/longterm-memory:long-term-memoryfrom longterm-memory
Use when starting any session, after completing debugging sessions, after brainstorming or planning, after code reviews, or after any major task completion. Works standalone with the longterm-memory MCP server.
Ships in longterm-memory. 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.
None: SKILL.md is the whole skill.
Persistent, semantic memory across sessions. Two modes: RECALL at session start (pull relevant context) and SAVE after completing tasks (persist insights). All memory operations should be invisible to the user.
| Tool | Purpose |
|---|---|
save_memory | Store text with auto-generated semantic embedding, tags, importance, and type |
search_memory | Find relevant memories using natural language query (cosine similarity) |
update_memory | Modify an existing memory (content, metadata, tags, importance, type) |
delete_memory | Remove a specific memory by ID |
delete_all_memories | Wipe all memories (irreversible) |
get_all_memories | List all stored memories (paginated) |
memory_stats | Get count and database location |
search_by_type | Filter memories by category (general, fact, preference, conversation, task, ephemeral) |
search_by_tags | Find memories matching any of the provided tags |
search_by_date_range | Find memories created within a specific date range |
create_backup | Manually trigger a database backup with JSON export |
When invoked at the start of a session:
Check the injected recall — With the Claude Code plugin, a hook has already searched with the first prompt and added a "Long-term memories that may be relevant" list to the context. Use those lines first; search_memory gives the full text of one. Search further only for what the list does not cover.
Detect context — Determine the current project from:
Search memories — Call search_memory with two queries (sequentially):
"{project name} {task keywords from user message}" — project-specific context"preference workflow" — general preferences that apply everywhereIntegrate silently — Use recalled memories to inform your behavior. Do NOT tell the user "I remembered X" or "Based on previous sessions." Just know it and act on it.
Invocation: After completing any task listed in "When to Use", self-invoke SAVE mode before responding to the user's next message. Do not wait for explicit request.
When invoked after a task completes:
search_memory with the insight text. If a result covers the same core fact, use update_memory to revise it in place (preferred), or delete_memory + save_memory if the content is completely differentsave_memory with a structured text stringUse a structured prefix so semantic search can match on category and project:
[{category}] [{project}] {concise insight in 1-3 sentences}
Examples:
[root-cause] [myproject] EF Core cascade delete fails silently when change tracking is disabled. Fix: explicitly load related entities before delete.[design-decision] [myproject] Catalog sync uses queue-based approach instead of direct API polling to handle rate limits.[preference] [global] User prefers guard clauses over nested if-else. Prefers invisible/automatic behavior over prompted confirmations.| Completed Task | Category prefix | What to Extract |
|---|---|---|
| Debugging / bug fix | root-cause | Root cause identified, fix applied, symptoms that led to it |
| Brainstorming / design | design-decision | Architecture choices, rejected alternatives and why |
| Planning / implementation | implementation-plan | Tech approach, key libraries chosen, structural decisions |
| Code review | review-feedback | Review findings, patterns to watch for |
| Code review feedback received | code-style | User's style preferences expressed through feedback |
| Testing | test-pattern | Testing strategies, test infrastructure choices |
| Any other task | preference | Workflow preferences, tool preferences, communication style |
When calling save_memory, use the structured fields to improve future retrieval:
["root-cause", "myproject", "ef-core"])root-cause → fact, design-decision → fact, preference → preference, implementation-plan → task, test-pattern → factglobal for cross-project preferences.search_memory first. If same fact exists, prefer update_memory. If save_memory rejects with a duplicate content error, use the returned memory ID with update_memory.<private>…</private>; the server removes them before storing. It rejects content that looks like a secret: drop the value and keep the lesson.Beyond semantic search, use these tools when the query is better served by structured filters:
search_by_type — Find all memories of a specific kind (e.g. all preference memories)search_by_tags — Find memories with specific tags (e.g. ["auth", "backend"])search_by_date_range — Find recent memories or memories from a specific periodupdate_memory — Revise an existing memory instead of delete + re-saveIf any memory tool call fails or times out:
| Mistake | Fix |
|---|---|
| Announcing "I recalled from memory..." | Integrate silently — never reveal memory operations. |
| Saving entire file contents | Save the insight, not the data. |
| Saving session-specific temp state | Only save reusable, cross-session insights. |
| Creating duplicate memories | Always search before saving; use update_memory for revisions. |
| Saving speculative conclusions | Only save confirmed facts and expressed preferences. |
| Showing errors when MCP is down | Degrade silently, proceed normally. |
| Using only semantic search | Use structured search (by type, tags, date) when appropriate. |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub marcelroozekrans/longtermmemory-mcp --plugin longterm-memory