AI code governance is the set of rules, controls and records that decide which AI tools engineers may use, what those tools can access, how their output gets reviewed, and how the company proves it to auditors and buyers. A workable policy fits on two pages and is enforced in CI, not in a wiki.
Why engineering teams need an AI code governance policy
Engineering teams need a written AI code governance policy because buyers, auditors and their own engineers all want to know which rules apply to AI-written code. Without a policy, each engineer picks tools and habits alone. One pastes customer data into a chat, another lets an agent auto-run commands with production credentials, and nobody can answer a security questionnaire with confidence.
A policy fixes three problems:
- It sets a shared bar so reviewers know what to check.
- It defines what agents may touch, which limits the blast radius of a mistake.
- It gives sales a document to attach when a prospect's security team asks about AI.
Frameworks give you the vocabulary. The NIST Secure Software Development Framework covers secure development practices, and the NIST AI Risk Management Framework covers AI-specific risk. Your policy turns both into rules your team follows on Monday.
What a good policy covers
A good AI code governance policy settles six decisions, and each one maps to a section of the template below.
- Which AI tools are approved, and who approves new ones.
- What data those tools may see.
- Which code needs extra review when AI wrote it.
- What coding agents may do without asking.
- Which automated checks must pass before merge.
- What records you keep, and for how long.
Anything beyond these six belongs in an engineering handbook, not the policy.
The AI code governance policy template
Copy this template, replace the bracketed parts, and keep each section short. Engineers follow rules they can read in five minutes.
Section 1: Purpose and scope
This policy covers all code, configuration and infrastructure definitions written with the help of AI assistants or coding agents at [Company]. It applies to employees, contractors and any agent acting on their behalf. AI-written code is treated as the author's code and the company's responsibility.
Section 2: Approved tools
- Approved assistants and agents: [for example Claude Code, Cursor, GitHub Copilot].
- New tools require approval from [CTO or security owner] after a review of data retention, permissions and admin controls.
- Engineers use company-managed accounts with organization settings applied, never personal accounts.
- Every Model Context Protocol server or agent plugin needs the same approval as a new tool.
Section 3: Data rules
- Never paste customer personal data, production secrets or credentials into an AI tool.
- Configure tools to exclude
.envfiles, key files and credential directories from context. - Use privacy or zero-retention settings where the vendor offers them, as required by [your data policy].
- Code under customer contracts that restrict AI use is listed in [location] and excluded from AI tools.
Section 4: Review tiers
- Every pull request needs at least one human approval, whoever or whatever wrote it.
- AI-authored or agent-authored PRs carry a label.
- Changes to authentication, authorization, billing, data access, infrastructure and CI configuration need approval from a code owner listed in CODEOWNERS.
- PRs above [your size limit in changed lines] are split before review unless the reviewer agrees otherwise.
Section 5: Agent permissions
- Agents run in a container or agent sandbox without production credentials.
- Agents may read code, run tests and edit files in their working branch without approval.
- Agents must ask before network calls to unapproved hosts, package installs, database commands and any destructive command.
- Agents never push to protected branches, deploy, or change access controls.
- Each agent commits under its own identity so changes are traceable.
- Security rules for agents live in AGENTS.md or the tool's project instructions file.
Section 6: Required automated checks
These checks must pass before merge, enforced through branch protection:
- Static analysis on the diff with no unresolved high-severity findings.
- Dependency checks: no known critical CVEs, and every new package approved.
- Secret scanning with push protection.
- A check for AI-specific risks: missing authorization, tenant isolation, unsafe handling of LLM output, and new outbound calls.
Section 7: Records and evidence
- Keep CI results, security findings and their fixes for [your audit retention period].
- Keep agent session logs for [your log retention period].
- Produce a monthly summary of findings for [security owner].
- Provide reports to customers on request during security reviews.
Section 8: Exceptions and incidents
- Exceptions need written approval from [security owner] with an expiry date.
- Suspected leaks of secrets or customer data through an AI tool are reported to [channel] within [your reporting window] and handled under the incident response plan.
Section 9: Ownership and review
[Name or role] owns this policy and reviews it on a fixed schedule, such as [your review cadence], and whenever the team adopts a new AI tool.
How to enforce the policy instead of filing it
A policy only works when CI and tool settings enforce it. Map each section to a control engineers cannot skip.
- Section 2: enforce with organization-level admin settings in each approved tool, and block unapproved tools at SSO where possible.
- Section 3: enforce with ignore files, deny rules in agent settings and secret scanning with push protection.
- Section 4: enforce with required reviews, CODEOWNERS and PR labels added by a bot.
- Section 5: enforce with agent permission files committed to the repo and managed settings that developers cannot override.
- Section 6: enforce with required status checks on protected branches.
- Section 7: enforce by generating evidence from CI automatically, so nobody assembles it by hand.
Watch for approval fatigue in Section 5. If agents ask about every routine command, engineers approve without reading. Allowlist safe commands and save prompts for risky ones.
Sections 6 and 7 are where most startups stall, because building custom checks for AI-specific risks and producing audit-ready reports takes engineering time. The Motiontic Security Layer (MSL) covers both. It runs on every pull request inside the team's own CI, scores risk against the ARI-42 risk index, posts a PR comment with each risk and its fix, and produces a dashboard plus a buyer-ready PDF report for security reviews. That keeps companies compliant so deals don't stall in security review.
Rolling the policy out
A policy lands better when engineers see the controls before the document.
- Week 1: draft the policy with two senior engineers, not alone.
- Week 1: turn on branch protection, required checks and secret scanning.
- Week 2: commit agent permission files and project instructions to each repo.
- Week 2: publish the policy and walk the team through it in 20 minutes.
- Week 3: add the AI-specific CI check and start keeping records.
- Week 4: review a month of findings and adjust the rules that caused friction.
FAQ
Do startups need an AI code governance policy before SOC 2?
Auditors and enterprise buyers increasingly ask about AI use during SOC 2 and vendor reviews. A short policy backed by CI enforcement answers those questions and maps onto existing change management controls. Motiontic's compliance page covers how this fits SOC 2 and ISO 27001.
Should we ban AI coding tools instead?
Bans push engineers to personal accounts where you have no controls and no records. Approving specific tools with admin settings gives you visibility and keeps data rules enforceable.
How strict should agent permissions be?
Strict on actions that are hard to undo: network calls, installs, database commands and deploys. Loose on reading code and running tests, so agents stay useful without constant approval prompts.
How do we prove the policy is followed?
Generate evidence from CI: required checks on every PR, security findings, and fixes with timestamps. A per-PR report answers buyer questionnaires more convincingly than the policy document alone.
Put your policy into CI
Motiontic helps engineering teams turn an AI code governance policy into checks that run on every pull request. Book a 20-minute call to see an ARI-42 report on your repos.



