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

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

Response

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:
If no memories exist:

Usage Examples

Get Recent Context for Current Project

Returns the 20 most recent observations from the “my-api” project.

Get Context Across All Projects

Returns the 10 most recent observations from all projects.

Get Personal Knowledge Context

Returns the 15 most recent cross-project observations.

Large Context Window

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
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:

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.