Expand description
Memory system — 3-layer architecture.
Layer 1 — Index (always loaded): MEMORY.md contains one-line pointers to topic files. Capped at 200 lines / 25KB. Always in the system prompt.
Layer 2 — Topic files (on-demand): Individual .md files with YAML frontmatter. Loaded selectively based on relevance to the current conversation.
Layer 3 — Transcripts (never loaded, only grepped): Past session logs. Not loaded into context.
§Write discipline
- Write the memory file with frontmatter
- Update MEMORY.md index with a one-line pointer
Never dump content into the index.
Modules§
- consolidation
- Memory consolidation (“dreaming”).
- extraction
- Background memory extraction after each turn.
- scanner
- Memory file scanner and relevance-based selection.
- session_
notes - Per-session working notes.
- types
- Memory type system and frontmatter schema.
- writer
- Memory write discipline.
Structs§
- Memory
Context - Persistent context loaded at session start.
- Memory
File - A single memory file with metadata.
Functions§
- ensure_
memory_ dir - Returns the user-level memory directory, creating it if needed.
- project_
memory_ dir - Returns the project-level memory directory (
.agent/in the project root).