diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index c79ae7c..e7f7b1e 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -331,3 +331,8 @@ rules: - **Cause**: BDR-126 dialog fires only on `/model `; spec said "no args → native picker untouched". Picker = real usage path. Main applied spec without flagging gap. - **Next**: /feat picker scope: pick model in picker, then ask project vs user scope. Check engine types for a settings-write intercept first; else mod must restore user settings (BDR-116 amendment, user call). Links [[BDR-126]]. - **Status 2026-10-25**: resolved for the picker, 2202964 (BDR-127: PreModelSwitch deny + deferred scope dialog, no user-settings write by the mod). Residual: `/config` Model row still native (source `command`). + +## BLK-037 — Same-model /model pick fires no PreModelSwitch: no scope question, project pin stays [resolved] (2026-10-29) +- **Friction**: `/model` picker, pick = session's current model (Opus 5.5) → native "Set model to `Opus 5.5` and saved as your default… settings.local.json pins `Fable 5.1` — that applies on restart"; no scope question; project pin stays. +- **Real cause**: engine fires no `PreModelSwitch` when the pick equals the session model (nothing to switch) → handlePicker (BDR-127) never runs. Proof 2026-10-29: user picked Sonnet 5.5 (different) → "Model switch to Sonnet 5.5 was blocked by a PreModelSwitch hook". First guess (gateway ids `anthropic/claude-opus-5.5`) was a logged-out OpenRouter session, not the bug (3 lenses FATAL). +- **Solution**: bare `/model` opens router dialog in command.run (BDR-132), 657e5cb. diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 69213fd..c1db745 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1410,6 +1410,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Alternatives rejected**: `$.config.set` (no scope arg); Esc = passthrough (silent tracked write); dialog on unknown names (router can't route them); `canonical()` for written id (strips `[1m]`); shared `modelAnswered` flag (concurrent dispatch clears it). - **Residuals**: stat-then-write race (no no-follow in `$.fs`); dangling-link refusal assumes lstat-like `$.fs.stat`; engine gitignore of created file unverified; live hot-switch on local `model` change unverified; worktree session writes worktree's file (documented). Live check pending ([[LRN-212]]). - **Refs**: contract `.claude/tasks/contracts/2026-10-25-model-scope-dialog-1450.md`, plan r3 same dir `plans/`, commits 1fde5bb, 773fe17. [[BDR-116]], [[BDR-125]], [[EVAL-049]]. +- **Status (2026-10-29)**: accepted, no-args part superseded by BDR-132 (2026-10-29) ## BDR-127 — model-router: `/model` picker asks its scope; hand pick always switches [accepted] (2026-10-25) - **Decision**: (1) picker = `classic.PreModelSwitch` source `picker`: gates (router on, string `requested_model` in table, surface present) → `$.session.id()` read → slot held = deny + toast `answer the open dialog first` (never native) → else set `st.asking` sync, `void pickerDialog`, return `{ permissionDecision: 'deny' }`. Dialog after 300 ms sleep = shared `scopeDialog` (same 3 scopes as BDR-126); Everywhere = `$.command.run model ` (native write); stale `session.id` → nothing applied. Default/unknown/headless/other sources → native. (2) hand pick: `Routed.explicitModel` set by dialog answers; `decideMain` runs `handCall` first: target usable (not down, fits) → move/keep, no caps, no switch flags; unusable → existing `automaticCall` with no wanted model + one log. Hand pick clears target mark at pick; native user switch (PostModelSwitch command/picker/sdk) drops it, skipped while picker dialog open. `/route model=` keeps caps. @@ -1443,3 +1444,9 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Decision**: tracked `settings.json` = base file. `/model` writes never committed (model per project lives in `.claude/settings.local.json`); tracked default `"model": "opus"`, `"switchModelsOnFlag": true` stays. UI-written keys (`"theme"`) stay uncommitted, stashed around `gitflow finish` (`git stash push -- settings.json`, finish, pop); re-pushed only for a major change. - **Why**: user 2026-10-29: "il ne faut jamais suivre le model… le model par defaut est opus… push un fichier de base, ensuite toute modifs auto on les stash". Never `git checkout`/`restore` the live file (symlink of ~/.claude/settings.json). - **Rejected**: commit `/model` + theme as is (doctor warns tracked ≠ opus). + +## BDR-132 — Bare /model opens the router dialog: model, variant, scope [accepted] (2026-10-29) +- **Decision**: bare `/model` (composer, router on, surface, no dialog open) → router dialog in `command.run`: step 1 `fable (best)` / `opus (big)` / `sonnet (work)` / `Other model (native picker)`; step 2 `Standard` / `[1m]`; step 3 existing scope question (scopeDialog). Asks even for current model. Other model → native picker after slot freed (pick inside it still asks). Esc/free text → "model: no model chosen, nothing changed". Haiku via native row or `/model haiku`. +- **Why**: user "il faut que ça soit systématique" (option A, 2026-10-29); BLK-037. +- **Rejected**: 8 rows in one ask (engine cap 2-4, LRN-242); native picker + pin-conflict alert only (option B, not systematic); gateway-id normalization (would switch on routing in a gateway session). +- **Supersedes**: BDR-126 "no args → native picker untouched". Live proof 2026-10-29: opus → [1m] → This project wrote `claude-opus-5-5[1m]`. Contract `.claude/tasks/contracts/2026-10-29-bare-model-dialog-1617.md`. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index c0fbe0a..f199002 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -671,3 +671,4 @@ rules: ## 2026-10-29 - Phase 1 context diet (feature/context-diet): 8 tasks SDD + final opus review (I1 Write gap fixed 789a2b2), GATE 0 MET, verifier CONFORME 21/21 after 2 micro-gates, security PASS. /context 30.5k → 26.2k (own −2.8k). Load proof: faunosteo supabase.md + web-building.md, game cloud-functions.md + supabase.md path_glob_match. robin_petier BDR-075 (auto memory migrated, chore/memory-lan-server). BDR-130/131, LRN-238..241, EVAL-053. Faunosteo/game: nothing lost. +- /bugfix /model pin (BLK-037: same-model pick fires no PreModelSwitch; gateway-id plan dropped after 3 lenses FATAL) → /feat bare /model dialog (BDR-132) 657e5cb: 2 challenge rounds (ui.ask 2-4 cap BLOCKER), verifier 8/9 + live c9 MET, security PASS. LRN-242/243. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index c6084ec..e901a21 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1849,3 +1849,11 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s ## LRN-241 — Classify a usage log by source before trusting its counts (2026-10-29) - **Pattern**: design-toolchain fire log 2026-10-28: 2,779 fires = 1,770 suite prompts (tests ran with the real HOME) + 857 ` 4 → split into steps. Engine contract limits belong in the test double. + +## LRN-243 — Interactive engine behavior: one discriminating user test before the fix plan (2026-10-29) +- **Pattern**: bugfix diagnosis twice wrong before code: "proven" cause was a logged-out OpenRouter session; real cause found by challengers reading timestamps + session model (same-model pick). A 30 s user-run discriminating test (pick a different model) settled it; a second (`/model opus` typed) proved `$.ui.ask` renders in command.run before building on it. +- **Application**: interactive-only engine behavior → design one discriminating user test, ask it in plain text (an open AskUserQuestion blocks the user's slash commands), before any fix plan hardens. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index b369b6b..623afcc 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -12,10 +12,10 @@ Shared rules for every phase: - Never: forced continuation / Stop block (BDR-083, BDR-087), per-turn nag (BDR-037), forced skill invocation, hiding a dispatchable agent via `agent.offer` (breaks dispatch, proved), a `hard_deny` that names a path, file or source line (the auto classifier would refuse all mod maintenance): hard_deny names off switches only (`"enabled": false`, `enabledPlugins`, `disableAllHooks`) and "never edit `permissions.ask/deny` to pass a gate". - Cleanup is part of each phase: delete what the phase makes obsolete (scripts, hooks, tests, doctrine lines, Makefile targets, doctor checks), grep every citer and patch in the same branch (doctrine-citers census in `make test`). -- [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 ` 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. +- [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 DONE 2026-10-29 (`/model opus` → scope question rendered → This project wrote settings.local.json); still unchecked: no PostModelSwitch/down mark after This project, gitignore of a created file). (user pick 2026-10-25). Fact (docs model-config): `/model ` 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. - [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. +- [x] **/feat picker scope** (done 2026-10-25, 2202964 + docs 5d262d3, BDR-127; live check DONE 2026-10-29 (Sonnet 5.5 pick held by the hook, scope asked; same-model pick fires no hook → BLK-037, fixed by BDR-132 657e5cb); still unchecked: 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. - [x] **Phase 0, no mod: split project CLAUDE.md** (this repo + the lever, feature/claude-md-split, 2026-10-26; merge on user signal). Four rules under `.claude/rules/` (rules-maintenance, graphify-vendored, mods, transient-artifacts `# static-check: skip`), `lib/project-rules.sh` check/matches/sections/extract/emit (`-C `) + suite, `hooks/instructions-loaded.sh` (log `~/.claude/logs/instructions-loaded.jsonl`, session + agent ids), `!.claude/rules/` here + socle, `/onboard split` + onboarder `MODE: split`, generators emit docker/testing/ci from `templates/project-rules/`. Baseline 2026-10-26 `/context`: 32.2k total, Memory files 11.6k, project CLAUDE.md 2.1k. - [ ] Proof, this repo: `/context` after the merge; one fresh session Reading one file per rule → 4 Project `path_glob_match` lines; one sub-agent Read → does a path rule load inside a sub-agent (decides what the per-repo pass may move). Results in the journal.