From 7128a95cd8ab37a67a1451eea89b9e9f5c474acb Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 12 Nov 2026 00:16:18 +0100 Subject: [PATCH] chore(memory): D4 done, BDR-143, LRN-278, follow-ups logged --- .claude/memory/decisions.md | 6 ++ .claude/memory/journal.md | 3 + .claude/memory/learnings.md | 5 + .claude/tasks/TODO.md | 2 +- ...6-11-11-prune-memory-status-reader-1400.md | 33 +++++++ ...6-11-11-prune-memory-status-reader-1400.md | 95 +++++++++++++++++++ 6 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 .claude/tasks/contracts/2026-11-11-prune-memory-status-reader-1400.md create mode 100644 .claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index e0e9bc0..0439e6e 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1536,3 +1536,9 @@ Supersedes [[BDR-030]]. - **Why**: `set` merges whole fragment (every managed key): a recommendation on a project with chosen packs or a custom state wiped them silently (web project told "backend → dev" lost 6 packs). Advisor has no Bash: lists it "computed" were invented; gate holds the shell. Bare `ui-ux-pro-max` id refused rc 2. - **Alternatives rejected**: set anytime with turns-off list (clobbers custom/chosen packs); hotfix → set minimal (task-scoped mass disable, persists project-wide); advisor printing full commands (unvalidated token reaches shell). - **Ref**: feature/banner-drop-plugin-dev 80f56ef + 9b12b12, plan .claude/tasks/plans/2026-11-11-advisor-packs-vocabulary-1000.md (r3, 2 challenge rounds, 4 exec rounds). Follow-ups in BUGS-FOUND (embedded keyword → SET minimal, extras metered pack, quoting). See [[BDR-134]]. + +## BDR-143 — prune-memory reads statuses via one prefix classifier, unreadable info-only [accepted] (2026-11-12) +- **Context**: /prune-memory STEP 1.A read raw `status:` prose + per-entry frontmatter; `memory.sh index decision` Status empty on game 107/107, config 19/19, faunosteo 76/80 (dialects, v1). +- **Decision**: one classifier `reconcile_status_classify ` (lib/reconcile.sh) for decisions + blockers: strict word v2, one-word status/statut label v1 (`RECONCILE_BDR_RE` widens v1 selector), never `## Index`. `reconcile_blk_classify` = BLK wrapper, output byte-identical. Unreadable status = one info-only count line per registry, outside "all", never written by skill, word from user per ID. User gated 2026-11-11. +- **Alternatives**: `memory.sh index decision` (reads no status on dialect/v1 projects); one reader per registry (duplicate parsers, BDR-129 drift class); guess word from prose (false open/close). +- **Consequences**: dialect projects (game, faunosteo) get no prune candidate until dialect migration (BUGS-FOUND follow-up). Commit 99f10b2, test RED-9. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 957d912..3efa6b3 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -720,3 +720,6 @@ rules: ## 2026-11-11 - 2026-11-11: /bugfix G5 handover blocker status: 2 challenge rounds -> r3 reconcile_blk_classify (open/closed/unreadable), STEP 9 rooted on PACKAGE root, mandatory SYNTH MEMORY line relayed to user; gates MET/CONFORME/PASS first pass; commit 93a8e19 + changelog; G6-G9 + 2 LOW logged in BUGS-FOUND; BLK-048, LRN-276. - 2026-11-11: G5 merged c0347eb. 3.0.0 scope set (D1-D6, dead denies, MIGRATION). /feat D2+D3 on feature/banner-drop-plugin-dev: 2 challenge rounds, RUN A banner (plugin-dev gone, OFF row hidden) 80f56ef, RUN B advisor packs vocabulary 9b12b12 after 2 verifier + 1 security rounds; docs; 6 follow-ups in BUGS-FOUND; BDR-142, LRN-277. + +## 2026-11-12 +- 2026-11-12: /feat D4 done on feature/prune-memory-status-reader: 99f10b2 one status classifier for prune-memory (v1+v2), docs bd0687d. 3 challenge rounds (r1 FATAL: memory.sh index reads no status on 4 projects). Gates: floor MET, verifier CONFORME, security PASS (4 LOW). 5 follow-ups in BUGS-FOUND. Merge awaits user. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 3da8f98..5146d73 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -2036,3 +2036,8 @@ Rule: when editing a doctrine file under structure locks, grep the test's lock s - **Context**: D3 plan r2 had advisor print "turns off: "; advisor tools Read/Glob/Grep, no Bash. Two challengers caught it: list would be invented. Same run: sonnet executors left stdin-blocked background jobs 3x (`python3 -`, `cat >>`, empty heredoc), one holding a stale compound command. - **Pattern**: before assigning a computation to an agent, check its `tools:` frontmatter; shell-derived facts belong to the component that runs Bash (main-loop gate), the report-only agent names inputs only. Executor briefs forbid stdin readers without input (`cat` no file, `cat >>`, `python3 -`), require one simple foreground command per call; orchestrator TaskStops any leftover job named in the report before GATE 0. - **Future application**: any plan splitting work between a reasoner agent and a gate; every feater/bugfixer brief. + +## LRN-278 — probe a registry reader on every real project before planning the switch (2026-11-12) +- **Pattern**: before plan swaps a registry reader, probe candidate reader read-only on real registries of every project (game, config, faunosteo, faunosteo-v1-2), count readable vs empty. +- **Context**: D4 r1 assumed `memory.sh index decision` gives decision status. Probe: Status empty 107/107 game, 19/19 config, 76/80 faunosteo, 79/110 faunosteo-v1-2. Challenge correctness FATAL, plan r2-r3 needed. +- **Apply**: STEP 0.6 / plan phase of any memory-reader change: run reader on all known project registries first, put counts in plan. Fixtures alone hide dialects. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index b7431f8..1515055 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -136,7 +136,7 @@ Shared rules for every phase: - [ ] D1 doctrine: CLAUDE.global.md:52-54 "Session start 1. Read `.claude/memory/`" + skills/capitalize/SKILL.md:375, while the 4c digest delivers open BLK + TODO + last journal at start (4a meant to fix the "load every session" premise) - [x] D2 visible (done 80f56ef, feature/banner-drop-plugin-dev): banner "OFF : plugin-dev" (plugin dropped 2026-07-02): lib/detect-plugins.sh:43-47, hooks/session-start.sh:106,111,180,210, agents/plugin-advisor.md:59,181,199,242,250-255 - [x] D3 visible (done 9b12b12, BDR-142; follow-ups in BUGS-FOUND) (= docs backlog P34): packs vocabulary in agents/plugin-advisor.md (:99 PROFILE template in the old `profile.sh current` format, :126-129 rollback, gstack ON/OFF rules, context7 ON) and USAGE.md:181,232,233,1090,1092,1095 - - [ ] D4 skill behavior: skills/prune-memory STEP 1.A/3 detection (per-entry frontmatter, raw `status:` lines) → read statuses via `memory.sh index` (v1 + v2); keep example IDs 9xx (RED-7) + - [x] D4 skill behavior (done 99f10b2 + docs bd0687d, feature/prune-memory-status-reader; one classifier `reconcile_status_classify`, unreadable = info-only count; follow-ups in BUGS-FOUND): skills/prune-memory STEP 1.A/3 detection (per-entry frontmatter, raw `status:` lines) → read statuses via `memory.sh index` (v1 + v2); keep example IDs 9xx (RED-7) - [ ] D5 user rules: rules/web-security.md vs rules/secure-by-default.md: strict duplicates (web-security :11, :19, "Login rate limiting," in :20) and password wording conflict ("bcrypt/argon2" vs "argon2id (bcrypt or scrypt otherwise)"); cookie flags, upload type/size, forced HTTPS, security headers are unique to web-security - [x] G1+G4 fixed (bugfix/banner-effective-profile, merged a655b06); G3 fixed (merged 9f9821e); G2 hand figures removed (bugfix/passive-cost-source, plan `.claude/tasks/plans/2026-11-10-passive-cost-source-1330.md` r3); G5 fixed (bugfix/handover-memory-status, 93a8e19, plan `.claude/tasks/plans/2026-11-10-handover-memory-status-1600.md` r3); follow-ups G6-G9 + 2 LOW quoting in BUGS-FOUND - [ ] feature (G2 split, user 2026-11-10): measured passive-cost API, one source for doctor / /status / plugin-advisor (probe COSTS field). Spec input = the two challenge rounds in the G2 plan: unit = pack or ON plugin (skills + agents + commands descriptions; pr-review-toolkit ~1550t, example-skills ~2350t), doctor counts OFF packs (higgsfield, extras), `detect_plugin_dev` globs the wrong cache level and ignores enabled state, `?` for not-installed or empty units, rc-0 sentinels (`costs-unavailable`/`unknown`) for doctor's `set -euo pipefail`, profile.sh failure → unknown, `python3 -I` (probe runs in the user's project), installPath from installed_plugins.json. Doctor keeps its measured ui-ux 670 until then. diff --git a/.claude/tasks/contracts/2026-11-11-prune-memory-status-reader-1400.md b/.claude/tasks/contracts/2026-11-11-prune-memory-status-reader-1400.md new file mode 100644 index 0000000..e2627a1 --- /dev/null +++ b/.claude/tasks/contracts/2026-11-11-prune-memory-status-reader-1400.md @@ -0,0 +1,33 @@ +# CONTRACT — prune-memory-status-reader +- date: 2026-11-11 | flow: feat | branch: feature/prune-memory-status-reader +- status: active + +## REQUEST (verbatim — IMMUTABLE) +D4 from .claude/tasks/TODO.md § Release 3.0.0 scope (user decision 2026-11-11 [gated]: "D4 /prune-memory reads statuses through memory.sh (v1+v2), example IDs 9xx"). Evidence: .claude/tasks/plans/2026-11-09-bdr125-obsolescence-clean-1650.md D4: skills/prune-memory/SKILL.md STEP 1.A/3 detection rules (:33-34,81-82,87-89,157-159,252,260-261) still describe per-entry frontmatter and raw `status:` lines; reading statuses through the shared reader (`memory.sh index`, lib/reconcile.sh reconcile_blk_current_status / memory_entry_status / memory_legacy_status per BDR-129) works on v1 and v2; example IDs must stay 9xx (run-deterministic.sh RED-7). Line numbers may have moved: re-locate. Regression test in the existing prune-memory / skill census harness if one fits. make test needs GATES_TIMEOUT=600 + PATH=$HOME/.bun/bin:$PATH (LRN-271). Foreign-code style. In force: BDR-129 (strict v2, legacy v1, never the Index), BDR-133, BDR-142 n/a, LRN-276 (test the shipped snippet), LRN-277 (executor briefs forbid stdin readers), LRN-275. + +## CLARIFICATIONS +Q: plan? / A: .claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md r3 is binding (orchestrator, after two challenge rounds) +Q: decision reader, given `memory.sh index decision` reads no status on game 107/107, config 19/19, faunosteo 76/80? / A: one classifier for decisions and blockers: generalize reconcile_blk_classify to a prefix (strict v2, one-word v1) (user, 2026-11-11) [gated] +Q: unreadable statuses in the plan? / A: one count line per registry, info only, outside "all", never written by the skill, word from the user per ID; dialect migration logged as a follow-up (user, 2026-11-11) [gated] +Q: STEP 4 status drift check (round 2)? / A: dropped from D4, logged as follow-up (orchestrator, simplicity finding: ungated new gate) + +## ACCEPTANCE CRITERIA +1. The prune-memory deterministic suite runs RED-9 and is all green. + CHECK: cd /home/bchanot/Documents/claude && out=$(bash skills/prune-memory/tests/run-deterministic.sh 2>&1); printf '%s\n' "$out" | grep -q '^RED-9: GREEN' && printf '%s\n' "$out" | grep -q 'SUITE: all GREEN' && echo PRUNE-OK + EXPECT: PRUNE-OK + EVIDENCE: MET exit=0 marker-found :: PRUNE-OK +2. SKILL.md reads statuses through the classifier and keeps no raw status or frontmatter wording. + CHECK: cd /home/bchanot/Documents/claude && S=skills/prune-memory/SKILL.md && grep -q 'reconcile_status_classify' $S && grep -q 'Status unreadable' $S && [ "$(/usr/bin/grep -c 'status: ' $S)" = 0 ] && [ "$(/usr/bin/grep -c 'frontmatter' $S)" = 0 ] && echo SKILL-OK + EXPECT: SKILL-OK + EVIDENCE: MET exit=0 marker-found :: SKILL-OK +3. The classifier is generic and the BLK wrapper stays. + CHECK: cd /home/bchanot/Documents/claude && grep -q '^reconcile_status_classify()' lib/reconcile.sh && grep -q 'reconcile_status_classify "$1" BLK' lib/reconcile.sh && grep -q 'MEM_LEGACY_RE:-' lib/memory.sh && echo LIB-OK + EXPECT: LIB-OK + EVIDENCE: MET exit=0 marker-found :: LIB-OK +4. Full suite green and shellcheck clean on the touched scripts. + CHECK: cd /home/bchanot/Documents/claude && shellcheck -S warning lib/reconcile.sh lib/memory.sh skills/prune-memory/tests/run-deterministic.sh && GATES_TIMEOUT=600 PATH="$HOME/.bun/bin:$PATH" make test 2>&1 | tail -1 | grep -q 'all suites green' && echo GREEN + EXPECT: GREEN + EVIDENCE: MET exit=0 marker-found :: GREEN + +## FILE SCOPE +lib/memory.sh (memory_legacy_status `` branch selector only), lib/reconcile.sh, skills/prune-memory/SKILL.md, skills/prune-memory/tests/run-deterministic.sh diff --git a/.claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md b/.claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md new file mode 100644 index 0000000..283de9a --- /dev/null +++ b/.claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md @@ -0,0 +1,95 @@ +# FEAT — prune-memory-status-reader (/feat D4, 2026-11-11) — r3 + +Source: .claude/tasks/TODO.md § Release 3.0.0 scope, D4 (user 2026-11-11 [gated]: "/prune-memory reads statuses through memory.sh (v1+v2), example IDs 9xx"); evidence .claude/tasks/plans/2026-11-09-bdr125-obsolescence-clean-1650.md D4. + +## User decisions 2026-11-11 [gated] (after challenge round 1) +- ONE classifier for decisions and blockers: generalize `reconcile_blk_classify` to a prefix (strict word on v2, single status word on v1 via `_mem_v1_word`, never the `## Index`, never prose). Same grammar for both registries. +- Unreadable statuses: ONE count line per registry, info only: outside "all", never a candidate, never written by the skill; the status word comes from the user, per ID, never from the entry text. Dialect migration is a separate follow-up, logged, not done here. + +## Round 2 rulings (no BLOCKER; CONCERNS robustness 4, simplicity 1, correctness 2) +- STEP 4 status drift check DROPPED (simplicity 1: ungated new certification gate; it misfires on every approved merge and on v1 prose compression, robustness 2/3, correctness 2). Logged as follow-up. +- v1 decisions line selector widened (robustness 1): `statut`, `superseded`, `deprecated` added for the BDR range, through an env override of the existing selector (BLK path untouched). +- One status-line rule for compression and merges, v1 included (correctness 1); merged status written by `--status ` shown on the [B] line, evals included (robustness 4, 9). +- v1 date dialects give no 90-day candidate: stated in 1.A, part of the dialect follow-up (simplicity 2, correctness 6). +- RED-9: no `grep -P`, no `sed -i` (portability census); BLK rows cut to one; census on `status: ` (catches backticked forms); extract_block anchored. + +## Context +- skills/prune-memory/SKILL.md raw `status: …` wording at :33-34, :81-82, :87-89, :122-123, :130, :252, :260-261; "frontmatter" at :157, :159. v2 registries have no per-entry frontmatter: heading `## ID — title [status] (date)` + `- **Label**: value` lines + dated `- **Status (date)**:` lines. On v1 files `memory.sh add --status s` writes a `- **Status**: s` body line (lib/memory.sh:396-399). +- Real data (read-only, challenge rounds): `memory.sh index decision` Status empty for game 107/107 (`format: 2` but `date: … · status:` dialect), config 19/19, faunosteo 76/80 (v1 words `closed`, `active`), faunosteo-v1-2 79/110. Most stay unreadable with any reader: hence the count line. +- `reconcile_blk_classify` (lib/reconcile.sh:116-137) is BLK-only. Column 2 is `open` for every known non-closed word; the word is column 3. +- `memory_legacy_status ` (lib/memory.sh:642-663) keeps the LAST line of the range matching `_MEM_LEGACY_RE='status|RESOLVED|REVERTED|upstream|resolved|[^a-z]open'` (case-insensitive in the `` awk branch via `RE="$_MEM_LEGACY_RE"`); `_mem_v1_word` needs exactly ONE known word after a status/statut label, else empty. +- run-deterministic.sh: RED-1,2,5,6,7 in Makefile SUITES; `extract_block` matches `"^## " h` unanchored, so "STEP 0" re-arms on `## STEP 0b` (step0.sh today also carries STEP 4's block). RED-6 pins HOME to a sandbox whose `.claude/lib` links this repo's lib. lib/tests/portability-census.test.sh flags `grep -…P` and `sed -i` in tracked *.sh. tests/BACKLOG.md already has a "RED-8 (candidate)": the new test is RED-9. + +## Plan +1. lib/memory.sh `memory_legacy_status`, `` branch only: `RE="$_MEM_LEGACY_RE"` → `RE="${MEM_LEGACY_RE:-$_MEM_LEGACY_RE}"`; one comment line: callers may widen the selector (reconcile's decisions range). Default branch untouched; no other memory.sh change. +2. lib/reconcile.sh — generalize, BLK output byte-identical: + - constant near RECONCILE_DEFER_RE: `RECONCILE_BDR_RE="$_MEM_LEGACY_RE|statut|superseded|deprecated"` with a comment (v1 decisions carry `**Statut** :` and `Superseded by …` lines the blocker selector skips; an unlabelled winner stays unreadable through `_mem_v1_word`). + - helper: + ```bash + _reconcile_status() { # → the current status line + [ "$3" = BLK ] && { reconcile_blk_current_status "$1" "$2"; return; } + if memory_is_v2 "$1"; then memory_entry_status "$1" "$2"; return; fi + MEM_GREP="$RECONCILE_GREP" MEM_LEGACY_RE="$RECONCILE_BDR_RE" \ + memory_legacy_status "$1" "$2" "^##* *$3-[0-9]" + } + ``` + - `reconcile_status_classify ` = today's `reconcile_blk_classify` body with `BLK` → `$2` (enumerate, `_mem_heading_ids`) and the status call → `_reconcile_status "$1" "$id" "$2"`; `reconcile_blk_classify() { reconcile_status_classify "$1" BLK; }`. Header "Layers" list: add `reconcile_status_classify` (any prefix; `reconcile_blk_classify` = its BLK wrapper). +3. skills/prune-memory/SKILL.md STEP 1 — AUDIT: right after "For each target registry…", the status source, run once: + ```bash + # Current statuses: one reader for decisions and blockers (BDR-129: + # strict word on v2, one status word on v1, never the ## Index, never a + # word in prose). Rows: IDopenword | IDunreadableline; + # closed entries (resolved, superseded, deprecated) are omitted. + for k in decisions:BDR blockers:BLK; do + f=".claude/memory/${k%%:*}.md" + [ -f "$f" ] || { echo "== $f: no-file"; continue; } + echo "== $f" + ( . "$HOME/.claude/lib/reconcile.sh" \ + && reconcile_status_classify "$f" "${k#*:}" ) \ + || echo "== $f: reader-unavailable" + done + ``` + Prose under it: these rows are the ONLY status source of STEP 1.A; a status word in an entry's prose or title is never a status. With a `$ARGUMENTS` filter, use only the rows of the filtered registries. `reader-unavailable` → no status-based candidate for that registry this run (say so in STEP 2). `unreadable` rows → the `[Status unreadable]` count line (STEP 2), never an A candidate. +4. STEP 1.A rules on that source (word = column 3): + - "Decisions whose word is `proposed` and whose date is older than 90 days → propose `memory.sh status "deprecated, no follow-up after 90 days"`. Date = the newer of the `memory.sh index decision` Date cell and the date of the entry's last `- **Status (YYYY-MM-DD)**:` line; no date → not a candidate (v1 dialect dates such as `| date |` headings or `date: … ·` lines give none)." + - Successor rule: "… whose word is still `accepted`" (drop its `memory.sh index decision` mention). + - "Blockers whose word is exactly `open` (never upstream, accepted or any other word) whose root cause matches a commit in the last 30 days (grep `git log --since=30.days --grep=`) → propose `memory.sh status "resolved "`." + - Journal rule unchanged. +5. STEP 2 — PRESENT PLAN example (9xx IDs only, RED-7): + - :122-123 → `BDR-901 — example proposed decision — word proposed, dated <90+ days ago>` / `→ memory.sh status BDR-901 "deprecated, no follow-up after 90 days"`. + - [B] line :128-130 → `→ propose: merge into NEW LRN-904 (learnings carry no status) with both bodies appended + caveman pass; sources: memory.sh status "superseded by LRN-904"`. Census reminder: nowhere in SKILL.md may `status` be followed by a colon and a space in lowercase. + - new block after [C]: + ``` + [Status unreadable — info only, never applied, not part of "all"] + decisions.md: 3 (BDR-905, BDR-906, BDR-907) + → you give the word per ID: memory.sh status "" + ``` + - Prose after the example: a [B] merge of decisions, blockers or evals names the merged entry's status word on its line (default: the sources' common word; sources differ → ask in `edit `); the count line folds IDs (first 10, then `+N more`); the word always comes from the user, never from the entry text; on a v1 file the status text carries one status word only (else it stays unreadable); a row `heading level` needs its heading fixed to `## ID` first (`memory.sh status` cannot reach it). Approve prompt unchanged. +6. STEP 3, one definition used by 3.2 and 3.3 — a STATUS LINE is any line of the entry that holds (case-insensitive) `status`, `statut`, `resolved`, `reverted`, `upstream`, `superseded`, `deprecated` or the word `open`, or a `- **