Skip to content

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

Description

@umair-a11y

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.tsLEARNING/FAILURES/<YYYY-MM>/<slug>/CONTEXT.md (plus siblings), and LEARNING/SIGNALS/ratings.jsonl
  • LIFEOS/TOOLS/SessionHarvester.tsLEARNING/{ALGORITHM,SYSTEM}/<YYYY-MM>/
  • LIFEOS/TOOLS/LearningPatternSynthesis.tsLEARNING/SYNTHESIS/
  • LIFEOS/TOOLS/Reflect.tsLEARNING/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 MemoryRetriever.ts indexes only top-level KNOWLEDGE files — subdirectories invisible #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions