chore(memory): queue re-challenged on Fable, TODO phases rewritten, BDR-125 amendment 7

This commit is contained in:
bchanot committed 2026-10-25 13:57:41 +01:00
1 parent dfaa5a0acd
commit afb209a577
3 files changed
+66 -68

No files matched your search

+1
View File
@@ -1503,4 +1503,5 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
- **Amendment 4 (2026-10-25, challenge of phase 2 + profile facts + user answers)**: phase 2: phrase-list merge gate rejected (3 lenses FATAL: false allows/denies, breaks BDR-068 ritual + release sub-agent) → `$.ui.ask` confirmation dialog per branch (user pick), named exceptions, prefilter before `.catch`, hard_deny extended; commit limit → `commit-msg` git hook (CLAUDECODE-gated); code limits → classic PostToolUse on added lines, 80 cols only; G2 removed (BLK-022). Phase 5 = native packs: per-project `.claude/settings.local.json` `enabledPlugins` and per-conversation `claude --settings` proven concurrent (same and different projects); skills-dir plugins obey; plugin skills keep short names; plugin agents need prefix → agents stay global (user); global profile mode deleted (user); 11 profiles kept as pack compositions (user); detection proposes once (user); off pack mid-skill → propose + `/reload-plugins` (spike). User-scope MCP not switchable per project → MCP into packs.
- **Amendment 5 (2026-10-25, routing verification + user picks)**: routing probe bench (`.claude/tasks/plans/2026-10-25-routing-probe/`): fresh sessions route explicit intents right (init-project, close, bugfix, reconcile, commit-change, cso), but a small feature ask was coded inline and history shows 11/21 code-writing bug/feature turns inline. User: always through a skill → phase 2 routing guard (main-loop code write outside a skill run denied; docs, `.claude/**`, sub-agents, in-skill writes free; ceiling bullet rewritten model-agnostic). Interviewer: by design inline in /init-project (C1 routed right), unused only because no new project in the window. Listing: 46/124 skills name-only; `SLASH_COMMAND_TOOL_CHAR_BUDGET=60000` → 0 name-only (+~17k chars); raise after packs (user). Order: 0 → 4a → 1 → 5 → 2 → 3 → 4b-4d (user).
- **Amendment 6 (2026-10-25, shell deny probe)**: bench `.claude/tasks/plans/2026-10-25-bash-deny-probe/`. Native Bash deny matcher sees through compound ops, subshell, `env`/`command`/`timeout`/`nohup`/`xargs`, quoted command word, simple assignments: no per-rule shell duplication. Misses `sh -c`, bare shell + heredoc, `$(…)` command, absolute path, interpreters, quoted literal arg. Under `defaultMode: auto` classifier approved every miss. rtk-rewrite hook runs before permission eval, deny evaluated on rewritten cmd: `git push origin :feature` → `rtk git push …` bypasses `git push * :**` (ac23cc6) and ask `git push *`; `cat */*.pem` likewise. Redirects into Edit-denied path denied. `ask` beats `allow`. User: stay auto, fixes go in phase 2 (rtk rc=3 passthrough + rtk read twins, targeted ask/deny rules, limits written down, routing guard covers Bash writes). Interim risk accepted with the phase order.
- **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/<name>.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.
+1
View File
@@ -649,3 +649,4 @@ rules:
## 2026-10-25
- Context-mod plan hardened: phase 2 challenged (3 lenses FATAL) → $.ui.ask merge gate, commit-msg git hook, added-lines 80-col hook, G2 out; phase 5 = native packs, per-project settings.local + per-conversation --settings proven concurrent; routing probe: explicit intents route right, small feature coded inline, 11/21 history code turns inline → routing guard (user: always via skill); 46/124 skills name-only, budget env fixes it (after packs). Order 0 → 4a → 1 → 5 → 2 → 3 → 4b-4d. Side: faunosteo TODO has stale follow-ups (ZodError msg gone since R4.7, SVG sanitiser done since R5.5): run /reconcile there.
- 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.
+64 -68
View File
@@ -3,91 +3,87 @@
## Open (reconciled 2026-10-23, /reconcile)
Done history before 2026-10-08 removed 2026-10-23 (git keeps it: `git log -p -- .claude/tasks/TODO.md`); decisions live in `.claude/memory/`.
### Context mod queue (BDR-125): one /ship-feature per phase, order (user 2026-10-25): 0 → 4a → 1 → 5 → 2 → 3 → 4b-4d
### Context mod queue (BDR-125): one /ship-feature per phase, order (user 2026-10-25): 0 → 4a → 1 → 5 → 2 → 3 (conditional) → 4b-4d
Re-challenged 2026-10-25 on Fable (4 lenses + native-features guide, synthesis in `.claude/tasks/plans/2026-10-25-context-mod-queue-challenge.md` § RE-CHALLENGE; user picks: native ask merge gate, phase 3 conditional, rest in block). The plan halves: native carriers and existing files first, a mod only where a measured gain has no native lever.
Shared rules for every phase:
- Baseline first: `claude -p "/context"` at repo root (2026-10-23: 30.2k always-on = memory files 11.6k, skills 10k, agents 2.6k, system 2.5k, MCP instr 2.2k, tools 1.1k). Same measure after; the delta is a phase criterion.
- Proof bench: `.claude/tasks/plans/2026-10-24-context-mod-probe/` (canary per lever + negative control, fresh `claude -p --plugin-dir`). Every lever a phase uses is re-proved there before code, every "to verify" below becomes a canary criterion.
- Subtract-only: source text stays in CLAUDE.global.md / rules / CLAUDE.md, marked `<!-- jit:<id> -->` … `<!-- /jit -->`; the mod drops a marked section only where it re-delivers it on a trigger. Mod off (`~/.claude/context-mod.json` `"enabled": false`) or hook throws → full text loads as today. Guards use `.catch` deny (fail closed); injections fail open.
- Inject once per context: mod ledger in `$.state` of what it injected; reset on `session.compact` and `session.end` reason `clear`; re-inject at the next trigger. Canary test after a real compaction is a criterion (documented, not yet proved).
- 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).
- Proof budget: a moved path rule gets a STATIC check (frontmatter parses, each glob matches ≥1 `git ls-files` path per project) + one session logged by the InstructionsLoaded hook (`load_reason: path_glob_match`). Model canaries (bench `.claude/tasks/plans/2026-10-24-context-mod-probe/`) only for hook and mod levers; the path lever is proved three times already.
- Subtract-only: source text stays in CLAUDE.global.md / rules / CLAUDE.md. A doctrine a mod replaces is jit-marked, never deleted (mod off = full text). Guards fail closed, injections fail open. Status model everywhere: ONE parser, "last status-bearing line wins", the entry's own header `[tag]` read first.
- 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`).
- [ ] **Phase 0, no mod: split project CLAUDE.md + fix higgsfield MCP**
- [ ] **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/<name>.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).
- `.gitignore:122` ignores `.claude/*`: add `!.claude/rules/`.
- Higgsfield: MCP declared user-scope in ~/.claude.json (`higgsfield` http) and connected while `toggle-external.sh` says disabled; make `toggle-external.sh enable|disable higgsfield` own `claude mcp add|remove -s user higgsfield` (the user runs the first removal), + doctor check "toggle state = MCP state".
- Proof: canary per moved rule (ABSENT at start, PRESENT after Read of a matching file); `/context` delta (~1.9k memory files + higgsfield MCP share).
- `.gitignore:122` ignores `.claude/*`: add `!.claude/rules/` (a directory-form ignore would untrack the rules).
- Higgsfield MCP: user-scope in ~/.claude.json while `toggle-external.sh` says disabled. The user runs `claude mcp remove -s user higgsfield` once; no toggle ownership, no doctor check: the phase 5 pack `.mcp.json` owns it (guide 2026-10-25: `disabledMcpjsonServers` never reaches a user-scope server, the `/mcp` toggle writes `~/.claude.json`).
- Proof: static check per moved rule + one InstructionsLoaded-logged session; `/context` delta (~1.9k memory files + higgsfield MCP share).
- Cleanup: CLAUDE.md keeps a 2-line pointer ("rules under .claude/rules load on path"); fix citers of the moved headings.
- Other projects (user ask 2026-10-24). Measured project CLAUDE.md, loaded every session of that project: faunosteo 50,228 chars (bigger than the global one), zenquality 23,378, game 14,918, robin_petier 12,895, config 4,990, integration_alphalink 4,249; none has `.claude/rules/`. Splitting is judgment (always-on: overview, stack, commands, conventions; path-scoped: one module, Docker, a folder), so no background automation and no new skill:
- `/onboard` gets a `split` mode (skill edit through /writing-skills: pressure test RED first): read the project CLAUDE.md, classify each section always-on vs path-scoped, propose globs from the real tree, user approves per project, write `.claude/rules/<name>.md` + slim CLAUDE.md + `!.claude/rules/` in .gitignore when `.claude/*` is ignored.
- Generators fixed at the source: onboarder + scaffolder (init-project) emit path rules from day one, so new projects are born split.
- One pass over the git repos in ~/Documents/ (this repo first, then by size: faunosteo, zenquality, game, robin_petier, config, integration_alphalink): one `chore/claude-md-split` branch per repo, per-project approval, never an automatic merge (user signal per repo), `/context` before/after per project recorded in that project's journal.
- Proof: per project, canary that a moved section is ABSENT at start and PRESENT after a Read of a matching file; total always-on delta across the 7 projects.
- Proof: per project, the static glob check + one logged session; total always-on delta across the 7 projects.
- [ ] **Phase 1, native context diet: no mod** (redesigned 2026-10-24 after challenge: the engine already does most of it)
- Facts 2026-10-24 (scratchpad pathtest, memtest): a `paths:` rule loads on Read of a matching file, NOT on Write of a new file (S1 ABSENT, S2 after Write ABSENT, S3 after Read PRESENT); `"autoMemoryEnabled": false` removes the auto-memory system section (PRESENT → ABSENT); classic SessionStart / UserPromptSubmit hooks inject additionalContext (seen live in every session); instruction files reload on compaction natively (InstructionsLoaded `load_reason: compact` in the 2.1.306 types). So each section goes to the native carrier that matches its trigger, with no mod code, no fail-open risk, and it works with the mod off and in sub-agents.
- [ ] **Phase 4a, memory v2 write side: shell, no mod** (shrunk 2026-10-25: the measured recall channels never read Meta; the measured status bug is a reconcile parser bug)
- Facts 2026-10-24 (scratchpad memeval, 434 entries): registries ~1M chars, never in always-on context, read only by /feat /bugfix /ship-feature (analyze-before-plan); Index drift 6 rows; status in 3 places (title tag, body Status line, Index column) → reconcile false-open BLK-032..034; no single writer (Edit needs a Read of a 357k file, so real writes are ad hoc python/bash); 8 projects on this machine hold v1 registries. Verified 2026-10-25: `lib/reconcile.sh:60-67` drops the entry's OWN header while BLK-032..034 carry `[resolved]` there (the false-open); nothing machine-reads `## Index` (analyze-before-plan.md:42, reconcile.sh:9, test T1); 1 of 1,290 entries across the 8 projects above a 1% accent ratio.
- `lib/memory.sh` = single writer, like gitflow.sh: `add <kind> --title --body-file [--status --supersedes]` allocates next ID from headings (never the Index) under `flock` (concurrent conversations, phase 5), appends the entry; `status <ID> <new>` appends a dated status line (append-only); `journal "<line>"`; `index` prints the Index on demand from headings; `check [--staged]` = the validator (heading pattern, ID = max+1 and unique, no removed line from an existing entry outside a /prune-memory commit, new BLK quotes ≥1 error verbatim). The validator runs in `add` and `check` + make test, NOT in the generated pre-commit (undecidable there, and it exits 0 on working branches). No English check (doctrine stays).
- Status: `reconcile_blk_current_status` reads the own-header `[tag]` first, then "last status-bearing line wins" (one parser, shared by memory.sh status and reconcile). Fixes BLK-032..034 false-open; regression test on those three.
- Index: the four generated `## Index` blocks are REMOVED in one /prune-memory curation; Index steps dropped in capitalize, ship-feature, commit-changer, prune-memory § D; `memory.sh index` replaces them.
- Per-file v2 marker (first line) so the 8 v1 projects keep working untouched; doctor warns "registry v1".
- Dropped: Meta line, 434-entry backfill, scope/critical labels, triggers field (4c derives triggers at read time), Index == generated validator, English validator.
- Citers: capitalize, close, prune-memory, CAPITALIZE steps of feat/bugfix/hotfix/ship-feature/commit-change, lib/capitalize-commit.md, lib/analyze-before-plan.md, lib/reconcile.sh, templates/memory, onboard/init-project; doctrine-citers census. CLAUDE.global.md Memory registries: write only via lib/memory.sh; fix the false "load every session" premise (keep caveman: it keeps reads and injections small).
- Proof: writer round-trip, flock race test (two adds), status parser on the three false-open BLKs + fixtures, v1 project untouched, `make test` green.
- [ ] **Phase 1, native context diet: no mod** (redesigned 2026-10-24, shrunk 2026-10-25: one carrier per section, existing files first)
- Facts 2026-10-24 (scratchpad pathtest, memtest): a `paths:` rule loads on Read of a matching file, NOT on Write of a new file; `"autoMemoryEnabled": false` removes the auto-memory system section; classic SessionStart / UserPromptSubmit hooks inject additionalContext; instruction files reload on compaction natively. `hooks/design-toolchain-reminder.sh` fired 2,131 times (16 to 210 per day); `brainstorming` is vendored and gitignored (.gitignore:78), an edit there does not persist.
- Section → carrier:
- auto-memory system section → `"autoMemoryEnabled": false` in settings.json (one line, proven).
- Design work (1.5k chars) → user rule `rules/design-work.md` with the UI globs of rules/web-building.md (fires on UI file Read) + `hooks/design-toolchain-reminder.sh` injects the section text itself when it detects UI work in a prompt (covers new files created from a prompt); drop its "(already in context)" wording.
- graphify (0.6k) → `hooks/session-start.sh` injects the section only when `graphify-out/graph.json` exists (it already computes graph presence for the banner).
- Public websites never SPA + default language + web APIs versioned (2.3k) → into the skills that brainstorm (init-project, ship-feature STEP 1, brainstorming, refactor whole-project, onboard) + session-start injects them when the cwd has no tracked code file (new project); dedupe "Web APIs" against rules/rest-api.md.
- secure-by-default domains 4 Supabase + 6 cloud functions → user path rules (`supabase/**`, `**/*.sql`; `functions/**`, `**/serverless.*`, `**/firebase.json`); keep "Every API", hosting, injection, exposure and SMS/email always-on (no reliable path for messaging, 325 chars).
- Our code vs foreign code → session-start runs `lib/code-origin.sh` once and injects one line ("this repo: ours, strict limits" / "foreign, keep its style"); both short sections stay always-on.
- Registry format → compressed in phase 4a (lib/memory.sh enforces it); gitflow detail → compressed in phase 2 cleanup (hooks + lib + merge gate enforce it). No JIT needed for either.
- Project fingerprint (stack, supabase, messaging, functions, graph, origin) moves to phase 3, its first consumer (listing filter), reused by phase 5.
- Proof: canary per moved section (ABSENT without trigger, PRESENT after it: UI Read, UI prompt, graph.json present, empty dir, skill load, supabase Read); a new-file-only UI turn still gets Design work through the prompt hook; `/context` delta (~4.4k est. across phases 1, 2, 4a); hook tests extended (design-toolchain-reminder, session-start).
- auto-memory system section → `"autoMemoryEnabled": false` in settings.json. Before: migrate existing auto memories in faunosteo, jeux-deploy, robin_petier into their registries (user review), doctor warns when an auto-memory dir is non-empty.
- Design work (1.5k chars) → APPENDED to `rules/web-building.md` (same UI globs, one file); `hooks/design-toolchain-reminder.sh` keeps its one-liner, retargeted to "Read ~/.claude/rules/web-building.md § Design work" (covers new-file turns); never the full text per fire.
- graphify → one always-on threshold line stays ("graphify from 200 code files, never below"); the rest of the section → `hooks/session-start.sh` injects it only when `graphify-out/graph.json` exists.
- Public websites never SPA + default language + web APIs versioned (2.3k) → one `lib/architecture-defaults.md` Read by our own skills (init-project, ship-feature STEP 1, refactor whole-project, onboard; the lib/*.md reference pattern); Web APIs § merged into `rules/rest-api.md`; no empty-dir injection (init-project routes correctly in an empty dir, routing probe C1).
- secure-by-default: "Every API", hosting, injection, exposure, SMS/email stay always-on; Supabase and cloud functions keep ONE always-on line each (path rules fail open at scaffold/Write), their bodies move to path rules (`supabase/**`, `**/*.sql`, `**/migrations/**`; `functions/**`, `**/serverless.*`, `**/firebase.json`).
- Agent descriptions: trim `description:` in `agents/*.md` at the source (5,755 of 9,098 listing chars; names and files unchanged, dispatch cannot break). Replaces the phase 3 agent listing rewrite.
- Registry format → compressed in phase 4a; gitflow detail → compressed in phase 2 cleanup. Our-code-vs-foreign line: already injected by session-start.sh:240-251, nothing to do.
- Proof: static glob check per moved rule + logged session; hook tests (design-toolchain-reminder one-liner, session-start graph branch); the four skills Read the lib (grep census); `/context` delta.
- Cleanup: CLAUDE.global.md loses the moved sections (one pointer line each where needed), citers patched (doctrine-citers census); BDR-031 citers.
- The `context` mod is born in phase 2 or 3 (first need: guards or listing rewrite); challenge at phase 2 launch whether guards fit better as classic hooks (push-guard pattern, transcript_path gives the last user message) or as the mod.
- [ ] **Phase 2, guards** (redesigned 2026-10-25 after a 3-lens challenge: correctness FATAL(10), robustness FATAL(13), simplicity FATAL(6); plan `.claude/tasks/plans/2026-10-24-context-mod-phase2.md`)
- Killed by the challenge: the phrase-list merge gate (false allows: "don't merge it yet", "should we merge it?", pasted text, skill bodies in the transcript; false denies: a plain "oui"; it blocked the BDR-068 /close auto-finish and the release-executor sub-agent finish; "ship it" contradicts the doctrine); G2 destructive guard (BLK-022: the content is withheld, not the language; stays a user-driven task with its two listed options); whole-file code-limit reports (measured 1498 lines > 80 cols across 92 files, lib/gitflow.sh 81: over-fires, LRN-091); parsing commit text from Bash (heredoc `-m "$(cat <<'EOF' …)"`, `-F`, `-C`); registry format (in 4a).
- Merge gate (user pick 2026-10-25: confirmation dialog). Mod `tool.call` on Bash|Monitor matching `gitflow.sh finish`, `gitflow_finish`, or `git merge` while develop/main is checked out → `$.ui.ask("Merge <branch> → <target> ?")`, one per branch, single use; dismissed, rejected, `-p`, or no surface → deny with reason "confirm at the terminal, then re-run". Named exceptions: BDR-068 ritual (this turn's prompt.submit command is capitalize or close, `gitflow.sh start chore <name>` seen this session, diff touches only `.claude/**`); release path in a decision table (verify that `$.ui.ask` works for a sub-agent's tool.call; else /release-candidate runs finish inline, BLK-018 option b). Cheap synchronous prefilter before the `.catch` deny, so a guard bug never denies every Bash call. Banner or doctor line when the guard is not live. settings.json hard_deny names mod refusals and the mod disarm paths (`mods/<name>/` sources, `~/.claude/<name>.json` `"enabled": false`, `enabledPlugins` `<name>@skills-dir`, dev-copy shadow). The finish prose stays until canaries pass across sessions. This is the first piece of the context mod.
- Routing guard (user pick 2026-10-25: "always through a skill"). Measured: "j'aimerais que doctor.sh affiche la version de rtk" was coded inline with no skill (routing probe L3); history 2026-09-23 → 10-24: 10 code-writing bug/feature turns went through a skill, 11 coded inline (long pasted faunosteo briefs). Mod `tool.call` on Edit/Write/NotebookEdit of a code file by the MAIN loop (no `agentId`) while no skill run is active (model-router run slot or a `skill.prompt` seen this turn for feat/bugfix/hotfix/ship-feature/refactor/code-clean/tour…) → deny with reason "route through /hotfix (≤2 files, obvious), /feat, /bugfix or /ship-feature". Free: docs (.md), `.claude/**`, sub-agents (executors), any write inside a skill run. Bash write forms to a code file by the main loop (`>`/`>>` redirect, `tee`, `sed -i`, `cat <<EOF > f`, `python3 -c 'open(…,"w")'`) → same deny, cheap regex prefilter, unparseable → allow (never deny every Bash). Doctrine follows in the same change: the ceiling bullet becomes "the main loop writes no code outside a skill run, whatever the model". Proof: routing bench `.claude/tasks/plans/2026-10-25-routing-probe/` cases (L3 must now enter a skill), long-brief replay in a clone, false-deny fixtures (doc edits, executor edits, in-skill edits, Bash writes inside a run).
- Shell deny hygiene (measured 2026-10-25, bench `.claude/tasks/plans/2026-10-25-bash-deny-probe/`; user pick: stay in `defaultMode: auto`). Facts: the native matcher already sees through `&&` `;` `||` `|` newline `( )` `env` `command` `\cmd` `timeout` `nohup` `xargs` quoted command word and simple assignments (no per-rule duplication needed); it misses `sh -c`, bare `bash`/`sh` + heredoc, `$(…)` in command position, absolute paths, interpreters (`python3 -c`, `awk system()`, `node -e`) and a quoted literal argument (`git push origin ":feature"` escapes `:**`); under auto every miss was approved by the classifier, not prompted; the rtk-rewrite PreToolUse hook runs BEFORE permission evaluation and the deny is evaluated on the REWRITTEN command (`cat SECRET.txt` under deny `cat SECRET*`: DENIED hooks off, RAN hooks on; `git push origin :feature` → rc=3 → `rtk git push origin :feature`, so deny `git push * :**` (hotfix ac23cc6) and ask `git push *` are bypassed in real use; rc=2 forms `--delete` `+ref` `--force*` `.env` `id_rsa` `.aws` `find -delete|-exec` `git branch -D` are left unchanged and hold; rc=0 misses `cat */*.pem`, `cat */secrets/*`); Bash redirects into an Edit-denied path ARE denied; `ask` beats `allow` (an `ask Bash(bash *)` prompts every lib script: never).
- rtk hook: rc=3 → pass through unchanged (no `updatedInput`), native deny/ask see the original; re-pin `hooks/.rtk-hook.sha256`; hook test with the `cat SECRET*` analogue hooks-on. rc=0 reads: census test that every `Bash(cat|head|tail <glob>)` deny has its `Bash(rtk read <glob>)` twin, twins added.
- settings.json `ask` += `Bash(sh -c *)`, `Bash(bash)`, `Bash(sh)`, `Bash(bash -s*)`, `Bash(bash <(*)`, `Bash(/*)`, `Bash(python3 -c *)`, `Bash(python -c *)`, `Bash(node -e *)`; `deny` += `Bash(awk *system*)` (`awk *` stays allowed; proven: plain awk RAN, system() DENIED). Each pattern proven in the bench (r3) before landing. P41 (templates: "ask inert under auto") is contradicted by measurement (`bash -c` prompted under auto in -p): re-check and fix the item, not the config.
- Limits written down, one place: settings.json soft_deny note + README permissions: `$(…)` in command position and a quoted literal argument have no matchable rule and rest on the classifier; mode stays auto.
- Folds TODO Actionable "docker host-root mount spellings" (prove with the same bench, same change) and the T42 dead-entry drop list (`git push * :*` etc.) if the release lands first.
- Interim (accepted with the order 0 → 4a → 1 → 5 → 2): until this lands, a `git push origin :ref` deletion rests on the classifier and rtk's registry, not on settings.json.
- Commit message: `commit-msg` git hook emitted by the gitflow hook generator (global core.hooksPath, T10 drift test), active only when `CLAUDECODE=1`, words counted with trailers excluded, limit read from lib/commit-message.md (one place), exemption only on deterministic convention files (commit template, .gitmessage, commitlint config). A failure is a git error to fix by shortening, not a permission refusal.
- Code limits: classic PostToolUse hook, added lines only (Edit new_string, Write content), our code only (`lib/code-origin.sh` on the edited file's repo), 80 columns only, at most 5 reports, once per file per turn, `additionalContext`, never a deny. Function length deferred (or the project's own linter rule).
- Proof: an evasion matrix per rule (the bash-deny-probe bench: quoting, cd and -C, bash -c, sh -c, heredoc, $(…), absolute path, interpreters, rtk rewrite hooks-on, Monitor, sub-agent, non-composer turn); false-allow fixtures for the gate (negation, question, paste); the /close ritual still finishes; the release decision table is tested; destructive commands are never run live (plugin test with stubs only).
- Cleanup: compress the gitflow section only for the forms now enforced; the commit-message line already points at the lib.
- [ ] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, shrunk the same day)
- Facts 2026-10-24/25 (scratch projects, fresh headless sessions, canaries, run concurrently, one shared ~/.claude): `.claude/settings.local.json` `enabledPlugins` per project works both ways and concurrently; `claude --settings '<json>'` gives two SIMULTANEOUS conversations in the SAME project different plugin sets; a skills-dir plugin obeys both; plugin skills keep their short name (`ui-styling` resolves) but verify `<plugin>:<name>` too (router rows must match both); plugin agents need the `plugin:` prefix; `permissions.deny Skill(x)` does not hide a skill; `skillOverrides` does not reach plugin skills (packs hide by disabling, guide); a user-scope MCP cannot be switched off per project by settings: project MCP belongs in a pack `.mcp.json`; claude.ai connectors do not load under `-p`.
- User answers 2026-10-25: profile per project and per conversation, never one for all; tracked `.claude/settings.json` keeps deny/allow only, profiles go local; a project without a profile gets a proposal once, written on accept; the global mode (skills/ ↔ skills-disabled/ symlinks + user-scope plugin toggling) is DELETED; core = everything except the heavy packs (design, seo/geo, web-validate, scroll/3d, higgsfield, gstack); agents stay global; a skill needing an off pack proposes to enable it then `/reload-plugins` (spike first); all 11 profiles kept as pack compositions.
- Packs: each heavy group becomes a skills-dir plugin `skills/pack-<name>/` (`.claude-plugin/plugin.json` + `skills/<skill>/SKILL.md`, + `.mcp.json` for higgsfield, + hooks if any). Spike first: nested skills load once as plugin skills; gstack (external installer, symlinks) as a pack.
- Profile = `lib/profiles/<name>.json` (`{"enabledPlugins": {...}}`), the source of truth, reachable through the ~/.claude/lib link: no generator, no `~/.claude/profiles/`. Per project: `profile.sh set <name>` writes `enabledPlugins` into `.claude/settings.local.json` (never user scope). Per conversation: `claude --settings ~/.claude/lib/profiles/<name>.json` (shell function or make helper, named with the user).
- Detection: no fingerprint. When the project has no profile, session-start prints one line pointing at `/plugin-check`; the plugin-advisor maps its canonical profile to a pack profile (replaces the banner hint the cleanup deletes).
- Pack needed mid-skill: the orchestrators' existing gates (lib/design-gate.md + design-tool-gate.sh, lib/plugin-gate.md) check the required packs; off → propose enabling for THIS conversation (the `--settings` copy when the session was launched with one, else `.claude/settings.local.json`; never user scope) + `/reload-plugins`; spike that a settings change + `/reload-plugins` loads the pack mid-session.
- Listing budget (user pick: after the packs): 124 skills listed, 46 name-only at the default budget; `SLASH_COMMAND_TOOL_CHAR_BUDGET=60000` → 0 name-only (+~5.7k tokens). Once packs shrink the listing, set the budget in settings.json `env` to the smallest value that leaves 0 name-only in the full profile (ctxprobe bench), record the cost.
- Spikes: nested skills in a pack, `/reload-plugins` after a settings change, claude.ai connectors per project (interactive only), higgsfield MCP in a pack.
- Proof: two concurrent conversations in one project and two projects, canaries prove different listings, MCP and hooks per pack; `/context` per profile; nothing references `skills-disabled/` or `toggle-external.sh`.
- Cleanup: `lib/profile.sh` symlink toggling + `skills-disabled/` (24 entries), user-scope plugin toggling in `set|apply|reset`, `lib/toggle-external.sh` (retire or rewire to packs) + `lib/tests/higgsfield.test.sh` + the CLAUDE.global.md "toggle-external.sh enable higgsfield" lines, every writer of the old layout (install-plugins.sh, update-all.sh, gstack and 21st installers), Makefile `profile*` targets rewired, `/profile` skill rewritten for packs, plugin-gate prose tied to global toggling, banner hint "/plugin-check before starting a new project", doctor profile checks, profile tests rewritten; `lib/profiles/*.profile` → `.json`.
- [ ] **Phase 3, listings** (scope note 2026-10-25: this is NOT the plugin advisor; per-project profiles are phase 5. Once phase 5 packs exist, the skill listing shrinks natively, so the mod listing filter shrinks to restoring truncated descriptions of kept skills; the routing hint, agent description trim and MCP names stay here; the fingerprint built here also feeds phase 5 profile detection.)
- Skill listing: `prompt.attachment` type `skill_listing` (30,031 chars measured) rewritten from the fingerprint: categories per skill live in routing.json (new `contexts` field beside the phase row); a skill with no category stays SHOWN (new skills always appear); census test in make test fails on an uncategorised skill; kept skills get their full description back from SKILL.md frontmatter (LRN-175 truncation). Handle the listing delta sent mid-session.
- To verify first (canary): a skill hidden from the listing still runs when typed (`/name`) and through the Skill tool.
- Routing hint: classifier (reuse model-router's small-model call) maps a typed prompt to one skill; inject one line via `prompt.submit` `context` only above a confidence threshold, never on slash prompts, mid-turn or inside a run; names hidden skills too. Replaces the CLAUDE.global.md "Skill routing" table (2.1k chars).
- Agent listing: `agent_listing_delta` (9,098 chars) rewritten with short descriptions for skill-dispatched executors, names kept. To verify first: dispatch of a trimmed agent still works (agent.offer untouched).
- MCP: drop instructions + deferred tool names of servers the fingerprint/toggles mark irrelevant (higgsfield off, claude.ai connectors in a coding repo) via `mcp_instructions_delta` / `deferred_tools_delta`; ToolSearch still finds them.
- Proof: canaries (hidden skill ABSENT, control PRESENT, typed hidden skill runs, trimmed agent dispatches), hint precision measured on a fixed prompt set (no hint on chat/bookkeeping), `/context` delta (~5-7.5k est.).
- Cleanup: CLAUDE.global.md Skill routing section → 2 lines; LRN-043 routing-line rule superseded; doctor skill-listing budget check updated.
- [ ] **Phase 2, guards** (redesigned 2026-10-25 after a 3-lens challenge, re-challenged the same day: native ask gate, guard hosted in model-router, interpreters in prose, commit-msg hook deferred)
- Killed by the challenges: the phrase-list merge gate; the `$.ui.ask` mod gate (its BDR-068 exception detector was never true: finish runs in the user's reply turn; a hard_deny naming mod sources was the robustness BLOCKER); G2 destructive guard (BLK-022, stays a user-driven task); whole-file code-limit reports (1498 lines > 80 cols across 92 files, over-fires); parsing commit text from Bash; Bash write-form detection in the routing guard (no measured Bash evasion, every inline write was Edit/Write).
- Merge gate = native `ask` rules in settings.json, no mod (user pick 2026-10-25; bench r3 G1-G7: all forms DENIED headless incl. `"$HOME"`, absolute path, after `source`; `start` RAN): `Bash(bash */gitflow.sh finish*)`, `Bash(gitflow_finish*)`, `Bash(git merge *)`; evaluate in the same bench `Bash(git pull *)` and `git push x:develop` forms before adding them. Trade-off accepted: the BDR-068 /close auto-finish gets one dialog click (ask beats allow, no exemption); release-executor finish prompts too (its dispatcher runs finish inline if a sub-agent cannot prompt, BLK-018 option b). hard_deny line: "never edit `permissions.ask` to skip the gate".
- Routing guard (user pick: "always through a skill") hosted in `mods/model-router` (owner of the only run signal; mod state is plugin-private, `runMain` is BEST-tier-only and never ends: wrong signal). `tool.call` on Edit/Write/NotebookEdit of a code file by the MAIN loop (no `agentId`) → deny with reason "route through /hotfix (≤2 files, obvious), /feat, /bugfix or /ship-feature" UNLESS this turn's `turnMain.source ∈ {skill, model}` or a `/route` sticky is in force (explicit escape hatch). Free: docs (.md), `.claude/**`, sub-agents, any write inside a skill run. Bash write forms deferred until a measured evasion. hard_deny gains "a guard redirect is not a refusal to route around: enter the skill". Doctrine: the ceiling bullet becomes "the main loop writes no code outside a skill run, whatever the model". Proof: routing bench cases (L3 must enter a skill), long-brief replay in a clone, false-deny fixtures (doc edits, executor edits, in-skill edits), guard-off = today.
- Shell deny hygiene (bench `.claude/tasks/plans/2026-10-25-bash-deny-probe/`; user pick: stay in `defaultMode: auto`). Facts: the native matcher sees through `&&` `;` `||` `|` newline `( )` `env` `command` `\cmd` `timeout` `nohup` `xargs` quoted command word and simple assignments; it misses `sh -c`, bare `bash`/`sh` + heredoc, `$(…)` in command position, absolute paths, interpreters and a quoted literal argument; under auto every miss was approved by the classifier; the rtk-rewrite hook runs BEFORE permission evaluation and deny is evaluated on the REWRITTEN command (`git push origin :feature` → rc=3 → `rtk git push …` bypasses deny `git push * :**` and ask `git push *`; rc=0 misses `cat */*.pem`); redirects into an Edit-denied path ARE denied; `ask` beats `allow`. Counted 2026-10-25 (14 days): 211 `python3 -c`, 450 `node -e`, 491 of them from sub-agents: a static ask on interpreters would prompt or deny hundreds of calls.
- rtk hook: rc=3 → pass through unchanged (no `updatedInput`), native deny/ask see the original; re-pin `hooks/.rtk-hook.sha256`; hook test with the `cat SECRET*` analogue hooks-on. rc=0 reads: census test that every `Bash(cat|head|tail <glob>)` deny has its `Bash(rtk read <glob>)` twin, twins added (alternative weighed and rejected for now: one case arm passing cat/head/tail through unrewritten loses rtk's read savings, unmeasured).
- settings.json `ask` += `Bash(sh -c *)`, `Bash(bash)`, `Bash(sh)`, `Bash(bash -s*)`, `Bash(bash <(*)`, `Bash(/bin/sh *)`, `Bash(/bin/bash *)`, `Bash(/usr/bin/env bash*)`, `Bash(/usr/bin/env sh*)` (NOT `Bash(/*)`: it would kill the `Bash(*/rtk …)` absolute-path twins the rtk heal relies on); `deny` += `Bash(awk *system(*`. Interpreters (`python3 -c`, `python -c`, `node -e`) go to the autoMode soft_deny prose, not static rules. Each pattern proven in the bench before landing. P41 (templates: "ask inert under auto") is contradicted by measurement: fix the item.
- Limits written down, one place: settings.json soft_deny note + README permissions: `$(…)` in command position, a quoted literal argument and interpreters have no static rule and rest on the classifier + prose; mode stays auto.
- Folds TODO Actionable "docker host-root mount spellings" and the T42 dead-entry drop list if the release lands first.
- Interim (accepted): until this lands, a `git push origin :ref` deletion rests on the classifier and rtk's registry.
- Commit message hook: DEFERRED (4 of 78 non-merge commits over 50 words since lib/commit-message.md landed e91dcb3; the generated hooks miss 6 of 7 repos on `core.hooksPath=.githooks`). Revisit if the overrun grows.
- Code limits: classic PostToolUse hook, added lines only (Edit new_string, Write content), our code only (`lib/code-origin.sh`), 80 columns only (462 of 19,161 added lines measured over), at most 5 reports, once per file per turn, `additionalContext`, never a deny.
- Proof: evasion matrix per rule (bench), the /close ritual finishes after one click, destructive commands never run live (plugin test with stubs only).
- Cleanup: compress the gitflow section only for the forms now enforced.
- [ ] **Phase 4, memory v2: write, capture, read, feedback** (redesigned 2026-10-24 after measurement; 4a needs no mod and can run right after phase 0)
- Facts 2026-10-24 (scratchpad memeval, 434 entries): registries ~1M chars (decisions 319k, learnings 357k, journal 168k, evals 85k, blockers 68k), never in always-on context, read only by /feat /bugfix /ship-feature (analyze-before-plan); Index drift 6 rows (decisions 121/125, evals 46/48); status in 3 places (title tag, body Status line, Index column; LRN/EVAL none) → reconcile false-open BLK-032..034; no single writer (skill says Edit + manual Index row; Edit needs a Read of a 357k file, so real writes are ad hoc python/bash); 93-100% of entries carry a language-neutral artifact (path, command, quoted string); lesson field present in 98% LRN, 85% BLK, 98% EVAL (median 170-560 chars vs body 1.2-2k); 2 near-duplicate title pairs only; 325/434 entries have [[links]] (1080); growth 40-90 entries/month; 44 files cite registry paths; 8 projects on this machine hold v1 registries. "Session start: read .claude/memory/" is unrealistic; caveman premise "registries load every session" is false.
- Measured recall (5 real FR prompts, 22 relevant entries): BM25 titles 7/22, BM25 full text 9/22, haiku rerank of lexical top-30 14/22 (~8.5k chars), haiku over all titles 14/22 (~43k chars). Error 4-gram match on today's real errors: 429 credits → BLK-030 + BLK-031 exact, BLK-034 suite error exact, no false positive; 5 of 7 real errors of 2026-10-23 had NO entry (never captured): capture is the weak link, not search.
- Storage choice: augment in place (5 files, headings and paths unchanged) + per-entry Meta line + generated Index. Rejected for now: one file per entry with frontmatter (better concurrency and per-entry history, but 44 citers + 8 project migrations; a commit-time validator + backfill give the same machine fields). Revisit if same-repo concurrent writes conflict.
- **4a write side (shell, no mod).** `lib/memory.sh` = single writer and reader, like gitflow.sh: `add <kind> --title --apply --body-file [--status --scope --supersedes --critical]` allocates next ID from headings (never the Index), appends the entry ending with `- **Meta**: status=…; scope=project|global; triggers=path:…,cmd:…,skill:…,err:"…"; supersedes=…; critical=yes|no`, regenerates `## Index` from headings + Meta; `status <ID> <new>` appends a dated status line (append-only); `journal "<line>"` appends under today's heading; `derive <ID>` prints derived triggers (paths, commands, skill names, quoted errors normalized); `index`; `check [--staged]`.
- Validator: pre-commit (only when `.claude/memory/` is staged; diff-based on added/changed entries, so legacy entries in the 8 projects pass) + make test: heading pattern, ID = max+1 and unique, Meta on new entries, Index == generated, no removed line from an existing entry outside a /prune-memory curation commit, English (accent-ratio threshold proven zero false positive on all 8 projects' registries). New BLK must quote ≥1 error verbatim.
- Backfill via /prune-memory (deterministic script + user review): Meta for the 434 entries; status from the 3 legacy forms (last wins); triggers derived; Apply = LRN/BLK/EVAL lesson field, BDR = first sentence of **Decision**; scope proposed by the model, reviewed (global = applies in other projects too: Claude Code behaviour, permissions, mod API, CLI quirks). Coverage report is a criterion.
- Citers: capitalize, close, prune-memory, CAPITALIZE steps of feat/bugfix/hotfix/ship-feature/commit-change, lib/capitalize-commit.md, lib/analyze-before-plan.md, lib/reconcile.sh (Meta status first, legacy fallback: fixes BLK-032..034 false-open), templates/memory, onboard/init-project; doctrine-citers census. CLAUDE.global.md Memory registries: write only via lib/memory.sh; fix the false "load every session" premise (keep caveman: it keeps reads and injections small).
- **4b capture (mod).** Failure ledger: every tool result with isError, deny or non-zero exit carrying a distinctive error line → normalized + verbatim + command, kept per session in `$.store`, matched against the registry error index; unmatched = new failure modes. Milestones observed: feat/fix commit, `gitflow finish`, a suite red then green. `memory_pending` tool (`isDeferred: false`) returns unmatched failures + milestones verbatim; /capitalize, /close and every CAPITALIZE step call it first; one context note at the next prompt after a milestone, never per turn, never at Stop. Judgment triggers (design choice, surprising discovery, dead end) stay with the model: "Proactive capitalization" paragraph KEPT. Writing always = model draft + user approval + lib/memory.sh (validated).
- **4c read side (mod).** Tier 1 always-on: ≤10 user-marked `critical=yes` lessons, one line each (~1k chars) in `prompt.context`. Session digest in `prompt.context` (open BLK from Meta status, actionable TODO, last journal line; re-read by the engine on compaction and /clear). Intent recall at `prompt.submit` only for model-router classifier labels design/analysis or the first coding prompt after idle: BM25 top-30 over title + Apply + triggers + body → haiku keeps ≤3 (option: same call as the classifier, no added latency), bounded 3 s, fail open. Execution recall: Read path triggers (lands before the edit), Bash command triggers (after the result; `critical` → deny once with the Apply line, retry allowed), tool error 4-gram match. Injection = ID + title + Apply only; superseded entries never injected (successor shown); linked IDs as one-line see-also; EVAL excluded from auto recall; budget ~1.5k chars per turn; once per context (ledger reset on compact/clear). Config-repo entries with scope=global indexed in every project (repo resolved from the ~/.claude/lib link). `memory_search` tool for skills (analyze-before-plan pass 1 calls it).
- **4d feedback and promotion.** Log each injection (ID, trigger kind, turn) and whether the turn cited the ID or the retried action succeeded; /prune-memory reads it: never-recalled entries, noisy entries (injected often, never used) get triggers fixed; entries recalled ≥N times → proposed promotion to a mechanism (guard, test, skill step), BDR-100 "mechanisms, not lessons".
- Proof: validator zero false positive on the 8 projects; writer round-trip; backfill coverage; recall precision on ≥20 real prompts and ≥10 real errors (journal + transcripts), target ≥ the 14/22 baseline; digest canary after a compaction; haiku rerank latency inside the mod measured; `/context` delta; captured-failure demo: an error from session N recalled by match in session N+1.
- Cleanup: hand-maintained Index steps in skills, "add one row to the Index" instructions, ad hoc append snippets, the false doctrine premise, reconcile legacy-only status parsing once backfill lands.
- [ ] **Phase 3, context mod: CONDITIONAL** (user pick 2026-10-25). Measure the always-on residual after phases 0, 4a, 1, 5 and 2 (`/context` at repo root + the two biggest projects). Build only if a mod can carry conditionally a residual worth its cost (birth, off switch, canaries, doctor line); otherwise close the item with the measurement.
- If built, scope = `prompt.compose` section deltas for doctrine a carrier already re-delivers (jit-marked, never deleted; mod off = full text; ledger in `$.state`, reset on compact/clear) + `mcp_instructions_delta` for connectors irrelevant in a coding repo. Shared infra (jit-marker subtraction, `$.state` ledger) lives here or in 4c, whichever ships first.
- Dropped by the re-challenge: skill listing filter + routing.json `contexts` + census (phase 5 packs + the budget env already give 0 name-only); routing-hint classifier (no measured miss outside code intents the phase 2 guard catches; the "Skill routing" table lines move into our own skills' `description:`, ≤3 lines for vendored aliases stay in CLAUDE.global.md, done in phase 1 cleanup); agent listing rewrite (phase 1 diet); higgsfield deltas (phase 0/5); project fingerprint. `prompt.attachment` kinds (`skill_listing`, `agent_listing_delta`…) exist in the 2.1.306 types but not in the docs text: re-verify at build time.
- [ ] **Phase 5, per-project and per-conversation profiles, native packs** (redesigned 2026-10-25, facts + user answers)
- Facts 2026-10-24/25 (scratch projects, fresh headless sessions, canaries, run concurrently, one shared ~/.claude): `.claude/settings.local.json` `enabledPlugins` per project works both ways and concurrently (ui-ux-pro-max off in A while on in B; pr-review-toolkit on in A only); `claude --settings '<json>'` gives two SIMULTANEOUS conversations in the SAME project different plugin sets; a skills-dir plugin (`~/.claude/skills/<name>` + `.claude-plugin/plugin.json`, like model-router) obeys both; plugin skills keep their short name (Skill tool `ui-styling` and typed `/ui-styling` resolve); plugin agents need the `plugin:` prefix (`silent-failure-hunter` → not found); `permissions.deny Skill(x)` does not hide a skill; a user-scope MCP cannot be switched off per project by settings (`disabledMcpjsonServers` and `disabledMcpServers` had no effect): project-specific MCP belongs in a pack plugin or at local scope; claude.ai connectors do not load under `-p` (untestable headless).
- User answers 2026-10-25: profile can change per project and per conversation, never one profile for all conversations; tracked `.claude/settings.json` keeps deny/allow only, profiles go local; a project without a profile gets a detected proposal once, written on accept; the global mode (skills/ ↔ skills-disabled/ symlinks + user-scope plugin toggling) is DELETED; core = everything except the heavy packs (design, seo/geo, web-validate, scroll/3d, higgsfield, gstack); agents stay global (no packs, short names kept); a skill needing an off pack proposes to enable it then `/reload-plugins` (spike first; fallback: stop and name the pack); all 11 profiles kept, rewritten as pack compositions.
- Packs: each heavy group becomes a skills-dir plugin `skills/pack-<name>/` (`.claude-plugin/plugin.json` + `skills/<skill>/SKILL.md`, + `.mcp.json` for higgsfield, + hooks if a pack has any). Spike first: nested skills inside a skills-dir plugin load as plugin skills and not twice as user skills; gstack (external installer, symlinks) as a pack.
- Profile = `lib/profiles/<name>.profile` → generated `~/.claude/profiles/<name>.json` (`{"enabledPlugins": {...}}`). Per project: `profile.sh set <name>` writes `enabledPlugins` into the cwd project's `.claude/settings.local.json` (never user scope; gitignore line checked). Per conversation: launcher `claude --settings ~/.claude/profiles/<name>.json` (shell function or `make` helper, named with the user), wins over the project default for that conversation only.
- Detection: session-start hook reads the fingerprint (stack, web public vs app, supabase, messaging, graph; from phase 3, or a minimal shell version here) when the project has no profile and proposes one in one line; writing it needs the user's yes.
- Pack needed mid-skill: orchestrators' existing gates (lib/design-gate.md + design-tool-gate.sh, lib/plugin-gate.md) check the required packs; off → propose enabling for this conversation/project + `/reload-plugins`; spike that a settings change + `/reload-plugins` loads the pack mid-session.
- Listing budget (user pick 2026-10-25: after the packs): measured 124 skills listed, 46 name-only at the default budget (incl. tour, seo, web-validate, status, profile, plugin-check, review, qa, spec, test-driven-development); `SLASH_COMMAND_TOOL_CHAR_BUDGET=60000` → 0 name-only, listing 30k → 47k chars (~+5.7k tokens). Once packs shrink the listing, set the budget in settings.json `env` to the smallest value that leaves 0 name-only in the full profile (measured with the ctxprobe bench), and record the cost.
- Spikes listed: nested skills in a pack, `/reload-plugins` after a settings change, claude.ai connectors per project (interactive session only), user-scope MCP moved into packs (higgsfield first).
- Proof: two concurrent conversations in one project and two projects, canaries prove different listings, MCP and hooks per pack; `/context` per profile; old global toggling gone and nothing references `skills-disabled/`.
- Cleanup: `lib/profile.sh` symlink toggling + `skills-disabled/` (24 entries), user-scope plugin toggling in `set|apply|reset`, Makefile `profile*` targets rewired, `/profile` skill rewritten for packs, plugin-gate prose tied to global toggling, banner hint "/plugin-check before starting a new project", doctor profile checks, profile tests rewritten; `lib/profiles/*.profile` stay as the definitions.
- [ ] **Phase 4b-4d, memory v2 capture, read, feedback** (shrunk 2026-10-25 to the measured channels)
- Measured recall (5 real FR prompts, 22 relevant entries): BM25 full text 9/22, haiku rerank of lexical top-30 14/22 (~8.5k chars). Error 4-gram match on real errors: BLK-030/031/034 exact, no false positive; 5 of 7 real errors of 2026-10-23 had NO entry: capture is the weak link.
- **4b capture (mod).** Failure ledger: tool results with isError, deny or non-zero exit carrying a distinctive error line → normalized + verbatim + command, REDACTED at capture (rtk-rewrite redaction + gitleaks patterns), bounded ring per session in `$.store` (4 MiB cap), matched against the registry error index; unmatched = new failure modes. Milestones: feat/fix commit, `gitflow finish`, a suite red then green. `memory_pending` tool returns unmatched failures + milestones; /capitalize, /close and every CAPITALIZE step call it first; one context note at the next prompt after a milestone, never per turn, never at Stop. "Proactive capitalization" paragraph KEPT. Writing always = model draft + user approval + lib/memory.sh.
- **4c read side.** Two channels only: intent recall at `prompt.submit` for classifier labels design/analysis or the first coding prompt after idle (BM25 top-30 over title + lesson + body → haiku keeps ≤3, bounded 3 s, fail open) and tool-error 4-gram match (PostToolUse; a classic hook is acceptable if the mod ledger is not needed). Session digest (open BLK via the status parser, actionable TODO, last journal line) in `hooks/session-start.sh` on `source: startup|compact|clear` (native matchers; the mod's `session.compact` only skips); a SubagentStart twin if sub-agents need it. Injection = ID + title + lesson line; superseded never injected; budget ~1.5k chars per turn; once per context. Deferred: Read path triggers, Bash command triggers, "critical → deny once", Tier 1, cross-repo scope=global index, `memory_search` tool.
- **4d feedback and promotion.** DEFERRED until a plain injection log (ID, trigger kind, turn, cited or not) shows misses or noise; then /prune-memory reads it and promotion to a mechanism follows BDR-100.
- Proof: recall precision on ≥20 real prompts and ≥10 real errors, target ≥ the 14/22 baseline; digest after a real compaction; redaction test on the ledger; `/context` delta; captured-failure demo: an error from session N recalled in session N+1.
### Actionable
- [ ] deferred (BDR-123): remap inline-writing best-tier skills (design Build stack, writing-skills, deprecation-and-migration, /tour single-project, /audit-delta 3d, /harden STEP 3); stale citers skills/feat/SKILL.md:6, skills/code-clean/SKILL.md:36; + impeccable row in routing.json (design Build stack has none; frontend-design has `reflect`; census test pins the table)