Limited time: Save up to 33% on every planView pricing
Voibe Logovoibe Resources
claude codeclaude code privacy settingsenvironment variablesanthropictelemetrydata retentiontraining opt-outdeveloper privacy

Claude Code Privacy Settings: Every Opt-Out & Env Var (2026)

Every Claude Code privacy setting in one place: disable non-essential traffic, feedback survey, training opt-out, and how to delete sessions. Copy-paste ready.

Β· Updated

Every Claude Code Privacy Setting, in One Table

Claude Code has real privacy controls β€” more of them than most AI tools ship. What it doesn't have is a settings screen that shows them to you. The controls are scattered across three places: environment variables, a settings.json file, and one toggle in your claude.ai account that decides whether Anthropic trains on your code.

The short version: set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 to shut off every optional network channel at once, turn off β€œHelp Improve our AI models” at claude.ai/settings/data-privacy-controls if you sign in with a Pro or Max account, and run claude project purge when you want local session transcripts gone. Those three moves cover most of what this page explains.

Everything below was verified against Anthropic's live documentation β€” the data usage page, the environment-variable reference, and the settings reference β€” on August 5, 2026. The full quick-reference table:

SettingWhere it livesWhat it does
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1Env varDisables auto-updates, telemetry, error reporting, /feedback, release notes, availability checks, session surveys, and feature-flag fetching in one flag
β€œHelp Improve our AI models” → offclaude.ai/settings/data-privacy-controlsStops model training on Pro/Max chats and coding sessions; retention drops from 5 years to 30 days
DISABLE_TELEMETRY=1Env varStops operational usage metrics (never includes code, prompts, or file paths)
DISABLE_ERROR_REPORTING=1Env varStops error reports (stack traces, secrets redacted before upload)
DISABLE_FEEDBACK_COMMAND=1Env varDisables /feedback, /bug, and /share (all report through the same path)
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1Env varDisables the β€œHow is Claude doing this session?” survey
CLAUDE_CODE_SKIP_PROMPT_HISTORY=1Env varNever writes session transcripts or prompt history to disk
DO_NOT_TRACK=1Env varCross-tool telemetry opt-out; same effect as DISABLE_TELEMETRY
cleanupPeriodDayssettings.jsonDays local transcripts are kept β€” default 30, minimum 1
skipWebFetchPreflight: truesettings.jsonStops the WebFetch hostname safety check
claude project purgeCLI command (v2.1.124+)Deletes a project's local transcripts, task data, history lines, and state

The rest of this guide walks each surface in the order that matters: the one-flag network kill switch, the individual channels, the training toggle, session deletion, and β€” the part no table can fix β€” what none of these settings change. For the broader question of whether Claude Code is safe to use at all, our Claude Code safety review covers the two-tier consumer-vs-commercial framework this page assumes.

Key Takeaway

Claude Code's privacy controls live in three places: environment variables (network channels), settings.json (local storage and WebFetch), and claude.ai/settings/data-privacy-controls (model training). One env var β€” CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 β€” covers every optional network channel at once.

CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: What It Covers, and What It Doesn't

Animated walkthrough of Claude Code's one-flag privacy move. A terminal types export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 into a shell profile, and five optional channels β€” auto-updates, usage metrics, error reports, the /feedback, /bug and /share commands, and the session-quality survey β€” flip off one by one, with a note that 0 or false still counts as set. A red row stays lit: prompts and code context still go to the model provider, labeled "no flag turns this off β€” that's the product." The closing rule reads: one flag for the side channels, zero flags for the main one.
The one-flag move in motion: every optional channel off in one line, and the one channel no setting touches. Each claim in this figure is stated in the text.

CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is the highest-leverage privacy setting Claude Code has. Per Anthropic's environment-variable reference, setting it to any non-empty value β€œdisable[s] nonessential network traffic: auto-updates, telemetry, error reporting, the /feedback command, release notes, gateway model discovery refreshes, and availability checks such as the fast mode check.” It also disables feature-flag fetching, which makes the Remote Control feature unavailable, and the session-quality survey shuts off with it.

Set it in your shell profile:

# ~/.zshrc or ~/.bashrc
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

Or check it into version control for the whole team via the env block of .claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

