Where does Claude Code memory go, and who can read it?

Published · Updated

Claude Code writes memory to plain Markdown files on your own disk, under ~/.claude/projects/<project>/memory/, and anyone or anything running as your user can read them. Nothing in that directory is synced to a shared place by Claude Code itself. The files are also loaded into the prompt, so their contents go to the model provider like any other context. Codex and Copilot differ, and Copilot's differ most, because its repository facts are shared with collaborators.

The vendor docs cited here were current on 10 November 2026. Read the output of the scan below before you paste it anywhere.

Claude Code

The auto memory docs say the project directory is derived from the git repository, so every worktree and subdirectory of one repo shares a single memory folder. It holds MEMORY.md, an index, plus one topic file per memory. The docs state that the files are not shared across machines or cloud environments.

Auto memory is on by default in local sessions. You can switch it off with autoMemoryEnabled, which /memory toggles, or with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. You can move the folder with autoMemoryDirectory. A moved folder can end up inside a synced directory, which then makes it as readable as that directory is.

The memory files are not the only place instruction text lands. The docs say transcripts are plaintext and that "OS file permissions are the only protection", and that a transcript may include the instruction files that were loaded, CLAUDE.md among them. Anything in your CLAUDE.md is therefore also in your session history. For the wider picture of what those transcripts hold, see secrets in Claude Code transcripts, where Claude Code stores sessions and the guides index.

On deletion, the docs say the retention sweep excludes memory files. claude purge <path> deletes a project's transcripts and its auto memory together, and takes --dry-run first. Before v2.1.288 that command was claude project purge. Run the dry run before the real one.

The docs do not say what file mode Claude Code gives memory files, so check yours with the commands below instead of assuming.

Codex

Codex memories are off by default. The config reference lists features.memories as "off by default", with the memory settings in a memories table. Three of those settings are about scope: memories.generate_memories defaults to true, memories.use_memories defaults to true, and memories.disable_on_external_context defaults to false. When that last one is switched on, threads that used MCP, web search or tool search are left out of memory generation.

The reference also gives a memories.max_rollout_age_days default of 30, so by default only sessions from the last 30 days are considered. The memories page says Codex stores them under the Codex home directory: fresh profiles use $CODEX_HOME/memories_v2/, and an existing $CODEX_HOME/memories/ keeps being used unless memories.version is set. The files are generated summaries and evidence from earlier chats, and the page advises reviewing them before you share your Codex home directory.

One GitHub issue deserves a careful reading. In openai/codex#41711, a single reporter says a memory-generation session on Windows build 0.150.0-alpha.12.2 sent a prior rollout from a non-OpenAI provider to OpenAI. It has two comments, neither from a maintainer, as of 10 November 2026. Treat it as an unconfirmed report, and if you use more than one provider, the disable_on_external_context setting and a look at your own network traffic are the sensible response.

Copilot

Copilot Memory is the one that is shared by design. Repository-level facts are visible to collaborators, and user-level preferences follow you between repositories. By default a fact expires after 90 days without reinforcement. Enterprise and organization owners can set 7 to 180 days for repository facts, and the shorter value wins if both levels set one.

Viewing repository facts needs write access, in the repository's settings. Organization and enterprise owners can export user-level preferences. The docs also say anyone who can view a shared agent session where a preference appears can see it.

Two issues show where this goes wrong. In github/copilot-cli#2278 a user audited roughly 310 repository memories and judged about 65 percent accurate, with about 50 duplicates of a single rule and one that told the agent to run shell commands without discussion. In github/copilot-cli#3945 a user reports a fresh repository surfacing facts from a similarly named one, with no reproduction steps. Both are open and both are single reports.

Where each tool keeps it

ToolDurable contextShared with othersDefault
Claude Code~/.claude/projects/<project>/memory/ plus CLAUDE.mdNot by the tool; CLAUDE.md through GitAuto memory on
Codex$CODEX_HOME/memories_v2/ (memories/ on older profiles)Not documentedMemories off
CopilotGitHub-hosted facts and preferencesRepository facts, yesRepository facts on

Check your own machine

These commands assume H is set to the home directory you want to inspect. Against a scratch directory containing fake keys they behaved as described below.

List what exists:

ls -d "$H"/.claude/projects/*/memory "$H"/.codex/memories* 2>/dev/null

Find memory files any local user can read. On Linux and macOS this prints a path for every file with the world-readable bit set:

find "$H"/.claude/projects/*/memory "$H"/.codex/memories* -type f -perm -004

Scan for common secret shapes, and print only the file and line number, not the match, so the output is safe to share:

grep -rEn --include='*.md' \
  -e 'AKIA[0-9A-Z]{16}' \
  -e '(sk|pk)_(live|test)_[A-Za-z0-9]{16,}' \
  -e '[a-z]+://[^/[:space:]:]+:[^@[:space:]]+@' \
  -e '-----BEGIN [A-Z ]*PRIVATE KEY-----' \
  "$H"/.claude/projects/*/memory "$H"/.codex/memories* \
  | sed -E 's/(:[0-9]+:).*/\1 (match hidden)/'

In that scratch run the permission check flagged the two Claude Code files, which had the default 644 mode, and skipped the Codex file at 600. The scan matched two lines in two files: one holding an AWS-style key and a connection string with a password, and one with a Stripe-style key. A short pattern list will miss tokens it does not know, so a dedicated scanner such as gitleaks covers more.

If something matches, rotate the secret first, then delete the line. Deleting the line does not remove it from transcripts that already quoted it.

Sealkeep

Sealkeep has sealkeep scan <path> to find pasted secrets, and a policy setting, sealkeep scan policy off|record|block-high, that records or blocks them when a session is backed up. Its documentation says secret scanning does not guarantee detection, and the encryption it applies has not been independently audited. It does not manage or edit the memory files of any tool.

FAQ

Does Claude Code send my memory files to Anthropic?

The memory files are loaded into the session as context, so their contents are part of the prompts sent over TLS. The data-usage page gives retention as 30 days for commercial users and for consumers who opt out of training, and 5 years for consumers who allow training (docs checked 2026-11-10).

Can a teammate see my Claude Code memory?

The folder is local, so not through Claude Code. They can see it only if you commit it, sync the directory, or share a machine account.

Is Codex memory on by default?

The config reference shows features.memories as off by default.

How do I delete Copilot memories?

Repository facts are managed in the repository's settings and need write access. Your own preferences are in your personal Copilot settings.

Should I put credentials in CLAUDE.md so the agent can deploy?

Do not. The file is loaded into transcripts and sometimes committed. Point the agent at a command that reads the credential from your secret store at run time.