Overview
Retrieve recent observations from previous coding sessions to understand what was done before. Unlikemem_search (which requires a query), this tool returns the most recent memories for a project or across all projects.
This is a core tool in the agent profile, always loaded in the MCP context.
Parameters
Filter observations by project nameOmit to retrieve context from all projects.Example:
Filter observations by visibility scopeOptions:
project(default) — project-scoped observationspersonal— cross-project personal knowledge
Number of observations to retrieveDefault:
20Returns the N most recent observations, ordered by creation timestamp.Response
Formatted recent context with observations and statistics
- Recent sessions — summary of the most recent coding sessions
- Recent observations — chronological list of observations with:
- Session ID
- Type and title
- Content preview (truncated)
- Project and scope
- Timestamp
- Memory statistics — total sessions, observations, and projects
Usage Examples
Get Recent Context for Current Project
Get Context Across All Projects
Get Personal Knowledge Context
Large Context Window
When to Use
- Session start — get context about recent work when starting a new session
- Context recovery — understand what happened in previous sessions
- Onboarding — catch up on project history
- Resume work — recall where you left off
Difference from mem_search
| Feature | mem_context | mem_search |
|---|---|---|
| Query | No query — returns most recent | Requires search query |
| Ordering | Chronological (newest first) | Relevance ranking (BM25) |
| Use case | ”What happened recently?" | "Find specific information” |
| Session summaries | Includes session summaries | No session summaries |
| Stats | Includes memory statistics | No statistics |
Use
mem_context when you want recent chronological context. Use mem_search when you’re looking for something specific.Session Summaries
The context includes session summaries created viamem_session_summary:
- Goal — what the session aimed to accomplish
- Discoveries — technical findings and gotchas
- Accomplished — completed tasks
- Relevant files — files changed or important for context
Memory Statistics
The footer includes:- Total sessions — number of coding sessions tracked
- Total observations — number of memories saved
- Projects — list of all projects with observations
Performance
- Fast retrieval — simple
ORDER BY created_at DESC LIMIT Nquery - No full-text search — no FTS5 index lookup
- Minimal overhead — suitable for frequent calls
Token Efficiency
Context is formatted for readability but can be large:- Default (20 observations): ~2000-4000 tokens
- Large (50 observations): ~5000-10000 tokens
Related Tools
mem_search- Search for specific observationsmem_session_summary- Save session summariesmem_save- Save new observationsmem_timeline- View chronological context around a specific observation