What happens to your code and data when you use Claude Code

By: Irina Shvaya | October 14, 2026
This article is part of our Claude Code Guide: what Claude Code is, how to use it safely on a business website, and how to budget for and choose help. Want it set up for your team? See Claude Code consulting.

When you use Claude Code, the code, files and prompts it works with are sent to Anthropic so the model can answer. What happens next depends mostly on one thing: which kind of account you signed in with. On a Team, Enterprise or API account, Anthropic says it does not train its models on your Claude Code data unless your organization opts in, and standard retention is 30 days. On a Free, Pro or Max account, your data can be used for training when a setting in your account is on, and retention is 30 days with that setting off or 5 years with it on.

There are also copies you control: Claude Code keeps session transcripts on your own computer in plain text for 30 days by default, and anything you send with the feedback commands is kept for 5 years. This guide walks through each of these as of October 2026, so you can pick the right plan for a business website and set up your machine sensibly. It describes Anthropic's published terms; it is not legal advice, and anything involving regulated or contractual data belongs in front of your counsel.

Key Takeaways

  • Team, Enterprise and API accounts are under Anthropic's Commercial Terms, which say "Anthropic may not train models on Customer Content from Services." Free, Pro and Max accounts are under the Consumer Terms.
  • On Free, Pro and Max, data is used for training "when this setting is on (including when you use Claude Code from these accounts)." Retention is 30 days with the setting off and 5 years with it on.
  • Even with training turned off, the Consumer Terms say Anthropic will still train on material you send as feedback or material flagged for safety review.
  • Claude Code stores transcripts locally in plaintext under ~/.claude/projects/ for 30 days by default. The cleanupPeriodDays setting changes that.
  • Transcripts sent with /feedback, /bug or /share are retained for 5 years.
  • Zero data retention (ZDR) for Claude Code is offered to qualified Claude for Enterprise accounts, and separately as an arrangement for Console API keys in commercial organizations. Neither is self-serve: Anthropic enables it after an eligibility check.

What leaves your machine in a normal session

Claude Code runs on your computer, but the model does not. Anthropic's data usage page puts it plainly: "To interact with the LLM, Claude Code sends data over the network. This data includes all user prompts and model outputs, encrypted in transit via TLS 1.2+." In practice that means your instructions, the parts of files Claude reads, command output it looks at, and its replies.

A few other things travel too, and it helps to know which are optional:

  • Usage metrics (latency, reliability, usage patterns). Anthropic says these "never include your code, prompts, or file paths." You can turn them off with DISABLE_TELEMETRY=1.
  • Error reports about Claude Code's own internals. Known patterns of secrets, file paths and email addresses are redacted before sending. These are on only for Pro and Max sign-ins that connect directly to the Claude API, and can be turned off.
  • A web safety check. Before fetching a URL, Claude Code sends only the hostname, not the page or path, to Anthropic to check it against a blocklist.
  • Feedback, if you choose to send it. More on that below, because it has the longest retention.

On Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry and Claude Platform on AWS, telemetry, error reports and bug reports are off by default, and your cloud provider's data terms apply to the model traffic.

Training: the rule depends on your plan

The answer is a plan decision, not a setting buried in Claude Code.

Account typeTerms that applyTraining on your Claude Code data
Free, Pro, MaxConsumer TermsYes when the training setting is on; you can change it at any time
Team, EnterpriseCommercial TermsNo, unless your organization opts in to a program such as the Development Partner Program
Claude API (Console key)Commercial TermsNo, unless your organization opts in
Bedrock, Agent Platform, FoundryYour commercial agreementNo, per Anthropic's commercial policy; the provider's own terms also apply

Two details are easy to miss. First, the Free plan does not include Claude Code at all, so the realistic consumer options are Pro and Max. Second, the Consumer Terms add a carve-out: even if you opt out, Anthropic "will use Materials for model training when: (1) you provide Feedback to us regarding any Materials, or (2) your Materials are flagged for safety review." For commercial accounts, Anthropic's Claude Code page says it does not train on code or prompts "unless the customer has chosen to provide their data to us for model improvement," and names the Development Partner Program as the example; an organization admin has to opt in explicitly.

