← Back to Capabilities
💭

autoDream — Memory Consolidation

AI that dreams — reorganizing memory while you sleep
P0Core Pattern
Summary
Runs as a forked subagent during idle time. Merges disparate observations, removes logical contradictions, converts vague insights into absolute facts. Gets read-only bash access. Critical design: runs in isolation so it cannot corrupt the main agent's active reasoning state.
Architecture Diagram
Three-Layer Memory ArchitectureLAYER 1MEMORY.md Index~150 chars per pointerAlways loaded into contextCHEAPLAYER 2Topic FilesFetched on demand, never all at onceWrite to topic first, then update indexMEDLAYER 3Session TranscriptsSearched selectively, never fully loadedHeaviest data — archive tierHEAVYMemory is a HINT, not truth — always verify against actual codebase
Technical Details
Three-layer memory architecture: • Layer 1: MEMORY.md index (~150 chars/pointer) — always loaded • Layer 2: Topic files — fetched on demand, never all at once • Layer 3: Session transcripts — searched selectively, never loaded Key principle: memory is treated as a HINT, not truth. Agent verifies against actual codebase before acting. Write discipline: write to topic file first, then update index. If fact can be re-derived from codebase, don't store it.
Implementation Pattern
TypeScript (conceptual)
// Three-layer memory architecture (conceptual)
// Layer 1: MEMORY.md index — always loaded (~150 chars per entry)
// Layer 2: Topic files — fetched on demand
// Layer 3: Session transcripts — searched, never fully loaded

interface MemoryIndex {
  entries: { title: string; file: string; hook: string }[];
  maxLineLength: 150;
}

async function consolidateMemory(topics: TopicFile[]) {
  // autoDream runs as forked subagent with read-only bash
  const merged = mergeObservations(topics);
  const cleaned = removeContradictions(merged);
  const facts = convertToAbsoluteFacts(cleaned);
  // Write to topic file first, then update index
  await writeTopicFile(facts);
  await updateMemoryIndex(facts);
}
Architecture Insight
The key insight is treating context window as a scarce resource with tiered storage: cheap index always loaded, expensive details fetched on demand, heaviest data only searched. This mirrors how databases use indexes.
Official / Public Basis
Three-layer memory architecture confirmed by official Claude Code documentation (docs.anthropic.com/en/docs/claude-code/memory). autoDream consolidation mechanism found in source.
Governance Concerns
Memory consolidation must run in isolation (read-only access) to prevent corruption of active state. Memory is a hint, not truth — agents must verify against actual codebase before acting on remembered facts.
LightHope Ecosystem Mapping
LightHope MemoryOS — student learning record integration, project decision history, organization rule optimization, auto-summary consolidation