Is Claude Code private? What Anthropic sees, keeps and trains on

What leaves your machine in a Claude Code session, how long Anthropic keeps it, when it trains on it, and what stays on your disk.

· 6 min read

"Is Claude Code private?" has no yes-or-no answer, because it depends on two things you control: which account you use, and what you let Claude read. Claude Code runs on your machine, but the model doesn't. Every answer means sending your prompt and what Claude read to Anthropic. What happens to that data next depends on your plan, one privacy setting, and a few habits. Here is the whole picture, from your terminal to Anthropic's servers and back to your disk.

#What does Claude Code send to Anthropic?

Everything the model needs to answer, which is more than your prompt. In a session, Claude Code sends:

  • Your messages and the model's replies.
  • File contents Claude reads, in full or in part.
  • Command output from what Claude runs: test results, logs, git diff.
  • Instruction files it loads, such as your CLAUDE.md.
  • The system prompt, tool definitions and request parameters.

It goes over the network encrypted in transit (TLS 1.2 or later). On Anthropic's API, data at rest sits on disks with AES-256 encryption. A useful way to think about it: anything that passes through a tool goes to the model. A file Claude never opens stays on your disk. A file it opens, or a command whose output it reads, doesn't.

Separate from the work itself, Claude Code also sends usage metrics and error reports by default, which carry no code or prompts. They're covered, with the switches that turn them off, in Does Claude Code send telemetry?.

#Does Anthropic train on your code?

It depends on whether you're on consumer or commercial terms.

AccountTraining on your Claude Code sessions
Free, Pro, Max, Ultra (consumer)Only if your "help improve Claude" setting is on. It's your choice, and it covers Claude Code used from these accounts
Team, Enterprise, API, third-party platforms such as Amazon Bedrock (commercial)No. Anthropic doesn't train generative models on code or prompts sent to Claude Code under commercial terms
Commercial org in the Development Partner ProgramYes, for what the org's admin explicitly chose to provide

On a consumer plan, check the setting at claude.ai/settings/data-privacy-controls. You can change it at any time. On a commercial account, training only happens if your organization opted in on purpose.

Two kinds of data follow their own rules:

  • Feedback you send with /feedback, /bug or /share includes the conversation, code too, and is kept for 5 years.
  • A transcript you share after the session survey (only if you answer Yes) is kept for up to 6 months, and Anthropic says it can't be used to train its models.

#How long does Anthropic keep your sessions?

AccountRetention
Consumer, training setting on5 years
Consumer, training setting off30 days
Commercial (Team, Enterprise, API), standard30 days
Claude for Enterprise with zero data retentionNo server-side persistence

Zero data retention (ZDR) isn't part of the standard Enterprise plan. Anthropic's account team turns it on per organization, after confirming eligibility. Organizations with ZDR also never see the transcript-sharing question after the survey.

The fastest privacy improvement for a solo developer on Pro or Max is the training setting. Turned off, your sessions are kept for 30 days instead of 5 years and aren't used for training.

#Are Remote Control and cloud sessions different?

Yes, because they store more on Anthropic's side:

  • Remote Control runs the session on your machine, so the data flow is the same as a local session. But while you're connected, the transcript is also stored on Anthropic's servers to sync it across your devices.
  • Cloud sessions (Claude Code on the web) run in a virtual machine Anthropic manages. Your repository is cloned into it, and Anthropic stores the transcript so you can come back to it. GitHub credentials are stored encrypted on Anthropic's servers and never enter the VM. Retention follows your account type, and you can delete a cloud session at any time.

If you want the fewest copies, a local session on a commercial account, or on a consumer account with training off, is the smallest footprint.

#What does Claude Code keep on your own disk?

More than most people expect, all in plain text. Under ~/.claude/projects/<project>/ there's one .jsonl transcript per session. It holds your messages, tool calls, tool results (file contents, command output, pasted text), plus the system prompt and request parameters. Next to it, ~/.claude/file-history/ keeps pre-edit snapshots of files Claude changed, for checkpoint restore.

These are deleted after 30 days by default. Change the period in ~/.claude/settings.json:

{
  "cleanupPeriodDays": 7
}

The minimum is 1 day. The deletion runs quietly in the background after a session starts, so a session older than the limit can no longer be resumed. That's the trade: shorter retention means fewer copies of your code on disk, and fewer sessions to pick back up.

Remember that your disk is part of the picture. Full-disk encryption (FileVault on a Mac) and a backup that excludes ~/.claude if you don't want transcripts in it matter as much as any setting.

#How do you keep things out of Claude's context?

The data you never send can't be kept, trained on or leaked. Three habits do most of the work:

  1. Deny reads of secret files. Permission rules stop Claude's file tools from opening them:

    {
      "permissions": {
        "deny": ["Read(./.env)", "Read(./secrets/**)"]
      }
    }
  2. Use keys by name, not by value. Environment variables let Claude call an API without the key ever showing up in a tool result. Claude Code and API keys covers the details, including the sandbox and what a Read rule doesn't stop.

  3. Don't paste what you wouldn't email. A customer list pasted "just to try" is in the transcript and sent to the model like anything else.

#So, is Claude Code private?

Private enough for most work, once you've made three choices on purpose:

ChoiceMost private option
AccountCommercial terms, or consumer with training off
Where it runsLocal sessions, not cloud
What Claude readsSecret files denied, keys used by name

Add telemetry off if you want nothing but the model calls on the wire. What no setting can change is that the model runs at Anthropic: whatever Claude reads goes there to be answered. The privacy question is really about what happens after, and for how long. On commercial terms or with training off, the answer is 30 days and no training.

#In Relais

Relais is a Mac app built on Claude Code, and it adds nothing to what leaves your machine. The app has no analytics, no telemetry and no crash reporting of its own, and the website sets no cookies and loads no analytics, ads or trackers. Relais starts the Claude Code on your Mac, under your own Claude account, and sends nothing to Anthropic itself. Claude Code sends what it always sends, under your account and Anthropic's terms, so the training setting and retention above apply as they do in a terminal. Sessions are plain Claude Code sessions in ~/.claude/projects, and your user, project and local settings load in them, so cleanupPeriodDays, your deny rules and your env block apply in Relais too.

Your code, files and transcripts stay on your Mac. API keys live in the macOS Keychain, in the Vault, and reach agents as environment variables, never printed. What reaches Relais's server is your account (email, name and subscription status; Mollie handles the card) and update checks. If you join a team, your messages, pages, presence and what you choose to share go too. A Token burn page goes up only if you share one. See how Relais keeps your work private, the privacy policy, what happened with T3 Code's telemetry, and how to see what a Mac app sends home.

Your AI team,
on your Claude plan.

$14.99 a month, everything included. On your Mac or on Linux, on your Claude Pro or Max plan. Cancel any time.