diff --git a/.claude/audits/BUGS-FOUND.md b/.claude/audits/BUGS-FOUND.md new file mode 100644 index 0000000..745c996 --- /dev/null +++ b/.claude/audits/BUGS-FOUND.md @@ -0,0 +1,52 @@ +# BUGS-FOUND + +- lib/toggle-external.sh:350 (pre-cleanup numbering; `usage()`, now near :370) — usage() prints header lines 3-26 only (`sed -n '3,26p'`); the managed-tool list continues to line 32, so `--help` omits 8 of the 14 tools. Severity: low (help text only). Discovered while: code-clean run 2026-10-12 (B5 audit). Not fixed (cleanup and bugfix are separate concerns). + FIXED 2026-10-12 (inline on chore/code-clean, no /bugfix pipeline): usage() now prints lines 3 .. closing banner (`sed -n '3,/^# ====/p' | sed '$d'`), no numeric range; --help shows all 14 tools (36 lines). + + +- hooks/session-start.sh:200-217 + lib/detect-plugins.sh:49-52 (`detect_uiux_pro_max`) — the banner "ALWAYS ON" row and the ui-ux-pro-max toggle row read user-scope settings.json / plugin cache, not the effective profile (`profile.sh current --plain`, BDR-134 single source of truth): a dev or minimal project shows ui-ux-pro-max on; pr-review-toolkit on in max/audit is not shown. Severity: low (banner only). Discovered while: code-clean 2026-11-09 (phase 5 sweep). Not fixed. + FIXED 2026-11-10 (/bugfix, bugfix/banner-effective-profile): new `list_on_plugins` (lib/detect-plugins.sh) = effective profile for the ids lib/profiles manages, user-scope true for the others; the ✅ row reads it (model-router now shown, user choice) and `detect_uiux_pro_max` = cache AND enabled; pipefail-safe for doctor.sh; test lib/tests/session-banner.test.sh SB1-SB8. +- hooks/session-start.sh:177-183 + agents/plugin-advisor.md:193,197,211,226,233,263 vs doctor.sh:520-526 — passive-cost constants disagree (banner/advisor: gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300; doctor dropped gstack/context7/graphify 2026-09-28 as double counting, ui-ux-pro-max 670); agents/status-reporter.md:26-30 names doctor as source of truth. Severity: low (estimates). Discovered while: code-clean 2026-11-09. Not fixed. + FIXED 2026-11-10 (/bugfix, bugfix/passive-cost-source, split by the user): stale hand figures removed from the banner (💰 budget row + `_plugin_costs` + now-dead `detect_plan` deleted), plugin-advisor and status-reporter (cost → `make doctor`); doctor keeps its measured ui-ux 670; tests SB9/SB10, detect-plan.test.sh renamed hook-recursion-guard.test.sh. Measured-cost API = TODO feature. +- hooks/session-start.sh:404-408 (`_digest_journal`) — greps `^- ` without skipping HTML comments; templates/memory/journal.md:19-21 holds `- ` bullets inside ``, so a template-born project prints "- journal: " in the session digest until its first journal write. Fix template and digest together. Severity: low. Discovered while: code-clean 2026-11-09 (phase 4 sweep). Not fixed. + FIXED 2026-11-09 (/hotfix, bugfix/digest-journal-comment): the digest skips HTML comment blocks (opener anchored at line start, CommonMark rule; an inline ` +- agents/handover-doc-writer.md §6.1 — vulgarizes BDRs with no status filter: a superseded or deprecated decision can read as current in the client deliverable. Severity: medium (client deliverable). Discovered while: /bugfix G5 challenge round 1. Not fixed. +- lib/memory.sh `upgrade` (`mem_want`, `_mem_verdict_diff` skips Index-stated IDs) — may take a stale v1 `## Index` cell over a `**Statut** :` body line. UNVERIFIED: check before recommending `upgrade` on v1 repos (faunosteo). Severity: medium if real (wrong status written into the body). Discovered while: /bugfix G5 challenge round 1. Not fixed. +- agents/handover-doc-writer.md STEP 10 and other paths — `git log` and file reads are cwd-relative, not rooted on the PACKAGE root; the PACKAGE `PROJECT:` line is space-separated, so a root containing a space mis-parses (the G5 orchestrator check only catches it when blockers.md exists). Severity: low. Discovered while: /bugfix G5 challenge round 1. Not fixed. +- lib/memory.sh `memory_legacy_status` default range (`## ID` to the next `## BLK-`) — on a v1 registry a `### BLK-` entry after a `## BLK-` entry feeds its status line to the `##` entry: a resolved `###` entry can close the open `##` entry above it, which then leaves the handover §5 (the `###` ID itself is flagged unreadable). Severity: low (rare dialect, flagged indirectly). Discovered while: /bugfix G5 verifier. Not fixed. +- agents/handover-doc-writer.md:83 + agents/client-handover-writer.md:1201-1202 — `ROOT=""` pastes the root into a double-quoted literal, and the printed remedy `memory.sh -C status …` leaves `` unquoted: a root with `"`, `$(…)`, a backtick or a space breaks the line or splits the path. Value is the operator's own `git rev-parse --show-toplevel`, not registry data. Severity: low. Discovered while: /bugfix G5 security gate. Not fixed. +- lib/profile-state.jq (`jq -r` output read by lib/detect-plugins.sh `list_on_plugins` / `detect_gstack`) — a settings value carrying a newline can forge a `plugin:=on` line in the PROFILE_PLAIN text, so the banner or status shows a plugin ON that is not. Display-only, pre-existing for detect_gstack. Severity: low. Discovered while: /bugfix G1+G4 security gate 2026-11-10. Not fixed. + + +- agents/plugin-advisor.md embedded RULE (~:217) — the `embedded` signal can come from REQUEST keywords alone ("driver", "kernel", :58) and maps to `↻ SET : minimal`, against the gated rule "minimal reachable from project-level signals only" (only DISABLE is limited to project signals, :124-126). Gate confirmation limits it. Severity: medium (gated decision not fully enforced). Discovered while: /feat D3 verifier 2026-11-11. Not fixed. +- lib/plugin-gate.md:49-51 — pack `extras` accepted from an advisor token, but pack-extras bundles 21st-ai (credit-metered generate/iterate), same reason as the higgsfield exclusion; no advisor rule emits it. Severity: medium. Discovered while: /feat D3 security gate. Not fixed. +- skills/onboard/SKILL.md:255 + agents/plugin-advisor.md:289 — say `make plugin` installs a pinned ctx7; plugins.lock.json pins "latest" (install-plugins.sh:573-574). Fix the wording or pin ctx7. Severity: low. Discovered while: /feat D3 security gate. Not fixed. +- agents/plugin-advisor.md:281 BLOCK "Superpowers skills missing → make plugin" + lib/plugin-gate.md:61 "A) fix plugins" undefined — cwd-dependent `make plugin` in an onboarded foreign repo; qualify with the claude-config repo or make it print-only. Severity: low. Discovered while: /feat D3 security gate. Not fixed. +- lib/plugin-gate.md templates — tokens and `""` sit in double quotes (`$()` / backticks still expand; protection = the prose closed-list check); linked worktree: the apply check compares `--show-toplevel` but profile.sh writes at the parent of `--git-common-dir` (confirmed path ≠ written path, same repo); PROJECT_ROOT = $HOME as a git repo passes the check and find_root writes `~/.claude/settings.local.json`. Severity: low (defense in depth). Discovered while: /feat D3 security gates. Not fixed. +- skills/onboard/SKILL.md:387-762 and skills/tour/SKILL.md:155 — still "gstack ON/OFF" (packs vocabulary elsewhere since D3); cosmetic: unwrapped lines skills/plugin-check/SKILL.md:17, lib/plugin-gate.md:45, USAGE.md:182, USAGE.md:1022 transcript without the ↻ glyph. Severity: low. Discovered while: /feat D3 verifier. Not fixed. + + +- Registry dialects the classifier cannot read: game is `format: 2` but written in the `date: … · status:` dialect (decision statuses unreadable), faunosteo uses `closed` / `active` words, v1 date dialects give no 90-day `proposed` candidate. /prune-memory shows them on the info-only `[Status unreadable]` line; a dialect migration (memory.sh upgrade or a one-shot rewrite per project) is not designed. Severity: medium (prune finds no candidate on those projects). Discovered while: /feat D4 challenge round 1. Not fixed. +- skills/prune-memory STEP 4 — status drift check (Index vs body, title word vs status word) dropped from D4 as an ungated new gate. Severity: low. Discovered while: /feat D4 challenge round 2. Not fixed. +- lib/memory.sh:657 `memory_legacy_status` reads `MEM_LEGACY_RE` from the environment: an ambient `export MEM_LEGACY_RE` also widens `memory.sh upgrade`'s `` readers (`_mem_legacy_open`, `_mem_explicit_status`, `_mem_repair_one`, the last one decides a v1 closure write). Fails closed on a bad regex. Fix: explicit 4th positional argument, drop the env read. Severity: low. Discovered while: /feat D4 security gate. Not fixed. +- lib/memory.sh `memory_legacy_status` `` range on v1 decisions: the last BDR entry runs to EOF, so a `## Index` or other `##` section after it would be read by the widened selector (none on disk today). Severity: low. Discovered while: /feat D4 verifier. Not fixed. +- skills/prune-memory/tests/run-deterministic.sh:13 — `SANDBOX="$(mktemp -d …)"` unchecked under `set -uo pipefail` (no `-e`): a mktemp failure leaves SANDBOX empty and RED-9 targets `/red9a`, `/home9` (fails for a non-root user; trap `rm -rf ""` deletes nothing). Pre-existing, RED-9 extends it. Fix: `|| exit 1`. Cosmetic: skills/prune-memory/SKILL.md:34 ~96 chars unwrapped. Severity: low. Discovered while: /feat D4 security gate + verifier. Not fixed. + + +- hooks/session-start.sh:329-333 `_digest_todo` reads only a `### Actionable` heading (this repo only); init-project and onboard TODOs never show in the digest. Tracked as TODO D1b (user 2026-11-12). Severity: medium. Discovered while: /feat D1 challenge round 1. Not fixed. +- hooks/session-start.sh digest blocker line fails open: a failed or timed-out `memory.sh index blocker` (timeout 2, stderr dropped) prints no `- open:` line, same as zero open blockers. Fix: print `- open: none` after a successful read. Severity: low. Discovered while: /feat D1 challenge round 2. Not fixed. +- Stale graphify claims outside the D6 scope: .gitignore:54-56 ("written into the repo by `graphify claude install`"), plugins.lock.json:37 (bare `graphify install && graphify claude install` recipe), update-all.sh:310-312 (re-run `graphify claude install` MANUALLY, no trap, cwd-dependent → point at `make plugin`), install-plugins.sh:688/690/1269 labels ("dependencies", "Claude Code integration", "PreToolUse hook" for steps the trap reverts), install-plugins.sh:694-695 LRN-071 comment now gates only `graphify install`, guard comment vs rule duplication. LRN-154 (learnings.md:1381) still says `graphify install --platform claude` "touches nothing else". Severity: low. Discovered while: /feat D6 challenge + gates. Not fixed. +- lib/tests/curated-config-guard.test.sh does not lock the Step 7 `(cd "$REPO" && graphify claude install)` subshell; a later edit dropping it passes make test. Severity: low. Discovered while: /feat D6 challenge round 2. Not fixed. +- install-plugins.sh Step 7 hook window (pre-existing): `graphify claude install` hooks sit live in $REPO/.claude/settings.json until the EXIT trap; a SIGKILL skips the trap. Severity: low. Discovered while: /feat D6 security gate. Not fixed. + + +- lib/tests/push-guard.test.sh T42c — passes even if the `$WORK/s-probe.json` jq write fails (empty slurp makes every base entry look lost); weakens what T42c proves, not the lock. Severity: low. Discovered while: /feat dead-deny security gate. Not fixed. +- lib/tests/push-guard.test.sh deny_lost — no pipefail: a missing list file or jq failure empties `lost` (T42 green); mitigated by T42c (red) and T40. Severity: low. Discovered while: /feat dead-deny security gate. Not fixed. +- Dead-entry premise (Write(glob) deny never blocks Write; mixed `* :*` / `* -v /:*` forms never match) rests on one live probe 2026-10-23 (journal); nothing re-proves it if Claude Code permission semantics change. Severity: low. Discovered while: /feat dead-deny security gate. Not fixed. +- lib/tests/push-guard.test.sh:421-424 T62F (pre-existing) — `mktemp` settings copy outside `$WORK`, removed only on the normal path (no trap). Severity: low. Discovered while: /feat dead-deny security gate. Not fixed. diff --git a/.claude/audits/CODE-CLEAN-SCOPE.md b/.claude/audits/CODE-CLEAN-SCOPE.md new file mode 100644 index 0000000..e91552f --- /dev/null +++ b/.claude/audits/CODE-CLEAN-SCOPE.md @@ -0,0 +1,10 @@ +# CODE-CLEAN SCOPE — approved 2026-11-09 (BDR-125 obsolescence pass) + +Source report: .claude/tasks/plans/2026-11-09-bdr125-obsolescence-clean-1650.md (r2 + confirmation). Approved: all 6 items. Zero behavior change: comments and dead `source` lines only. + +A1. install-plugins.sh:29-30, update-all.sh:18-19 — `source lib/detect-plugins.sh` with no `detect_*` call in either file or the libs they source (verified by all 3 lenses + confirmation; PRE-PHASE debt: git log -S last hit 50db70c 2026-04-15) — warn — delete the source lines (and their comment line if it only explains that source); update lib/detect-plugins.sh:4 "Sourced by:" header to drop install-plugins.sh and update-all.sh; in lib/tests/curated-config-guard.test.sh:9 replace the stale "install-plugins.sh:43-44" line citation with "the GUARDED_CONFIGS array in install-plugins.sh" (comment only) +B4a. link.sh:57-58 — comment says gstack is exposed via flat per-skill symlinks under skills/ created by gstack's ./setup, naming autoplan (retired, lib/gstack-removed.list) — info — rewrite: gstack skills are tracked links under skills/pack-gstack-*/skills/ → skills-external/gstack/ (packs, BDR-134); no skill names +B4b. doctor.sh:607-610 — comment says gstack skills (health, status, …) are OFF by default and profile-managed — info — rewrite: gstack skills ship in three packs (pack-gstack-dev/-browser/-design, on by manifest default = full, off per project or conversation by a profile) and live under skills/pack-gstack-*/skills/, while the check below reads $HOME/.claude/skills//SKILL.md, so they are excluded here; drop `status` from the examples (repo-owned skill, listed in EXPECTED_SKILLS) +B4c. lib/gstack-links.sh:9 — cites "BDR-030 links gstack skills individually" — info — keep BDR-030 and add "(superseded by BDR-134: packs)" +B4d. install-plugins.sh:37-38 — comment says the graphify installer "clobbers" the curated graphify section — info — keep the guard rationale, fix the facts (graphifyy 0.9.67 install.py): Step 7 runs `graphify install` (default platform claude: appends a `# graphify` block to ~/.claude/CLAUDE.md = CLAUDE.global.md, which holds the curated `## graphify` section; matches the heading and appends, it does not clobber) and `graphify claude install` (writes CLAUDE.md and .claude/settings.json in the caller's cwd); the EXIT trap restores the four $REPO files in GUARDED_CONFIGS (fully effective when run from $REPO, e.g. `make plugin`); replace "clobbers" accordingly +B4e. lib/doctor-skills.sh:5-6 and doctor.sh:511-512 — comments say the skill count covers `/*/SKILL.md` only, but phase 5 (6509ab2) added the `pack-*/skills/*/SKILL.md` glob (lib/doctor-skills.sh:50) — info — name both globs in both comments diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index cfe9f7f..74b8bf0 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -1,4 +1,5 @@ --- +format: 2 type: blockers_registry entry_prefix: BLK schema: @@ -16,39 +17,6 @@ rules: # Blockers registry (BLK) -## Index - -| ID | Date | Friction | Status | -|----|------|---------|--------| -| BLK-001 | 2026-04-22 | `rtk curl` breaks JSON pipelines | upstream | -| BLK-002 | 2026-04-23 | `rmdir` denied in sandbox on empty directory | resolved | -| BLK-003 | 2026-05-12 | `scripts/screenshot.mjs` hardcoded macOS path blocks PNG cards on Linux | upstream | -| BLK-004 | 2026-05-20 | `/ship-feature` wrapper at `~/.claude/commands/` points to deleted agent files post-refactor | resolved | -| BLK-005 | 2026-05-21 | gstack submodule rename (checkpoint→context-save) breaks profile entries | resolved | -| BLK-006 | 2026-05-21 | `profile.sh current` false-negative via `~/.claude` symlink (`cd` not `cd -P`) | resolved | -| BLK-007 | 2026-06-02 | 6 gstack source skills (ios-*, spec) unlinked post-bump — invisible to profiles + `gstack on` | resolved | -| BLK-008 | 2026-06-23 | gstack ./setup on Ubuntu 26.04: Playwright chromium unsupported → gstack browser (/browse, /qa, screenshots) silently dead | resolved (211c7d4) | -| BLK-009 | 2026-06-25 | user-level path-scoped rules (`paths:` frontmatter in `~/.claude/rules/`) never inject — broken in CC 2.1.190 (#21858) | resolved (2026-07-06) | -| BLK-010 | 2026-06-27 | init-project: scaffold (STEP 5) + bootstrap README (5b) have no deterministic commit owner; worktree `add -b` on unborn HEAD | resolved (uncommitted) | -| BLK-011 | 2026-06-27 | init-project STEP 13 GSD post-FINISH creates ROADMAP.md → stranded doc (3rd post-FINISH artifact) | resolved (STEP 12 removed) | -| BLK-012 | 2026-06-29 | gitflow_init half-applied: socle-commit failure swallowed → hook activated on partial run → re-run self-blocks | resolved | -| BLK-013 | 2026-06-30 | `make plugin` Error 127 — npm absent on apt-`nodejs` host (Step 4 gsd-pi aborts, Steps 5-10 + residual cleanup never run) | resolved (env) | -| BLK-014 | 2026-07-01 | `make install` aborts npm EEXIST on `~/.local/bin/claude` when claude already installed via native installer — no presence guard | resolved | -| BLK-015 | 2026-07-03 | `gitflow_finish` ignored its ` ` args → merged the CHECKED-OUT branch not the one named → wrong-branch merge (audit LOT3) | resolved | -| BLK-016 | 2026-07-04 | rtk compression PATH-dead 30 days — 6/5070 Bash commands compressed (~460K tokens missed); installer sources cargo env so its own check passes, Claude tool shell never gets ~/.cargo/bin | resolved | -| BLK-017 | 2026-07-17 | Bing Webmaster API unusable for a multi-client agency: OAuth swamp (localhost redirect refused, rotated single-use refresh tokens race our parallel dispatch), API key = wrong model (client-owned sites) | open/deferred | -| BLK-018 | 2026-07-20 | release-executor finish span blocked by permission classifier (human signal invisible to subagent) — 2026-07-… | open | -| BLK-019 | 2026-09-01 | notify-attention bell silent, toast OK (VS Code client default) — 2026-09-01 | superseded by BLK-028 | -| BLK-020 | 2026-09-02 | notify-attention: both channels dead on one VS Code client — 2026-09-02 | superseded by BLK-028 | -| BLK-021 | 2026-09-22 | Bash tool dead mid-session ("every command exits 1"): /tmp usrquota blown by a dead session's probe HOMEs — 2… | open | -| BLK-022 | 2026-09-22 | `hooks/guard-bash.sh` withheld by the safety classifier; executable spec shipped instead — 2026-09-22 | open | -| BLK-023 | 2026-09-28 | floor-guard SKIP pattern `xit(` (Jasmine) matches any `exit(` in python/JS test helpers → false ECARTS; workaround: no `exit(` in inline python, bash derives rc from output — 2026-09-28 | resolved | -| BLK-024 | 2026-09-29 | update-all.sh re-fetched vendored skills but never re-applied the effort pins (lost until next `make plugin`); my first fix placed the re-apply BEFORE the late 21st refresh — rtk-truncated grep read as complete — 2026-09-29 | resolved | -| BLK-025 | 2026-09-30 | deny rule `Bash(npm install -g *)` bypassed unknowingly by the alias `npm i -g` (pasted user instruction ran as typed); deny patterns are literal prefixes — 2026-09-30 | resolved (partial) | -| BLK-026 | 2026-10-06 | `make test` red on macOS: 13 suites, GNU-only idioms in suite + 7 libs (SIGPIPE under pipefail, `sed -i`, `wc` padding, `stat -c`, `realpath -m`, bare `timeout`, `grep -oP`) | resolved | -| BLK-027 | 2026-10-06 | this machine never ran `make link`/`make plugin`: no global `core.hooksPath` → post-commit push never fired, branches landed ahead of upstream; 11 vendored skills + `~/.claude/.env` missing | resolved (link) / open (plugin) | -| BLK-028 | 2026-10-06 | notify-attention on a VS Code client: bell + toast silent-degradation faults (merge of BLK-019 + BLK-020): terminalBell sound default off, ext hooks only terminals born after activation, Code muted in Windows mixer | resolved | - --- ## BLK-001 — `rtk curl` returns compressed schema in pipes @@ -225,7 +193,9 @@ rules: - **Real cause**: gitflow doctrine "finish only on explicit human signal" lives in DISPATCHER transcript (user ask + STEP 4 AskUserQuestion go); subagent transcript starts fresh → classifier sees consequential merge with zero authorization evidence. Structural: any human-gated action dispatched to a subagent loses its gate evidence. - **Solution** (workaround): dispatcher ran `gitflow.sh finish` + tag inline after its own human gate — where the signal is real. Release completed clean (main `648bc6e`, tag v1.3.1). - **Status**: open. Candidate fixes: (a) quote gate evidence verbatim in span prompt — untested vs classifier; (b) move finish+tag span permanently inline in /release-candidate — keeps prep span dispatched, costs the sonnet pin on ~5 mechanical commands, cheap; (c) permission rule allowing subagent `gitflow.sh finish` — weakens the guard, refused. Decide at next release. +- **Status (2026-10-23, reconcile)**: open. Did not recur at 2.0.0 (journal: release-executor finish passed), no fix applied (release-candidate SKILL.md:88-90 still dispatches `SPAN: finish`). Decide (a)/(b) at 3.0.0. - **Reference**: skill `release-candidate` STEP 5. Pattern adjacent [[LRN-089]] (ambient-state/context assumptions across boundaries). Journal 2026-07-20. +- **Status (2026-11-02)**: resolved 536d39e: option b, /release-candidate runs gitflow.sh finish and the tag in the main loop under the ask prompt ## BLK-019 — notify-attention bell silent, toast OK (VS Code client default) — 2026-09-01 - **Friction**: hook fired, Windows toast arrived, native bell never audible. User heard only Windows toast sound. Looked like half-broken hook. @@ -233,6 +203,7 @@ rules: - **Solution**: `"accessibility.signals.terminalBell": { "sound": "on" }` in CLIENT-side user settings.json (`c:/Users//AppData/Roaming/Code/User/`). Unreachable from remote: real SSH remote, not WSL (no `/mnt/c`, `/proc/version` no Microsoft). User applied, retest → both channels OK. - **Status**: resolved (per-client-machine, not repo-portable). - **Reference**: `~/.claude/hooks/notify-attention.sh` header already documented the setting; never applied. New client machine → bell mute again while toast works. Silent-degradation class [[LRN-047]]. +- **Status (2026-10-28, upgrade)**: superseded by BLK-028 ## BLK-020 — notify-attention: both channels dead on one VS Code client — 2026-09-02 - **Friction**: client-side prereqs applied on Windows box (ext `wenbopan.vscode-terminal-osc-notifier` + `accessibility.signals.terminalBell` sound:on), window reloaded. AskUserQuestion → nothing. `idle_prompt` 90s wait → nothing. Direct write `\a\a` + OSC 777 to claude own pty (`/dev/pts/2`) → nothing. Second client machine, same SSH server, same hook, same registries → both channels OK. @@ -253,6 +224,7 @@ rules: - **Status**: resolved (A: ext hooks only terminals born after activation → install ext THEN start/re-attach session; B: Code app volume 0 in Windows mixer). - **Lesson**: two independent client faults presented as one symptom ("nothing works"). Splitting probe = run signal in FRESH terminal + play VS Code's own sound preview. Preview bypasses terminal/BEL/hook/dtach/ext → isolates renderer audio in one step. Do that FIRST next time, before any server-side archaeology. - **Reference**: [[BLK-019]] bell-only variant (resolved differently — setting alone insufficient here), [[LRN-145]] terminalSequence-not-/dev/tty pattern. Silent-degradation class [[LRN-047]]. +- **Status (2026-10-28, upgrade)**: superseded by BLK-028 ## BLK-021 — Bash tool dead mid-session ("every command exits 1"): /tmp usrquota blown by a dead session's probe HOMEs — 2026-09-22 - **Friction**: previous session on `feature/21st-cli-migration` lost its shell before tests + commit: every Bash call, `echo` included, returned 1. Its harness file `imptest2/step8d-test.sh` landed as 0 bytes. @@ -261,6 +233,7 @@ rules: - **Recurred same day**: this session's shell died the same way mid-G8 (BDR-095 amendment) while the 5.9 GB still sat there; recovered the moment the user deleted the dir. Mechanism now established, not inferred: stock `/usr/lib/systemd/system/tmp.mount` mounts /tmp with `x-systemd.graceful-option=usrquota` (no override, no fstab line on this machine) and systemd caps each user at 80% of the tmpfs → 0.8 × 7.4 GB = 5.9 GB, the exact volume observed. One quota for every session AND every sub-agent of the uid: multi-session is not the cause, the shared cap is. - **Durable fix**: (1) launch claude with `TMPDIR=$HOME/.cache/claude-tmp` (in `~/.bashrc` `dtach_claude()`, before `exec claude`; `mkdir -p` it) → Claude Code's scratchpad, tool outputs, `mktemp` and npm staging all leave the tmpfs; children inherit. (2) `~/.config/user-tmpfiles.d/claude-tmp.conf` with `e %h/.cache/claude-tmp - - - 3d` + the user `systemd-tmpfiles-clean.timer` so dead-session dirs age out. (3) `make doctor` "Scratchpad" section warns while TMPDIR sits on a quota'd tmpfs. Probe rule unchanged: HOMEs with npm payloads under `~/.cache//`. - **Status**: cause established; open until the launcher exports TMPDIR (user's .bashrc, hand-managed). Links [[BDR-094]], [[BDR-095]], [[LRN-159]]. +- **Status (2026-11-02)**: resolved 2026-11-02: lib/cc.sh exports TMPDIR=$HOME/.cache/claude-tmp for every cc session (phase 5) ## BLK-022 — `hooks/guard-bash.sh` withheld by the safety classifier; executable spec shipped instead — 2026-09-22 - **Friction**: layer C item G2 (PreToolUse Bash guard: whole-command scan incl. nested `bash -c`, `docker compose run … lftp`, scripts the command runs; exit 2 + reason + `logger` trace; fail-closed without jq). The response carrying the hook body was stopped by a safety classifier mid-write; content withheld, instruction not to regenerate it. @@ -305,3 +278,133 @@ rules: - **Probe order (do FIRST, before server archaeology)**: fresh VS Code terminal, `printf '\a\a\033]777;notify;Test;hello\033\\'` → splits terminal path from client renderer; palette `Help: List Signal Sounds` → Terminal Bell preview bypasses terminal/BEL/hook/dtach/ext, isolates renderer audio in one step. - **Status**: resolved (BLK-019 2026-09-01, BLK-020 A+B 2026-09-02/03). Sources superseded by this entry; bodies kept for history. - **Reference**: `~/.claude/hooks/notify-attention.sh` header documents the setting; [[LRN-145]] terminalSequence-not-/dev/tty; silent-degradation class [[LRN-047]]; sources [[BLK-019]], [[BLK-020]]. + +## BLK-029 — Mods: model alias set by a hook resolves to a stale id (`sonnet` → `claude-sonnet-5`, 404) — 2026-10-08 +- **Friction**: model-router spike. Sub-agent routed by `agent.spawn` or `tool.call Agent` rewrite with alias `sonnet`/`haiku` → "model_not_found HTTP 404, model sent to the API: claude-sonnet-5". Same alias typed by the model in the Agent tool param → `claude-sonnet-5-5`, OK. +- **Real cause**: two alias tables in the CLI (2.1.294): the Agent tool's is current, the function-hooks path's is stale. Not an access issue (`/model` lists all four tiers; explicit haiku/sonnet dispatches answered). +- **Solution**: hooks write full ids (`claude-sonnet-5-5`, `claude-haiku-4-5-20251001`, `claude-opus-5-5`, `claude-fable-5-1`) from the mod's own table; Agent tool param rewrite stays alias-only (schema enum) → the mod sets the model at `agent.spawn`, not at the param. +- **Status**: upstream (report to anthropics/claude-code with the request id `req_011Cfppp7VFt8z2Pd3zJrpUi`); workaround in model-router. +- **Reference**: [[LRN-203]], plan `.claude/tasks/plans/2026-10-08-model-router-mod.md`. + +## BLK-030 — model-router routes main to Fable out of usage credits; turn lost every session + hold lapse — 2026-10-15 +- **Friction**: Fable 5.1 out of credits. `route(reflect)` answered `claude-fable-5-1 (upgrade)` after hold lapse; next request died `` "You're out of usage credits", `apiError: model_requires_usage_credits`, `error: rate_limit`, HTTP 429. Holds 15→30→60 min, user typed "reprends" each time. +- **Real cause**: availability learned only reactively. Breaker (`markDown`) fed by `classic.StopFailure` + `PostModelSwitch auto`, i.e. AFTER real request died. Hold in-memory w/ backoff; nothing checked move target before main sent there. 429 body generic (no credits marker) → no cheap typed signal. +- **Solution**: 2cccc43 (bugfix/router-probe-before-route). `decideFor` decides first, then probes decided move target once: `$.model.complete` raced vs `PROBE_MS` 8000 via shared `raceTimeout`; timeout/reject → `markDown(..., 'probe')` + ONE re-decision, no further probe. `verified` set kept across `/clear`, cleared by `markDown`. Never probes cur or held id. Config `probe` (default true). Stand-in effort one notch up (reflect xhigh, plan max, orchestrate high) when lower model replaces held tier head where head would have run; explicit/floor effort never bumped. 497 tests. +- **Status**: resolved. Residuals in TODO (explicit `Agent(model:"fable")` pins, spawn path, session model itself out of credits, ≤8 s stall per new session). +- **Reference**: [[LRN-218]], [[BDR-116]], [[BDR-115]], [[LRN-207]], contract `.claude/tasks/contracts/2026-10-14-router-probe-before-route-0005.md`, plan r3 `.claude/tasks/plans/2026-10-14-router-probe-before-route-0005.md`. + +## BLK-031 — model-router: session ON Fable w/o credits still loses 1st turn; probe skipped kept model — 2026-10-16 +- **Friction**: session model fable, credits out. Log `main: fable/high → fable/medium (implement: classifier)` then "You're out of usage credits", then `claude-fable-5-1 unavailable (rate_limit) for 15 min`. User suspected bad redeploy; not cause. +- **Real cause**: 2cccc43 `unprobed()` required `call.moved`: only move target probed. Session model = cur, kept by `decideMain` → never probed. New process (empty `verified`) + hold lapse (`markDown` drops `verified`, cur = session model again) → real request to dead model. Residual of [[BLK-030]], accepted then. +- **Solution**: c11cd3b drops `!call.moved` guard: model decision lands on (moved or kept) probed once if table id, unverified, not held. Fail → markDown 'probe', one re-decision → leaveDown → opus, stand-in effort +1. Cost ~1.3 s healthy / ≤8 s dead, 1st decision per process. Test `probe: a session model that never answers leaves for opus on the first step`. +- **Status**: resolved. Open: leaveDown follows classifier `wanted` (implement → sonnet), not opus; "context size unknown" likely document attachment → `promptSize` unknown. +- **Reference**: [[BLK-030]], [[LRN-218]], contract `.claude/tasks/contracts/2026-10-16-router-probe-session-model-1850.md`. + +## BLK-032 — Main loop pinned on Fable in long sessions: session model Fable 1M + downgrade cap 120k + prompt rule `plan` → inline code on Fable xhigh [resolved] +- **Date**: 2026-10-19 +- **Cause**: `~/.claude/settings.json` `"model": "claude-fable-5-1[1m]"` (every session starts on Fable); model-router never moves main above the session model, moves DOWN only under `downgradeMaxTokens` 120000 (LRN-204 cold read) → a long session (faunosteo R4.x, context > 120k) never reaches `implement`/sonnet; prompt rule `(plan|design|architecture…)` → phase plan = best/xhigh each turn ("plan §B.1.7"). No doctrine ceiling: CLAUDE.md allows inline work "doable in a few tool calls", BDR-115 "pin = default, never ceiling". +- **User policy 2026-10-19**: session model Opus 5.5; sonnet writes, opus decides what to write; Fable only for orchestrator reflection/plans and the important audits (security, functional), other judges opus. → next `/feat`: settings model, `judge` split, ceiling rule in CLAUDE.md, BDR superseding part of BDR-066 / BDR-115. Links [[BDR-066]], [[BDR-107]], [[BDR-115]], [[LRN-204]]. + +- **Solution (2026-10-23)**: feat A+B (BDR-123) + feat C 786ee13 (feature/router-keyword-cap): keyword prompt rules, `ultrathink` floor, derived `orchestrate` dispatch write effort-only routes (`effortRoute`, `belowRun` pattern) → never lift main above session model; held best-tier run keeps its model (per-axis fall-through); `mainModelSlot` drops `turnFloor`. Fable on main only via skill row, `route` tool, `/route`. Docs d2d590f. Links [[LRN-226]], [[EVAL-048]]. + +## BLK-033 — Guardrails residuals: probe trusted plan `supabase.url`, redirects free of budget, unread bodies read CLOSED; rules 5 FP / 7 misses [resolved] +- **Date**: 2026-10-21 +- **Friction**: GATE 2 of the a11y split (f586304) left a MEDIUM + 3 LOW on probe.py, opus review left Minors on the rules. Parked in TODO, fixed via `/bugfix` 2026-10-20/21. +- **Cause**: `supabase.url` read from the plan w/o `_http_url` → planted SUPABASE_URL would receive GUARDRAILS_ANON_KEY / JWT2, `file://` read CLOSED; `_SameHost` redirector followed hops w/o charging `session.budget`; `_rows_state` collapsed non-200 / empty / >1 MB / non-JSON into CLOSED (unobserved = CLOSED, breaks LRN-220); plan r2 mapped budget exhaustion on `str(URLError)`, which wraps the reason → never matched. Rules: SENSITIVE_KEY on metadata names (`token_type`, `has_password`), 403 on first map candidate stopped the walk, hydrated scan read whole route file, NOSQL `$where` fired on GraphQL `_bool_exp`; misses: Go backtick Sprintf, `rf`/triple-quoted f-strings, `sql|db|trx.raw`, empty `.select()`, multi-line hidden input, Rust `{}` shell arg, `"sources"` map head. +- **Solution**: 5a98c2c (`_BudgetExhausted(URLError)` + `BUDGET_EXHAUSTED` constant, `_SameHost(session)` charges per hop, `_rows_state` rows|empty|unreadable → SKIPPED, `_map_outcome` full candidate walk, `data:` OPEN w/o decoding, `printable` on remote strings, `_safe_text` in scanner, rule fixes + mutant per language variant) + 633faa2 (checks.md: `IN (…)` placeholder list flagged, judged by hand). Plan r3 after 2 challenge rounds, contract 22 oracles MET, verifier CONFORME, auditor PASS. Suites probe 84, scan 241. +- **Residual** (LOW, parked in TODO): table names not `IDENT.fullmatch`-checked per table (`/` → path walk on the approved host); `printable` lets Unicode bidi/format controls through. Links [[LRN-219]], [[LRN-220]], [[LRN-222]], [[LRN-223]]. + +## BLK-034 — mods.test.sh red on CLI 2.1.306: whole-output `warning` grep caught the advisory plugin-directory section [resolved] +- **Date**: 2026-10-22 +- **Friction**: `make test suite=lib/tests/mods.test.sh` → `FAIL model-router: validate printed a warning`, pre-existing on develop (git archive baseline), surfaced as feat B criterion 8 (NEED-DECISION, BDR-123 run). +- **Cause**: CLI 2.1.306 `claude plugin validate` prints "Plugin directory checks" section (submission catalogue): `⚠ Found 1 plugin directory warning:` ICON_MISSING, `--json` `directory.findings[].blocking: false`. mods.test.sh:57 grepped whole output for `warning` (also matched hooks notes quoting register.ts identifiers, checkout paths). Prose scraping of a CLI with an exit-code contract: `--strict` → per-file warnings rc 1, directory findings rc only under `--profile directory`. +- **Solution**: 801992a (bugfix/mods-validate-advisory). Helper `validate_strict` = rc of `claude plugin validate --strict`; check_cli + positive control share it; control = scratch manifests `{"name":"warnfix"}` (rc 1) / cleanfix with version+description+author (rc 0) under script-level `mktemp -d`. Plan r3 after 3 lenses + 1 re-challenge (sed range on closing marker killed: CLI prints it only when findings > 0, fail-open to EOF). GATE 0 7/7, verifier ECARTS(2) = out-of-scope routing.json dialog write only, auditor PASS. +- **Residual**: 3 historical contracts carry old scrape as CHECK oracle (`.claude/tasks/contracts/2026-10-08-model-router-w1a-1533.md:22`, `2026-10-08-model-router-floor-1835.md:22`, `2026-10-09-model-router-tiers-1237.md:23`), left unedited; re-run fails on ICON_MISSING, not a model-router regression. Unverified: whether `--strict` escalates `advice[]`. Links [[LRN-225]], [[BDR-123]]. + +## BLK-035 — model-router: haiku session unrouted, table still on Haiku 4.5 [resolved] +- **Friction**: integration_alphalink 2026-10-25T16:22:53Z `model-router: claude-haiku-5-5 unknown to the models table; no switch`. `/model haiku` → This project (BDR-126) would write stale id. +- **Cause**: DEFAULT_CONFIG `haiku: 'claude-haiku-4-5-20251001'` + `windows` 200K entry; native alias moved to `claude-haiku-5-5` (1M, effort low–max) silently. +- **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]]. +- **Status 2026-10-25**: residual resolved 8e93507 (bugfix/router-haiku-effort): no-effort guard scoped to Haiku 4.x, Haiku 5.x gets route effort; negative control (family prefix) → 6 tests red. + +## 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`). + +## 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. + +## BLK-038 — memory.sh upgrade cements a v1 prose false-closed as an explicit resolved status line [open] (2026-10-30) +- **Date**: 2026-10-30 +- **Friction**: phase 4a per-repo pass. `memory.sh upgrade` on orbistep wrote `- **Status (2026-10-30, upgrade)**: resolved` under BLK-021 (`status: open`, fix not decided) and BLK-030 (`status: code resolved (df5818c) · SMTP open (upstream OVH)`), twice under BLK-008. Oracle silent: "open BLK unchanged (14)". +- **Real cause**: `_mem_upgrade_repair` copies the v1 legacy reader's closed verdict, never asks where it came from. Legacy reader = last line matching `status|resolved|…|open`, prose included ("another tab already resolved it"). v1 false-closed → explicit status line. Oracle shares that reader → blind ([[LRN-237]]). Duplicate: `_mem_verdict_diff` loops `_mem_heading_ids`, which lists `### BLK-008 UPDATE` sub-heading too. +- **Measured**: 13 repos, 4 v1 closures without a labelled leading closed word: orbistep BLK-021 (really open), BLK-026 (prose addendum, really resolved), BLK-030 (mixed), bchanot-cv BLK-001 (strict already resolved, no effect). No lexical rule decides prose: BLK-021 and BLK-026 same shape, opposite truth. +- **Solution**: /bugfix bugfix/memory-upgrade-prose-closure: repair only from a `Status`/`Statut` label whose leading word closes; else refuse file (rc 2), name ID + v1 line + remedy `memory.sh status`. Dedupe IDs. Committed repos audited clean; orbistep + zenquality redone after fix. +- **Status (2026-10-31)**: resolved 2dae528: repair writes only a single closed Status word, prose/mixed refused and named, diff captured before inserts, one upgrade line per entry; orbistep + zenquality redone (144505f, b7edb9c) + +## BLK-039 — Nested heredoc executed plan text: settings.json committed, user's stash popped [resolved] (2026-11-02) +- **Friction**: a Bash call holding a python heredoc that itself contained `<<'EOF'` blocks: the inner `EOF` closed the outer heredoc; the rest of the plan text ran as shell commands → `git stash push settings.json` (silently failed), `git commit` of settings.json WITH the UI writes (theme, switchModelsOnFlag), auto-pushed; `git stash pop` popped the USER's own stash `wip: settings+routing dirty (user)` (conflict, entry kept). +- **Real cause**: heredoc nesting with the same delimiter; `rm -r`-class rules did not matter, the damage was git state. +- **Solution**: tree restored (`git reset -q`, checkout of the three stash-touched files to HEAD, stash-brought spec removed), commit dropped with `git reset --soft HEAD~1` + `git push --force-with-lease=:` (user approved), user's stash untouched. Rule: plan/doc text via Write/Edit, never heredoc-in-heredoc; never `git stash pop` on a machine with the user's own stashes; settings.json only through the index recipe (LRN-253). +- **Status**: resolved 2026-11-01. + +## BLK-040 — Permission rules and auto-mode classifier refuse destructive-shaped compound calls and dispatches [resolved] (2026-11-02) +- **Friction**: phase 5 execution: the permission rules refused a compound Bash call holding a `trap` with `rm -f`/`rmdir` (Task 1 canary), a 53-name `rm … && rmdir && rm .active-profile` chain, and `rmdir` alone; the auto-mode classifier refused the whole Task 2 dispatch because its brief described removing ~70 symlinks, moving impeccable and rewriting settings.json. +- **Real cause**: destructive-shaped text in one call or one brief; the classifier judges the dispatch prompt, the rules judge each command. +- **Solution**: split build steps (implementer) from state steps (main loop, after the user's explicit approval); one `rm` of literal names per call; `mv` to the scratch dir instead of `rmdir`/`rm -r`; never retry a refused command through a wrapper. Cost: three extra user gates, no data loss. +- **Status**: resolved 2026-11-02. + +## BLK-041 — gitleaks 8.16 pre-commit ignores .gitleaks.toml allowlists: secret-shaped fixtures built at runtime [resolved] (2026-11-04) +- **Friction**: 4b spec quoted the fake AWS key and test fixtures held `AKIA…`-shaped literals; the pre-commit hook refused: `gitleaks` found leaks although `.gitleaks.toml` `[[allowlists]]` named them (gitleaks 8.16). +- **Real cause**: the installed gitleaks does not honour the allowlist block under the hook's invocation (rules compiled in; allowlist silently ignored). +- **Solution**: secret-shaped fixtures built at runtime by concatenation (`'AKIA' + 'I'.repeat(16)`, `'eyJ' + 'a'.repeat(20) + …`), expected strings stay literal (LRN-237); spec and NOISE.md quote shapes by reference, never a literal. +- **Status**: resolved 2026-11-03. + +## BLK-042 — Package extracted into the root filesystem of a VM replaced usr-merge symlinks and overwrote system binaries [resolved] (2026-11-05) +- **Friction**: on a VM (vaas-cli ssh, no package manager), a Debian package was extracted with `dpkg -x` into the root filesystem; system binaries overwritten, usr-merge symlinks (bin, sbin, lib, lib64) replaced by real directories carrying the archive's paths. +- **Real cause**: no rule or guard named package/archive extraction into system dirs; the ssh deny rule did not cover vaas-cli ssh; extraction improvised instead of telling the user there was no package manager. +- **Solution**: `hooks/extract-guard.sh` (deny before run, quoted remote scripts re-scanned) + soft_deny line + doctrine bullet (list first, extract into a literal mktemp -d path, PATH/PYTHONPATH, no package manager → tell the user). See the extract-guard BDR. +- **Status**: resolved 2026-11-05. + +## BLK-043 — detect_plan CLI fallback forks claude from SessionStart hook: recursive fork bomb, OOM, reboot [open] (2026-11-06) +- **Friction**: `make test suite=lib/tests/session-digest.test.sh` (uncommitted SD13 cases) ate 14 GiB in 45 s, 2026-11-05 23:49; earlyoom killed valheim, node, mariadb, docker, audio; kernel OOM; machine rebooted 23:55; all sessions + RC lost. OOM dump: 126 `claude`, 396 `bash`, 124 `sh`. +- **Real cause**: `lib/detect-plugins.sh` `detect_plan` falls back to `claude config get planType` when `$HOME/.claude.json` lacks plan markers. claude 2.1.318 has no `config` subcommand → words read as prompt → full session → its SessionStart hook (`hooks/session-start.sh:158`) calls `detect_plan` again, same HOME → unbounded recursion. SD13 `mkhome` linked `~/.claude/*` but not `~/.claude.json`. Prod survives only via internal flags `tengu_cobalt_compass` + `tengu_harbor` in `~/.claude.json`; flag rename upstream → every session start recurses. +- **Solution**: pending /bugfix (plan `.claude/tasks/plans/2026-11-06-detect-plan-fork-bomb-0030.md`): CLI fallback dropped (default pro), hook recursion guard env marker, suite-wide `claude` stub in PATH + regression cases. +- **Status**: open 2026-11-06, fix in progress. +- **Status (2026-11-06)**: resolved 49aa2ff (hotfix/detect-plan-fork-bomb): CLI fallback dropped, env guard SESSION_START_RUNNING, lib/tests/detect-plan.test.sh red on main lib, green after; merge pending user + +## BLK-044 — claude processes run with oom_score_adj -1000 of unknown origin: OOM killers spare a runaway claude [open] (2026-11-06) +- **Friction**: during the detect_plan fork bomb (2026-11-05 23:49), every `claude`, `bash`, `grep` child carried `oom_score_adj=-1000`; earlyoom and kernel OOM could not kill the runaway, killed every other service instead (valheim, mariadb, docker, networkd, logind) until reboot. Live session 2026-11-06 still shows `-1000`. +- **Real cause**: unknown. Not set by the repo (`lib/cc.sh`, hooks: no OOMScoreAdjust). Suspects: inherited from launcher (dtach under `systemd-run --user --scope`, sshd, or the RC/remote-control process). +- **Solution**: none yet. Next: trace `/proc//oom_score_adj` up the parent chain of a live claude; then set `OOMScoreAdjust` (e.g. 500) on the `cc` scope so a claude runaway dies first. +- **Status**: open 2026-11-06. + +## BLK-045 — Hook-running test suites could reach real claude CLI: fail-open inline stubs, 3 suites unstubbed [resolved] (2026-11-06) + +- **Date**: 2026-11-06 +- **Friction**: hook-running test suites could still reach real `claude` CLI (BLK-043 family). Inline stubs in detect-plan + session-digest ran `claude probe` before checking stub won PATH; red control did not stop suite. graphify-gate, memory, push-guard ran `hooks/session-start.sh` with no stub; cc.test.sh shims same fail-open shape. +- **Real cause**: stub pattern (LRN-263) copied inline, fail-open: failed write (no `set -e`) or noexec TMPDIR (`command -v` skips non-exec) → real CLI; relative work dir passes same-cwd check, breaks after hook's `cd`. +- **Solution**: shared `lib/tests/claude-stub.sh`: `stub_first_or_die` (command -v == stub else exit 1), `claude_stub_install` (absolute dir via `cd -P`, every step `|| exit 1`, control from `/`, `GIT_CEILING_DIRECTORIES`), `claude_stub_calls`; 6 suites adopt, each ends zero-call check; `lib/tests/claude-stub.test.sh` proves fail-closed (no-op chmod script + sentinel fake claude). Commits dc5f127, 7ca6b18 on bugfix/safety-residuals. +- **Status**: resolved dc5f127 + +## BLK-046 — Banner plugin rows showed user-scope state, not effective profile [resolved 556d0e6] (2026-11-10) +- **Date**: 2026-11-10 +- **Friction**: session banner plugin rows showed user-scope state, not project's. dev project showed `ui-ux-pro-max` in `🟢 ON`; audit project hid `pr-review-toolkit`; /status read `~/.claude/plugins/cache` as active. +- **Real cause**: `detect_uiux_pro_max` tested plugin cache only (installed = on); ✅ row grepped `"": true` in user `~/.claude/settings.json`. PROFILE_PLAIN (`profile.sh current --plain`) already held effective state, unused there. Found by code-clean 2026-11-09 (G1, G4). +- **Solution**: `list_on_plugins` in lib/detect-plugins.sh: profile `plugin:=on` for managed ids, user-scope true for rest, awk set difference, `return 0`. ✅ row + detect_uiux_pro_max (cache AND enabled) + status-reporter read it; plugin-advisor INPUT names PROFILE. Test lib/tests/session-banner.test.sh SB1-SB8. Commit 556d0e6. + +## BLK-047 — Passive-cost constants stale in banner and advisor, budget row on wrong denominator [resolved 1971b8d] (2026-11-10) +- **Date**: 2026-11-10 +- **Friction**: passive-cost figures disagreed: banner `_plugin_costs` (gstack 2750, ui-ux-pro-max 400, context7 200, graphify 300) and plugin-advisor `~Nt` vs doctor.sh (ui-ux 670 only). Banner 💰 row divided by per-plan "budget" (Pro 11000, Max 20000). +- **Real cause**: hand-copied constants. 2026-09-28 skill-catalog prune re-measured doctor (ui-ux 400 → 670, gstack/context7/graphify dropped: skills already in catalog) but missed banner + advisor citers (BDR-100 class). Measured 2026-11-10: gstack 3 packs ~445t (~196/120/129), ui-ux ~666t, context7 = CLI, find-docs skill always loads. +- **Solution**: user split. Bugfix removed constants, 💰 row, budget block, dead `detect_plan` (BLK-043 source); advisor + status-reporter point to `make doctor`; detect-plan.test.sh → hook-recursion-guard.test.sh; SB9/SB10. Commit 1971b8d. Measured-cost API = TODO feature (spec input: two challenge rounds in plan 2026-11-10-passive-cost-source-1330). + +## BLK-048 — Handover STEP 9 parsed blocker status by hand, client section 5 could list closed or drop open [resolved 93a8e19] (2026-11-11) +- **Friction**: handover-doc-writer STEP 9 said "parse manually", blocker status read from prose of cwd-relative `.claude/memory`. Client §5 could list closed blocker or drop open one (BLK-032..034 class). +- **Real cause**: agent prompt bypassed shared readers. `reconcile_blk_open` not reusable as is: v1 branch closes on substring "resolved" (drops `unresolved`); v1 non-word lines (`closed`, prose) leak as open; `###` entries invisible to enumerator. +- **Solution**: new `reconcile_blk_classify` (lib/reconcile.sh): strict word v2, `_mem_v1_word` v1, never `## Index`; closed omitted; empty/prose/mixed/`closed`/`###` = unreadable. STEP 9 rooted on PACKAGE root, `no-file` / `reader-unavailable` lines. Fenced SYNTH REPORT, mandatory `MEMORY:` line; orchestrator retries when missing or contradicted by existing blockers.md, relays unreadable IDs + `memory.sh status` remedy in 9.7. Test handover-memory-contract.test.sh HM1-HM3. Commit 93a8e19. Real data: game repo 14 unreadable (v1 `status:` lines left after upgrade). Follow-ups G6-G9 in BUGS-FOUND. diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index e1cbe79..df09afb 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1,4 +1,5 @@ --- +format: 2 type: decisions_registry entry_prefix: BDR schema: @@ -18,121 +19,6 @@ rules: # Decisions registry (BDR) -## Index - -| ID | Date | Title | Status | -|----|------|-------|--------| -| BDR-001 | 2026-04-22 | Uniform --help helper via session-start hook (option C) | accepted · won't-build 2026-06-30 | -| BDR-002 | 2026-04-23 | Move tasks/ + introduce memory + audits under .claude/ | accepted | -| BDR-003 | 2026-04-23 | Gitignore wildcard + negations pattern for .claude/ | accepted | -| BDR-004 | 2026-04-27 | Adopt auto permission mode as default | accepted | -| BDR-005 | 2026-04-27 | `motion` as default animation library; advisor stays read-only | accepted | -| BDR-006 | 2026-05-03 | Caveman as 4th always-on plugin (output compression) | accepted | -| BDR-007 | 2026-05-04 | Skill profiles partition gstack by usage (design / dev / qa / audit / minimal) | accepted | -| BDR-008 | 2026-05-04 | Profile system v2: extend to plugins + MCPs + CLIs (web/seo/web-full/backend) | accepted | -| BDR-009 | 2026-05-05 | Mandate caveman format on .claude/memory/ registries | accepted | -| BDR-010 | 2026-05-07 | Gate GEO independently at ≥17/20 in client-handover pipeline | accepted | -| BDR-011 | 2026-05-07 | Client handover deliverable: 4-chapter structure + ZenQuality branded HTML/PDF | superseded by BDR-013 (6-chapter doc) | -| BDR-012 | 2026-05-07 | client-handover cover: white bg + green accents + PNG logo default | accepted | -| BDR-013 | 2026-05-11 | client-handover: 6-chapter doc — promote scores §2 + NAP §4 | accepted | -| BDR-014 | 2026-05-11 | Personal SKILL.md descriptions: "Use when [triggers]…" pattern + 1024-char spec limit | accepted | -| BDR-015 | 2026-05-12 | Exclude broken gstack symlinks from /darwin-skill scope (external ownership) | accepted · trigger cleared by BDR-043 | -| BDR-016 | 2026-05-15 | doc-syncer: README AUTO+unconditional, DEPLOY.md prod-only + 14-section VPS template | accepted | -| BDR-017 | 2026-05-18 | `full` profile = web-full + plan + dev superset for /init-project MVP | accepted | -| BDR-018 | 2026-06-02 | `profile gstack on/off` verb — toggle gstack keeping active-profile label | accepted | -| BDR-019 | 2026-06-09 | Remove `disable-model-invocation` repo-wide — align skills with CLAUDE.md routing | accepted | -| BDR-020 | 2026-06-11 | `/audit-delta`: per-axis SHA markers + always-on fix gate + unreachable-first-run = full report-only | accepted | -| BDR-021 | 2026-06-27 | CLAUDE.md restructure: contradiction purge, project-specific sections labeled, critical sections never compressed | accepted | -| BDR-022 | 2026-06-18 | doc-syncer scoped to public docs; `.claude/` + `CLAUDE.md` read-only context, never targets; conventions + clean mode | accepted | -| BDR-023 | 2026-06-19 | Merge /close into /capitalize — 2 modes + TODO reconcile; /close alias | accepted | -| BDR-024 | 2026-06-27 | `profile show --plain` = claude-free parse contract for the design gate | accepted | -| BDR-025 | 2026-06-27 | Design gate profile-based; remedy `/profile design`; magic required-but-manual; unknown → fail-visible; claude via PATH-repair | accepted | -| BDR-026 | 2026-06-27 | Secret source-of-truth outside the repo (`~/.claude/.env`) reached via a `repo/.env` symlink | accepted | -| BDR-027 | 2026-06-27 | Minimal npm-via-nvm bootstrap over a centralized prereq lib | accepted | -| BDR-028 | 2026-06-27 | Hand-curated config install-immutable (auto-revert guard) + de-vendor installer-managed skills | accepted | -| BDR-029 | 2026-06-27 | Installer auto-fixes gstack browser on an OS newer than its pinned Playwright supports | accepted | -| BDR-030 | 2026-06-27 | gstack skills activated ON-DEMAND per profile, not pre-installed; OFF by default stays | accepted | -| BDR-031 | 2026-06-27 | global CLAUDE.md lightening = COMPRESSION, not path-scope / externalization | accepted · 275-line target superseded by BDR-062 | -| BDR-032 | 2026-06-27 | skill `/validate` → `/web-validate` (rename user surface, keep internals) | accepted | -| BDR-033 | 2026-06-27 | design-gate §4: anim-lib suggestion — suggest-only, non-blocking, stateless 1-line | accepted | -| BDR-034 | 2026-06-26 | Coupled-capitalize invariant v1 — memory commit auto per dev flow (Frame 2) | accepted | -| BDR-035 | 2026-06-26 | Analyze-before-plan invariant v1 — read-before bookend of coupled-capitalize | accepted | -| BDR-036 | 2026-06-27 | Doc-sync coupled invariant — commit docs doc-syncer patches (twin of BDR-034, BUILT not reordered) | accepted | -| BDR-037 | 2026-06-27 | v2 capitalize Stop-hook rejected → wire /capitalize+/close to the include | accepted | -| BDR-038 | 2026-06-27 | deploy skill: per-project learning runbook, two-moment cold-resume | superseded by BDR-054 (NEXT.sh, hand-back) | -| BDR-039 | 2026-06-29 | Gitea branch protection = Option-1 owner-pushable, not require-PR | accepted | -| BDR-040 | 2026-06-29 | doc-syncer MINOR-shape oracle: deterministic floor under LLM's MINOR call | accepted | -| BDR-041 | 2026-06-30 | /reconcile = deterministic declared-vs-real engine + thin gated skill (reconciler, not lister) | accepted | -| BDR-042 | 2026-06-30 | /release-candidate = thin orchestrator over gitflow release; the tag lives in the skill, not the lib | accepted | -| BDR-043 | 2026-06-30 | BDR-015 trigger cleared — 5 ex-broken gstack symlinks repaired → darwin re-baseline back in scope (unblocked, NOT run) | accepted | -| BDR-044 | 2026-06-30 | auto-skill-dispatch won't-build — under-routing fear inverted to over-routing by cartography, then measured: model discriminates (clear→route, ambiguous→ask, trivial→abstain) | accepted · won't-build | -| BDR-045 | 2026-07-01 | Standalone memory/doc skills branch to chore/* via aiguillage (hook exemption kept) | accepted | -| BDR-046 | 2026-07-01 | Claude Code installs via official native installer (curl claude.ai/install.sh), drop npm from install.sh | accepted | -| BDR-047 | 2026-07-01 | ECC audit → zero import; local config ahead of reference | accepted | -| BDR-048 | 2026-07-03 | semgrep security gate: engine version + rulesets PINNED, never --config auto; upgrade = deliberate visible human jump | accepted | -| BDR-049 | 2026-07-03 | verifier = fresh + blind (no iteration history) + disk-contract + PROOF-or-fail; mute ≠ PASS; scope enrichment via human micro-gate | accepted | -| BDR-050 | 2026-07-03 | universal pipeline (contract→dev inline→fresh verify→fresh security, loops bounded 3× in main loop) with per-flow weighting; hotfix failure = revert not loop | accepted | -| BDR-051 | 2026-07-04 | contract enrich-at-gate: the contract grows ONLY at a human micro-gate ([gated] marker); the verifier judges the ENRICHED contract, not the seed | accepted | -| BDR-052 | 2026-07-05 | /tour auto mode = branch-as-gate: no mid-run approval gates; unmerged chore branch + per-project TOUR.md = deferred human gate; reconcile report-only; loop bounded 3× | accepted | -| BDR-053 | 2026-07-06 | ctx7 single surface: keep find-docs skill, kill context7.md rule | accepted | -| BDR-054 | 2026-07-06 | supersede BDR-038 NEXT.sh/hand-back artifacts — shipped impl removed both (52f6678, LRN-102) | accepted | -| BDR-055 | 2026-07-07 | job5: delete memory-commit/doc-commit `pending` verbs — v2 hook rejected (BDR-037), J4-17 closed MOOT | accepted | -| BDR-056 | 2026-07-07 | job6: deps policy = latest gated by integration, not KEEP-PINNED by default | accepted | -| BDR-057 | 2026-07-07 | job7: secrets by reference not by value; redact at capture, not just at rest | accepted | -| BDR-058 | 2026-07-07 | job8: darwin-skill reinstall full pinned tree, detached HEAD (skills CLI single-file-fetch gap) | accepted | -| BDR-059 | 2026-07-07 | job8: explicit ask-gate for all 4 magic MCP tools, empty allow stays empty | accepted | -| BDR-060 | 2026-07-08 | job9: CC orchestration floor = v2.1.172 (nested dispatch), supersedes implicit v2.1.83 whole-system floor | accepted | -| BDR-061 | 2026-07-08 | job9: seo/geo analyzers → fix-bundle→L1 by doctrine (validator-analyzer pattern), not by version constraint | accepted | -| BDR-062 | 2026-07-08 | supersede BDR-031's 275 CLAUDE.md target — 305 assumed reality (extraction done at job1; more compression costs clarity > tokens); guard threshold realigned 280→320 | accepted | -| BDR-063 | 2026-07-10 | GSC multi-account: OAuth2 installed-app flow + label-keyed token store, explicit (account,property) args, no global state | accepted | -| BDR-064 | 2026-07-14 | global memory split: repo file → CLAUDE.global.md (deployed name unchanged), CLAUDE.md freed for project scope; consumer/maintainer wording rule | accepted | -| BDR-065 | 2026-07-14 | transient planning artifacts (superpowers spec/plan): committed during run, deleted post-merge; git history = archive; codified in project CLAUDE.md | accepted | -| BDR-066 | 2026-07-15 | Model routing: reflection inline (session big model) + sonnet-pinned executors + blocking gate | accepted | -| BDR-067 | 2026-07-16 | first public release: versioning reset to v1.0.0 (override "never restart at v1.0.0") — 2026-07-16 | SHIPPED | -| BDR-068 | 2026-07-16 | /capitalize + /close auto-persist memory (finish→develop + push); scoped LRN-069 exception — 2026-07-16 | implemented on feature/close-auto-persist | -| BDR-069 | 2026-07-16 | permissions deny: keep broad `.env.*` glob, keep `.env.example` name (option A) — 2026-07-16 | implemented on chore/fix-inert-write-deny-rules | -| BDR-070 | 2026-07-17 | claude-seo: cherry-pick scripts into our tree, never install; /seo stays sole entry | accepted | -| BDR-071 | 2026-07-17 | No viable free backlink source → Off-page axis stays brand-mentions-only (FINAL, not placeholder) | accepted | -| BDR-072 | 2026-07-17 | SPA: honest refuse (On-page N/A, not zero), no headless browser (R2 over R1) | accepted | -| BDR-073 | 2026-07-17 | Scoring: LLM judges findings+severity, engine does the arithmetic (deterministic /20) | accepted | -| BDR-074 | 2026-07-17 | Remove config-protection edit-block guardrail | accepted | -| BDR-075 | 2026-07-17 | Framework-wide 3-way adversarial plan-challenge phase | accepted | -| BDR-076 | 2026-07-19 | Dispatched judgment agents pinned OPUS; session model = orchestration + inline reflection ONLY | accepted | -| BDR-077 | 2026-07-19 | Model-tiering v2: 4-tier explicit routing, mode-based splits, no-inherit dispatches | accepted | -| BDR-078 | 2026-07-20 | ctx7 coverage: central fast-libs list + once-per-session reminder hook; every code path covered | accepted | -| BDR-079 | 2026-07-20 | profile `set` symmetric on managed externals + MCPs | accepted | -| BDR-080 | 2026-07-21 | Bug routing inverted: /bugfix primary, /investigate explicit-only | accepted | -| BDR-081 | 2026-07-30 | Config recalibrated for Claude 5 family (Opus 5 dispatch tier) | accepted | -| BDR-082 | 2026-08-02 | seo/geo analyzers de-prescribed for Opus 5 (C1) | accepted | -| BDR-083 | 2026-08-24 | Contract gates: deterministic floor (GATE 0) under the fresh verifier | accepted | -| BDR-084 | 2026-08-24 | /tour multi-project: parallel runners (LRN-083 derogation, bounded), runner inherits session model | accepted | -| BDR-085 | 2026-08-25 | User permanent rules: writing-style always-on in rules/, web build+security path-scoped | accepted | -| BDR-086 | 2026-08-26 | darwin: threshold gates full loops; verified defects fixed regardless of unit score (paired-validated, batched checkpoint) | accepted | -| BDR-087 | 2026-09-03 | Stop hook = attention signal only, never control flow; one script for Notification + Stop | accepted | -| BDR-088 | 2026-09-15 | gstack Playwright bump shared via lib, re-applied after submodule update; update helper never touches the submodule tree | accepted | -| BDR-089 | 2026-09-15 | No Playwright browser-cache pruner; read-only doctor report — .links proved 0 bytes reclaimable | accepted | -| BDR-090 | 2026-09-15 | Destructive shell work → autoMode soft_deny/hard_deny; `ask` tier abandoned (inert under auto) | accepted | -| BDR-091 | 2026-09-16 | Ask, don't guess: open-choice sweep (3 classes) at plan step + mid-run CLASS channel supersede "one question upfront" | accepted | -| BDR-092 | 2026-09-16 | docker + node framed by the classifier via autoMode.allow + soft_deny; ask entries retired | accepted | -| BDR-093 | 2026-09-22 | 21st.dev: magic MCP → CLI + skill pack; staged install past the ~/.claude/skills symlink; CLI = gate's required-manual | accepted | -| BDR-094 | 2026-09-22 | impeccable: global-scope install through the repo symlinks, pin + @latest fallback, output-read failure check | accepted | -| BDR-095 | 2026-09-22 | Data-loss guardrails: static deny for transfer/destructive tools, push every commit, brief ≠ user authority | accepted | -| BDR-096 | 2026-09-24 | Branch deletion guard: lib-only delete after verified merge, main/develop undeletable at the ref layer | accepted | -| BDR-097 | 2026-09-24 | graphify from 200 tracked code files: the banner informs, the user decides | accepted | -| BDR-098 | 2026-09-24 | CLAUDE.global.md density pass 352 → 270: compression only, three name-obvious routing lines dropped | accepted | -| BDR-099 | 2026-09-24 | C2 coherence: 30 doctrine/skill tensions resolved, doctrine wins, BDR-068 kept as the written exception | accepted | -| BDR-100 | 2026-09-24 | Guardrail evasion and partial rule changes get mechanisms, not lessons: refusal ends the attempt, citers census in make test | accepted | -| BDR-101 | 2026-09-25 | `full` = default profile: no selection ⇒ full in force, `reset` applies it, install applies it | accepted | -| BDR-102 | 2026-09-27 | agent-skills: no plugin, vendor 3 skills + build floor-guard + routing census + rest-api rule | accepted | -| BDR-103 | 2026-09-27 | 6-repo review: 5 verdicts, 3 criteria (grep-verified coverage, per-session cost, doctrine conflict); stars decided nothing | accepted | -| BDR-104 | 2026-09-28 | MengTo motion pack: vendor 5 scroll skills pinned via shared lib/vendor-skills.sh + build personal skill site-motion; 17 skipped | accepted | -| BDR-105 | 2026-09-28 | skill-catalog prune: 9 gstack out via GSTACK_REMOVED, full ⊇ every profile, max = everything, brightdata + frontend-design plugin off, security-guidance Stop review off, design gate asks `21st login` and waits | accepted | -| BDR-106 | 2026-09-28 | superpowers: 7 wired skills vendored at v6.4.1 via lib/vendor-skills.sh (always_on lock class), plugin + marketplace dropped, citers by bare name, doctrine map for the 4 non-vendored refs | accepted | -| BDR-107 | 2026-09-28 | Effort tiering: session high, effort pins on 20 agents (BDR-077 second axis), entry level on 30 skills, five paired shifter skills, max at loop caps + ship-feature 4b | accepted | -| BDR-108 | 2026-09-29 | Effort round: level on every skill next to its model pin (3 repo + 25 vendored via `lib/effort-pins.txt` re-applied after the LAST vendoring step of install + resync), design stack ONE level (high), model pins stay tier aliases: quality/price trade-off = tier × effort, never version | accepted | -| BDR-109 | 2026-09-30 | Higgsfield pack: npm CLI `latest` + 8 upstream skills git-cloned into gitignored `skills-external/higgsfield-*`, OFF by default, in no profile; two toggles (`higgsfield` = allowlist of 7 media skills, `higgsfield-websites` = landing-page aid, never website create/deploy/publish); CLI presence by probe; routing on explicit ask | accepted | -| BDR-110 | 2026-10-06 | Shell portability doctrine: native userland on macOS AND Linux, no Homebrew GNU tools on PATH; `lib/tests/portability-census.test.sh` locks deterministic GNU-only idioms | accepted | - --- ## BDR-001 — Uniform --help helper via session-start hook (option C) @@ -588,13 +474,14 @@ rules: - **Caveats**: the symlink form (`skills/ -> skills-external/gstack/`) differs from what gstack `./setup` would create (real dir + symlinked SKILL.md) — fine here because `./setup` never populates `skills/` in this layout, so no mixed-form collision. Browse RUNTIME still needs the built binary + sandbox env ([[BDR-029]]) — on-demand makes the skill DISCOVERABLE, not the browser functional on an unsupported OS. The old "try: bash link.sh" message was wrong (link.sh never creates gstack skills) → replaced with submodule-aware messages. - **Alternatives rejected**: full gstack integration (make `./setup` install into `skills/`) — user picked option 1, too invasive/version-fragile; leave `full` broken with honest 1-line warning — worse UX; pre-symlink all gstack at install — violates OFF-by-default context policy. - **Reference**: `lib/profile.sh` `GSTACK_SRC` + `enable_skill` gstack branch. Verified: `set full` → 0 missing, 35 on-demand; `minimal`↔`full` cycle re-parks/restores; git clean (gstack symlinks gitignored, [[LRN-025]]). Linked to [[LRN-042]], [[LRN-022]], [[BDR-018]] (gstack on/off verb). +- **Status (2026-11-02)**: superseded by BDR-134 --- ## BDR-031 — global CLAUDE.md lightening = COMPRESSION, not path-scope / externalization - **Date**: 2026-06-25 -- **Status**: accepted +- **Status**: accepted; SUPERSEDED 2026-10-23 by [[BDR-125]] (conditional load now proven reliable + mod injection) - **Decision**: lighten the universal global CLAUDE.md (`~/.claude/CLAUDE.md`, loaded every session in every project) by COMPRESSION only — denser prose, drop name-obvious routing lines, trim decorative whitespace. NOT by path-scoping rules under `~/.claude/rules/`, NOT by externalizing sections to on-demand files. Result: 317 → 275 lines. - **Why**: user-level path-scoped rules (`paths:` frontmatter under `~/.claude/rules/`) do NOT load in CC 2.1.190 (#21858, [[BLK-009]]) — proven by probe. Conditional/scoped loading is therefore an unreliable lever for this user; compression is the only mechanism that actually cuts every-session token cost without depending on the broken feature. - **Caveats**: future GLOBAL memory must stay tiny — with conditional loading broken, anything global loads in EVERY project unconditionally; fold that constraint into the global-memory design once a backup exists. Caveman pass to ~250 was explicitly DECLINED: marginal ~25-line gain vs real risk (changes the nature of instructions-to-follow; no evidence caveman is followed better than prose; CLAUDE.md is the most-edited file → caveman = painful to re-read/amend). 275 readable > 250 caveman. @@ -683,14 +570,17 @@ rules: - **Reference**: read-phase analysis (no hook code ever written); wiring commit (capitalize STEP 5B) follows. Completes [[BDR-034]] rollout; applies [[BDR-033]] doctrine to REJECT (not all nudges — the determinism split is [[LRN-061]]). See [[LRN-061]], [[LRN-047]], [[LRN-049]], [[LRN-054]]. ## BDR-038 — deploy skill: per-project learning runbook, two-moment cold-resume +- **Date**: 2026-06-27 - **date**: 2026-06-27 - **status**: accepted - **decision**: New `/deploy` skill = per-project runbook in `.claude/deploy/`. 5 artifacts: `PROCEDURE.md` (runbook, in-place edits), `INCIDENTS.md` (`DEP-NNN` ledger, append-only), `STATE.json` (deploy oracle, committed), `PENDING.json` (cold-resume bridge, gitignored), `NEXT.sh` (instantiated checklist, gitignored, hand-run). Two-moment spine: BEFORE (delta-instantiate `NEXT.sh` + hand back) → user deploys OUT-OF-BAND → AFTER (react: MARK success or LEARN from failure). Cold cross-session resume via `PENDING.json` (disk = only memory across the gap). Learn = atomic patch+incident (one `deploy-commit.sh` call, both files). New helper `lib/deploy-commit.sh` (allowlist `.claude/deploy/`). Built via subagent-driven-development (4 tasks). - **why**: deployment memory that LEARNS (runbook patched in place per failure) beats a frozen runbook; disk-bridge so a resume survives session loss. - **alternatives**: tag-oracle (rejected — lightweight-tag date unreliable, rebase-fragile, [[LRN-063]]); separate append-only ERRORS log (rejected — git history of `PROCEDURE.md`+`INCIDENTS.md` suffices, no `resolved-by` field); `NEXT.sh`-as-bridge (rejected — ephemeral ≠ persistent → separate `PENDING.json`); reuse doc/memory-commit (rejected — neither can commit `.claude/deploy/`, [[LRN-064]]). - **reference**: `skills/deploy/SKILL.md`, `lib/deploy-commit.sh`, `templates/deploy/`; branch `feat/deploy-skill` (b210e8d..79741e3, kept un-merged); spec `docs/specs/2026-06-27-deploy-skill-design.md`, plan `docs/plans/2026-06-27-deploy-skill.md`. +- **Status (2026-10-28, upgrade)**: superseded by BDR-054 (NEXT.sh, hand-back) ## BDR-039 — Gitea branch protection = Option-1 owner-pushable, not require-PR +- **Date**: 2026-06-29 - **date**: 2026-06-29 - **status**: accepted - **decision**: Protect `main` + `develop` on every gitflow-migrated Gitea repo with **Option 1 (owner-pushable)**: `enable_push=true` + `enable_push_whitelist=true` + `push_whitelist_usernames=[owner]`. Blocks force-push, branch deletion, and pushes by non-owners — while letting the owner push their LOCAL gitflow merges directly. NOT require-PR / required-review. @@ -699,6 +589,7 @@ rules: - **reference**: `lib/gitflow-migrate.sh` `_protect()` (POST `/repos/{o}/{r}/branch_protections`, owner whitelist); applied to all 6 repos 2026-06-29 (journal). Hook backstop in `lib/gitflow.sh` (pre-commit); CLAUDE.md "Version control — gitflow (universal)". Pairs with [[LRN-069]] (the `git push` ASK gate at the tool-call layer). ## BDR-040 — doc-syncer MINOR-shape oracle: deterministic floor under LLM's MINOR call +- **Date**: 2026-06-29 - **date**: 2026-06-29 - **status**: accepted - **Problem**: doc-syncer AUTO MODE classifies drift NONE/MINOR/SIGNIFICANT by LLM judgment, no deterministic backstop. SIGNIFICANT mislabeled MINOR → silent auto-patch + auto-commit, skips the SIGNIFICANT gate (RISK-1). Follow-up [[BDR-036]] flagged. @@ -860,6 +751,7 @@ rules: - **Alternatives rejected**: `latest` (pipx house default, graphifyy-style) — fine for comfort tools, wrong for a blocking gate; `--config auto` — telemetry + non-determinism. - **Reference**: plugins.lock.json `semgrep` entry, install-plugins.sh STEP 7.5, update-all.sh step 6.2 — branch feature/semgrep-install `ccfecc9`. Conditions [[LRN-047]], [[LRN-085]]. Coverage caveat of the community rulesets: [[LRN-092]]. - **Addendum 2026-07-03** (lot 3, measured): rulesets = `p/security-audit` + `p/secrets` + **`p/owasp-top-ten`**. owasp-top-ten is REQUIRED not optional — measured on realistic Flask code, the 2-ruleset baseline missed SQL injection + path traversal ENTIRELY (0 findings); owasp's taint rules catch them. Severity map: secrets ERROR→CRITICAL, other ERROR→HIGH (block), WARNING/INFO→reported. Blocking threshold = ERROR (per-RULE, not per-vuln — same class can straddle ERROR/WARNING; blocking WARNING too floods FP). FP measured shell/md only (faunosteo, game: sole added blocking ERROR = Dockerfile `missing-user` hygiene, contained by gate-mode diff-scoping). **Re-evaluate owasp FP at the first real web/python app project** (shell/md repos don't represent where the gate runs). See [[LRN-094]], agents/security-auditor.md branch feature/security-auditor `2b297bd`. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-049 — Verifier doctrine: fresh + blind + disk-contract + proof-or-fail @@ -868,6 +760,7 @@ rules: - **Rationale**: dev self-score is always confident → not a gate. Verifier fed history anchors on prior verdicts → telescopic drift. Context-only contract dies at compaction, the verbatim with it. - **Alternatives rejected**: dev self-assessment as gate; cumulative verifier context ("cheaper" but anchored); gitignored run files (lose escalation reference + session-death survival). - **Reference**: lib/contract-interview.md + agents/verifier.md + lib/tests/contract-verifier.test.sh (31 locks) — branch feature/contract-verifier `6aed5ee`. Behavioral GREEN: planted-gap → ECARTS(2) exact; conform-under-injected-history → CONFORME (blindness held). Twin of [[BDR-048]] (security gate). Conditions [[LRN-048]], [[LRN-083]]. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-050 — Universal verify+secure pipeline, weighted per flow (loops in the main loop) @@ -876,6 +769,7 @@ rules: - **Rationale**: the value is the INDEPENDENCE of the gate (fresh subagent vs a rich contract), NOT delegating the dev — so dev stays inline in light flows and weighting lives on loops+questions, never on skipping a gate. hotfix reverts because a 3× loop would reintroduce the weight its identity excludes. - **Alternatives rejected**: dispatch the dev too (turns feat into ship-feature-bis); one merged "quality" gate (see [[LRN-095]] — orthogonal gates degrade if fused); hotfix loops like feat (breaks its 1-attempt identity). - **Reference**: lib/verify-secure-loop.md + wired feater/bugfixer/hotfixer + lib/tests/loops-light.test.sh (27 locks) — feature/verify-loops `0f0162d`. Behavioral GREEN (feat fixture): CONFORME→BLOCK(1) SQLi→fix→re-verify CONFORME→re-scan PASS, order invariant held. Builds on [[BDR-048]] [[BDR-049]]. Conditions [[LRN-083]] [[LRN-095]]. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-051 — Contract enrich-at-gate: the contract grows only at a human micro-gate - **Date**: 2026-07-04 @@ -883,6 +777,7 @@ rules: - **Rationale**: raw request underspecifies (one-line "add validation" hides the schema-rejection requirement the design surfaces); verifier judging only the seed → every design decision unverified. Gating the growth keeps the contract honest (no silent scope creep) AND complete (design criteria are verified). Only flow where the contract is mutable mid-run — bounded to gate moments. - **Alternatives rejected**: freeze contract at creation (design criteria unverified — seed too thin); let dev enrich ([[BDR-049]] failure mode — dev justifies everything, scope constrains nothing); second contract per design (loses single-reference property). - **Reference**: ship-feature STEP 0e+3, init-project STEP 1+4, feature/verify-loops `1c69de2`. Behavioral GREEN: a `[gated 2026-07-04]` design criterion (reject unknown config keys) was read + judged NOT-MET by a fresh verifier across 3 rounds (dogfood). Builds on [[BDR-049]] [[BDR-050]]. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-052 — /tour auto mode: branch-as-gate, declared state read-only @@ -891,6 +786,7 @@ rules: - **Rationale**: mid-run gates defeat the skill's point (hands-off grouped sweep, user away). Auto-checking TODO reproduces the exact lie /reconcile catches — RED-proven, baseline did it. Branch+report = same approval semantics as audit-delta's 3c gate, moved after the fact where a headless run can afford it. - **Alternatives rejected**: per-phase AskUserQuestion gates (audit-delta model — blocks headless); one consolidated pre-fix gate (still blocks); auto-edit TODO on oracle proof (inference ≠ approval); plain-branch fallback on non-gitflow repos (violates lib-only doctrine → report-only instead). - **Reference**: skills/tour/SKILL.md + CLAUDE.md routing (feature/tour-skill `73e6a1c`). TDD trail [[LRN-099]] [[LRN-100]] [[EVAL-014]]. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-053 — ctx7 single surface: keep find-docs skill, kill context7.md rule @@ -899,6 +795,7 @@ rules: - **Rationale**: rule = ~490 tok/session session-start duplicate of the skill (job1 F10 + job2); skill self-suffices (876-char description carries the triggers, body has full CLI flow). Purge-in-installer beats one-shot rm: survives re-runs + manual `ctx7 setup`. - **Alternatives rejected**: kill skill keep rule (rule always-on, costs every session even non-lib work; skill lazy — wrong direction); hand-trim generated files (fight the generator, LRN-039 class); hand-edit lock hash (algo undocumented). - **Reference**: chore/ctx7-single-surface; job1 F10, job2 F8/F13. User decision 2026-07-06. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-054 — supersede BDR-038: NEXT.sh file + AskUserQuestion hand-back removed from /deploy @@ -1065,12 +962,14 @@ rules: - **Alternatives rejected**: (plugin install) → both `/seo` coexist namespaced → non-deterministic dispatch, silently loses our FR-legal axis on an unpredictable fraction of runs. (install nothing) → forgoes render_page/url_safety/unlighthouse we lack. - **Verdict on parity**: their README lies (dual JSON-LD validator = 2 hyperlinks, zero `.py` calls; "zero-network"/"fully offline" false). Our system is more honest; we keep FR-legal (their whole repo: 2 hits), fix-bundle+ownership, trajectory-17/20, NAP anti-seed. - **Files**: none installed. Findings drove the whole seo-geo-integrity branch (21 commits). +- **Status (2026-10-28, upgrade)**: accepted ## BDR-071 — no viable free backlink source: Off-page axis stays brand-mentions-only — 2026-07-17 - **Decision**: I1's narrowed Off-page axis (brand mentions from STEP 6 only, backlinks+authority declared §14-unauditable) is the FINAL state, not a placeholder awaiting data. - **Why**: measured, not assumed. GSC has no links endpoint (API = Search Analytics/Sitemaps/Sites/URL-Inspection only; links report UI-only). Common Crawl hyperlinkgraph domain-edges = **17.3 GB gzipped** (+879MB vertices, +2.3GB ranks), HEAD-measured live. Scanning it per-audit is non-viable + abusive to a nonprofit. The reference impl (claude-seo commoncrawl_graph.py:169) caps download at 500 MiB = **2.9% of edges**, sorted by source ID → arbitrary slice reported as a backlink profile, "70/100 health". A random sample dressed as a measurement — the exact failure class the branch removes. - **Consequence**: B1/B2/B3 all killed. Weight (10-15%) unchanged — re-deriving for an axis that won't widen churns historical scores for nothing. - **Only free viable source**: Bing GetUrlLinks — first-party only (never a competitor), blocked on client's Bing account → raises W2's value ([[BLK-017]]), does not unblock it. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-072 — SPA: honest refuse, no headless browser (R2 chosen over R1) — 2026-07-17 - **Decision**: rendercheck verdict `client-rendered` → On-page axis N/A, excluded from weighted global, NEVER scored zero. No Playwright, no Chromium. User-arbitrated. @@ -1078,12 +977,14 @@ rules: - **GEO angle (sharper)**: AI crawlers (GPTBot/PerplexityBot/ClaudeBot) are WORSE at JS than Googlebot — fetch HTML, largely don't execute. A client-rendered site is near-invisible to the engines the audit serves → §0 alert + SSR/SSG top user action, aligns CLAUDE.global "public sites never SPA". - **Alternatives rejected**: R1 Playwright (~300MB Chromium, breaks bash+curl purity) — user chose refusal. Refusing IS the finding. - **Files**: lib/seo-data/render_check.py, seo/geo STEP-5 gates (20d3082). +- **Status (2026-10-28, upgrade)**: accepted ## BDR-073 — deterministic scoring: split LLM judgement from arithmetic — 2026-07-17 - **Decision**: LLM emits WHICH findings + severity (irreducible judgement); engine computes the /20. Reuses /harden's scale (-15/-8/-3/-1, clamp, /5 into /20) → one vocabulary across the family. - **Why**: /harden had a real scale (SKILL.md:435), /seo had NONE → every axis felt → two runs over identical code diverged, while /client-handover gates on 17/20. H2 sharpened it: once drift reports real change, a self-moving score is visibly noise. Same principle as engine-side cannibalisation grouping — never hand a model 1000 rows to add. - **Makes computable (was prose)**: "N/A is not a zero" (R2 on-page, I1 off-page) → axis excluded + weights renormalised, verified all-20 with 2 N/A → global 20.0. Prevalence: affected/sampled shift severity ONE step (≥50% escalate, single de-escalate). - **Files**: lib/seo-data/score.py (4818c61). +- **Status (2026-10-28, upgrade)**: accepted ## BDR-074 — Remove config-protection edit-block guardrail [accepted] (2026-07-17) Deleted hooks/config-protection.sh + its settings.json PreToolUse registration + lib/tests/config-protection.test.sh. Hook blocked model Edit/Write on quality-gate files (settings.json, gitflow.sh, .githooks, doctor.sh, hooks, lib/tests, lint) via one-shot .claude/.config-edit-ok sentinel. Removed per user req — friction editing own config > guardrail value; user = human operator. Residual: gitflow pre-commit guard + Gitea branch protection still block direct code commits main/develop; only edit-time block gone. Alts rejected: warn-only (exit0+log), targeted relaxation. Supersedes any prior config-protection decision. @@ -1145,6 +1046,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Why**: leaving a verified destructive path (hotfix `git restore .` wiping tolerated user edits, file scored 85) unfixed = score-worship; rubric serves quality, not the inverse. - **Alternatives rejected**: strict threshold (ships known bugs); optimize-everything (cost, HL-4 diminishing returns). - **Reference**: run 2026-08-26, commits 6eceedb..6eac7fb, `.claude/audits/DARWIN-2026-08-26.md`. +- **Status (2026-10-28, upgrade)**: accepted ## BDR-087 — Stop hook = attention signal only, never control flow - **Date**: 2026-09-03 @@ -1254,6 +1156,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Alternatives rejected**: path-scope Design work / Web sections into `rules/` (BDR-031 principle; the design hook needs the section in context regardless of file type); caveman doctrine (BDR-031: instructions-to-follow must stay prose); raise the 320 guard again (BDR-062 already moved it once; a guard that follows the file is not a guard). - **Status**: accepted, on chore/claude-global-density, UNMERGED (human gate). make test unchanged (2 pre-existing T16a), banner density warning gone, doctor 0 errors. - **Reference**: `CLAUDE.global.md`, `hooks/session-start.sh` (320 guard), `hooks/design-toolchain-reminder.sh` (heading match). Links [[BDR-031]], [[BDR-062]], [[BDR-085]]. +- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Design work path-scoped in rules/web-building.md, hook = Read pointer ## BDR-099 — C2 coherence: 30 doctrine/skill tensions resolved, doctrine wins, BDR-068 kept as the written exception - **Date**: 2026-09-24 @@ -1343,6 +1246,7 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Caveats**: shifts inert headless; a prose gate ending the turn resets to session level (re-assert wired in bugfix and ship-feature 4b); mode-based agents pin their judgment mode; a shift paired with a built-in judgment dispatch would downgrade it (pair with Read/Bash instead); `lib/gitflow-test.sh` T16a red on this machine = gitleaks not installed, unrelated. - **Refs**: spec `docs/superpowers/specs/2026-09-28-effort-tiering-design.md`, plan `docs/superpowers/plans/2026-09-28-effort-tiering.md`, [[LRN-179]], [[EVAL-035]], [[EVAL-036]], [[BDR-077]]. - **Correction (2026-09-28)**: EVAL-035 counted one record per content block (~2.8× on request counts); deduped figures in [[EVAL-037]]: main-loop thinking 99.9% of total thinking (was 96.6%), thinking 5.6% of weighted cost (was 8.4%), sonnet think/request 26→0.2 tok. Conclusions hold, sharper: main loop still carries almost all thinking, executors stay cheap. +- **Amendment (2026-10-25, bugfix 8e93507)**: "none on status-reporter (haiku)" superseded: status-reporter pins `effort: low` (its `mechanical` row); census `effort-routing.test.sh` no longer skips haiku agents. Reason: Haiku 5.5 takes effort. Links [[BLK-035]]. ## BDR-108 — Effort round: every skill carries a level next to its model pin; model pins stay tier aliases [accepted] (2026-09-29) - **Decision**: 3 repo skills pinned (skills-perso low, pdf-translate medium, site-motion high). 25 vendored externals (superpowers 7, agent-skills 3, design stack 9, 21st pack 6) get level from `lib/effort-pins.txt`, applied by `lib/effort-pins.sh` after LAST vendoring step of install-plugins.sh (21st pack, STEP 8.7) AND update-all.sh (§7.4). Design stack = ONE level, high. hotfix stays high. Model pins stay aliases (`sonnet` `opus` `haiku` `fable`). Doctrine: design stack loads paired with first Read; census order-locked by line number; `lib/effort-audit.py` prints thinking coverage. @@ -1364,3 +1268,289 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate). - **Alternatives rejected**: prepend coreutils/gnu-sed to PATH in Makefile+hooks; `grep X >/dev/null` (GNU grep treats /dev/null stdout like `-q`, race stays); broad `| grep -q` census (119 hits, fixtures, false confidence). - **Gates**: 3 lenses (FATAL 6 / CONCERNS 4 / FATAL 2) + confirmation CONCERNS(2), all closed r3; GATE 0 MET 8/8 ×2; verifier CONFORME 9/9; security PASS (1 MEDIUM hardened). Linux run `[deferred]`. - **Refs**: contract `.claude/tasks/contracts/2026-10-06-macos-portability-1105.md`, plan `.claude/tasks/plans/2026-10-06-macos-portability-1030.md`, commit 0efdff0 (bugfix/macos-portability), [[BLK-026]], [[LRN-189]], [[LRN-190]]. + +## BDR-111 — Manual-push mode = `gitflow.autopush false` end to end, no new key [accepted] (2026-10-06) +- **Decision**: user need (work machine): same flow, branches + commits + local merges, nothing pushed, push only by hand. Reuse existing human-set `gitflow.autopush` (static deny on `git config gitflow.*`), no `gitflow.mode`. Run A: lib `_gitflow_push_off` single reader for `start`/`finish`/`delete_remote`; `gitflow_delete` checks out CONTAINING base + `--unset-upstream` before `-d`; `_gitflow_sync_base` warns "behind origin, cannot fast-forward" instead of silent `|| true`; `unpushed-guard` silent at Stop, one `ℹ manual push mode:` SessionStart line counting ALL local branches; doctrine line CLAUDE.global.md. Run B (queued): PreToolUse `hooks/push-guard.sh` denies `git push` when autopush=false (user: block, `! git push` only), widen `gitflow.*` deny (`git config * gitflow.*`, `git -c`, `GIT_CONFIG_COUNT=`), settings prose, banner, fail-CLOSED on unparseable value in every reader at once. Run C (queued): skills that push alone (`/capitalize` STEP 5C `git push origin develop`, client-handover, release-candidate/tour claims). ORDER: no autopush=false at work before B+C. +- **Why**: `autopush false` already silenced hooks + remote delete; lib push sites ignored it (bug). Merge is NOT the user's concern (local merge wanted), push is. Fail-open on invalid value kept in A for consistency with untouched hook emitters (AC7). +- **Alternatives rejected**: new `gitflow.mode auto|manual` (duplicates autopush); tty-only lock on `finish` (user wants local merges); `-D` after ancestor gate (statically denied form, reviewers' red flag); fail-closed in lib only (hooks would still push → inconsistent). +- **Gates**: 3 lenses CONCERNS(1/2/2) + confirmation FATAL(4) → r2 fixes (T22j containing base, `-u` fixture, T18n before T18l); feater ×2; GATE 0 7/8 (AC6 = env red); verifier ECARTS(1) = AC6 only; security PASS ×2 (1 MEDIUM fail-open → run B). +- **Refs**: contract `.claude/tasks/contracts/2026-10-06-manual-push-mode-1632.md`, plan `.claude/tasks/plans/2026-10-06-manual-push-mode-1632.md`, commit 2fc8830 (feature/manual-push-mode, UNMERGED). Extends [[BDR-095]] (c); [[LRN-161]], [[LRN-191]], [[LRN-192]], [[LRN-193]], [[BLK-022]]. + +## BDR-112 — push-guard: text-only PreToolUse deny of Claude's `git push` in manual-push mode, fail closed [accepted] (2026-10-07) +- **Decision**: run B of [[BDR-111]]. `hooks/push-guard.sh` (own PreToolUse group `Bash|Monitor`, timeout 10) reads `tool_input.command` + `cwd`; folds `\`-newline in bash (BSD sed unsafe, [[LRN-195]]); three ERE matches on `/usr/bin/grep`: STRICT (git + `-opt [arg]`* + push|send-pack, boundaries `[^[:alnum:]_.-]` / `[^[:alnum:]_-]`), LOOSE on quote-stripped text (any later ` push` word in the same simple command), ALIAS (`alias.x=…push`). Candidate dirs = cwd + literal `-C`/`cd`/`pushd` tokens (quotes stripped, never eval/expand), dedup `sort -u`, >20 distinct → deny before any fork. Mode per dir via `git config --bool gitflow.autopush` rc: 0 → value, 1 → auto, else → deny; NO work-tree gate (global key = work-machine deployment). Deny = JSON `permissionDecision=deny` exit 0, reason carries `! `; EXIT trap emits static deny + `exit 0` once a push is detected and nothing decided; jq missing → stderr + allow (sibling policy). User gated: fail-closed cases (cap, unenterable dir, git failure) fire in auto mode too. settings.json: 18 deny entries on WRITE forms of `gitflow.*` (any `git … config` spelling, remove/rename-section, `-c`, config env overrides, Edit/Write of git config files); soft_deny "pushing in manual-push mode, any form, no per-turn clearance"; routing-around hard_deny names hook refusals; banner `🔒 push : manual (autopush=false) — ! git push` (`%-46s`, bytes). +- **Why**: `ask` inert under auto ([[LRN-155]]); `hooks/guard-bash.sh` withheld ([[BLK-022]]) → one narrow rule instead. Trailing ` *` glob matches end-of-string ([[LRN-194]]) → no infix rule spares the bare read → Claude loses `git config … gitflow.autopush`; hooks/lib keep it; run C gets `gitflow.sh push-mode`. Text-only guard cannot see scripts/aliases → soft_deny is the declared backstop. +- **Alternatives rejected**: no-jq fallback (greps whole payload, denies in auto, untestable without shim; jq hard dep); `-C` dir unresolvable → allow (fail-open; now skipped, cwd still checked); `rev-parse` work-tree gate (drops the global key); `--default true` read (hides git failure); narrowing deny to spare the read (impossible with end-matching globs). +- **Gates**: 3 lenses CONCERNS(2)/CONCERNS(5)/FATAL(7) + confirmation FATAL(8) → r2 (BSD sed, oracle naming denied tokens, read loss); feater ×3 (58 → 61 → 71 checks); GATE 0 MET ×3; verifier CONFORME, then ECARTS(1) on hardening closed by gated clarification; security PASS ×2 (3 MEDIUM closed: 20k-token flood denied in 0.15 s, git absent → deny, `bash -c 'cd … && git push'` extracted; residuals → run D). +- **Refs**: contract `.claude/tasks/contracts/2026-10-07-manual-push-guard-1003.md`, plan `.claude/tasks/plans/2026-10-07-manual-push-guard-1003.md`, commits a2ac018 + 6468eda (feature/manual-push-mode, UNMERGED). Links [[BDR-095]], [[BDR-100]], [[LRN-069]], [[LRN-196]]. +- **Amendment 2026-10-07**: user probe done on their machine (`autopush=false` repo): no auto push, the bang-prefixed dry-run passes → `!` commands bypass the PreToolUse guard, design confirmed. Dotfiles installer will prompt for the key (default false) and carry `core.hooksPath` in the gitconfig template. + +## BDR-113 — Skills never push; truth from `rev-list` facts, mode verb only words the reason [accepted] (2026-10-07) +- **Decision**: run C of [[BDR-111]]. New lib verb `gitflow.sh push-mode` (stdout `auto|manual|invalid`, rc 0, raw value on stderr, printable ≤64 chars; ignores GITFLOW_NO_PUSH) = the one reader skills may call (bare `git config … gitflow.*` denied, [[BDR-112]]). Skills push NOTHING on their own except the release tag in auto mode on explicit go. Every "on origin / not pushed" line comes from `git rev-list --count origin/
..
` (or `
--not --remotes=origin` for the tour) read AFTER the action, in its own Bash call; the verb only words the reason (manual vs push FAILED vs invalid). Removed as redundant since BDR-095: `/close` STEP 5C `git push origin develop` (finish pushes develop itself, mode-aware since run A) and `/client-handover`'s "Push to origin now?" question + push block (hooks had pushed; push-guard denies in manual). User hints are complete `! git …` commands (`-u`, `--atomic origin main develop vX`, `-C `), branch name allowlisted `^[A-Za-z0-9._/][A-Za-z0-9._/-]*$` before any interpolation. `/release-candidate` manual/invalid or any count ≠ 0 → one user command, STOP, no question; tag gate kept for auto with both counts 0. `/tour`: one `-C` fact per project after the report commit, suffix-aware branch name, summary row `on origin | local only → cmd`. +- **Why**: a shell gate `[ "$mode" = auto ] && git push …` is denied WHOLE by the text-only push-guard and `$mode` dies between Bash calls ([[LRN-199]]); the push it gated was redundant anyway ([[LRN-197]]); invalid value: lib/hooks still push (fail-open until run D) so "not pushed" from the mode word would lie — the count tells the truth. +- **Alternatives rejected**: gate the existing push on the verb (denied/stateless); keep the GO question (gated nothing); word invalid as manual (false in the lib); per-skill `git config` read (denied). +- **Gates**: C1: 3 lenses (1 BLOCKER: shell gate) + confirm CONCERNS(3); feater; GATE 0 MET; verifier CONFORME; security PASS. C2: 3 lenses (BLOCKER: deploy brief said "push done") + confirm CONCERNS(4); feater; verifier CONFORME; security BLOCK(1) branch-name injection ([[LRN-198]]) → fixed → CONFORME + PASS. Polish pass: CONFORME + PASS. +- **Refs**: contracts `.claude/tasks/contracts/2026-10-07-manual-push-skills-c1-1304.md`, `…-c2-1325.md`; plans same slugs; commits 5cf049d, 6104545, 3881f46 (feature/manual-push-mode, UNMERGED). Links [[BDR-068]], [[BDR-095]], [[BDR-042]], [[LRN-069]]. + +## BDR-114 — Every `gitflow.autopush` reader fails closed and names the stop; the lib verb is the single reader [accepted] (2026-10-07) +- **Decision**: run D of [[BDR-111]]. Rule for every reader: unset or `true` → auto (push); `false` → manual (no push, silent); anything else (unparseable value, corrupt config, git failure) → NO push and one named line. Readers: lib `_gitflow_push_off` = `[ "$(gitflow_push_mode)" != auto ]` (verb stderr passes through); emitted post-commit/post-merge hooks (standalone POSIX sh, mirror of the verb: `case "$rc:$v" in 0:true|1:*) ;; 0:false) exit 0 ;; *) echo "… NOT pushed, treated as manual push mode" >&2; exit 0 ;; esac`); unpushed-guard, session-start banner (`autopush bad` lock line) and push-guard (sources the lib once, `gitflow_push_mode` per candidate) all read the verb. push-guard residuals: whole-word dir tokens (mixed quoting → deny; fully quoted + inner other-quote and `\ ` escapes resolved), payload jq cannot parse → raw scan with JSON escapes folded → static deny, cap BEFORE any per-token fork, T42 base = main. Skill prose: invalid outcome split on the ahead count (0 → "pushed anyway, likely a stale fail-open hook or a manual push"), labels COMMIT + PUSH STATE READ, release-executor version format check by reading. Doctrine: invalid = manual; "never pushes, even when asked". +- **Why**: `--bool --default true` covers a MISSING key only; a typo re-enabled every push silently (the 21-09 hazard class on a work machine). The user chose fail-closed for the guard in run B; D extends it everywhere and keeps a terminal signal (git's own "fatal: bad boolean" used to be the only one; the hooks now print theirs). +- **Alternatives rejected**: regen via `install-hook` (writes a LOCAL hooks-path entry) or `global-hooks` (writes the GLOBAL config when the value is missing — it was, [[LRN-200]]) → `emit-hook > file` only; temp file for the verb's stderr in a hook (fail-open on a full TMPDIR, predictable path) → `2>&1` capture ([[LRN-202]]); classification before the token cap (13 s flood) → cap first ([[LRN-201]]); shell check of the release version string (interpolation sink) → by reading. +- **Gates**: D1 3 lenses + confirm FATAL(1) (global-config write) → emit-hook; feater; GATE 0 MET; verifier CONFORME; security PASS. D2 3 lenses + confirm FATAL(3) (escape alternative, same-quote-inside, `bare=$one` when unparsed); feater; GATE 0 MET; verifier CONFORME; security BLOCK(1) cap-after-fork → fixed (20k tokens 0.13 s) → CONFORME + PASS. D3 3 lenses + confirm CONCERNS(3); feater; CONFORME + PASS. +- **Refs**: contracts/plans `2026-10-07-manual-push-failclosed-d1-1522`, `…-guard-residuals-d2-1526`, `…-prose-d3-1530`; commits 472cccb, 3c59333, 64ca0f8 (feature/manual-push-mode, UNMERGED). Supersedes the "fail-open on invalid value" line of [[BDR-111]]. Links [[BDR-112]], [[BDR-113]], [[LRN-114]], [[LRN-196]]. Residuals: TODO "post-run-D residuals" (soft_deny names only `false`; stale `.githooks/` in onboarded repos until reconcile). + +## BDR-115 — model-router mod: pin = entry default, sub-tasks route finer; one writer per axis; full ids; built-ins-only table until pins go [accepted] (2026-10-08) +- **Decision**: one function-hooks mod (`mods/model-router/`) routes model + effort per request. Rules: (1) a skill/agent pin = DEFAULT route of the run, never ceiling/floor; inside the run every sub-task routes to its phase, declared (`route` tool, `/route`, `ultrathink`) or derived (skill load, agent dispatch). (2) ONE writer per axis: `Skill(effort-*)` answered by the mod WITHOUT loading the skill (no pairing rule, no doublon); every write lands on the CALLING loop; explicit Agent params frozen per loop for the whole run; agent model written once at spawn. (3) hooks write FULL ids from `config.models` ([[LRN-203]]). (4) wave 1 agents table = built-ins only (Explore sonnet/medium, Plan opus/xhigh); repo agents keep frontmatter as single writer until wave 2 moves pins into the table and deletes frontmatter + shifters + effort-pins + model-gate. (5) precedence: user `/route` sticky > latest turn route (one slot, last writer wins; non-effort skill load resets it except a prompt rule) > session. (6) main-loop model switch behind `mainModelSwitch` (default off) + context-window guard ([[LRN-204]]). (7) state in `register` closure, defaults cloned, `/route off` kill switch, config validated before merge. Load: `CLAUDE_CODE_PLUGIN_DIRS` in settings env via link.sh (wave 1-B). +- **Why**: user 2026-10-08: existing pins + `effort-*` shifters built for this goal with older tools; some pins forced (one level for a skill doing many things). Mods expose `turn.step` model/effort rewrite + `agent.spawn` + `tool.call` answers = cleaner, unified, automatic, works headless too (BDR-107 gap). +- **Alternatives rejected**: agents table copying the 21 frontmatter pins in wave 1 (third source of truth, silent override of a frontmatter edit); `scope: agents` / `/route agents` bulk lever (no requirement, sixth precedence tier); `model` param on the model-facing tool (typo → LRN-203 404 class); per-step agent model rewrite (fights engine fallback, beat explicit params); `userConfig` (one config file instead); marketplace install (live symlink repo model); `source`-dependent skill-load reset (kept stale shifts). +- **Gates**: plan r1 → r3 through 3 challengers + 1 confirmation (2 BLOCKER + 10 MAJOR closed, [[EVAL-040]]); feater DONE first pass; GATE 0 MET; verifier CONFORME 6/6; security PASS + hardening round (criteria 7-11). +- **Refs**: plan `.claude/tasks/plans/2026-10-08-model-router-mod.md`, contract `.claude/tasks/contracts/2026-10-08-model-router-w1a-1533.md`, [[BDR-107]], [[BDR-108]], [[BLK-029]], [[LRN-205]], [[LRN-206]]. +- **Amendment (2026-10-09, user decisions 2026-10-08 evening)**: (a) LOAD supersedes the "Load:" line: tracked relative symlink `skills/model-router` → `../mods/model-router`, loaded in place as `model-router@skills-dir` wherever link.sh links `~/.claude/skills`; `CLAUDE_CODE_PLUGIN_DIRS` dropped (absolute path, settings `env` has no `$HOME` expansion, settings.json tracked), local marketplace dropped (`add` writes an absolute path into settings.json). Proven by fresh-process `claude plugin list --json`. (b) PRECEDENCE amended: `ultrathink` and a typed `/effort-` are the main turn's DEFAULT and MINIMUM (floor slot `turnFloor`): sticky `/route` effort > turn route effort > floor > engine, then floored; per axis; mid-turn prompt floors the running turn and the next (`wait` ignored). Rationale: user "un choix explicite bat la phase déduite"; a pure floor made `/effort-low` a no-op (challenge finding). (c) Per-machine kill switch `"enabled": false` in the untracked `~/.claude/model-router.json` (survives `/clear`, a failed reload keeps the previous config); `enabledPlugins` would dirty the tracked settings.json on every machine. (d) Hardening: `/route` composer-only; agent loops effort-only (model fixed at spawn); config caps; typed slash attested at `prompt.submit`. Commits 346d6ae, 1ff608a, 6430ac6; contracts `2026-10-08-model-router-floor-1835`, `2026-10-08-model-router-wiring-1835`; residuals parked in TODO. +- **Amendment 2 (2026-10-10, wave 2 closed, commits bb56f3e + 1f2d33b)**: (a) rule 4 closed: rows for every repo skill (56) + agent (21) + Explore/Plan, PHASES by role (plan/reflect/orchestrate/escalate best · judge big · implement/write/verify/explore/apply work · mechanical cheap; `write` work/high + `apply` work/low added). User: pins "deleted or reworked", not copied → rows are the live source, tracked `model:`/`effort:` frontmatter KEPT as off-state floor, census-locked equal to rows (`lib/tests/effort-routing.test.sh`). Robustness BLOCKER closed: mod off → agents would inherit parent model. (b) Rule 5 amended: unrowed skill load changes nothing; best-tier skill row lives in `runMain` slot surviving turn end (precedence userMain > turnMain > runMain > floor > engine), dropped by `/route clear`, `/route off`, user `/model`, typed non-best skill; turn writers (route tool, prompt rules) never touch it. (c) Agents: model written at spawn WITHIN tier, upward only (never below frontmatter alias); explicit Agent params win; project-defined agent (agent.offer source projectSettings|localSettings) skipped. (d) Typed slash: name-bound marker at prompt.submit (composer|sdk|bridge) + pending slot + idle fallback (no live/spawning loop). (e) Shifters `effort-*`, `effort-pins.*`, `model-check.sh` DELETED; orchestrators call `mcp__model-router__route` per phase; gate witness = route answer id, remedy `/route on`; builtin `/effort` not a lever inside a run (levers `ultrathink`, `/route effort=max`). (f) SemVer: typed `/effort-*` removal = breaking → next release 3.0.0. Plan `.claude/tasks/plans/2026-10-09-model-router-w2-1546.md` r4, contracts `2026-10-09-model-router-w2a-1546`, `2026-10-10-model-router-w2b-1045`. Links [[LRN-210]], [[LRN-211]], [[EVAL-042]]. + +## BDR-116 — model-router first-use confirmation: tracked `routing.json` = source of phases, rows and decisions; engine dialog once per row/phase; project exceptions in user scope; model never writes [accepted] (2026-10-11) +- **Decision**: (1) `mods/model-router/routing.json` (tracked, reached from every project through the plugin dir `$.plugin.root` = the existing `~/.claude/skills/model-router` link) is the single source: 11 phases (full routes), 56 skill rows, 23 agent rows, `confirmed` (kind/name → phase), `changed` (from/to for an Everywhere change), `projects[]` exceptions, `ask`. `DEFAULT_CONFIG` keeps only the phases as fallback; rows `{}`. (2) First use of a rowed typed skill (T1), a rowed agent spawn with no explicit model (T2) or a main-loop phase declared via the route tool (T3) opens `$.ui.ask`: options Later / Keep / 2 alt phases (Other = phase name; T3 Later/Keep); a change asks Everywhere (row moved + `changed`) or This project only (`projects[key]`, confirmed = base row so no other project asks). Keep endorses the phase too. One dialog in flight; concurrent uses route unasked; headless/dismissed/garbage = Later; never inside a sub-agent; pre-ask re-read of the file (other sessions' decisions seen). (3) Project key = origin remote normalized (`new URL` host+path or strict scp regex; userinfo never read; any remaining `@`/`:`/empty host → no key); no `local:` path keys; no remote → Everywhere/Later only. The project tree's `.claude/model-router.json` is NEVER read (a cloned repo must not re-route the user's gate agents). (4) Writers = dialog answers + composer `/route ask on|off` only; serialized chain; output capped 64 KB; file never created; later unreadable → previous config kept (kill-switch rule); layers routing.json < `~/.claude/model-router.json` (its `ask` wins). (5) Census reads rows + phases from the file, locks DEFAULT phases == file, tolerates a drift only for a `changed` row whose frontmatter == `from` and row == `to` (WARN); Keep-only drift still FAILs. (6) `/route pending`, `/route ask on|off`; `set`/`confirm`/show suffix deferred. +- **Why**: user 2026-10-10: see in practice whether routing fits ("prompt qui demande de confirmer… mémoire de ce qu'on décide… met à jour la table… exception pour ce projet… persistant sur tous les projets, se redéploie comme le mod"). Tracked file = deploys with the mod via git; user-scope exceptions = security (robustness lens: project-tree layer let a cloned repo downgrade security-auditor to haiku). +- **Alternatives rejected**: `$.store` (machine-local, re-asks per machine); project file in the tree (security hole + writes into worktrees); shared-promise dedupe for parallel spawns (hook budget: awaiters time out); `confirmed` dates (git log dates them); dialog edits of phases (blast radius: a phase is shared by many rows); per-layer degrade after first load (one transient read failure wiped 79 rows + the kill switch); `local:` keys (home path in a tracked file). +- **Gates**: plan r1 → r4 (simplicity CONCERNS(3), correctness FATAL(8) with the census BLOCKER, robustness CONCERNS(8) after a network-killed first run, confirmation CONCERNS(6)); feater DONE + 4 rounds; GATE 0 MET; verifier ECARTS(3)/(2) → CONFORME, re-verify after security ECARTS(1) → fixtures; security BLOCK(1) real (password with `@`/`/` stored in the key) → fixed, PASS. Kit 86 → 190 tests. Live T2 dialogs answered by the user from the hot-loaded working-tree mod ([[LRN-212]]). +- **Refs**: contract `.claude/tasks/contracts/2026-10-10-model-router-w3a-confirm-1201.md`, plan `.claude/tasks/plans/2026-10-10-model-router-w3a-confirm-1201.md`, commit 22455c0, [[BDR-115]], [[LRN-210]], [[LRN-211]], [[EVAL-043]]. +- **Amendment (2026-10-11, wave 3-B, commit 604a6c4)**: clause (2) superseded: the dialog carries CONTEXT (skill description = first sentence of its SKILL.md frontmatter, five YAML forms, hardened read: name allowlist, stat kind file, size cap, `clean()` Cc/Cf + code points; agent description from `agent.offer`, bounded cache; phase `about` line, new 120-char field on the 11 routing.json phases, kept in memory not on Route) and the REAL next model id + effort. Options Later / Keep / Change (T3 Later / Keep). Change = model (4 fixed alias labels with tier role) → effort among those the phases headed by that alias offer (ascending, ≤ 4, one → skipped, zero → Later) → scope; the pair maps to an existing PHASE (rows stay phase names; row's current phase wins a tie; same phase = Keep); a pair no phase offers = a new phase by hand. Other anywhere = Later + toast (no echo). A main-row change toasts the real decision + `/route switch on` hint on a held downgrade. Three lenses rejected inline-route rows and dialog phase edits (2 BLOCKERs). First real use: user moved security-auditor to `judge` (opus/xhigh) through it; floor aligned (`model: opus`, 2026-10-11). Links [[EVAL-044]]. +- **Amendment (2026-10-11, wave 3-C, commit cd8d72f)**: clause (6) extended: `/route forget ` (composer only) clears decisions in the tracked file through the same writer: a name in every table (`confirmed`, `changed` → row restored to its recorded `from` when it is a string, the row still equals `to` and `from` is a known phase; `projects[*]` pruned), asked again at once; `all`/`projects` confirm through the engine dialog (Cancel first, anything else = cancelled) and hold the single-dialog slot; nothing written when nothing to forget; the answer names a restored row's file + values to realign (a floor aligned to the decision makes the census FAIL after the restore). No per-user decisions file (user: "seulement le forget"): another user inherits the shared memory and may forget. Residuals (security LOW/MEDIUM): raw error text in the answer, file fragments unsanitized in the answer, `floorFile` name not allowlisted, `__proto__` plan/apply mismatch, `changed.phases` restorable. Links [[EVAL-044]]. +- **Amendment (2026-10-11, wave 4-A, commit 68d7ea6)**: logging rule: `verbose` (boolean) logs TRANSITIONS only, built from the decision itself inside `safely` before `next`: main "fable/high → fable/xhigh (: [, ])" once per turn per transition (causes: skill /, route tool, prompt rule, prompt floor, dispatch, sticky /route, session; model: upgrade, switch, fallback: down); one hand-off line per agent dispatch deduped per turn per (type, target) "main … → agent / (row |explicit|fallback|frontmatter, row|explicit|engine)"; later agent effort moves; an answered-by anomaly (agents only, canonical ids, once per agent+model). The host prefixes the plugin name: new lines carry none. The four stream lines are gone. Residuals W3-A/B/C closed: failure texts to the log, file fragments cleaned at render, floorFile allowlisted, `__proto__` refused, changed scan = rows, dialog Change offers shipped phases only (`mem.filePhases` = validated seed layer), post-answer write failure keeps the key asked. Rejected: a `trace` level (unrequested surface); detecting agent moves at turn.step (decided at spawn). Links [[EVAL-044]]. +- **Amendment (2026-10-11, wave 4-B, commit e54a2b5)**: prompt classifier closes the main-loop gap (plain prompt, no skill, no agent, no route in force). Composer `prompt.submit`, trimmed text ≥ 12 chars not starting with `/`, no prompt rule matched, no sticky/turn/run/floor route → one `$.model.classify(sample, [design, analysis, coding, bookkeeping, chat])`, sample = whole text ≤ 2000 code points else head 500 + tail 1500, no `model` option (engine small model). Label → phase (design→plan, analysis→reflect, coding→implement, bookkeeping→apply, chat/unknown → nothing) written as the TURN route, EFFORT ONLY (no tier: main model never moves on a guess), may lower, replaced by any later route tool call or typed skill, ignored at a step whose engine effort ≠ session baseline (`engineBase`: a user `/effort` beats the guess). Bounded: race with `$.clock.sleep(3000)`; timeout/rejection count, user abort neither counts nor writes, every guard re-checked after the await (a route landing meanwhile wins); 3 failures in a row → pause `cooldownMinutes` (×60000, kept across `/clear`, cleared by `/route reload`, one toast + status marker ` · classifier: paused`); skipped while the haiku id is marked down or main runs on haiku. No dialog, no routing.json write on a classified route. Config key `classify` (default true, `pickSwitch`), `/route classify on|off` session toggle surviving a rebuild, `/route show` `classify:` field, status `route: classifier `, verbose line `(: classifier)`. +- **Why**: user 2026-10-11: routing must also cover the main conversation when no skill or agent is invoked. Effort-only because a model flip on a 3-s guess would fight the breaker and the user's `/model`; turn-scoped because a guess must never outlive its prompt. +- **Alternatives rejected**: first-use dialog on classified phases (the TODO line said so; a dialog per plain prompt is noise and the phase is already confirmed through T3); writing the guess into routing.json; classifying mid-turn or sub-agent prompts; unbounded await (robustness BLOCKER r1: the classify call sat on the critical path with no clock race); `classify` as a tracked-file writer (session toggle + config key instead). +- **Gates**: plan r1 → r3 (simplicity CONCERNS(4), robustness FATAL(6) BLOCKER unbounded await, correctness CONCERNS(4); confirmation robustness CONCERNS(4)); feater DONE (423) + 1 round (trim, argumentHint, repeated undefined: 428, each mutation-proven); GATE 0 MET; verifier ECARTS(2) coverage → CONFORME on #2; security PASS (0 findings; LOW accepted: pasted text can steer one turn's effort up, README says so). Abort paths judged by reading (`[gated]` clarification). Residual: `smallModelBusy` checks `cfg.models.haiku` while classify uses the engine's default small model (mismatch only when the two differ). Live AC9 open. +- **Refs**: contract `.claude/tasks/contracts/2026-10-11-model-router-w4b-classifier-1858.md`, plan r3 same slug. Links [[EVAL-045]], [[LRN-210]]. + +- **Amendment (2026-10-13, feature/router-downgrade-cap, commit 2ce203a, user decision)**: W4-B "EFFORT ONLY" clause superseded. Classifier writes full phase route; main may move DOWN on a guess, never above session model (`wantedModel` ranks vs `sessionModel`, not `cur`: breaker fallback sonnet→opus, never haiku); `ultrathink` floor model beats guess. `mainModelSwitch` default **true**, fail-closed picker (non-boolean → off + log). Caps measure COLD READ (LRN-216): `coldRead(M) = tokens − served[M].tokens` within `CACHE_TTL_MS` 1 h, else whole context; `downgradeMaxTokens` 120000 (user delegated value), `upgradeMaxTokens` 200000 same measure; served record written EVERY main step, dropped by `/clear` + `/route reload`, stale (context < record) = cold. No return bypass (warm return cheap by construction). Model-loaded helper skill inside best-tier run → effort only (`belowRun`). Window outgrown (haiku 200k) → back to session model. `/effort` typed between turns drops guess for that turn only (`engineBase` per turn). Rejected: user `/model` suspends classifier (baseline moves, guess follows; `/route classify off` pins) — trade-off accepted; raw context-size cap (r1: refused cheap re-down to warm sonnet, forced cold fable read); engine-model return bypass (premise false after N sonnet turns). Residuals TODO 2026-10-13: unrowed agent `parentModel` inheritance on demoted turn, `session.usage` lag vs new prompt, TTL const. Gates: 3 lenses CONCERNS (10 MAJOR) → r2; confirmation FATAL(7) BLOCKER → r3; feater DONE 450 tests; verifier CONFORME 10/10 first pass; security PASS. Links [[LRN-216]], [[EVAL-047]], [[LRN-204]]. + +- **Amendment 2 (2026-10-13, same branch, commit 1be57a3, user "fix les residus")**: three residuals closed. (1) Spawn pin NARROW: built-in `general-purpose` only (`INHERITING_AGENTS` + `offers.source === 'built-in'`), no explicit model, no row, no fork/workflow, main's own child, main BELOW session model (`ranksAbove(session, turnModel)`), session model ranked + up → sent `sessionModel` verbatim, cause `session`. Rejected: "no model + no row = inherits" (r1 BLOCKER ×2: frontmatter `model:` invisible to the hook, would override plugin/project agents; LRN-217); any `turnModel` (upgrade would drag agents down). (2) Prompt estimate: `ceil(codePoints/3)` of text + `context` + main's TYPED skill body, summed, first baseline kept; pure `withEstimate` in shared `readingFor` + `mainPlan` (texts = step); `noteServed` RAW (inflated record would trip compaction path); consumed at first main step of its turn; mid-turn → `pendingEstimate` next turn; `document` attachment → unknown → blocked. (3) TTL: `cacheTtlMs` from engine enum `'5m'|'1h'` on main's PostModelSwitch (`agent_id` events ignored), kept across `/clear`, show prints `ttl N min`. Residuals left (TODO): TTL before first switch event = 60 min assumption; hooks-below context / dropped prompt = conservative; `onAutoSwitch` targets main's `lastPlan` for sub-agent fallbacks (pre-existing); LIVE CHECK whether `parentModel` follows the rewrite. Gates: 3 lenses (FATAL ×2, CONCERNS) → r2, confirmation CONCERNS(3) → r3, feater DONE 472 tests, verifier CONFORME 7/7, security PASS. Links [[LRN-217]], [[LRN-216]]. + +## BDR-117 — shared gstack helpers live in lib/gstack-removed.sh, not in a new lib [accepted] (2026-10-12) +- **Decision**: C5 /refactor 2026-10-12. profile.sh + toggle-external.sh duplicated gstack_skills + park/unpark moves. Host gstack_skills/gstack_parked_names/gstack_park/gstack_unpark in lib/gstack-removed.sh; each takes dirs as args, no caller globals; plain-statement call only (errexit, [[LRN-215]]). +- **Why**: only sourced file 5 fixture suites copy next to both scripts; new lib = every fixture breaks. +- **Alternatives rejected**: new lib/gstack-helpers.sh + patch 5 fixtures (wider diff, fixture drift risk); keep twins (3 copies drifted once already). +- **Cost**: file name says denylist, now hosts helpers; header comment states it. +- **Refs**: commit 8444661. Links [[LRN-215]], [[EVAL-046]]. + +## BDR-118 — Rust default language, always-on rule file [accepted] (2026-10-12) +- **Decision**: user rule, new project / from scratch / whole-project rewrite → Rust unless other language shows gain (features, security, perf, reliability, maintainability). Lives in `rules/default-language.md` WITHOUT `paths:` (always-on), CLAUDE.global.md at 317/320 → BDR-085 exception path. +- **Scope cut**: module refactor or feature inside existing codebase keeps codebase language. "Rust slower to write" alone not a gain; throwaway script is. +- **Hooks**: interviewer FAILURE MODES row (language not stated → propose Rust), init-project founding-BDR table, project CLAUDE.md exception list. +- **Alternatives rejected**: section in CLAUDE.global.md (busts 320 budget); `paths:`-scoped rule (brainstorm is chat, never fires). +- **Refs**: commit ee76723, branch chore/rust-default. Links [[BDR-085]]. +- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Rust default moved to lib/architecture-defaults.md, chat covered by the always-on line + +## BDR-119 — impeccable = Build path for all UI, frontend-design out of the gate [accepted] (2026-10-16) +- **Decision**: Build UI routes to impeccable (init, shape, new-work, craft floor, `impeccable detect`, fresh finish reviewer). `design.profile` GATE-BLOCK: impeccable in, frontend-design out. frontend-design stays installed + profile-listed: light path for a one-off visual w/o project context, never beside impeccable on same task. +- **Why**: impeccable 4.6 craft-floor + new-work carry frontend-design's anti-default list (eyebrow, numbering, identical cards, hero metric, cream/serif, scattered motion) and add direction roll, 61 deterministic rules, fresh reviewer, PRODUCT.md/DESIGN.md. Gate blocked on frontend-design (likely source of install prompt seen in another project, not traced). 2026-07-05 "complementary, keep both" call assumed frontend-design kept aesthetic direction; no longer true. Skill dist drifts untracked (pin = CLI only). +- **Gaps accepted**: tells only frontend-design names: middle-dot meta strings, arrow on buttons, short ALL-CAPS labels, tinted near-black. impeccable heavier: ~79k chars, init interview, mandatory seed roll on new world. +- **Alternatives rejected**: both in gate (conflict: frontend-design lets brief earn an eyebrow, impeccable bans it); uninstall frontend-design (loses light path); impeccable non-blocking (gate stays blind to the main tool). +- **Residual**: model-router has no impeccable row (frontend-design = `reflect`); census test pins the table, own change. +- **Refs**: branch chore/impeccable-build-path. Supersedes TODO 2026-07-05 call (no BDR). Links [[BDR-094]] [[BDR-025]] [[BDR-105]]. + +## BDR-120 — Secure-by-default guardrails: always-on rule + /guardrails scanner [accepted] (2026-10-18) +- **Decision**: 5 domains (hosting, a11y, Supabase, SMS/email, cloud functions) + API/access hygiene = baseline every project. Rule `rules/secure-by-default.md` always-on, no `paths:` (CLAUDE.global.md at 320/320, BDR-085 path). `/guardrails` = stdlib py scanner (`skills/guardrails/scripts/scan.py`, FAIL/WARN/MANUAL, exit 1 on FAIL, read-only, never runs project code) + judgment + `.claude/audits/GUARDRAILS.md`. security-auditor gate runs `api,supabase`; FAIL → HIGH, secret/service_role/password-plaintext → CRITICAL. Passwords folded into api domain on user question, not sixth domain: same gate, same CRITICAL path. +- **Why**: user ask. Dashboard-only items (spend cap, WAF, budget stop) stay MANUAL, never claimed done. Scanner proves absence of protection, never presence of security; clean scan = "no static finding". Calibrated on 8 real projects, each FP class fixed + locked by benign test. +- **Alternatives rejected**: Rust scanner (interpreted skill script, no build step, default-language contraindication, same rank as explain-diff checker); section in CLAUDE.global.md (budget); `paths:`-scoped rule (never fires in chat/brainstorm); semgrep rules only (blind to migrations, policies, consent flow). +- **Refs**: branch feature/secure-by-default, suite `lib/tests/guardrails-scan.test.sh` (89 checks). Links [[BDR-085]] [[BDR-118]]. +- **Status (2026-10-29)**: accepted, amended by BDR-130 (2026-10-29): Supabase/cloud-functions bodies → path rules, one always-on line each + +## BDR-121 — Guardrails fix loop reuses the bugfix circuit, scanner = oracle [accepted] (2026-10-18) +- **Decision**: after report, proposals (route plan) -> prose approval gate -> bugfixer + verify-secure gates -> re-pass. Each accepted fix = contract criterion, CHECK = `scan.py --assert-absent RULE:path` (marker GUARDRAILS-CLEAR, positive control: fails before fix). Re-pass = `--baseline` vs pre-fix scan (GUARDRAILS-NO-NEW). 2 rounds max, residuals open. `--report-only` keeps audit alone. +- **Why**: user ask. Proof by deterministic scanner, never executor's word; no new circuit to maintain. +- **Alternatives rejected**: guardrails edits code itself (skips fresh gates); chain to /bugfix per finding (one interview + contract per hit, too heavy for 60 labels); LLM verifier as sole proof (verdict without execution). +- **Refs**: feature/secure-by-default 73c25d7. Links [[BDR-120]]. + +## BDR-122 — Guardrails split: /a11y standalone on the shared scan engine, injection + exposure domains, exposure proven live by the read-only probe [accepted] (2026-10-19) +- **Decision**: a11y out of /guardrails → `skills/a11y` (own SKILL, Tab-only walk, report `.claude/audits/A11Y.md`, fix loop = bugfixer + verify-secure gates, scanner oracle A11Y-CLEAR / A11Y-NO-NEW). Shared engine `skills/guardrails/scripts/scanner.py` `Catalogue(name, domains, rule_domains, manual_rules)`, marker = name upper; a11y `scan.py` loads it via `importlib.import_module` after `sys.path` insert (no noqa). Guardrails = 7 domains: api, hosting, supabase, messaging, functions, injection (INJ-*, 6 rules), exposure (EXP-*, 9 rules). `rules/secure-by-default.md` six numbered domains; a11y doctrine → lazy `rules/a11y.md` (`paths:` globs), `rules/web-building.md` points at it. Probe exposure block sourcemap / error-body / fields: fail-closed (unobserved = SKIPPED or ERROR, never CLOSED), every plan path starts with `/`, same scheme+host only, production build target (dev-server OPEN = dev artefact). security-auditor gate keeps `--domain api,supabase`. INJ-SQL-RAW-UNSAFE = WARN (variable ≠ proof), INJ-SQL-CONCAT = FAIL. +- **Why**: user ask 2026-10-18 (keyboard/alt/labels as own skill; SQL/DB injection; browser-visible info). One engine = one CLI contract, two catalogues, no drift. Lazy a11y rule keeps CLAUDE.global.md at 320. +- **Alternatives rejected**: a11y as a `--domain` flag only (user wanted own report + walk); engine copied into skills/a11y (two CLIs drift); exposure probe against dev server (dev artefacts = false OPEN); semgrep-only (blind to live responses, policies). +- **Refs**: branch feature/a11y-split-inj-exp, contract `.claude/tasks/contracts/2026-10-18-guardrails-a11y-split-inj-exp-2210.md`; spec + plan purged at finish (`git show 988038c:docs/superpowers/...`). Supersedes the domain list of [[BDR-120]]; links [[BDR-121]]. + +## BDR-123 — Routing policy: opus session, Fable via rows for orchestrator reflection + merge gates, sonnet writes, ceiling on Fable main [accepted] (2026-10-21) +- **Decision**: user policy 2026-10-19. `settings.json` session model `opus`; model-router best-tier rows lift main to Fable for reflection ONLY (brainstorm, plan, contract, audit judgment, loop decisions). Fresh gates (verifier, security-auditor) = `audit` phase best/xhigh, frontmatter floor `opus` (LRN-224). Other judges (plan-challenger, analyzer, code review) opus. Executors sonnet; "what to write" (plan, diagnosis, contract) opus. Doctrine ceiling (CLAUDE.global.md Sub-agents rule): main on Fable writes no code past `/hotfix` scope, hands it to `/feat` or `/bugfix`. Supersedes BDR-066 "reflection inline on session model (Fable)" + "verifier + security-auditor stay sonnet"; amends BDR-115 "pin = never ceiling" (agent pins unchanged, ceiling lives in doctrine on main writing code). +- **Why**: BLK-032: session on Fable 1M + downgrade cap 120k + keyword `plan` rule → long sessions wrote code inline on Fable xhigh. Fable reserved for big reflection + important audits, rest opus/sonnet. +- **Alternatives rejected**: fable frontmatter on gates (dead model in credit outage, LRN-224); general-purpose dispatch for small writes (inherits Fable); CLAUDE.global.md budget raise over 320 (bullet compacted instead). +- **[deferred]** inline-writing best-tier skills = declared exception, visible in this repo only: design Build stack (frontend-design, 21st-ui-build, emil-design-eng, design-motion-principles Create, site-motion, build-threejs-scroll-worlds, scroll-*, 21st-ai), writing-skills, deprecation-and-migration, /tour single-project, /audit-delta STEP 3d, /harden STEP 3. Remap = own task (TODO). +- **Known gaps**: default keyword prompt rules (plan|design|architecture, why|review|audit|analyze, ultrathink) lift main to Fable unwitnessed → feat C caps them at session model; Fable held down → opus stand-in, ceiling does not bind; stale "session model" citers `skills/feat/SKILL.md:6`, `skills/code-clean/SKILL.md:36`. +- **Refs**: feat A feature/routing-audit-phase d3635b6 a7d747c dae142b; feat B feature/routing-ceiling-rule ef13713 887cf89, contract `.claude/tasks/contracts/2026-10-21-routing-ceiling-rule-1753.md`, plan `.claude/tasks/plans/2026-10-21-routing-ceiling-rule-1753.md`. Links [[BDR-066]] [[BDR-115]] [[BLK-032]] [[LRN-224]]. +- **Amendment (2026-10-23, feat C 786ee13 + docs d2d590f)**: keyword-lift gap CLOSED: prompt rules (keywords, `ultrathink`, user rules) + derived `orchestrate` on main Agent dispatch (user pick 2026-10-23) write effort-only routes; model axis falls through to held run or stays on cur. Amends [[BDR-115]] amendment 2026-10-13 clause "ultrathink floor model beats guess": mid-turn ultrathink after classifier demotion keeps guessed model that turn (floor raises effort only). Accepted edges: haiku session → keywords no-op; session model held → keyword turn = plain-turn fallback (sonnet), not fable; no stand-in notch on keyword/dispatch turns; dispatch after demotion orchestrates on demoted model. Rejected: cap in `wantedModel` (r1) → shadowed held run slot + fail-open on `sessionModel` '' after /reload-plugins. Contract `.claude/tasks/contracts/2026-10-23-router-keyword-cap-0019.md`, plan r2.1 `.claude/tasks/plans/2026-10-23-router-keyword-cap-0019.md`. Links [[LRN-226]], [[EVAL-048]]. +- **Amendment (2026-10-25, bugfix 8e93507)**: accepted edge "haiku session → keywords no-op" REVERSED (user pick: Haiku 5.x like any model). No-effort rule now Haiku 4.x only (`NO_EFFORT = 'claude-haiku-4'`); on Haiku 5.x keyword rules, `ultrathink`, sticky effort and derived orchestrate apply, unrouted step passes engine effort. Links [[BLK-035]], [[LRN-230]]. + +## BDR-124 — Foreign code keeps its own style; limits strict in our code only [accepted] (2026-10-23) +- **Decision**: CLAUDE.global.md header: strict limits in our code, "Foreign code: keep its style" section wins on foreign code (granularity, layout, naming, comments, idioms; limits = guidelines; no refactor toward our norms unless asked). Origin = `lib/code-origin.sh`: `git config claude.origin` (ours|foreign, per clone, invalid → foreign) > root commit author vs `user.email` + global `claude.identity` list; undecidable (no git, shallow, no commit) → foreign, said. Session banner line `code : ours|foreign (reason)`. refactorer, /refactor, /audit-delta conformity follow it; refactorer cites CLAUDE.md limits, no copy. +- **Why**: lima (third-party, 2009): extracted `rtnh_put_via6()` for 25-line limit while neighbour branches work inline; user had to inline back reusing in-scope vars/sizeof. +- **Alternatives rejected**: marker file committed in foreign repo (pollutes third-party tree); limits everywhere (breaks foreign style); per-file heuristics (unverifiable). +- **Known gaps**: "Session start" rule still creates `.claude/memory/` in foreign repos (out of scope). CLAUDE.global.md now 328L > 320 warn. +- **Refs**: chore/foreign-code-style 70e0f9a 71d28f8 052a704 5c6e368, merge 1a14265. Links [[LRN-227]]. + +## BDR-125 — Context mod: subtract-only JIT injection + deterministic guards; supersedes BDR-031 [accepted] (2026-10-23) +- **Decision**: user ask "move always-on doctrine into a mod, make it hard". Always-on context = 30.2k tok (`/context`, opus, repo root): memory files 11.6k, skill listing 10k, agents 2.6k, system 2.5k, MCP instr 2.2k, tools 1.1k. Mod = (a) SUBTRACT a marked CLAUDE.md/rules section only when it can re-deliver it JIT on a deterministic trigger, (b) turn mechanically checkable rules into tool.call guards (deny + reason). Source text stays in CLAUDE.md/rules with markers: mod off or hook throws → hook skipped → full content loads as today (fail-safe). Per-turn rules (writing-style, communication, workflow core) stay always-on. +- **Why**: BDR-031 premise dead. Proven 2026-10-23 by throwaway probe mod + fresh `claude -p --plugin-dir` canaries (unique tokens + negative controls): `prompt.context` drops an instruction file (default-language ABSENT, writing-style PRESENT) and adds blocks; `prompt.compose` adds system section; `prompt.section` drops one (auto-memory ABSENT); `prompt.submit` `context` + `tool.call` result `context` inject; `prompt.attachment` rewrite of `skill_listing` drops a skill (scrape ABSENT, seo PRESENT); user `paths:` rules load on Read (web-security, rest-api). Facts: `agent.offer` false → agent undispatchable ("Agent type not found"); `command.describe` isHidden = typeahead only. +- **Phases** (each a future /ship-feature): 0 no mod: project CLAUDE.md sections → project `paths:` rules, higgsfield MCP declared in ~/.claude.json while toggle disabled. 1 context mod: marked-section subtraction + JIT (design, graphify, web/SPA + API + language, secure-by-default domains by fingerprint, gitflow detail, registry format, foreign/our code variant), project fingerprint, drop unused auto-memory section. 2 guards: registry writes (next ID, index row, append-only, English), merge gate (`gitflow finish` needs explicit signal in last user msg), commit msg ≤50 words, 80-col/function-length feedback on our code. 3 listings: skill listing filtered by fingerprint + descriptions restored, classifier one-line skill hint replaces routing table, agent descriptions trimmed (names kept; dispatch to verify). 4 active memory: session digest (open BLK, actionable TODO, last journal) re-injected after compaction + per-prompt local heading score (top 3-5 above threshold). +- **Est. gain**: ~13-15k of 30.2k tok (measured chars × measured chars/token ratios; estimate). Main value = relevance + hard guarantees, not tokens. +- **Constraints kept**: no forced continuation (BDR-083, BDR-087), no per-turn capitalize nag (BDR-037), hints never over-fire (LRN-091), skill hint advisory never forced invocation. Prompt cache: context/sections computed once per conversation; per-prompt context appended (no bust). +- **Alternatives rejected**: hide executor agents via `agent.offer` (breaks dispatch, proven); move writing-style/communication out (apply every turn, same cost); rewrite shown answer (`turn.complete` only appends below); Stop-hook enforcement (BDR-083). +- **Refs**: probe `scratchpad/ctxprobe` (session-local, not committed), plugin-authoring types 2.1.306 (`prompt.context`, `prompt.compose`, `prompt.section`, `prompt.attachment`, `prompt.submit`, `tool.call`). Supersedes [[BDR-031]]; links [[BLK-009]], [[LRN-175]], [[LRN-054]], [[LRN-091]], [[BDR-115]]. +- **Amendment (2026-10-24, user)**: phase 5 added: per-project virtual profiles, concurrent sessions (today `lib/profile.sh` global: one profile for all open sessions), auto-pick from fingerprint or pinned `/profile set`, per-skill advert of needed helpers; plugin project-scope `enabledPlugins` to verify. Advisor toast refused. Each phase deletes what it obsoletes (scripts, hooks, tests, doctrine). Full specs: TODO "Context mod queue". Probe bench kept at `.claude/tasks/plans/2026-10-24-context-mod-probe/`. +- **Amendment 2 (2026-10-24, user: full memory redesign allowed)**: phase 4 = memory v2 (write + capture + read + feedback), measured on 434 entries: capture is the weak link (5/7 real errors of 2026-10-23 had no entry), not search; haiku rerank of lexical top-30 = 14/22 vs BM25 9/22 on real FR prompts; error 4-gram match exact (429 → BLK-030/031). Storage: augment in place + Meta line + generated Index + single writer `lib/memory.sh` + pre-commit validator (Edit-level guard rejected: real writes go through Bash/python). One-file-per-entry rejected for now (44 citers + 8 project migrations for concurrency/history gains a validator+backfill mostly match). Registry guard moved from phase 2 to 4a; 4a needs no mod. +- **Amendment 3 (2026-10-24, challenge of phase 1)**: phase 1 = native context diet, no mod. Proven: `paths:` rules load on Read (not on Write of a new file), `autoMemoryEnabled: false` drops the auto-memory section, classic SessionStart/UserPromptSubmit hooks inject context, instruction files reload on compaction natively. Each section goes to the carrier matching its trigger (path rule, hook, skill body, setting, or compression once enforced by 4a/phase 2). Same ~4.4k gain, no mod code, works with mod off. Mod marker subtraction kept only as fallback if a native carrier fails a canary. Fingerprint moves to phase 3. +- **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/.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. +- **Status (2026-10-29)**: accepted, phase 1 shipped 2026-10-29 (BDR-130): next phase 5 + + +## 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]]. +- **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. +- **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]]. + +## BDR-128 — Project path rules: one bash oracle, `/onboard split` subtract-only, generators born split [accepted] (2026-10-27) +- **Decision**: `.claude/rules/.md`, frontmatter `paths: ["a", "b"]` one line (block list refused by the oracle, named in the error). One oracle `lib/project-rules.sh [-C dir] check | matches | sections | extract | emit`: globs on the WORKING TREE (`compgen -G` globstar dotglob, dep dirs filtered unless the glob names one: `vendor/**` valid), `# static-check: skip` marker exempts a rule whose files exist mid-run, a section ends at next `#`/`##` outside a fence, `extract` refuses (heading count ≠ 1, target exists, glob no match, failed rewrite rc 2 + rule removed). This repo: 4 rules (rules-maintenance, graphify-vendored, mods, transient-artifacts + skip), CLAUDE.md keeps header + Health Stack + `## Path-scoped rules` pointer. `/onboard split`: main loop classifies (`sections`), verifies every glob (`matches`), row shape `[a-z0-9][a-z0-9-]*` / no `'` `|` `/` `..`, gate, onboarder `MODE: split` executes (S0 preflight incl. `check` + gitignore negation ordered a-f, S1 extract per row, S2 pointer + `cat -s`, S3 check + commit + `cat-file -e HEAD:` per rule, two STOP shapes, rollback `reset -q` + `checkout`). Generators: onboarder PHASE 5b + scaffolder 3b `emit` docker/testing/ci from `templates/project-rules/` when a glob matches. `hooks/instructions-loaded.sh` permanent (`InstructionsLoaded` → `~/.claude/logs/instructions-loaded.jsonl`, field allowlist, exit 0 always, rotate 5 MB). `!.claude/rules/` after `.claude/*` here + socle. +- **Why**: project CLAUDE.md 5,285 → 584 bytes, `/context` Memory files 11.6k → 9.6k, project row 2.1k → 166 tokens; rules load on Read only, proven in main + sub-agent ([[LRN-232]]). Phase 0 of [[BDR-125]]: no mod, subtract-only, deterministic oracle in `make test`. +- **Alternatives rejected**: block-list `paths:` parsing (spec shape inline; pre-flight `check` at S0/S1 moves the failure before any write); mod-based injection (BDR-125 says phase 0 no mod); dep-dir filter unconditional (vetoed `vendor/**`); `git add .claude/rules` dir (a pre-existing rule made visible by the negation would ride along); whole-file Write for the pointer (subtract-only). +- **Residuals**: `###` granularity before faunosteo (12.6 KB path-bound content under always-on `## Project conventions`; `##`-only moves 1.5%), user decides (TODO 0b); `game` heading with `'` refused until renamed or extract by index; `extract -n` dry run deferred; T11b + AC2 hardcode 4 rules; `InstructionsLoaded` key on older CLIs unverified (check `claude --version` on work machine before pull); pre-commit `.claude/**` exemption lets a rules-only commit land on develop → phase 2. +- **Refs**: spec `docs/superpowers/specs/2026-10-26-claude-md-split-design.md`, plan r3 `docs/superpowers/plans/2026-10-26-claude-md-split.md`, contract `.claude/tasks/contracts/2026-10-26-claude-md-split-0042.md`, commits abfa416..0b59687. [[BDR-125]], [[BDR-003]], [[BDR-065]], [[LRN-154]], [[LRN-232]], [[LRN-233]], [[EVAL-051]]. + +## BDR-129 — Memory registries v2: lib/memory.sh single writer, format: 2 without Index, shared parser, rc 6 chokepoint, oracle upgrade [accepted] (2026-10-28) +- **Decision**: `lib/memory.sh` = single writer + reader of `.claude/memory` registries (add/status/journal/index/check [--staged]/upgrade, `-C dir`). v2 = same file, `format: 2` frontmatter, no `## Index`. Status parser shared with `lib/reconcile.sh`: strict on v2 (heading `[tag]` or labelled status line, last wins, `memory_closed` = resolved|superseded|deprecated), legacy lexical reader kept on v1 (13 v1 repos: open sets identical). `memory-commit.sh` runs `check --staged`: staged v2 registry rewriting an entry line, new duplicate, bad heading, open fence, deletion or downgrade → unstaged, rc 6. Lock = bash noclobber file in git common dir, token unlock, serialized steal, verified backup restored on failure/signal. `upgrade`: Index-only dates/statuses → body lines, dialect headings → `## ID — title (date)`, one-way verdict repair (v1-closed→strict-open only), oracle else rc 2 file untouched; refuses duplicate IDs, non-table Index. +- **Why**: Index drifted (16 rows missing), status in 3 places, BLK-032..034 false-open (prose words), no single writer (ad hoc Edit/python on 357k files). Phase 4a of [[BDR-125]]. +- **Alternatives rejected**: `flock(1)` (absent on macOS, [[BDR-110]]); `mkdir` lock (uutils 0.10 not atomic, [[LRN-236]]); generated Index kept (drift by construction, [[LRN-055]]); upgrade via /prune-memory curation (no oracle); strict parser on v1 (regressed 4 of 13 repos: title-suffix, `date: · status:`, `**Statut** :`). +- **Refs**: contract `.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md`, plan + spec `docs/superpowers/{plans,specs}/2026-10-27-memory-v2-write*`, commits a423594..aab9e4d, upgrade 9698473. [[LRN-237]], [[EVAL-052]]. + +## BDR-130 — Phase 1 context diet: native carriers per section, one always-on line where chat needs it [accepted] (2026-10-29) +- **Context**: BDR-125 phase 1, feature/context-diet (4bbb3c5..789a2b2), contract `.claude/tasks/contracts/2026-10-28-context-diet-1944.md`. +- **Decision**: each always-on section → native carrier matching its trigger, no mod. Design work → `rules/web-building.md` (hook one-liner says Read it); graphify usage → `hooks/session-start.sh` block only when `graphify-out/graph.json` exists (threshold + one reminder clause stay, sub-agents never see the banner); never SPA + Rust default → `lib/architecture-defaults.md` Read by init-project/interviewer/scaffolder/ship-feature STEP 1/onboard/audit-delta, one always-on line under `# Architecture decisions`; Web APIs → `rules/rest-api.md` § Versioning; Supabase/cloud-functions bodies → `rules/supabase.md` / `rules/cloud-functions.md`, one always-on line each saying Read before writing a new file; `"autoMemoryEnabled": false`; 13 agent descriptions ≤ 200 chars. +- **Measured**: `/context` 30.5k → 26.2k; own gain ≈ −2.8k (Memory files 9.6k → 8.0k, System prompt 4.4k → 3.7k, Custom agents 2.6k → 2.1k); MCP instr 2.4k → 0.9k external. +- **Accepted costs**: analyzer `memory: project` dropped with auto memory (dirs empty, user pick); `**/functions/**` fires in non-cloud dirs; Supabase owner-policy detail not always-on. +- **Amends**: BDR-118, BDR-120 (moved out of always-on; chat covered by always-on line), BDR-098 (Design work path-scoped, hook = pointer). +- **Deferred**: Skill-routing lines → skill descriptions (TODO phase 3 bullet). + +## BDR-131 — settings.json is a base file: /model never committed, UI writes stashed [accepted] (2026-10-29) +- **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`. + +## BDR-133 — Negated status word in clause does not count, shared v1/v2 negation helper [accepted] (2026-11-01) +**Context**: v2 parser + v1 legacy reader read `Status: not resolved yet` as resolved (phase 4a minor, robin_petier EVAL-005 `keep, … not accepted until …` read accepted). User pick 2026-10-31/11-01. + +**Decision**: status word negated in its clause does not count. Negator `not|no|never|pas`, at most one word between negator and word, no clause boundary `, ; . : ( ) -> → —` between. Next non-negated occurrence still counts. One helper `mem_has` in `_MEM_AWK`, shared by `mem_word` (v2) and `_mem_v1_word` (v1), so `upgrade` refuses such v1 closure ("unlabelled, mixed or negated line") instead of cementing resolved. Word = maximal `[a-z0-9]` run, loop not ERE interval (BWK awk). + +**Alternatives**: ignore negation (keeps false closures); line-scope negation (`resolved, not open` would read none: wrong); NLP (no). + +**Consequences**: real-data replay 14 repos → 1 move (robin_petier EVAL-005 accepted → keep). mawk run in T17 guards BWK-class awk. + +## BDR-134 — Phase 5: packs are skills-dir plugins, profiles are settings fragments, nothing global (2026-11-02) +- **Context**: one `~/.claude` serves every project and conversation. Old mechanism global: `skills/` ↔ `skills-disabled/` symlink moves + user-scope `claude plugin enable|disable` + `.active-profile`. One project's switch changed every open session. +- **Decision**: heavy skill groups = skills-dir plugins `skills/pack-/` (manifest + tracked relative symlinks into `skills-external/`, 4 real dirs moved). 9 packs: design, scroll3d, seo, web-validate, gstack-dev, gstack-browser, gstack-design, higgsfield (OFF), extras (OFF). Profiles = literal settings fragments `lib/profiles/.json` (`enabledPlugins` explicit for every pack + managed plugin, `deniedMcpServers` both higgsfield connectors on minimal/dev/seo/qa/audit, optional `model`); 9 profiles (backend, web-full dropped: byte-identical to dev, full). Per project `profile.sh set` merges into `.claude/settings.local.json`; per conversation `cc ` = `claude --settings`. `profile.sh current --plain` single truth for gate, hooks, statusline, advisor. No profile = manifest defaults = full. Listing budget `SLASH_COMMAND_TOOL_CHAR_BUDGET=50000` (0 name-only on full, +4.5k tokens est.). +- **Rationale**: measured 2026-11-01 (CLI 2.1.316): pack skills listed once as `pack:skill`, both names invoke; `--settings` false beats local true; `/reload-plugins` reloads a pack mid-session from a local edit but never re-reads a `--settings` file (frozen conversation → relaunch); connectors load under `-p`, denied per project by `serverName`, union across files. +- **Alternatives rejected**: keep symlink toggling (global, races between sessions); pack `.mcp.json` for higgsfield (duplicates the claude.ai connector, needs interactive OAuth); per-request confirmation of the gate (gate reads settings state, not files). +- **Supersedes**: BDR-030 (gstack via symlinks), BDR-079 (`set` symmetric on externals/MCPs), BDR-101 mechanism (full stays the policy). **Amends**: BDR-024/025 (`show --plain` → `current --plain`), BDR-109 (`higgsfield-websites` lives in pack-higgsfield, ON in `max` only; `profile.sh enable higgsfield` replaces both toggles; npm CLI unchanged). +- **Accepted risks**: `cc.sh` keeps `set -a; . ~/.claude/.env` (all secrets in the claude env, as `dtach_claude` did); `deniedMcpServers` union = `cc x web` on a `dev` project keeps the connectors denied (`set web` in the project fixes it). +- **Branch**: feature/phase5-profiles-packs; spec docs/superpowers/specs/2026-11-01-phase5-profiles-packs-design.md; contract .claude/tasks/contracts/2026-11-01-phase5-profiles-packs-1300.md. +Supersedes [[BDR-030]]. +- **Status (2026-11-09)**: accepted, amended 2026-11-09: higgsfield connector denies + census connector rule removed after claude.ai account removal (chore/connector-deny-cleanup); generic deniedMcpServers mechanism in profile.sh kept + +## BDR-135 — model-router askTier: consent before Fable, tier-name choice stamped on turn and run slots, per-type spawn memory [accepted] (2026-11-02) +- **Context**: user ask 2026-11-02: model-router must ask before routing main or a rowed spawn onto Fable. feature/router-ask-tier, contract `.claude/tasks/contracts/2026-11-02-router-ask-tier-1434.md`, plan r3 after 3 lenses + confirmation. +- **Decision**: `routing.json` `askTier` (`best` | `false`, machine override wins, absent = best, missing file = off, bad value logged once + best). Ask fires at route EVENTS only (typed or model-loaded rowed skill, main `route` tool phase, typed `/route `, rowed spawn from main), never in turn.step (LRN-231). Guards: router on, not paused, cur not head, `asking` free, slot unstamped, slot tier = best, slot = effective `mainModelSlot`, surfaces non-empty, then real decision via `snapshot`/`decideMain` lands on head. Options `Fable` · `Opus instead (big tier)` (dropped when opus down) · `Stop asking this session`. Choice = TIER NAME on `Routed.tierChoice` (`best` | `big`), stamped on turn slot AND run slot; inherited only same-tier, non-typed writes (typed skill = new span, work route never inherits). `big` resolves minus head (opus, else sonnet, head last), phase effort (no stand-in notch). Spawns: one answer per agent type per session (`State.tierSpawn`), stored answer applied before any guard. `/route ask-tier on|off` via `flagCommand` (shared with `ask`); `/route show` `ask-tier:`. Nothing written to `confirmed`. +- **Why**: Fable credits burn on best-tier rows (BLK-030/031); user wants consent per span, not per spawn (audit gates respawn verifier + security-auditor each loop). +- **Alternatives rejected**: stand-in rewrite (`isStandIn` keyed on held head, would print "stands in for" on a user pick); rebuilt decision from parts (diverges from `decideMain`: sticky slot, mainUpgrade off, cap); per-spawn ask (blocking dialog, no timeout, stalls unattended orchestration); generated labels from aliases (contract fixes the exact words); any tier name in `askTier`; `{ model: alias }` on spawn (explicit model bypasses breaker). +- **Residual (user-accepted, F)**: Fable held or cap exceeded at the route event → no question, slot unstamped; hold lapse / compaction → next step upgrades unasked (breaker behaviour today). `/model ` while any dialog holds `asking` falls to native (pre-existing, BDR-126). +- **Gates**: r1 correctness FATAL(6) robustness FATAL(6) simplicity CONCERNS(4) → r2 → confirmation CONCERNS(6) → r3; feater DONE 28 TIER tests (590 → 618); GATE 0 MET 5/5; verifier CONFORME 11/11 first pass; security PASS (1 LOW fixed: `clean(skill)`). Commits 9a24a62, docs 789fd00. +- **Refs**: [[BDR-116]], [[BDR-123]], [[BLK-032]], [[LRN-231]], [[LRN-242]], [[LRN-254]]. + +## BDR-136 — Phase 2 guards: native ask merge gate, bench-proven shell rules, rtk rc 3 passthrough, router write guard with a session skill latch, code-limits signal [accepted] (2026-11-02) +- **Context**: BDR-125 phase 2, feature/phase2-guards, contract `.claude/tasks/contracts/2026-11-02-phase2-guards-1545.md`, bench `.claude/tasks/plans/2026-11-02-phase2-bench/`. +- **Decision**: (1) merge gate = native `ask` `Bash(git merge *)`, `Bash(bash *gitflow.sh finish*)`, `Bash(sh *gitflow.sh finish*)`; every finish prompts once, `/close` 5C + `/release-candidate` included; declined prompt → "nothing merged, branch kept", stop. (2) shell-form asks (`sh -c`, `sh -*c`, `bash -*c`, `dash -c`, bare `bash`/`sh`, `bash <(`, `/bin/{sh,bash}`, `/usr/bin/{sh,bash}`, `/usr/bin/env {sh,bash}`), denies `awk *system(*`, `head|tail|cat * .env*` + `* */.env*`, 20 `rtk read` twins; census T62/T63. Rule lands only when every bench row naming it hits its want + one positive row. (3) rtk hook rc 2|3 → original passes (native rules judge as typed). (4) router write guard: main-loop Edit/Write/NotebookEdit of code (config included; free `.md` `.txt` `/.claude/` minus worktrees, `/docs/`) redirected until `skillRun` latch (any skill typed or model-loaded on main), a route phase this turn, or typed `/route`; dropped by `/route clear|off`, `/clear`; fail-open. (5) code-limits PostToolUse `Edit|Write`: added lines > 80 cols, ours only, once per file per session, additionalContext. (6) release finish + tag in main loop (BLK-018 b), executor prep only. +- **Why**: doctrine rules mechanically checkable → deterministic; routing probe 11/21 code turns inline; rtk rewrite let `git push origin :ref` escape deny/ask. +- **Alternatives rejected**: `$.ui.ask` mod gate, phrase-list gate (challenges 2026-10-25); 16 routing rows for the guard (run slot drops mid-run, would open first-use + ask-tier dialogs); `git -C * merge *` (asks on any commit text with " merge ", sub-agent ask refused); quoted finish rule (matcher ignores quote in pattern); `gitflow_finish*`, `bash -s*` (bench RAN); `Bash(/*)` (kills `*/rtk` twins); per-spawn guard. +- **Residuals**: Bash write forms outside guard; latch reset on register.ts reload; sourced `gitflow_finish`, `git -C merge`; `rtk read -n .env` flag-first (security MEDIUM, TODO); code-limits TMPDIR state dir ownership unchecked; silent in this repo (code-origin foreign). +- **Gates**: plan r1 correctness FATAL(8) robustness FATAL(5) → r2 → confirmation CONCERNS(4) → r3; user interactive ask check; SDD 11 tasks; final opus review With fixes → fix wave; GATE 0 ABANDONED(2) user-accepted; verifier ECARTS(6) → ECARTS(2) human-gated; security PASS (1 MEDIUM, 3 LOW). Refs [[BDR-125]], [[BDR-068]], [[BDR-123]], [[BLK-018]], [[LRN-256]], [[LRN-257]]. + +## BDR-137 — Phase 4b memory capture mod: error-shaped Bash failures redacted into a per-project store, 4-gram index per call, one note per milestone, memory_pending (2026-11-04) +- **Context**: BDR-125 phase 4b, `feature/memory-capture` (f1d4f9d..HEAD), contract `.claude/tasks/contracts/2026-11-03-memory-capture-0100.md`, spec `docs/superpowers/specs/2026-11-03-memory-capture-design.md`, plan r3, spike `.claude/tasks/plans/2026-11-03-memory-capture-spike/REPORT.md`. Capture = weak link: 5/7 real errors of 2026-10-23 no entry. +- **Decision**: mod `mods/memory` (`memory@skills-dir`). (1) Failure = Bash `isError` text `Exit code N`; distinctive line = last line after rtk-trailer strip, must hold a letter AND an error word (`ERRORISH`, answer 2-amended after 83 % measured noise); permission/guard/tool_use texts never captured; sub-agent failures marked. (2) Redact BEFORE store: `KEY=value` (TOKEN|API_KEY|SECRET|PASSWORD|PASSWD, digits ok, quote-aware), 7 guardrails shapes, JWT first, Bearer, URL creds, `-u`/`--password`/`-b`(curl)/`--cookie`, `Authorization: Basic|Bearer|token`, vendor prefixes (sk-ant-, sk-proj-, github_pat_, glpat-, AIza, npm_), `--token|--api-key|--secret`, API-key/cookie headers, JSON/YAML password|token|secret|api[_-]?key keys, 40-hex URL user (answers 6-amended, 6-bis). (3) Store `$.store` key `p:` → 3 sessions × 50 failures, 2 KiB/entry, milestones 20, red 10, 1 MiB sweep at session creation, one closure write chain. (4) Index per call from BLK/LRN backticked spans ≥ 12 (cap 300), word 4-grams, all-placeholder grams skipped (4-amended), superseded excluded (lexical reader, `shortcut:`), first ID wins. (5) Milestones main loop only: feat|fix commit (`-m` and heredoc forms), `gitflow.sh finish` ≠ `finish chore`, `make test` red→green; one `memory: