[STUDY] Memory extraction — learn from Claude Code's auto-memory system #156

Open
opened 2026-03-31 16:30:08 +00:00 by ezra · 0 comments
Member

Parent Epic: #154

Maps to: #89 (self-improvement loop), #90 (few-shot curation)

Source Files

  • src/services/extractMemories/extractMemories.ts (21,650 bytes)
  • src/services/extractMemories/prompts.ts — the extraction prompts
  • src/memdir/memdir.ts — memory directory structure
  • src/memdir/findRelevantMemories.ts — relevance scoring
  • src/memdir/memoryScan.ts — scanning memory files
  • src/memdir/memoryAge.ts — memory aging/decay
  • src/memdir/memoryTypes.ts — typed memory categories

Key Patterns to Study

  1. End-of-loop extraction — runs after every complete query (final response with no tool calls). Uses a forked agent sharing the prompt cache.
  2. Memory directory structure — not flat files. Organized by project, with types, aging, and relevance scoring.
  3. Memory types — categorized memories (facts, preferences, corrections, etc.)
  4. Relevance scoringfindRelevantMemories.ts scores memories against the current context to decide what to inject.
  5. Memory agingmemoryAge.ts manages decay so old memories don't crowd out new ones.

What to Document

  • What prompt do they use to extract memories?
  • How do they categorize memories into types?
  • How does relevance scoring work?
  • How does aging/decay work?
  • How do they avoid extracting noise vs signal?

Acceptance Criteria

## Parent Epic: #154 ## Maps to: #89 (self-improvement loop), #90 (few-shot curation) ### Source Files - `src/services/extractMemories/extractMemories.ts` (21,650 bytes) - `src/services/extractMemories/prompts.ts` — the extraction prompts - `src/memdir/memdir.ts` — memory directory structure - `src/memdir/findRelevantMemories.ts` — relevance scoring - `src/memdir/memoryScan.ts` — scanning memory files - `src/memdir/memoryAge.ts` — memory aging/decay - `src/memdir/memoryTypes.ts` — typed memory categories ### Key Patterns to Study 1. **End-of-loop extraction** — runs after every complete query (final response with no tool calls). Uses a forked agent sharing the prompt cache. 2. **Memory directory structure** — not flat files. Organized by project, with types, aging, and relevance scoring. 3. **Memory types** — categorized memories (facts, preferences, corrections, etc.) 4. **Relevance scoring** — `findRelevantMemories.ts` scores memories against the current context to decide what to inject. 5. **Memory aging** — `memoryAge.ts` manages decay so old memories don't crowd out new ones. ### What to Document - What prompt do they use to extract memories? - How do they categorize memories into types? - How does relevance scoring work? - How does aging/decay work? - How do they avoid extracting noise vs signal? ### Acceptance Criteria - [ ] Read all 7 memdir files + 2 extractMemories files - [ ] Document the extraction prompt and pipeline - [ ] Document the memory type system - [ ] Document relevance scoring algorithm - [ ] Write a 1-page design doc adapting this for Hermes - [ ] Post findings as comments on #89 and #90
Timmy was assigned by ezra 2026-03-31 16:30:08 +00:00
Timmy added this to the Claude Code Study milestone 2026-03-31 16:58:31 +00:00
Timmy added the study label 2026-03-31 16:58:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/timmy-home#156