Skip to main content

Overview

Save a structured summary when a coding session ends or when significant work is complete. This creates a high-level overview that future sessions use to understand what happened, what was learned, and what’s left to do.
This is a core tool in the agent profile, always loaded in the MCP context.

When to Use

  • Session ending — when the user is done for the day
  • Major milestone — when significant work is complete
  • Context checkpoint — before a long break or context compaction
  • Handoff — when switching agents or team members

Parameters

content
string
required
Full session summary using the structured formatUse this exact structure:
## Goal
[One sentence: what were we building/working on in this session]

## Instructions
[User preferences, constraints, or context discovered during this session. Things a future agent needs to know about HOW the user wants things done. Skip if nothing notable.]

## Discoveries
- [Technical finding, gotcha, or learning 1]
- [Technical finding 2]
- [Important API behavior, config quirk, etc.]

## Accomplished
- ✅ [Completed task 1 — with key implementation details]
- ✅ [Completed task 2 — mention files changed]
- 🔲 [Identified but not yet done — for next session]

## Relevant Files
- path/to/file.ts — [what it does or what changed]
- path/to/other.go — [role in the architecture]
project
string
required
Project nameAssociates the session summary with a specific project.Example: my-api, engram, frontend
session_id
string
Session identifierDefault: manual-save-{project}Links the summary to a specific coding session.

Response

result
string
Confirmation message
Example:
Session summary saved for project "my-api"

Structured Format

Goal

One sentence describing what this session aimed to accomplish.
  • “Build JWT authentication system for the API”
  • “Fix N+1 query performance issues in user list”
  • “Add CSV export feature to admin dashboard”
  • “Investigate and resolve FTS5 search crashes”

Instructions (Optional)

User preferences, constraints, or discovered context about how the user wants things done.
  • “User prefers TypeScript strict mode — all new files must have explicit types”
  • “Use Zod for validation — no manual type guards”
  • “Follow existing pattern: one service per domain entity”
  • “No external dependencies without approval — prefer stdlib”
Skip this section if there are no notable instructions. Not every session has user preferences to capture.

Discoveries

Technical findings, gotchas, and non-obvious learnings. This is the most valuable section.
  • “FTS5 MATCH syntax requires quotes around terms with special chars — raw user input crashes”
  • “SQLite WAL mode creates -wal and -shm files — safe to delete only when DB is closed”
  • “Next.js data fetching doesn’t auto-optimize joins — always check Network tab for N+1 patterns”
  • “JWT refresh tokens need separate rotation logic — access token expiry alone is insufficient”
  • “Go’s fmt.Errorf with %w preserves error chains for errors.Is() — %v does not”
Focus on surprises and gotchas — things that would save a future agent time. Obvious implementation details don’t belong here.

Accomplished

Completed tasks with key implementation details and identified next steps.
Use checkmarks:
  • Completed — tasks that are done
  • 🔲 Identified but not done — for next session
Include:
  • What was done (high-level)
  • Files changed (if relevant)
  • Any important decisions made
  • ✅ Added JWT authentication middleware — validates tokens on protected routes (src/middleware/auth.ts)
  • ✅ Refactored UserService to repository pattern — separates DB logic from business logic (src/services/UserService.ts, src/repositories/UserRepository.ts)
  • ✅ Fixed N+1 query in user list — added eager loading for relationships (src/api/users.ts line 45)
  • 🔲 Add refresh token rotation — identified security requirement, not yet implemented
  • 🔲 Write tests for auth middleware — covered in next session

Relevant Files

Files that were significantly changed or are important for context.
- path/to/file.ext — [what it does or what changed]
Keep it concise:
  • src/middleware/auth.ts — JWT validation logic
  • internal/store/store.go — FTS5 query sanitization added
  • src/ — too vague
  • ❌ Full absolute paths like /Users/me/projects/app/src/... — use relative paths
Only include files that provide context. Don’t list every file touched — focus on the important ones.

Usage Example

{
  "content": "## Goal\nAdd JWT authentication to the API and secure protected endpoints\n\n## Instructions\nUser prefers TypeScript strict mode — all new files must have explicit types. Use Zod for request validation.\n\n## Discoveries\n- JWT access tokens need short expiry (15min) to limit exposure — refresh tokens handle re-auth\n- httpOnly cookies prevent XSS but break mobile apps — need to support both cookie and Authorization header\n- express-jwt middleware automatically decodes and attaches user to req.user — no manual verification\n\n## Accomplished\n- ✅ Added JWT authentication middleware — validates tokens and attaches user to request (src/middleware/auth.ts)\n- ✅ Created login endpoint — returns access + refresh tokens (src/routes/auth.ts)\n- ✅ Secured user routes — applied auth middleware to /api/users/* (src/routes/users.ts)\n- 🔲 Refresh token rotation — identified security requirement, implementation pending\n- 🔲 Add tests for auth flows — next session\n\n## Relevant Files\n- src/middleware/auth.ts — JWT validation middleware\n- src/routes/auth.ts — login/logout endpoints\n- src/routes/users.ts — protected user routes\n- src/types/express.d.ts — extended Express.Request with user property",
  "project": "my-api",
  "session_id": "session-2026-03-03-1430"
}

Guidelines

Don’t lose important details, but avoid verbosity:
  • ✅ “Added eager loading for user relationships to fix N+1 query”
  • ❌ “First I identified the N+1 query by opening the Network tab and seeing 50+ requests, then I researched how to fix it, then I added include: [‘profile’, ‘settings’] to the query…”
The code is in the repo — focus on context:
  • ✅ “Switched to JWT because session storage doesn’t scale across instances”
  • ❌ “I imported jsonwebtoken, then created a secret in .env, then wrote a function to sign tokens with HS256…”
Discoveries are the most valuable section. Focus on surprises:
  • ✅ “FTS5 requires quotes around search terms — special chars are operators”
  • ✅ “WAL files are safe to delete only when DB is closed”
  • ❌ “I learned that TypeScript has types” (obvious)
Only include files that provide context:
  • ✅ Core files that changed
  • ✅ New architectural pieces
  • ❌ Every file touched (config tweaks, imports, etc.)

What Gets Stored

The session summary is saved as an observation with:
  • Type: session_summary
  • Title: Session summary: {project}
  • Content: The structured markdown you provide
  • Project: The specified project
  • Session ID: Links to the session

When Future Sessions See This

Session summaries appear in:
  1. mem_context — shows recent session summaries first
  2. mem_search — can search summary content by keywords
  3. TUI session view — displays session summaries
  4. HTTP API/api/sessions/{id} includes the summary

Build docs developers (and LLMs) love