If you use Pro or Max for client or company work, check the setting at claude.ai/settings/data-privacy-controls and record what you chose. For a team, the cleaner answer is a Team or Enterprise plan, where the commercial terms apply to everyone. Our guide to Claude Code pricing and plans compares the plans and prices as of October 2026.

How long Anthropic keeps it

DataRetention, as published October 2026
Consumer, training setting off30 days
Consumer, training setting on5 years
Commercial (Team, Enterprise, API), standard30 days
Commercial with ZDR enabledNot stored after the response, except where needed to comply with law or combat misuse
Reports sent with /feedback, /bug or /share5 years
Transcripts shared after the "How is Claude doing?" surveyUp to 6 months
ZDR sessions flagged for a policy violationUp to 2 years
Enterprise with the Compliance API on: captured Claude Code sessions6 years by default, or your organization's custom retention period; 30 days with HIPAA readiness

The Compliance API row needs a word of explanation. On Claude Enterprise with the Compliance API turned on, Anthropic's Compliance API documentation says local Claude Code sessions are captured server-side for your admins to retrieve, and that nothing masks credentials or personal data in that content. Sessions under ZDR aren't captured, and a custom conversation retention period set in the organization's data and privacy settings replaces the 6-year default.

The feedback row matters for website work. The data usage page says that when you run /feedback, "a copy of your conversation history including code is sent to Anthropic." If a session touched customer records, don't send it as feedback. An organization can turn the command off with DISABLE_FEEDBACK_COMMAND=1. The session survey works differently: answering it records only your rating, and a transcript is uploaded only if you pick "Yes" on the separate follow-up question.

The copy on your own computer

Claude Code "clients store session transcripts locally in plaintext under ~/.claude/projects/ for 30 days by default to enable session resumption." Those transcripts contain whatever Claude read and wrote, which can include file contents and command output.

One exception: transcripts of sessions started or last continued in Claude Desktop or Cowork are exempt from that 30-day limit by default. That has practical consequences:

  1. Disk encryption and screen locks matter. A stolen, unencrypted laptop exposes recent sessions.
  2. Backups copy transcripts too. Check whether your backup or sync tool picks up the .claude folder.
  3. Set a retention period that matches your policy. The cleanupPeriodDays setting changes the 30-day default. In a company, an admin can set it in managed settings so every machine uses the same number.
  4. Offboarding includes the machine. When a contractor leaves, their local transcripts of your project stay on their computer unless your agreement says otherwise.

Memory files are separate. Auto memory, the notes Claude writes for itself, is stored under ~/.claude/projects/<project>/memory/ on the same machine and isn't shared across machines.

Cloud sessions and the web

A cloud session runs in an Anthropic-managed virtual machine instead of on your computer. Anthropic says your repository "is cloned into the session's isolated VM," and Anthropic "stores the session transcript so you can return to the session later." Code and session data follow the same retention and training rules as your account type, GitHub credentials are stored encrypted and never enter the VM, and you can delete a cloud session at any time. If you want everything to stay local, use the terminal, desktop app or IDE extension instead. Surfaces are compared in our guide to terminal, desktop, web and IDE.

Zero data retention, and what it doesn't cover

ZDR means prompts and responses in Claude Code sessions "are processed in real time and not stored by Anthropic after the response is returned, except where needed to comply with law or combat misuse." It is available "to qualified accounts on Claude for Enterprise," it "is not included in the standard Claude for Enterprise plan and cannot be enabled from your admin settings," and it is turned on per organization by Anthropic after an eligibility check.

Read the exclusions before you rely on it. According to the ZDR page, it doesn't cover chat on claude.ai, Cowork, admin data such as account emails, or "Data processed by third-party tools, MCP servers, or other external integrations." Sessions where a developer signs in with a personal account or another organization's key are not covered either, which is why admins pair ZDR with managed settings that force sign-in to the right organization (see managed settings and admin controls). Several features that need stored data, including cloud sessions, Remote Control and feedback, are switched off under ZDR.

