Skip to content

Definition

An Anthropic-provided, client-side, file-based tool (memory_20250818) that lets Claude request file operations against a developer-controlled /memories store, giving agents persistent memory outside the context window.

Key points

  • Tool entry: {"type": "memory_20250818", "name": "memory"}name must be memory; no input schema (Anthropic-provided tool).
  • Generally available on the Messages API — NO beta header required. (SDK helpers live in the beta namespace even though the tool is GA.)
  • Available on all Claude 4 and later models. ZDR-eligible.
  • Client-side: Claude only requests file operations; your app executes them against storage you control and returns a tool_result. /memories is a prefix your handler maps onto real storage.
  • Six client-side commands (dispatch on input.command):
    1. view{command, path, view_range?}; dir listing up to 2 levels deep, file view with 6-char line numbers.
    2. create{command, path, file_text}; "creates or overwrites."
    3. str_replace{command, path, old_str, new_str?} (omit new_str = delete); old_str must be unique.
    4. insert{command, path, insert_line, insert_text}; inserted after insert_line, 0 = beginning.
    5. delete{command, path}; recursive for dirs; cannot delete /memories root.
    6. rename{command, old_path, new_path}; won't overwrite existing dest; cannot rename /memories root.
  • Auto-injected system prompt when present: "IMPORTANT: ALWAYS VIEW YOUR MEMORY DIRECTORY BEFORE DOING ANYTHING ELSE." + memory protocol + "ASSUME INTERRUPTION...".
  • Pairs with Context Editing (memory_20250818 + clear_tool_uses_20250919): near the clearing threshold Claude is warned to write important info to memory before tool results are cleared. Also pairs with Server-side Compaction.

Why it matters for the exam

  • The product implementation of Structured Note-Taking for long-running agents. Expect the GA/no-beta-header detail, the /memories prefix, the six commands, and the pairing with context editing/compaction.

Common gotchas

  • Path-traversal protection is the developer's responsibility/memories/../../secrets.env can escape. Validate every path resolves inside /memories; reject ../, ..\\, and URL-encoded %2e%2e%2f.
  • It's GA — no beta header (unlike Context Editing, which needs context-management-2025-06-27). Don't conflate the two.
  • The tool is client-side: Claude never touches your storage directly; your handler does.

See also

Sources