From 0ccd4af88fd77009e087d3b32ddd1d961c0fa61c Mon Sep 17 00:00:00 2001 From: bchanot Date: Wed, 28 Oct 2026 14:04:11 +0100 Subject: [PATCH] =?UTF-8?q?docs(plan):=20Task=208=20=E2=80=94=20upgrade=20?= =?UTF-8?q?migrates=20every=20v1=20dialect=20(user=20ask=20at=20the=20gate?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-10-27-memory-v2-write-2030.md | 2 ++ .../plans/2026-10-27-memory-v2-write.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md b/.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md index 8231fe5..33b0d10 100644 --- a/.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md +++ b/.claude/tasks/contracts/2026-10-27-memory-v2-write-2030.md @@ -27,5 +27,7 @@ Phase 4a of the context mod queue (BDR-125), TODO.md "Phase 4a, memory v2 write EXPECT: all suites green EVIDENCE: PENDING +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). diff --git a/docs/superpowers/plans/2026-10-27-memory-v2-write.md b/docs/superpowers/plans/2026-10-27-memory-v2-write.md index a760082..0ea6961 100644 --- a/docs/superpowers/plans/2026-10-27-memory-v2-write.md +++ b/docs/superpowers/plans/2026-10-27-memory-v2-write.md @@ -525,3 +525,22 @@ Run: `grep -c '^## Index' .claude/memory/*.md` → 0 everywhere; `make test suit /home/bchanot/repos/bchanot/trucks_at_work ``` (pre-branch reader: `git show develop:lib/reconcile.sh > ` then source ``; measured 2026-10-28 on copies: 13 of 13 distinct files identical.) + +--- + +### Task 8: `upgrade` migrates every v1 dialect (user ask at the gate, 2026-10-28) + +User at STEP 3: "Il faudrait un système de migration pour que les fichiers v1 deviennent des fichiers v2 pour tout harmoniser". Same files, same `.claude/memory/` place, versioned and pushed with the code; v2 = `format: 2` + no Index. + +**Files:** `lib/memory.sh` (`upgrade` path only), `lib/tests/memory.test.sh` (new T15 block), `lib/tests/fixtures/blockers-v1-dialects.md` (extend if needed). + +**Behaviour** (replaces the dialect refusal of Deviation 6 for `upgrade` only): +1. No frontmatter → prepend the matching `templates/memory/.md` frontmatter (with `format: 2`) and keep the file's own body verbatim below it. +2. Heading normalization, entry headings only (`^#+ *PREFIX-[0-9]+`): `## ID - t`, `## ID | date | t`, `### ID — t`, `## ID — t — date` → `## ID — t (date)`; the date comes from the heading, else the Index row, else the first `Date`/`date:` body line, else none. The title text is kept verbatim (only separators change). IDs never change. +3. Status preservation: before rewriting, compute every entry's open/closed verdict with the v1 lexical reader (reconcile's legacy path, blockers) and the status word (all registries); after rewriting, if the strict v2 parser would read a different verdict or no status where the legacy reader had one, append `- **Status (, upgrade)**: ` to that entry. +4. Oracle (file untouched on any failure, rc 2, culprit named): same ID set and order; every entry's verdict before == after (blockers via the legacy reader vs `memory_closed`, others by status word when one existed); `check` green; idempotent second run. +5. `upgrade` no longer refuses any of the measured dialects; it refuses only what the oracle cannot prove. + +**Tests (T15):** one fixture per dialect (hyphen, pipe, `###`, title-suffix `— RESOLVED`, `date: … · status:`, `**Statut** :`, no frontmatter) → upgraded, `check` green, verdicts preserved, idempotent; a tampered case where the oracle refuses and the file stays byte-identical. Proof on copies (read-only on the real repos): `upgrade` on a copy of each of the 13 other projects' registries is oracle-green; report the per-repo line counts. + +**Out of this branch:** applying it to the 13 other repos happens after the merge, one `chore/memory-v2` branch per repo, user approval per repo (phase 0b pattern), committed through `/commit-change` (a heading rename is an in-place edit, memory-commit refuses it by design).