diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 51d5111..46b6df5 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1506,3 +1506,11 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Amendment 7 (2026-10-25, Fable re-challenge of the whole queue)**: 4 lenses + native-features guide (CLI 2.1.308), synthesis `.claude/tasks/plans/2026-10-25-context-mod-queue-challenge.md` § RE-CHALLENGE. BLOCKER closed: hard_deny names off switches only, never mod paths/sources (classifier would refuse mod maintenance). Merge gate = native `ask` rules (`Bash(bash */gitflow.sh finish*)`, `Bash(gitflow_finish*)`, `Bash(git merge *)`), bench r3 G1-G7 all denied, `start` free; `$.ui.ask` mod dropped; BDR-068 /close auto-finish costs one click (user accepted). Routing guard hosted in model-router: `runMain` wrong signal (BEST tier only, never ends), mod state plugin-private; free when `turnMain.source ∈ {skill, model}` or `/route` sticky; Edit/Write/NotebookEdit only, Bash write forms deferred (no measured evasion). Interpreters (`python3 -c` 211, `node -e` 450 calls / 14 days) → soft_deny prose, not static ask; `Bash(/*)` dropped (kills rtk abs twins). Commit-msg hook deferred (4/78 overrun, hooks miss 6/7 repos on core.hooksPath). 4a shrunk: memory.sh add/status/journal/check/index + flock, own-header `[tag]` first then last status line wins (reconcile.sh:60-67 dropped own header = BLK-032..034 false-open), Index blocks removed via /prune-memory, no Meta backfill, no English validator (1/1,290), per-file v2 marker. Phase 1: design section appended to rules/web-building.md (hook one-liner, 2,131 fires), one lib/architecture-defaults.md, Supabase/functions keep always-on line (path rules fail open at scaffold), agent description diet at source, origin line already shipped. Phase 5: lib/profiles/.json source of truth (no generator), detection via /plugin-check (no fingerprint), cleanup += toggle-external.sh + old-layout writers, migrate auto memories before autoMemoryEnabled:false, enable scope = --settings copy else settings.local, never user scope mid-skill. Phase 3 CONDITIONAL on the measured residual after 0/4a/1/5/2: listing filter, contexts field, hint classifier, agent rewrite, higgsfield deltas dropped. 4c = intent rerank + error 4-gram only, digest in session-start.sh on compact/clear; 4b redacts at capture, bounded ring; 4d deferred. Proof budget: static glob check + InstructionsLoaded log for path rules, model canaries for hook/mod levers only. - **Amendment 8 (2026-10-25, model per project and per conversation)**: user ask (one Claude Code conversation per project, often concurrent: Fable on one, opus on another). Measured headless (scratchpad modeltest): project `.claude/settings.local.json` `"model"` wins over user settings, `--settings '{"model":…}'` wins over both; same scopes as packs. `/model` writes the TRACKED user settings.json (fable landed there 2026-10-25): never the per-project route. Applied: tracked default `opus`, this repo local `claude-fable-5-1[1m]`. Phase 5 profile = `enabledPlugins` + `model`; doctor warns when tracked `model` ≠ `opus`. Residuals accepted by the user: interpreters (`python3 -c`, `node -e`) rest on prose + classifier (491/661 calls from sub-agents, an ask rule would fail executors); Bash write forms out of the routing guard until a measured evasion. + +## BDR-126 — model-router `/model ` scope dialog: project / conversation / everywhere [accepted] (2026-10-25) +- **Decision**: `command.run` hook on core `model`. Composer origin, 1 token, name in `cfg.models` (alias or listed full id, `[1m]` stripped for test, `haiku[1m]` out), surface present, no dialog open, router on → `$.ui.ask` This project / This conversation / Everywhere. Project = full id (`[1m]` verbatim) into `/.claude/settings.local.json` + sticky model route; conversation = sticky route only; both drop `runMain`, keep sticky effort. Everywhere = drop sticky model+tier, native passthrough. Esc/free text = cancel. Else native, no question. Fail-open to native only BEFORE answer; post-answer own try/catch → text. +- **Why**: native `/model` always writes tracked user settings.json (BDR-125 am. 8, LRN-098); user wants model per project and per conversation. +- **Project write rules**: mod's first project-tree write. Stat-first absence ([[LRN-228]]), links refused (`.claude` and file), regular file only, 64 KiB cap, JSON object only, fixed cause words (never err.message), other keys kept. +- **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]]. diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md index c13f604..ac82a59 100644 --- a/.claude/memory/evals.md +++ b/.claude/memory/evals.md @@ -437,3 +437,8 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse - **Method**: /feat. r1 = cap in `wantedModel` mirroring classifier. 3 blind lenses: correctness FATAL(4), robustness FATAL(5), simplicity CONCERNS(1). BLOCKERs: capped prompt slot shadowed held run (both correctness + robustness), probe-test one-line swap hangs (route tool answer probes), cap fail-open on `sessionModel` '' (/reload-plugins). r2 = effort-only routes at 3 writers + user pick (derived orchestrate too). 1 confirmation: SOLID, 5 MINOR applied (r2.1). feater DONE no deviation, 509 tests; GATE 0 12/12 MET; verifier CONFORME 14/14 1st pass; auditor PASS 0 findings; doc-sync SIGNIFICANT 5 patches. - **Anomalies**: author r1 claim "identical to classifier" false: classifier never runs under a held route, prompt rules do. First verifier dispatched on Fable died 429 (credits out): LRN-224 residual (spawn path unprobed) seen live; retry landed on opus floor. Push of remote branch delete + first /feat Skill call blocked by auto-mode classifier. - **Action**: when reusing a mechanism from another source, list the guards that source runs under (idle gate) before claiming equivalence. Links [[LRN-226]], [[LRN-224]], [[BLK-032]]. + +## EVAL-049 — /feat model scope dialog: challenge + gates yield on 4-file hook feat (2026-10-25) +- **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]]. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 329adff..a90a94c 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -651,3 +651,4 @@ rules: - Shell deny probe (user: facts): 27 variants vs `Bash(echo SECRET*)`; matcher sees through compound/wrappers/assignments, misses `sh -c`, heredoc shell, `$(…)`, abs path, interpreters, quoted literal arg; auto mode classifier approved all misses. rtk-rewrite hook bypasses deny on rewritten cmds (`git push origin :feature`, `cat */*.pem`): ac23cc6 fix inert in real use. Fixes queued in phase 2 (BDR-125 amendment 6), order kept, mode stays auto. - Full queue re-challenge on Fable (user ask): correctness 13, robustness 18 (1 BLOCKER: hard_deny naming mod paths), simplicity 14, native guide. Plan halves: native ask merge gate (no mod), guard in model-router on `turnMain.source`, interpreters in prose, commit-msg hook deferred, 4a = memory.sh + status parser fix + Index removal (no Meta backfill), phase 3 conditional, 4c two channels. TODO queue rewritten, BDR-125 amendment 7. User picks: native gate, phase 3 conditional, rest in block. - 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. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 011a611..a59ee94 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1890,3 +1890,11 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s ## LRN-227 — Root-commit author ≠ name the user remembers; identity list must cover every root email - **Context**: BDR-124 verify. User expected lima `root n.turpault 2009`; real root = t.surrel 2009-02-25 (not shallow). Own repo root = `git@bchanot.fr`, absent from user.email + claude.identity → false foreign banner. - **Apply**: check origin claims against `git log --max-parents=0`, never memory. Every email ever used as root author → `git config --global --add claude.identity `. Links [[BDR-124]]. + +## LRN-228 — Absence test in untrusted tree: stat first, `exists` only after stat rejects +- **Context**: BDR-126 contract (main wrote it) said "absent = `$.fs.exists` false". GATE 2 MEDIUM: `exists` may follow links → dangling symlink reads absent → `$.fs.write` creates link target. `stat` answers `isLink` even dangling. +- **Apply**: stat → resolves: isLink/kind/size checks; rejects → `exists` false = absent, true = fs error. Same for parent dir. Contract wording for a write path gets the same scrutiny as code. Links [[BDR-126]]. + +## LRN-229 — Mod test kit: forcing a throw after a dialog answer +- **Context**: BDR-126 post-answer throw test. Kit drops `$.ui.status` (void event, hook never reached); bottom hooks register once ("registered twice"); hooks after first `$` call refused; `session.usage` swallowed by `readTokens`. +- **Apply**: swap the mock clock at boot behind a fixture flag: `clock.now` answers until a dialog opened, then rejects (`show` → `readingFor` throws). Flag off by default; a test advancing that clock breaks. Links [[BDR-126]]. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index c1fc322..58128cd 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -12,7 +12,7 @@ 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`). -- [ ] **Before phase 0: /feat `/model` scope dialog in model-router** (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 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. - [ ] **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).