feat(agents): W2/S2 doc pipeline two-mode + last inline conversions (BDR-077)

doc-syncer: ONE agent, TWO dispatch modes around the dispatcher's gate —
MODE: audit (model="opus" call-site override, READ-ONLY, drafts + PATCH
PLAN) / MODE: patch (sonnet pin, applies the APPROVED plan, shape oracle
w/ revert-on-fail, emits CHANGE SUMMARY + PATCHED_FILES). Deviation from
plan's 2-file split, per the challenge's own commit-changer mode
precedent: zero text duplication, zero lock moves. Fixes a LATENT DEFECT:
/doc dispatched an agent whose STEP 8 gate could never fire (dispatched
agents cannot ask) — the gate now lives in the dispatcher (DISPATCHER
PROTOCOL section). doc-commit.md consumes the patcher's CHANGE SUMMARY
(the in-thread context now crosses the dispatch boundary, LRN-126).
Consumers rewired: /doc (audit→gate→patch→commit), onboard (audit
report-only, opus), doc-commit steps in bugfix/hotfix/feat/ship-feature/
init-project(5b+10c); scaffolder loses PHASE 6 (README = init 5b's job);
scaffolder + onboarder now DISPATCHED in init-project/onboard (pins live,
was inline on session model). In-wave planted-drift smoke PASSED
end-to-end, disk-verified (audit caught npm-run-dev drift → [MINOR] plan
→ patch applied → summary crossed). Census §14-15 (103 pass), make test
exit 0. Typed plugin-probe dispatch resolution verified post-restart.
This commit is contained in:
Bastien Chanot
2026-07-19 22:28:09 +02:00
parent 74528a6910
commit 18075a38db
11 changed files with 213 additions and 97 deletions
+23 -8
View File
@@ -18,13 +18,28 @@ allowed-tools:
- Agent
---
Dispatch the doc-syncer as a subagent so its `model: sonnet` pin takes
effect (doc-sync = execution, not the session's big model):
Run the two-mode doc pipeline (BDR-077 — audit judgment on opus, patch on
the sonnet pin, the validation gate in THIS loop; a dispatched agent cannot
hold a gate):
Agent(subagent_type="doc-syncer")
prompt: "Audit + sync public docs for this project. Context from the user:
$ARGUMENTS. Report PATCHED_FILES and a summary — do NOT commit."
1. AUDIT — dispatch:
`Agent(subagent_type="doc-syncer", model="opus")`
prompt: "MODE: audit. Audit public docs for this project. Context from
the user: $ARGUMENTS. Emit the DOC SYNC REPORT + PATCH PLAN — no writes."
Then commit the patched docs from THIS loop per `$HOME/.claude/lib/doc-commit.md`
(surgical: only doc-syncer's PATCHED_FILES, never `.claude/`/`CLAUDE.md`,
no-op if nothing patched).
2. GATE — present the report and run the DOC SYNC — VALIDATION GATE from
the agent's DISPATCHER PROTOCOL (AUTO yes/select/cancel; HUMAN, CREATE,
CLEAN per-item; README CREATE has no skip). Wait for explicit approval.
`DOC SYNC: all docs current` → stop here.
3. PATCH — re-dispatch:
`Agent(subagent_type="doc-syncer")` (sonnet pin)
prompt: "MODE: patch." + the APPROVED PATCH PLAN verbatim (approved item
lines + rendered drafts for approved CREATE items). A `SHAPE ESCALATION`
in its report → re-gate the named set here, then re-dispatch patch with
the kept subset.
4. COMMIT — from THIS loop per `$HOME/.claude/lib/doc-commit.md` (surgical:
only the report's `PATCHED_FILES`, summary composed from its
`CHANGE SUMMARY` block, never `.claude/`/`CLAUDE.md`, no-op if nothing
patched).