Overview
Search your persistent memory using natural language or keywords. Powered by SQLite FTS5 full-text search with BM25 ranking, this tool finds past decisions, bugs fixed, patterns used, files changed, and any context from previous coding sessions.This is a core tool in the agent profile, always loaded in the MCP context.
Parameters
Search query — natural language or keywordsExamples:
"JWT authentication""N+1 query fix""FTS5 sanitization""authentication middleware decision"
- Each term is wrapped in quotes to handle special characters
- Boolean operators are preserved (AND, OR, NOT)
- Safe to include user input directly
Filter results by observation typeRecognized types:
tool_use— automatic captures from agent tool callsfile_change— file modificationscommand— shell commands executedfile_read— files read during sessionssearch— search operations performedmanual— manually saved observationsdecision— architectural or technical decisionsarchitecture— system design, patternsbugfix— bug fixespattern— conventions, guidelines
Filter results by project nameOnly returns observations associated with the specified project.Example:
Filter observations by visibility scopeOptions:
project(default) — project-scoped observationspersonal— cross-project personal knowledge
Maximum number of results to returnDefault:
10Maximum: 20Results are ranked by FTS5 BM25 relevance score.Response
Array of search results, ranked by relevance
- ID — observation identifier for
mem_get_observationormem_timeline - Type — observation category
- Title — short summary
- Content — truncated preview (up to 300 characters)
- Project — associated project (if any)
- Scope —
projectorpersonal - Created timestamp — when it was saved
Usage Examples
Basic Search
Search by Type
Project-Specific Search
Personal Knowledge
Multi-Word Query
FTS5 Search Behavior
Tokenization
FTS5 tokenizes both the query and stored content:- Case-insensitive — “JWT” matches “jwt” and “Jwt”
- Stem matching — “running” matches “run”, “runs”, “ran”
- Special characters — automatically quoted to prevent syntax errors
Ranking (BM25)
Results are ranked by BM25 relevance:- Term frequency — how often the query terms appear
- Document length — shorter documents rank higher for the same term frequency
- Inverse document frequency — rare terms boost ranking more than common terms
Boolean Operators
FTS5 supports boolean search (advanced):When to Use
- Context recovery — recall what was done in previous sessions
- Decision lookup — find why an architectural choice was made
- Bug reference — remember how a similar bug was fixed
- Pattern discovery — find established conventions
- File changes — locate where specific changes were made
Progressive Disclosure Pattern
mem_search returns truncated content to save tokens. For full details:
Get full content (if needed)
mem_get_observation to retrieve untruncated content.View timeline (optional)
mem_timeline to see chronological context.Search Performance
- FTS5 index — full-text search index on
titleandcontentcolumns - Sub-millisecond queries — typical search completes in less than 5ms
- No external dependencies — pure SQLite, no vector database
Empty Results
Ifmem_search returns no results:
- Broaden the query — try fewer or more general terms
- Check the project filter — remove
projectfilter to search all projects - Check the type filter — remove
typefilter to search all categories - Verify scope — try
scope: "personal"if searching for cross-project knowledge
Related Tools
mem_get_observation- Get full content by IDmem_timeline- View chronological context around a resultmem_context- Get recent memory context (not search-based)mem_save- Save new observations