Primer / Code & privacy

Why code and prompt privacy matter: follow one prompt

Download the agent version Complete Markdown · r4

Follow one prompt from your laptop to a provider's logs and a court order, and see what each step means for the code and secrets you send.

Updated: 2026-11-09.

A test is failing at the end of a long day. You copy the function into your coding assistant, and because the bug only shows up with real data, you paste a row from the customer table as well. The assistant finds the off-by-one error in seconds. Where did that customer's name go?

Most answers to that question are either alarm or reassurance, and neither helps you decide what to paste tomorrow. A more useful approach is to follow the prompt from stop to stop and ask the same thing at each one: who holds this now, for how long, and what controls that? The answers depend far more on your plan and your settings than on the name of the vendor. Everything below about providers comes from what they publish, as read on 2026-11-09. Nobody outside these companies can easily confirm that practice matches the policy, and we did not try to.

Three questions that get merged into one

"We do not train on your data" sounds like a complete answer. It settles one question out of three.

Training asks whether your text can shape a future model. Retention asks how long a copy exists. Access asks who can read that copy while it does, including safety reviewers, a court, or someone who has stolen a password. A provider can decline to train on a prompt and still keep it for a month, and a month is long enough for each kind of access to apply. Keep the three apart as you read any policy, including the summaries below.

First stop: your own machine

The prompt has not left your laptop and it has already been copied. Coding tools keep transcripts so that you can resume a session. Claude Code stores them in plain text under ~/.claude/projects/, for 30 days by default. Other tools keep their own records in their own formats, and those files sit inside whatever your backup software already collects. That customer row may now be in a transcript, a nightly backup and a cloud sync folder.

The practical step is modest: find out which tools on your machine keep transcripts, and treat those folders as you would treat the data you pasted.

Second stop: anything in the middle

Between the tool and the model there may be an editor extension, a proxy or a router that lets you switch providers. Each one sees the prompt, and each one also holds keys worth stealing. In March 2026, two releases of the LiteLLM routing library on PyPI were compromised. They were live for about 40 minutes and, according to the project's notice, appear to have included a credential stealer. The notice says users of its official Docker image were not affected, which is a useful reminder that how you install a middle layer matters as well as which one you choose. Pin the versions of anything that handles your prompts and your keys, and know what would need replacing if one of them turned on you.

Third stop: the provider, and which plan you are on

This is the stop people usually mean, and the plan matters more than the brand. The table holds stated policies on the check date, and these change often.

Service Used for training? How long is it kept?
Claude, personal plans (Free, Pro, Max, Ultra) Yes, when the setting is on 5 years if on; 30 days if off
Claude, commercial (Team, Enterprise, API) Not unless the customer chooses to provide data Privacy centre: within 30 days for API, with exceptions. The API retention page says that, where a feature needs storage, conversation content is not retained by default, except certain models. Plan on the 30 days unless your contract says otherwise
OpenAI API Not unless you opt in Abuse-monitoring logs up to 30 days by default; some stored objects until deleted
Copilot Free, Pro, Pro+ Yes, unless you opt out Not stated in the announcement
Copilot Business, Enterprise Not affected by that change Not stated in the announcement
Cursor with Privacy Mode Stated no-training when enabled See its privacy policy

Three rows deserve a closer look. GitHub's change took effect from April 24, according to a post dated March 25, 2026, and the wording is careful. Private repository content "at rest" is excluded, but code you are actively working on with Copilot counts as interaction data. So a private repository offers less protection here than the word suggests.

Cursor says it applies technical controls and contract terms to its model providers when Privacy Mode is on. The pages we read do not say whether code passes through Cursor's own servers, or that providers keep nothing, so do not assume either.

We could not load OpenAI's pages on consumer ChatGPT plans when we checked, so the table has no row for them. Check the data controls in your own ChatGPT settings, and read that page yourself rather than relying on what the API terms say. API terms do not describe a personal subscription.

The same warning applies in reverse to anyone reasoning from the word "enterprise". Find the contract or the settings page that covers your exact account, and note the date you read it.

Fourth stop: people, and the exceptions

"Deleted within 30 days" nearly always has a list after it. Anthropic's retention article says inputs and outputs flagged by its automated safety systems can be kept for up to two years, and classification scores for up to seven, and that it may keep data as the law requires. Zero-data-retention terms are a separate approved arrangement, and they do not cover everything: Anthropic lists certain models that require 30-day retention. OpenAI similarly says abuse logs may be kept longer when the law requires it.

These exceptions exist for understandable reasons. They still mean that a retention figure is a default, and you should not plan as if it were a ceiling.

Fifth stop: a court

In 2025, in the New York Times copyright case, a US court required OpenAI to keep ChatGPT output logs it would otherwise have deleted. The press dated that order to May. A stipulation and order filed on 2025-10-09 ended the ongoing duty to "preserve and segregate all output log data that would otherwise be deleted" as of September 26. It did not end everything. Logs already preserved stayed preserved, apart from those originating in the European Economic Area, Switzerland or the United Kingdom, and OpenAI would keep preserving logs from accounts tied to domains named by the plaintiffs.

Nobody in that dispute was thinking about your customer's row. That is the point. A deletion setting describes the normal course of business, and a legal hold can override it for reasons that have nothing to do with you.

Two ways out that no setting covers

Human error needs no flaw in any product. In 2023, Bloomberg reported an internal Samsung memo that restricted generative AI tools on company devices, and press accounts connected this to staff entering source code into ChatGPT. We have read those reports and no statement from Samsung itself, and details vary between them. The pattern is familiar enough without the details: someone in a hurry pastes what is in front of them. The Canadian Centre for Cyber Security lists the same risk, warning that people can paste confidential business data or details about individuals without realizing it.

Agents add a second route, because they act on what they read. Researchers at Invariant Labs demonstrated an agent reading a planted issue in a public repository and then copying private repository data into a public pull request. That was a demonstration with demo repositories, but it shows why an agent with access to both private data and a public channel deserves more care than a chat window.

Secrets are a separate case from personal data, and simpler. If an API key or password went into a prompt, rotate it. Do not spend time working out whether the provider's policy makes that unnecessary.

A rule you can apply while tired

Everything above comes down to a decision you make in a few seconds, so it helps to make it once in advance. Sort what you might paste into five classes and decide where each may go.

Class Example A reasonable default
Public Open-source code, published documents Any tool you accept for other reasons
Internal Ordinary private code Only accounts with training off, checked and dated
Confidential Client code, unreleased plans Only under a business contract that you have read
Personal Names, emails, customer records De-identify first. Otherwise only where authorized
Secret Keys, passwords, tokens Never in a prompt

The defaults are our suggestion, and yours may be stricter. The agent download turns this into a dated map of your tools and a small scanner that flags obvious secrets and email addresses before you send a file. A clean scan proves very little, since no pattern can recognize a customer's name in a comment.

Then choose your controls. A settings change is free and takes a minute. A business contract costs money and buys defined terms. Replacing that customer row with made-up values costs thirty seconds and removes the question entirely. Running a local model removes the provider stop, while adding the stops you now operate yourself: the machine, the logs, the backups and the updates.

None of these makes a prompt private in any absolute sense. They reduce how many hands it passes through, and they let you say which hands those are. Back at the failing test, the better paste was the function and an invented customer named Test User. The bug was never in the name.

Keep the guide with your own notes.
Download the complete Markdown version