diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 5267e48..e2972e8 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -680,3 +680,4 @@ rules: ## 2026-11-01 - memory-v2-minors /feat shipped (e4fb8f7 + 48ade8f): negated status words, dead empty steal, body `## ` refused, blob rc 1/2, rc 6 names dropped partial stages, reflow. Verifier CONFORME, security PASS, replay 14 repos = 1 expected move. Docs synced. Next: doc half, then phase 5 spikes. +- memory-v2-minors-docs /feat shipped (dfbc8a7): § WRITE says every verb takes -C and --body-file absolute; tour/deploy/audit-delta point at § WRITE; evals template Later status line. Verifier CONFORME, security PASS. Phase 4a minors fully closed; MIGRATION.md:209 parked. Next: phase 5 spikes. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index be6f952..37c75f0 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -34,7 +34,8 @@ Shared rules for every phase: - [ ] faunosteo: NOT upgraded (V1-2 active in another session's worktree; user: no write to develop or the V1-2 worktree). Patch prepared off-repo from V1-2 587cbb2 (rc 0, 520 lines, open BLK-008/009 unchanged); at integration re-run `memory.sh -C upgrade` on the branch the user names rather than applying the stale patch. Stale clone `/home/bchanot/faunosteo` (main, 2026-07-01): left alone, user to decide. - [ ] BLK-038 residuals (gates 2026-10-30, non-blocking): v1 line echoed on stderr unfiltered (CWE-150 LOW, terminal control chars from a foreign registry; same as existing "upgrade lost" path); no fixture asserts the "wrote upgrade status" / "dated status line kept" messages; the real-data replay oracle lives in the session scratchpad (`up4a/realdata.sh`), not re-runnable: port to a `make` target over fixture copies if the upgrade is touched again; `memory.sh journal` leaves two blank lines before a new date heading on files ending with a blank line (commit-changer note). - [x] Phase 4a parked minors, code half (/feat memory-v2-minors 2026-11-01, e4fb8f7 + 48ade8f: negated status words, dead empty steal, body `## ` refused at add, `_mem_blob` rc 1/2, rc 6 names dropped partial stages, reflow; A2 Index comment-edge + A7 rc 6 upgrade wording dropped as moot, 0 `## Index` left outside faunosteo). Doc half still open, next line. Original 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. - - [ ] Phase 4a minors, doc half (/feat): lib/capitalize-commit.md § WRITE `-C` + absolute `--body-file`; tour/deploy/audit-delta SKILL.md § WRITE pointer; templates/memory/evals.md "Later status" line; capitalize-commit.md:73-74 rc 6 text if affected. + - [x] Phase 4a minors, doc half (/feat memory-v2-minors-docs 2026-11-01): § WRITE intro says every verb takes `-C` and `--body-file` is absolute; tour/deploy/audit-delta point at § WRITE; evals template `Later status` line; rc 6 text done by the code half's doc sync (18e6370). + - [ ] MIGRATION.md:209 shows `memory.sh -C add … --body-file …` with no absolute-path note (same trap as § WRITE, parked by the docs-half challenge 2026-11-01): next doc pass. - [ ] memory.sh awk operand (security LOW 2026-11-01): a `--body-file` named `x=1.md` is read by awk as a variable assignment in `_mem_fence_open` and `_mem_body_heading` (stdin read, check bypassed; `cat` still inserts the body). Fix: `awk '…' < "$f"`. Also `_partial_stages` passes the path to `git ls-files -s --` as a glob pathspec (quote with `:(literal)`). - 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 --title --body-file [--status --supersedes]` allocates next ID from headings (never the Index) under `flock` (concurrent conversations, phase 5), appends the entry; `status ` appends a dated status line (append-only); `journal ""`; `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). diff --git a/.claude/tasks/contracts/2026-11-01-memory-v2-minors-docs-1130.md b/.claude/tasks/contracts/2026-11-01-memory-v2-minors-docs-1130.md new file mode 100644 index 0000000..af5da47 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-01-memory-v2-minors-docs-1130.md @@ -0,0 +1,34 @@ +# CONTRACT — memory-v2-minors-docs + +## REQUEST (verbatim — IMMUTABLE) +Phase 4a parked minors, doc half (5 doc files, no code): (1) lib/capitalize-commit.md § WRITE: with `-C `, memory.sh does `cd` before reading `--body-file`, so a relative body-file path resolves against the project root, not the caller's cwd; say to pass an absolute `--body-file` with `-C`. (2) skills/tour/SKILL.md, skills/deploy/SKILL.md, skills/audit-delta/SKILL.md: their "offer to capitalize" sentence names the registries but not the write path; add the pointer "per `lib/capitalize-commit.md` § WRITE" like feat/bugfix/hotfix/capitalize do. (3) templates/memory/evals.md: add the "Later status" line that blockers.md and decisions.md templates carry (`bash ~/.claude/lib/memory.sh status EVAL-NNN "correct …"` / `"deprecate, see BDR-NNN"`). The rc 6 text in capitalize-commit.md was already updated by the code half's doc sync (18e6370). + +## CLARIFICATIONS +- Plan r2: `.claude/tasks/plans/2026-11-01-memory-v2-minors-docs-1130.md`. Wording closed there; the `-C` sentence sits in the § WRITE intro (covers add, status, journal), the Entry bullet's own `-C` sentence is removed; the executor changes nothing else in the five files. +- 2026-11-01 user [gated]: evals `Later status` example = `deprecate, see BDR-NNN`; the pointer sentence is the same short form in all three skills: "Approved entries per `lib/capitalize-commit.md` § WRITE." +- Code half shipped as feature/memory-v2-minors → develop c92381e; this contract is the doc half only. + +## ACCEPTANCE CRITERIA +1. lib/capitalize-commit.md § WRITE says, once for every verb, that `-C` `cd`s first and the `--body-file` path is absolute. + CHECK: cd /home/bchanot/Documents/claude && sed -n '/^## WRITE/,/^## /p' lib/capitalize-commit.md | tr -s ' \n' ' ' | grep -q 'body-file. an absolute path' && [ "$(sed -n '/^## WRITE/,/^## /p' lib/capitalize-commit.md | grep -c 'when the cwd is not the project root')" = 1 ] && echo WRITE-OK + EXPECT: WRITE-OK + EVIDENCE: MET exit=0 marker-found :: WRITE-OK +2. The capitalize offer in skills/tour, skills/deploy and skills/audit-delta points at `lib/capitalize-commit.md` § WRITE. + CHECK: cd /home/bchanot/Documents/claude && for s in tour deploy audit-delta; do grep -q 'lib/capitalize-commit.md` § WRITE' skills/$s/SKILL.md || exit 1; done && echo POINTER-OK + EXPECT: POINTER-OK + EVIDENCE: MET exit=0 marker-found :: POINTER-OK +3. templates/memory/evals.md carries a `Later status:` line naming `memory.sh status EVAL-NNN`, inside the template comment like blockers.md and decisions.md. + CHECK: cd /home/bchanot/Documents/claude && grep -q 'Later status: `bash ~/.claude/lib/memory.sh status EVAL-NNN' templates/memory/evals.md && awk '/^/{c=0} /Later status/{print c}' templates/memory/evals.md | grep -q 1 && echo EVALS-OK + EXPECT: EVALS-OK + EVIDENCE: MET exit=0 marker-found :: EVALS-OK +4. `make test` green (doctrine-citers census, project-rules); the diff vs develop adds no line over 80 bytes in lib/capitalize-commit.md (templates are not held to 80: decisions.md:32 is 84), and touches only the five files. + CHECK: cd /home/bchanot/Documents/claude && t=$(make test 2>&1) && printf '%s\n' "$t" | grep -q 'all suites green' && [ "$(git diff develop -- lib/capitalize-commit.md | grep '^+' | grep -v '^+++' | LC_ALL=C awk 'length($0) > 81' | wc -l)" = 0 ] && [ "$(git diff develop --name-only -- . ':!settings.json' ':!.claude' | sort | tr '\n' ' ')" = "lib/capitalize-commit.md skills/audit-delta/SKILL.md skills/deploy/SKILL.md skills/tour/SKILL.md templates/memory/evals.md " ] && echo DOCS-LINT-OK + EXPECT: DOCS-LINT-OK + EVIDENCE: MET exit=0 marker-found :: DOCS-LINT-OK + +## FILE SCOPE +- lib/capitalize-commit.md +- skills/tour/SKILL.md +- skills/deploy/SKILL.md +- skills/audit-delta/SKILL.md +- templates/memory/evals.md diff --git a/.claude/tasks/plans/2026-11-01-memory-v2-minors-docs-1130.md b/.claude/tasks/plans/2026-11-01-memory-v2-minors-docs-1130.md new file mode 100644 index 0000000..81106b0 --- /dev/null +++ b/.claude/tasks/plans/2026-11-01-memory-v2-minors-docs-1130.md @@ -0,0 +1,62 @@ +# /feat memory-v2-minors-docs — PLAN r2 + +r2 2026-11-01 after 3 lenses: simplicity FATAL(2), correctness FATAL(1), +robustness FATAL(1). One shared BLOCKER (the 86-byte evals line vs criterion +4) and one MAJOR (the `-C` sentence must cover status/journal too) folded; +all MINORs folded. No deferral. The approach (same five files, same edits) +did not change, so no second pass. + +FEAT: phase 4a parked minors, doc half — 5 doc files, wording only. Code half +shipped (develop c92381e). No logic, no test code: the oracles are greps. +User picks 2026-11-01 (gated): evals example word = `deprecate, see +BDR-NNN`; the same short pointer sentence in all three skills. + +## Plan +- [ ] lib/capitalize-commit.md § WRITE intro (lines 34-35, "Registry entries + and journal lines are written only by `lib/memory.sh`, never by Edit or + append; there is no `## Index` to update."): append one sentence, wrapped + at 80: "Every verb takes `-C ` when the cwd is not the + project root; it `cd`s first, so give `--body-file` an absolute path." + Then DELETE the Entry bullet's last sentence "`-C` when the cwd is not + the project root." (line 42) so `-C` is stated once, for add, status + and journal alike. Keep the bullet's wrap. +- [ ] skills/tour/SKILL.md: after line 277 ("repo's nor any target + project's."), add ONE new line "Approved entries per + `lib/capitalize-commit.md` § WRITE." No reflow of the paragraph; the + citation stays on one line. +- [ ] skills/deploy/SKILL.md step 7 (lines 449-450): after "gated, never + silent." append " Approved entries per `lib/capitalize-commit.md` § + WRITE." — put it on a NEW continuation line with the item's 3-space + indent, citation on one line; no reflow of the existing lines. +- [ ] skills/audit-delta/SKILL.md: after line 251 ("`evals.md`. Behind + approval, never silent."), add ONE new line "Approved entries per + `lib/capitalize-commit.md` § WRITE." No reflow. +- [ ] templates/memory/evals.md: insert ONE line between the existing blank + line (evals.md:30) and `-->` (evals.md:31), no new blank line: + Later status: `bash ~/.claude/lib/memory.sh status EVAL-NNN "deprecate, see BDR-NNN"`. + That is the shape of blockers.md:28-30 and decisions.md:31-33 (blank, + `Later status:`, `-->`). The line is 86 bytes: templates are not held + to 80 (decisions.md:32 is 84; evals.md:9,13,16,17 already exceed it), + and criterion 4's width check covers lib/capitalize-commit.md only. + `deprecate` is a status word (`_MEM_WORDS`) that names a successor; it + does not close an entry (`memory_closed` = resolved|superseded| + deprecated), which is fine for an eval. +- [ ] No test file: criteria 1-4 are grep/awk oracles run by gates.sh; the + executor runs `make test` (doctrine-citers census: 8 citers already + use the identical string `lib/capitalize-commit.md` § WRITE). + +## Edge cases +- The three skills keep their CLAUDE.md gate sentence; the new line names + the write path only. +- `~/.claude/lib/memory.sh` is a `.sh` path: the census never extracts it. +- Nothing parses the template comment block (init-project, capitalize and + onboarder `cp -n` it; memory.sh reads only the frontmatter). + +## Parked (TODO line, outside FILE SCOPE) +- MIGRATION.md:209 shows `memory.sh -C add … --body-file …` with + no absolute-path note: same trap, next doc pass. + +## Disposition +Honors BDR-129 (single writer: every doc points at the one § WRITE entry +point) and BDR-022 (doc-commit never touches `.claude/`: FILE SCOPE is outside +it). No in-force LRN constrains a wording change. diff --git a/CHANGELOG.md b/CHANGELOG.md index 23ce9b8..528a8c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project ### Changed - **model-router bare `/model` dialog**: a bare `/model` opens the router's dialog (model, variant, scope), so the scope question also comes when the pick is the current model (fable, opus, sonnet; a current haiku goes through `/model haiku`). Step 1 asks fable, opus, sonnet or `Other model (native picker)` (the native picker, run with the slot free so a pick inside it asks its scope); step 2 asks Standard or `[1m]`; step 3 is the existing scope question. Esc or free text changes nothing. Tests: `mods/model-router/hooks/register.test.ts`. -- 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. +- 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`) and the gated capitalize offers of `/tour`, `/deploy` and `/audit-delta` write 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; a HEAD or staged blob git cannot read is refused too, and stderr names each memory path whose separate partial stage the refusal dropped, with its blob id and `git update-index --cacheinfo` restore command; 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, a status word negated in its clause (`not`, `no`, `never`, `pas`, at most one word between, no clause punctuation or arrow in between) does not count, resolved/superseded/deprecated closes the entry; the lexical reader is kept for v1. This repo's registries are upgraded to v2. diff --git a/lib/capitalize-commit.md b/lib/capitalize-commit.md index bc3c47a..b228519 100644 --- a/lib/capitalize-commit.md +++ b/lib/capitalize-commit.md @@ -32,14 +32,16 @@ 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. +never by Edit or append; there is no `## Index` to update. Every verb takes +`-C ` when the cwd is not the project root; it `cd`s first, so +give `--body-file` an absolute path. - Entry: caveman body to a scratch file, then `bash "$HOME/.claude/lib/memory.sh" [-C ] add --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. + error in backticks. - 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 …`, diff --git a/skills/audit-delta/SKILL.md b/skills/audit-delta/SKILL.md index c2a2ee0..95de729 100644 --- a/skills/audit-delta/SKILL.md +++ b/skills/audit-delta/SKILL.md @@ -249,6 +249,7 @@ AUDIT-DELTA COMPLETE — 2026-06-11 Then offer to capitalize (per CLAUDE.md): recurring finding patterns → `learnings.md`, audit verdicts → `evals.md`. Behind approval, never silent. +Approved entries per `lib/capitalize-commit.md` § WRITE. ## Axis specs (subagent prompts) diff --git a/skills/deploy/SKILL.md b/skills/deploy/SKILL.md index ac40682..c70066f 100644 --- a/skills/deploy/SKILL.md +++ b/skills/deploy/SKILL.md @@ -448,6 +448,7 @@ The deploy succeeded. Lay the oracle and close out. 7. Report: deployed SHA, tag (+ push result), state committed, any `DEP-NNN` learned this deploy. Then offer to capitalize per CLAUDE.md (recurring failure pattern → `learnings.md`; deploy verdict → `evals.md`), gated, never silent. + Approved entries per `lib/capitalize-commit.md` § WRITE. --- diff --git a/skills/tour/SKILL.md b/skills/tour/SKILL.md index 44ad537..49f99ee 100644 --- a/skills/tour/SKILL.md +++ b/skills/tour/SKILL.md @@ -275,6 +275,7 @@ TOUR COMPLETE — 2026-07-04 Then offer to capitalize (gated, per CLAUDE.md): recurring cross-project patterns → learnings, tour verdict → evals. Never write registries without that approval — neither this repo's nor any target project's. +Approved entries per `lib/capitalize-commit.md` § WRITE. ## Rules diff --git a/templates/memory/evals.md b/templates/memory/evals.md index 176701d..4065069 100644 --- a/templates/memory/evals.md +++ b/templates/memory/evals.md @@ -28,4 +28,5 @@ rules: - **Anomalies**: <what is wrong, missing, surprising> - **Action**: <keep | correct | deprecate> +Later status: `bash ~/.claude/lib/memory.sh status EVAL-NNN "deprecate, see BDR-NNN"`. -->