Merge bugfix/router-haiku-effort into develop
This commit is contained in:
commit
aaeaac82f7
12 files changed
+171
-13
No files matched your search
@@ -357,6 +357,7 @@ rules:
|
||||
- **Cause**: DEFAULT_CONFIG `haiku: 'claude-haiku-4-5-20251001'` + `windows` 200K entry; native alias moved to `claude-haiku-5-5` (1M, effort low–max) silently.
|
||||
- **Solution**: 2c39524 (feature/model-scope-dialog): haiku → `claude-haiku-5-5`, `windows: {}`; regression test + window test on explicit override. Negative control: revert → 20 tests red.
|
||||
- **Residual**: "haiku takes no effort" strip (effortWord, step plan, isHaiku sites, census `effort-routing.test.sh:170`) still 4.5-era → `mechanical` (low) runs haiku at default medium. Follow-up /bugfix. Links [[LRN-230]], [[BDR-126]].
|
||||
- **Status 2026-10-25**: residual resolved 8e93507 (bugfix/router-haiku-effort): no-effort guard scoped to Haiku 4.x, Haiku 5.x gets route effort; negative control (family prefix) → 6 tests red.
|
||||
|
||||
## BLK-036 — bare `/model` picker writes tracked user settings for a per-project intent [resolved]
|
||||
- **Friction**: user picked haiku in native picker in integration_alphalink, wanted that project only → `"model": "haiku"` landed in tracked user settings.json (every project). Restored opus by hand; haiku pinned in alphalink `.claude/settings.local.json`.
|
||||
|
||||
@@ -1354,6 +1354,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Caveats**: shifts inert headless; a prose gate ending the turn resets to session level (re-assert wired in bugfix and ship-feature 4b); mode-based agents pin their judgment mode; a shift paired with a built-in judgment dispatch would downgrade it (pair with Read/Bash instead); `lib/gitflow-test.sh` T16a red on this machine = gitleaks not installed, unrelated.
|
||||
- **Refs**: spec `docs/superpowers/specs/2026-09-28-effort-tiering-design.md`, plan `docs/superpowers/plans/2026-09-28-effort-tiering.md`, [[LRN-179]], [[EVAL-035]], [[EVAL-036]], [[BDR-077]].
|
||||
- **Correction (2026-09-28)**: EVAL-035 counted one record per content block (~2.8× on request counts); deduped figures in [[EVAL-037]]: main-loop thinking 99.9% of total thinking (was 96.6%), thinking 5.6% of weighted cost (was 8.4%), sonnet think/request 26→0.2 tok. Conclusions hold, sharper: main loop still carries almost all thinking, executors stay cheap.
|
||||
- **Amendment (2026-10-25, bugfix 8e93507)**: "none on status-reporter (haiku)" superseded: status-reporter pins `effort: low` (its `mechanical` row); census `effort-routing.test.sh` no longer skips haiku agents. Reason: Haiku 5.5 takes effort. Links [[BLK-035]].
|
||||
|
||||
## BDR-108 — Effort round: every skill carries a level next to its model pin; model pins stay tier aliases [accepted] (2026-09-29)
|
||||
- **Decision**: 3 repo skills pinned (skills-perso low, pdf-translate medium, site-motion high). 25 vendored externals (superpowers 7, agent-skills 3, design stack 9, 21st pack 6) get level from `lib/effort-pins.txt`, applied by `lib/effort-pins.sh` after LAST vendoring step of install-plugins.sh (21st pack, STEP 8.7) AND update-all.sh (§7.4). Design stack = ONE level, high. hotfix stays high. Model pins stay aliases (`sonnet` `opus` `haiku` `fable`). Doctrine: design stack loads paired with first Read; census order-locked by line number; `lib/effort-audit.py` prints thinking coverage.
|
||||
@@ -1481,6 +1482,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
||||
- **Known gaps**: default keyword prompt rules (plan|design|architecture, why|review|audit|analyze, ultrathink) lift main to Fable unwitnessed → feat C caps them at session model; Fable held down → opus stand-in, ceiling does not bind; stale "session model" citers `skills/feat/SKILL.md:6`, `skills/code-clean/SKILL.md:36`.
|
||||
- **Refs**: feat A feature/routing-audit-phase d3635b6 a7d747c dae142b; feat B feature/routing-ceiling-rule ef13713 887cf89, contract `.claude/tasks/contracts/2026-10-21-routing-ceiling-rule-1753.md`, plan `.claude/tasks/plans/2026-10-21-routing-ceiling-rule-1753.md`. Links [[BDR-066]] [[BDR-115]] [[BLK-032]] [[LRN-224]].
|
||||
- **Amendment (2026-10-23, feat C 786ee13 + docs d2d590f)**: keyword-lift gap CLOSED: prompt rules (keywords, `ultrathink`, user rules) + derived `orchestrate` on main Agent dispatch (user pick 2026-10-23) write effort-only routes; model axis falls through to held run or stays on cur. Amends [[BDR-115]] amendment 2026-10-13 clause "ultrathink floor model beats guess": mid-turn ultrathink after classifier demotion keeps guessed model that turn (floor raises effort only). Accepted edges: haiku session → keywords no-op; session model held → keyword turn = plain-turn fallback (sonnet), not fable; no stand-in notch on keyword/dispatch turns; dispatch after demotion orchestrates on demoted model. Rejected: cap in `wantedModel` (r1) → shadowed held run slot + fail-open on `sessionModel` '' after /reload-plugins. Contract `.claude/tasks/contracts/2026-10-23-router-keyword-cap-0019.md`, plan r2.1 `.claude/tasks/plans/2026-10-23-router-keyword-cap-0019.md`. Links [[LRN-226]], [[EVAL-048]].
|
||||
- **Amendment (2026-10-25, bugfix 8e93507)**: accepted edge "haiku session → keywords no-op" REVERSED (user pick: Haiku 5.x like any model). No-effort rule now Haiku 4.x only (`NO_EFFORT = 'claude-haiku-4'`); on Haiku 5.x keyword rules, `ultrathink`, sticky effort and derived orchestrate apply, unrouted step passes engine effort. Links [[BLK-035]], [[LRN-230]].
|
||||
|
||||
## BDR-124 — Foreign code keeps its own style; limits strict in our code only [accepted] (2026-10-23)
|
||||
- **Decision**: CLAUDE.global.md header: strict limits in our code, "Foreign code: keep its style" section wins on foreign code (granularity, layout, naming, comments, idioms; limits = guidelines; no refactor toward our norms unless asked). Origin = `lib/code-origin.sh`: `git config claude.origin` (ours|foreign, per clone, invalid → foreign) > root commit author vs `user.email` + global `claude.identity` list; undecidable (no git, shallow, no commit) → foreign, said. Session banner line `code : ours|foreign (reason)`. refactorer, /refactor, /audit-delta conformity follow it; refactorer cites CLAUDE.md limits, no copy.
|
||||
|
||||
@@ -654,3 +654,4 @@ rules:
|
||||
- /feat `/model` scope dialog (feature/model-scope-dialog): 3 lenses r1 (1 BLOCKER `[1m]`), r3 plan, feater + 2 fix rounds (test gap, dangling link), verifier CONFORME 15/15, auditor PASS. 1fde5bb + docs 773fe17. BDR-126, LRN-228/229, EVAL-049. Merge on user go; live check next.
|
||||
- BLK-036: bare /model picker wrote haiku into tracked user settings (integration_alphalink intent). Restored opus, haiku pinned in alphalink settings.local.json. /bugfix haiku table 2c39524 (BLK-035, LRN-230): verifier CONFORME 7/7, auditor PASS. Next: haiku effort bugfix, picker scope feat. Merge of feature/model-scope-dialog held.
|
||||
- /feat picker scope (BLK-036): spike (user ran 2 live picker tests: ask inside hook froze, deny + continuation works), plan r1 FATAL x2 / r2 FATAL(1) on breaker-vs-target, r3 inline; verifier CONFORME 14/14, auditor PASS. 2202964 + docs 5d262d3. BDR-127, LRN-231, EVAL-050. Spike mod neutralized. Next: haiku effort bugfix; live check picker in fresh session.
|
||||
- /bugfix haiku effort (bugfix/router-haiku-effort): 3 lenses no BLOCKER (2 caught delete-instead-of-scope), user pick Haiku 5.x like any model; guard = Haiku 4.x; verifier CONFORME 10/10, auditor PASS. 8e93507. BDR-123 + BDR-107 amended, BLK-035 closed, LRN-230 addendum. feature/model-scope-dialog merged a6b94a4. Next: merge bugfix on go, /clear, phase 0.
|
||||
@@ -1902,6 +1902,7 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
||||
## LRN-230 — Native model alias moves under the mod silently; table facts rot with it
|
||||
- **Context**: BLK-035. haiku alias 4.5 → 5.5, no error anywhere; only signal = mod log `unknown to the models table`. Mod also hardcodes 4.5 facts (200K window, no effort).
|
||||
- **Apply**: at each Claude Code upgrade, check `cfg.models` ids vs claude-api skill model table (context, effort support); grep code for model-specific facts (`startsWith(HAIKU)`, windows) in same pass. A per-model behaviour rule names its model version in a comment. Links [[BLK-035]], [[LRN-203]].
|
||||
- **Addendum (2026-10-25, 8e93507)**: model fact changes → SCOPE old rule to old version (`claude-haiku-4`), never delete: old model stays reachable (override, full id). Negative control: revert to family prefix → tests red. 2 of 3 challenge lenses caught the delete-instead-of-scope plan.
|
||||
|
||||
## LRN-231 — PreModelSwitch hook: no dialog inside; deny at once, ask in a continuation
|
||||
- **Context**: picker spike 2026-10-25 (dev mod, user-run). `$.ui.ask` awaited inside `classic.PreModelSwitch` never renders: UI frozen on "Running PreModelSwitch hooks… (Esc to cancel)". Returning `{ permissionDecision: 'deny', permissionDecisionReason }` at once blocks switch AND user settings.json write; engine prints "Model switch to X was blocked by a PreModelSwitch hook: <reason>".
|
||||
|
||||
@@ -14,7 +14,7 @@ Shared rules for every phase:
|
||||
|
||||
- [x] **Before phase 0: /feat `/model` scope dialog in model-router** (done 2026-10-25, 1fde5bb + docs 773fe17, BDR-126; merge on user signal; live check pending: dialog in a real session, no PostModelSwitch/down mark after This project, gitignore of a created file). (user pick 2026-10-25). Fact (docs model-config): `/model <name>` always writes `model` to user settings.json (tracked here); picker key `s` = session only; project `model` honored at launch. Mod: `command.run` on `model` with args → `$.ui.ask` "This project / This conversation / Everywhere": project = `model` in `.claude/settings.local.json` + sticky route now; conversation = sticky route only (`/route model=`); everywhere = native passthrough. No args → native picker untouched; `-p` or no surface → passthrough. Files: register.ts, register.test.ts, lib/effort-shift.md. Doctor keeps the tracked ≠ opus warning.
|
||||
|
||||
- [ ] **/bugfix model-router haiku effort strip** (BLK-035 residual, user pick 2026-10-25): Haiku 5.5 takes effort; drop 4.5-era "haiku takes no effort" (effortWord, step plan omission, isHaiku sites, census `lib/tests/effort-routing.test.sh:170`), so `mechanical` runs low.
|
||||
- [x] **/bugfix model-router haiku effort strip** (done 2026-10-25, 8e93507; merge on user signal) (BLK-035 residual, user pick 2026-10-25): Haiku 5.5 takes effort; drop 4.5-era "haiku takes no effort" (effortWord, step plan omission, isHaiku sites, census `lib/tests/effort-routing.test.sh:170`), so `mechanical` runs low.
|
||||
- [x] **/feat picker scope** (done 2026-10-25, 2202964 + docs 5d262d3, BDR-127; live check pending: picker in a fresh session, PostModelSwitch on a denied pick) (BLK-036, user ask 2026-10-25): bare `/model` → pick in native picker → ask project scope (`.claude/settings.local.json`) or user scope. First: engine types for a settings-write intercept; none → mod restores user settings.json = BDR-116 amendment, user decides before code.
|
||||
|
||||
- [ ] **Phase 0, no mod: split project CLAUDE.md**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# CONTRACT — router-haiku-effort
|
||||
- date: 2026-10-25 | flow: bugfix | branch: bugfix/router-haiku-effort (from develop)
|
||||
- status: active
|
||||
|
||||
## REQUEST (verbatim — IMMUTABLE)
|
||||
model-router haiku effort strip (BLK-035 residual, TODO "/bugfix model-router haiku effort strip"): Haiku 5.5 takes effort (low–max, default medium, claude-api model table) but the mod still applies the Haiku 4.5 rule "haiku takes no effort": effort omitted on every haiku step (register.ts step plan ~l.3820 `startsWith(HAIKU) → effort: undefined`), `effortWord` prints "- (haiku takes none)" (~l.1824), isHaiku sites (~l.1372, 3550, 3703, 4095, 4267), census skip `lib/tests/effort-routing.test.sh:170`. Symptom: the `mechanical` phase (cheap tier, effort low) runs status-reporter on haiku at the engine default medium, not low.
|
||||
|
||||
## CLARIFICATIONS
|
||||
- [gated 2026-10-25] Fix approved with challenge (user).
|
||||
- [gated 2026-10-25] Haiku 5.x behaves like any model (user pick): routes, prompt keywords, sticky effort and session effort apply; reverses the 2026-10-23 edge "haiku session → keywords no-op".
|
||||
- [after the challenge] The no-effort guard is kept, scoped to Haiku 4.x (`claude-haiku-4` prefix after `canonical`): 4.5 is still served and takes no effort, reachable by override or full id.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. On a Haiku 5.x model (`claude-haiku-5-5`), a routed main step and a spawned agent's steps carry the route's effort (`mechanical` → `low`); `/route show` prints that effort, not "takes none"; an unrouted step passes the engine effort unchanged.
|
||||
2. On Haiku 4.x (`models.haiku` overridden to `claude-haiku-4-5-20251001`), steps still carry no effort and `/route show` says `haiku 4 takes none`.
|
||||
3. The no-effort rule is keyed on a version-named constant (`claude-haiku-4`), not on the family prefix `claude-haiku`, at every effort site (planStep, handoffOf, the loop.last condition, effortWord).
|
||||
CHECK: python3 -I -c "import re;s=open('mods/model-router/hooks/register.ts').read();a=s.count(\"'claude-haiku-4'\");b=len(re.findall(r'haiku takes none',s));print('guard=%d/%d'%(min(a,1),b))"
|
||||
EXPECT: guard=1/0
|
||||
EVIDENCE: MET exit=0 marker-found :: guard=1/0
|
||||
4. Tests in register.test.ts: the three former omission assertions now expect the phase effort; new tests for Haiku 4.x keeping the strip, the unrouted passthrough, a `plan` keyword on a haiku-5-5 session → xhigh, an unrowed haiku spawn (hand-off `haiku/-`, first step silent), `/route show` on haiku-5-5.
|
||||
5. Census: the haiku skip at lib/tests/effort-routing.test.sh is gone and agents/status-reporter.md declares `effort: low`.
|
||||
CHECK: a=$(grep -c 'field_of "$RD" "$phase" model)" = haiku' lib/tests/effort-routing.test.sh); b=$(awk 'NR==1&&/^---$/{p=1;next} p&&/^---$/{exit} p' agents/status-reporter.md | grep -c '^effort: low$'); echo "census=$a/$b"
|
||||
EXPECT: census=0/1
|
||||
EVIDENCE: MET exit=0 marker-found :: census=0/1
|
||||
6. README.md no longer says haiku takes no effort.
|
||||
CHECK: echo "readme=$(grep -c 'none on haiku' README.md)"
|
||||
EXPECT: readme=0
|
||||
EVIDENCE: MET exit=0 marker-found :: readme=0
|
||||
7. Mod suite green.
|
||||
CHECK: make test suite=lib/tests/mods.test.sh 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
8. Full suite green (census included).
|
||||
CHECK: make test 2>&1 | tail -1
|
||||
EXPECT: all suites green
|
||||
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||
9. Diff touches only the FILE SCOPE.
|
||||
CHECK: git diff --name-only develop -- . ':!.claude' | grep -vcE '^(mods/model-router/hooks/register.ts|mods/model-router/hooks/register.test.ts|lib/tests/effort-routing.test.sh|agents/status-reporter.md|README.md)$' | sed 's/^/n=/'
|
||||
EXPECT: n=0
|
||||
EVIDENCE: MET exit=0 marker-found :: n=0
|
||||
10. No new lint or test suppression.
|
||||
CHECK: git diff -U0 develop -- . ':!.claude' | grep -E '^\+' | grep -cE 'eslint-disable|@ts-ignore|@ts-expect-error|shellcheck disable' | sed 's/^/n=/'
|
||||
EXPECT: n=0
|
||||
EVIDENCE: MET exit=0 marker-found :: n=0
|
||||
|
||||
## FILE SCOPE
|
||||
- mods/model-router/hooks/register.ts
|
||||
- mods/model-router/hooks/register.test.ts
|
||||
- lib/tests/effort-routing.test.sh
|
||||
- agents/status-reporter.md
|
||||
- README.md (l.124 only)
|
||||
@@ -0,0 +1,25 @@
|
||||
# FIX PLAN — router-haiku-effort (bugfix)
|
||||
|
||||
## DIAGNOSIS
|
||||
- BUG: on a haiku model the router never sends an effort: `mechanical` (cheap tier, effort low) runs status-reporter and the 8 mechanical skills (status, profile, plugin-check, skills-perso, using-git-worktrees, 21st-cli-use, 21st-registry, 21st-design-sync) at Haiku 5.5's engine default (medium); `/route show` prints `- (haiku takes none)`.
|
||||
- ROOT CAUSE: the Haiku 4.5 rule "haiku takes no effort" is hard-coded in 4 places; the `haiku` alias now resolves to `claude-haiku-5-5` (2c39524, BLK-035), which takes effort low–max, default medium (claude-api skill model table, cached 2026-10-06).
|
||||
- PRIOR: BLK-035 (this is its residual), LRN-230 (per-model facts rot with the alias).
|
||||
- EVIDENCE: mods/model-router/hooks/register.ts:3948-3953 `planStep` strips `effort` when `step.plan.model.startsWith(HAIKU)` (main AND agent steps); :3833 `handoffOf` sets the spawned agent's effort to undefined on haiku; :4238 `loop.last = hand.to` also when `isHaiku` (the "effort known" case only because it was undefined); :1874-1875 `effortWord` prints `- (haiku takes none)`. Census lib/tests/effort-routing.test.sh:170 skips the agent effort floor check when the phase model is haiku; agents/status-reporter.md frontmatter has `model: haiku` and no `effort:`.
|
||||
- OUT OF SCOPE (not effort): `moveTo` / `knownModel` / `variantNote` `[1m]` rule (l.1220, 2137, 2273), `windowReturn` refusing a haiku home (l.1373), `smallModelBusy` (l.4410).
|
||||
|
||||
## FIX PLAN (r2, after 3 lenses: correctness CONCERNS(1), robustness CONCERNS(2), simplicity SOLID; no BLOCKER)
|
||||
The guard is KEPT and scoped to the version that takes no effort (C1/R1, LRN-230: name the model version), not deleted.
|
||||
1. register.ts: new constant beside `HAIKU` (l.213): `const NO_EFFORT = 'claude-haiku-4' // Haiku 4.x takes no effort; 5.x does (low-max)`. New helper next to `isHaiku` (l.3678): `const takesNoEffort = (cfg: Config, id: string): boolean => canonical(cfg, id).startsWith(NO_EFFORT)`.
|
||||
2. register.ts:3948-3953 `planStep`: the strip tests `takesNoEffort(st.cfg, step.plan.model)` instead of `startsWith(HAIKU)`; comment names Haiku 4.x.
|
||||
3. register.ts:3833 `handoffOf`: `takesNoEffort(st.cfg, started.model) ? undefined : given ?? route?.effort`.
|
||||
4. register.ts:4238: `hand.effortCause !== 'engine' || takesNoEffort(st.cfg, hand.to.model)`.
|
||||
5. register.ts:1873-1875 `effortWord`: `takesNoEffort(st.cfg, v.call.model)` → `'- (haiku 4 takes none)'`; doc sentence names Haiku 4.x.
|
||||
`HAIKU` / `isHaiku` stay for the out-of-scope sites ([1m], windowReturn, smallModelBusy).
|
||||
6. register.test.ts (S1/C3/R3): update the existing omission assertions to the phase effort and rename: l.~860 `expect(sent.effort).toBeUndefined()`, l.~3838 `mainWord(..., 'haiku/-', ...)` → `haiku/low`, l.~4038-4048 test "a haiku spawn shows no effort" → asserts `haiku/low` and a new name. New tests: (c) `/route show` main line on a haiku-5-5 session shows the effort, not `takes none`; (d) Haiku 4.x keeps the strip: `models.haiku` overridden to `claude-haiku-4-5-20251001` (home override fixture) → a routed step sends NO effort, `/route show` says `haiku 4 takes none`, a spawn hand-off shows `haiku/-`; (e) unrouted haiku-5-5 step passes the engine effort unchanged (C2); (f) haiku-5-5 session + `plan` keyword prompt → step effort xhigh (R2, the accepted edge reversal pinned by a test); (g) unrowed haiku-5-5 spawn (engine effort cause): hand-off `haiku/-`, first agent step logs nothing (R3).
|
||||
7. lib/tests/effort-routing.test.sh:170: delete the haiku skip (status-reporter is the only haiku agent; its row `mechanical` = haiku/low).
|
||||
8. agents/status-reporter.md: add `effort: low` to the frontmatter, placed like other agents' `effort:` line.
|
||||
9. README.md:124 (S2): drop "(none on haiku, which rejects the parameter)" (now false for Haiku 5.5).
|
||||
|
||||
## RISK (r2)
|
||||
Visible behaviour change on Haiku 5.x (user pick 2026-10-25: "like any model"): routed steps get the phase effort (`mechanical` low); effort-only routes go live on a haiku session (`plan`/`design`/`architecture` → xhigh, `ultrathink` → max, `why`/`review` → high, sticky `/route effort=`, derived orchestrate); an unrouted step passes the engine/session effort (high here) instead of the engine default medium. Reverses the 2026-10-23 accepted edge "haiku session → keywords no-op" → amendment at CAPITALIZE; also the effort-pin BDR line "none on status-reporter (haiku)" (decisions.md:~1350) → amendment. Haiku 4.x unchanged.
|
||||
Live check (C4, user-run, not a gate): `/status` on a session with `verbose` → hand-off `status-reporter haiku/low`.
|
||||
@@ -120,8 +120,8 @@ to the rows by the census `lib/tests/effort-routing.test.sh` (a best-tier
|
||||
row floors on the tier's second alias, opus, since Fable is credit-gated; a
|
||||
row changed through the first-use dialog passes with a `WARN floor drift` line
|
||||
until its frontmatter follows): low
|
||||
appliers, medium executors, high writers, xhigh judgment and gates (none
|
||||
on haiku, which rejects the parameter); `/status` low … `/ship-feature`
|
||||
appliers, medium executors, high writers, xhigh judgment and gates;
|
||||
`/status` low … `/ship-feature`
|
||||
xhigh. The vendored externals (design stack, superpowers, agent-skills,
|
||||
MengTo scroll skills, 21st) get their level from their row only.
|
||||
Orchestrators declare each phase through the `mcp__model-router__route`
|
||||
|
||||
@@ -3,6 +3,7 @@ name: status-reporter
|
||||
description: Read-only project-status engine — dispatched by /status. Collects plugin roster + passive-cost estimate (doctor.sh constants), git state, build/tests, GSD milestone into one snapshot.
|
||||
tools: Read, Bash, Glob, Grep
|
||||
model: haiku
|
||||
effort: low
|
||||
---
|
||||
|
||||
# STATUS REPORTER
|
||||
|
||||
@@ -167,7 +167,6 @@ check_agent() {
|
||||
phase="$(row_of "$RD" agents "$name")"
|
||||
[ -n "$phase" ] || { ko "agents/$name: no row in routing.json"; return; }
|
||||
floor_check "$RD" agents "$name" model "$(fm_val "$R/$f" model)" "$phase" "agents/$name"
|
||||
[ "$(field_of "$RD" "$phase" model)" = haiku ] && return
|
||||
floor_check "$RD" agents "$name" effort "$(fm_val "$R/$f" effort)" "$phase" "agents/$name"
|
||||
}
|
||||
while IFS= read -r f; do check_agent "$f"; done < <(
|
||||
|
||||
@@ -857,7 +857,52 @@ test('cap: a downgrade under the cold-read cap moves main', async (
|
||||
await $.tool.call({ tool: ROUTE_TOOL, phase: 'mechanical' })
|
||||
const sent = await stepOn($, rig, FABLE)
|
||||
expect(sent.model).toBe(HAIKU)
|
||||
expect(sent.effort).toBe('low')
|
||||
})
|
||||
|
||||
const HAIKU_4 = 'claude-haiku-4-5-20251001'
|
||||
const HAIKU_4_HOME = { home: { models: { haiku: HAIKU_4 } } }
|
||||
|
||||
test('haiku 5: /route show prints the effort, not "takes none"', async (
|
||||
$, on) => {
|
||||
await bootRig($, on)
|
||||
await $.tool.call({ tool: ROUTE_TOOL, phase: 'mechanical' })
|
||||
const line = mainLine(await route($, 'show'))
|
||||
expect(line).toContain('effort low')
|
||||
expect(line).not.toContain('takes none')
|
||||
})
|
||||
|
||||
test('haiku 4: a routed step keeps no effort, show says so', async (
|
||||
$, on) => {
|
||||
const rig = await bootRig($, on, FABLE, 1000, newWorld(HAIKU_4_HOME))
|
||||
await $.tool.call({ tool: ROUTE_TOOL, phase: 'mechanical' })
|
||||
const sent = await stepOn($, rig, FABLE)
|
||||
expect(sent.model).toBe(HAIKU_4)
|
||||
expect(sent.effort).toBeUndefined()
|
||||
expect(mainLine(await route($, 'show'))).toContain('haiku 4 takes none')
|
||||
})
|
||||
|
||||
test('haiku 5: an unrouted step passes the engine effort', async (
|
||||
$, on) => {
|
||||
const rig = await bootRig($, on, HAIKU)
|
||||
expect(await stepOn($, rig, HAIKU)).toEqual({
|
||||
model: HAIKU,
|
||||
effort: 'high',
|
||||
})
|
||||
})
|
||||
|
||||
test('haiku 5: a plan keyword on a haiku session is xhigh', async (
|
||||
$, on) => {
|
||||
const rig = await bootRig($, on, HAIKU)
|
||||
await $.prompt.submit({
|
||||
text: 'plan the migration',
|
||||
wait: false,
|
||||
origin: { kind: 'composer' },
|
||||
})
|
||||
expect(await stepOn($, rig, HAIKU)).toEqual({
|
||||
model: HAIKU,
|
||||
effort: 'xhigh',
|
||||
})
|
||||
})
|
||||
|
||||
test('fallback: a rate limit on fable moves plan to opus max', async (
|
||||
@@ -3835,7 +3880,8 @@ test('logs: a downgrade is a switch', async ($, on) => {
|
||||
await route($, 'mechanical')
|
||||
await runStep($, highStep())
|
||||
expect(logs).toEqual([
|
||||
mainWord('fable/high', 'haiku/-', 'mechanical: sticky /route, switch'),
|
||||
mainWord('fable/high', 'haiku/low',
|
||||
'mechanical: sticky /route, switch'),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -4035,13 +4081,14 @@ test('logs: an explicit effort is one line, then silence', async ($, on) => {
|
||||
expect(logs).toEqual([line])
|
||||
})
|
||||
|
||||
test('logs: a haiku spawn shows no effort, then silence', async ($, on) => {
|
||||
test('logs: a haiku spawn shows its effort, then silence', async (
|
||||
$, on) => {
|
||||
const world = newWorld({
|
||||
edit: f => { (f.agents as Rec).feater = 'mechanical' },
|
||||
})
|
||||
const { logs } = await afterMainStep($, on, { world })
|
||||
await $.agent.spawn(spawnOf('feater'))
|
||||
const line = 'main fable/high → agent feater haiku/- ' +
|
||||
const line = 'main fable/high → agent feater haiku/low ' +
|
||||
'(row mechanical, row)'
|
||||
expect(logs).toEqual([line])
|
||||
await runStep($, { ...highStep('a1'), model: HAIKU })
|
||||
@@ -4064,6 +4111,31 @@ test('logs: two agent types to one model are two hand-offs', async (
|
||||
expect(handoffs(logs)).toHaveLength(2)
|
||||
})
|
||||
|
||||
test('logs: a haiku 4 spawn shows no effort, then silence', async (
|
||||
$, on) => {
|
||||
const world = newWorld({
|
||||
...HAIKU_4_HOME,
|
||||
edit: f => { (f.agents as Rec).feater = 'mechanical' },
|
||||
})
|
||||
const { logs } = await afterMainStep($, on, { world })
|
||||
await $.agent.spawn(spawnOf('feater'))
|
||||
const line = 'main fable/high → agent feater haiku/- ' +
|
||||
'(row mechanical, row)'
|
||||
expect(logs).toEqual([line])
|
||||
await runStep($, { ...highStep('a1'), model: HAIKU_4 })
|
||||
expect(logs).toEqual([line])
|
||||
})
|
||||
|
||||
test('logs: an unrowed haiku spawn is silent at its first step', async (
|
||||
$, on) => {
|
||||
const { logs } = await afterMainStep($, on)
|
||||
await $.agent.spawn(spawnOf('unrowed', { model: 'haiku' }))
|
||||
const line = 'main fable/high → agent unrowed haiku/- (explicit, engine)'
|
||||
expect(logs).toEqual([line])
|
||||
await runStep($, { ...highStep('a1'), model: HAIKU })
|
||||
expect(logs).toEqual([line])
|
||||
})
|
||||
|
||||
test('logs: one agent type to two models is two hand-offs', async (
|
||||
$, on) => {
|
||||
const { logs } = await afterMainStep($, on)
|
||||
|
||||
@@ -211,6 +211,7 @@ const SKILL_NAME = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/
|
||||
const ROWS: readonly Row[] = ['skills', 'agents']
|
||||
const KINDS: readonly Kind[] = ['skills', 'agents', 'phases']
|
||||
const HAIKU = 'claude-haiku'
|
||||
const NO_EFFORT = 'claude-haiku-4' // Haiku 4.x takes no effort; 5.x does
|
||||
const MAX_PATTERN = 200 // chars of a prompt-rule pattern
|
||||
const MAX_PROMPT_SCAN = 4096 // chars of a prompt a rule is run against
|
||||
const MAX_CONFIG_BYTES = 65536 // override file size
|
||||
@@ -1870,9 +1871,9 @@ function standInWord(st: State, v: Verdict): string {
|
||||
return `${alias} stands in for ${head}`
|
||||
}
|
||||
|
||||
/** Haiku takes no effort: the main line says so when it will run there. */
|
||||
/** Haiku 4.x takes no effort: the main line says so when it runs there. */
|
||||
function effortWord(st: State, v: Verdict): string {
|
||||
if (v.call.model.startsWith(HAIKU)) return '- (haiku takes none)'
|
||||
if (takesNoEffort(st.cfg, v.call.model)) return '- (haiku 4 takes none)'
|
||||
const d = standInEffort(st, mainEffort(st, undefined), v)
|
||||
const word = String(d.effort ?? '-')
|
||||
return d.standIn ? `${word} (${standInWord(st, v)})` : word
|
||||
@@ -3678,6 +3679,9 @@ const NAME_CAP = 40 // code points of any name read from outside, in a line
|
||||
const isHaiku = (cfg: Config, id: string): boolean =>
|
||||
canonical(cfg, id).startsWith(HAIKU)
|
||||
|
||||
const takesNoEffort = (cfg: Config, id: string): boolean =>
|
||||
canonical(cfg, id).startsWith(NO_EFFORT)
|
||||
|
||||
/** The table alias of a model id (a `[1m]` marker kept), else the id. */
|
||||
function nameOf(cfg: Config, id: string): string {
|
||||
const bare = canonical(cfg, id)
|
||||
@@ -3830,7 +3834,7 @@ function handoffOf(
|
||||
!pinned) {
|
||||
return undefined
|
||||
}
|
||||
const effort = isHaiku(st.cfg, started.model)
|
||||
const effort = takesNoEffort(st.cfg, started.model)
|
||||
? undefined
|
||||
: given ?? route?.effort
|
||||
return {
|
||||
@@ -3946,8 +3950,8 @@ async function planStep(
|
||||
const step: Step = e.agentId === undefined
|
||||
? await mainPlan($, st, e, signal)
|
||||
: { plan: agentPlan(st, e) }
|
||||
// Haiku takes no effort: omit it rather than send a hook-set value.
|
||||
return step.plan.model.startsWith(HAIKU)
|
||||
// Haiku 4.x takes no effort: omit it rather than send a hook-set value.
|
||||
return takesNoEffort(st.cfg, step.plan.model)
|
||||
? { ...step, plan: { ...step.plan, effort: undefined } }
|
||||
: step
|
||||
}
|
||||
@@ -4235,7 +4239,8 @@ function afterSpawn($: Api, st: State, sp: Spawned): void {
|
||||
const hand = handoffOf(st, sp, given)
|
||||
if (hand === undefined) return
|
||||
// an effort the engine picks is unknown here: the first step tells it
|
||||
if (hand.effortCause !== 'engine' || isHaiku(st.cfg, hand.to.model)) {
|
||||
if (hand.effortCause !== 'engine' ||
|
||||
takesNoEffort(st.cfg, hand.to.model)) {
|
||||
loop.last = hand.to
|
||||
}
|
||||
if (!st.cfg.verbose) return
|
||||
|
||||
Reference in new issue
Block a user