Memory System

Long-term memory for agents to remember and recall information across conversations.

Configuration

Memory is enabled via environment variables:

# Required: Your memory user ID (UUID)
export MEMORY_USER_ID="3bfa14ac-b514-475c-a142-4442a90c05a5"

# Optional: Context identifier (defaults to cli:<run-id>)
export MEMORY_CONTEXT="cli:my-session"

To find your user ID:

sqlite3 ~/.local/share/omni/memory.db "SELECT DISTINCT user_id FROM memories"

Overview

The memory system has two modes:

  1. Passive - Relevant memories auto-injected into context based on conversation
  2. Active - Explicit remember and recall tools for precise control

Active Memory (Tools)

remember

Store information for future reference:

{
  "content": "User prefers dark mode and uses vim keybindings",
  "context": "mentioned during IDE setup discussion",
  "tags": ["preferences", "editor"]
}

When to use:

Best practices:

recall

Search memory for relevant information:

{
  "query": "editor preferences",
  "limit": 5
}

When to use:

Best practices:

Passive Memory (Auto-injection)

When enabled, the system automatically:

  1. Knowledge injection - Recalls semantically similar memories based on current conversation
  2. Temporal context - Includes recent conversation history
  3. Contradiction detection - Warns if recalled memories conflict

You don’t need to call recall for basic context - it’s already in your system prompt under <knowledge> or <conversation_history>.

Memory Identity

Memory is scoped by identity:

Examples:

Deduplication

The system automatically:

Tags

Common tag categories:

Examples

Storing preferences

User: "I prefer functional programming and use Haskell at work"

remember({
  content: "User prefers functional programming, uses Haskell professionally",
  context: "shared during programming discussion",
  tags: ["preferences", "technical", "languages"]
})

Storing corrections

User: "Actually I switched from VS Code to Neovim"

remember({
  content: "User uses Neovim (switched from VS Code)",
  context: "correction to previous editor preference",
  tags: ["preferences", "editor", "correction"]
})

Recalling before answering

User: "What editor config should I use?"

// Before answering, check memory
recall({ query: "editor preferences IDE", limit: 3 })

// Then personalize response based on what you find

When NOT to Remember

Don’t store:

Troubleshooting

Conflicting memories?

Missing context?

Too much context?