The 3-layer workflow
Search — get a compact index
Start with Review the index and identify which observation IDs look relevant before fetching anything further.
search to get a lightweight table of IDs, titles, dates, and types. Each result costs roughly 50–100 tokens.Timeline — get chronological context
Use Or let it find the anchor automatically from a query:
timeline to understand the narrative arc around interesting results — what was happening before and after a specific observation.Why this works
Traditional approach
Fetching 20 observations upfront: 10,000–20,000 tokens, with roughly 10% actually useful.
3-layer approach
Search index + timeline + 3 full observations: ~3,000 tokens, 100% relevant.
Tool reference
__IMPORTANT — workflow documentation
An always-visible reminder of the 3-layer workflow pattern injected into the MCP context. It helps Claude understand how to use the search tools efficiently. You do not need to invoke it directly.
search — search memory index
Search your memory and get a compact index with IDs.
Parameters
Full-text search query. Supports AND, OR, NOT, phrase searches, and column-specific filters. See FTS5 query syntax below.
Maximum number of results to return.
Skip the first N results for pagination.
Filter by observation type:
bugfix, feature, decision, discovery, refactor, or change.Filter by record type:
observation, session, or prompt.Filter results to a specific project name.
Include only results on or after this date (
YYYY-MM-DD).Include only results on or before this date (
YYYY-MM-DD).Sort order:
date_desc, date_asc, or relevance.timeline — get chronological context
Get a chronological view of observations around a specific point or query. Returns depth_before + 1 + depth_after items interleaved in chronological order.
Parameters
Observation ID to center the timeline around. Required if
query is not provided.Search query to find the anchor automatically. Required if
anchor is not provided.Number of observations to include before the anchor. Maximum 20.
Number of observations to include after the anchor. Maximum 20.
Filter results to a specific project name.
get_observations — fetch full details
Fetch complete observation details by ID. Always batch multiple IDs in a single call — one request instead of N individual requests.
Parameters
Array of observation IDs to fetch.
Sort order:
date_desc or date_asc.Maximum number of observations to return.
Filter results to a specific project name.
Common use cases
Debugging issues
Debugging issues
Find what went wrong and how it was fixed.
Understanding decisions
Understanding decisions
Review architectural choices and their rationale.
Code archaeology
Code archaeology
Find when and why a specific file was changed.
Feature history
Feature history
Track how a feature evolved from first commit to completion.
Context recovery
Context recovery
Restore context after time away from a project.
Reviewing refactoring patterns
Reviewing refactoring patterns
Study past refactoring approaches before starting a new one.
FTS5 query syntax
Thequery parameter uses SQLite FTS5 full-text search syntax.
Boolean operators
Phrase searches
Column-specific searches
Combining operators
Token efficiency guide
Cost estimates
| Operation | Tokens per result |
|---|---|
search index | 50–100 |
timeline per observation | 100–200 |
get_observations full details | 500–1,000 |
Best practices
- Always start with
search— survey the index before fetching anything - Use small limits first — start with 3–5 results, increase only if needed
- Filter before fetching — use
type,dateStart/dateEnd, andprojectto narrow results - Batch
get_observations— always group multiple IDs in a single call - Use
timelinestrategically — only when understanding narrative context matters
Efficient vs. inefficient patterns
Advanced filtering
Date ranges
Multiple observation types
Make separate searches for each type, then compare results:Project-specific search
Pagination
Result metadata
Every observation returned byget_observations includes:
| Field | Description |
|---|---|
| ID | Unique observation identifier |
| Type | bugfix, feature, decision, discovery, refactor, or change |
| Date | When the work occurred |
| Title | Concise description |
| Concepts | Tagged themes such as security, performance, architecture |
| Files read | Files examined during the work |
| Files modified | Files changed during the work |
| Narrative | Story of what happened and why |
| Facts | Key factual points: decisions made, patterns used, metrics |
Troubleshooting
No results found
No results found
Broaden your query:Check the database has data:Try without filters:
IDs not found in get_observations
IDs not found in get_observations
Error:
Observation IDs not found: [123, 456]Possible causes: the IDs belong to a different project, they were deleted, or there is a typo.Token limit errors
Token limit errors
Error: Response exceeds token limitsSwitch to the 3-layer workflow instead of fetching large batches upfront:
Slow search performance
Slow search performance
- Use more specific queries — better precision helps the FTS5 index
- Add date range filters to narrow the scope
- Specify a
projectfilter when possible - Use smaller
limitvalues
Technical details
The MCP tools are a thin wrapper over the worker HTTP API onlocalhost:37777. The MCP server translates tool calls into HTTP requests; all business logic, database queries, and Chroma vector search run in the worker service.
| Component | Location |
|---|---|
| MCP server | ~/.claude/plugins/marketplaces/thedotmack/plugin/scripts/mcp-server.cjs |
| Worker service | Express API on port 37777, managed by Bun |
| Database | SQLite FTS5 at ~/.claude-mem/claude-mem.db |
| Vector search | Chroma embeddings for semantic search |
Progressive disclosure
The philosophy behind the 3-layer workflow
Claude Desktop
Using memory search from Claude Desktop
Architecture overview
System components and data flow
Database schema
Understanding the observation data structure