Compare commits
65
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b58d8857cd | ||
|
|
e8c061e4f0 | ||
|
|
39cf9ddbde | ||
|
|
19dfe7eb86 | ||
|
|
68a4d8b805 | ||
|
|
3663f87fe3 | ||
|
|
8826699a6f | ||
|
|
500f88638a | ||
|
|
1dedf9056d | ||
|
|
c62ee9c5cf | ||
|
|
4bd0af6753 | ||
|
|
b71db282f0 | ||
|
|
6be066957c | ||
|
|
7979b9bfaf | ||
|
|
28e5feb80a | ||
|
|
db7a18f525 | ||
|
|
6e455361db | ||
|
|
3ffd81f3a5 | ||
|
|
77aac4b73e | ||
|
|
7d09837854 | ||
|
|
63f5fa4a9c | ||
|
|
c6f2dad39a | ||
|
|
52689ae535 | ||
|
|
82dee85f8a | ||
|
|
1ec72d918f | ||
|
|
17a60fd5ef | ||
|
|
87566e2a1e | ||
|
|
af846d6dbe | ||
|
|
9d4d10b1fc | ||
|
|
4a8dffb0ba | ||
|
|
9f8cf974a2 | ||
|
|
b120ba50b6 | ||
|
|
4bb0a95534 | ||
|
|
981472033a | ||
|
|
c7d3677350 | ||
|
|
366f1f63bd | ||
|
|
6e3c811998 | ||
|
|
8f23683ef2 | ||
|
|
575408cdc7 | ||
|
|
8733669373 | ||
|
|
49cc13ccb6 | ||
|
|
51f343f79c | ||
|
|
78aad7db1a | ||
|
|
55edd0a6c7 | ||
|
|
2b7aeb8605 | ||
|
|
858bd41782 | ||
|
|
ce8d1b1dfb | ||
|
|
2d8e4578d3 | ||
|
|
15c6d096c2 | ||
|
|
482fd37808 | ||
|
|
44dc0b3015 | ||
|
|
c25a7ea017 | ||
|
|
2a5e3a41d8 | ||
|
|
6c4d24fcc4 | ||
|
|
019bacd5a5 | ||
|
|
0ceaa580c3 | ||
|
|
5bc64f4c3a | ||
|
|
bfcf21aa91 | ||
|
|
9917ade7a7 | ||
|
|
6022b9dfb9 | ||
|
|
25660542d3 | ||
|
|
24354d9b68 | ||
|
|
f48343e2d7 | ||
|
|
b11d642841 | ||
|
|
d659e25d8d |
No files matched your search
@@ -106,12 +106,42 @@
|
||||
- lib/model-gate.md `fixed at spawn` row: inside a sub-agent the gate proceeds whatever model the child really runs on (the route answer names no id); fix direction: print the spawn id from `agentModels` in `routedText` ("fixed at spawn: <id>") and keep the id check. The repo-wide fable census (lib/tests/model-routing.test.sh) uses `git grep` (tracked files only) and the regex `model ?[:=] ?"fable"` (misses single quotes and unquoted frontmatter); skills/tour runner inherits the session model by design (BDR-084), so a hand-picked Fable session runs it on Fable. Severity: low. Discovered while: /feat fable-pins-to-opus security gate and verifier. Not fixed.
|
||||
- CLAUDE.global.md § Workflow + lib/effort-shift.md § Advisor: "sub-agents do not" call the advisor is prose only; sub-agents get the advisor tool listed and the harness prompt tells them to call it (seen live in this run's challengers and gates), each call forwarding that agent's whole transcript to Fable outside the router's caps (cost, BLK-030 credits). Fix direction: a mechanical scope (advisorModel for the main session only, if the CLI allows it), else accept. Severity: low. Discovered while: /feat advisor-doctrine plan challenge and security gate. Not fixed.
|
||||
SUPERSEDED 2026-11-17 (6ef3069, /feat advisor-call-points): plan-challenger, verifier, security-auditor now may call it at most once before the verdict; other sub-agents do not. Residual kept: still prose only, and the harness prompt asks sub-agents for "at least once before … and once before declaring done" (a verifier made 2 calls on 2026-11-16), against "at most one call". Severity: low.
|
||||
FIX SHIPPED, UNVERIFIED 2026-11-20 (7979b9b 6be0669 b71db28, /ship-feature advisor-subagent-scope): no tool filter removes the advisor (probed), so the rule rides each sub-agent's own text (allowed agents "one call allowed", never-call lines in opus agents and briefs, opus code review one call) + SubagentStart hook hooks/subagent-advisor.sh + standalone SDD workers on sonnet. FIXED once the dated TODO behavioural check passes.
|
||||
- agents/security-auditor.md:166 (advisor bullet) — "overrides the STEP 2 mapping for that finding only" has no direction: read alone, an advisor "raise" into a lower STEP 3 class could take a semgrep HIGH out of BLOCK(n); only the closing "never removes, lowers or waives" stops it. Fix direction: "overrides it upward only". Severity: low. Discovered while: /feat advisor-call-points security gate r5 (advisor-sourced LOW). Not fixed.
|
||||
FIXED 2026-11-17 (24354d9, /ship-feature advisor-points-b2): a raise applies only when its class's severity is higher than the finding's own; a raise that does not apply, or matches no class, changes nothing (no tag, no PROOF count); "Advice never removes, lowers or waives" kept.
|
||||
- agents/verifier.md + agents/security-auditor.md advisor bullets — not scoped to dispatch (analyzer's is, 58a5273); lib/verify-secure-loop.md:54,:96 still allow "or load agents/<x>.md" inline, where the gate's own call would be a main-loop call and void the stuck-call unit "no main-loop advisor call since GATE 0 first ran". No skill takes the inline path today. Fix direction: "when dispatched" in both bullets. Severity: low. Discovered while: /feat advisor-points-b1 re-challenge. Not fixed.
|
||||
FIXED 2026-11-17 (24354d9): verifier, security-auditor and plan-challenger read "Advisor, when dispatched as a sub-agent". Residual kept: lib/verify-secure-loop.md:57-58, :106-107 still offer "or load agents/<x>.md" inline (unused today).
|
||||
- agents/plan-challenger.md ORCHESTRATOR PROTOCOL (~:111-112, :133-135) — mirror of lib/challenge-plan.md lacks the main-loop "Advisor first" step and the CHALLENGE SUMMARY `Advisor:` row (58a5273); the 12 skills' own summary templates also lack the row (lib rule says append it anyway). Fix direction: patch the mirror, optionally add the row to the templates. Severity: low. Discovered while: /feat advisor-points-b1 re-challenge. Not fixed.
|
||||
FIXED 2026-11-17 (24354d9): the mirror gains ADVISOR FIRST (pointer to the lib, its guards) and the `Advisor:` row. Residual kept: the 12 skills' own CHALLENGE SUMMARY templates still lack the row.
|
||||
FIXED 2026-11-18 (2b7aeb8, run B3): the 12 callers' CHALLENGE SUMMARY templates carry the `Advisor` row (9 block rows, 3 one-line summaries).
|
||||
|
||||
<!-- /ship-feature advisor-points-b2 2026-11-17 (f48343e, 24354d9, 6022b9d): review residuals, not fixed in the run -->
|
||||
- skills/tour/SKILL.md STEP 0b item 2 — in fan-out the end-of-run advisor call sees only the runners' one-line rows (no diff, no report section), and a `RUNNER FAILED` row can hide fixes already committed, so "when any row reports a fix" can skip the call. Fix direction: read each REPORT's new section (or `git -C <p> diff --stat develop..<branch>`) before the call. Severity: low. Discovered while: /ship-feature advisor-points-b2 STEP 6 review.
|
||||
- lib/effort-shift.md § Advisor item 3 + lib/verify-secure-loop.md stuck unit — after a fix the end call drives, the re-run gates find a main-loop call "since GATE 0 first ran", so the stuck call is already spent on that re-gate; the budget is plausible but unstated. Wording: "the six flows that run the gates" unnamed; "a later proposal" fits finish flows only; in feat/bugfix the doc and memory commits after the call always make "predates the newer commits" true; item 3 and the CHANGELOG say "the end step" of feat and bugfix, where the call sits at their commit step (STEP 5 / STEP 6), before doc sync and capitalize (the skill lines are placed right). Severity: low. Discovered while: /ship-feature advisor-points-b2 SDD final review and STEP 6 review.
|
||||
PARTLY FIXED 2026-11-18 (2b7aeb8, run B3): item 3 names the six gate flows, puts feat/bugfix at their commit step, and replaces "predates the newer commits" with "names any code commit made after it (doc and memory commits excepted)". Open: the stuck-budget half.
|
||||
- skills/release-candidate/SKILL.md STEP 4 — the end call's `route(phase="reflect")` has no route back, so STEP 5 (finish and tag) runs at reflect against an apply/low row. Severity: low (cost). Discovered while: same.
|
||||
- skills/{feat,bugfix,audit-delta,tour}/SKILL.md summary templates — FEAT/BUGFIX/AUDIT-DELTA/TOUR COMPLETE have no `Advisor:` field (only the prose asks for the line), and the end call has no "not called (absent | error | skipped)" wording like the CHALLENGE SUMMARY row. Severity: low. Discovered while: same.
|
||||
PARTLY FIXED 2026-11-18 (2b7aeb8, run B3): FEAT and BUGFIX COMPLETE carry `ADVISOR : <one-line answer | skipped (gates clean on first pass) | not called (absent | error)>`. Open: audit-delta and tour.
|
||||
- skills/{ship-feature,init-project}/SKILL.md — the end call runs after STEP 6/10 code review, capitalize and doc sync; a fix it drives re-runs the gates but neither the code review nor the doc sync. Severity: low. Discovered while: same.
|
||||
- agents/security-auditor.md STEP 5 dedup keys on (file:line, rule/check): an advisor-added `advisor:<class>` finding on a semgrep line counts twice in BLOCK(n) (pre-existing); "An added or applied finding" reads oddly; PROOF suffix for n=0 unspecified. Severity: low. Discovered while: same.
|
||||
|
||||
<!-- /hotfix doctor-skilloverrides-residue 2026-11-14: non-blocking gate finding, not BDR-125 -->
|
||||
- doctor.sh `warn`/`pass`/`fail` print through `echo -e`: jq's `\uXXXX` escapes in the residue diff (:153) come back as raw control bytes (ESC sequences) on the terminal. Source = the user's own tracked settings.json (no trust boundary). Fix direction: `printf '%s\n'` in the shared helpers. Severity: low. Discovered while: /hotfix doctor-skilloverrides-residue security gate. Not fixed.
|
||||
|
||||
<!-- /bugfix perl-timeout-group 2026-11-14 (490ad83): non-blocking gate findings, not BDR-125 -->
|
||||
- hooks/session-start.sh perl runner sends KILL to the group at the deadline (timeout sends TERM): a WRITER later put under `_SS_TMO` would skip memory.sh's INT/TERM/HUP restore trap and leave `memory.lock` until the 30 s steal. Today's three callers are readers (check, index blocker, feedback remind). Severity: low. Discovered while: /bugfix perl-timeout-group security gate. Not fixed.
|
||||
|
||||
<!-- /ship-feature advisor-points-b3 2026-11-18 (2b7aeb8, 51f343f): STEP 6 review root fix, not in the run's file scope -->
|
||||
- lib/verify-secure-loop.md:111,:126-128 + agents/security-auditor.md:184,:190-192 — teach parsing DEGRADED off the `SECURITY — VERDICT:` line, but the auditor prints `VERDICT: PASS` on a DEGRADED scan and DEGRADED only on its `TOOL:` line (agents/security-auditor.md:133-134). A reader checking the VERDICT line misses it. feat/bugfix skip text now names the TOOL line at the site (51f343f). Fix direction: say DEGRADED shows on the TOOL line beside a PASS, in both. Severity: low. Discovered while: /ship-feature advisor-points-b3 STEP 6 opus review.
|
||||
FIXED 2026-11-19 (9814720, /bugfix degraded-tool-line): the three readers (+ hotfix) read the `TOOL:` line inside the PASS bullet, the VERDICT-line `DEGRADED` value is gone, a PASS without `TOOL:` is structural; lib/effort-shift.md item 3 names the line; loops-light locks it.
|
||||
- Run B3 residuals (plan purged at finish, recorded here): (a) the challenge route line pairs `mcp__model-router__route` with the server-side advisor call, unverified in this repo (lib/effort-shift.md: the router cannot see the advisor tool; pairing only saves a request). (b) skills/{feat,bugfix} end line prints the diff stat even on a skip (cost one cheap command, nothing reads it). (c) lib/effort-shift.md item 3 "Two skips only" sentence ~65 words; feat/bugfix end-line first sentence ~60 words (prose length, oracle-safe splits exist). (d) contract 2026-11-18-advisor-points-b3-1056 criterion 9 says the exempt rows "run as wide as the rows beside them"; they run wider (Advisor rows 125-132 cols vs 77-96), wording only. Severity: low. Discovered while: /ship-feature advisor-points-b3 STEP 2b/STEP 6.
|
||||
|
||||
<!-- /bugfix degraded-tool-line 2026-11-19 (9814720): confirmation-pass minors, pre-existing, not fixed -->
|
||||
- A DEGRADED scan that BLOCKs and hits the cap: the STOP/escalation text (lib/verify-secure-loop.md, agents/security-auditor.md) does not name the missing semgrep or `make plugin`, so the human sees a checklist-only BLOCK without the remedy. Severity: low. Discovered while: /bugfix degraded-tool-line STEP 3b.
|
||||
- DEGRADED is read by word presence on the `TOOL:` line: a garbled `TOOL:` line (no `semgrep <ver>`, no DEGRADED) reads as a full scan. Fix direction: allowlist `TOOL: semgrep <ver>` as the only full-scan shape, anything else DEGRADED or structural. Severity: low. Discovered while: same.
|
||||
|
||||
<!-- /feat merge-reuse-clause 2026-11-19 (af846d6): executor report -->
|
||||
- Run 1 feater: first full `make test` exited `make: *** [Makefile:36: test] Error 1`, suite unknown (only the tail captured); rerun green, GATE 0 + verifier make test green, no stray process after. Possibly a flaky suite or overlap with the scratch-clone `make test` running at the same time (the scratch run's only red was run-reconcile T6c = darwin-skill path absent in a fresh clone, environment). Next red: keep the full log, name the suite. Severity: low. Discovered while: /feat merge-reuse-clause STEP 3.
|
||||
|
||||
<!-- /feat advisor-usage 2026-11-19 (c6f2dad): GATE 0 first run -->
|
||||
- lib/tests/mods.test.sh: `FAIL model-router: plugin test timed out after 120s` in a full make test at load avg ~30; the suite alone took 121 s (CLI_TIMEOUT=120 at :12) and passed. Probable cause of the run 1 feater's unexplained red (entry above). Fix direction: raise CLI_TIMEOUT for the plugin test or cut its runtime. Severity: low. Discovered while: /feat advisor-usage GATE 0.
|
||||
@@ -424,3 +424,9 @@ rules:
|
||||
- **Real cause**: lib/memory.sh `memory_index` `[ -f "$file" ] || continue` treated present non-regular registry as absent; awk rc of `_mem_index_rows` dropped (fn rc = trailing echo). hooks/session-start.sh `_digest_blockers` skipped unparsable `| BLK-` rows.
|
||||
- **Solution**: 87aecc1. Kind named (strict) → rc 2 + stderr `memory: <file>: not a readable regular file`; no kind (lax, mods/memory register.ts recall) → skip bad registry + stderr, rc 0. Rows captured before print, healthy output byte-identical. Digest prints `- open: unknown (memory.sh index failed)` on unparsable row. Tests SD9b/c re-pinned, SD9f/g/h, T20*. Residuals BUGS-FOUND 07f9a7f.
|
||||
- **Reference**: lib/memory.sh, hooks/session-start.sh, lib/tests/memory.test.sh, lib/tests/session-digest.test.sh
|
||||
|
||||
## BLK-051 — DEGRADED security scan read as clean PASS: readers parsed VERDICT line, DEGRADED prints on TOOL line [resolved] (2026-11-19)
|
||||
- **Friction**: DEGRADED security scan (semgrep absent) read as clean PASS: checklist + `make plugin` hint never surfaced, hotfix `SECURITY: DEGRADED (checklist only)` unreachable.
|
||||
- **Real cause**: security-auditor prints `SECURITY — VERDICT: PASS` on DEGRADED scan, DEGRADED only on `TOOL:` line. lib/verify-secure-loop.md, agents/security-auditor.md ORCHESTRATOR PROTOCOL, skills/hotfix/SKILL.md STEP 4 listed `DEGRADED` as VERDICT-line sibling value after terminal `PASS` bullet → never fired. PASS without `TOOL:` line not structural → also read as full scan. Shipped in v3.0.0.
|
||||
- **Solution**: 9814720. PASS bullet reads `TOOL:` line first; old DEGRADED bullets removed; PASS without `TOOL:` = structural (retry once, escalate). lib/effort-shift.md item 3 names line (LRN-300). loops-light section locks readers + feat/bugfix skip sentence (78/78; 16 FAIL on develop). Residual minors BUGS-FOUND 2026-11-19.
|
||||
- **Reference**: lib/verify-secure-loop.md, agents/security-auditor.md, skills/hotfix/SKILL.md, lib/effort-shift.md, lib/tests/loops-light.test.sh, BUGS-FOUND:134
|
||||
@@ -1611,3 +1611,12 @@ Supersedes [[BDR-030]].
|
||||
- **Status (2026-11-17)**: accepted, completed: pins opus beebfe2 (gate row 'fixed at spawn' passes a pinned sub-agent), doctrine c3507ea (main loop calls advisor, sub-agents do not, absent advisor -> proceed, advice waives no gate)
|
||||
- **Status (2026-11-17)**: accepted, amended 6ef3069: main loop named call points (before a skill's plan, once per verify-secure run at first gate loop failing twice, before merge); plan-challenger/verifier/security-auditor at most one call before verdict, advice add-only (security: STEP 3 class severity, no class -> REPORTED LOW); other sub-agents do not
|
||||
- **Status (2026-11-17)**: accepted, amended 58a5273: plan point in lib/challenge-plan.md (on written plan before challengers, once per skill run, Advisor: row in CHALLENGE SUMMARY, no attribution in plan); stuck lines inline in verify-secure-loop (main-loop calls only since GATE 0); dispatched analyzer joins; trigger before recommending doctrine/architecture/public-interface change
|
||||
- **Status (2026-11-17)**: accepted, amended 6022b9d: B2 stuck trigger in 6 gate skills (points to verify-secure-loop); end-of-run call before done/merge in feat, bugfix, ship-feature, init-project, a11y, guardrails, audit-delta+tour (fix applied only), release-candidate STEP 4; own budget; gate flows print diff stat, fix back through gates; verifier/security-auditor/plan-challenger advise only when dispatched; auditor raise upward only; plan-challenger protocol mirror. Commits f48343e 24354d9 6022b9d
|
||||
- **Status (2026-11-18)**: accepted, amended 51f343f: B3: challenge route rides first lib/challenge-plan.md call; summary Advisor row in 12 callers; feat/bugfix skip end call when GATE 0 MET + verifier CONFORME + security PASS (not DEGRADED, TOOL line) first attempt, ADVISOR field shows skip; item 3 reuse clause names later code commits
|
||||
- **Status (2026-11-20)**: accepted, amended 7979b9b..b71db28: allowed set + opus code review (ship-feature STEP 6, init-project STEP 10, standalone SDD final) one call via brief; never-call lines in opus agents/briefs; SubagentStart hook hooks/subagent-advisor.sh backstop; standalone SDD workers sonnet; Advisor row reason sub-agent
|
||||
|
||||
## BDR-151 — Done and triage levers: done = oracles green, MINOR fold-or-drop, placed-decision skip, contract dry run, TODO +n/-m [accepted] (2026-11-20)
|
||||
- **Decision**: six done/triage levers adopted (user 2026-11-20). Done = GATE 0 MET + verifier CONFORME + security PASS on same diff; later review reopens only with reproducible evidence (command failing on HEAD, real output shown wrong); scenario → one try to make it a failing command, else MINOR. MINOR on plan/diff: fold before dispatch or drop as `MINOR dropped:` line (report + run plan), never TODO/BUGS-FOUND/registry; security finding never droppable → user. Challenge skip for placed decision: text dictated by decision, decision = user's own words or challenged in run that wrote it, caller runs verify-secure-loop after dispatch. Contract dry run before dispatch: `- run-base: <sha>` in contract + `gates.sh run` on mktemp copy. TODO loop notes start SHA in TODO.md. Memory-commit report ends `· TODO +n / -m`, counted before step 2. Verifier STEP 4: added plan files, appended `MINOR dropped:` lines, handed contract (whole if untracked, else EVIDENCE/run-base/[gated]) in scope.
|
||||
- **Why**: session c9afbcbf open TODO 44→50 while closing items; MINOR→backlog was habit, no rule; challenge on placement runs found no MAJOR; verifier ECARTS were own contract bookkeeping.
|
||||
- **Alternatives rejected**: TODO cap/expiry (cap 10 starts violated); "fix if under five minutes" post-gate exit; base from merge-base (overcounts multi-run branch) or pending diff only (misses earlier commits); verifier exempting whole `.claude/tasks/plans/` (142 durable plans, BDR-065 amendment).
|
||||
- **Reference**: 19dfe7e, 39cf9dd, docs e8c061e; handoff plan .claude/tasks/plans/2026-11-20-done-and-triage-levers.md; contract .claude/tasks/contracts/2026-11-20-done-triage-levers-1413.md. Follow-up /feat (contract-interview, ship-feature STEP 6, init-project STEP 10, run_base `--end-of-options`, [gated] only untracked) open in TODO.
|
||||
@@ -461,3 +461,10 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
||||
- **Result**: 3.0.0 cut; E1/E2/G/H1-H7/BLK-049/Fable 5.2/perl runner merged, all `make test` green; F faunosteo branch ready (user merges). Every phase 0/0b/4a/1/5/2/4b-4d TODO line closed, BUGS-FOUND BDR-125 items fixed or closed with reason.
|
||||
- **Anomalies**: (1) gates caught what executors missed: H6b verifier ECARTS (profile.test.sh:123 comment silenced shellcheck from that line on; my brief said "counts equal to HEAD", gate said "clean"); perl plan r1 FATAL(3) (impossible digest assertion without tty, single quotes = SC2016, timeout(1) misread) and r2 still let a fast-failing runner pass timing-only tests. (2) my own slips: contract without EVIDENCE lines (H7, gates ERROR), reconcile loop misused `reconcile_blk_open`, awk print `" || "` tripped our own H4a deny row. (3) E3 npm -g edit refused by auto-mode classifier twice → user hand edit. (4) one feater died on API 403 mid-run, gates proved its diff. (5) doc audits found real drift twice (CLAUDE.global.md `open: unknown` clause, MIGRATION step 1 restoring enabledPlugins only).
|
||||
- **Action**: keep fresh gates + confirmation challenger (they paid every time); briefs quote the contract criterion verbatim, never paraphrase it; LRN-289/290 written; gates.sh label guard TODO stays.
|
||||
|
||||
## EVAL-060 — /feat done-triage-levers: r1 9 MAJOR on unrecorded base, r2 2 MAJOR in r1 fixes, gates first pass (2026-11-20)
|
||||
- **Subject**: /feat done-triage-levers 2026-11-20 (6 doctrine levers, 5 files + 1 gated citer).
|
||||
- **Method**: advisor on plan, 3-lens challenge r1, 1 confirmation r2, GATE 0/1/2, positive control on untouched tree, scratch-clone simulation each revision.
|
||||
- **Result**: advisor 5 pre-challenge fixes (exact prose in plan, criterion 12 oracle, TODO n/a, pass B batch). r1: 9 MAJOR → 5 distinct; all 3 lenses converged on unrecorded `base`; 2 on verifier scope too wide (142 durable plans). r2: 2 MAJOR inside r1 fixes (count after commit = silent 0; DONE claimed to bind ship-feature/init-project act sites unchanged). Gates first pass: MET 12/12, CONFORME, PASS (semgrep). Citer re-loop (effort-shift) MET 13/13, CONFORME, PASS.
|
||||
- **Anomalies**: first dogfood of triage: GATE 2 REPORTED 2 items (run_base option injection LOW, [gated] lines on tracked contract) routed to user, not dropped → follow-up /feat. Census reads `§ Advisor point 1` as heading name (LRN-296 again). Doc-sync found un-patched citer (effort-shift § Advisor point 1).
|
||||
- **Action**: challenge earned cost on a mechanism run (keep). Follow-up /feat + MEASURE line in TODO. Rule "rule changed → patch citers" needs a grep for every `§ <heading>` the change discharges, before the plan.
|
||||
@@ -776,3 +776,17 @@ rules:
|
||||
- Advisor doctrine (c3507ea, docs): CLAUDE.global § Workflow + effort-shift § Advisor: main loop calls Fable advisor (approach, stuck, before done), sub-agents do not (they have tool listed: prose-only, residual), absent → proceed, advice waives no gate/cap/guard. Stale Fable prose → opus (effort-shift, challenge-plan, plan-challenger, tour). BDR-150 change complete: router 24b0f35, pins beebfe2, doctrine c3507ea.
|
||||
- Advisor call points run A (6ef3069): transcript count showed main loop 2 calls on Opus (409k/680k uncached) vs 18/20 opus sub-agents on Fable (~70k); doctrine now names main-loop points (plan, first gate loop failing twice, merge) + judgment agents once, advice add-only; 2 challenge rounds, gates found block E double count, fixed r5. Runs B, C next.
|
||||
- Advisor run B1 (58a5273): plan point moved into lib/challenge-plan.md (once per skill run, Advisor: row), stuck lines inline in verify-secure-loop (main-loop calls only), analyzer joins, trigger for doctrine/architecture/public-interface recommendations. 2 challenge rounds (2 BLOCKERs were my own oracle markers), scratch simulation then MET first run; gates sequential, CONFORME + PASS.
|
||||
- Advisor run B2 (/ship-feature, f48343e 24354d9 6022b9d): stuck line in 6 gate skills, end-of-run call at each flow's end step (9 flows, capitalize-commit untouched), 3 judgment agents dispatch-scoped, auditor raise upward only; plan r3 after 3 lenses + confirm; STEP 6 review fix restated fix path in skills (LRN-297); gates green first pass and after fix. Merge waits for user go.
|
||||
|
||||
## 2026-11-18
|
||||
- gates.sh hotfix c25a7ea (bugfix/gates-label-timeout): digit label not `N. text` = parse error; 2nd CHECK/EXPECT/EVIDENCE on one criterion = error (indented/bullet/bold labels gave same false MET, advisor caught it); no-criteria die names first parse error; default timeout 120 -> 600. GATE 0 MET 5/5 incl full make test at default, security PASS, 3 challengers SOLID. ABANDON-id aliasing + verify-secure-loop cause list -> TODO.
|
||||
- Advisor run B3 (/ship-feature, 2b7aeb8 51f343f): 12 callers route rides first challenge-plan call + summary Advisor row; feat/bugfix skip end call on strict clean gates (MET, CONFORME, PASS not DEGRADED, first attempt), ADVISOR field; item 3 commit step + reuse names later code commits. 3 lenses + re-challenge (3 MAJOR fixed), opus STEP 6 caught DEGRADED on TOOL line (LRN-300). Gates clean x2.
|
||||
|
||||
## 2026-11-19
|
||||
- /bugfix degraded-tool-line 9814720: 3 security readers read DEGRADED off TOOL line (BLK-051), BUGS-FOUND:134 FIXED, TODO:13 done, 2 pre-existing minors logged; CHANGELOG Fixed entry.
|
||||
- /feat x2 merge-reuse (af846d6, 87566e2, feature/advisor-merge-reuse): 6 gate-flow end lines restate effort-shift item 3 merge-reuse clause, loops-light 97; TODO:14 done, 3 follow-ups logged; run 1 GATE 0 ERROR = contract without EVIDENCE: pending (LRN-173 again).
|
||||
- Run C /feat advisor-usage (c6f2dad + retention fix, feature/advisor-usage): FEEDBACK.md advisor usage table per caller/model, reconciled vs probe (156 calls, 21.7M); found general-purpose sub-agent advisor leak (30 calls, 7.1M) → TODO; LRN-301 (call = served iteration), LRN-302 (scratch develop ref); mods.test.sh timeout under load → BUGS-FOUND.
|
||||
|
||||
## 2026-11-20
|
||||
- /ship-feature advisor-subagent-scope (7979b9b 6be0669 b71db28): leak root cause = advisor server tool on every sub-agent, no filter, opus ignores CLAUDE.md attachment; rule moved into agent defs/briefs + SubagentStart hook + SDD sonnet pin; LRN-303; behavioural proof pending next usage table.
|
||||
- /feat done-triage-levers (19dfe7e 39cf9dd, docs e8c061e): six levers in verify-secure-loop/challenge-plan/capitalize-commit/verifier/CLAUDE.global + effort-shift citer. r1 3 lenses 9 MAJOR (unrecorded base), r2 2 MAJOR in r1 fixes; gates first pass. BDR-151 LRN-304 EVAL-060. Follow-up /feat (5 files) + MEASURE line in TODO. Branch UNMERGED.
|
||||
@@ -2140,3 +2140,49 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Context**: 2026-11-17 advisor runs A and B1. Markers broke three times: phrase wrapped across two lines (grep per line, count 0); awk `/X/{a=NR}` kept LAST match after a later block mentioned "X"; census extractor read word after `§ Label` as part of heading ("§ Workflow names"). Each would have cost a floor loop. Also `Nb.` criterion label absorbed by gates.sh (LRN-284). Simulation of B1 (apply.py on mktemp copy) passed 5/5 CHECKs; executor then got MET first run.
|
||||
- **Apply**: any /feat or /bugfix whose oracles are grep/awk markers on prose: write blocks to files, applier script with exact-once asserts, run CHECKs with `cd` swapped to the scratch copy; anchor awk on line start (`/^\*\*Label/`); keep each marker and each `§ Label` citation on one line followed by `)`/`;`. Give the executor the applier.
|
||||
- **Reference**: lib/gates.sh, lib/tests/doctrine-citers.test.sh, .claude/tasks/plans/2026-11-17-advisor-points-b1-1500.md, LRN-284
|
||||
|
||||
## LRN-297 — Single-source doctrine holds only where acting step loads cited lib (2026-11-17)
|
||||
- **Pattern**: rule kept once in lib + skills citing it works only if step that acts loads that lib. Citation alone not read at act time.
|
||||
- **Context**: 2026-11-17 run B2 STEP 6, 2 reviewers (sonnet SDD final, opus craft). Stuck lines fine: gate step loads `lib/verify-secure-loop.md`. End-of-run lines cited `lib/effort-shift.md` § Advisor, loaded only via ROUTING line, never at end step → diff stat + fix path (item 3) unseen; 3 of 9 lines already restated own path, 6 silent read as "report only". Parked ruling withdrawn, clause restated at 6 sites (6022b9d).
|
||||
- **Apply**: before keeping a procedure only in a lib, check acting step reads that lib (include it loads, not ROUTING line); else one clause at site, lib keeps full rule. Uneven restatement across sibling sites = misread by contrast.
|
||||
- **Reference**: lib/effort-shift.md § Advisor item 3, lib/verify-secure-loop.md, BDR-150, LRN-296
|
||||
|
||||
## LRN-298 — Marker oracles prove presence, not placement semantics (2026-11-17)
|
||||
- **Pattern**: marker oracles prove text present at position, not placement semantics. Need read of flow's own sequence: who executes site, when run is declared done, can condition be false.
|
||||
- **Context**: 2026-11-17 run B2: scratch-clone simulation 15/15 MET, yet challengers found end call after FEAT COMPLETE (done already printed), tour runners (sub-agents) execute STEP 3 holding main-loop call, skip "fixed or committed anything" always true (tour commits report each run). Fixed in plan r2/r3 before dispatch.
|
||||
- **Apply**: anchor position oracles on flow's done/merge moment (summary or finish line), not nearby heading; per site list executor (main loop vs runner/sub-agent) and falsifiable condition. Non-idempotent applier fix after commit: delta group from HEAD + byte-compare with fresh apply from base (review1 == fresh).
|
||||
- **Reference**: docs plan 2026-11-17-advisor-points-b2 (purged at finish, git keeps), LRN-296, LRN-284
|
||||
|
||||
## LRN-299 — Cursor parser: refuse the overwrite at the sink, not the label shapes at the source (2026-11-18)
|
||||
**Context**: gates.sh hotfix c25a7ea (2026-11-17). LRN-284 named `1b.` label: parser drops it as prose, cursor `_CUR` still on previous criterion, stray CHECK/EXPECT overwrite its oracle → false MET. First plan: reject `^[0-9]` non-`N. text` lines. Advisor + scratch fixtures: indented ` 2.`, `- `, `**2.**` labels gave same false MET.
|
||||
**Pattern**: line parser with current-record cursor → close overwrite at sink: refuse second write of already-set field (`_set_attr` guard), not enumerate bad label shapes at source. Source-side rule only names the common shape (better error message).
|
||||
**Apply**: any cursor parser (contract ledger, registry, config sections). Before fixing a reported bad input shape, fixture sibling shapes (indent, bullet, bold) against the same sink; scan existing data for repeated fields first so guard changes no past verdict.
|
||||
|
||||
## LRN-300 — Rule keyed on a gate verdict names the line its qualifier prints on (2026-11-18)
|
||||
**Context**: advisor run B3 (2b7aeb8, 51f343f). feat/bugfix skip end-of-run advisor call when security PASS "(not DEGRADED)". security-auditor prints `SECURITY — VERDICT: PASS` on DEGRADED scan; DEGRADED only on `TOOL:` line (agents/security-auditor.md OUTPUT), while lib/verify-secure-loop.md teaches reading DEGRADED off VERDICT line → reader checks wrong line, wrong skip. 3 lenses + re-challenge missed it; opus STEP 6 caught it.
|
||||
**Pattern**: rule keyed on gate verdict must name the line its qualifier prints on. Agent OUTPUT format = source of truth, not the doctrine paraphrasing it.
|
||||
**Apply**: before writing a condition on an agent's verdict, grep that agent's OUTPUT block for where each qualifier prints; state the line at the site.
|
||||
|
||||
## LRN-301 — Advisor call = served advisor_message iteration, not request block; reconcile usage table vs independent probe (2026-11-19)
|
||||
- **Pattern**: advisor call = served `advisor_message` iteration in `message.usage.iterations[]`, not `server_tool_use` block named `advisor`. Block without iteration = request never run (sent beside client tool_use, re-issued next message) or `advisor_tool_result_error`. Count iterations, dedupe by `message.id`. Usage table built from transcripts: reconcile row by row against independent probe (other language, same window, same instant) before calling it right; gates re-running same code prove nothing about real numbers.
|
||||
- **Context**: 2026-11-19 Run C (/memory-feedback advisor usage, c6f2dad). Real transcripts: 147 blocks vs 141 iterations (5 unrun, 1 error). Python probe vs bun table: 8 rows identical, 156 calls 21.7M input tok. First table exposed leak: general-purpose sub-agents 30 calls / 7.1M (16 after 6ef3069 rule), doc-syncer 4.
|
||||
- **Apply**: any advisor cost/usage count: iterations not blocks; corrects LRN-295 call definition. Report generator on real data: independent probe + timing before FEAT COMPLETE.
|
||||
- **Reference**: lib/memory-feedback/advisor.ts, LRN-295, BDR-150, TODO advisor doctrine leak
|
||||
|
||||
## LRN-302 — Scratch clone -b lacks local develop: create ref before simulating develop-based oracles (2026-11-19)
|
||||
- **Pattern**: `git clone -q -b <branch> . <scratch>` scratch copy has no local `develop` (only `origin/develop`): oracles naming `develop` (`git diff --quiet develop -- …`, floor-guard) fail `fatal: bad revision 'develop'` on scratch, pass in real repo. Before simulating contract CHECKs on clone: `git -C <scratch> branch develop origin/develop`.
|
||||
- **Context**: 2026-11-19 merge-reuse run 2 simulation (LRN-296 method): criterion 3 SKIP-INTACT failed only on scratch clone; fixed by creating ref.
|
||||
- **Apply**: every LRN-296 scratch simulation from a non-develop branch: create local develop ref first, else false red.
|
||||
- **Reference**: LRN-296, .claude/tasks/contracts/2026-11-19-merge-reuse-feat-bugfix-1450.md
|
||||
|
||||
## LRN-303 — Server tool scope per sub-agent: no filter removes advisor; rule must ride agent definition or brief, hook is backstop (2026-11-20)
|
||||
- **Pattern**: server-side advisor tool attached to every sub-agent (sonnet too); no tool filter removes it: `tools` allowlist, agent `disallowedTools: ["advisor"]`, `--disallowedTools advisor` all probed 2026-11-19, still listed. Opus sub-agents ignored CLAUDE.global rule delivered as `instructions` attachment (18/25 called); agents carrying rule in own definition (system prompt) obeyed (≤1 call per dispatch, 89 dispatches). Sonnet never called (0/~450). SubagentStart `additionalContext` reaches sub-agent before first turn (nonce probe) = attachment channel too.
|
||||
- **Context**: 2026-11-19/20 advisor leak (Run C table: general-purpose 30 calls 7.1M tok, 29 from standalone SDD on opus in another repo). Fix 7979b9b..b71db28: rule in each agent definition/brief, SDD workers sonnet, hook backstop.
|
||||
- **Apply**: to scope any harness-listed server tool per sub-agent: put rule in agent definition or dispatcher brief, not CLAUDE.md; word allowance as explicit permission ("one call allowed"); hook = backstop only; behavioural proof = transcript tally, not delivery.
|
||||
- **Reference**: hooks/subagent-advisor.sh, lib/effort-shift.md § Advisor, LRN-294, LRN-295, LRN-301, BDR-150
|
||||
|
||||
## LRN-304 — Run-movement counter must run before the commit step; after it the diff is a silent +0 (2026-11-20)
|
||||
- **Pattern**: snippet measuring a run's working-tree movement must run BEFORE the step that commits it. Read after `memory-commit.sh commit` (stages `.claude/tasks`), tree == HEAD, `git diff HEAD` empty rc 0 → silent `+0 / -0`. Fixture must cover the committed case, not only uncommitted.
|
||||
- **Context**: 2026-11-20 /feat done-triage-levers, lever 6 `TODO +n / -m`. r1 put count in DO step 3 ("taken before step 2" in prose, but placed after). Contract CHECK ran on uncommitted fixture → green. r2 confirmation challenger traced step order → MAJOR. Fix: count in DO step 1, run-base SHA from contract, root pathspec `:/` (subdir cwd = silent 0 too), `--no-color --no-ext-diff`.
|
||||
- **Apply**: any "report what the run changed" counter: place it before the commit step in the doc's own numbering; base = SHA recorded at run start, never a branch name; fixture rows: uncommitted, committed, subdir cwd, bad SHA → n/a.
|
||||
- **Reference**: lib/capitalize-commit.md DO step 1, lib/memory-commit.sh MC_PATHS, LRN-298 (placement semantics), LRN-193
|
||||
+27
-5
@@ -3,12 +3,31 @@
|
||||
## Open (reconciled 2026-11-12 before 3.0.0, /reconcile on the BDR-125 phases; full pass 2026-10-23)
|
||||
Done history before 2026-10-08 removed 2026-10-23 (git keeps it: `git log -p -- .claude/tasks/TODO.md`); decisions live in `.claude/memory/`.
|
||||
|
||||
### Done, triage and loop levers (user 2026-11-20: "oui lance une session neuve avec les six leviers")
|
||||
- [x] DONE 19dfe7e + 39cf9dd (docs e8c061e) /feat feature/done-triage-levers, UNMERGED: /feat the six levers in .claude/tasks/plans/2026-11-20-done-and-triage-levers.md (done = oracles green, reopen only on reproducible evidence; MINOR fixed before dispatch or dropped; no challenge on a placed decision; loop on a frozen list; contract dry run + plan artifacts in scope; `TODO +n / -m` in summaries). 5 files: lib/verify-secure-loop.md, lib/challenge-plan.md, CLAUDE.global.md (1 line), lib/capitalize-commit.md, agents/verifier.md (contract .claude/tasks/contracts/2026-11-20-done-triage-levers-1413.md)
|
||||
- [ ] NEXT: follow-up /feat (user 2026-11-20, pass B + GATE 2 answers), 5 files: lib/contract-interview.md STEP 4 (dry run + `- run-base:` from every contract-writing flow: guardrails, a11y, ship-feature, init-project, bugfix fast path, hotfix); skills/ship-feature STEP 6 (:262/:344) and skills/init-project STEP 10 (:280/:382) "Fix all CRITICAL" bound by lever 1 (reopen only on reproducible evidence); lib/capitalize-commit.md:75 `git diff --end-of-options` + `^[0-9a-f]{7,40}$` check on `run_base` (GATE 2 LOW); agents/verifier.md STEP 4 `[gated]` lines in scope only on an untracked contract (GATE 2 design note)
|
||||
- [ ] MEASURE 2026-11-20 levers, after ~5 runs from 19dfe7e: dispatches/run, `TODO +n / -m` per run (measurement lines counted apart), `MINOR dropped:` lines per run plan, challenge skips taken → EVAL. Tripwires (reopen the levers): a BUGS-FOUND entry whose cause matches a `MINOR dropped:` line of a merged run; net open TODO growing run over run; a placed-decision skip on a run that settled an open choice
|
||||
|
||||
### Advisor call points (user 2026-11-17: "oui 1 et 2, et le 3 aussi"; amends BDR-150)
|
||||
- [x] Run A DONE 6ef3069, merged fc2d84d (docs 09277f5, audits c1a0c32, memory 78a6942) /feat feature/advisor-call-points: CLAUDE.global § Workflow + lib/effort-shift.md § Advisor + plan-challenger/verifier/security-auditor one-call rule (contract .claude/tasks/contracts/2026-11-17-advisor-call-points-1130.md)
|
||||
- [x] Run B1 DONE 58a5273 (docs, memory below) /feat feature/advisor-points-b1 (user 2026-11-17 "oui a, b et c"): (a) main-loop plan point in lib/challenge-plan.md (before first dispatch), (b) analyzer joins judgment agents (CLAUDE.global, effort-shift, agents/analyzer.md), (c) trigger "before recommending a change to the doctrine, the architecture or a public interface", stuck call lines in lib/verify-secure-loop.md (contract .claude/tasks/contracts/2026-11-17-advisor-points-b1-1500.md)
|
||||
- [ ] Run B2 /feat: stuck trigger line in the gate bullets of skills/feat, skills/bugfix, skills/ship-feature (they restate the loop inline); merge-proposal lines in skills/ship-feature STEP 9 + skills/release-candidate STEP 4; agents/security-auditor.md severity applies only when higher + "Advice never removes…" (BUGS-FOUND LOW c1a0c32). Plan notes: test citation lines against the census regex; fast oracle doctrine-citers; no `Nb.` criterion labels (LRN-284)
|
||||
- [x] Run B1 DONE 58a5273, merged eb1f594 (docs 47e5ee8, audits 9033b4a, memory d55f491) /feat feature/advisor-points-b1 (user 2026-11-17 "oui a, b et c"): (a) main-loop plan point in lib/challenge-plan.md (before first dispatch), (b) analyzer joins judgment agents (CLAUDE.global, effort-shift, agents/analyzer.md), (c) trigger "before recommending a change to the doctrine, the architecture or a public interface", stuck call lines in lib/verify-secure-loop.md (contract .claude/tasks/contracts/2026-11-17-advisor-points-b1-1500.md)
|
||||
- [x] Run B2 DONE f48343e + 24354d9 + 6022b9d, merged 6c4d24f (docs 5bc64f4, audits bfcf21a 0ceaa58, memory 9917ade) /ship-feature feature/advisor-points-b2 (user 2026-11-17): stuck line in the 6 gate skills; end-of-run call at each flow's own end step (feat, bugfix, ship-feature, init-project, a11y, guardrails, audit-delta + tour when a fix was applied, release-candidate STEP 4), lib/capitalize-commit.md untouched; verifier/security-auditor/plan-challenger advise only when dispatched; auditor raise upward only; plan-challenger protocol mirror; effort-shift item 3 + blank line (contract .claude/tasks/contracts/2026-11-17-advisor-points-b2-1634.md; BUGS-FOUND :109-111 fixed, B2 review residuals logged)
|
||||
- [x] DONE 2b7aeb8, merged 366f1f6 (docs 575408c, audits 8733669 8f23683, memory 49cc13c) (run B3, /ship-feature feature/advisor-points-b3): route line now "send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due" in the 12 callers. Was: The 12 skills send their reflect route with the challenger dispatch, after the advisor call now (low; moved out of B2 by the user 2026-11-17)
|
||||
- [x] DECIDED user 2026-11-18 "skip when gates clean" (strict), DONE 2b7aeb8 + 51f343f (run B3). Was: Decide: feat/bugfix end-of-run advisor call has no skip (audit-delta/tour skip when no fix was applied); nominal /feat or /bugfix = 2 main-loop advisor calls (plan + end), ~0.6-1.4M uncached tokens late in a session; ship-feature STEP 6 opus review and the end call review the same branch back to back (B2 STEP 6 review, user decision)
|
||||
- [x] After B1 DONE (doc commit + BDR-150 status + LRN-296): README/USAGE/CHANGELOG say "before writing a skill's plan (/feat, /bugfix, /ship-feature)" and list 3 agents → doc-sync; BDR-150 status line
|
||||
- [ ] Run C /feat: advisor usage section in /memory-feedback (main loop vs sub-agents, model served, input tokens; dedupe usage rows by message.id, model from the `advisor_message` iteration)
|
||||
- [x] DONE 9814720, merged 4a8dffb (docs 4bb0a95, audits b120ba5, memory 9f8cf97) (/bugfix degraded-tool-line, with BUGS-FOUND:134). Was: loops-light lock on the feat/bugfix skip sentence ("each on its first attempt", "(not DEGRADED)"): B3 contract CHECKs are one-shot (robustness challenger, run B3)
|
||||
- [x] DONE af846d6 + 87566e2, merged 82dee85 (audits 17a60fd, memory 1ec72d9) (/feat x2, feature/advisor-merge-reuse; user 2026-11-19 "all 6": feat/bugfix too). Was: a11y:201, guardrails:278, ship-feature:325, init-project:361 end lines: restate item 3's merge-reuse clause ("reuses the last run's answer, or its skip, and names any code commit made after it"); item 3 loads only via the lib (B3 final review, low)
|
||||
- [ ] lib/effort-shift.md § Advisor item 3 reuse clause has no fallback: end-of-run answer absent (advisor absent/error) or out of view at the merge signal → candidate "answer absent or out of view → the merge proposal runs the call" (source, not the sites); the merge happens at the gitflow finish gate (skills/gitflow/SKILL.md:68-89, 0 advisor mentions) where the rule is not loaded (merge-reuse challengers, low)
|
||||
- [ ] item 3 "names any code commit made after it" has no anchor: ADVISOR field records no HEAD SHA, commits made outside the session are invisible; candidate: record the short SHA with the answer (visible format change, user decision) (merge-reuse robustness challenger, low)
|
||||
- [ ] end-of-run sites restate the call but not "one end-of-run call per skill run": a fix that goes back through the gates re-enters the end step and may call again (merge-reuse robustness challenger, low)
|
||||
- [x] DONE c6f2dad + 63f5fa4, merged 6e45536 (docs 7d09837, audits 77aac4b, memory 3ffd81f) (/feat feature/advisor-usage; user 2026-11-19: FEEDBACK.md section, per agentType, all projects no repo, since last run, retention + drift lines). Was: Run C /feat: advisor usage section in /memory-feedback (main loop vs sub-agents, model served, input tokens; dedupe usage rows by message.id, model from the `advisor_message` iteration)
|
||||
- [x] FIX SHIPPED 7979b9b 6be0669 b71db28, merged 8826699 (docs 4bd0af6, audits c62ee9c, memory 1dedf90) (/ship-feature feature/advisor-subagent-scope; behavioural proof pending, next line). Was: Advisor doctrine leak: general-purpose sub-agents called the advisor 30× (7.1M input tok, the largest line of the first advisor usage table; 16 on 2026-11-18/19, after 6ef3069 2026-11-17 12:59 limited sub-agents to plan-challenger/verifier/security-auditor/analyzer), doc-syncer 4× (2026-11-16/17). Likely SDD implementers/reviewers dispatched as general-purpose: find why the "executors and every other sub-agent do not" rule does not reach them (brief, agent prompt or tool listing) (Run C first table, medium)
|
||||
- [ ] 2026-11-27 or later, after a fresh session: advisor leak behavioural check. Run /memory-feedback (advisor usage table) plus a per-dispatch transcript tally since 7979b9b. Tripwires: every typed non-allowed type 0 calls; sonnet stays 0; general-purpose at most 1 call per dispatch and only in code-review dispatches; allowed four keep about 1 per dispatch (a drop to 0 = the "one call allowed" line not read); standalone SDD workers served sonnet. Revert path: drop the SubagentStart entry from settings.json. Then mark BUGS-FOUND :107 FIXED or reopen (advisor-subagent-scope, medium)
|
||||
- [ ] lib/memory-feedback/advisor.ts: split general-purpose callers per dispatch (calls per dispatch, code-review vs other from a fixed description marker), so the advisor usage table can read the general-purpose tripwire without a hand tally (advisor-subagent-scope robustness challenger, low)
|
||||
- [ ] census test: every agents/*.md served on opus (frontmatter or a model="opus" dispatch) carries either the never-call line or an allowance; every model="opus" general-purpose brief in skills/agents names its advisor rule (STEP 6 review minor 3, low)
|
||||
- [ ] hooks/subagent-advisor.sh shortcut: SubagentStart only, a sub-agent that compacts may lose the line; re-inject on SessionStart `compact` when agent_type is set (hook header shortcut, low)
|
||||
- [ ] advisor-scope review minors: lib/model-gate.md Dispatch tiers names the advisor line for opus built-ins; feat/bugfix ADVISOR fields gain `not called (sub-agent)`; client-handover-writer quoted child templates carry the line literally, not only the routing paragraph (STEP 6 review minors 1, 6, 8, low)
|
||||
- [ ] lib/tests/mods.test.sh model-router plugin test runs ~121 s alone vs CLI_TIMEOUT=120 (load avg 26-31 on 2026-11-19): flaky red in make test, probable cause of run 1 feater's unexplained red; raise the bound or speed the test (Run C GATE 0, low)
|
||||
- [x] Stale citers after A: README/USAGE/CHANGELOG patched, BUGS-FOUND residual superseded + LOW logged, BDR-150 status, LRN-295 (LRN-294 kept: its lesson holds)
|
||||
|
||||
### BDR-125 close-out run (user 2026-11-12): no phase 0/0b/4a/1/5/2/4b/4c/4d line left in TODO or BUGS-FOUND
|
||||
@@ -83,8 +102,11 @@ Open children of the shipped phases (History 2026-11-12), text verbatim.
|
||||
- [ ] feature (G2 split, user 2026-11-10): measured passive-cost API, one source for doctor / /status / plugin-advisor (probe COSTS field). Spec input = the two challenge rounds in the G2 plan: unit = pack or ON plugin (skills + agents + commands descriptions; pr-review-toolkit ~1550t, example-skills ~2350t), doctor counts OFF packs (higgsfield, extras), `detect_plugin_dev` globs the wrong cache level and ignores enabled state, `?` for not-installed or empty units, rc-0 sentinels (`costs-unavailable`/`unknown`) for doctor's `set -euo pipefail`, profile.sh failure → unknown, `python3 -I` (probe runs in the user's project), installPath from installed_plugins.json. Doctor keeps its measured ui-ux 670 until then.
|
||||
- [x] D3 add-ons (done 9b12b12) from G2 (plugin-advisor.md): plan-budget WARN :317 (unreachable: plugin-gate never sends PLAN, detect_plan gone), :42 "absolute COST ESTIMATE still reported", :105 `(budget: ~<N>t | n/a)`, :222 "passive cost estimate = highest-cost package profile", "0t passive" claims for impeccable / design-motion-principles (:226 :227 :268 :269); USAGE.md :248 "Budget Pro (~11k tokens/5h)", :494 `(~400t)`, :923 `(~200t)`; session-banner.test.sh SB10 `gone()` passes on a missing file (add an existence check)
|
||||
- [x] D6 project rule (done c69ce9c; lead paragraph fixed too, follow-ups in BUGS-FOUND): .claude/rules/graphify-vendored.md says `graphify install --platform claude` "touches nothing else", but graphifyy 0.9.67 appends a `# graphify` block to ~/.claude/CLAUDE.md (= CLAUDE.global.md); `graphify claude install` writes into the caller's cwd, so the install-plugins.sh trap protects $REPO only when run from $REPO
|
||||
- [ ] gates.sh: warn or reject a criterion row labelled `^[0-9]+[a-z]\.` (LRN-284: `1b.` absorbed into criterion 1, its CHECK/EXPECT overwritten, false MET)
|
||||
- [ ] gates.sh default `GATES_TIMEOUT=120` < full `make test` (~135 s on 2026-11-16): a "Full make test green" criterion goes NOT-MET on timeout alone (A6 run, re-run with GATES_TIMEOUT=400). Raise the default or have contract-interview write the timeout for full-suite criteria.
|
||||
- [x] DONE c25a7ea, merged 2d8e457 (docs 15c6d09, memory 44dc0b3 482fd37 LRN-299) (bugfix/gates-label-timeout, user 2026-11-17 "reject"; also rejects a 2nd CHECK/EXPECT/EVIDENCE on one criterion: indented ` 2.`, `- `, `**2.**` gave the same false MET) gates.sh: warn or reject a criterion row labelled `^[0-9]+[a-z]\.` (LRN-284: `1b.` absorbed into criterion 1, its CHECK/EXPECT overwritten, false MET)
|
||||
- [x] DONE c25a7ea (user 2026-11-17: default 600 s, env override kept) gates.sh default `GATES_TIMEOUT=120` < full `make test` (~135 s on 2026-11-16): a "Full make test green" criterion goes NOT-MET on timeout alone (A6 run, re-run with GATES_TIMEOUT=400). Raise the default or have contract-interview write the timeout for full-suite criteria.
|
||||
- [ ] gates.sh:93 ABANDON regex `([0-9]+)?` reads `ABANDON: 1b …` / `1.1` as id 1: after a renumber (LRN-284) criterion 1 is masked ABANDONED (rc 3) instead of "unknown criterion" ERROR. Anchor the id `([0-9]+)([[:space:]]|$)` + test (robustness challenger, gates hotfix 2026-11-17)
|
||||
- [ ] gates.sh residual: a stray oracle (indented ` 2.`, `- `, `**2.**` label) after a MANUAL criterion still attaches to it, row MANUAL → MET/NOT-MET on an unrelated oracle (no red oracle overwritten; accepted 2026-11-17)
|
||||
- [ ] lib/verify-secure-loop.md:46-47 ERROR(n) cause list is examples, incomplete: missing "no numbered criteria", "ABANDON names unknown criterion", malformed label, second attribute (c25a7ea)
|
||||
- [ ] lib/design-tool-gate.sh:70 `perl -e 'alarm shift; exec @ARGV' 15 21st whoami` kills one process only (same limit as the old session-start runner, fixed 490ad83): reuse the group-kill runner when this file is next touched.
|
||||
- [ ] parked (code-clean 2026-11-09): hooks/rtk-rewrite.sh:84 no-op `[ "$CMD" = "$REWRITTEN" ] && REWRITTEN="$CMD"`: remove with the next real rtk-hook edit, re-pin `hooks/.rtk-hook.sha256` + rtk-rewrite.test.sh T13 in the same step
|
||||
- [ ] deferred (BDR-123): remap inline-writing best-tier skills (design Build stack, writing-skills, deprecation-and-migration, /tour single-project, /audit-delta 3d, /harden STEP 3); stale citers skills/feat/SKILL.md:6, skills/code-clean/SKILL.md:36; + impeccable row in routing.json (design Build stack has none; frontend-design has `reflect`; census test pins the table)
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
# CONTRACT — advisor-points-b2
|
||||
- date: 2026-11-17 | flow: ship-feature | branch: feature/advisor-points-b2 (off develop, created at STEP 4)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Run B2 of the advisor call points (follow-up to BDR-150, runs A 6ef3069 and B1 58a5273, both merged into develop).
|
||||
|
||||
Read first:
|
||||
- .claude/tasks/TODO.md, the "Advisor call points" block: the "Run B2" line holds the full scope
|
||||
- lib/effort-shift.md § Advisor (the source of truth for the call points)
|
||||
- .claude/audits/BUGS-FOUND.md, the advisor entries (block E LOW, verifier/security-auditor not limited to dispatch, plan-challenger mirror)
|
||||
- LRN-295, LRN-296, LRN-284; the B1 contract and plan as a model: .claude/tasks/{contracts,plans}/2026-11-17-advisor-points-b1-1500.md
|
||||
|
||||
Scope (10 files):
|
||||
1. A "stuck" trigger line in the gate step of the 6 skills that restate the verify-secure loop: feat, bugfix, ship-feature, init-project, a11y, guardrails. It points to lib/verify-secure-loop.md and lib/effort-shift.md § Advisor (second failure of a gate loop, main-loop calls only since GATE 0, the advice never goes into an executor's brief).
|
||||
2. Merge point: ONE line in lib/capitalize-commit.md (the shared tail of feat, bugfix, hotfix, ship-feature, init-project, audit-delta, tour), plus skills/release-candidate STEP 4.
|
||||
3. agents/security-auditor.md: the class severity applies only when it is higher, and "Advice never removes, lowers or waives…".
|
||||
4. agents/verifier.md and agents/security-auditor.md: advisor rule limited to "when dispatched".
|
||||
5. agents/plan-challenger.md: the ORCHESTRATOR PROTOCOL mirror gains the "Advisor first" step and the `Advisor:` row.
|
||||
Optional, low: blank line before block I in effort-shift § Advisor (it renders as part of item 3).
|
||||
|
||||
Over /feat's 5-file cap: ask me first whether this goes through /ship-feature or through two /feat runs (skills, then libs + agents).
|
||||
|
||||
Method (lessons from A and B1):
|
||||
- Apply the advisor rules you're editing: advisor on the written plan before the challengers, before the merge.
|
||||
- Write each text into a file, apply the edit with an exact-match script on a scratch copy (mktemp, never rm -rf through a variable), and run every contract CHECK on it before dispatch (LRN-296).
|
||||
- Every marker and every `§ Label` citation stays on a single line, followed by `)` or `;`. Never label a criterion `Nb.` (LRN-284). Use GATES_TIMEOUT=400 for the full make test.
|
||||
- Gates in order: GATE 0, then the verifier, then security only after CONFORME. Never in parallel.
|
||||
- At capitalize: call memory_pending first; add a BDR-150 status line; update the BUGS-FOUND entries you fixed.
|
||||
- Docs: README/USAGE/CHANGELOG [Unreleased], the "Advisor doctrine" bullet.
|
||||
|
||||
## CLARIFICATIONS
|
||||
- Q: route (11 files, 12 with the optional effort-shift line; two /feat runs hold at most 10) / A: /ship-feature, one run [gated 2026-11-17]
|
||||
- Q: which flows the end-of-run advisor line applies to / A: code flows, no hotfix: feat, bugfix, ship-feature, init-project, audit-delta, tour; hotfix and the memory-only flows (capitalize, prune-memory, memory-feedback, deploy) excluded [gated 2026-11-17]
|
||||
- Q: plugin gate SET dev / A: no, profile full kept [gated 2026-11-17]
|
||||
- Q: merge point host (capitalize-commit is read whole only by feat, bugfix, ship-feature, init-project, plus hotfix, /capitalize, commit-changer; audit-delta and tour reach only § WRITE on an accepted offer) / A: each flow's own end step; lib/capitalize-commit.md stays untouched [gated 2026-11-17]
|
||||
- Q: a11y and guardrails in the merge point / A: yes, included [gated 2026-11-17]
|
||||
- Q: agents/plan-challenger.md advisor bullet scoped "when dispatched" too / A: yes [gated 2026-11-17]
|
||||
- Q: TODO low item "12 skills send their reflect route with the challenger dispatch" / A: out of B2, own TODO line [gated 2026-11-17]
|
||||
- Q: plan r3 deviations from the chat design (feat/bugfix end call before the COMPLETE summaries; audit-delta/tour call only when a fix was applied; route lines in ship-feature, init-project, release-candidate; `Advisor:` line in summaries; tour runner and STEP 0b wiring; effort-shift item 3 carries budget, skips and gate-flow fix path) / A: approved at the STEP 3 validation gate [gated 2026-11-17]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Each of the 6 verify-secure skills (feat, bugfix, ship-feature, init-project, a11y, guardrails) carries, in its gate step, a stuck trigger citing `lib/verify-secure-loop.md` and `lib/effort-shift.md` § Advisor: second failure of a gate loop, main-loop calls only since GATE 0 first ran, the advice never enters an executor brief.
|
||||
2. The merge point (effort-shift § Advisor item 3) is wired for the flows of CLARIFICATIONS and in skills/release-candidate STEP 4, citing `lib/effort-shift.md` § Advisor; hotfix, commit-changer and the memory-only flows gain no call.
|
||||
3. agents/security-auditor.md advisor bullet: a STEP 3 class severity replaces the STEP 2 one only when higher; the sentence that advice never removes, lowers or waives a finding stays.
|
||||
4. agents/verifier.md and agents/security-auditor.md advisor bullets apply when dispatched as a sub-agent.
|
||||
5. agents/plan-challenger.md ORCHESTRATOR PROTOCOL mirrors lib/challenge-plan.md: the main-loop "Advisor first" step before the dispatch and the CHALLENGE SUMMARY `Advisor:` row.
|
||||
6. lib/effort-shift.md § Advisor: a blank line separates item 3 from the "Inside a skill run" paragraph.
|
||||
CHECK: cd /home/bchanot/Documents/claude && awk '/^Inside a skill run, the points above/{print (prev=="" ? "BLANK-BEFORE-I" : "NO-BLANK")} {prev=$0}' lib/effort-shift.md
|
||||
EXPECT: BLANK-BEFORE-I
|
||||
EVIDENCE: MET exit=0 marker-found :: BLANK-BEFORE-I
|
||||
7. Citation census green (fast oracle).
|
||||
CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/doctrine-citers.test.sh </dev/null 2>&1 | tail -1
|
||||
EXPECT: FAIL=0
|
||||
EVIDENCE: MET exit=0 marker-found :: PASS=23 FAIL=0
|
||||
8. Full make test green (run gates.sh with GATES_TIMEOUT=400).
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
9. Every test-locked phrase in the touched files stays on one unbroken line; touched lines ≤ 80 columns; no wording changed outside the planned blocks (manual).
|
||||
10. [gated 2026-11-17] Stuck paragraph in each gate skill, citing the lib and § Advisor.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for s in feat bugfix ship-feature init-project a11y guardrails; do f=skills/$s/SKILL.md; printf '%s:%s/%s ' "$s" "$(/usr/bin/grep -c 'Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0' "$f")" "$(/usr/bin/grep -cF '(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.' "$f")"; done; echo
|
||||
EXPECT: feat:1/1 bugfix:1/1 ship-feature:1/1 init-project:1/1 a11y:1/1 guardrails:1/1
|
||||
EVIDENCE: MET exit=0 marker-found :: feat:1/1 bugfix:1/1 ship-feature:1/1 init-project:1/1 a11y:1/1 guardrails:1/1
|
||||
11. [gated 2026-11-17] The stuck paragraph sits in the gate step (after a GATE 2 line, no heading between).
|
||||
CHECK: cd /home/bchanot/Documents/claude && for s in feat bugfix ship-feature init-project a11y guardrails; do awk -v s="$s" '/GATE 2/{g=NR} /^## /{h=NR} /Stuck: a gate loop fails twice/{m=NR; ok=(g>h)} END{printf "%s:%s ", s, (m&&ok)?"in-gate":"OUT"}' "skills/$s/SKILL.md"; done; echo
|
||||
EXPECT: feat:in-gate bugfix:in-gate ship-feature:in-gate init-project:in-gate a11y:in-gate guardrails:in-gate
|
||||
EVIDENCE: MET exit=0 marker-found :: feat:in-gate bugfix:in-gate ship-feature:in-gate init-project:in-gate a11y:in-gate guardrails:in-gate
|
||||
12. [gated 2026-11-17] The end-of-run marker is in exactly the 9 flows (no hotfix, lib, agent or memory-only flow).
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "[$(/usr/bin/grep -rlF 'end-of-run advisor call (`lib/effort-shift.md` § Advisor)' skills lib agents | LC_ALL=C sort | tr '\n' ' ')]"
|
||||
EXPECT: [skills/a11y/SKILL.md skills/audit-delta/SKILL.md skills/bugfix/SKILL.md skills/feat/SKILL.md skills/guardrails/SKILL.md skills/init-project/SKILL.md skills/release-candidate/SKILL.md skills/ship-feature/SKILL.md skills/tour/SKILL.md ]
|
||||
EVIDENCE: MET exit=0 marker-found :: [skills/a11y/SKILL.md skills/audit-delta/SKILL.md skills/bugfix/SKILL.md skills/feat/SKILL.md skills/guardrails/SKILL.md skills/init-project…
|
||||
13. [gated 2026-11-17] Each end marker occurs once, before its flow's done or merge moment.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for t in 'feat|^## STEP 5 |^FEAT COMPLETE' 'bugfix|^## STEP 6 |BUGFIX COMPLETE' 'ship-feature|^## STEP 9 |finish # feature' 'init-project|^## STEP 11 |finish # feature' 'a11y|^## STEP 10:|^2[.] .mcp__model-router' 'guardrails|^## STEP 12:|^2[.] .mcp__model-router' 'audit-delta|^## STEP 4 |AUDIT-DELTA COMPLETE' 'tour|^Checks: pytest PASS|^TOUR COMPLETE' 'release-candidate|^### STEP 4 |^AskUserQuestion:'; do IFS='|' read -r s a b <<<"$t"; awk -v s="$s" -v a="$a" -v b="$b" '!sa && $0~a {sa=NR} index($0,"end-of-run advisor call (`lib/effort-shift.md` § Advisor)"){n++; m=NR} sa && !sb && NR>sa && $0~b {sb=NR} END{printf "%s:%s ", s, (n==1 && sa<m && m<sb)?"ok":"BAD"}' "skills/$s/SKILL.md"; done; echo
|
||||
EXPECT: feat:ok bugfix:ok ship-feature:ok init-project:ok a11y:ok guardrails:ok audit-delta:ok tour:ok release-candidate:ok
|
||||
EVIDENCE: MET exit=0 marker-found :: feat:ok bugfix:ok ship-feature:ok init-project:ok a11y:ok guardrails:ok audit-delta:ok tour:ok release-candidate:ok
|
||||
14. [gated 2026-11-17] verifier, security-auditor and plan-challenger advise only when dispatched.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for a in verifier security-auditor plan-challenger; do printf '%s:%s/%s ' "$a" "$(/usr/bin/grep -c '^- Advisor, when dispatched as a sub-agent: at most one call' "agents/$a.md")" "$(/usr/bin/grep -c 'Advisor (when listed)' "agents/$a.md")"; done; echo
|
||||
EXPECT: verifier:1/0 security-auditor:1/0 plan-challenger:1/0
|
||||
EVIDENCE: MET exit=0 marker-found :: verifier:1/0 security-auditor:1/0 plan-challenger:1/0
|
||||
15. [gated 2026-11-17] security-auditor: a raise applies only upward, a no-op raise is neither tagged nor counted, advice never removes, lowers or waives.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "[$(/usr/bin/grep -c 'A raise applies only when its class.s severity' agents/security-auditor.md)/$(/usr/bin/grep -c 'changes nothing: no tag,' agents/security-auditor.md)/$(/usr/bin/grep -c '^ Advice never removes, lowers or waives a finding from semgrep' agents/security-auditor.md)/$(/usr/bin/grep -c 'overrides the STEP 2 mapping' agents/security-auditor.md)/$(/usr/bin/grep -c 'It never removes' agents/security-auditor.md)]"
|
||||
EXPECT: [1/1/1/0/0]
|
||||
EVIDENCE: MET exit=0 marker-found :: [1/1/1/0/0]
|
||||
16. [gated 2026-11-17] plan-challenger ORCHESTRATOR PROTOCOL: ADVISOR FIRST (pointer to the lib, its guards) before the dispatch bullet, `Advisor:` row in ADVISORY.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "[$(/usr/bin/grep -c '^- ADVISOR FIRST (main loop): per `lib/challenge-plan.md`' agents/plan-challenger.md)/$(/usr/bin/grep -c 'with no main-loop advisor call since the skill run started; absent or' agents/plan-challenger.md)/$(/usr/bin/grep -cF 'an `Advisor:` row) feed the' agents/plan-challenger.md)/$(awk '/^## ORCHESTRATOR PROTOCOL/{p=NR} /^- ADVISOR FIRST/{a=NR} /^- Dispatch THREE fresh challengers/{d=NR} END{print (p && p<a && a<d)}' agents/plan-challenger.md)]"
|
||||
EXPECT: [1/1/1/1]
|
||||
EVIDENCE: MET exit=0 marker-found :: [1/1/1/1]
|
||||
17. [gated 2026-11-17] effort-shift § Advisor item 3 keeps its generic trigger, names its sites, its own budget, the audit-delta/tour skip and the gate-flow-only fix path; § Advisor still names no STEP.
|
||||
CHECK: cd /home/bchanot/Documents/claude && sec() { sed -n '/^## Advisor/,/^## Never/p' lib/effort-shift.md; }; echo "[$(sec | /usr/bin/grep -c 'done. Wired at the end step of feat, bugfix,')/$(sec | /usr/bin/grep -c 'release gate of release-candidate: one end-of-run call per skill')/$(sec | /usr/bin/grep -c 'never skipped for an earlier plan or stuck call')/$(sec | /usr/bin/grep -c 'and tour skip it when the run applied no fix')/$(sec | /usr/bin/grep -c 'the answer is reported only and a fix it calls for is a new run')/$(sec | /usr/bin/grep -c STEP)]"
|
||||
EXPECT: [1/1/1/1/1/0]
|
||||
EVIDENCE: MET exit=0 marker-found :: [1/1/1/1/1/0]
|
||||
18. [gated 2026-11-17] Every added line in the 13 files is at most 80 columns.
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=$(/usr/bin/git diff develop -U0 -- skills/feat/SKILL.md skills/bugfix/SKILL.md skills/ship-feature/SKILL.md skills/init-project/SKILL.md skills/a11y/SKILL.md skills/guardrails/SKILL.md skills/audit-delta/SKILL.md skills/tour/SKILL.md skills/release-candidate/SKILL.md agents/verifier.md agents/security-auditor.md agents/plan-challenger.md lib/effort-shift.md | /usr/bin/grep '^+[^+]' | cut -c2- | LC_ALL=C.UTF-8 awk 'length>80' | wc -l); [ "$n" -eq 0 ] && echo WIDTH-OK
|
||||
EXPECT: WIDTH-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: WIDTH-OK
|
||||
19. [gated 2026-11-17] Tour fan-out: the main loop makes the call (STEP 0b list) only when a fix was applied, runners never do.
|
||||
CHECK: cd /home/bchanot/Documents/claude && f=skills/tour/SKILL.md; echo "[$(/usr/bin/grep -c 'when any row reports a fix, makes the' $f)/$(/usr/bin/grep -c 'STEP 3 end-of-run advisor call; then prints the global summary' $f)/$(/usr/bin/grep -c 'them; never call the advisor. Every rule' $f)/$(/usr/bin/grep -c '^Main loop only, never a runner: when the tour applied any fix' $f)]"
|
||||
EXPECT: [1/1/1/1]
|
||||
EVIDENCE: MET exit=0 marker-found :: [1/1/1/1]
|
||||
20. [gated 2026-11-17] ship-feature and init-project route back to their plan level, release-candidate up to reflect, before the end call.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "[$(/usr/bin/grep -cF 'route(phase="plan")` first (route: end-of-run review).' skills/ship-feature/SKILL.md)/$(/usr/bin/grep -cF 'route(phase="plan")` first (route: end-of-run review).' skills/init-project/SKILL.md)/$(/usr/bin/grep -cF 'route(phase="reflect")` first (route: end-of-run review).' skills/release-candidate/SKILL.md)]"
|
||||
EXPECT: [1/1/1]
|
||||
EVIDENCE: MET exit=0 marker-found :: [1/1/1]
|
||||
21. [gated 2026-11-17] In ship-feature and init-project the stuck paragraph follows the "This …" paragraph it would otherwise split from the gates.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for t in 'ship-feature|^This replaces the old informal' 'init-project|^This adds the security gate'; do IFS='|' read -r s a <<<"$t"; awk -v s="$s" -v a="$a" '$0~a{t=NR} /Stuck: a gate loop fails twice/{m=NR} END{printf "%s:%s ", s, (t && m>t)?"after-this":"BAD"}' "skills/$s/SKILL.md"; done; echo
|
||||
EXPECT: ship-feature:after-this init-project:after-this
|
||||
EVIDENCE: MET exit=0 marker-found :: ship-feature:after-this init-project:after-this
|
||||
|
||||
## FILE SCOPE
|
||||
[gated 2026-11-17] (replaces the STEP 0e seed below) skills/feat/SKILL.md (gate
|
||||
step, STEP 5 summary), skills/bugfix/SKILL.md (gate step, STEP 6 summary),
|
||||
skills/{ship-feature,init-project}/SKILL.md (gate step, FINISH head),
|
||||
skills/{a11y,guardrails}/SKILL.md (Gates item, Commit and hand over item 1),
|
||||
skills/audit-delta/SKILL.md (STEP 4 head), skills/tour/SKILL.md (runner
|
||||
prompt, STEP 0b list, before the global summary),
|
||||
skills/release-candidate/SKILL.md (STEP 4 head), agents/verifier.md and
|
||||
agents/security-auditor.md (advisor bullet), agents/plan-challenger.md
|
||||
(advisor bullet, ORCHESTRATOR PROTOCOL), lib/effort-shift.md (§ Advisor item 3
|
||||
and the blank line before block I); transient, purged by `gitflow finish`:
|
||||
docs/superpowers/plans/2026-11-17-advisor-points-b2.md and
|
||||
docs/superpowers/plans/2026-11-17-advisor-points-b2/apply.py; this contract.
|
||||
`lib/capitalize-commit.md` is not touched. Seed criterion 2's "flows of
|
||||
CLARIFICATIONS" = the end steps of feat, bugfix, ship-feature, init-project,
|
||||
a11y, guardrails, audit-delta and tour.
|
||||
|
||||
Seed (STEP 0e, superseded): skills/{feat,bugfix,ship-feature,init-project,a11y,guardrails}/SKILL.md (gate step), lib/capitalize-commit.md, skills/release-candidate/SKILL.md (STEP 4), agents/security-auditor.md, agents/verifier.md, agents/plan-challenger.md (advisor bullet, ORCHESTRATOR PROTOCOL), lib/effort-shift.md (§ Advisor blank line). Final list settled at STEP 3.
|
||||
@@ -0,0 +1,41 @@
|
||||
# CONTRACT — gates-label-timeout
|
||||
- date: 2026-11-17 | flow: hotfix | branch: bugfix/gates-label-timeout
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
corrige les deux bugs mis dans le todos puis passe a C
|
||||
|
||||
Bug description (TODO:88-89): (1) gates.sh: warn or reject a criterion row labelled `^[0-9]+[a-z]\.` (LRN-284: `1b.` absorbed into criterion 1, its CHECK/EXPECT overwritten, false MET). (2) gates.sh default `GATES_TIMEOUT=120` < full `make test` (~135 s on 2026-11-16): a "Full make test green" criterion goes NOT-MET on timeout alone (A6 run, re-run with GATES_TIMEOUT=400). Raise the default or have contract-interview write the timeout for full-suite criteria.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: the two bugs? / A: inferred, not asked: TODO:88-89, the two gates.sh items (TODO:90 design-tool-gate is deferred to its next touch by its own text); the user's answers to the two questions below approve both fixes
|
||||
Deviation 2026-11-17 (advisor, reported to the user): the same false MET reproduces with an indented ` 2. sub`, `- sub` or `**2.** sub` label, so `_set_attr` also rejects a second CHECK/EXPECT/EVIDENCE on one criterion (no past contract has one; every past verdict unchanged)
|
||||
Q: bad label handling? / A: reject: an unindented ACCEPTANCE CRITERIA line starting with a digit that is not `N. text` (`1b.`, `1.1`, `2)`) is a parse error naming the line, its attributes belong to no criterion, verdict ERROR [gated 2026-11-17]
|
||||
Q: timeout fix? / A: default 600 s, the GATES_TIMEOUT env override kept [gated 2026-11-17]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. A `1b.` label after a failing criterion makes `gates.sh run` return ERROR rc 2 naming line 6 (before the fix this fixture is a false MET).
|
||||
CHECK: cd /home/bchanot/Documents/claude && f=$(mktemp) && printf '## ACCEPTANCE CRITERIA\n1. real\n CHECK: exit 1\n EXPECT: x\n EVIDENCE: pending\n1b. sub\n CHECK: echo y\n EXPECT: y\n EVIDENCE: pending\n' > "$f"; out=$(bash lib/gates.sh run "$f" 2>&1); rc=$?; rm -f "$f"; [ "$rc" -eq 2 ] && printf '%s' "$out" | grep -q 'malformed criterion label at line 6' && printf '%s' "$out" | grep -q 'VERDICT: ERROR' && echo LABEL-REJECTED
|
||||
EXPECT: LABEL-REJECTED
|
||||
EVIDENCE: MET exit=0 marker-found :: LABEL-REJECTED
|
||||
2. With GATES_TIMEOUT unset, gates.sh reports a 600 s timeout; with GATES_TIMEOUT=7 it reports 7 s.
|
||||
CHECK: cd /home/bchanot/Documents/claude && f=$(mktemp) && printf '## ACCEPTANCE CRITERIA\n1. manual\n' > "$f"; a=$(env -u GATES_TIMEOUT bash lib/gates.sh status "$f" 2>&1); b=$(GATES_TIMEOUT=7 bash lib/gates.sh status "$f" 2>&1); rm -f "$f"; printf '%s' "$a" | grep -q 'timeout 600s' && printf '%s' "$b" | grep -q 'timeout 7s' && echo DEFAULT-600
|
||||
EXPECT: DEFAULT-600
|
||||
EVIDENCE: MET exit=0 marker-found :: DEFAULT-600
|
||||
3. lib/tests/gates.test.sh carries the regression cases and is green; shellcheck clean on both files.
|
||||
CHECK: cd /home/bchanot/Documents/claude && grep -q '1b\. sub' lib/tests/gates.test.sh && grep -q '1\.1 dotted' lib/tests/gates.test.sh && grep -q 'timeout 600s' lib/tests/gates.test.sh && shellcheck -S warning lib/gates.sh lib/tests/gates.test.sh && bash lib/tests/gates.test.sh 2>&1 | tail -1 | grep -q ', 0 fail' && echo SUITE-GREEN
|
||||
EXPECT: SUITE-GREEN
|
||||
EVIDENCE: MET exit=0 marker-found :: SUITE-GREEN
|
||||
4. An indented ` 2. sub` label with a passing oracle after a failing criterion 1 makes `gates.sh run` return ERROR naming the second CHECK (before the fix: false MET).
|
||||
CHECK: cd /home/bchanot/Documents/claude && f=$(mktemp) && printf '## ACCEPTANCE CRITERIA\n1. real\n CHECK: exit 1\n EXPECT: x\n EVIDENCE: pending\n 2. sub\n CHECK: echo y\n EXPECT: y\n EVIDENCE: pending\n' > "$f"; out=$(bash lib/gates.sh run "$f" 2>&1); rc=$?; rm -f "$f"; [ "$rc" -eq 2 ] && printf '%s' "$out" | grep -q 'second CHECK: at line 7' && printf '%s' "$out" | grep -q 'VERDICT: ERROR' && echo STRAY-REJECTED
|
||||
EXPECT: STRAY-REJECTED
|
||||
EVIDENCE: MET exit=0 marker-found :: STRAY-REJECTED
|
||||
5. Full make test green, run by gates.sh with no GATES_TIMEOUT set (proves the new default covers the suite).
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
|
||||
## FILE SCOPE
|
||||
lib/gates.sh
|
||||
lib/tests/gates.test.sh
|
||||
(bookkeeping: .claude/tasks/TODO.md, .claude/memory via memory.sh, this contract, the challenge plan .claude/tasks/plans/2026-11-17-gates-label-timeout-2342.md)
|
||||
@@ -0,0 +1,60 @@
|
||||
# CONTRACT — advisor-points-b3
|
||||
- date: 2026-11-18 | flow: ship-feature | branch: feature/advisor-points-b3
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
corrige les deux bugs mis dans le todos puis passe a C
|
||||
|
||||
Answers 2026-11-18 that scope this run: "Did 'les deux bugs' also mean TODO:10-11?" → "Yes, do 10-11 first". Route line wording → "First challenge call (Recommended)": "(route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due)". BUGS-FOUND :114 Advisor row → "Yes, same run (Recommended)". Flow → "/ship-feature (Recommended)". TODO:11 → "Skip when gates clean": feat/bugfix skip the end-of-run call when GATE 0, verifier and security passed first try and no stuck call ran; doctrine edit in effort-shift item 3 + 2 skills.
|
||||
|
||||
Skill args (/ship-feature): Advisor run B3 (TODO:10-11 + BUGS-FOUND :114 residual; user 2026-11-18). (1) The challenge route line in 12 skills (feat, bugfix, hotfix, ship-feature, init-project, audit-delta, code-clean, onboard, harden, pack-seo seo + geo, pack-web-validate web-validate) reads "(route: own level before the challenge; send it with the challenger dispatch)"; lib/challenge-plan.md now puts the main-loop advisor call (and a plan read) before the dispatch. User wording: "(route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due)". (2) Same 12 skills: each CHALLENGE SUMMARY template gains the `Advisor:` row lib/challenge-plan.md OUTPUT requires; BUGS-FOUND :114 residual → FIXED. (3) TODO:11 user decision "skip when gates clean": /feat and /bugfix skip the end-of-run advisor call when GATE 0, the verifier and security all passed on their first run and no stuck call ran; doctrine in lib/effort-shift.md § Advisor item 3 + skills/feat + skills/bugfix end lines; TODO:11 closed, BDR-150 status line. Method as B2: blocks in files + exact-once applier, simulated on a mktemp scratch copy with every contract CHECK before dispatch (LRN-296); markers and `§ Label` citations on one line followed by `)` or `;`; criteria plain `N.` labels (gates.sh now rejects others); full make test at the gates.sh default timeout; gates in order GATE 0 → verifier → security after CONFORME; at capitalize memory_pending first; docs CHANGELOG [Unreleased] Advisor doctrine bullet, README/USAGE only if they cite the changed lines.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: route line wording / A: user wording above [gated 2026-11-18]
|
||||
Q: fold BUGS-FOUND :114 Advisor row into the run / A: yes [gated 2026-11-18]
|
||||
Q: flow / A: /ship-feature [gated 2026-11-18]
|
||||
Q: TODO:11 decision / A: skip when gates clean, feat and bugfix only [gated 2026-11-18]
|
||||
Q: route wording vs a PLAN Read first / A: keep verbatim [gated 2026-11-18]
|
||||
Q: Advisor row format / A: row with its three values inline; one-line summaries gain "/ advisor" [gated 2026-11-18]
|
||||
Q: "gates clean" / A: strict: GATE 0 MET, verifier CONFORME, security PASS (not DEGRADED), each first attempt; anything else runs the call [gated 2026-11-18]
|
||||
Q: add-ons / A: ADVISOR field in FEAT/BUGFIX COMPLETE; item 3 "end step" wording (BUGS-FOUND :118 wording part) [gated 2026-11-18]
|
||||
Q: STEP 3 dispositions (plan "Dispositions shown at the STEP 3 gate": verdict out of view runs the call; all-manual GATE 0 MET counts; NEED-DECISION / deferred BLOCKER / REPORTED findings count as clean; a skip discharges its point and trigger; bugfix end route kept; reuse clause names later code commits) / A: approved as listed [gated 2026-11-18]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. No skill keeps the old route annotation "send it with the challenger dispatch". [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=$(git grep -c 'send it with the challenger dispatch' -- skills | wc -l); [ "$n" -eq 0 ] && echo OLD-ROUTE-GONE
|
||||
EXPECT: OLD-ROUTE-GONE
|
||||
EVIDENCE: MET exit=0 marker-found :: OLD-ROUTE-GONE
|
||||
2. Each of the 12 challenge callers carries the new route annotation exactly once, on its `mcp__model-router__route(phase=…)` line. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in skills/feat/SKILL.md skills/bugfix/SKILL.md skills/hotfix/SKILL.md skills/ship-feature/SKILL.md skills/init-project/SKILL.md skills/audit-delta/SKILL.md skills/code-clean/SKILL.md skills/onboard/SKILL.md skills/harden/SKILL.md skills/pack-seo/skills/seo/SKILL.md skills/pack-seo/skills/geo/SKILL.md skills/pack-web-validate/skills/web-validate/SKILL.md; do c=$(grep -F 'mcp__model-router__route(phase=' "$f" | grep -cF '(route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).'); [ "$c" -eq 1 ] && n=$((n+1)); done; [ "$n" -eq 12 ] && echo ROUTE-12
|
||||
EXPECT: ROUTE-12
|
||||
EVIDENCE: MET exit=0 marker-found :: ROUTE-12
|
||||
3. In the 9 block-form CHALLENGE SUMMARY templates, the line right after `Lenses returned` is the `Advisor:` row, its noun equal to the noun of the block's own `BLOCKERs addressed` row. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in skills/ship-feature/SKILL.md skills/init-project/SKILL.md skills/audit-delta/SKILL.md skills/code-clean/SKILL.md skills/onboard/SKILL.md skills/harden/SKILL.md skills/pack-seo/skills/seo/SKILL.md skills/pack-seo/skills/geo/SKILL.md skills/pack-web-validate/skills/web-validate/SKILL.md; do awk 'BEGIN{ok=0} /BLOCKERs addressed : <n>/{if (match($0,/named [a-z-]+ change/)) x=substr($0,RSTART+6,RLENGTH-13)} p{if (x!="" && index($0,"Advisor : <the " x " change it drove | called, no change | not called (absent | error | already called this run)>")) ok=1; p=0} /Lenses returned : correctness/{p=1} END{exit !ok}' "$f" && n=$((n+1)); done; [ "$n" -eq 9 ] && echo ROWS-9
|
||||
EXPECT: ROWS-9
|
||||
EVIDENCE: MET exit=0 marker-found :: ROWS-9
|
||||
4. feat, bugfix and hotfix name the advisor in their one-line CHALLENGE SUMMARY. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in feat bugfix hotfix; do grep -qF 'lenses returned / advisor)' skills/$f/SKILL.md && grep -qF 'CHALLENGE SUMMARY' skills/$f/SKILL.md && n=$((n+1)); done; [ "$n" -eq 3 ] && echo SENTENCES-3
|
||||
EXPECT: SENTENCES-3
|
||||
EVIDENCE: MET exit=0 marker-found :: SENTENCES-3
|
||||
5. lib/effort-shift.md § Advisor item 3 keeps "never skipped for an earlier plan or stuck call" and names its two skips (audit-delta/tour with no fix; feat/bugfix on the strict rule, "(not DEGRADED)" and the verdict-out-of-view clause included); a skipped call discharges its point; feat/bugfix sit at their commit step; for the six gate flows a later merge proposal reuses the last run's answer or skip and names any later code commit (doc and memory commits excepted); "end step of feat" and "predates the newer commits" are gone. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && t=$(awk '/^3\. Before proposing a merge/{p=1} p&&/^$/{exit} p' lib/effort-shift.md | tr '\n' ' ' | tr -s ' '); for s in 'Wired at the commit step of feat and bugfix, at the end step of ship-feature' 'never skipped for an earlier plan or stuck call. Two skips only:' 'feat and bugfix when GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED), each on its first attempt (any other verdict, a retry, a loop iteration or a verdict no longer in view runs the call)' '`skipped (gates clean on first pass)`' 'A skipped call discharges its point and the trigger it covers.' 'a later merge proposal reuses the last run' 'and names any code commit made after it (doc and memory commits excepted).'; do printf '%s' "$t" | grep -qF -- "$s" || exit 1; done; printf '%s' "$t" | grep -qF 'end step of feat' && exit 1; printf '%s' "$t" | grep -qF 'predates the newer commits' && exit 1; echo ITEM3-OK
|
||||
EXPECT: ITEM3-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: ITEM3-OK
|
||||
6. skills/feat and skills/bugfix restate the skip condition ("(not DEGRADED)" and the verdict-out-of-view clause included) at their end-of-run line, before the COMPLETE summary, and the summary template carries the `ADVISOR` field with its three values; the old "as an `Advisor:` line" wording is gone. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && for f in skills/feat/SKILL.md skills/bugfix/SKILL.md; do t=$(tr '\n' ' ' < "$f" | tr -s ' '); for s in 'end-of-run advisor call (`lib/effort-shift.md` § Advisor), skipped when GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED), each on its first attempt; any other verdict, a retry, a loop iteration or a verdict no longer in view runs the call.' '`ADVISOR` field, and a fix it drives goes back through the gates.' ': <one-line answer | skipped (gates clean on first pass) | not called (absent | error)>'; do printf '%s' "$t" | grep -qF -- "$s" || exit 1; done; printf '%s' "$t" | grep -qF 'goes into the summary as an `Advisor:` line' && exit 1; a=$(grep -n '§ Advisor), skipped when' "$f" | cut -d: -f1); c=$(grep -nE '^ *(FEAT|BUGFIX) COMPLETE$' "$f" | tail -1 | cut -d: -f1); d=$(grep -n 'ADVISOR .*: <one-line answer' "$f" | cut -d: -f1); [ -n "$a" ] && [ -n "$c" ] && [ -n "$d" ] && [ "$a" -lt "$c" ] && [ "$c" -lt "$d" ] || exit 1; done; echo FEAT-BUGFIX-SKIP
|
||||
EXPECT: FEAT-BUGFIX-SKIP
|
||||
EVIDENCE: MET exit=0 marker-found :: FEAT-BUGFIX-SKIP
|
||||
7. CHANGELOG [Unreleased] "Advisor doctrine" bullet names the new callers, the summary row and route, the feat/bugfix skip (not DEGRADED), their commit step, the `ADVISOR` field and the reuse clause that names later code commits; "It sits at the end step of feat, bugfix" and "the answer goes into the reply, summary or finish proposal" are gone. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && u=$(awk '/^## \[Unreleased\]/{p=1;next} /^## \[/{p=0} p' CHANGELOG.md); for s in 'skills/{feat,bugfix,hotfix,ship-feature,init-project,onboard,code-clean,harden,a11y,guardrails,audit-delta,tour,release-candidate}/SKILL.md' 'the CHALLENGE SUMMARY of every caller gains an `Advisor:` row' 'with the first tool call of `lib/challenge-plan.md`' 'feat and bugfix skip it when GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED), each on its first attempt' 'It sits at the commit step of feat and bugfix and at the end step of ship-feature' 'and a later merge proposal reuses the last run' 'names any code commit made after it (doc and memory commits excepted).' 'or into the feat/bugfix summary'; do printf '%s' "$u" | grep -qF -- "$s" || exit 1; done; printf '%s' "$u" | grep -qF 'It sits at the end step of feat, bugfix' && exit 1; printf '%s' "$u" | grep -qF 'the answer goes into the reply, summary or finish proposal' && exit 1; echo CHANGELOG-OK
|
||||
EXPECT: CHANGELOG-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: CHANGELOG-OK
|
||||
8. Full make test green. [gated 2026-11-18]
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
9. No wording changed outside the planned edits; every marker and `§ Label` citation stays on one line followed by `)` or `;`; new prose lines ≤ 80 columns, except by name the 12 route lines and the template rows (`Advisor` row, `ADVISOR` field), which run as wide as the rows beside them, and the CHANGELOG bullet (one unwrapped line, like every bullet in that file) (manual). [gated 2026-11-18]
|
||||
|
||||
## FILE SCOPE
|
||||
skills/feat/SKILL.md, skills/bugfix/SKILL.md, skills/hotfix/SKILL.md, skills/ship-feature/SKILL.md, skills/init-project/SKILL.md, skills/audit-delta/SKILL.md, skills/code-clean/SKILL.md, skills/onboard/SKILL.md, skills/harden/SKILL.md, skills/pack-seo/skills/seo/SKILL.md, skills/pack-seo/skills/geo/SKILL.md, skills/pack-web-validate/skills/web-validate/SKILL.md, lib/effort-shift.md, CHANGELOG.md
|
||||
(bookkeeping: .claude/tasks/TODO.md, .claude/audits/BUGS-FOUND.md, .claude/memory via memory.sh, this contract; transient plan under docs/superpowers/plans/)
|
||||
@@ -0,0 +1,57 @@
|
||||
# CONTRACT — advisor-subagent-scope
|
||||
- date: 2026-11-19 | flow: ship-feature | branch: feature/advisor-subagent-scope
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
corrige la fuite advisor des sous-agents et fais les todos, et si il y en a d'autre ensuite fais les, tant que des todos apparaissent fais les sauf si tu vois que ca se repete
|
||||
|
||||
Scope of this run (main loop): the advisor sub-agent leak (TODO advisor-leak), escalated from /bugfix (>5 files). Diagnosis and probes: .claude/tasks/plans/2026-11-19-subagent-advisor-hook-1905.md.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: fix layers / A: "Both": SDD sonnet pin + never-call lines in opus-served agent prompts and opus briefs + a SubagentStart hook backstop [gated 2026-11-19]
|
||||
Q: opus judgment reviewers / A: "Allow code reviews once": the opus code review (ship-feature STEP 6, init-project STEP 10, standalone SDD final review) may call the advisor at most once before its verdict; other judgment children never [gated 2026-11-19]
|
||||
Q: merges in the TODO loop / A: gitflow finish per item once gates are clean [gated 2026-11-19]
|
||||
Q: design / A: approved: carriers = CLAUDE.global.md § Skill routing (SDD pin) + § Workflow (allowed set, brief rule, hook) + lib/effort-shift.md § Advisor detail; six agent prompts (plugin-advisor, seo-analyzer, geo-analyzer, doc-syncer, commit-changer, handover-doc-writer); onboard's six opus briefs; client-handover-writer routing paragraph (not its top prompt: inline-loaded by the main loop); tour Phase B; ship-feature STEP 6 + init-project STEP 10 allowance; silent SubagentStart hook, timeout 5; vendored skills-external files NOT edited (update-all.sh overwrites them, BDR-106, BLK-024) [gated 2026-11-19]
|
||||
Q: Advisor row of a skill run by a sub-agent / A: add `sub-agent` to the `not called (...)` reasons in lib/challenge-plan.md OUTPUT and the 9 caller template rows [gated 2026-11-19]
|
||||
Q: plugin profile SET dev / A: no, keep full [gated 2026-11-19]
|
||||
|
||||
Q: 3-lens challenge fixes (hook line: agent definition or dispatcher's brief, the tool's own instructions never an allowance, ~/.claude path; all SDD workers sonnet incl. fix rounds, no opus carve-out; imperative code-review brief line; agent lines scoped "when you run as a sub-agent"; atomic applier; tripwire redefined for general-purpose) / A: main loop, internal; no gated choice reopened [2026-11-19]
|
||||
|
||||
Q: STEP 3 validation gate, plan docs/superpowers/plans/2026-11-19-advisor-subagent-scope.md (1 task, 33-check suite) / A: yes, execute [gated 2026-11-20]
|
||||
|
||||
Q: GATE 1 round 1 ECARTS(4): plan artifacts outside FILE SCOPE + SC2016 shellcheck disable (FLOOR) / A: main loop: the docs/superpowers plan + apply.py are transient run artifacts committed during the run and purged by gitflow finish (BDR-065), added to FILE SCOPE; the disable is removed (double quotes with escaped backticks, as loops-light), no suppression authorized [2026-11-20]
|
||||
|
||||
Q: STEP 6 opus review (With fixes: 2 Important) / A: main loop: fixed as plan section "Review fix round 1" (allowed agents' lines reworded "one call allowed" and locked T20; CLAUDE.global parenthetical clarified; hook prohibition locked T2c; plan-challenger mirror; effort-shift "other opus-served agents"; agent lines cite ~/.claude path; test lines ≤ 80); suite 38 checks; other minors to TODO [2026-11-20]
|
||||
|
||||
Q: add agents/{plan-challenger,verifier,security-auditor,analyzer}.md to FILE SCOPE (review fix: "one call allowed", locked T20) / A: yes [gated 2026-11-20]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. The new suite lib/tests/subagent-advisor.test.sh (hook output + wiring + carrier locks) is green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/subagent-advisor.test.sh 2>&1 | tail -1 | grep -qE '^subagent-advisor: [0-9]+ pass, 0 fail$' && echo SA-GREEN
|
||||
EXPECT: SA-GREEN
|
||||
EVIDENCE: MET exit=0 marker-found :: SA-GREEN
|
||||
2. The hook emits one valid SubagentStart JSON object naming the advisor tool, whatever its stdin, and exits 0.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for i in '{"agent_type":"general-purpose"}' '' 'not json'; do o=$(printf '%s' "$i" | bash hooks/subagent-advisor.sh); [ $? -eq 0 ] || exit 1; printf '%s' "$o" | jq -e '.hookSpecificOutput.hookEventName == "SubagentStart" and (.hookSpecificOutput.additionalContext | test("advisor"))' >/dev/null || exit 1; done && echo HOOK-OK
|
||||
EXPECT: HOOK-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: HOOK-OK
|
||||
3. settings.json wires SubagentStart to the hook with timeout 5.
|
||||
CHECK: cd /home/bchanot/Documents/claude && jq -e '.hooks.SubagentStart[0].hooks[0] | .command == "bash ~/.claude/hooks/subagent-advisor.sh" and .timeout == 5' settings.json >/dev/null && echo WIRED
|
||||
EXPECT: WIRED
|
||||
EVIDENCE: MET exit=0 marker-found :: WIRED
|
||||
4. The 9 caller template rows and lib/challenge-plan.md carry the `sub-agent` reason; no row keeps the old closing.
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=$(grep -l 'already called this run | sub-agent)' skills/init-project/SKILL.md skills/code-clean/SKILL.md skills/onboard/SKILL.md skills/audit-delta/SKILL.md skills/ship-feature/SKILL.md skills/harden/SKILL.md skills/pack-seo/skills/seo/SKILL.md skills/pack-seo/skills/geo/SKILL.md skills/pack-web-validate/skills/web-validate/SKILL.md lib/challenge-plan.md | wc -l); [ "$n" -eq 10 ] && ! git grep -q 'already called this run)' -- skills lib ':!lib/tests' && echo ROWS-10
|
||||
EXPECT: ROWS-10
|
||||
EVIDENCE: MET exit=0 marker-found :: ROWS-10
|
||||
5. CLAUDE.global.md stays within its 320-line density budget.
|
||||
CHECK: cd /home/bchanot/Documents/claude && [ "$(wc -l < CLAUDE.global.md)" -le 320 ] && echo BUDGET-OK
|
||||
EXPECT: BUDGET-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: BUDGET-OK
|
||||
6. Full make test green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
7. Live delivery: a headless run with a scratch settings file wiring the real hooks/subagent-advisor.sh shows a sub-agent quoting the injected rule (manual, recorded by the main loop; this session may not reload settings). Behavioural proof is NOT claimed here: it is the next /memory-feedback advisor usage table plus a per-dispatch transcript check (dated TODO; tripwires: every typed non-allowed type → 0 calls, sonnet stays 0, general-purpose at most 1 call per dispatch and only in code-review dispatches, checked by hand until advisor.ts splits general-purpose by dispatch; revert = drop the settings entry).
|
||||
8. No vendored skills-external file edited; no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
hooks/subagent-advisor.sh (new), lib/tests/subagent-advisor.test.sh (new), settings.json, CLAUDE.global.md, lib/effort-shift.md, lib/challenge-plan.md, agents/{plugin-advisor,seo-analyzer,geo-analyzer,doc-syncer,commit-changer,handover-doc-writer,client-handover-writer}.md, skills/onboard/SKILL.md, skills/tour/SKILL.md, skills/ship-feature/SKILL.md, skills/init-project/SKILL.md, skills/{code-clean,audit-delta,harden}/SKILL.md, skills/pack-seo/skills/{seo,geo}/SKILL.md, skills/pack-web-validate/skills/web-validate/SKILL.md, docs/superpowers/plans/2026-11-19-advisor-subagent-scope.md + docs/superpowers/plans/2026-11-19-advisor-subagent-scope/apply.py (transient, BDR-065), agents/{plan-challenger,verifier,security-auditor,analyzer}.md (review fix round 1, gated)
|
||||
@@ -0,0 +1,49 @@
|
||||
# CONTRACT — advisor-usage (Run C)
|
||||
- date: 2026-11-19 | flow: feat | branch: feature/advisor-usage
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Merge et corrige le bug et fais les todo
|
||||
|
||||
Scope of this run (main loop): TODO:18 Run C — advisor usage section in /memory-feedback (main loop vs sub-agents, model served, input tokens; dedupe usage rows by message.id, model from the `advisor_message` iteration).
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: placement / A: a "## Advisor usage (<from> → <to>)" section appended to FEEDBACK.md by `reader.ts apply`, printed with the gates, even at 0 records [gated 2026-11-19]
|
||||
Q: sub-agent breakdown / A: per agent type from subagents/agent-<id>.meta.json `agentType`; unknown → "sub-agent (unknown)"; main thread = "main loop" [gated 2026-11-19]
|
||||
Q: scope / A: every project under ~/.claude/projects summed, no repo name or tag in the table [gated 2026-11-19]
|
||||
Q: window / A: since the last /memory-feedback run (state.json lastRun) to now; first run (lastRun 0) = everything on disk [gated 2026-11-19]
|
||||
Q: retention note / A: when the window exceeds 7 days, "Transcripts kept 7 d: calls before <date> may be missing." under the heading [gated 2026-11-19]
|
||||
Q: shape drift / A: 0 calls but usage rows mention advisor_message → "N transcript lines mention advisor_message, none parsed: check the transcript shape." in place of the plain zero [gated 2026-11-19]
|
||||
Q: challenge (3 lenses) changes: call = served advisor iteration (block without iteration not counted), per-dir skip, dated Unavailable heading, no 6th local in commit(), compact 999950 → 1.0M / A: main loop, internal [2026-11-19]
|
||||
|
||||
Q: GATE 0 run 1 criterion 1 oracle broken (bun prints file names only on failure) / A: main loop, oracle corrected to run advisor.test.ts directly; criterion 4 red = mods.test.sh model-router plugin test timeout at load avg ~30 (121 s alone vs CLI_TIMEOUT 120), unrelated to the diff [2026-11-19]
|
||||
|
||||
Q: retention note fires every weekly run (window just over 7 d, cut day = start day) / A: print it only when the cut day is later than the heading's start day [gated 2026-11-19]
|
||||
Q: privacy wording / A: skills/memory-feedback/SKILL.md:12 "keeps IDs, enums and repo tags only" → also names advisor call counts [gated 2026-11-19]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. The memory-feedback bun suite is green and advisor.test.ts runs at least 17 passing tests.
|
||||
CHECK: cd /home/bchanot/Documents/claude/lib/memory-feedback && PATH=$HOME/.bun/bin:$PATH bun test advisor.test.ts 2>&1 | grep -qE '^ *(1[7-9]|[2-9][0-9]) pass' && cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH bash lib/tests/memory-feedback.test.sh 2>&1 | grep -qE '^ *0 fail' && echo MF-GREEN
|
||||
EXPECT: MF-GREEN
|
||||
EVIDENCE: MET exit=0 marker-found :: MF-GREEN
|
||||
2. On real transcripts, advisorUsage + renderAdvisor read this machine's advisor calls: the section heading, a "main loop" row, a Fable-served row and the total row appear (total arithmetic: advisor.test.ts).
|
||||
CHECK: cd /home/bchanot/Documents/claude/lib/memory-feedback && PATH=$HOME/.bun/bin:$PATH bun -e 'import {advisorUsage,renderAdvisor} from "./advisor.ts"; const p=require("os").homedir()+"/.claude/projects"; const t=advisorUsage(p,0,Date.now()); const u=t.uses; const s=renderAdvisor(t,0,Date.now()); const ok=s.startsWith("## Advisor usage (all on disk → ")&&u.some(x=>x.caller==="main loop")&&u.some(x=>x.model.startsWith("claude-fable"))&&s.includes("| total |"); console.log(ok?"ADV-SMOKE":"bad")'
|
||||
EXPECT: ADV-SMOKE
|
||||
EVIDENCE: MET exit=0 marker-found :: ADV-SMOKE
|
||||
3. `reader.ts apply` writes the section into FEEDBACK.md (reader.test.ts locks it) and the skill's STEP 5 tells the user to show it.
|
||||
CHECK: cd /home/bchanot/Documents/claude && grep -qF '## Advisor usage' lib/memory-feedback/reader.test.ts && grep -qF '`## Advisor usage`' skills/memory-feedback/SKILL.md && echo WIRED
|
||||
EXPECT: WIRED
|
||||
EVIDENCE: MET exit=0 marker-found :: WIRED
|
||||
4. Full make test green (code-limits and the citers census included).
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
5. Manual: the table carries no repo name, slug, path or prompt text (callers are agent types or the two fixed labels, models are id-shaped); rows are deduped by message.id; an unreadable transcript is skipped, a failure of the whole section never fails `apply`; new code within the global limits (25 logic lines/function, 80 cols, 5 params, 5 locals).
|
||||
|
||||
6. The retention note prints only when its cut day is later than the heading's start day (advisor.test.ts test 13 covers a 7-day-plus-hours window with no note), and SKILL.md's data line names the advisor counts.
|
||||
CHECK: cd /home/bchanot/Documents/claude/lib/memory-feedback && PATH=$HOME/.bun/bin:$PATH bun -e 'import {renderAdvisor} from "./advisor.ts"; const D=86400000, to=Date.UTC(2026,10,19,17); const t={uses:[],unparsed:0,files:1}; const wk=renderAdvisor(t,to-7*D-5*3600000,to), two=renderAdvisor(t,to-14*D,to); console.log(!wk.includes("Transcripts kept")&&two.includes("calls before 2026-11-12 may be missing.")?"RET-OK":"bad")' | grep -qF RET-OK && grep -qF 'advisor call counts' /home/bchanot/Documents/claude/skills/memory-feedback/SKILL.md && echo RET-OK
|
||||
EXPECT: RET-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: RET-OK
|
||||
|
||||
## FILE SCOPE
|
||||
lib/memory-feedback/advisor.ts (new), lib/memory-feedback/advisor.test.ts (new), lib/memory-feedback/reader.ts, lib/memory-feedback/reader.test.ts, skills/memory-feedback/SKILL.md
|
||||
@@ -0,0 +1,41 @@
|
||||
# CONTRACT — degraded-tool-line
|
||||
- date: 2026-11-19 | flow: bugfix | branch: bugfix/degraded-tool-line
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Merge et corrige le bug et fais les todo
|
||||
|
||||
Scope of this run (main loop, from the previous turn's report): "le bug" = BUGS-FOUND.md:134 (security-auditor prints `VERDICT: PASS` on a DEGRADED scan, DEGRADED only on its `TOOL:` line; lib/verify-secure-loop.md, agents/security-auditor.md and skills/hotfix/SKILL.md teach DEGRADED as a VERDICT-line value); TODO:13 (loops-light lock on the feat/bugfix skip sentence) folds in as the regression test. TODO:14 and Run C are separate runs.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: fix plan (.claude/tasks/plans/2026-11-19-degraded-tool-line-0930.md, STEP 3 gate with challenge summary) / A: yes [gated 2026-11-19]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. loops-light carries the new locks and is green: 78 pass, 0 fail.
|
||||
CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '78 pass, 0 fail' && echo LOCKS-78
|
||||
EXPECT: LOCKS-78
|
||||
EVIDENCE: MET exit=0 marker-found :: LOCKS-78
|
||||
2. No reader lists DEGRADED as a VERDICT value: the backticked token `DEGRADED` is gone from the three readers.
|
||||
CHECK: cd /home/bchanot/Documents/claude && ! grep -qF '`DEGRADED`' lib/verify-secure-loop.md agents/security-auditor.md skills/hotfix/SKILL.md && echo OLD-VALUE-GONE
|
||||
EXPECT: OLD-VALUE-GONE
|
||||
EVIDENCE: MET exit=0 marker-found :: OLD-VALUE-GONE
|
||||
3. Each of the three readers' PASS branch reads the TOOL line first and makes a PASS without it a structural failure (joined text).
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in lib/verify-secure-loop.md agents/security-auditor.md skills/hotfix/SKILL.md; do tr '\n' ' ' < "$f" | tr -s ' ' | grep -qF '`PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows there, never on the VERDICT line; a PASS with no `TOOL:` line is a structural failure (below).' && n=$((n+1)); done; [ "$n" -eq 3 ] && echo READERS-3
|
||||
EXPECT: READERS-3
|
||||
EVIDENCE: MET exit=0 marker-found :: READERS-3
|
||||
4. The auditor's and hotfix's structural-failure lists name a PASS with no TOOL line (joined text).
|
||||
CHECK: cd /home/bchanot/Documents/claude && tr '\n' ' ' < agents/security-auditor.md | tr -s ' ' | grep -qF 'PASS without PROOF or without `TOOL:` line) → retry ONCE fresh' && tr '\n' ' ' < skills/hotfix/SKILL.md | tr -s ' ' | grep -qF 'Structural failure (mute / unparsable / no VERDICT line / PASS with no `TOOL:` line) → treat as a failed gate' && echo STRUCT-2
|
||||
EXPECT: STRUCT-2
|
||||
EVIDENCE: MET exit=0 marker-found :: STRUCT-2
|
||||
5. lib/effort-shift.md § Advisor item 3 names the line DEGRADED prints on, and hotfix's DEGRADED PASS sets its SECURITY field.
|
||||
CHECK: cd /home/bchanot/Documents/claude && tr '\n' ' ' < lib/effort-shift.md | tr -s ' ' | grep -qF '`skipped (gates clean on first pass)`; DEGRADED shows on the auditor'"'"'s `TOOL:` line. A skipped call discharges' && tr '\n' ' ' < skills/hotfix/SKILL.md | tr -s ' ' | grep -qF 'a DEGRADED PASS sets the summary'"'"'s SECURITY field to `DEGRADED (checklist only)`' && echo EFF-HOT-OK
|
||||
EXPECT: EFF-HOT-OK
|
||||
EVIDENCE: MET exit=0 marker-found :: EFF-HOT-OK
|
||||
6. Full make test green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
7. The new locks are red on develop's readers (16 FAIL simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
lib/verify-secure-loop.md, agents/security-auditor.md, skills/hotfix/SKILL.md, lib/effort-shift.md, lib/tests/loops-light.test.sh
|
||||
@@ -0,0 +1,34 @@
|
||||
# CONTRACT — merge-reuse-clause (run 1 of 2)
|
||||
- date: 2026-11-19 | flow: feat | branch: feature/advisor-merge-reuse
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Merge et corrige le bug et fais les todo
|
||||
|
||||
Scope of this run (main loop): TODO:14 — the end-of-run advisor lines in skills/a11y, skills/guardrails, skills/ship-feature, skills/init-project restate lib/effort-shift.md § Advisor item 3's merge-reuse clause, plus a regression lock in lib/tests/loops-light.test.sh. Run 2 (same branch) does feat + bugfix.
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: challenge MINORs (lock 1 anchored on "the gates.", lock 3 "commits excepted)." with si re-wrap, $EFF source lock → 91) / A: main loop, internal (no visible wording change) [2026-11-19]
|
||||
Q: which sites get the clause / A: all 6 (the 4 named + feat + bugfix); /feat 5-file cap → two /feat runs on one branch, this run = the 4 named sites [gated 2026-11-19]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. loops-light carries 13 new locks (3 per site + the lib source) and is green: 91 pass, 0 fail.
|
||||
CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '91 pass, 0 fail' && echo LOCKS-91
|
||||
EXPECT: LOCKS-91
|
||||
EVIDENCE: MET exit=0 marker-found :: LOCKS-91
|
||||
2. Each of the four sites carries the full clause right after its "a fix it drives goes back through the gates." (joined text).
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in a11y guardrails ship-feature init-project; do tr '\n' ' ' < skills/$f/SKILL.md | tr -s ' ' | grep -qF 'goes back through the gates. A later merge proposal reuses this answer and names any code commit made after it (doc and memory commits excepted).' && n=$((n+1)); done; [ "$n" -eq 4 ] && echo SITES-4
|
||||
EXPECT: SITES-4
|
||||
EVIDENCE: MET exit=0 marker-found :: SITES-4
|
||||
3. lib/effort-shift.md item 3 is unchanged (the clause stays single-sourced there).
|
||||
CHECK: cd /home/bchanot/Documents/claude && git diff --quiet develop -- lib/effort-shift.md && echo EFF-UNCHANGED
|
||||
EXPECT: EFF-UNCHANGED
|
||||
EVIDENCE: MET exit=0 marker-found :: EFF-UNCHANGED
|
||||
4. Full make test green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
5. The new site locks are red on develop's skills (12 FAIL; the lib lock passes on develop simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
skills/a11y/SKILL.md, skills/guardrails/SKILL.md, skills/ship-feature/SKILL.md, skills/init-project/SKILL.md, lib/tests/loops-light.test.sh
|
||||
@@ -0,0 +1,33 @@
|
||||
# CONTRACT — merge-reuse-feat-bugfix (run 2 of 2)
|
||||
- date: 2026-11-19 | flow: feat | branch: feature/advisor-merge-reuse
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Merge et corrige le bug et fais les todo
|
||||
|
||||
Scope of this run (main loop): TODO:14 run 2 — the feat and bugfix end-of-run lines restate lib/effort-shift.md § Advisor item 3's merge-reuse clause with the skip ("reuses the last run's answer, or its skip"), plus loops-light locks. Run 1 = af846d6 (a11y, guardrails, ship-feature, init-project).
|
||||
|
||||
## CLARIFICATIONS
|
||||
Q: which sites get the clause / A: all 6; feat/bugfix get "reuses the last run's answer, or its skip" (scope question option text) [gated 2026-11-19]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. loops-light carries 6 new locks (3 per site) and is green: 97 pass, 0 fail.
|
||||
CHECK: cd /home/bchanot/Documents/claude && bash lib/tests/loops-light.test.sh 2>&1 | tail -1 | grep -qF '97 pass, 0 fail' && echo LOCKS-97
|
||||
EXPECT: LOCKS-97
|
||||
EVIDENCE: MET exit=0 marker-found :: LOCKS-97
|
||||
2. feat and bugfix carry the full clause right after their "a fix it drives goes back through the gates." (joined text).
|
||||
CHECK: cd /home/bchanot/Documents/claude && n=0; for f in feat bugfix; do tr '\n' ' ' < skills/$f/SKILL.md | tr -s ' ' | grep -qF 'goes back through the gates. A later merge proposal reuses the last run'"'"'s answer, or its skip, and names any code commit made after it (doc and memory commits excepted).' && n=$((n+1)); done; [ "$n" -eq 2 ] && echo SITES-2
|
||||
EXPECT: SITES-2
|
||||
EVIDENCE: MET exit=0 marker-found :: SITES-2
|
||||
3. The 9814720 skip locks and lib/effort-shift.md stay intact: lib unchanged vs develop, and the skip sentence's locked fragments still present in both skills.
|
||||
CHECK: cd /home/bchanot/Documents/claude && git diff --quiet develop -- lib/effort-shift.md && for f in skills/feat/SKILL.md skills/bugfix/SKILL.md; do grep -qF 'a verdict no longer in view runs the call.' "$f" && grep -qF "auditor's \`TOOL:\` line, beside a PASS." "$f" || exit 1; done && echo SKIP-INTACT
|
||||
EXPECT: SKIP-INTACT
|
||||
EVIDENCE: MET exit=0 marker-found :: SKIP-INTACT
|
||||
4. Full make test green.
|
||||
CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test </dev/null 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
5. The 6 new locks are red before the edit (simulated on a scratch clone before dispatch); no wording changed outside the plan's blocks; new prose lines ≤ 80 columns (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
skills/feat/SKILL.md, skills/bugfix/SKILL.md, lib/tests/loops-light.test.sh
|
||||
@@ -0,0 +1,77 @@
|
||||
# CONTRACT — done-triage-levers
|
||||
- date: 2026-11-20 | flow: feat | branch: feature/done-triage-levers
|
||||
- status: active
|
||||
- run-base: 68a4d8b
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Implémente les six leviers décrits dans .claude/tasks/plans/2026-11-20-done-and-triage-levers.md (TODO "NEXT, fresh session"). Suis le plan tel quel : 5 fichiers, challenge maintenu car c'est un nouveau mécanisme.
|
||||
|
||||
## CLARIFICATIONS
|
||||
none — request complete (the handoff plan names the six levers, their substance and their five carriers; placement and exact prose are settled in the run plan .claude/tasks/plans/2026-11-20-done-triage-levers-1413.md, challenged r1 by three lenses)
|
||||
Q: CLAUDE.global.md lever-4 line wording / A: keep "A TODO loop notes its start SHA in TODO.md, runs that list + user adds; new items: report, run if one breaks its work." [gated 2026-11-20]
|
||||
Q: strings `MINOR dropped: <finding>` and `Challenge: skipped (placed decision: …)` / A: both OK [gated 2026-11-20]
|
||||
Q: extend scope to (a) lib/contract-interview.md STEP 4 and (b) skills/ship-feature STEP 6 + skills/init-project STEP 10? / A: both (a) and (b). Three more files exceed /feat's five-file cap: this run stays on its five files, (a)+(b) run as a follow-up /feat right after this one (3 files) [gated 2026-11-20]
|
||||
Q: GATE 2 REPORTED (1) LOW `$run_base` reaches `git diff` without `--end-of-options`/SHA check (lib/capitalize-commit.md:75), (2) verifier STEP 4 accepts `[gated]` lines on a tracked contract / A: fix both in the follow-up /feat (now 5 files: contract-interview, ship-feature, init-project, capitalize-commit, verifier) [gated 2026-11-20]
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. Lever 1, done = oracles green: lib/verify-secure-loop.md has `## DONE: oracles green, reopened only on evidence`: done at GATE 0 MET + GATE 1 CONFORME + GATE 2 PASS; a review reopens only with reproducible evidence (a command failing on HEAD, or real output shown wrong); a plausible scenario gets one attempt at a failing command, else it is a MINOR; a behavioural claim is done at locks green + one live probe + one dated measurement.
|
||||
CHECK: f=lib/verify-secure-loop.md; grep -q '^## DONE: oracles green, reopened only on evidence$' $f && grep -q 'only with reproducible evidence: a command that fails on HEAD, or real$' $f && grep -q '^output shown wrong. A plausible scenario alone does not reopen the run:$' $f && grep -q '^the main loop tries once to turn it into a failing command, and if it$' $f && grep -q '^the rule") is done at its locks green, one live probe and one dated$' $f && echo LEVER1_OK
|
||||
EXPECT: LEVER1_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: LEVER1_OK
|
||||
2. Lever 2, MINOR triage: lib/verify-secure-loop.md has `## MINOR triage: fold before dispatch, or drop`: a MINOR on the run's plan or diff is folded before dispatch or dropped; no post-gate fix round; a drop is one `MINOR dropped:` line in the report and the run's plan file, nothing in TODO.md / BUGS-FOUND.md / a registry; backlog only on reproducible evidence or user ask; a security finding is never droppable and goes to the user; doc-syncer's `[MINOR]` patch class, guardrails, gates and user questions are untouched.
|
||||
CHECK: f=lib/verify-secure-loop.md; grep -q '^## MINOR triage: fold before dispatch, or drop$' $f && grep -q '^fix round after the gates for a MINOR: it costs a full gate cycle. A drop$' $f && grep -q 'is one line, `MINOR dropped: <finding>`, in the run report and appended to$' $f && grep -q 'the run.s plan file; nothing goes to TODO.md, BUGS-FOUND.md or any$' $f && grep -q 'what the user asks for. Never a droppable MINOR: a security finding (a$' $f && grep -q '^Untouched by this triage: doc-syncer.s `\[MINOR\]` patch class, the safety$' $f && echo LEVER2_OK
|
||||
EXPECT: LEVER2_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: LEVER2_OK
|
||||
3. Lever 3, placed decision: lib/challenge-plan.md has `## SKIP: a placed decision` before `## DISPATCH`: skip = no challengers and no plan advisor call; three required conditions (text dictated by the decision; the decision is the user's own words or was challenged in the run that wrote it; the caller runs verify-secure-loop.md after its dispatch); the open-choice test, never code versus text, in doubt challenge; the skip is the include's own path (user decision 2026-11-20) and discharges the plan point of effort-shift § Advisor; the caller prints `Challenge: skipped (placed decision: …)`.
|
||||
CHECK: f=lib/challenge-plan.md; s=$(grep -n '^## SKIP: a placed decision$' $f | cut -d: -f1); d=$(grep -n '^## DISPATCH' $f | cut -d: -f1); [ -n "$s" ] && [ "$s" -lt "$d" ] && grep -q '^no challengers and no plan advisor call. Three conditions, all required:$' $f && grep -q '^decision.s text is the user.s own words, or was challenged in the run that$' $f && grep -q '^user did not dictate), never code versus text; in doubt, challenge. The$' $f && grep -q '^skip is this include.s own path (user decision 2026-11-20): a skill.s$' $f && grep -q '^discharges the plan point (`lib/effort-shift.md` § Advisor). The caller prints$' $f && grep -q '^`Challenge: skipped (placed decision: <the user.s decision, date>)` in$' $f && echo LEVER3_OK
|
||||
EXPECT: LEVER3_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: LEVER3_OK
|
||||
4. Lever 2 at the challenge synthesis: lib/challenge-plan.md's SYNTHESIZE MINOR bullet says each MINOR is folded now or dropped, gives the drop format inline, routes a security finding to the user, and cites `lib/verify-secure-loop.md` § MINOR triage.
|
||||
CHECK: f=lib/challenge-plan.md; grep -q '^ Each MINOR is folded into the plan now or dropped: a drop is one$' $f && grep -q '^ `MINOR dropped: <finding>` line in the report and the plan file, nothing$' $f && grep -q '^ (`lib/verify-secure-loop.md` § MINOR triage).$' $f && echo SYNTH_OK
|
||||
EXPECT: SYNTH_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: SYNTH_OK
|
||||
5. Lever 4, frozen loop list: CLAUDE.global.md's Planning & TODO section says a TODO loop notes its start SHA in TODO.md, runs that list plus user adds, reports new items and runs one only if it breaks its work; the file stays at or under 320 lines and the new lines at or under 80 chars.
|
||||
CHECK: f=CLAUDE.global.md; [ "$(wc -l < $f)" -le 320 ] && awk '/^## Planning & TODO/{p=1;next} /^## /{p=0} p' $f > /tmp/.cg5.$$ && grep -q '^ then carries one line per run. A TODO loop notes its start SHA in TODO.md,$' /tmp/.cg5.$$ && grep -q '^ runs that list + user adds; new items: report, run if one breaks its work.$' /tmp/.cg5.$$ && [ "$(git diff -U0 68a4d8b -- $f | grep '^+[^+]' | awk 'length($0)>81' | wc -l)" -eq 0 ] && rm -f /tmp/.cg5.$$ && echo LEVER4_OK
|
||||
EXPECT: LEVER4_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: LEVER4_OK
|
||||
6. Lever 5 main-loop side: lib/verify-secure-loop.md's header says its first section runs before the dev dispatch; `## BEFORE THE FIRST DISPATCH: contract dry run (main loop)` sits before `## GATE 0`, applies when the flow wrote a contract with `CHECK:` lines, records `- run-base: <git rev-parse HEAD>` (a SHA), runs `gates.sh run` on a `mktemp -d` copy from the project root (no ERROR, NOT-MET only for undone work and for that reason, already-MET valid only for keep-green rows), states the scratch-copy simulation for prose oracles inline, and fixes bad oracles before any floor loop. lib/challenge-plan.md restates the two actions outside the SKIP condition, before the executor dispatch.
|
||||
CHECK: f=lib/verify-secure-loop.md; b=$(grep -n '^## BEFORE THE FIRST DISPATCH: contract dry run (main loop)$' $f | cut -d: -f1); g=$(grep -n '^## GATE 0' $f | cut -d: -f1); [ -n "$b" ] && [ "$b" -lt "$g" ] && grep -q '^section runs before the dev step is dispatched). Turns a$' $f && grep -q '^When the flow wrote a contract with `CHECK:` lines, the main loop does two$' $f && grep -q '^ `- run-base: <git rev-parse HEAD>` (a SHA, never a branch name;$' $f && grep -q '^2. Copies the contract to a `mktemp -d` path and, from the project root,$' $f && grep -q '^ to a scratch copy of the repo and run the CHECKs there (LRN-296).$' $f && grep -q '^A bad oracle is fixed in the contract here, before any floor loop.$' $f && grep -q '^Challenged or skipped: when the flow wrote a contract with `CHECK:` lines,$' lib/challenge-plan.md && grep -q '^before the executor dispatch the main loop records `- run-base:` in the$' lib/challenge-plan.md && grep -q '^(`lib/verify-secure-loop.md` § BEFORE THE FIRST DISPATCH).$' lib/challenge-plan.md && echo DRYRUN_OK
|
||||
EXPECT: DRYRUN_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: DRYRUN_OK
|
||||
7. Lever 5 verifier side: agents/verifier.md STEP 4 counts run artifacts in scope by default (name-status plus untracked): a plan file the diff ADDS under `.claude/tasks/plans/` or `docs/superpowers/plans/`; on an existing plan, appended `MINOR dropped:` lines only; the CONTRACT handed to the verifier, whole when untracked or added, else only its `EVIDENCE:`, `- run-base:` and `[gated]` lines; any other plan or contract change stays out of scope. lib/verify-secure-loop.md's out-of-scope bullet points to it.
|
||||
CHECK: f=agents/verifier.md; awk '/^## STEP 4/{p=1;next} /^## /{p=0} p' $f > /tmp/.vf7.$$; grep -q '^`FILE SCOPE` says: a plan file the diff ADDS under `.claude/tasks/plans/`$' /tmp/.vf7.$$ && grep -q '^`MINOR dropped:` lines only; the CONTRACT you were handed, whole when$' /tmp/.vf7.$$ && grep -q '^untracked or added, else only its `EVIDENCE:` lines, `- run-base:` line and$' /tmp/.vf7.$$ && grep -q '^`\[gated\]` entries. Any other change to a plan or a contract stays out of$' /tmp/.vf7.$$ && grep -q '^ default (`agents/verifier.md`, STEP 4).$' lib/verify-secure-loop.md && rm -f /tmp/.vf7.$$ && echo SCOPE_OK
|
||||
EXPECT: SCOPE_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: SCOPE_OK
|
||||
8. Lever 6, `TODO +n / -m`: lib/capitalize-commit.md computes `<todo>` in DO step 1, before step 2's commit; `run_base` is a SHA from the contract's `- run-base:` line else `git rev-parse HEAD` at that point (with a `shortcut:` note); a failing diff gives `TODO n/a`; step 3 and both rc 0 templates carry `· <todo>`. The 6-line snippet, on a fixture where a run closes one open item, edits a closed one and adds two, yields `TODO +2 / -1` with the start SHA (uncommitted, then committed, run from a subdirectory), the same with `HEAD` on the uncommitted change, and `TODO n/a` on an unknown SHA.
|
||||
CHECK: f=$PWD/lib/capitalize-commit.md; a=$(grep -n '^ Then, still before step 2, count the run.s TODO movement as `<todo>`:$' $f | cut -d: -f1); c=$(grep -n '^2. Commit surgically' $f | cut -d: -f1); [ -n "$a" ] && [ "$a" -lt "$c" ] && grep -q '^3. Report by (rc, mem_hash). Every report line ends with `· <todo>` (step 1):$' $f && grep -q '`✅ mémoire committée <mem_hash> · <todo>`' $f && grep -q '`CAPITALIZE: rien à committer · <todo>`' $f && grep -q 'never the gitflow base branch: the contract.s `- run-base:` line' $f && grep -q '`git rev-parse HEAD` now (shortcut: without a contract only the pending' $f && t=$(mktemp -d) && s=$t/s.sh && awk '/^ if d=\$\(git diff --no-color/{p=1} p{print} p&&/todo="TODO n\/a"; fi$/{exit}' $f | sed 's/^ //' > $s && [ "$(wc -l < $s)" -eq 6 ] && mkdir $t/r && cd $t/r && git init -q && mkdir -p .claude/tasks sub && printf -- '- [ ] a\n- [ ] b\n- [x] old\n' > .claude/tasks/TODO.md && git add . && git -c user.email=t@t -c user.name=t commit -qm base && b=$(git rev-parse HEAD) && printf -- '- [x] a DONE\n- [ ] b\n- [x] old edited\n- [ ] c\n- [ ] d\n' > .claude/tasks/TODO.md && r1=$(run_base=$b bash -c ". $s; echo \"\$todo\"") && r2=$(run_base=HEAD bash -c ". $s; echo \"\$todo\"") && r3=$(run_base=0123456789abcdef0123456789abcdef01234567 bash -c ". $s; echo \"\$todo\"") && git add . && git -c user.email=t@t -c user.name=t commit -qm run && r4=$(cd sub && run_base=$b bash -c ". $s; echo \"\$todo\"") && echo "R1=$r1 R2=$r2 R3=$r3 R4=$r4"
|
||||
EXPECT: R1=TODO +2 / -1 R2=TODO +2 / -1 R3=TODO n/a R4=TODO +2 / -1
|
||||
EVIDENCE: MET exit=0 marker-found :: R1=TODO +2 / -1 R2=TODO +2 / -1 R3=TODO n/a R4=TODO +2 / -1
|
||||
9. No em-dash in any line this run adds to the five files, and all five files are changed.
|
||||
CHECK: n=$(git diff -U0 68a4d8b -- lib/verify-secure-loop.md lib/challenge-plan.md CLAUDE.global.md lib/capitalize-commit.md agents/verifier.md | grep '^+[^+]' | grep -c '—'); [ "$n" -eq 0 ] && [ "$(git diff --name-only 68a4d8b -- lib/verify-secure-loop.md lib/challenge-plan.md CLAUDE.global.md lib/capitalize-commit.md agents/verifier.md | wc -l)" -eq 5 ] && echo NODASH_OK
|
||||
EXPECT: NODASH_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: NODASH_OK
|
||||
10. Locking suites stay green (doctrine census incl. the new § citations, escalate-route count, challenge wiring, advisor row lock).
|
||||
CHECK: make test suite="lib/tests/doctrine-citers.test.sh lib/tests/effort-routing.test.sh lib/tests/plan-challenger.test.sh lib/tests/subagent-advisor.test.sh" 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
11. Loop and gate suites stay green.
|
||||
CHECK: make test suite="lib/tests/loops-light.test.sh lib/tests/loops-heavy.test.sh lib/tests/gates.test.sh lib/tests/contract-verifier.test.sh lib/tests/model-routing.test.sh lib/tests/curated-config-guard.test.sh" 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
12. Not loosened: apart from the changes criteria 1-8 name (criterion 13's file is outside this count), no existing line of the five files is removed or weakened. Exactly 8 lines are removed against 68a4d8b, each an anchor the plan extends or re-wraps (verify-secure-loop.md header line 3 and "otherwise the dev removes the file.", CLAUDE.global.md "then carries one line per run.", verifier.md's two STEP 4 lines "Compare against the contract's `FILE SCOPE`. Report every out-of-scope" / "file. Disposition is NOT your call: …", capitalize-commit.md "3. Report by (rc, mem_hash):" and its two rc 0 templates); GATE 0 and the security gate read as before.
|
||||
CHECK: n=$(git diff --numstat 68a4d8b -- lib/verify-secure-loop.md lib/challenge-plan.md CLAUDE.global.md lib/capitalize-commit.md agents/verifier.md | awk '{d+=$2} END{print d+0}'); [ "$n" -eq 8 ] && echo REMOVED_8
|
||||
EXPECT: REMOVED_8
|
||||
EVIDENCE: MET exit=0 marker-found :: REMOVED_8
|
||||
13. [gated 2026-11-20] Citer: lib/effort-shift.md § Advisor point 1 says the plan advisor call is skipped with the challenge for a placed decision, citing `lib/challenge-plan.md` § SKIP; the census still resolves every citation.
|
||||
CHECK: f=lib/effort-shift.md; grep -q '^ challengers see it (`lib/challenge-plan.md`), at most once per skill run;$' $f && grep -q '^ skipped with the challenge for a placed decision (`lib/challenge-plan.md` § SKIP).$' $f && make test suite=lib/tests/doctrine-citers.test.sh 2>&1 | tail -1 | grep -q 'all suites green' && echo CITER_OK
|
||||
EXPECT: CITER_OK
|
||||
EVIDENCE: MET exit=0 marker-found :: CITER_OK
|
||||
|
||||
## FILE SCOPE
|
||||
- lib/verify-secure-loop.md
|
||||
- lib/challenge-plan.md
|
||||
- CLAUDE.global.md
|
||||
- lib/capitalize-commit.md
|
||||
- agents/verifier.md
|
||||
- lib/effort-shift.md [gated 2026-11-20] (citer of lever 3)
|
||||
- this contract and .claude/tasks/plans/2026-11-20-done-triage-levers-1413.md (run artifacts)
|
||||
@@ -0,0 +1,173 @@
|
||||
# Fix plan — gates.sh stray oracle + default timeout (hotfix)
|
||||
|
||||
Contract: .claude/tasks/contracts/2026-11-17-gates-label-timeout-2342.md
|
||||
Branch: bugfix/gates-label-timeout. Files: lib/gates.sh, lib/tests/gates.test.sh.
|
||||
|
||||
## Root causes
|
||||
1. `_absorb` (lib/gates.sh:86-98) opens a criterion only on
|
||||
`^([0-9]+)\.[[:space:]]+(.*)$`. Any other label (`1b. sub`, `1.1 dotted`,
|
||||
`2) paren`, an indented ` 2. sub`, `- sub`, `**2.** sub`) matches no
|
||||
branch and is dropped as prose, but `_CUR` still points at the previous
|
||||
criterion, so `_set_attr` lets the CHECK/EXPECT/EVIDENCE under it
|
||||
overwrite that criterion's oracle. Criterion 1 with `CHECK: exit 1`
|
||||
followed by a stray passing oracle yields VERDICT: MET (LRN-284; all six
|
||||
shapes reproduced on a scratch copy).
|
||||
2. `TIMEOUT="${GATES_TIMEOUT:-120}"` (lib/gates.sh:32) is per CHECK; the full
|
||||
`make test` takes ~135 s, so a "full suite green" criterion goes NOT-MET
|
||||
on timeout unless the caller exports GATES_TIMEOUT (contracts used
|
||||
400/600/1200).
|
||||
|
||||
## Edit — lib/gates.sh (exact)
|
||||
A. Line 32: `TIMEOUT="${GATES_TIMEOUT:-600}"`, with three comment lines
|
||||
right above it:
|
||||
```bash
|
||||
# TIMEOUT is per CHECK and a run lasts their sum: the caller's own limit (a
|
||||
# foreground tool call stops at 600 s) must cover it, else run it in the
|
||||
# background. A killed run writes nothing back; the floor stays PENDING.
|
||||
```
|
||||
|
||||
B. `_set_attr`: a comment line above the function, then a guard between the
|
||||
`_CUR -lt 0` block and the assigning `case`:
|
||||
```bash
|
||||
# A second attribute on one criterion is an error, never an overwrite: it
|
||||
# is what an oracle under a label the parser missed looks like (LRN-284).
|
||||
_set_attr() { # _set_attr <CHECK|EXPECT|EVIDENCE> <value> <lineno>
|
||||
if [ "$_CUR" -lt 0 ]; then
|
||||
_err "$1 at line $3 belongs to no criterion"
|
||||
return 0
|
||||
fi
|
||||
local seen=""
|
||||
case "$1" in
|
||||
CHECK) seen="${_CHECK[_CUR]}" ;;
|
||||
EXPECT) seen="${_EXPECT[_CUR]}" ;;
|
||||
EVIDENCE) [ "${_EVLINE[_CUR]}" = 0 ] || seen=yes ;;
|
||||
esac
|
||||
if [ -n "$seen" ]; then
|
||||
_err "second $1: at line $3 in criterion ${_ID[_CUR]}"
|
||||
return 0
|
||||
fi
|
||||
case "$1" in
|
||||
```
|
||||
C. `_absorb`: new branch right after the criterion branch, before ABANDON:
|
||||
```bash
|
||||
elif [[ "$1" =~ ^[0-9] ]]; then
|
||||
_err "malformed criterion label at line $2 (want \`N. text\`)"
|
||||
_CUR=-1
|
||||
```
|
||||
It covers the case B cannot: a digit label after a MANUAL criterion
|
||||
(no attribute yet) would otherwise lend it the stray oracle. The comment
|
||||
above `_absorb` gains: "A digit-led line that is not `N. text` (`1b.`,
|
||||
`1.1`, `2)`) is rejected and orphans what follows, like a duplicate id."
|
||||
|
||||
D. `main`: when no criterion parsed, the die message carries the first
|
||||
parse error, so an all-malformed block (`1) a`, `2) b`) still names its
|
||||
line:
|
||||
`main`'s locals become `local mode="$1" file="$2" first`, and the
|
||||
two-line `[ "${#_ID[@]}" -gt 0 ] || _die "no numbered criteria …"`
|
||||
becomes:
|
||||
```bash
|
||||
if [ "${#_ID[@]}" -eq 0 ]; then
|
||||
first="${_ERRORS[0]:+; ${_ERRORS[0]}}"
|
||||
_die "no numbered criteria under ## ACCEPTANCE CRITERIA$first"
|
||||
fi
|
||||
```
|
||||
|
||||
Any `_ERRORS` entry already makes the verdict ERROR rc 2 and executes
|
||||
nothing (existing "malformed ledger executes nothing" case).
|
||||
|
||||
Scans done on all 90+ .claude/tasks/contracts/*.md: no unindented digit-led
|
||||
non-criterion line and no criterion with a repeated attribute; `gates.sh
|
||||
status` verdicts identical before/after on every contract (scratch copy).
|
||||
|
||||
## Edit — lib/tests/gates.test.sh (exact)
|
||||
1. Section "fail-closed execution", right after
|
||||
`has "timeout recorded" "NOT-MET timeout=1s"`:
|
||||
```bash
|
||||
# The default must outlast the full suite (~135 s on 2026-11-16): at 120 s
|
||||
# a "full make test green" criterion went NOT-MET on the timeout alone.
|
||||
LAST="$WORK/default-timeout.md"
|
||||
printf '## ACCEPTANCE CRITERIA\n1. manual\n' > "$LAST"
|
||||
out="$(env -u GATES_TIMEOUT bash "$GATES" status "$LAST" 2>&1)"
|
||||
if [[ "$out" == *"timeout 600s"* ]]; then
|
||||
ok "default timeout 600s"
|
||||
else
|
||||
bad "default timeout 600s" "status did not print timeout 600s"
|
||||
fi
|
||||
```
|
||||
2. Section "parse strictness", right after the "duplicate orphans what
|
||||
follows" case (its closing `EOF`):
|
||||
```bash
|
||||
# An oracle under a label the parser does not read as `N. text` must never
|
||||
# overwrite the previous criterion's: criterion 1 fails, the stray oracle
|
||||
# passes, a false MET (LRN-284). A digit-led label is rejected by name;
|
||||
# any other shape trips the second-attribute guard when the previous
|
||||
# criterion already has that attribute (after a manual one it does not).
|
||||
gate "1b. label rejected" run "malformed criterion label at line 6" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
1b. sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "1.1 label rejected" run "malformed criterion label at line 3" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. first
|
||||
1.1 dotted
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "no valid label" run "malformed criterion label at line 2" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
2) paren
|
||||
EOF
|
||||
|
||||
gate "indented label: second CHECK" run "second CHECK: at line 7" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
2. sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "bullet label: second EVIDENCE" run "second EVIDENCE: at line 9" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
- sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
```
|
||||
(Plan text is indented 3 for the list; in the file every heredoc body
|
||||
line starts at column 0 exactly as in the existing cases, the oracle
|
||||
attributes indented 3 spaces.)
|
||||
|
||||
## Residual (accepted)
|
||||
- Any label branch C misses (indented ` 2.`, `- `, `**2.**`) after a MANUAL
|
||||
criterion still lends it the stray oracle: that row turns MANUAL into
|
||||
MET/NOT-MET on an unrelated oracle. No failing oracle is overwritten.
|
||||
- `ABANDON: 1b …` parses as id 1 (gates.sh:90 regex): pre-existing, same
|
||||
class, logged to TODO, not fixed here.
|
||||
- lib/verify-secure-loop.md:46-47 lists ERROR causes as examples; it already
|
||||
omits "no numbered criteria" and "ABANDON names unknown criterion", so the
|
||||
two new causes do not make it newly stale. Logged to TODO (complete the
|
||||
list), not a third file here.
|
||||
- ~/.claude/lib is a symlink to this repo's lib: an in-flight contract in
|
||||
another repo with a repeated attribute or a digit-led prose line now goes
|
||||
ERROR (fail-closed, names the line).
|
||||
|
||||
## Out of scope
|
||||
lib/design-tool-gate.sh:70 (TODO:90, deferred by its own text). The test
|
||||
helper's own `${GATES_TIMEOUT:-120}` stays (fast fixtures only).
|
||||
@@ -0,0 +1,178 @@
|
||||
# Feat plan: advisor usage section in /memory-feedback (Run C, TODO:18)
|
||||
|
||||
## Why
|
||||
LRN-295 measured advisor use by hand (per caller, model, uncached input) and named Run C to
|
||||
automate it. User choices 2026-11-19 [gated]: a section of FEEDBACK.md written by `reader.ts
|
||||
apply`; sub-agents per agent type; all projects summed, no repo in the table; window = since
|
||||
the last run; a retention note when the window exceeds 7 days; a shape-drift line in place of
|
||||
a false zero.
|
||||
|
||||
## Disposition
|
||||
- honors LRN-295 (the method), with one correction: a call = one served advisor iteration, i.e.
|
||||
one `message.usage.iterations[]` entry with `type == "advisor_message"` (model from that entry's
|
||||
`model`, tokens = its `input_tokens`). A `server_tool_use` block named `advisor` with no
|
||||
iteration is NOT a call: on real transcripts 147 blocks vs 141 iterations; the 6 gaps are
|
||||
requests that never ran (re-issued next message) or an `advisor_tool_result_error`. Usage rows
|
||||
repeat once per content block → dedupe by `message.id`.
|
||||
- probe 2026-11-19 over all 1095 transcripts (136 calls then): 0 advisor iterations with
|
||||
cache_read/cache_creation tokens, so `input_tokens` is the whole input; rows sharing an id
|
||||
always carry identical advisor iterations, so first-seen is exact; no `isSidechain` row in a
|
||||
main transcript; no advisor row outside the two path shapes; every meta `agentType` today is a
|
||||
global or built-in agent name (general-purpose, plan-challenger, verifier, …).
|
||||
- honors LRN-267: only `type == "assistant"` records count (blob replays and tool results never
|
||||
do); sub-agent transcripts = `<session>/subagents/agent-<id>.jsonl`, meta beside it
|
||||
(`agent-<id>.meta.json`, field `agentType`).
|
||||
- honors BDR-140: FEEDBACK.md stays local (~/.claude/memory-feedback, never git); the section
|
||||
adds no repo name, slug, path or prompt text: callers are validated agent type strings or two
|
||||
fixed labels, models validated id strings. A project-scoped agent's own name would appear
|
||||
verbatim (none exists today).
|
||||
- honors BDR-100: thresholds.ts untouched; no new gate.
|
||||
- global code limits (our code): ≤ 25 logic lines/function, ≤ 80 cols, ≤ 5 params, ≤ 5 locals
|
||||
(a destructured name counts as a local). Unexported helpers are allowed and expected; the
|
||||
exported names below are final.
|
||||
|
||||
## Files
|
||||
1. lib/memory-feedback/advisor.ts (new)
|
||||
2. lib/memory-feedback/advisor.test.ts (new)
|
||||
3. lib/memory-feedback/reader.ts — `commit()` appends the section
|
||||
4. lib/memory-feedback/reader.test.ts — the apply test asserts the section
|
||||
5. skills/memory-feedback/SKILL.md — STEP 5 shows it
|
||||
|
||||
## advisor.ts — exported API (names final)
|
||||
```ts
|
||||
// lib/memory-feedback/advisor.ts: advisor usage read from Claude Code
|
||||
// transcripts (Run C, LRN-295): served calls and input tokens per caller
|
||||
// and model, deduped by message.id, for the FEEDBACK.md section.
|
||||
export type Use = { caller: string; model: string; calls: number; input: number }
|
||||
export type Tally = { uses: Use[]; unparsed: number; files: number }
|
||||
export type Source = { file: string; caller: string }
|
||||
export const MAIN = 'main loop'
|
||||
export const UNKNOWN_AGENT = 'sub-agent (unknown)'
|
||||
export const RETENTION_DAYS = 7
|
||||
export function transcriptsOf(projects: string, from: number): Source[]
|
||||
export function callerOf(jsonl: string): string
|
||||
export function advisorUsage(projects: string, from: number, to: number): Tally
|
||||
export function compact(n: number): string
|
||||
export function renderAdvisor(t: Tally, from: number, to: number): string
|
||||
export function advisorSection(projects: string, from: number, to: number): string
|
||||
```
|
||||
Suggested private split (names free): a directory lister that never throws, a per-file line
|
||||
reader that returns the counted records, a tally step for one record, the sort comparator.
|
||||
|
||||
Behaviour:
|
||||
- `transcriptsOf`: every directory read is wrapped (`readdirSync`/`lstatSync` in a try; an
|
||||
unreadable or vanished directory or file is skipped, never thrown). `projects` missing → `[]`.
|
||||
For each entry of `projects` that is a real directory (`lstat`, symlinks skipped): every
|
||||
regular `*.jsonl` file directly inside → caller `MAIN`; for each real sub-directory `<session>`,
|
||||
its `subagents` entry when it is a real directory (lstat), every regular `agent-*.jsonl` inside
|
||||
→ caller `callerOf(file)`. A file whose `mtimeMs <= from` is skipped (a small saving: it can
|
||||
hold no row in the window; the substring pre-filter below is what keeps the scan cheap).
|
||||
- `callerOf`: lstats the sibling `<name without .jsonl>.meta.json` first: not a regular file
|
||||
(symlink, FIFO, dir) or larger than 64 KiB → `UNKNOWN_AGENT`; else reads it; its `agentType` when a string
|
||||
matching `/^[A-Za-z0-9_.:-]{1,64}$/`, else `UNKNOWN_AGENT` (missing file, unparsable JSON,
|
||||
non-object, bad type: never throws).
|
||||
- `advisorUsage`: one `seen: Set<string>` of message ids across all files, one tally
|
||||
`Map<string, Use>` keyed `caller + '\t' + model`, one `unparsed` counter, `files` = the number
|
||||
of sources `transcriptsOf` returned. Per source file
|
||||
(read in a try: an unreadable file is skipped): split lines; a line is parsed only when it
|
||||
contains `advisor_message` (pre-filter); JSON errors and non-objects skipped. A record is
|
||||
considered when `type === 'assistant'`, `Date.parse(timestamp)` is in `(from, to]`, and
|
||||
`message.id` is a non-empty string not yet in `seen` (then added). For each element of
|
||||
`message.usage.iterations` (array, else none) with `type === 'advisor_message'`: model = its
|
||||
`model` when a string matching `/^[A-Za-z0-9._:-]{1,80}$/`, else `'unknown'`; calls += 1;
|
||||
input += `input_tokens` when a non-negative safe integer, else 0. A considered record whose
|
||||
`JSON.stringify(message.usage ?? null)` contains `advisor_message` but which yielded no call
|
||||
→ `unparsed += 1` (shape drift; text that merely mentions the word is not in `usage`).
|
||||
`uses` sorted: `MAIN` first, then calls descending, then caller, then model ascending.
|
||||
- `compact(n)`: `n < 1000` → `String(n)`; `n < 999950` → `(n / 1e3).toFixed(1) + 'k'`; else
|
||||
`(n / 1e6).toFixed(1) + 'M'` (so `999950` prints `1.0M`, never `1000.0k`).
|
||||
- `renderAdvisor(t, from, to)`: lines, joined with `\n`, ending with `\n`:
|
||||
1. `## Advisor usage (<from> → <to>)`, `<from>` = `all on disk` when `from === 0`, else the
|
||||
UTC day `YYYY-MM-DD` (`new Date(ms).toISOString().slice(0, 10)`, as metrics.ts `day`);
|
||||
`<to>` = that day of `to`.
|
||||
2. blank line.
|
||||
3. only when `from > 0` and `to - from > RETENTION_DAYS * 86400000`: the line
|
||||
`Transcripts kept 7 d: calls before <day(to - 7 d)> may be missing.` then a blank line.
|
||||
4. body: when `t.uses` is empty: `t.files === 0` → `No transcript modified since <from>
|
||||
under the projects dir: check the path.` (`<from>` as in the heading); else `t.unparsed > 0`
|
||||
→ the drift line `<t.unparsed> transcript lines mention advisor_message, none parsed: check
|
||||
the transcript shape.`; else `No advisor call in the window.`. Otherwise the table,
|
||||
followed (blank line between) by the same drift line when `t.unparsed > 0`:
|
||||
```
|
||||
| caller | model | calls | input tok |
|
||||
|---|---|---|---|
|
||||
| main loop | claude-fable-5-2 | 14 | 3.4M |
|
||||
| total | | 41 | 5.1M |
|
||||
```
|
||||
(`input tok` via `compact`; the total row sums calls and input).
|
||||
- `advisorSection(projects, from, to)`: first normalises `from` (outside the try, pure
|
||||
arithmetic): a finite number in `[0, to]`, else `0` (state.json is hand-editable: `1e999`,
|
||||
`1e17` or `NaN` must not reach `toISOString`). Then `renderAdvisor(advisorUsage(projects, f,
|
||||
to), f, to)` in a try; on any throw returns `## Advisor usage (<from> → <to>)` (same dates), a blank
|
||||
line and `Unavailable: transcripts unreadable.` (fixed text: an error message could carry a
|
||||
path), ending with `\n`. Never throws.
|
||||
|
||||
## reader.ts
|
||||
`commit()` gains no local (it has 5: `fresh, m, v, next, feedback`): the section call reads the
|
||||
old `lastRun` inline, before any write:
|
||||
```ts
|
||||
const feedback = renderFeedback(m, v, now) + '\n' +
|
||||
advisorSection(p.projects, readState(stateOf(p)).lastRun, now)
|
||||
```
|
||||
(import `advisorSection` from `./advisor.ts`). The order stays as today: the scan runs while
|
||||
`feedback` is built, before `appendRows`/`writeState`/`writeSafe`; a throw inside is caught by
|
||||
`advisorSection`; a kill during the scan leaves nothing written, so a rerun is clean. The
|
||||
section goes into FEEDBACK.md and the printed output (NEW lines still follow it).
|
||||
|
||||
## SKILL.md STEP 5
|
||||
The sentence "It prints FEEDBACK.md: show the gate lines (`Post-fix prompt asks: k/20` included:
|
||||
actions wait for 20 post-fix asks) and the Actions list to the user." becomes "It prints
|
||||
FEEDBACK.md: show the gate lines (`Post-fix prompt asks: k/20` included: actions wait for 20
|
||||
post-fix asks), the Actions list and the `## Advisor usage` table (advisor calls since the last
|
||||
run per caller and served model) to the user." Wrapped ≤ 80 cols like the file, with the
|
||||
backticked span `` `## Advisor usage` `` kept whole on one line (contract CHECK 3 greps it).
|
||||
|
||||
## Tests
|
||||
advisor.test.ts (bun:test, fixtures in `fs.mkdtempSync(path.join(os.tmpdir(), 'mf-adv-'))`,
|
||||
removed in afterAll, like reader.test.ts):
|
||||
1. main transcript: two assistant rows sharing one `message.id`, one advisor iteration
|
||||
(model claude-fable-5-2, input_tokens 1500) → one `main loop` row, calls 1, input 1500.
|
||||
2. a row outside the window (timestamp ≤ from) and one after `to` → not counted.
|
||||
3. a `user` record and a torn line, both containing `advisor_message` → ignored.
|
||||
4. one message with two advisor iterations → calls 2.
|
||||
5. iteration without `model` → model `unknown`.
|
||||
6. sub-agent `agent-a1.jsonl` + meta `{"agentType":"verifier"}` → caller `verifier`;
|
||||
`agent-a2.jsonl` without meta and `agent-a3.jsonl` with `agentType: "../x"` →
|
||||
`sub-agent (unknown)`.
|
||||
7. a transcript whose mtime ≤ from (`fs.utimesSync`) → skipped even with in-window rows.
|
||||
8. missing projects dir → `{ uses: [], unparsed: 0, files: 0 }`; `advisorSection` on it →
|
||||
heading + the `No transcript modified since … check the path.` line; a projects dir with one
|
||||
in-window transcript holding no advisor row → `No advisor call in the window.`
|
||||
9. render: `from 0` → `all on disk`; `compact` 999 → `999`, 1500 → `1.5k`, 999950 → `1.0M`,
|
||||
2500000 → `2.5M`; total row sums calls and input; sort order (main loop first, then calls
|
||||
desc).
|
||||
10. the rendered section never contains the fixture's project slug or its path.
|
||||
11. a message with a `server_tool_use` block named `advisor` and no `advisor_message` iteration
|
||||
(and no usage mention) → 0 calls, `unparsed` 0.
|
||||
12. shape drift: an in-window assistant record whose `usage` holds `advisor_message` in a shape
|
||||
the reader does not parse (e.g. `usage.advisor_message: {...}` with no `iterations`) →
|
||||
`unparsed` 1, and the render prints the `none parsed` line instead of the plain zero.
|
||||
13. retention: `from = to - 10 d` → the `Transcripts kept 7 d: calls before <day> may be
|
||||
missing.` line; `from = to - 3 d` and `from = 0` → no such line.
|
||||
14. an unreadable sub-directory (`chmod 000` on a fixture dir, mode restored in a try/finally
|
||||
inside the test itself; skip the assertion when running as root) → still returns the other
|
||||
files' calls, no throw.
|
||||
15. `advisorSection` with `from = Infinity`, `from = 1e17` and `from = NaN` → heading `all on
|
||||
disk`, never throws.
|
||||
16. drift under a table: one parsed call plus one drift record → the table, then the drift line.
|
||||
17. `callerOf` with a meta that is a symlink (to a valid meta elsewhere) → `sub-agent (unknown)`.
|
||||
reader.test.ts: the existing apply test (or one new apply test on the same fixture) asserts the
|
||||
output and FEEDBACK.md contain `## Advisor usage`.
|
||||
|
||||
## Edge cases
|
||||
- `from` = state.lastRun = 0 on a first run → everything still on disk, heading `all on disk`.
|
||||
- Huge files (largest 63 MB, 1.1 GB total): substring pre-filter before `JSON.parse`.
|
||||
- A message id seen in two files (never seen in the probe) counts once.
|
||||
|
||||
RISK: low — read-only reporting added after the existing FEEDBACK body; the labelling path and
|
||||
its write order are unchanged.
|
||||
@@ -0,0 +1,190 @@
|
||||
# Bugfix plan: DEGRADED read off the wrong line (BUGS-FOUND:134 + TODO:13)
|
||||
|
||||
## DIAGNOSIS
|
||||
BUG: three gate readers teach DEGRADED as a value of the `SECURITY — VERDICT:` line.
|
||||
ROOT CAUSE: agents/security-auditor.md OUTPUT (:133-134) prints
|
||||
`SECURITY — VERDICT: PASS | BLOCK(n) | ERROR(<reason>)`; DEGRADED appears only on the
|
||||
`TOOL:` line (`ABSENT (DEGRADED — checklist only; install: make plugin)`). The parse
|
||||
lists in lib/verify-secure-loop.md:111-128, agents/security-auditor.md:184-192 and
|
||||
skills/hotfix/SKILL.md:182-183 end their parse at a terminal `PASS` bullet and list
|
||||
`DEGRADED` as a sibling value of the VERDICT line. A reader parsing the VERDICT line
|
||||
never sees it: a DEGRADED scan reads as a clean PASS (the hotfix SECURITY summary field,
|
||||
the feat/bugfix end-of-run skip, the "surface the checklist + recommend make plugin"
|
||||
step never fires). A PASS with no `TOOL:` line is not named a structural failure, so it
|
||||
also reads as non-DEGRADED.
|
||||
EVIDENCE: OUTPUT template vs the three parse lists; B3 STEP 6 opus review.
|
||||
PRIOR: LRN-300 (a rule keyed on a gate verdict names the line its qualifier prints on) —
|
||||
applied to the three readers and to lib/effort-shift.md item 3, the canonical skip rule.
|
||||
The auditor's output format stays unchanged (no parser contract change).
|
||||
BLAST RADIUS: the three readers + lib/effort-shift.md:124 ("security PASS (not
|
||||
DEGRADED)" names no line). agents/security-auditor.md STEP 1 (:44-48) already puts
|
||||
DEGRADED on the `TOOL:` line: untouched. feat/bugfix already name the TOOL line
|
||||
(51f343f): untouched, now locked. README:84 / USAGE / CHANGELOG cite no parse list:
|
||||
untouched (doc-sync re-checks). audit-delta:271, tour:156, onboard:549 say "semgrep
|
||||
ABSENT → DEGRADED" (audit mode, non-blocking): untouched. a11y/guardrails/ship-feature/
|
||||
init-project inherit lib/verify-secure-loop.md (their "PASS → STEP n" lines point at it).
|
||||
Rejected alternative: change the auditor to print `VERDICT: DEGRADED` — breaks every
|
||||
`PASS | BLOCK(n)` parser and the PROOF rule; the logged fix direction is the reader side.
|
||||
A DEGRADED BLOCK needs no own sentence: the BLOCK bullet handles every BLOCK.
|
||||
|
||||
## FIX PLAN (exact text; each `old` occurs exactly once in its file)
|
||||
|
||||
1. lib/verify-secure-loop.md — the PASS bullet reads the TOOL line; the old
|
||||
DEGRADED bullet is deleted.
|
||||
|
||||
### Block vsl-pass-old
|
||||
```
|
||||
- `PASS` → done, proceed to commit.
|
||||
```
|
||||
### Block vsl-pass-new
|
||||
```
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows
|
||||
there, never on the VERDICT line; a PASS with no `TOOL:` line is a
|
||||
structural failure (below). Then done, proceed to commit; a DEGRADED
|
||||
PASS also surfaces the checklist result + recommends `make plugin`
|
||||
(the tool's absence never blocks).
|
||||
```
|
||||
### Block vsl-degraded-old
|
||||
```
|
||||
- `DEGRADED` (semgrep absent) → does NOT block on the tool's absence; surface
|
||||
the checklist result + recommend `make plugin`. A DEGRADED run that still
|
||||
BLOCKs (grep-caught secret/injection) blocks like any other.
|
||||
```
|
||||
(replaced by nothing: the three lines are removed)
|
||||
|
||||
2. agents/security-auditor.md — same shape.
|
||||
|
||||
### Block aud-pass-old
|
||||
```
|
||||
- `PASS` → proceed (to commit / next step).
|
||||
```
|
||||
### Block aud-pass-new
|
||||
```
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||
is a structural failure (below). Then proceed (to commit / next
|
||||
step); a DEGRADED PASS also surfaces the checklist result +
|
||||
recommends `make plugin` (the tool's absence never blocks).
|
||||
```
|
||||
### Block aud-degraded-old
|
||||
```
|
||||
- `DEGRADED` (semgrep absent) → does NOT block; surface the checklist
|
||||
result + recommend `make plugin`. A DEGRADED BLOCK (grep-caught
|
||||
hardcoded secret etc.) blocks like any other.
|
||||
```
|
||||
(removed)
|
||||
|
||||
### Block aud-struct-old
|
||||
```
|
||||
unparsable, crash, PASS without PROOF) → retry ONCE fresh; 2nd
|
||||
structural failure → human escalation. A mute auditor is never a PASS.
|
||||
```
|
||||
### Block aud-struct-new
|
||||
```
|
||||
unparsable, crash, PASS without PROOF or without `TOOL:` line) →
|
||||
retry ONCE fresh; 2nd structural failure → human escalation. A mute
|
||||
auditor is never a PASS.
|
||||
```
|
||||
|
||||
3. skills/hotfix/SKILL.md
|
||||
|
||||
### Block hot-pass-old
|
||||
```
|
||||
- `PASS` (or `DEGRADED` with no BLOCK) → proceed to commit.
|
||||
```
|
||||
### Block hot-pass-new
|
||||
```
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||
is a structural failure (below). Then proceed to commit; a DEGRADED
|
||||
PASS sets the summary's SECURITY field to `DEGRADED (checklist only)`.
|
||||
```
|
||||
### Block hot-struct-old
|
||||
```
|
||||
- Structural failure (mute / unparsable / no VERDICT line) → treat as a
|
||||
failed gate: retry ONCE fresh; a 2nd structural failure → revert +
|
||||
escalate. A mute auditor is never a PASS.
|
||||
```
|
||||
### Block hot-struct-new
|
||||
```
|
||||
- Structural failure (mute / unparsable / no VERDICT line / PASS with
|
||||
no `TOOL:` line) → treat as a failed gate: retry ONCE fresh; a 2nd
|
||||
structural failure → revert + escalate. A mute auditor is never a
|
||||
PASS.
|
||||
```
|
||||
|
||||
4. lib/effort-shift.md § Advisor item 3 — name the line (LRN-300).
|
||||
|
||||
### Block eff-old
|
||||
```
|
||||
`skipped (gates clean on first pass)`. A skipped call discharges
|
||||
```
|
||||
### Block eff-new
|
||||
```
|
||||
`skipped (gates clean on first pass)`; DEGRADED shows on the
|
||||
auditor's `TOOL:` line. A skipped call discharges
|
||||
```
|
||||
|
||||
5. lib/tests/loops-light.test.sh — regression locks. Single-line fragments with the
|
||||
file's own `tf`/`tn` (LRN-093: a clause spanning lines → lock a distinctive single-line
|
||||
fragment), double quotes with escaped backticks (the file's idiom). The section lives
|
||||
here, not in security-auditor.test.sh, so one section locks this bug across its five
|
||||
files (that file's `tn` is ERE: the parenthesised strings would match vacuously there).
|
||||
|
||||
### Block t-vars-old
|
||||
```
|
||||
HSKL="$REPO/skills/hotfix/SKILL.md"
|
||||
```
|
||||
### Block t-vars-new
|
||||
```
|
||||
HSKL="$REPO/skills/hotfix/SKILL.md"
|
||||
AUD="$REPO/agents/security-auditor.md"
|
||||
EFF="$REPO/lib/effort-shift.md"
|
||||
```
|
||||
### Block t-locks-old
|
||||
```
|
||||
echo ""
|
||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||
```
|
||||
### Block t-locks-new
|
||||
```
|
||||
echo "── DEGRADED on the TOOL line, feat/bugfix skip (BUGS-FOUND:134) ──"
|
||||
for f in "$FSK" "$BSK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n skip not DEGRADED" "$f" "security PASS (not DEGRADED),"
|
||||
tf "$n skip first attempt" "$f" "each on its first attempt;"
|
||||
tf "$n skip out of view" "$f" "a verdict no longer in view runs the call."
|
||||
tf "$n skip names TOOL" "$f" "auditor's \`TOOL:\` line, beside a PASS."
|
||||
done
|
||||
tf "effort-shift names TOOL" "$EFF" "auditor's \`TOOL:\` line. A skipped call"
|
||||
for f in "$INC" "$AUD" "$HSKL"; do
|
||||
n=$(basename "$(dirname "$f")")/$(basename "$f")
|
||||
tf "$n PASS reads TOOL" "$f" "\`PASS\` → read the \`TOOL:\` line first"
|
||||
tf "$n DEGRADED off VERDICT" "$f" "never on the VERDICT line;"
|
||||
tf "$n no TOOL structural" "$f" "a PASS with no \`TOOL:\` line"
|
||||
tf "$n structural (below)" "$f" "structural failure (below)"
|
||||
tn "$n DEGRADED no verdict" "$f" "\`DEGRADED\`"
|
||||
tn "$n DEGRADED no branch" "$f" "DEGRADED (semgrep absent) →"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||
```
|
||||
The two `tn` catch the old shapes coming back: the backticked `DEGRADED` value and a
|
||||
`DEGRADED (semgrep absent) →` branch (none of the three files keeps that token after the fix; hotfix's
|
||||
`DEGRADED (checklist only)` does not match). The paired `tf` on the same file fails on
|
||||
an unreadable file, which `tn` alone would pass.
|
||||
Simulated on a scratch clone (locks first, fix second): develop = 16 FAIL (effort-shift
|
||||
lock + 3 files × 4 reader `tf` + 3 backticked `tn`), the 8 feat/bugfix locks PASS, the
|
||||
3 `DEGRADED (semgrep absent) →` `tn` PASS (they guard the un-backticked variant, absent
|
||||
on both sides); fix applied = 78/78 PASS.
|
||||
Deferred (confirmation pass, logged to BUGS-FOUND at bookkeeping): a DEGRADED BLOCK's
|
||||
cap STOP does not name the missing semgrep / `make plugin`; DEGRADED is read by word
|
||||
presence, a garbled `TOOL:` line reads as a full scan (allowlist `semgrep <ver>` would
|
||||
close it). Both were already true before this fix (the old bullet keyed on the wrong
|
||||
line).
|
||||
|
||||
6. Bookkeeping (main loop, not executor): BUGS-FOUND:134 FIXED, TODO:13 done.
|
||||
|
||||
RISK: low — prose only, no output format change. New prose lines ≤ 80 cols; the lock
|
||||
lines follow the test file's existing width (it already has lines past 80).
|
||||
@@ -0,0 +1,103 @@
|
||||
# Feat plan: merge-reuse clause at the end-of-run sites (TODO:14, run 1 of 2)
|
||||
|
||||
## Why
|
||||
lib/effort-shift.md § Advisor item 3 (:131-134): "In the six flows that run the gates (...), a later
|
||||
merge proposal reuses the last run's answer, or its skip, and names any code commit made after it
|
||||
(doc and memory commits excepted)." The end steps of a11y, guardrails, ship-feature, init-project
|
||||
cite `lib/effort-shift.md` § Advisor but do not load it (LRN-297): at merge time the reuse rule is
|
||||
not in front of the main loop, so a merge proposal either re-calls the advisor or reuses a stale
|
||||
answer without naming the commits made since. User 2026-11-19: all 6 sites; this run = the 4
|
||||
TODO:14 names (feat/bugfix next run, same branch; /feat 5-file cap).
|
||||
|
||||
## Disposition
|
||||
- honors LRN-297 by restating one clause at the acting site, the lib keeps the full rule.
|
||||
- honors LRN-268 / user "verbatim where it fits": item 3 wording, "the last run's answer, or its
|
||||
skip" → "this answer" (these four flows have no skip; "this" = the answer just named on the line).
|
||||
- honors LRN-093: locks are single-line fragments; LRN-296: simulated on a scratch clone.
|
||||
- honors BDR-100: grep "merge proposal" across skills/lib/agents/README/USAGE/CLAUDE.global → only
|
||||
lib/effort-shift.md:132 (unchanged, the source); no other citer to patch.
|
||||
- BDR-150 unchanged (no new call point, no skip).
|
||||
|
||||
## FIX PLAN (exact text; each `old` occurs exactly once in its file)
|
||||
|
||||
1. skills/a11y/SKILL.md and 2. skills/guardrails/SKILL.md — same block in both.
|
||||
### Block ag-old
|
||||
```
|
||||
goes into the reply as an `Advisor:` line, and a fix it drives goes
|
||||
back through the gates.
|
||||
```
|
||||
### Block ag-new
|
||||
```
|
||||
goes into the reply as an `Advisor:` line, and a fix it drives goes
|
||||
back through the gates. A later merge proposal reuses this answer and
|
||||
names any code commit made after it (doc and memory commits excepted).
|
||||
```
|
||||
|
||||
3. skills/ship-feature/SKILL.md and 4. skills/init-project/SKILL.md — same block in both.
|
||||
### Block si-old
|
||||
```
|
||||
its answer goes with the proposal as an `Advisor:` line, and a fix it
|
||||
drives goes back through the gates.
|
||||
```
|
||||
### Block si-new
|
||||
```
|
||||
its answer goes with the proposal as an `Advisor:` line, and a fix it
|
||||
drives goes back through the gates. A later merge proposal reuses this
|
||||
answer and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
```
|
||||
|
||||
5. lib/tests/loops-light.test.sh
|
||||
### Block t-vars-old
|
||||
```
|
||||
EFF="$REPO/lib/effort-shift.md"
|
||||
```
|
||||
### Block t-vars-new
|
||||
```
|
||||
EFF="$REPO/lib/effort-shift.md"
|
||||
SFK="$REPO/skills/ship-feature/SKILL.md"
|
||||
ISK="$REPO/skills/init-project/SKILL.md"
|
||||
```
|
||||
### Block t-locks-old
|
||||
```
|
||||
echo ""
|
||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||
```
|
||||
### Block t-locks-new
|
||||
```
|
||||
echo "── end-of-run merge reuse at the site (TODO:14, LRN-297) ──"
|
||||
tf "effort-shift merge reuse" "$EFF" "reuses the last run's answer, or its skip, and names any code commit"
|
||||
for f in "$ASK" "$GSK" "$SFK" "$ISK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses this"
|
||||
tf "$n names later commits" "$f" "names any code commit made after it"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||
```
|
||||
Each fragment sits on one line in both wrap shapes (ag: 3-space indent; si: column 0); lock 1 anchors
|
||||
the clause right after the gates sentence, lock 3 pins the polarity word, the `$EFF` lock pins the
|
||||
source (lib/effort-shift.md:133). 78 → 91 pass.
|
||||
|
||||
## Edge cases
|
||||
- ship-feature/init-project: the finish proposal follows the call in the same step; "later" covers a
|
||||
finish proposed after more commits land (user defers the go). Same sentence everywhere, no
|
||||
per-flow variant.
|
||||
- Prose lines ≤ 80 cols (ag 72/73, si 70/70/62/18).
|
||||
|
||||
## Tests
|
||||
lib/tests/loops-light.test.sh section above; full make test.
|
||||
RISK: low — prose only, no rule change (item 3 already binds; the site now restates it).
|
||||
|
||||
## Deferred (challenge MINORs, logged at bookkeeping, not this run)
|
||||
- item 3 reuse clause has no fallback when the end-of-run answer is absent (advisor absent/error) or out
|
||||
of view at the merge signal → candidate: "answer absent or out of view → the merge proposal runs the
|
||||
call" in lib/effort-shift.md item 3 (source, not the sites).
|
||||
- end sites restate the call but not "one end-of-run call per skill run": a fix that goes back
|
||||
through the gates may re-enter the end step and call again.
|
||||
- one branch can carry two end-of-run answers (a11y then guardrails): "this answer" = the latest run's;
|
||||
"names any code commit made after it" keeps the proposal truthful.
|
||||
- run 2 (feat:210, bugfix:236) gets its own TODO line when TODO:14 is ticked; the branch is not
|
||||
merge-ready before run 2 lands.
|
||||
@@ -0,0 +1,97 @@
|
||||
# Feat plan: merge-reuse clause at the feat/bugfix end lines (TODO:14, run 2 of 2)
|
||||
|
||||
## Why
|
||||
Run 1 (af846d6) restated lib/effort-shift.md § Advisor item 3's merge-reuse clause at the a11y,
|
||||
guardrails, ship-feature and init-project end steps. User 2026-11-19: all 6 sites; feat and bugfix
|
||||
are the other two gate flows. Their end lines cite `lib/effort-shift.md` § Advisor without loading
|
||||
it (LRN-297), and leaving them bare is the uneven restatement LRN-297 warns about. Same branch
|
||||
feature/advisor-merge-reuse (/feat 5-file cap split the 6 sites in two runs).
|
||||
|
||||
## Disposition
|
||||
- honors LRN-297: one clause read ahead at the run's end (feat/bugfix never propose the merge
|
||||
themselves; it comes at the user's later "merge it"), the lib keeps the full rule.
|
||||
- honors LRN-268 / user wording: the scope question offered feat/bugfix "reuses the last run's
|
||||
answer, or its skip" (they can skip, unlike the four run-1 flows); text = item 3 verbatim.
|
||||
- honors LRN-093 (single-line lock fragments), LRN-296 (scratch simulation), LRN-298 (lock 1
|
||||
anchored on "the gates." = placement after the gates sentence).
|
||||
- 9814720's eight feat/bugfix skip locks sit on lines this run does not touch: the clause is
|
||||
appended after the final "through the gates." of each end line.
|
||||
- BDR-100: "merge proposal" cited only by lib/effort-shift.md:132 and the run-1 sites.
|
||||
|
||||
## FIX PLAN (exact text; each `old` occurs exactly once in its file)
|
||||
|
||||
1. skills/feat/SKILL.md
|
||||
### Block feat-old
|
||||
```
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates.
|
||||
|
||||
Print summary:
|
||||
```
|
||||
### Block feat-new
|
||||
```
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates. A later merge proposal reuses the last run's answer,
|
||||
or its skip, and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
|
||||
Print summary:
|
||||
```
|
||||
|
||||
2. skills/bugfix/SKILL.md
|
||||
### Block bug-old
|
||||
```
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates.
|
||||
4. Print summary:
|
||||
```
|
||||
### Block bug-new
|
||||
```
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates. A later merge proposal reuses the last run's answer,
|
||||
or its skip, and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
4. Print summary:
|
||||
```
|
||||
|
||||
3. lib/tests/loops-light.test.sh — extend run 1's section (its loop's lock 1 ends "reuses this",
|
||||
which does not match the feat/bugfix wording, so the two sites get their own loop).
|
||||
### Block t-old
|
||||
```
|
||||
tf "$n names later commits" "$f" "names any code commit made after it"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
```
|
||||
### Block t-new
|
||||
```
|
||||
tf "$n names later commits" "$f" "names any code commit made after it (doc and memory"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
for f in "$FSK" "$BSK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses the last run's answer,"
|
||||
tf "$n reuse covers skip" "$f" "or its skip, and names any code commit made after it (doc and memory"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
```
|
||||
91 → 97 pass. Each fragment sits on one line in both indents. Lock 2 now reaches "(doc and memory" in
|
||||
both loops (run 1's loop widened in place, same file, count unchanged) so the exception is pinned.
|
||||
Each skill block runs through the next line ("Print summary:"), so a second apply finds no `old`
|
||||
and fails loudly instead of doubling the clause.
|
||||
|
||||
## Edge cases
|
||||
- New prose widths: feat 71/68/18, bugfix 74/71/21 (≤ 80).
|
||||
- "the last run's answer" at a feat/bugfix site = this run's answer unless a later gate flow ran on
|
||||
the same branch; "names any code commit made after it" keeps the proposal truthful either way.
|
||||
|
||||
## Tests
|
||||
lib/tests/loops-light.test.sh; full make test.
|
||||
RISK: low — prose only, rule unchanged; behavior changes: a merge after a clean-first-pass feat/bugfix
|
||||
run reuses the skip instead of re-calling the advisor (the gated trade-off, item 3).
|
||||
|
||||
## Deferred (challenge MINORs, logged at bookkeeping, not this run)
|
||||
- merge-time gap: the merge proposal happens at the gitflow finish gate (skills/gitflow/SKILL.md
|
||||
:68-89, 0 advisor mentions); if compaction drops the skill body the reuse rule is not in view.
|
||||
- "names any code commit made after it" has no anchor: the ADVISOR field records no HEAD SHA, so
|
||||
commits made outside the session are invisible; candidate: record short SHA with the answer
|
||||
(visible format change, user's call).
|
||||
@@ -0,0 +1,93 @@
|
||||
# Bugfix plan: sub-agents call the advisor against the doctrine (TODO advisor leak)
|
||||
|
||||
## DIAGNOSIS
|
||||
BUG: sub-agents outside the allowed four call the advisor. First advisor usage table
|
||||
(2026-11-19): general-purpose 30 calls / 7.1M input tokens (29 in faunosteo's U2 SDD run, 1 the
|
||||
B3 STEP 6 code review), doc-syncer 4 (opus audit). 16 general-purpose calls came after 6ef3069
|
||||
(2026-11-17 12:59) restricted sub-agent calls to plan-challenger, verifier, security-auditor and
|
||||
analyzer.
|
||||
ROOT CAUSE: the advisor is a server tool the harness attaches to every sub-agent, whatever its
|
||||
model, with its own system prompt telling it to call "before substantive work … and before
|
||||
declaring done". The restriction lives only in CLAUDE.global.md § Workflow and
|
||||
lib/effort-shift.md § Advisor (:140-143), text a dispatched agent does not hold in its own
|
||||
prompt; the four allowed agents carry an in-prompt "at most once" line and comply. No tool
|
||||
filter exists: probed 2026-11-19, the advisor stays listed under a `tools:` allowlist
|
||||
(plan-challenger), under `--disallowedTools advisor` (headless main) and under an agent's
|
||||
`disallowedTools: ["advisor"]` (headless sub-agent). Sonnet sub-agents also list it (probe) and
|
||||
simply never used it (0 calls in ~400 dispatches); opus sub-agents act on the tool's prompt.
|
||||
EVIDENCE: transcript tally per agentType × model (all 1105 transcripts): every call comes from
|
||||
an opus-served agent; leakers' meta: general-purpose `model: opus` (faunosteo SDD standalone,
|
||||
41 opus dispatches; ship-feature's sonnet pin did not apply), doc-syncer `model=opus` audits;
|
||||
three live probes (opus gp, sonnet gp, headless with/without disallowedTools) all list advisor.
|
||||
Delivery and compliance proven before planning (2026-11-19): a headless `claude -p --settings
|
||||
<scratch>` run with a SubagentStart hook injecting a random nonce → the sub-agent returned the
|
||||
exact nonce (additionalContext reaches the sub-agent before its first turn). In-context rules are
|
||||
obeyed: since 6ef3069 the four allowed types made at most 1 call per dispatch (plan-challenger
|
||||
43×1, verifier 22×1 + 3×0, security-auditor 21×1 + 1×0, analyzer 3×1); each carries its line in
|
||||
its own prompt (agents/analyzer.md:46 and the other three).
|
||||
PRIOR: LRN-294 (check what tools sub-agents really get; prefer a mechanical scope; prose →
|
||||
residual) applied: the mechanical tool scope does not exist, so the next most mechanical layer is
|
||||
used, a harness hook that delivers the rule into the sub-agent's own context. BUGS-FOUND :107
|
||||
(prose-only residual, d292911, superseded line notes a verifier making 2 calls) is this bug.
|
||||
honors BDR-150 (call points unchanged; this only delivers them), BDR-066 (executors sonnet).
|
||||
LRN-295/301: counts from transcripts, call = served iteration.
|
||||
BLAST RADIUS: every sub-agent of every project (settings.json hooks are global, symlinked to
|
||||
~/.claude/settings.json). The four allowed agents get a reinforcing "at most once" line. No skill,
|
||||
agent file or brief changes. Not fixed here (logged): faunosteo-style standalone SDD runs dispatch
|
||||
implementers on opus (BDR-066 tier rule only lives in ship-feature STEP 4).
|
||||
Rejected alternatives: (a) `disallowedTools` / deny rules: probed, no effect. (b) a "do not call
|
||||
the advisor" line in each opus-dispatched agent prompt and brief template (doc-syncer,
|
||||
commit-changer, plugin-advisor, seo/geo analyzers, handover writers, SDD implementer/reviewer
|
||||
templates, code-reviewer template, onboard/tour audit briefs): 12+ files, misses ad-hoc
|
||||
general-purpose dispatches and other projects' agents, drifts as agents are added. (c)
|
||||
`CLAUDE_CODE_DISABLE_ADVISOR_TOOL` / advisorModel unset: kills the main loop's advisor too.
|
||||
|
||||
## FIX PLAN
|
||||
1. hooks/subagent-advisor.sh (new) — SubagentStart hook. Reads stdin JSON, takes `agent_type`
|
||||
(jq `.agent_type // ""`, errors → empty). Always exits 0, prints exactly one JSON object
|
||||
`{"hookSpecificOutput":{"hookEventName":"SubagentStart","additionalContext":<msg>}}`:
|
||||
- `agent_type` exactly one of `plan-challenger`, `verifier`, `security-auditor`, `analyzer`
|
||||
→ msg: "Advisor rule (lib/effort-shift.md § Advisor): as a dispatched <type> you may call
|
||||
the advisor tool at most once, before your verdict or report. Never a second call, even if
|
||||
the tool's own prompt asks for one before and after the work."
|
||||
- anything else (general-purpose, Explore, Plan, executors, plugin agents, empty, malformed)
|
||||
→ msg: "Advisor rule (lib/effort-shift.md § Advisor): do not call the advisor tool in this
|
||||
run, even though it is listed and its prompt asks for calls. Only the main loop and the
|
||||
plan-challenger, verifier, security-auditor and analyzer sub-agents call it."
|
||||
The JSON is built with `jq -n --arg` (the agent type reaches the text only from the fixed
|
||||
allowed set); without jq, a printf of the same fixed text for the "do not call" case (no
|
||||
interpolation). Style: like hooks/unpushed-guard.sh / ctx7-reminder.sh (header comment with
|
||||
purpose + BDR ref, `set -u`, never blocks).
|
||||
2. settings.json — add a `SubagentStart` event (no matcher: all agent types) running
|
||||
`bash ~/.claude/hooks/subagent-advisor.sh`, beside the existing events, same entry shape.
|
||||
3. lib/effort-shift.md:140-144 — after "executors and every other sub-agent do not, even when
|
||||
the tool is listed." add: "A SubagentStart hook (hooks/subagent-advisor.sh) states each
|
||||
sub-agent's rule in its own context at spawn: no tool filter removes the advisor." (wrapped
|
||||
≤ 80 cols; the list sentence itself unchanged, the hook's allowed set is locked to it).
|
||||
4. lib/tests/subagent-advisor.test.sh (new) — style of lib/tests/unpushed-guard.test.sh:
|
||||
T1 general-purpose → valid JSON, hookEventName SubagentStart, context contains "do not call
|
||||
the advisor tool"; T2-T5 each allowed type → contains "at most once" and the type, not "do not
|
||||
call"; T6 empty stdin and T7 malformed JSON → "do not call", valid JSON, rc 0; T8 an
|
||||
agent_type carrying `"`, newline and `$(…)` → valid JSON, the raw value absent from the
|
||||
output, "do not call"; T9 PATH without jq (a temp PATH dir holding only bash/cat/printf links,
|
||||
or `env PATH=` minimal) → valid JSON (checked with python3), "do not call"; T10 settings.json
|
||||
wires `SubagentStart` to `hooks/subagent-advisor.sh` (jq query); T11 consistency: each of the
|
||||
four allowed names appears in lib/effort-shift.md's "Sub-agents, when dispatched" sentence and
|
||||
in the hook, and the effort-shift sentence names the hook. Lines ≤ 80 cols where the file
|
||||
style allows.
|
||||
|
||||
Bookkeeping (main loop): BUGS-FOUND :107 residual → FIXED line; TODO advisor-leak line done;
|
||||
new TODO: standalone SDD opus dispatches (BDR-066 pin only in ship-feature STEP 4).
|
||||
|
||||
Skill-runner children (onboard, tour, client-handover dispatch opus children that run whole
|
||||
skills whose text has main-loop advisor points): the hook tells them not to call; proposed rule
|
||||
(user decision at the STEP 3 gate): the parent main loop owns the call points, a child's own
|
||||
`Advisor:` row / ADVISOR field reads `not called (sub-agent)`.
|
||||
Proof of "fixed": the contract proves delivery (headless nonce through the real hook script and a
|
||||
scratch settings file, since this session may not reload settings) and the hook's output per
|
||||
type; the behavioural proof is the next /memory-feedback advisor usage table showing no calls
|
||||
from other agent types after the hook commit (dated follow-up in TODO).
|
||||
|
||||
RISK: low-medium — a new global hook on every sub-agent spawn (cost ~10 ms, a few dozen context
|
||||
tokens per sub-agent); a hook failure injects nothing (never blocks a spawn). Live check after
|
||||
commit: a probe sub-agent reports the injected line.
|
||||
@@ -0,0 +1,66 @@
|
||||
# Handoff plan: done, triage and loop levers (user 2026-11-20)
|
||||
|
||||
User ask (2026-11-20, verbatim): "Et comment faire pour avoir une loop sans qu'on ait en boucle
|
||||
des low-priority qui se développent. De façon à ce qu'on loop jusqu'à ce qu'on soit sûr de ce
|
||||
qu'on a développé et qu'on dise : bah c'est fini jusqu'à preuve du contraire par les tests ?"
|
||||
then "oui lance une session neuve avec les six leviers et faire ça dedans". Run as one /feat
|
||||
(5 files). It creates a mechanism (not a placement), so it keeps its plan challenge.
|
||||
|
||||
## Evidence (session c9afbcbf, 2026-11-19/20)
|
||||
- Open TODO 44 → 50 over the session although items were closed; BUGS-FOUND 67 bullets.
|
||||
- No doctrine rule requires logging a MINOR: "never silently carried" covers BLOCKERs only
|
||||
(lib/challenge-plan.md:12-13); feat/bugfix/ship-feature, verifier and security-auditor never
|
||||
name BUGS-FOUND. The minor → TODO/BUGS-FOUND flow was the main loop's habit (and some advisor
|
||||
instructions), copied from earlier runs.
|
||||
- Where reviews paid: DEGRADED bugfix (a terminal PASS bullet ahead of the DEGRADED note),
|
||||
advisor leak (a false root cause overturned by the challenge: CLAUDE.md already reached
|
||||
sub-agents), Run C (window loss, Infinity lastRun; marginal).
|
||||
- Where they did not: TODO:14 runs 1-2, each placing a clause the user had decided: 6 challengers
|
||||
+ 2 plan advisor calls, no MAJOR. The 3 verifier ECARTS of the advisor run were all bookkeeping
|
||||
from the main loop's own contract text (locals in a test callback, plan artifacts and 4 agent
|
||||
files outside FILE SCOPE, a lint suppression); both first-run GATE 0 failures were contract
|
||||
wording. Two post-gate fix rounds each cost a full gate cycle (plus one scope question).
|
||||
- Each main-loop advisor call resends the whole transcript (700k+ tokens late in the session).
|
||||
|
||||
## The six levers (reviewed with the advisor 2026-11-20)
|
||||
1. Done = oracles green. A run is done when the contract criteria are MET, the tests pass and
|
||||
the gates are clean. After done, a review reopens it only with reproducible evidence: a
|
||||
command that fails on HEAD, or real output shown wrong. A plausible scenario alone does not
|
||||
reopen. A behavioural claim ("agents obey") is done at locks green + one live probe + one
|
||||
dated measurement (TODO line with date and tripwires). Trade accepted: the advisor-run opus
|
||||
review's allowance finding would have gone to the dated check, not a fix round.
|
||||
2. MINOR triage: a MINOR is fixed before dispatch (folded into the plan) or dropped. No post-gate
|
||||
fix of a MINOR (it costs a full gate cycle). A drop is one line in the run report, nothing in
|
||||
any registry. The backlog only takes findings with reproducible evidence, or what the user asks.
|
||||
3. Challenge only when a decision is open. A run that only places a decision the user already
|
||||
made (exact text dictated by that decision, no new design) skips the plan challenge and its
|
||||
plan advisor call; gates still run. The split is NOT code vs text. Check against the five runs
|
||||
of session c9afbcbf: only TODO:14 runs 1-2 go gates-only; DEGRADED, Run C and the advisor leak
|
||||
keep their challenge.
|
||||
4. Loop with a frozen list. An autonomous "do the TODOs" loop works the list that exists when
|
||||
the user starts it (plus items the user adds). Items born during the loop are reported, not
|
||||
run, unless they break what the loop shipped. Termination by construction; this formalizes
|
||||
the user's own "sauf si tu vois que ça se répète".
|
||||
5. Contract hygiene (main loop): before any dispatch, `gates.sh status` on the contract and a dry
|
||||
run of each CHECK; transient plan artifacts (docs/superpowers/plans/**, the run's
|
||||
.claude/tasks contract and plan) are in FILE SCOPE by default (verifier side).
|
||||
6. Visibility: every run summary prints `TODO +n / -m` (items added / closed by the run).
|
||||
|
||||
Cut after review: a TODO cap or expiry (50 open: a cap of 10 starts violated; /prune-memory
|
||||
curates registries, not TODO.md); a "fix if under five minutes" exit after the gates.
|
||||
|
||||
## Carriers (where it is written; the permission to drop must be written, else the next
|
||||
session repeats the habit)
|
||||
- lib/verify-secure-loop.md — levers 1 and 2 (done, reopen evidence, MINOR triage).
|
||||
- lib/challenge-plan.md — lever 3 (placement skips the challenge and its advisor call; summary
|
||||
row says so).
|
||||
- CLAUDE.global.md — lever 4, one line (319/320 budget: exactly one line left).
|
||||
- lib/capitalize-commit.md — lever 6 (`TODO +n / -m` beside the memory-commit hash).
|
||||
- agents/verifier.md — lever 5 scope default for transient plan artifacts; the main-loop dry run
|
||||
rides lever 1's text in lib/verify-secure-loop.md.
|
||||
Not loosened: safety guardrails (destructive tools, gitflow, secrets), GATE 0, verifier,
|
||||
security gate, user gates on visible / public-name / scope choices.
|
||||
|
||||
## Proof of the change
|
||||
After ~5 runs: dispatches per run, `TODO +n / -m` per run, and any post-merge bug traced to a
|
||||
dropped MINOR (BUGS-FOUND entry naming a merged run). Log as an EVAL.
|
||||
@@ -0,0 +1,347 @@
|
||||
# PLAN r3 — done-triage-levers (/feat, 2026-11-20 14:13)
|
||||
|
||||
Source: handoff plan `.claude/tasks/plans/2026-11-20-done-and-triage-levers.md` (six levers,
|
||||
five carriers, user-approved). Contract: `.claude/tasks/contracts/2026-11-20-done-triage-levers-1413.md`.
|
||||
Base: develop 68a4d8b. Branch: feature/done-triage-levers.
|
||||
|
||||
## Mechanism (exact text: § EXACT DIFF below)
|
||||
|
||||
- [ ] lib/verify-secure-loop.md
|
||||
- header line 3: the include runs after the dev step, except its first section (before dispatch).
|
||||
- new `## BEFORE THE FIRST DISPATCH: contract dry run (main loop)` before `## GATE 0` (lever 5,
|
||||
main-loop side), only when the flow wrote a contract with `CHECK:` lines: (1) record
|
||||
`- run-base: <git rev-parse HEAD>` in the contract header (a SHA; feeds lever 6); (2) from
|
||||
the project root, `gates.sh run` on a `mktemp -d` copy of the contract (real ledger stays
|
||||
pending): no ERROR, NOT-MET only for undone work and for that reason, a row already MET
|
||||
valid only when the work must keep it green; prose oracles: simulate the planned text on a
|
||||
scratch copy and run the CHECKs there (LRN-296, stated inline). Bad oracle fixed before any
|
||||
floor loop.
|
||||
- out-of-scope bullet: "Run artifacts are in scope by default (`agents/verifier.md`, STEP 4)."
|
||||
- after `## Order invariant`: `## DONE: oracles green, reopened only on evidence` (lever 1,
|
||||
one attempt to turn a scenario into a failing command) and
|
||||
`## MINOR triage: fold before dispatch, or drop` (lever 2: findings on the run's plan or diff;
|
||||
drop line in the report and the run's plan file; security findings never droppable, to the
|
||||
user; doc-syncer `[MINOR]` patch class untouched).
|
||||
- unchanged: the three `route(phase="escalate")` (effort-routing lock = 3).
|
||||
- [ ] lib/challenge-plan.md
|
||||
- new `## SKIP: a placed decision` before `## DISPATCH` (lever 3): three required conditions
|
||||
(dictated text; the decision is the user's own words or was challenged in the run that wrote
|
||||
it; the caller runs verify-secure-loop.md after its dispatch); open-choice test, in doubt
|
||||
challenge; the skip is the include's own path (user decision 2026-11-20) and discharges the
|
||||
plan point of effort-shift § Advisor; the `Challenge: skipped (…)` line replaces the summary.
|
||||
- second paragraph, outside the skip condition: the two dry-run actions restated inline, before
|
||||
the executor dispatch, citing § BEFORE THE FIRST DISPATCH (pre-dispatch reach of lever 5).
|
||||
- SYNTHESIZE MINOR bullet: fold or drop, drop format inline, security → user, cites § MINOR triage.
|
||||
- [ ] CLAUDE.global.md — Planning & TODO last bullet (lever 4): "A TODO loop notes its start SHA
|
||||
in TODO.md, runs that list + user adds; new items: report, run if one breaks its work."
|
||||
319 → 320 lines (guard fires only above 320).
|
||||
- [ ] lib/capitalize-commit.md — DO step 1, before step 2's commit (lever 6): compute `<todo>`;
|
||||
`run_base` = the contract's `- run-base:` SHA, else `git rev-parse HEAD` then (`shortcut:`:
|
||||
only pending TODO edits); 6-line snippet, `--no-color --no-ext-diff`, root pathspec
|
||||
`:/.claude/tasks/TODO.md`; failing diff → `TODO n/a`; step 3 and both rc 0 templates carry
|
||||
`· <todo>`.
|
||||
- [ ] agents/verifier.md — STEP 4 (lever 5), with `--name-status` plus untracked: in scope by
|
||||
default = a plan file the diff ADDS under `.claude/tasks/plans/` or `docs/superpowers/plans/`;
|
||||
appended `MINOR dropped:` lines on an existing plan; the CONTRACT handed to the verifier, whole
|
||||
when untracked or added, else only its `EVIDENCE:`, `- run-base:`, `[gated]` lines; any other
|
||||
plan or contract change stays out of scope.
|
||||
|
||||
## Executor steps
|
||||
1. Extract the EXACT DIFF block of this file and apply it atomically:
|
||||
`t=$(mktemp -d); awk '/^```diff$/{p=1;next} p&&/^```$/{exit} p'
|
||||
/home/bchanot/Documents/claude/.claude/tasks/plans/2026-11-20-done-triage-levers-1413.md
|
||||
> "$t/levers.patch"`, then, from the repo root, `git apply --check "$t/levers.patch"` and
|
||||
`git apply "$t/levers.patch"` (same shell call, so `$t` survives). git apply is
|
||||
all-or-nothing; recovery if anything goes wrong: `git checkout -- lib/verify-secure-loop.md
|
||||
lib/challenge-plan.md CLAUDE.global.md lib/capitalize-commit.md agents/verifier.md`.
|
||||
2. `bash ~/.claude/lib/gates.sh run .claude/tasks/contracts/2026-11-20-done-triage-levers-1413.md`
|
||||
→ `GATES — VERDICT: MET`.
|
||||
3. No other edit. No commit.
|
||||
|
||||
## Edge cases
|
||||
- CLAUDE.global.md at exactly 320 lines: the session-start guard fires only above 320.
|
||||
- `run_base` unknown SHA or failing diff → `TODO n/a`; start SHA counts uncommitted and
|
||||
committed edits, from a subdirectory too; `HEAD` taken before the commit counts pending edits
|
||||
(all fixture-tested, criterion 8).
|
||||
- `- run-base:` header line: `gates.sh status` parses it unchanged (PENDING(12) checked).
|
||||
- `§` citations (§ BEFORE THE FIRST DISPATCH, § MINOR triage, § Advisor): resolved by the
|
||||
doctrine-citers census, flip-tested (renaming a heading turns T6 red).
|
||||
- Contract CHECKs pinned to 68a4d8b, not `develop`.
|
||||
|
||||
## Proof done before dispatch
|
||||
Fresh scratch clone + r3 text: 12/12 criteria MET (10 suites green, fixture 4 cases, 8 removed
|
||||
lines). Positive control on the
|
||||
untouched tree: 10 NOT-MET, the 2 keep-green suite rows MET.
|
||||
|
||||
## Challenge r1 (3 lenses: correctness CONCERNS(3), robustness CONCERNS(4), simplicity CONCERNS(1))
|
||||
- `base` never recorded (3 lenses) → `- run-base:` SHA written at the dry run, `HEAD` fallback,
|
||||
name distinct from the gitflow base, `--no-color --no-ext-diff`.
|
||||
- verifier scope too wide, `.claude/tasks` mislabelled transient (2 lenses) → only ADDED plan
|
||||
files and EVIDENCE/run-base/[gated] contract changes; edits to existing plans stay out.
|
||||
- dry run unreached before dispatch → header line 3 fixed, actions restated inline in
|
||||
challenge-plan.md outside the skip; unreached flows named below.
|
||||
- security findings droppable → never a droppable MINOR, to the user.
|
||||
- post-gate review precedence → DONE binds ship-feature STEP 6 / init-project STEP 10.
|
||||
- MINORs taken: `gates.sh run` on a mktemp copy instead of hand runs; LRN-296 reduced to a
|
||||
citation; SKIP conditions (user's own words or challenged; caller has gates), discharges the
|
||||
advisor plan point; drop line also in the plan file (tripwire traceable); doc-syncer `[MINOR]`
|
||||
untouched; triage limited to plan or diff findings; frozen list anchored on the start SHA;
|
||||
applier dropped for `git apply` of this diff (atomic, named recovery); drop format inline at
|
||||
SYNTHESIZE; dry run conditional on a contract with CHECKs.
|
||||
- MINOR dropped: tripwire "open TODO still growing" confounded by measurement lines; the dated
|
||||
measurement lines are counted apart at the EVAL, no text change.
|
||||
|
||||
## Challenge r2 (confirmation, correctness: CONCERNS(2)), closed in r3
|
||||
- `HEAD` fallback read after step 2's commit → silent `+0 / -0` → count moved to DO step 1,
|
||||
before the commit; fixture adds the committed and subdirectory cases.
|
||||
- DONE claimed to bind ship-feature STEP 6 / init-project STEP 10, act sites unchanged → sentence
|
||||
dropped; both sites go to the pass B scope question.
|
||||
- MINORs taken: verifier clause keyed on the handed CONTRACT (untracked/added = whole) and on
|
||||
appended `MINOR dropped:` lines of an existing plan, `--name-status` + untracked; dry run cwd
|
||||
= project root; LRN-296 procedure inline, "never" dropped; skip grounded in the user decision
|
||||
of 2026-11-20; lever-4 start SHA written into TODO.md by the loop; executor step names the
|
||||
plan's absolute path and keeps `$t`; root pathspec `:/`; ship-feature and init-project named
|
||||
unreached below.
|
||||
- No further re-challenge: lib/challenge-plan.md allows one confirmation pass.
|
||||
|
||||
## This run under lever 1 (a behavioural claim)
|
||||
Locks: the three `§` citations (census T6) and this contract's CHECKs. Live probe: the next
|
||||
/feat or /bugfix run (dry run + run-base, SKIP decision, MINOR drops, `TODO +n / -m` line).
|
||||
Dated measurement: the TODO line written at capitalize, "2026-11-20 levers: after ~5 runs, log
|
||||
dispatches/run, TODO +n/-m per run (measurement lines apart), `MINOR dropped:` lines per plan,
|
||||
any post-merge bug traced to a dropped MINOR (EVAL)"; tripwires: a BUGS-FOUND entry whose cause
|
||||
matches a `MINOR dropped:` line of a merged run, or net open TODO growing run over run.
|
||||
|
||||
## User answers (pass B, 2026-11-20): CLAUDE.global line kept, both strings OK, scope (a)+(b) yes → follow-up /feat (3 files) after this run
|
||||
|
||||
## Questions asked (pass B)
|
||||
- The CLAUDE.global.md line wording (loaded in every session).
|
||||
- The strings `MINOR dropped: <finding>` and `Challenge: skipped (placed decision: …)`.
|
||||
- Scope beyond five files: (a) lib/contract-interview.md STEP 4 would reach the dry run +
|
||||
run-base from every contract-writing flow; (b) ship-feature STEP 6 (:262/:344) and
|
||||
init-project STEP 10 (:280/:382) still say "Fix all CRITICAL", unbound by lever 1.
|
||||
|
||||
## Not done (named)
|
||||
- No skill file changes (five-file limit). Unreached by the pre-dispatch pointer: guardrails and
|
||||
a11y (contract + executor, no challenge-plan.md), bugfix's trivial fast path and hotfix's
|
||||
cosmetic skip (no challenge read), bugfix STEP 3b (reads challenge-plan.md before its contract
|
||||
exists), ship-feature and init-project (dispatch in a later turn, after a human gate).
|
||||
Contract-less flows count `TODO` from `HEAD` (pending edits only).
|
||||
- Lever 1 does not bind ship-feature STEP 6 / init-project STEP 10 (their text unchanged).
|
||||
- Proof of the change after ~5 runs (EVAL) stays a TODO line, per the handoff plan.
|
||||
|
||||
## Disposition (STEP 0.6)
|
||||
- honors BDR-062/BDR-098: CLAUDE.global.md ≤ 320 (one line added).
|
||||
- honors BDR-065 (amendment: `.claude/tasks/{contracts,plans}` durable): the verifier default
|
||||
covers only plan files a run ADDS and EVIDENCE/run-base/[gated] contract changes; an edit to
|
||||
an existing plan stays a gap.
|
||||
- honors BDR-075: the three-lens challenge stays for every run with an open choice; the skip is
|
||||
limited to placement of a user's own or already-challenged decision (user approval of lever 3).
|
||||
- honors BDR-049/BDR-083: fresh blind verifier and GATE 0 untouched.
|
||||
- applies LRN-296 (scratch simulation), LRN-297 (pointer restates the actions at the act site),
|
||||
LRN-298 (placement by line order in CHECKs 3 and 6), LRN-281/LRN-173 (EVIDENCE lines, literal
|
||||
markers, CHECKs run on the precedent and on the untouched tree).
|
||||
|
||||
## EXACT DIFF (against develop 68a4d8b)
|
||||
|
||||
```diff
|
||||
diff --git a/CLAUDE.global.md b/CLAUDE.global.md
|
||||
index 778434e..e87a323 100644
|
||||
--- a/CLAUDE.global.md
|
||||
+++ b/CLAUDE.global.md
|
||||
@@ -113,7 +113,8 @@ code" wins. Repo-specific instructions override both.
|
||||
- Once it qualifies: plan before code → one subtask = one coherent change
|
||||
→ check off as you go → high-level note at each milestone. A plan a skill
|
||||
persists (`.claude/tasks/plans/`, contract) satisfies the rule; TODO.md
|
||||
- then carries one line per run.
|
||||
+ then carries one line per run. A TODO loop notes its start SHA in TODO.md,
|
||||
+ runs that list + user adds; new items: report, run if one breaks its work.
|
||||
|
||||
## After code changes
|
||||
1. Run tests, lint, build, type-check if available. Report what was
|
||||
diff --git a/agents/verifier.md b/agents/verifier.md
|
||||
index cd3f0ec..15b7b5b 100644
|
||||
--- a/agents/verifier.md
|
||||
+++ b/agents/verifier.md
|
||||
@@ -101,8 +101,15 @@ Parse the single `FLOOR GUARD:` line:
|
||||
## STEP 4 — SCOPE CHECK
|
||||
|
||||
List the files actually touched (`git diff --name-only` over `DIFF`).
|
||||
-Compare against the contract's `FILE SCOPE`. Report every out-of-scope
|
||||
-file. Disposition is NOT your call: the orchestrator treats each one as a
|
||||
+Compare against the contract's `FILE SCOPE` (`git diff --name-status`
|
||||
+plus untracked files). Run artifacts are in scope by default, whatever
|
||||
+`FILE SCOPE` says: a plan file the diff ADDS under `.claude/tasks/plans/`
|
||||
+or `docs/superpowers/plans/`; on an existing plan, appended
|
||||
+`MINOR dropped:` lines only; the CONTRACT you were handed, whole when
|
||||
+untracked or added, else only its `EVIDENCE:` lines, `- run-base:` line and
|
||||
+`[gated]` entries. Any other change to a plan or a contract stays out of
|
||||
+scope. Report every other out-of-scope file.
|
||||
+Disposition is NOT your call: the orchestrator treats each one as a
|
||||
gap — the dev removes it or justifies it, and an accepted justification
|
||||
only enters the contract through a human micro-gate.
|
||||
|
||||
diff --git a/lib/capitalize-commit.md b/lib/capitalize-commit.md
|
||||
index 59bc2ac..de907ec 100644
|
||||
--- a/lib/capitalize-commit.md
|
||||
+++ b/lib/capitalize-commit.md
|
||||
@@ -63,14 +63,30 @@ never a shell argument.
|
||||
- `chore(memory): BLK-010 resolved — bugfix profile path`
|
||||
- `chore(memory): journal — hotfix copy typo` (journal-only, nothing else)
|
||||
|
||||
+ Then, still before step 2, count the run's TODO movement as `<todo>`:
|
||||
+ `TODO +n / -m`, the open TODO items the run added and removed (closed or
|
||||
+ dropped); a reworded open item counts on both sides. `run_base` is a SHA,
|
||||
+ never the gitflow base branch: the contract's `- run-base:` line
|
||||
+ (`lib/verify-secure-loop.md` § BEFORE THE FIRST DISPATCH), else
|
||||
+ `git rev-parse HEAD` now (shortcut: without a contract only the pending
|
||||
+ TODO edits count; edits committed earlier in the run are missed). A
|
||||
+ failing `git diff` → `TODO n/a`, never a silent `+0 / -0`.
|
||||
+
|
||||
+ if d=$(git diff --no-color --no-ext-diff "$run_base" \
|
||||
+ -- ':/.claude/tasks/TODO.md' 2>/dev/null); then
|
||||
+ n=$(printf '%s\n' "$d" | grep -c '^+ *- \[ \]')
|
||||
+ m=$(printf '%s\n' "$d" | grep -c '^- *- \[ \]')
|
||||
+ todo="TODO +$n / -$m"
|
||||
+ else todo="TODO n/a"; fi
|
||||
+
|
||||
2. Commit surgically via the helper, capturing the memory-commit hash it prints:
|
||||
|
||||
mem_hash=$(bash "$HOME/.claude/lib/memory-commit.sh" commit "<message>")
|
||||
rc=$?
|
||||
|
||||
-3. Report by (rc, mem_hash):
|
||||
- - rc 0, mem_hash non-empty → `✅ mémoire committée <mem_hash>`
|
||||
- - rc 0, mem_hash empty → `CAPITALIZE: rien à committer` (helper no-op)
|
||||
+3. Report by (rc, mem_hash). Every report line ends with `· <todo>` (step 1):
|
||||
+ - rc 0, mem_hash non-empty → `✅ mémoire committée <mem_hash> · <todo>`
|
||||
+ - rc 0, mem_hash empty → `CAPITALIZE: rien à committer · <todo>` (helper no-op)
|
||||
- rc 3 → unsafe git state (detached / merge in progress);
|
||||
memory stays in the working tree for a manual
|
||||
commit — surface the helper's stderr.
|
||||
diff --git a/lib/challenge-plan.md b/lib/challenge-plan.md
|
||||
index fd69e67..2941ff1 100644
|
||||
--- a/lib/challenge-plan.md
|
||||
+++ b/lib/challenge-plan.md
|
||||
@@ -30,6 +30,27 @@ SOLID, synthesis is a no-op. It only costs more when a lens lands a real finding
|
||||
The main loop's advisor call before the dispatch (below) is the costliest
|
||||
single item: once per skill run.
|
||||
|
||||
+## SKIP: a placed decision
|
||||
+
|
||||
+A run that only places a decision the user already made skips this phase:
|
||||
+no challengers and no plan advisor call. Three conditions, all required:
|
||||
+the exact text or change is dictated by that decision (no new design); the
|
||||
+decision's text is the user's own words, or was challenged in the run that
|
||||
+wrote it; and the caller runs `lib/verify-secure-loop.md` after its
|
||||
+dispatch, so the gates still run. The test is whether the run settles an
|
||||
+open choice of its own (a mechanism, a condition, a threshold, wording the
|
||||
+user did not dictate), never code versus text; in doubt, challenge. The
|
||||
+skip is this include's own path (user decision 2026-11-20): a skill's
|
||||
+challenge step that reads this section runs as written, and the skip
|
||||
+discharges the plan point (`lib/effort-shift.md` § Advisor). The caller prints
|
||||
+`Challenge: skipped (placed decision: <the user's decision, date>)` in
|
||||
+place of its CHALLENGE SUMMARY.
|
||||
+
|
||||
+Challenged or skipped: when the flow wrote a contract with `CHECK:` lines,
|
||||
+before the executor dispatch the main loop records `- run-base:` in the
|
||||
+contract and runs `gates.sh run` on a `mktemp -d` copy of it
|
||||
+(`lib/verify-secure-loop.md` § BEFORE THE FIRST DISPATCH).
|
||||
+
|
||||
## DISPATCH — three fresh challengers, in parallel, blind
|
||||
|
||||
**Advisor first (main loop).** Before the first dispatch, with no main-loop
|
||||
@@ -88,6 +109,10 @@ Parse each `CHALLENGE — LENS: … — VERDICT:` line and merge the FINDINGS:
|
||||
- **Severity-driven, not consensus.** Any `[BLOCKER]` from ANY single lens is
|
||||
must-address — the lenses are orthogonal, so a lone security/rollback finding
|
||||
is real, never outvoted by lens-count. Cross-lens agreement only RANKS the MINORs.
|
||||
+ Each MINOR is folded into the plan now or dropped: a drop is one
|
||||
+ `MINOR dropped: <finding>` line in the report and the plan file, nothing
|
||||
+ in TODO.md or a registry; a security finding goes to the user
|
||||
+ (`lib/verify-secure-loop.md` § MINOR triage).
|
||||
- **RE-THINK the aspect the challenge pointed at.** For each BLOCKER (and each
|
||||
MAJOR you accept): revise the plan on THAT aspect — a NAMED, diffable change to
|
||||
the plan, never a self-authored "addressed" line. A BLOCKER you consciously keep
|
||||
diff --git a/lib/verify-secure-loop.md b/lib/verify-secure-loop.md
|
||||
index b2aaa32..1141a1e 100644
|
||||
--- a/lib/verify-secure-loop.md
|
||||
+++ b/lib/verify-secure-loop.md
|
||||
@@ -1,6 +1,7 @@
|
||||
# Verify + secure loop — shared orchestrator include (feat, bugfix, guardrails, a11y)
|
||||
|
||||
-Runs in the ORCHESTRATOR MAIN LOOP after the dev step completes. Turns a
|
||||
+Runs in the ORCHESTRATOR MAIN LOOP after the dev step completes (its first
|
||||
+section runs before the dev step is dispatched). Turns a
|
||||
finished diff into a verified, security-cleared change through two fresh
|
||||
gates and bounded loops. Loop decisions live here, in the main loop
|
||||
(LRN-083: subagents = execution + report). The dev step is a dispatched
|
||||
@@ -17,6 +18,26 @@ Nominal path is cheap — a free floor run, then
|
||||
one verifier dispatch + one security dispatch, done. The loop only costs
|
||||
more when it actually loops.
|
||||
|
||||
+## BEFORE THE FIRST DISPATCH: contract dry run (main loop)
|
||||
+
|
||||
+When the flow wrote a contract with `CHECK:` lines, the main loop does two
|
||||
+things before the dev step is dispatched:
|
||||
+
|
||||
+1. Records the run's start commit in the contract header, once:
|
||||
+ `- run-base: <git rev-parse HEAD>` (a SHA, never a branch name;
|
||||
+ `lib/capitalize-commit.md` counts the run's TODO movement from it).
|
||||
+2. Copies the contract to a `mktemp -d` path and, from the project root,
|
||||
+ runs `bash ~/.claude/lib/gates.sh run <copy>`, so the real ledger stays
|
||||
+ `pending`. Expected: no `ERROR(n)` (malformed ledger: fix it here),
|
||||
+ NOT-MET rows only where the work is not done yet, each failing for that
|
||||
+ reason and not for a syntax error, a missing tool or a wrong path. A row
|
||||
+ already MET is valid only when the work must keep it green (a suite, a
|
||||
+ line cap); any other is vacuous. A marker that can never match fails
|
||||
+ like undone work: for oracles that grep prose, apply the planned text
|
||||
+ to a scratch copy of the repo and run the CHECKs there (LRN-296).
|
||||
+
|
||||
+A bad oracle is fixed in the contract here, before any floor loop.
|
||||
+
|
||||
## GATE 0 — DETERMINISTIC FLOOR (no dispatch, no model)
|
||||
|
||||
Before spending a verifier dispatch, execute the oracles the contract itself
|
||||
@@ -92,7 +113,8 @@ Parse its single `VERIFY — VERDICT:` line:
|
||||
cannot fix unverifiability); do not spend a loop on it.
|
||||
- Out-of-scope files: a dev justification is accepted ONLY through the human
|
||||
micro-gate that appends `[gated <date>]` to the contract's FILE SCOPE;
|
||||
- otherwise the dev removes the file.
|
||||
+ otherwise the dev removes the file. Run artifacts are in scope by
|
||||
+ default (`agents/verifier.md`, STEP 4).
|
||||
- Structural failure (`ERROR(…)`, missing/duplicated VERDICT line,
|
||||
unparsable, crash, `CONFORME` without `PROOF` or without `FLOOR`) → retry
|
||||
ONCE with a fresh verifier; a 2nd structural failure → human escalation.
|
||||
@@ -147,3 +169,31 @@ verifier's verdict meaningless. REQUEST conformity is
|
||||
always re-checked BEFORE security on any re-loop — a security fix that breaks
|
||||
the feature must not slip through because only the security gate re-ran.
|
||||
Never the reverse order.
|
||||
+
|
||||
+## DONE: oracles green, reopened only on evidence
|
||||
+
|
||||
+A run is done when its oracles are green: GATE 0 MET (the suite criterion
|
||||
+included), GATE 1 CONFORME and GATE 2 PASS on the same diff. After done, a
|
||||
+review (the end-of-run advisor call, a code review, a re-read) reopens the
|
||||
+run only with reproducible evidence: a command that fails on HEAD, or real
|
||||
+output shown wrong. A plausible scenario alone does not reopen the run:
|
||||
+the main loop tries once to turn it into a failing command, and if it
|
||||
+cannot, the finding is a MINOR (below). A behavioural claim ("agents obey
|
||||
+the rule") is done at its locks green, one live probe and one dated
|
||||
+measurement: a TODO line that carries the date and the tripwires that
|
||||
+would reopen it.
|
||||
+
|
||||
+## MINOR triage: fold before dispatch, or drop
|
||||
+
|
||||
+A MINOR finding on the run's plan or diff (from a challenger, a review, an
|
||||
+advisor) is either folded into the plan before the dispatch or dropped. No
|
||||
+fix round after the gates for a MINOR: it costs a full gate cycle. A drop
|
||||
+is one line, `MINOR dropped: <finding>`, in the run report and appended to
|
||||
+the run's plan file; nothing goes to TODO.md, BUGS-FOUND.md or any
|
||||
+registry. The backlog takes only findings with reproducible evidence, or
|
||||
+what the user asks for. Never a droppable MINOR: a security finding (a
|
||||
+GATE 2 `REPORTED` item, a secret, an injection, authorization or exposure
|
||||
+issue from any review) goes to the user, who decides fix or record.
|
||||
+Untouched by this triage: doc-syncer's `[MINOR]` patch class, the safety
|
||||
+guardrails, every gate, and the user's questions on visible, public-name
|
||||
+and scope choices.
|
||||
```
|
||||
+1
-1
@@ -20,7 +20,7 @@ claude-config/
|
||||
├── update-all.sh # One-command update for all components
|
||||
├── Makefile # Unified entry point: make install / doctor / update / test (make help)
|
||||
├── plugins.lock.json # Version pinning for non-marketplace dependencies and vendored skills
|
||||
├── hooks/ # Claude Code hooks: session start, statusline, RTK rewrite, ctx7 reminder, attention notify, unpushed-work guard, manual-mode push guard, system-dir extraction guard, instruction-load log, memory digest and memory feedback reminder at session start, code-limits line-width signal
|
||||
├── hooks/ # Claude Code hooks: session start, statusline, RTK rewrite, ctx7 reminder, attention notify, unpushed-work guard, manual-mode push guard, system-dir extraction guard, instruction-load log, memory digest and memory feedback reminder at session start, code-limits line-width signal, sub-agent advisor rule at spawn
|
||||
├── githooks/ # Generated git hooks (pre-commit, post-commit, post-merge, reference-transaction), git's global core.hooksPath
|
||||
├── .githooks/ # This repo's own copy of the same hooks
|
||||
├── .claude/rules/ # This repo's project path rules (paths: frontmatter), loaded on Read of a matching file
|
||||
|
||||
+7
-1
@@ -10,6 +10,7 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship
|
||||
|
||||
### Added
|
||||
- **/prune-memory feedback step (D)**: reads this repo's `Noisy:` and `Promotion candidates:` lines from `~/.claude/memory-feedback/FEEDBACK.md` (written by `/memory-feedback`). A noisy entry gets an inline rewrite of its title and lesson sentence, narrowed to its concrete trigger, committed as `chore(memory): noisy-rewrite <ID>`. A promotion candidate gets a mechanism proposal (rule line, hook, guard, test); on accept, a `<current status word>, promoted to <mechanism>` status line is recorded (a closed entry stays closed) and the mechanism is built in a separate `/feat`. Rows already rewritten or promoted are dropped. Cutoffs stay in `lib/memory-feedback/thresholds.ts`.
|
||||
- **/memory-feedback advisor usage**: each run appends `## Advisor usage (<from> → <to>)` to `~/.claude/memory-feedback/FEEDBACK.md`: advisor calls served since the last run (first run: every transcript on disk), per caller (`main loop`, or the sub-agent type from its `.meta.json`, `sub-agent (unknown)` when absent or malformed) and model, with input tokens, deduped by `message.id`, all projects summed with no repo name. When the window starts before the 7-day transcript retention, a line says older calls may be missing. No transcript found, or messages that mention `advisor_message` but no longer parse, print a line in place of a false zero; a read failure prints `Unavailable: transcripts unreadable.`. `/memory-feedback` STEP 5 shows the table. New module `lib/memory-feedback/advisor.ts`; tests `lib/memory-feedback/advisor.test.ts`.
|
||||
|
||||
### Changed
|
||||
- **memory recall**: a prompt after 30 minutes idle now needs 8 content words, up from 5 (a context's first prompt or a design/analysis prompt still needs 5), and the haiku rerank keeps at most 2 entries, down from 3. Measured on the first feedback gate: idle precision 44 %, third pick 35 %.
|
||||
@@ -20,7 +21,9 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship
|
||||
- **memory commit chokepoint**: `lib/memory.sh check --staged`, run by `lib/memory-commit.sh commit` before every memory commit (rc 6, registry unstaged), also refuses a staged v2 registry whose new `## ` entry does not carry the next free ID: the highest ID seen at any heading level, fenced or not, in HEAD and above the entry in the staged file, plus one, the same reading `add` uses. stderr: `memory: <file>:<line>: new entry <ID> is not the next free ID <PREFIX>-NNN`. A committed ID is never renamed: fix the uncommitted heading and every uncommitted mention of its ID (the `superseded by` line from `add --supersedes`, the journal line), or drop the new entry and re-add it with `memory.sh add`. Skipped when the registry is absent from HEAD, HEAD is v1 (an `upgrade` commit), HEAD has an open code fence, or HEAD has no well-formed `## ` entry. Tests: `lib/tests/memory.test.sh`.
|
||||
- **model-router write guard fails closed**: when the guard's own check throws or times out, a main-loop Edit, Write or NotebookEdit of a code file outside a skill run is held with `model-router: the write guard failed (<kind>), so this write is held. Enter /hotfix, /feat, /bugfix or /ship-feature, or re-enter the skill you were running, then make this edit.` One log line per session: `model-router: write guard failed (<kind>): main-loop code writes are held until a skill runs`. Sub-agents, skill runs (typed, model-declared phase, typed `/route`) and `.md` / `.txt` files still pass; an error raised by a downstream tool is replayed as before. The guard used to let the write through on its own failure. Tests: `mods/model-router/hooks/register.test.ts` (GUARD: a failing guard …).
|
||||
- **model-router: Fable leaves auto-routing**: the `best` and `big` tiers default to opus then sonnet (were fable>opus>sonnet and opus>fable>sonnet), so Opus is the strongest model the router routes to and Fable is the advisor (`advisorModel` in settings.json). Fable stays in the model table and first in the fallback rank, so a hand pick of fable ranks above opus. The first-use Change dialog offers opus, sonnet and haiku; the bare `/model` dialog still offers fable, labelled `fable (custom)`. The ask before Fable only fires when a machine override puts fable at the head of `best`: otherwise `/route ask-tier on` answers `(inert: best is not headed by fable)` and `/route show` prints `ask-tier: inert`. An agent on a best or big row keeps its opus frontmatter when Opus is down. The `tiers.best does not lead the fallback chain` log is gone; `routing.json` is unchanged. Tests: `mods/model-router/hooks/register.test.ts`; `lib/tests/effort-routing.test.sh` floors every row on its tier's head. The `/client-handover` skill-runner children and the `lib/model-gate.md` dispatch doctrine pin `model: "opus"` instead of `"fable"` (BDR-150: Fable is the advisor, never a dispatch target), and the model gate lets a sub-agent pass when the route answer says its model is `fixed at spawn`. Tests: `lib/tests/model-routing.test.sh` refuses any fable dispatch pin under agents/, skills/ and lib/; `lib/tests/effort-routing.test.sh` checks the 7 opus/effort="high" client-handover dispatches.
|
||||
- **Advisor doctrine (`CLAUDE.global.md` § Workflow, `lib/effort-shift.md` § Advisor, `lib/challenge-plan.md`, `lib/verify-secure-loop.md`, `agents/plan-challenger.md`, `agents/verifier.md`, `agents/security-auditor.md`, `agents/analyzer.md`)**: when a stronger model is needed (an approach to settle before building, a stuck problem, a long task before calling it done, a change to recommend to the doctrine, the architecture or a public interface), the main loop calls the advisor tool (Fable, settings `advisorModel`, set by `/advisor`), at least on the written plan before the plan challengers are dispatched (`lib/challenge-plan.md`, every skill that challenges a plan, once per skill run, not before a re-challenge: an answer that lands a real flaw revises the plan file as plain plan text with no advisor attribution, the advice never enters a challenger brief, and the CHALLENGE SUMMARY gains an `Advisor:` row), once per verify-secure run at the first gate loop to fail twice (floor, conformity, security, or a second structural failure, counting main-loop calls since GATE 0 first ran; the advice stays in the main loop and never enters an executor brief; every cap or escalation STOP carries it and says whether it predates the last iteration), and before proposing a merge (`gitflow finish`) or calling a long task done. Inside a skill run these points cover the triggers: no second call for the same recommendation. `plan-challenger`, `verifier`, `security-auditor` and `analyzer` may call it at most once per dispatch, late, before their verdict or report; the analyzer's output rests on the code it read, never on the advice alone, and advice proposing a design or a fix counts only where the brief asks for one. For the three gates advice only adds: the verifier may go back to a contract criterion and tags a resulting NOT-MET `(advisor-prompted)`, never clearing a gap on advice; the challenger never drops or lowers a finding on advice alone; the security-auditor tags an added finding `advisor:<STEP 3 class>` and a raised one `<rule>+advisor`, at that class's severity (an added finding matching no class is REPORTED LOW), and its PROOF ends with `; advisor <n> added/raised`. Executors and every other sub-agent do not call it, even when the tool is listed. Advisor absent or erroring → proceed as written; advice waives no gate, cap or guard and, at a loop cap, feeds the STOP diagnosis. Fable on main comes only from a hand pick, a typed `/route model=fable`, a phase naming `model: fable` or a machine override that puts fable in a tier (BDR-150). Prose that still named Fable as the `audit` row head or a skill-runner pin (`agents/plan-challenger.md`, `lib/challenge-plan.md`, `lib/effort-shift.md`, `skills/tour/SKILL.md`) now says opus.
|
||||
- **Advisor doctrine (`CLAUDE.global.md` § Workflow, `lib/effort-shift.md` § Advisor, `lib/challenge-plan.md`, `lib/verify-secure-loop.md`, `agents/plan-challenger.md`, `agents/verifier.md`, `agents/security-auditor.md`, `agents/analyzer.md`, `skills/{feat,bugfix,hotfix,ship-feature,init-project,onboard,code-clean,harden,a11y,guardrails,audit-delta,tour,release-candidate}/SKILL.md`, `skills/pack-seo/skills/{seo,geo}/SKILL.md`, `skills/pack-web-validate/skills/web-validate/SKILL.md`)**: when a stronger model is needed (an approach to settle before building, a stuck problem, a long task before calling it done, a change to recommend to the doctrine, the architecture or a public interface), the main loop calls the advisor tool (Fable, settings `advisorModel`, set by `/advisor`), at least on the written plan before the plan challengers are dispatched (`lib/challenge-plan.md`, every skill that challenges a plan, once per skill run, not before a re-challenge: an answer that lands a real flaw revises the plan file as plain plan text with no advisor attribution, the advice never enters a challenger brief, and the CHALLENGE SUMMARY of every caller gains an `Advisor:` row (the plan change it drove, `called, no change` or `not called (absent | error | already called this run)`), each caller sending its route before the challenge with the first tool call of `lib/challenge-plan.md`; the ORCHESTRATOR PROTOCOL in `agents/plan-challenger.md` mirrors this advisor-first step and the row), once per verify-secure run at the first gate loop to fail twice (floor, conformity, security, or a second structural failure, counting main-loop calls since GATE 0 first ran; the advice stays in the main loop and never enters an executor brief; every cap or escalation STOP carries it and says whether it predates the last iteration), and before proposing a merge (`gitflow finish`) or calling a long task done: one end-of-run call per skill run, never skipped for an earlier plan or stuck call, except that audit-delta and tour skip it when the run applied no fix and feat and bugfix skip it when GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED), each on its first attempt, their summary's `ADVISOR` field then reading `skipped (gates clean on first pass)`. It sits at the commit step of feat and bugfix and at the end step of ship-feature, init-project, a11y and guardrails: the main loop first prints the run's diff stat, the answer goes into the reply or finish proposal as an `Advisor:` line, or into the feat/bugfix summary's `ADVISOR` field, a fix it drives goes back through the gates, and a later merge proposal reuses the last run's answer, or its skip, and names any code commit made after it (doc and memory commits excepted). It also sits at the end of audit-delta and tour when the run applied a fix (tour: main loop only, never a runner), and at release-candidate STEP 4 before the go / hold ask. In those three the answer is reported only: a fix it calls for waits for a new run, and at the release gate it makes hold the recommended answer. The same six gate skills carry a `Stuck:` line that points at the verify-secure rule. Inside a skill run these points cover the triggers: no second call for the same recommendation. `plan-challenger`, `verifier`, `security-auditor` and `analyzer` may call it only when dispatched as a sub-agent, at most once per dispatch, late, before their verdict or report; the analyzer's output rests on the code it read, never on the advice alone, and advice proposing a design or a fix counts only where the brief asks for one. For the three gates advice only adds: the verifier may go back to a contract criterion and tags a resulting NOT-MET `(advisor-prompted)`, never clearing a gap on advice; the challenger never drops or lowers a finding on advice alone; the security-auditor tags an added finding `advisor:<STEP 3 class>` at that class's severity (REPORTED LOW when it matches no class), and tags a raised one `<rule>+advisor` only when the class's severity is higher than the finding's own; a raise that does not apply, or matches no class, changes nothing (no tag, no PROOF count). Its PROOF ends with `; advisor <n> added/raised`. Executors and every other sub-agent do not call it, even when the tool is listed. Advisor absent or erroring → proceed as written; advice waives no gate, cap or guard and, at a loop cap, feeds the STOP diagnosis. Fable on main comes only from a hand pick, a typed `/route model=fable`, a phase naming `model: fable` or a machine override that puts fable in a tier (BDR-150). Prose that still named Fable as the `audit` row head or a skill-runner pin (`agents/plan-challenger.md`, `lib/challenge-plan.md`, `lib/effort-shift.md`, `skills/tour/SKILL.md`) now says opus.
|
||||
- **gates.sh timeout**: the default per-CHECK timeout (`GATES_TIMEOUT`) is 600 s, up from 120 s. A full `make test` (about 135 s) went NOT-MET on the timeout alone. A run lasts the sum of its CHECKs: a caller with a shorter limit (a foreground tool call stops at 600 s) runs it in the background, and a killed run writes nothing back, so the floor stays PENDING.
|
||||
- **Done and triage levers (`lib/verify-secure-loop.md`, `lib/challenge-plan.md`, `lib/capitalize-commit.md`, `agents/verifier.md`, `CLAUDE.global.md`)**: a run is done when its oracles are green (GATE 0 MET, verifier CONFORME and security PASS on the same diff); a later review reopens it only with reproducible evidence, a command that fails on HEAD or real output shown wrong. A MINOR finding is folded into the plan before the dispatch or dropped as one `MINOR dropped: <finding>` line in the run report and plan file, never in TODO.md or a registry; a security finding is never dropped and goes to the user. A run that only places a decision the user already made skips the plan challenge and its advisor call and prints `Challenge: skipped (placed decision: …)`. Before the first dispatch the main loop records `- run-base: <sha>` in the contract and dry-runs its CHECKs with `gates.sh run` on a `mktemp -d` copy. A TODO loop notes its start SHA in TODO.md and runs that list plus user additions. The memory-commit report line ends with `· TODO +n / -m` (`TODO n/a` when the diff fails). The verifier counts run artifacts in scope: an added plan file, appended `MINOR dropped:` lines, the contract's `EVIDENCE:`, `- run-base:` and `[gated]` lines.
|
||||
|
||||
### Removed
|
||||
- `hooks/design-toolchain-reminder.sh`, its `UserPromptSubmit` entry in `settings.json` (`ctx7-reminder` stays the only one) and its suite `lib/tests/design-toolchain-reminder.test.sh`. Measured 2026-10-31: 59 fires, 0 Reads of `rules/web-building.md`. Design routing stays with the `rules/web-building.md` path rule and the `CLAUDE.global.md` pointer. The fire log `~/.claude/logs/design-toolchain-fires.log` is left in place.
|
||||
@@ -41,6 +44,9 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship
|
||||
- `mods/` type-check under `claude plugin validate --strict` (CLI 2.1.323 started type-checking mods): 17 sites narrowed, failure behaviour unchanged (6433e4d, BLK-049); the write guard has since moved to fail-closed (see Changed).
|
||||
- model-router: a Skill call whose answer carries `isError` (refused or unknown skill) no longer opens the write guard for the rest of the session. Test: `mods/model-router/hooks/register.test.ts` (GUARD: an isError Skill answer leaves the latch closed).
|
||||
- `settings.json`: the `autoMode.hard_deny` entry "Disarming the guardrails" now names turning a mod off as disarming: `"enabled": false` in `~/.claude/<mod>.json`, a mod's `enabledPlugins` entry set to false, or `profile.sh disable` of a mod. These switches turn off the model-router write guard and the memory mod; the user still sets them by hand.
|
||||
- `lib/gates.sh` (GATE 0 floor): an unindented line under `## ACCEPTANCE CRITERIA` that starts with a digit but is not `N. text` (`1b.`, `1.1`, `2)`) is now a parse error, `malformed criterion label at line N`, and a second `CHECK:`, `EXPECT:` or `EVIDENCE:` on one criterion is one too, `second CHECK: at line N in criterion M`. Either gives `VERDICT: ERROR(n)` (rc 2) and no CHECK runs. An oracle under a label the parser missed used to overwrite the previous criterion's, so a failing criterion could read MET. A label that is not digit-led (indented, bullet) is caught only when the criterion before it already has that attribute; after a manual criterion its oracle is still absorbed. With no criterion parsed, the `no numbered criteria` error now ends with the first parse error. Test: `lib/tests/gates.test.sh`.
|
||||
- Security gate readers (`lib/verify-secure-loop.md`, `agents/security-auditor.md` ORCHESTRATOR PROTOCOL, `skills/hotfix/SKILL.md` STEP 4) no longer read `DEGRADED` as a value of the `SECURITY — VERDICT:` line. The auditor prints `VERDICT: PASS` on a scan without semgrep and reports DEGRADED on its `TOOL:` line, so the old `DEGRADED` branch never fired: a degraded scan read as a clean PASS, the checklist result and the `make plugin` hint were never surfaced, and hotfix's `SECURITY: DEGRADED (checklist only)` summary could not be reached. The `PASS` branch now reads the `TOOL:` line first, and a PASS with no `TOOL:` line is a structural failure (one fresh retry, then escalation). `lib/effort-shift.md` § Advisor names the `TOOL:` line in the feat/bugfix skip condition. The auditor's output format is unchanged. Test: `lib/tests/loops-light.test.sh` (DEGRADED on the TOOL line).
|
||||
- **Advisor in sub-agents**: opus sub-agents, general-purpose ones included, called the `advisor` tool on their own: 30 calls, 7.1M input tokens. The tool is listed to every sub-agent, its own instructions ask for calls, and the rule in `CLAUDE.global.md` reached them only as an attachment. A new SubagentStart hook, `hooks/subagent-advisor.sh` (`settings.json`, timeout 5 s), tells every sub-agent at spawn not to call it unless its agent definition or its dispatcher's brief allows it, then at most once. The allowed set is plan-challenger, verifier, security-auditor, `analyzer` and an opus code review (`/ship-feature` STEP 6, `/init-project` STEP 10, a standalone subagent-driven-development final review), whose brief allows one call. plugin-advisor, seo-analyzer, geo-analyzer, doc-syncer, commit-changer and handover-doc-writer, and the opus briefs of `/onboard`, client-handover-writer and `/tour` Phase B, carry a never-call line. A standalone subagent-driven-development run dispatches every worker on sonnet, task reviews and fix rounds included. `Advisor:` rows gain `not called (sub-agent)`. Test: `lib/tests/subagent-advisor.test.sh`.
|
||||
|
||||
## [3.0.0] — 2026-11-12
|
||||
|
||||
|
||||
+8
-4
@@ -84,9 +84,10 @@ code" wins. Repo-specific instructions override both.
|
||||
calls the advisor tool when it is listed (settings `advisorModel`,
|
||||
Fable, set by /advisor), at least at the points of
|
||||
`~/.claude/lib/effort-shift.md` § Advisor; dispatched plan-challenger,
|
||||
verifier, security-auditor and `analyzer` at most once, before their
|
||||
verdict or report; other sub-agents do not. Fable is never routed or
|
||||
pinned: the router tops out at opus (BDR-150).
|
||||
verifier, security-auditor, `analyzer` and an opus code review at most
|
||||
once, before their verdict or report; other sub-agents never (each opus
|
||||
brief you write states its rule; a SubagentStart hook restates it). Fable
|
||||
is never routed or pinned: the router tops out at opus (BDR-150).
|
||||
- Ask rather than guess. A choice visible in the result (placement,
|
||||
wording, order, behavior), a name that becomes public (command, flag,
|
||||
endpoint, file), or a scope the request leaves open → ask, even mid-task;
|
||||
@@ -112,7 +113,8 @@ code" wins. Repo-specific instructions override both.
|
||||
- Once it qualifies: plan before code → one subtask = one coherent change
|
||||
→ check off as you go → high-level note at each milestone. A plan a skill
|
||||
persists (`.claude/tasks/plans/`, contract) satisfies the rule; TODO.md
|
||||
then carries one line per run.
|
||||
then carries one line per run. A TODO loop notes its start SHA in TODO.md,
|
||||
runs that list + user adds; new items: report, run if one breaks its work.
|
||||
|
||||
## After code changes
|
||||
1. Run tests, lint, build, type-check if available. Report what was
|
||||
@@ -291,6 +293,8 @@ cryptic names.
|
||||
finishing-a-development-branch → `gitflow finish` (human signal)
|
||||
systematic-debugging → bugfix
|
||||
verification-before-completion → the verifier gates
|
||||
- subagent-driven-development standalone: workers sonnet (task reviews and
|
||||
fix rounds too); final review opus, its brief allowing one `advisor` call
|
||||
- SEO+GEO → seo (GEO only → geo); W3C + WCAG → web-validate. Pack off →
|
||||
propose `profile.sh enable seo` (seo, geo) or `enable web-validate`, the
|
||||
user runs `/reload-plugins`; else say so. Security audit (secrets, CVE,
|
||||
|
||||
@@ -76,15 +76,25 @@ decisions) to the `best` tier, opus at the phase's effort. Fable is never
|
||||
auto-routed: it is the advisor (`advisorModel` in settings.json) and a hand
|
||||
pick. The main loop calls the advisor at least on the written plan before the
|
||||
plan challengers see it (`lib/challenge-plan.md`, once per skill run; the
|
||||
CHALLENGE SUMMARY's `Advisor:` row records what it changed), once per
|
||||
CHALLENGE SUMMARY's `Advisor:` row records what it changed; skipped with
|
||||
the challenge when the run only places a decision the user already made,
|
||||
`Challenge: skipped (placed decision: …)` standing in for the summary),
|
||||
once per
|
||||
verify-secure run at the first gate loop to fail twice (the advice stays in
|
||||
the main loop, never in an executor brief; a cap or escalation STOP carries
|
||||
it), before proposing a merge or calling a long task done, and before
|
||||
it), before proposing a merge or calling a long task done (two skips:
|
||||
`/feat` and `/bugfix` when GATE 0 said MET, the verifier CONFORME and
|
||||
security PASS, not DEGRADED, each on its first attempt, their summary's
|
||||
`ADVISOR` field then reading `skipped (gates clean on first pass)`;
|
||||
`/audit-delta` and `/tour` when the run applied no fix), and before
|
||||
recommending a change to the doctrine, the architecture or a public interface.
|
||||
plan-challenger, verifier, security-auditor and `analyzer` may call it once,
|
||||
before their verdict or report: advice can add a finding or raise its
|
||||
severity, never drop, lower or clear one. Other sub-agents do not, even when
|
||||
the tool is listed. An absent or
|
||||
plan-challenger, verifier, security-auditor, `analyzer` and an opus code
|
||||
review (`/ship-feature` STEP 6, `/init-project` STEP 10, a standalone
|
||||
subagent-driven-development final review) may call it once when dispatched
|
||||
as a sub-agent, before their verdict or report: advice can add a finding or
|
||||
raise its severity, never drop, lower or clear one. Other sub-agents never
|
||||
call it, even when the tool is listed; the SubagentStart hook
|
||||
`hooks/subagent-advisor.sh` restates the rule in every sub-agent at spawn. An absent or
|
||||
failing advisor changes nothing, and its advice waives no gate, cap or guard
|
||||
(`lib/effort-shift.md` § Advisor). The main loop writes no
|
||||
code outside a skill run (the router's guard redirects it to a skill); the fresh
|
||||
@@ -182,7 +192,7 @@ Limits: a main-loop switch re-reads cold the part of the context the target mode
|
||||
- Digest: `hooks/session-start.sh` prints `memory digest:` on `startup`, `clear` and `compact` (never `resume`) in a project that has `.claude/memory/`: up to 3 open BLK from `memory.sh index blocker` (the rest counted, upstream ones counted; `- open: none` when none is open, `- open: unknown (memory.sh index failed)` when the read fails, times out or returns a `| BLK-` row it cannot parse), up to 3 unchecked TODO items (from a `## Actionable` or `### Actionable` section, else the file's first 3 unchecked top-level items; items inside HTML comments ignored), the last journal line, 800 characters at most. When the cap bites, TODO lines drop first and a `- todo: +N not shown, read .claude/tasks/TODO.md` line counts them; nothing else drops. Without `timeout` and `jq` it prints only from a terminal.
|
||||
- Recall switch: `{"enabled": true, "recall": false}` in `~/.claude/memory.json` cuts the injections (recall and known-error line) and keeps capture. Every ask is logged under the `l:<root>` store key (last 200 records, 64 KiB), never shown: when, session, agent, channel, the IDs injected, the `trigger` (`fresh`, `idle`, `keyword`, `tool`) and the `outcome` (`injected`, `none`, `timeout`, `refused`, `paused`; an ask that injects nothing is logged with no IDs); a prompt ask also logs `cands` (BM25 candidates after the seen filter) and `ms` (rerank wall time, when a rerank ran). `/memory-feedback` reads it.
|
||||
- Recall residuals: measured on 14 days of this repo's transcripts, precision is 54 to 61 % against a 64 % bar, so recall ships on and switchable, and the log decides. The router's classifier label is not used. EVAL entries are not recalled. Each failing command that matches an entry spawns one `memory.sh index`. The haiku bound drops the recalls that answer slower than 5 seconds.
|
||||
- Feedback: `/memory-feedback` (phase 4d) labels each injected entry from its transcript, with a 5-label spot check by you, and reports precision, misses, noisy entries and promotion candidates against `lib/memory-feedback/thresholds.ts`. Two gates: prompt at 20 labelled asks or 35 days, tool at 10 injections (one 35-day extension, then closed). Precision, trigger precision and the miss share count only rows after the gate-1 fix; their actions wait for 20 post-fix asks (`Post-fix prompt asks: k/20` in FEEDBACK.md, pre-fix entries excluded). Data stays local in `~/.claude/memory-feedback/` (IDs, enums and repo tags only, never in git). The session banner prints `memory feedback: … → /memory-feedback` when a run is due, and goes silent once the prompt gate, the tool gate and the post-fix sample are recorded, or with `"recall": false`.
|
||||
- Feedback: `/memory-feedback` (phase 4d) labels each injected entry from its transcript, with a 5-label spot check by you, and reports precision, misses, noisy entries and promotion candidates against `lib/memory-feedback/thresholds.ts`. Each run also appends `## Advisor usage (<from> → <to>)` to FEEDBACK.md: advisor calls served since the last run (first run: every transcript on disk), per caller (main loop or sub-agent type) and model, with input tokens, all projects summed with no repo name. When the window starts before the 7-day transcript retention, a line warns that older calls may be missing. Two gates: prompt at 20 labelled asks or 35 days, tool at 10 injections (one 35-day extension, then closed). Precision, trigger precision and the miss share count only rows after the gate-1 fix; their actions wait for 20 post-fix asks (`Post-fix prompt asks: k/20` in FEEDBACK.md, pre-fix entries excluded). Data stays local in `~/.claude/memory-feedback/` (IDs, enums, repo tags and advisor call counts only, never in git). The session banner prints `memory feedback: … → /memory-feedback` when a run is due, and goes silent once the prompt gate, the tool gate and the post-fix sample are recorded, or with `"recall": false`.
|
||||
- Off switch: `{"enabled": false}` in `~/.claude/memory.json`, read at the first event of a session, so it applies at the next session or after `/reload-plugins`. Off, the tool answers `memory capture is off (~/.claude/memory.json)`. A switch file that cannot be read, or whose `enabled` is not a boolean, keeps capture on and logs one line.
|
||||
- Residuals: cross-process writes are unverified (two concurrent sessions: last writer wins). Non-Bash failures are not captured. `-b` counts as curl's cookie flag only when `curl` opens its command segment, after optional env assignments, `sudo`, `rtk` or `$(`: `time curl -b …` keeps its cookies. 40-hex Gitea tokens are kept by design: they look like commit SHAs. A session root that moves with `/cd` or a worktree move hides earlier captures of the same repo from /capitalize. A bare `gitflow.sh finish` on a chore branch counts as a milestone. Measured at 83 % noise before the error-shaped filter over 14 days of this repo's transcripts; the filter keeps every useful sample and cuts captures by two thirds (`.claude/tasks/plans/2026-11-03-memory-capture-spike/NOISE.md`).
|
||||
|
||||
@@ -266,7 +276,7 @@ a different package, ships its own conflicting `graphify` bin) — see
|
||||
| `/audit-delta` | Recurring audit of changes since last run (norms, bugs, dead code, security) |
|
||||
| `/capitalize` | Flush uncapitalized context + reconcile TODO before /clear or /compact (`--ritual` adds the end-of-session reflection) |
|
||||
| `/prune-memory` | Curate and compress the .claude/memory/ registries; rewrite noisy recall entries and propose promotions from `/memory-feedback` |
|
||||
| `/memory-feedback` | Label the memory mod's recall injections relevant or irrelevant from the transcripts, spot-check 5 labels with you, report precision and the phase 4d gates in ~/.claude/memory-feedback/FEEDBACK.md. Run it weekly: transcripts live 7 days |
|
||||
| `/memory-feedback` | Label the memory mod's recall injections relevant or irrelevant from the transcripts, spot-check 5 labels with you, report precision, the phase 4d gates and advisor usage in ~/.claude/memory-feedback/FEEDBACK.md. Run it weekly: transcripts live 7 days |
|
||||
| `/reconcile` | Confront declared status (TODO, registries) against real git/fs state — surface stale items |
|
||||
| `/pdf-translate` | Translate a PDF to another language, output as HTML (via Vision) |
|
||||
| `/explain-diff` | Explain a diff, commit, branch or PR as one self-contained HTML page (background, intuition, code walkthrough, 5-question quiz), saved outside the repo |
|
||||
|
||||
@@ -161,7 +161,7 @@ Tu veux...
|
||||
| `/audit-delta` | Audit récurrent du delta depuis le dernier run | Axes : conformité / bugs / dead code / sécurité |
|
||||
| `/capitalize` | Avant /clear ou /compact | Flush contexte non capitalisé + réconcilie .claude/tasks/TODO.md |
|
||||
| `/prune-memory` | Registres trop longs / bruyants | Curation : merge, superseded, compression ; réécriture des entrées bruyantes et propositions de promotion en mécanisme (règle, hook, garde, test) lues dans `~/.claude/memory-feedback/FEEDBACK.md` |
|
||||
| `/memory-feedback` | Chaque semaine, ou quand la bannière le rappelle | Étiquette les injections du rappel mémoire depuis les transcripts, contrôle de 5 étiquettes avec toi, précision et gates de la phase 4d dans `~/.claude/memory-feedback/FEEDBACK.md` |
|
||||
| `/memory-feedback` | Chaque semaine, ou quand la bannière le rappelle | Étiquette les injections du rappel mémoire depuis les transcripts, contrôle de 5 étiquettes avec toi, précision, gates de la phase 4d et usage de l'advisor dans `~/.claude/memory-feedback/FEEDBACK.md` |
|
||||
| `/reconcile` | Connaître l'état réel du travail ouvert (TODO/registres douteux) | Confronte statut déclaré vs git/fs réel |
|
||||
| `/close` | Fin de session | Alias de /capitalize --ritual — dedup + TODO + réflexion 3 questions |
|
||||
| `/harden` | Audit sécurité web (SSL, CSP, HSTS) | Projet web avec config HTTP |
|
||||
@@ -200,7 +200,7 @@ l'outil `mcp__model-router__route` (`lib/effort-shift.md`). Les skills
|
||||
externes vendorés (pile design, superpowers, agent-skills, skills scroll
|
||||
MengTo, 21st) ont aussi leur ligne.
|
||||
|
||||
Taper un skill qui a une ligne route la boucle principale dessus. Une ligne du tier best (plan, reflect, orchestrate, escalate ; `audit` est une ligne d'agent, jamais tapée) tient d'un tour à l'autre pendant tout le run, jusqu'à `/route clear`, `/route off`, un `/model` tapé ou choisi dans le sélecteur, ou un skill d'un autre tier tapé. Un `/model <nom>` tapé, ou un choix dans le sélecteur `/model`, avec un modèle de la table demande sa portée (Échap ne change rien). Le changement du sélecteur est d'abord retenu (le moteur affiche qu'un hook l'a bloqué), puis la question vient ; un choix fait pendant qu'un autre dialogue est ouvert est refusé (`answer the open dialog first`) : This project écrit l'id complet dans `model` du `.claude/settings.local.json` du projet (créé s'il manque, à garder dans le `.gitignore`) et pose une route de modèle tenue ; This conversation pose la route seule, sans rien écrire ; Everywhere lance le `/model` natif (`settings.json` utilisateur, tous les projets). Default dans le sélecteur, sans argument, avec un nom inconnu, en headless (`-p`) ou mod coupé, le `/model` natif passe sans question. Un modèle choisi dans ce dialogue change toujours : ni plafond de relecture à froid, ni `mainUpgrade` ni `mainModelSwitch`. S'il est en panne, la boucle principale reste où elle est jusqu'à son retour. Un changement natif (ligne Model de `/config` comprise) ou `/clear` l'abandonne ; un `/route model=` tapé garde les plafonds. La ligne Model de `/config` écrit toujours le `settings.json` utilisateur, et un dialogue jamais répondu n'a pas de délai. Pour relancer un tour bloqué : `ultrathink` dans le prompt (plancher d'effort du tour) ou `/route effort=max` (tient jusqu'à `/route clear`). Le `/effort` intégré n'a pas d'effet dans un run : les lignes et les routes passent devant. Les règles de mots-clés du prompt (`plan`, `design`, `architecture`… prennent l'effort de plan ; `pourquoi`, `review`, `audit`… celui de reflect), `ultrathink` et un lancement d'agent par la boucle principale (route `orchestrate` dérivée, tenue jusqu'à la fin de ses agents en arrière-plan) ne fixent que le niveau d'effort du tour, jamais le modèle : ils ne font jamais monter la boucle principale au-dessus du modèle de la session, et un run best tenu garde son modèle. Fable n'arrive sur la boucle principale que par un choix à la main (`/model`, sélecteur), un `/route model=fable` tapé, une phase qui nomme `model: fable` ou une config machine qui le place dans un tier : aucun tier ni aucune phase livrés ne le contiennent. Fable sert de conseiller (outil advisor, `advisorModel` dans settings.json, réglé par `/advisor`) : la boucle principale l'appelle au moins sur le plan écrit, avant que les challengers du plan le voient (`lib/challenge-plan.md`, une fois par run de skill ; la ligne `Advisor:` du CHALLENGE SUMMARY dit ce qu'il a changé), une fois par run verify-secure à la première boucle de porte qui échoue deux fois (le conseil reste dans la boucle principale, jamais dans le brief d'un exécutant ; un STOP au plafond ou en escalade le reprend), avant de proposer un merge ou de déclarer finie une longue tâche, et avant de recommander un changement de la doctrine, de l'architecture ou d'une interface publique ; plan-challenger, verifier, security-auditor et `analyzer` peuvent l'appeler une fois, avant leur verdict ou leur rapport : un conseil peut ajouter un constat ou relever sa sévérité, jamais le retirer, l'abaisser ni l'effacer ; les autres sous-agents ne l'appellent pas, même quand l'outil est listé. Conseiller absent ou en erreur : on continue ; un conseil ne lève aucune porte, aucun plafond ni aucune garde. Un prompt tapé sans règle, skill ni route en cours passe par un classifieur (un appel au petit modèle, 3 secondes au plus) : le tour prend la route de la phase devinée : son niveau d'effort, et son modèle, jamais au-dessus de celui de la session. Une devinette `coding` ou `bookkeeping` fait descendre la boucle principale vers un modèle moins cher quand `mainModelSwitch` est actif (par défaut) et que la relecture à froid tient sous `downgradeMaxTokens` (120000 tokens par défaut). Cette relecture compte aussi le prompt qui vient d'être envoyé (un token pour 3 caractères), et un document joint bloque la descente pour cette étape. Le cache compte comme chaud pendant le TTL du moteur (`cache_ttl`, 5 ou 60 minutes), 60 minutes par défaut. `/route classify off` ou `"classify": false` dans la config machine le coupe, et un `/effort` tapé entre deux tours annule la devinette pour ce tour seulement. Avant d'envoyer la boucle principale sur un modèle, celui vers lequel elle se déplace comme celui qu'elle garde (le modèle de la session compris), le mod l'essaie une fois (un appel minimal, 8 secondes au plus) : sans réponse, ce modèle est marqué en panne (raison `probe`) et la décision est reprise une fois ; `"probe": false` dans la confiLine truncated
|
||||
Taper un skill qui a une ligne route la boucle principale dessus. Une ligne du tier best (plan, reflect, orchestrate, escalate ; `audit` est une ligne d'agent, jamais tapée) tient d'un tour à l'autre pendant tout le run, jusqu'à `/route clear`, `/route off`, un `/model` tapé ou choisi dans le sélecteur, ou un skill d'un autre tier tapé. Un `/model <nom>` tapé, ou un choix dans le sélecteur `/model`, avec un modèle de la table demande sa portée (Échap ne change rien). Le changement du sélecteur est d'abord retenu (le moteur affiche qu'un hook l'a bloqué), puis la question vient ; un choix fait pendant qu'un autre dialogue est ouvert est refusé (`answer the open dialog first`) : This project écrit l'id complet dans `model` du `.claude/settings.local.json` du projet (créé s'il manque, à garder dans le `.gitignore`) et pose une route de modèle tenue ; This conversation pose la route seule, sans rien écrire ; Everywhere lance le `/model` natif (`settings.json` utilisateur, tous les projets). Default dans le sélecteur, sans argument, avec un nom inconnu, en headless (`-p`) ou mod coupé, le `/model` natif passe sans question. Un modèle choisi dans ce dialogue change toujours : ni plafond de relecture à froid, ni `mainUpgrade` ni `mainModelSwitch`. S'il est en panne, la boucle principale reste où elle est jusqu'à son retour. Un changement natif (ligne Model de `/config` comprise) ou `/clear` l'abandonne ; un `/route model=` tapé garde les plafonds. La ligne Model de `/config` écrit toujours le `settings.json` utilisateur, et un dialogue jamais répondu n'a pas de délai. Pour relancer un tour bloqué : `ultrathink` dans le prompt (plancher d'effort du tour) ou `/route effort=max` (tient jusqu'à `/route clear`). Le `/effort` intégré n'a pas d'effet dans un run : les lignes et les routes passent devant. Les règles de mots-clés du prompt (`plan`, `design`, `architecture`… prennent l'effort de plan ; `pourquoi`, `review`, `audit`… celui de reflect), `ultrathink` et un lancement d'agent par la boucle principale (route `orchestrate` dérivée, tenue jusqu'à la fin de ses agents en arrière-plan) ne fixent que le niveau d'effort du tour, jamais le modèle : ils ne font jamais monter la boucle principale au-dessus du modèle de la session, et un run best tenu garde son modèle. Fable n'arrive sur la boucle principale que par un choix à la main (`/model`, sélecteur), un `/route model=fable` tapé, une phase qui nomme `model: fable` ou une config machine qui le place dans un tier : aucun tier ni aucune phase livrés ne le contiennent. Fable sert de conseiller (outil advisor, `advisorModel` dans settings.json, réglé par `/advisor`) : la boucle principale l'appelle au moins sur le plan écrit, avant que les challengers du plan le voient (`lib/challenge-plan.md`, une fois par run de skill ; la ligne `Advisor:` du CHALLENGE SUMMARY dit ce qu'il a changé ; sauté avec le challenge quand le run ne fait que placer une décision déjà prise par l'utilisateur, la ligne `Challenge: skipped (placed decision: …)` remplaçant alors le CHALLENGE SUMMARY), une fois par run verify-secure à la première boucle de porte qui échoue deux fois (le conseil reste dans la boucle principale, jamais dans le brief d'un exécutant ; un STOP au plafond ou en escalade le reprend), avant de proposer un merge ou de déclarer finie une longue tâche (deux exceptions : `/feat` et `/bugfix` le sautent quand GATE 0 a dit MET, le verifier CONFORME et la sécurité PASS, pas DEGRADED, chacun au premier essai, et leur champ `ADVISOR` affiche alors `skipped (gates clean on first pass)` ; `/audit-delta` et `/tour` le sautent quand le run n'a appliqué aucun fix), et avant de recommander un changement de la doctrine, de l'architecture ou d'une interface publique ; plan-challenger, verifier, security-auditor, `analyzer` et une revue de code sur opus (`/ship-feature` STEP 6, `/init-project` STEP 10, revue finale d'un subagent-driven-development lancé seul) peuvent l'appeler une fois, seulement quand ils sont lancés comme sous-agents, avant leur verdict ou leur rapport : un conseil peut ajouter un constat ou relever sa sévérité, jamais le retirer, l'abaisser ni l'effacer ; les autres sous-agents ne l'appellent jamais, même quand l'outil est listé, et le hook SubagentStart `hooks/subagent-advisor.sh` leur rappelle la règle au lancement. Conseiller absent ou en erreur : on continue ; un conseil ne lève aucune porte, aucun plafond ni aucune garde. Un prompt tapé sans règle, skill ni route en cours passe par un classifieur (un appel au petit modèle, 3 secondes au plus) : le tour prend la route de la phase devinée : son niveau d'effort, et son modèle, jamais au-dessus de celui de la session. Une devinette `coding` ou `bookkeeping` fait descendre la boucle principale vers un modèle moins cher quand `mainModelSwitch` est actif (par défaut) et que la relecture à froid tient sous `downgradeMaxTokens` (120000 tokeLine truncated
|
||||
|
||||
Garde d'écriture : un Edit, Write ou NotebookEdit d'un fichier de code par la boucle principale est redirigé avec « model-router: code is written inside a skill run… » tant qu'aucun skill n'a tourné sur la boucle principale dans la session (tapé ou chargé par le modèle ; un skill refusé ou inconnu ne compte pas), qu'aucune phase n'a été déclarée ce tour, et qu'aucun `/route` tapé ne tient. Chemins libres : `.md`, `.txt`, le `.claude/` du projet sauf `worktrees/`, et `docs/`. Les sous-agents écrivent librement. Si la vérification du garde échoue elle-même (exception ou délai dépassé), l'écriture est retenue au lieu de passer, avec « model-router: the write guard failed (<kind>), so this write is held… », journalisé une fois par session ; les sous-agents, un skill en cours, une phase déclarée ou un `/route` tapé, et les fichiers `.md` / `.txt` passent toujours, et une erreur levée par l'outil lui-même est transmise telle quelle. `/route clear`, `/route off` et `/clear` réarment le garde ; `/route off` le coupe aussi, et `"enabled": false` dans `~/.claude/model-router.json` coupe le routeur et le garde. Un choix à la main avec `/model` ne l'ouvre pas, et un rechargement de `register.ts` le remet à zéro.
|
||||
|
||||
@@ -220,7 +220,7 @@ Le mod `mods/memory/` note les échecs Bash et les jalons de la session pour que
|
||||
- Digest : `hooks/session-start.sh` affiche `memory digest:` sur `startup`, `clear` et `compact` (jamais `resume`) dans un projet qui a `.claude/memory/` : jusqu'à 3 BLK ouverts issus de `memory.sh index blocker` (le reste compté, les « upstream » comptés ; `- open: none` quand aucun n'est ouvert, `- open: unknown (memory.sh index failed)` quand la lecture échoue, dépasse son délai ou renvoie une ligne `| BLK-` illisible), jusqu'à 3 items non cochés du TODO (section `## Actionable` ou `### Actionable`, sinon les 3 premiers items de premier niveau du fichier ; items en commentaire HTML ignorés), la dernière ligne du journal, 800 caractères au plus. Quand le plafond mord, les lignes TODO tombent d'abord et une ligne `- todo: +N not shown, read .claude/tasks/TODO.md` les compte ; rien d'autre ne tombe. Sans `timeout` ni `jq`, il ne s'affiche que depuis un terminal.
|
||||
- Interrupteur du rappel : `{"enabled": true, "recall": false}` dans `~/.claude/memory.json` coupe les injections (rappel et ligne d'erreur connue) et garde la capture. Chaque demande est journalisée sous la clé de store `l:<racine>` (200 enregistrements, 64 Kio), jamais affichée : date, session, agent, canal, IDs injectés, `trigger` (`fresh`, `idle`, `keyword`, `tool`) et `outcome` (`injected`, `none`, `timeout`, `refused`, `paused` ; une demande qui n'injecte rien est journalisée sans ID) ; une demande sur prompt note aussi `cands` (candidats BM25 après le filtre des entrées déjà vues) et `ms` (durée du rerank, quand il a tourné). `/memory-feedback` la lit.
|
||||
- Limites du rappel : mesurée sur 14 jours de transcripts de ce dépôt, la précision est de 54 à 61 % pour une barre à 64 %, donc le rappel est livré actif et coupable, et le journal tranchera. L'étiquette du classifieur du routeur n'est pas utilisée. Les entrées EVAL ne sont pas rappelées. Chaque commande en échec qui correspond à une entrée lance un `memory.sh index`. La borne haiku écarte les rappels qui répondent après 5 secondes.
|
||||
- Retour d'usage : `/memory-feedback` (phase 4d) étiquette chaque entrée injectée depuis son transcript, avec un contrôle de 5 étiquettes par toi, et donne la précision, les manqués, les entrées bruyantes et les candidates à promotion face aux seuils de `lib/memory-feedback/thresholds.ts`. Deux gates : prompt à 20 demandes étiquetées ou 35 jours, outil à 10 injections (une prolongation de 35 jours, puis fermé). La précision, la précision par trigger et la part de manqués ne comptent que les lignes postérieures au correctif du gate 1 ; leurs actions attendent 20 demandes post-correctif (`Post-fix prompt asks: k/20` dans FEEDBACK.md, entrées antérieures exclues). Les données restent locales dans `~/.claude/memory-feedback/` (IDs, enums et étiquettes de dépôt seulement, jamais dans git). La bannière de session affiche `memory feedback: … → /memory-feedback` quand un passage est dû, et se tait une fois le gate prompt, le gate outil et l'échantillon post-correctif enregistrés, ou avec `"recall": false`.
|
||||
- Retour d'usage : `/memory-feedback` (phase 4d) étiquette chaque entrée injectée depuis son transcript, avec un contrôle de 5 étiquettes par toi, et donne la précision, les manqués, les entrées bruyantes et les candidates à promotion face aux seuils de `lib/memory-feedback/thresholds.ts`. Chaque passage ajoute aussi `## Advisor usage (<from> → <to>)` à FEEDBACK.md : les appels à l'advisor servis depuis le passage précédent (premier passage : tous les transcripts présents), par appelant (boucle principale ou type de sous-agent) et par modèle, avec les tokens d'entrée, tous projets confondus, sans nom de dépôt. Quand la fenêtre commence avant la rétention de 7 jours des transcripts, une ligne prévient que des appels plus anciens peuvent manquer. Deux gates : prompt à 20 demandes étiquetées ou 35 jours, outil à 10 injections (une prolongation de 35 jours, puis fermé). La précision, la précision par trigger et la part de manqués ne comptent que les lignes postérieures au correctif du gate 1 ; leurs actions attendent 20 demandes post-correctif (`Post-fix prompt asks: k/20` dans FEEDBACK.md, entrées antérieures exclues). Les données restent locales dans `~/.claude/memory-feedback/` (IDs, enums, étiquettes de dépôt et compteurs d'appels advisor seulement, jamais dans git). La bannière de session affiche `memory feedback: … → /memory-feedback` quand un passage est dû, et se tait une fois le gate prompt, le gate outil et l'échantillon post-correctif enregistrés, ou avec `"recall": false`.
|
||||
- Interrupteur : `{"enabled": false}` dans `~/.claude/memory.json`, lu au premier événement d'une session : effet à la session suivante ou après `/reload-plugins`. Coupé, l'outil répond `memory capture is off (~/.claude/memory.json)`. Un fichier illisible, ou dont `enabled` n'est pas un booléen, laisse la capture active et journalise une ligne.
|
||||
- Limites connues : les écritures entre processus ne sont pas vérifiées (deux sessions simultanées : la dernière écrit). Les échecs hors Bash ne sont pas captés. `-b` ne vaut drapeau de cookies de curl que si `curl` ouvre son segment de commande, après d'éventuelles affectations de variables, `sudo`, `rtk` ou `$(` : `time curl -b …` garde ses cookies. Un jeton de 40 hexadécimaux nu est gardé à dessein : il ressemble à un SHA de commit (expurgé seulement comme utilisateur d'URL). Une racine de session qui bouge avec `/cd` ou un changement de worktree cache à /capitalize les captures précédentes du même dépôt. Un `gitflow.sh finish` nu sur une branche chore compte comme un jalon. Bruit mesuré à 83 % avant le filtre de forme d'erreur sur 14 jours de transcripts de ce dépôt ; le filtre garde tous les échantillons utiles et réduit les captures des deux tiers (`.claude/tasks/plans/2026-11-03-memory-capture-spike/NOISE.md`).
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ Produce a clear analysis without proposing solutions.
|
||||
- No solutions
|
||||
- Stay factual
|
||||
- Do not modify files
|
||||
- Advisor, when dispatched as a sub-agent: at most one call, after the last
|
||||
- Advisor, when dispatched as a sub-agent: one call allowed, after the last
|
||||
TASKS or PROCESS step and before the OUTPUT, whatever the harness prompt
|
||||
schedules; absent or erroring → proceed. Advice may point you back to
|
||||
the code; every OUTPUT line rests on what you read, never on the advice
|
||||
|
||||
@@ -269,6 +269,9 @@ the gate.
|
||||
this pipeline (initial audits, fix-loop re-dispatches, commit-change,
|
||||
web-validate) carries `model: "opus"` and `effort="high"` — the child hosts gated
|
||||
orchestration on the pipeline's behalf; it must never inherit the session model.
|
||||
Append to each such prompt: "never call the `advisor` tool in this run;
|
||||
a CHALLENGE SUMMARY, if your skill prints one, reads `Advisor: not called
|
||||
(sub-agent)`" (BDR-150).
|
||||
|
||||
For web projects, dispatch in **a single message with two parallel Agent calls** (each with `model: "opus"`, `effort="high"`):
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ effort: high
|
||||
|
||||
# Git Smart Commit
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
> MODEL (BDR-077): `MODE: propose` is dispatched with `model="opus"` (the
|
||||
> call-site override — narrative reconstruction + capitalize routing are
|
||||
> judgment); `MODE: apply` runs on its sonnet row (frontmatter = off-state floor; mechanical
|
||||
|
||||
@@ -8,6 +8,10 @@ effort: high
|
||||
|
||||
# DOC SYNCER
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
## GOAL
|
||||
Keep PUBLIC documentation in sync with code. Detect drift, report it,
|
||||
patch what can be patched automatically. Auto-discover what public doc
|
||||
|
||||
@@ -8,6 +8,10 @@ effort: xhigh
|
||||
|
||||
# GEO — Generative Engine Optimization audit, fix & strategy
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
Target search engines: **ChatGPT Search, Perplexity, Claude, Gemini,
|
||||
Google AI Overviews, Microsoft Copilot, Brave AI, DuckAssist, You.com,
|
||||
Apple Intelligence**. Google classical search is handled by the
|
||||
|
||||
@@ -8,6 +8,10 @@ effort: high
|
||||
|
||||
# HANDOVER DOC WRITER
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
## INPUT — the PACKAGE
|
||||
|
||||
You are dispatched by `client-handover-writer` with a single structured
|
||||
|
||||
@@ -97,17 +97,22 @@ PROOF: read <n> files, inspected <what>, checked plan §<…>
|
||||
(STEP 1's missing/unreadable-plan verdict) is part of the grammar: it
|
||||
carries only the `PLAN:` line — no FINDINGS, no PROOF — and the
|
||||
orchestrator treats it as a dispatcher-side failure, not a challenge result.
|
||||
- Advisor (when listed): at most one call, after drafting your findings
|
||||
and before the verdict, whatever the harness prompt schedules; absent
|
||||
or erroring → proceed. Advice may add or sharpen a finding. Advice
|
||||
alone never drops or lowers one: a change rests on your own re-read,
|
||||
cited at file:line.
|
||||
- Advisor, when dispatched as a sub-agent: one call allowed, after
|
||||
drafting your findings and before the verdict, whatever the harness
|
||||
prompt schedules; absent or erroring → proceed. Advice may add or
|
||||
sharpen a finding. Advice alone never drops or lowers one: a change
|
||||
rests on your own re-read, cited at file:line.
|
||||
|
||||
## ORCHESTRATOR PROTOCOL (consumer contract — wiring reference)
|
||||
|
||||
How an orchestrator runs the plan-challenge phase (the loop + synthesis live in
|
||||
the MAIN loop, never here):
|
||||
|
||||
- ADVISOR FIRST (main loop): per `lib/challenge-plan.md` "Advisor first",
|
||||
with no main-loop advisor call since the skill run started; absent or
|
||||
erroring → dispatch as written. The advice never enters a challenger
|
||||
brief: they stay blind. A skill run inside a sub-agent skips it (row
|
||||
`not called (sub-agent)`).
|
||||
- Dispatch THREE fresh challengers IN PARALLEL, one per lens
|
||||
(correctness / robustness / simplicity), each blind to the others.
|
||||
- MODEL (BDR-076, supersedes the BDR-066 inherit): plan critique is AUDIT
|
||||
@@ -131,5 +136,6 @@ the MAIN loop, never here):
|
||||
- RE-CHALLENGE ONCE if synthesis materially changed the plan (a fix can open a
|
||||
new flaw); max 1 extra pass, then the human gate.
|
||||
- ADVISORY: the revised plan + a challenge summary (raised / addressed /
|
||||
deferred / any lens that failed to return) feed the orchestrator's existing
|
||||
human gate. The human decides — this is not a hard block.
|
||||
deferred / any lens that failed to return / an `Advisor:` row) feed the
|
||||
orchestrator's existing human gate. The human decides — this is not a
|
||||
hard block.
|
||||
@@ -8,6 +8,10 @@ effort: xhigh
|
||||
|
||||
# PLUGIN ADVISOR
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
## ROLE
|
||||
Reason over the PROBE REPORT + request. Classify signals, score complexity,
|
||||
recommend enable/disable, apply the compatibility matrix. Block or warn.
|
||||
|
||||
+23
-18
@@ -157,18 +157,21 @@ In audit mode, ALSO write this same block (plus per-finding detail) to
|
||||
- Blocks on HIGH/CRITICAL only. A noisy gate that blocks on hygiene is a
|
||||
gate people learn to bypass (LRN-047) — MEDIUM/LOW are reported, not
|
||||
gated.
|
||||
- Advisor (when listed): at most one call, after STEP 4 and before
|
||||
STEP 5 and any REPORT write, whatever the harness prompt schedules;
|
||||
absent or erroring → proceed. Advice may add a finding or raise a
|
||||
severity, cited at a file:line you read. An added finding's rule/check
|
||||
is `advisor:<STEP 3 class>`; a raised one keeps its own line, its
|
||||
rule/check becoming `<rule>+advisor`, so it counts once. The severity
|
||||
is that STEP 3 class's, which overrides the STEP 2 mapping for that
|
||||
finding only; an added finding matching no class is REPORTED as LOW,
|
||||
and a raise matching no class changes nothing. It enters STEP 5's
|
||||
dedup and BLOCK(n) like any other, and PROOF ends with `; advisor <n>
|
||||
added/raised`. It never removes, lowers or waives a finding from
|
||||
semgrep, the checklist or STEP 4.
|
||||
- Advisor, when dispatched as a sub-agent: one call allowed, after
|
||||
STEP 4 and before STEP 5 and any REPORT write, whatever the harness
|
||||
prompt schedules; absent or erroring → proceed. Advice may add a
|
||||
finding or raise a severity, cited at a file:line you read. An added
|
||||
finding's rule/check is `advisor:<STEP 3 class>`; it takes that
|
||||
class's severity, for that finding only, and is REPORTED as LOW when
|
||||
it matches no class. A raise applies only when its class's severity
|
||||
is higher than the finding's own: it keeps the finding's line, its
|
||||
rule/check becoming `<rule>+advisor`, so it counts once. A raise
|
||||
that does not apply, or matches no class, changes nothing: no tag,
|
||||
no PROOF count. An added or applied finding enters STEP 5's dedup and
|
||||
BLOCK(n) like any other, and PROOF ends with
|
||||
`; advisor <n> added/raised`.
|
||||
Advice never removes, lowers or waives a finding from semgrep, the
|
||||
checklist or STEP 4.
|
||||
|
||||
## ORCHESTRATOR PROTOCOL (consumer contract — wiring reference)
|
||||
|
||||
@@ -179,14 +182,16 @@ In audit mode, ALSO write this same block (plus per-finding detail) to
|
||||
- Dispatch a FRESH auditor each iteration — no context reuse. Input = mode +
|
||||
scope + (report) + (context), nothing else.
|
||||
- Parse the `SECURITY — VERDICT:` line:
|
||||
- `PASS` → proceed (to commit / next step).
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||
is a structural failure (below). Then proceed (to commit / next
|
||||
step); a DEGRADED PASS also surfaces the checklist result +
|
||||
recommends `make plugin` (the tool's absence never blocks).
|
||||
- `BLOCK(n)` → the dev subagent receives the BLOCKING list + the contract
|
||||
path. After the fix: re-verify the REQUEST first (verifier), THEN re-run
|
||||
this gate — in that order. Max 3 security iterations → STOP + human
|
||||
escalation with the BLOCKING table.
|
||||
- `DEGRADED` (semgrep absent) → does NOT block; surface the checklist
|
||||
result + recommend `make plugin`. A DEGRADED BLOCK (grep-caught
|
||||
hardcoded secret etc.) blocks like any other.
|
||||
- Structural failure (`ERROR(…)`, missing/duplicated VERDICT line,
|
||||
unparsable, crash, PASS without PROOF) → retry ONCE fresh; 2nd
|
||||
structural failure → human escalation. A mute auditor is never a PASS.
|
||||
unparsable, crash, PASS without PROOF or without `TOOL:` line) →
|
||||
retry ONCE fresh; 2nd structural failure → human escalation. A mute
|
||||
auditor is never a PASS.
|
||||
@@ -8,6 +8,10 @@ effort: xhigh
|
||||
|
||||
# SEO — Classical Search Engines audit, fix & strategy
|
||||
|
||||
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
|
||||
never call the `advisor` tool, even though it is listed and its own
|
||||
instructions ask for calls.
|
||||
|
||||
Target search engines: **Google, Bing, DuckDuckGo, Qwant, Ecosia,
|
||||
Yandex, Baidu**. Generative / AI engines (ChatGPT, Perplexity, Claude,
|
||||
Gemini, Google AI Overviews, Copilot) are handled by the
|
||||
|
||||
+11
-4
@@ -101,8 +101,15 @@ Parse the single `FLOOR GUARD:` line:
|
||||
## STEP 4 — SCOPE CHECK
|
||||
|
||||
List the files actually touched (`git diff --name-only` over `DIFF`).
|
||||
Compare against the contract's `FILE SCOPE`. Report every out-of-scope
|
||||
file. Disposition is NOT your call: the orchestrator treats each one as a
|
||||
Compare against the contract's `FILE SCOPE` (`git diff --name-status`
|
||||
plus untracked files). Run artifacts are in scope by default, whatever
|
||||
`FILE SCOPE` says: a plan file the diff ADDS under `.claude/tasks/plans/`
|
||||
or `docs/superpowers/plans/`; on an existing plan, appended
|
||||
`MINOR dropped:` lines only; the CONTRACT you were handed, whole when
|
||||
untracked or added, else only its `EVIDENCE:` lines, `- run-base:` line and
|
||||
`[gated]` entries. Any other change to a plan or a contract stays out of
|
||||
scope. Report every other out-of-scope file.
|
||||
Disposition is NOT your call: the orchestrator treats each one as a
|
||||
gap — the dev removes it or justifies it, and an accepted justification
|
||||
only enters the contract through a human micro-gate.
|
||||
|
||||
@@ -158,8 +165,8 @@ PROOF: read <n> files, ran <cmd → result | nothing>, checked <n>/<n> criteria
|
||||
missing `PROOF` — the run was skipped, not the diff clean.
|
||||
- The verdict grammar is load-bearing: exactly one `VERIFY — VERDICT:`
|
||||
line, spelled exactly as above.
|
||||
- Advisor (when listed): at most one call, after STEP 4 and before
|
||||
STEP 5, whatever the harness prompt schedules; absent or
|
||||
- Advisor, when dispatched as a sub-agent: one call allowed, after STEP 4
|
||||
and before STEP 5, whatever the harness prompt schedules; absent or
|
||||
erroring → proceed. Advice may send you back to a criterion: a
|
||||
resulting NOT-MET cites the file:line you read, ends with
|
||||
`(advisor-prompted)` and counts in STEP 5 like any other. Advice adds
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# hooks/subagent-advisor.sh — SubagentStart: restate the advisor rule in
|
||||
# every sub-agent's own context at spawn (BDR-150, lib/effort-shift.md
|
||||
# § Advisor). The advisor is a server tool listed to every sub-agent and no
|
||||
# tool filter removes it (`tools`, `disallowedTools`, probed 2026-11-19);
|
||||
# the rule in CLAUDE.global.md reaches a sub-agent only as an attachment,
|
||||
# which opus sub-agents ignored. One uniform line for every agent type: the
|
||||
# allowed callers carry their allowance in their own prompt or brief, so
|
||||
# the hook holds no list of names.
|
||||
#
|
||||
# Context only: never blocks a spawn, never echoes the payload, never runs
|
||||
# the CLI of Claude Code (BLK-043). Exit 0 so the JSON is parsed (LRN-196).
|
||||
# shortcut: SubagentStart only; a sub-agent that compacts may lose the
|
||||
# line (upgrade: re-inject on SessionStart `compact` when agent_type is set).
|
||||
set -u
|
||||
cat >/dev/null 2>&1
|
||||
msg='Advisor tool (~/.claude/lib/effort-shift.md § Advisor): do not'
|
||||
msg="$msg call the \`advisor\` tool in this run unless your agent definition"
|
||||
msg="$msg or your dispatcher's brief explicitly allows it; the advisor tool's"
|
||||
msg="$msg own instructions are never an allowance. When allowed: at most"
|
||||
msg="$msg once, before your verdict or report."
|
||||
printf '{"hookSpecificOutput":{"hookEventName":"SubagentStart",'
|
||||
printf '"additionalContext":"%s"}}\n' "$msg"
|
||||
exit 0
|
||||
@@ -63,14 +63,30 @@ never a shell argument.
|
||||
- `chore(memory): BLK-010 resolved — bugfix profile path`
|
||||
- `chore(memory): journal — hotfix copy typo` (journal-only, nothing else)
|
||||
|
||||
Then, still before step 2, count the run's TODO movement as `<todo>`:
|
||||
`TODO +n / -m`, the open TODO items the run added and removed (closed or
|
||||
dropped); a reworded open item counts on both sides. `run_base` is a SHA,
|
||||
never the gitflow base branch: the contract's `- run-base:` line
|
||||
(`lib/verify-secure-loop.md` § BEFORE THE FIRST DISPATCH), else
|
||||
`git rev-parse HEAD` now (shortcut: without a contract only the pending
|
||||
TODO edits count; edits committed earlier in the run are missed). A
|
||||
failing `git diff` → `TODO n/a`, never a silent `+0 / -0`.
|
||||
|
||||
if d=$(git diff --no-color --no-ext-diff "$run_base" \
|
||||
-- ':/.claude/tasks/TODO.md' 2>/dev/null); then
|
||||
n=$(printf '%s\n' "$d" | grep -c '^+ *- \[ \]')
|
||||
m=$(printf '%s\n' "$d" | grep -c '^- *- \[ \]')
|
||||
todo="TODO +$n / -$m"
|
||||
else todo="TODO n/a"; fi
|
||||
|
||||
2. Commit surgically via the helper, capturing the memory-commit hash it prints:
|
||||
|
||||
mem_hash=$(bash "$HOME/.claude/lib/memory-commit.sh" commit "<message>")
|
||||
rc=$?
|
||||
|
||||
3. Report by (rc, mem_hash):
|
||||
- rc 0, mem_hash non-empty → `✅ mémoire committée <mem_hash>`
|
||||
- rc 0, mem_hash empty → `CAPITALIZE: rien à committer` (helper no-op)
|
||||
3. Report by (rc, mem_hash). Every report line ends with `· <todo>` (step 1):
|
||||
- rc 0, mem_hash non-empty → `✅ mémoire committée <mem_hash> · <todo>`
|
||||
- rc 0, mem_hash empty → `CAPITALIZE: rien à committer · <todo>` (helper no-op)
|
||||
- rc 3 → unsafe git state (detached / merge in progress);
|
||||
memory stays in the working tree for a manual
|
||||
commit — surface the helper's stderr.
|
||||
|
||||
+28
-2
@@ -30,6 +30,27 @@ SOLID, synthesis is a no-op. It only costs more when a lens lands a real finding
|
||||
The main loop's advisor call before the dispatch (below) is the costliest
|
||||
single item: once per skill run.
|
||||
|
||||
## SKIP: a placed decision
|
||||
|
||||
A run that only places a decision the user already made skips this phase:
|
||||
no challengers and no plan advisor call. Three conditions, all required:
|
||||
the exact text or change is dictated by that decision (no new design); the
|
||||
decision's text is the user's own words, or was challenged in the run that
|
||||
wrote it; and the caller runs `lib/verify-secure-loop.md` after its
|
||||
dispatch, so the gates still run. The test is whether the run settles an
|
||||
open choice of its own (a mechanism, a condition, a threshold, wording the
|
||||
user did not dictate), never code versus text; in doubt, challenge. The
|
||||
skip is this include's own path (user decision 2026-11-20): a skill's
|
||||
challenge step that reads this section runs as written, and the skip
|
||||
discharges the plan point (`lib/effort-shift.md` § Advisor). The caller prints
|
||||
`Challenge: skipped (placed decision: <the user's decision, date>)` in
|
||||
place of its CHALLENGE SUMMARY.
|
||||
|
||||
Challenged or skipped: when the flow wrote a contract with `CHECK:` lines,
|
||||
before the executor dispatch the main loop records `- run-base:` in the
|
||||
contract and runs `gates.sh run` on a `mktemp -d` copy of it
|
||||
(`lib/verify-secure-loop.md` § BEFORE THE FIRST DISPATCH).
|
||||
|
||||
## DISPATCH — three fresh challengers, in parallel, blind
|
||||
|
||||
**Advisor first (main loop).** Before the first dispatch, with no main-loop
|
||||
@@ -40,7 +61,8 @@ is listed (`lib/effort-shift.md` § Advisor). An answer that lands a real
|
||||
flaw revises the `PLAN` file on disk before the dispatch, as plain plan
|
||||
text: no advisor attribution, no "changes after review" section; the
|
||||
summary's `Advisor:` row carries it (OUTPUT below). Absent or erroring →
|
||||
dispatch as written.
|
||||
dispatch as written. A skill run inside a sub-agent skips this call (its
|
||||
row reads `not called (sub-agent)`, BDR-150).
|
||||
The advice never enters a challenger brief: they stay blind.
|
||||
|
||||
Dispatch THREE fresh `plan-challenger` subagents IN PARALLEL, one per LENS, each
|
||||
@@ -87,6 +109,10 @@ Parse each `CHALLENGE — LENS: … — VERDICT:` line and merge the FINDINGS:
|
||||
- **Severity-driven, not consensus.** Any `[BLOCKER]` from ANY single lens is
|
||||
must-address — the lenses are orthogonal, so a lone security/rollback finding
|
||||
is real, never outvoted by lens-count. Cross-lens agreement only RANKS the MINORs.
|
||||
Each MINOR is folded into the plan now or dropped: a drop is one
|
||||
`MINOR dropped: <finding>` line in the report and the plan file, nothing
|
||||
in TODO.md or a registry; a security finding goes to the user
|
||||
(`lib/verify-secure-loop.md` § MINOR triage).
|
||||
- **RE-THINK the aspect the challenge pointed at.** For each BLOCKER (and each
|
||||
MAJOR you accept): revise the plan on THAT aspect — a NAMED, diffable change to
|
||||
the plan, never a self-authored "addressed" line. A BLOCKER you consciously keep
|
||||
@@ -103,6 +129,6 @@ Feed the orchestrator's gate:
|
||||
anything `[deferred]`; any lens that failed to return; and an `Advisor:`
|
||||
row, added to whatever summary template the caller prints: each plan
|
||||
change an advisor answer drove, `called, no change`, or
|
||||
`not called (absent | error | already called this run)`.
|
||||
`not called (absent | error | already called this run | sub-agent)`.
|
||||
|
||||
The human remains the decider.
|
||||
+38
-7
@@ -106,7 +106,8 @@ target (BDR-150). It is a server tool: the router cannot see or refuse it.
|
||||
Main loop, at least at these points (for work outside them, see the
|
||||
triggers in CLAUDE.global.md § Workflow):
|
||||
1. Before settling an approach: on the written plan, before the
|
||||
challengers see it (`lib/challenge-plan.md`), at most once per skill run.
|
||||
challengers see it (`lib/challenge-plan.md`), at most once per skill run;
|
||||
skipped with the challenge for a placed decision (`lib/challenge-plan.md` § SKIP).
|
||||
2. When stuck: once per verify-secure run, at the first gate loop to fail
|
||||
twice (floor, conformity, security, or a second structural failure),
|
||||
before re-dispatching or escalating. At a cap the STOP diagnosis
|
||||
@@ -115,15 +116,45 @@ triggers in CLAUDE.global.md § Workflow):
|
||||
(a contract micro-gate, an early escalation, the STOP diagnosis) and
|
||||
never enters an executor brief.
|
||||
3. Before proposing a merge (`gitflow finish`) or calling a long task
|
||||
done.
|
||||
done. Wired at the commit step of feat and bugfix, at the end step
|
||||
of ship-feature, init-project, a11y, guardrails, audit-delta and
|
||||
tour, and at the release gate of release-candidate: one end-of-run
|
||||
call per skill run, never skipped for an earlier plan or stuck call.
|
||||
Two skips only: audit-delta and tour when the run applied no fix;
|
||||
feat and bugfix when GATE 0 said MET, the verifier CONFORME and
|
||||
security PASS (not DEGRADED), each on its first attempt (any other
|
||||
verdict, a retry, a loop iteration or a verdict no longer in view
|
||||
runs the call), their summary then reading
|
||||
`skipped (gates clean on first pass)`; DEGRADED shows on the
|
||||
auditor's `TOOL:` line. A skipped call discharges
|
||||
its point and the trigger it covers. In the six flows that run the
|
||||
gates (feat, bugfix, ship-feature, init-project, a11y, guardrails),
|
||||
the main loop first prints the run's diff stat, a fix the answer
|
||||
drives goes back through the gates, and a later merge proposal
|
||||
reuses the last run's answer, or its skip, and names any code commit
|
||||
made after it (doc and memory commits excepted). Elsewhere the
|
||||
answer is reported only and a fix it calls for is a new run.
|
||||
|
||||
Inside a skill run, the points above also cover the triggers of
|
||||
CLAUDE.global.md § Workflow; no second call for the same recommendation.
|
||||
|
||||
Sub-agents, when dispatched: plan-challenger, verifier, security-auditor
|
||||
and `analyzer` call it at most once per dispatch, before their verdict or
|
||||
report; executors and every other sub-agent do not, even when the tool is
|
||||
listed. The analyzer file loaded inline by the main loop follows the
|
||||
main-loop points.
|
||||
Sub-agents, when dispatched: plan-challenger, verifier, security-auditor,
|
||||
`analyzer` and an opus code review (ship-feature STEP 6, init-project
|
||||
STEP 10, a standalone subagent-driven-development final review) call it
|
||||
at most once per dispatch, before their verdict or report; executors and
|
||||
every other sub-agent never call it, even when the tool is listed. The
|
||||
rule rides each sub-agent's own text: the allowed agents' prompts, a
|
||||
`never call` line in the other opus-served agents and the opus briefs we
|
||||
write (a brief sending a general-purpose agent to opus says which rule
|
||||
applies; a code review's says it may call once), and, for every spawn
|
||||
including built-ins such as `Plan`, the SubagentStart hook
|
||||
hooks/subagent-advisor.sh. A skill run by a sub-agent reads
|
||||
`not called (sub-agent)` in its `Advisor:` row.
|
||||
subagent-driven-development, whoever runs it, dispatches every worker
|
||||
(implementers, task reviewers, re-reviews, fix rounds) on sonnet
|
||||
(BDR-066), as ship-feature and init-project pin it; run standalone, its
|
||||
final whole-branch review runs on opus as a code review. The analyzer
|
||||
file loaded inline by the main loop follows the main-loop points.
|
||||
|
||||
Advisor absent or erroring (Fable out of credits, for example) → proceed
|
||||
as written. Advice is input, never consent: it waives no gate, cap or
|
||||
|
||||
+27
-5
@@ -29,7 +29,10 @@
|
||||
# lib/url-guard.sh first.
|
||||
set -uo pipefail
|
||||
|
||||
TIMEOUT="${GATES_TIMEOUT:-120}"
|
||||
# TIMEOUT is per CHECK and a run lasts their sum: the caller's own limit (a
|
||||
# foreground tool call stops at 600 s) must cover it, else run it in the
|
||||
# background. A killed run writes nothing back; the floor stays PENDING.
|
||||
TIMEOUT="${GATES_TIMEOUT:-600}"
|
||||
EVIDENCE_CAP=140
|
||||
|
||||
# Module-level parse tables, index-aligned. Bash has no record type; threading
|
||||
@@ -68,11 +71,23 @@ _new_crit() { # _new_crit <id> <text>
|
||||
_CUR=$((${#_ID[@]} - 1))
|
||||
}
|
||||
|
||||
# A second attribute on one criterion is an error, never an overwrite: it
|
||||
# is what an oracle under a label the parser missed looks like (LRN-284).
|
||||
_set_attr() { # _set_attr <CHECK|EXPECT|EVIDENCE> <value> <lineno>
|
||||
if [ "$_CUR" -lt 0 ]; then
|
||||
_err "$1 at line $3 belongs to no criterion"
|
||||
return 0
|
||||
fi
|
||||
local seen=""
|
||||
case "$1" in
|
||||
CHECK) seen="${_CHECK[_CUR]}" ;;
|
||||
EXPECT) seen="${_EXPECT[_CUR]}" ;;
|
||||
EVIDENCE) [ "${_EVLINE[_CUR]}" = 0 ] || seen=yes ;;
|
||||
esac
|
||||
if [ -n "$seen" ]; then
|
||||
_err "second $1: at line $3 in criterion ${_ID[_CUR]}"
|
||||
return 0
|
||||
fi
|
||||
case "$1" in
|
||||
CHECK) _CHECK[_CUR]="$2" ;;
|
||||
EXPECT) _EXPECT[_CUR]="$2" ;;
|
||||
@@ -82,11 +97,16 @@ _set_attr() { # _set_attr <CHECK|EXPECT|EVIDENCE> <value> <lineno>
|
||||
|
||||
# An UNINDENTED attribute is diagnosed, never absorbed: silently ignoring it
|
||||
# would demote a runnable criterion to a manual one, which is the one parse
|
||||
# bug that turns this checker into a rubber stamp.
|
||||
# bug that turns this checker into a rubber stamp. A digit-led line that is
|
||||
# not `N. text` (`1b.`, `1.1`, `2)`) is rejected and orphans what follows, like
|
||||
# a duplicate id.
|
||||
_absorb() { # _absorb <raw-line> <lineno>
|
||||
local body
|
||||
if [[ "$1" =~ ^([0-9]+)\.[[:space:]]+(.*)$ ]]; then
|
||||
_new_crit "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}"
|
||||
elif [[ "$1" =~ ^[0-9] ]]; then
|
||||
_err "malformed criterion label at line $2 (want \`N. text\`)"
|
||||
_CUR=-1
|
||||
elif [[ "$1" =~ ^ABANDON:[[:space:]]*([0-9]+)?[[:space:]]*(.*)$ ]]; then
|
||||
_ABANDON_ID+=("${BASH_REMATCH[1]}"); _ABANDON_WHY+=("${BASH_REMATCH[2]}")
|
||||
elif [[ "$1" =~ ^(CHECK|EXPECT|EVIDENCE): ]]; then
|
||||
@@ -300,11 +320,13 @@ _runnable_count() {
|
||||
# ── entry point ─────────────────────────────────────────────────────────────
|
||||
|
||||
main() { # main <status|run> <contract>
|
||||
local mode="$1" file="$2"
|
||||
local mode="$1" file="$2" first
|
||||
[ -r "$file" ] || _die "contract unreadable: $file"
|
||||
_parse "$file"
|
||||
[ "${#_ID[@]}" -gt 0 ] ||
|
||||
_die "no numbered criteria under ## ACCEPTANCE CRITERIA"
|
||||
if [ "${#_ID[@]}" -eq 0 ]; then
|
||||
first="${_ERRORS[0]:+; ${_ERRORS[0]}}"
|
||||
_die "no numbered criteria under ## ACCEPTANCE CRITERIA$first"
|
||||
fi
|
||||
_validate_oracles
|
||||
_validate_abandons
|
||||
if [ "$mode" = "run" ] && [ "${#_ERRORS[@]}" -eq 0 ]; then
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
import { afterAll, expect, test } from 'bun:test'
|
||||
import * as fs from 'node:fs'
|
||||
import * as os from 'node:os'
|
||||
import * as path from 'node:path'
|
||||
import {
|
||||
MAIN, UNKNOWN_AGENT, advisorSection, advisorUsage, callerOf, compact,
|
||||
renderAdvisor, type Tally,
|
||||
} from './advisor.ts'
|
||||
|
||||
const dirs: string[] = []
|
||||
afterAll(() => dirs.forEach(d => fs.rmSync(d, { recursive: true })))
|
||||
const mk = () => {
|
||||
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'mf-adv-'))
|
||||
dirs.push(d)
|
||||
return d
|
||||
}
|
||||
const DAY = 86400000
|
||||
const FROM = Date.parse('2026-01-01T00:00:00Z')
|
||||
const TO = FROM + 10 * DAY
|
||||
const SLUG = '-home-secret-slug'
|
||||
const iso = (ms: number) => new Date(FROM + ms).toISOString()
|
||||
const adv = (input: number, model = 'claude-fable-5-2') =>
|
||||
({ type: 'advisor_message', model, input_tokens: input })
|
||||
const row = (ms: number, id: string, its: object[], type = 'assistant') =>
|
||||
({ type, timestamp: iso(ms), message: { id, usage: { iterations: its } } })
|
||||
const lines = (recs: object[]) =>
|
||||
recs.map(r => JSON.stringify(r)).join('\n') + '\n'
|
||||
|
||||
/** A projects dir with one project dir; returns both paths. */
|
||||
function fixture() {
|
||||
const projects = mk()
|
||||
const proj = path.join(projects, SLUG)
|
||||
fs.mkdirSync(proj)
|
||||
return { projects, proj }
|
||||
}
|
||||
const put = (file: string, recs: object[]) =>
|
||||
fs.writeFileSync(file, lines(recs))
|
||||
const subDir = (proj: string, session = 's1') => {
|
||||
const d = path.join(proj, session, 'subagents')
|
||||
fs.mkdirSync(d, { recursive: true })
|
||||
return d
|
||||
}
|
||||
const only = (t: Tally) => t.uses.map(u =>
|
||||
[u.caller, u.model, u.calls, u.input])
|
||||
|
||||
test('1: one main row, duplicate rows deduped by message.id', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [
|
||||
row(10, 'm1', [adv(1500)]), row(10, 'm1', [adv(1500)])])
|
||||
expect(only(advisorUsage(projects, FROM, TO)))
|
||||
.toEqual([[MAIN, 'claude-fable-5-2', 1, 1500]])
|
||||
})
|
||||
|
||||
test('2: rows outside (from, to] are not counted', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(0, 'a', [adv(1)]),
|
||||
row(-5, 'b', [adv(1)]), row(11 * DAY, 'c', [adv(1)]),
|
||||
row(1000, 'd', [adv(7)])])
|
||||
expect(only(advisorUsage(projects, FROM, TO))[0]?.[3]).toBe(7)
|
||||
})
|
||||
|
||||
test('3: a user record and a torn line are ignored', () => {
|
||||
const { projects, proj } = fixture()
|
||||
fs.writeFileSync(path.join(proj, 's1.jsonl'),
|
||||
lines([row(10, 'u', [adv(5)], 'user')]) + '{"torn advisor_message\n')
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
expect(t.uses).toEqual([])
|
||||
expect(t.unparsed).toBe(0)
|
||||
})
|
||||
|
||||
test('4: two advisor iterations in one message are two calls', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [adv(1), adv(2)])])
|
||||
expect(only(advisorUsage(projects, FROM, TO)))
|
||||
.toEqual([[MAIN, 'claude-fable-5-2', 2, 3]])
|
||||
})
|
||||
|
||||
test('5: an iteration without model is `unknown`', () => {
|
||||
const { projects, proj } = fixture()
|
||||
const bare = { type: 'advisor_message', input_tokens: 4 }
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [bare])])
|
||||
expect(advisorUsage(projects, FROM, TO).uses[0]?.model).toBe('unknown')
|
||||
})
|
||||
|
||||
/** One sub-agent transcript per entry; its meta file only when given. */
|
||||
function putAgents(sub: string, metas: Record<string, string | undefined>) {
|
||||
for (const [id, meta] of Object.entries(metas)) {
|
||||
put(path.join(sub, `agent-${id}.jsonl`), [row(10, id, [adv(1)])])
|
||||
if (meta) fs.writeFileSync(path.join(sub, `agent-${id}.meta.json`), meta)
|
||||
}
|
||||
}
|
||||
|
||||
test('6: sub-agent callers come from the meta agentType', () => {
|
||||
const { projects, proj } = fixture()
|
||||
putAgents(subDir(proj), {
|
||||
a1: '{"agentType":"verifier"}', a2: undefined,
|
||||
a3: '{"agentType":"../x"}' })
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
expect(t.uses.map(u => [u.caller, u.calls]).sort())
|
||||
.toEqual([['verifier', 1], [UNKNOWN_AGENT, 2]].sort())
|
||||
})
|
||||
|
||||
test('7: a transcript with mtime <= from is skipped', () => {
|
||||
const { projects, proj } = fixture()
|
||||
const f = path.join(proj, 's1.jsonl')
|
||||
put(f, [row(10, 'm', [adv(1)])])
|
||||
fs.utimesSync(f, new Date(FROM - 1000), new Date(FROM - 1000))
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
expect(t.uses).toEqual([])
|
||||
expect(t.files).toBe(0)
|
||||
})
|
||||
|
||||
test('8: missing projects dir, and a window with no advisor row', () => {
|
||||
const none = path.join(mk(), 'absent')
|
||||
expect(advisorUsage(none, FROM, TO))
|
||||
.toEqual({ uses: [], unparsed: 0, files: 0 })
|
||||
const s = advisorSection(none, FROM, TO)
|
||||
expect(s).toContain('## Advisor usage (2026-01-01 → 2026-01-11)')
|
||||
expect(s).toContain('No transcript modified since 2026-01-01')
|
||||
expect(s).toContain('check the path.')
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [])])
|
||||
expect(advisorSection(projects, FROM, TO))
|
||||
.toContain('No advisor call in the window.')
|
||||
})
|
||||
|
||||
test('9: render: all on disk, compact, total row, sort order', () => {
|
||||
expect([999, 1500, 999950, 2500000].map(compact))
|
||||
.toEqual(['999', '1.5k', '1.0M', '2.5M'])
|
||||
const uses = [
|
||||
{ caller: 'verifier', model: 'm', calls: 9, input: 1000 },
|
||||
{ caller: MAIN, model: 'm', calls: 2, input: 1500 },
|
||||
{ caller: 'planner', model: 'm', calls: 3, input: 500 }]
|
||||
const t = { uses: [...uses].sort((a, b) =>
|
||||
Number(b.caller === MAIN) - Number(a.caller === MAIN) ||
|
||||
b.calls - a.calls), unparsed: 0, files: 3 }
|
||||
const s = renderAdvisor(t, 0, TO)
|
||||
expect(s.startsWith('## Advisor usage (all on disk → 2026-01-11)\n'))
|
||||
.toBe(true)
|
||||
expect(s).toContain('| total | | 14 | 3.0k |')
|
||||
expect(s.indexOf('| main loop')).toBeLessThan(s.indexOf('| verifier'))
|
||||
expect(s.indexOf('| verifier')).toBeLessThan(s.indexOf('| planner'))
|
||||
expect(s.endsWith('\n')).toBe(true)
|
||||
})
|
||||
|
||||
test('9b: advisorUsage sorts main loop first, then calls desc', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [adv(1)])])
|
||||
const sub = subDir(proj)
|
||||
put(path.join(sub, 'agent-a.jsonl'),
|
||||
[row(10, 'x', [adv(1)]), row(20, 'y', [adv(1)])])
|
||||
fs.writeFileSync(path.join(sub, 'agent-a.meta.json'),
|
||||
'{"agentType":"verifier"}')
|
||||
expect(advisorUsage(projects, FROM, TO).uses.map(u => u.caller))
|
||||
.toEqual([MAIN, 'verifier'])
|
||||
})
|
||||
|
||||
test('10: the section holds no project slug or path', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [adv(1)])])
|
||||
const s = advisorSection(projects, FROM, TO)
|
||||
expect(s).toContain('| main loop |')
|
||||
expect(s).not.toContain('secret-slug')
|
||||
expect(s).not.toContain(projects)
|
||||
})
|
||||
|
||||
test('11: an advisor block with no iteration is not a call', () => {
|
||||
const { projects, proj } = fixture()
|
||||
const blockOnly = { type: 'assistant', timestamp: iso(10), message: {
|
||||
id: 'm', content: [{ type: 'server_tool_use', name: 'advisor' }],
|
||||
usage: { iterations: [] } } }
|
||||
fs.writeFileSync(path.join(proj, 's1.jsonl'), lines([blockOnly]) +
|
||||
'{"type":"assistant","note":"advisor_message"}\n')
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
expect(t.uses).toEqual([])
|
||||
expect(t.unparsed).toBe(0)
|
||||
})
|
||||
|
||||
const drift = { type: 'assistant', timestamp: iso(10), message: {
|
||||
id: 'd', usage: { advisor_message: { input_tokens: 1 } } } }
|
||||
|
||||
test('12: shape drift is counted and replaces the plain zero', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [drift])
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
expect(t.unparsed).toBe(1)
|
||||
const s = renderAdvisor(t, FROM, TO)
|
||||
expect(s).toContain('1 transcript lines mention advisor_message, none ' +
|
||||
'parsed: check the transcript shape.')
|
||||
expect(s).not.toContain('No advisor call')
|
||||
})
|
||||
|
||||
test('13: the retention note appears past 7 calendar days only', () => {
|
||||
const t: Tally = { uses: [], unparsed: 0, files: 1 }
|
||||
expect(renderAdvisor(t, TO - 10 * DAY, TO)).toContain(
|
||||
'Transcripts kept 7 d: calls before 2026-01-04 may be missing.')
|
||||
expect(renderAdvisor(t, TO - 3 * DAY, TO)).not.toContain('Transcripts kept')
|
||||
expect(renderAdvisor(t, 0, TO)).not.toContain('Transcripts kept')
|
||||
const to = TO + 17 * 3600000 // a weekly run lands mid-day, not at 00:00
|
||||
expect(renderAdvisor(t, to - 7 * DAY - 5 * 3600000, to))
|
||||
.not.toContain('Transcripts kept')
|
||||
})
|
||||
|
||||
test('14: an unreadable sub-directory is skipped, the rest counts', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [adv(1)])])
|
||||
const sub = subDir(proj, 's2')
|
||||
put(path.join(sub, 'agent-a.jsonl'), [row(10, 'z', [adv(1)])])
|
||||
const locked = path.join(proj, 's2')
|
||||
fs.chmodSync(locked, 0o000)
|
||||
try {
|
||||
const t = advisorUsage(projects, FROM, TO)
|
||||
if (process.getuid?.() !== 0) expect(only(t))
|
||||
.toEqual([[MAIN, 'claude-fable-5-2', 1, 1]])
|
||||
} finally {
|
||||
fs.chmodSync(locked, 0o700)
|
||||
}
|
||||
})
|
||||
|
||||
test('15: a hand-edited from never throws', () => {
|
||||
const none = path.join(mk(), 'absent')
|
||||
for (const bad of [Infinity, 1e17, NaN]) {
|
||||
expect(advisorSection(none, bad, TO)).toContain('(all on disk → ')
|
||||
}
|
||||
})
|
||||
|
||||
test('16: drift under a table prints the table then the drift line', () => {
|
||||
const { projects, proj } = fixture()
|
||||
put(path.join(proj, 's1.jsonl'), [row(10, 'm', [adv(1)]), drift])
|
||||
const s = advisorSection(projects, FROM, TO)
|
||||
expect(s.indexOf('| total |')).toBeGreaterThan(0)
|
||||
expect(s.indexOf('none parsed')).toBeGreaterThan(s.indexOf('| total |'))
|
||||
})
|
||||
|
||||
test('17: a symlinked meta file is not trusted', () => {
|
||||
const { proj } = fixture()
|
||||
const sub = subDir(proj)
|
||||
const real = path.join(mk(), 'meta.json')
|
||||
fs.writeFileSync(real, '{"agentType":"verifier"}')
|
||||
fs.symlinkSync(real, path.join(sub, 'agent-a.meta.json'))
|
||||
expect(callerOf(path.join(sub, 'agent-a.jsonl'))).toBe(UNKNOWN_AGENT)
|
||||
})
|
||||
@@ -0,0 +1,211 @@
|
||||
// lib/memory-feedback/advisor.ts: advisor usage read from Claude Code
|
||||
// transcripts (Run C, LRN-295): served calls and input tokens per caller
|
||||
// and model, deduped by message.id, for the FEEDBACK.md section.
|
||||
import * as fs from 'node:fs'
|
||||
import * as path from 'node:path'
|
||||
|
||||
export type Use = {
|
||||
caller: string; model: string; calls: number; input: number
|
||||
}
|
||||
export type Tally = { uses: Use[]; unparsed: number; files: number }
|
||||
export type Source = { file: string; caller: string }
|
||||
type Obj = Record<string, unknown>
|
||||
type Acc = { seen: Set<string>; uses: Map<string, Use>; unparsed: number }
|
||||
|
||||
export const MAIN = 'main loop'
|
||||
export const UNKNOWN_AGENT = 'sub-agent (unknown)'
|
||||
export const RETENTION_DAYS = 7
|
||||
|
||||
const DAY_MS = 86400000
|
||||
const META_MAX = 65536
|
||||
const MARK = 'advisor_message'
|
||||
const AGENT_RE = /^[A-Za-z0-9_.:-]{1,64}$/
|
||||
const MODEL_RE = /^[A-Za-z0-9._:-]{1,80}$/
|
||||
const UNAVAILABLE = 'Unavailable: transcripts unreadable.'
|
||||
|
||||
const day = (ms: number) => new Date(ms).toISOString().slice(0, 10)
|
||||
const since = (from: number) => from === 0 ? 'all on disk' : day(from)
|
||||
const heading = (from: number, to: number) =>
|
||||
`## Advisor usage (${since(from)} → ${day(to)})`
|
||||
const obj = (v: unknown): Obj | undefined =>
|
||||
typeof v === 'object' && v !== null && !Array.isArray(v)
|
||||
? v as Obj : undefined
|
||||
|
||||
function lstatOf(p: string): fs.Stats | undefined {
|
||||
try {
|
||||
return fs.lstatSync(p)
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/** Directory entries; [] when unreadable or gone, never throws. */
|
||||
function listDir(dir: string): string[] {
|
||||
try {
|
||||
return fs.readdirSync(dir)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
const isRealDir = (p: string) => lstatOf(p)?.isDirectory() === true
|
||||
|
||||
/** Regular `<prefix>*.jsonl` files of `dir` newer than `from`. */
|
||||
function jsonlIn(
|
||||
dir: string, prefix: string, from: number, callerOf: (f: string) => string,
|
||||
): Source[] {
|
||||
return listDir(dir)
|
||||
.filter(n => n.startsWith(prefix) && n.endsWith('.jsonl'))
|
||||
.map(n => path.join(dir, n))
|
||||
.flatMap(file => {
|
||||
const st = lstatOf(file)
|
||||
return st?.isFile() && st.mtimeMs > from
|
||||
? [{ file, caller: callerOf(file) }] : []
|
||||
})
|
||||
}
|
||||
|
||||
/** Every transcript under `projects` modified after `from`, with its
|
||||
* caller: main threads and `<session>/subagents/agent-*.jsonl`. */
|
||||
export function transcriptsOf(projects: string, from: number): Source[] {
|
||||
return listDir(projects).map(n => path.join(projects, n))
|
||||
.filter(isRealDir).flatMap(proj => {
|
||||
const subs = listDir(proj).map(n => path.join(proj, n))
|
||||
.filter(isRealDir).map(s => path.join(s, 'subagents'))
|
||||
.filter(isRealDir)
|
||||
return [...jsonlIn(proj, '', from, () => MAIN),
|
||||
...subs.flatMap(s => jsonlIn(s, 'agent-', from, callerOf))]
|
||||
})
|
||||
}
|
||||
|
||||
/** The agent type of a sub-agent transcript, from its sibling meta file;
|
||||
* UNKNOWN_AGENT for anything missing, odd or oversized. */
|
||||
export function callerOf(jsonl: string): string {
|
||||
const meta = jsonl.replace(/\.jsonl$/, '') + '.meta.json'
|
||||
const st = lstatOf(meta)
|
||||
if (!st?.isFile() || st.size > META_MAX) return UNKNOWN_AGENT
|
||||
try {
|
||||
const type = obj(JSON.parse(fs.readFileSync(meta, 'utf8')))?.agentType
|
||||
return typeof type === 'string' && AGENT_RE.test(type)
|
||||
? type : UNKNOWN_AGENT
|
||||
} catch {
|
||||
return UNKNOWN_AGENT
|
||||
}
|
||||
}
|
||||
|
||||
/** The assistant messages of a file that mention advisor_message and
|
||||
* fall in (from, to]; [] for an unreadable file. */
|
||||
function windowed(file: string, from: number, to: number): Obj[] {
|
||||
let text: string
|
||||
try {
|
||||
text = fs.readFileSync(file, 'utf8')
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
return text.split('\n').filter(l => l.includes(MARK)).flatMap(line => {
|
||||
try {
|
||||
const rec = obj(JSON.parse(line))
|
||||
const at = Date.parse(String(rec?.timestamp))
|
||||
const msg = obj(rec?.message)
|
||||
return rec?.type === 'assistant' && msg !== undefined &&
|
||||
at > from && at <= to ? [msg] : []
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function bump(uses: Map<string, Use>, caller: string, it: Obj): void {
|
||||
const model = typeof it.model === 'string' && MODEL_RE.test(it.model)
|
||||
? it.model : 'unknown'
|
||||
const key = `${caller}\t${model}`
|
||||
const use = uses.get(key) ?? { caller, model, calls: 0, input: 0 }
|
||||
use.calls += 1
|
||||
use.input += Number.isSafeInteger(it.input_tokens) &&
|
||||
(it.input_tokens as number) >= 0 ? it.input_tokens as number : 0
|
||||
uses.set(key, use)
|
||||
}
|
||||
|
||||
/** Counts one message once: its served advisor iterations, or a drift. */
|
||||
function tallyOne(msg: Obj, caller: string, acc: Acc): void {
|
||||
const id = msg.id
|
||||
if (typeof id !== 'string' || id === '' || acc.seen.has(id)) return
|
||||
acc.seen.add(id)
|
||||
const its = obj(msg.usage)?.iterations
|
||||
const calls = (Array.isArray(its) ? its : []).map(obj)
|
||||
.filter((i): i is Obj => i?.type === MARK)
|
||||
calls.forEach(it => bump(acc.uses, caller, it))
|
||||
if (calls.length === 0 &&
|
||||
JSON.stringify(msg.usage ?? null).includes(MARK)) acc.unparsed += 1
|
||||
}
|
||||
|
||||
const byUse = (a: Use, b: Use) =>
|
||||
Number(b.caller === MAIN) - Number(a.caller === MAIN) ||
|
||||
b.calls - a.calls || a.caller.localeCompare(b.caller) ||
|
||||
a.model.localeCompare(b.model)
|
||||
|
||||
/** Served advisor calls and input tokens in (from, to], per caller and
|
||||
* model, over every transcript under `projects`. */
|
||||
export function advisorUsage(
|
||||
projects: string, from: number, to: number,
|
||||
): Tally {
|
||||
const sources = transcriptsOf(projects, from)
|
||||
const acc: Acc = { seen: new Set(), uses: new Map(), unparsed: 0 }
|
||||
for (const s of sources) {
|
||||
windowed(s.file, from, to).forEach(m => tallyOne(m, s.caller, acc))
|
||||
}
|
||||
return { uses: [...acc.uses.values()].sort(byUse),
|
||||
unparsed: acc.unparsed, files: sources.length }
|
||||
}
|
||||
|
||||
/** 999 → `999`, 1500 → `1.5k`, 2500000 → `2.5M`. */
|
||||
export function compact(n: number): string {
|
||||
if (n < 1000) return String(n)
|
||||
return n < 999950 ? `${(n / 1e3).toFixed(1)}k` : `${(n / 1e6).toFixed(1)}M`
|
||||
}
|
||||
|
||||
function table(uses: Use[]): string {
|
||||
const sum = (f: (u: Use) => number) => uses.reduce((a, u) => a + f(u), 0)
|
||||
const rows = uses.map(u =>
|
||||
`| ${u.caller} | ${u.model} | ${u.calls} | ${compact(u.input)} |`)
|
||||
return ['| caller | model | calls | input tok |', '|---|---|---|---|',
|
||||
...rows, `| total | | ${sum(u => u.calls)} | ` +
|
||||
`${compact(sum(u => u.input))} |`].join('\n')
|
||||
}
|
||||
|
||||
function bodyOf(t: Tally, from: number): string {
|
||||
const drift = `${t.unparsed} transcript lines mention ${MARK}, none ` +
|
||||
'parsed: check the transcript shape.'
|
||||
if (t.uses.length > 0) {
|
||||
return t.unparsed > 0 ? `${table(t.uses)}\n\n${drift}` : table(t.uses)
|
||||
}
|
||||
if (t.files === 0) {
|
||||
return `No transcript modified since ${since(from)} under the ` +
|
||||
'projects dir: check the path.'
|
||||
}
|
||||
return t.unparsed > 0 ? drift : 'No advisor call in the window.'
|
||||
}
|
||||
|
||||
/** The `## Advisor usage` markdown section, ending with a newline. */
|
||||
export function renderAdvisor(t: Tally, from: number, to: number): string {
|
||||
const blocks = [heading(from, to)]
|
||||
const cut = day(to - RETENTION_DAYS * DAY_MS)
|
||||
if (from > 0 && cut > day(from)) {
|
||||
blocks.push(`Transcripts kept ${RETENTION_DAYS} d: calls before ` +
|
||||
`${cut} may be missing.`)
|
||||
}
|
||||
blocks.push(bodyOf(t, from))
|
||||
return blocks.join('\n\n') + '\n'
|
||||
}
|
||||
|
||||
/** The section for FEEDBACK.md; a fixed Unavailable text on any failure
|
||||
* (an error message could carry a path). Never throws. */
|
||||
export function advisorSection(
|
||||
projects: string, from: number, to: number,
|
||||
): string {
|
||||
const f = Number.isFinite(from) && from >= 0 && from <= to ? from : 0
|
||||
try {
|
||||
return renderAdvisor(advisorUsage(projects, f, to), f, to)
|
||||
} catch {
|
||||
return `${heading(f, to)}\n\n${UNAVAILABLE}\n`
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,9 @@ test('R5: apply writes labels, state, FEEDBACK; a second apply refuses',
|
||||
const fb = apply(work, p, NOW)
|
||||
expect(fb).toContain('Prompt gate: open (1/20)')
|
||||
expect(fb).toContain('Lost records: 1')
|
||||
expect(fb).toContain('## Advisor usage')
|
||||
expect(fs.readFileSync(path.join(p.out, 'FEEDBACK.md'), 'utf8'))
|
||||
.toContain('## Advisor usage')
|
||||
expect(fb).not.toContain('design the reader gate')
|
||||
const labels = fs.readFileSync(path.join(p.out, 'labels.tsv'), 'utf8')
|
||||
expect(labels).not.toContain('design')
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
tagOf, writeSafe, writeState, type Draft, type Item, type Row,
|
||||
type State,
|
||||
} from './labels.ts'
|
||||
import { advisorSection } from './advisor.ts'
|
||||
import { PROMPT_GATE_N } from './thresholds.ts'
|
||||
import {
|
||||
clockStart, gateVerdict, metricsOf, renderFeedback, type Metrics,
|
||||
@@ -301,7 +302,8 @@ function commit(
|
||||
assertFresh(items, labelsOf(p))
|
||||
const { fresh, m, v } = projected(items, drafts, p, now)
|
||||
const next = nextState(readState(stateOf(p)), m, v, now)
|
||||
const feedback = renderFeedback(m, v, now)
|
||||
const feedback = renderFeedback(m, v, now) + '\n' +
|
||||
advisorSection(p.projects, readState(stateOf(p)).lastRun, now)
|
||||
if (fresh.length > 0) appendRows(labelsOf(p), fresh)
|
||||
writeState(stateOf(p), next.state)
|
||||
writeSafe(path.join(p.out, 'FEEDBACK.md'), feedback)
|
||||
|
||||
@@ -89,6 +89,17 @@ GATES_TIMEOUT=1 gate "timeout = UNMET" run "GATES — VERDICT: UNMET(1)" 2 <<'EO
|
||||
EOF
|
||||
has "timeout recorded" "NOT-MET timeout=1s"
|
||||
|
||||
# The default must outlast the full suite (~135 s on 2026-11-16): at 120 s
|
||||
# a "full make test green" criterion went NOT-MET on the timeout alone.
|
||||
LAST="$WORK/default-timeout.md"
|
||||
printf '## ACCEPTANCE CRITERIA\n1. manual\n' > "$LAST"
|
||||
out="$(env -u GATES_TIMEOUT bash "$GATES" status "$LAST" 2>&1)"
|
||||
if [[ "$out" == *"timeout 600s"* ]]; then
|
||||
ok "default timeout 600s"
|
||||
else
|
||||
bad "default timeout 600s" "status did not print timeout 600s"
|
||||
fi
|
||||
|
||||
gate "manual-only contract passes through" run "RUNNABLE: 0 of 2" 0 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. a human reads the copy
|
||||
@@ -203,6 +214,59 @@ gate "duplicate orphans what follows" run "belongs to no criterion" 2 <<'EOF'
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
# An oracle under a label the parser does not read as `N. text` must never
|
||||
# overwrite the previous criterion's: criterion 1 fails, the stray oracle
|
||||
# passes, a false MET (LRN-284). A digit-led label is rejected by name;
|
||||
# any other shape trips the second-attribute guard when the previous
|
||||
# criterion already has that attribute (after a manual one it does not).
|
||||
gate "1b. label rejected" run "malformed criterion label at line 6" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
1b. sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "1.1 label rejected" run "malformed criterion label at line 3" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. first
|
||||
1.1 dotted
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "no valid label" run "malformed criterion label at line 2" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
2) paren
|
||||
EOF
|
||||
|
||||
gate "indented label: second CHECK" run "second CHECK: at line 7" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
2. sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "bullet label: second EVIDENCE" run "second EVIDENCE: at line 9" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. real
|
||||
CHECK: exit 1
|
||||
EXPECT: x
|
||||
EVIDENCE: pending
|
||||
- sub
|
||||
CHECK: echo y
|
||||
EXPECT: y
|
||||
EVIDENCE: pending
|
||||
EOF
|
||||
|
||||
gate "no numbered criteria" run "no numbered criteria" 2 <<'EOF'
|
||||
## ACCEPTANCE CRITERIA
|
||||
nothing numbered here
|
||||
|
||||
@@ -17,6 +17,10 @@ HSK="$REPO/skills/hotfix/SKILL.md"
|
||||
GSK="$REPO/skills/guardrails/SKILL.md"
|
||||
ASK="$REPO/skills/a11y/SKILL.md"
|
||||
HSKL="$REPO/skills/hotfix/SKILL.md"
|
||||
AUD="$REPO/agents/security-auditor.md"
|
||||
EFF="$REPO/lib/effort-shift.md"
|
||||
SFK="$REPO/skills/ship-feature/SKILL.md"
|
||||
ISK="$REPO/skills/init-project/SKILL.md"
|
||||
PASS=0; FAIL=0
|
||||
|
||||
tf() { # tf <label> <file> <fixed-string>
|
||||
@@ -108,6 +112,40 @@ tf "hotfix no verifier" "$HSKL" "No verifier is dispatched at hotfix wei
|
||||
tf "hotfix skill has Agent" "$HSK" " - Agent"
|
||||
tf "hotfix dispatches hotfixer" "$HSKL" 'subagent_type="hotfixer"'
|
||||
|
||||
echo "── DEGRADED on the TOOL line, feat/bugfix skip (BUGS-FOUND:134) ──"
|
||||
for f in "$FSK" "$BSK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n skip not DEGRADED" "$f" "security PASS (not DEGRADED),"
|
||||
tf "$n skip first attempt" "$f" "each on its first attempt;"
|
||||
tf "$n skip out of view" "$f" "a verdict no longer in view runs the call."
|
||||
tf "$n skip names TOOL" "$f" "auditor's \`TOOL:\` line, beside a PASS."
|
||||
done
|
||||
tf "effort-shift names TOOL" "$EFF" "auditor's \`TOOL:\` line. A skipped call"
|
||||
for f in "$INC" "$AUD" "$HSKL"; do
|
||||
n=$(basename "$(dirname "$f")")/$(basename "$f")
|
||||
tf "$n PASS reads TOOL" "$f" "\`PASS\` → read the \`TOOL:\` line first"
|
||||
tf "$n DEGRADED off VERDICT" "$f" "never on the VERDICT line;"
|
||||
tf "$n no TOOL structural" "$f" "a PASS with no \`TOOL:\` line"
|
||||
tf "$n structural (below)" "$f" "structural failure (below)"
|
||||
tn "$n DEGRADED no verdict" "$f" "\`DEGRADED\`"
|
||||
tn "$n DEGRADED no branch" "$f" "DEGRADED (semgrep absent) →"
|
||||
done
|
||||
|
||||
echo "── end-of-run merge reuse at the site (TODO:14, LRN-297) ──"
|
||||
tf "effort-shift merge reuse" "$EFF" "reuses the last run's answer, or its skip, and names any code commit"
|
||||
for f in "$ASK" "$GSK" "$SFK" "$ISK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses this"
|
||||
tf "$n names later commits" "$f" "names any code commit made after it (doc and memory"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
for f in "$FSK" "$BSK"; do
|
||||
n=$(basename "$(dirname "$f")")
|
||||
tf "$n merge reuses answer" "$f" "the gates. A later merge proposal reuses the last run's answer,"
|
||||
tf "$n reuse covers skip" "$f" "or its skip, and names any code commit made after it (doc and memory"
|
||||
tf "$n doc/memory excepted" "$f" "commits excepted)."
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "loops-light structure locks: $PASS pass, $FAIL fail"
|
||||
[ "$FAIL" -eq 0 ]
|
||||
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib/tests/subagent-advisor.test.sh — the SubagentStart advisor line and
|
||||
# the carriers of the sub-agent advisor rule (BDR-150). Locks are single
|
||||
# lines (LRN-093).
|
||||
set -u
|
||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
H="$ROOT/hooks/subagent-advisor.sh"
|
||||
pass=0; fail=0
|
||||
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||
has() { grep -qF -- "$2" "$ROOT/$1" 2>/dev/null && echo yes || echo no; }
|
||||
ctx() { printf '%s' "$1" | bash "$H" 2>/dev/null | jq -r \
|
||||
'select(.hookSpecificOutput.hookEventName == "SubagentStart")
|
||||
| .hookSpecificOutput.additionalContext' 2>/dev/null; }
|
||||
in_ctx() { case "$1" in *"$2"*) echo yes ;; *) echo no ;; esac; }
|
||||
|
||||
# hook: one valid object, same line whatever the payload
|
||||
for p in '{"agent_type":"general-purpose"}' '' 'not json' \
|
||||
"{\"agent_type\":\"x\\\"y\\n\$(id)\"}"; do
|
||||
c=$(ctx "$p")
|
||||
check "T1 names the tool [$p]" "$(in_ctx "$c" "\`advisor\` tool")" yes
|
||||
check "T2 defers to brief [$p]" \
|
||||
"$(in_ctx "$c" 'own instructions are never an allowance')" yes
|
||||
done
|
||||
printf '{}' | bash "$H" >/dev/null 2>&1; check T3-exit-0 "$?" 0
|
||||
check T2c-prohibits "$(in_ctx "$(ctx '{}')" \
|
||||
"do not call the \`advisor\` tool in this run unless")" yes
|
||||
check T4-one-line "$(printf '{}' | bash "$H" | wc -l | tr -d ' ')" 1
|
||||
check T5-no-cli "$(grep -v '^ *#' "$H" \
|
||||
| grep -cE '(^|[[:space:];&|(])claude([[:space:]]|$)')" 0
|
||||
check T5b-no-echo "$(printf 'PAYLOADMARK' | bash "$H" | grep -c PAYLOADMARK)" 0
|
||||
|
||||
# wiring
|
||||
S="$ROOT/settings.json"
|
||||
check T6-wired "$(jq -r '.hooks.SubagentStart[0].hooks[0].command' "$S")" \
|
||||
"bash ~/.claude/hooks/subagent-advisor.sh"
|
||||
check T7-timeout "$(jq -r '.hooks.SubagentStart[0].hooks[0].timeout' "$S")" 5
|
||||
|
||||
# carriers
|
||||
for a in plugin-advisor seo-analyzer geo-analyzer doc-syncer \
|
||||
commit-changer handover-doc-writer; do
|
||||
check "T8 $a" "$(has "agents/$a.md" \
|
||||
"never call the \`advisor\` tool, even though")" yes
|
||||
done
|
||||
check T9-onboard-briefs \
|
||||
"$(grep -cF "Never call the \`advisor\` tool in this run" \
|
||||
"$ROOT/skills/onboard/SKILL.md")" 6
|
||||
check T10-handover-children "$(has agents/client-handover-writer.md \
|
||||
"never call the \`advisor\` tool in")" yes
|
||||
for a in plan-challenger verifier security-auditor analyzer; do
|
||||
check "T20 $a allowance" "$(has "agents/$a.md" \
|
||||
'Advisor, when dispatched as a sub-agent: one call allowed')" yes
|
||||
done
|
||||
check T10b-handover-top-clean "$(sed -n '1,30p' \
|
||||
"$ROOT/agents/client-handover-writer.md" | grep -c "advisor\` tool")" 0
|
||||
check T11-tour-phase-b \
|
||||
"$(has skills/tour/SKILL.md "saying never call the \`advisor\` tool")" yes
|
||||
for s in ship-feature init-project; do
|
||||
check "T12 $s" "$(has "skills/$s/SKILL.md" \
|
||||
"Add to its brief: \"you may call the \`advisor\` tool once")" yes
|
||||
done
|
||||
check T13-sdd-pin "$(has CLAUDE.global.md \
|
||||
'subagent-driven-development standalone: workers sonnet')" yes
|
||||
check T14-global-set "$(has CLAUDE.global.md \
|
||||
'and an opus code review at most')" yes
|
||||
check T15-effort-hook "$(has lib/effort-shift.md \
|
||||
'hooks/subagent-advisor.sh. A skill run by a sub-agent reads')" yes
|
||||
check T16-effort-sdd "$(has lib/effort-shift.md \
|
||||
'subagent-driven-development, whoever runs it')" yes
|
||||
check T17-row-reason "$(has lib/challenge-plan.md \
|
||||
'already called this run | sub-agent)')" yes
|
||||
check T19-advisor-first-skip "$(has lib/challenge-plan.md \
|
||||
'A skill run inside a sub-agent skips this call')" yes
|
||||
check T18-no-old-row "$(cd "$ROOT" && git grep -c 'already called this run)' \
|
||||
-- skills lib ':!lib/tests' | wc -l | tr -d ' ')" 0
|
||||
|
||||
echo "subagent-advisor: $pass pass, $fail fail"
|
||||
[ "$fail" -eq 0 ]
|
||||
@@ -1,6 +1,7 @@
|
||||
# Verify + secure loop — shared orchestrator include (feat, bugfix, guardrails, a11y)
|
||||
|
||||
Runs in the ORCHESTRATOR MAIN LOOP after the dev step completes. Turns a
|
||||
Runs in the ORCHESTRATOR MAIN LOOP after the dev step completes (its first
|
||||
section runs before the dev step is dispatched). Turns a
|
||||
finished diff into a verified, security-cleared change through two fresh
|
||||
gates and bounded loops. Loop decisions live here, in the main loop
|
||||
(LRN-083: subagents = execution + report). The dev step is a dispatched
|
||||
@@ -17,6 +18,26 @@ Nominal path is cheap — a free floor run, then
|
||||
one verifier dispatch + one security dispatch, done. The loop only costs
|
||||
more when it actually loops.
|
||||
|
||||
## BEFORE THE FIRST DISPATCH: contract dry run (main loop)
|
||||
|
||||
When the flow wrote a contract with `CHECK:` lines, the main loop does two
|
||||
things before the dev step is dispatched:
|
||||
|
||||
1. Records the run's start commit in the contract header, once:
|
||||
`- run-base: <git rev-parse HEAD>` (a SHA, never a branch name;
|
||||
`lib/capitalize-commit.md` counts the run's TODO movement from it).
|
||||
2. Copies the contract to a `mktemp -d` path and, from the project root,
|
||||
runs `bash ~/.claude/lib/gates.sh run <copy>`, so the real ledger stays
|
||||
`pending`. Expected: no `ERROR(n)` (malformed ledger: fix it here),
|
||||
NOT-MET rows only where the work is not done yet, each failing for that
|
||||
reason and not for a syntax error, a missing tool or a wrong path. A row
|
||||
already MET is valid only when the work must keep it green (a suite, a
|
||||
line cap); any other is vacuous. A marker that can never match fails
|
||||
like undone work: for oracles that grep prose, apply the planned text
|
||||
to a scratch copy of the repo and run the CHECKs there (LRN-296).
|
||||
|
||||
A bad oracle is fixed in the contract here, before any floor loop.
|
||||
|
||||
## GATE 0 — DETERMINISTIC FLOOR (no dispatch, no model)
|
||||
|
||||
Before spending a verifier dispatch, execute the oracles the contract itself
|
||||
@@ -92,7 +113,8 @@ Parse its single `VERIFY — VERDICT:` line:
|
||||
cannot fix unverifiability); do not spend a loop on it.
|
||||
- Out-of-scope files: a dev justification is accepted ONLY through the human
|
||||
micro-gate that appends `[gated <date>]` to the contract's FILE SCOPE;
|
||||
otherwise the dev removes the file.
|
||||
otherwise the dev removes the file. Run artifacts are in scope by
|
||||
default (`agents/verifier.md`, STEP 4).
|
||||
- Structural failure (`ERROR(…)`, missing/duplicated VERDICT line,
|
||||
unparsable, crash, `CONFORME` without `PROOF` or without `FLOOR`) → retry
|
||||
ONCE with a fresh verifier; a 2nd structural failure → human escalation.
|
||||
@@ -110,7 +132,11 @@ stdout-only, no Write).
|
||||
|
||||
Parse its single `SECURITY — VERDICT:` line:
|
||||
|
||||
- `PASS` → done, proceed to commit.
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent) shows
|
||||
there, never on the VERDICT line; a PASS with no `TOOL:` line is a
|
||||
structural failure (below). Then done, proceed to commit; a DEGRADED
|
||||
PASS also surfaces the checklist result + recommends `make plugin`
|
||||
(the tool's absence never blocks).
|
||||
- `BLOCK(n)` → hand the dev the `BLOCKING` list + the CONTRACT path
|
||||
(re-dispatch a FRESH executor, never fix by hand). Then re-run GATE 0, then
|
||||
**re-verify the REQUEST first** (GATE 1, fresh verifier) — a security fix
|
||||
@@ -123,9 +149,6 @@ Parse its single `SECURITY — VERDICT:` line:
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
- `DEGRADED` (semgrep absent) → does NOT block on the tool's absence; surface
|
||||
the checklist result + recommend `make plugin`. A DEGRADED run that still
|
||||
BLOCKs (grep-caught secret/injection) blocks like any other.
|
||||
- Structural failure → retry ONCE fresh; 2nd → human escalation. A mute
|
||||
auditor is NEVER a PASS.
|
||||
A 2nd structural failure with no main-loop advisor call since GATE 0
|
||||
@@ -146,3 +169,31 @@ verifier's verdict meaningless. REQUEST conformity is
|
||||
always re-checked BEFORE security on any re-loop — a security fix that breaks
|
||||
the feature must not slip through because only the security gate re-ran.
|
||||
Never the reverse order.
|
||||
|
||||
## DONE: oracles green, reopened only on evidence
|
||||
|
||||
A run is done when its oracles are green: GATE 0 MET (the suite criterion
|
||||
included), GATE 1 CONFORME and GATE 2 PASS on the same diff. After done, a
|
||||
review (the end-of-run advisor call, a code review, a re-read) reopens the
|
||||
run only with reproducible evidence: a command that fails on HEAD, or real
|
||||
output shown wrong. A plausible scenario alone does not reopen the run:
|
||||
the main loop tries once to turn it into a failing command, and if it
|
||||
cannot, the finding is a MINOR (below). A behavioural claim ("agents obey
|
||||
the rule") is done at its locks green, one live probe and one dated
|
||||
measurement: a TODO line that carries the date and the tripwires that
|
||||
would reopen it.
|
||||
|
||||
## MINOR triage: fold before dispatch, or drop
|
||||
|
||||
A MINOR finding on the run's plan or diff (from a challenger, a review, an
|
||||
advisor) is either folded into the plan before the dispatch or dropped. No
|
||||
fix round after the gates for a MINOR: it costs a full gate cycle. A drop
|
||||
is one line, `MINOR dropped: <finding>`, in the run report and appended to
|
||||
the run's plan file; nothing goes to TODO.md, BUGS-FOUND.md or any
|
||||
registry. The backlog takes only findings with reproducible evidence, or
|
||||
what the user asks for. Never a droppable MINOR: a security finding (a
|
||||
GATE 2 `REPORTED` item, a secret, an injection, authorization or exposure
|
||||
issue from any review) goes to the user, who decides fix or record.
|
||||
Untouched by this triage: doc-syncer's `[MINOR]` patch class, the safety
|
||||
guardrails, every gate, and the user's questions on visible, public-name
|
||||
and scope choices.
|
||||
@@ -572,6 +572,17 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"SubagentStart": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "bash ~/.claude/hooks/subagent-advisor.sh",
|
||||
"timeout": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
|
||||
@@ -162,6 +162,9 @@ file before anything else. Accepted set empty → stop.
|
||||
GATE 0 runs every scanner oracle (the per-fix proof), GATE 1 a fresh
|
||||
verifier, GATE 2 a fresh security-auditor. Loop caps and escalation are
|
||||
the include's; loop decisions stay in this main loop.
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
## STEP 9: Re-pass (prove it all)
|
||||
|
||||
@@ -194,6 +197,11 @@ open and say so plainly. Never report a fix the re-pass did not prove.
|
||||
```
|
||||
Then `git add <files touched>` (never `-A`, never the baseline file) and
|
||||
commit, project convention else 50 words at most.
|
||||
Before the reply, the main loop prints the run's diff stat, then makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor); its answer
|
||||
goes into the reply as an `Advisor:` line, and a fix it drives goes
|
||||
back through the gates. A later merge proposal reuses this answer and
|
||||
names any code commit made after it (doc and memory commits excepted).
|
||||
2. `mcp__model-router__route(phase="apply")` for the tail. Reply with: fixed
|
||||
and proven (proposal, rule, file), still open and why, the walk's result,
|
||||
the branch name. Merge waits for the user's explicit signal.
|
||||
|
||||
@@ -170,7 +170,7 @@ Then show the user the same compact table inline.
|
||||
|
||||
### 3b-bis. CHALLENGE THE PROPOSALS (before the gate)
|
||||
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
This axis' findings + proposed fixes are a proposal set worth attacking before
|
||||
the human gate. Persist THIS axis' finding list (not the whole append-only
|
||||
report) to `.claude/tasks/plans/<date>-<axis>-<HHMM>.md`, then run
|
||||
@@ -192,6 +192,7 @@ CHALLENGE SUMMARY (3b-bis — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named finding-set change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the finding-set change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
```
|
||||
|
||||
- "Fix what you find" said **in the invocation** does NOT skip this gate:
|
||||
@@ -237,6 +238,11 @@ fix commits land inside it and get re-audited — safe overlap, by design.
|
||||
|
||||
## STEP 4 — FINAL SUMMARY
|
||||
|
||||
When the run applied a fix, before the summary, the main loop makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor); its answer
|
||||
goes into the summary as an `Advisor:` line, and a fix it calls for
|
||||
waits for a new run.
|
||||
|
||||
```
|
||||
AUDIT-DELTA COMPLETE — 2026-06-11
|
||||
security : 3 findings → 2 fixed, 1 declined | marker → fbf3e26
|
||||
|
||||
+20
-3
@@ -127,7 +127,7 @@ RISK: <low/medium — what could go wrong>
|
||||
fast-path is not exempt: a 1-line fix with a visible choice still asks.
|
||||
|
||||
## STEP 3b — CHALLENGE THE FIX PLAN (before the contract)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Unless the fix is the trivial 1-2 line case STEP 3 already fast-paths, the
|
||||
DIAGNOSIS + FIX PLAN is a reflection worth attacking before it hardens into a
|
||||
contract. Persist it to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
@@ -137,8 +137,8 @@ dispositions. Three blind challengers attack it (correctness = is the root cause
|
||||
right; robustness = blast radius / regressions; simplicity = is the fix minimal);
|
||||
RE-THINK every aspect a BLOCKER lands, re-challenge once if the plan materially
|
||||
changed. STEP 3.5 writes the contract from the REVISED plan. Print a CHALLENGE SUMMARY
|
||||
(BLOCKERs addressed / deferred / lenses returned), folding any deferred BLOCKER into
|
||||
the STEP 3 approval gate.
|
||||
(BLOCKERs addressed / deferred / lenses returned / advisor), folding any
|
||||
deferred BLOCKER into the STEP 3 approval gate.
|
||||
|
||||
## STEP 3.5 — CONTRACT
|
||||
|
||||
@@ -200,6 +200,10 @@ Parse the `BUGFIX-EXEC REPORT`:
|
||||
re-dispatch a FRESH bugfixer with the BLOCKING list + the CONTRACT
|
||||
path; re-verify the request THEN re-scan, max 3 → escalate.
|
||||
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
Loop decisions stay HERE, in the main loop (LRN-083). Nominal = one
|
||||
executor + a free floor run + one verifier + one security dispatch.
|
||||
|
||||
@@ -227,6 +231,18 @@ Parse the `BUGFIX-EXEC REPORT`:
|
||||
3. Commit after approval, message per `$HOME/.claude/lib/commit-message.md`
|
||||
(project convention first, else short: root cause in the subject, at most
|
||||
two sentences of body).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: end-of-run review).
|
||||
Before the summary, the main loop prints the run's diff stat, then makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor), skipped when
|
||||
GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED),
|
||||
each on its first attempt; any other verdict, a retry, a loop iteration or
|
||||
a verdict no longer in view runs the call. DEGRADED shows on the
|
||||
auditor's `TOOL:` line, beside a PASS. A skip also settles the global
|
||||
"long task before calling it done" trigger. The answer, or the skip,
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates. A later merge proposal reuses the last run's answer,
|
||||
or its skip, and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
4. Print summary:
|
||||
```
|
||||
BUGFIX COMPLETE
|
||||
@@ -235,6 +251,7 @@ Parse the `BUGFIX-EXEC REPORT`:
|
||||
FILE(S) : <changed files>
|
||||
TEST(S) : <added/updated tests, or "none — verified manually">
|
||||
REGRESSION : <checked areas>
|
||||
ADVISOR : <one-line answer | skipped (gates clean on first pass) | not called (absent | error)>
|
||||
```
|
||||
|
||||
## STEP 7 — DOC SYNC (automatic)
|
||||
|
||||
@@ -122,7 +122,7 @@ TOTALS: <N blocking, N warn, N info>
|
||||
If no issues found: report clean state and stop.
|
||||
|
||||
## STEP 3b — CHALLENGE THE SCOPE (before approval)
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
The STEP 3 report is the proposed cleanup scope — worth attacking before the
|
||||
human approves it. It is still inline, so FIRST persist it to
|
||||
`.claude/tasks/plans/<date>-<slug>-<HHMM>.md` (STEP 3 report format, one item
|
||||
@@ -144,6 +144,7 @@ CHALLENGE SUMMARY (STEP 3b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named scope change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the scope change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
|
||||
AskUserQuestion:
|
||||
Approve which items for execution? (all / <item numbers> / clarify <item>)
|
||||
|
||||
+20
-3
@@ -124,7 +124,7 @@ in the contract's CLARIFICATIONS `[gated]` and in the plan. A choice that
|
||||
surfaces only during execution comes back as `NEED-DECISION` (STEP 3).
|
||||
|
||||
## STEP 1b — CHALLENGE THE PLAN (before branching)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
The STEP 1 plan is a reflection worth attacking before a branch is spent on it.
|
||||
Persist it to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
`$HOME/.claude/lib/challenge-plan.md` with `PLAN` = that file, `KIND` = `build-plan`,
|
||||
@@ -132,8 +132,8 @@ Persist it to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
Three blind challengers attack it; RE-THINK every aspect a BLOCKER lands (a named
|
||||
plan change, or `[deferred]`), re-challenge once if the plan materially changed. The
|
||||
STEP 3 executor receives the REVISED plan. Before dispatch, print a CHALLENGE SUMMARY
|
||||
(BLOCKERs addressed / deferred / lenses returned), surfacing any deferred BLOCKER in
|
||||
the STEP 1 pass B batch.
|
||||
(BLOCKERs addressed / deferred / lenses returned / advisor), surfacing any
|
||||
deferred BLOCKER in the STEP 1 pass B batch.
|
||||
|
||||
## STEP 2 — BRANCH
|
||||
|
||||
@@ -185,6 +185,10 @@ produced, `TEST` = the suite named in its report:
|
||||
STEP 5. BLOCK → re-dispatch a FRESH feater with the BLOCKING list + the
|
||||
CONTRACT path; re-verify the request THEN re-scan, max 3 → escalate.
|
||||
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
Loop decisions stay HERE, in the main loop (LRN-083). Nominal (clear
|
||||
request, conform first pass, clean diff) = one executor + a free floor
|
||||
run + one verifier + one security dispatch.
|
||||
@@ -202,6 +206,18 @@ commit-changer (propose opus / apply sonnet, BDR-077); never inline-load the bar
|
||||
propose/apply executor).
|
||||
Then `mcp__model-router__route(phase="reflect")` (route: nested commit-change loaded at apply; reload feat's level).
|
||||
|
||||
Before the summary, the main loop prints the run's diff stat, then makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor), skipped when
|
||||
GATE 0 said MET, the verifier CONFORME and security PASS (not DEGRADED),
|
||||
each on its first attempt; any other verdict, a retry, a loop iteration or
|
||||
a verdict no longer in view runs the call. DEGRADED shows on the
|
||||
auditor's `TOOL:` line, beside a PASS. A skip also settles the global
|
||||
"long task before calling it done" trigger. The answer, or the skip,
|
||||
goes into the summary's `ADVISOR` field, and a fix it drives goes back
|
||||
through the gates. A later merge proposal reuses the last run's answer,
|
||||
or its skip, and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
|
||||
Print summary:
|
||||
```
|
||||
FEAT COMPLETE
|
||||
@@ -209,6 +225,7 @@ FEATURE : <name>
|
||||
FILE(S) : <created/modified files>
|
||||
TEST(S) : <added tests>
|
||||
VERIFIED : <what was checked>
|
||||
ADVISOR : <one-line answer | skipped (gates clean on first pass) | not called (absent | error)>
|
||||
```
|
||||
|
||||
## STEP 6 — DOC SYNC (automatic)
|
||||
|
||||
@@ -236,6 +236,9 @@ file before anything else. Accepted set empty → stop.
|
||||
GATE 0 runs every scanner oracle (the per-fix proof), GATE 1 a fresh
|
||||
verifier, GATE 2 a fresh security-auditor. Loop caps and escalation are
|
||||
the include's; loop decisions stay in this main loop.
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
## STEP 11: Re-pass (prove it all)
|
||||
|
||||
@@ -271,6 +274,11 @@ open and say so plainly. Never report a fix the re-pass did not prove.
|
||||
```
|
||||
Then `git add <files touched>` (never `-A`, never the baseline file) and
|
||||
commit, project convention else 50 words at most.
|
||||
Before the reply, the main loop prints the run's diff stat, then makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor); its answer
|
||||
goes into the reply as an `Advisor:` line, and a fix it drives goes
|
||||
back through the gates. A later merge proposal reuses this answer and
|
||||
names any code commit made after it (doc and memory commits excepted).
|
||||
2. `mcp__model-router__route(phase="apply")` for the tail. Reply with: fixed
|
||||
and proven (proposal, rule, file), still open and why, MANUAL steps left
|
||||
for the user, the branch name. Merge waits for the user's explicit signal.
|
||||
|
||||
@@ -522,7 +522,7 @@ Extract the score and critical-alert count from `.claude/audits/HARDEN.md` for t
|
||||
---
|
||||
|
||||
## STEP 2b — CHALLENGE THE FIX BUNDLE (MODE=fix only, advisory)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Skip if MODE=audit (no bundle exists). Else, before the STEP 3 gate, harden the bundle:
|
||||
extract the `## 8. Fix bundle` section from HARDEN.md to
|
||||
`.claude/tasks/plans/<date>-<slug>-<HHMM>.md` (a clean, blind-judgeable artifact), then run
|
||||
@@ -557,6 +557,7 @@ If MODE=fix and `.claude/audits/HARDEN.md` ends with `READY TO APPLY — awaitin
|
||||
BLOCKERs addressed : <n> — <finding → the named bundle change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the bundle change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
|
||||
Options :
|
||||
A) Apply all
|
||||
|
||||
+11
-7
@@ -94,7 +94,7 @@ point. Run it ONLY when the settled fix touches control flow or behaviour — an
|
||||
off-by-one, a wrong operator/variable, a behaviour-changing config value, or a
|
||||
missing import that alters execution. In doubt → it is probably a `/bugfix`.
|
||||
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
For a logic fix: persist the STEP 1 located fix (root cause + the exact edit) to
|
||||
`.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
`$HOME/.claude/lib/challenge-plan.md` with `PLAN` = that file, `KIND` =
|
||||
@@ -102,8 +102,8 @@ For a logic fix: persist the STEP 1 located fix (root cause + the exact edit) to
|
||||
contract's acceptance criteria. Three blind challengers attack the fix; the main
|
||||
loop RE-THINKS any aspect a BLOCKER lands (a named change to the fix, or
|
||||
`[deferred]`) and re-challenges once if it materially changed. Print a
|
||||
CHALLENGE SUMMARY (BLOCKERs addressed / deferred / lenses returned). A BLOCKER
|
||||
that shows the fix is wrong or incomplete means this was never
|
||||
CHALLENGE SUMMARY (BLOCKERs addressed / deferred / lenses returned / advisor).
|
||||
A BLOCKER that shows the fix is wrong or incomplete means this was never
|
||||
a hotfix — escalate to `/bugfix` (its STEP 3b runs the same phase under the full
|
||||
verify+secure loop).
|
||||
|
||||
@@ -180,16 +180,20 @@ Parse the `HOTFIX-EXEC REPORT`:
|
||||
fresh dispatch, never inline-load: the repo convention and the FRESH
|
||||
requirement both forbid it) with `MODE: gate`, `SCOPE:` the working-tree
|
||||
diff vs `$PRE`. Parse its `SECURITY — VERDICT:` line:
|
||||
- `PASS` (or `DEGRADED` with no BLOCK) → proceed to commit.
|
||||
- `PASS` → read the `TOOL:` line first: DEGRADED (semgrep absent)
|
||||
shows there, never on the VERDICT line; a PASS with no `TOOL:` line
|
||||
is a structural failure (below). Then proceed to commit; a DEGRADED
|
||||
PASS sets the summary's SECURITY field to `DEGRADED (checklist only)`.
|
||||
- `BLOCK(n)` → this is hotfix: do NOT loop. Revert ONLY the executor's
|
||||
files (`git restore --source=$PRE -- <FILE(S)>` + delete report-listed
|
||||
NEW files), print the `BLOCKING` list, and STOP:
|
||||
`"Hotfix introduced a security finding. Reverted. Escalate to /bugfix
|
||||
for a fix under the full verify+security loop."` The hotfix model is
|
||||
one attempt; any gate failure (smoke OR security) reverts and escalates.
|
||||
- Structural failure (mute / unparsable / no VERDICT line) → treat as a
|
||||
failed gate: retry ONCE fresh; a 2nd structural failure → revert +
|
||||
escalate. A mute auditor is never a PASS.
|
||||
- Structural failure (mute / unparsable / no VERDICT line / PASS with
|
||||
no `TOOL:` line) → treat as a failed gate: retry ONCE fresh; a 2nd
|
||||
structural failure → revert + escalate. A mute auditor is never a
|
||||
PASS.
|
||||
3. Commit only after smoke AND security pass, message per
|
||||
`$HOME/.claude/lib/commit-message.md` (no convention: one subject line,
|
||||
`fix(<scope>): <what was wrong>`).
|
||||
|
||||
@@ -192,7 +192,7 @@ Invoke `writing-plans` (vendored superpowers skill) with BRIEF + skeleton.
|
||||
Granular tasks (2-5 min each), exact file paths, TDD: tests before code.
|
||||
|
||||
## STEP 6b — CHALLENGE THE PLAN (before the gate)
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Before the human sees the implementation plan, harden it. Run
|
||||
`$HOME/.claude/lib/challenge-plan.md` with `PLAN` = the plan STEP 6 wrote under
|
||||
`docs/superpowers/plans/`, `KIND` = `build-plan`, `SCOPE` = the skeleton + task file
|
||||
@@ -213,6 +213,7 @@ CHALLENGE SUMMARY (STEP 6b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named plan change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the plan change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
Approve and start? (yes / request changes)
|
||||
```
|
||||
Changes → back to STEP 6. Approved → continue.
|
||||
@@ -267,11 +268,16 @@ deferred to a later /onboard) and turns the informal analyze into a verdict
|
||||
against the founding contract. Distinct axis from STEP 10 code review
|
||||
([[LRN-095]]) — both run.
|
||||
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
## STEP 10 — CODE REVIEW
|
||||
Invoke `requesting-code-review` (vendored superpowers skill). **Model routing (BDR-077):** the
|
||||
review subagent it dispatches MUST carry `model: "opus"` and `effort="xhigh"` in the Agent call —
|
||||
craft review is dispatched judgment, never inherited from the session. Fix
|
||||
all CRITICAL before proceeding.
|
||||
craft review is dispatched judgment, never inherited from the session.
|
||||
Add to its brief: "you may call the `advisor` tool once, before your
|
||||
verdict" (code review, BDR-150). Fix all CRITICAL before proceeding.
|
||||
|
||||
## STEP 10b — CAPITALIZE FOUNDING DECISIONS (memory registries)
|
||||
A greenfield's founding architecture decisions are the highest-value BDRs — the
|
||||
@@ -351,6 +357,14 @@ patched. Report per its rc table — rc 4 = a LOUD upstream BDR-022 anomaly, not
|
||||
> patched docs on the MVP feature branch so they reach the merge.
|
||||
|
||||
## STEP 11 — FINISH
|
||||
`mcp__model-router__route(phase="plan")` first (route: end-of-run review).
|
||||
Before proposing the finish, the main loop prints the run's diff stat,
|
||||
then makes its end-of-run advisor call (`lib/effort-shift.md` § Advisor);
|
||||
its answer goes with the proposal as an `Advisor:` line, and a fix it
|
||||
drives goes back through the gates. A later merge proposal reuses this
|
||||
answer and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
|
||||
Tests pass, build clean, no placeholders. Integrate the MVP feature into develop
|
||||
— **only on the user's explicit go** (the `gitflow` finish gate):
|
||||
```bash
|
||||
|
||||
@@ -8,8 +8,8 @@ description: Run only when the user asks for it ("memory feedback", "label recal
|
||||
|
||||
Phase 4d (BDR-125). The memory mod logs every recall ask; transcripts live
|
||||
7 days, so this runs weekly. Claude labels, the user spot-checks. Redacted
|
||||
text stays in the scratchpad; `~/.claude/memory-feedback/` keeps IDs, enums
|
||||
and repo tags only, never in git.
|
||||
text stays in the scratchpad; `~/.claude/memory-feedback/` keeps IDs, enums,
|
||||
repo tags and advisor call counts only, never in git.
|
||||
|
||||
## STEP 1 — WORKSHEET
|
||||
|
||||
@@ -73,7 +73,9 @@ MFD="$(cd -P "$HOME/.claude/lib" && pwd)/memory-feedback"
|
||||
|
||||
rc 1 `draft refused: <reason>` → fix the draft, rerun. It prints
|
||||
FEEDBACK.md: show the gate lines (`Post-fix prompt asks: k/20` included:
|
||||
actions wait for 20 post-fix asks) and the Actions list to the user.
|
||||
actions wait for 20 post-fix asks), the Actions list and the
|
||||
`## Advisor usage` table (advisor calls since the last run per caller and
|
||||
served model) to the user.
|
||||
|
||||
## STEP 6 — A GATE REACHED FOR THE FIRST TIME
|
||||
|
||||
|
||||
@@ -403,6 +403,7 @@ Agent(
|
||||
effort="xhigh",
|
||||
description="Onboard — code-clean audit only (read-only, opus)",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
AUDIT-ONLY mode — NO fixes, NO refactoring, NO file modifications.
|
||||
Target: <PROJECT_ROOT>. ARCHETYPE: <archetype>.
|
||||
Produce a report covering:
|
||||
@@ -441,6 +442,7 @@ bash $HOME/.claude/lib/profile.sh -C "$PWD" current --plain 2>/dev/null | grep -
|
||||
effort="xhigh",
|
||||
description="Onboard — security audit fallback (archetype-adaptive)",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
READ-ONLY security audit. No file modifications.
|
||||
Target: <PROJECT_ROOT>. ARCHETYPE: <archetype>. Category: <category>. Stack: <stack>.
|
||||
|
||||
@@ -690,6 +692,7 @@ Agent(
|
||||
effort="xhigh",
|
||||
description="Onboard — static design review fallback",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
AUDIT-ONLY mode — NO edits. Static design review du code UI.
|
||||
Target: <PROJECT_ROOT>. Archetype: <archetype>.
|
||||
Context: ui-ux-pro-max plugin state = <active/inactive>.
|
||||
@@ -735,6 +738,7 @@ Agent(
|
||||
effort="xhigh",
|
||||
description="Onboard — static perf audit",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
AUDIT-ONLY mode — NO edits.
|
||||
Target: <PROJECT_ROOT>. Archetype: <archetype>.
|
||||
Static perf audit (pas de browser) :
|
||||
@@ -779,6 +783,7 @@ Agent(
|
||||
effort="xhigh",
|
||||
description="Onboard — static a11y audit",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
AUDIT-ONLY mode — NO edits.
|
||||
Target: <PROJECT_ROOT>. Archetype: <archetype>.
|
||||
Static a11y audit (WCAG 2.1 AA + RGAA 4.1 France) :
|
||||
@@ -826,6 +831,7 @@ Agent(
|
||||
effort="xhigh",
|
||||
description="Onboard — synthèse vers .claude/audits/",
|
||||
prompt="""
|
||||
Never call the `advisor` tool in this run (sub-agent, BDR-150).
|
||||
Lire tous les fichiers de <PROJECT_ROOT>/.onboard-audit/ :
|
||||
- analyze.md, code-clean.md, cso.md, doc.md (toujours)
|
||||
- seo.md, geo.md, design.md, perf.md, a11y.md (si présents)
|
||||
@@ -917,7 +923,7 @@ Vérifier que les 4 fichiers `.claude/audits/ONBOARD_REPORT.md`, `.claude/audits
|
||||
---
|
||||
|
||||
## STEP 7b — CHALLENGE THE PROPOSALS (before the human gate)
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
The 4 audit files are on disk; `AUDIT_PROPOSALS.md` is the artifact worth
|
||||
attacking before the human spends a gate on it. Run
|
||||
`$HOME/.claude/lib/challenge-plan.md` with `PLAN` =
|
||||
@@ -961,6 +967,7 @@ CHALLENGE SUMMARY (STEP 7b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named proposals change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the proposals change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
|
||||
Prochaine étape : générer .claude/tasks/TODO.md depuis .claude/audits/AUDIT_PROPOSALS.md approuvé.
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ your bundle."
|
||||
```
|
||||
|
||||
## STEP 1b — CHALLENGE THE FIX BUNDLE (advisory, before apply)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
The analyzer returned a `## FIX BUNDLE` — worth attacking before any edit lands.
|
||||
**Skip if intervention mode = conservative** (nothing is applied). Else persist the
|
||||
bundle verbatim to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
@@ -138,6 +138,7 @@ CHALLENGE SUMMARY (STEP 1b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named bundle change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the bundle change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
Approve all / select (ids) / skip all?
|
||||
```
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ the reports."
|
||||
```
|
||||
|
||||
## STEP 1b — CHALLENGE THE FIX BUNDLE (advisory, before apply)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Both envelopes now carry a `## FIX BUNDLE` — worth attacking before any edit lands.
|
||||
**Skip if intervention mode = conservative** (nothing is applied). Else persist both
|
||||
bundles (seo + geo, verbatim) to `.claude/tasks/plans/<date>-<slug>-<HHMM>.md`, then run
|
||||
@@ -583,6 +583,7 @@ CHALLENGE SUMMARY (STEP 1b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named bundle change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the bundle change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
Approve all / select (ids) / skip all?
|
||||
```
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ grep -c '^### \[Critique\]' .claude/audits/VALIDATE.md
|
||||
---
|
||||
|
||||
## STEP 2b — CHALLENGE THE FIX BUNDLE (MODE=fix only, advisory)
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="reflect")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Skip if MODE=audit (no bundle exists). Else, before the STEP 3 gate, harden the bundle:
|
||||
extract the `## 5. Fix bundle` section from VALIDATE.md to
|
||||
`.claude/tasks/plans/<date>-<slug>-<HHMM>.md` (a clean, blind-judgeable artifact), then run
|
||||
@@ -296,6 +296,7 @@ CHALLENGE SUMMARY (STEP 2b — 3 lenses) :
|
||||
BLOCKERs addressed : <n> — <finding → the named bundle change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the bundle change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
|
||||
Options :
|
||||
A) Apply all
|
||||
|
||||
@@ -76,6 +76,12 @@ Parse the `RELEASE-EXEC REPORT`:
|
||||
- `STATUS: BLOCKED` → surface the blocker verbatim, STOP.
|
||||
|
||||
### STEP 4 — HUMAN GATE: when to release
|
||||
`mcp__model-router__route(phase="reflect")` first (route: end-of-run review).
|
||||
Before the ask, the main loop makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor); its answer
|
||||
goes with the ask as an `Advisor:` line, and a fix it calls for makes
|
||||
hold the recommended answer.
|
||||
|
||||
STOP. Show the prep report's `TESTS` result, then:
|
||||
```
|
||||
AskUserQuestion:
|
||||
|
||||
@@ -133,7 +133,7 @@ request nor the STEP 1 brainstorm settled (check the contract's CLARIFICATIONS
|
||||
first) → one batch before STEP 2b; answers append to the contract `[gated]`.
|
||||
|
||||
## STEP 2b — CHALLENGE THE PLAN (adversarial, before the gate)
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the challenger dispatch).
|
||||
`mcp__model-router__route(phase="plan")` first (route: own level before the challenge; send it with the first tool call of lib/challenge-plan.md, the advisor call when one is due).
|
||||
Before the human sees the plan, harden it. Run `$HOME/.claude/lib/challenge-plan.md`:
|
||||
- `PLAN` = the plan STEP 2 wrote under `docs/superpowers/plans/`
|
||||
- `KIND` = `build-plan`
|
||||
@@ -163,6 +163,7 @@ CHALLENGE SUMMARY (STEP 2b — 3 lenses):
|
||||
BLOCKERs addressed : <n> — <finding → the named plan change that closes it>
|
||||
Deferred (human-ack): <list | none>
|
||||
Lenses returned : correctness / robustness / simplicity (NAME any that failed to return)
|
||||
Advisor : <the plan change it drove | called, no change | not called (absent | error | already called this run | sub-agent)>
|
||||
Approve and execute? (yes / request changes)
|
||||
```
|
||||
This block EXPOSES each in-force item with the plan's CLAIMED disposition, for human
|
||||
@@ -249,11 +250,16 @@ against the contract. It is a DISTINCT axis from STEP 6 code review (contract
|
||||
conformity + security vs. craft/design) — both run, neither subsumes the
|
||||
other ([[LRN-095]]).
|
||||
|
||||
Stuck: a gate loop fails twice with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls the advisor per `lib/verify-secure-loop.md`
|
||||
(`lib/effort-shift.md` § Advisor); the answer never enters an executor brief.
|
||||
|
||||
## STEP 6 — CODE REVIEW
|
||||
Invoke `requesting-code-review` (vendored superpowers skill). **Model routing (BDR-077):** the
|
||||
review subagent it dispatches MUST carry `model: "opus"` and `effort="xhigh"` in the Agent call —
|
||||
craft review is dispatched judgment, never inherited from the session. Fix
|
||||
all CRITICAL before proceeding.
|
||||
craft review is dispatched judgment, never inherited from the session.
|
||||
Add to its brief: "you may call the `advisor` tool once, before your
|
||||
verdict" (code review, BDR-150). Fix all CRITICAL before proceeding.
|
||||
|
||||
## STEP 7 — CAPITALIZE (memory registries)
|
||||
Call memory_pending first, per /capitalize STEP 1 "Captured first".
|
||||
@@ -315,6 +321,14 @@ surfaced a forbidden path), not a silent skip. It runs BEFORE FINISH so the doc
|
||||
on the branch FINISH integrates.
|
||||
|
||||
## STEP 9 — FINISH
|
||||
`mcp__model-router__route(phase="plan")` first (route: end-of-run review).
|
||||
Before proposing the finish, the main loop prints the run's diff stat,
|
||||
then makes its end-of-run advisor call (`lib/effort-shift.md` § Advisor);
|
||||
its answer goes with the proposal as an `Advisor:` line, and a fix it
|
||||
drives goes back through the gates. A later merge proposal reuses this
|
||||
answer and names any code commit made after it (doc and memory
|
||||
commits excepted).
|
||||
|
||||
Tests pass, build clean. Integrate the feature into develop — **only on the
|
||||
user's explicit go** (the `gitflow` finish gate):
|
||||
```bash
|
||||
|
||||
+13
-3
@@ -92,7 +92,8 @@ Agent(subagent_type="general-purpose",
|
||||
prompt="Read ~/.claude/skills/tour/SKILL.md and execute STEP 1 → STEP 3
|
||||
for EXACTLY ONE project: <absolute path>. Flags: <--report-only|none>.
|
||||
Skip STEP 0/0b (routing) and the global summary — the dispatcher owns
|
||||
them. Every rule of the skill applies unchanged: max 3 iterations,
|
||||
them; never call the advisor. Every rule of the skill applies
|
||||
unchanged: max 3 iterations,
|
||||
never merge/finish/push main|develop, scoped commits, report appended to that
|
||||
project's own .claude/audits/TOUR.md. Return EXACTLY: the project's
|
||||
one-line global-summary row (STEP 3 format), then BRANCH: <name|no
|
||||
@@ -104,7 +105,9 @@ The main loop then:
|
||||
1. Collects each runner's summary row. A dead or mute runner becomes the
|
||||
row `<path> : RUNNER FAILED — <reason> | no report` — never a silent
|
||||
absence (a mute runner is NEVER a pass).
|
||||
2. Prints the global summary (STEP 3 format) once ALL runners returned.
|
||||
2. Once ALL runners returned: when any row reports a fix, makes the
|
||||
STEP 3 end-of-run advisor call; then prints the global summary (STEP 3
|
||||
format).
|
||||
3. Runs the gated capitalize offer — MAIN LOOP ONLY, never inside a
|
||||
runner: registries are shared state, and gate decisions stay here
|
||||
(LRN-083).
|
||||
@@ -171,7 +174,8 @@ honestly in the summary. Never loop past 3.
|
||||
### Phase B — CLEAN
|
||||
|
||||
1. Dispatch a read-only cleanup audit (analyzer — opus row, BDR-076 —
|
||||
or general-purpose with `model="opus"`, `effort="xhigh"`; NOT the sonnet code-cleaner,
|
||||
or general-purpose with `model="opus"`, `effort="xhigh"`, its brief
|
||||
saying never call the `advisor` tool; NOT the sonnet code-cleaner,
|
||||
which is now a fix executor): dead code, unused imports/exports,
|
||||
commented-out blocks, stale flags, norm violations. Findings as
|
||||
`id | file:line | finding | proposed fix`.
|
||||
@@ -261,6 +265,12 @@ order:
|
||||
Checks: pytest PASS, ruff PASS. Residuals: SEC-2 (needs decision). Commits: 4. BREAKING: 1 (SEC-2).
|
||||
```
|
||||
|
||||
Main loop only, never a runner: when the tour applied any fix, before
|
||||
the global summary, the main loop makes its
|
||||
end-of-run advisor call (`lib/effort-shift.md` § Advisor); its answer
|
||||
goes into the summary as an `Advisor:` line, and a fix it calls for
|
||||
waits for a new run.
|
||||
|
||||
Global summary inline, one line per project (append `BREAKING: n` to
|
||||
any project line with contract-changing fixes left open for decision):
|
||||
|
||||
|
||||
Reference in new issue
Block a user