Skip to content

refactor(adapters): move feature usage out of the resident bootstrap - #46

Merged
whitelonng merged 2 commits into
mainfrom
experiment/guidance-slim
Oct 24, 2026
Merged

whitelonng merged 2 commits into
mainfrom
experiment/guidance-slim

Conversation

@whitelonng

Copy link
Copy Markdown
Owner

Summary

The resident bootstrap (loaded into every agent session) grew ~35% after the September simplification, mostly from feature-specific usage text. This PR keeps invariants and one-line triggers in the bootstrap and moves the rest to where it is read on demand.

  • Context index protocol: kept only in mode entries. The bootstrap keeps the entry command and the post-compaction refresh rule (mode entries may not survive compaction).
  • Progress page: usage moved to mancode progress --help, marked operator-requested only.
  • Secrets: usage moved to mancode secret --help; bootstrap keeps the never-in-chat / no-plaintext invariant. Help states only the operator sets secrets and approves actions.
  • UI: three bullets merged into one, keeping the content-emoji exception, the no-emoji fallback, and "broad adjectives are not a selected direction". Details come from mancode design context.
  • Guidance budget test: tests/adapter-guidance-budget-contracts.test.ts caps cl100k tokens per platform and entry (tests/fixtures/guidance-budget.json). It is a ratchet and review trigger, not a quality metric.
  • Docs: docs/platform-adapters.md describes where each kind of rule now lives.

Codex bootstrap: 2530 → 1947 tokens (−23%). Mode entries: about −100 each (progress text removed). The man entry (~7.7k) is not touched here.

Behavioural check

Blind A/B of baseline (77fb169) vs this branch on four scenarios: ordinary Solo edit, task needing a secret, "make it modern and clean" UI request, resuming an existing TaskRef. Scored mechanically from final project state and tool-call logs.

  • Claude haiku + sonnet (subagents with the fixture's CLAUDE.md): 16/16 pass.
  • GPT-6 via Codex: 11/11 pass, including an S2 rerun.
  • Baseline progress text caused one unrequested progress init / progress refresh (GPT-6, S4). This branch did not.
  • One slim S2 run read mancode's bundled source to learn action approval. After the operator-only note was added to secret --help, two reruns did not.

Limits: one or two runs per cell, Claude side emulated via subagents, post-compaction behaviour not tested.

Test plan

  • npx tsc --noEmit, npx biome check src tests
  • Full vitest run: 1744 passed. 2 failures are pre-existing on main and unrelated: man-delivery 5s timeout (~590 git subprocesses per test), and a macOS-only secrets executor bug where a second kill returns EPERM and overwrites OUTPUT_LIMIT (src/secrets/run.ts). CI runs ubuntu only, so neither shows there.

Notes

  • Installed adapters will report stale after release and need adapter upgrade. Plan is to release this together with the upcoming man entry slimming so users upgrade once.
  • Follow-up experiment/cli-recovery-hints (stacked on this branch, no PR yet) adds error.recovery hints for MANCODE_TASK_REQUIRED / MANCODE_SESSION_REQUIRED. It waits on hints for migrate, upgrade and install.

The resident bootstrap had grown about 35% since the September
simplification, mostly from feature usage text that only governed or
feature-specific sessions need. Keep invariants and one-line triggers in
the bootstrap and move the rest to where it is read on demand:

- Context index reading protocol now lives only in the mode entries; the
  bootstrap keeps the entry command and the post-compaction refresh rule.
- Progress page usage moves to `mancode progress --help`, marked as
  operator-requested only.
- Secrets usage moves to `mancode secret --help`; the bootstrap keeps the
  never-in-chat / no-plaintext invariant. The help also states that only
  the operator sets secrets and approves actions.
- UI guidance merges into one bullet that keeps the emoji content
  exception, the no-emoji fallback rule and the "broad adjectives are not
  a selected direction" rule; details come from `mancode design context`.

Add a guidance budget contract test (cl100k token caps per platform and
entry) as a ratchet: growth fails until the fixture is edited explicitly.

Codex bootstrap: 2530 -> 1947 tokens. Behavioural A/B on four scenarios
(Claude haiku/sonnet via subagents, GPT-6 via Codex) found no regression;
the baseline progress text caused one unrequested `progress init`, which
the new wording removes.
@whitelonng
whitelonng merged commit b44e92c into main Oct 24, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant