Skip to content

Memory

Cross-session persistence with 4 memory types and automatic extraction.

Memory

Brainstorm maintains persistent memory across sessions so context is never lost. The memory system has four types, an auto-extraction middleware, and a consolidation mechanism for keeping memory clean and relevant.

Memory Types

Core Facts

High-confidence facts about your project and preferences that rarely change. These form the foundation of Brainstorm's understanding.

Examples:

  • "This project uses Drizzle ORM with PostgreSQL"
  • "The user prefers functional components over class components"
  • "All API endpoints require tenant-scoped queries"

Core facts are surfaced in every session's system prompt.

Working Memory

Short-lived context relevant to the current task or recent sessions. Working memory decays over time -- items not referenced in recent sessions are eventually archived or removed.

Examples:

  • "Currently refactoring the auth module to use JWT"
  • "The staging deployment is broken due to a migration issue"

Archival Memory

Long-term storage for decisions, lessons learned, and historical context. Lower priority in prompt construction but searchable when relevant.

Examples:

  • "Migrated from REST to GraphQL in March 2026"
  • "Performance issue with N+1 queries was fixed by adding DataLoader"

Episodic Memory

Records of specific interactions and their outcomes. Used by the learned routing strategy to improve model selection over time.

Auto-Extraction Middleware

Brainstorm's middleware pipeline automatically extracts memory-worthy information from conversations. The extraction middleware analyzes each exchange and identifies:

  • New facts about the project or user preferences
  • Decisions made and their rationale
  • Patterns in how the user works
  • Corrections to previously held beliefs

Extracted memories are tagged with confidence scores and source sessions. Low-confidence extractions are held in a staging area until confirmed by repetition.

The /dream Command

The /dream command triggers memory consolidation:

``

/dream

`

During consolidation, Brainstorm:

1. Reviews all recent memories across types

2. Merges duplicates and resolves contradictions

3. Promotes high-confidence working memories to core facts

4. Archives stale working memories

5. Compresses verbose memories into concise summaries

6. Removes memories that are no longer relevant

Run /dream periodically (or let it run automatically between sessions) to keep memory lean and accurate.

Memory Search

Search across all memory types:

`

/memory search "database migration patterns"

`

Results are ranked by relevance and recency, with memory type and confidence score shown for each result.

Manual Memory Management

Save important context explicitly:

`

/memory save "The CI pipeline requires Node 22 -- do not use Node 20"

`

View current memory state:

`

/memory list # all memories

/memory list --type core # only core facts

/memory list --recent # recently added

`

Remove outdated memories:

`

/memory remove

`

Storage

Memories are stored in the local SQLite database at ~/.brainstorm/brainstorm.db`. The database uses WAL mode for concurrent read performance. Memory data never leaves your machine unless you explicitly configure BrainstormRouter's cloud memory sync.