chore(memory): BDR-133 negation rule, LRN-246 reflow proof, LRN-247 awk RSTART, journal + TODO ticks

This commit is contained in:
bchanot committed 2026-11-01 11:45:51 +01:00
1 parent 18e63705c5
commit 3873e35133
4 files changed
+31 -3

No files matched your search

+9
View File
@@ -1450,3 +1450,12 @@ Branch feature/user-writing-web-rules, UNMERGED (human gate).
- **Why**: user "il faut que ça soit systématique" (option A, 2026-10-29); BLK-037.
- **Rejected**: 8 rows in one ask (engine cap 2-4, LRN-242); native picker + pin-conflict alert only (option B, not systematic); gateway-id normalization (would switch on routing in a gateway session).
- **Supersedes**: BDR-126 "no args → native picker untouched". Live proof 2026-10-29: opus → [1m] → This project wrote `claude-opus-5-5[1m]`. Contract `.claude/tasks/contracts/2026-10-29-bare-model-dialog-1617.md`.
## BDR-133 — Negated status word in clause does not count, shared v1/v2 negation helper [accepted] (2026-11-01)
**Context**: v2 parser + v1 legacy reader read `Status: not resolved yet` as resolved (phase 4a minor, robin_petier EVAL-005 `keep, … not accepted until …` read accepted). User pick 2026-10-31/11-01.
**Decision**: status word negated in its clause does not count. Negator `not|no|never|pas`, at most one word between negator and word, no clause boundary `, ; . : ( ) -> → —` between. Next non-negated occurrence still counts. One helper `mem_has` in `_MEM_AWK`, shared by `mem_word` (v2) and `_mem_v1_word` (v1), so `upgrade` refuses such v1 closure ("unlabelled, mixed or negated line") instead of cementing resolved. Word = maximal `[a-z0-9]` run, loop not ERE interval (BWK awk).
**Alternatives**: ignore negation (keeps false closures); line-scope negation (`resolved, not open` would read none: wrong); NLP (no).
**Consequences**: real-data replay 14 repos → 1 move (robin_petier EVAL-005 accepted → keep). mawk run in T17 guards BWK-class awk.
+3
View File
@@ -677,3 +677,6 @@ rules:
- Phase 4a per-repo pass: 12 repos upgraded to v2 on chore/memory-v2 (game headings demoted, trucks bullet Indexes dropped + BLK-001 resolved, robin BLK-013/015 closures kept); BLK-038 found (upgrade cemented prose false-closed) → /bugfix 2dae528, 3 lenses + confirmation, verifier CONFORME 6/6, security PASS, real-data replay oracle over 13 repos; game/zq redone with user statuses. LRN-244, LRN-245. faunosteo prepared off-repo (V1-2 active).
- Step 2 suites: /hotfix 40a993c (absolute ~/.claude/rules paths in interviewer + guardrails) + 7899670 (analyzer memory field dropped), security PASS x2. Measured design hook: 59 fires, 0 web-building Reads (no once-per-session). Probe: Bash sed -n loads path rules like Read. Census blind spots: 0 real citations.
- /feat citers-blind-spots 5bd0de4: census reads nested lib paths, home prefixes, templates/project-rules, citer-aware .claude/rules; 3 lenses + confirmation (0 BLOCKER), verifier ECARTS x1 (SC2088/SC2016 suppressions) → fixtures rewritten, CONFORME, security PASS. /hotfix 3330f0b geo/seo '(dispatcher applies)'.
## 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.
+14
View File
@@ -1867,3 +1867,17 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s
- **Context**: phase 4a per-repo pass 2026-10-30, BLK-038. `memory.sh upgrade` turned the v1 lexical reader's closed verdict into an explicit `Status (…, upgrade): resolved` line; oracle "open set unchanged" passed because both readers agreed on the wrong verdict.
- **Pattern**: prose lines of the same shape carried opposite truth (orbistep BLK-021 "already resolved it" = really open; BLK-026 "ADDENDUM: resolved same day" = really resolved). No lexical rule decides prose.
- **Apply**: a migration carries a status only from a labelled line holding exactly one status word; everything else is named and refused, the human records the truth (`memory.sh status`), then re-run. Audit every written repair line against its source line before trusting "verdicts unchanged" ([[LRN-237]]).
## LRN-246 — Reflow proof: declare -f / declare -p diff, string splits executed on fixture (2026-11-01)
**Context**: A9 reflow of reconcile.sh + memory-commit.sh (39 lines > 80 bytes) had to prove zero behaviour change (memory-v2-minors 48ade8f).
**Pattern**: proof = `bash -c '. lib/x.sh; declare -f; declare -p <consts>'` before vs after, diff. Comment reflow and pipe/`&&` breaks normalize away. Surviving hunk = string split: review by hand, execute both versions on fixture, compare md5. Source old copy next to CURRENT deps so diff isolates the reflow.
**Application**: any cosmetic reflow of a sourceable shell lib; name the proof in the contract criterion, verifier reproduces it.
## LRN-247 — awk match() in shared helper clobbers caller RSTART, take substr first (2026-11-01)
**Context**: `mem_has` (negation helper) calls awk `match()`; `mem_tag` read `RSTART` after calling `mem_word` → `mem_has`, T10h/T10j broke.
**Pattern**: awk `match()` sets globals `RSTART`/`RLENGTH`; shared helper calling it clobbers caller's values. Take `substr(line, RSTART)` BEFORE calling any parser helper; audit every `RSTART` reader in programs embedding the shared awk block.
**Application**: any `_MEM_AWK` change touching match(); same for `$0`, `NF` side effects of `sub()`/`split()` in helpers.
+5 -3
View File
@@ -33,7 +33,9 @@ Shared rules for every phase:
- [x] Phase 4a per-repo pass (2026-10-30/31): 12 repos v2 on `chore/memory-v2` (config, integration_alphalink, robin_petier, zenquality, game, trucks_at_work, bchanot-cv, game-deploy, gitea-deploy off develop; angelscar356 off main; for_you, nuit-folle off master). game: 16 headings demoted in place; trucks_at_work: 3 bullet Indexes dropped + BLK-001 resolved; robin_petier: BLK-013 resolved + BLK-015 superseded (closures only in the v1 Index). BLK-038 (upgrade cemented prose false-closed) fixed 2dae528 before game/zenquality; user statuses: game BLK-021 open, BLK-026 resolved, BLK-030 upstream, zenquality BLK-006 open. Replay oracle: the 10 earlier repos byte-identical under the fixed lib.
- [ ] 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 <faunosteo> 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).
- [ ] 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.
- [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.
- [ ] 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 <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.
@@ -48,12 +50,12 @@ Shared rules for every phase:
- [ ] User step: delete the auto-memory leftovers by hand (`~/.claude/projects/-home-bchanot-Documents-{faunosteo,jeux-deploy,robin-petier}/memory/`); doctor warns until then.
- [x] Remove the dead `memory: project` field from agents/analyzer.md (/hotfix 7899670, 2026-10-31).
- [ ] Deferred (gate 2026-10-29): "Skill routing" lines → our skills' `description:` (phase 3 bullet said phase 1 cleanup).
- [ ] Census blind spots: nested `lib/<dir>/x.md § Y`, templates/ and .claude/rules/ outside doctrine-citers. Measured 2026-10-31: 0 real citations in all three today (preventive).
- [x] Census blind spots (2026-10-31, feature/citers-blind-spots 5bd0de4 → develop 4175401, T8a-T8h): nested `lib/<dir>/x.md § Y`, templates/ and .claude/rules/ outside doctrine-citers. Measured 2026-10-31: 0 real citations in all three today (preventive).
- [x] Measure the design hook's "Read … first" re-Read cost (2026-10-31, transcripts since 789a2b2): 59 hook fires, 0 Read-tool reads of web-building.md, 8 Bash mentions (repo maintenance). Re-read cost ≈ 0 → no "once per session" needed.
- [ ] Design hook false positives: the pointer is almost never followed, and it fires on non-design prompts (fired on the 2026-10-30 phase 4a memory-work prompt). Decide: tighten the trigger, or drop the hook now that web-building.md loads by path. User call, nothing coded.
- [x] Probe Bash `sed -n` (2026-10-31, two `claude -p --model haiku` runs here, mods/model-router/.claude-plugin/plugin.json): Bash `sed -n` AND Read both log `path_glob_match` mods.md with that trigger file. Path rules load after a Bash read too; not isolated whether the harness or the rtk rewrite triggers it.
- [x] Minor: relative rule paths in interviewer.md / guardrails SKILL.md → `~/.claude/rules/` (/hotfix 40a993c).
- [ ] Agent description losses: user pick 2026-10-31 = restore "(dispatcher applies)" on geo-analyzer + seo-analyzer only; the rest closed (bodies keep it).
- [x] Agent description losses (3330f0b): user pick 2026-10-31 = restore "(dispatcher applies)" on geo-analyzer + seo-analyzer only; the rest closed (bodies keep it).
- [x] robin_petier `chore/memory-lan-server` (BDR-075): merged 2026-10-29 (6877443).
- Facts 2026-10-24 (scratchpad pathtest, memtest): a `paths:` rule loads on Read of a matching file, NOT on Write of a new file; `"autoMemoryEnabled": false` removes the auto-memory system section; classic SessionStart / UserPromptSubmit hooks inject additionalContext; instruction files reload on compaction natively. `hooks/design-toolchain-reminder.sh` fired 2,131 times (16 to 210 per day); `brainstorming` is vendored and gitignored (.gitignore:78), an edit there does not persist.
- Section → carrier: