Skip to main content

Memory System

The Memory system provides persistent storage for facts, decisions, and conversation context. Multiple backends (Markdown, SQLite, vector databases) can be used interchangeably through a uniform trait interface.

Architecture Overview

Memory Trait

All backends implement the Memory trait from src/memory/traits.rs:

Memory Categories

Memory Entry

Markdown Memory Implementation

Real implementation from src/memory/markdown.rs:

File Layout

MEMORY.md:
memory/2026-03-03.md:

SQLite Memory with Embeddings

The SQLite backend supports vector similarity search:

Session Management

Memories can be scoped to conversation sessions:

Memory Configuration

Memory Lifecycle

Best Practices

Storage Strategy

  • Core: Long-term facts, user preferences, important decisions
  • Daily: Session logs, temporary context, work-in-progress
  • Conversation: Short-term context, current thread state

Recall Optimization

  • Use embeddings for semantic search
  • Limit results to relevant subset (5-10 entries)
  • Scope to session when appropriate
  • Prefer specific queries over broad searches

Maintenance

  • Periodically review and prune daily logs
  • Migrate important daily entries to core
  • Reindex embeddings after model changes
  • Back up memory database regularly

Next Steps

  • Security - Security architecture and policy enforcement