Overview
Save significant work, decisions, discoveries, and learnings to persistent memory. Call this proactively after completing important tasks — don’t wait to be asked.This is a core tool in the agent profile, always loaded in the MCP context.
When to Save
Callmem_save after each of these:
- Architectural decisions or tradeoffs — chose JWT over sessions, microservices vs monolith
- Bug fixes — what was wrong, why it happened, how you fixed it
- New patterns or conventions — established a naming convention, file structure
- Configuration changes — environment setup, build config, CI/CD changes
- Important discoveries or gotchas — API behavior, edge cases, performance findings
- File structure changes — created new directories, reorganized modules
Parameters
Short, searchable titleExamples:
- “JWT auth middleware”
- “Fixed N+1 query in user list”
- “FTS5 query sanitization”
- “Switched to TypeScript strict mode”
Structured content using the What/Why/Where/Learned formatUse this exact structure:Focus on:
- What was changed (concise, high-level)
- Why it was needed (the problem or goal)
- Where the changes are (file paths, line numbers)
- What you learned (non-obvious insights, gotchas)
- Full code diffs (the git repo has that)
- Step-by-step instructions (focus on outcomes)
- Obvious implementation details
Category for the observationRecognized types:
decision— architectural or technical decisionsarchitecture— system design, structure, patternsbugfix— bug fixes and incident resolutionspattern— conventions, guidelines, code patternsconfig— configuration, setup, environment changesdiscovery— technical findings, investigationslearning— lessons learned, gotchasmanual(default) — general observations
- Search filtering (users can filter by type)
- Topic key generation (used for upserts)
- Categorization in the TUI
Session ID to associate with this observationDefault:
manual-save-{project} or manual-save if no projectLinks the observation to a coding session for timeline context.Project nameAssociates the observation with a specific project for filtering and scoping.Example:
my-api, engram, frontendVisibility scope for this observationOptions:
project(default) — visible only within this projectpersonal— cross-project, personal knowledge
personal for:- Language-specific patterns (e.g., “Go error handling pattern”)
- Tool usage tips (e.g., “Git rebase vs merge”)
- General learnings that apply across projects
project (default) for:- Project-specific decisions
- Architecture choices
- Bug fixes tied to this codebase
Optional topic identifier for upsertsFormat:
family/segment (e.g., architecture/auth-model, bug/fts5-sanitization)When to use:- Evolving architectural decisions that should update a single observation
- Ongoing bug investigations that refine over time
- Living documentation that gets revised
- If an observation with the same
topic_key,project, andscopeexists, it’s updated (revision count increments) - If not, a new observation is created
mem_suggest_topic_key to generate a normalized key:Response
Confirmation message with the saved observation details
Usage Examples
Bug Fix
Architectural Decision
Pattern with Topic Key
Discovery
Structured Format
Always use the What/Why/Where/Learned format in thecontent field:
What
What
Concise description of what was doneFocus on the outcome, not the steps:
- ✅ “Added JWT authentication to API endpoints”
- ✅ “Refactored UserService to use repository pattern”
- ❌ “First I created a new file, then I imported jwt, then…”
Why
Why
The reasoning, problem, or user request that drove itExplain the motivation:
- ✅ “Session cookies don’t scale across multiple server instances”
- ✅ “User requested ability to export data as CSV”
- ❌ “Because it’s better” (too vague)
Where
Where
Files and paths affectedBe specific:
- ✅
src/auth/middleware.ts(line 45) - ✅
internal/store/store.go,internal/mcp/mcp.go - ❌ “The auth files” (too vague)
- ❌ Full file paths with absolute directories (use relative paths from project root)
Learned
Learned
Gotchas, edge cases, non-obvious insightsCapture the surprises:
- ✅ “FTS5 requires quotes around search terms with special chars”
- ✅ “Must close WAL files before SQLite backup”
- ❌ “It works now” (no insight)
Deduplication
Engram automatically detects duplicate observations:- Duplicate detection window: 15 minutes (configurable)
- Matching criteria: Same session + same content hash
- Behavior: Updates
duplicate_countinstead of creating a new entry
Topic Key Upserts
Whentopic_key is provided:
- Engram searches for an existing observation with:
- Same
topic_key - Same
project - Same
scope
- Same
- If found:
- Content is replaced with new content
revision_countincrementsupdated_attimestamp refreshes
- If not found:
- New observation is created
Use topic keys for evolving knowledge — architecture decisions, ongoing investigations, living documentation.
When NOT to Save
- Raw tool calls — don’t save every
edit,bash, orreadaction - Trivial changes — typo fixes, formatting, minor refactors
- Work in progress — save when a task is complete, not mid-implementation
- Duplicate context — if you already saved it, don’t save again (unless using topic_key for updates)
Related Tools
mem_search- Search saved observationsmem_suggest_topic_key- Generate stable topic keys for upsertsmem_update- Update an existing observation by IDmem_session_summary- Save end-of-session summaries