From 4881fe8cbafa985620b1f58377a9881aa9913407 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sat, 24 Oct 2026 03:58:07 +0200 Subject: [PATCH] chore(memory): phase 4 action-triggered recall, generated index --- .claude/tasks/TODO.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index e041a3b..bc22231 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -49,6 +49,10 @@ Shared rules for every phase: - [ ] **Phase 4, active memory** - Session digest via `prompt.context` block (re-read on compaction/clear by the engine): open BLK (body status, last block wins, as lib/reconcile.sh reads it), actionable TODO items (Open § Actionable), last journal heading + line; only when `.claude/memory/` exists. - Per-prompt retrieval: local score of registry headings (`## BDR|LRN|BLK|EVAL-` lines) against the typed prompt, top 3-5 `ID — title` lines as `prompt.submit` `context` above a threshold; no model call. Optional `memory_search` tool (`$.tool.register`, `isDeferred: false`) for skills (analyze-before-plan pass 1 calls it instead of grep). + - Facts 2026-10-24: registries never in always-on context (~1M chars: decisions 319k, learnings 357k, journal 168k, evals 85k, blockers 68k); Index tables drift (decisions 121/125 rows, evals 46/48); only /feat /bugfix /ship-feature read them (analyze-before-plan, at plan time, by heading); nothing fires on an action. "Session start: read .claude/memory/" is unrealistic as written. + - Action-triggered recall (user ask 2026-10-24: "pioché quand on fait l'action"): (a) error match: a tool result containing an error string quoted verbatim in a BLK/LRN body → inject that entry as result `context` (deterministic, entries already quote errors exact); (b) optional `- **Trigger**: ` line per BLK/LRN, checked at `tool.call` / `skill.prompt` → inject the entry; entries marked `critical` → deny the action once with the lesson as reason, then allow the retry. + - Generated index: rebuild each registry `## Index` from the `## ID —` headings (mod or script in make test), so it can never drift; readers keep reading headings. + - Selection quality: score = heading words + Trigger lines + quoted errors; precision measured on 10 real prompts and 10 real errors from journal history before shipping; threshold so nothing fires on chat/bookkeeping (LRN-091). - Capitalization proposals on observed milestones only: a `feat`/`fix` commit or a `gitflow finish` seen in `tool.call` → one context note at the next prompt (never per turn, never at Stop). - Proof: digest canary after start, after compaction, after /clear; retrieval precision on 10 real prompts from journal history; zero note on turns without milestone. - Cleanup: CLAUDE.global.md "Session start" step 1 (read registries) → mod; "Proactive capitalization" paragraph KEPT (design choices, surprising discoveries, dead ends leave no commit: only the model sees them; the mod adds the commit/merge triggers, never replaces the judgment ones; writing always stays model draft + user approval, format checked by the phase 2 guard); analyze-before-plan pass 1 points at the tool; fix the reconcile engine gap seen 2026-10-23 (`reconcile_blk_open` ignores header `[resolved]`) since the digest reuses it.