# AI coding policy for [Company] engineering

Owner: [name, role]
Approved by: [name, role]
In effect from: [date]
Next review: [date, no more than six months out]

## 1. Scope

This policy covers every change to [Company] repositories that a coding agent or
AI assistant helped write: application code, tests, configuration, infrastructure
as code, documentation and commit messages. It applies to employees, contractors,
and any bot or background agent that opens pull requests.

## 2. Approved tools and models

- Approved agents and assistants: [e.g. Claude Code, Cursor, GitHub Copilot, Codex].
- Approved models and providers: [list], used only through accounts [Company]
  controls, under data terms [legal or security] has reviewed.
- Agent config files (AGENTS.md, CLAUDE.md, .cursorrules,
  .github/copilot-instructions.md) live in the repository and are reviewed like code.
- To add a tool or model, open a request with [team]. Personal accounts and
  unapproved tools are not used on company code.

## 3. Data and secrets

- Never put secrets, credentials, customer data or personal data in a prompt.
- Agents get the least access the task needs: no production credentials, and
  read-only access wherever it is enough.
- Repositories classed as [restricted] are used only with [approved setup, e.g.
  a self-hosted model or a local-only tool].
- Secret scanning runs as a pre-commit hook and again in CI.

## 4. Provenance and attribution

- Every change records which agent and model helped write it: a
  `Co-authored-by` trailer on the commit, or the field in the pull request template.
- A change with no record is reported as unknown. It is never assumed to have
  had no agent involved.
- When we report how much code agents wrote, we report label coverage with it:
  the share of changes we could attribute at all.

## 5. Review and merge

- Every change is approved by a reviewer other than its author before it merges.
  An agent can author a change. It cannot approve one.
- Changes to [payments, auth, data deletion, ...] need approval from a named code
  owner, enforced with CODEOWNERS and branch protection.
- Changes over [N] lines must reach at least one test, or be split.
- Required CI checks pass before merge. No merging on a failing required check.

## 6. Accountability

- A named person owns every agent's changes: the engineer who started the agent
  session, or the team that owns the automation. That person answers for the
  change in review and in incidents.
- Every bot or background agent that opens pull requests is listed in [registry]
  with its owning person or team.

## 7. Security and licensing

- Dependency, license and secret scans run on every change. A dependency an agent
  adds needs the same approval as any other new dependency.
- Generated code that reproduces third-party code under an incompatible license is
  not merged. Where a tool offers a public-code filter or reference check, keep it on.
- Security-sensitive changes follow [secure development policy].

## 8. Incidents

- Incident reviews start from the change that shipped: its files, author,
  reviewer, and the agent and model recorded on it.
- When an agent-written change contributed, fix the prompt, rules or agent config
  that produced it, and record the reason next to the code.
- Report a suspected data exposure through an AI tool to [security contact]
  within [24 hours].

## 9. Exceptions

- Any override of this policy is logged with who, when and why. The log is read
  at every policy review.

## 10. Review cadence

- [Owner] reviews this policy every [quarter / six months], and whenever an
  approved tool or model changes.
- Each review reads the exception log, label coverage for the period, and every
  incident that involved an agent-written change.
