From beebfe2d8281ee919e96d3b57138f34756949f87 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 23:55:31 +0100 Subject: [PATCH 1/4] feat(routing): skill-runner pins move from fable to opus Fable is the advisor (BDR-150): the client-handover skill-runner children and the model-gate dispatch doctrine pin opus. A pinned child's route answer "fixed at spawn" passes the gate; a repo-wide census refuses any fable pin. --- agents/client-handover-writer.md | 14 +++++++------- lib/model-gate.md | 9 +++++---- lib/tests/effort-routing.test.sh | 6 ++++-- lib/tests/model-routing.test.sh | 14 ++++++++------ skills/client-handover/SKILL.md | 2 +- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/agents/client-handover-writer.md b/agents/client-handover-writer.md index a696067..00e27ec 100644 --- a/agents/client-handover-writer.md +++ b/agents/client-handover-writer.md @@ -267,10 +267,10 @@ the gate. **Model routing (BDR-077):** EVERY `general-purpose` skill-runner dispatch in this pipeline (initial audits, fix-loop re-dispatches, commit-change, -web-validate) carries `model: "fable"` and `effort="high"` — the child hosts gated +web-validate) carries `model: "opus"` and `effort="high"` — the child hosts gated orchestration on the pipeline's behalf; it must never inherit the session model. -For web projects, dispatch in **a single message with two parallel Agent calls** (each with `model: "fable"`, `effort="high"`): +For web projects, dispatch in **a single message with two parallel Agent calls** (each with `model: "opus"`, `effort="high"`): | Audit (web) | Subagent | Prompt template | |---------------|-------------------|-----------------| @@ -429,7 +429,7 @@ for CSO) in the format ### Re-dispatch prompt template (SEO + GEO loop) -Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`): +Send to `general-purpose` subagent (`model: "opus"`, `effort="high"`): > Read `~/.claude/skills/pack-seo/skills/seo/SKILL.md` and re-run it on this project in > **conservative (audit-only) intervention mode**: re-score and leave both @@ -460,7 +460,7 @@ Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`): ### Re-dispatch prompt template (HARDEN loop) -Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`): +Send to `general-purpose` subagent (`model: "opus"`, `effort="high"`): > Read `~/.claude/skills/harden/SKILL.md` and re-run it with `--fix` ONLY > up to the bundle: stop at `READY TO APPLY — awaiting dispatcher @@ -473,7 +473,7 @@ Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`): ### Re-dispatch prompt template (CSO loop — non-web only) -Send to `general-purpose` subagent (`model: "fable"`, `effort="high"`): +Send to `general-purpose` subagent (`model: "opus"`, `effort="high"`): > Read `~/.claude/skills/pack-gstack-dev/skills/cso/SKILL.md` and re-run it in **daily mode**. > Previous score: **``/20** — below threshold. @@ -562,7 +562,7 @@ listed changes by hand before deploy." Continue to STEP 6. If `PENDING_CHANGES` non-empty → invoke /commit-change skill via subagent: -> Dispatch `general-purpose` subagent (`model: "fable"`, `effort="high"`). Prompt: +> Dispatch `general-purpose` subagent (`model: "opus"`, `effort="high"`). Prompt: > > "Read `~/.claude/skills/commit-change/SKILL.md` and execute. All pending > changes were produced by the client-handover ship pipeline during the @@ -682,7 +682,7 @@ Skip if `VALIDATE_SKIPPED=true` or `PROJECT_TYPE != web` (in either case ensure `VALIDATE_SKIPPED=true` is set so the gate logic in STEP 8 treats VALIDATE as not-applicable rather than failed). -Dispatch `general-purpose` subagent (`model: "fable"`, `effort="high"`): +Dispatch `general-purpose` subagent (`model: "opus"`, `effort="high"`): > Read `~/.claude/skills/pack-web-validate/skills/web-validate/SKILL.md` and execute against the > deployed URL: ``. Audit W3C HTML validity (validator.nu), diff --git a/lib/model-gate.md b/lib/model-gate.md index 85a5ab7..d5e2f43 100644 --- a/lib/model-gate.md +++ b/lib/model-gate.md @@ -12,6 +12,7 @@ call. The answer names the id main runs on next. | answer | action | |---|---| | names a fable or opus id | proceed, SILENT | +| says the model is `fixed at spawn` (sub-agent) | proceed, SILENT | | names sonnet, haiku, anything else; "is off"; tool absent | **STOP** | **STOP means**: print exactly `⛔ MODEL GATE — session on . @@ -24,7 +25,7 @@ the turn. No later step runs, no agent is dispatched, nothing is edited. The gate guards the MAIN loop only. Typed agents are routed by their model-router row (`model:` frontmatter = off-state floor). Built-ins (general-purpose / Explore / Plan) carry an explicit `model=` at every call -site: `model: "fable"` when the child reflects/orchestrates for the main -loop (skill-runners), else its tier (opus = dispatched judgment, sonnet = -execution, haiku = mechanical probes). A built-in judgment dispatch also -carries an explicit `effort=` (`lib/effort-shift.md`). +site, its tier: `model: "opus"` = skill-runners (the child reflects or +orchestrates for the main loop) and dispatched judgment, sonnet = execution, +haiku = mechanical probes; never fable (BDR-150, the advisor). A built-in +judgment dispatch also carries an explicit `effort=` (`lib/effort-shift.md`). diff --git a/lib/tests/effort-routing.test.sh b/lib/tests/effort-routing.test.sh index c398842..c2370ea 100755 --- a/lib/tests/effort-routing.test.sh +++ b/lib/tests/effort-routing.test.sh @@ -221,8 +221,10 @@ n_opus="$(grep -c 'model="opus",$' "$R/skills/onboard/SKILL.md")" n_eff="$(grep -c 'effort="xhigh",$' "$R/skills/onboard/SKILL.md")" [ "$n_opus" -ge 7 ] && [ "$n_opus" -eq "$n_eff" ] && ok \ || ko "onboard: $n_opus model=\"opus\" dispatches vs $n_eff effort=\"xhigh\"" -bad="$(grep 'model: "fable"' "$R/agents/client-handover-writer.md" | grep -vc 'effort="high"')" -[ "$bad" -eq 0 ] && ok || ko "client-handover-writer: $bad model: \"fable\" line(s) without effort=\"high\"" +n_opus="$(grep -c 'model: "opus"' "$R/agents/client-handover-writer.md")" +n_eff="$(grep 'model: "opus"' "$R/agents/client-handover-writer.md" | grep -c 'effort="high"')" +[ "$n_opus" -eq 7 ] && [ "$n_opus" -eq "$n_eff" ] && ok \ + || ko "client-handover-writer: $n_opus model: \"opus\" lines vs $n_eff with effort=\"high\" (want 7/7)" for s in ship-feature init-project feat bugfix web-validate seo hotfix geo harden code-clean audit-delta tour onboard; do has "$(skdir "$s")/SKILL.md" 'ROUTING: follow $HOME/.claude/lib/effort-shift.md' done diff --git a/lib/tests/model-routing.test.sh b/lib/tests/model-routing.test.sh index 5aabff4..043c0d4 100755 --- a/lib/tests/model-routing.test.sh +++ b/lib/tests/model-routing.test.sh @@ -85,14 +85,16 @@ lacks "skills/tour/SKILL.md" 'description="tour runner", model=' has "skills/onboard/SKILL.md" 'model="opus"' has "skills/tour/SKILL.md" 'model="opus"' has "lib/challenge-plan.md" 'BDR-076' -# 12) BDR-077 W1 — no-inherit: skill-runner children pinned fable at every -# call site; code-review dispatches carry opus; doctrine in model-gate. -# (fable dispatch alias spike-verified 2026-07-19: resolves -# claude-fable-5, enum-validated, loud failure — never silent fallback) -has "agents/client-handover-writer.md" 'model: "fable"' +# 12) BDR-077 W1 — no-inherit: skill-runner children pinned opus since +# BDR-150 (Fable is the advisor, never a dispatch target); code-review +# dispatches carry opus; doctrine in model-gate. +has "agents/client-handover-writer.md" 'model: "opus"' has "skills/ship-feature/SKILL.md" 'model: "opus"' has "skills/init-project/SKILL.md" 'model: "opus"' -has "lib/model-gate.md" 'model: "fable"' +has "lib/model-gate.md" 'model: "opus"' +has "lib/model-gate.md" 'fixed at spawn' +hits="$(git -C "$R" grep -nE 'model ?[:=] ?"fable"' -- agents skills lib ':!lib/tests')" +[ -z "$hits" ] && ok || ko "fable dispatch pin left: $hits" lacks "lib/model-gate.md" 'model: "sonnet" in the Agent call' # 13) BDR-077 W2 — plugin split: probe (sonnet, facts only) + advisor # reasoner (opus, PROBE REPORT is ground truth, fail-closed); gate diff --git a/skills/client-handover/SKILL.md b/skills/client-handover/SKILL.md index fa4acc3..6aacff9 100644 --- a/skills/client-handover/SKILL.md +++ b/skills/client-handover/SKILL.md @@ -31,7 +31,7 @@ Load and follow strictly: Execute the CLIENT HANDOVER WRITER agent on this project. It runs the audit/fix/gate pipeline INLINE on the big session model (gated above), its -skill-runner children dispatched `model: "fable"`, then delegates the +skill-runner children dispatched `model: "opus"`, then delegates the client deliverable to the two-mode `handover-doc-writer` subagent — synthesize on opus, render (Markdown + branded HTML + PDF) on the sonnet pin (BDR-077). From ff6a550affffa24b4409995f441b1c4ebb40a558 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 23:56:00 +0100 Subject: [PATCH 2/4] chore(audits): log BDR-150 routing and pin residuals --- .claude/audits/BUGS-FOUND.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.claude/audits/BUGS-FOUND.md b/.claude/audits/BUGS-FOUND.md index c8386f6..90e9611 100644 --- a/.claude/audits/BUGS-FOUND.md +++ b/.claude/audits/BUGS-FOUND.md @@ -101,6 +101,10 @@ - settings.json `autoMode.hard_deny[6]` mod off-switch clause is a closed list: it does not name removing the `skills/` symlink, a same-name dev copy shadowing a mod (`--plugin-dir`, `~/.claude/dev-mods//`), the memory mod's partial `"recall": false`, or `/route off` typed inside a skill run (the "Passing a gate" entry only bars `/route` outside a run). Its closing "The user maintains these files by hand" may now read as covering every edit to `~/.claude/.json`, including ordinary routing overrides (classifier over-refusal, unmeasured). `profile.sh disable` reaches only `model-router@skills-dir` (memory is not a managed id). Severity: low. Discovered while: /hotfix hard-deny-mod-off security gate and doc audit. Not fixed. - mods/model-router/hooks/register.ts write guard: if the config load keeps throwing, no hook latches in-session (Skill and skill.prompt await ensureConfig first), so main-loop code writes stay held until a sub-agent writes; no throw source known today. The `next.called` replay branch is pinned only indirectly (the kit hides the downstream error). Severity: low. Discovered while: /feat guard-fail-closed plan challenge and security gate. Not fixed. + +- 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: ") 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. + - 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. From 609550e7ad3f9cd28bb25de378858aeb93de45e6 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 23:59:20 +0100 Subject: [PATCH 3/4] docs: skill-runner pins on opus, gate passes a sub-agent fixed at spawn --- CHANGELOG.md | 2 +- README.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc25ccd..10f6e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship - **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: :: new entry is not the next free ID -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 (), 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 (): 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. +- **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. ### 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. diff --git a/README.md b/README.md index 071a4b3..8a333d2 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,10 @@ 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). 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. +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 | |---|---|---| @@ -106,7 +106,7 @@ The pure-execution skills `/doc`, `/status`, `/commit-change`, so the pin takes effect and the work leaves the big session model; `/hotfix` was split like `/feat` (reflection inline + gate, `hotfixer` executor) and so joins the gated group; `/client-handover`'s nested skill-runner -children are dispatched `model:"fable"` (they carry reflection). +children are dispatched `model:"opus"` (they carry reflection). ## Effort routing (BDR-107, BDR-108) @@ -131,7 +131,7 @@ Orchestrators declare each phase through the `mcp__model-router__route` tool (`lib/effort-shift.md`): `orchestrate` at a dispatch span, `reflect` or `plan` when reflection resumes, `apply` at the bookkeeping tail, `escalate` at the verify-secure caps. Model pins stay tier aliases -(`sonnet`, `opus`, `haiku`, `fable`): the latest version of a tier is also +(`sonnet`, `opus`, `haiku`): the latest version of a tier is also the cheapest or same-priced, so the quality/price trade-off is tier × effort, never version. Transcript audit `python3 lib/effort-audit.py`. From ef5784675433e2d8baef70d5a67b7d640239a3a0 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 23:59:21 +0100 Subject: [PATCH 4/4] chore(memory): Fable pins journal, doctrine tracker --- .claude/memory/journal.md | 1 + .claude/tasks/TODO.md | 3 +- .../2026-11-16-fable-pins-to-opus-1300.md | 28 +++++++ .../2026-11-16-fable-pins-to-opus-1300.md | 75 +++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 .claude/tasks/contracts/2026-11-16-fable-pins-to-opus-1300.md create mode 100644 .claude/tasks/plans/2026-11-16-fable-pins-to-opus-1300.md diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 6c4735e..6019f9d 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -770,3 +770,4 @@ rules: - C7 hard_deny mod off-switch clause: entry 6 names enabled:false in ~/.claude/.json, enabledPlugins false, profile.sh disable of mod (8c21c4b); off switches only, no source paths (2026-10-25 challenge). Staged via crafted index blob so user's dirty settings.json /model change stayed out. Residuals (closed list, /route off in run, over-refusal risk) BUGS-FOUND e22893d. - 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). diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 2473742..c57c9ef 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -95,6 +95,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 ### 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. @@ -148,7 +149,7 @@ Scope (user 2026-11-11) [gated]: D1-D6 + the 6 dead deny entries + MIGRATION/CHA ### Known limits (accepted, no action) - model-router spawn path unprobed: 1st gate of an outage window dies once (seen live 2026-10-23, retry lands on the opus floor); tour/onboard/audit-delta no retry; onAutoSwitch with main on opus marks nothing if the engine auto-falls a gate off Fable -- Residuals (accepted): explicit `Agent(model:"fable")` pins (client-handover) still fail w/o credits (BDR-115 kept); spawn path not probed; session model itself out of credits → CLOSED 2026-10-16 c11cd3b (kept cur probed too); no cross-session persistence → ≤8 s stall per new session; timed-out probe keeps retrying in engine (no cancel); `[1m]` gating unverified (bare id probed); no Esc regression test (kit cannot abort signal); probe sleep eats ~8 of 10 s `turn.step` budget. +- Residuals (accepted): explicit `Agent(model:"fable")` pins (client-handover) moved to opus 2026-11-16 (beebfe2, BDR-150): an opus runner failure now marks opus down in the breaker and demotes main to the sonnet stand-in for the cooldown (accepted); spawn path not probed; session model itself out of credits → CLOSED 2026-10-16 c11cd3b (kept cur probed too); no cross-session persistence → ≤8 s stall per new session; timed-out probe keeps retrying in engine (no cancel); `[1m]` gating unverified (bare id probed); no Esc regression test (kit cannot abort signal); probe sleep eats ~8 of 10 s `turn.step` budget. - Residuals left (accepted): TTL known only after the first PostModelSwitch of the process (no API exposes the account TTL; 60 min default before); hooks-below `context` and a dropped prompt leave the estimate conservative/stale; `onAutoSwitch` targets main's `lastPlan` even for a sub-agent's auto fallback (pre-existing); `agent_id: null` on a main switch (if the engine ever sends null) would freeze sessionModel/TTL updates. - W1-C accepted-by-design (security 2026-10-09, MEDIUM, not coded around;): (1) the model itself can raise the main loop to fable for the rest of a turn through the `route` tool (plan/reflect/escalate/judge) or a background dispatch (derived orchestrate = best tier) — bounded by the turn and `upgradeMaxTokens`, no sticky route is model-callable; (2) CLOSED by feat C 786ee13 (keywords, ultrathink and derived orchestrate set effort only). Residuals: `PostModelSwitch` `auto` covers "other programmatic change" (a healthy model could be marked 15 min); strikes never decay inside a session; a `[1m]` variant's `model_not_found` marks the base model until reload; classifier deferred to W2. 2026-10-23 feat C 786ee13: (1) derived-orchestrate part and (2) keyword/ultrathink part CLOSED (effort-only routes); (1) route-tool lift stays by design (sanctioned path) - W3-B residuals: SKILL.md symlink follow (LOW, kept: `skills/` itself is a symlink); `descs` cap and "(custom)" label untested. (security-auditor `changed` entry purged 2026-10-11.) diff --git a/.claude/tasks/contracts/2026-11-16-fable-pins-to-opus-1300.md b/.claude/tasks/contracts/2026-11-16-fable-pins-to-opus-1300.md new file mode 100644 index 0000000..99bff27 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-16-fable-pins-to-opus-1300.md @@ -0,0 +1,28 @@ +# CONTRACT — fable-pins-to-opus (BDR-150 follow-up, amends BDR-077 W1) +- date: 2026-11-16 | flow: feat | branch: feature/fable-pins-to-opus (off develop) +- status: active + +## REQUEST (verbatim — IMMUTABLE) +Fable dispatch pins → opus (user 2026-11-16, BDR-150: Fable is the advisor, never auto-routed; this amends BDR-077 W1 "skill-runner children pinned fable"). Explicit `model: "fable"` sub-agent pins become `model: "opus"` (effort stays "high"): agents/client-handover-writer.md (7 sites: :270, :273, :432, :463, :476, :565, :685), skills/client-handover/SKILL.md:34, lib/model-gate.md:27 (dispatch tiers paragraph: skill-runners get opus). The census tests follow: lib/tests/model-routing.test.sh:88-95 (BDR-077 W1 block asserts 'model: "fable"' in client-handover-writer.md and model-gate.md) and lib/tests/effort-routing.test.sh:231-232 (client-handover-writer skill-runner lines carry effort="high"). model-gate's table keeps accepting a fable id (a hand-picked Fable session may still run a skill). + +## CLARIFICATIONS +- [internal 2026-11-16] plan .claude/tasks/plans/2026-11-16-fable-pins-to-opus-1300.md, section r2 wins (same-line pins, exact count 7, repo-wide fable census, gate row for `fixed at spawn`). +- [deferred 2026-11-16] lib/effort-shift.md:30-32 and the prose citers (plan-challenger, challenge-plan, tour, README) go to the doctrine run next (feat 5-file cap); TODO line written at close. + +## ACCEPTANCE CRITERIA +1. No `model: "fable"` pin left in the dispatch sites. + CHECK: cd /home/bchanot/Documents/claude && { grep -c 'model: "fable"' agents/client-handover-writer.md skills/client-handover/SKILL.md lib/model-gate.md || true; } | awk -F: '{s+=$2} END {print s}' + EXPECT: 0 + EVIDENCE: MET exit=0 marker-found :: 0 +2. The seven skill-runner pins in client-handover-writer.md are opus with effort high. + CHECK: cd /home/bchanot/Documents/claude && grep 'model: "opus"' agents/client-handover-writer.md | grep -c 'effort="high"' + EXPECT: 7 + EVIDENCE: MET exit=0 marker-found :: 7 +3. model-routing and effort-routing suites green. + CHECK: cd /home/bchanot/Documents/claude && PATH=$HOME/.bun/bin:$PATH make test suite=lib/tests/model-routing.test.sh &1 | tail -1 && PATH=$HOME/.bun/bin:$PATH make test suite=lib/tests/effort-routing.test.sh &1 | tail -1 + EXPECT: all suites green + EVIDENCE: MET exit=0 marker-found :: all suites green all suites green +4. Full make test green (GATES_TIMEOUT=400); the census assertions bite (a reintroduced `model: "fable"` pin or an opus skill-runner line without effort="high" turns a suite red; shown on a scratch copy) (manual). + +## FILE SCOPE +agents/client-handover-writer.md (7 pin lines + the BDR-077 paragraph ~:268-271), skills/client-handover/SKILL.md (~:34), lib/model-gate.md (Dispatch tiers paragraph ~:23-29), lib/tests/model-routing.test.sh (~:88-95), lib/tests/effort-routing.test.sh (~:224-225). diff --git a/.claude/tasks/plans/2026-11-16-fable-pins-to-opus-1300.md b/.claude/tasks/plans/2026-11-16-fable-pins-to-opus-1300.md new file mode 100644 index 0000000..1fe03eb --- /dev/null +++ b/.claude/tasks/plans/2026-11-16-fable-pins-to-opus-1300.md @@ -0,0 +1,75 @@ +# PLAN — fable-pins-to-opus (BDR-150 follow-up) + +## APPROACH +1. agents/client-handover-writer.md: the 7 `model: "fable"` occurrences + become `model: "opus"`, `effort="high"` kept on each. In the BDR-077 + paragraph (~:268-271) the sentence keeps its meaning: skill-runners carry + `model: "opus"` and `effort="high"`, never inherit the session model; add + "(BDR-150: Fable is the advisor, never a dispatch target)". +2. skills/client-handover/SKILL.md ~:34: "skill-runner children dispatched + `model: "fable"`" → `model: "opus"`. +3. lib/model-gate.md Dispatch tiers paragraph: "`model: "fable"` when the + child reflects/orchestrates for the main loop (skill-runners), else its + tier (opus = dispatched judgment, ...)" → "`model: "opus"` for + skill-runners (the child reflects/orchestrates for the main loop) and + for dispatched judgment, sonnet = execution, haiku = mechanical probes; + Fable is never a dispatch target, it is the advisor (BDR-150)". The + gate's answer table stays (a fable id still proceeds: a hand-picked + Fable session may run a skill); its STOP text stays "require Fable or + Opus". +4. lib/tests/model-routing.test.sh block 12 (~:88-95): comment says + skill-runner children are pinned opus since BDR-150 (Fable = advisor); + `has client-handover-writer.md 'model: "opus"'`, `has model-gate.md + 'model: "opus" for skill-runners'` (the new phrase), plus `lacks` on + 'model: "fable"' in client-handover-writer.md, skills/client-handover/ + SKILL.md and model-gate.md. +5. lib/tests/effort-routing.test.sh ~:224-225: count the `model: "opus"` + lines of client-handover-writer.md (must be ≥ 1, else ko: a vacuous + pass) and require every one to carry `effort="high"`. + +## EDGE CASES +- lib/effort-shift.md ("`high` for fable runners", wiring point 5) is the + doctrine run's file, out of scope here; it stays stale until that run + (next, same session). +- README.md:107 and :132 citers → doc-sync step. + +## DISPOSITION +Amends BDR-077 W1 (skill-runner pins fable → opus) per BDR-150. Honors +BDR-108 (pins stay tier aliases). + +## FILES +agents/client-handover-writer.md, skills/client-handover/SKILL.md, +lib/model-gate.md, lib/tests/model-routing.test.sh, +lib/tests/effort-routing.test.sh. + +## r2 (challenge r1: correctness CONCERNS(1), robustness CONCERNS(1), simplicity SOLID) — amends APPROACH 1-5 +1. client-handover-writer.md: swap the 7 `model: "fable"` for `model: "opus"` + only; `model: "opus"` and `effort="high"` stay on the SAME physical line + at each site; no BDR-150 parenthetical in this file. +2. model-gate.md Dispatch tiers paragraph: one tier list, e.g. "its tier: + `model: "opus"` = skill-runners (the child reflects/orchestrates for the + main loop) and dispatched judgment, sonnet = execution, haiku = + mechanical probes; never fable (BDR-150, the advisor)." Keep the file + short (≤ 31 lines). Gate table: add one row: the answer says the model + is `fixed at spawn` (the route tool called inside a sub-agent, e.g. a + pinned skill-runner running a gated skill) → proceed, SILENT. +3. model-routing.test.sh block 12: replace the whole block comment (spike + lines included) with: skill-runner children pinned opus since BDR-150 + (Fable is the advisor, never a dispatch target). Assertions: `has + client-handover-writer.md 'model: "opus"'`, `has lib/model-gate.md + 'model: "opus"'` (no backtick in the needle; the string is absent from + model-gate.md today), `has lib/model-gate.md 'fixed at spawn'`, and ONE + repo-wide census: `git -C "$R" grep -nE 'model ?[:=] ?"fable"' -- + agents skills lib ':!lib/tests'` must print nothing (ko with the hits). +4. effort-routing.test.sh ~:224-225: following the onboard idiom + (:220-222): count the lines of client-handover-writer.md holding + `model: "opus"`; require `-eq 7` and that the same 7 carry + `effort="high"` (equal counts). +5. Tracking (closing step, not the executor): TODO.md Actionable line for + lib/effort-shift.md:30-32 (wiring point 5 still names fable runners) + + README.md:109, :134, plan-challenger.md:111,:115, challenge-plan.md:48, + :51, skills/tour/SKILL.md:83 → the doctrine run (next); TODO.md:151 + residual ("explicit Agent(model:"fable") pins … fail w/o credits") + rewritten: now an opus runner failure marks opus down in the breaker + and demotes main to the sonnet stand-in for the cooldown (accepted + residual, BDR-150).