Skip to content
PKResources
Course outline

The CTO's playbook for AI coding agents · Module 4: Guardrails and governance

Accountability: review, ownership and evidence

Agents write code; people own it. Make agent work visible, scale review to risk, keep CODEOWNERS meaningful, run blameless postmortems and collect the evidence auditors will ask for.

Lesson 16 / 20 · ⏱ 8 min

When an agent-written change breaks production, someone will ask “who approved this?”. If the honest answer is “the agent did, sort of”, you don’t have a tooling problem. You have an accountability gap. The fix fits in one sentence: humans own what ships. The rest of this lesson is how you make that sentence true at scale.

Ownership by design, not by memo

Saying “the engineer is responsible” changes nothing if the process lets agent work slip through unseen. Compare the two setups.

✕ Accountability by memo

  • –Policy says humans own the code; nobody can tell which PRs an agent wrote
  • –Every PR gets the same one-approval review, whatever it touches
  • –Bots merge their own changes because the checks were green
  • –CODEOWNERS lists a team alias nobody watches
  • –Postmortems conclude 'the AI made a mistake' and stop there

✓ Accountability by design

  • +Agent-authored PRs carry a label and a named human author
  • +Review depth scales with the risk of what changed
  • +No agent identity can approve or merge; branch protection enforces it
  • +CODEOWNERS points to people who review sensitive paths
  • +Postmortems ask which control should have caught it, and fix that

Review tiers by risk

Reviewing every agent PR like a payments change burns out your seniors. Reviewing a payments change like a docs typo is how incidents happen. Tie the review to the path, not to who or what wrote the code.

Risk tier Typical paths Review rule
Low Docs, tests, internal tooling, copy One reviewer, can be lightweight; agent label still required
Medium Application code, APIs, UI One reviewer from the owning team, tests must cover the change
High Auth, payments, data migrations, infra, permissions config CODEOWNERS approval plus a second reviewer; no agent-only commits without a written plan
Critical Security controls, secrets handling, the agent’s own guardrail config Security sign-off; changes to guardrails never made by an agent

That last row matters more than it looks. An agent that can edit its own allowlist has no allowlist.

Make agent work visible

You can’t apply tiers to work you can’t see. Three cheap conventions do it:

  • A label on every PR where an agent wrote a meaningful share of the diff, applied automatically by CI agents and by template for local use.
  • A named human author on every PR, including those opened by CI agents. The person who triggered or accepted the job owns it.
  • A short “how this was built” note: what the agent did, what the human checked, what wasn’t verified. Your developers’ version of this is in Code review and ownership when agents write the code.

Postmortems with an agent in the story

Agent incidents are rarely about the model. They are about a control that was missing or switched off. Keep postmortems blameless, and don’t let “the AI did it” be a root cause.

  1. 1

    Day 1

    Reconstruct

    Pull the agent's logs: prompt, tool calls, approvals. This is why autonomous tiers must log.

  2. 2

    Day 2

    Find the missed control

    Which guardrail should have stopped it: tier, token scope, review rule, test? Name it.

  3. 3

    Week 1

    Fix the system

    Change the default, not the person. Update the threat register and the managed settings.

  4. 4

    Week 2

    Share the pattern

    Publish a one-paragraph lesson internally. Other teams likely have the same gap.

Evidence for auditors

If you’re under SOC 2, ISO 27001 or a sector regulator, auditors will ask how you control AI-written code. The good news: if you did the above, the evidence already exists. Branch protection settings, PR labels and approvals, agent logs, the policy with its review date, and the exception register. Export them; don’t recreate them in a spreadsheet the week before the audit. Framing your build provenance with something like SLSA helps here too: it already asks who and what produced an artifact.

Myths vs reality

🃏 Accountability myths

Tap a card to flip it

Before you move on

✅ Key takeaways

0 / 6 completed