Does Claude Code train on your code? The setting, the exceptions, and what stays on disk
The Morse teamPublished 9 min read
As of November 2026, Claude Code trains Anthropic's models on your code by default only if you use it from a personal Claude account (Free, Pro, Max, or Ultra) with Help Improve our AI models turned on, apart from the exceptions below. On Team, Enterprise, the API, and cloud platforms such as Amazon Bedrock, Anthropic says it "does not train generative models using code or prompts sent to Claude Code" unless the customer opts in (Anthropic).
We read Anthropic's Claude Code documentation on data usage, the ~/.claude directory, zero data retention, and cloud sessions, its privacy center pages on training, retention, and the training setting, the Development Partner Program page, and the Commercial Terms on November 3, 2026. Anthropic documents Claude Code in more detail than most coding tools, down to the name of every file it writes, and that detail shows several ways your code reaches Anthropic, or stays on your laptop, that have nothing to do with the training switch.
Claude Code training and retention at a glance
| Setting or path | Default | How long it's kept | Source |
|---|---|---|---|
| Help Improve our AI models (personal plans) | Your choice, on the setting's page | Up to 5 years with it on; 30 days with it off | Anthropic |
| Team, Enterprise, and API accounts | No training | 30 days | Anthropic |
/feedback, /bug, and /share reports | Sent only when you run one | 5 years | Anthropic |
| Session transcript shared after the survey | Sent only if you choose Yes | Up to 6 months; never trained on | Anthropic |
| A session flagged under the Usage Policy | Not applicable | Inputs and outputs up to 2 years, safety scores up to 7 years | Anthropic |
| Development Partner Program (organizations) | Off; an admin opts in | Up to 2 years | Anthropic |
Local transcripts in ~/.claude/projects/ | On, in plaintext | 30 days, set by cleanupPeriodDays | Anthropic |
Prompt history in ~/.claude/history.jsonl | On | Until you delete it | Anthropic |
Does Claude Code use your code for training by default?
It depends on how you answered Anthropic's training question. Anthropic's data usage page says it will train new models on data from Free, Pro, Max, and Ultra accounts "when this setting is on (including when you use Claude Code from these accounts)" (Anthropic). The setting is the same one that covers your chats in the Claude app, so a choice you made in a browser in 2025 also decides what happens to the repository you opened in your terminal last week. We cover how that switch was first presented, and the rest of the chat-app story, in is Claude private.
Business accounts start from the other side. Anthropic's Commercial Terms, effective June 17, 2025, say "Anthropic may not train models on Customer Content from Services." The Claude Code page lists Team, Enterprise, the API, third-party platforms, and Claude Gov under that rule (Anthropic). A person paying for Max is still on the consumer terms, however much they pay.
How do you turn off Claude Code training?
Change one setting in the Claude app, then check two habits.
- Help Improve our AI models. On the web or desktop app, open the menu under your name, choose Settings, then Privacy, and toggle off the switch under "Help Improve our AI models" (Anthropic). The direct page is claude.ai/settings/data-privacy-controls. There's no separate switch inside Claude Code.
- Don't send feedback with code in it. A
/feedbackreport carries "a copy of your conversation history including code," and/bugand/sharego through the same path (Anthropic). - Say No to the transcript follow-up. After the session rating, Claude Code may ask whether Anthropic can look at your transcript. Only Yes uploads anything (Anthropic).
Turning training off only works forward. Anthropic says it will "stop using your previously stored chats and coding sessions in future model training runs," but your data "will still be included in model training that has already started" (Anthropic, updated August 3, 2026). Turn it off before you point Claude Code at a private repository.
When does Anthropic keep your code with training off?
In four cases, each on Anthropic's own pages.
- Feedback reports. Transcripts shared through
/feedback,/bug, or/share"are retained for 5 years" (Anthropic). Anthropic says it may use the feedback "to improve our products and services." The feedback dialog lets you include only the current session, the default, or other sessions from the same project over the last 24 hours or 7 days. Some reports also become an issue in Anthropic's public GitHub repository, if you choose. - The survey's follow-up. Choosing Yes uploads "your conversation transcript, any subagent transcripts, and the raw session log file." Anthropic redacts known API key and token patterns, but "source code, file contents, and other conversation content are uploaded as-is," and the upload is kept for up to 6 months (Anthropic). Anthropic says these transcripts "cannot be used to train our AI models."
- Safety flags. If a session is flagged under the Usage Policy, Anthropic keeps "inputs and outputs for up to 2 years and trust and safety classification scores for up to 7 years" (Anthropic). Its training page says flagged conversations can be used even with training off (Anthropic).
- The Development Partner Program. An organization admin can opt in to share "your Claude Code input and output tokens from the first-party Claude API," stored "for up to two years" (Anthropic). Organizations under zero data retention aren't eligible.
The guides ranking for this question on November 3, 2026 get the feedback period wrong or leave it out. ClaudeLog's FAQ, last updated October 24, 2026, says feedback and bug reports are kept for "10 years" (ClaudeLog), and Aurascape's August 2026 answer gives no figure (Aurascape). Anthropic's page says 5 years. Neither guide mentions the transcripts on your own disk.
What leaves your machine in a Claude Code session
Every data flow Anthropic documents for local Claude Code, read on November 3, 2026, with the switch that stops it. All of these are environment variables you can set in your shell or in settings.json (Anthropic).
| What goes out | What it contains | Default when signed in to Claude | How to stop it |
|---|---|---|---|
| Prompts and model outputs | Everything in the conversation, including files Claude reads | Always, over TLS 1.2+ | Can't be stopped; that's how the model answers |
| Usage metrics | Latency and usage patterns; "never include your code, prompts, or file paths" | On, sent to Anthropic and third-party logging | DISABLE_TELEMETRY=1 |
| Error reports | Claude Code's own stack traces, with secrets, paths, and emails redacted | On for Pro, Max, and Ultra from v2.1.198 | DISABLE_ERROR_REPORTING=1 |
/feedback, /bug, /share | Your conversation history, code included | Only when you run one | DISABLE_FEEDBACK_COMMAND=1 |
| Session quality survey | Your rating, and your transcript if you say Yes | On | CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1 |
| WebFetch safety check | The hostname of a URL Claude fetches, not the path | On, with every model provider | skipWebFetchPreflight: true in settings |
One variable, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, turns off the metrics, error reports, feedback, and surveys together, but Anthropic says it doesn't affect the WebFetch check (Anthropic). On Amazon Bedrock, Google Cloud, and Microsoft Foundry, metrics, error reports, and bug reports start off; the survey and the WebFetch check still run.
Does Claude Code store your code on your computer?
Yes, in plaintext, for 30 days by default: Anthropic says Claude Code clients "store session transcripts locally in plaintext under ~/.claude/projects/" (Anthropic). If a tool reads a .env file, "that value is written" to the transcript, and "OS file permissions are the only protection" (Anthropic). We cover what outlasts the 30 days and how to clear it in how to delete Claude chats.
Is Claude Code on the web private?
Less so than the terminal, because the work moves onto Anthropic's machines. A cloud session clones your repository into a virtual machine Anthropic manages, and "Anthropic stores the session transcript so you can return to the session later" (Anthropic). Your GitHub credentials stay encrypted on Anthropic's servers and never enter the VM. Cloud sessions come with Pro, Max, Ultra, and Team (Anthropic).
Sharing is where personal accounts differ. On Pro, Max, and Ultra, a shared session's options are Private and Public, and Public "makes the session visible to any user logged into claude.ai," with repository access checks "not enabled by default" (Anthropic). Anthropic warns that sessions "may contain code and credentials from private GitHub repositories." Team and Enterprise accounts get Team visibility instead, with the checks on. We compare share links across apps in AI chat share links.
Does zero data retention cover Claude Code?
Only for qualified Claude for Enterprise organizations, and only for the terminal. Anthropic says ZDR "is not included in the standard Claude for Enterprise plan" and is turned on per organization by its account team (Anthropic). A developer who signs in with a personal account isn't covered. Under ZDR, cloud sessions, feedback commands, and Remote Control are switched off, and a session flagged for a policy violation can still be kept "for up to 2 years." We explain the term itself in what is zero data retention.
How Morse keeps the code you ask about out of training
Everything above follows from how Claude Code works. It reads your repository on behalf of an Anthropic account, so that account's training answer, Anthropic's feedback and safety records, and a plaintext transcript on your disk all attach to the code it touches. Morse is a chat app, and it doesn't run in your repository. For the questions you'd rather not put through your Claude account, such as a stack trace, a function you can't explain, or a config file with the secrets taken out, it starts from different defaults. Morse doesn't train AI on your content, so there's no switch to find and no second setting for code. The Free plan includes coding, file, and other chat tools.
- Private, for code you'd rather no host keep. New chats open in Private. Morse strips your account, email, and IP address and sends the question to an open-weight model such as DeepSeek, Kimi, or GLM, or to xAI's Grok. Morse has zero data retention agreements with its inference, search, and other providers, so they keep nothing. Where a provider confirms zero retention on each reply, Morse checks it and refuses a reply that doesn't.
- E2EE, for code no one else should read. Your browser checks the enclave's cryptographic proof that it's genuine, then encrypts the message so only that enclave can open it. Morse's servers relay ciphertext they can't read, and the reply is decrypted only in your browser. This rests on the enclave hardware and attestation working as designed. E2EE chats come with Pro, at $19 a month; here's how end-to-end encrypted AI chat works.
- Anonymous, to ask Claude without Anthropic knowing it's you. Morse's proxy sends your message under Morse's own account, with your account, email, and IP address removed. Anthropic sees the code without knowing it's you and may keep it for a limited time to check for abuse, under its own policy, so swap out keys and internal hostnames before you paste. Claude Haiku 5.5 is on the Free plan.
In every mode, your chat history is stored in your browser, encrypted, instead of in a plaintext file under your home folder. It's locked when you sign out and takes two keys to open: one that never leaves your device, and one Morse's server gives you when you sign in. Attached files go with the message and are never stored by Morse, and Morse doesn't sell your data or show ads (Morse privacy policy). Clearing your browser deletes those chats for good, and Morse can't recover them, so copy out any answer you'll need.
Which Claude Code setting to change, by worry
- Your code training a future Claude: turn off Help Improve our AI models before you start, and skip
/feedbackand the transcript follow-up on private work. On Morse, there's nothing to turn off. - Transcripts on your laptop: follow the Claude Code steps in how to delete Claude chats.
- Telemetry: set
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, andskipWebFetchPreflightif hostnames matter too. - A shared cloud session: keep it Private, or turn on repository access checks under Claude Code > Sharing settings.
- A question about code you can't show anyone: ask it in an E2EE chat on Morse, which rests on the enclave hardware and attestation working as designed.
You can start free with no card, and E2EE chats come with Pro.
Common questions
Does Claude Code send your whole repository to Anthropic?
Not in one upload, for a local session. Anthropic says Claude Code sends "all user prompts and model outputs" over the network, and its transcripts record the tool results in each request, so any file Claude reads becomes part of what Anthropic receives. A cloud session is different: Anthropic clones the repository into its own virtual machine.
Does answering "How is Claude doing this session?" share your code?
The rating alone doesn't. Anthropic says it records "only your rating." A separate follow-up asks whether Anthropic can look at your session transcript, and choosing Yes uploads it with source code "as-is," kept for up to 6 months and not used for training.
Does Claude Code train on your code if you sign in with an API key?
No, unless your organization opts in. API keys fall under Anthropic's Commercial Terms, which say "Anthropic may not train models on Customer Content from Services," and the Development Partner Program is the opt-in exception.
Does deleting a Claude Code cloud session delete your code?
Anthropic says deleting a cloud session "permanently removes the session's event data," and it can't be undone. The branch Claude pushed to GitHub stays there, so delete it separately if you don't want it.