Skip to main content

Overview

Retrieve recent observations from previous coding sessions to understand what was done before. Unlike mem_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

project
string
Filter observations by project nameOmit to retrieve context from all projects.Example:
{
  "project": "my-api"
}
scope
string
Filter observations by visibility scopeOptions:
  • project (default) — project-scoped observations
  • personal — cross-project personal knowledge
Example:
{
  "scope": "personal"
}
limit
number
Number of observations to retrieveDefault: 20Returns the N most recent observations, ordered by creation timestamp.

Response

context
string
Formatted recent context with observations and statistics
The response includes:
  1. Recent sessions — summary of the most recent coding sessions
  2. Recent observations — chronological list of observations with:
    • Session ID
    • Type and title
    • Content preview (truncated)
    • Project and scope
    • Timestamp
  3. Memory statistics — total sessions, observations, and projects
Example response:
=== Recent Sessions ===

Session: my-api (2026-03-01T14:00:00Z) — Added JWT authentication and refactored user service
Observations: 5

Session: engram (2026-02-28T09:30:00Z) — Fixed FTS5 search bugs and added deduplication
Observations: 3

=== Recent Observations ===

[#87] session-abc-123 | decision | Switched from sessions to JWT
**What**: Replaced express-session with jsonwebtoken for auth
**Why**: Session storage doesn't scale across multiple instances
...
Project: my-api | Scope: project | 2026-03-01T14:23:45Z

[#42] session-xyz-789 | bugfix | Fixed FTS5 syntax error on special chars
**What**: Wrapped each search term in quotes before passing to FTS5 MATCH
...
Project: engram | Scope: project | 2026-02-28T10:15:30Z

---
Memory stats: 12 sessions, 87 observations across projects: my-api, engram, frontend
If no memories exist:
No previous session memories found.

Usage Examples

Get Recent Context for Current Project

{
  "project": "my-api"
}
Returns the 20 most recent observations from the “my-api” project.

Get Context Across All Projects

{
  "limit": 10
}
Returns the 10 most recent observations from all projects.

Get Personal Knowledge Context

{
  "scope": "personal",
  "limit": 15
}
Returns the 15 most recent cross-project observations.

Large Context Window

{
  "project": "my-api",
  "limit": 50
}
Returns up to 50 recent observations (useful for deep context recovery).

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
Featuremem_contextmem_search
QueryNo query — returns most recentRequires search query
OrderingChronological (newest first)Relevance ranking (BM25)
Use case”What happened recently?""Find specific information”
Session summariesIncludes session summariesNo session summaries
StatsIncludes memory statisticsNo 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 via mem_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
Session summaries provide high-level overviews, while individual observations contain detailed 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
Example:
Memory stats: 25 sessions, 143 observations across projects: my-api, engram, frontend, mobile-app

Performance

  • Fast retrieval — simple ORDER BY created_at DESC LIMIT N query
  • 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
Adjust the limit parameter based on your context window. Start with 10-20 observations and increase if needed.

Build docs developers (and LLMs) love