/handoff-mcp:handoff-memoryfrom Handoff MCP
Project memory — save, query, merge, and clean up durable project knowledge (lessons, rules, conventions, gotchas). Triggers on 'メモリ保存', 'これ覚えて', '知見を残して', '過去の知見', 'memory save', 'memory query', 'remember this', 'recall', 'cleanup memories', or when recording post-incident learnings, recurring NG patterns, or project-specific conventions.
Ships in Handoff MCP. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
One memory = one piece of knowledge. Do not bundle multiple unrelated lessons into a single memory. Each memory should be independently searchable and independently deletable. If two ideas always travel together, save them together; if they could be relevant in different contexts, split them.
Call handoff_memory_save with:
| Param | Required | Description |
|---|---|---|
text | yes | The memory content. Be specific and actionable — "always use X because Y", not "X is important" |
kind | no (default: lesson) | One of: lesson (something learned), rule (a mandated practice), convention (an agreed pattern), gotcha (a non-obvious trap) |
scope_paths | no | Path prefixes this memory applies to (e.g. ["src/storage/", "src/mcp/handlers/"]). Memories with matching scope_paths get a relevance boost when the user edits files under those paths |
tags | no | Free-form tags for searchability (e.g. ["atomic-write", "config"]). Tags are included in the similarity index |
force | no | true to skip near-duplicate detection and save unconditionally |
merge_into | no | ID of an existing memory to overwrite with merged content (see Merging below) |
absorb_ids | no | IDs of memories to delete after merging into the target |
"src/storage/" not "src/storage/config.rs". The matching is substring-based (file_path.contains(scope)), so "storage/" will match any file whose path contains that segment"atomic-write", "json-rpc", "config-toml"When handoff_memory_save returns status: "conflict", it means the new memory
is similar to one or more existing memories (Jaccard similarity >= threshold). The
response includes both the new text and the similar existing memories.
Decision flow:
handoff_memory_save again with:
text: the merged contentmerge_into: ID of the existing memory to keepabsorb_ids: IDs of any other similar memories to absorbkind, tags, scope_paths as neededhandoff_memory_save with force: true to save the new one separately.Do not ignore conflicts — they indicate the memory store may have redundancy that degrades injection quality.
Call handoff_memory_query with:
| Param | Description |
|---|---|
text | The prompt or question to match against (BM25 relevance ranking) |
file_paths | Files being worked on — memories scoped to these paths get a boost |
session_id | Current session ID — suppresses re-injection of memories already seen this session |
limit | Max memories to return (default from config, typically 5) |
tool_name | Tool being used (adds context tokens for matching) |
mark_injected | Whether to record injection for dedup (default: true) |
The query engine uses BM25 text similarity plus a scope_path bonus. Passing
session_id enables per-session diff injection: a memory already injected this
session (same content hash) is filtered out, but an edited memory (new hash) is
re-injected.
Run handoff_memory_cleanup at the start of each session (the SessionStart hook
does this automatically if configured). Optional arguments:
| Param | Default | Description |
|---|---|---|
apply_exact_merges | false | Set true to merge exact duplicates (lossless; oldest kept, others deleted and logged as a memory.merged event). Off by default so cleanup never rewrites or deletes a memory file |
stale_days | from config (default 60) | Override the review-candidate age threshold in days |
Reading memories never changes a memory file: handoff_memory_query only writes a
git-ignored per-session sidecar, and handoff_memory_cleanup is read-only unless
you pass apply_exact_merges=true.
It performs three passes:
apply_exact_merges is trueupdated_at is older than stale_days, listed as review candidates (key stale)handoff_memory_save(merge_into=..., absorb_ids=[...]). If distinct, leave them.updated_at says nothing about whether a memory is still relevant. Re-read each one and keep it, update it (handoff_memory_save(merge_into=...) refreshes updated_at), or — only when you have confirmed it is wrong or obsolete — delete it with handoff_memory_delete.Older memory files carry hit_count / last_referenced_at. They still load and are
dropped when a memory is next saved. To strip them from all files at once, run
handoff-mcp memory strip-usage-stats (dry-run, counts only) and then add --apply
(MCP tool handoff_memory_strip_usage_stats). It removes only those two keys and
keeps updated_at.
Call handoff_memory_delete with the memory id (full ID or unique prefix). Use
this for memories that are confirmed obsolete, wrong, or superseded by a code
change.
Memory tools can be called manually, but for automatic injection without AI initiative, configure Claude Code hooks:
| Hook | Tool Call | Purpose |
|---|---|---|
UserPromptSubmit | handoff_memory_query (prompt text) | Inject memories relevant to each user prompt |
PreToolUse (Edit|Write|MultiEdit) | handoff_memory_query (file path) | Inject memories scoped to the file being edited |
SessionStart | handoff_memory_cleanup | Surface review candidates (deletes nothing by default) |
Run handoff-mcp setup to install these hooks automatically, or
handoff-mcp setup --uninstall to remove them. See the README for the full hook
JSON configuration.
| Layer | Lifespan | Purpose |
|---|---|---|
Sessions (.handoff/sessions/) | Per-conversation | "What was I doing last time?" |
Memory (.handoff/memory/) | Cross-session, long-lived | "What has this project learned?" |
CLAUDE.md | Permanent | Foundational rules, build commands, repo structure |
.claude/skills/ | Permanent | Operational procedures triggered by intent |
Rule changes: discover via memory → codify in skills/CLAUDE.md. Memory is the source of evidence; skills and CLAUDE.md are the source of authority.
| Memory | Documents | |
|---|---|---|
| Shape | Short, atomic lesson/rule/convention/gotcha | Structured, multi-section Markdown (specs, designs, ADRs, guides) |
| Storage | One flat entry (.handoff/memory/) | Split into fragments with a family tree (.handoff/docs/) |
| Relationships | None | parent/child (structural) + related (semantic: supersedes/references/implements/extends/conflicts) |
| Task linking | Via scope_paths boost only | Bidirectional task_ids ↔ task_links |
| Injection | Always inline (BM25 similarity) | Staged — full body for small fragments, outline (headings only) for large ones |
Boundary rule: if it is a standalone piece of knowledge that fits in a
paragraph or two (< 1 page, no internal sections), save it as a memory. If it
has structure — sections, a hierarchy, cross-references to other documents —
use document management (handoff_doc_save; see the handoff-docs skill).
There is no migration path between the two stores — they are independent.
If a memory grows into something that needs sections and cross-references,
recreate it as a document with handoff_doc_save and delete the memory with
handoff_memory_delete rather than expecting an automatic conversion.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alphaelements/handoff-mcp --plugin handoff-mcp11 skills in this plugin
/handoffSession handoff — load context at start, save at end, track tasks during work. Triggers on session start, session end, task tracking, or when the user says 'handoff', 'save context', 'load context', 'what was I working on', 'resume', 'milestone', 'frozen', 'マイルストーン', 'リリーススコープ', 'depends_on', 'milestone report', 'capacity', 'metrics', 'timer', 'report', 'calendar', 'labels', 'bulk_update', or 'events'./handoff-docsDocument management — save, read, search, import, and traverse structured project documents (specs, designs, plans, ADRs, guides, notes). Triggers on 'ドキュメント保存', '仕様書を管理', '設計書をインポート', '実装計画', 'save this doc', 'import specs', 'document management', 'タスク開始', 'spec registration', '仕様登録', 'verification check', 'scaffold_suggestions', 'schedule_stale', 'orphaned_tasks', 'mock', 'golden', 'viewport', 'モック', 'ゴールデン', 'ビューポート', 'capture_method', 'doc_req_impact', 'doc_req_status', or when the user asks to persist/organize/search multi-section markdown that is too structured for a single memory entry, or when the AI writes a spec/design/plan document during development./handoff-getting-startedFirst steps with handoff-mcp: the shortest path from an empty directory to one finished task (install, initialize, set up, check readiness, brainstorm, requirements, implementation). Triggers on '/handoff-getting-started', 'getting started', 'first project', 'how do I start', 'はじめかた', '最初の一歩', 'チュートリアル'.Other plugins' skills for the same job