Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0ca9dbd88 | ||
|
|
1d69fce92f | ||
|
|
d9f0f427c6 |
No files matched your search
@@ -1639,3 +1639,9 @@ Supersedes [[BDR-030]].
|
|||||||
- **Why**: machine pulled before fetch → chrome-extensions SKILL.md missing = doctor FAIL → `make update` (ends on doctor.sh) exits 1. User chose warn only 2026-11-22.
|
- **Why**: machine pulled before fetch → chrome-extensions SKILL.md missing = doctor FAIL → `make update` (ends on doctor.sh) exits 1. User chose warn only 2026-11-22.
|
||||||
- **Alternatives rejected**: keep FAIL (update red until `make plugin`).
|
- **Alternatives rejected**: keep FAIL (update red until `make plugin`).
|
||||||
- **Reference**: 14bee52; tests TREE_OWNED_* + TREE_NAMES_ERREXIT_BROKEN_LOCK in lib/tests/doctor-vendored.test.sh; open LOW: lock key unvalidated in `_dv_tree_expectations` (TODO, 7e29279).
|
- **Reference**: 14bee52; tests TREE_OWNED_* + TREE_NAMES_ERREXIT_BROKEN_LOCK in lib/tests/doctor-vendored.test.sh; open LOW: lock key unvalidated in `_dv_tree_expectations` (TODO, 7e29279).
|
||||||
|
|
||||||
|
## BDR-155 — Advisor once per main-loop run of plan/reflect-row skills; model-router prepends rule to skill body [accepted] (2026-11-24)
|
||||||
|
**Context**: User 2026-11-23: advisor called too rarely; wants it wherever main used to route to Fable (pre-BDR-150 best tier = plan/reflect rows). 7-day tally: 96 main runs of those skills, 65 advisor calls.
|
||||||
|
**Decision**: Main-loop run of skill whose model-router row = `plan`|`reflect` makes one advisor call on settled plan/diagnosis/fix, before execute or report. Call at point 1/2/3 counts. Only challenge-plan § SKIP + point 3 skips waive; other challenge guards (cosmetic /hotfix, audit/conservative modes, clean stop) still get call. Nested under plan/reflect run: none. Carrier: model-router mod prepends ADVISOR_NOTE to skill body (skill.prompt) on main loads (Skill call w/o agentId, typed slash), never sub-agent/preload. Rule text = `lib/effort-shift.md` § Advisor point 4 "Per run". Amends BDR-150: call point, never route.
|
||||||
|
**Alternatives**: Skill-result `context` (attachment channel, ignored per LRN-303); CLAUDE.global.md line (320/320 budget); per-skill body edits (55 rows, drift).
|
||||||
|
**Consequences**: ~140k input tokens per main call; harden/seo/geo/web-validate audit modes + cosmetic hotfix gain a call. Accepted gaps (shortcut comments register.ts): same-name sub-agent load mid main Skill call steals note; typed slash during in-flight Skill call loses it; concurrent main calls keep last marker. Behavioural tally deferred to 1-week re-measure. Commits d9f0f42, 1d69fce.
|
||||||
@@ -808,3 +808,6 @@ rules:
|
|||||||
## 2026-11-23
|
## 2026-11-23
|
||||||
- prompt-audit Opus 5.5: always-on ~14k tok (doctor), 5 small edits CLAUDE.global merged 38be889; olmind not found; slim gitflow/memory text = BDR-125 candidate.
|
- prompt-audit Opus 5.5: always-on ~14k tok (doctor), 5 small edits CLAUDE.global merged 38be889; olmind not found; slim gitflow/memory text = BDR-125 candidate.
|
||||||
- advisor trigger before root-cause diagnosis / user-run commands (7b63507). Measured: unserved advisor blocks beside tool_use all re-served next msg, no lost calls; lever dropped.
|
- advisor trigger before root-cause diagnosis / user-run commands (7b63507). Measured: unserved advisor blocks beside tool_use all re-served next msg, no lost calls; lever dropped.
|
||||||
|
|
||||||
|
## 2026-11-24
|
||||||
|
- advisor per-run note (d9f0f42, docs 1d69fce): mod prepends one-call rule on main plan/reflect skill loads; gates MET, sec PASS, verifier ECARTS(1)=AC6 live check pending /reload-plugins. BDR-155, LRN-306.
|
||||||
@@ -2192,3 +2192,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
|
|||||||
- **Context**: 2026-11-21/22 ship-feature modern-web-guidance. Dry run overlapped running executor → false reds; re-run after report = MET. Separate real red same run: row 10 `FAIL bun not on PATH` (see learnings line ~2009, fixed by `PATH="$HOME/.bun/bin:$PATH"` in oracle).
|
- **Context**: 2026-11-21/22 ship-feature modern-web-guidance. Dry run overlapped running executor → false reds; re-run after report = MET. Separate real red same run: row 10 `FAIL bun not on PATH` (see learnings line ~2009, fixed by `PATH="$HOME/.bun/bin:$PATH"` in oracle).
|
||||||
- **Apply**: dry run only with no live executor (before first dispatch, or after its report). Red dry run during a dispatch → re-run after report before acting on it.
|
- **Apply**: dry run only with no live executor (before first dispatch, or after its report). Red dry run during a dispatch → re-run after report before acting on it.
|
||||||
- **Reference**: lib/verify-secure-loop.md § BEFORE THE FIRST DISPATCH; BDR-151 lever 4 (contract dry run).
|
- **Reference**: lib/verify-secure-loop.md § BEFORE THE FIRST DISPATCH; BDR-151 lever 4 (contract dry run).
|
||||||
|
|
||||||
|
## LRN-306 — doctrine-citers captures unquoted section label over following words; close label with paren (2026-11-24)
|
||||||
|
**Pattern**: doctrine-citers T6 (lib/tests/doctrine-citers.test.sh:78) captures unquoted `§ <Label>` greedily over following words: "`lib/challenge-plan.md` § SKIP and point 3's skips" → label "SKIP and point", no heading starts with it → dangling cite, suite red.
|
||||||
|
**Context**: /feat advisor per-run note 2026-11-24, effort-shift point 4; executor reworded.
|
||||||
|
**Apply**: in .md doctrine, end a § label at clause end or close it with ")": "(`lib/challenge-plan.md` § SKIP)". Dry-run planned prose through doctrine-citers before dispatch (LRN-296 scratch-copy pattern).
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# CONTRACT — advisor note per former-Fable skill run
|
||||||
|
- run-base: 4b8ed29736d0975544c0348f00204eb7bae7f92f
|
||||||
|
|
||||||
|
## REQUEST (verbatim)
|
||||||
|
User 2026-11-23: "il faut appeler l'adviser partout ou initialement on avait
|
||||||
|
le routage ver fable aussi." Answers (same day): scope = "Un appel par run";
|
||||||
|
skips = "Les garder"; sub-agents = "Rien ne change".
|
||||||
|
|
||||||
|
## CLARIFICATIONS
|
||||||
|
- [gated] One main-loop advisor call per run of a skill whose routing.json
|
||||||
|
row phase is `plan` or `reflect` (the rows that lifted main to Fable before
|
||||||
|
BDR-150; rows unchanged since 24b0f35^). A call the skill already places
|
||||||
|
counts. Existing skips stay. Sub-agent advisor scope unchanged.
|
||||||
|
- [gated] Plan r4 § Rule 1-4: one call on the settled plan/diagnosis/fix;
|
||||||
|
a point 1-3 call counts; only challenge-plan § SKIP and point 3 skips
|
||||||
|
waive it (other challenge guards get the call: cosmetic /hotfix gains
|
||||||
|
one, as told to the user); nested under a plan/reflect run: no call.
|
||||||
|
Row phase read from the merged config.
|
||||||
|
- [internal] Carrier: the model-router mod prepends one note line to the
|
||||||
|
skill body (skill.prompt) for main-loop loads only (main Skill tool call or
|
||||||
|
user-typed slash), never sub-agent loads or preloads.
|
||||||
|
|
||||||
|
- [gated 2026-11-24] Deferred point "behavioural tally (calls per run
|
||||||
|
counted in transcripts)": keep. Not a criterion of this run; done at the
|
||||||
|
one-week re-measure with the same transcript count. User: "tu peux lancer".
|
||||||
|
|
||||||
|
## ACCEPTANCE CRITERIA
|
||||||
|
1. A main-loop load of a plan/reflect row (Skill tool call without agentId,
|
||||||
|
or a user-typed slash) gets ADVISOR_NOTE prepended to the skill text;
|
||||||
|
prefixed rows (`pack-design:frontend-design`) too. Mod suite green.
|
||||||
|
CHECK: cd /home/bchanot/Documents/claude && timeout 300 claude plugin test mods/model-router 2>&1 | grep -cE '^ *0 fail$'
|
||||||
|
EXPECT: 1
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: 1
|
||||||
|
2. No note for: a sub-agent Skill load (agentId set), a preload (no Skill
|
||||||
|
call, not typed), a row of another phase (capitalize), an unrowed skill,
|
||||||
|
the mod off. Each case has a test whose name starts "advisor note".
|
||||||
|
CHECK: n=$(grep -c "test('advisor note:" /home/bchanot/Documents/claude/mods/model-router/hooks/register.test.ts); [ "$n" -ge 11 ] && echo enough || echo "only $n"
|
||||||
|
EXPECT: enough
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: enough
|
||||||
|
3. lib/effort-shift.md § Advisor gains point 4 `**Per run.**`.
|
||||||
|
CHECK: grep -c '^4\. \*\*Per run\.\*\*' /home/bchanot/Documents/claude/lib/effort-shift.md
|
||||||
|
EXPECT: 1
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: 1
|
||||||
|
4. `make test` green except the baseline memory-feedback suite (bun not on PATH).
|
||||||
|
CHECK: cd /home/bchanot/Documents/claude && make test 2>&1 | grep 'suite(s) red'
|
||||||
|
EXPECT: 1 suite(s) red: lib/tests/memory-feedback.test.sh
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: 1 suite(s) red: lib/tests/memory-feedback.test.sh
|
||||||
|
5. CLAUDE.global.md and routing.json untouched by this run (routing.json's
|
||||||
|
working-tree `"close": "apply"` predates the run: live mod dialog).
|
||||||
|
CHECK: cd /home/bchanot/Documents/claude && git diff --quiet 4b8ed29..HEAD -- CLAUDE.global.md mods/model-router/routing.json && git diff --quiet -- CLAUDE.global.md && echo untouched
|
||||||
|
EXPECT: untouched
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: untouched
|
||||||
|
6. Live precondition before any merge proposal (not a test): after the user
|
||||||
|
runs /reload-plugins, with a background sub-agent live (typed fallback
|
||||||
|
off), a main-loop Skill load of one reflect row and one pack row shows
|
||||||
|
the note; until then reported "not verified live".
|
||||||
|
|
||||||
|
## FILE SCOPE
|
||||||
|
- mods/model-router/hooks/register.ts
|
||||||
|
- mods/model-router/hooks/register.test.ts
|
||||||
|
- lib/effort-shift.md
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
# PLAN — advisor note per former-Fable skill run (r4)
|
||||||
|
|
||||||
|
CONTRACT: .claude/tasks/contracts/2026-11-23-advisor-skill-note-1840.md
|
||||||
|
|
||||||
|
## Rule (the same words in the note and in point 4)
|
||||||
|
1. A main-loop run of a skill whose row phase (merged config `st.cfg`) is
|
||||||
|
`plan` or `reflect` makes one advisor call on its settled plan,
|
||||||
|
diagnosis or fix, before it executes or reports (at load when the run
|
||||||
|
starts from a settled plan).
|
||||||
|
2. A call made this run at point 1, 2 or 3 of § Advisor counts as this one.
|
||||||
|
3. Only two kinds of skip waive it: `lib/challenge-plan.md` § SKIP (placed
|
||||||
|
decision) and point 3's named skips. Any other skip of a challenge step
|
||||||
|
(hotfix's cosmetic guard, harden or web-validate MODE=audit, seo or geo
|
||||||
|
conservative mode, code-clean's clean stop) does not waive it: the call
|
||||||
|
is made where that step would have run.
|
||||||
|
4. A skill loaded inside a plan/reflect skill's run makes no call of its
|
||||||
|
own (the outer run owns it); under a skill of another row or no row, it
|
||||||
|
calls.
|
||||||
|
|
||||||
|
## Note text (exact, one source line, then "\n\n", prepended)
|
||||||
|
"Advisor (`~/.claude/lib/effort-shift.md` § Advisor, **Per run**): when the
|
||||||
|
`advisor` tool is listed, this skill run makes one main-loop advisor call on
|
||||||
|
its settled plan, diagnosis or fix, before it executes or reports. A call
|
||||||
|
this run already made at an advisor point counts. Only
|
||||||
|
`~/.claude/lib/challenge-plan.md` § SKIP and the end-of-run skips waive it;
|
||||||
|
any other skipped challenge step still gets the call where it would have
|
||||||
|
run. Loaded inside another plan/reflect skill's run: no call of its own."
|
||||||
|
|
||||||
|
## Files
|
||||||
|
- [ ] mods/model-router/hooks/register.ts
|
||||||
|
- Consts near REFERENCE_SKILLS: `ADVISOR_NOTE` (text above + "\n\n"),
|
||||||
|
`ADVISOR_PHASES = new Set(['plan', 'reflect'])`.
|
||||||
|
- State field `advisorSkill: string | null`, init null in the state
|
||||||
|
factory (~line 1028), comment "main-loop Skill load awaiting its note".
|
||||||
|
- Helper `advisorDue(st, skill): boolean` = `skillRow(st, skill)?.phase`
|
||||||
|
in ADVISOR_PHASES (row-phase test only; `st.off` is handled by the
|
||||||
|
existing early returns).
|
||||||
|
- registerSkills tool.call (~4627): decide due-ness with the SAME name
|
||||||
|
`onSkillLoad` routes by. Immediately before `const out = await next(e)`
|
||||||
|
(after tierAsk), if `e.agentId === undefined && advisorDue(st, skill)`
|
||||||
|
set `st.advisorSkill = skill`. In `finally`: `if (e.agentId ===
|
||||||
|
undefined) st.advisorSkill = null`. No name normalization (no
|
||||||
|
skillKey): AC6 live check decides whether names ever differ.
|
||||||
|
- registerSkills skill.prompt (~4650):
|
||||||
|
- In-call branch (`st.skillCalls > 0`, mod on): `const out = await
|
||||||
|
next(e)`; if `st.advisorSkill === e.skill` → set `st.advisorSkill =
|
||||||
|
null` and return `{ text: ADVISOR_NOTE + out.text }`; else `out`.
|
||||||
|
- Typed branch: evaluate `typed && advisorDue(st, e.skill)` AFTER
|
||||||
|
`confirmSkill` returns (a first-use move counts), then wrap the
|
||||||
|
`next(e)` result the same way.
|
||||||
|
- Accepted gaps (state them in a code comment at the marker): a same-name
|
||||||
|
sub-agent load while a main Skill call is in flight takes the note (and
|
||||||
|
the main load loses it); a typed slash whose prompt lands while any
|
||||||
|
Skill call is in flight loses its note; two concurrent main Skill calls
|
||||||
|
keep only the last marker. skill.prompt carries no agentId.
|
||||||
|
- [ ] mods/model-router/hooks/register.test.ts — `describe('advisor note')`
|
||||||
|
with tests titled `test('advisor note: …'`. Local rig: a world built with
|
||||||
|
`newWorld({ edit: f => Object.assign(f.skills, { 'writing-plans': 'plan',
|
||||||
|
'pack-design:frontend-design': 'reflect', capitalize: 'apply' }) })`
|
||||||
|
(adapt to the fixture API), and a bottom Skill tool modeled on the test
|
||||||
|
at ~line 1613 that calls `$.skill.prompt({ skill: e.skill, text: 'BODY' })`
|
||||||
|
and returns its text in the result so the test can read it. Assert with a
|
||||||
|
literal prefix duplicated in the test: `'Advisor (`~/.claude/lib/effort-
|
||||||
|
shift.md` § Advisor, **Per run**)'` (no export from register.ts).
|
||||||
|
Cases (11): main `feat` → note; main `writing-plans` → note; main
|
||||||
|
`pack-design:frontend-design` → note; agentId set → no note; preload
|
||||||
|
(skill.prompt, no Skill call, not typed, a sub-agent spawned so the typed
|
||||||
|
fallback is off) → no note; `capitalize` (apply) → no note; `status`
|
||||||
|
(mechanical) → no note; unrowed skill → no note; `/route off` → no note;
|
||||||
|
typed `/feat` → note; sub-agent Skill call ending during a main call does
|
||||||
|
not clear the main marker (note still on the main load).
|
||||||
|
- [ ] lib/effort-shift.md § Advisor — after item 3 (ends "…a new run."):
|
||||||
|
"4. **Per run.** A main-loop run of a skill whose model-router row is
|
||||||
|
`plan` or `reflect` (the rows that put main on Fable before BDR-150)
|
||||||
|
makes one call on its settled plan, diagnosis or fix, before it
|
||||||
|
executes or reports (at load when it starts from a settled plan). A
|
||||||
|
call this run made at point 1, 2 or 3 counts as this one. Only
|
||||||
|
`lib/challenge-plan.md` § SKIP and point 3's skips waive it; any other
|
||||||
|
skipped challenge step (hotfix's cosmetic guard, an audit-only or
|
||||||
|
conservative mode, a clean stop) gets the call where that step would
|
||||||
|
have run. A skill loaded inside a plan/reflect skill's run makes none;
|
||||||
|
under another row or none, it calls. The model-router mod prepends
|
||||||
|
this rule to the skill body on a main-loop load, never on a
|
||||||
|
sub-agent's."
|
||||||
|
|
||||||
|
## Edge cases
|
||||||
|
- Mod off → no note (existing early returns). Hook failure → passthrough.
|
||||||
|
- Nested loads under a plan/reflect run still carry the note; its last
|
||||||
|
sentence says no call.
|
||||||
|
- routing.json dirty before the run: never edited or staged by this run.
|
||||||
|
|
||||||
|
## Disposition
|
||||||
|
- honors BDR-150 (a call point, not a route); LRN-303 (body carrier over
|
||||||
|
Skill-result `context`, an attachment channel LRN-303 found ignored;
|
||||||
|
price = the marker and its accepted gaps).
|
||||||
|
- honors user picks 2026-11-23: one call per run; the advisor-section skips
|
||||||
|
kept (§ SKIP, point 3); sub-agent scope unchanged; cosmetic /hotfix gains
|
||||||
|
its call. Challenge-step guards that never were advisor skips now get the
|
||||||
|
call (that is what "one per run" buys).
|
||||||
|
- CLAUDE.global.md untouched. README/USAGE/CHANGELOG via STEP 6.
|
||||||
|
- [deferred] behavioural tally (calls per run counted in transcripts):
|
||||||
|
needs real runs after reload; proposed = the one-week re-measure already
|
||||||
|
promised to the user, run with the same transcript count.
|
||||||
@@ -11,6 +11,7 @@ The BDR-125 context queue is delivered: phases 0, 0b, 4a, 1, 5, 2 and 4b-4d ship
|
|||||||
### Added
|
### 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`.
|
- **/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`.
|
- **/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`.
|
||||||
|
- **model-router advisor note (`lib/effort-shift.md` § Advisor, point 4 Per run)**: when the main loop loads a skill whose row is `plan` or `reflect`, typed or loaded by the model, the mod prepends a one-call-per-run advisor rule to the skill body; a sub-agent's load, a preloaded skill, any other row and `/route off` get none. That run makes one main-loop advisor call on its settled plan, diagnosis or fix before it executes or reports. A call made at another advisor point counts; only the placed-decision skip (`lib/challenge-plan.md` § SKIP) and the end-of-run skips waive it, and a skill loaded inside such a run makes none. Tests: `mods/model-router/hooks/register.test.ts` (advisor note: …).
|
||||||
- **Modern Web Guidance**: Google's guides (GoogleChrome/modern-web-guidance, tag v1.0.1, commit `64a6d70`) are vendored as a git-tree pin (`managed_by: git-tree` in `plugins.lock.json`) into `skills-external/mwg/`, with `chrome-extensions` into `skills-external/chrome-extensions/`. `make plugin` (install-plugins.sh Step 8e) and `make update` fetch them through `lib/vendor-skills.sh vendor_pinned_tree`; a failed fetch keeps the previous copy and warns. Licenses: Apache-2.0 (code), CC-BY 4.0 (guides).
|
- **Modern Web Guidance**: Google's guides (GoogleChrome/modern-web-guidance, tag v1.0.1, commit `64a6d70`) are vendored as a git-tree pin (`managed_by: git-tree` in `plugins.lock.json`) into `skills-external/mwg/`, with `chrome-extensions` into `skills-external/chrome-extensions/`. `make plugin` (install-plugins.sh Step 8e) and `make update` fetch them through `lib/vendor-skills.sh vendor_pinned_tree`; a failed fetch keeps the previous copy and warns. Licenses: Apache-2.0 (code), CC-BY 4.0 (guides).
|
||||||
- **`modern-web-guidance` skill** (always on): picks guides from the generated `mwg/INDEX.md` and reads them locally, Read only, no npx, no network. It runs first for front-end work (HTML, CSS, client-side JS, components, forms, layout, motion, Core Web Vitals, images, accessibility), and the answer that delivers a front-end change ends with one line, `Modern Web Guidance: <id>, <id>`.
|
- **`modern-web-guidance` skill** (always on): picks guides from the generated `mwg/INDEX.md` and reads them locally, Read only, no npx, no network. It runs first for front-end work (HTML, CSS, client-side JS, components, forms, layout, motion, Core Web Vitals, images, accessibility), and the answer that delivers a front-end change ends with one line, `Modern Web Guidance: <id>, <id>`.
|
||||||
- **chrome-extensions**: linked always on by `link.sh`.
|
- **chrome-extensions**: linked always on by `link.sh`.
|
||||||
|
|||||||
@@ -88,8 +88,12 @@ security PASS, not DEGRADED, each on its first attempt, their summary's
|
|||||||
`ADVISOR` field then reading `skipped (gates clean on first pass)`;
|
`ADVISOR` field then reading `skipped (gates clean on first pass)`;
|
||||||
`/audit-delta` and `/tour` when the run applied no fix), before
|
`/audit-delta` and `/tour` when the run applied no fix), before
|
||||||
recommending a change to the doctrine, the architecture or a public interface,
|
recommending a change to the doctrine, the architecture or a public interface,
|
||||||
and before handing the user a root-cause diagnosis or commands to run on
|
before handing the user a root-cause diagnosis or commands to run on
|
||||||
their machine.
|
their machine, and once per main-loop run of a skill whose router row is
|
||||||
|
`plan` or `reflect`, on its settled plan, diagnosis or fix before it
|
||||||
|
executes or reports (a call made at another point counts; only the
|
||||||
|
placed-decision skip and the end-of-run skips waive it; a skill loaded
|
||||||
|
inside such a run makes none).
|
||||||
plan-challenger, verifier, security-auditor, `analyzer` and an opus code
|
plan-challenger, verifier, security-auditor, `analyzer` and an opus code
|
||||||
review (`/ship-feature` STEP 6, `/init-project` STEP 10, a standalone
|
review (`/ship-feature` STEP 6, `/init-project` STEP 10, a standalone
|
||||||
subagent-driven-development final review) may call it once when dispatched
|
subagent-driven-development final review) may call it once when dispatched
|
||||||
@@ -167,6 +171,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.
|
- 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.
|
- 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, nor does a reference skill, `modern-web-guidance` or `find-docs`, which writes no code), 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.
|
- 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, nor does a reference skill, `modern-web-guidance` or `find-docs`, which writes no code), 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.
|
||||||
|
- Advisor note: when the main loop loads a skill whose row is `plan` or `reflect` (typed, or loaded by the model through the Skill tool), the mod prepends the per-run advisor rule (`lib/effort-shift.md` § Advisor, point 4) to the skill body. A sub-agent's load, a preloaded skill, any other row and `/route off` get none.
|
||||||
- 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.
|
- 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.
|
- `/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.
|
- 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.
|
||||||
|
|||||||
@@ -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
|
externes vendorés (pile design, superpowers, agent-skills, skills scroll
|
||||||
MengTo, 21st) ont aussi leur ligne.
|
MengTo, 21st) ont aussi leur ligne.
|
||||||
|
|
||||||
Taper un skill qui a une ligne route la boucle principale dessus. Une ligne du tier best (plan, reflect, orchestrate, escalate ; `audit` est une ligne d'agent, jamais tapée) tient d'un tour à l'autre pendant tout le run, jusqu'à `/route clear`, `/route off`, un `/model` tapé ou choisi dans le sélecteur, ou un skill d'un autre tier tapé. Un `/model <nom>` tapé, ou un choix dans le sélecteur `/model`, avec un modèle de la table demande sa portée (Échap ne change rien). Le changement du sélecteur est d'abord retenu (le moteur affiche qu'un hook l'a bloqué), puis la question vient ; un choix fait pendant qu'un autre dialogue est ouvert est refusé (`answer the open dialog first`) : This project écrit l'id complet dans `model` du `.claude/settings.local.json` du projet (créé s'il manque, à garder dans le `.gitignore`) et pose une route de modèle tenue ; This conversation pose la route seule, sans rien écrire ; Everywhere lance le `/model` natif (`settings.json` utilisateur, tous les projets). Default dans le sélecteur, sans argument, avec un nom inconnu, en headless (`-p`) ou mod coupé, le `/model` natif passe sans question. Un modèle choisi dans ce dialogue change toujours : ni plafond de relecture à froid, ni `mainUpgrade` ni `mainModelSwitch`. S'il est en panne, la boucle principale reste où elle est jusqu'à son retour. Un changement natif (ligne Model de `/config` comprise) ou `/clear` l'abandonne ; un `/route model=` tapé garde les plafonds. La ligne Model de `/config` écrit toujours le `settings.json` utilisateur, et un dialogue jamais répondu n'a pas de délai. Pour relancer un tour bloqué : `ultrathink` dans le prompt (plancher d'effort du tour) ou `/route effort=max` (tient jusqu'à `/route clear`). Le `/effort` intégré n'a pas d'effet dans un run : les lignes et les routes passent devant. Les règles de mots-clés du prompt (`plan`, `design`, `architecture`… prennent l'effort de plan ; `pourquoi`, `review`, `audit`… celui de reflect), `ultrathink` et un lancement d'agent par la boucle principale (route `orchestrate` dérivée, tenue jusqu'à la fin de ses agents en arrière-plan) ne fixent que le niveau d'effort du tour, jamais le modèle : ils ne font jamais monter la boucle principale au-dessus du modèle de la session, et un run best tenu garde son modèle. Fable n'arrive sur la boucle principale que par un choix à la main (`/model`, sélecteur), un `/route model=fable` tapé, une phase qui nomme `model: fable` ou une config machine qui le place dans un tier : aucun tier ni aucune phase livrés ne le contiennent. Fable sert de conseiller (outil advisor, `advisorModel` dans settings.json, réglé par `/advisor`) : la boucle principale l'appelle au moins sur le plan écrit, avant que les challengers du plan le voient (`lib/challenge-plan.md`, une fois par run de skill ; la ligne `Advisor:` du CHALLENGE SUMMARY dit ce qu'il a changé ; sauté avec le challenge quand le run ne fait que placer une décision déjà prise par l'utilisateur, la ligne `Challenge: skipped (placed decision: …)` remplaçant alors le CHALLENGE SUMMARY), une fois par run verify-secure à la première boucle de porte qui échoue deux fois (le conseil reste dans la boucle principale, jamais dans le brief d'un exécutant ; un STOP au plafond ou en escalade le reprend), avant de proposer un merge ou de déclarer finie une longue tâche (deux exceptions : `/feat` et `/bugfix` le sautent quand GATE 0 a dit MET, le verifier CONFORME et la sécurité PASS, pas DEGRADED, chacun au premier essai, et leur champ `ADVISOR` affiche alors `skipped (gates clean on first pass)` ; `/audit-delta` et `/tour` le sautent quand le run n'a appliqué aucun fix), avant de recommander un changement de la doctrine, de l'architecture ou d'une interface publique, et avant de remettre à l'utilisateur un diagnostic de cause racine ou des commandes à lancer sur sa machine ; plan-challenger, verifier, security-auditor, `analyzer` et une revue de code sur opus (`/ship-feature` STEP 6, `/init-project` STEP 10, revue finale d'un subagent-driven-development lancé seul) peuvent l'appeler une fois, seulement quand ils sont lancés comme sous-agents, avant leur verdict ou leur rapport : un conseil peut ajouter un constat ou relever sa sévérité, jamais le retirer, l'abaisser ni l'effacer ; les autres sous-agents ne l'appellent jamais, même quand l'outil est listé, et le hook SubagentStart `hooks/subagent-advisor.sh` leur rappelle la règle au lancement. Conseiller absent ou en erreur : on continue ; un conseil ne lève aucune porte, aucun plafond ni aucune garde. Un prompt tapé sans règle, skill ni route en cours passe par un classifieur (un appel au petit modèle, 3 secondes au plus) : le tour prend la route de la phase devinée : son niveau d'effort, et son modèle, jamais au-dessus de celui de la session. Une devinette `coding` ou `bookkeeping` fait descendre la boucle principale vers un modèle moins cher quand `mainMoLine truncated
|
Taper un skill qui a une ligne route la boucle principale dessus. Une ligne du tier best (plan, reflect, orchestrate, escalate ; `audit` est une ligne d'agent, jamais tapée) tient d'un tour à l'autre pendant tout le run, jusqu'à `/route clear`, `/route off`, un `/model` tapé ou choisi dans le sélecteur, ou un skill d'un autre tier tapé. Un `/model <nom>` tapé, ou un choix dans le sélecteur `/model`, avec un modèle de la table demande sa portée (Échap ne change rien). Le changement du sélecteur est d'abord retenu (le moteur affiche qu'un hook l'a bloqué), puis la question vient ; un choix fait pendant qu'un autre dialogue est ouvert est refusé (`answer the open dialog first`) : This project écrit l'id complet dans `model` du `.claude/settings.local.json` du projet (créé s'il manque, à garder dans le `.gitignore`) et pose une route de modèle tenue ; This conversation pose la route seule, sans rien écrire ; Everywhere lance le `/model` natif (`settings.json` utilisateur, tous les projets). Default dans le sélecteur, sans argument, avec un nom inconnu, en headless (`-p`) ou mod coupé, le `/model` natif passe sans question. Un modèle choisi dans ce dialogue change toujours : ni plafond de relecture à froid, ni `mainUpgrade` ni `mainModelSwitch`. S'il est en panne, la boucle principale reste où elle est jusqu'à son retour. Un changement natif (ligne Model de `/config` comprise) ou `/clear` l'abandonne ; un `/route model=` tapé garde les plafonds. La ligne Model de `/config` écrit toujours le `settings.json` utilisateur, et un dialogue jamais répondu n'a pas de délai. Pour relancer un tour bloqué : `ultrathink` dans le prompt (plancher d'effort du tour) ou `/route effort=max` (tient jusqu'à `/route clear`). Le `/effort` intégré n'a pas d'effet dans un run : les lignes et les routes passent devant. Les règles de mots-clés du prompt (`plan`, `design`, `architecture`… prennent l'effort de plan ; `pourquoi`, `review`, `audit`… celui de reflect), `ultrathink` et un lancement d'agent par la boucle principale (route `orchestrate` dérivée, tenue jusqu'à la fin de ses agents en arrière-plan) ne fixent que le niveau d'effort du tour, jamais le modèle : ils ne font jamais monter la boucle principale au-dessus du modèle de la session, et un run best tenu garde son modèle. Fable n'arrive sur la boucle principale que par un choix à la main (`/model`, sélecteur), un `/route model=fable` tapé, une phase qui nomme `model: fable` ou une config machine qui le place dans un tier : aucun tier ni aucune phase livrés ne le contiennent. Fable sert de conseiller (outil advisor, `advisorModel` dans settings.json, réglé par `/advisor`) : la boucle principale l'appelle au moins sur le plan écrit, avant que les challengers du plan le voient (`lib/challenge-plan.md`, une fois par run de skill ; la ligne `Advisor:` du CHALLENGE SUMMARY dit ce qu'il a changé ; sauté avec le challenge quand le run ne fait que placer une décision déjà prise par l'utilisateur, la ligne `Challenge: skipped (placed decision: …)` remplaçant alors le CHALLENGE SUMMARY), une fois par run verify-secure à la première boucle de porte qui échoue deux fois (le conseil reste dans la boucle principale, jamais dans le brief d'un exécutant ; un STOP au plafond ou en escalade le reprend), avant de proposer un merge ou de déclarer finie une longue tâche (deux exceptions : `/feat` et `/bugfix` le sautent quand GATE 0 a dit MET, le verifier CONFORME et la sécurité PASS, pas DEGRADED, chacun au premier essai, et leur champ `ADVISOR` affiche alors `skipped (gates clean on first pass)` ; `/audit-delta` et `/tour` le sautent quand le run n'a appliqué aucun fix), avant de recommander un changement de la doctrine, de l'architecture ou d'une interface publique, avant de remettre à l'utilisateur un diagnostic de cause racine ou des commandes à lancer sur sa machine, et une fois par run, sur la boucle principale, d'un skill dont la ligne est `plan` ou `reflect`, sur son plan, son diagnostic ou son fix arrêté, avant qu'il exécute ou rende compte (un appel fait à un autre point compte ; seuls le saut de décision placée et les sauts de fin de run l'en dispensent ; un skill chargé dans un tel run n'en fait pas, et le mod ajoute cette règle en tête du corps du skill quand la boucle principale le charge, tapé ou chargé par le modèle, jamais pour un sous-agent) ; plan-challenger, verifier, security-auditor, `analyzer` et une revue de code sur opus (`/ship-feature` STEP 6, `/init-project` STEP 10, revue finale d'un subagent-driven-development lancé seul) peuvent l'appeler une fois, seulement quand ils sont lancés comme sous-agents, avant leur verdict ou leur rapport : un conseil peut ajouter un constat ou relever sa sévérité, jamais le retirer, l'abaisser ni l'effacer ; les autres sous-agents ne l'appellent jamais, même quand l'outil est listé, et le hook SubagentStart `hooks/subagent-advisor.sh` leur rappelLine 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, un skill de référence non plus, `modern-web-guidance` ou `find-docs`, qui n'écrit pas de code), 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.
|
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, un skill de référence non plus, `modern-web-guidance` ou `find-docs`, qui n'écrit pas de code), 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.
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,18 @@ triggers in CLAUDE.global.md § Workflow):
|
|||||||
reuses the last run's answer, or its skip, and names any code commit
|
reuses the last run's answer, or its skip, and names any code commit
|
||||||
made after it (doc and memory commits excepted). Elsewhere the
|
made after it (doc and memory commits excepted). Elsewhere the
|
||||||
answer is reported only and a fix it calls for is a new run.
|
answer is reported only and a fix it calls for is a new run.
|
||||||
|
4. **Per run.** A main-loop run of a skill whose model-router row is
|
||||||
|
`plan` or `reflect` (the rows that put main on Fable before BDR-150)
|
||||||
|
makes one call on its settled plan, diagnosis or fix, before it
|
||||||
|
executes or reports (at load when it starts from a settled plan). A
|
||||||
|
call this run made at point 1, 2 or 3 counts as this one. Only the
|
||||||
|
placed-decision skip (`lib/challenge-plan.md` § SKIP) and point 3's
|
||||||
|
skips waive it; any other skipped challenge step (hotfix's cosmetic
|
||||||
|
guard, an audit-only or conservative mode, a clean stop) gets the
|
||||||
|
call where that step would have run. A skill loaded inside a
|
||||||
|
plan/reflect skill's run makes none; under another row or none, it
|
||||||
|
calls. The model-router mod prepends this rule to the skill body on a
|
||||||
|
main-loop load, never on a sub-agent's.
|
||||||
|
|
||||||
Inside a skill run, the points above also cover the triggers of
|
Inside a skill run, the points above also cover the triggers of
|
||||||
CLAUDE.global.md § Workflow; no second call for the same recommendation.
|
CLAUDE.global.md § Workflow; no second call for the same recommendation.
|
||||||
|
|||||||
@@ -7744,3 +7744,110 @@ test('GUARD: an isError Skill answer leaves the latch closed', async (
|
|||||||
await $.tool.call({ tool: 'Skill', skill: 'diagram' } as never)
|
await $.tool.call({ tool: 'Skill', skill: 'diagram' } as never)
|
||||||
expect(denied(await write($, `${ROOT}/src/a.ts`))).toContain(GUARD)
|
expect(denied(await write($, `${ROOT}/src/a.ts`))).toContain(GUARD)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// ---- advisor note: one main-loop advisor call per plan/reflect run ------
|
||||||
|
|
||||||
|
// duplicated on purpose: register.ts exports no constant
|
||||||
|
const NOTE = 'Advisor (`~/.claude/lib/effort-shift.md` § Advisor, **Per run**)'
|
||||||
|
|
||||||
|
const noteWorld = () => newWorld({
|
||||||
|
edit: f => {
|
||||||
|
Object.assign(f.skills as Rec, {
|
||||||
|
'writing-plans': 'plan',
|
||||||
|
'pack-design:frontend-design': 'reflect',
|
||||||
|
capitalize: 'apply',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A rig whose bottom Skill tool loads the skill body through skill.prompt,
|
||||||
|
* as the engine does, and answers the loaded text as `commandName`.
|
||||||
|
*/
|
||||||
|
async function noteRig($: Engine, on: On, gate?: Promise<void>) {
|
||||||
|
on('tool.call', { tool: 'Skill' }, async (_api, e) => {
|
||||||
|
if (e.agentId === undefined) await gate
|
||||||
|
const out = await $.skill.prompt({ skill: String(e.skill), text: 'BODY' })
|
||||||
|
return { result: { success: true, commandName: out.text } }
|
||||||
|
})
|
||||||
|
await bootRig($, on, FABLE, 1000, noteWorld())
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The body a Skill call loaded, as the bottom tool answered it. */
|
||||||
|
async function bodyOf(
|
||||||
|
$: Engine,
|
||||||
|
skill: string,
|
||||||
|
agentId?: string,
|
||||||
|
): Promise<string> {
|
||||||
|
const out = await loadSkill($, skill, agentId)
|
||||||
|
return (out as unknown as { result: { commandName: string } })
|
||||||
|
.result.commandName
|
||||||
|
}
|
||||||
|
|
||||||
|
test('advisor note: a main feat load carries it', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
const body = await bodyOf($, 'feat')
|
||||||
|
expect(body.startsWith(NOTE)).toBe(true)
|
||||||
|
expect(body.endsWith('\n\nBODY')).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a main plan row carries it', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'writing-plans')).toContain(NOTE)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a prefixed reflect row carries it', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'pack-design:frontend-design')).toContain(NOTE)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a sub-agent load carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'feat', 'a1')).toBe('BODY')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a preload carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
await $.agent.spawn(spawnOf('feater'))
|
||||||
|
expect((await skillPrompt($, 'feat')).text).toBe('x')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: an apply row carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'capitalize')).toBe('BODY')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a mechanical row carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'status')).toBe('BODY')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: an unrowed skill carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
expect(await bodyOf($, 'diagram')).toBe('BODY')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: /route off carries none', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
await route($, 'off')
|
||||||
|
expect(await bodyOf($, 'feat')).toBe('BODY')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a typed /feat carries it', async ($, on) => {
|
||||||
|
await noteRig($, on)
|
||||||
|
await typed($, '/feat add a thing')
|
||||||
|
const out = await skillPrompt($, 'feat')
|
||||||
|
expect(out.text.startsWith(NOTE)).toBe(true)
|
||||||
|
expect(out.text.endsWith('\n\nx')).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('advisor note: a sub-agent load ending mid-call keeps the main one', async (
|
||||||
|
$, on) => {
|
||||||
|
let release: () => void = () => undefined
|
||||||
|
const gate = new Promise<void>(resolve => { release = resolve })
|
||||||
|
await noteRig($, on, gate)
|
||||||
|
const main = bodyOf($, 'feat')
|
||||||
|
expect(await bodyOf($, 'status', 'a1')).toBe('BODY')
|
||||||
|
release()
|
||||||
|
expect(await main).toContain(NOTE)
|
||||||
|
})
|
||||||
@@ -95,6 +95,7 @@ type State = {
|
|||||||
loops: Map<string, Loop> // agentId -> that loop's routing
|
loops: Map<string, Loop> // agentId -> that loop's routing
|
||||||
explicitEffort: Map<string, Level> // Agent tool_use_id -> effort param
|
explicitEffort: Map<string, Level> // Agent tool_use_id -> effort param
|
||||||
skillCalls: number // Skill tool calls in flight
|
skillCalls: number // Skill tool calls in flight
|
||||||
|
advisorSkill: string | null // main-loop Skill load awaiting its note
|
||||||
off: boolean // /route off or config: every hook passes through
|
off: boolean // /route off or config: every hook passes through
|
||||||
offConfig: boolean // `off` comes from the config key `enabled`
|
offConfig: boolean // `off` comes from the config key `enabled`
|
||||||
spinner: string // "model/effort" of the last main step of this turn
|
spinner: string // "model/effort" of the last main step of this turn
|
||||||
@@ -192,6 +193,18 @@ const INHERITING_AGENTS: ReadonlySet<string> = new Set(['general-purpose'])
|
|||||||
const REFERENCE_SKILLS: ReadonlySet<string> = new Set([
|
const REFERENCE_SKILLS: ReadonlySet<string> = new Set([
|
||||||
'modern-web-guidance', 'find-docs',
|
'modern-web-guidance', 'find-docs',
|
||||||
])
|
])
|
||||||
|
// Rows whose skill run makes one main-loop advisor call (effort-shift.md
|
||||||
|
// § Advisor, point 4); ADVISOR_NOTE is the rule, prepended to the body.
|
||||||
|
const ADVISOR_PHASES: ReadonlySet<string> = new Set(['plan', 'reflect'])
|
||||||
|
const ADVISOR_NOTE =
|
||||||
|
'Advisor (`~/.claude/lib/effort-shift.md` § Advisor, **Per run**): when ' +
|
||||||
|
'the `advisor` tool is listed, this skill run makes one main-loop ' +
|
||||||
|
'advisor call on its settled plan, diagnosis or fix, before it executes ' +
|
||||||
|
'or reports. A call this run already made at an advisor point counts. ' +
|
||||||
|
'Only `~/.claude/lib/challenge-plan.md` § SKIP and the end-of-run skips ' +
|
||||||
|
'waive it; any other skipped challenge step still gets the call where ' +
|
||||||
|
'it would have run. Loaded inside another plan/reflect skill\'s run: no ' +
|
||||||
|
'call of its own.\n\n'
|
||||||
// PostModelSwitch sources a person chose (auto and resume are not).
|
// PostModelSwitch sources a person chose (auto and resume are not).
|
||||||
const USER_SWITCH: ReadonlySet<string> = new Set([
|
const USER_SWITCH: ReadonlySet<string> = new Set([
|
||||||
'command', 'picker', 'sdk',
|
'command', 'picker', 'sdk',
|
||||||
@@ -1026,6 +1039,7 @@ function newState(cfg: Config, source: string): State {
|
|||||||
loops: new Map(),
|
loops: new Map(),
|
||||||
explicitEffort: new Map(),
|
explicitEffort: new Map(),
|
||||||
skillCalls: 0,
|
skillCalls: 0,
|
||||||
|
advisorSkill: null,
|
||||||
off: false,
|
off: false,
|
||||||
offConfig: false,
|
offConfig: false,
|
||||||
spinner: '',
|
spinner: '',
|
||||||
@@ -3754,6 +3768,12 @@ function skillRow(st: State, skill: string): Picked | undefined {
|
|||||||
return phase !== undefined && route ? { phase, route } : undefined
|
return phase !== undefined && route ? { phase, route } : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether a skill's row phase owes its run one advisor call. */
|
||||||
|
function advisorDue(st: State, skill: string): boolean {
|
||||||
|
const phase = skillRow(st, skill)?.phase
|
||||||
|
return phase !== undefined && ADVISOR_PHASES.has(phase)
|
||||||
|
}
|
||||||
|
|
||||||
/** The run slot's model outranks the route's: a helper moves effort only. */
|
/** The run slot's model outranks the route's: a helper moves effort only. */
|
||||||
function belowRun(st: State, route: Route): boolean {
|
function belowRun(st: State, route: Route): boolean {
|
||||||
const mine = resolveRoute(st, route)
|
const mine = resolveRoute(st, route)
|
||||||
@@ -4634,6 +4654,13 @@ function registerSkills(on: On, st: State): void {
|
|||||||
if (e.agentId === undefined && skillRow(st, skill)) {
|
if (e.agentId === undefined && skillRow(st, skill)) {
|
||||||
await tierAsk($, st, st.turnMain, `Skill /${clean(skill, NAME_CAP)}`)
|
await tierAsk($, st, st.turnMain, `Skill /${clean(skill, NAME_CAP)}`)
|
||||||
}
|
}
|
||||||
|
// shortcut: one marker, so accepted gaps: a same-name sub-agent load
|
||||||
|
// during a main call takes the note (the main load loses it); two
|
||||||
|
// concurrent main calls keep the last marker. skill.prompt has no
|
||||||
|
// agentId. Upgrade path: key the marker by tool_use_id.
|
||||||
|
if (e.agentId === undefined && advisorDue(st, skill)) {
|
||||||
|
st.advisorSkill = skill
|
||||||
|
}
|
||||||
const out = await next(e)
|
const out = await next(e)
|
||||||
const refused = typeof out !== 'object' || out === null ||
|
const refused = typeof out !== 'object' || out === null ||
|
||||||
'deny' in out || (out as { isError?: unknown }).isError === true
|
'deny' in out || (out as { isError?: unknown }).isError === true
|
||||||
@@ -4642,6 +4669,7 @@ function registerSkills(on: On, st: State): void {
|
|||||||
return out
|
return out
|
||||||
} finally {
|
} finally {
|
||||||
st.skillCalls -= 1
|
st.skillCalls -= 1
|
||||||
|
if (e.agentId === undefined) st.advisorSkill = null
|
||||||
}
|
}
|
||||||
}).catch(($, e, next) => {
|
}).catch(($, e, next) => {
|
||||||
warnOnce(st, $, 'Skill', next.error.kind)
|
warnOnce(st, $, 'Skill', next.error.kind)
|
||||||
@@ -4649,14 +4677,24 @@ function registerSkills(on: On, st: State): void {
|
|||||||
})
|
})
|
||||||
on('skill.prompt', async ($, e, next) => {
|
on('skill.prompt', async ($, e, next) => {
|
||||||
await ensureConfig($, st)
|
await ensureConfig($, st)
|
||||||
if (st.off || st.skillCalls > 0) return next(e)
|
if (st.off) return next(e)
|
||||||
|
if (st.skillCalls > 0) {
|
||||||
|
const out = await next(e)
|
||||||
|
if (st.advisorSkill !== e.skill) return out
|
||||||
|
st.advisorSkill = null
|
||||||
|
return { ...out, text: ADVISOR_NOTE + out.text }
|
||||||
|
}
|
||||||
const { row, typed } = armed($, st, e.skill)
|
const { row, typed } = armed($, st, e.skill)
|
||||||
if (typed) {
|
if (typed) {
|
||||||
const size = { points: pointsOf([e.text]), unknown: false }
|
const size = { points: pointsOf([e.text]), unknown: false }
|
||||||
await addEstimate($, st, size, false)
|
await addEstimate($, st, size, false)
|
||||||
}
|
}
|
||||||
if (row) await confirmSkill($, st, e.skill, row)
|
if (row) await confirmSkill($, st, e.skill, row)
|
||||||
return next(e)
|
const out = await next(e)
|
||||||
|
// shortcut: a typed slash landing while a Skill call is in flight
|
||||||
|
// takes the in-call branch above and loses its note.
|
||||||
|
if (!typed || !advisorDue(st, e.skill)) return out
|
||||||
|
return { ...out, text: ADVISOR_NOTE + out.text }
|
||||||
}).catch(($, e, next) => {
|
}).catch(($, e, next) => {
|
||||||
warnOnce(st, $, 'skill.prompt', next.error.kind)
|
warnOnce(st, $, 'skill.prompt', next.error.kind)
|
||||||
return next(e)
|
return next(e)
|
||||||
|
|||||||
Reference in new issue
Block a user