Overview
Thememory context command retrieves a summary of available memories formatted for injection into agent prompts. This is typically used by hooks and integrations to provide agents with relevant context at session start.
Syntax
Options
Filter to current project only (uses current directory name).
Filter by source (e.g.,
cursor, claude, codex).Maximum number of memory pointers to return.
Semantic search query for filtering memories by relevance.
Force semantic search (requires embeddings). Overrides config.
Disable embeddings and use FTS-only search.
Show effective configuration and exit (doesn’t retrieve memories).
Output format:
hook (default) or agents-md.Examples
Get context for current project
Get all memories (no filter)
Query-based context
Force semantic search
Use keyword-only search
Agents markdown format
Show configuration
Output Format
Default (hook format)
Optimized for agent prompt injection:- Date formatted as “Mon DD” (e.g., “Mar 03”)
- Title with category and tags in brackets
- Footer with search instruction
Agents markdown format
Similar to hook format but wrapped in a markdown section:- Starts with
## Memory Contextheader - Same list format
- Ends with blank line
How Context Retrieval Works
Retrieval Strategy
Thecontext command follows your config.yaml settings:
- semantic: auto: Use vectors if available, fall back to keywords
- semantic: always: Require embeddings (error if not configured)
- semantic: never: Always use FTS5 keyword search
- topup_recent: true: Include recent memories even if not highest-ranked
With --query
When you provide a query:
- Searches memories using hybrid FTS5 + semantic
- Ranks by relevance to the query
- Returns top N based on
--limit
Without --query
When no query is provided:
- Returns recent memories (ordered by creation date)
- Optionally filtered by project/source
Integration Use Cases
In agent hooks
Typically used in.cursor/hooks.json, .claude/settings.json, or similar:
In shell scripts
Capture context for custom workflows:With MCP servers
The EchoVault MCP server uses this internally:Filtering Logic
By project
project matches the current directory name.
By source
Combined
Related Commands
memory search- Search for specific memoriesmemory save- Add memories to context poolmemory config- View context retrieval settings
The
--semantic and --fts-only flags override your config.yaml settings for testing. Most integrations should rely on the config file.