Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

MEMORY/LEARNING/ is write-only: neither MemoryRetriever nor ContextSearch indexes it, so failure captures and harvested learnings are unrecallable

Open umair-a11y opened this issue 4 months ago • 2 comments

Summary

MEMORY/LEARNING/ is a write-only corpus. Several shipped tools write into it on a regular cadence, but neither retrieval path — MemoryRetriever.ts (BM25) nor ContextSearch.ts — includes it in the set of things it indexes. Anything the system learns and files under LEARNING/ cannot be recalled by any built-in search; the only way to get it back is rg by hand.

What writes to MEMORY/LEARNING/

  • LIFEOS/TOOLS/FailureCapture.ts — LEARNING/FAILURES/<YYYY-MM>/<slug>/CONTEXT.md (plus siblings), and LEARNING/SIGNALS/ratings.jsonl
  • LIFEOS/TOOLS/SessionHarvester.ts — LEARNING/{ALGORITHM,SYSTEM}/<YYYY-MM>/
  • LIFEOS/TOOLS/LearningPatternSynthesis.ts — LEARNING/SYNTHESIS/
  • LIFEOS/TOOLS/Reflect.ts — LEARNING/REFLECTIONS/algorithm-reflections.jsonl
  • LIFEOS/TOOLS/RecurrenceLedger.ts — reads LEARNING/FAILURES, writes LEARNING/PATCHES

MemorySystem.md also routes content here on purpose: "Task logs, algorithm reflections, ISA checklists → WORK/ and LEARNING/, not KNOWLEDGE/". So this is the documented destination for a whole class of content, not an accident.

What indexes it

Nothing.

LIFEOS/TOOLS/MemoryRetriever.ts scores MEMORY/KNOWLEDGE/{People,Companies,Ideas,Research}/*.md (KNOWLEDGE_DIR + a fixed DOMAINS array), and getRelevantContext additionally folds in the two hot-layer files (USER/PRINCIPAL/PRINCIPAL_MEMORY.md, USER/DIGITAL_ASSISTANT/DA_MEMORY.md) as virtual notes. LEARNING/ is not in the corpus, and the CLI path errors out on KNOWLEDGE_DIR alone.

skills/ContextSearch/Tools/ContextSearch.ts searches five sources — MEMORY/STATE/work.json, MEMORY/STATE/session-names.json, MEMORY/WORK/ directory names, MEMORY/WORK/*/ISA.md bodies, and ~/.claude/projects/*.jsonl transcripts. The only MEMORY/ subtrees it touches are STATE/ and WORK/.

So a failure capture written on Monday is unreachable by memory search and unreachable by ContextSearch on Tuesday, even though the system wrote it specifically so the lesson would persist.

Why it matters

The failure-capture → synthesis → recurrence-ledger loop is one of the better ideas in the system, and its whole premise is that past failures inform future behavior. That only works if something can read the corpus back. Right now the synthesis tools read specific known files by path; there is no general retrieval over what has accumulated. The larger LEARNING/ grows, the more value is stranded.

This is the same shape as #1255 (MemoryRetriever indexing only top-level KNOWLEDGE files, subdirectories invisible) — a corpus that exists on disk but is outside the retriever's declared roots. That one was fixed by widening the walk.

Suggested direction

Not prescriptive about the design, but the cheap version looks like:

  1. Add MEMORY/LEARNING/ to MemoryRetriever.ts's corpus discovery as its own note class, so it participates in the existing BM25 scoring. The dated-subdirectory layout means the walk needs to be recursive (same fix shape as #1255).
  2. Give results a class/source tag so LEARNING/ hits are visibly historical rather than current-state facts, and can be weighted below KNOWLEDGE/ notes if that is the desired ranking.
  3. Optionally add LEARNING/ as a sixth Source in ContextSearch.ts, which already has the ripgrep plumbing for body search (isa-body).

Files are markdown with pai-freshness-v1 frontmatter already, so there is no format work — it is a roots-and-ranking change.

Happy to send a PR if the maintainers agree on the direction.

Environment

LifeOS 7.28.3, Windows 11 + Bun. Verified by reading the two source files on this install; nothing here is Windows-specific.

umair-a11y avatar Aug 05 '26 00:08 umair-a11y

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed on my install. Added LEARNING/ to MemoryRetriever.ts's corpus discovery as its own note class, using the existing recursive walker (it already handled dated subdirectories and skipped non-.md files for free). Wired into both the per-turn injection path and the CLI. Left the ContextSearch.ts sixth-source addition undone since you flagged that one as optional and the core complaint is resolved by this half alone. Verified live: real LEARNING/ hits now rank alongside KNOWLEDGE notes in search results.

waveman2020-sudo avatar Aug 05 '26 12:08 waveman2020-sudo

Fixed in source. MemoryRetriever now walks MEMORY/LEARNING/** recursively as its own note class, tagged in results and weighted below KNOWLEDGE so historical captures don't outrank current-state facts (CLI searches the full corpus; the per-turn hot path takes a bounded newest slice for latency). Same fix shape as #1255, as you predicted. Rides the next release. Thanks for the precise corpus/reader analysis — the write-only framing is exactly what it was.

danielmiessler avatar Aug 07 '26 09:08 danielmiessler