USER
Who you are
Your role, expertise, and working preferences.
FIELD GUIDE 02 / MEMORY & CONTEXT
A file on disk is not a fact in the model’s head.
What gets saved, what gets retrieved, and what actually reaches the prompt.
Claude Code · OpenViking · Magic Context · Letta · Mem0
Compare the systemsPrimary documentation checked 17 September 2026. Architecture comparison, not a performance benchmark or installation guide. Features depend on version and configuration. Interactive examples are local teaching models, not live memory services.
01 / THE SHORT ANSWER
Claude Code’s documented built-in memory uses Markdown files. You write instructions in CLAUDE.md; Claude writes selected learnings into auto memory. A bounded MEMORY.md index is loaded into context, and Claude reads detailed topic files with its standard file tools when needed. [1]
No separate embedding model or vector database is required for that documented path. It is file loading and model-directed reading—not a documented nearest-neighbor lookup over a vector index. This describes native memory, not every internal Claude Code feature or third-party plugin.
No embeddings ≠ no model work. Claude still decides what to save, reads notes, and reasons about them. Notes consume input tokens when loaded; writing them involves ordinary model/tool work. Memory does not train or update the model’s weights.
An embedding model maps text to numerical vectors. A retrieval system compares a query vector with stored vectors to find semantically similar material, even when the wording differs. It then supplies selected text to the main model.
That can improve discovery across a large archive. It also adds indexing, model dependencies, scope filters and stale-index concerns. Similarity is not truth, permission, or a guarantee that the right fact was retrieved.
A system can store Markdown and index it with embeddings. Storage format and retrieval method are separate choices; OpenViking is a useful example.
02 / WHAT LIVES WHERE
| Layer | Storage | How it enters context |
|---|---|---|
| Shared instructions | CLAUDE.md or .claude/CLAUDE.md | Applicable ancestor and working-directory files load at launch. Nested files load when Claude reads in their subtree. Concatenated, not a settings-style override. |
| Personal instructions | ~/.claude/CLAUDE.md; project CLAUDE.local.md | Persistent conventions you author. Keep local project instructions out of git when private. |
| Scoped rules | .claude/rules/*.md | Unscoped rules load at startup; rules with paths: load when matching files are read. |
| Auto memory index | ~/.claude/projects/<project>/memory/MEMORY.md | First 200 lines or 25KB, whichever comes first, at conversation start. This is not a 200-token budget. |
| Auto memory detail | Topic files alongside MEMORY.md | Read on demand with file tools. The whole directory is not injected at startup. |
Auto memory is enabled by default and machine-local. Worktrees and subdirectories of the same git repository share its auto memory directory by default; it is not automatically synchronized to another machine. Claude decides which useful learnings to save—not every message or every session. [1]
USER
Your role, expertise, and working preferences.
FEEDBACK
Approaches to avoid or repeat, with the reason.
PROJECT
Ongoing decisions, deadlines, and context not derivable from the repository.
REFERENCE
Pointers to external sources such as an issue tracker.
The current memory documentation tells Claude not to duplicate facts it can derive from code or git, or instructions already in CLAUDE.md. Use CLAUDE.md for explicit standing conventions and skills for repeatable procedures.
Not by default. The main conversation’s auto memory is not loaded into ordinary subagents. A fork inherits the parent context; a custom subagent can instead have its own persistent memory. [2]
Its frontmatter can set memory: user, memory: project, or memory: local. These use ~/.claude/agent-memory/<name>/, .claude/agent-memory/<name>/, or .claude/agent-memory-local/<name>/, respectively. Turning off auto memory also disables that subagent memory behavior.
Do not confuse the subagent’s own persistent notes with the parent conversation or assume every worker sees every memory.
03 / FOLLOW ONE MEMORY
A synthetic correction: “For reviews, lead with the user-visible failure and reproduction. Skip praise-only summaries.” Here is one possible lifecycle; saving and reading the note are model decisions, not guaranteed steps.
ON DISK / TOPIC FILE
---
name: Review feedback
description: How to structure code reviews
type: feedback
---
Lead with the user-visible failure and
reproduction. Skip praise-only summaries.ON DISK / MEMORY.md
- [Review feedback](feedback_reviews.md)
— Review structure and evidence.The index points to the detail. This is an example note, not a prescribed filename or an observed Claude transcript.
The short entry is in context, within the documented index limit. The topic file remains on disk. The model does not automatically receive every note or the old conversation just because it was saved.
IN CONTEXT: applicable CLAUDE.md + MEMORY.md index
ON DISK: feedback_reviews.md
NOT IMPLIED: full prior conversationYou ask for a review. Claude can use the index to locate feedback_reviews.md and read it with a standard file tool. The returned text now occupies context and can influence the review.
Task → recognize relevant index entry
→ read feedback_reviews.md
→ use the returned text in this taskNo embedding lookup is required in this flow. The possible failure is selection: a saved note can still be overlooked or misapplied.
If the preference changes, ask Claude to update the memory or edit it through /memory. Keep the index consistent with its topic files. To retire a note, remove its index entry and topic file intentionally.
Removing a file does not retroactively remove its text from an already-running context or older transcripts/backups. Check each store separately when deleting sensitive information.
The index is a retrieval aid, not the memory itself. Keep it short and descriptive. Moving a long note into a topic file saves startup context only if the index stays small.
04 / DON’T MIX THESE UP
| Mechanism | What it does | What it does not do |
|---|---|---|
| Persistent memory | Keeps selected information outside the current request so future work can reuse it. | Guarantee every stored fact is loaded, current, or obeyed. |
| Context window | Holds the actual text and other supported input supplied for this model request. | Automatically include everything on disk or give unlimited attention. |
| Compaction | Summarizes conversation to make room. Root instructions and memory can be reloaded; summaries can omit detail. [3] | Turn the model’s finite window into an infinite one or preserve every detail verbatim in the active prompt. |
| Prompt caching | Reuses eligible prompt-prefix computation; affects latency and billing. [4] | Find memories, save preferences, or remove cached text from the context budget. |
Retained conversation transcripts are another store. Resuming a conversation is not the same as starting a fresh conversation with selected auto memories. Claude Code’s memory files are excluded from its old-session transcript retention sweep. [1]
Memory is guidance, not a security boundary. CLAUDE.md and recalled notes are context. Use permission rules, hooks, and sandbox/OS controls to enforce restrictions. Stored text can be stale, malicious, or simply wrong.
05 / SAME WORD, DIFFERENT ARCHITECTURES
These are different layers: a native feature, a context database, a harness plugin, an agent runtime, and an application memory API. They are not drop-in substitutes. Recommendations below are architectural judgments, not measured rankings.
| System | Storage & recall | Embedding requirement | Claude Code relationship |
|---|---|---|---|
| Claude Code native | Markdown instructions + note index; on-demand file reads. | None for the documented native memory path. | Built in. No extra memory service. |
| OpenViking | URI filesystem + summaries + vector index; hierarchical semantic retrieval. | Yes for semantic indexing/search; not for reading a known URI. | Official hooks + MCP integration; separate service. |
| Magic Context | Local SQLite, project facts, tiered history, lexical + optional semantic search. | Optional; local embeddings documented as default. FTS5/BM25 works with embeddings off. | Documented for OpenCode, Pi, OMP. No official Claude Code adapter verified. |
| Letta / MemFS | Git-backed Markdown; system files always in context, other files read on demand. | None for default MemFS. Optional semantic/hybrid search adds an index. | Primarily its own runtime. Claude Subconscious integration is explicitly a demo. |
| Mem0 | Extracted facts + metadata; application calls add/search and injects results. | Yes for the standard semantic path; generation also used for default extraction. | Official Claude Code plugin targets Mem0 Platform and requires its API key. |
01 / NATIVE FEATURE
Source: Anthropic memory documentation [1].
02 / CONTEXT DATABASE
viking:// addresses. Full content lives in filesystem storage; a separate vector index holds retrieval data. L0 abstracts and L1 overviews help select L2 full content.find() performs semantic retrieval without LLM intent planning. search() adds session-aware LLM planning. Vector search identifies candidate directories, then retrieval explores their contents; reranking is optional.Sources: OpenViking architecture, retrieval, configuration and Claude integration [5]. No retrieval benchmark run for this guide.
03 / CONVERSATION & CONTEXT PLUGIN
ctx_search combines lexical retrieval with optional semantic ranking and can search memories, session history, notes and optional indexed commits. ctx_expand recovers original transcript ranges; ctx_reduce queues working-context reduction, not archive deletion.Xenova/all-MiniLM-L6-v2; an OpenAI-compatible endpoint is another option. Embeddings off leaves SQLite FTS5/BM25 keyword search. Off does not disable historian/dreamer generation costs.Project memories can cross sessions and supported harnesses. Raw-message search in the inspected default path is session-scoped; do not assume one query searches every transcript ever recorded.
Exact expansion depends on the original host transcript remaining available. Preserve the harness session store as well as Magic Context’s database. A summary is not a reversible encoding of the full conversation.
This describes the public default TypeScript implementation at the linked revision—not the configuration of any particular OMP installation, its experimental backend, or its other native memory systems.
Sources: Magic Context docs and pinned source [6]; inspected revision 3b797e5, 17 September 2026.
04 / STATEFUL AGENT RUNTIME
system/ files load into the system prompt every turn; other files stay outside context until read, with their file tree available as a guide.Sources: Current Letta MemFS, dreaming, self-hosting and demo integration [7]. Older Letta/MemGPT descriptions of archival vector memory should not be assumed to describe today’s default MemFS.
05 / APPLICATION MEMORY LAYER
add() after useful interactions, then search() before a model call. The application chooses which results enter the prompt. Current docs describe additive extraction; use explicit update/delete to correct old facts rather than assume new statements overwrite them.infer=False skips extraction generation in OSS, not embedding. Providers and backing stores are configurable; reranking is optional.Sources: Mem0 architecture, OSS configuration/source and Claude Code plugin [8]. Current Platform graph/temporal features are not interchangeable with the current OSS path.
06 / MATCH THE PROBLEM
Evaluate on your actual failure cases. Did it recall the right decision? Can it show the source? Does a correction replace stale advice? Can it isolate users/projects and delete data? Measure total model calls, tokens and latency—not just storage size or a vendor benchmark.
07 / INSPECT & MAINTAIN
/memory # browse/edit notes and toggle auto memory
/context # inspect current context and loaded memory filesFor explicit team instructions, ask to update CLAUDE.md or edit it directly. For a personal learning, ask Claude to remember it, then inspect what was actually saved. Do not infer persistence solely from an answer saying “I’ll remember.”
{
"autoMemoryEnabled": false
}This disables auto memory, not CLAUDE.md instructions, and does not itself delete existing notes. The environment alternative is CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. See the current official settings.
SOURCES / 17 SEPTEMBER 2026
Native-memory claims follow Anthropic’s public documentation, not an audit of private internals. External comparisons follow each project’s public documentation/source; no memory service was installed or benchmarked for this guide.
Download this guide · standalone HTML ↓Download the seminar ↓
Fonts, styles and interactions are embedded. The saved guide works offline; source links and site navigation require a connection. Nothing typed or clicked in the teaching model is sent to a memory service.