Guides › AI coding assistant data policies

Do GitHub Copilot, Cursor, Claude Code and Codex Train on Your Code? Data Policies Compared

On business plans, no. GitHub Copilot Business and Enterprise, Cursor with Privacy Mode on, Claude Code on Team, Enterprise and API accounts, and Codex in ChatGPT Business and Enterprise workspaces all exclude your code from model training. On individual plans the answer is a setting. Since April 24, 2026, GitHub may use Copilot Free, Pro and Pro+ interactions for training unless the user opts out, and Claude Code on Free, Pro and Max accounts follows the user's model-improvement setting. Retention varies more than training does, from zero retention at the model provider to five years. This page gives the answer for each tool and plan, the exceptions, and the settings to enforce before developers point an assistant at a company repository.

The answer in four points
  • Business plans. Code is not used for training on Copilot Business and Enterprise, Cursor with Privacy Mode, Claude Code under commercial terms, or Codex in ChatGPT Business and Enterprise workspaces.
  • Individual plans. Copilot Free, Pro and Pro+ may train on interactions unless the user opts out. Claude Code on Free, Pro and Max trains when the user's setting allows it. Individual ChatGPT and Codex content may be used unless the user opts out.
  • Retention. Cursor's Privacy Mode carries zero data retention agreements with its model providers. Claude Code keeps commercial data for 30 days by default and consumer data for 30 days or five years, depending on the setting.
  • Exceptions. Personal API keys, cloud agents, models outside a zero retention agreement and feedback buttons each change the answer.

What a Coding Assistant Sends

A completion request carries more than the line being typed. The assistant sends the prompt, the open file and context from neighboring files. An agent goes further and reads across the repository, runs commands and reads their output. That context often includes things nobody thinks of as source code: connection strings, API keys in environment files, customer records in test fixtures and production data in logs. The data policy of the tool decides what happens to all of it.

Tool by Tool

Each row paraphrases the vendor's published position as of November 2026.

Tool and planUsed for training?RetentionWhat changes the answer
GitHub Copilot Free, Pro, Pro+Yes, unless the user opts out. In effect since April 24, 2026, and it covers inputs, outputs, code snippets and context.Not stated on GitHub's policy page.The personal setting Allow GitHub to use my data for AI model training.
GitHub Copilot Business, EnterpriseNo. GitHub states it does not use Business or Enterprise customer data to train AI models.Governed by GitHub's Data Protection Agreement.Nothing on the plan. The training setting is not shown for these seats.
Cursor, Privacy Mode onNo, by Cursor or by its model providers.Zero data retention agreements with OpenAI, Anthropic, Google Vertex AI and xAI.Personal API keys, models that require provider retention, and Cloud Agents.
Cursor, Privacy Mode offThe no-training commitment applies only with Privacy Mode on.Follows Cursor's data use page and each provider's policy.Privacy Mode is available on every plan and is on by default for teams and Enterprise.
Claude Code on Team, Enterprise or an API accountNo. Anthropic does not train on code or prompts sent under commercial terms.30 days by default. Zero data retention is available for Claude Code on Claude Enterprise, enabled per organization by Anthropic.Feedback a user chooses to submit.
Claude Code on Free, Pro or MaxYes, when the user's model-improvement setting is on.Five years with the setting on, 30 days with it off.The setting in the account's privacy controls.
Codex on an individual ChatGPT planOpenAI may use content from its services for individuals, including Codex, unless the user opts out.Follows the ChatGPT account.The data controls opt-out.
Codex in a ChatGPT Business, Enterprise or Edu workspace, or through the APINo, by default.Workspace retention settings. On the API, zero data retention for qualifying organizations.An API organization that opts in to sharing data.

The Exceptions That Matter

Personal accounts on company code

The business commitments attach to the seat. A developer who signs in with a personal Copilot Pro account, or runs Claude Code from a personal Max subscription, is under consumer terms while working in a company repository. GitHub's April 2026 change made this concrete: interactions on individual Copilot plans may be used for training unless that user has turned the setting off. No organization policy reaches a personal account.

Bring your own key

Cursor states that its zero data retention agreements do not apply when a user supplies a personal API key. The request then follows whatever terms that key's account has with the model provider. The same holds for any tool pointed at a personal API key.

Models outside the agreement

Cursor notes that a few models require data retention with their provider and fall outside its zero retention agreements. They are off by default and need admin approval. Check the model list whenever a new model is enabled.

Cloud and background agents

An agent that runs in the vendor's cloud works on a copy of the repository there. Cursor's documentation is direct about it: if your security policy prohibits code storage, do not enable Cloud Agents. Treat any hosted agent as a separate data flow with its own review.

What to Set Before Rollout

  1. Buy the business tier and bind the accounts.Put every developer on an organization seat with single sign-on, so the commercial terms apply to the work.
  2. Enforce the privacy setting.Cursor admins can enforce Privacy Mode so members cannot turn it off. On Claude Enterprise, ask Anthropic about zero data retention for Claude Code if 30 days is too long.
  3. Restrict personal keys and unapproved models.Both move requests outside the agreement you reviewed.
  4. Decide on cloud agents.Approve them for specific repositories or leave them off.
  5. Exclude what should never be read.Use each tool's file exclusion or permission rules for secrets, credentials and regulated data.
  6. Clean the repository context.Real customer records in fixtures, seed files and logs travel with every request. Replace them with stand-ins.

Where Hardshell Sits

Hardshell does not scan source code. It governs the enterprise data an assistant or coding agent retrieves through connectors: tickets, documents, customer records and database rows. It connects that data without migrating it, enforces each user's existing permissions at query time, substitutes stand-ins for real identifiers before content reaches the model, and records every retrieval. As coding agents take on more of that retrieval, the connector and MCP security guide covers the questions to ask.

Frequently Asked Questions

Does GitHub Copilot train on my code?

On Copilot Business and Enterprise, no. On Copilot Free, Pro and Pro+, GitHub may use interactions, including code snippets and context, to train models unless you turn off the training setting. That policy took effect on April 24, 2026.

Does Cursor store or train on my code?

With Privacy Mode on, Cursor states that code is not stored by its model providers or used for training, under zero data retention agreements with those providers. Privacy Mode is on by default for teams and Enterprise. Personal API keys, some models and Cloud Agents are exceptions.

Does Claude Code train on my code?

Not on Team, Enterprise or API accounts. On Free, Pro and Max accounts, Anthropic uses the data for training when the user's model-improvement setting is on, and keeps it for five years in that case.

Does OpenAI Codex train on my code?

In ChatGPT Business, Enterprise and Edu workspaces and on the API, not by default. On individual plans, OpenAI may use Codex content to train its models unless the user opts out.

Can developers use a personal AI coding account on company code?

They can, and the consumer terms then apply to your code. The vendors' no-training and retention commitments for businesses attach to organization seats, so the safe rule is company code on company accounts only.

Which coding assistant has zero data retention?

Cursor documents zero data retention agreements with its model providers when Privacy Mode is on. Anthropic offers zero data retention for Claude Code on Claude Enterprise for approved organizations, and OpenAI offers it on the API for qualifying organizations.