Third-party tools are a separate data flow

Anthropic's terms stop at Anthropic. When Claude Code calls an MCP server, a plugin, a CLI that talks to your host, or a browser extension, the data that goes to that service is governed by that vendor's terms. Anthropic says it "does not security-audit or manage any MCP server." Before connecting your CMS, analytics or CRM, read that vendor's data terms and connect with the narrowest access that does the job.

A privacy setup for a business website team

  1. Choose commercial terms for company work. Team or Enterprise for people, Console keys for scripts.
  2. Decide what data may enter a session. Source code and public content are one thing; customer lists, form submissions and health or payment data are another. Use copies with fake or removed personal data where you can.
  3. Keep secrets out. Deny Claude read access to environment files and never paste keys into prompts. Our guide to keeping API keys and passwords away from Claude Code has the settings.
  4. Set local retention with cleanupPeriodDays and make sure laptops are encrypted. The basics of device and account hygiene are in our website security checklist.
  5. Write down the feedback rule: no /feedback from sessions that touched personal data, or turn the command off.
  6. List every connected tool and the vendor terms that apply to it.
  7. Re-check the pages above when terms change. Anthropic's terms and docs are dated; note the dates you relied on.

If you serve EU or UK visitors or clients, the data protection side is covered in GDPR and client data. For the overall safety picture, start with whether Claude Code is safe for a live website.

Conclusion

Claude Code's privacy story is mostly decided before the first prompt: commercial plans keep your code out of training by default and keep standard data for 30 days, consumer plans depend on a setting, and your own laptop holds a plaintext copy either way. Choose the plan on purpose, keep personal data and secrets out of sessions, set local retention, and treat every connected tool as its own data flow. Have counsel review anything that involves client or regulated data. If you want help setting up plans, managed settings and data rules for your team, that is part of our Claude Code consulting. More guides are in our Claude Code Guide.

Frequently asked questions

Does Anthropic train on my code if I use Claude Code on a Pro plan?

It can. On Free, Pro and Max, Anthropic trains on your data when the training setting is on, including Claude Code use. You can turn it off at claude.ai/settings/data-privacy-controls. Even then, the Consumer Terms say feedback you send and material flagged for safety review can still be used for training.

Is my code private on a Team or Enterprise plan?

Under the Commercial Terms, Anthropic says it may not train models on your content, and standard retention is 30 days. That is not the same as "never stored": standard retention is 30 days unless you have ZDR, Enterprise organizations using the Compliance API keep captured sessions longer, and anything sent to third-party tools follows their terms.

Where does Claude Code keep my conversation history?

On your computer, in plaintext under ~/.claude/projects/, for 30 days by default. Change the period with the cleanupPeriodDays setting, and delete cloud sessions from the web interface if you used them.

Can I get zero data retention on a small business plan?

Not on Pro, Max or Team as of October 2026. ZDR for Claude Code is offered to qualified Claude for Enterprise accounts, and Anthropic's API docs describe a separate ZDR arrangement for Console API keys in commercial organizations. Either way Anthropic enables it after confirming eligibility, so contact its sales team to ask.

Is it safe to send a session to Anthropic with /feedback?

Only if the session contains nothing sensitive. The report includes your conversation history and code and is kept for 5 years. If the session touched customer data or credentials, describe the problem in a new, clean session instead.

Put this into action with eSEOspace

We help businesses grow with seo, geo & aeo that actually performs. Explore the services behind this guide:

Book a free strategy call →

Get a FREE Audit

We'll perform a comprehensive SEO, AEO, GEO & CRO audit of your website — completely free — and show you exactly how to outrank your competitors.

Don't have a site yet? Get in touch →

Get a FREE GEO/AEO/SEO Audit

We'll analyze your site's SEO, GEO, AEO & CRO — completely free — and show you exactly how to get found across Google and AI answers.

Don't have a site yet? Get in touch →

You Might Also like to Read