Skip to main content
Five layers give agents persistent, self-improving memory across sessions.

Memory Layers

The structured memory store uses OpenAI text-embedding-3-small (1536 dimensions) for vector search. Two important behaviors:
  • Non-OpenAI providers degrade to keyword-only. If no OpenAI key is configured the embedding provider defaults to "none" and the store falls back to FTS5 keyword search.
  • Auto-disable on consecutive failures. After 3 consecutive embedding failures the store silently disables vectors for the process lifetime (keyword search continues). Restart to retry.

Write-Then-Compact Pattern

Before the context manager discards messages, it:
  1. Asks the LLM to extract important facts from the conversation
  2. Stores facts in both MEMORY.md and the structured memory DB
  3. Summarizes the conversation
  4. Replaces message history with: summary + last 4 messages
Nothing is permanently lost during compaction.

Cross-Session Memory

Facts saved with memory_save are stored in both the workspace (daily log) and the structured SQLite database. After a reset or restart, memory_search retrieves them via hybrid search:

Memory Tools

Workspace Files

Each agent has a persistent workspace at /data/workspace/. The scaffold set (_SCAFFOLD_FILES) is six files: SOUL, INSTRUCTIONS, USER, MEMORY, INTERFACE, HEARTBEAT. AGENTS.md is symlinked from the engine root. Direct writes to SOUL / INSTRUCTIONS / USER / MEMORY / INTERFACE / HEARTBEAT / AGENTS are blocked — agents must go through the update_workspace tool, which enforces caps and emits HTTP 413 when exceeded. Workspace bootstrap injection is capped at 48K total chars across all files.