From 5e7a2679c0737d2008e90a4f9fd41c7dd2f0ad5a Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 13 Nov 2026 14:48:13 +0100 Subject: [PATCH] docs: memory.sh legacy reader and upgrade semantics (CHANGELOG, MIGRATION, usage comment) --- CHANGELOG.md | 2 ++ MIGRATION.md | 4 ++-- lib/memory.sh | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fcc708..9a09b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,12 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project ### Removed - `hooks/design-toolchain-reminder.sh`, its `UserPromptSubmit` entry in `settings.json` (`ctx7-reminder` stays the only one) and its suite `lib/tests/design-toolchain-reminder.test.sh`. Measured 2026-10-31: 59 fires, 0 Reads of `rules/web-building.md`. Design routing stays with the `rules/web-building.md` path rule and the `CLAUDE.global.md` pointer. The fire log `~/.claude/logs/design-toolchain-fires.log` is left in place. +- `MEM_LEGACY_RE`, the environment override of `memory_legacy_status`'s v1 line selector announced in 3.0.0, and that function's `` argument: the signature is now `memory_legacy_status []` (third argument = line selector, the range end follows the ID's prefix). The decision selector `_MEM_LEGACY_BDR_RE` lives in `lib/memory.sh`; `RECONCILE_BDR_RE` is gone from `lib/reconcile.sh`. Test: `lib/tests/memory.test.sh` T15-env-selector-ignored. ### Fixed - `cc [profile]` (lib/cc.sh) raises the session's `oom_score_adj` to 500 before `exec claude` (raise-only, silent if the write fails). sshd's systemd override `OOMScoreAdjust=-1000` was inherited through tmux and dtach by every claude started with `cc`, so the OOM killer never picked a runaway session; `systemd-run --scope` rejects that property, hence the write inside the session (BLK-044). Test: `lib/tests/cc.test.sh` T7-oom. - `lib/project-rules.sh` (`extract`, `emit`): the out-path check resolves the rule file's first existing parent physically and refuses (rc 2, `must stay under the project`) a path a symlinked component sends outside the project; 3.0.0 checked `..` lexically only. `emit` goes through the same check and reports `cannot create` or `not written` (no partial file) with rc 2 where it printed `emitted`. An `extract` that wrote the rule but fails to rewrite CLAUDE.md keeps the rule file and the rewritten text in a temp file and names both on stderr with the command to complete or abort; it used to delete both. `/onboard` and `/init-project` keep an existing rule on an rc 2 ending in ` exists` and stop on any other rc 2. Tests: `lib/tests/project-rules.test.sh` T9h (re-asserted), T9z3 to T9z13. +- `lib/memory.sh`: `memory_legacy_status` (the v1 status reader behind `memory.sh upgrade`, `/reconcile`, `/prune-memory`) ends an entry's range at the next heading of another entry of the same prefix, any level, outside a code fence, or at `## Index`: a `### BLK-` entry no longer lends its status to the `## BLK-` entry above, and a trailing `## Index` is no longer read. `memory.sh upgrade` on an entry with no strict status word writes the single word of its v1 `Status`/`Statut` label as the dated upgrade status line; when the `## Index` cell disagrees the body word wins and stderr says `kept body , dropped Index ` (the Index used to win); an Index `superseded`/`deprecated` still wins; a label without exactly one word is refused on a blocker and leaves the Index cell on a decision. Control characters from a v1 line or an Index cell print as `?`. `memory.sh journal` leaves exactly one blank line before a new date heading (a file ending with a blank line got two, one without a final newline got none). Tests: `lib/tests/memory.test.sh` T14l-gap, T15-statut-*, T15-bdr-*, T15-idx-*, T15-ctl-*, T15-trailing-index-not-read. ## [3.0.0] — 2026-11-12 diff --git a/MIGRATION.md b/MIGRATION.md index bbda43b..007ea34 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -297,11 +297,11 @@ is the only one that removes a real directory (`make plugin` replaces A v2 registry is the same `.claude/memory/.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 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. A v1 blocker closure is carried over only from a `Status`/`Statut` label holding a single closed word that is not negated (`Status: not resolved yet` holds none). A blocker the v1 reader closed through prose, a mixed or a negated Status line is named with its v1 line and the whole run is refused (rc 2, file untouched). Record its real status with `bash ~/.claude/lib/memory.sh -C status ", …"` (the leading word decides), then re-run `upgrade`. +To migrate, run `bash ~/.claude/lib/memory.sh -C 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. A v1 blocker closure is carried over only from a `Status`/`Statut` label holding a single closed word that is not negated (`Status: not resolved yet` holds none). A blocker or decision whose `## Index` cell disagrees with a one-word `Status`/`Statut` label in its body keeps the body word, written as its dated `upgrade` status line, and stderr names the dropped Index cell; an Index `superseded` or `deprecated` still wins. A blocker the v1 reader closed through prose, a mixed or a negated Status line is named with its v1 line and the whole run is refused (rc 2, file untouched). Record its real status with `bash ~/.claude/lib/memory.sh -C status ", …"` (the leading word decides), then re-run `upgrade`. ## Auto memory off (2026-10-29) -`settings.json` now sets `"autoMemoryEnabled": false`, so Claude Code no longer loads `~/.claude/projects//memory/`. Anything left there is knowledge no session reads. `make doctor` (section "Auto memory") counts the project dirs that still hold files. For each one, move what is worth keeping into that project's registries with `bash ~/.claude/lib/memory.sh -C add --title … --body-file …`, then delete the leftover dir by hand. +`settings.json` now sets `"autoMemoryEnabled": false`, so Claude Code no longer loads `~/.claude/projects//memory/`. Anything left there is knowledge no session reads. `make doctor` (section "Auto memory") counts the project dirs that still hold files. For each one, move what is worth keeping into that project's registries with `bash ~/.claude/lib/memory.sh -C add --title … --body-file …` (give `--body-file` an absolute path: `-C` changes into the project before the file is read), then delete the leftover dir by hand. ## Claude.ai-synced skills off (2026-11-09) diff --git a/lib/memory.sh b/lib/memory.sh index 2bf862e..f9174bf 100755 --- a/lib/memory.sh +++ b/lib/memory.sh @@ -21,6 +21,8 @@ # a blocker the v1 reader closed but the strict one reads # open gets a `Status (…, upgrade)` line only when its v1 # line is a Status/Statut label holding one closed word; +# an Index-row blocker or decision with no strict word takes +# its one-word v1 body label over the Index cell; # a prose or mixed closure is named and refused (record # it with `status`, re-run); a `## Index` that is not a # table is refused (rc 2); the oracle (IDs, check,