Tool reference · Save & recall
memory_save
Stores one piece of knowledge (a decision, solution, lesson, fact or convention) so later sessions can find it.
local stdio server writes
Caution. When the quality gate is enabled (MEMORY_MODE=deep or MEMORY_QUALITY_GATE_ENABLED set), low-scoring content is not stored and the response has saved: false with rejected_by_quality_gate: true. The gate and coref: true call the configured LLM provider.
When to use
- You just made a decision and want to record it together with the reason behind it.
- You fixed a bug and want the fix to be findable the next time the same error shows up.
- You learned a project convention or config detail that should outlive the current session.
- A single-valued fact changed and the old value should be retired (pass supersede: true).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
contentrequired | string | — | The knowledge to save |
source_format | "auto" | "conversation" | "auto" | Conversation preserves dialogue structure and bypasses automatic CLI filters. |
typerequired | "decision" | "fact" | "solution" | "lesson" | "convention" | — | — |
project | string | "general" | — |
tags | string[] | — | — |
context | string | — | Additional context, WHY for decisions |
branch | string | — | Git branch this knowledge relates to |
filter | string | — | Optional content filter (pytest|cargo|git_status|docker_ps|generic_logs). Trims noisy CLI output while preserving URLs/paths/code. |
importance | "critical" | "high" | "medium" | "low" | "medium" | Recall-time boost: critical x1.5, high x1.2, medium x1.0, low x0.8. Reserve `critical` for migration-blocking decisions and security incidents. |
coref | boolean | — | Opt into v10 coreference rewrite — expand pronouns ('after this it broke') into self-contained text using recent session history. Costs ~1s LLM round-trip; default off. |
agent_id | string | — | Optional Claude Code subagent ID (x-claude-code-agent-id header / OTEL agent_id attribute, v2.1.139+). Lets recall trace which subagent produced this knowledge. |
parent_agent_id | string | — | Optional parent agent ID (the dispatching Agent tool / parent span). Together with agent_id forms the subagent lineage tree. |
supersede | boolean | false | Retire active records of the same project and type that this one gives a new value for: same opening words, different trailing value ("X's citizenship is Argentina" -> "... is Armenia"). Use for single-valued facts only; "likes jazz" would retire "likes rock". The retired ids are returned as `superseded`. |
Example
Arguments
{
"content": "Use PostgreSQL advisory locks for the nightly billing job instead of a Redis lock.",
"type": "decision",
"project": "my-api",
"tags": [
"database",
"billing"
],
"context": "Redis lock expired mid-run twice; advisory locks are released only when the session ends.",
"importance": "high"
} Result shape
{
"saved": true,
"id": 1842,
"deduplicated": false
} Saving the same words again returns deduplicated: true. Optional keys: superseded, privacy_redacted, quality_score, competency_updated.
Values are illustrative; the keys follow the server's handler. MCP clients receive the result as JSON text content.
Server description
The description the server sends to your agent in tools/list, captured from the v14.7.0 source:
Save knowledge explicitly. Types: decision (MUST include WHY in context), solution, lesson, fact, convention. Saving the same words again (case and punctuation aside) replaces the stored record, so it carries the latest date; any other text, including a changed value, is stored as a new record. v10: a quality gate scores the record before save; below-threshold records are rejected with a `rejected_by_quality_gate: true` response (override with MEMORY_QUALITY_GATE_ENABLED=false). Use `importance` to surface critical decisions at recall time (boosts the final RRF score). v11.0: routes to fast hot path when MEMORY_MODE=fast (default). Use memory_save_fast for explicit fast routing.