Three things this flag does not do:

  • It doesn't touch inference. Your prompts and the relevant code context still go to your model provider β€” that's the product working as designed, covered below.
  • It doesn't stop the WebFetch domain safety check. Before fetching any URL, Claude Code sends the hostname (only the hostname β€” not the full URL, path, or page contents) to api.anthropic.com to check a safety blocklist, cached per hostname for five minutes. The separate opt-out is "skipWebFetchPreflight": true in settings.json β€” pair it with WebFetch permission rules if you use it, since you're turning off a safety check.
  • It doesn't skip official plugin marketplace auto-install. That has its own flag: CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL=1.

Warning

The falsy-value trap: for CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, DISABLE_TELEMETRY, and DISABLE_ERROR_REPORTING, setting the value to 0 or false STILL disables the traffic β€” Anthropic's docs state any non-empty value counts. To re-enable a channel, unset the variable entirely.

Telemetry, Error Reports, and the Feedback Channels, One by One

If you'd rather keep auto-updates and turn channels off individually, these are the four that carry data, what each one sends, and how long Anthropic keeps it β€” all per the data-usage documentation.

  • Usage metrics β€” DISABLE_TELEMETRY=1. Operational metrics (latency, reliability, usage patterns) sent to Anthropic and third-party logging infrastructure. The docs are specific on scope: β€œMetrics never include your code, prompts, or file paths.” Claude Code also honors the cross-tool DO_NOT_TRACK=1 convention with the same effect. Side effect: disabling telemetry also stops feature-flag fetching, which makes Remote Control unavailable.
  • Error reports β€” DISABLE_ERROR_REPORTING=1. Error messages and stack traces from Claude Code's own internals, sent to a third-party error-tracking service. Anthropic states known patterns of secrets, file paths, and emails are redacted before anything leaves your machine. As of August 2026 this channel is on only for Pro/Max sign-ins on recent versions using the direct Claude API with no zero-data-retention agreement β€” but the flag is the reliable way to make that a non-question.
  • /feedback, /bug, and /share β€” DISABLE_FEEDBACK_COMMAND=1. The heaviest channel: running /feedback sends a copy of your conversation history including code, and shared transcripts are retained for 5 years. Since v2.1.212 you choose the scope before sending β€” the current session by default, or same-project sessions from the last 24 hours or 7 days. All three commands report through the same path, and the older variable name DISABLE_BUG_COMMAND is still accepted. On Bedrock, Vertex AI, or Foundry, /feedback doesn't upload at all β€” it writes a redacted local archive to ~/.claude/feedback-bundles/.
  • Session-quality survey β€” CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY=1. The occasional β€œHow is Claude doing this session?” prompt records only your rating. A follow-up asks whether Anthropic can look at your session transcript; per the docs, β€œnothing is uploaded unless you explicitly select Yes.” If you do share, API-key and token patterns are redacted but source code is uploaded as-is, retention is up to 6 months, and shared transcripts β€œcannot be used to train our AI models.” The survey is auto-disabled if you've set DISABLE_TELEMETRY, DO_NOT_TRACK, or the non-essential-traffic flag.

One deployment note: on Amazon Bedrock, Google Vertex AI, and Microsoft Foundry, telemetry, error reporting, and the feedback command are off by default β€” the individual flags matter most on the direct Anthropic API path. The provider-by-provider default matrix is in our Claude Code safety review.

How to Turn Off Model Training on a Pro or Max Account

This is the setting with the largest consequences, and it doesn't live on your machine. If you sign in to Claude Code with a claude.ai account (Free, Pro, or Max), Anthropic's consumer terms apply β€” and since the August 2025 consumer terms update, model training on your chats and coding sessions is controlled by a toggle that defaults to on. Anthropic's Claude Code documentation is explicit: β€œWe will train new models using data from Free, Pro, and Max accounts when this setting is on (including when you use Claude Code from these accounts).”

Turning it off takes under a minute:

  1. Open claude.ai/settings/data-privacy-controls in a browser where you're signed in to the account Claude Code uses.
  2. Find the β€œHelp Improve our AI models” toggle.
  3. Turn it off. The change applies to the account β€” every device and every Claude Code session signed in with it.

