Merge feature/memory-v2-write into develop
This commit is contained in:
commit
017a28b45c
43 files changed
+1897
-649
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: blockers_registry
|
type: blockers_registry
|
||||||
entry_prefix: BLK
|
entry_prefix: BLK
|
||||||
schema:
|
schema:
|
||||||
@@ -16,45 +17,6 @@ rules:
|
|||||||
|
|
||||||
# Blockers registry (BLK)
|
# 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 `<type> <name>` 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-029 | 2026-10-08 | Claude Code mods (2.1.294): alias → id resolution for a model set by a hook lags the Agent tool's (`sonnet` → `claude-sonnet-5`, 404); Agent tool schema refuses full ids | upstream |
|
|
||||||
| BLK-030 | 2026-10-15 | model-router kept routing best-tier phases to Fable out of usage credits: each new session + each hold lapse lost a turn to 429 `model_requires_usage_credits`; breaker reactive only | resolved |
|
|
||||||
| BLK-031 | 2026-10-16 | model-router: session starting on Fable w/o credits lost 1st turn + each hold lapse; probe skipped kept cur | resolved |
|
|
||||||
| BLK-032 | 2026-10-19 | Main loop pinned on Fable in long sessions: session model Fable 1M + downgrade cap 120k + prompt rule `plan` → inline code on Fable xhigh; feat A+B shipped (BDR-123), closed by feat C 786ee13 | resolved |
|
|
||||||
| BLK-033 | 2026-10-21 | Guardrails residuals: probe trusted plan `supabase.url`, redirects free of budget, unread bodies read CLOSED, `str(URLError)` hid budget signal; rules 5 FP / 7 misses | resolved |
|
|
||||||
| BLK-034 | 2026-10-22 | mods.test.sh red on CLI 2.1.306: whole-output `warning` grep caught advisory plugin-directory section (ICON_MISSING, blocking: false); verdict = `--strict` exit code now | resolved |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## BLK-001 — `rtk curl` returns compressed schema in pipes
|
## BLK-001 — `rtk curl` returns compressed schema in pipes
|
||||||
@@ -240,6 +202,7 @@ rules:
|
|||||||
- **Solution**: `"accessibility.signals.terminalBell": { "sound": "on" }` in CLIENT-side user settings.json (`c:/Users/<u>/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.
|
- **Solution**: `"accessibility.signals.terminalBell": { "sound": "on" }` in CLIENT-side user settings.json (`c:/Users/<u>/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).
|
- **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]].
|
- **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
|
## 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.
|
- **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.
|
||||||
@@ -260,6 +223,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).
|
- **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.
|
- **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]].
|
- **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
|
## 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.
|
- **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.
|
||||||
@@ -335,18 +299,21 @@ rules:
|
|||||||
- **Reference**: [[BLK-030]], [[LRN-218]], contract `.claude/tasks/contracts/2026-10-16-router-probe-session-model-1850.md`.
|
- **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]
|
## 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".
|
- **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]].
|
- **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]].
|
- **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]
|
## 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.
|
- **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.
|
- **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.
|
- **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]].
|
- **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]
|
## 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).
|
- **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`.
|
- **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.
|
- **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.
|
||||||
|
|||||||
+22
-127
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: decisions_registry
|
type: decisions_registry
|
||||||
entry_prefix: BDR
|
entry_prefix: BDR
|
||||||
schema:
|
schema:
|
||||||
@@ -18,133 +19,6 @@ rules:
|
|||||||
|
|
||||||
# Decisions registry (BDR)
|
# 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 | superseded by BDR-125 · 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-115 | 2026-10-08 | model-router mod: pin = entry default, sub-tasks route finer; one writer per axis; full ids from the mod table; built-ins-only agents table until frontmatter pins go; state in closure | accepted |
|
|
||||||
| BDR-116 | 2026-10-11 | model-router first-use confirmation: tracked routing.json = source of phases + rows + decisions; engine dialog at first use; project exceptions in user scope keyed by normalized remote; model never writes; census tolerates a decided row | accepted |
|
|
||||||
| BDR-117 | 2026-10-12 | shared gstack helpers live in lib/gstack-removed.sh, not in a new lib | accepted |
|
|
||||||
| BDR-118 | 2026-10-12 | Rust default language for new projects / whole-project rewrites, always-on rule file | accepted |
|
|
||||||
| BDR-119 | 2026-10-16 | impeccable = Build path for all UI; GATE-BLOCK swaps frontend-design for impeccable | accepted |
|
|
||||||
| BDR-120 | 2026-10-18 | Secure-by-default guardrails: always-on rule file + /guardrails stdlib scanner, passwords in api domain | accepted |
|
|
||||||
| BDR-121 | 2026-10-18 | Guardrails fix loop reuses bugfix circuit; scanner = contract oracle, baseline re-pass | accepted |
|
|
||||||
| BDR-122 | 2026-10-19 | Guardrails split: /a11y standalone on shared scan engine, injection + exposure domains, exposure proven live by read-only probe | accepted |
|
|
||||||
| BDR-123 | 2026-10-21 | Routing policy: opus session model, Fable via best-tier rows for orchestrator reflection + merge gates, sonnet writes, doctrine ceiling on Fable main; supersedes parts of BDR-066 / BDR-115 | accepted |
|
|
||||||
| BDR-124 | 2026-10-23 | Foreign code keeps its own style (lib/code-origin.sh, `git config claude.origin`), limits strict in our code only | accepted |
|
|
||||||
| BDR-125 | 2026-10-23 | Context mod: subtract-only JIT injection + deterministic guards; supersedes BDR-031 (conditional load proven reliable) | accepted · phases 0-5 planned |
|
|
||||||
| BDR-128 | 2026-10-27 | Project path rules: one bash oracle (lib/project-rules.sh), /onboard split subtract-only, generators born split, InstructionsLoaded proof hook | accepted · 0b pending |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## BDR-001 — Uniform --help helper via session-start hook (option C)
|
## BDR-001 — Uniform --help helper via session-start hook (option C)
|
||||||
@@ -695,14 +569,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]].
|
- **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
|
## BDR-038 — deploy skill: per-project learning runbook, two-moment cold-resume
|
||||||
|
- **Date**: 2026-06-27
|
||||||
- **date**: 2026-06-27
|
- **date**: 2026-06-27
|
||||||
- **status**: accepted
|
- **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).
|
- **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.
|
- **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]]).
|
- **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`.
|
- **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
|
## BDR-039 — Gitea branch protection = Option-1 owner-pushable, not require-PR
|
||||||
|
- **Date**: 2026-06-29
|
||||||
- **date**: 2026-06-29
|
- **date**: 2026-06-29
|
||||||
- **status**: accepted
|
- **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.
|
- **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.
|
||||||
@@ -711,6 +588,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).
|
- **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
|
## BDR-040 — doc-syncer MINOR-shape oracle: deterministic floor under LLM's MINOR call
|
||||||
|
- **Date**: 2026-06-29
|
||||||
- **date**: 2026-06-29
|
- **date**: 2026-06-29
|
||||||
- **status**: accepted
|
- **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.
|
- **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.
|
||||||
@@ -872,6 +750,7 @@ rules:
|
|||||||
- **Alternatives rejected**: `latest` (pipx house default, graphifyy-style) — fine for comfort tools, wrong for a blocking gate; `--config auto` — telemetry + non-determinism.
|
- **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]].
|
- **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`.
|
- **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
|
## BDR-049 — Verifier doctrine: fresh + blind + disk-contract + proof-or-fail
|
||||||
|
|
||||||
@@ -880,6 +759,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.
|
- **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).
|
- **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]].
|
- **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)
|
## BDR-050 — Universal verify+secure pipeline, weighted per flow (loops in the main loop)
|
||||||
|
|
||||||
@@ -888,6 +768,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.
|
- **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).
|
- **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]].
|
- **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
|
## BDR-051 — Contract enrich-at-gate: the contract grows only at a human micro-gate
|
||||||
- **Date**: 2026-07-04
|
- **Date**: 2026-07-04
|
||||||
@@ -895,6 +776,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.
|
- **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).
|
- **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]].
|
- **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
|
## BDR-052 — /tour auto mode: branch-as-gate, declared state read-only
|
||||||
|
|
||||||
@@ -903,6 +785,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.
|
- **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).
|
- **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]].
|
- **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
|
## BDR-053 — ctx7 single surface: keep find-docs skill, kill context7.md rule
|
||||||
|
|
||||||
@@ -911,6 +794,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`.
|
- **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).
|
- **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.
|
- **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
|
## BDR-054 — supersede BDR-038: NEXT.sh file + AskUserQuestion hand-back removed from /deploy
|
||||||
|
|
||||||
@@ -1077,12 +961,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.
|
- **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.
|
- **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).
|
- **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
|
## 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.
|
- **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.
|
- **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.
|
- **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.
|
- **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
|
## 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.
|
- **Decision**: rendercheck verdict `client-rendered` → On-page axis N/A, excluded from weighted global, NEVER scored zero. No Playwright, no Chromium. User-arbitrated.
|
||||||
@@ -1090,12 +976,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".
|
- **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.
|
- **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).
|
- **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
|
## 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.
|
- **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.
|
- **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).
|
- **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).
|
- **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)
|
## 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.
|
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.
|
||||||
@@ -1157,6 +1045,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.
|
- **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).
|
- **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`.
|
- **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
|
## BDR-087 — Stop hook = attention signal only, never control flow
|
||||||
- **Date**: 2026-09-03
|
- **Date**: 2026-09-03
|
||||||
@@ -1531,3 +1420,9 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
|
|||||||
- **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).
|
- **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.
|
- **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]].
|
- **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]].
|
||||||
+12
-52
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: evals_registry
|
type: evals_registry
|
||||||
entry_prefix: EVAL
|
entry_prefix: EVAL
|
||||||
schema:
|
schema:
|
||||||
@@ -17,58 +18,6 @@ rules:
|
|||||||
|
|
||||||
# Evals registry (EVAL)
|
# Evals registry (EVAL)
|
||||||
|
|
||||||
## Index
|
|
||||||
|
|
||||||
| ID | Date | Output | Action |
|
|
||||||
|----|------|--------|--------|
|
|
||||||
| EVAL-001 | 2026-04-23 | `.claude/` restructure plan (ship-feature STEP 2) | keep |
|
|
||||||
| EVAL-002 | 2026-06-02 | `profile gstack on/off` verb implementation | keep |
|
|
||||||
| EVAL-003 | 2026-06-11 | darwin optimization run on `audit-delta` skill | keep |
|
|
||||||
| EVAL-004 | 2026-06-11 | darwin eval 26 perso skills + 4-bug fix round | keep |
|
|
||||||
| EVAL-005 | 2026-06-23 | Obsolete `claude --effort max` alias missed across Step 9 edits | correct |
|
|
||||||
| EVAL-006 | 2026-06-25 | prune-memory v1.1 TDD — 6 guards (0a3e766), validated on real data | keep |
|
|
||||||
| EVAL-007 | 2026-06-26 | Coupled-capitalize machinery — TDD 13 + e2e, surgical scope proven | keep |
|
|
||||||
| EVAL-008 | 2026-06-27 | Doc-sync coupled machinery — 28/28 real-exec, swap-sweep caught prior debt | keep |
|
|
||||||
| EVAL-009 | 2026-06-27 | deploy skill subagent-driven build: multi-stage review + pressure-test net-positive | keep |
|
|
||||||
| EVAL-010 | 2026-06-29 | prune-memory hardening: RED-7 deterministic fix + RED-8 accept + 34-row index backfill | keep |
|
|
||||||
| EVAL-011 | 2026-06-30 | /reconcile build: RED contaminated→corrected (unguided control), GREEN behavioral confirmed, dogfooded on itself | keep |
|
|
||||||
| EVAL-012 | 2026-06-30 | /release-candidate build: RED (gitflow fans out, no tag) → GREEN 5/5 (tag), throwaway-repo flow replay | keep |
|
|
||||||
| EVAL-013 | 2026-06-30 | /reconcile real-usage on live repo: known gap + 2 unanticipated (header-marker drift class) + false-positive rejected off-fixture, 0 false assertion | keep |
|
|
||||||
| EVAL-014 | 2026-07-05 | /tour GREEN run: 6/6 RED gaps closed, disk-verified; re-verify caught agent's own regression | keep (skill shipped). REFACTOR additions not re-run through 3rd full pass — re-test at first real u… |
|
|
||||||
| EVAL-015 | 2026-07-05 | /tour first REAL run (report-only, bchanot-cv): REFACTOR additions validated; premise corrected by user | keep. Skill validated on real drift; two refinement candidates noted (report-commit placement, serv… |
|
|
||||||
| EVAL-016 | 2026-07-05 | /deploy first REAL run (bchanot-cv): bootstrap→instantiate→hand-back→mark, full cycle OK | keep. Two-moment contract works in-session; disk artifacts coherent throughout. |
|
|
||||||
| EVAL-017 | 2026-07-06 | job2 audit: fresh-context verify pass caught 3 explorer false claims | harness-semantics claims from explorers ALWAYS cross-check vs docs/live evidence; file-content clai… |
|
|
||||||
| EVAL-018 | 2026-07-06 | job3 docs-drift audit + execution: 46/46 findings verified, 20/23 fixes shipped (B1 blocked, D2-D5+B6 skipped by decision), zero residual on re-sweep | keep |
|
|
||||||
| EVAL-019 | 2026-07-06 | job4 test-gap audit + execution: 11 specs + 5 fixes/seams, every mutation red-green verified, zero residual | keep |
|
|
||||||
| EVAL-020 | 2026-07-07 | job6 dep upgrade execution: 5 deps sequenced by risk, 2 real STOP gates hit and resolved live, zero regression | keep. Branch unmerged (`chore/job6-deps-upgrade`, gitflow finish = separate human signal per CLAUDE… |
|
|
||||||
| EVAL-021 | 2026-07-08 | adversarial review of the 9-job series (release/1.0.0..develop) + remediation | keep. Remediation branch unmerged (human gate). Fil-rouge guard now prevents the partial-fix class… |
|
|
||||||
| EVAL-022 | 2026-07-08 | job9 model pins (BDR-060) were smoke-tested but never recorded as an EVAL (M5 trace) | keep — record backfilled here, no re-smoke required. |
|
|
||||||
| EVAL-023 | 2026-07-16 | post-merge ronde on the model-routing refactor (BDR-066) — clean, 5 edge gaps found + fixed | keep — all 5 fixed (bugfix/model-routing-edge-fixes, merged 5f159f3); census 47→57 now locks each. |
|
|
||||||
| EVAL-024 | 2026-07-16 | deny-list design pass (BDR-069) — core fix sound, 1 unauthorized weakening caught by classifier not by me | keep — fix landed (07ca738), weakening reverted. Lesson: vague delegation ("je te laisse en juger")… |
|
|
||||||
| EVAL-025 | 2026-07-17 | opening seo/geo inventory (subagents): 7/7 verifiable claims false or overstated; real contact corrected all, 6 plan corrections + 4 features killed at measurement | keep |
|
|
||||||
| EVAL-026 | 2026-07-17 | 3-way plan challenge caught 4 BLOCKERs dogfooding own plan (2026-07-17) | — |
|
|
||||||
| EVAL-027 | 2026-08-24 | contract-gates behavioral RED: 16/16 fresh unprimed runs followed new doctrine (GATE 0 order, vacuous oracle, ABANDONED routing, scope temptation resisted) | keep |
|
|
||||||
| EVAL-028 | 2026-08-26 | darwin v2.1 paired run 54 units: 60 paired verdicts 0 revert/tie; skeptics found 3 real residuals — engaged, not rubber-stamp | keep |
|
|
||||||
| EVAL-029 | 2026-09-15 | 4-agent plan challenge: 6 BLOCKER; 3 of 3 confirmation-pass BLOCKERs came from the fixes themselves; caught a false 654 MB orphan claim | keep |
|
|
||||||
| EVAL-030 | 2026-09-24 | 2026-09-24 self-audit: two regressions and one guardrail bypass came from my own process, not from the tools | BDR-100 mechanisms shipped; re-run census at next doctrine wave |
|
|
||||||
| EVAL-031 | 2026-09-25 | /feat run for BDR-101: challenge round earned its cost, two blockers sat in my own premises | keep challenge round on state-detection plans; check live state before planning; pin grep in oracles |
|
|
||||||
| EVAL-032 | 2026-09-27 | 4 parallel feater executors, one tree, gate loop: verifier caught a vacuous test, security caught a partial-write; my oracles wrong twice | keep same-tree parallel dispatch with disjoint FILE SCOPE + orchestrator-owned shared files; blind verifier stays; measure oracles on precedents |
|
|
||||||
| EVAL-033 | 2026-09-28 | case 7: 2 analyzers + 2 executors + 3 re-dispatches; verifiers caught shape, convention and my wrong count; security caught an env override | brief names the scratchpad path explicitly (3 /tmp leftovers); keep blind verifiers; count claims get an artifact |
|
|
||||||
| EVAL-034 | 2026-09-28 | catalog prune + 21st gate: two challenge rounds each found what r3 missed (nested SKILL.md, fixture cp lists, in-session export); my ledgers failed twice (heredoc CHECKs); 5 executors DONE first pass; verifier gap = tool false positive | keep the confirmation pass on any plan that changed materially; one-line CHECKs; grep fixture cp lists before a `source` |
|
|
||||||
| EVAL-035 | 2026-09-28 | thinking-share measurement, 6 days of transcripts (10,955 requests): thinking = 8 % of weighted spend, 97 % of it in the main loop; sonnet subagents at xhigh think 26 tok/request; cache reads = 53 % | pins = explicitness not savings; main-loop effort + context size are the levers; A/B after rollout |
|
|
||||||
| EVAL-036 | 2026-09-28 | A/B `/reconcile` headless, session high vs skill entry low: requests 18→15, output 12374→9038 (−27 %), thinking 3135→2248 (−28 %), time 96.5→78.4 s (−19 %), n=1 | keep low on bookkeeping skills; repeat on a reflection skill before touching the medium/high split |
|
|
||||||
| EVAL-037 | 2026-09-28 | correction of EVAL-035/036 counts: transcript records are per content block; deduped by message.id → main-loop thinking share 99.9%, thinking share of weighted cost 5.6%, sonnet think/msg 26→0.2, A/B requests 9→8 | conclusions hold (sharper: main-loop thinking 96.6%→99.9%, weighted-cost thinking corrected 8.4%→5.6%); effort-audit.py dedupes from a3b479e+ |
|
|
||||||
| EVAL-038 | 2026-09-29 | correction of EVAL-037: 94 % of sub-agent usage records carry no `output_tokens_details` (Fable subs at xhigh read 0 thinking, impossible with always-on thinking) → sub-agent thinking UNMEASURED, not ≈0; main loop 100 % counted; weighted-cost split (61/39) still holds | `effort-audit.py` prints coverage + CAVEAT; cite the cost split only; agent effort pins stay unmeasured; a tier move on a price argument = judgment, not figure |
|
|
||||||
| EVAL-039 | 2026-09-30 | ship-feature run higgsfield-pack: plan dry-run in scratch → 0 executor failure on 7 tasks; challenge found 7 MAJOR I missed; floor-guard caught 2 shellcheck suppressions of mine; final review found README/code gap | keep |
|
|
||||||
| EVAL-040 | 2026-10-08 | model-router w1a plan: 3 challengers + 1 confirmation found 2 BLOCKER + 14 MAJOR on a plan judged closed; executor then passed every gate first time | keep the round, never dispatch a mod plan without it |
|
|
||||||
| EVAL-041 | 2026-10-09 | model-router W1-C plan: 3 lenses FATAL (4 BLOCKER + 20 MAJOR) then 2 confirmations each FATAL with a NEW BLOCKER in my own revision; executor DONE first pass, 3 short text/hardening rounds | one confirmation is not enough when a revision removes a whole mechanism; the plan carried the risk, the code almost none |
|
|
||||||
| EVAL-042 | 2026-10-10 | model-router W2 plan r1 → r4: 3 lenses (1 BLOCKER), 2 confirmations (1 BLOCKER then 0); W2-A verifier 3× ECARTS on coverage clauses only, W2-B ECARTS(7) → CONFORME; gate A→B read from engine records | second confirmation paid again (BLOCKER on my own r2 slot); compound coverage criterion = endless ECARTS; engine jsonl replaces the live log |
|
|
||||||
| EVAL-043 | 2026-10-11 | model-router W3-A: 3 lenses + 1 confirmation (census BLOCKER, project-tree layer dropped), feater DONE + 4 rounds, verifier 3× then re-verify after a REAL security BLOCK (credential fragment in the tracked key) | challenge + security gates both earned their cost; coverage-shaped criteria still cost 3 verifier rounds; live mod side effects misread as a test leak |
|
|
||||||
| EVAL-044 | 2026-10-11 | model-router W3-B (dialog with context): 3 lenses converged on 2 BLOCKERs of my r1 (inline rows, phase edits) + 1 confirmation; feater DONE + 2 coverage rounds; verifier 3× to CONFORME; security PASS; user's first real decision through the new dialog | the lenses pay most when the plan adds a data shape; coverage criteria still cost rounds; live dialogs during the gates must be announced and their data reconciled before commit |
|
|
||||||
| EVAL-045 | 2026-10-11 | model-router W4-B (prompt classifier): 3 lenses (BLOCKER: unbounded classify await) + 1 confirmation; feater DONE + 1 round; verifier ECARTS(2) → CONFORME; security PASS 0 findings; LRN-210 applied (one coverage clause per criterion) | first wave since W2 with no verifier cap: per-clause criteria + abort paths declared unverifiable up front cut the rounds to one |
|
|
||||||
| EVAL-048 | 2026-10-23 | model-router feat C keyword cap: 3 lenses FATAL(4)/FATAL(5)/CONCERNS on r1 (3 BLOCKER: run-slot shadow, probe-test hang, reload fail-open), mechanism rewritten, confirmation SOLID; verifier CONFORME 1st pass; 1st verifier died 429 on Fable |
|
|
||||||
| EVAL-051 | 2026-10-27 | CLAUDE.md split: plan r1→r3 FATAL(5), 12 SDD tasks clean, RED/GREEN + dry run, sonnet final 3 Important, opus 2 Important 8 Minor; extract rc 0 on failed rewrite survived 5 reviews | failure-path test per rewriting function; review a cross-repo tool on real inputs |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## EVAL-001 — `.claude/` restructure plan
|
## EVAL-001 — `.claude/` restructure plan
|
||||||
@@ -117,6 +66,7 @@ rules:
|
|||||||
- **Method / why missed**: I treated the pre-existing `CLAUDE_LINES` as established and only touched the lines I was adding/removing. Spotting the redundancy needs cross-referencing TWO config layers (shell alias vs settings.json) — a semantic check I never ran. Masked further: the user's `.bashrc` is hand-managed and the alias line wasn't even present, so it looked inert.
|
- **Method / why missed**: I treated the pre-existing `CLAUDE_LINES` as established and only touched the lines I was adding/removing. Spotting the redundancy needs cross-referencing TWO config layers (shell alias vs settings.json) — a semantic check I never ran. Masked further: the user's `.bashrc` is hand-managed and the alias line wasn't even present, so it looked inert.
|
||||||
- **Anomaly**: not just dead config — a CLI flag (`--effort max`) silently OVERRIDES the settings.json value (`xhigh`). Real correctness bug.
|
- **Anomaly**: not just dead config — a CLI flag (`--effort max`) silently OVERRIDES the settings.json value (`xhigh`). Real correctness bug.
|
||||||
- **Action**: when editing installer shell-config, audit EACH existing line against the current settings.json / CLAUDE.md source of truth, not only the lines being changed. Removed the alias + added cleanup. General rule: reconcile config to ONE source of truth across env/alias/settings layers.
|
- **Action**: when editing installer shell-config, audit EACH existing line against the current settings.json / CLAUDE.md source of truth, not only the lines being changed. Removed the alias + added cleanup. General rule: reconcile config to ONE source of truth across env/alias/settings layers.
|
||||||
|
- **Status (2026-10-28)**: correct (Index Action, upgrade)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -147,6 +97,7 @@ rules:
|
|||||||
- **Action**: keep. BLK-010 (scaffold/unborn-HEAD) + BLK-011 (GSD ROADMAP post-FINISH) + MINOR-gate strengthening = separate chantiers.
|
- **Action**: keep. BLK-010 (scaffold/unborn-HEAD) + BLK-011 (GSD ROADMAP post-FINISH) + MINOR-gate strengthening = separate chantiers.
|
||||||
|
|
||||||
## EVAL-009 — deploy skill subagent-driven build: multi-stage review + pressure-test net-positive
|
## EVAL-009 — deploy skill subagent-driven build: multi-stage review + pressure-test net-positive
|
||||||
|
- **Date**: 2026-06-27
|
||||||
- **output**: `/deploy` skill (helper + SKILL.md + templates + bootstrap), built via subagent-driven-development (4 tasks; fresh implementer + per-task spec+quality review each).
|
- **output**: `/deploy` skill (helper + SKILL.md + templates + bootstrap), built via subagent-driven-development (4 tasks; fresh implementer + per-task spec+quality review each).
|
||||||
- **method**: per-task review (sonnet; opus on the keystone) + writing-skills pressure-test (fresh agent on a `PENDING.json`+moved-HEAD fixture) + final whole-branch review (opus).
|
- **method**: per-task review (sonnet; opus on the keystone) + writing-skills pressure-test (fresh agent on a `PENDING.json`+moved-HEAD fixture) + final whole-branch review (opus).
|
||||||
- **anomalies**: (1) the PLAN's code carried 3 latent bugs — missing `git add` for new files, SC2086 unquoted `$viol`, comment-before-shebang SC1128 — all caught by the implementer's TDD+shellcheck gate → plan-code is a DRAFT, the test gate is load-bearing. (2) the final whole-branch review caught 2 Important seam-bugs INVISIBLE to per-task reviews: target-repo `.claude/`-ignored silent no-op ([[LRN-066]]) + `NEXT.sh`-absence non-regeneration → holistic review earns its keep. (3) pressure-test confirmed the cold-resume discipline holds under temptation (the agent excluded the moved-HEAD `0034`). (4) a reviewer subagent bugged out once (user killed it) → re-dispatched clean (transient, not a finding).
|
- **anomalies**: (1) the PLAN's code carried 3 latent bugs — missing `git add` for new files, SC2086 unquoted `$viol`, comment-before-shebang SC1128 — all caught by the implementer's TDD+shellcheck gate → plan-code is a DRAFT, the test gate is load-bearing. (2) the final whole-branch review caught 2 Important seam-bugs INVISIBLE to per-task reviews: target-repo `.claude/`-ignored silent no-op ([[LRN-066]]) + `NEXT.sh`-absence non-regeneration → holistic review earns its keep. (3) pressure-test confirmed the cold-resume discipline holds under temptation (the agent excluded the moved-HEAD `0034`). (4) a reviewer subagent bugged out once (user killed it) → re-dispatched clean (transient, not a finding).
|
||||||
@@ -296,6 +247,7 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
|||||||
- **Method**: paired same-judge 3-majority per round (v2.1); judges live-exec where artifact executable (5 units: skills-perso, profile, plugin-pair, status-reporter, gitflow). Absolute scores triage-only. Totals main-thread (LRN-018 applied).
|
- **Method**: paired same-judge 3-majority per round (v2.1); judges live-exec where artifact executable (5 units: skills-perso, profile, plugin-pair, status-reporter, gitflow). Absolute scores triage-only. Totals main-thread (LRN-018 applied).
|
||||||
- **Anomalies**: (1) 0 reverts/ties in 60 verdicts — homogeneous-better checked: skeptic lens found real residuals 3x (doctor.sh cost source, hotfix RULES leftover restore, FILE(S) new-marker) → judges engaged. (2) census lock RED on line-rewrap, make test caught → LRN-144. (3) head-pipe masked grep exit 2x → LRN-143.
|
- **Anomalies**: (1) 0 reverts/ties in 60 verdicts — homogeneous-better checked: skeptic lens found real residuals 3x (doctor.sh cost source, hotfix RULES leftover restore, FILE(S) new-marker) → judges engaged. (2) census lock RED on line-rewrap, make test caught → LRN-144. (3) head-pipe masked grep exit 2x → LRN-143.
|
||||||
- **Action**: v2.1 paired = standard. Post-run absolute rescore skipped by design (would be judge-noise theater).
|
- **Action**: v2.1 paired = standard. Post-run absolute rescore skipped by design (would be judge-noise theater).
|
||||||
|
- **Status (2026-10-28)**: keep (Index Action, upgrade)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -385,6 +337,7 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
|||||||
- **Method**: 3 blind opus challengers (simplicity CONCERNS(3), robustness CONCERNS(6), correctness FATAL(8)) + 1 confirmation (CONCERNS(4)); every BLOCKER/MAJOR closed by a named plan change (r2, r3); then feater, GATE 0, verifier, security.
|
- **Method**: 3 blind opus challengers (simplicity CONCERNS(3), robustness CONCERNS(6), correctness FATAL(8)) + 1 confirmation (CONCERNS(4)); every BLOCKER/MAJOR closed by a named plan change (r2, r3); then feater, GATE 0, verifier, security.
|
||||||
- **Anomaly**: r1 carried 2 BLOCKER (explicit Agent `model` overridden at every step; Skill bridge answer shape refused by the output schema → doublon kept) + 10 MAJOR, all invisible to me: spike levers carried over as design (`agentsNext`, per-step model rewrite), a table copying 21 pins = third source of truth, writes on main from sub-agent loops. Confirmation found 4 more MAJOR (explicit params vs in-agent writes, `e.wait`, vacuous test assertions, haiku effort). Executor then DONE first pass, verifier CONFORME 6/6, security PASS: the plan was the whole risk.
|
- **Anomaly**: r1 carried 2 BLOCKER (explicit Agent `model` overridden at every step; Skill bridge answer shape refused by the output schema → doublon kept) + 10 MAJOR, all invisible to me: spike levers carried over as design (`agentsNext`, per-step model rewrite), a table copying 21 pins = third source of truth, writes on main from sub-agent loops. Confirmation found 4 more MAJOR (explicit params vs in-agent writes, `e.wait`, vacuous test assertions, haiku effort). Executor then DONE first pass, verifier CONFORME 6/6, security PASS: the plan was the whole risk.
|
||||||
- **Action**: a mod plan always goes through the full round + confirmation; test assertions must read the one line that carries the value; spike code is a FACT source, never a design source ([[BDR-115]], [[LRN-205]], [[LRN-206]]).
|
- **Action**: a mod plan always goes through the full round + confirmation; test assertions must read the one line that carries the value; spike code is a FACT source, never a design source ([[BDR-115]], [[LRN-205]], [[LRN-206]]).
|
||||||
|
- **Status (2026-10-28)**: keep the round, never dispatch a mod plan without it (Index Action, upgrade)
|
||||||
|
|
||||||
## EVAL-041 — model-router W1-C: the plan was the whole risk, two confirmations were needed
|
## EVAL-041 — model-router W1-C: the plan was the whole risk, two confirmations were needed
|
||||||
- **Date**: 2026-10-09
|
- **Date**: 2026-10-09
|
||||||
@@ -434,6 +387,7 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
|||||||
- **Action**: keep the single confirmation pass mandatory after any r2 that changes the mechanism (not just wording); when a plan says "fail closed", name the picker and its fallback value in the plan; TODO residuals (parentModel inheritance, usage lag, TTL const) carried, not dropped. Links [[BDR-116]], [[LRN-216]], [[EVAL-045]].
|
- **Action**: keep the single confirmation pass mandatory after any r2 that changes the mechanism (not just wording); when a plan says "fail closed", name the picker and its fallback value in the plan; TODO residuals (parentModel inheritance, usage lag, TTL const) carried, not dropped. Links [[BDR-116]], [[LRN-216]], [[EVAL-045]].
|
||||||
|
|
||||||
## EVAL-048 — model-router feat C: lenses killed r1 mechanism; second mechanism passed every gate first time
|
## EVAL-048 — model-router feat C: lenses killed r1 mechanism; second mechanism passed every gate first time
|
||||||
|
- **Date**: 2026-10-23
|
||||||
|
|
||||||
- **Method**: /feat. r1 = cap in `wantedModel` mirroring classifier. 3 blind lenses: correctness FATAL(4), robustness FATAL(5), simplicity CONCERNS(1). BLOCKERs: capped prompt slot shadowed held run (both correctness + robustness), probe-test one-line swap hangs (route tool answer probes), cap fail-open on `sessionModel` '' (/reload-plugins). r2 = effort-only routes at 3 writers + user pick (derived orchestrate too). 1 confirmation: SOLID, 5 MINOR applied (r2.1). feater DONE no deviation, 509 tests; GATE 0 12/12 MET; verifier CONFORME 14/14 1st pass; auditor PASS 0 findings; doc-sync SIGNIFICANT 5 patches.
|
- **Method**: /feat. r1 = cap in `wantedModel` mirroring classifier. 3 blind lenses: correctness FATAL(4), robustness FATAL(5), simplicity CONCERNS(1). BLOCKERs: capped prompt slot shadowed held run (both correctness + robustness), probe-test one-line swap hangs (route tool answer probes), cap fail-open on `sessionModel` '' (/reload-plugins). r2 = effort-only routes at 3 writers + user pick (derived orchestrate too). 1 confirmation: SOLID, 5 MINOR applied (r2.1). feater DONE no deviation, 509 tests; GATE 0 12/12 MET; verifier CONFORME 14/14 1st pass; auditor PASS 0 findings; doc-sync SIGNIFICANT 5 patches.
|
||||||
- **Anomalies**: author r1 claim "identical to classifier" false: classifier never runs under a held route, prompt rules do. First verifier dispatched on Fable died 429 (credits out): LRN-224 residual (spawn path unprobed) seen live; retry landed on opus floor. Push of remote branch delete + first /feat Skill call blocked by auto-mode classifier.
|
- **Anomalies**: author r1 claim "identical to classifier" false: classifier never runs under a held route, prompt rules do. First verifier dispatched on Fable died 429 (credits out): LRN-224 residual (spawn path unprobed) seen live; retry landed on opus floor. Push of remote branch delete + first /feat Skill call blocked by auto-mode classifier.
|
||||||
@@ -453,3 +407,9 @@ Dogfood: 3 blind lenses attacked the v1 plan for the plan-challenge feature itse
|
|||||||
- **Method**: 0d analyzer; brainstorm 4 user answers; plan r1 → r3 (correctness FATAL(5): SIGPIPE, rc 127, dry run on develop blocked, unchecked commit rc, 80 cols). SDD 12 tasks sonnet/medium, 12 task reviews clean (1 controller resolve avg, mostly attribution lines + oracle facts). RED (current skill stops at plugin-probe) → GREEN (S5 table, nothing written) → dry run on a branched scratch (2 rules in HEAD). Sonnet final review 3 Important → 89334f2. GATE 0 MET 14/20 runnable; verifier ECARTS(3) → ECARTS(1 = user MCP step); security PASS, 1 LOW. Opus/xhigh craft: 0 Critical, 2 Important, 8 Minor, ran the lib on the 6 real 0b targets (56 sections conserved) → 0b59687, re-review 0 open. `make test` all GREEN, suite PASS=93.
|
- **Method**: 0d analyzer; brainstorm 4 user answers; plan r1 → r3 (correctness FATAL(5): SIGPIPE, rc 127, dry run on develop blocked, unchecked commit rc, 80 cols). SDD 12 tasks sonnet/medium, 12 task reviews clean (1 controller resolve avg, mostly attribution lines + oracle facts). RED (current skill stops at plugin-probe) → GREEN (S5 table, nothing written) → dry run on a branched scratch (2 rules in HEAD). Sonnet final review 3 Important → 89334f2. GATE 0 MET 14/20 runnable; verifier ECARTS(3) → ECARTS(1 = user MCP step); security PASS, 1 LOW. Opus/xhigh craft: 0 Critical, 2 Important, 8 Minor, ran the lib on the 6 real 0b targets (56 sections conserved) → 0b59687, re-review 0 open. `make test` all GREEN, suite PASS=93.
|
||||||
- **Anomalies**: `extract` rc 0 on a failed rewrite passed 3 challengers + 12 task reviews + 1 final review: nobody tested an I/O failure (only logic refusals). `##`-only granularity misses faunosteo's payload (12.6 KB under `###`): found only because the reviewer ran the tool on the real targets. Headless proof 0 lines (model skipped Read). T10h-j named a guard the test could not observe. Brief tally arithmetic wrong (96 vs 93). Final review found 3 Important the 12 task reviews missed (dep-dir veto of `vendor/**`, misleading error, gitignore newline glue): per-task scope hides cross-task consequences.
|
- **Anomalies**: `extract` rc 0 on a failed rewrite passed 3 challengers + 12 task reviews + 1 final review: nobody tested an I/O failure (only logic refusals). `##`-only granularity misses faunosteo's payload (12.6 KB under `###`): found only because the reviewer ran the tool on the real targets. Headless proof 0 lines (model skipped Read). T10h-j named a guard the test could not observe. Brief tally arithmetic wrong (96 vs 93). Final review found 3 Important the 12 task reviews missed (dep-dir veto of `vendor/**`, misleading error, gitignore newline glue): per-task scope hides cross-task consequences.
|
||||||
- **Action**: Review Focus lists a failure-path test per function that rewrites a file; a tool meant for other repos gets a reviewer run on their real inputs before merge; a load proof prompt names the tool call ([[LRN-232]]); test names state the observable. Links [[BDR-128]], [[LRN-233]].
|
- **Action**: Review Focus lists a failure-path test per function that rewrites a file; a tool meant for other repos gets a reviewer run on their real inputs before merge; a load proof prompt names the tool call ([[LRN-232]]); test names state the observable. Links [[BDR-128]], [[LRN-233]].
|
||||||
|
|
||||||
|
## EVAL-052 — Memory v2: 12 review layers, each caught what green gates missed [keep] (2026-10-28)
|
||||||
|
- **Output**: phase 4a memory v2 (lib/memory.sh + 7 citer tasks + dialect migration), 2026-10-27/28.
|
||||||
|
- **Method**: 2 plan-challenge rounds (3 lenses each, reference lib run before the plan), 8 task reviews, 4 fix rounds on Task 8, verifier ×2, security gate, controller proof on 14 repo copies, opus xhigh final review + scoped re-review.
|
||||||
|
- **Anomalies**: each layer caught what earlier green layers missed. Challenge: two classifiers, BLK-019/020 false-open, uutils mkdir lock. Task reviews: G4 guard dodged by string split (rejected), `###` verdict flip ×4 shapes. Verifier: 3 EVAL Index actions lost. Controller proof: template path after `-C` (relative call only). Opus final, after all gates green: lock spin on unwritable `.git` (no rc), bare-prefix `status BLK` writing BLK-001, bullet-list Index facts dropped (trucks_at_work), 59+106 duplicate Date lines (`**Date** :` spacing). One implementer tried `--no-verify` in a temp repo (denied).
|
||||||
|
- **Action**: keep the full stack for libs that rewrite user data; add a real-data copy proof with the user's own invocation before the final review. [[BDR-129]], [[LRN-237]].
|
||||||
@@ -665,3 +665,6 @@ rules:
|
|||||||
- Phase 0b run (10 repos, faunosteo excluded: on the user's feature branch): 3 splits on chore/claude-md-split, merge on user go — zenquality 4 rules (Memory files 19.4k → 14.5k, project row 10k → 5k), game 2 rules (16k → 14.9k), angelscar356 1 rule (16.2k → 15.4k); 7 keep-everything (overview/stack/commands/structure/conventions only, S4 rule). `gitflow start` refreshed zenquality's own .githooks → S0 STOP on a dirty tree, committed as chore ed10340, re-dispatched. Three onboarder runs in parallel, one repo each, all clean first pass.
|
- Phase 0b run (10 repos, faunosteo excluded: on the user's feature branch): 3 splits on chore/claude-md-split, merge on user go — zenquality 4 rules (Memory files 19.4k → 14.5k, project row 10k → 5k), game 2 rules (16k → 14.9k), angelscar356 1 rule (16.2k → 15.4k); 7 keep-everything (overview/stack/commands/structure/conventions only, S4 rule). `gitflow start` refreshed zenquality's own .githooks → S0 STOP on a dirty tree, committed as chore ed10340, re-dispatched. Three onboarder runs in parallel, one repo each, all clean first pass.
|
||||||
- faunosteo split on the user's feature branch (user choice): 11 rules (10 ### under Project conventions + Docker), Memory files 31.9k → 27.2k, project row 22.3k → 17.7k, 7a75974. Phase 0b done: 4 repos split, 7 keep everything.
|
- faunosteo split on the user's feature branch (user choice): 11 rules (10 ### under Project conventions + Docker), Memory files 31.9k → 27.2k, project row 22.3k → 17.7k, 7a75974. Phase 0b done: 4 repos split, 7 keep everything.
|
||||||
- /feat extract-hardening (feature/extract-hardening 14a93e3 + docs 9160ce2): `_rules_out_path_ok` (absolute, `..`, exists or dangling link → rc 2, reason on stderr), mkdir + rule-write rc checked before the source rewrite, S0.3 prose in lib case order, 116 → 139 checks. Plan r1 `if ! { … } > "$out"` blind to a failed redirect (2 BLOCKER, bash 5.3.9 probe) → `|| { …; return 2; }`; r2 confirmation CONCERNS(1) (GNU mkdir stderr also says "cannot create"). Verifier CONFORME 8/8, security PASS. LRN-235. Three follow-ups in TODO (emit rc, rewrite keeps $tmp, lexical `..`). Merge on user go.
|
- /feat extract-hardening (feature/extract-hardening 14a93e3 + docs 9160ce2): `_rules_out_path_ok` (absolute, `..`, exists or dangling link → rc 2, reason on stderr), mkdir + rule-write rc checked before the source rewrite, S0.3 prose in lib case order, 116 → 139 checks. Plan r1 `if ! { … } > "$out"` blind to a failed redirect (2 BLOCKER, bash 5.3.9 probe) → `|| { …; return 2; }`; r2 confirmation CONCERNS(1) (GNU mkdir stderr also says "cannot create"). Verifier CONFORME 8/8, security PASS. LRN-235. Three follow-ups in TODO (emit rc, rewrite keeps $tmp, lexical `..`). Merge on user go.
|
||||||
|
|
||||||
|
## 2026-10-28
|
||||||
|
- Phase 4a memory v2 shipped on feature/memory-v2-write: lib/memory.sh single writer, registries v2 (9698473), shared parser fixes BLK-032..034, upgrade migrates 12/14 repos on copies (game, trucks_at_work refused). 2 challenge rounds + 8 task reviews + 4 Task 8 fix rounds + verifier x2 + opus final (lock spin, bare-prefix status, bullet Index). BDR-129, LRN-236, LRN-237, EVAL-052. Merge on user go.
|
||||||
+142
-236
File diff suppressed because it is too large.
Load diff
@@ -28,7 +28,10 @@ Shared rules for every phase:
|
|||||||
- [ ] `extract` rewrite failure mid-`cat` (ENOSPC/EIO after the truncation of `$src`): keep `$tmp` and name it on stderr instead of `rm -f` (today "$src not rewritten" can be false, the two copies gone; onboarder S1 rollback covers the split path, not direct lib use).
|
- [ ] `extract` rewrite failure mid-`cat` (ENOSPC/EIO after the truncation of `$src`): keep `$tmp` and name it on stderr instead of `rm -f` (today "$src not rewritten" can be false, the two copies gone; onboarder S1 rollback covers the split path, not direct lib use).
|
||||||
- [ ] shortcut `_rules_out_path_ok`: the `..` check is lexical, a symlinked parent component (`.claude` or `.claude/rules` pointing elsewhere) is not resolved; upgrade = `cd -P` on the parent dir, compare with `$PWD` (no portable `realpath -m`).
|
- [ ] shortcut `_rules_out_path_ok`: the `..` check is lexical, a symlinked parent component (`.claude` or `.claude/rules` pointing elsewhere) is not resolved; upgrade = `cd -P` on the parent dir, compare with `$PWD` (no portable `realpath -m`).
|
||||||
|
|
||||||
- [ ] **Phase 4a, memory v2 write side: shell, no mod** (shrunk 2026-10-25: the measured recall channels never read Meta; the measured status bug is a reconcile parser bug)
|
- [x] **Phase 4a, memory v2 write side: shell, no mod** (shrunk 2026-10-25: the measured recall channels never read Meta; the measured status bug is a reconcile parser bug)
|
||||||
|
- Done 2026-10-28 on feature/memory-v2-write (a423594..aab9e4d, registries v2 9698473): BDR-129, LRN-236, LRN-237, EVAL-052. memory suite 202/0, make test green.
|
||||||
|
- [ ] Phase 4a per-repo pass: `bash ~/.claude/lib/memory.sh -C <proj> upgrade` on a clean `.claude/memory`, one `chore/memory-v2` branch per repo, user approval each, commit via `/commit-change` when headings were rewritten (memory-commit rc 6 by design). Ready (proven on copies 2026-10-28): config, faunosteo, game-deploy ×2, integration_alphalink, robin_petier, zenquality, angelscar356, bchanot-cv, for_you, gitea-deploy, nuit-folle. Refused, user decision first: game (`## BDR-027/061 ADDENDUM` headings, duplicate BLK-008/014), trucks_at_work (bullet-list `## Index` holding BLK-001's closure).
|
||||||
|
- [ ] Phase 4a parked minors (ledger `.superpowers/sdd/2026-10-27-memory-v2-write/progress.md`): empty `memory.lock.steal` never stale (manual rm); `## Index` comment-edge mismatch; `upgrade` header doc lacks the non-table refusal; memory-commit rc 6 message misleading on a v1→v2 heading-rewrite upgrade; labelled "not resolved yet" reads resolved on v2; body `## ` line splits an entry (refuse at add); `-C` + relative `--body-file` (say absolute in § WRITE); tour/deploy/audit-delta § WRITE pointer; reconcile.sh:24-25 and :41-42 stale comments; `_mem_blob` → `git cat-file blob`; evals template "Later status" line; partial stage dropped on rc 6; 39 pre-existing >80-char lines in reconcile.sh / memory-commit.sh.
|
||||||
- Facts 2026-10-24 (scratchpad memeval, 434 entries): registries ~1M chars, never in always-on context, read only by /feat /bugfix /ship-feature (analyze-before-plan); Index drift 6 rows; status in 3 places (title tag, body Status line, Index column) → reconcile false-open BLK-032..034; no single writer (Edit needs a Read of a 357k file, so real writes are ad hoc python/bash); 8 projects on this machine hold v1 registries. Verified 2026-10-25: `lib/reconcile.sh:60-67` drops the entry's OWN header while BLK-032..034 carry `[resolved]` there (the false-open); nothing machine-reads `## Index` (analyze-before-plan.md:42, reconcile.sh:9, test T1); 1 of 1,290 entries across the 8 projects above a 1% accent ratio.
|
- Facts 2026-10-24 (scratchpad memeval, 434 entries): registries ~1M chars, never in always-on context, read only by /feat /bugfix /ship-feature (analyze-before-plan); Index drift 6 rows; status in 3 places (title tag, body Status line, Index column) → reconcile false-open BLK-032..034; no single writer (Edit needs a Read of a 357k file, so real writes are ad hoc python/bash); 8 projects on this machine hold v1 registries. Verified 2026-10-25: `lib/reconcile.sh:60-67` drops the entry's OWN header while BLK-032..034 carry `[resolved]` there (the false-open); nothing machine-reads `## Index` (analyze-before-plan.md:42, reconcile.sh:9, test T1); 1 of 1,290 entries across the 8 projects above a 1% accent ratio.
|
||||||
- `lib/memory.sh` = single writer, like gitflow.sh: `add <kind> --title --body-file [--status --supersedes]` allocates next ID from headings (never the Index) under `flock` (concurrent conversations, phase 5), appends the entry; `status <ID> <new>` appends a dated status line (append-only); `journal "<line>"`; `index` prints the Index on demand from headings; `check [--staged]` = the validator (heading pattern, ID = max+1 and unique, no removed line from an existing entry outside a /prune-memory commit, new BLK quotes ≥1 error verbatim). The validator runs in `add` and `check` + make test, NOT in the generated pre-commit (undecidable there, and it exits 0 on working branches). No English check (doctrine stays).
|
- `lib/memory.sh` = single writer, like gitflow.sh: `add <kind> --title --body-file [--status --supersedes]` allocates next ID from headings (never the Index) under `flock` (concurrent conversations, phase 5), appends the entry; `status <ID> <new>` appends a dated status line (append-only); `journal "<line>"`; `index` prints the Index on demand from headings; `check [--staged]` = the validator (heading pattern, ID = max+1 and unique, no removed line from an existing entry outside a /prune-memory commit, new BLK quotes ≥1 error verbatim). The validator runs in `add` and `check` + make test, NOT in the generated pre-commit (undecidable there, and it exits 0 on working branches). No English check (doctrine stays).
|
||||||
- Status: `reconcile_blk_current_status` reads the own-header `[tag]` first, then "last status-bearing line wins" (one parser, shared by memory.sh status and reconcile). Fixes BLK-032..034 false-open; regression test on those three.
|
- Status: `reconcile_blk_current_status` reads the own-header `[tag]` first, then "last status-bearing line wins" (one parser, shared by memory.sh status and reconcile). Fixes BLK-032..034 false-open; regression test on those three.
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# CONTRACT — memory-v2-write (phase 4a)
|
||||||
|
- date: 2026-10-27 | flow: ship-feature | branch: feature/memory-v2-write (off develop ae9a7e3)
|
||||||
|
- status: active
|
||||||
|
|
||||||
|
## REQUEST (verbatim — IMMUTABLE)
|
||||||
|
Phase 4a of the context mod queue (BDR-125), TODO.md "Phase 4a, memory v2 write side: shell, no mod": `lib/memory.sh` as the single registry writer, like gitflow.sh (`add <kind> --title --body-file [--status --supersedes]` allocating the next ID from headings under flock, `status <ID> <new>` appending a dated status line, `journal "<line>"`, `index` printed on demand from headings, `check [--staged]` validator in add/check + make test, not in the pre-commit); one shared status parser (own-header `[tag]` first, then last status-bearing line wins) fixing the BLK-032..034 false-open in reconcile with a regression test; the four generated `## Index` blocks removed in one /prune-memory curation and the Index steps dropped from capitalize, ship-feature, commit-changer, prune-memory § D; a per-file v2 marker so the 8 v1 projects keep working and doctor warns "registry v1"; citers patched (capitalize, close, prune-memory, CAPITALIZE steps of feat/bugfix/hotfix/ship-feature/commit-change, lib/capitalize-commit.md, lib/analyze-before-plan.md, lib/reconcile.sh, templates/memory, onboard/init-project, doctrine-citers census, CLAUDE.global.md Memory registries). Dropped: Meta line, backfill, scope/critical labels, triggers field, English validator. Proof: writer round-trip, flock race test, status parser on the three false-open BLKs + fixtures, v1 project untouched, make test green.
|
||||||
|
|
||||||
|
(user: "ok tu peux passer a la suite", 2026-10-27, after the phase 0b and extract-hardening merges.)
|
||||||
|
|
||||||
|
## CLARIFICATIONS
|
||||||
|
(pass A: scope gaps surfaced by the read-before, settled at the STEP 1 brainstorm — see [gated] rows below)
|
||||||
|
|
||||||
|
Q: files outside the seed FILE SCOPE that the approved plan (STEP 3 gate 2026-10-28, plan r3 Tasks 2/3/5/6) requires? / A: agents/analyzer.md (Task 5 citer), lib/tests/run-deterministic.sh (Task 3 chokepoint test), skills/reconcile/SKILL.md (Task 2 parser doc + test count), skills/prune-memory/tests/fixtures/red6-check/ added and red6-orphan/ deleted (Task 6: RED-6 asserted "no false ORPHAN INDEX", a check that only exists with an Index; § D removal makes it obsolete, red6-check replaces it as the flip test) [gated 2026-10-28, plan approval]
|
||||||
|
Q: EVAL Index "Action" column at upgrade? / A: the 2026-10-27 gate dropped the column on the premise the body carries **Action**; where the body has no status word, the Index action is materialized as a body status line (verifier gap 2026-10-28, EVAL-005/028/040) [gated 2026-10-27, refined 2026-10-28]
|
||||||
|
|
||||||
|
## ACCEPTANCE CRITERIA
|
||||||
|
1. `lib/memory.sh [-C dir] add <kind> --title <t> --body-file <f> [--status <s>] [--supersedes <ID>]` appends one entry `## <PREFIX>-NNN — <title> [<status>] (<date>)` + body at the end of the registry, NNN = max heading ID + 1, under a lock; prints the new ID on stdout; rc 2 with a named reason on a bad kind, a missing body file, a duplicate ID after allocation, or a validator failure (nothing written).
|
||||||
|
2. `memory.sh status <ID> <new>` appends a dated status line to that entry (inserted before the next heading, after the body), never rewrites an existing line; rc 2 when the ID does not exist.
|
||||||
|
3. `memory.sh journal "<line>"` appends the line under today's `## YYYY-MM-DD` heading, creating the heading at the end of journal.md when absent.
|
||||||
|
4. `memory.sh index [<registry>]` prints a markdown table (ID | Date | Title | Status) derived from headings and the status parser only; no `## Index` block is read.
|
||||||
|
5. `memory.sh check [--staged]` validates: heading shape, ID uniqueness, v2 marker present, no `## Index` block in a v2 file; `--staged` also refuses a removed line inside an existing entry. It runs inside `add` and in `make test`; the generated pre-commit hook is untouched.
|
||||||
|
6. One shared status parser (lib function used by memory.sh and lib/reconcile.sh): candidates are the entry's own header `[tag]` and labelled status lines only (never a free word in prose); the last candidate in document order wins. `reconcile_blk_open` on a fixture holding BLK-032..034 as written today returns none of them; the existing run-reconcile T1/T2 stay green.
|
||||||
|
7. The four `## Index` blocks of this repo's registries are removed in one deterministic step; every status or supersession that lived only in an Index row is first materialized as a status line in the entry body (oracle: parser(body) == former Index status for every such row); heading count unchanged.
|
||||||
|
8. Per-file v2 marker: every registry of this repo and the four registry templates `templates/memory/{decisions,learnings,blockers,evals}.md` carry it (journal is not a registry: no marker); a file without it is v1: the writer still appends, `check` reports it, and the per-project session banner warns `registry v1`.
|
||||||
|
9. Citers patched in the same branch: capitalize, close, prune-memory (§ D removed, STEP 3 status carrier = `memory.sh status`, STEP 4 verify = `memory.sh check`), CAPITALIZE steps of feat/bugfix/hotfix/ship-feature/commit-change, init-project, lib/capitalize-commit.md (rc 5 documented), lib/analyze-before-plan.md, lib/reconcile.sh, templates/memory, onboard; doctrine-citers census green.
|
||||||
|
10. CLAUDE.global.md "Memory registries": writes go only through `lib/memory.sh`; the "Registries load every session" premise replaced; the heading and the bold label `Always English, always caveman` kept (census); file line count not above today's 333.
|
||||||
|
11. Dropped, must NOT appear: Meta line, 434-entry backfill, scope/critical labels, triggers field, English validator.
|
||||||
|
12. Proof: writer round-trip test, concurrent-add race test (two adds, distinct IDs), status parser on BLK-032..034 fixtures, every other project's `.claude/memory/` untouched (no diff outside this repo), `make test` all green, shellcheck clean, every new lib line ≤ 80 chars, functions ≤ 25 logic lines / ≤ 5 locals / ≤ 5 params.
|
||||||
|
CHECK: make test 2>&1 | tail -1
|
||||||
|
EXPECT: all suites green
|
||||||
|
EVIDENCE: MET exit=0 marker-found :: all suites green
|
||||||
|
|
||||||
|
13. [gated 2026-10-28] `memory.sh upgrade` migrates every measured v1 dialect (hyphen, pipe, `###` headings, title-suffix status, `date: · status:`, `**Statut** :`, no frontmatter) to v2: headings normalized to `## ID — title (date)`, frontmatter added, open/closed verdict of every entry identical before and after (oracle), idempotent; proven on copies of the 13 other projects. Applying it to those repos is a later per-repo pass, not this branch.
|
||||||
|
|
||||||
|
## FILE SCOPE
|
||||||
|
lib/memory.sh (new), lib/tests/memory.test.sh (new), lib/tests/fixtures/* (new fixtures), lib/reconcile.sh, lib/tests/run-reconcile.sh, lib/memory-commit.sh, lib/capitalize-commit.md, lib/analyze-before-plan.md, skills/capitalize/SKILL.md, skills/close/SKILL.md, skills/prune-memory/SKILL.md (+ tests/run-deterministic.sh, test-prompts.json), skills/feat/SKILL.md, skills/bugfix/SKILL.md, skills/hotfix/SKILL.md, skills/ship-feature/SKILL.md, skills/commit-change/SKILL.md, agents/commit-changer.md, skills/init-project/SKILL.md, agents/onboarder.md, skills/onboard/SKILL.md, templates/memory/*.md, hooks/session-start.sh, CLAUDE.global.md (Memory registries), Makefile (suite glob already covers lib/tests/*.test.sh), .claude/memory/{decisions,learnings,blockers,evals}.md (Index removal + marker), mods/model-router/routing.json (only if a new row is needed), docs (CHANGELOG at STEP 8).
|
||||||
|
|
||||||
|
## PROOF — criterion 13 (controller, 2026-10-28, after 28c5a42)
|
||||||
|
Fresh scratchpad copies of the 14 project memory dirs, `bash lib/memory.sh -C <copy> upgrade` (relative lib path), then `check`, then a second upgrade (cksum): 13 rc 0 + check 0 + idempotent (config 2, robin_petier 6, zenquality 15, angelscar356 32, bchanot-cv 3 added status lines; others 0); game rc 2 (`## BDR-027 ADDENDUM`, `## BDR-061 ADDENDUM` headings, duplicate BLK IDs: plan Deviation 6, user decision at the per-repo pass); `git -C <orig> status --short .claude/memory` empty on all 14. The first run of this proof (before 28c5a42) found the template path resolved after the `-C` cd (rc 2 on config, faunosteo, for_you, trucks_at_work): fixed in 28c5a42, test T15-relpath.
|
||||||
|
PROOF update (after aab9e4d, final code review): trucks_at_work is now REFUSED (bullet-list `## Index` in decisions/learnings/blockers, facts would be lost; user decision at the per-repo pass, like game). Date counts corrected: the earlier zenquality 59 / angelscar356 106 were duplicates (`- **Date** :` spacing dialect, 65 and 106 such lines); now 0 and 1. 12/14 migrate, 2 refused untouched.
|
||||||
+1
-1
@@ -30,7 +30,7 @@ claude-config/
|
|||||||
├── mods/ # Claude Code mods (function-hooks plugins), loaded through the skills/<name> symlink
|
├── mods/ # Claude Code mods (function-hooks plugins), loaded through the skills/<name> symlink
|
||||||
├── skills-external/ # Vendored skill packs: gstack submodule, design skills, superpowers, agent-skills, MengTo scroll skills, 21st and Higgsfield packs (machine-owned copies gitignored)
|
├── skills-external/ # Vendored skill packs: gstack submodule, design skills, superpowers, agent-skills, MengTo scroll skills, 21st and Higgsfield packs (machine-owned copies gitignored)
|
||||||
├── templates/ # Per-project templates (CLAUDE.md, settings, memory registries, path-rule skeletons, deploy runbook, gitignore)
|
├── templates/ # Per-project templates (CLAUDE.md, settings, memory registries, path-rule skeletons, deploy runbook, gitignore)
|
||||||
└── lib/ # Shared libs: gitflow, profiles, vendoring, route doctrine, gates, archetypes, project-rule oracle, tests
|
└── lib/ # Shared libs: gitflow, memory registry writer, profiles, vendoring, route doctrine, gates, archetypes, project-rule oracle, tests
|
||||||
```
|
```
|
||||||
|
|
||||||
## Architecture principles
|
## Architecture principles
|
||||||
|
|||||||
@@ -19,8 +19,13 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
|||||||
- **/explain-diff skill**: turns a change (commit, range, branch, merge, PR, staged or uncommitted work) into one self-contained HTML page saved outside the repo, under `~/Documents/explanations/<project>/YYYY-MM-DD-<slug>.html`. The page has a background, an intuition built on toy data with HTML diagrams, a code walkthrough grouped by concern and a 5-question interactive quiz. Adapted from Geoffrey Litt's explain-diff gist. A bundled template (light and dark, works offline) and a checker (`scripts/check_explanation.py`: file name, location, sections, quiz, code escaping, no ASCII art, no em-dash) hold every page to the same floor. Routing row `reflect`; profiles full, max and dev.
|
- **/explain-diff skill**: turns a change (commit, range, branch, merge, PR, staged or uncommitted work) into one self-contained HTML page saved outside the repo, under `~/Documents/explanations/<project>/YYYY-MM-DD-<slug>.html`. The page has a background, an intuition built on toy data with HTML diagrams, a code walkthrough grouped by concern and a 5-question interactive quiz. Adapted from Geoffrey Litt's explain-diff gist. A bundled template (light and dark, works offline) and a checker (`scripts/check_explanation.py`: file name, location, sections, quiz, code escaping, no ASCII art, no em-dash) hold every page to the same floor. Routing row `reflect`; profiles full, max and dev.
|
||||||
- **Project path rules (CLAUDE.md split)**: `lib/project-rules.sh` (`check`, `matches`, `sections`, `extract`, `emit`, optional `-C <dir>`) is the glob oracle for `.claude/rules/<name>.md` rules, one-line `paths:` frontmatter, loaded on Read of a matching file; suite `lib/tests/project-rules.test.sh`. `/onboard split` classifies an existing project CLAUDE.md section by section behind a gate and moves the path-bound ones into rules on a `chore/claude-md-split` branch. `extract` also moves a `###` subsection (heading passed as `'### <title>'`; a bare heading stays `##`), which ends at the next heading of level 3 or less outside a fence, and `sections --depth 3` lists each `##` section's subsections with their sizes, so `/onboard split` can move a path-bound subsection out of an always-on parent (one `### <title>` row; a row's parent is never itself a move row). `extract` refuses an absolute `<out>`, one with a `..` part, or one that already exists (a dangling symlink included), with rc 2 and the reason on stderr, and leaves the source CLAUDE.md untouched when the rule directory or file cannot be written. `/onboard` and `/init-project` emit `docker`, `testing` and `ci` rules from `templates/project-rules/` when their globs match. This repo's CLAUDE.md now keeps its header, Health Stack and a pointer; four sections load as path rules.
|
- **Project path rules (CLAUDE.md split)**: `lib/project-rules.sh` (`check`, `matches`, `sections`, `extract`, `emit`, optional `-C <dir>`) is the glob oracle for `.claude/rules/<name>.md` rules, one-line `paths:` frontmatter, loaded on Read of a matching file; suite `lib/tests/project-rules.test.sh`. `/onboard split` classifies an existing project CLAUDE.md section by section behind a gate and moves the path-bound ones into rules on a `chore/claude-md-split` branch. `extract` also moves a `###` subsection (heading passed as `'### <title>'`; a bare heading stays `##`), which ends at the next heading of level 3 or less outside a fence, and `sections --depth 3` lists each `##` section's subsections with their sizes, so `/onboard split` can move a path-bound subsection out of an always-on parent (one `### <title>` row; a row's parent is never itself a move row). `extract` refuses an absolute `<out>`, one with a `..` part, or one that already exists (a dangling symlink included), with rc 2 and the reason on stderr, and leaves the source CLAUDE.md untouched when the rule directory or file cannot be written. `/onboard` and `/init-project` emit `docker`, `testing` and `ci` rules from `templates/project-rules/` when their globs match. This repo's CLAUDE.md now keeps its header, Health Stack and a pointer; four sections load as path rules.
|
||||||
- **InstructionsLoaded logger**: `hooks/instructions-loaded.sh`, wired in `settings.json`, appends one JSON line per instruction file loaded to `~/.claude/logs/instructions-loaded.jsonl` (rotated above 5 MB), the proof that a path rule loaded.
|
- **InstructionsLoaded logger**: `hooks/instructions-loaded.sh`, wired in `settings.json`, appends one JSON line per instruction file loaded to `~/.claude/logs/instructions-loaded.jsonl` (rotated above 5 MB), the proof that a path rule loaded.
|
||||||
|
- **Memory registries v2, single writer**: `lib/memory.sh` is the one writer and reader of the `.claude/memory/` registries (every verb takes an optional leading `-C <dir>`): `add <kind> --title … --body-file … [--status …] [--supersedes <ID>]` appends an entry with the next ID from the headings and prints only the new ID; `status <ID> <text>` appends a dated `**Status (<date>)**:` line; `journal <line>` appends under today's `## YYYY-MM-DD`; `index [<kind>]` prints ID, date, title and status from headings and bodies; `check [--staged]` verifies heading shape, unique IDs, no Index and no open fence (a v1 file is named, never failed); `upgrade` migrates v1 to v2 (Index-only dates and statuses become body lines, `format: 2` added, `## Index` removed, every v1 heading dialect becomes `## ID — title (date)`), after an oracle on IDs, check and blocker verdicts, else rc 2 with the file untouched (a duplicate ID or a non-table Index is refused). Writes run under a lock in the git common dir, on a verified backup restored on failure or signal. `templates/memory/` ships v2 templates; the session banner adds `registry v1: N file(s) (memory.sh check)` while a project registry is v1. Suite `lib/tests/memory.test.sh`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Registries are written only through `lib/memory.sh`, never by Edit (`CLAUDE.global.md`, Memory registries); every CAPITALIZE step (`/feat`, `/bugfix`, `/hotfix`, `/ship-feature`, `/capitalize`, `/init-project`, `/onboard`, `commit-changer`) writes through `lib/capitalize-commit.md` § WRITE.
|
||||||
|
- `lib/memory-commit.sh commit` runs `memory.sh check --staged` first: a staged v2 registry that removes or rewrites a line inside an entry, gains a duplicate ID, a bad heading or an open fence, or is deleted or downgraded is unstaged and refused with rc 6; v1 registries are skipped.
|
||||||
|
- `/prune-memory` drops its Index drift category (§ D): status fixes go through `memory.sh status`, merges through `memory.sh add --supersedes`, STEP 4 verifies with `memory.sh check` (`CHECK: OK`, was `INDEX SANITY: OK`).
|
||||||
|
- `lib/reconcile.sh` reads blocker status through the parser shared with `lib/memory.sh`: on v2, a heading `[tag]` or a labelled status line, last candidate wins, resolved/superseded/deprecated closes the entry; the lexical reader is kept for v1. This repo's registries are upgraded to v2.
|
||||||
- impeccable is the Build path for all UI: it replaces `frontend-design` on the design gate's `# GATE-BLOCK:` list and leads the Build line of the design doctrine. `frontend-design` stays installed as the light path for a one-off visual. Detector rule count corrected 45 to 61 (BDR-119).
|
- impeccable is the Build path for all UI: it replaces `frontend-design` on the design gate's `# GATE-BLOCK:` list and leads the Build line of the design doctrine. `frontend-design` stays installed as the light path for a one-off visual. Detector rule count corrected 45 to 61 (BDR-119).
|
||||||
- model-router `verbose: true` logs transitions only: one line when main changes model or effort (`model-router: main: fable/high → fable/xhigh (plan: route tool)`), one hand-off line per dispatch and one per later effort move of an agent, each with its cause; the per-step, "answered by", spawn, route-tool and skill-path lines are gone. An agent answering on a model other than the planned one is said once. A non-boolean `verbose` falls back to `false`, said once.
|
- model-router `verbose: true` logs transitions only: one line when main changes model or effort (`model-router: main: fable/high → fable/xhigh (plan: route tool)`), one hand-off line per dispatch and one per later effort move of an agent, each with its cause; the per-step, "answered by", spawn, route-tool and skill-path lines are gone. An agent answering on a model other than the planned one is said once. A non-boolean `verbose` falls back to `false`, said once.
|
||||||
- `verifier` and `security-auditor` run on a new `audit` phase (best/xhigh: Fable, Opus when Fable is down). Their frontmatter floor is `model: opus` (the verifier was `sonnet`): a fable floor would spawn the gates on a dead model during a credit outage. `judge` (big/xhigh, opus) keeps plan-challenger, analyzer and plugin-advisor. The `about` lines of `judge` and `verify` no longer claim audits or security review. The census `lib/tests/effort-routing.test.sh` floors a best-tier agent row on the tier's second alias (opus).
|
- `verifier` and `security-auditor` run on a new `audit` phase (best/xhigh: Fable, Opus when Fable is down). Their frontmatter floor is `model: opus` (the verifier was `sonnet`): a fable floor would spawn the gates on a dead model during a credit outage. `judge` (big/xhigh, opus) keeps plan-challenger, analyzer and plugin-advisor. The `about` lines of `judge` and `verify` no longer claim audits or security review. The census `lib/tests/effort-routing.test.sh` floors a best-tier agent row on the tier's second alias (opus).
|
||||||
@@ -41,6 +46,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
|||||||
- The five `effort-low` … `effort-max` skills, `lib/effort-pins.txt`, `lib/effort-pins.sh` and `lib/model-check.sh`, with their tests and the effort-pin re-apply steps of `install-plugins.sh` and `update-all.sh`. The model-router rows replace them. A typed `/effort-<level>` no longer exists: use `ultrathink` or `/route effort=max`. Breaking: the next release is 3.0.0.
|
- The five `effort-low` … `effort-max` skills, `lib/effort-pins.txt`, `lib/effort-pins.sh` and `lib/model-check.sh`, with their tests and the effort-pin re-apply steps of `install-plugins.sh` and `update-all.sh`. The model-router rows replace them. A typed `/effort-<level>` no longer exists: use `ultrathink` or `/route effort=max`. Breaking: the next release is 3.0.0.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- `/reconcile` no longer reports a v2 blocker as open because a status word appears in its title or prose (BLK-032..034).
|
||||||
- model-router probes the model main is about to run on, moved to or kept (the session's own model included), before routing main to it: with a model out of usage credits, every new session and hold lapse used to route main there, or keep it there, and lose the turn to a 429. That model is tried once with a small completion bounded to 8 s; a timeout or error marks it down (reason `probe`) and the decision is taken again once. A model that answered is not probed again until marked down (kept across `/clear`). `"probe": false` in `~/.claude/model-router.json` turns it off; `/route show` prints `probe:`. When a lower model stands in for its tier's held head, the phase's own effort goes one notch up (reflect xhigh, plan max, orchestrate high on Opus); explicit and floor efforts are never raised. Tests: `mods/model-router/hooks/register.test.ts`.
|
- model-router probes the model main is about to run on, moved to or kept (the session's own model included), before routing main to it: with a model out of usage credits, every new session and hold lapse used to route main there, or keep it there, and lose the turn to a 429. That model is tried once with a small completion bounded to 8 s; a timeout or error marks it down (reason `probe`) and the decision is taken again once. A model that answered is not probed again until marked down (kept across `/clear`). `"probe": false` in `~/.claude/model-router.json` turns it off; `/route show` prints `probe:`. When a lower model stands in for its tier's held head, the phase's own effort goes one notch up (reflect xhigh, plan max, orchestrate high on Opus); explicit and floor efforts are never raised. Tests: `mods/model-router/hooks/register.test.ts`.
|
||||||
- model-router residuals of waves 1-4 (2026-10-11): the kill switch fails closed (a `~/.claude/model-router.json` present but unreadable at first load, or an `enabled` that is not a boolean, turns the router off and says so; `/route reload` answers `config unreadable; previous config kept` instead of `config reloaded`); a prompt rule whose pattern nests quantifiers (`(a+)+$`) is dropped; a config file that is not a regular file reads as failed; every log of a caught error prints its kind and code only, never the message (a JSON parse error quotes the file); rejected table keys are masked in logs and model alias keys must be short printable names; `__proto__`, `constructor` and `prototype` are never read or written as keys; the agent offers map is capped like the descriptions; a `models` alias added without a `fallback` list is ranked at the end of the default chain (the upgrade gates now apply to it); a dated or variant id maps to its table id only at a `-` boundary (`claude-sonnet-5-50` no longer reads as sonnet); the status refresh and the main-decision log on the step path can no longer unroute a step; the route tool's failure answer says the route may be partly applied. `lib/tests/mods.test.sh` proves `claude plugin test` exists from its usage line (an unknown subcommand exits 0), `doctor.sh` bounds `claude plugin list --json` to 60 s, `update-all.sh` skips `@skills-dir` mods. Kit 428 → 431.
|
- model-router residuals of waves 1-4 (2026-10-11): the kill switch fails closed (a `~/.claude/model-router.json` present but unreadable at first load, or an `enabled` that is not a boolean, turns the router off and says so; `/route reload` answers `config unreadable; previous config kept` instead of `config reloaded`); a prompt rule whose pattern nests quantifiers (`(a+)+$`) is dropped; a config file that is not a regular file reads as failed; every log of a caught error prints its kind and code only, never the message (a JSON parse error quotes the file); rejected table keys are masked in logs and model alias keys must be short printable names; `__proto__`, `constructor` and `prototype` are never read or written as keys; the agent offers map is capped like the descriptions; a `models` alias added without a `fallback` list is ranked at the end of the default chain (the upgrade gates now apply to it); a dated or variant id maps to its table id only at a `-` boundary (`claude-sonnet-5-50` no longer reads as sonnet); the status refresh and the main-decision log on the step path can no longer unroute a step; the route tool's failure answer says the route may be partly applied. `lib/tests/mods.test.sh` proves `claude plugin test` exists from its usage line (an unknown subcommand exits 0), `doctor.sh` bounds `claude plugin list --json` to 60 s, `update-all.sh` skips `@skills-dir` mods. Kit 428 → 431.
|
||||||
- model-router residuals of the confirmation waves: a failed `/route forget` or `/route ask` write logs its cause and answers a generic text; forget answers clean every file-sourced name, phase and key; a restore names a frontmatter file only for a valid skill name and refuses a `__proto__` row; `/route forget` never restores `changed.phases`; the dialog's Change offers and writes shipped phases only (a machine-only phase never reaches routing.json, and an alias no shipped phase uses says so); a failure after the user answered keeps the key asked instead of asking again at every use.
|
- model-router residuals of the confirmation waves: a failed `/route forget` or `/route ask` write logs its cause and answers a generic text; forget answers clean every file-sourced name, phase and key; a restore names a frontmatter file only for a valid skill name and refuses a `__proto__` row; `/route forget` never restores `changed.phases`; the dialog's Change offers and writes shipped phases only (a machine-only phase never reaches routing.json, and an alias no shipped phase uses says so); a failure after the user answered keeps the key asked instead of asking again at every use.
|
||||||
|
|||||||
+4
-4
@@ -107,8 +107,8 @@ code" wins. Repo-specific instructions override both.
|
|||||||
|
|
||||||
## Memory registries (`.claude/memory/`)
|
## Memory registries (`.claude/memory/`)
|
||||||
Five registries persist across sessions; capitalize during and after work.
|
Five registries persist across sessions; capitalize during and after work.
|
||||||
Append-only: never rewrite past entries; curation (merge, supersede,
|
Append-only, written only through `bash ~/.claude/lib/memory.sh` (add,
|
||||||
compress) only via `/prune-memory`.
|
status, journal), never by Edit; curation only via `/prune-memory`.
|
||||||
|
|
||||||
| File | ID | Purpose |
|
| File | ID | Purpose |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
@@ -124,8 +124,8 @@ log → journal; whether the output actually worked → evals.
|
|||||||
|
|
||||||
**Always English, always caveman**: drop articles and filler, fragments OK,
|
**Always English, always caveman**: drop articles and filler, fragments OK,
|
||||||
short synonyms; technical terms, code blocks, quoted errors, IDs and dates
|
short synonyms; technical terms, code blocks, quoted errors, IDs and dates
|
||||||
exact. Pattern `[thing] [action] [reason]. [next step].` Registries load
|
exact. Pattern `[thing] [action] [reason]. [next step].` Planning flows
|
||||||
every session; caveman cuts ~40% of the tokens with no substance lost.
|
read the registries; caveman cuts ~40% of every read, no substance lost.
|
||||||
Applies to direct writes and to the CAPITALIZE step of every completion
|
Applies to direct writes and to the CAPITALIZE step of every completion
|
||||||
skill. Prompts to the user may mirror their language; the entry is English.
|
skill. Prompts to the user may mirror their language; the entry is English.
|
||||||
Legacy entries: compress on demand via `/prune-memory`.
|
Legacy entries: compress on demand via `/prune-memory`.
|
||||||
|
|||||||
+8
-2
@@ -60,8 +60,8 @@ for reg in decisions learnings blockers journal evals; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# 5. If LESSONS.legacy.md had useful entries, convert them manually into
|
# 5. If LESSONS.legacy.md had useful entries, convert each one with
|
||||||
# .claude/memory/learnings.md (LRN-XXX format) then delete LESSONS.legacy.md
|
# `bash ~/.claude/lib/memory.sh add learning --title … --body-file …`, then delete LESSONS.legacy.md
|
||||||
|
|
||||||
# 6. Update .gitignore - see "Gitignore patch" section below
|
# 6. Update .gitignore - see "Gitignore patch" section below
|
||||||
# (`bash ~/.claude/lib/gitflow.sh reconcile` appends only the missing
|
# (`bash ~/.claude/lib/gitflow.sh reconcile` appends only the missing
|
||||||
@@ -197,3 +197,9 @@ make doctor
|
|||||||
- **Git hooks in every repo**: `link.sh` sets git's global `core.hooksPath` to `~/.claude/githooks`. Every repo on the machine now gets the gitflow pre-commit guard and pushes each commit as it lands. For a foreign clone: `git config gitflow.protect false` and `git config gitflow.autopush false`.
|
- **Git hooks in every repo**: `link.sh` sets git's global `core.hooksPath` to `~/.claude/githooks`. Every repo on the machine now gets the gitflow pre-commit guard and pushes each commit as it lands. For a foreign clone: `git config gitflow.protect false` and `git config gitflow.autopush false`.
|
||||||
- **Default profile**: a machine with no profile selected now runs `full`. Check with `make profile-current`. Nine gstack skills (`ship`, `land-and-deploy`, `setup-deploy`, `autoplan`, `context-save`, `learn`, `careful`, `guard`, `design-shotgun`) left every profile and are denylisted.
|
- **Default profile**: a machine with no profile selected now runs `full`. Check with `make profile-current`. Nine gstack skills (`ship`, `land-and-deploy`, `setup-deploy`, `autoplan`, `context-save`, `learn`, `careful`, `guard`, `design-shotgun`) left every profile and are denylisted.
|
||||||
- **Higgsfield**: installed, off by default. Nothing to do until you enable it.
|
- **Higgsfield**: installed, off by default. Nothing to do until you enable it.
|
||||||
|
|
||||||
|
## Memory registries v2 (2026-10-28)
|
||||||
|
|
||||||
|
A v2 registry is the same `.claude/memory/<name>.md` file, versioned and pushed with the code, with `format: 2` in its frontmatter and no `## Index`. The session banner line `registry v1: N file(s) (memory.sh check)` flags a project still on v1. v1 stays readable and writable (lenient), and the `check --staged` chokepoint skips it.
|
||||||
|
|
||||||
|
To migrate, run `bash ~/.claude/lib/memory.sh -C <project> upgrade` on a clean `.claude/memory`, then commit through `/commit-change` when headings were rewritten (memory-commit refuses heading rewrites by design). `upgrade` refuses a registry with duplicate IDs or a non-table Index and leaves the file untouched: a human renumbers or converts first.
|
||||||
+1
-1
@@ -96,7 +96,7 @@ A surfaced ID left undisposed is the gap this closes. You judge bearing; the mai
|
|||||||
plan decides what to DO.
|
plan decides what to DO.
|
||||||
|
|
||||||
Read-only here too: reading registries is within Read/Grep; the "Do not modify files" rule
|
Read-only here too: reading registries is within Read/Grep; the "Do not modify files" rule
|
||||||
still forbids any write — Index backfill or new entries are never your job. Empty or absent
|
still forbids any write — new entries or status lines are never your job (writes go through lib/memory.sh). Empty or absent
|
||||||
registries → omit the section (no-op).
|
registries → omit the section (no-op).
|
||||||
Tracing what a destructive tool would do (a mirror, a sync with delete, a
|
Tracing what a destructive tool would do (a mirror, a sync with delete, a
|
||||||
recursive rm, a deploy script) is done by reading it, never by running it,
|
recursive rm, a deploy script) is done by reading it, never by running it,
|
||||||
|
|||||||
@@ -217,10 +217,7 @@ Otherwise:
|
|||||||
hash and substitute `(ref step <n>)` → `(ref commit <hash>)` in every
|
hash and substitute `(ref step <n>)` → `(ref commit <hash>)` in every
|
||||||
entry before writing. An entry that names no step (e.g. a pure LRN
|
entry before writing. An entry that names no step (e.g. a pure LRN
|
||||||
pattern) needs no ref.
|
pattern) needs no ref.
|
||||||
2. Append the resolved entries to their target registry file(s)
|
2. Write each resolved entry and one journal line for the batch per `$HOME/.claude/lib/capitalize-commit.md` § WRITE (`memory.sh -C <repo root> add …`, `memory.sh -C <repo root> journal …`; no Index to update).
|
||||||
(`.claude/memory/decisions.md`, `blockers.md`, `learnings.md`) and
|
|
||||||
update each file's `## Index` table. Add a one-line summary of the
|
|
||||||
commit batch to today's heading in `.claude/memory/journal.md`.
|
|
||||||
3. **Language rule**: written entries are ALWAYS in English and caveman,
|
3. **Language rule**: written entries are ALWAYS in English and caveman,
|
||||||
regardless of the language used in the dispatcher's approval exchange
|
regardless of the language used in the dispatcher's approval exchange
|
||||||
(CLAUDE.md "Memory registries", Always English, always caveman).
|
(CLAUDE.md "Memory registries", Always English, always caveman).
|
||||||
|
|||||||
+1
-1
@@ -123,7 +123,7 @@ ls ${PROJECT_ROOT}/.claude/tasks/TODO.md ${PROJECT_ROOT}/.claude/memory/ 2>/dev/
|
|||||||
# TODO
|
# TODO
|
||||||
<!-- Claude writes tasks here before implementing. Format: - [ ] task -->
|
<!-- Claude writes tasks here before implementing. Format: - [ ] task -->
|
||||||
```
|
```
|
||||||
- **.claude/memory/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/memory`, then for each of the 5 registries (`decisions.md`, `learnings.md`, `blockers.md`, `journal.md`, `evals.md`): if the file does not exist in `${PROJECT_ROOT}/.claude/memory/`, copy from `~/.claude/templates/memory/<name>.md` (YAML schema + empty index + inline template comment). If a registry file already exists → skip (do NOT overwrite).
|
- **.claude/memory/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/memory`, then for each of the 5 registries (`decisions.md`, `learnings.md`, `blockers.md`, `journal.md`, `evals.md`): if the file does not exist in `${PROJECT_ROOT}/.claude/memory/`, copy from `~/.claude/templates/memory/<name>.md` (YAML schema with `format: 2` + inline template comment; no Index, entries go through `lib/memory.sh`). If a registry file already exists → skip (do NOT overwrite).
|
||||||
- **.claude/audits/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/audits` (empty — populated later by `/onboard` audit phase).
|
- **.claude/audits/ missing** → `mkdir -p ${PROJECT_ROOT}/.claude/audits` (empty — populated later by `/onboard` audit phase).
|
||||||
|
|
||||||
**Do NOT overwrite existing content.**
|
**Do NOT overwrite existing content.**
|
||||||
|
|||||||
@@ -266,6 +266,19 @@ if [ -n "$REPO_DIR" ] && [ -f "$REPO_DIR/CLAUDE.global.md" ]; then
|
|||||||
fi
|
fi
|
||||||
unset _claude_lines
|
unset _claude_lines
|
||||||
fi
|
fi
|
||||||
|
# Registry v1 (BDR-125 phase 4a): a project registry without `format: 2`.
|
||||||
|
# The lib names each v1 registry on stderr (`memory: v1: <file>`).
|
||||||
|
_mem_lib="$(dirname "${BASH_SOURCE[0]}")/../lib/memory.sh"
|
||||||
|
if [ -f "$_mem_lib" ] && [ -d .claude/memory ]; then
|
||||||
|
_v1=$(bash "$_mem_lib" check .claude/memory 2>&1 >/dev/null \
|
||||||
|
| grep -c '^memory: v1:' || true)
|
||||||
|
if [ "${_v1:-0}" -gt 0 ]; then
|
||||||
|
printf "│ ⚠️ %-44s│\n" "registry v1: ${_v1} file(s) (memory.sh check)"
|
||||||
|
fi
|
||||||
|
unset _v1
|
||||||
|
fi
|
||||||
|
unset _mem_lib
|
||||||
|
|
||||||
# Version check: compare local vs remote (non-blocking)
|
# Version check: compare local vs remote (non-blocking)
|
||||||
_remote_ver=""
|
_remote_ver=""
|
||||||
if [ -n "$REPO_DIR" ] && [ -d "$REPO_DIR/.git" ] && [ -z "${SESSION_START_OFFLINE:-}" ]; then
|
if [ -n "$REPO_DIR" ] && [ -d "$REPO_DIR/.git" ] && [ -z "${SESSION_START_OFFLINE:-}" ]; then
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ blocker already solved.
|
|||||||
no-match) → no-op naturally; only the ABSENT / no-file case needed the guard. The REGEX
|
no-match) → no-op naturally; only the ABSENT / no-file case needed the guard. The REGEX
|
||||||
is the filter, not the file list: the glob also reads journal.md (date-keyed
|
is the filter, not the file list: the glob also reads journal.md (date-keyed
|
||||||
`## YYYY-MM-DD`) and any non-entry file, which contribute zero matches — no need to
|
`## YYYY-MM-DD`) and any non-entry file, which contribute zero matches — no need to
|
||||||
exclude them. Do NOT read the `## Index` table: it drifts (entries land in the body, the
|
exclude them. Do NOT read a `## Index` table (v1 registries may still carry one; it drifted 32-40% on a mature repo; v2 has none); headings cannot drift.
|
||||||
manual Index update lapses — measured 32-40% missing on a mature repo); headings cannot.
|
|
||||||
|
|
||||||
3. SELECT — IDs whose title bears on $REQUEST. Judge on titles (one dense line each), not
|
3. SELECT — IDs whose title bears on $REQUEST. Judge on titles (one dense line each), not
|
||||||
on bodies. Over-inclusion is SAFE: an entry that proves non-binding costs one bare ref
|
on bodies. Over-inclusion is SAFE: an entry that proves non-binding costs one bare ref
|
||||||
@@ -97,9 +96,8 @@ is not the current flow having TREATED it as a constraint. Re-surfacing is the f
|
|||||||
|
|
||||||
## HARD RULE — read-only
|
## HARD RULE — read-only
|
||||||
|
|
||||||
Touches nothing. No write, no Index update, no memory mutation. Symmetric to
|
Touches nothing. No write, no memory mutation. Symmetric to
|
||||||
capitalize-commit's surgical scope (there: stage ONLY memory; here: stage NOTHING). Index
|
capitalize-commit's surgical scope (there: stage ONLY memory; here: stage NOTHING). Registry writes go through `lib/memory.sh`, never this snippet.
|
||||||
backfill, if ever wanted, is `/prune-memory` passe D — never this snippet.
|
|
||||||
|
|
||||||
## ORDERING (orchestrators only)
|
## ORDERING (orchestrators only)
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# CAPITALIZE-COMMIT — couple the memory commit to the dev flow
|
# CAPITALIZE-COMMIT — couple the memory commit to the dev flow
|
||||||
|
|
||||||
Inline snippet. Include at the END of any dev flow's CAPITALIZE step, AFTER the
|
Inline snippet for any dev flow's CAPITALIZE step: § WRITE says how the approved
|
||||||
approved registry / journal / TODO entries are written. It commits ONLY the
|
registry and journal entries are written, then the rest commits ONLY the
|
||||||
memory, surgically, so the flow never leaves an uncommitted `.claude/memory`
|
memory, surgically, so the flow never leaves an uncommitted `.claude/memory`
|
||||||
behind and never embarks dangling code.
|
behind and never embarks dangling code.
|
||||||
|
|
||||||
This is the TAIL of capitalize, not a replacement: the SCAN + APPROVAL GATE that
|
This is the TAIL of capitalize, not a replacement: the SCAN + APPROVAL GATE that
|
||||||
decide WHAT to write are unchanged and run before this snippet. Only the COMMIT
|
decide WHAT to write are unchanged and run before this snippet; § WRITE then
|
||||||
of the already-approved entries is automated here.
|
writes them through lib/memory.sh and the COMMIT is automated here.
|
||||||
|
|
||||||
## WHEN TO RUN
|
## WHEN TO RUN
|
||||||
|
|
||||||
@@ -29,6 +29,26 @@ If a flow should stay fully silent on a trivial run, that is the FLOW's gate
|
|||||||
policy (e.g. hotfix skipping the journal line), not this snippet's concern —
|
policy (e.g. hotfix skipping the journal line), not this snippet's concern —
|
||||||
tune it there.
|
tune it there.
|
||||||
|
|
||||||
|
## WRITE (before the commit)
|
||||||
|
|
||||||
|
Registry entries and journal lines are written only by `lib/memory.sh`,
|
||||||
|
never by Edit or append; there is no `## Index` to update.
|
||||||
|
|
||||||
|
- Entry: caveman body to a scratch file, then
|
||||||
|
`bash "$HOME/.claude/lib/memory.sh" [-C <project root>] add
|
||||||
|
<decision|learning|blocker|eval> --title "<title>" --body-file <file>
|
||||||
|
[--status <status>] [--supersedes <ID>]`. One call per entry; it
|
||||||
|
allocates the ID under a lock and prints it. A blocker body quotes ≥1
|
||||||
|
error in backticks. `-C` when the cwd is not the project root.
|
||||||
|
- Status change on an existing entry:
|
||||||
|
`bash "$HOME/.claude/lib/memory.sh" status <ID> "<word> …"`, the text
|
||||||
|
starting with a status word (`resolved abc1234`, `open, reopened by …`,
|
||||||
|
`superseded by BDR-NNN`).
|
||||||
|
- Journal: `bash "$HOME/.claude/lib/memory.sh" journal "<line>"`.
|
||||||
|
- rc 2 names its reason (title chars, empty body, a status not starting
|
||||||
|
with a status word, an open code fence in the body or the registry,
|
||||||
|
unknown ID, lock busy): fix the input and re-run.
|
||||||
|
|
||||||
## DO
|
## DO
|
||||||
|
|
||||||
1. Compose the message from the IDs just written + the flow, matching repo style
|
1. Compose the message from the IDs just written + the flow, matching repo style
|
||||||
@@ -48,6 +68,16 @@ tune it there.
|
|||||||
- rc 3 → unsafe git state (detached / merge in progress);
|
- rc 3 → unsafe git state (detached / merge in progress);
|
||||||
memory stays in the working tree for a manual
|
memory stays in the working tree for a manual
|
||||||
commit — surface the helper's stderr.
|
commit — surface the helper's stderr.
|
||||||
|
- rc 5 → `git commit` rejected (hook, protected branch,
|
||||||
|
signing); nothing committed, surface stderr.
|
||||||
|
- rc 6 → `memory.sh check --staged` refused, nothing
|
||||||
|
committed, nothing left staged. Two causes,
|
||||||
|
named on stderr: a line removed inside an
|
||||||
|
existing v2 entry (only appends pass), or a NEW
|
||||||
|
culprit (duplicate ID, heading shape); an open
|
||||||
|
code fence counts even when it predates the
|
||||||
|
commit. Fix the file, then commit the fix with
|
||||||
|
/commit-change; never bypass the helper.
|
||||||
|
|
||||||
`<mem_hash>` is the MEMORY commit (the one that ADDS the entries). It is NOT
|
`<mem_hash>` is the MEMORY commit (the one that ADDS the entries). It is NOT
|
||||||
the code-commit hash that capitalize anchored INSIDE the entries
|
the code-commit hash that capitalize anchored INSIDE the entries
|
||||||
|
|||||||
+15
-1
@@ -7,7 +7,9 @@
|
|||||||
# happens to be dirty or staged is NEVER embarked.
|
# happens to be dirty or staged is NEVER embarked.
|
||||||
#
|
#
|
||||||
# Usage (CLI):
|
# Usage (CLI):
|
||||||
# memory-commit.sh commit "<message>" # surgical commit; exit 0 ok/no-op, 3 unsafe state
|
# memory-commit.sh commit "<message>"
|
||||||
|
# # surgical commit; exit 0 ok/no-op, 3 unsafe state,
|
||||||
|
# # 5 commit rejected, 6 check refused
|
||||||
#
|
#
|
||||||
# Output contract for `commit`: diagnostics go to stderr; on a real commit the
|
# Output contract for `commit`: diagnostics go to stderr; on a real commit the
|
||||||
# short hash of the MEMORY commit is the ONLY thing on stdout (empty on no-op or
|
# short hash of the MEMORY commit is the ONLY thing on stdout (empty on no-op or
|
||||||
@@ -18,6 +20,7 @@
|
|||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
MC_PATHS=(".claude/memory" ".claude/tasks")
|
MC_PATHS=(".claude/memory" ".claude/tasks")
|
||||||
|
MC_MEMORY_SH="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)/memory.sh"
|
||||||
|
|
||||||
_in_git_repo() { git rev-parse --git-dir >/dev/null 2>&1; }
|
_in_git_repo() { git rev-parse --git-dir >/dev/null 2>&1; }
|
||||||
|
|
||||||
@@ -68,6 +71,17 @@ commit_memory() {
|
|||||||
# then commit ONLY those paths. The pathspec on `git commit` makes it a partial
|
# then commit ONLY those paths. The pathspec on `git commit` makes it a partial
|
||||||
# commit: other staged files (dangling code) are not recorded.
|
# commit: other staged files (dangling code) are not recorded.
|
||||||
git add -- "${changed[@]}"
|
git add -- "${changed[@]}"
|
||||||
|
# Chokepoint (BDR-125 phase 4a): a staged v2 registry may only grow and
|
||||||
|
# never gains a new culprit (duplicate ID, bad heading, open fence). v1
|
||||||
|
# registries are skipped. Unstage on refusal so no later plain commit
|
||||||
|
# sweeps the refused change in.
|
||||||
|
if [ -d .claude/memory ] \
|
||||||
|
&& ! bash "$MC_MEMORY_SH" check --staged .claude/memory; then
|
||||||
|
git reset -q -- "${changed[@]}"
|
||||||
|
echo "memory-commit: REFUSED — memory.sh check --staged failed (above);" \
|
||||||
|
"NOTHING committed, nothing left staged." >&2
|
||||||
|
return 6
|
||||||
|
fi
|
||||||
if git diff --cached --quiet -- "${changed[@]}"; then
|
if git diff --cached --quiet -- "${changed[@]}"; then
|
||||||
echo "memory-commit: only ignored/no-op changes — no-op" >&2
|
echo "memory-commit: only ignored/no-op changes — no-op" >&2
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Executable
+797
@@ -0,0 +1,797 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# lib/memory.sh — the single writer and reader of the .claude/memory
|
||||||
|
# registries (BDR-125 phase 4a). Sourceable; every verb takes an optional
|
||||||
|
# leading `-C <dir>` (a dispatched agent's cwd is the session's, never the
|
||||||
|
# project's):
|
||||||
|
# add <kind> --title <t> --body-file <f> [--status <s>] [--supersedes <ID>]
|
||||||
|
# append one entry, next ID from the headings, under the
|
||||||
|
# lock; the new ID is the only stdout line
|
||||||
|
# status <ID> <text> append `- **Status (<date>)**: <text>` to the entry;
|
||||||
|
# <text> starts with a status word ("open, reopened by …")
|
||||||
|
# journal <line> append `- <line>` under today's `## YYYY-MM-DD`
|
||||||
|
# index [<kind>] ID | Date | Title | Status, from headings and bodies
|
||||||
|
# check [--staged] [<memory-dir>] heading shape, unique IDs, no Index,
|
||||||
|
# no open fence in a v2 file (v1 reported, never failed);
|
||||||
|
# --staged: only NEW culprits vs HEAD, no line removed
|
||||||
|
# inside an entry, no v2 registry deleted or downgraded
|
||||||
|
# upgrade [<memory-dir>] v1 → v2: Index-only dates and statuses become
|
||||||
|
# body lines, `format: 2`, `## Index` removed; a missing
|
||||||
|
# frontmatter comes from the template, ` - ` / ` | date | `
|
||||||
|
# / `###` headings take the `## ID — title (date)` shape;
|
||||||
|
# a blocker whose open / closed verdict (reconcile's v1
|
||||||
|
# reader) would move gets a `Status (…, upgrade)` line; the
|
||||||
|
# oracle (IDs, check, verdicts) runs first, else rc 2
|
||||||
|
# <kind> = decision | learning | blocker | eval. MEMORY_DATE overrides today.
|
||||||
|
# Status of an entry: the last candidate wins. A candidate is the heading's
|
||||||
|
# trailing `[tag]`, or a body line whose bold label names Status, Resolution,
|
||||||
|
# Action, UPDATE or FINAL (v1: `Status:`), holding a status word. A word in
|
||||||
|
# prose (title included) is never one (the BLK-032..034 false-open). A dated
|
||||||
|
# `**Status (YYYY-MM-DD…)**:` line reads its leading word; other lines rank
|
||||||
|
# words in _MEM_WORDS order, `open` last: "accepted, check OPEN" = accepted.
|
||||||
|
# Closed = resolved | superseded | deprecated (memory_closed).
|
||||||
|
# Lock: <git-common-dir>/memory.lock created under noclobber (flock(1) is
|
||||||
|
# absent on macOS), holding "<epoch> <token>"; released only by its token;
|
||||||
|
# a lock older than 30 s (or seen empty 10 times) is stolen by one waiter
|
||||||
|
# at a time (memory.lock.steal). Every writer runs on a verified backup
|
||||||
|
# of its file, restored on failure or signal. Next ID = max over headings
|
||||||
|
# of any level, fenced or not. Free text reaches awk through ENVIRON,
|
||||||
|
# never `-v` (which expands backslash escapes).
|
||||||
|
|
||||||
|
# absolute before any `-C` cd: a relative $0 no longer resolves after it
|
||||||
|
_MEM_LIB_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
MEM_GREP="${MEM_GREP:-/usr/bin/grep}"
|
||||||
|
_MEM_TABLE='decision decisions BDR
|
||||||
|
learning learnings LRN
|
||||||
|
blocker blockers BLK
|
||||||
|
eval evals EVAL'
|
||||||
|
_MEM_WORDS='resolved superseded deprecated upstream accepted implemented'
|
||||||
|
_MEM_WORDS+=' shipped proposed keep correct deprecate open'
|
||||||
|
_MEM_AWK='
|
||||||
|
function mem_word(s, t, i, n, w) {
|
||||||
|
t = tolower(s); n = split(MEMW, w, " ")
|
||||||
|
for (i = 1; i <= n; i++)
|
||||||
|
if (t ~ ("(^|[^a-z])" w[i] "([^a-z]|$)")) return w[i]
|
||||||
|
return "" }
|
||||||
|
function mem_lead(s, v, i, n, w) {
|
||||||
|
v = s; sub(/^[^:]*\*\*: */, "", v); v = tolower(v)
|
||||||
|
sub(/[^a-z].*$/, "", v); n = split(MEMW, w, " ")
|
||||||
|
for (i = 1; i <= n; i++) if (v == w[i]) return v
|
||||||
|
return "" }
|
||||||
|
function mem_lineword(s, w) {
|
||||||
|
if (s ~ /^- \*\*Status \([0-9]/ && (w = mem_lead(s)) != "") return w
|
||||||
|
return mem_word(s) }
|
||||||
|
function mem_tag(line) {
|
||||||
|
if (!match(line, /\[[^]]*\]( \([0-9-]+\))? *$/)) return ""
|
||||||
|
if (mem_word(substr(line, RSTART)) == "") return ""
|
||||||
|
line = substr(line, RSTART); sub(/\].*$/, "]", line); return line }
|
||||||
|
function mem_cand(line, lab) {
|
||||||
|
if (line ~ /^- \*\*[^*]+\*\*/) {
|
||||||
|
lab = line; sub(/^- \*\*/, "", lab); sub(/\*\*.*/, "", lab)
|
||||||
|
if (tolower(lab) !~ /status|resolution|action|update|final/) return ""
|
||||||
|
return mem_lineword(line) }
|
||||||
|
if (line ~ /^(- )?[Ss]tatus:/) return mem_word(line)
|
||||||
|
return "" }
|
||||||
|
function mem_key(line, key, c) {
|
||||||
|
if (index(line, "## " key) != 1) return 0
|
||||||
|
c = substr(line, length(key) + 4, 1)
|
||||||
|
return c == "" || c !~ /[0-9A-Za-z]/ }
|
||||||
|
function mem_want(p, c, st, w) {
|
||||||
|
w = mem_word(c)
|
||||||
|
if (w == "") return ""
|
||||||
|
if (p == "EVAL") return st == "" ? c : ""
|
||||||
|
if (p == "LRN") return c ~ /^superseded by/ ? c : ""
|
||||||
|
if (st == "" || (w ~ /^(superseded|deprecated)$/ && st != w)) return c
|
||||||
|
return "" }
|
||||||
|
'
|
||||||
|
|
||||||
|
_mem_date() { printf '%s\n' "${MEMORY_DATE:-$(date +%F)}"; }
|
||||||
|
|
||||||
|
_mem_table() { # <out col> [<key col> <value>] → matching cells, rc 2 if none
|
||||||
|
# the one reader of _MEM_TABLE (1 kind, 2 registry basename, 3 prefix)
|
||||||
|
awk -v o="$1" -v c="${2:-0}" -v v="${3:-}" '
|
||||||
|
c == 0 || $c == v { print $o; f = 1 }
|
||||||
|
END { exit f ? 0 : 2 }' <<< "$_MEM_TABLE"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_names() { _mem_table 2; } # the four registry basenames
|
||||||
|
|
||||||
|
_mem_kind() { # <kind> → "<file>.md <PREFIX>", rc 2 when unknown
|
||||||
|
local file
|
||||||
|
file=$(_mem_table 2 1 "$1") || {
|
||||||
|
echo "memory: unknown kind: $1 (decision|learning|blocker|eval)" >&2
|
||||||
|
return 2; }
|
||||||
|
echo "$file.md $(_mem_table 3 1 "$1")"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_id_file() { # <ID> → its registry path, rc 2 when the prefix is unknown
|
||||||
|
local file
|
||||||
|
[[ "$1" =~ ^[A-Z]+-[0-9][0-9][0-9]+$ ]] \
|
||||||
|
|| { echo "memory: not an entry ID: $1" >&2; return 2; }
|
||||||
|
file=$(_mem_table 2 3 "${1%%-[0-9]*}") \
|
||||||
|
|| { echo "memory: not an entry ID: $1" >&2; return 2; }
|
||||||
|
echo ".claude/memory/$file.md"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_prefix() { # <registry path> → its prefix by basename, rc 2 if none
|
||||||
|
local base="${1##*/}"
|
||||||
|
_mem_table 3 2 "${base%.md}" \
|
||||||
|
|| { echo "memory: $1: not a registry name" >&2; return 2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_is_v2() { # <file> → rc 0 when the frontmatter carries `format: 2`
|
||||||
|
awk 'NR == 1 && $0 != "---" { exit }
|
||||||
|
NR > 1 && $0 == "---" { exit }
|
||||||
|
$0 == "format: 2" { v2 = 1; exit }
|
||||||
|
END { exit !v2 }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_has_id() { # <file> <ID> → rc 0 when a heading carries the ID
|
||||||
|
MEM_K="$2" awk "$_MEM_AWK"'
|
||||||
|
BEGIN { k = ENVIRON["MEM_K"] }
|
||||||
|
/^```/ { fence = !fence; next }
|
||||||
|
!fence && mem_key($0, k) { found = 1; exit }
|
||||||
|
END { exit !found }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_next_id() { # <file> <PREFIX> → max heading ID + 1, zero-padded
|
||||||
|
# every heading level, fenced or not: a gap is harmless, a duplicate is
|
||||||
|
# not (trucks_at_work writes `### BDR-001`; a stray fence hides headings)
|
||||||
|
awk -v p="$2" '
|
||||||
|
match($0, "^#+ *" p "-[0-9]+") {
|
||||||
|
n = substr($0, RSTART, RLENGTH); sub(/^#+ *[A-Z]+-/, "", n)
|
||||||
|
if (n + 0 > m) m = n + 0 }
|
||||||
|
END { printf "%s-%03d\n", p, m + 1 }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_heading_has() { # <file> <ID> → rc 0 when a heading of any level has it
|
||||||
|
awk -v id="$2" 'match($0, "^#+ *" id "([^0-9]|$)") { f = 1; exit }
|
||||||
|
END { exit !f }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_fence_open() { # <file> → rc 0 when a ``` fence is left open
|
||||||
|
awk '/^```/ { n++ } END { exit !(n % 2) }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_entry_status() { # <file> <ID> → the winning candidate, rc 1 if none
|
||||||
|
# a heading candidate prints its `[tag]` only, never the title
|
||||||
|
MEM_K="$2" awk -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
BEGIN { k = ENVIRON["MEM_K"] }
|
||||||
|
/^```/ { fence = !fence; next }
|
||||||
|
fence { next }
|
||||||
|
/^## / { if (on) exit
|
||||||
|
if (mem_key($0, k)) { on = 1; t = mem_tag($0)
|
||||||
|
if (t != "") last = t }
|
||||||
|
next }
|
||||||
|
on && mem_cand($0) != "" { last = $0 }
|
||||||
|
END { if (last == "") exit 1; print last }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_status_word() { # <line> → its status word, else its first 40 chars
|
||||||
|
MEM_L="$1" awk -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
BEGIN { s = ENVIRON["MEM_L"]; w = mem_lineword(s)
|
||||||
|
print (w != "" ? w : substr(s, 1, 40)) }'
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_closed() { # <status word> → rc 0 when it closes the entry
|
||||||
|
case "$1" in resolved|superseded|deprecated) return 0 ;; esac
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_lock_path() { # → the lock file for the current repository
|
||||||
|
local d
|
||||||
|
if d=$(git rev-parse --git-common-dir 2>/dev/null); then
|
||||||
|
echo "$d/memory.lock"; return
|
||||||
|
fi
|
||||||
|
echo "${TMPDIR:-/tmp}/memory-$(pwd | cksum | cut -d' ' -f1).lock"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_stale() { # <lock content> <times seen empty> → rc 0 when stealable
|
||||||
|
local t="${1%% *}"
|
||||||
|
if [ -z "$1" ]; then [ "$2" -ge 10 ]; return; fi
|
||||||
|
case "$t" in ''|*[!0-9]*) return 1 ;; esac
|
||||||
|
[ $(( $(date +%s) - t )) -gt 30 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_steal() { # <lock> → remove a stale lock; one stealer at a time
|
||||||
|
local g="$1.steal" seen
|
||||||
|
if ! (set -C; date +%s > "$g") 2>/dev/null; then
|
||||||
|
_mem_stale "$(cat "$g" 2>/dev/null) x" 0 && rm -f "$g" # dead stealer
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
seen=$(cat "$1" 2>/dev/null)
|
||||||
|
_mem_stale "$seen" 10 && rm -f "$1" # age re-read under the guard
|
||||||
|
rm -f "$g"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_lock() { # <lock file> <token> → rc 0 held, rc 2 after MEM_LOCK_TRIES
|
||||||
|
# noclobber = open(O_EXCL) by bash itself: mkdir is not atomic under
|
||||||
|
# uutils coreutils 0.10 (two concurrent mkdir both succeed)
|
||||||
|
local lock="$1" tries=0 empty=0 t
|
||||||
|
[ -w "$(dirname "$lock")" ] \
|
||||||
|
|| { echo "memory: cannot create lock: $lock" >&2; return 2; }
|
||||||
|
until (set -C; echo "$(date +%s) $2" > "$lock") 2>/dev/null; do
|
||||||
|
t=$(cat "$lock" 2>/dev/null)
|
||||||
|
if [ -z "$t" ]; then empty=$((empty + 1)); else empty=0; fi
|
||||||
|
if _mem_stale "$t" "$empty"; then _mem_steal "$lock"; fi
|
||||||
|
tries=$((tries + 1))
|
||||||
|
[ "$tries" -lt "${MEM_LOCK_TRIES:-50}" ] \
|
||||||
|
|| { echo "memory: lock busy: $lock" >&2; return 2; }
|
||||||
|
sleep 0.2
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_unlock() { # <lock> <token> → remove the lock only when it is ours
|
||||||
|
[ "$(cut -d' ' -f2 < "$1" 2>/dev/null)" = "$2" ] && rm -f "$1"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_restore() { # <backup> <file> → put the verified copy back if changed
|
||||||
|
[ -s "$1" ] || return 0
|
||||||
|
cmp -s "$1" "$2" && return 0
|
||||||
|
cat "$1" > "$2" && echo "memory: $2 restored" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_backed() { # <fn> <file> [args…] → fn on a verified backup of <file>,
|
||||||
|
# restored when fn fails or a signal lands. Runs inside _mem_locked: the
|
||||||
|
# trap reads that frame's __mem_lock / __mem_tok (dynamic scope), and
|
||||||
|
# every name here is __-prefixed so fn's own locals never shadow it.
|
||||||
|
local __mem_bak __mem_file="$2" __mem_old __mem_rc
|
||||||
|
__mem_bak=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
if ! { cat "$2" > "$__mem_bak" && cmp -s "$2" "$__mem_bak"; }; then
|
||||||
|
rm -f "$__mem_bak"; echo "memory: backup of $2 failed, nothing written" >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
__mem_old=$(trap -p INT TERM HUP)
|
||||||
|
trap '_mem_restore "$__mem_bak" "$__mem_file"
|
||||||
|
_mem_unlock "$__mem_lock" "$__mem_tok"; exit 130' INT TERM HUP
|
||||||
|
"$@"; __mem_rc=$?
|
||||||
|
trap - INT TERM HUP; eval "$__mem_old"
|
||||||
|
[ "$__mem_rc" = 0 ] || _mem_restore "$__mem_bak" "$__mem_file"
|
||||||
|
rm -f "$__mem_bak"
|
||||||
|
return "$__mem_rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_locked() { # <fn> <file> [args…] → fn under the lock, its rc; fn's
|
||||||
|
local __mem_lock __mem_tok out rc # stdout is printed after the unlock
|
||||||
|
__mem_lock=$(_mem_lock_path); __mem_tok="$$.$RANDOM"
|
||||||
|
out=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
_mem_lock "$__mem_lock" "$__mem_tok" || { rm -f "$out"; return 2; }
|
||||||
|
_mem_backed "$@" > "$out"; rc=$?
|
||||||
|
_mem_unlock "$__mem_lock" "$__mem_tok"
|
||||||
|
cat "$out"; rm -f "$out"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_one_line() { # <what> <text> → rc 2 when empty or multi-line
|
||||||
|
case "$2" in
|
||||||
|
''|*$'\n'*) echo "memory: $1 must be one non-empty line" >&2; return 2 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_insert() { # <file> <key> <line> [exact] → line ends the section,
|
||||||
|
local tmp # rc 1 if absent; exact: the heading is `## <key>` alone
|
||||||
|
tmp=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
MEM_K="$2" MEM_INS="$3" MEM_X="${4:-}" awk "$_MEM_AWK"'
|
||||||
|
BEGIN { k = ENVIRON["MEM_K"]; ins = ENVIRON["MEM_INS"]
|
||||||
|
x = ENVIRON["MEM_X"] != "" }
|
||||||
|
function hit(l) { return x ? l == "## " k : mem_key(l, k) }
|
||||||
|
function flush( i) { print ins; for (i = 1; i <= n; i++) print buf[i]
|
||||||
|
n = 0; done = 1 }
|
||||||
|
/^```/ { fence = !fence }
|
||||||
|
on && !fence && /^## / { flush(); on = 0 }
|
||||||
|
!done && !on && !fence && hit($0) { on = 1; print; next }
|
||||||
|
on { if ($0 == "" || $0 == "---") { buf[++n] = $0; next }
|
||||||
|
for (i = 1; i <= n; i++) print buf[i]; n = 0; print; next }
|
||||||
|
{ print }
|
||||||
|
END { if (on) flush(); exit !done }' "$1" > "$tmp"
|
||||||
|
case $? in
|
||||||
|
0) cat "$tmp" > "$1" || {
|
||||||
|
echo "memory: write-back of $1 failed; full copy kept: $tmp" >&2
|
||||||
|
return 2; } ;;
|
||||||
|
*) rm -f "$tmp"; return 1 ;;
|
||||||
|
esac
|
||||||
|
rm -f "$tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_status_text() { # <text> → rc 2 unless it starts with a status word
|
||||||
|
local w
|
||||||
|
w=$(tr '[:upper:]' '[:lower:]' <<< "${1%%[^A-Za-z]*}")
|
||||||
|
case " $_MEM_WORDS " in *" $w "*) [ -n "$w" ] && return 0 ;; esac
|
||||||
|
echo "memory: status text starts with a status word: $_MEM_WORDS" >&2
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_status() { # <ID> <text>
|
||||||
|
local file rc
|
||||||
|
_mem_one_line "status text" "$2" || return 2
|
||||||
|
_mem_status_text "$2" || return 2
|
||||||
|
file=$(_mem_id_file "$1") || return 2
|
||||||
|
[ -f "$file" ] || { echo "memory: no registry: $file" >&2; return 2; }
|
||||||
|
_mem_locked _mem_insert "$file" "$1" "- **Status ($(_mem_date))**: $2"
|
||||||
|
rc=$?
|
||||||
|
case "$rc" in
|
||||||
|
0) return 0 ;;
|
||||||
|
1) echo "memory: no entry $1 in $file" >&2 ;;
|
||||||
|
*) echo "memory: $1 status not written" >&2 ;;
|
||||||
|
esac
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_journal_locked() { # <file> <date> <line>
|
||||||
|
_mem_insert "$1" "$2" "$3" exact
|
||||||
|
case $? in
|
||||||
|
1) printf '\n## %s\n%s\n' "$2" "$3" >> "$1" ;;
|
||||||
|
0) return 0 ;;
|
||||||
|
*) return 2 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_journal() { # <line> → `- <line>` under today's heading
|
||||||
|
local file=.claude/memory/journal.md line="$1"
|
||||||
|
_mem_one_line "journal line" "$line" || return 2
|
||||||
|
[ -f "$file" ] || { echo "memory: no $file" >&2; return 2; }
|
||||||
|
case "$line" in '- '*) ;; *) line="- $line" ;; esac
|
||||||
|
_mem_locked _mem_journal_locked "$file" "$(_mem_date)" "$line" \
|
||||||
|
|| { echo "memory: journal line not written" >&2; return 2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_add_valid() { # <PREFIX> <title> <body-file> <status> <supersedes>
|
||||||
|
_mem_one_line title "$2" || return 2
|
||||||
|
case "$2$4" in *'['*|*']'*|*'|'*)
|
||||||
|
echo "memory: title and status take no [ ] |" >&2; return 2 ;;
|
||||||
|
esac
|
||||||
|
[ "${#2}" -le 160 ] || { echo "memory: title over 160 chars" >&2; return 2; }
|
||||||
|
case "$4" in *$'\n'*) _mem_one_line status "$4"; return 2 ;; esac
|
||||||
|
[ -z "$4" ] || _mem_status_text "$4" || return 2
|
||||||
|
[ -s "$3" ] || { echo "memory: empty or missing body: $3" >&2; return 2; }
|
||||||
|
! _mem_fence_open "$3" \
|
||||||
|
|| { echo "memory: body leaves a code fence open" >&2; return 2; }
|
||||||
|
if [ "$1" = BLK ] && ! "$MEM_GREP" -q '`' "$3"; then
|
||||||
|
echo "memory: a blocker body quotes ≥1 error in backticks" >&2; return 2
|
||||||
|
fi
|
||||||
|
case "$5" in ''|"$1"-[0-9]*) ;; *)
|
||||||
|
echo "memory: --supersedes takes a $1 ID: $5" >&2; return 2 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_entry_text() { # <title> <body-file> <status> <supersedes> <v1>
|
||||||
|
local tag="" # v1: the status is a body line (the v1 reconcile reader
|
||||||
|
[ -z "$3" ] || [ -n "$5" ] || tag=" [$3]" # never reads the heading)
|
||||||
|
printf '%s%s (%s)\n' "$1" "$tag" "$(_mem_date)"
|
||||||
|
[ -z "$3" ] || [ -z "$5" ] || printf -- '- **Status**: %s\n' "$3"
|
||||||
|
awk '{ l[NR] = $0 } END { n = NR; while (n > 0 && l[n] == "") n--
|
||||||
|
for (i = 1; i <= n; i++) print l[i] }' "$2"
|
||||||
|
[ -z "$4" ] || printf 'Supersedes [[%s]].\n' "$4"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_add_locked() { # <file> <PREFIX> <entry-file> <supersedes>
|
||||||
|
local f="$1" id pre rc=0 # runs under _mem_locked: failure = restore
|
||||||
|
if _mem_fence_open "$f"; then
|
||||||
|
echo "memory: $f leaves a code fence open; fix it first" >&2; return 2
|
||||||
|
fi
|
||||||
|
id=$(_mem_next_id "$f" "$2")
|
||||||
|
if _mem_heading_has "$f" "$id"; then
|
||||||
|
echo "memory: $id already in a heading of $f" >&2; return 2
|
||||||
|
fi
|
||||||
|
pre=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
cat "$f" > "$pre"
|
||||||
|
{ printf '\n## %s — ' "$id"; cat "$3"; } >> "$f" || rc=2
|
||||||
|
if [ "$rc" = 0 ] && [ -n "$4" ]; then
|
||||||
|
_mem_insert "$f" "$4" "- **Status ($(_mem_date))**: superseded by $id" \
|
||||||
|
|| rc=2
|
||||||
|
fi
|
||||||
|
if [ "$rc" = 0 ] && memory_is_v2 "$f"; then
|
||||||
|
memory_check_file "$f" "$2" "$pre" || rc=2
|
||||||
|
fi
|
||||||
|
rm -f "$pre"
|
||||||
|
[ "$rc" = 0 ] && echo "$id"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_add() { # <kind> <title> <body-file> <status> <supersedes>
|
||||||
|
local spec file entry rc v1=""
|
||||||
|
spec=$(_mem_kind "$1") || return 2
|
||||||
|
file=".claude/memory/${spec% *}"
|
||||||
|
_mem_add_valid "${spec#* }" "$2" "$3" "$4" "$5" || return 2
|
||||||
|
[ -f "$file" ] || { echo "memory: no registry: $file" >&2; return 2; }
|
||||||
|
[ -z "$5" ] || _mem_has_id "$file" "$5" \
|
||||||
|
|| { echo "memory: no entry $5 in $file" >&2; return 2; }
|
||||||
|
memory_is_v2 "$file" || {
|
||||||
|
v1=1; echo "memory: v1 registry (no format: 2): $file" >&2; }
|
||||||
|
entry=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
_mem_entry_text "$2" "$3" "$4" "$5" "$v1" > "$entry"
|
||||||
|
_mem_locked _mem_add_locked "$file" "${spec#* }" "$entry" "$5"; rc=$?
|
||||||
|
rm -f "$entry"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_add_cli() { # <kind> --title t --body-file f [--status s] [--supersedes I]
|
||||||
|
local kind="${1:-}" title="" body="" st="" sup=""
|
||||||
|
[ $# -gt 0 ] && shift
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
[ $# -ge 2 ] || { echo "memory: add: $1 needs a value" >&2; return 2; }
|
||||||
|
case "$1" in
|
||||||
|
--title) title="$2" ;;
|
||||||
|
--body-file) body="$2" ;;
|
||||||
|
--status) st="$2" ;;
|
||||||
|
--supersedes) sup="$2" ;;
|
||||||
|
*) echo "memory: add: unknown option: $1" >&2; return 2 ;;
|
||||||
|
esac
|
||||||
|
shift 2
|
||||||
|
done
|
||||||
|
memory_add "$kind" "$title" "$body" "$st" "$sup"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_culprits() { # <file> <PREFIX> → "<line>\t<reason>" per culprit
|
||||||
|
awk -v p="$2" '
|
||||||
|
/^```/ { fence = !fence; next }
|
||||||
|
fence { next }
|
||||||
|
$0 == "## Index" { print NR "\t## Index in a v2 registry" }
|
||||||
|
!match($0, "^## " p "-[0-9]") { next }
|
||||||
|
!match($0, "^## " p "-[0-9][0-9][0-9]+ — .") {
|
||||||
|
print NR "\theading shape: " $0; next }
|
||||||
|
seen[$2]++ { print NR "\tduplicate " $2 }
|
||||||
|
END { if (fence) print NR "\tcode fence open at end of file" }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_check_file() { # <file> <PREFIX> [<reference>] [<name>] → rc 2 on a
|
||||||
|
# culprit. With a reference only culprits absent from it count (a merge
|
||||||
|
# duplicate never blocks the next append); an open fence always counts
|
||||||
|
local p="$2" ref="${3:-/dev/null}" name="${4:-$1}"
|
||||||
|
[ -s "$ref" ] || ref=/dev/null
|
||||||
|
awk -F'\t' -v f="$name" '
|
||||||
|
FILENAME == ARGV[1] { old[$2]++; next }
|
||||||
|
$2 !~ /^code fence/ && old[$2]-- > 0 { next }
|
||||||
|
{ print "memory: " f ":" $1 ": " $2; bad = 1 }
|
||||||
|
END { exit bad ? 2 : 0 }' \
|
||||||
|
<(_mem_culprits "$ref" "$p") <(_mem_culprits "$1" "$p") >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_check() { # [--staged] [<memory-dir>] → rc 2 on any culprit
|
||||||
|
local staged="" dir f rc=0
|
||||||
|
[ "${1:-}" = --staged ] && { staged=1; shift; }
|
||||||
|
dir="${1:-.claude/memory}"
|
||||||
|
[ $# -le 1 ] && [ "${dir#-}" = "$dir" ] || { echo "usage: memory.sh" \
|
||||||
|
"check [--staged] [dir]" >&2; return 2; }
|
||||||
|
[ -n "$staged" ] || [ -d "$dir" ] \
|
||||||
|
|| { echo "memory: no memory dir: $dir" >&2; return 2; }
|
||||||
|
case "$staged:$dir" in 1:/*|1:..|1:../*|1:*/../*|1:*/..)
|
||||||
|
echo "memory: check --staged takes a repo-relative dir: $dir" >&2
|
||||||
|
return 2 ;;
|
||||||
|
esac
|
||||||
|
for f in $(_mem_names); do
|
||||||
|
f="$dir/$f.md"
|
||||||
|
if [ -n "$staged" ]; then _mem_check_staged "$f" || rc=2; continue; fi
|
||||||
|
[ -f "$f" ] || continue
|
||||||
|
if ! memory_is_v2 "$f"; then echo "memory: v1: $f" >&2; continue; fi
|
||||||
|
memory_check_file "$f" "$(_mem_prefix "$f")" || rc=2
|
||||||
|
done
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_blob() { # <rev:path> <out file> → rc 1 when the blob is absent
|
||||||
|
git cat-file -e "$1" 2>/dev/null && git show "$1" > "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_check_staged() { # <file> → rc 2 on a new culprit or a lost v2 file
|
||||||
|
local h s rc=0
|
||||||
|
h=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
s=$(mktemp) || { rm -f "$h"; echo "memory: no temp file" >&2; return 2; }
|
||||||
|
_mem_blob "HEAD:./$1" "$h" || : > "$h"
|
||||||
|
_mem_blob ":./$1" "$s" || : > "$s"
|
||||||
|
if [ -s "$h" ] && memory_is_v2 "$h" && ! { [ -s "$s" ] && memory_is_v2 "$s"; }
|
||||||
|
then
|
||||||
|
echo "memory: $1: staged deletion, emptying or loss of format: 2" >&2
|
||||||
|
rc=2
|
||||||
|
elif [ -s "$s" ] && memory_is_v2 "$s"; then
|
||||||
|
memory_check_file "$s" "$(_mem_prefix "$1")" "$h" "$1" || rc=2
|
||||||
|
_mem_removed_lines "$1" "$h" || rc=2
|
||||||
|
fi
|
||||||
|
rm -f "$h" "$s"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_removed_lines() { # <file> <HEAD copy> → rc 2 when a hunk removes an
|
||||||
|
local p first # entry line (an Index sits above the first entry)
|
||||||
|
[ -s "$2" ] || return 0
|
||||||
|
p=$(_mem_prefix "$1" 2>/dev/null) || return 0
|
||||||
|
first=$(awk -v p="$p" '/^```/ { fence = !fence; next }
|
||||||
|
!fence && match($0, "^## " p "-[0-9]") { print NR; exit }' "$2")
|
||||||
|
[ -n "$first" ] || return 0
|
||||||
|
git -c diff.interHunkContext=0 diff --cached --no-color --no-ext-diff \
|
||||||
|
--no-textconv -U0 -- "$1" | awk -v first="$first" -v f="$1" '
|
||||||
|
/^@@ / { split($2, a, ","); start = substr(a[1], 2) + 0
|
||||||
|
cnt = (2 in a) ? a[2] + 0 : 1
|
||||||
|
if (cnt > 0 && start + cnt - 1 >= first) {
|
||||||
|
print "memory: " f ": line " start " removed inside an entry" \
|
||||||
|
" (fix it, then commit with /commit-change)"
|
||||||
|
bad = 1 } }
|
||||||
|
END { exit bad ? 2 : 0 }' >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_index_rows() { # <file> <PREFIX> → "| ID | date | title | word |" rows
|
||||||
|
awk -v p="$2" -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
function row() { if (id != "") print "| " id " | " d " | " t " | " s " |" }
|
||||||
|
/^```/ { fence = !fence; next }
|
||||||
|
fence { next }
|
||||||
|
/^## / { row(); id = ""
|
||||||
|
if (!match($0, "^## " p "-[0-9]+")) next
|
||||||
|
id = $2; t = $0; sub(/^## [^ ]+( — )?/, "", t); d = ""
|
||||||
|
s = mem_word(mem_tag(t))
|
||||||
|
if (match(t, / \([0-9-]+\) *$/)) {
|
||||||
|
d = substr(t, RSTART + 2, RLENGTH - 3); t = substr(t, 1, RSTART - 1) }
|
||||||
|
else if (match(t, / — [0-9][0-9][0-9][0-9]-[0-9-]+ *$/)) {
|
||||||
|
d = substr(t, RSTART); t = substr(t, 1, RSTART - 1)
|
||||||
|
sub(/^ — /, "", d) }
|
||||||
|
sub(/ \[[^]]*\] *$/, "", t); gsub(/\|/, "/", t); next }
|
||||||
|
id == "" { next }
|
||||||
|
d == "" && sub(/^- \*\*Date\*\* *: */, "") { d = substr($0, 1, 10) }
|
||||||
|
(w = mem_cand($0)) != "" { s = w }
|
||||||
|
END { row() }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_index() { # [<kind>] → one table per registry
|
||||||
|
local kinds k spec file
|
||||||
|
kinds=${1:-$(awk '{ print $1 }' <<< "$_MEM_TABLE")}
|
||||||
|
for k in $kinds; do
|
||||||
|
spec=$(_mem_kind "$k") || return 2
|
||||||
|
file=".claude/memory/${spec% *}"
|
||||||
|
[ -f "$file" ] || continue
|
||||||
|
printf '%s\n\n| ID | Date | Title | Status |\n|---|---|---|---|\n' "$file"
|
||||||
|
_mem_index_rows "$file" "${spec#* }"
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_index_table() { # <file> → "ID<TAB>date<TAB>last column" per Index row
|
||||||
|
awk '$0 == "## Index" { on = 1; next }
|
||||||
|
on && /^## / { exit }
|
||||||
|
on && /^\| *[A-Z]+-[0-9]+ *\|/ {
|
||||||
|
n = split($0, c, "|")
|
||||||
|
for (i = 2; i < n; i++) gsub(/^ +| +$/, "", c[i])
|
||||||
|
print c[2] "\t" c[3] "\t" c[n - 1] }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_text() { # <rows> <file> <PREFIX> → the v2 text on stdout
|
||||||
|
awk -v p="$3" -v today="$(_mem_date)" -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
function flush( i, s, w) {
|
||||||
|
w = mem_word(col[cur])
|
||||||
|
if (cur != "" && (s = mem_want(p, col[cur], st[cur])) != "")
|
||||||
|
print "- **Status (" today ", upgrade)**: " s
|
||||||
|
else if (cur != "" && w != "" && p !~ /^(LRN|EVAL)$/ && w != st[cur])
|
||||||
|
print "memory: " cur ": kept body " st[cur] ", dropped Index " \
|
||||||
|
col[cur] > "/dev/stderr"
|
||||||
|
for (i = 1; i <= n; i++) print buf[i]
|
||||||
|
n = 0 }
|
||||||
|
FILENAME == ARGV[1] { split($0, r, "\t"); dt[r[1]] = r[2]
|
||||||
|
col[r[1]] = r[3]; next }
|
||||||
|
FILENAME == ARGV[2] { split($0, r, / \| /); sub(/^\| /, "", r[1])
|
||||||
|
sub(/ \|$/, "", r[4]); hd[r[1]] = r[2] != ""; st[r[1]] = r[4]
|
||||||
|
next }
|
||||||
|
FNR == 1 { print; print "format: 2"; next }
|
||||||
|
/^```/ { fence = !fence }
|
||||||
|
$0 == "## Index" { skip = 1; next }
|
||||||
|
skip { if (/^\|/) { tbl = 1; next }
|
||||||
|
if (tbl) { skip = 0; if ($0 == "") next }
|
||||||
|
else if ($0 ~ /^#/ || $0 == "---") skip = 0
|
||||||
|
else next }
|
||||||
|
!fence && /^## / { flush(); split($0, w, " ")
|
||||||
|
cur = (w[2] in col) ? w[2] : ""; print
|
||||||
|
if (cur != "" && !hd[cur] && dt[cur] != "") print "- **Date**: " dt[cur]
|
||||||
|
next }
|
||||||
|
cur != "" && ($0 == "" || $0 == "---") { buf[++n] = $0; next }
|
||||||
|
{ for (i = 1; i <= n; i++) print buf[i]; n = 0; print }
|
||||||
|
END { flush() }' "$1" <(_mem_index_rows "$2" "$3") "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_heading_ids() { # <file> <PREFIX> → the entry IDs, any heading level
|
||||||
|
"$MEM_GREP" -oE "^#+ *$2-[0-9]+" "$1" | sed 's/^#* *//'
|
||||||
|
}
|
||||||
|
|
||||||
|
_MEM_LEGACY_RE='status|RESOLVED|REVERTED|upstream|resolved|[^a-z]open'
|
||||||
|
memory_legacy_status() { # <file> <ID> [<end>] → the v1 lexical status line
|
||||||
|
# (reconcile reads it on a v1 blockers file; `upgrade` proves its verdicts
|
||||||
|
# against it). Default range: `## ID` to the next `## BLK-`, reconcile's
|
||||||
|
# own. With <end> (ERE) the range is fence-aware: it stops at the next
|
||||||
|
# heading matching <end> outside a ``` fence, and that header is not read.
|
||||||
|
local end="${3:-}"
|
||||||
|
if [ -z "$end" ]; then
|
||||||
|
sed -n "/^## ${2} /,/^## BLK-/p" "$1" \
|
||||||
|
| "$MEM_GREP" -v '^## BLK-' \
|
||||||
|
| "$MEM_GREP" -iE "$_MEM_LEGACY_RE" \
|
||||||
|
| tail -1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
RE="$_MEM_LEGACY_RE" END_RE="$end" awk -v id="$2" '
|
||||||
|
/^```/ { fence = !fence; next }
|
||||||
|
!fence && $0 ~ ENVIRON["END_RE"] { on = 0 }
|
||||||
|
!fence && $0 ~ "^## " id " " { on = 1; next }
|
||||||
|
on && !fence && tolower($0) ~ tolower(ENVIRON["RE"]) { last = $0 }
|
||||||
|
END { if (last != "") print last }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_legacy_open() { # <old file> <ID> → rc 0 when reconcile's v1 reader
|
||||||
|
local st # lists the blocker open (its status is not RESOLVED);
|
||||||
|
# upgrade reads the entry's own range, up to a heading of any level
|
||||||
|
st=$(memory_legacy_status "$1" "$2" '^##* *BLK-[0-9]')
|
||||||
|
case "$st" in *RESOLVED*|*resolved*) return 1 ;; esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_index_stated() { # <old> <PREFIX> → IDs whose Index status upgrade
|
||||||
|
# writes into the body (mem_want): a fact the v1 reader never saw
|
||||||
|
awk -F'\t' -v p="$2" -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
FILENAME == ARGV[1] { col[$1] = $3; next }
|
||||||
|
{ split($0, a, / \| /); id = a[1]; sub(/^\| /, "", id); s = a[4]
|
||||||
|
sub(/ \|$/, "", s)
|
||||||
|
if (id in col && mem_want(p, col[id], s) != "") print id }' \
|
||||||
|
<(_mem_index_table "$1") <(_mem_index_rows "$1" "$2")
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_verdict_diff() { # <old> <new> → "ID<TAB>word" per blocker whose open /
|
||||||
|
local id was now ix # closed verdict moved (word = the old verdict)
|
||||||
|
ix=$(_mem_index_stated "$1" BLK)
|
||||||
|
for id in $(_mem_heading_ids "$2" BLK); do
|
||||||
|
printf '%s\n' "$ix" | "$MEM_GREP" -qx "$id" && continue
|
||||||
|
# the v1 reader enumerates `## ID` headings only: no verdict to keep
|
||||||
|
"$MEM_GREP" -qE "^## $id( |$)" "$1" || continue
|
||||||
|
_mem_legacy_open "$1" "$id" && was=open || was=resolved
|
||||||
|
memory_closed "$(memory_status_word "$(memory_entry_status "$2" "$id")")" \
|
||||||
|
&& now=resolved || now=open
|
||||||
|
[ "$was" = "$now" ] || printf '%s\t%s\n' "$id" "$was"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_repair() { # <old> <new> <PREFIX> → no blocker loses its closure
|
||||||
|
# v1 closed, strict reader open (a dialect it cannot read): a status line
|
||||||
|
# restores it. v1 open, strict closed is the BLK-032..034 fix (prose words
|
||||||
|
# read as status by the v1 reader): kept, named
|
||||||
|
local id word
|
||||||
|
[ "$3" = BLK ] || return 0
|
||||||
|
while IFS=$'\t' read -r id word; do
|
||||||
|
if [ "$word" = open ]; then
|
||||||
|
echo "memory: $id: v1 reader open, strict reader closed (kept)" >&2
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
_mem_insert "$2" "$id" "- **Status ($(_mem_date), upgrade)**: $word" \
|
||||||
|
|| return 2
|
||||||
|
done < <(_mem_verdict_diff "$1" "$2")
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_oracle() { # <old> <new> <PREFIX> → rc 2 on a lost fact
|
||||||
|
local o n
|
||||||
|
[ "$(_mem_heading_ids "$1" "$3")" = "$(_mem_heading_ids "$2" "$3")" ] \
|
||||||
|
|| { echo "memory: upgrade changed the entry IDs: $1" >&2; return 2; }
|
||||||
|
memory_check_file "$2" "$3" "" "$1" || return 2
|
||||||
|
o=$(_mem_index_rows "$1" "$3"); n=$(_mem_index_rows "$2" "$3")
|
||||||
|
awk -F'\t' -v p="$3" -v MEMW="$_MEM_WORDS" "$_MEM_AWK"'
|
||||||
|
function f(s, k) { split(s, a, / \| /); return a[k] }
|
||||||
|
FILENAME == ARGV[1] { dt[$1] = $2; col[$1] = $3; next }
|
||||||
|
{ id = f($0, 1); sub(/^\| /, "", id) }
|
||||||
|
FILENAME == ARGV[2] { old[id] = f($0, 4); sub(/ \|$/, "", old[id]); next }
|
||||||
|
!(id in col) { next }
|
||||||
|
{ d = f($0, 2); s = f($0, 4); sub(/ \|$/, "", s)
|
||||||
|
m = mem_want(p, col[id], old[id])
|
||||||
|
want = m != "" ? mem_word(m) : old[id]
|
||||||
|
if (dt[id] != "" && d == "") bad = bad " " id ":date"
|
||||||
|
if (want != "" && p != "BLK" && s != want)
|
||||||
|
bad = bad " " id ":" s "!=" want }
|
||||||
|
END { if (bad != "") { print "memory: upgrade lost:" bad; exit 2 } }' \
|
||||||
|
<(_mem_index_table "$1") <(printf '%s\n' "$o") \
|
||||||
|
<(printf '%s\n' "$n") >&2 || return 2
|
||||||
|
o=$(_mem_verdict_diff "$1" "$2" | awk -F'\t' '$2 == "resolved" \
|
||||||
|
{ printf "%s ", $1 }')
|
||||||
|
[ -z "$o" ] || { echo "memory: upgrade moved a verdict: $o" >&2; return 2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_front() { # <file> → the file; one lacking a frontmatter gets
|
||||||
|
local t first # the template's (format: 2 is added with the rest)
|
||||||
|
IFS= read -r first < "$1"
|
||||||
|
if [ "$first" != --- ]; then
|
||||||
|
t="$_MEM_LIB_DIR/../templates/memory/${1##*/}"
|
||||||
|
[ -f "$t" ] || { echo "memory: no template for $1" >&2; return 2; }
|
||||||
|
awk 'NR > 1 && /^---$/ { print; print ""; exit }
|
||||||
|
$0 != "format: 2"' "$t"
|
||||||
|
fi
|
||||||
|
cat "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_headings() { # <file> <PREFIX> → entry headings in the v2 shape
|
||||||
|
# `## ID — title` stays byte-identical; ` - ` and ` | date | ` separators
|
||||||
|
# and any other level are rewritten, the title text and the ID kept; a
|
||||||
|
# heading that would still not be v2 (`### ID amendment`) is left as is
|
||||||
|
awk -v p="$2" '
|
||||||
|
/^```/ { fence = !fence }
|
||||||
|
fence || !match($0, "^#+ *" p "-[0-9]+") { print; next }
|
||||||
|
{ lead = substr($0, 1, RLENGTH); rest = substr($0, RLENGTH + 1)
|
||||||
|
if (lead ~ /^## / && rest ~ /^ — ./) { print; next }
|
||||||
|
sub(/^#+ */, "", lead); d = ""
|
||||||
|
if (rest ~ /^ [|] /) { rest = substr(rest, 4)
|
||||||
|
if (match(rest, "^[0-9][0-9/-]* [|] ")) {
|
||||||
|
d = substr(rest, 1, RLENGTH - 3); rest = substr(rest, RLENGTH + 1) }
|
||||||
|
rest = " — " rest (d != "" ? " (" d ")" : "") }
|
||||||
|
else if (rest ~ /^ - /) rest = " — " substr(rest, 4)
|
||||||
|
cand = "## " lead rest
|
||||||
|
print (cand ~ "^## " p "-[0-9][0-9][0-9]+ — ." ? cand : $0) }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_build() { # <file> <PREFIX> <out> → the v2 text, blocker
|
||||||
|
local front src rows rc=0 # verdicts kept
|
||||||
|
front=$(mktemp); src=$(mktemp); rows=$(mktemp)
|
||||||
|
[ -n "$front" ] && [ -n "$src" ] && [ -n "$rows" ] \
|
||||||
|
|| { rm -f "$front" "$src" "$rows"; echo "memory: no temp file" >&2
|
||||||
|
return 2; }
|
||||||
|
{ _mem_upgrade_front "$1" > "$front" \
|
||||||
|
&& _mem_upgrade_headings "$front" "$2" > "$src" \
|
||||||
|
&& _mem_index_table "$src" > "$rows" \
|
||||||
|
&& _mem_upgrade_text "$rows" "$src" "$2" > "$3" \
|
||||||
|
&& _mem_upgrade_repair "$1" "$3" "$2"; } || rc=2
|
||||||
|
rm -f "$front" "$src" "$rows"
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_index_only_table() { # <file> → rc 1 when ## Index holds a non-table
|
||||||
|
awk '$0 == "## Index" { on = 1; next } # line outside a comment
|
||||||
|
!on { next }
|
||||||
|
cm { if (/-->/) cm = 0; next }
|
||||||
|
/^<!--/ { if ($0 !~ /-->/) cm = 1; next }
|
||||||
|
/^\|/ { tbl = 1; next }
|
||||||
|
/^#/ || /^---$/ || (tbl && /^$/) { exit }
|
||||||
|
/^$/ { next }
|
||||||
|
{ bad = 1; exit }
|
||||||
|
END { exit bad }' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_ready() { # <file> → rc 0 upgradable, 1 already v2, 2 refused
|
||||||
|
memory_is_v2 "$1" && { echo "memory: $1 already v2" >&2; return 1; }
|
||||||
|
_mem_index_only_table "$1" || { echo "memory: $1: ## Index is not a" \
|
||||||
|
"table, not upgraded" >&2; return 2; }
|
||||||
|
_mem_prefix "$1" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
_mem_upgrade_file() { # <file> → rc 0 upgraded or already v2, rc 2 refused
|
||||||
|
local p new rc=0
|
||||||
|
_mem_upgrade_ready "$1"; rc=$?
|
||||||
|
[ "$rc" = 1 ] && return 0
|
||||||
|
[ "$rc" = 0 ] || return 2
|
||||||
|
p=$(_mem_prefix "$1") || return 2
|
||||||
|
new=$(mktemp) || { echo "memory: no temp file" >&2; return 2; }
|
||||||
|
{ _mem_upgrade_build "$1" "$p" "$new" \
|
||||||
|
&& _mem_upgrade_oracle "$1" "$new" "$p" \
|
||||||
|
&& cat "$new" > "$1"; } || rc=2
|
||||||
|
rm -f "$new"
|
||||||
|
[ "$rc" = 0 ] && echo "memory: upgraded $1"
|
||||||
|
[ "$rc" = 0 ] || echo "memory: $1 left as it was" >&2
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory_upgrade() { # [<memory-dir>] → every template-born registry to v2
|
||||||
|
local dir="${1:-.claude/memory}" f rc=0
|
||||||
|
for f in $(_mem_names); do
|
||||||
|
[ -f "$dir/$f.md" ] || continue
|
||||||
|
_mem_locked _mem_upgrade_file "$dir/$f.md" || rc=2
|
||||||
|
done
|
||||||
|
return "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
_memory_main() {
|
||||||
|
set -uo pipefail
|
||||||
|
if [ "${1:-}" = "-C" ]; then
|
||||||
|
cd "${2:-}" 2>/dev/null \
|
||||||
|
|| { echo "memory: no dir ${2:-}" >&2; return 2; }
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
case "${1:-}:$#" in
|
||||||
|
add:*) shift; _mem_add_cli "$@" ;;
|
||||||
|
status:3) memory_status "$2" "$3" ;;
|
||||||
|
journal:2) memory_journal "$2" ;;
|
||||||
|
index:[12]) memory_index "${2:-}" ;;
|
||||||
|
check:*) shift; memory_check "$@" ;;
|
||||||
|
upgrade:[12]) memory_upgrade "${2:-}" ;;
|
||||||
|
*) echo "usage: memory.sh [-C dir] add <kind> --title t --body-file f" \
|
||||||
|
"[--status s] [--supersedes ID] | status <ID> <text> | journal" \
|
||||||
|
"<line> | index [kind] | check [--staged] [dir] | upgrade [dir]" >&2
|
||||||
|
return 2 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then _memory_main "$@"; fi
|
||||||
+23
-15
@@ -10,6 +10,7 @@
|
|||||||
# nor believes a `[x]`/`[ ]` checkbox; it enumerates registry entries from the BODY
|
# nor believes a `[x]`/`[ ]` checkbox; it enumerates registry entries from the BODY
|
||||||
# `## ID —` headings and decides "done/stale" from git/fs only. It practices what it
|
# `## ID —` headings and decides "done/stale" from git/fs only. It practices what it
|
||||||
# preaches — the recursive-coherence test (run-reconcile.sh T1) reds if this is broken.
|
# preaches — the recursive-coherence test (run-reconcile.sh T1) reds if this is broken.
|
||||||
|
# v2 registries carry no Index at all (lib/memory.sh); v1 ones still may.
|
||||||
#
|
#
|
||||||
# HONEST LIMITS (graven, do not over-read):
|
# HONEST LIMITS (graven, do not over-read):
|
||||||
# - Deferral detection is LEXICAL (reconcile_deferrals): it catches deferrals MARKED
|
# - Deferral detection is LEXICAL (reconcile_deferrals): it catches deferrals MARKED
|
||||||
@@ -28,6 +29,9 @@
|
|||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
RECONCILE_GREP="${RECONCILE_GREP:-/usr/bin/grep}" # LRN-074: pin grep, never assume GNU flags
|
RECONCILE_GREP="${RECONCILE_GREP:-/usr/bin/grep}" # LRN-074: pin grep, never assume GNU flags
|
||||||
|
# the status parser and classifier are shared with lib/memory.sh (BDR-125 4a)
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$(dirname "${BASH_SOURCE[0]}")/memory.sh"
|
||||||
# markers that LEXICALLY signal a deferral/follow-up (honest limit: marked-only)
|
# markers that LEXICALLY signal a deferral/follow-up (honest limit: marked-only)
|
||||||
RECONCILE_DEFER_RE='[Dd]efer|[Ff]ollow-?up|[Oo]ut.of.scope|OUT-OF-SCOPE|[Rr]econsider|[Rr]evisit|2e passage|won.t.do|optional\)|one-line ticket'
|
RECONCILE_DEFER_RE='[Dd]efer|[Ff]ollow-?up|[Oo]ut.of.scope|OUT-OF-SCOPE|[Rr]econsider|[Rr]evisit|2e passage|won.t.do|optional\)|one-line ticket'
|
||||||
|
|
||||||
@@ -55,26 +59,30 @@ reconcile_oracle_msg_committed() { # $1 repo, $2 grep → rc 0 if a comm
|
|||||||
}
|
}
|
||||||
reconcile_oracle_path_present() { [ -e "${1:?}" ]; } # $1 path → rc 0 if it still exists on disk
|
reconcile_oracle_path_present() { [ -e "${1:?}" ]; } # $1 path → rc 0 if it still exists on disk
|
||||||
|
|
||||||
# --- registry status: LAST status-bearing line wins (the BLK-008 trap A fell into) ---
|
# --- registry status: LAST candidate wins (the BLK-008 trap A fell into) ---
|
||||||
# $1 blockers file, $2 id. Echoes the current status line (compound/UPDATE/FINAL aware).
|
# $1 blockers file, $2 id. A v2 registry (lib/memory.sh): the entry's own
|
||||||
|
# header `[tag]` or a labelled body line, never a status word in prose or in
|
||||||
|
# the title (the BLK-032..034 false-open). A v1 registry keeps the lexical
|
||||||
|
# reader (memory_legacy_status): its dialects (title suffix `— RESOLVED`,
|
||||||
|
# `date: … · status:`, `**Statut** :`) carry status where the strict parser
|
||||||
|
# cannot see it.
|
||||||
reconcile_blk_current_status() {
|
reconcile_blk_current_status() {
|
||||||
# drop ALL `## BLK-` header lines first: the range is inclusive of the NEXT entry's
|
if memory_is_v2 "$1"; then memory_entry_status "$1" "$2"; return; fi
|
||||||
# header, and a sibling header may carry a status word (e.g. BLK-005 "...upstream rename")
|
MEM_GREP="$RECONCILE_GREP" memory_legacy_status "$1" "$2"
|
||||||
# → cross-entry bleed. The entry's own header carries no status, so dropping it is safe.
|
|
||||||
sed -n "/^## ${2} /,/^## BLK-/p" "$1" \
|
|
||||||
| "$RECONCILE_GREP" -v '^## BLK-' \
|
|
||||||
| "$RECONCILE_GREP" -iE 'status|RESOLVED|REVERTED|upstream|resolved|[^a-z]open' \
|
|
||||||
| tail -1
|
|
||||||
}
|
}
|
||||||
# blockers whose CURRENT status is not resolved → emits "id<TAB>status"
|
# blockers whose CURRENT status does not close them → "id<TAB>status".
|
||||||
|
# v2: memory_closed (resolved | superseded | deprecated); v1: the substring.
|
||||||
reconcile_blk_open() {
|
reconcile_blk_open() {
|
||||||
local id st
|
local id st v2=""
|
||||||
|
memory_is_v2 "$1" && v2=1
|
||||||
for id in $(reconcile_enumerate_ids "$1" BLK); do
|
for id in $(reconcile_enumerate_ids "$1" BLK); do
|
||||||
st=$(reconcile_blk_current_status "$1" "$id")
|
st=$(reconcile_blk_current_status "$1" "$id")
|
||||||
case "$st" in
|
if [ -n "$v2" ]; then
|
||||||
*RESOLVED*|*resolved*) : ;;
|
memory_closed "$(memory_status_word "$st")" && continue
|
||||||
*) printf '%s\t%s\n' "$id" "$st" ;;
|
else
|
||||||
esac
|
case "$st" in *RESOLVED*|*resolved*) continue ;; esac
|
||||||
|
fi
|
||||||
|
printf '%s\t%s\n' "$id" "$st"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
# Blockers
|
||||||
|
|
||||||
|
## BLK-001 - hyphen dialect, resolved
|
||||||
|
- **Status**: resolved
|
||||||
|
|
||||||
|
## BLK-002 | 2026-05-18 | pipe dialect, open
|
||||||
|
Status: open
|
||||||
|
|
||||||
|
## BLK-003 | 2026-05-19 | pipe dialect, resolved
|
||||||
|
Status: resolved.
|
||||||
|
|
||||||
|
## BLK-004 - lib-shaped v1 add, resolved
|
||||||
|
- **Status**: resolved
|
||||||
|
- **Cause**: `TypeError: x is undefined`
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
format: 2
|
||||||
|
type: blockers_registry
|
||||||
|
entry_prefix: BLK
|
||||||
|
---
|
||||||
|
|
||||||
|
# Status parser fixture: BLK-032..034 as written 2026-10-27 (false-open
|
||||||
|
# before phase 4a), BLK-008 compound (frozen snapshot), BLK-040..042 shapes.
|
||||||
|
|
||||||
|
## BLK-008 — gstack ./setup fails on Ubuntu 26.04 — Playwright chromium unsupported
|
||||||
|
|
||||||
|
- **Date**: 2026-06-23
|
||||||
|
- **Friction**: fresh Ubuntu 26.04, `make install` / `make plugin` → "Failed to install browsers / ERROR: Playwright does not support chromium on ubuntu26.04-x64" → "GStack ./setup failed". Non-fatal in our wrapper (warn only) but gstack's browser (`/browse`, `/qa`, design screenshots) is silently dead once gstack is enabled.
|
||||||
|
- **Real cause**: Playwright 1.58.2 (pinned in the gstack submodule) registry lists `ubuntu20.04/22.04/24.04` only; 26.04 released later → not in list → `getHostPlatform` errors. Pure OS-newness, not an install bug.
|
||||||
|
- **Solution**: gated `export PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=ubuntu24.04-x64` (ubuntu >24.04 only) before gstack setup + persisted to `.bashrc` for runtime. Playwright then pulls a Chrome-for-Testing fallback build for ubuntu24.04. Verified on 26.04: `ldd` resolves all libs + real headless render OK.
|
||||||
|
- **Status**: resolved (commit 211c7d4). Residual: exact rev 1208 launch not in-session-tested (sandbox download hung at extraction); proved via sibling rev 1228 same-platform CfT build. Confirm on next real `make plugin`. Proper upstream fix = gstack bumps Playwright to a version that lists ubuntu26.04. See [[LRN-038]].
|
||||||
|
|
||||||
|
- **2026-06-23 UPDATE — Solution REVERTED, status downgraded to UPSTREAM/open** (commit b9c3937): the `PLAYWRIGHT_HOST_PLATFORM_OVERRIDE` solution above does NOT work on 26.04. The fallback build downloads to 100% then HANGS at extraction (chrome binary never appears, no headless-shell download starts; reproduced on real machine + sandbox) → turned a 0.5s fast-fail into an install-blocking hang (user Ctrl+C). Reverted to the fast-fail (non-fatal; gstack OFF by default, browser only for /browse,/qa,screenshots). The earlier "verified ldd + headless render" was an isolated test on a sibling already-extracted build (rev 1228) — it masked the rev-1208 install-path hang. **Real fix = upstream**: gstack bumps Playwright to a version that lists ubuntu26.04. Until then gstack's browser is unavailable on 26.04, install completes cleanly. See [[LRN-038]] correction.
|
||||||
|
|
||||||
|
- **2026-06-23 FINAL — RESOLVED** (commit 3b8ffb1): gstack browser now works on Ubuntu 26.04. Two layers fixed: (1) bumped gstack's pinned Playwright 1.58.2 → 1.61 (`bun add playwright@latest` in the submodule; 1.61 ships a native ubuntu26.04 build — chromium rev 1228), automated in the installer (`gstack_bump_playwright_if_unsupported`, idempotent, OS-gated); (2) `GSTACK_CHROMIUM_NO_SANDBOX=1` to work around the AppArmor userns restriction (`sysctl kernel.apparmor_restrict_unprivileged_userns=1`), persisted to `.bashrc` + installer Step 9 (sysctl-gated). Verified end-to-end: `browse goto https://example.com` → "Navigated (200)". Caveat: the Playwright bump is a local submodule edit, reset by `git submodule update`, re-applied by the next install. See [[BDR-029]], [[LRN-040]].
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 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]
|
||||||
|
- **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]
|
||||||
|
- **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]
|
||||||
|
- **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-040 — accepted with an open check
|
||||||
|
- **Status**: accepted. Behavioral check OPEN: `x` must ask first.
|
||||||
|
|
||||||
|
## BLK-041 — "Use when [triggers]" mid-title bracket
|
||||||
|
- **Status**: open. `y` pending.
|
||||||
|
|
||||||
|
## BLK-042 — no status anywhere
|
||||||
|
- **Solution**: fail-open guard, `data:` OPEN in prose.
|
||||||
|
|
||||||
|
## BLK-043 — DNS resolved to stale IP after failover [open] (2026-10-28)
|
||||||
|
- **Friction**: `dig` answers the old address.
|
||||||
|
|
||||||
|
## BLK-044 — reopened after a regression [resolved] (2026-10-28)
|
||||||
|
- **Cause**: `abc` reverted the fix.
|
||||||
|
- **Status (2026-10-28)**: open again, not resolved by abc
|
||||||
Executable
+562
@@ -0,0 +1,562 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# lib/tests/memory.test.sh — lib/memory.sh (add / status / journal / index /
|
||||||
|
# check / upgrade) and the shared status parser. Hermetic fixtures under one
|
||||||
|
# mktemp dir with its own git repo; flip-tests first (LRN-096), then the
|
||||||
|
# real check on this repo's registries.
|
||||||
|
set -u
|
||||||
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
|
MEM="$ROOT/lib/memory.sh"
|
||||||
|
pass=0; fail=0
|
||||||
|
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
||||||
|
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
||||||
|
FIX=$(mktemp -d); trap 'rm -rf "$FIX"' EXIT
|
||||||
|
cd "$FIX" || exit 1
|
||||||
|
git init -q . && git config user.email t@t && git config user.name t
|
||||||
|
export MEMORY_DATE=2026-10-27
|
||||||
|
mkdir -p .claude/memory
|
||||||
|
reg() { # <file> <type> <PREFIX> <title> → a v2 registry with no entry
|
||||||
|
printf -- '---\nformat: 2\ntype: %s\nentry_prefix: %s\n---\n\n# %s\n' \
|
||||||
|
"$2" "$3" "$4" > ".claude/memory/$1"
|
||||||
|
}
|
||||||
|
reg decisions.md decisions_registry BDR 'Decisions registry (BDR)'
|
||||||
|
reg learnings.md learnings_registry LRN 'Learnings registry (LRN)'
|
||||||
|
reg blockers.md blockers_registry BLK 'Blockers registry (BLK)'
|
||||||
|
reg evals.md evals_registry EVAL 'Evals registry (EVAL)'
|
||||||
|
printf -- '---\ntype: journal\n---\n\n# Journal\n\n## 2026-10-26\n- old\n' \
|
||||||
|
> .claude/memory/journal.md
|
||||||
|
B=.claude/memory/blockers.md
|
||||||
|
printf -- "- **Friction**: \`make\` red\n- **Cause**: x\n\n" > body.md
|
||||||
|
|
||||||
|
# T1 add: next ID from headings, canonical heading, ID alone on stdout
|
||||||
|
out=$(bash "$MEM" add blocker --title 'make red' --body-file body.md \
|
||||||
|
--status open)
|
||||||
|
check T1-first-id "$out" BLK-001
|
||||||
|
check T1b-heading "$(grep -c '^## BLK-001 — make red \[open\] (2026-10-27)$' "$B")" 1
|
||||||
|
check T1c-body-trimmed "$(tail -1 "$B")" '- **Cause**: x'
|
||||||
|
check T1d-second-id "$(bash "$MEM" add blocker --title 'two' --body-file body.md)" BLK-002
|
||||||
|
check T1e-check-green "$(bash "$MEM" check; echo $?)" 0
|
||||||
|
check T1f-index-row "$(bash "$MEM" index blocker | grep -c '^| BLK-001 | 2026-10-27 | make red | open |$')" 1
|
||||||
|
|
||||||
|
# T2 add refuses, rc 2, registry unchanged
|
||||||
|
sum=$(cksum < "$B")
|
||||||
|
refused() { # <name> <add args…> → the add is rc 2
|
||||||
|
local name="$1"; shift
|
||||||
|
bash "$MEM" add "$@" >/dev/null 2>&1
|
||||||
|
check "T2-$name" "$?" 2
|
||||||
|
}
|
||||||
|
refused kind unknown --title t --body-file body.md
|
||||||
|
refused bracket blocker --title 'a[b]' --body-file body.md
|
||||||
|
refused pipe blocker --title 'a|b' --body-file body.md
|
||||||
|
refused no-body blocker --title t --body-file missing.md
|
||||||
|
refused status-bracket blocker --title t --body-file body.md --status 'a]'
|
||||||
|
refused cross-prefix blocker --title t --body-file body.md --supersedes LRN-001
|
||||||
|
refused unknown-sup blocker --title t --body-file body.md --supersedes BLK-099
|
||||||
|
refused no-value blocker --title t --body-file
|
||||||
|
refused bad-option blocker --title t --body-file body.md --bogus x
|
||||||
|
printf 'no backtick here\n' > plain.md
|
||||||
|
bash "$MEM" add blocker --title t --body-file plain.md 2>/dev/null
|
||||||
|
check T2b-blocker-needs-backtick "$?" 2
|
||||||
|
check T2c-unchanged "$(cksum < "$B")" "$sum"
|
||||||
|
bash "$MEM" add learning --title t --body-file plain.md >/dev/null
|
||||||
|
check T2d-learning-without-backtick "$?" 0
|
||||||
|
printf 'x\n```\nopen fence\n' > fence.md
|
||||||
|
bash "$MEM" add learning --title f --body-file fence.md 2>/dev/null
|
||||||
|
check T2e-open-fence-body "$?" 2
|
||||||
|
|
||||||
|
# T3 status: a dated line ends the entry, before the next heading's blank
|
||||||
|
bash "$MEM" status BLK-001 'resolved abc1234'
|
||||||
|
check T3-rc "$?" 0
|
||||||
|
check T3b-placed "$(awk '/^## BLK-001/{on=1} on && /^- \*\*Status/{print; exit}' "$B")" \
|
||||||
|
'- **Status (2026-10-27)**: resolved abc1234'
|
||||||
|
check T3c-before-next "$(awk '/Status \(2026-10-27\)/{getline n; print n; exit}' "$B")" ''
|
||||||
|
bash "$MEM" status BLK-002 'upstream, open'
|
||||||
|
check T3d-at-eof "$(tail -1 "$B")" '- **Status (2026-10-27)**: upstream, open'
|
||||||
|
bash "$MEM" status BLK-404 x 2>/dev/null
|
||||||
|
check T3e-unknown-id "$?" 2
|
||||||
|
bash "$MEM" status BLK-001 "$(printf 'a\nb')" 2>/dev/null
|
||||||
|
check T3f-multi-line "$?" 2
|
||||||
|
bash "$MEM" status BLK-001 'reopened by abc' 2>/dev/null
|
||||||
|
check T3g-needs-status-word "$?" 2
|
||||||
|
bash "$MEM" status BLK-002 'open \b \n \| kept'
|
||||||
|
check T3h-backslash-verbatim "$(tail -1 "$B")" \
|
||||||
|
'- **Status (2026-10-27)**: open \b \n \| kept'
|
||||||
|
|
||||||
|
# T4 journal: appended under today, heading created once, old date untouched
|
||||||
|
J=.claude/memory/journal.md
|
||||||
|
bash "$MEM" journal 'first'
|
||||||
|
bash "$MEM" journal '- second'
|
||||||
|
check T4-heading-once "$(grep -c '^## 2026-10-27$' "$J")" 1
|
||||||
|
check T4b-order "$(tail -2 "$J" | tr '\n' '|')" '- first|- second|'
|
||||||
|
check T4c-old-kept "$(sed -n '/^## 2026-10-26$/,/^$/p' "$J" | grep -c '^- old$')" 1
|
||||||
|
bash "$MEM" journal "$(printf 'a\nb')" 2>/dev/null
|
||||||
|
check T4d-multi-line "$?" 2
|
||||||
|
bash "$MEM" journal 'grep \bword\b w/ \n'
|
||||||
|
check T4e-backslash-verbatim "$(tail -1 "$J")" '- grep \bword\b w/ \n'
|
||||||
|
|
||||||
|
# T5 --supersedes: forward link on the new entry, status line on the old one
|
||||||
|
L=.claude/memory/learnings.md
|
||||||
|
new=$(bash "$MEM" add learning --title 'better' --body-file plain.md \
|
||||||
|
--supersedes LRN-001)
|
||||||
|
check T5-id "$new" LRN-002
|
||||||
|
check T5b-forward "$(tail -1 "$L")" 'Supersedes [[LRN-001]].'
|
||||||
|
word() { # <file> <ID> → the entry's status word, through the lib
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(. "$MEM"; memory_status_word "$(memory_entry_status "$1" "$2")")
|
||||||
|
}
|
||||||
|
check T5c-old-status "$(word "$L" LRN-001)" superseded
|
||||||
|
check T5d-index "$(bash "$MEM" index learning | grep -c '^| LRN-001 | 2026-10-27 | t | superseded |$')" 1
|
||||||
|
|
||||||
|
# T6 lock: a held lock refuses, a stale one is stolen, concurrent adds get
|
||||||
|
# distinct IDs
|
||||||
|
lock="$(git rev-parse --git-common-dir)/memory.lock"
|
||||||
|
date +%s > "$lock"
|
||||||
|
sum=$(cksum < .claude/memory/evals.md)
|
||||||
|
MEM_LOCK_TRIES=2 bash "$MEM" add eval --title t --body-file plain.md 2>/dev/null
|
||||||
|
check T6-held-rc "$?" 2
|
||||||
|
check T6b-held-unchanged "$(cksum < .claude/memory/evals.md)" "$sum"
|
||||||
|
echo $(( $(date +%s) - 60 )) > "$lock"
|
||||||
|
check T6c-stale-stolen "$(bash "$MEM" add eval --title t --body-file plain.md)" EVAL-001
|
||||||
|
check T6d-lock-released "$([ -e "$lock" ] && echo held || echo free)" free
|
||||||
|
for i in 1 2 3 4 5; do
|
||||||
|
bash "$MEM" add decision --title "d$i" --body-file plain.md > "out$i" &
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
check T6e-distinct "$(cat out1 out2 out3 out4 out5 | sort -u | wc -l | tr -d ' ')" 5
|
||||||
|
check T6f-max "$(cat out1 out2 out3 out4 out5 | sort | tail -1)" BDR-005
|
||||||
|
check T6g-check-green "$(bash "$MEM" check; echo $?)" 0
|
||||||
|
|
||||||
|
# T7 check: shape, duplicate, Index in v2 are rc 2; v1 is named, not failed
|
||||||
|
cp .claude/memory/decisions.md d.bak
|
||||||
|
printf '\n## BDR-005 — again\nx\n' >> .claude/memory/decisions.md
|
||||||
|
err=$(bash "$MEM" check 2>&1 >/dev/null); rc=$?
|
||||||
|
check T7-duplicate-rc "$rc" 2
|
||||||
|
check T7b-duplicate-named "$(printf '%s\n' "$err" | grep -c 'duplicate BDR-005')" 1
|
||||||
|
cat d.bak > .claude/memory/decisions.md
|
||||||
|
printf '\n## BDR-7 — short\nx\n' >> .claude/memory/decisions.md
|
||||||
|
bash "$MEM" check 2>/dev/null
|
||||||
|
check T7c-shape-rc "$?" 2
|
||||||
|
cat d.bak > .claude/memory/decisions.md
|
||||||
|
printf '\n## Index\n' >> .claude/memory/decisions.md
|
||||||
|
bash "$MEM" check 2>/dev/null
|
||||||
|
check T7d-index-in-v2-rc "$?" 2
|
||||||
|
cat d.bak > .claude/memory/decisions.md
|
||||||
|
mkdir v1 && printf '# Decisions\n\n## BDR-001 - legacy\n' > v1/decisions.md
|
||||||
|
err=$(bash "$MEM" check v1 2>&1 >/dev/null); rc=$?
|
||||||
|
check T7e-v1-rc "$rc" 0
|
||||||
|
check T7f-v1-named "$(printf '%s\n' "$err" | grep -c '^memory: v1: v1/decisions.md$')" 1
|
||||||
|
printf '\n## BDR-006 — fenced\n```\nx\n' >> .claude/memory/decisions.md
|
||||||
|
err=$(bash "$MEM" check 2>&1 >/dev/null); rc=$?
|
||||||
|
check T7g-open-fence-rc "$rc" 2
|
||||||
|
check T7h-open-fence-named "$(printf '%s\n' "$err" | grep -c 'fence open at end')" 1
|
||||||
|
cat d.bak > .claude/memory/decisions.md
|
||||||
|
# a duplicate a merge left behind blocks neither add nor a staged append
|
||||||
|
printf '\n## BDR-005 — merged twice (2026-10-27)\nx\n' >> .claude/memory/decisions.md
|
||||||
|
check T7i-dup-still-adds "$(bash "$MEM" add decision --title after --body-file plain.md)" BDR-006
|
||||||
|
check T7j-dup-still-reported "$(bash "$MEM" check >/dev/null 2>&1; echo $?)" 2
|
||||||
|
git add -A && git commit -qm dup
|
||||||
|
bash "$MEM" add decision --title later --body-file plain.md >/dev/null
|
||||||
|
git add .claude/memory/decisions.md
|
||||||
|
check T7k-dup-staged-append "$(bash "$MEM" check --staged >/dev/null 2>&1; echo $?)" 0
|
||||||
|
git reset -q
|
||||||
|
cat d.bak > .claude/memory/decisions.md
|
||||||
|
|
||||||
|
# T8 check --staged: an append passes, a removed entry line is rc 2
|
||||||
|
git add -A && git commit -qm base
|
||||||
|
bash "$MEM" add blocker --title three --body-file body.md >/dev/null
|
||||||
|
git add "$B"
|
||||||
|
check T8-append-staged "$(bash "$MEM" check --staged; echo $?)" 0
|
||||||
|
git commit -qm three
|
||||||
|
sed 's/^## BLK-001 — make red/## BLK-001 — make RED/' "$B" > b.tmp \
|
||||||
|
&& cat b.tmp > "$B"
|
||||||
|
git add "$B"
|
||||||
|
err=$(bash "$MEM" check --staged 2>&1 >/dev/null); rc=$?
|
||||||
|
check T8b-removed-line-rc "$rc" 2
|
||||||
|
check T8c-named "$(printf '%s\n' "$err" | grep -c 'removed inside an entry')" 1
|
||||||
|
git checkout -q HEAD -- "$B"
|
||||||
|
cp "$B" b.keep
|
||||||
|
sed '/^format: 2$/d' b.keep > "$B" && git add "$B"
|
||||||
|
check T8d-downgrade-refused "$(bash "$MEM" check --staged >/dev/null 2>&1; echo $?)" 2
|
||||||
|
git rm -q --cached "$B"
|
||||||
|
check T8e-deletion-refused "$(bash "$MEM" check --staged >/dev/null 2>&1; echo $?)" 2
|
||||||
|
git reset -q && cat b.keep > "$B"
|
||||||
|
|
||||||
|
# T9 upgrade: Index-only dates and statuses become body lines, the marker
|
||||||
|
# lands, the Index goes, headings untouched; idempotent; refusals keep the file
|
||||||
|
mkdir -p up/.claude/memory && cd up || exit 1
|
||||||
|
cat > .claude/memory/decisions.md <<'EOF'
|
||||||
|
---
|
||||||
|
type: decisions_registry
|
||||||
|
entry_prefix: BDR
|
||||||
|
---
|
||||||
|
|
||||||
|
# Decisions registry (BDR)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
| ID | Date | Title | Status |
|
||||||
|
|----|------|-------|--------|
|
||||||
|
| BDR-001 | 2026-01-01 | kept | accepted |
|
||||||
|
| BDR-002 | 2026-01-02 | stale index | accepted |
|
||||||
|
| BDR-003 | 2026-01-03 | gone | superseded by BDR-004 |
|
||||||
|
| BDR-004 | 2026-01-04 | no status | accepted |
|
||||||
|
| BDR-005 | 2026-01-05 | suffix date | accepted |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## BDR-001 — kept (2026-01-01)
|
||||||
|
- **Status**: accepted
|
||||||
|
|
||||||
|
## BDR-002 — stale index
|
||||||
|
- **Date**: 2026-01-02
|
||||||
|
- **Status**: shipped
|
||||||
|
|
||||||
|
## BDR-003 — gone
|
||||||
|
- **Status**: accepted
|
||||||
|
|
||||||
|
## BDR-004 — no status
|
||||||
|
body
|
||||||
|
|
||||||
|
## BDR-005 — suffix date — 2026-01-05
|
||||||
|
- **Status**: accepted
|
||||||
|
EOF
|
||||||
|
cat > .claude/memory/learnings.md <<'EOF'
|
||||||
|
---
|
||||||
|
type: learnings_registry
|
||||||
|
entry_prefix: LRN
|
||||||
|
---
|
||||||
|
|
||||||
|
# Learnings registry (LRN)
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
| ID | Date | Pattern | Applies to |
|
||||||
|
|----|------|---------|------------|
|
||||||
|
| LRN-001 | 2026-02-01 | old | superseded by LRN-002 |
|
||||||
|
| LRN-002 | 2026-02-02 | new | any shell |
|
||||||
|
|
||||||
|
## LRN-001 — old
|
||||||
|
x
|
||||||
|
|
||||||
|
## LRN-002 — new
|
||||||
|
y
|
||||||
|
EOF
|
||||||
|
D=.claude/memory/decisions.md
|
||||||
|
heads=$(grep '^## BDR-' "$D")
|
||||||
|
err=$(bash "$MEM" upgrade 2>&1 >/dev/null); rc=$?
|
||||||
|
check T9-rc "$rc" 0
|
||||||
|
check T9n-dropped-named "$(printf '%s\n' "$err" | grep -c '^memory: BDR-002: kept body shipped, dropped Index accepted$')" 1
|
||||||
|
check T9b-marker "$(sed -n 2p "$D")" 'format: 2'
|
||||||
|
check T9c-no-index "$(grep -c '^## Index$\|^| BDR-' "$D")" 0
|
||||||
|
check T9d-headings-same "$(grep '^## BDR-' "$D")" "$heads"
|
||||||
|
check T9e-index-out "$(bash "$MEM" index decision | sed -n '5,8p' | tr '\n' '#')" \
|
||||||
|
'| BDR-001 | 2026-01-01 | kept | accepted |#| BDR-002 | 2026-01-02 | stale index | shipped |#| BDR-003 | 2026-01-03 | gone | superseded |#| BDR-004 | 2026-01-04 | no status | accepted |#'
|
||||||
|
for loc in C en_US.UTF-8; do
|
||||||
|
check "T9r-suffix-date-$loc" "$(LC_ALL=$loc bash "$MEM" index decision | grep -c '^| BDR-005 | 2026-01-05 | suffix date | accepted |$')" 1
|
||||||
|
done
|
||||||
|
check T9f-lrn-superseded "$(bash "$MEM" index learning | grep -c '^| LRN-001 | 2026-02-01 | old | superseded |$')" 1
|
||||||
|
check T9g-lrn-applies-dropped "$(grep -c 'any shell' .claude/memory/learnings.md)" 0
|
||||||
|
check T9h-check-green "$(bash "$MEM" check; echo $?)" 0
|
||||||
|
sum=$(cksum < "$D")
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9i-idempotent "$(cksum < "$D")" "$sum"
|
||||||
|
cat > .claude/memory/blockers.md <<'EOF'
|
||||||
|
---
|
||||||
|
type: blockers_registry
|
||||||
|
entry_prefix: BLK
|
||||||
|
---
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
| ID | Date | Friction | Status |
|
||||||
|
|----|------|----------|--------|
|
||||||
|
| BLK-001 | 2026-03-01 | dup | open |
|
||||||
|
|
||||||
|
## BLK-001 — dup
|
||||||
|
- **Status**: open
|
||||||
|
|
||||||
|
## BLK-001 — dup again
|
||||||
|
EOF
|
||||||
|
sum=$(cksum < .claude/memory/blockers.md)
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9j-oracle-refuses "$?" 2
|
||||||
|
check T9k-refused-untouched "$(cksum < .claude/memory/blockers.md)" "$sum"
|
||||||
|
printf '# Evals\n\n## EVAL-001 | 2026 | pipe dialect\n' > .claude/memory/evals.md
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9l-no-frontmatter-v2 "$(sed -n 2p .claude/memory/evals.md)" 'format: 2'
|
||||||
|
check T9m-pipe-heading "$(grep -c '^## EVAL-001 — pipe dialect (2026)$' .claude/memory/evals.md)" 1
|
||||||
|
printf -- '---\ntype: evals_registry\nentry_prefix: EVAL\n---\n\n## Index\n\n| ID | Date | Output | Action |\n|----|------|--------|--------|\n\n## EVAL-001 - hyphen dialect\nx\n' \
|
||||||
|
> .claude/memory/evals.md
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9o-hyphen-upgraded "$(grep -c '^## EVAL-001 — hyphen dialect$' .claude/memory/evals.md)" 1
|
||||||
|
printf -- '---\ntype: evals_registry\nentry_prefix: EVAL\n---\n\n## Index\n\n| ID | Date | Output | Action |\n|----|------|--------|--------|\n\n## EVAL-001 — empty index (2026-04-01)\nx\n' \
|
||||||
|
> .claude/memory/evals.md
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9p-empty-index-upgraded "$(sed -n 2p .claude/memory/evals.md)" 'format: 2'
|
||||||
|
check T9q-empty-index-heading "$(grep -c '^## EVAL-001 — empty index' .claude/memory/evals.md)" 1
|
||||||
|
printf -- '---\ntype: evals_registry\nentry_prefix: EVAL\n---\n\n## Index\n\n| ID | Date | Output | Action |\n|----|------|--------|--------|\n| EVAL-001 | 2026-04-01 | a | correct |\n| EVAL-002 | 2026-04-02 | b | correct |\n\n## EVAL-001 — prose action\n- **Action**: fix the prompt next round\n\n## EVAL-002 — body wins\n- **Action**: keep it\n' \
|
||||||
|
> .claude/memory/evals.md
|
||||||
|
bash "$MEM" upgrade >/dev/null 2>&1
|
||||||
|
check T9s-eval-index-action-kept "$(sed -n '/^## EVAL-001/,/^## EVAL-002/p' .claude/memory/evals.md | grep -c 'upgrade)\*\*: correct$')" 1
|
||||||
|
check T9t-eval-body-wins "$(sed -n '/^## EVAL-002/,$p' .claude/memory/evals.md | grep -c 'upgrade)')" 0
|
||||||
|
cd "$FIX" || exit 1
|
||||||
|
|
||||||
|
# T10 parser: header tag and labelled lines only, last wins, open ranks last
|
||||||
|
cp "$ROOT/lib/tests/fixtures/blockers-v2-status.md" st.md
|
||||||
|
check T10-header-tag "$(word st.md BLK-032)" resolved
|
||||||
|
check T10b-prose-open-ignored "$(word st.md BLK-033)" resolved
|
||||||
|
check T10c-fail-open-ignored "$(word st.md BLK-034)" resolved
|
||||||
|
check T10d-final-wins "$(word st.md BLK-008)" resolved
|
||||||
|
check T10e-accepted-before-open "$(word st.md BLK-040)" accepted
|
||||||
|
check T10f-mid-title-bracket "$(word st.md BLK-041)" open
|
||||||
|
check T10h-title-prose-ignored "$(word st.md BLK-043)" open
|
||||||
|
check T10i-dated-lead-word "$(word st.md BLK-044)" open
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
check T10j-tag-only "$(. "$MEM"; memory_entry_status st.md BLK-043)" '[open]'
|
||||||
|
closed() { # <word> → yes when memory_closed accepts it
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(. "$MEM"; memory_closed "$1") && echo yes || echo no; }
|
||||||
|
check T10k-closed "$(closed resolved)$(closed superseded)$(closed deprecated)" yesyesyes
|
||||||
|
check T10l-not-closed "$(closed accepted)$(closed open)$(closed upstream)" nonono
|
||||||
|
mkdir -p v1h/.claude/memory
|
||||||
|
printf '# Blockers\n\n## BLK-001 - hyphen\n- **Status**: resolved\n\n## BLK-002 | 2026-05-18 | pipe\nStatus: open\n' \
|
||||||
|
> v1h/.claude/memory/blockers.md
|
||||||
|
check T10m-hyphen-dialect "$(word v1h/.claude/memory/blockers.md BLK-001)" resolved
|
||||||
|
check T10n-pipe-dialect "$(word v1h/.claude/memory/blockers.md BLK-002)" open
|
||||||
|
bash "$MEM" -C v1h status BLK-002 'resolved by abc' 2>/dev/null
|
||||||
|
check T10o-status-on-v1-pipe "$(word v1h/.claude/memory/blockers.md BLK-002)" resolved
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(. "$MEM"; memory_entry_status st.md BLK-042) >/dev/null
|
||||||
|
check T10g-no-candidate-rc "$?" 1
|
||||||
|
|
||||||
|
# T11 -C runs from elsewhere
|
||||||
|
check T11-dash-C "$(cd / && bash "$MEM" -C "$FIX" index blocker | grep -c '^| BLK-00')" 3
|
||||||
|
bash "$MEM" -C /nonexistent check 2>/dev/null
|
||||||
|
check T11b-bad-dir "$?" 2
|
||||||
|
bash "$MEM" frobnicate 2>/dev/null
|
||||||
|
check T11c-usage "$?" 2
|
||||||
|
|
||||||
|
# T14 r3: any-level ID allocation, open fence refused, v1 status as a body
|
||||||
|
# line, token lock, empty-lock steal, journal exact key, --staged dir
|
||||||
|
cd "$FIX" || exit 1
|
||||||
|
mkdir -p h3/.claude/memory && cd h3 || exit 1
|
||||||
|
printf '# Decisions\n\n### BDR-001 — a\nx\n\n### BDR-007 — b\ny\n' \
|
||||||
|
> .claude/memory/decisions.md
|
||||||
|
check T14-h3-next "$(bash "$MEM" add decision --title c --body-file "$FIX/plain.md" 2>/dev/null)" BDR-008
|
||||||
|
printf '# Blockers\n\n## BLK-001 - legacy\n- Status: open\n' \
|
||||||
|
> .claude/memory/blockers.md
|
||||||
|
bash "$MEM" add blocker --title fixed --body-file "$FIX/body.md" \
|
||||||
|
--status resolved >/dev/null 2>&1
|
||||||
|
check T14b-v1-no-tag "$(grep -c '^## BLK-002 — fixed (2026-10-27)$' .claude/memory/blockers.md)" 1
|
||||||
|
check T14c-v1-status-line "$(sed -n '/^## BLK-002/{n;p;}' .claude/memory/blockers.md)" '- **Status**: resolved'
|
||||||
|
bash "$MEM" add blocker --title t --body-file "$FIX/body.md" --status fixed 2>/dev/null
|
||||||
|
check T14d-status-word-required "$?" 2
|
||||||
|
cd "$FIX" || exit 1
|
||||||
|
cp .claude/memory/evals.md e.bak
|
||||||
|
printf '\n```\nunclosed\n' >> .claude/memory/evals.md
|
||||||
|
sum=$(cksum < .claude/memory/evals.md)
|
||||||
|
bash "$MEM" add eval --title t --body-file plain.md >/dev/null 2>&1
|
||||||
|
check T14e-open-fence-refused "$?" 2
|
||||||
|
check T14f-open-fence-untouched "$(cksum < .claude/memory/evals.md)" "$sum"
|
||||||
|
cat e.bak > .claude/memory/evals.md
|
||||||
|
lock="$(git rev-parse --git-common-dir)/memory.lock"
|
||||||
|
echo "$(date +%s) someone.1" > "$lock"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
(. "$MEM"; _mem_unlock "$lock" me.2)
|
||||||
|
check T14g-foreign-token-kept "$(cut -d' ' -f2 "$lock")" someone.1
|
||||||
|
: > "$lock"
|
||||||
|
check T14h-empty-lock-stolen "$(bash "$MEM" add eval --title e --body-file plain.md)" EVAL-002
|
||||||
|
echo "$(( $(date +%s) - 60 )) dead.1" > "$lock"
|
||||||
|
for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
|
||||||
|
bash "$MEM" add learning --title "r$i" --body-file plain.md > "lr$i" &
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
check T14i-twelve-distinct "$(cat lr1 lr2 lr3 lr4 lr5 lr6 lr7 lr8 lr9 lr10 lr11 lr12 | sort -u | wc -l | tr -d ' ')" 12
|
||||||
|
check T14j-no-lock-left "$([ -e "$lock" ] || [ -e "$lock.steal" ] && echo left || echo none)" none
|
||||||
|
check T14k-check-green "$(bash "$MEM" check; echo $?)" 0
|
||||||
|
J=.claude/memory/journal.md
|
||||||
|
printf '\n## 2026-10-28 (cont. 1) — legacy\n- kept\n' >> "$J"
|
||||||
|
MEMORY_DATE=2026-10-28 bash "$MEM" journal 'new day'
|
||||||
|
check T14l-cont-not-matched "$(grep -c '^## 2026-10-28$' "$J")" 1
|
||||||
|
check T14m-cont-untouched "$(sed -n '/(cont. 1)/{n;p;}' "$J")" '- kept'
|
||||||
|
bash "$MEM" check --staged /abs 2>/dev/null
|
||||||
|
check T14n-staged-absolute "$?" 2
|
||||||
|
bash "$MEM" status BLK-404 'open' 2>&1 >/dev/null | grep -c restored > rs
|
||||||
|
check T14o-no-restore-noise "$(tr -d ' ' < rs)" 0
|
||||||
|
|
||||||
|
# T15 upgrade migrates every measured v1 dialect; the oracle refuses what it
|
||||||
|
# cannot prove. Blockers fixtures: the open set (reconcile's reader) before
|
||||||
|
# and after must be the same, the check green, a second run a no-op
|
||||||
|
v1blk() { # <dir> <body…> → <dir>/blockers.md with a v1 frontmatter
|
||||||
|
mkdir -p "$1"; { printf -- '---\ntype: blockers_registry\n'
|
||||||
|
printf 'entry_prefix: BLK\n---\n\n# Blockers\n'; shift; printf '%s\n' "$@"
|
||||||
|
} > "$(dirname "$1/x")/blockers.md"; }
|
||||||
|
memory_word_of() { # <file> <ID> → the strict reader's status word
|
||||||
|
bash -c '. "$1"; memory_status_word "$(memory_entry_status "$2" "$3")"' \
|
||||||
|
_ "$MEM" "$1" "$2"; }
|
||||||
|
openset() { bash -c '. "$1/lib/reconcile.sh"; reconcile_blk_open "$2"' _ \
|
||||||
|
"$ROOT" "$1" | cut -f1 | tr '\n' ' '; }
|
||||||
|
dialect() { # <name> <heading regex expected> — fixture already in d15/<name>
|
||||||
|
local f="d15/$1/blockers.md" before
|
||||||
|
before=$(openset "$f")
|
||||||
|
bash "$MEM" upgrade "d15/$1" >/dev/null 2>&1
|
||||||
|
check "T15-$1-rc" "$?" 0
|
||||||
|
check "T15-$1-v2" "$(sed -n 2p "$f")" 'format: 2'
|
||||||
|
check "T15-$1-heading" "$(grep -c "$2" "$f")" 1
|
||||||
|
check "T15-$1-check" "$(bash "$MEM" check "d15/$1" 2>&1; echo $?)" 0
|
||||||
|
# a ### file: reconcile's v1 reader never saw its entries (asserted below)
|
||||||
|
[ "${3:-}" = unseen ] && before=$(openset "$f")
|
||||||
|
check "T15-$1-verdicts" "$(openset "$f")" "$before"
|
||||||
|
sum=$(cksum < "$f"); bash "$MEM" upgrade "d15/$1" >/dev/null 2>&1
|
||||||
|
check "T15-$1-idempotent" "$(cksum < "$f")" "$sum"; }
|
||||||
|
v1blk d15/hyphen '## BLK-001 - hyphen, resolved' 'Status: resolved' '' \
|
||||||
|
'## BLK-002 - hyphen, open' 'Status: open'
|
||||||
|
dialect hyphen '^## BLK-001 — hyphen, resolved$'
|
||||||
|
v1blk d15/pipe '## BLK-001 | 2026-05-18 | pipe, resolved' 'Status: resolved' '' \
|
||||||
|
'## BLK-002 | 2026-05-19 | pipe, open' 'Status: open'
|
||||||
|
dialect pipe '^## BLK-001 — pipe, resolved (2026-05-18)$'
|
||||||
|
v1blk d15/hashes '### BLK-001 — three hashes, resolved' 'Status: resolved' '' \
|
||||||
|
'### BLK-002 — three hashes, open' 'Status: open'
|
||||||
|
dialect hashes '^## BLK-001 — three hashes, resolved$' unseen
|
||||||
|
# ### entries were never in the v1 reader's set: no repair line, strict read
|
||||||
|
check T15-hashes-no-repair "$(grep -c 'upgrade)' d15/hashes/blockers.md)" 0
|
||||||
|
check T15-hashes-1-resolved "$(memory_word_of d15/hashes/blockers.md BLK-001)" resolved
|
||||||
|
check T15-hashes-2-open "$(memory_word_of d15/hashes/blockers.md BLK-002)" open
|
||||||
|
# probe d: a ### entry after a ## one must not leak its status into it
|
||||||
|
v1blk d15/probed '## BLK-003 — three, open' 'Status: open' '' \
|
||||||
|
'### BLK-001 — x' 'Status: resolved'
|
||||||
|
bash "$MEM" upgrade d15/probed >/dev/null 2>&1
|
||||||
|
check T15-probed-no-repair "$(grep -c 'upgrade)' d15/probed/blockers.md)" 0
|
||||||
|
check T15-probed-open "$(memory_word_of d15/probed/blockers.md BLK-003)" open
|
||||||
|
# a heading line quoted inside a ``` fence does not end the entry's range
|
||||||
|
v1blk d15/fenced '## BLK-003 — three' 'Status: resolved' '```' \
|
||||||
|
'### BLK-001 — quoted' '```' 'Status: open'
|
||||||
|
bash "$MEM" upgrade d15/fenced >/dev/null 2>&1
|
||||||
|
check T15-fenced-no-repair "$(grep -c 'upgrade)' d15/fenced/blockers.md)" 0
|
||||||
|
check T15-fenced-open "$(memory_word_of d15/fenced/blockers.md BLK-003)" open
|
||||||
|
# status words inside a ``` fence are not the entry's status
|
||||||
|
v1blk d15/fstat-a '## BLK-003 — three' 'Status: open' '```' 'Status: resolved' '```'
|
||||||
|
bash "$MEM" upgrade d15/fstat-a >/dev/null 2>&1
|
||||||
|
check T15-fenced-status-a-no-repair "$(grep -c 'upgrade)' d15/fstat-a/blockers.md)" 0
|
||||||
|
check T15-fenced-status-a "$(memory_word_of d15/fstat-a/blockers.md BLK-003)" open
|
||||||
|
v1blk d15/fstat-b '## BLK-003 — three' 'Status: open' '```' \
|
||||||
|
'## BLK-009 — quoted' 'Status: resolved' '```'
|
||||||
|
bash "$MEM" upgrade d15/fstat-b >/dev/null 2>&1
|
||||||
|
check T15-fenced-status-b-no-repair "$(grep -c 'upgrade)' d15/fstat-b/blockers.md)" 0
|
||||||
|
check T15-fenced-status-b "$(memory_word_of d15/fstat-b/blockers.md BLK-003)" open
|
||||||
|
# `## ID—x` (no space) is no v1-visible heading: no silent flip
|
||||||
|
v1blk d15/nospace '## BLK-001—x' 'Status: resolved' '' \
|
||||||
|
'## BLK-002 — y' 'Status: open'
|
||||||
|
sum=$(cksum < d15/nospace/blockers.md)
|
||||||
|
bash "$MEM" upgrade d15/nospace >/dev/null 2>&1
|
||||||
|
check T15-nospace-refused "$?" 2
|
||||||
|
check T15-nospace-untouched "$(cksum < d15/nospace/blockers.md)" "$sum"
|
||||||
|
check T15-nospace-no-repair "$(grep -c 'upgrade)' d15/nospace/blockers.md)" 0
|
||||||
|
# RECONCILE_GREP reaches reconcile's v1 pipeline
|
||||||
|
v1blk d15/v1only '## BLK-001 — v1 file' 'Status: resolved'
|
||||||
|
printf '#!/bin/sh\necho STUB >&2\nexec /usr/bin/grep "$@"\n' > gstub
|
||||||
|
chmod +x gstub
|
||||||
|
stubbed=$(RECONCILE_GREP="$PWD/gstub" bash -c \
|
||||||
|
'. "$1/lib/reconcile.sh"; reconcile_blk_current_status "$2" BLK-001' \
|
||||||
|
_ "$ROOT" d15/v1only/blockers.md 2>&1 >/dev/null | grep -c STUB)
|
||||||
|
check T15-reconcile-grep "$([ "$stubbed" -gt 0 ] && echo reached || echo missed)" reached
|
||||||
|
v1blk d15/suffix '## BLK-001 — suffix — RESOLVED' 'Status: resolved in repo' \
|
||||||
|
'' '## BLK-002 — suffix, open' 'Status: open'
|
||||||
|
dialect suffix '^## BLK-001 — suffix — RESOLVED$'
|
||||||
|
v1blk d15/datestatus '## BLK-001 — one line' \
|
||||||
|
'date: 2026-06-02 · status: RESOLVED 2026-06-04' '' \
|
||||||
|
'## BLK-002 — one line open' 'date: 2026-06-02 · status: open'
|
||||||
|
dialect datestatus '^- \*\*Status ([0-9-]*, upgrade)\*\*: resolved$'
|
||||||
|
check T15-datestatus-one-line "$(grep -c 'upgrade)' d15/datestatus/blockers.md)" 1
|
||||||
|
v1blk d15/statut '## BLK-001 — fr' '- **Statut** : resolved' '' \
|
||||||
|
'## BLK-002 — fr open' '- **Statut** : open'
|
||||||
|
dialect statut '^- \*\*Status ([0-9-]*, upgrade)\*\*: resolved$'
|
||||||
|
mkdir -p d15/nofm
|
||||||
|
printf '# Blockers\n\n## BLK-001 | 2026-05-18 | no frontmatter\n%s\n' \
|
||||||
|
'- **Statut** : resolved' > d15/nofm/blockers.md
|
||||||
|
dialect nofm '^## BLK-001 — no frontmatter (2026-05-18)$'
|
||||||
|
check T15-nofm-template "$(sed -n 1,3p d15/nofm/blockers.md | tr '\n' '#')" \
|
||||||
|
'---#format: 2#type: blockers_registry#'
|
||||||
|
check T15-nofm-body "$(grep -c '^# Blockers$' d15/nofm/blockers.md)" 1
|
||||||
|
# a relative lib path plus -C from another cwd still finds the templates
|
||||||
|
mkdir -p d15/relpath/.claude/memory
|
||||||
|
printf '# Blockers\n\n## BLK-001 | 2026-05-18 | no frontmatter\n%s\n' \
|
||||||
|
'- **Statut** : resolved' > d15/relpath/.claude/memory/blockers.md
|
||||||
|
(cd "$ROOT" && bash lib/memory.sh -C "$FIX/d15/relpath" upgrade >/dev/null 2>&1)
|
||||||
|
check T15-relpath-rc "$?" 0
|
||||||
|
check T15-relpath-format "$(grep -c '^format: 2$' d15/relpath/.claude/memory/blockers.md)" 1
|
||||||
|
# an em-dash heading stays byte-identical, a dated one included
|
||||||
|
v1blk d15/keep '## BLK-001 — keep — 2026-05-18' 'Status: open'
|
||||||
|
bash "$MEM" upgrade d15/keep >/dev/null 2>&1
|
||||||
|
check T15-keep-heading "$(grep -c '^## BLK-001 — keep — 2026-05-18$' d15/keep/blockers.md)" 1
|
||||||
|
# v1 open, strict reader closed: kept and named (BLK-032..034)
|
||||||
|
v1blk d15/fix '## BLK-001 — prose' 'Status: Resolved'
|
||||||
|
err=$(bash "$MEM" upgrade d15/fix 2>&1 >/dev/null)
|
||||||
|
check T15-fix-named "$(printf '%s\n' "$err" | grep -c 'BLK-001: v1 reader open, strict reader closed')" 1
|
||||||
|
# tampered: no status line lands, the oracle refuses, the file is untouched
|
||||||
|
v1blk d15/tamper '## BLK-001 | 2026-05-18 | lost closure' \
|
||||||
|
'date: 2026-06-02 · status: RESOLVED'
|
||||||
|
sum=$(cksum < d15/tamper/blockers.md)
|
||||||
|
err=$(bash -c '. "$1"; _mem_upgrade_repair() { :; }; memory_upgrade "$2"' \
|
||||||
|
_ "$MEM" d15/tamper 2>&1 >/dev/null)
|
||||||
|
check T15-tamper-rc "$?" 2
|
||||||
|
check T15-tamper-culprit "$(printf '%s\n' "$err" | grep -c 'moved a verdict: BLK-001')" 1
|
||||||
|
check T15-tamper-untouched "$(cksum < d15/tamper/blockers.md)" "$sum"
|
||||||
|
|
||||||
|
# T16 final-review fixes
|
||||||
|
# lock dir not writable: bounded, named, rc 2 (never a spin)
|
||||||
|
chmod a-w .git
|
||||||
|
out=$(timeout 10 bash "$MEM" journal x 2>&1); rc=$?
|
||||||
|
chmod u+w .git
|
||||||
|
check T16-lock-rc "$rc" 2
|
||||||
|
check T16-lock-named "$(printf '%s\n' "$out" | grep -c 'memory: cannot create lock: ')" 1
|
||||||
|
# a bare prefix is not an entry ID
|
||||||
|
sum=$(cksum < "$B")
|
||||||
|
bash "$MEM" status BLK "resolved abc" >/dev/null 2>&1
|
||||||
|
check T16-bare-prefix-rc "$?" 2
|
||||||
|
check T16-bare-prefix-untouched "$(cksum < "$B")" "$sum"
|
||||||
|
# a bullet Index is refused, byte-identical
|
||||||
|
mkdir -p t16/bul
|
||||||
|
printf -- '---\ntype: blockers_registry\nentry_prefix: BLK\n---\n\n# B\n\n' \
|
||||||
|
> t16/bul/blockers.md
|
||||||
|
printf '## Index\n\n- BLK-001 — x (resolved 2026-08-03)\n\n---\n\n' \
|
||||||
|
>> t16/bul/blockers.md
|
||||||
|
printf '## BLK-001 — x\n- **Status**: resolved\n' >> t16/bul/blockers.md
|
||||||
|
sum=$(cksum < t16/bul/blockers.md)
|
||||||
|
err=$(bash "$MEM" upgrade t16/bul 2>&1 >/dev/null); rc=$?
|
||||||
|
check T16-bullet-index-rc "$rc" 2
|
||||||
|
check T16-bullet-index-named "$(printf '%s\n' "$err" | grep -c 'blockers.md: ## Index is not a table, not upgraded')" 1
|
||||||
|
check T16-bullet-index-untouched "$(cksum < t16/bul/blockers.md)" "$sum"
|
||||||
|
# check refuses nothing-to-check
|
||||||
|
bash "$MEM" check --stagd >/dev/null 2>&1
|
||||||
|
check T16-check-flag "$?" 2
|
||||||
|
err=$(bash "$MEM" check /no/such/dir 2>&1); rc=$?
|
||||||
|
check T16-check-nodir-rc "$rc" 2
|
||||||
|
check T16-check-nodir-named "$(printf '%s\n' "$err" | grep -c 'memory: no memory dir: /no/such/dir')" 1
|
||||||
|
# a `- **Date** :` body gets no second Date line
|
||||||
|
mkdir -p t16/dt
|
||||||
|
printf -- '---\ntype: blockers_registry\nentry_prefix: BLK\n---\n\n# B\n\n' \
|
||||||
|
> t16/dt/blockers.md
|
||||||
|
{ printf '## Index\n\n| ID | Date | Title | Status |\n|---|---|---|---|\n'
|
||||||
|
printf '| BLK-001 | 2026-05-01 | x | open |\n\n---\n\n'
|
||||||
|
printf '## BLK-001 — x\n- **Date** : 2026-05-01\n- **Status**: open\n'
|
||||||
|
} >> t16/dt/blockers.md
|
||||||
|
bash "$MEM" upgrade t16/dt >/dev/null 2>&1
|
||||||
|
check T16-date-spacing "$(grep -c '^- \*\*Date\*\*' t16/dt/blockers.md)" 1
|
||||||
|
|
||||||
|
# T12 this repo's registries pass the check
|
||||||
|
check T12-live-check "$(bash "$MEM" -C "$ROOT" check >/dev/null 2>&1; echo $?)" 0
|
||||||
|
|
||||||
|
# T13 templates are born v2; the session banner names a v1 project only
|
||||||
|
for t in decisions learnings blockers evals; do
|
||||||
|
check "T13-template-$t-v2" "$(sed -n 2p "$ROOT/templates/memory/$t.md")" 'format: 2'
|
||||||
|
check "T13b-template-$t-no-index" "$(grep -c '^## Index$' "$ROOT/templates/memory/$t.md")" 0
|
||||||
|
done
|
||||||
|
banner() { (cd "$1" && SESSION_START_OFFLINE=1 bash "$ROOT/hooks/session-start.sh" \
|
||||||
|
</dev/null 2>/dev/null) | grep -c "${2:-registry v1}"; }
|
||||||
|
check T13c-banner-v1-v2 "$(banner "$FIX/v1h" 'registry v1: 1 file(s) (memory.sh check)')/$(banner "$FIX")" 1/0
|
||||||
|
cp "$FIX/v1h/.claude/memory/blockers.md" v1h.bak
|
||||||
|
printf -- '---\nformat: 2\n---\n' > "$FIX/v1h/.claude/memory/blockers.md"
|
||||||
|
check T13d-banner-flips-off "$(banner "$FIX/v1h")" 0
|
||||||
|
cat v1h.bak > "$FIX/v1h/.claude/memory/blockers.md"
|
||||||
|
echo "PASS=$pass FAIL=$fail"
|
||||||
|
[ "$fail" -eq 0 ]
|
||||||
@@ -155,6 +155,22 @@ if [ -z "$OUT" ]; then ok "stdout empty on rejection (no stale hash)"; else ko "
|
|||||||
if [ "$BEFORE" = "$AFTER" ]; then ok "HEAD unmoved"; else ko "HEAD moved despite rejection"; fi
|
if [ "$BEFORE" = "$AFTER" ]; then ok "HEAD unmoved"; else ko "HEAD moved despite rejection"; fi
|
||||||
rm -rf "$R"
|
rm -rf "$R"
|
||||||
|
|
||||||
|
echo "== check --staged chokepoint (v2 registry, phase 4a)"
|
||||||
|
d="$(new_repo)"
|
||||||
|
printf -- '---\nformat: 2\ntype: decisions_registry\nentry_prefix: BDR\n---\n\n## BDR-001 — kept (2026-10-27)\n- **Status**: accepted\n' \
|
||||||
|
> "$d/.claude/memory/decisions.md"
|
||||||
|
git -C "$d" add -A && git -C "$d" commit -qm v2
|
||||||
|
head_before=$(git -C "$d" rev-parse HEAD)
|
||||||
|
sed 's/kept/rewritten/' "$d/.claude/memory/decisions.md" > "$d/x.tmp" \
|
||||||
|
&& cat "$d/x.tmp" > "$d/.claude/memory/decisions.md"
|
||||||
|
out="$(cd "$d" && bash "$HELPER" commit "chore(memory): bad" 2>/dev/null)"; rc=$?
|
||||||
|
staged="$(git -C "$d" diff --cached --name-only)"
|
||||||
|
if [ "$rc" -eq 6 ] && [ -z "$out" ] && [ -z "$staged" ] && [ "$(git -C "$d" rev-parse HEAD)" = "$head_before" ]; then ok "in-place edit of a v2 entry → rc 6, nothing committed, nothing staged"; else ko "rc=$rc out=[$out] staged=[$staged] — in-place edit committed or left staged"; fi
|
||||||
|
git -C "$d" checkout -q HEAD -- .claude/memory/decisions.md
|
||||||
|
printf '\n## BDR-002 — added (2026-10-27)\nbody\n' >> "$d/.claude/memory/decisions.md"
|
||||||
|
out="$(cd "$d" && bash "$HELPER" commit "chore(memory): BDR-002" 2>/dev/null)"; rc=$?
|
||||||
|
if [ "$rc" -eq 0 ] && [ -n "$out" ]; then ok "append to a v2 registry → committed"; else ko "append refused rc=$rc"; fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
printf 'RESULT: %d passed, %d failed\n' "$PASS" "$FAIL"
|
printf 'RESULT: %d passed, %d failed\n' "$PASS" "$FAIL"
|
||||||
[ "$FAIL" -eq 0 ]
|
[ "$FAIL" -eq 0 ]
|
||||||
@@ -94,5 +94,21 @@ if reconcile_oracle_msg_committed "$orepo" "ahead commit"; then ok "T7c msg_comm
|
|||||||
if reconcile_oracle_msg_committed "$orepo" "nonexistent-message-xyz"; then no "T7c msg_committed should be rc≠0 for an absent message"; else ok "T7c msg_committed rc≠0 for an absent message"; fi
|
if reconcile_oracle_msg_committed "$orepo" "nonexistent-message-xyz"; then no "T7c msg_committed should be rc≠0 for an absent message"; else ok "T7c msg_committed rc≠0 for an absent message"; fi
|
||||||
rm -rf "$OWORK"
|
rm -rf "$OWORK"
|
||||||
|
|
||||||
|
echo; echo "=== T8 shared parser — header [tag] + labelled lines, prose never (BLK-032..034) ==="
|
||||||
|
v2="$FIX/blockers-v2-status.md"
|
||||||
|
open_v2=$(reconcile_blk_open "$v2" | cut -f1 | sort | tr '\n' ' ')
|
||||||
|
if [ "$open_v2" = "BLK-040 BLK-041 BLK-042 BLK-043 BLK-044 " ]; then ok "T8a open = {040..044}: 032..034 and 008 closed, accepted stays open"; else no "T8a open = [$open_v2], expected {040,041,042,043,044}"; fi
|
||||||
|
case "$(reconcile_blk_current_status "$v2" BLK-034)" in
|
||||||
|
'[resolved]') ok "T8b BLK-034 status = its own header tag, title never read";;
|
||||||
|
*) no "T8b BLK-034 read from prose (fail-open), not the header tag";;
|
||||||
|
esac
|
||||||
|
v1d="$FIX/blockers-v1-dialects.md"
|
||||||
|
open_v1=$(reconcile_blk_open "$v1d" | cut -f1 | tr '\n' ' ')
|
||||||
|
if [ "$open_v1" = "BLK-002 " ]; then ok "T8c v1 hyphen and pipe headings still parsed"; else no "T8c v1 dialects open = [$open_v1], expected {002}"; fi
|
||||||
|
case "$(reconcile_blk_current_status "$v1d" BLK-004)" in
|
||||||
|
*resolved*) ok "T8d lib-shaped v1 blocker (status body line first) reads closed";;
|
||||||
|
*) no "T8d lib-shaped v1 blocker BLK-004 status not read as resolved";;
|
||||||
|
esac
|
||||||
|
|
||||||
echo; echo "================ $pass GREEN / $fail RED ================"
|
echo; echo "================ $pass GREEN / $fail RED ================"
|
||||||
[ "$fail" -eq 0 ] && exit 0 || exit 1
|
[ "$fail" -eq 0 ] && exit 0 || exit 1
|
||||||
+2
-1
@@ -542,5 +542,6 @@
|
|||||||
"**Sensitive remote targets**: any namespace, host, database or container whose name carries `prod` or `production` as a whole word or name segment.",
|
"**Sensitive remote targets**: any namespace, host, database or container whose name carries `prod` or `production` as a whole word or name segment.",
|
||||||
"**Sensitive data locations & audiences**: per-project `.env` files (gitignored) hold database, deploy and API credentials; some web projects store customer-submitted form data under a retention policy. Both are personal or client data — never send either to an external service."
|
"**Sensitive data locations & audiences**: per-project `.env` files (gitignored) hold database, deploy and API credentials; some web projects store customer-submitted form data under a retention policy. Both are personal or client data — never send either to an external service."
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"switchModelsOnFlag": true
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ A bugfix with an understood root cause is almost always worth one entry:
|
|||||||
[LRN-XXX — <pattern>] (optionnel)
|
[LRN-XXX — <pattern>] (optionnel)
|
||||||
Valider ? (all / blockers-only / edit / skip)
|
Valider ? (all / blockers-only / edit / skip)
|
||||||
```
|
```
|
||||||
4. Append approved entries + update the Index. Add a line to today's heading in `.claude/memory/journal.md`.
|
4. Write approved entries per `lib/capitalize-commit.md` § WRITE: a new blocker `add blocker … --status resolved`, an existing one now fixed `status <BLK-ID> "resolved <hash>"`, an LRN `add learning …` (no status); the journal line `memory.sh journal`.
|
||||||
|
|
||||||
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate may mirror the user's language; the appended entries must not.
|
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate may mirror the user's language; the appended entries must not.
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ with no dedup.
|
|||||||
|
|
||||||
For every candidate from STEP 1 (and STEP 1B), check whether it is already
|
For every candidate from STEP 1 (and STEP 1B), check whether it is already
|
||||||
captured before proposing it. Pull the distinctive keyword(s) of the candidate
|
captured before proposing it. Pull the distinctive keyword(s) of the candidate
|
||||||
and grep the relevant registry (Index + bodies):
|
and grep the relevant registry (headings + bodies):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Example: candidate is a learning about "cd -P symlink resolution"
|
# Example: candidate is a learning about "cd -P symlink resolution"
|
||||||
@@ -246,14 +246,8 @@ Registries first (in registry order), then the TODO.
|
|||||||
|
|
||||||
Registry entries — for each approved:
|
Registry entries — for each approved:
|
||||||
|
|
||||||
1. Read the target registry file.
|
1. Write each approved entry per `lib/capitalize-commit.md` § WRITE (`memory.sh add`, one call each; a resolved blocker: `memory.sh status <ID> "resolved <hash>"`).
|
||||||
2. Next sequential ID = scan existing `## <PREFIX>-NNN` body headings, take max,
|
2. Body in **caveman English** per CLAUDE.md memory format: drop articles +
|
||||||
+1 (e.g. last `## BDR-018` → `BDR-019`). Never reuse, never renumber.
|
|
||||||
3. Append the full entry at the **end** of the body (never rewrite existing
|
|
||||||
entries — append-only).
|
|
||||||
4. Add one row to the `## Index` table at the top: `| <ID> | <date> | <title>
|
|
||||||
| <status> |` (column set varies per file — match that file's header row).
|
|
||||||
5. Body in **caveman English** per CLAUDE.md memory format: drop articles +
|
|
||||||
filler, fragments OK, short synonyms. Keep code/URLs/error-quotes/IDs/dates
|
filler, fragments OK, short synonyms. Keep code/URLs/error-quotes/IDs/dates
|
||||||
verbatim. Entries are ALWAYS English even if the STEP 3 prompt mirrored the
|
verbatim. Entries are ALWAYS English even if the STEP 3 prompt mirrored the
|
||||||
user's language.
|
user's language.
|
||||||
@@ -269,8 +263,7 @@ TODO — for each approved:
|
|||||||
Write one timeline line under today's `## YYYY-MM-DD` heading — even if every
|
Write one timeline line under today's `## YYYY-MM-DD` heading — even if every
|
||||||
candidate was skipped or already captured.
|
candidate was skipped or already captured.
|
||||||
|
|
||||||
- Heading exists → append a bullet.
|
- `bash "$HOME/.claude/lib/memory.sh" journal "<line>"` per bullet (it creates today's heading when missing).
|
||||||
- Missing → create `## YYYY-MM-DD` and write 3-5 bullets summarizing the session.
|
|
||||||
|
|
||||||
Reference any IDs written this run AND the TODO ops:
|
Reference any IDs written this run AND the TODO ops:
|
||||||
`BDR-019 + LRN-026 capitalized; checked 1 done, added 1 task.`
|
`BDR-019 + LRN-026 capitalized; checked 1 done, added 1 task.`
|
||||||
@@ -302,6 +295,7 @@ Follow `~/.claude/lib/capitalize-commit.md`:
|
|||||||
- **rc 3** → unsafe git state (detached / merge / rebase) or not a git repo:
|
- **rc 3** → unsafe git state (detached / merge / rebase) or not a git repo:
|
||||||
memory stays in the working tree, surface the helper's stderr, do NOT retry.
|
memory stays in the working tree, surface the helper's stderr, do NOT retry.
|
||||||
The flush is safe on disk; STEP 6 must say NOT committed, not ✅-all.
|
The flush is safe on disk; STEP 6 must say NOT committed, not ✅-all.
|
||||||
|
- **rc 5 / rc 6** → nothing committed; surface the helper's stderr; meaning and recovery in `lib/capitalize-commit.md` (rc 6: fix the registry, then /commit-change). STEP 6 says NOT committed.
|
||||||
- **rc 0, hash EMPTY → must NOT happen from this step.** STEP 5 always writes
|
- **rc 0, hash EMPTY → must NOT happen from this step.** STEP 5 always writes
|
||||||
the journal line, so memory is ALWAYS pending at 5B → the helper always has
|
the journal line, so memory is ALWAYS pending at 5B → the helper always has
|
||||||
≥1 change → the hash is non-empty by construction. An empty hash here means
|
≥1 change → the hash is non-empty by construction. An empty hash here means
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ CAPITALIZE — proposé
|
|||||||
Valider ? (all / <IDs> / edit / skip)
|
Valider ? (all / <IDs> / edit / skip)
|
||||||
```
|
```
|
||||||
|
|
||||||
Always append a 1-line entry to today's heading in `.claude/memory/journal.md`.
|
Approved entries and the always-written 1-line journal entry: per `lib/capitalize-commit.md` § WRITE (`memory.sh add` / `memory.sh journal`).
|
||||||
|
|
||||||
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate may mirror the user's language; the appended entries must not.
|
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate may mirror the user's language; the appended entries must not.
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ Hotfixes are often trivial (typo, config, import) — skip by default. But if th
|
|||||||
Default behaviour: `CAPITALIZE: hotfix trivial, skip` (no prompt, no output).
|
Default behaviour: `CAPITALIZE: hotfix trivial, skip` (no prompt, no output).
|
||||||
Ask the user only when there is an actual candidate to propose.
|
Ask the user only when there is an actual candidate to propose.
|
||||||
|
|
||||||
Always append a 1-line entry to today's heading in `.claude/memory/journal.md` (even trivial hotfix — journal is timeline, not signal).
|
Always append a 1-line journal entry (even trivial hotfix — journal is timeline, not signal) and any approved BLK/LRN per `lib/capitalize-commit.md` § WRITE.
|
||||||
|
|
||||||
**Language rule**: the journal line and any proposed BLK/LRN entries are ALWAYS written English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman).
|
**Language rule**: the journal line and any proposed BLK/LRN entries are ALWAYS written English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman).
|
||||||
|
|
||||||
|
|||||||
@@ -298,9 +298,7 @@ capitalizes NOTHING. Do NOT fabricate a BDR to fill the step. Print
|
|||||||
[ decisions.md ] BDR-XXX — <decision> — <1-line why>
|
[ decisions.md ] BDR-XXX — <decision> — <1-line why>
|
||||||
Valider lesquels ? (all / <IDs> / edit / skip)
|
Valider lesquels ? (all / <IDs> / edit / skip)
|
||||||
```
|
```
|
||||||
3. Append approved entries to the existing registries (bootstrapped at STEP 5,
|
3. Write approved entries to the registries bootstrapped at STEP 5 (in the root commit), and the journal line, per `lib/capitalize-commit.md` § WRITE.
|
||||||
in the root commit) + update the Index. Append a journal line under today's
|
|
||||||
heading in `.claude/memory/journal.md`.
|
|
||||||
|
|
||||||
**Hash rule — founding decisions carry NO commit hash; use path + date only.**
|
**Hash rule — founding decisions carry NO commit hash; use path + date only.**
|
||||||
This is by nature, not an omission: a founding decision is made at DESIGN
|
This is by nature, not an omission: a founding decision is made at DESIGN
|
||||||
|
|||||||
@@ -1179,7 +1179,7 @@ per the project's commit convention), and verifies every rule is in
|
|||||||
hash and `git -C <ROOT> show --stat <hash>`, the user decides.
|
hash and `git -C <ROOT> show --stat <hash>`, the user decides.
|
||||||
|
|
||||||
S7 — AFTER. `claude -p "/context"` again from `<ROOT>`; append to that
|
S7 — AFTER. `claude -p "/context"` again from `<ROOT>`; append to that
|
||||||
project's `.claude/memory/journal.md` under today's date: `CLAUDE.md
|
project's journal (`bash "$HOME/.claude/lib/memory.sh" -C <ROOT> journal`): `CLAUDE.md
|
||||||
split: <k> sections → .claude/rules/ (<names>), always-on <before> →
|
split: <k> sections → .claude/rules/ (<names>), always-on <before> →
|
||||||
<after>`. Tell the user the proof step: a fresh session in that project
|
<after>`. Tell the user the proof step: a fresh session in that project
|
||||||
that Reads one file per rule, then `jq -c 'select(.memory_type=="Project"
|
that Reads one file per rule, then `jq -c 'select(.memory_type=="Project"
|
||||||
|
|||||||
@@ -80,9 +80,10 @@ age comparisons. Today's date is in the system context.
|
|||||||
### A. Obsolete — mark-superseded candidates
|
### A. Obsolete — mark-superseded candidates
|
||||||
- Decisions `status: proposed` older than 90 days → propose
|
- Decisions `status: proposed` older than 90 days → propose
|
||||||
`status: deprecated` (no follow-up).
|
`status: deprecated` (no follow-up).
|
||||||
- Decisions whose body contains "superseded by <ID>" but Index row still
|
- Decisions whose body names a successor ("superseded by <ID>",
|
||||||
says `accepted` → propose Index row fix to
|
"Supersedes [[<ID>]]" on the newer one) but whose current status
|
||||||
`superseded by <that-ID>`.
|
(`bash "$HOME/.claude/lib/memory.sh" index decision`) still reads
|
||||||
|
`accepted` → propose `memory.sh status <ID> "superseded by <that-ID>"`.
|
||||||
- Blockers `status: open` whose root cause matches a commit in last 30
|
- Blockers `status: open` whose root cause matches a commit in last 30
|
||||||
days (grep `git log --since=30.days --grep=<keyword>`) → propose
|
days (grep `git log --since=30.days --grep=<keyword>`) → propose
|
||||||
`status: resolved` with commit ref.
|
`status: resolved` with commit ref.
|
||||||
@@ -108,12 +109,6 @@ age comparisons. Today's date is in the system context.
|
|||||||
- Detect filler density: count `\b(the|a|an|just|really|basically|actually|simply)\b`
|
- Detect filler density: count `\b(the|a|an|just|really|basically|actually|simply)\b`
|
||||||
matches; if > 5% of word count → bloated.
|
matches; if > 5% of word count → bloated.
|
||||||
|
|
||||||
### D. Index drift
|
|
||||||
- Body `## (BDR|LRN|BLK|EVAL)-NNN` heading exists but no matching row
|
|
||||||
in `## Index` table → propose Index backfill.
|
|
||||||
- Index row exists but body entry missing → propose `status: deleted
|
|
||||||
(orphaned)` tombstone or removal of Index row (user decides).
|
|
||||||
|
|
||||||
## STEP 2 — PRESENT PLAN ★ MANDATORY STOP
|
## STEP 2 — PRESENT PLAN ★ MANDATORY STOP
|
||||||
|
|
||||||
Print one block per registry. Example:
|
Print one block per registry. Example:
|
||||||
@@ -127,7 +122,7 @@ PRUNE PLAN — decisions.md (N entries → M after if approved)
|
|||||||
BDR-901 — example proposed decision — status: proposed since <90+ days ago>
|
BDR-901 — example proposed decision — status: proposed since <90+ days ago>
|
||||||
→ mark: status: deprecated (no follow-up after 90 days)
|
→ mark: status: deprecated (no follow-up after 90 days)
|
||||||
BDR-902 — example decision — body says superseded by BDR-903
|
BDR-902 — example decision — body says superseded by BDR-903
|
||||||
→ fix Index: status = "superseded by BDR-903"
|
→ memory.sh status BDR-902 "superseded by BDR-903"
|
||||||
|
|
||||||
[B. Similar — merge]
|
[B. Similar — merge]
|
||||||
LRN-901 + LRN-902 — SAME concept (two notes on the identical bug)
|
LRN-901 + LRN-902 — SAME concept (two notes on the identical bug)
|
||||||
@@ -138,10 +133,7 @@ PRUNE PLAN — decisions.md (N entries → M after if approved)
|
|||||||
[C. Bloated — inline caveman rewrite]
|
[C. Bloated — inline caveman rewrite]
|
||||||
BDR-902 — body 612 words, filler density 7.2% → ~380 expected (-38%)
|
BDR-902 — body 612 words, filler density 7.2% → ~380 expected (-38%)
|
||||||
|
|
||||||
[D. Index drift]
|
Approve per category? (all / a / b / c / edit <ID> / skip)
|
||||||
(none)
|
|
||||||
|
|
||||||
Approve per category? (all / a / b / c / d / edit <ID> / skip)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Wait for user input. Default = nothing applied.
|
Wait for user input. Default = nothing applied.
|
||||||
@@ -149,18 +141,22 @@ Wait for user input. Default = nothing applied.
|
|||||||
## STEP 3 — APPLY APPROVED CHANGES
|
## STEP 3 — APPLY APPROVED CHANGES
|
||||||
|
|
||||||
Order: safe → destructive.
|
Order: safe → destructive.
|
||||||
|
Registry writes follow `lib/capitalize-commit.md` § WRITE (single writer).
|
||||||
|
|
||||||
1. **Index drift fixes** — no body changes. Backfill missing rows, mark
|
1. **Status flag updates** — `bash "$HOME/.claude/lib/memory.sh" status <ID>
|
||||||
orphans.
|
"<word> …"` appends a dated status line (text starts with a status word:
|
||||||
2. **Status flag updates** — Index row status field only. Body untouched.
|
`deprecated, no follow-up after 90 days`); the body above stays verbatim.
|
||||||
3. **Merges** — write new merged entry (next-free ID); source IDs marked
|
2. **Merges** — write the merged body to a scratch file, then
|
||||||
`status: superseded by <new-ID>` in Index (body kept verbatim for
|
`bash "$HOME/.claude/lib/memory.sh" add <kind> --title "<title>"
|
||||||
history). Merged body:
|
--body-file <file> --supersedes <first source>` (next-free ID, forward
|
||||||
|
link, the first source marked superseded); each other source:
|
||||||
|
`memory.sh status <ID> "superseded by <new-ID>"`. Source bodies stay
|
||||||
|
verbatim for history. Merged body:
|
||||||
- Preserves all `**Reference**:` lines (dedupe identical paths).
|
- Preserves all `**Reference**:` lines (dedupe identical paths).
|
||||||
- Caveman pass on prose during merge.
|
- Caveman pass on prose during merge.
|
||||||
- Keeps frontmatter fields: id (new), date (today), title, status
|
- Keeps frontmatter fields: id (new), date (today), title, status
|
||||||
(accepted), references (union).
|
(accepted), references (union).
|
||||||
4. **Inline caveman compression** — preserve frontmatter exactly (id,
|
3. **Inline caveman compression** — preserve frontmatter exactly (id,
|
||||||
date, title, status, references). Rewrite prose body to fragments:
|
date, title, status, references). Rewrite prose body to fragments:
|
||||||
- **NEGATION GUARD (deterministic, overrides every rule below):** never
|
- **NEGATION GUARD (deterministic, overrides every rule below):** never
|
||||||
rewrite a sentence containing a negation token (`not`, `never`, `no`,
|
rewrite a sentence containing a negation token (`not`, `never`, `no`,
|
||||||
@@ -174,39 +170,13 @@ Order: safe → destructive.
|
|||||||
- Keep code blocks, URLs, error messages, file paths VERBATIM.
|
- Keep code blocks, URLs, error messages, file paths VERBATIM.
|
||||||
- Keep IDs (BDR-XXX, LRN-XXX, commit hashes) verbatim.
|
- Keep IDs (BDR-XXX, LRN-XXX, commit hashes) verbatim.
|
||||||
|
|
||||||
After each write, regenerate Index from body when rows changed.
|
|
||||||
|
|
||||||
## STEP 4 — VERIFY
|
## STEP 4 — VERIFY
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Filename → ID-prefix map. Hard-mapped because filenames don't share
|
# Structure: heading shape + unique IDs + no open fence (v2 registries; a
|
||||||
# their first 3 chars with the prefix (decisions → BDR, not DEC).
|
# v1 one is named and skipped). Same verify the writer runs after every add.
|
||||||
# A prior version derived the prefix via `basename | cut -c1-3`, which never
|
bash "$HOME/.claude/lib/memory.sh" check .claude/memory \
|
||||||
# matched any heading and made verify a no-op (false-clean signal).
|
|| echo "CHECK FAILED: fix the lines above before certifying"
|
||||||
declare -A PREFIX_MAP=(
|
|
||||||
[decisions]=BDR
|
|
||||||
[learnings]=LRN
|
|
||||||
[blockers]=BLK
|
|
||||||
[evals]=EVAL
|
|
||||||
)
|
|
||||||
|
|
||||||
# All body entries have Index rows; no orphans
|
|
||||||
for fname in decisions learnings blockers evals; do
|
|
||||||
f=".claude/memory/${fname}.md"
|
|
||||||
[ -f "$f" ] || continue
|
|
||||||
prefix="${PREFIX_MAP[$fname]}"
|
|
||||||
|
|
||||||
/usr/bin/grep -oE "^## (${prefix})-[0-9]+" "$f" | while read marker; do
|
|
||||||
id="${marker##\#\# }"
|
|
||||||
/usr/bin/grep -q "^| ${id} " "$f" || echo "MISSING INDEX: $id in $f"
|
|
||||||
done
|
|
||||||
/usr/bin/grep -oE "^\| (${prefix})-[0-9]+ " "$f" | while read row; do
|
|
||||||
id=$(echo "$row" | awk '{print $2}')
|
|
||||||
# RED-6 fix: match id at a word boundary (space OR end-of-line) so a
|
|
||||||
# title-less heading "## BDR-009" is not flagged as a false orphan.
|
|
||||||
/usr/bin/grep -qE "^## ${id}( |\$)" "$f" || echo "ORPHAN INDEX: $id in $f"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# RED-5 fidelity guard (count-based, per-entry x per-category). STEP 0 ensured
|
# RED-5 fidelity guard (count-based, per-entry x per-category). STEP 0 ensured
|
||||||
# a clean tree, so git HEAD is the pre-prune backup. Fails the run if any
|
# a clean tree, so git HEAD is the pre-prune backup. Fails the run if any
|
||||||
@@ -271,7 +241,7 @@ PRUNE COMPLETE
|
|||||||
journal.md : 88 → 62 lines (-30%)
|
journal.md : 88 → 62 lines (-30%)
|
||||||
evals.md : no candidates
|
evals.md : no candidates
|
||||||
|
|
||||||
INDEX SANITY: OK
|
CHECK: OK
|
||||||
NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -302,7 +272,7 @@ NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
|||||||
| Working tree dirty on registry files | STOP per PRECHECK; tell user to commit/stash first |
|
| Working tree dirty on registry files | STOP per PRECHECK; tell user to commit/stash first |
|
||||||
| User says `skip` at STEP 2 | Exit cleanly, no writes |
|
| User says `skip` at STEP 2 | Exit cleanly, no writes |
|
||||||
| Merge produces an entry > 600 words | Re-split — merge was too greedy. Re-prompt user to keep separate. |
|
| Merge produces an entry > 600 words | Re-split — merge was too greedy. Re-prompt user to keep separate. |
|
||||||
| Index sanity FAILED at STEP 4 | Print exact missing/orphan IDs. Do NOT auto-fix — user re-runs or hand-edits. |
|
| `memory.sh check` FAILED at STEP 4 | Print its culprit lines. Do NOT auto-fix — user re-runs or hand-edits. |
|
||||||
| Caveman compression result < 20% of original AND original had code blocks | Revert that entry's compression — flag as needing manual rewrite (likely stripped technical detail). |
|
| Caveman compression result < 20% of original AND original had code blocks | Revert that entry's compression — flag as needing manual rewrite (likely stripped technical detail). |
|
||||||
| Same file already compressed in same session | Skip C-category for that file; warn user that double-pass risks technical drift. |
|
| Same file already compressed in same session | Skip C-category for that file; warn user that double-pass risks technical drift. |
|
||||||
|
|
||||||
@@ -320,7 +290,7 @@ NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
|||||||
|
|
||||||
Baseline RED scenarios were run and their counters are embedded: the
|
Baseline RED scenarios were run and their counters are embedded: the
|
||||||
RED-2/RED-5/RED-6 guards live in the body above, and `tests/` holds the
|
RED-2/RED-5/RED-6 guards live in the body above, and `tests/` holds the
|
||||||
fixtures (red3-negation, red4-journal, red6-orphan) plus
|
fixtures (red3-negation, red4-journal, red6-check) plus
|
||||||
`run-deterministic.sh` and `run-behavioral.md`. New rationalizations a
|
`run-deterministic.sh` and `run-behavioral.md`. New rationalizations a
|
||||||
subagent finds → add the fixture and its counter to the "Common
|
subagent finds → add the fixture and its counter to the "Common
|
||||||
mistakes" / "Failure paths" tables (`tests/BACKLOG.md` tracks candidates).
|
mistakes" / "Failure paths" tables (`tests/BACKLOG.md` tracks candidates).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[
|
[
|
||||||
{"id": 1, "prompt": "prune memory — registres trop longs", "expected": "Skill runs PRECHECK (refuses if working tree dirty on .claude/memory/), audits all 5 registries for A) obsolete/superseded entries B) similar merge candidates C) bloated prose D) Index drift, presents the per-registry PRUNE PLAN with category-level approval gate, applies only approved changes (mark-superseded never hard-delete), then runs Index sanity verify at STEP 4."},
|
{"id": 1, "prompt": "prune memory — registres trop longs", "expected": "Skill runs PRECHECK (refuses if working tree dirty on .claude/memory/), audits all 5 registries for A) obsolete/superseded entries B) similar merge candidates C) bloated prose, presents the per-registry PRUNE PLAN with category-level approval gate, applies only approved changes (status lines and merges through lib/memory.sh, never hard-delete), then runs memory.sh check and the fidelity census at STEP 4."},
|
||||||
{"id": 2, "prompt": "/prune-memory decisions", "expected": "Skill filters audit to decisions.md only — leaves learnings/blockers/journal/evals untouched, presents plan for that single registry, and exits cleanly after applying approved changes with the same append-only + caveman rules."},
|
{"id": 2, "prompt": "/prune-memory decisions", "expected": "Skill filters audit to decisions.md only — leaves learnings/blockers/journal/evals untouched, presents plan for that single registry, and exits cleanly after applying approved changes with the same append-only + caveman rules."},
|
||||||
{"id": 3, "prompt": "compresse les memoires — mais j'ai des changements pas commités dans .claude/memory/", "expected": "STEP 0 PRECHECK detects dirty working tree on registry files and STOPS immediately: 'Commit or stash pending changes in .claude/memory/ first. Skill writes in-place. Git is the only backup.' — no writes, no plan."}
|
{"id": 3, "prompt": "compresse les memoires — mais j'ai des changements pas commités dans .claude/memory/", "expected": "STEP 0 PRECHECK detects dirty working tree on registry files and STOPS immediately: 'Commit or stash pending changes in .claude/memory/ first. Skill writes in-place. Git is the only backup.' — no writes, no plan."}
|
||||||
]
|
]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
format: 2
|
||||||
|
type: decisions_registry
|
||||||
|
entry_prefix: BDR
|
||||||
|
---
|
||||||
|
|
||||||
|
# Decisions registry (BDR)
|
||||||
|
|
||||||
|
## BDR-009 — first (2026-06-01)
|
||||||
|
- **Status**: accepted
|
||||||
|
|
||||||
|
## BDR-009 — duplicate, the trap (2026-06-02)
|
||||||
|
- **Status**: accepted
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Decisions
|
|
||||||
|
|
||||||
## Index
|
|
||||||
|
|
||||||
| ID | status | date | title |
|
|
||||||
|----|--------|------|-------|
|
|
||||||
| BDR-009 | accepted | 2026-06-01 | titleless |
|
|
||||||
| BDR-010 | accepted | 2026-06-02 | has title |
|
|
||||||
|
|
||||||
## BDR-009
|
|
||||||
Body exists. Heading above has NO trailing space and NO title -- this is
|
|
||||||
the trap. STEP 4 loop-2 checks `^## BDR-009 ` (trailing space required)
|
|
||||||
and so reports a FALSE ORPHAN even though this body is right here.
|
|
||||||
|
|
||||||
## BDR-010 — Has title
|
|
||||||
Body exists. Control entry: heading has a title, so STEP 4 finds it and
|
|
||||||
does NOT false-orphan it. Proves the bug is specific to title-less headings.
|
|
||||||
@@ -71,16 +71,20 @@ else
|
|||||||
red 5 "STEP 4 certifies OK after a safety-critical line was deleted (no fidelity check)"
|
red 5 "STEP 4 certifies OK after a safety-critical line was deleted (no fidelity check)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---- RED-6: STEP 4 verify must not false-orphan a title-less heading --------
|
# ---- RED-6: STEP 4 verify runs memory.sh check (duplicate ID caught) --------
|
||||||
S6="$SANDBOX/red6"; mkdir -p "$S6/.claude/memory"
|
# v2 registries carry no Index; the structural verify is `memory.sh check`
|
||||||
cp "$HERE/fixtures/red6-orphan/.claude/memory/decisions.md" \
|
# (heading shape, unique IDs). HOME is pinned to a sandbox whose .claude/lib
|
||||||
|
# is this repo's lib, so the run never depends on the machine's ~/.claude.
|
||||||
|
S6="$SANDBOX/red6"; mkdir -p "$S6/.claude/memory" "$S6/home/.claude"
|
||||||
|
ln -s "$HERE/../../../lib" "$S6/home/.claude/lib"
|
||||||
|
cp "$HERE/fixtures/red6-check/.claude/memory/decisions.md" \
|
||||||
"$S6/.claude/memory/decisions.md"
|
"$S6/.claude/memory/decisions.md"
|
||||||
extract_block "STEP 4" > "$S6/step4.sh"
|
extract_block "STEP 4" > "$S6/step4.sh"
|
||||||
out="$( cd "$S6" && bash step4.sh 2>/dev/null )"
|
out="$( cd "$S6" && HOME="$S6/home" bash step4.sh 2>&1 )"
|
||||||
if printf '%s\n' "$out" | grep -qE '^ORPHAN INDEX: BDR-009'; then
|
if printf '%s\n' "$out" | grep -qE 'duplicate BDR-009'; then
|
||||||
red 6 "verify emits FALSE 'ORPHAN INDEX: BDR-009' (body exists; trailing-space bug)"
|
green 6 "verify runs memory.sh check and names the duplicate BDR-009"
|
||||||
else
|
else
|
||||||
green 6 "verify does not false-orphan the title-less heading"
|
red 6 "verify misses the duplicate BDR-009 (no memory.sh check in STEP 4)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---- RED-7: STEP 2 plan example must use FICTIONAL ids, never live registry ids
|
# ---- RED-7: STEP 2 plan example must use FICTIONAL ids, never live registry ids
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Not for: curating/compressing registries → `/prune-memory`. The skill never ed
|
|||||||
**REQUIRED ENGINE:** `lib/reconcile.sh` does the mechanical truth-probing. A capable agent CAN reconcile by hand — but burns ~50k tokens, depends on the question being phrased well, and still hits traps (compound status, a disclaimer instead of a check). The engine is deterministic, cheap, repeatable. Source it, then:
|
**REQUIRED ENGINE:** `lib/reconcile.sh` does the mechanical truth-probing. A capable agent CAN reconcile by hand — but burns ~50k tokens, depends on the question being phrased well, and still hits traps (compound status, a disclaimer instead of a check). The engine is deterministic, cheap, repeatable. Source it, then:
|
||||||
|
|
||||||
1. Enumerate registry entries from BODY headings (`reconcile_enumerate_ids`, never the Index).
|
1. Enumerate registry entries from BODY headings (`reconcile_enumerate_ids`, never the Index).
|
||||||
2. Per declared item, run the matching oracle (`reconcile_oracle_*`, `reconcile_blk_current_status` = last block wins) and apply `reconcile_verdict`.
|
2. Per declared item, run the matching oracle (`reconcile_oracle_*`, `reconcile_blk_current_status` = last candidate wins: header `[tag]` or a labelled status line on a v2 registry via `lib/memory.sh`, today's lexical reader on v1) and apply `reconcile_verdict`.
|
||||||
3. Classify into the four categories.
|
3. Classify into the four categories.
|
||||||
4. **Gate the write-back** (below).
|
4. **Gate the write-back** (below).
|
||||||
|
|
||||||
@@ -51,4 +51,4 @@ Reconciling the TODO edits a tracked file → never silent. Show the proposed di
|
|||||||
- Writing a disclaimer ("à vérifier si déjà fait") instead of verifying → the engine verifies, it never hedges-and-advances.
|
- Writing a disclaimer ("à vérifier si déjà fait") instead of verifying → the engine verifies, it never hedges-and-advances.
|
||||||
|
|
||||||
## Validation
|
## Validation
|
||||||
`bash lib/tests/run-reconcile.sh` → 25/25, shellcheck clean. Oracle of record = the 2026-06-29 inventory (7 gaps + 3 blocked + 5 deferred + 1 contradiction), fixtures frozen under neutral names in `lib/tests/fixtures/`.
|
`bash lib/tests/run-reconcile.sh` → 29/29, shellcheck clean. Oracle of record = the 2026-06-29 inventory (7 gaps + 3 blocked + 5 deferred + 1 contradiction), fixtures frozen under neutral names in `lib/tests/fixtures/`.
|
||||||
@@ -270,8 +270,8 @@ Feature shipped implies at least one design decision worth capturing. Run this B
|
|||||||
|
|
||||||
Valider lesquels ? (all / <IDs> / edit / skip)
|
Valider lesquels ? (all / <IDs> / edit / skip)
|
||||||
```
|
```
|
||||||
4. Append approved entries to the registries. Update the Index table at the top of each file.
|
4. Write approved entries per `lib/capitalize-commit.md` § WRITE (`memory.sh add`, one call each; no Index to update).
|
||||||
5. Append a one-line entry to `.claude/memory/journal.md` under today's date heading (`## YYYY-MM-DD`).
|
5. Journal line: `memory.sh journal` (same section).
|
||||||
|
|
||||||
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate above may mirror the user's language; the appended entries must not.
|
**Language rule**: written entries are ALWAYS English AND caveman — fragments, articles dropped, code/IDs/quoted errors verbatim — per CLAUDE.md "Memory registries" (Always English, always caveman). The interactive gate above may mirror the user's language; the appended entries must not.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: blockers_registry
|
type: blockers_registry
|
||||||
entry_prefix: BLK
|
entry_prefix: BLK
|
||||||
schema:
|
schema:
|
||||||
@@ -17,19 +18,13 @@ rules:
|
|||||||
|
|
||||||
# Blockers registry (BLK)
|
# Blockers registry (BLK)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add blocker --title "<friction>"
|
||||||
|
--body-file <file> [--status open]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Friction | Status |
|
## BLK-NNN — <friction> [open] (YYYY-MM-DD)
|
||||||
|----|------|---------|--------|
|
- **Friction**: <what was blocked>
|
||||||
|
- **Real cause**: <root cause>
|
||||||
<!-- Append entries below. Template:
|
- **Solution**: <workaround or fix>
|
||||||
|
|
||||||
## BLK-XXX - <friction>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Friction**: <what was blocked>
|
|
||||||
- **Real cause**: <root cause>
|
|
||||||
- **Solution**: <workaround or fix>
|
|
||||||
- **Status**: open | resolved | upstream
|
|
||||||
|
|
||||||
|
Later status: `bash ~/.claude/lib/memory.sh status BLK-NNN "resolved <hash>"`.
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: decisions_registry
|
type: decisions_registry
|
||||||
entry_prefix: BDR
|
entry_prefix: BDR
|
||||||
schema:
|
schema:
|
||||||
@@ -19,22 +20,14 @@ rules:
|
|||||||
|
|
||||||
# Decisions registry (BDR)
|
# Decisions registry (BDR)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add decision --title "<title>"
|
||||||
|
--body-file <file> [--status accepted]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Title | Status |
|
## BDR-NNN — <title> [accepted] (YYYY-MM-DD)
|
||||||
|----|------|-------|--------|
|
- **Decision**: <what was chosen>
|
||||||
|
- **Why**: <motivation>
|
||||||
<!-- Append entries below. Template:
|
- **Rejected alternatives**: <each option, why rejected>
|
||||||
|
- **Reference**: <commit / PR / file>
|
||||||
## BDR-XXX - <title>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Status**: proposed | accepted | deprecated | superseded
|
|
||||||
- **Decision**: <what was chosen>
|
|
||||||
- **Why**: <motivation>
|
|
||||||
- **Rejected alternatives**:
|
|
||||||
- Option A - <why rejected>
|
|
||||||
- Option B - <why rejected>
|
|
||||||
- **Reference**: <commit / PR / file>
|
|
||||||
|
|
||||||
|
Later status: `bash ~/.claude/lib/memory.sh status BDR-NNN "superseded by BDR-NNN"`.
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: evals_registry
|
type: evals_registry
|
||||||
entry_prefix: EVAL
|
entry_prefix: EVAL
|
||||||
schema:
|
schema:
|
||||||
@@ -18,19 +19,13 @@ rules:
|
|||||||
|
|
||||||
# Evals registry (EVAL)
|
# Evals registry (EVAL)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add eval --title "<output>"
|
||||||
|
--body-file <file> [--status keep]` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Output | Action |
|
## EVAL-NNN — <output> [keep] (YYYY-MM-DD)
|
||||||
|----|------|--------|--------|
|
- **Output**: <what was produced>
|
||||||
|
- **Method**: <how it was evaluated>
|
||||||
<!-- Append entries below. Template:
|
- **Anomalies**: <what is wrong, missing, surprising>
|
||||||
|
- **Action**: <keep | correct | deprecate>
|
||||||
## EVAL-XXX - <output>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Output**: <what was produced>
|
|
||||||
- **Method**: <how it was evaluated>
|
|
||||||
- **Anomalies**: <what is wrong, missing, surprising>
|
|
||||||
- **Action**: keep | correct | deprecate
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
format: 2
|
||||||
type: learnings_registry
|
type: learnings_registry
|
||||||
entry_prefix: LRN
|
entry_prefix: LRN
|
||||||
schema:
|
schema:
|
||||||
@@ -16,18 +17,12 @@ rules:
|
|||||||
|
|
||||||
# Learnings registry (LRN)
|
# Learnings registry (LRN)
|
||||||
|
|
||||||
## Index
|
<!-- Written only by `bash ~/.claude/lib/memory.sh add learning
|
||||||
|
--title "<abstract pattern>" --body-file <file>` (it allocates the ID). Entry shape:
|
||||||
|
|
||||||
| ID | Date | Pattern | Applies to |
|
## LRN-NNN — <abstract pattern> (YYYY-MM-DD)
|
||||||
|----|------|---------|------------|
|
- **Pattern**: <what was observed, phrased for reuse>
|
||||||
|
- **Context**: <where and when, concrete>
|
||||||
<!-- Append entries below. Template:
|
- **Future application**: <when to recall this>
|
||||||
|
|
||||||
## LRN-XXX - <abstract pattern>
|
|
||||||
|
|
||||||
- **Date**: YYYY-MM-DD
|
|
||||||
- **Pattern**: <what was observed, phrased for reuse>
|
|
||||||
- **Context**: <where and when, concrete>
|
|
||||||
- **Future application**: <when to recall this>
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
Reference in new issue
Block a user