Merge feature/prune-memory-status-reader into develop
This commit is contained in:
commit
1cc89bee35
12 files changed
+296
-38
No files matched your search
@@ -30,3 +30,10 @@
|
||||
- agents/plugin-advisor.md:281 BLOCK "Superpowers skills missing → make plugin" + lib/plugin-gate.md:61 "A) fix plugins" undefined — cwd-dependent `make plugin` in an onboarded foreign repo; qualify with the claude-config repo or make it print-only. Severity: low. Discovered while: /feat D3 security gate. Not fixed.
|
||||
- lib/plugin-gate.md templates — tokens and `"<PROJECT_ROOT>"` sit in double quotes (`$()` / backticks still expand; protection = the prose closed-list check); linked worktree: the apply check compares `--show-toplevel` but profile.sh writes at the parent of `--git-common-dir` (confirmed path ≠ written path, same repo); PROJECT_ROOT = $HOME as a git repo passes the check and find_root writes `~/.claude/settings.local.json`. Severity: low (defense in depth). Discovered while: /feat D3 security gates. Not fixed.
|
||||
- skills/onboard/SKILL.md:387-762 and skills/tour/SKILL.md:155 — still "gstack ON/OFF" (packs vocabulary elsewhere since D3); cosmetic: unwrapped lines skills/plugin-check/SKILL.md:17, lib/plugin-gate.md:45, USAGE.md:182, USAGE.md:1022 transcript without the ↻ glyph. Severity: low. Discovered while: /feat D3 verifier. Not fixed.
|
||||
|
||||
<!-- /feat D4 2026-11-12 (feature/prune-memory-status-reader): follow-ups from challenge rounds and gates, plan .claude/tasks/plans/2026-11-11-prune-memory-status-reader-1400.md r3 -->
|
||||
- Registry dialects the classifier cannot read: game is `format: 2` but written in the `date: … · status:` dialect (decision statuses unreadable), faunosteo uses `closed` / `active` words, v1 date dialects give no 90-day `proposed` candidate. /prune-memory shows them on the info-only `[Status unreadable]` line; a dialect migration (memory.sh upgrade or a one-shot rewrite per project) is not designed. Severity: medium (prune finds no candidate on those projects). Discovered while: /feat D4 challenge round 1. Not fixed.
|
||||
- skills/prune-memory STEP 4 — status drift check (Index vs body, title word vs status word) dropped from D4 as an ungated new gate. Severity: low. Discovered while: /feat D4 challenge round 2. Not fixed.
|
||||
- lib/memory.sh:657 `memory_legacy_status` reads `MEM_LEGACY_RE` from the environment: an ambient `export MEM_LEGACY_RE` also widens `memory.sh upgrade`'s `<end>` readers (`_mem_legacy_open`, `_mem_explicit_status`, `_mem_repair_one`, the last one decides a v1 closure write). Fails closed on a bad regex. Fix: explicit 4th positional argument, drop the env read. Severity: low. Discovered while: /feat D4 security gate. Not fixed.
|
||||
- lib/memory.sh `memory_legacy_status` `<end>` range on v1 decisions: the last BDR entry runs to EOF, so a `## Index` or other `##` section after it would be read by the widened selector (none on disk today). Severity: low. Discovered while: /feat D4 verifier. Not fixed.
|
||||
- skills/prune-memory/tests/run-deterministic.sh:13 — `SANDBOX="$(mktemp -d …)"` unchecked under `set -uo pipefail` (no `-e`): a mktemp failure leaves SANDBOX empty and RED-9 targets `/red9a`, `/home9` (fails for a non-root user; trap `rm -rf ""` deletes nothing). Pre-existing, RED-9 extends it. Fix: `|| exit 1`. Cosmetic: skills/prune-memory/SKILL.md:34 ~96 chars unwrapped. Severity: low. Discovered while: /feat D4 security gate + verifier. Not fixed.
|
||||
@@ -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 <file> <PREFIX>` (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.
|
||||
@@ -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.
|
||||
@@ -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: <ids from profile.sh diff>"; 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.
|
||||
@@ -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.
|
||||
|
||||
@@ -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 `<end>` branch selector only), lib/reconcile.sh, skills/prune-memory/SKILL.md, skills/prune-memory/tests/run-deterministic.sh
|
||||
@@ -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 <word>` 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 <file> <ID> <end>` (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 `<end>` 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`, `<end>` 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() { # <file> <ID> <PREFIX> → 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 <file> <PREFIX>` = 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: ID<TAB>open<TAB>word | ID<TAB>unreadable<TAB>line;
|
||||
# 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 <ID> "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=<keyword>`) → propose `memory.sh status <ID> "resolved <commit>"`."
|
||||
- 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 <ID> "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 <ID> "<word>"
|
||||
```
|
||||
- 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 <ID>`); 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 `- **<label>**:` line whose label holds status/resolution/action/update/final.
|
||||
- 3.2 Merges: `memory.sh add <kind> --title … --body-file … [--status <word>] --supersedes …` with the word shown on the [B] line (decisions, blockers, evals; learnings none). The merged body drops the sources' labelled status lines (`- **Status…**:`, `Status:` / `statut` lines, `- **Resolution|Action|Update|Final…**:`); the new entry's status is the `--status` word (v2: heading tag; v1: a `- **Status**:` body line, and a later prose STATUS LINE can make it unreadable: it then shows in the count line). Replace the "Keeps frontmatter fields: …" bullet with "`memory.sh add` writes the heading (new ID, title, date) and the status; the body keeps the union of `**Reference**:` lines."
|
||||
- 3.3 Compression: "preserve frontmatter exactly (id, date, title, status, references)" → "keep VERBATIM the heading line, every `- **Label**:` key and every STATUS LINE; rewrite only the other prose."
|
||||
7. Core principles :33-34, What NOT to prune :252, Common mistakes :260-261: `status: superseded by …` / `status: deprecated` / `status: superseded` → "a `superseded by <ID>` / `deprecated` status written by `memory.sh status`"; "Entries the user marked `status: accepted` in the current session" → "Entries whose status the user set this session". After the run SKILL.md holds no `status: ` (lowercase, colon, space) and no `frontmatter`.
|
||||
8. skills/prune-memory/tests/run-deterministic.sh:
|
||||
- `extract_block`: anchor the heading, `$0 ~ "^## " h "( |$)"` (STEP 0 no longer re-arms on STEP 0b); RED-2 and RED-6 stay GREEN.
|
||||
- RED-9 (behaviour, LRN-276: runs the shipped STEP 1 block), fixtures written with printf in `$SANDBOX/red9a` and `$SANDBOX/red9b` (no fixture files), HOME pinned like RED-6, `TAB=$'\t'`, assertions `/usr/bin/grep -qxF "<row>"` on the block output (whole-line, fixed string; unreadable rows matched with `/usr/bin/grep -qF "BDR-905${TAB}unreadable${TAB}"`). No `grep -P`, no `sed -i`.
|
||||
- red9a decisions.md v2 (`---` / `format: 2` / `---` frontmatter): `## BDR-901 — old idea [proposed] (2026-01-01)` with body "resolved later" → `BDR-901${TAB}open${TAB}proposed`; `## BDR-902 — kept [accepted] (2026-02-01)` + `- **Status (2026-03-01)**: superseded by BDR-903` → no BDR-902 row. red9a blockers.md v1: `## BLK-903 — c` + `- **Status**: upstream` → `BLK-903${TAB}open${TAB}upstream` (wiring only; HM3a covers the BLK cases).
|
||||
- red9b decisions.md v1 (no frontmatter): `## BDR-904 — x` + `date: 2026-01-01 · status: accepted` → `BDR-904${TAB}open${TAB}accepted`; `## BDR-905 — y` + `Status: closed.` → unreadable row; `## BDR-906 — z` + `Status: proposed` then a later `- **Statut** : accepted (2026-05-01)` → `BDR-906${TAB}open${TAB}accepted`; `## BDR-907 — w` + `- Status: proposed` then `Superseded by BDR-911 (2026-05-01).` → no `open` row for BDR-907 (unreadable).
|
||||
- Census: `/usr/bin/grep -c 'status: ' "$SKILL"` = 0 and `/usr/bin/grep -c 'frontmatter' "$SKILL"` = 0.
|
||||
- GREEN when every assertion holds; a RED message names the first failing one.
|
||||
- Header comment lists RED-9; summary lines unchanged.
|
||||
|
||||
## Edge cases
|
||||
- No decisions.md / blockers.md: `no-file` line. reconcile.sh missing or failing: `reader-unavailable` line.
|
||||
- BLK output unchanged (wrapper, default selector): HM1-HM3 and run-reconcile.sh stay green.
|
||||
- Fixture IDs 9xx only. learnings / evals / journal are not read by the STEP 1 block.
|
||||
- G7 (memory.sh upgrade may take a stale v1 Index cell): the remedy names `memory.sh status`, never `upgrade`.
|
||||
|
||||
## Disposition
|
||||
honors BDR-129 (strict v2, legacy v1, never the Index: one classifier, both registries), BDR-133 (negated words: `_mem_v1_word`), LRN-276 (RED-9 runs the shipped STEP 1 block), LRN-277 (executor brief forbids stdin readers), LRN-275 (explicit staging), LRN-271 (make test env), LRN-074 (pinned /usr/bin/grep). Deviation from the gated wording "through memory.sh": the classifier lives in lib/reconcile.sh, built on memory.sh readers (user chose it 2026-11-11). Foreign-code style.
|
||||
|
||||
## Files (4)
|
||||
lib/memory.sh, lib/reconcile.sh, skills/prune-memory/SKILL.md, skills/prune-memory/tests/run-deterministic.sh.
|
||||
|
||||
## Follow-ups (log in BUGS-FOUND / TODO, not done)
|
||||
- Dialect migration: `format: 2` registries in `date: … · status:` (game 107 decisions), v1 words outside `_MEM_WORDS` (`closed`, `active`, faunosteo), v1 date dialects invisible to the 90-day rule.
|
||||
- Status drift check at /prune-memory STEP 4 (classify HEAD vs working, expected-drift set from STEP 2 incl. merges, whole-file restore remedy): dropped from D4 round 2.
|
||||
@@ -40,6 +40,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
|
||||
- `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.
|
||||
- `/prune-memory` reads decision and blocker statuses through one classifier, `reconcile_status_classify <file> <PREFIX>` in `lib/reconcile.sh` (`reconcile_blk_classify` stays as its BLK wrapper): a strict status word on v2, the single word of a status or statut label on v1, never the `## Index`, never a word in an entry's title or prose. Its obsolete candidates (a `proposed` decision older than 90 days, an `open` blocker matched by a commit of the last 30 days) come from those words only. A status no reader can map shows on an info-only `[Status unreadable]` count line with the `memory.sh status` command to set it; that line is never applied and is not part of `all`. `memory_legacy_status` (`lib/memory.sh`) accepts a `MEM_LEGACY_RE` override of its v1 line selector.
|
||||
- impeccable is the Build path for all UI: it replaces `frontend-design` on the design gate's `# GATE-BLOCK:` list and leads the Build line of the design doctrine. `frontend-design` stays installed as the light path for a one-off visual. Detector rule count corrected 45 to 61 (BDR-119).
|
||||
- model-router `verbose: true` logs transitions only: one line when main changes model or effort (`model-router: main: fable/high → fable/xhigh (plan: route tool)`), one hand-off line per dispatch and one per later effort move of an agent, each with its cause; the per-step, "answered by", spawn, route-tool and skill-path lines are gone. An agent answering on a model other than the planned one is said once. A non-boolean `verbose` falls back to `false`, said once.
|
||||
- `verifier` and `security-auditor` run on a new `audit` phase (best/xhigh: Fable, Opus when Fable is down). Their frontmatter floor is `model: opus` (the verifier was `sonnet`): a fable floor would spawn the gates on a dead model during a credit outage. `judge` (big/xhigh, opus) keeps plan-challenger, analyzer and plugin-advisor. The `about` lines of `judge` and `verify` no longer claim audits or security review. The census `lib/tests/effort-routing.test.sh` floors a best-tier agent row on the tier's second alias (opus).
|
||||
|
||||
+2
-1
@@ -653,7 +653,8 @@ memory_legacy_status() { # <file> <ID> [<end>] → the v1 lexical status line
|
||||
| tail -1
|
||||
return
|
||||
fi
|
||||
RE="$_MEM_LEGACY_RE" END_RE="$end" awk -v id="$2" '
|
||||
# callers may widen the selector (reconcile: the decisions range)
|
||||
RE="${MEM_LEGACY_RE:-$_MEM_LEGACY_RE}" END_RE="$end" awk -v id="$2" '
|
||||
/^```/ { fence = !fence; next }
|
||||
!fence && $0 ~ ("^#+ *" id "( |$)") && on { next }
|
||||
!fence && $0 ~ ENVIRON["END_RE"] { on = 0 }
|
||||
|
||||
+25
-12
@@ -31,8 +31,9 @@
|
||||
# parser on v2, legacy lexical reader on v1
|
||||
# reconcile_blk_open — blockers whose CURRENT status is not closed
|
||||
# (resolved | superseded | deprecated on v2)
|
||||
# reconcile_blk_classify — blockers for a client deliverable: open
|
||||
# reconcile_status_classify — entries of any prefix (BLK, BDR): open
|
||||
# (word) | unreadable, closed omitted
|
||||
# reconcile_blk_classify — its BLK wrapper, for a client deliverable
|
||||
# reconcile_verdict — pure kernel: declared checkbox × real fact
|
||||
# → verdict
|
||||
# reconcile_deferrals — lexical deferral sweep (honest limit)
|
||||
@@ -49,6 +50,9 @@ RECONCILE_GREP="${RECONCILE_GREP:-/usr/bin/grep}"
|
||||
RECONCILE_DEFER_RE='[Dd]efer|[Ff]ollow-?up|[Oo]ut.of.scope|OUT-OF-SCOPE'
|
||||
RECONCILE_DEFER_RE+='|[Rr]econsider|[Rr]evisit|2e passage|won.t.do'
|
||||
RECONCILE_DEFER_RE+='|optional\)|one-line ticket'
|
||||
# v1 decisions carry `**Statut** :` and `Superseded by …` lines the blocker
|
||||
# selector skips; an unlabelled winner stays unreadable (_mem_v1_word)
|
||||
RECONCILE_BDR_RE="$_MEM_LEGACY_RE|statut|superseded|deprecated"
|
||||
|
||||
# --- recursive coherence: enumerate IDs from the BODY, never the ## Index ---
|
||||
# $1 registry file, $2 prefix (BDR|LRN|BLK|EVAL). Emits one id per line, unique.
|
||||
@@ -107,17 +111,25 @@ reconcile_blk_open() {
|
||||
printf '%s\t%s\n' "$id" "$st"
|
||||
done
|
||||
}
|
||||
# blockers for a client deliverable → "id<TAB>open|unreadable<TAB>word or
|
||||
# line"; closed ones are omitted. A status no reader maps to exactly one
|
||||
# known word is unreadable, never open (BDR-129, BDR-133): v2 strict word,
|
||||
# v1 the single word of a status/statut label (_mem_v1_word: prose, mixed
|
||||
# or negated lines give none). Entries under a heading the enumerator
|
||||
# cannot see (`### BLK-`) are unreadable too.
|
||||
reconcile_blk_classify() {
|
||||
_reconcile_status() { # <file> <ID> <PREFIX> → 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]"
|
||||
}
|
||||
# entries of one prefix (BLK blockers, BDR decisions) → "id<TAB>open|
|
||||
# unreadable<TAB>word or line"; closed ones are omitted. A status no
|
||||
# reader maps to exactly one known word is unreadable, never open
|
||||
# (BDR-129, BDR-133): v2 strict word, v1 the single word of a
|
||||
# status/statut label (_mem_v1_word: prose, mixed or negated lines give
|
||||
# none). Entries under a heading the enumerator cannot see (`### BLK-`)
|
||||
# are unreadable too.
|
||||
# $1 file, $2 prefix. The status source: _reconcile_status.
|
||||
reconcile_status_classify() {
|
||||
local id st w v2=""
|
||||
memory_is_v2 "$1" && v2=1
|
||||
for id in $(reconcile_enumerate_ids "$1" BLK); do
|
||||
st=$(reconcile_blk_current_status "$1" "$id")
|
||||
for id in $(reconcile_enumerate_ids "$1" "$2"); do
|
||||
st=$(_reconcile_status "$1" "$id" "$2")
|
||||
if [ -n "$v2" ]; then w=$(memory_status_word "$st")
|
||||
else w=$(_mem_v1_word "$st"); fi
|
||||
[ -n "$st" ] || w=""
|
||||
@@ -128,11 +140,12 @@ reconcile_blk_classify() {
|
||||
esac
|
||||
printf '%s\tunreadable\t%s\n' "$id" "${st:0:80}"
|
||||
done
|
||||
MEM_GREP="$RECONCILE_GREP" _mem_heading_ids "$1" BLK | sort -u \
|
||||
| comm -23 - <(reconcile_enumerate_ids "$1" BLK) \
|
||||
MEM_GREP="$RECONCILE_GREP" _mem_heading_ids "$1" "$2" | sort -u \
|
||||
| comm -23 - <(reconcile_enumerate_ids "$1" "$2") \
|
||||
| while read -r id; do printf '%s\tunreadable\theading level\n' "$id"; done
|
||||
return 0
|
||||
}
|
||||
reconcile_blk_classify() { reconcile_status_classify "$1" BLK; }
|
||||
|
||||
# --- pure reconciliation kernel: declared checkbox × real fact → verdict
|
||||
# (no git, fully testable) ---
|
||||
|
||||
@@ -30,8 +30,8 @@ Operates on `.claude/memory/` in the current project (CWD). Curates the
|
||||
|
||||
- **Git is the backup.** Skill writes in-place. PRECHECK refuses to run
|
||||
if working tree dirty on registry files.
|
||||
- **Append-only friendly.** Marks entries `status: superseded by <new-ID>`
|
||||
or `status: deprecated` instead of deleting. Body of old entry stays
|
||||
- **Append-only friendly.** Marks entries with a `superseded by <ID>` or
|
||||
`deprecated` status written by `memory.sh status` instead of deleting. Body of old entry stays
|
||||
for history.
|
||||
- **IDs stable.** Never renumber. Merges create a new ID; sources keep
|
||||
their ID with superseded status.
|
||||
@@ -74,19 +74,47 @@ on a branch; on a working branch it proceeds in place. Never `gitflow finish`.
|
||||
|
||||
For each target registry (filter by `$ARGUMENTS` or all 5):
|
||||
|
||||
Current statuses come from one reader for decisions and blockers, 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: ID<TAB>open<TAB>word | ID<TAB>unreadable<TAB>line;
|
||||
# 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
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
Read file. Classify candidates into A/B/C/D below. Use today's date for
|
||||
age comparisons. Today's date is in the system context.
|
||||
|
||||
### A. Obsolete — mark-superseded candidates
|
||||
- Decisions `status: proposed` older than 90 days → propose
|
||||
`status: deprecated` (no follow-up).
|
||||
- Decisions whose word is `proposed` and whose date is older than 90 days
|
||||
→ propose `memory.sh status <ID> "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).
|
||||
- Decisions whose body names a successor ("superseded by <ID>",
|
||||
"Supersedes [[<ID>]]" on the newer one) but whose current status
|
||||
(`bash "$HOME/.claude/lib/memory.sh" index decision`) still reads
|
||||
"Supersedes [[<ID>]]" on the newer one) but whose word is still
|
||||
`accepted` → propose `memory.sh status <ID> "superseded by <that-ID>"`.
|
||||
- Blockers `status: open` whose root cause matches a commit in last 30
|
||||
days (grep `git log --since=30.days --grep=<keyword>`) → propose
|
||||
`status: resolved` with commit ref.
|
||||
- Blockers whose word is exactly `open` (never upstream, accepted or any
|
||||
other word) whose root cause matches a commit in last 30 days (grep
|
||||
`git log --since=30.days --grep=<keyword>`) → propose
|
||||
`memory.sh status <ID> "resolved <commit>"`.
|
||||
- Journal entries older than 180 days with zero cross-reference from
|
||||
later entries → propose collapse into 1-line month summary
|
||||
(`## YYYY-MM` heading replaces detail).
|
||||
@@ -119,23 +147,36 @@ PRUNE PLAN — decisions.md (N entries → M after if approved)
|
||||
worked example cannot PRIME a real prune. Apply the same shapes to real IDs.)
|
||||
|
||||
[A. Obsolete — mark superseded]
|
||||
BDR-901 — example proposed decision — status: proposed since <90+ days ago>
|
||||
→ mark: status: deprecated (no follow-up after 90 days)
|
||||
BDR-901 — example proposed decision — word proposed, dated <90+ days ago>
|
||||
→ memory.sh status BDR-901 "deprecated, no follow-up after 90 days"
|
||||
BDR-902 — example decision — body says superseded by BDR-903
|
||||
→ memory.sh status BDR-902 "superseded by BDR-903"
|
||||
|
||||
[B. Similar — merge]
|
||||
LRN-901 + LRN-902 — SAME concept (two notes on the identical bug)
|
||||
→ propose: merge into NEW LRN-904 with both bodies appended +
|
||||
caveman pass; sources marked status: superseded by LRN-904
|
||||
→ propose: merge into NEW LRN-904 (learnings carry no status) with
|
||||
both bodies appended + caveman pass; sources:
|
||||
memory.sh status <ID> "superseded by LRN-904"
|
||||
(merge ONLY same-concept entries — complementary/different-angle stays split)
|
||||
|
||||
[C. Bloated — inline caveman rewrite]
|
||||
BDR-902 — body 612 words, filler density 7.2% → ~380 expected (-38%)
|
||||
|
||||
[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 <ID> "<word>"
|
||||
|
||||
Approve per category? (all / a / b / c / edit <ID> / skip)
|
||||
```
|
||||
|
||||
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 <ID>`). 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).
|
||||
|
||||
Wait for user input. Default = nothing applied.
|
||||
|
||||
## STEP 3 — APPLY APPROVED CHANGES
|
||||
@@ -151,13 +192,24 @@ Registry writes follow `lib/capitalize-commit.md` § WRITE (single writer).
|
||||
--body-file <file> --supersedes <first source>` (next-free ID, forward
|
||||
link, the first source marked superseded); each other source:
|
||||
`memory.sh status <ID> "superseded by <new-ID>"`. Source bodies stay
|
||||
verbatim for history. Merged body:
|
||||
verbatim for history. 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
|
||||
`- **<label>**:` line whose label holds status/resolution/action/
|
||||
update/final. Add `--status <word>` (decisions, blockers, evals; the
|
||||
word shown on the [B] line; learnings none). Merged body:
|
||||
- Preserves all `**Reference**:` lines (dedupe identical paths).
|
||||
- Caveman pass on prose during merge.
|
||||
- Keeps frontmatter fields: id (new), date (today), title, status
|
||||
(accepted), references (union).
|
||||
3. **Inline caveman compression** — preserve frontmatter exactly (id,
|
||||
date, title, status, references). Rewrite prose body to fragments:
|
||||
- Drops the sources' labelled status lines (`- **Status…**:`, `Status:`
|
||||
/ `statut` lines, `- **Resolution|Action|Update|Final…**:`). The new
|
||||
entry's status is the `--status` word (v2: heading tag; v1: a
|
||||
`- **Status**:` body line, and a later prose STATUS LINE can make it
|
||||
unreadable: it then shows in the count line).
|
||||
- `memory.sh add` writes the heading (new ID, title, date) and the
|
||||
status; the body keeps the union of `**Reference**:` lines.
|
||||
3. **Inline caveman compression** — keep VERBATIM the heading line, every
|
||||
`- **Label**:` key and every STATUS LINE; rewrite only the other prose
|
||||
to fragments:
|
||||
- **NEGATION GUARD (deterministic, overrides every rule below):** never
|
||||
rewrite a sentence containing a negation token (`not`, `never`, `no`,
|
||||
`cannot`, or any `*n't` contraction). Keep such sentences VERBATIM —
|
||||
@@ -249,7 +301,7 @@ NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
||||
|
||||
- Journal entries < 30 days old.
|
||||
- Decisions / learnings with commit references < 14 days old.
|
||||
- Entries the user marked `status: accepted` in the current session.
|
||||
- Entries whose status the user set this session.
|
||||
- The current session's just-capitalized entries (read `journal.md`
|
||||
tail to identify them).
|
||||
|
||||
@@ -257,8 +309,8 @@ NEXT: review `git diff .claude/memory/`, then `/commit-change`
|
||||
|
||||
| Mistake | Fix |
|
||||
|---------|-----|
|
||||
| Renumbering IDs after a merge | IDs are stable. Sources keep their ID + `status: superseded`. New merged entry gets next-free ID. |
|
||||
| Hard-deleting "obsolete" entries | Forbidden by append-only rule. Use `status: deprecated`. Body stays. |
|
||||
| Renumbering IDs after a merge | IDs are stable. Sources keep their ID + a `superseded by <ID>` status. New merged entry gets next-free ID. |
|
||||
| Hard-deleting "obsolete" entries | Forbidden by append-only rule. Use a `deprecated` status (`memory.sh status`). Body stays. |
|
||||
| Compressing code blocks / URLs / error messages | Caveman compression touches PROSE only. Code, URLs, IDs, error quotes stay verbatim. |
|
||||
| Running on a dirty working tree | PRECHECK blocks this. Commit first. |
|
||||
| Compressing the current session's journal entry | Excluded by "What NOT to prune" — current session capitalization is still useful. |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deterministic RED suite for /prune-memory — RED-1, RED-2, RED-5, RED-6, RED-7.
|
||||
# Deterministic RED suite for /prune-memory — RED-1, RED-2, RED-5, RED-6, RED-7, RED-9.
|
||||
# Each MUST be red on the current (v1) skill. Pure mechanical oracles,
|
||||
# no LLM. Faithful: RED-2/RED-6 execute the REAL bash blocks extracted
|
||||
# no LLM. Faithful: RED-2/RED-6/RED-9 execute the REAL bash blocks extracted
|
||||
# from SKILL.md (no copy that could drift).
|
||||
#
|
||||
# Sandbox only (mktemp). NEVER touches real registries or the repo.
|
||||
@@ -21,7 +21,7 @@ green() { printf 'RED-%s: GREEN (skill fixed) -- %s\n' "$1" "$2"; }
|
||||
# Verified by the extract-check before the suite was written.
|
||||
extract_block() {
|
||||
awk -v h="$1" '
|
||||
$0 ~ "^## " h {f=1}
|
||||
$0 ~ "^## " h "( |$)" {f=1}
|
||||
f && /^```bash/ {c=1; next}
|
||||
f && /^```/ && c {c=0; f=0; next}
|
||||
c {print}
|
||||
@@ -102,6 +102,48 @@ else
|
||||
green 7 "STEP 2 example uses only fictional (9xx) ids"
|
||||
fi
|
||||
|
||||
# ---- RED-9: STEP 1 reads statuses through the classifier (v1 + v2) ---------
|
||||
# Runs the shipped STEP 1 block (LRN-276) on sandbox registries written with
|
||||
# printf; HOME pinned like RED-6. Rows asserted whole-line, fixed string.
|
||||
TAB=$'\t'
|
||||
S9A="$SANDBOX/red9a"; S9B="$SANDBOX/red9b"
|
||||
mkdir -p "$S9A/.claude/memory" "$S9B/.claude/memory"
|
||||
printf -- '---\nformat: 2\n---\n# Decisions\n\n' > "$S9A/.claude/memory/decisions.md"
|
||||
printf '## BDR-901 — old idea [proposed] (2026-01-01)\n- **Context**: resolved later\n\n' \
|
||||
>> "$S9A/.claude/memory/decisions.md"
|
||||
printf '## BDR-902 — kept [accepted] (2026-02-01)\n- **Status (2026-03-01)**: superseded by BDR-903\n' \
|
||||
>> "$S9A/.claude/memory/decisions.md"
|
||||
printf '## BLK-903 — c\n- **Status**: upstream\n' > "$S9A/.claude/memory/blockers.md"
|
||||
printf '## BDR-904 — x\ndate: 2026-01-01 · status: accepted\n\n' > "$S9B/.claude/memory/decisions.md"
|
||||
printf '## BDR-905 — y\nStatus: closed.\n\n' >> "$S9B/.claude/memory/decisions.md"
|
||||
printf '## BDR-906 — z\nStatus: proposed\n- **Statut** : accepted (2026-05-01)\n\n' \
|
||||
>> "$S9B/.claude/memory/decisions.md"
|
||||
printf '## BDR-907 — w\n- Status: proposed\nSuperseded by BDR-911 (2026-05-01).\n' \
|
||||
>> "$S9B/.claude/memory/decisions.md"
|
||||
extract_block "STEP 1" > "$SANDBOX/step1.sh"
|
||||
mkdir -p "$SANDBOX/home9/.claude"; ln -s "$HERE/../../../lib" "$SANDBOX/home9/.claude/lib"
|
||||
out9a="$( cd "$S9A" && HOME="$SANDBOX/home9" bash "$SANDBOX/step1.sh" 2>&1 )"
|
||||
out9b="$( cd "$S9B" && HOME="$SANDBOX/home9" bash "$SANDBOX/step1.sh" 2>&1 )"
|
||||
msg9=""
|
||||
has9() { printf '%s\n' "$1" | /usr/bin/grep -qxF "$2"; }
|
||||
has9 "$out9a" "BDR-901${TAB}open${TAB}proposed" || msg9="v2 BDR-901 row missing"
|
||||
printf '%s\n' "$out9a" | /usr/bin/grep -qF "BDR-902${TAB}" \
|
||||
&& msg9="${msg9:-v2 BDR-902 listed after superseded}"
|
||||
has9 "$out9a" "BLK-903${TAB}open${TAB}upstream" || msg9="${msg9:-BLK-903 row missing}"
|
||||
has9 "$out9b" "BDR-904${TAB}open${TAB}accepted" || msg9="${msg9:-v1 BDR-904 row missing}"
|
||||
printf '%s\n' "$out9b" | /usr/bin/grep -qF "BDR-905${TAB}unreadable${TAB}" \
|
||||
|| msg9="${msg9:-v1 BDR-905 not unreadable}"
|
||||
has9 "$out9b" "BDR-906${TAB}open${TAB}accepted" || msg9="${msg9:-v1 BDR-906 row missing}"
|
||||
printf '%s\n' "$out9b" | /usr/bin/grep -qF "BDR-907${TAB}open${TAB}" \
|
||||
&& msg9="${msg9:-v1 BDR-907 listed open}"
|
||||
[ "$(/usr/bin/grep -c 'status: ' "$SKILL")" = 0 ] || msg9="${msg9:-SKILL.md keeps a raw status: line}"
|
||||
[ "$(/usr/bin/grep -c 'frontmatter' "$SKILL")" = 0 ] || msg9="${msg9:-SKILL.md keeps frontmatter wording}"
|
||||
if [ -z "$msg9" ]; then
|
||||
green 9 "STEP 1 block classifies v1 + v2 statuses, SKILL.md has no raw status wording"
|
||||
else
|
||||
red 9 "$msg9"
|
||||
fi
|
||||
|
||||
echo "----"
|
||||
if [ "$fail" -eq 0 ]; then
|
||||
echo "SUITE: all GREEN"
|
||||
|
||||
Reference in new issue
Block a user