What flips when you do, per Anthropic's privacy documentation:

  • Training stops going forward. New chats and coding sessions are not used for model training, and previously stored sessions stop being used in future training runs.
  • It is not retroactive. Data already included in training runs in progress, or in models already trained, is not pulled back out.
  • Retention drops from 5 years to 30 days. The long window exists to support training; opt out and new data is kept 30 days.

Who can skip this section: if Claude Code authenticates through an Anthropic API key, Amazon Bedrock, Google Vertex AI, Microsoft Foundry, or a Team/Enterprise plan, you're under the Commercial Terms β€” no training on your code or prompts by default, nothing to toggle. The full retention picture for those paths is in our Claude API data retention guide, and the consumer-side detail (including what the 5-year window actually means) is in the Claude Pro and Max privacy explainer.

Tip

Not sure which terms you're under? If you ran `claude` and logged in with the same account you use at claude.ai, you're on consumer terms and this toggle applies to you. If you set ANTHROPIC_API_KEY or configured Bedrock/Vertex/Foundry, you're on commercial terms and training is off by default.

How to Delete Claude Code Sessions

Claude Code session data lives in three places, and each has a different delete lever: transcripts on your disk, a prompt-history file the cleanup never touches, and whatever sits inside Anthropic's retention window. Here's the complete procedure, local first.

  1. Delete a project's sessions with claude project purge. Available since v2.1.124, this removes the project's session transcripts, per-session task and debug data, its matching lines in the prompt-history file, and the project's entry in ~/.claude.json β€” with a confirmation prompt. Run claude project purge --dry-run first to see what would go.
  2. Or delete the files directly. Transcripts are plaintext JSONL under ~/.claude/projects/ β€” one folder per project, one file per session. Removing them is an ordinary file deletion; the next session starts clean.
  3. Shrink the automatic window. Claude Code deletes session files older than cleanupPeriodDays at startup β€” default 30 days, minimum 1. A value like 7 is a reasonable balance if you use --resume; note that 0 is rejected with a validation error, so β€œkeep nothing” needs the next option instead.
  4. Never write transcripts at all. Set CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 and sessions are not written to disk β€” the trade is that they won't appear in --resume, --continue, or up-arrow history. For scripted claude -p runs, --no-session-persistence does the same per invocation.
  5. Don't forget ~/.claude/history.jsonl. Every prompt you've typed β€” with timestamp and project path β€” is appended here, and per Anthropic's directory reference it is not covered by the automatic cleanup; it persists until you delete it. claude project purge removes the purged project's lines; deleting the file removes everything.
  6. Web sessions have a delete button. Claude Code on the web stores sessions server-side; delete any session from its menu at claude.ai/code β€” Anthropic's docs say deletion permanently removes the session and its data.
  7. Server-side CLI data ages out with your retention window. There's no documented button that deletes CLI session data off Anthropic's servers on demand; what governs it is the retention window β€” 30 days on commercial terms or on Pro/Max with training off, 5 years on Pro/Max with training on. That's one more reason the training toggle above is the setting to get right.

Security detail worth knowing: Anthropic's docs note the local transcripts β€œare not encrypted at rest” and that if a tool reads a .env file or a command prints a credential, that value lands in the transcript. On a shared machine, that's an argument for a short cleanupPeriodDays and full-disk encryption; on any machine, it's an argument for knowing where the files are.

What No Setting Changes: Your Prompts Still Go to the Cloud

Here's the part a settings guide owes you plainly: every flag on this page trims an optional channel. None of them changes the main one. Claude Code runs your tools locally β€” file reads, edits, command execution happen on your machine β€” but every prompt and the code context the model needs are sent, encrypted in transit, to a cloud model provider for inference. That's Anthropic's API by default, or Bedrock, Vertex AI, or Foundry if you've configured them. There is no local-inference mode; the models are too large to run on a laptop, and no environment variable reroutes that traffic.

This is the difference between configuration and architecture. Configuration is what this page covers: which side channels stay open, how long transcripts live, whether your sessions train models. Architecture is what the product is: a cloud-inference coding agent. Configuration you can get wrong on any given machine β€” a missed env var, a toggle left on. Architecture doesn't depend on you remembering anything.

