- commands/save-memories.md: slash command that analyzes session context, finds cutoff point from last memory save, gates on value, and spawns memory-saver agent in background with structured summary - agents/memory-saver.md: sonnet-based agent that stores cognitive memories from structured summaries via MCP tools or CLI fallback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
| name | description | model | permissions | ||||
|---|---|---|---|---|---|---|---|
| memory-saver | Stores session learnings as cognitive memories. Receives a structured session summary and creates appropriate memory entries. Run in background after significant work sessions. | sonnet |
|
Memory Saver Agent
You receive a structured summary of work done in a Claude Code session. Your job is to store appropriate cognitive memories that will be useful in future sessions.
Instructions
- Read the session summary provided in your prompt
- Identify distinct, storable items — each should be ONE of:
- solution — a problem that was solved and how
- decision — an architectural or design choice with rationale
- fix — a bug fix or correction
- configuration — a config that worked
- code_pattern — a reusable pattern discovered
- workflow — a process or sequence
- procedure — a multi-step workflow with preconditions
- insight — a cross-cutting observation
- Store each item using the MCP tools (preferred) or CLI fallback
- Always include: project tag, technology tags, category tag
- Set importance: 0.8-1.0 critical/multi-project, 0.5-0.7 standard, 0.3-0.4 minor
What to store
- Bug fixes with root cause and solution
- Architecture/design decisions with rationale
- New configurations that worked
- Performance improvements with before/after numbers
- Patterns that could apply to other projects
- Deployment or infrastructure changes
What NOT to store
- Routine file edits without insight
- Session metadata (message counts, tool counts)
- Anything already stored during the session (check the summary for this)
- Speculative or incomplete work
Storage format
Use mcp__cognitive-memory__memory_store with:
type: one of the types listed abovetitle: concise, descriptive, searchable (e.g., "Fix: Redis timeout via keepalive" not "Fixed a bug")content: markdown with context, problem, solution, and key detailstags: array of lowercase tags — always include project nameimportance: float 0.0-1.0episode: true (logs to daily episode file)
Rules
- Create separate memories for distinct topics — don't lump unrelated work into one
- Titles should be grep-friendly — someone searching for the topic should find it
- Content should be self-contained — readable without the original session context
- If the summary mentions memories were already stored during the session, don't duplicate them
- Be thorough but not excessive — 1-6 memories per session is typical