What Claude Code loads at session start
Each Claude Code session begins with a fresh context window. Two mechanisms carry knowledge across sessions: CLAUDE.md instruction files and auto memory. Both are loaded at the start of every conversation. Details are in the Claude Code memory guide.
CLAUDE.md files: instructions you write
CLAUDE.md files provide persistent instructions written by you. They hold context you want Claude to keep. Claude treats them as context, not enforced configuration, so they guide behavior rather than force it. See the Claude Code memory guide.
Auto memory: notes Claude writes itself
Auto memory stores learnings Claude writes based on your corrections and preferences. Claude skips anything it can derive from the codebase, such as architecture, file paths, or debugging fixes. It also skips anything your CLAUDE.md files already say. Auto memory is on by default in local sessions, and off by default in self-hosted environments outside Claude Tag sessions. Source: Claude Code memory guide.
Limits: what loads and what does not
Only the first 200 lines of MEMORY.md, or the first 25KB, whichever comes first, are loaded at the start of every conversation. Topic files such as user_role.md or feedback_testing.md are not loaded at startup. Claude reads them on demand when needed. Details in the Claude Code memory guide.
Where memory lives
Each project gets its own memory directory at ~/.claude/projects/<project>/memory/. The directory contains a MEMORY.md index and one topic file per memory. All worktrees and subdirectories within the same repo share one auto memory directory. Auto memory is machine-local, and files are not shared across machines or cloud environments. Source: Claude Code memory guide.
Retention and cleanup
Claude Code deletes old session transcripts after the cleanupPeriodDays retention period, but excludes the memory files in the memory directory from that sweep. Memory files therefore persist beyond session transcripts. Source: Claude Code memory guide.
The Claude Platform memory tool is a different thing
The memory tool on the Claude Platform also lets Claude store and retrieve information across conversations, in memory files. It works differently from Claude Code auto memory. It uses just-in-time retrieval instead of loading all relevant information up front. It is client-side: Claude requests file operations, and your application runs them. Storage can be files on disk, a database, cloud storage, or encrypted files, and your handler must reject paths outside /memories. See the Platform memory tool docs.
Where KnowMan fits
Auto memory holds notes Claude writes based on your corrections and preferences (Claude Code docs). A knowledge base holds a different kind of memory: the articles and links you save. KnowMan saves articles and links, reads and tags them, answers questions with citations, and keeps memories such as claims, decisions, and playbooks. KnowMan runs as a local stdio MCP server, the package @knowman/mcp, started with npx -y @knowman/mcp (Node 22 or newer), which talks to KnowMan's HTTP API with a Bearer key in the environment variable KNOWMAN_API_KEY, and also as a hosted server at https://api.knowman.io/mcp with OAuth sign-in or an API key. Tools include kb_search, kb_ask, kb_get_item, which returns the readable content of one item, kb_save, kb_recent, and kb_memories. Claude Code is one of the clients documented in the KnowMan README. For setup, see connecting a knowledge base over MCP and using KnowMan with Claude Code, or persistent memory for AI agents.
Use the hosted KnowMan server in Claude Code
The hosted remote MCP server at https://api.knowman.io/mcp serves the same KnowMan tools as the local stdio server. For clients with MCP OAuth, add the server URL and sign in: Claude Code opens the KnowMan consent page, you approve the knowman.read and knowman.write scopes, and access tokens last one hour and refresh automatically. The other option is an API key created in KnowMan settings, sent as an Authorization: Bearer header. The open-source client is documented at knowman-mcp on GitHub.
The documented Claude Code command for the API key option is: claude mcp add --transport http knowman https://api.knowman.io/mcp --header "Authorization: Bearer <key>"
Replace <key> with a key from your KnowMan settings, then ask Claude Code to search or save, for example "search my KnowMan for ..." or "save this URL".
Questions people ask
Does Claude Code remember between sessions?
Two separate mechanisms, not one, carry knowledge across Claude Code sessions: CLAUDE.md instruction files you write and auto memory notes Claude writes. Both are loaded at the start of every conversation. See the Claude Code memory guide.
How much of MEMORY.md loads at startup?
Only the first 200 lines, or the first 25KB, whichever comes first. Topic files are not loaded at startup, Claude reads them on demand. Source: Claude Code memory guide.
Where is auto memory stored?
Auto memory lives in a project-specific directory at ~/.claude/projects/<project>/memory/. The directory holds a MEMORY.md index and one topic file per memory, and worktrees and subdirectories in the same repo share it. Source: Claude Code memory guide.
Does Claude Code memory sync across machines?
No. Auto memory is machine-local, and files are not shared across machines or cloud environments. Source: Claude Code memory guide.