The practical read isn't β€œdon't use Claude Code” β€” under commercial terms, with training off by default and 30-day retention, its posture is stronger than most developer tools'. The practical read is: know which of your data flows are configured private and which are architecturally private, and spend your diligence on the configured ones. For Claude Code, that means getting the account tier right first (commercial, not consumer β€” or consumer with the training toggle off), then setting the flags above once in a checked-in settings file so no machine misses them.

Key Takeaway

Claude Code's privacy settings control the optional channels β€” telemetry, error reports, feedback uploads, surveys, local storage. The core channel is architectural: prompts and code context go to a cloud model provider for inference, and no setting changes that.

Voibe: The On-Device Voice Layer for a Claude Code Workflow

I dictate most of my Claude Code prompts instead of typing them β€” long instructions with file names and constraints are exactly where voice beats the keyboard, at roughly 5x typing speed. But adding a dictation app adds a second privacy surface to the workflow, and most cloud dictation tools put another vendor between your voice and your prompt, with their own retention policy to audit.

That's the reason Voibe β€” the app we build β€” pairs naturally with a locked-down Claude Code setup. The contrast with this page is the point: you just read seven sections of configuration; the voice layer can simply have nothing to configure away. On Apple Silicon Macs, Voibe transcribes fully on-device with Whisper β€” audio never leaves the Mac, so there is no retention window, no training question, and no opt-out to remember. Voibe also runs on Windows and Intel Macs through its private zero-retention cloud, which uses open-source models only: audio is never stored, sold, or used to train AI. Where Anthropic publishes retention windows to manage, on-device transcription has none to publish.

  • Developer Mode resolves file and folder names when you dictate into Cursor, VS Code, or a terminal β€” β€œrefactor auth middleware dot ts” comes out as auth-middleware.ts. Our dictating in Cursor guide shows the setup.
  • Smart Formatting strips the β€œums” and fixes punctuation locally, without paraphrasing β€” your prompt stays your prompt.
  • Pricing: $7.50/month, $59/year, or $149 lifetime.

To be precise about the boundary: Voibe covers the voice-input half of the workflow. Once the text lands in Claude Code, everything on this page still applies β€” the dictation layer doesn't change Anthropic's data handling, and nothing about Claude Code changes what Voibe does with audio. Two surfaces, two answers, both worth getting right. The wider voice-plus-AI setup is in our dictation for AI prompting guide.

Info

Try Voibe for Free: download from getvoibe.com β€” no account, no credit card. On-device mode requires an Apple Silicon Mac (M1 or newer); Windows and Intel Macs run on the private zero-retention cloud.

Claude Privacy, Page by Page

This page is the configuration manual. The rest of the cluster answers the neighboring questions:

  • The session transcript prompt β€” the one prompt that can upload a whole session with a single keypress, including subagent transcripts and the raw session log file, and the four ways to stop being asked.
  • Is Claude Code safe? β€” the full safety review: the consumer-vs-commercial two-tier framework, the terms-update history, provider defaults, and the decision tree.
  • Claude API data retention β€” what Anthropic keeps on the API, Zero Data Retention eligibility, the Commercial Terms in plain English, and the Bedrock/Vertex/Foundry defaults.
  • Claude Pro and Max privacy β€” the consumer side: the 5-year window, the update emails, incognito chats, and what deletion actually removes.
  • Is Claude safe? β€” the claude.ai consumer product overall, including how it compares with ChatGPT on data handling.
  • AI Tool Privacy Tracker β€” the continuously updated cross-tool reference covering Claude Code alongside ChatGPT, Gemini, Cursor, Copilot, and the dictation tools.

Frequently Asked Questions

What does CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC disable?

CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, set to any non-empty value, disables Claude Code's optional network traffic in one flag: auto-updates, telemetry, error reporting, the /feedback command, release-note fetches, model-discovery refreshes, availability checks, session-quality surveys, and feature-flag fetching (which makes Remote Control unavailable). Per Anthropic's documentation as of August 2026, it does NOT disable two things: the WebFetch domain safety check (opt out separately with skipWebFetchPreflight: true in settings.json) and official plugin marketplace auto-install (opt out with CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL=1). It also never affects the core channel: prompts and code context still go to your model provider for inference.

