From 438462f084595b04cd3fb33cf18f773c3dad3717 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sun, 25 Oct 2026 20:42:34 +0100 Subject: [PATCH] chore(memory): BDR-127 picker scope, LRN-231, EVAL-050, BLK-036 resolved --- .claude/memory/blockers.md | 3 ++- .claude/memory/decisions.md | 7 +++++++ .claude/memory/evals.md | 5 +++++ .claude/memory/journal.md | 1 + .claude/memory/learnings.md | 4 ++++ .claude/tasks/TODO.md | 2 +- 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index 67c3b9c..ac1a818 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -358,7 +358,8 @@ rules: - **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]]. -## BLK-036 — bare `/model` picker writes tracked user settings for a per-project intent [open] +## 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`. - **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`). diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 46b6df5..5a904c5 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1514,3 +1514,10 @@ 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]]. + +## 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. +- **Why**: BLK-036 (picker wrote tracked user settings for per-project intent, 3 times on 2026-10-25); user: picker → project or user scope, default opus, hand choice must switch even in long conversation. +- **Alternatives rejected**: `$.ui.ask` inside hook (never renders, spike); bypass inside `upgradeCall`/`downgradeCall` (breaker never checked on target: 2 BLOCKERs r1); handCall `keep(cur)` when unusable (pins down model when hand pick == cur: BLOCKER r2); mod restoring user settings.json after native write (BDR-116); alias pins (user kept full id). +- **Residuals**: `/config` Model row still native (PreModelSwitch source `command`, same as Everywhere's own run); hand pick dropped at `/clear`; no timeout on never-answered dialog (slot held → picks denied, no leak); window guard needs a `windows` entry (none shipped); PostModelSwitch on denied pick unverified live (guarded). +- **Refs**: contract `.claude/tasks/contracts/2026-10-25-picker-scope-1952.md`, plan r3 same name in `plans/`, commits 2202964, 5d262d3. [[BDR-126]], [[BDR-116]], [[BLK-036]], [[LRN-231]], [[EVAL-050]]. diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md index ac82a59..e99d110 100644 --- a/.claude/memory/evals.md +++ b/.claude/memory/evals.md @@ -442,3 +442,8 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse - **Method**: /feat. 3 blind lenses r1: correctness FATAL(6), robustness CONCERNS(7), simplicity CONCERNS(3); r2 confirm CONCERNS(3) → r3 inline. feater DONE 540 tests; GATE 0 MET; verifier ECARTS(1) (no post-answer throw test on non-native branch) → feater → CONFORME 15/15; auditor PASS + MEDIUM (dangling link from main's contract) → feater → re-verify CONFORME + PASS. Doc-sync SIGNIFICANT 3 patches (1 = README defect from executor placement). - **Anomalies**: BLOCKER r1 `[1m]` ids never reached dialog (`MODEL_ID` rejects brackets): this repo's own local model is `[1m]`. Confirm pass caught FsStat kind `dir` vs plan `directory` (suite would stay green with bug). Main's contract wording introduced the MEDIUM. - **Action**: worth the cost on hooks that write settings. Plan API literals (`kind` values, regex coverage) against the types file before challenge. Links [[BDR-126]], [[LRN-228]]. + +## EVAL-050 — /feat picker scope: spike first, then 2 FATAL challenge rounds on the same axis (2026-10-25) +- **Method**: dev-mod spike, 2 live runs by user (ask-inside froze; deny + continuation worked) before any plan. Plan r1: correctness FATAL(5), robustness FATAL(2), simplicity SOLID. r2 confirm FATAL(1). r3 inline. feater DONE 29 tests (574 total); GATE 0 MET; verifier CONFORME 14/14 1st pass; auditor PASS 1st pass; doc-sync SIGNIFICANT 12 patches. +- **Anomalies**: both FATAL rounds on breaker-vs-target: r1 bypass skipped target-down check across turns; r2 early branch pinned a down model when hand pick == cur (user's exact scenario). Main wrote "leaveDown untouched: down still wins" without tracing which model `decideMain` checks. +- **Action**: a new routing branch gets a trace of every exit against `st.down` for cur AND target, across a turn boundary, before challenge. Spike-first paid: zero rework on the UI mechanism. Links [[BDR-127]], [[LRN-231]]. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 1fa4220..998a0f5 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -653,3 +653,4 @@ rules: - Model per project measured (local settings > user, --settings > local); tracked settings.json back to opus, repo local on Fable; BDR-125 amendment 8; user keeps the two residuals (interpreters in prose, Bash writes deferred). - /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. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 29bb54c..891a076 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1902,3 +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]]. + +## 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: ". +- **Apply**: launch `void (async () => { await $.clock.sleep(300); … $.ui.ask … })()` before returning the deny; hold any shared dialog slot synchronously before return, free it in the continuation's `finally`. `$.command.run({ command: 'model', args })` from the continuation re-enters as PreModelSwitch source `command` + command.run origin plugin: gate both. Links [[BDR-127]]. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 7a8ec9b..bdd875d 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -15,7 +15,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 ` 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. -- [ ] **/feat picker scope** (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 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** - Move the 4 project CLAUDE.md sections (graphify vendored skill 1.4k chars, mods/ 1.3k, rules/ maintenance 1.3k, transient planning artifacts 0.9k) to `.claude/rules/.md` with `paths:` (`skills/graphify/**`; `mods/**`, `skills/model-router`; `rules/**`; `docs/superpowers/**`). Project scope only: no ~/.claude link points at `.claude/` (checked 2026-10-24); never into `rules/` (= ~/.claude/rules, every project).