cortex memory
Search and manage the 5-tier memory system. CortexPrism uses a hybrid retrieval approach combining FTS5 keyword search with cosine vector similarity, scored with exponential decay.
Usage
cortex memory search "<query>" # Search all memory types (hybrid return)
cortex memory search "<query>" --type semantic # Semantic-only search
cortex memory search "<query>" --type episodic # Episodic-only search
cortex memory add "<fact>" # Add a semantic fact
cortex memory add "<fact>" --category project --importance 0.9 # Categorized memory
Subcommands
| Subcommand | Description |
|---|
search | Search memory with hybrid retrieval |
add | Add a new semantic memory entry |
health | Show memory system health metrics |
heuristics | Display memory decay and scoring heuristics |
Options
| Option | Description |
|---|
--type | Filter results by memory type: episodic, semantic, reflection, graph, or all (default: all) |
--limit, -n | Maximum results to return (default: 8) |
--category | Category filter for add subcommand |
--importance | Importance value for add subcommand (0.0–1.0, default: 0.5) |
--help | Show help for this command |
Memory Tiers
| Tier | Persistence | Content |
|---|
| Episodic | Session | Turn summaries of user+agent exchanges with auto-decay |
| Semantic | Long-term | Injected facts and knowledge with hybrid FTS5 + vector retrieval |
| Reflection | Permanent | LLM-extracted behavior patterns from per-turn meta-cognition |
| Graph | Long-term | Knowledge graph of entities and relationships |
| Skills | Permanent | Procedural knowledge extracted from multi-step tool usage |
Retrieval Algorithm
Query
→ FTS5 keyword search (episodic + semantic tables)
→ cosine vector similarity (via embedding provider)
→ merge + re-score: score × 2^(-age_days / half_life_days)
→ sort descending → top-K results
Embedding Providers
| Provider | Model | Requirement |
|---|
| OllamaEmbedder | Configurable via Ollama | Ollama running locally |
| OpenAIEmbedder | text-embedding-3-small | OpenAI API key required |
| StubEmbedder | Deterministic hash | No external service needed (default) |
Examples
# Hybrid search (all memory types)
cortex memory search "project deployment config"
# Semantic-only search
cortex memory search "deployment config" --type semantic
# Episodic-only search
cortex memory search "deployment" --type episodic
# Add a fact to semantic memory
cortex memory add "CortexPrism uses SQLite WAL mode for all databases"
# Add a categorized fact with high importance
cortex memory add "critical bug" --category bugs --importance 0.9