How do I stop Claude Code from training on my code?

If you sign in to Claude Code with a Pro or Max account, open claude.ai/settings/data-privacy-controls and turn off the "Help Improve our AI models" toggle. With the toggle off, Anthropic states it will not use new chats and coding sessions for model training, and retention drops from 5 years to 30 days. If you use Claude Code through an API key, Amazon Bedrock, Google Vertex AI, Microsoft Foundry, or a Team/Enterprise plan, no action is needed β€” those run under Anthropic's Commercial Terms, which state Anthropic does not train generative models on code or prompts by default.

How do I delete Claude Code sessions?

Locally: run claude project purge (Claude Code v2.1.124 or later) to delete a project's session transcripts, task data, matching prompt-history lines, and project state β€” use the --dry-run flag to preview first. You can also manually delete files under ~/.claude/projects/, shrink the automatic cleanup window with cleanupPeriodDays in settings.json (default 30 days, minimum 1), or set CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 so transcripts are never written. Note that ~/.claude/history.jsonl (your typed prompts) is not auto-cleaned and persists until deleted. For Claude Code on the web, each session can be deleted from the session menu at claude.ai/code. Server-side CLI data expires with your retention window: 30 days on commercial terms or with training off, 5 years on Pro/Max with training on.

Where does Claude Code store session transcripts?

Claude Code stores session transcripts locally in plaintext under ~/.claude/projects/, organized per project, one JSONL file per session, for 30 days by default. Anthropic's documentation notes the transcripts are not encrypted at rest β€” OS file permissions are the only protection β€” and that anything a tool prints, including credentials read from a .env file, lands in the transcript. A separate file, ~/.claude/history.jsonl, records every prompt you type with timestamp and project path, and is not covered by the automatic cleanup.

Does setting CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=0 re-enable the traffic?

No. Anthropic's environment-variable reference states that for CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, DISABLE_TELEMETRY, and DISABLE_ERROR_REPORTING, setting the value to 0 or false still disables the traffic β€” any non-empty value counts as set. To re-enable the traffic you must unset the variable entirely (for example, remove the export line from your shell profile and the entry from your settings.json env block).

Do I need these privacy settings on Amazon Bedrock or Google Vertex AI?

Mostly no. On Bedrock, Vertex AI, and Microsoft Foundry, Claude Code's telemetry, error reporting, and /feedback channels are off by default, and running /feedback there writes a redacted local archive to ~/.claude/feedback-bundles/ instead of uploading. Training is off by default under the Commercial Terms on all of these paths. Two things still apply everywhere: the local plaintext transcripts under ~/.claude/projects/ (manage with cleanupPeriodDays or claude project purge) and the WebFetch hostname safety check (opt out with skipWebFetchPreflight: true).

Can I set cleanupPeriodDays to 0 to disable session storage?

No. As of August 2026, cleanupPeriodDays accepts a minimum of 1 β€” Anthropic's settings reference states that setting it to 0 fails with a validation error. If you want no transcripts written at all, use CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 (sessions then won't appear in --resume, --continue, or up-arrow history), or --no-session-persistence for non-interactive claude -p runs.

Does opting out of training delete data Anthropic already collected?

Partially. Anthropic's privacy documentation states that when you turn off "Help Improve our AI models," new chats and coding sessions are not used for training, and previously stored conversations stop being used in future training runs β€” but data already included in training runs that are in progress, or in models that have been trained, is not retroactively removed. Deleted conversations are removed from Anthropic's back-end systems within 30 days.

Can any setting make Claude Code run fully offline?

No. Claude Code executes tools locally, but every prompt and the relevant code context are sent to a cloud model provider (Anthropic's API, Bedrock, Vertex AI, or Foundry) for inference β€” that is the product's architecture, and no environment variable changes it. The settings on this page control the optional channels around that core path: telemetry, error reports, feedback uploads, surveys, update checks, and local transcript storage.

Ready to type 5x faster?

Voibe is the fastest, most private dictation app for Mac and Windows. Try it today.

  • On-device or private cloud
  • Free to try
  • No subscription
  • Mac + Windows
  • 90+ languages

Prefer to go Pro? Save 20% on any plan with code VOIBE20 View pricing β†’