What does Claude Code remember, and what can the next teammate still not see?
Claude Code remembers two layers: the instruction files you write (CLAUDE.md or AGENTS.md, plus optional .claude/rules/) and the auto memory it writes for itself from your corrections and from project context it cannot d
Claude Code remembers two layers: the instruction files you write (CLAUDE.md or AGENTS.md, plus optional .claude/rules/) and the auto memory it writes for itself from your corrections and from project context it cannot derive from the code. What a teammate can see is whatever you commit to the repository, and, in some organizations, a managed policy file installed on each machine. The main session's auto memory lives under ~/.claude/projects/ on that machine; Anthropic's docs call it machine-local and say the files are not shared across machines or cloud environments.
This is an operational map of those layers, based on Anthropic's current memory documentation, How Claude remembers your project. It is not a rewrite of the argument that a memory only one agent can see is not project memory yet, or that if a fresh session can't see it, it isn't project context yet. Those tests still apply. The question here is more specific: which of Claude Code's stores actually travel to the next checkout?
What Claude Code actually remembers
Every Claude Code session starts with a fresh context window. Persistence comes from files the product loads, not from the previous chat still being open.
Instruction files you write
CLAUDE.md files are markdown instructions you author. Claude reads them at the start of every session. If the repository already uses AGENTS.md, Claude Code can read that instead of, or in some configurations alongside, CLAUDE.md. Direct AGENTS.md loading requires Claude Code v2.1.277 or later; some sessions still cannot load it directly, in which case the docs recommend importing it from a CLAUDE.md.
Anthropic describes four scopes, loaded from broadest to most specific:
| Scope | Typical location | Who it is for | Who else sees it |
|---|---|---|---|
| Managed policy | A system path such as /Library/Application Support/ClaudeCode/CLAUDE.md on macOS, /etc/claude-code/CLAUDE.md on Linux and WSL, or C:\Program Files\ClaudeCode\CLAUDE.md on Windows |
Organization-wide guidance | Users on machines where IT has installed it |
| User instructions | ~/.claude/CLAUDE.md |
Your preferences across projects | Only you, on that machine |
| Project instructions |
./CLAUDE.md or ./.claude/CLAUDE.md, or AGENTS.md when it loads |
Team-shared rules for the repo | Anyone who has the committed file |
| Local instructions | ./CLAUDE.local.md |
Your preferences in this project; the docs say to add it to .gitignore
|
Only you |
For larger projects, .claude/rules/ can hold topic- or path-scoped rules so the always-loaded brief does not have to carry every procedure. Project rules that you commit travel with the repo the same way a project CLAUDE.md does. User-level rules under ~/.claude/rules/ do not.
These files are context, not enforced configuration. Claude treats them as guidance. If you need to block an action regardless of what Claude decides, the docs point to a PreToolUse hook or managed permission settings, not to a longer CLAUDE.md.
A useful habit, also from the official page: keep the always-loaded file to facts every session should hold: build commands, conventions, layout, βalways do Xβ rules. If you are restating the same correction you typed last session, or a new teammate would need the same fact to be productive, it belongs in an instruction file you actually share. If the entry is a multi-step procedure or only matters in one part of the tree, a skill or a path-scoped rule is the better home. That split is why a new session shouldn't have to rediscover the project by stuffing the whole map into the brief, or by copying it into skills that then go stale.
To see what loaded, run /context all and check the list under Memory files. /memory opens the instruction files and the auto-memory toggle from inside a session.
Auto memory Claude writes
Auto memory is the other layer. You do not maintain it as a document. As it works, Claude can save notes for itself, tagged in frontmatter as:
-
user: your role, expertise, and working preferences -
feedback: corrections you give and approaches you confirm -
project: ongoing work, deadlines, and decisions Claude cannot derive from the code or from git history -
reference: where to find information outside the project, such as an issue tracker or dashboard
Claude is supposed to skip anything it can already derive from the codebase, and anything your CLAUDE.md files already say. It does not write a note every session; it decides whether the information would be useful later.
Auto memory is on by default in local sessions. You can toggle it with /memory, set autoMemoryEnabled in settings, or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. In a self-hosted environment, outside Claude Tag sessions, the docs say it starts off by default.
Each project gets a directory at ~/.claude/projects/<project>/memory/. The <project> path is derived from the git repository, so all worktrees and subdirectories of the same repo on that machine share one auto-memory directory. The directory holds a MEMORY.md index and one topic file per memory. At session start, Claude loads the first 200 lines or 25KB of MEMORY.md, whichever comes first. Topic files are read on demand, not injected in full at startup.
The official wording on the boundary is direct: auto memory is machine-local. Files are not shared across machines or cloud environments.
What can travel with git
The shared layer is whatever lives in the repository, plus whatever an administrator installs as managed policy.
That usually means:
- a project
CLAUDE.mdor.claude/CLAUDE.md - an
AGENTS.mdthat other tools already read - committed rules under
.claude/rules/ - other checked-in docs those files point at
It does not mean CLAUDE.local.md, ~/.claude/CLAUDE.md, or the main session's auto memory. Those stay with the person, or with the machine.
If you want one instruction file that Claude Code, Codex, and other tools can share, Anthropic's own guidance is to keep AGENTS.md as that file. When Claude is not reading AGENTS.md directly, put an @AGENTS.md import in a CLAUDE.md next to it, and add Claude-specific notes below the import. A symlink can work, but the docs warn against it on Windows clones unless you know the symlink will survive checkout.
The default loading rule is easy to miss
By default, Claude Code uses claude-md-or-agents-md. It reads your AGENTS.md only when there is no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in the working directory or above it. Your user-level ~/.claude/CLAUDE.md, a managed policy file, and .claude/rules/ do not trigger that skip.
The practical trap: a teammate adds a personal CLAUDE.local.md in a repo that relies on AGENTS.md, and Claude stops reading AGENTS.md for them. The official fix is to set Project instructions to claude-md-and-agents-md if you need both, or to import AGENTS.md from the CLAUDE.md you actually want loaded. Confirm with /context all. A file the next teammate committed is not shared in practice if the next session never loads it.
A documented exception: subagent project memory
The main conversation's auto memory is not the same as a subagent's memory. The memory docs say the main session's auto memory is not loaded into subagents, except for a fork. A subagent can have its own auto-memory directory, enabled with a memory field in the subagent configuration.
According to the subagent documentation, memory: project stores that subagent's notes under .claude/agent-memory/<name>/, and the docs describe that location as shareable via version control. memory: user stays under ~/.claude/agent-memory/; memory: local is project-specific and should not be checked in. If auto memory is turned off, the memory field has no effect.
This is a real, documented way for notes Claude writes to enter git. It is still that subagent's auto memory: an index Claude maintains, loaded with the same 200-line / 25KB cap on MEMORY.md. It is not a substitute for a reviewable record of project decisions, and it is not visible to Codex or to a teammate who is not running that subagent.
What the next teammate, or another machine, still cannot see
After you push the instruction files, a surprising amount is still private.
-
The main session's auto memory. It stays under
~/.claude/projects/on that machine. Worktrees on the same checkout share it; a laptop, a cloud environment, or a teammate's clone does not. If Claude saved aprojectnote about a deadline or a decision it could not see in git history, the next person will not have that note unless someone also wrote it down somewhere shared. -
Your user
CLAUDE.mdand user rules. Preferences that live in the home directory apply to every project you open, and to no one else. -
CLAUDE.local.md. That is the point of the file. If a sandbox URL or a local fixture path is only in that file, the next teammate's agent will not see it, and should not. -
A correction that stayed in the chat. Official docs are explicit that conversation-only instructions do not survive
/compactunless you add them toCLAUDE.md(or, for a personal lesson, unless auto memory captured them). Auto memory capturing them still does not share them. -
The other tool's store. Codex does not read Claude Code's auto memory. Codex has its own local memory store under the Codex home directory, and OpenAI's docs tell you to keep required team guidance in
AGENTS.mdor checked-in documentation. That split is the subject of A memory only one agent can see is not project memory yet; the operational consequence is simple: do not treat~/.claude/projects/.../memory/as the project record.
A useful test is the one in If a fresh session can't see it, it isn't project context yet: open a session that never had the original conversation, on another machine or under another account. If that session cannot reconstruct the current decisions, constraints, and reasons, you still have personal or conversational memory, not shared project context.
How to decide where a fact should live
The official CLAUDE.md versus auto memory table is a good starting point: you write instructions and rules; Claude writes learnings and patterns. For a team, add a third question: does the next checkout need this?
- A preference that only matters in Claude, on your machine, such as how you like diffs or a personal shortcut, can stay in user or local instructions, or in auto memory.
- A rule every session in this repo should follow belongs in a committed
CLAUDE.mdorAGENTS.md, or in a scoped rule file, not only in a note Claude saved for itself. - A decision, constraint, or piece of project background the next session will need should not have its only home in auto memory. Claude's own
projecttype is for facts it cannot derive from the code or from git history. Those are often exactly the facts a teammate's agent will also lack, unless they live in a shared, reviewable place. - Do not copy the same decision into
CLAUDE.md,AGENTS.md, and a private memory file βjust in case.β The copies will drift. That is the failure described in One home per rule: write it once, and point the brief at that home.
/memory is the right tool for inspecting what Claude has stored. Promoting a fact into the shared brief should be a deliberate edit, reviewed like any other change to the repo.
A reviewable project brain is a different layer
Instruction files tell an agent how to work in the repository. Auto memory helps one Claude Code user on one machine accumulate learnings. Neither is a full project record: a current answer, plus the trail that produced it, in a form the next person can read and correct.
That is the job of a project brain: Markdown that holds background, decisions, and constraints, and that an agent can read before the next task starts. The open convention is brain.md; the product form is MindMux's Project Brain. A local Brain can live with the repo as ordinary Markdown; a Cloud Brain is the same kind of memory, kept in a Cloud Project you can share or connect from a coding agent. The CLI is @mindmux/cli (mmx, mmx setup). Related open tooling lives in @mindmux/brain-md.
This article is not a setup walkthrough. The point here is narrower: commit the rules the team needs; do not expect auto memory to travel with them; keep the decisions the next teammate must see in a place that teammate can actually open.
FAQ
Does committing CLAUDE.md share auto memory?
No. A project CLAUDE.md or AGENTS.md shares the instructions you wrote and committed. The main session's auto memory stays under ~/.claude/projects/ and is not shared across machines or cloud environments.
If the repo already has AGENTS.md, will Claude Code read it?
Only under the default rule if there is no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md in the working directory or above it, and only in sessions that support direct AGENTS.md loading (v2.1.277 or later). If a CLAUDE.md is present, import @AGENTS.md or set Project instructions to load both, then confirm with /context all.
Can a teammate on another machine see what my subagent learned?
Only if that subagent used memory: project, the files under .claude/agent-memory/ were committed and pulled, and the teammate actually runs that subagent with auto memory on. Main-session auto memory still does not travel.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.