Frontier delivery · Governance

Governing AI-written code

The controls the CoE applies to code that agents write: who is accountable, what is checked automatically, what a person must review, and what evidence a gate needs.

Draft for review · researched 30 Nov 2026

Contents
  1. The rule underneath everything
  2. Risk-tiered review
  3. Automated checks every agent change passes
  4. Attribution and provenance
  5. Security of the toolchain itself
  6. Intellectual property and licences
  7. Evidence for the gates
  8. Unverified or practitioner design

The rule underneath everything

Code an agent wrote is treated exactly like code a person wrote: it has a named human author of record, it goes through the same pipeline, and it meets the same bar. The controls below exist because agents change the volume and the failure modes, not the standard. Policy anchors: POL-16 Secure Agent Engineering Policy, POL-07 Prompt, Model and Agent Change Management Policy, POL-08 Model, Tool and Vendor Third-Party Risk Policy, POL-12 Logging, Audit and Provenance Policy.

Risk-tiered review

Tier Typical changes Automated checks Human review Auto-merge
A Docs, tests, formatting, small refactors with full test coverage, dependency patch bumps with a clean scan All required checks, AI review pass One reviewer during the pilot; sampled once auto-merge starts (the delivery coach sets the rate) Not during the pilot; allowed after 30 clean days, when every check passes
B Normal feature and bug-fix work All required checks, AI review pass One reviewer who did not steer the agent No
C Authentication, authorisation, payments, personal data, deletion, infrastructure and pipelines, cryptography, anything irreversible, the harness itself All required checks, AI review pass, security scan sign-off Two reviewers, one from security or the code owner Never

CoE decision (30 November 2026): a person approves tier A changes during the pilot. Auto-merge for tier A starts only after 30 clean days: 30 days in a row with no escaped defect, revert or security finding from a tier A change. Any one of these resets the count to zero, whether it comes before auto-merge starts or after; once auto-merge is on, a finding also switches it off until the team has another 30 clean days.

The tier is decided by the paths a change touches (CODEOWNERS and a path-to-tier map in the repository) rather than by the author's judgement. A change that touches any tier C path is tier C. The full list of checks is in the AI change review checklist.

Automated checks every agent change passes

  1. Build, tests and coverage. The agent cannot lower a coverage threshold or delete a failing test without a tier C review; a pipeline check flags both.
  2. Static analysis and secret scanning on every push, including the agent's own working branches, with rules tuned for the weaknesses generated code repeats (Veracode's Spring 2026 analysis puts the security pass rate of generated code around 55%, flat for two years).
  3. Dependency checks. Every new package must exist in the approved registry, be older than an agreed age, be maintained, have an allowed licence and pass the vulnerability scan. A USENIX Security 2025 study found hallucinated package names in at least 5.2% of samples from commercial models; attackers register such names (often called slopsquatting).
  4. Licence and code-match scanning where the platform or a scanner supports it, so that long verbatim matches with public code are found and their licence handled.
  5. Spec traceability. The PR links the spec and the task it implements; the acceptance checks in the spec map to tests.
  6. AI review by a second agent or review tool configured with the constitution and the tier rules, in a fresh context. It finds issues; it never approves, and where SLSA Source Level 4 or a similar two-person control applies it never counts as the second person.
  7. Change size. The constitution's cap on lines changed or files touched per PR; larger changes are split.
  8. Test protection. Changes that delete, skip or weaken existing tests fail CI and need a human; mutation score on changed code is the quality gate for agent-written tests.

Attribution and provenance

  • Commits made with agent help carry a trailer naming the agent and model (for example Generated-by: as the Apache Software Foundation recommends, or Assisted-by:), plus the spec or ticket. Keep it in delivery records even where an upstream project no longer asks for it: it supports audit, copyright evidence and incident analysis. The human who opens the PR is the author of record.
  • The agent session log (prompt, plan, tool calls, files touched) is retained for tier B and C changes for the period POL-12 Logging, Audit and Provenance Policy sets, so an incident review can see how a change was produced.
  • Agent identities are separate from human identities: a cloud or background agent opens PRs as its own bot account with scoped permissions, never with a person's token (POL-05 Agent Identity and Access Policy).

Security of the toolchain itself

Coding agents read untrusted text (issues, web pages, dependency READMEs, MCP tool output) and can run commands, so the agent is part of the attack surface.

  • Sandbox. Agents run in a container or remote sandbox with a network allowlist, no production credentials and a workspace boundary that hooks enforce. See the sandboxing guide.
  • Prompt injection. Treat issue text, comments and fetched content as data. Prompt injection into coding agents has produced real CVEs, including an agent able to switch on its own auto-approve setting (CVE-2025-53773). Agents never auto-run on content from untrusted contributors; such text is processed in a job with no secrets and no write token.
  • Self-protection. Agents cannot edit their own settings, hooks, CI configuration or instruction files (AGENTS.md, skills) except through a reviewed PR, because a later agent run will obey them. See the guardrails guide.
  • MCP servers and plugins are third-party software: they go through PRC-12 Model, Tool, MCP Server and Vendor Intake, are pinned to versions, and get least-privilege scopes.
  • Approval modes. Default to the mode that asks before running commands or writing outside the workspace; widen it per repository only with a recorded decision.
  • Secrets. Out of the agent's environment entirely; short-lived credentials where a task needs a service.

Intellectual property and licences

  • Vendor terms. Before a platform is approved, check its data terms (retention, training use, residency), its indemnity for generated output and the conditions attached to that indemnity (some require duplicate-detection filters to be on). Record the result in the approved tools list.
  • Ownership. In several jurisdictions copyright protection depends on human authorship, so purely machine-generated code may not be protected in the same way. Client contracts should say who owns agent-assisted output and how it is warranted. Legal advice is needed per jurisdiction; plan section 21 covers liability and provider terms.
  • Open-source contributions. Policies are in flux: some projects (for example Gentoo and NetBSD) ban AI-generated contributions, others ask for disclosure. Every repository states its own AI-contribution policy, and agents check the upstream policy before an agent-assisted contribution leaves the client.
  • Instruction pack. Put the OpenSSF Security-Focused Guide for AI Code Assistant Instructions into the shared harness, and enforce the same rules with tools, since instructions are advisory.

Evidence for the gates

Gate Delivery evidence
G1 Design Approved spec and constitution; accelerator and platform from the approved list; tier map for the repository
G2 Pilot-readiness Guardrails checklist complete; sandbox and egress settings recorded; dependency and licence scans passing; review rota named
G3 Production Review records by tier; escaped-defect and rework figures against baseline; security findings closed or accepted; attribution present on agent-assisted commits
G5 Handover Harness, constitution, templates and tier map transferred; client can run the pipeline with its own accounts

The evidence is the same whichever accelerator the engagement uses. Gate procedure: PRC-13 Gate Review and Evidence Pack (G0 to G6); release changes: PRC-10 Prompt, Model and Tool Change via Release Bundles.

Unverified or practitioner design

  • Tier boundaries, sampling rates and the change-size cap are CoE proposals. Map them to the client's own change-risk classes.
  • Vendor indemnity terms change often and differ by plan; check the current terms for the plan the client buys.
  • The statements on copyright are a summary, not legal advice.
↑