All Agent Engineering

Claude Code auto memory: shared directories and loading limits

Inspect auto-memory storage, MEMORY.md load limits and toggles; separate instructions, topic files and worktree sharing.

AINavWritten / Updated
On this page

At a glance

The goal is to locate auto memory and understand what loads at session start. The official memory page was checked and original settings fixtures inspected locally. User memory was not read, settings were not changed and Claude Code was not started. Statements follow the documentation at this verification date.

Runtime and applicability

Article type
Spec file
Verified
Applies to
  • Claude Code Applies to Claude Code as documented; version, model and environment prerequisites are stated in the body.

File locations

PathScopeHow it is read
~/.claude/projects/<project>/memory/MEMORY.mdMachine-local auto-memory index associated with a repository.At session start, the first 200 lines or 25KB of the index load, whichever comes first; topic files are read on demand.

When to use

  • When the same memories appear across worktrees, or the latter part of an index does not load automatically.

When not to use

  • For stable instructions shared with other machines or cloud environments, do not treat local auto memory as synchronization.

One repository shares a local directory

The default directory is ~/.claude/projects/<project>/memory/. The project path is derived from the Git repository, so its worktrees and subdirectories share one auto-memory directory; non-Git projects use the project root. Memory is machine-local and not shared with other machines or cloud environments. Separate editable worktrees therefore do not isolate this memory. Keep MEMORY.md distinct from maintained CLAUDE.md instructions.

The index loads automatically; topics load on demand

MEMORY.md indexes the directory. Session startup loads its first 200 lines or 25KB, whichever limit comes first. Beyond-limit content does not load at startup, and topic files are not all preloaded; Claude reads them using file tools as needed. This limit is specific to MEMORY.md and cannot be applied to every CLAUDE.md. Move detail into topic files near the limit; file existence does not establish that its content loaded.

Inspect the toggle and directory separately

The docs provide autoMemoryEnabled: false to disable project auto memory and CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 as an environment variable. autoMemoryDirectory must be absolute or start with ~/ and can come from different settings scopes; repository-supplied settings are affected by workspace trust and relevant read restrictions. Only the JSON field types were checked here; settings were not applied. Disabling auto memory does not establish deletion of existing files.

Inspect the source before correcting memory

The local fixture models line/byte limits and directory type and does not reproduce Claude Code’s actual truncation algorithm. Use /memory to inspect the current directory and toggle, then identify index, topic file or project instructions. The docs say background sessions and sessions launched by another session may not re-enable memory through the toggle; changing directories repeatedly is not a remedy. Stop writing if sources contain sensitive data, projects share an unintended directory or loading is unclear, and inspect the preserved files.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. Anthropic · How Claude remembers your project

Found an error? Tell us →