Compare commits
67
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
eb1f594644 | ||
|
|
d55f4911ce | ||
|
|
9033b4a944 | ||
|
|
47e5ee8389 | ||
|
|
58a5273b5c | ||
|
|
d059658067 | ||
|
|
fc2d84dd41 | ||
|
|
78a694299b | ||
|
|
c1a0c32417 | ||
|
|
09277f528a | ||
|
|
6ef3069f6e | ||
|
|
f3b3987acf | ||
|
|
bf0bc2fc95 | ||
|
|
d027dfab3a | ||
|
|
8ffe7e7ddd | ||
|
|
d292911343 | ||
|
|
c3507ea447 |
No files matched your search
@@ -104,9 +104,43 @@
|
||||
<!-- /feat router-no-fable 2026-11-16 (24b0f35) and /feat fable-pins-to-opus (beebfe2): residuals of BDR-150, not BDR-125 -->
|
||||
- mods/model-router (BDR-150 shipped tiers): an opus outage spawns best/big agents on the held opus (frontmatter floor; the gates fail, verify-secure retries then escalates; they used to move up to Fable); a single opus outage makes sonnet stand in for best and big with the effort notch; a fable-baseline session (native /model Everywhere) is demoted per downgradeCall caps and sessionPin pins general-purpose spawns to fable; a skill row answering opus + xhigh in the Change dialog lands on run-holding `plan`. isStandIn and tierWord still read a stored `tierChoice === 'big'` directly. Severity: low. Discovered while: /feat router-no-fable challenges and executor. Accepted, not fixed.
|
||||
- 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.
|
||||
- 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
|
||||
@@ -1004,6 +1004,7 @@ Reverses the BDR-066 rejected alternative "opus pins on audit agents (session-in
|
||||
|
||||
## BDR-077 — Model-tiering v2: 4-tier explicit routing, mode-based splits, no-inherit dispatches [accepted] (2026-07-19)
|
||||
Supersedes BDR-076 scope + amends BDR-066. Doctrine: session model (Fable) = main-loop reflection/orchestration/planning/logic ONLY; main-loop retention criteria = interactive | conversation-context access | orchestration decision | dispatch overhead > step cost. NOTHING dispatched inherits: typed agents = frontmatter pin, built-ins = `model=` at every call site (`fable` for skill-runner reflection children, else complexity tier). Spike+smoke proven: `model:"fable"` resolves claude-fable-5 (enum-validated, loud fail, no silent fallback); call-site override BEATS a typed pin (sonnet-pinned verifier ran haiku). Fail-safe pin rule: mixed-mode agents keep the HIGH tier as pin, overrides go DOWN — forgotten override over-tiers (cost), never downgrades judgment. Mode-based splits (commit-changer precedent generalized; file splits rejected): doc-syncer audit(opus)/patch(sonnet) — ALSO fixed a latent defect: /doc dispatched an agent whose STEP 8 interactive gate could never fire; gates hoisted to a DISPATCHER PROTOCOL section; handover-doc-writer synthesize(opus)/render(sonnet) via run-scoped `.audit/handover-draft-<RUNID>.md` + DRAFT COMPLETE sentinel; seo/geo collect(sonnet)/judge(OPUS PIN)/template(sonnet) via `.audit/*-signals-<RUNID>.md` + COLLECTION COMPLETE + fail-closed judge + dispatcher ERROR contract (mute/ERROR judge NEVER carried into templating; retry once, escalate). File split only for a genuinely new role: plugin-probe (sonnet, facts-only) + plugin-advisor repinned opus reasoner (fail-closed on missing PROBE REPORT) + lib/plugin-gate.md (checkpoint + apply gate, doc-commit ×N include pattern). Inline→dispatch conversions: scaffolder, onboarder, doc-commit steps ×5 flows — their sonnet pins were INERT since creation, now live; CHANGE SUMMARY crosses the doc dispatch into doc-commit (LRN-126 wire). Tier moves: validator-analyzer opus→sonnet (deterministic runner); commit-changer propose=opus/apply=pin; ship-feature/init-project code-review dispatches = opus explicit (WAS an inherit leak); client-handover-writer's 7 skill-runners = model:"fable". Every wave shipped an IN-WAVE planted-input smoke as its merge gate — all PASSED disk-verified. Census §12-18 (125 pass; one vacuous line-wrapped lock self-caught = LRN-093 live). 6 waves, branches feature/model-tiering-w1..w6, merged on user standing signal. Plan: challenged 3 blind lenses + 1 confirmation (1 BLOCKER closed by spike, 8 MAJORs + 8 MINORs closed by named changes, 0 deferred). Refs: `.claude/tasks/plans/2026-07-19-model-tiering-v2-{analysis,plan}.md`.
|
||||
- **Status (2026-11-17)**: accepted, amended by BDR-150: skill-runner pins opus (beebfe2); session opus, Fable is the advisor
|
||||
|
||||
## BDR-078 — ctx7 coverage: central fast-libs list + once-per-session reminder hook; every code path covered [accepted] (2026-07-20)
|
||||
Refines BDR-053 (single surface). Audit 2026-07-20: coverage PARTIAL — find-docs fired on user doc-questions only; ship-feature 0c / init-project 5c pre-fetched; /feat //bugfix executors + ad-hoc coding NEVER consulted ctx7; fast-libs list hardcoded 3× (drift risk). 4 closures shipped: (a) find-docs description += BEFORE-writing-code trigger (fast-moving lib, even without doc question, unless fresh cache) + cache-first rule in body (tee fetched docs to .ctx7-cache/); (b) feater+bugfixer briefs += fast-lib docs rule — read fresh `.ctx7-cache/<lib>*.md`, else `npx ctx7@latest` fetch max 2 topics, else `ctx7 cache miss: <lib>` in NOTES + proceed (executors lack Skill tool → Bash path); (c) hooks/ctx7-reminder.sh UserPromptSubmit — ONE fire/session (sentinel on session_id), only when project manifest carries fast-libs; reports cache state; skips <task-notification> turns; always exit 0; (d) lib/fast-libs.sh = SINGLE SOURCE (detect / cache-status verbs, JS package.json anchored full-key match + Python requirements/pyproject, 7-day freshness, LC_ALL=C sort locale-independent) consumed by hook + 3 pipeline skills + 2 briefs. 2nd session surface DELIBERATE, not a BDR-053 reversal: 053 killed a 490-tok ALWAYS-ON rule duplicate; hook costs ~0 quiet, 1 line once when fast-libs present. Alternatives rejected: PreToolUse Edit/Write gate (fires per-edit = noise); description-only fix (probabilistic, executors unreachable). Tests: lib/tests/fast-libs.test.sh 11 checks (anchored/near-miss/py/none, cache fresh/stale/missing, hook fire/sentinel/quiet×2); shellcheck + full make test green. Branch feature/ctx7-coverage, unmerged (human gate).
|
||||
@@ -1607,3 +1608,8 @@ Supersedes [[BDR-030]].
|
||||
- **Residuals**: opus outage → best/big agents spawn on held opus (gates fail, verify-secure retries then escalates; was move-up to Fable); single opus outage → sonnet stands in with effort notch; fable-baseline session (native Everywhere) demoted to opus per downgrade caps, sessionPin pins general-purpose to fable; skill row answering opus+xhigh in Change lands on `plan`. Test rig: shipped tiers default, `legacyTiers: true` on 47 fable-mechanics tests.
|
||||
- **Gates**: r1 3 lenses CONCERNS → r2 → re-challenge CONCERNS → r3; feater DONE 661 tests; GATE 0 MET; verifier CONFORME; security PASS (MEDIUM fixed: stored answer survives ask-tier off); commits 24b0f35, docs 42385d2.
|
||||
- **Refs**: amends [[BDR-123]], [[BDR-135]]; supersedes [[LRN-224]]; [[BLK-030]], [[BDR-077]] (Fable dispatch pins: separate run).
|
||||
- **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
|
||||
@@ -771,3 +771,18 @@ rules:
|
||||
- C1-C3 BDR-125 gap: 11 status lines (BDR-125 summary; BDR-079/017 + LRN-155 superseded, 7 amended by BDR-134/136; amended entries still recalled with old title, only superseded/deprecated leave recall); C3 deferrals → 7 TODO lines + 3 dated drops; C6 dropped (throwaway repos, user).
|
||||
- Router no-Fable (BDR-150, 24b0f35, docs 42385d2): best/big = opus>sonnet, fable ranked + hand pick only, Change dialog drops fable, askTier inert unless override heads best with fable; routing.json untouched (live install). 2 challenge rounds caught dialog labels, live-install consent gap, legacy rig masking. BDR-123/135 amended, LRN-224 superseded. Next: Fable pins → opus, advisor doctrine.
|
||||
- Fable pins → opus (beebfe2, docs): client-handover 7 skill-runner pins + model-gate doctrine opus, gate row 'fixed at spawn' proceeds in sub-agent, repo-wide census refuses fable pins. Amends BDR-077 W1 per BDR-150. Next: doctrine run (effort-shift, advisor rule, Fable prose).
|
||||
|
||||
## 2026-11-17
|
||||
- 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.
|
||||
@@ -2122,3 +2122,55 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
- **Context**: A6 router write guard fail-closed (859e504). r1 try/catch around guardWrite, r2 cfgErr hold + `.catch` latches: challengers found latches unreachable (no ensureConfig throw source), typed-skill latch unable to fire. claude-code.d.ts tool.call remark already prescribes `.catch(($, e, next) => next.called ? next(e) : { deny })`; Caught.called splits guard failure from downstream error, next(e) replays without re-run. r3 used it: guardWrite unchanged, 3 `.catch` blocks only.
|
||||
- **Apply**: grep `~/.claude/plugins/marketplaces/claude-code-plugins/mods/types/claude-code.d.ts` for the event + `@remarks` before planning; prefer documented idiom over hand-built try/catch. Engine refusals reach hooks as `isError`, not `deny` (BDR-137): latch/success predicates test both.
|
||||
- **Reference**: mods/model-router/hooks/register.ts guardCaught, guardPasses; BDR-136 amended
|
||||
|
||||
## LRN-294 — Scope rules to main loop only after checking which tools sub-agents really get (2026-11-17)
|
||||
- **Pattern**: before scoping a rule to "main loop only" or "sub-agents never", check which tools sub-agents actually receive; harness may list tool + prompt them to use it, so prose rule fights harness instruction.
|
||||
- **Context**: 2026-11-17 advisor doctrine (BDR-150, c3507ea). Plan assumed advisor = main-loop tool. Robustness challenger (typed sub-agent, tools Read/Grep/Glob/Bash) had `advisor` listed + system prompt saying call it before/after work; same for verifier, security-auditor, executors. Each call forwards that agent's full transcript to Fable outside router caps (server tool, hooks cannot see/refuse).
|
||||
- **Apply**: ask a dispatched agent what tools it has (or read its prompt) before writing a scope rule; prefer mechanical scope (settings/tool lists) over prose; when only prose exists, log as residual (BUGS-FOUND d292911).
|
||||
- **Reference**: CLAUDE.global.md § Workflow, lib/effort-shift.md § Advisor
|
||||
|
||||
## LRN-295 — Measure advisor calls from transcripts: per caller, model, uncached input (2026-11-17)
|
||||
- **Pattern**: measure advisor use from session transcripts, not from feel. Main transcript `~/.claude/projects/<proj>/<session>.jsonl`, sub-agents `<session>/subagents/*.jsonl` (+ `.meta.json` agentType). Call = content block `server_tool_use` name `advisor`; model + tokens = `message.usage.iterations[]` with `type=="advisor_message"`. Usage rows repeat once per content block: dedupe by `message.id`.
|
||||
- **Context**: 2026-11-17, user asked if advisor called when needed. Since /advisor (2026-11-16 16:19Z): main loop 2 calls, served by Opus (conversation kept old advisor), 409k + 680k input tokens, cache_read 0; 18/20 opus sub-agents 19 calls on Fable, median 70k (43k-119k), total 1.46M; 8 sonnet sub-agents 0. Data reversed "main loop only" (c3507ea) → 6ef3069 (judgment agents once, main loop named points).
|
||||
- **Apply**: before scoping who calls advisor, or judging cost: count per caller + model + uncached input; main-loop call in long session costs ~6-10 sub-agent calls. Run C (/memory-feedback advisor section) automates it.
|
||||
- **Reference**: lib/effort-shift.md § Advisor, BDR-150, LRN-294
|
||||
|
||||
## LRN-296 — Simulate contract CHECKs on a scratch copy of the planned edit before dispatch (2026-11-17)
|
||||
- **Pattern**: before dispatching a prose/doctrine run, apply the planned blocks to a scratch copy (deterministic applier asserting each anchor once) and run every contract CHECK against it. Grepping markers against the block text alone misses cross-block effects.
|
||||
- **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
|
||||
+23
-3
@@ -3,6 +3,23 @@
|
||||
## 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/`.
|
||||
|
||||
### 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, 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
|
||||
- [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)
|
||||
- [ ] 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)
|
||||
- [ ] 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
|
||||
Decisions at start (asked once): faunosteo memory v2 on `chore/memory-v2` off develop in a fresh worktree (split already on develop 7a75974, 11 rules); settings.json `npm -g` deny lines removed on the block E branch, classifier test = `npm install -g --dry-run cowsay`; 3.0.0 cut right after block A (/release-candidate), later blocks land under the next Unreleased; LRN-270 bisect = user-run interactive sessions, one `--settings` file per pack. Merge prompts (`gitflow finish` ask) = the human signal per block once gates are green.
|
||||
- [x] A merged 1b82a25 (routing `confirmed` row a2f352e)
|
||||
@@ -75,8 +92,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)
|
||||
@@ -95,7 +115,7 @@ Open children of the shipped phases (History 2026-11-12), text verbatim.
|
||||
- [ ] lib/tests/project-rules.test.sh:296 T11b hardcodes '4 rule(s) ok': a 5th .claude/rules/*.md turns it red (BDR-128 residual)
|
||||
- [ ] MIGRATION.md: one sentence that hooks/instructions-loaded.sh needs a CLI emitting InstructionsLoaded (older CLI: no log, no path-rule load proof); check claude --version on the work machine (BDR-128 residual)
|
||||
- [ ] raw registry text to the terminal (TODO:57 leftover, not phase-tied): lib/reconcile.sh:137 prints ${st:0:80} of an unreadable status line, lib/memory.sh:493 check prints the bad heading $0; control chars pass (upgrade's clean() maps them to ?, these two do not)
|
||||
- [ ] doctrine run (BDR-150, next): lib/effort-shift.md:30-32 wiring point 5 still names `fable` skill-runners and "high for fable runners" (split across lines, the census regex misses it); stale Fable-routing prose in agents/plan-challenger.md:111,:115, lib/challenge-plan.md:48,:51, skills/tour/SKILL.md:83; advisor rule into CLAUDE.global.md + effort-shift.md
|
||||
- [x] doctrine run (BDR-150) DONE c3507ea: lib/effort-shift.md:30-32 wiring point 5 still names `fable` skill-runners and "high for fable runners" (split across lines, the census regex misses it); stale Fable-routing prose in agents/plan-challenger.md:111,:115, lib/challenge-plan.md:48,:51, skills/tour/SKILL.md:83; advisor rule into CLAUDE.global.md + effort-shift.md
|
||||
|
||||
### Release 3.0.0
|
||||
Scope (user 2026-11-11) [gated]: D1-D6 + the 6 dead deny entries + MIGRATION/CHANGELOG land before the cut. Decisions: D1 digest + on-demand read (capitalize:375 aligned); D2 remove plugin-dev everywhere (OFF row disappears when empty); D3 advisor + USAGE rewritten to packs vocabulary, no budget/token claims, G2 add-ons included, SB10 fails on a missing file; D4 /prune-memory reads statuses through memory.sh (v1+v2), example IDs 9xx; D5 web-security keeps only its unique rules, points to secure-by-default, password = argon2id; D6 rule text names the CLAUDE.global.md append + install-plugins.sh runs the graphify step from $REPO. Runs: /feat D2+D3, /feat D4, /feat D1+D5+D6, /feat dead denies, docs, /release-candidate.
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# CONTRACT — advisor-call-points, run A (BDR-150 amendment)
|
||||
- date: 2026-11-17 | flow: feat | branch: feature/advisor-call-points (off develop)
|
||||
- status: active
|
||||
- plan: .claude/tasks/plans/2026-11-17-advisor-call-points-1130.md (r4)
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
User 2026-11-17, after the transcript count (main loop 2 advisor calls on Opus, 409k/680k uncached tokens; 18 of 20 opus sub-agents 19 calls on Fable, median 70k; sonnet 0 of 8), answering the three proposals: "oui 1 et 2, et le 3 aussi". Proposal 1: let the judgment agents (plan-challenger, verifier, security-auditor) call the advisor once, before their verdict; sonnet executors stay without; for the security-auditor, advice can add a finding or raise a severity, never clear a semgrep HIGH or CRITICAL. Proposal 2: name the main loop's call points in the skills rather than leave them to its judgment: before settling the approach (ahead of the plan of /feat, /bugfix, /ship-feature), at the second failure of a gate loop before re-dispatching or escalating, and before proposing the merge; the text lives in lib/effort-shift.md § Advisor, the skills cite it, the doctrine-citers census checks it. Proposal 3: count advisor calls per session (main loop vs sub-agents, model served).
|
||||
|
||||
## CLARIFICATIONS
|
||||
- [gated 2026-11-17] user: split in runs. Run A (this contract) = doctrine (CLAUDE.global.md, lib/effort-shift.md § Advisor) + the three judgment agents. Run B = inline call lines in skills/feat, skills/bugfix, skills/ship-feature, lib/verify-secure-loop.md. Run C = the counter.
|
||||
- [gated 2026-11-17] user: the counter (proposal 3) is a section of /memory-feedback (run C).
|
||||
- [internal 2026-11-17] gates round 1 (verifier CONFORME, security PASS) flagged block E: a raise double-counted in BLOCK(n), a no-class finding had no severity → block E r5 (plan), criterion 4 gains 'so it counts once' and 'REPORTED as LOW'.
|
||||
- [gated 2026-11-17] user: an advisor-added or -raised security finding takes the severity of the STEP 3 checklist class it matches; no matching class → REPORTED, non-blocking (block E r4).
|
||||
- [internal 2026-11-17] executor NEED-DECISION: block B line reworded to "(for work outside them, see the / triggers in CLAUDE.global.md § Workflow):" (census T3 read "§ Workflow names").
|
||||
- [internal 2026-11-17] re-challenge → plan r4 (section "r4 changes"): criterion 1 markers + 315 lines, criterion 2/4 markers, EVIDENCE: pending lines.
|
||||
- [internal 2026-11-17] challenge round 1 → plan r3 (section "r3 changes"): criteria re-scoped (criterion 2 counts STEP inside § Advisor only), blocks per r3.
|
||||
- [internal 2026-11-17] advisor review: blocks C-E carry "absent or erroring → proceed" (they read their agent file and CLAUDE.global.md, never lib/effort-shift.md); block E carries a grounding clause (added or raised finding cites a file:line read); "at most once" wording in both block A and B; no skill step numbers in block B.
|
||||
|
||||
## RELATED MEMORY
|
||||
- BDR-150 (accepted): amended here, "sub-agents do not" (c3507ea) becomes "the three judgment agents at most once"; "never routed or pinned" kept.
|
||||
- LRN-294: honored, scope set from observed tool lists, rest named a prose rule.
|
||||
- BDR-066 / LRN-083: loop decisions stay in the main loop; advice is input.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. CLAUDE.global.md carries block A: the three-agent scope and the § Advisor pointer.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'and security-auditor at most once, before the verdict; other' CLAUDE.global.md || true; })/$({ grep -c 'sub-agents do not. Fable is never routed' CLAUDE.global.md || true; })/$({ grep -cF '`~/.claude/lib/effort-shift.md` § Advisor' CLAUDE.global.md || true; })/$(wc -l < CLAUDE.global.md)"
|
||||
EXPECT: 1/1/1/315
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/315
|
||||
2. lib/effort-shift.md § Advisor carries block B, with no skill step number.
|
||||
CHECK: cd /home/bchanot/Documents/claude && sec() { sed -n '/^## Advisor/,/^## Never/p' lib/effort-shift.md; }; echo "$(grep -c '^## Advisor' lib/effort-shift.md)/$(sec | grep -c 'Main loop, at least at these points')/$(sec | grep -c 'once per verify-secure run, at the first gate loop')/$(sec | grep -c 'never enters an executor brief')/$(sec | grep -c 'once per dispatch, before their verdict')/$(sec | grep -c STEP)"
|
||||
EXPECT: 1/1/1/1/1/0
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/1/1/0
|
||||
3. Each judgment agent carries its one-call rule with the proceed clause.
|
||||
CHECK: cd /home/bchanot/Documents/claude && for f in plan-challenger verifier security-auditor; do printf '%s/' "$({ grep -c 'Advisor (when listed): at most one call' agents/$f.md || true; })$({ grep -c 'erroring → proceed' agents/$f.md || true; })"; done; echo
|
||||
EXPECT: 11/11/11/
|
||||
EVIDENCE: MET exit=0 marker-found :: 11/11/11/
|
||||
4. Advice can only add: security-auditor routes and tags it, verifier and plan-challenger never clear.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'It never removes,' agents/security-auditor.md || true; })/$({ grep -c 'BLOCK(n) like any other' agents/security-auditor.md || true; })/$({ grep -c 'so it counts once' agents/security-auditor.md || true; })/$({ grep -c 'is REPORTED as LOW,' agents/security-auditor.md || true; })/$({ grep -c 'Advice alone never clears a' agents/verifier.md || true; })/$({ grep -c 'alone never drops or lowers one' agents/plan-challenger.md || true; })"
|
||||
EXPECT: 1/1/1/1/1/1
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/1/1/1
|
||||
5. Full make test green (run 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
|
||||
6. Touched lines ≤ 80 columns; blocks applied verbatim from plan r4; no other wording changed in the five files (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
CLAUDE.global.md (§ Workflow bullet ~:81-85), lib/effort-shift.md (§ Advisor body ~:103-110), agents/plan-challenger.md (§ RULES), agents/verifier.md (§ RULES), agents/security-auditor.md (§ RULES).
|
||||
@@ -0,0 +1,39 @@
|
||||
# CONTRACT — advisor-doctrine (BDR-150 follow-up)
|
||||
- date: 2026-11-17 | flow: feat | branch: feature/advisor-doctrine (off develop)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
Advisor doctrine (user 2026-11-16, BDR-150: Fable is the advisor, "the advisor is called whenever a smarter agent is needed"). CLAUDE.global.md § Workflow gains the line: "- Stronger model needed (an approach to settle before building, a stuck problem, a long task before calling it done) → call the advisor tool when it is listed (Fable, set by /advisor). Fable is never routed or pinned: the router tops out at opus (BDR-150)." lib/effort-shift.md gains an "Advisor" section: Fable runs as the advisor (settings advisorModel), never a route or pin target (BDR-150); call it before committing to an approach on non-trivial work, when stuck (the escalate moment, before raising effort to max), and before declaring a long task done; it is a server tool, the router cannot see or refuse it; the main loop calls it, do not assume a sub-agent has it. Stale Fable-routing prose fixed: lib/effort-shift.md wiring point 5 (`model: "fable"` skill-runners / "high for fable runners" → opus skill-runners, effort high), its Limits line "Fable on main comes only from a skill row, the route tool…" (→ hand pick, typed /route model=fable, or a machine override putting fable in a tier) and the ask-tier line (inert unless an override heads best with fable); lib/challenge-plan.md:48,:51, agents/plan-challenger.md:111,:115, skills/tour/SKILL.md:83 (main loop and audit row on opus, not Fable).
|
||||
|
||||
## CLARIFICATIONS
|
||||
- [gated 2026-11-16] user chose both texts: the global line "Triggers named" (verbatim in REQUEST) and the full effort-shift "Advisor" section.
|
||||
- [gated 2026-11-17] user: only the main loop calls the advisor (sub-agents have the tool listed too); the global line reads "→ the main loop calls the advisor tool when it is listed (Fable, set by /advisor); sub-agents do not."; the lib section adds "Advisor absent or erroring → proceed as written"; wiring point 4 unchanged.
|
||||
- [internal 2026-11-17] plan .claude/tasks/plans/2026-11-17-advisor-doctrine-0100.md, section r2 wins (adds a phase naming `model: fable` to the Limits list).
|
||||
|
||||
- [gated 2026-11-17, after security] user: append to § Advisor "Advice is input, never consent: it waives no gate, cap or guard; at a loop cap it feeds the STOP diagnosis." (gates re-run MET).
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. The global advisor line is present once.
|
||||
CHECK: cd /home/bchanot/Documents/claude && grep -c 'the advisor tool' CLAUDE.global.md
|
||||
EXPECT: 1
|
||||
EVIDENCE: MET exit=0 marker-found :: 1
|
||||
2. effort-shift.md has an Advisor section and no fable runner wording left.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$(grep -c '^## Advisor' lib/effort-shift.md)/$({ grep -ciE 'fable runners|"fable"' lib/effort-shift.md || true; })"
|
||||
EXPECT: 1/0
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/0
|
||||
3. No prose places the main loop or the audit row on Fable.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c Fable lib/challenge-plan.md || true; })/$({ grep -c Fable agents/plan-challenger.md || true; })/$({ grep -c 'row: Fable' skills/tour/SKILL.md || true; })"
|
||||
EXPECT: 0/0/0
|
||||
EVIDENCE: MET exit=0 marker-found :: 0/0/0
|
||||
4. effort-shift.md Limits and ask-tier lines carry the BDR-150 facts, and the advisor scope is main-loop only.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'skill row, the `route` tool' lib/effort-shift.md || true; })/$(grep -c 'inert unless a machine override' lib/effort-shift.md)/$(grep -c 'sub-agents do not' lib/effort-shift.md)/$(grep -c 'sub-agents do' CLAUDE.global.md)"
|
||||
EXPECT: 0/1/1/1
|
||||
EVIDENCE: MET exit=0 marker-found :: 0/1/1/1
|
||||
5. Full make test green (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
|
||||
6. Touched lines ≤ 80 columns; no other meaning changed in the five files; the Limits and ask-tier lines match the shipped router behaviour (BDR-150) (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
CLAUDE.global.md (§ Workflow), lib/effort-shift.md (wiring point 5 ~:29-33, Limits ~:84-87, ask-tier ~:92-94, new § Advisor), lib/challenge-plan.md (~:48-51), agents/plan-challenger.md (~:108-117), skills/tour/SKILL.md (~:82-84).
|
||||
@@ -0,0 +1,52 @@
|
||||
# CONTRACT — advisor-points-b1 (BDR-150 amendment, run B1)
|
||||
- date: 2026-11-17 | flow: feat | branch: feature/advisor-points-b1 (off develop)
|
||||
- status: active
|
||||
- plan: .claude/tasks/plans/2026-11-17-advisor-points-b1-1500.md (r4)
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
User 2026-11-17: "oui a, b et c dans la run B", answering: (a) move the main loop's "before the plan" point into lib/challenge-plan.md, shared by 9 skills: the main loop consults the advisor on the written plan before dispatching the challengers; (b) add the analyzer to the agents allowed one call; (c) add a concrete trigger to the global line: "before recommending a change to the doctrine, the architecture or a public interface". Run B (from run A) also places inline call lines in lib/verify-secure-loop.md (second failure, caps).
|
||||
|
||||
## CLARIFICATIONS
|
||||
- [internal 2026-11-17] run B split (/feat max 5 files): B1 = CLAUDE.global.md, lib/effort-shift.md, lib/challenge-plan.md, lib/verify-secure-loop.md, agents/analyzer.md (this contract); B2 = stuck trigger lines in skills/feat, skills/bugfix, skills/ship-feature, skills/init-project gate bullets, merge lines in skills/ship-feature STEP 9 and skills/release-candidate STEP 4, agents/security-auditor.md direction fix.
|
||||
- [internal 2026-11-17] plan r2: stuck unit "since GATE 0 first ran", block C once, user wording "before recommending", analyzer moved in.
|
||||
- [internal 2026-11-17] re-challenge (correctness FATAL(2), robustness CONCERNS(1), simplicity CONCERNS(1)) → plan r4, no third round: criterion 3 awk anchored on `^**Advisor first`; block F `Advisor:` row added to whatever summary template the caller prints, states `called, no change` / `not called (…)`; block C dedup "no main-loop advisor call since the skill run started", re-persist PLAN on disk, route clause dropped; block H (nominal-path cost line); block I (named points cover the § Workflow triggers inside a skill run); B2 inline sentence narrowed to the analyzer; E parenthetical dropped. Residuals → BUGS-FOUND at capitalize: verifier/security-auditor advisor rules not dispatch-scoped (inline load path unused today), agents/plan-challenger.md ORCHESTRATOR PROTOCOL mirror lacks the advisor step and row.
|
||||
- [internal 2026-11-17] challenge round 1 (correctness FATAL(5), robustness CONCERNS(4), simplicity SOLID) → plan r3: plan call once per skill run, reads PLAN first, route sent with it, no attribution in PLAN, CHALLENGE SUMMARY lists advisor-driven changes (block F); stuck unit counts main-loop calls only; STOP clause moved before "## Order invariant" (block G); effort-shift item 2 "says whether it predates"; analyzer rule scoped to dispatch, anchored after TASKS/PROCESS, fix advice allowed where the brief asks; `analyzer` backticked; B2 gains skills/init-project. Rejected: one-line D triggers (S1, the brief ban stays at the site), on-disk stuck marker (R10, over-built).
|
||||
|
||||
## RELATED MEMORY
|
||||
- BDR-150 (accepted, amended 6ef3069): amended again here.
|
||||
- LRN-294, LRN-295, BUGS-FOUND advisor residual: prose-only scope, cost per main-loop call.
|
||||
- BDR-066 / LRN-083: decisions and advice stay in the main loop.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. CLAUDE.global.md carries block A (trigger c, dispatched analyzer, one-line citation).
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'before recommending a change' CLAUDE.global.md || true; })/$({ grep -c 'verifier, security-auditor and `analyzer` at most once, before their' CLAUDE.global.md || true; })/$({ grep -cF '`~/.claude/lib/effort-shift.md` § Advisor;' CLAUDE.global.md || true; })/$(wc -l < CLAUDE.global.md)"
|
||||
EXPECT: 1/1/1/316
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/316
|
||||
2. lib/effort-shift.md § Advisor: plan point on the written plan, "whether it predates", dispatched analyzer, inline loads, old wording gone.
|
||||
CHECK: cd /home/bchanot/Documents/claude && sec() { sed -n '/^## Advisor/,/^## Never/p' lib/effort-shift.md; }; echo "$(sec | grep -c 'on the written plan, before the')/$(sec | grep -c 'says whether it predates')/$(sec | grep -c 'and `analyzer` call it at most once per dispatch')/$(sec | grep -c 'loaded inline by the main loop follows the')/$(sec | grep -c 'no second call for the same recommendation')/$(sec | grep -c "ahead of writing a skill's plan")/$(sec | grep -c STEP)"
|
||||
EXPECT: 1/1/1/1/1/0/0
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/1/1/0/0
|
||||
3. lib/challenge-plan.md: main-loop advisor call before the first dispatch, challengers blind, summary lists advisor-driven changes.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'Advisor first (main loop)' lib/challenge-plan.md || true; })/$({ grep -c 'The advice never enters a challenger brief' lib/challenge-plan.md || true; })/$({ grep -c 'whatever summary template the caller prints' lib/challenge-plan.md || true; })/$({ grep -c 'revises the `PLAN` file on disk before the dispatch' lib/challenge-plan.md || true; })/$(awk '/^\*\*Advisor first/{a=NR} /^Dispatch THREE fresh/{d=NR} END{print (a>0 && a<d)}' lib/challenge-plan.md)"
|
||||
EXPECT: 1/1/1/1/1
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1/1/1
|
||||
4. lib/verify-secure-loop.md: five main-loop stuck lines, the STOP clause before the order invariant.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'with no main-loop advisor call since GATE 0' lib/verify-secure-loop.md || true; })/$({ grep -cF '`lib/effort-shift.md` § Advisor' lib/verify-secure-loop.md || true; })/$({ grep -c 'never$' lib/verify-secure-loop.md || true; })/$(awk '/the STOP carries its answer/{s=NR} /^## Order invariant/{o=NR} END{print (s>0 && s<o)}' lib/verify-secure-loop.md)/$({ grep -c 'NEVER a PASS' lib/verify-secure-loop.md || true; })"
|
||||
EXPECT: 5/5/3/1/2
|
||||
EVIDENCE: MET exit=0 marker-found :: 5/5/3/1/2
|
||||
5. agents/analyzer.md carries its dispatch-scoped one-call rule.
|
||||
CHECK: cd /home/bchanot/Documents/claude && echo "$({ grep -c 'Advisor, when dispatched as a sub-agent' agents/analyzer.md || true; })/$({ grep -c 'erroring → proceed' agents/analyzer.md || true; })/$({ grep -c 'never on the advice' agents/analyzer.md || true; })"
|
||||
EXPECT: 1/1/1
|
||||
EVIDENCE: MET exit=0 marker-found :: 1/1/1
|
||||
6. 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
|
||||
7. Full make test green (run 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
|
||||
8. Touched lines ≤ 80 columns; blocks applied verbatim from the plan; no other wording changed in the five files (manual).
|
||||
|
||||
## FILE SCOPE
|
||||
CLAUDE.global.md (§ Workflow bullet ~:81-88), lib/effort-shift.md (§ Advisor items), lib/challenge-plan.md (§ DISPATCH head), lib/verify-secure-loop.md (GATE 0/1/2 bullets ~:38, :78, :91, :110, :115), agents/analyzer.md (§ RULES).
|
||||
@@ -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,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,198 @@
|
||||
# PLAN — advisor call points, run A (r4 after re-challenge)
|
||||
Contract: .claude/tasks/contracts/2026-11-17-advisor-call-points-1130.md
|
||||
Branch: feature/advisor-call-points (off develop)
|
||||
|
||||
## Why
|
||||
User 2026-11-17 approved points 1 and 2 after transcript data: since /advisor
|
||||
(2026-11-16 16:19Z) the main loop called the advisor 2 times in 3 skill runs
|
||||
(served by Opus, 409k and 680k uncached input tokens each); 18 of 20 opus
|
||||
sub-agents called it (19 calls, Fable, median 70k tokens, 1.46M total); 0 of 8
|
||||
sonnet sub-agents. The doctrine of c3507ea ("main loop only") is inverted by the
|
||||
data on both use and cost. Reverses BDR-150's "sub-agents do not" for the three
|
||||
judgment agents.
|
||||
|
||||
## Files (5)
|
||||
1. CLAUDE.global.md § Workflow, lines 81-85: replace the whole "- Stronger model
|
||||
needed …" bullet with block A (verbatim; 8 lines, file 312 → 315, guard 320).
|
||||
2. lib/effort-shift.md § Advisor (lines 101-110): replace the section body
|
||||
(heading kept) with block B (verbatim). Nothing else in the file changes.
|
||||
3. agents/plan-challenger.md § RULES: append block C as the last bullet of the
|
||||
RULES list (before `## ORCHESTRATOR PROTOCOL`).
|
||||
4. agents/verifier.md § RULES: append block D as the last bullet of the RULES
|
||||
list (before `## ORCHESTRATOR PROTOCOL`).
|
||||
5. agents/security-auditor.md § RULES: append block E as the last bullet of the
|
||||
RULES list (before the next `## ` heading).
|
||||
|
||||
### Block A (CLAUDE.global.md)
|
||||
```
|
||||
- Stronger model needed (an approach to settle before building, a stuck
|
||||
problem, a long task before calling it done) → the main loop 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; plan-challenger, verifier
|
||||
and security-auditor at most once, before the verdict; other
|
||||
sub-agents do not. Fable is never routed or pinned: the router tops
|
||||
out at opus (BDR-150).
|
||||
```
|
||||
|
||||
### Block B (lib/effort-shift.md § Advisor body)
|
||||
```
|
||||
Fable runs as the advisor (settings `advisorModel`), never a route or pin
|
||||
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: ahead of writing a skill's plan (`/feat`,
|
||||
`/bugfix`, `/ship-feature`).
|
||||
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
|
||||
reuses that advice and says it predates the last iteration. The
|
||||
advice stays in the main loop: it feeds the main loop's own decision
|
||||
(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.
|
||||
|
||||
Sub-agents: plan-challenger, verifier and security-auditor call it at most
|
||||
once per dispatch, before their verdict; executors and every other
|
||||
sub-agent do not, even when the tool is listed.
|
||||
|
||||
Advisor absent or erroring (Fable out of credits, for example) → proceed
|
||||
as written. Advice is input, never consent: it waives no gate, cap or
|
||||
guard; at a loop cap it feeds the STOP diagnosis.
|
||||
```
|
||||
|
||||
### Block C (agents/plan-challenger.md)
|
||||
```
|
||||
- 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.
|
||||
```
|
||||
|
||||
### Block D (agents/verifier.md)
|
||||
```
|
||||
- Advisor (when listed): at most one call, 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
|
||||
no gap outside the contract's criteria. Advice alone never clears a
|
||||
gap and is never evidence for a MET: any change rests on your own
|
||||
re-read or run (STEP 2).
|
||||
```
|
||||
|
||||
### Block E (agents/security-auditor.md)
|
||||
```
|
||||
- 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.
|
||||
```
|
||||
|
||||
## Edge cases
|
||||
- Each block's lines ≤ 80 columns (block A keeps the 2-space bullet indent).
|
||||
- Blocks C-E sit inside the RULES list, keeping its blank-line-between-bullets
|
||||
style if the list uses one.
|
||||
- No other wording in the five files changes (wiring points, Limits, ask-tier,
|
||||
`## Never` untouched).
|
||||
|
||||
## Tests
|
||||
No hermetic test asserts this prose (grep lib/tests: none). Oracles are the
|
||||
contract's grep criteria + full `make test`. The doctrine-citers census (T6,
|
||||
lib/tests/doctrine-citers.test.sh:213-214) also scans CLAUDE.global.md, so block
|
||||
A's `~/.claude/lib/effort-shift.md` § Advisor citation is checked once it sits
|
||||
on one line (the extractor is per line; r4 keeps it on one line), and block
|
||||
B's `CLAUDE.global.md § Workflow` citation too.
|
||||
|
||||
## Split (user 2026-11-17)
|
||||
- Run A (this plan): doctrine + three judgment agents, 5 files.
|
||||
- Run B: inline advisor call lines at the step sites (plan step of skills/feat,
|
||||
skills/bugfix, skills/ship-feature; second-failure and cap sites in
|
||||
lib/verify-secure-loop.md; the merge proposal), citing
|
||||
`lib/effort-shift.md § Advisor`.
|
||||
- Run C (point 3): advisor usage counter as a section of /memory-feedback
|
||||
(user choice); dedupe usage rows by message.id, model from the
|
||||
`advisor_message` iteration, main transcript vs subagents/*.jsonl.
|
||||
- Stale citers for doc-sync / capitalize: README, USAGE, CHANGELOG
|
||||
[Unreleased] advisor bullet, BUGS-FOUND d292911 residual, BDR-150 status,
|
||||
LRN-294.
|
||||
|
||||
## Disposition
|
||||
- amends BDR-150 (its "sub-agents do not" clause, c3507ea) by allowing the three
|
||||
judgment agents one call; keeps "never routed or pinned".
|
||||
- applies LRN-294 only partly: sub-agents get the tool, CLAUDE.global.md and a
|
||||
harness prompt asking for "at least once before … and once before declaring
|
||||
done"; blocks C-E say the one-call rule overrides it, but that is prose
|
||||
against a harness instruction: logged as a BUGS-FOUND residual at capitalize.
|
||||
- honors BDR-066/LRN-083: loop decisions stay in the main loop; advice is input.
|
||||
|
||||
## r3 changes (challenge round 1: correctness FATAL(2), robustness CONCERNS(3), simplicity CONCERNS(1))
|
||||
- C1 BLOCKER oracle: contract criterion 2 counts STEP inside § Advisor only.
|
||||
- C2 BLOCKER + R5: block E routes an advisor-added/raised finding into STEP 5's
|
||||
merge and BLOCK(n), tagged `advisor-added` / `advisor-raised from <sev>` in
|
||||
<why>; REPORT written after the advisor call (R6).
|
||||
- R3: block D mirrors E (never clears NOT-MET, UNVERIFIABLE, FLOOR, out-of-scope;
|
||||
may add a gap at file:line); C5: MET evidence defers to STEP 2.
|
||||
- R4: block C "may add or sharpen, never drop or lower".
|
||||
- S1 + C4: block A minimal: keeps its generic triggers, points to
|
||||
`~/.claude/lib/effort-shift.md` § Advisor, no copied list.
|
||||
- S4 + R1 + C8: block B = the approved points only. One stuck call per loop at
|
||||
its second failure (structural failures included), the cap reuses it; "any
|
||||
non-trivial change" dropped; done + merge one point.
|
||||
- R2: second-failure advice stays in the main loop, never enters an executor
|
||||
brief (verify-secure-loop "nothing else" briefs kept).
|
||||
- S2: cost sentence and sub-agent evidence sentence moved out of block B (the
|
||||
rationale goes to the BDR-150 amendment).
|
||||
- R6 + C7: blocks C-E say "whatever the harness prompt schedules"; block B names
|
||||
the residual.
|
||||
- C6: main-loop calls served by Opus are explained by the /advisor output in
|
||||
this conversation ("keeps Opus until /clear"); doctrine names the advisor by
|
||||
`advisorModel`.
|
||||
- S3 rejected in part: the advice-specific clauses in C and D stay, because
|
||||
R3/R4 need them (they now carry new rules, not repeats).
|
||||
|
||||
## r4 changes (re-challenge: correctness CONCERNS(3), robustness CONCERNS(3), simplicity CONCERNS(1); no third round, these go to the CHALLENGE SUMMARY)
|
||||
- RC1/RR1: block A keeps "`~/.claude/lib/effort-shift.md` § Advisor" on one
|
||||
line so the per-line census extractor sees it; criterion 1 greps it.
|
||||
- RC2: contract criteria 1-5 carry `EVIDENCE: pending` (gates.sh ERROR otherwise).
|
||||
- RC3/RR2/RS2: block D: advice can only send the verifier back to a criterion;
|
||||
a resulting NOT-MET is tagged `(advisor-prompted)` and counts in STEP 5; no
|
||||
gap outside the criteria; advice alone never clears; no copied gap list.
|
||||
- RR3/RC5/RC6/RS3/RR8: block E: rule/check `advisor:<STEP 3 class>` or
|
||||
`<rule>+advisor`; severity = the matching STEP 3 class (overrides the STEP 2
|
||||
mapping for that finding only); no matching class → REPORTED, non-blocking
|
||||
(so one opinion cannot BLOCK, hence no /hotfix revert on opinion alone);
|
||||
PROOF gets `; advisor <n> added/raised`.
|
||||
- RR4: calls placed late: verifier/auditor after STEP 4 before STEP 5;
|
||||
challenger after drafting findings.
|
||||
- RS1/RR5/RC4: "advice alone never drops/lowers/clears": a change rests on the
|
||||
agent's own re-read, cited.
|
||||
- RR6: main loop stuck call once per verify-secure run; the STOP says the
|
||||
advice predates the last iteration.
|
||||
- RC7: block B points are a floor ("at least"), CLAUDE.global.md § Workflow
|
||||
triggers cover work outside them.
|
||||
- RS4: block B residual sentence dropped (BUGS-FOUND carries it); "whatever the
|
||||
harness prompt schedules" kept (one verifier made 2 calls on 2026-11-16).
|
||||
- RR7: live-install note: ~/.claude/CLAUDE.md and ~/.claude/agents are symlinks
|
||||
into this repo, so the edits apply to every session as soon as written,
|
||||
including this run's own verifier and security-auditor. Rollback:
|
||||
`git restore` of the five files on the branch.
|
||||
- Execution NEED-DECISION (internal, 2026-11-17): census read "§ Workflow
|
||||
names" as heading "Workflow names" (T3 DANGLING). Block B line reworded so the
|
||||
citation ends at "§ Workflow)". Agent RULES bullets sit tight under the
|
||||
previous bullet (the lists are tight), accepted.
|
||||
- Gate findings (security PASS + verifier CONFORME, 2026-11-17): block E r5.
|
||||
A raise keeps its own line (rule/check `<rule>+advisor`) so STEP 5 dedup counts
|
||||
it once; an added no-class finding is REPORTED as LOW; a raise with no class
|
||||
changes nothing.
|
||||
@@ -0,0 +1,84 @@
|
||||
# PLAN — advisor-doctrine (BDR-150 follow-up)
|
||||
|
||||
## APPROACH
|
||||
1. CLAUDE.global.md § Workflow: insert as a new bullet right after the
|
||||
"Sub-agents: one task each…" bullet, wrapped ≤ 80 columns, the user's
|
||||
text verbatim: "- Stronger model needed (an approach to settle before
|
||||
building, a stuck problem, a long task before calling it done) → call
|
||||
the advisor tool when it is listed (Fable, set by /advisor). Fable is
|
||||
never routed or pinned: the router tops out at opus (BDR-150)."
|
||||
2. lib/effort-shift.md:
|
||||
a. wiring point 5: "(`general-purpose` `model="opus"`, `model: "opus"`
|
||||
skill-runners) → explicit `effort=` on the Agent call (`xhigh` for
|
||||
opus reviewers, `high` for skill-runners)." Rest unchanged.
|
||||
b. Limits bullet: "…set the turn's effort only, never a model above the
|
||||
session model: Fable on main comes only from a hand pick (`/model`,
|
||||
picker), a typed `/route model=fable` or a machine override that puts
|
||||
fable in a tier (no shipped tier holds it, BDR-150)."
|
||||
c. ask-tier mention (~:92-94): "`/route ask-tier off|on` the ask before
|
||||
a route lifts main or a rowed agent onto Fable (inert unless a
|
||||
machine override heads `best` with fable)".
|
||||
d. new section "## Advisor" placed before "## Never" (or before
|
||||
"## Limits" if "## Never" is absent), ≤ 8 lines: Fable runs as the
|
||||
advisor (settings `advisorModel`), never a route or pin target
|
||||
(BDR-150). Call it before committing to an approach on non-trivial
|
||||
work, when stuck (the `escalate` moment, before raising effort to
|
||||
max), and before declaring a long task done. It is a server tool:
|
||||
the router cannot see or refuse it. The main loop calls it; do not
|
||||
assume a sub-agent has it.
|
||||
3. lib/challenge-plan.md ~:48 "(Fable through its best-tier row)" → "(opus
|
||||
through its best-tier row)"; ~:51 "the two merge gates sit on the
|
||||
`audit` row, Fable with an opus floor" → "… on the `audit` row, opus".
|
||||
4. agents/plan-challenger.md ~:111 "on Fable through its best-tier row" →
|
||||
"on opus through its best-tier row"; ~:115 "sit on the `audit` row,
|
||||
Fable with an opus floor" → "sit on the `audit` row, opus".
|
||||
5. skills/tour/SKILL.md ~:83 "security-auditor (`audit` row: Fable, opus
|
||||
floor)" → "security-auditor (`audit` row: opus)".
|
||||
|
||||
## EDGE CASES
|
||||
- Do not touch lib/effort-shift.md's /model dialog paragraph (fable is
|
||||
still offered there by hand, true).
|
||||
- doctrine-citers census in make test: headings cited elsewhere must stay
|
||||
intact; adding "## Advisor" changes no existing heading.
|
||||
|
||||
## DISPOSITION
|
||||
Honors BDR-150 (Fable = advisor, never routed or pinned) and the user's
|
||||
2026-11-16 wording choices. Amends nothing else.
|
||||
|
||||
## FILES
|
||||
CLAUDE.global.md, lib/effort-shift.md, lib/challenge-plan.md,
|
||||
agents/plan-challenger.md, skills/tour/SKILL.md.
|
||||
|
||||
## r2 (challenge r1: correctness CONCERNS(1), robustness CONCERNS(1), simplicity CONCERNS(1)) — amends APPROACH; final
|
||||
User answers 2026-11-17: only the main loop calls the advisor (sub-agents
|
||||
have the tool listed too: every challenger, gate and executor would send
|
||||
its whole transcript to Fable outside the router's caps); add the fallback
|
||||
"advisor absent or erroring → proceed as written"; wiring point 4 unchanged.
|
||||
1. CLAUDE.global.md § Workflow, new bullet right after the "Sub-agents: one
|
||||
task each…" bullet, text (user line, amended by the main-loop answer):
|
||||
"- Stronger model needed (an approach to settle before building, a stuck
|
||||
problem, a long task before calling it done) → the main loop calls the
|
||||
advisor tool when it is listed (Fable, set by /advisor); sub-agents do
|
||||
not. Fable is never routed or pinned: the router tops out at opus
|
||||
(BDR-150)." Wrap ≤ 80 columns like the neighbouring bullets (2-space
|
||||
continuation); the phrase "the advisor tool" stays on one line.
|
||||
2. lib/effort-shift.md:
|
||||
a. wiring point 5 as in APPROACH 2a.
|
||||
b. Limits: "Fable on main comes only from a hand pick (`/model`,
|
||||
picker), a typed `/route model=fable`, a phase naming `model: fable`
|
||||
or a machine override that puts fable in a tier (no shipped tier or
|
||||
phase holds it, BDR-150)." Keep "a typed `/route model=fable`" on one
|
||||
line.
|
||||
c. ask-tier as in APPROACH 2c; keep "inert unless a machine override"
|
||||
on one line.
|
||||
d. "## Advisor" placed right before "## Never": the APPROACH 2d text,
|
||||
with "The main loop calls it; sub-agents do not, even when the tool
|
||||
is listed. Advisor absent or erroring (Fable out of credits, for
|
||||
example) → proceed as written."
|
||||
3-5. As APPROACH 3-5. agents/plan-challenger.md: the second target spans
|
||||
lines 115-116 ("…sit on the `audit` row, Fable with an" / "opus
|
||||
floor.)"): replace across both lines → "…sit on the `audit` row,
|
||||
opus.)".
|
||||
6. Rollback: the five files are live machine-wide from the working tree;
|
||||
if anything misbehaves, `git checkout develop -- <the 5 files>`. Do not
|
||||
run gates mid-edit.
|
||||
@@ -0,0 +1,176 @@
|
||||
# PLAN — advisor call points, run B1 (r4)
|
||||
Contract: .claude/tasks/contracts/2026-11-17-advisor-points-b1-1500.md
|
||||
Branch: feature/advisor-points-b1 (off develop)
|
||||
|
||||
## Why
|
||||
User 2026-11-17 "oui a, b et c dans la run B": outside the named points,
|
||||
advisor use rested on judgment and under-fired. (a) the main loop's plan point
|
||||
moves into lib/challenge-plan.md, wired into 12 skills (9 core + seo, geo,
|
||||
web-validate packs), once per skill run; (b) the dispatched `analyzer` joins the
|
||||
judgment agents; (c) trigger "before recommending a change to the doctrine, the
|
||||
architecture or a public interface". Stuck point: inline at the verify-secure
|
||||
loop sites, counting main-loop calls only. B2 (separate run): stuck trigger in
|
||||
the gate bullets of skills/feat, bugfix, ship-feature, init-project; merge lines
|
||||
(ship-feature STEP 9, release-candidate STEP 4); security-auditor severity
|
||||
direction; file count settled there.
|
||||
|
||||
## Exact edit (deterministic)
|
||||
The edits are the blocks below, applied by
|
||||
/tmp/claude-1000/-home-bchanot-Documents-claude/4ba4524e-88fb-4f6c-a31d-fedd261f8925/scratchpad/b1/apply.py
|
||||
(`python3 apply.py <blocks dir> <repo root>`; blocks dir = .../scratchpad/b1).
|
||||
It asserts every anchor occurs exactly once and fails loudly otherwise.
|
||||
Summary of what it does, by file:
|
||||
1. CLAUDE.global.md § Workflow: the whole "- Stronger model needed … (BDR-150)."
|
||||
bullet → block A (file 315 → 316 lines, guard 320).
|
||||
2. lib/effort-shift.md § Advisor: item 1 (2 lines) → B1; the line " reuses that
|
||||
advice and says it predates the last iteration. The" → B1b; after item 3
|
||||
("…calling a long task\n done.") insert I; the "Sub-agents: …listed."
|
||||
paragraph → B2.
|
||||
3. lib/challenge-plan.md: after "— which is the point." insert H; before
|
||||
"Dispatch THREE fresh" insert C; the 2-line CHALLENGE SUMMARY bullet in
|
||||
§ OUTPUT → F.
|
||||
4. lib/verify-secure-loop.md (inserts only): Dfloor after "then STOP + human
|
||||
escalation with the rows."; Dconf after " CRITERIA table (the
|
||||
contract-vs-realized diff)."; Dstruct after " A mute verifier is NEVER a
|
||||
PASS."; Dsec after " `/route effort=max` (sticky, `/route clear` after).";
|
||||
Dstruct after " auditor is NEVER a PASS."; G before "## Order invariant".
|
||||
5. agents/analyzer.md § RULES: E after "- Do not modify files".
|
||||
|
||||
### Block A
|
||||
```
|
||||
- Stronger model needed (an approach to settle before building, a stuck
|
||||
problem, a long task before calling it done, before recommending a change
|
||||
to the doctrine, the architecture or a public interface) → the main loop
|
||||
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).
|
||||
```
|
||||
|
||||
### Block B1
|
||||
```
|
||||
1. Before settling an approach: on the written plan, before the
|
||||
challengers see it (`lib/challenge-plan.md`), at most once per skill run.
|
||||
```
|
||||
|
||||
### Block B1b
|
||||
```
|
||||
reuses that advice and says whether it predates the last iteration. The
|
||||
```
|
||||
|
||||
### Block I
|
||||
```
|
||||
Inside a skill run, the points above also cover the triggers of
|
||||
CLAUDE.global.md § Workflow; no second call for the same recommendation.
|
||||
```
|
||||
|
||||
### Block B2
|
||||
```
|
||||
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.
|
||||
```
|
||||
|
||||
### Block H
|
||||
```
|
||||
The main loop's advisor call before the dispatch (below) is the costliest
|
||||
single item: once per skill run.
|
||||
```
|
||||
|
||||
### Block C
|
||||
```
|
||||
**Advisor first (main loop).** Before the first dispatch, with no main-loop
|
||||
advisor call since the skill run started (so at most once per skill run, not
|
||||
before a re-challenge), the main loop reads the `PLAN` file unless its full
|
||||
text is already in this conversation, then calls the advisor when the tool
|
||||
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.
|
||||
The advice never enters a challenger brief: they stay blind.
|
||||
|
||||
```
|
||||
|
||||
### Block F
|
||||
```
|
||||
- a CHALLENGE SUMMARY: each BLOCKER raised → the named change that closed it;
|
||||
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)`.
|
||||
```
|
||||
|
||||
### Block Dfloor
|
||||
```
|
||||
A second UNMET with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
```
|
||||
|
||||
### Block Dconf
|
||||
```
|
||||
A second ECARTS with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
```
|
||||
|
||||
### Block Dsec
|
||||
```
|
||||
A second BLOCK with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
```
|
||||
|
||||
### Block Dstruct
|
||||
```
|
||||
A 2nd structural failure with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls it before escalating
|
||||
(`lib/effort-shift.md` § Advisor).
|
||||
```
|
||||
|
||||
### Block G
|
||||
```
|
||||
Every cap or escalation STOP above: when the main loop consulted the advisor
|
||||
since GATE 0 first ran, the STOP carries its answer and says whether it
|
||||
predates the last iteration.
|
||||
|
||||
```
|
||||
|
||||
### Block E
|
||||
```
|
||||
- Advisor, when dispatched as a sub-agent: at most one call, 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
|
||||
alone. Advice proposing a design or a fix counts only where the brief
|
||||
asks for a fix.
|
||||
```
|
||||
|
||||
## Edge cases
|
||||
- Every new line ≤ 80 columns; every `§ Label` citation on one line followed by
|
||||
`)` or `;` (census extractor: 6 × effort-shift § Advisor, 2 × CLAUDE.global.md
|
||||
§ Workflow) — checked by script.
|
||||
- Contract CHECKs 1-5 simulated on a scratch copy with apply.py: all equal EXPECT.
|
||||
- Stuck-call unit counts main-loop calls only; plan point skipped when the main
|
||||
loop already consulted the advisor in this skill run.
|
||||
- lib/tests pin "NEVER a PASS" lines: unchanged.
|
||||
|
||||
## Tests
|
||||
None added (prose). Oracles: contract greps; fast census
|
||||
`bash lib/tests/doctrine-citers.test.sh`; full `make test`.
|
||||
|
||||
## Disposition
|
||||
- amends BDR-150 (6ef3069): plan point in challenge-plan; analyzer joins; (c).
|
||||
- honors LRN-294 / BUGS-FOUND residual: prose; run C measures.
|
||||
- honors BDR-066 / LRN-083: advice stays in the main loop, never in an executor
|
||||
or challenger brief, never attributed in the plan file.
|
||||
- applies LRN-295 cost: at most one plan call per skill run, at most one stuck
|
||||
call per verify-secure run, no second call for the same recommendation.
|
||||
@@ -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).
|
||||
+6
-1
@@ -10,16 +10,19 @@ 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 %.
|
||||
- **memory digest TODO lines**: with no `## Actionable` (or `### Actionable`) section, the digest now shows the TODO file's first 3 unchecked top-level items instead of none, and items inside HTML comments are ignored. When the 800-character cap drops TODO lines, a `- todo: +N not shown, read .claude/tasks/TODO.md` line counts them. `/init-project`, `/onboard` and `/capitalize` seed new TODO files with a `## Actionable` section. The session-start doctrine (`CLAUDE.global.md`) now trusts the digest and reads `.claude/tasks/TODO.md` only when no digest prints or the task needs it.
|
||||
- **Skill routing (`CLAUDE.global.md`)**: routing lines a skill's own description already covers move there (bugfix, feat/hotfix split, ship-feature, tour, reconcile, capitalize, close); the section keeps the gstack cases (investigate on explicit ask, gstack ship retired per BDR-105), the pack-off SEO/GEO/W3C line (`profile.sh enable seo|web-validate`), `cso` and media. `/bugfix` triggers gain "error", "500", "stack trace + fix"; `/ship-feature` gains "ship this feature".
|
||||
- **model-router**: the `fable` alias resolves to `claude-fable-5-2` (was `claude-fable-5-1`); every phase, row and skill pin naming `fable` follows. Kit tests updated.
|
||||
- **model-router**: the `fable` alias resolves to `claude-fable-5-2` (was `claude-fable-5-1`); the alias table follows. Kit tests updated.
|
||||
- **memory feedback**: precision, trigger precision and the miss share count only rows after the gate-1 fix (merge 2026-11-12T19:53:59Z); their actions wait for 20 post-fix asks (`Post-fix prompt asks: k/20` in FEEDBACK.md, one `NEW: post-fix prompt sample reached` line) and the session reminder keeps prompting until then. The third-pick signal is retired (recall keeps 2 picks). The reader holds one parsed transcript at a time; `labels.tsv` rows and `state.json` are validated on read.
|
||||
- **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`, `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.
|
||||
|
||||
### 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.
|
||||
@@ -40,6 +43,8 @@ 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).
|
||||
|
||||
## [3.0.0] — 2026-11-12
|
||||
|
||||
|
||||
@@ -78,6 +78,15 @@ code" wins. Repo-specific instructions override both.
|
||||
command is reported with its rule (a guard redirect naming a skill is
|
||||
followed instead), never rerun through a wrapper, alias, env
|
||||
file or other shell. Hermetic tests run through `make test [suite=…]` only.
|
||||
- Stronger model needed (an approach to settle before building, a stuck
|
||||
problem, a long task before calling it done, before recommending a change
|
||||
to the doctrine, the architecture or a public interface) → the main loop
|
||||
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).
|
||||
- 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;
|
||||
|
||||
@@ -71,20 +71,37 @@ commands, settings, secrets, maintenance.
|
||||
## Agent model routing (model-tiering v2)
|
||||
|
||||
Doctrine: the main loop runs on the `opus` session model; the model-router rows
|
||||
route main-loop reflection (brainstorm, plan, contract,
|
||||
audit judgment, loop 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 writes no code outside a skill run (the router's guard
|
||||
redirects it to a skill); the fresh gates run as dispatched agents on the `audit` row. The
|
||||
Fable/Opus model floor is enforced by a blocking gate (`lib/model-gate.md`) at
|
||||
the entry of the 17 reflection skills (the orchestrators, `/analyze`,
|
||||
`/guardrails` and `/a11y`): the skill calls the model-router `route` tool and
|
||||
its answer, which names the model id the main loop runs on, is the witness. A
|
||||
non-Fable/Opus id or the mod off stops the skill (`/route on` resumes the
|
||||
mod). Inside a sub-agent the answer says the model is `fixed at spawn`, and
|
||||
the skill proceeds. Nothing dispatched inherits silently: typed agents run on
|
||||
their model-router row, their `model:` frontmatter being the off-state floor;
|
||||
built-ins get an explicit `model=` at every call site.
|
||||
route main-loop reflection (brainstorm, plan, contract, audit judgment, loop
|
||||
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
|
||||
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 (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
|
||||
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 do not, even when the tool is listed. 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
|
||||
gates run as dispatched agents on the `audit` row. The Fable/Opus model floor is
|
||||
enforced by a blocking gate (`lib/model-gate.md`) at the entry of the 17
|
||||
reflection skills (the orchestrators, `/analyze`, `/guardrails` and `/a11y`):
|
||||
the skill calls the model-router `route` tool and its answer, which names the
|
||||
model id the main loop runs on, is the witness. A non-Fable/Opus id or the mod
|
||||
off stops the skill (`/route on` resumes the mod). Inside a sub-agent the answer
|
||||
says the model is `fixed at spawn`, and the skill proceeds. Nothing dispatched
|
||||
inherits silently: typed agents run on their model-router row, their `model:`
|
||||
frontmatter being the off-state floor; built-ins get an explicit `model=` at
|
||||
every call site.
|
||||
|
||||
| Agent | Model | Tier |
|
||||
|---|---|---|
|
||||
@@ -142,7 +159,7 @@ effort, never version. Transcript audit `python3 lib/effort-audit.py`.
|
||||
- Main loop: every request gets the route in force. A typed skill with a row routes the main loop to it; a best-tier row (`plan`, `reflect`, `orchestrate`, `escalate`; `audit` is an agent row, never typed) holds across turns in a run slot until `/route clear`, `/route off`, a user `/model` (typed with a name, bare, or picked in the `/model` picker, it asks the scope: this project, this conversation, everywhere) or a typed skill on a non-best row. A skill without a row leaves the route as it is. A rowed skill the model loads inside a best-tier run moves effort only when its row ranks below the run's model. Main routed onto a model whose context window the conversation outgrew returns to the session model. Before main runs on a model, the one it moves to or the one it keeps (the session's own model included), the mod probes it with one small completion bounded to 8 seconds; the step (and `/route show`, the route tool's answer) waits for it. A timeout or an error marks the model down (reason `probe`, held for `cooldownMinutes` like any breaker hold) and the decision is taken again once. A model already marked down is never probed, and a model that answered is not probed again, `/clear` included, until it is marked down. When a lower model stands in for its tier's head held down (Sonnet for Opus on a best-tier phase; Opus for Fable when a machine override heads `best` with fable), the phase's own effort goes one notch up: `reflect` xhigh, `plan` max, `orchestrate` high, `escalate` stays max. An effort asked explicitly (`/route ... effort=`, the `route` tool's `effort`) or set by a floor is never raised. `/route show` and the route tool's answer print the level with `(<model> stands in for <head>)`, `(sonnet stands in for opus)` with the shipped tiers; the verbose transition line names `stand-in` as a cause.
|
||||
- Sub-agents: a routed agent gets its row's model at spawn, within its tier and only upward from its frontmatter model, and the row's effort on every step. Explicit `model` / `effort` params on the Agent call win; a project-defined agent of the same name keeps its own definition. Built-ins: Explore runs on sonnet/medium, Plan on opus/xhigh. A built-in `general-purpose` agent that main spawns with no `model` param, while main runs below the session model (a downgrade or a breaker fallback), starts on the session model instead of inheriting the lower one; it is not pinned when the session model is marked down, for a fork, a workflow or a nested spawn, or when a project or user definition shadows the built-in. Other agent types are never pinned this way: the hook cannot see their frontmatter model.
|
||||
- Write guard: a main-loop Edit, Write or NotebookEdit of a code file is redirected with "model-router: code is written inside a skill run…" until a skill ran on the main loop in the session (typed or loaded by the model; a refused or unknown skill does not count), a phase was declared this turn, or a typed `/route` holds. Free paths: `.md`, `.txt`, the project's `.claude/` except `worktrees/`, and `docs/`. Sub-agents write freely. If the guard's own check fails (throw or timeout), it holds such a write instead of letting it through, with "model-router: the write guard failed (<kind>), so this write is held…", logged once per session; sub-agents, a skill run, a declared phase or a typed `/route`, and `.md` / `.txt` files still pass, and an error raised by the tool itself is passed on unchanged. `/route clear`, `/route off` and `/clear` re-arm the guard; `/route off` also turns it off, and `"enabled": false` in `~/.claude/model-router.json` turns the router and the guard off. A `/model` hand pick does not open it, and a `register.ts` reload resets it.
|
||||
- Levers inside a run: `ultrathink` in a prompt sets the turn's minimum effort; `/route effort=max` holds until `/route clear`. Keyword prompt rules (`plan`, `design`, `architecture`… take plan's effort; `why`, `review`, `audit`… reflect's), `ultrathink` and a main Agent dispatch (the derived `orchestrate` route, held until its background agents end) set the turn's effort only, never a model: they never lift main above the session model, and a held best-tier run keeps its model. Fable on main comes only from a hand pick (`/model`, picker), a typed `/route model=fable` or a machine override that puts fable in a tier: no shipped tier holds it. The built-in `/effort` is not a lever inside a run, rows and routes outrank it.
|
||||
- Levers inside a run: `ultrathink` in a prompt sets the turn's minimum effort; `/route effort=max` holds until `/route clear`. Keyword prompt rules (`plan`, `design`, `architecture`… take plan's effort; `why`, `review`, `audit`… reflect's), `ultrathink` and a main Agent dispatch (the derived `orchestrate` route, held until its background agents end) set the turn's effort only, never a model: they never lift main above the session model, and a held best-tier run keeps its model. Fable on main comes only from a hand pick (`/model`, picker), a typed `/route model=fable`, a phase naming `model: fable` or a machine override that puts fable in a tier: no shipped tier or phase holds it. The built-in `/effort` is not a lever inside a run, rows and routes outrank it.
|
||||
- `/model` scope: a pick in the `/model` picker is held first (the engine prints that a hook blocked it), then the same question as `/model <name>` comes. A bare `/model` opens the router's model, variant and scope dialog: fable (labelled `fable (custom)`, it heads no shipped tier), opus or sonnet, then Standard or `[1m]`, then the scope, the current model included; `Other model (native picker)` opens the native picker (haiku goes through it or `/model haiku`) and Esc changes nothing. A pick while another dialog is open is refused with `answer the open dialog first`. The picker's Default, an unknown name or a headless run go native, no question. A model chosen in that dialog (a hand pick) always switches: no cold-read cap, no `mainUpgrade` or `mainModelSwitch` flag. A hand pick marked down keeps main where it is until it is back. A native switch (the `/config` Model row included) or `/clear` drops a hand pick; a typed `/route model=` keeps the caps.
|
||||
- Prompt classifier: a plain prompt typed in the composer (12 characters or more, not a slash command) that no keyword rule, skill, run slot, `/route` or floor covers is sent to the engine's small fast model, one call, bounded to 3 seconds (the prompt waits for it, typically under a second). The label (`design`, `analysis`, `coding`, `bookkeeping`, `chat`) maps to plan, reflect, implement or apply (`chat` routes nothing), and the turn takes that phase's route: its effort becomes the turn's default, and its model may move the main loop, never above the session model. A `coding` or `bookkeeping` guess moves main down only when `mainModelSwitch` is on and the cold read fits `downgradeMaxTokens`; an `ultrathink` floor in the same turn raises the effort only, the guess's model holds. No dialog opens and no file is written. The route is gone at the end of the turn, a later route call or typed skill replaces it, and a `/effort` you type between turns drops the guess for that turn only. A typed best-tier skill holds its run slot across turns, so nothing is classified there until `/route clear`. Long prompts are sampled (first 500 and last 1500 code points), so pasted text at the end can steer one turn's route. Three failures in a row pause it for `cooldownMinutes` (one toast, `classifier: paused` in the status line). Never in a sub-agent, mid-turn or under `-p`. Off per session with `/route classify off`, per machine with `"classify": false`. The status line reads `route: classifier <phase>`; `/route verbose on` adds the transition line.
|
||||
- `/route` (user command) shows or sets the route: `show`, `clear`, `off`, `on`, `reload`, `pending` (rows and phases not confirmed yet), `ask on|off` (first-use dialog on or off), `ask-tier on|off` (the ask before Fable, below), `forget <name|all|projects>` (takes decisions back: a changed row returns to its shipped phase; `all` and `projects` ask first), a phase name, `model=<alias|id> effort=<level>`, `switch on|off`, `classify on|off` (the prompt classifier, below), `verbose on|off` (logs transitions only: each change of model or effort, with a few words of cause). `/route show` names the run slot when one holds (`main: run <phase>`) and prints the switch with its cap and the prompt-cache TTL (`switch: on (downgrade, cap 120000 tokens cold, ttl 60 min)`) and `ask-tier:` (`best`, `best (paused this session)`, `off`, or `inert` while `best` is not headed by fable). The model sets routes through a `route` tool.
|
||||
@@ -169,7 +186,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`).
|
||||
|
||||
@@ -253,7 +270,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é ou une config machine qui le place dans un tier : aucun tier livré ne le contient. 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 config machine coupe cet essai, et `/route show` affiche `probe:`. Quand un modèle inférieur remplace la tête de son tier en panne (Sonnet pour Opus sur une phase best ; Opus pour Fable si une config machine met fable en tête de best), le niveau propre de la phase monte d'un cran (reflect xhigh, plan max, orchestrate high) ; un niveau demandé explicitement ou un plancher ne bouge jamais. Les sous-agents reçoivent le modèle de leur ligne au lancement (dans leur tier, jamais en dessous de leur frontmatter) et son niveau à chaque étape ; un `model` ou `effort` explicite sur l'appel gagne. Explore tourne en sonnet/medium, Plan en opus/xhigh. Un agent intégré `general-purpose` lancé par la boucle principale sans `model`, pendant que celle-ci tourne sous le modèle de la session (descente, ou repli quand un modèle est en panne), part sur le modèle de la session au lieu d'hériter du modèle inférieur ; les autres types d'agents ne sont jamais épinglés ainsi. `/route show` affiche la route en cours, slot de run compris (`main: run <phase>`), et le switch avec son plafond et ce TTL (`switch: on (downgrade, cap 120000 tokens cold, ttl 60 min)`). Première utilisatLine 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é), 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 et `analyzer` 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 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 toLine 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`).
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ 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
|
||||
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
|
||||
alone. Advice proposing a design or a fix counts only where the brief
|
||||
asks for a fix.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -97,23 +97,31 @@ 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 dispatched as a sub-agent: 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.
|
||||
|
||||
## 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.
|
||||
- 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
|
||||
JUDGMENT, not a procedural gate — the challenger is routed to the `judge`
|
||||
row (opus) by the model-router, the `model: opus` frontmatter being the
|
||||
off-state floor (big tier; the main loop, on Fable through its best-tier
|
||||
off-state floor (big tier; the main loop, on opus through its best-tier
|
||||
row, stays inline).
|
||||
Never `model: "sonnet"` — a silent judgment downgrade. (Contrast the
|
||||
executors on their `implement` row, sonnet, oracle-anchored to a contract;
|
||||
the verifier and security-auditor sit on the `audit` row, Fable with an
|
||||
opus floor.)
|
||||
the verifier and security-auditor sit on the `audit` row, opus.)
|
||||
- FAIL-SAFE — never fail open: a malformed/empty verdict, a missing `PROOF`, or
|
||||
a dead challenger → retry ONCE fresh; a 2nd failure → escalate to the human and
|
||||
NAME the lens. Never report "plan challenged" on a silently dropped lens (same
|
||||
@@ -127,5 +135,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.
|
||||
@@ -157,6 +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 dispatched as a sub-agent: 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>`; 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)
|
||||
|
||||
@@ -167,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.
|
||||
@@ -158,6 +158,14 @@ 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 dispatched as a sub-agent: at most one call, 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
|
||||
no gap outside the contract's criteria. Advice alone never clears a
|
||||
gap and is never evidence for a MET: any change rests on your own
|
||||
re-read or run (STEP 2).
|
||||
|
||||
## ORCHESTRATOR PROTOCOL (consumer contract — wiring reference)
|
||||
|
||||
|
||||
+19
-3
@@ -27,9 +27,22 @@ explicitly deferred for the human.
|
||||
Nominal path is cheap for a small, clean plan: three parallel challengers return
|
||||
SOLID, synthesis is a no-op. It only costs more when a lens lands a real finding
|
||||
— which is the point.
|
||||
The main loop's advisor call before the dispatch (below) is the costliest
|
||||
single item: once per skill run.
|
||||
|
||||
## DISPATCH — three fresh challengers, in parallel, blind
|
||||
|
||||
**Advisor first (main loop).** Before the first dispatch, with no main-loop
|
||||
advisor call since the skill run started (so at most once per skill run, not
|
||||
before a re-challenge), the main loop reads the `PLAN` file unless its full
|
||||
text is already in this conversation, then calls the advisor when the tool
|
||||
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.
|
||||
The advice never enters a challenger brief: they stay blind.
|
||||
|
||||
Dispatch THREE fresh `plan-challenger` subagents IN PARALLEL, one per LENS, each
|
||||
blind to the others and to this conversation:
|
||||
|
||||
@@ -45,10 +58,10 @@ Agent(subagent_type="plan-challenger", description="challenge:<lens>", prompt=""
|
||||
**MODEL (BDR-076, supersedes the BDR-066 inherit):** plan critique is AUDIT
|
||||
JUDGMENT — the challengers are routed to the `judge` row (opus) by the model-router,
|
||||
the `model: opus` frontmatter being the off-state floor: a big tier, off
|
||||
the main loop. The main loop (Fable through its best-tier row)
|
||||
the main loop. The main loop (opus through its best-tier row)
|
||||
keeps only this loop — synthesis, RE-THINK, gate. Never sonnet: that would
|
||||
silently downgrade the judgment. (The executors stay sonnet; the two merge
|
||||
gates sit on the `audit` row, Fable with an opus floor.)
|
||||
gates sit on the `audit` row, opus.)
|
||||
|
||||
**Lens framing by `KIND`** (the agent's three lenses, read against the artifact):
|
||||
- `build-plan` — will it WORK / will it BREAK / is it needlessly COMPLEX.
|
||||
@@ -87,6 +100,9 @@ Parse each `CHALLENGE — LENS: … — VERDICT:` line and merge the FINDINGS:
|
||||
Feed the orchestrator's gate:
|
||||
- the REVISED plan, and
|
||||
- a CHALLENGE SUMMARY: each BLOCKER raised → the named change that closed it;
|
||||
anything `[deferred]`; and any lens that failed to return.
|
||||
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)`.
|
||||
|
||||
The human remains the decider.
|
||||
+57
-6
@@ -28,8 +28,8 @@ load; a skill without one changes nothing, the last ROWED skill wins.
|
||||
ship-feature STEP 4b. Not automatic: the challenge fail-safe and "gone
|
||||
WRONG → STOP"; their STOP text names the levers below.
|
||||
5. Built-in judgment dispatch (`general-purpose` `model="opus"`, `model:
|
||||
"fable"` skill-runners) → explicit `effort=` on the Agent call (`xhigh`
|
||||
for opus reviewers, `high` for fable runners). A main route never
|
||||
"opus"` skill-runners) → explicit `effort=` on the Agent call (`xhigh`
|
||||
for opus reviewers, `high` for skill-runners). A main route never
|
||||
reaches a child. Typed agents run on their row, never on a shift.
|
||||
6. After a prose gate that ends the turn, the resumed reflection phase
|
||||
starts with its own route call.
|
||||
@@ -82,20 +82,71 @@ back; the window guard needs a `windows` entry (none shipped). A typed
|
||||
- Keyword prompt rules (`plan|design|architecture…`,
|
||||
`why|review|audit…`), `ultrathink` and a background agent
|
||||
dispatch (derived `orchestrate`) set the turn's effort only, never
|
||||
a model above the session model: Fable on main comes only from a
|
||||
skill row, the `route` tool, a typed `/route` or a hand pick (`/model`,
|
||||
picker).
|
||||
a model above the session model: Fable on main comes only from a hand
|
||||
pick (`/model`, picker), a typed `/route model=fable`, a phase naming
|
||||
`model: fable` or a machine override that puts fable in a tier (no
|
||||
shipped tier or phase holds it, BDR-150).
|
||||
- Mod off: typed agents fall back to their `model:`/`effort:` frontmatter.
|
||||
- First use of a row asks once, with context (Later, Keep or Change: model,
|
||||
then effort, then Everywhere or this project only); the answer is kept in
|
||||
`mods/model-router/routing.json`. `/route pending` lists what is still
|
||||
unconfirmed, `/route ask off|on` toggles the dialog, `/route ask-tier
|
||||
off|on` the ask before a route lifts main or a rowed agent onto Fable,
|
||||
off|on` the ask before a route lifts main or a rowed agent onto Fable
|
||||
(inert unless a machine override heads `best` with fable),
|
||||
`/route forget <name|all|projects>` takes a decision back.
|
||||
|
||||
Measure the split any time: `python3 ~/.claude/lib/effort-audit.py`
|
||||
(thinking/output/cache tokens per scope, model and effort).
|
||||
|
||||
## Advisor
|
||||
|
||||
Fable runs as the advisor (settings `advisorModel`), never a route or pin
|
||||
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.
|
||||
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
|
||||
reuses that advice and says whether it predates the last iteration. The
|
||||
advice stays in the main loop: it feeds the main loop's own decision
|
||||
(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. 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.
|
||||
|
||||
Advisor absent or erroring (Fable out of credits, for example) → proceed
|
||||
as written. Advice is input, never consent: it waives no gate, cap or
|
||||
guard; at a loop cap it feeds the STOP diagnosis.
|
||||
|
||||
## Never
|
||||
|
||||
- A route inside a dispatched agent: its row rules there.
|
||||
|
||||
+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 ]
|
||||
@@ -36,6 +36,10 @@ single `GATES — VERDICT:` line:
|
||||
nothing else; re-run GATE 0. **No verifier is dispatched** — a red build or
|
||||
a red suite is not a judgement call, and paying an LLM to discover it is
|
||||
waste. **Max 3 floor iterations** → `mcp__model-router__route(phase="escalate")` (route: cap reached, diagnose at max before escalating; send it with the first tool call that gathers the escalation evidence), then STOP + human escalation with the rows.
|
||||
A second UNMET with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
- `ABANDONED(n)` → floor green but a handoff stands. Continue to GATE 1; the
|
||||
verifier surfaces it and its `ABANDONED(n)` verdict routes to the human
|
||||
gate.
|
||||
@@ -76,6 +80,10 @@ Parse its single `VERIFY — VERDICT:` line:
|
||||
re-dispatch a FRESH verifier. Repeat.
|
||||
**Max 3 conformity iterations** → `mcp__model-router__route(phase="escalate")` (route: cap reached, diagnose at max before escalating; send it with the first tool call that gathers the escalation evidence), then STOP + human escalation with the
|
||||
CRITERIA table (the contract-vs-realized diff).
|
||||
A second ECARTS with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
- `ABANDONED(n)` → direct human gate, never a dev loop (a dev cannot close
|
||||
what was proven impossible). The human lifts the abandonment or accepts
|
||||
the partial delivery; either way the run is never reported as fully
|
||||
@@ -89,6 +97,9 @@ Parse its single `VERIFY — VERDICT:` line:
|
||||
unparsable, crash, `CONFORME` without `PROOF` or without `FLOOR`) → retry
|
||||
ONCE with a fresh verifier; a 2nd structural failure → human escalation.
|
||||
A mute verifier is NEVER a PASS.
|
||||
A 2nd structural failure with no main-loop advisor call since GATE 0
|
||||
first ran → the main loop calls it before escalating
|
||||
(`lib/effort-shift.md` § Advisor).
|
||||
|
||||
## GATE 2 — SECURITY (fresh security-auditor)
|
||||
|
||||
@@ -99,7 +110,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
|
||||
@@ -108,11 +123,19 @@ Parse its single `SECURITY — VERDICT:` line:
|
||||
BLOCKING table. Every STOP text names the level reached (`$CLAUDE_EFFORT`)
|
||||
and suggests relaunching with `ultrathink` in the prompt (turn floor) or
|
||||
`/route effort=max` (sticky, `/route clear` after).
|
||||
- `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.
|
||||
A second BLOCK with no main-loop advisor call since GATE 0 first ran →
|
||||
the main loop calls it before the re-dispatch
|
||||
(`lib/effort-shift.md` § Advisor); the answer stays here, never
|
||||
in the dev brief.
|
||||
- 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
|
||||
first ran → the main loop calls it before escalating
|
||||
(`lib/effort-shift.md` § Advisor).
|
||||
|
||||
Every cap or escalation STOP above: when the main loop consulted the advisor
|
||||
since GATE 0 first ran, the STOP carries its answer and says whether it
|
||||
predates the last iteration.
|
||||
|
||||
## Order invariant
|
||||
|
||||
|
||||
@@ -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)>
|
||||
```
|
||||
|
||||
- "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)>
|
||||
|
||||
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)>
|
||||
|
||||
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)>
|
||||
Approve and start? (yes / request changes)
|
||||
```
|
||||
Changes → back to STEP 6. Approved → continue.
|
||||
@@ -267,6 +268,10 @@ 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 —
|
||||
@@ -351,6 +356,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
|
||||
|
||||
|
||||
@@ -917,7 +917,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 +961,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)>
|
||||
|
||||
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)>
|
||||
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)>
|
||||
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)>
|
||||
|
||||
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)>
|
||||
Approve and execute? (yes / request changes)
|
||||
```
|
||||
This block EXPOSES each in-force item with the plan's CLAIMED disposition, for human
|
||||
@@ -249,6 +250,10 @@ 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 —
|
||||
@@ -315,6 +320,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
|
||||
|
||||
+12
-3
@@ -80,7 +80,7 @@ Model discipline (the user-fixed invariant behind this mode):
|
||||
carries this skill's reflection (fix decisions, convergence calls); it
|
||||
must never be pinned down to an executor tier.
|
||||
- Inside a runner, every dispatched agent keeps the tier this skill
|
||||
already defines: security-auditor (`audit` row: Fable, opus floor), the
|
||||
already defines: security-auditor (`audit` row: opus), the
|
||||
Phase B audit (analyzer opus pin or `model="opus"`), doc-syncer (audit on
|
||||
`model="opus"`, patch on its sonnet frontmatter — BDR-077).
|
||||
|
||||
@@ -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).
|
||||
@@ -261,6 +264,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