// Stay in touch?
Products
Encore CloudEncore Cloud
Encore.tsEncore.ts
Encore.goEncore.go
PricingPricing
Book a DemoBook a Demo
Use Cases
AI-Powered DevelopmentAI-Powered Development
Event-Driven SystemsEvent-Driven Systems
Distributed SystemsDistributed Systems
Case StudiesCase Studies
ShowcaseShowcase
Resources
DocsDocs
InstallInstall
Example AppsExample Apps
Demo videoDemo video
ArticlesArticles
GitHub ReleasesGitHub Releases
Systems Operational
Company
About UsAbout Us
Swag ShopSwag Shop
ContactContact
JobsJobs
PressPress
SecuritySecurity
TermsTerms
Privacy PolicyPrivacy Policy
Data Processing AgreementData Processing Agreement
Enterprise SLAEnterprise SLA
Encore
© 2026 EncoreAll rights reserved
© 2026 Encore All Rights Reserved
GitHubDiscordYouTube
← All guides
Guide · Governance

The Compliance Guide to AI-Written Code

What engineering leaders need in place under SOC 2, ISO 27001, and the EU AI Act, which becomes fully applicable on August 2, 2026.

What the 2026 data shows
75%Of new code at Google is AI-generated
18%Have policies governing AI coding assistants
45%Of AI-generated code introduced vulnerabilities
2xSecret-leak rate of AI-assisted commits
Contents
01The governance gap02What AI-generated code does in production03The secrets problem04How much autonomy should agents have?05Writing the policy06SOC 2, ISO 27001, and the EU AI Act07Governance by construction08Getting started09About Encore

Three numbers describe AI-assisted development in 2026. At Google, 75% of new code is now AI-generated and approved by engineers, up from a quarter in late 2024.1 Across the industry, 34% of organizations say more than 60% of their code is AI-generated, and only 18% have policies governing the use of the tools that write it.3

The distance between those numbers is governance debt, and it is now producing incidents, leaked credentials, and compliance exposure on a measurable scale. The instinctive fix, reviewing everything harder, collides with review pipelines that are already the bottleneck.

This guide is an operating manual for closing that gap: what the evidence says AI-generated code actually does in production, where secrets leak, how much autonomy to grant agents by change class, what a workable policy contains, and how to argue the compliance case under SOC 2, ISO 27001, and the EU AI Act, which becomes fully applicable on August 2, 2026.

01

The governance gap

The clearest public record of how fast AI took over code production comes from Google's own statements: a quarter of new code in October 2024, well over 30% by April 2025, about half by late 2025 (written by coding agents and reviewed by engineers), and 75% by April 2026.1 Microsoft's Satya Nadella put his company's share at 20 to 30% back in April 2025.2

Figure 01 — the governance gapAdoption vs policy
A steeply climbing line for the share of code written by AI runs above a flat line for policy coverage. The widening gap between the two lines fills with scattered dots representing ungoverned change.
The share of code written by AI climbs steeply while policy coverage stays flat, and the widening gap between them fills with ungoverned change. Illustrative, not to scale.
Figure 02 — share of new code at Google that is AI-generatedGoogle's public statements
~25%Oct 2024
30%+Apr 2025
~50%Late 2025
75%Apr 2026
All figures describe code that is AI-generated and reviewed or approved by engineers. Sources: Alphabet earnings calls Q3 2024, Q1 2025, Q4 2025; Google Cloud Next 2026.

The pattern extends well beyond Big Tech. In Checkmarx's survey of 1,500+ security and development leaders, 34% of organizations report that more than 60% of their code is AI-generated.3 For a large share of the industry, AI generation is already the default way code gets written.

Policy coverage has not kept pace

Figure 03 — how far policy trails adoptionThree surveys, 2025
18%Have policies governing the use of AI coding assistants3
28%Of organizations worldwide have a formal, comprehensive AI policy4
26%Have comprehensive AI security governance policies5
Sources: Checkmarx (n=1,500+), ISACA (n=3,029), Cloud Security Alliance with Google Cloud (n=300).

Three independent surveys converge on the same finding: adoption is running roughly three times ahead of policy, and every percentage point of AI-generated code that ships without governance adds exposure. The rest of this guide covers how to close that gap with controls that hold at agent output volume, rather than by slowing adoption down.

02

What AI-generated code does in production

A governance policy is only as good as its model of the risk. The research base from 2023 to 2026 is unusually consistent about what AI-generated code does when nobody is checking.

It carries more security defects

Veracode tested 100+ models against 80 curated coding tasks: 45% of AI-generated code introduced security vulnerabilities, with an 86% failure rate on cross-site scripting. Newer and larger models wrote more capable code without writing more secure code, and Veracode's Spring 2026 update, now covering 150+ models, puts it plainly: two years of model releases moved the security pass rate from roughly 55% to roughly 55%.6 CodeRabbit's analysis of 470 real open-source pull requests found AI-co-authored PRs carried roughly 1.7x more issues than human-only ones, and were 2.74x more likely to introduce XSS.7 Sonar's lab study makes the sharpest version of the point: when one leading model improved its benchmark pass rate by 6.3%, its high-severity bug rate rose 93%.8

It inflates developer confidence

The overconfidence pattern

In Stanford's controlled study, developers with an AI assistant wrote significantly less secure code overall, producing insecure solutions more often on four of five tasks, and were more likely to believe their code was secure.9 In METR's randomized trial, experienced open-source developers took 19% longer when using AI tools, while believing the AI had sped them up by 20%.10 The defects arrive together with miscalibrated trust, in both security and speed.

Practitioners sense this: DORA's 2025 research found 30% of developers report little to no trust in AI-generated code, even as 90% use AI at work.11 The result is an uneasy equilibrium where output volume grows, formal controls lag, and individual judgment carries the difference.

Staging does not catch it

In a 2026 survey of 200 senior SRE and DevOps leaders at large enterprises, 43% of AI-generated code required manual debugging in production after passing QA and staging tests, and not one respondent said they were very confident that AI code behaves correctly once deployed.12 Pre-production gates were designed for code written by someone with a mental model of the system. AI code satisfies the tests it can see and fails on the intent it cannot.

When it reaches production systems

Case study: Amazon, March 2026

Amazon's retail site suffered a series of outages in one week. By Amazon's own account, one incident involved an engineer following inaccurate advice that an AI tool inferred from an outdated internal wiki. Internal documents reported by the Financial Times and CNBC described a "trend of incidents" tied to "Gen-AI assisted changes"; Amazon disputes parts of that reporting and says it has updated internal guidance.13

What failed here was the advice path rather than a generated diff: an agent read a stale internal document, a human trusted the output, and a production system inherited the error. Governance that only reviews diffs would not have caught it. The scope of a working policy is everything an AI system touches on the way to a change: sources, suggestions, code, and configuration.

Why "review everything harder" fails

The instinctive response to all of the above is to add human review, but the capacity for that does not exist. Telemetry from 8.1 million pull requests shows AI-generated PRs already wait 4.6x longer for first review, and their acceptance rate is 32.7% versus 84.4% for manual PRs.14 Review capacity is the scarcest resource in an AI-accelerated organization. A governance model that spends it uniformly, on every change regardless of risk, guarantees both a bottleneck and reviewer fatigue on exactly the changes that deserve attention.

Figure 04 — what review capacity already looks like8.1M pull requests
4.6xLonger wait for first review, AI-generated PRs
32.7%Acceptance rate, AI-generated PRs
84.4%Acceptance rate, manual PRs
Source: LinearB, "2026 Software Engineering Benchmarks Report", 8.1M+ pull requests across 4,800+ organizations.

The alternative is to spend review where risk lives and remove entire risk categories structurally. Sections 03 through 05 cover that alternative: cutting off secrets exposure, setting autonomy by change class, and writing the policy that encodes both.

"A high-quality platform amplifies the effects of AI adoption on organizational performance. The positive impact of AI on organizational performance is strong when platform quality is high."

DORA Research
2025 State of AI-Assisted Software Development
03

The secrets problem

Of everything AI tools change about security posture, credentials exposure is the most measurable, and the numbers are moving the wrong way. GitGuardian's 2026 telemetry across public GitHub is the reference dataset.15

Figure 05 — credentials exposure in the AI eraPublic GitHub, 2025–2026
2xSecret-leak rate of AI-assisted commits vs. all public commits (3.2% vs 1.5%)
28.65MNew hardcoded secrets on public GitHub in 2025, +34% YoY, the largest jump on record
24,008Unique secrets exposed in MCP-related configuration files, 2,117 of them valid
Source: GitGuardian, "The State of Secrets Sprawl 2026", telemetry across public GitHub.

AI-service credentials themselves grew 81% year over year as teams wired up model providers and agent frameworks, and eight of the ten fastest-growing leak detectors were tied to AI services.15 The mechanism is mundane: AI tools read whatever the repository and their configuration give them, and they reproduce patterns they see. If credentials are reachable, they end up in generated code, in commits, and in context sent to third parties.

The exposure map

Figure 06 — the exposure mapFour paths

Repository files · .env files, IaC state, connection strings. Every AI tool reads the repo as context. Reachable credentials become training material for the next suggestion.

Context windows · Whatever is pasted or auto-included in prompts. Production data and keys leave your perimeter to a third-party service, often unlogged.

Agent configuration · MCP and tool configs holding tokens. 24,008 secrets found in MCP-related config files on public GitHub.15

Internal docs and wikis · Stale runbooks, credentials in docs. Agents treat internal documents as ground truth. The Amazon incident began with an outdated wiki.13

Sources: GitGuardian, "The State of Secrets Sprawl 2026"; Amazon incident reporting, Mar 2026.

Across all four rows, scanning and training reduce how often leaks happen, and only removing credentials from the places AI can read eliminates the class. Section 07 covers how to do that removal.

04

How much autonomy should agents have?

The question now facing engineering organizations is what an agent may do without a human in the loop, and the answer should depend on what is being changed rather than on which team is asking. Five levels cover the practical range:

Figure 07 — five levels of agent autonomySuggest → Autonomous
Suggest Human writes, AI advisesLevel 1
Draft AI writes, human reviews allLevel 2
Gated AI merges behind automated checksLevel 3
Bounded Autonomous within declared scopesLevel 4
Autonomous No human gateLevel 5
Autonomy rises down the list. The ceiling that applies depends on the change class, not on the team asking. Illustrative, not to scale.

Most organizations today run everything at level 2 and exhaust their reviewers, or let individual teams drift to level 4 without deciding to; both are policy failures. The workable pattern is an autonomy ceiling per change class:

Figure 08 — autonomy ceilings by change classCeiling per class
Level 3-4

Docs, tests, tooling · Documentation, test additions, internal scripts. Merge behind automated checks.

Level 3

Reversible app code · Feature code behind flags, UI, isolated services. Automated gates plus async human review.

Level 2

Sensitive app code · AuthN/authZ, payments, PII handling, data migrations. Mandatory human review before merge.

Level 1-2

Infrastructure and config · IAM, networking, provisioning, schemas. Level 1-2, or remove the surface: derive infrastructure from code (section 07).

Excluded

Secrets and credentials · Keys, grants, rotation. Not in agent scope at all. Platform-managed.

The ceiling attaches to what is being changed, not to the team or the tool that asks.

The cautionary tale for skipping this exercise: 33% of infrastructure teams say they would apply AI-generated HCL directly to production without any review.16 That is level 5 autonomy on the highest-blast-radius change class, adopted by default rather than by decision. DORA's finding frames the payoff of doing it deliberately: AI amplifies the system around it, and the organizations that profit are the ones whose control systems were designed for it.11

Also available as a PDF

The Compliance Guide to AI-Written Code

The same material as a designed, print-ready report with the full source list, for circulating internally or reading offline.

Download the PDFBook a demo
05

Writing the policy

The 18% of organizations with a policy did not get there by writing long documents. A workable AI development policy fits in a few pages and answers seven questions; everything else is implementation detail. DORA's 2025 guidance for leaders starts in the same place, with "clarify and socialize your AI policies" as its first recommendation.11

Figure 09 — the seven questions a policy answersComponents

Scope and tool allowlist · Which AI tools and agents are approved, and who approves new ones?

Data boundaries · What may AI tools read? What must never enter a context window or tool configuration?

Change classes and autonomy ceilings · What may an agent do without a human, per class of change? (Figure 08.)

Review requirements · Which changes need human review, at what depth, and by whom? Where is review replaced by automated gates?

Attribution and audit · How is AI involvement recorded per change, and can you reconstruct who and what produced any line in production?

Incident handling · When a change causes an incident, how is AI involvement identified, and what feeds back into the ceilings above?

Exceptions and ownership · Who owns the policy, how are exceptions granted, and when is it revisited?

Everything beyond these seven components is implementation detail.

Starter rules that hold up in practice

  • Every AI-assisted change is labeled as such in commit or PR metadata. Attribution is the precondition for every other control on this list.
  • AI tools never hold production credentials, enforced through architecture rather than through instructions to the tool (section 07).
  • Autonomy ceilings attach to change classes, not to teams or tools. A new agent inherits the existing ceilings.
  • Treat review capacity as a budget. If agent output exceeds what humans can meaningfully review, lower the autonomy ceiling or raise the automated gates rather than letting review quality silently degrade.
  • Every agent action has a named human owner, so accountability for any change traces to a person.
  • Incident postmortems record whether AI was involved in the change and in the diagnosis. The ceilings move based on that record.
The policy in one sentence

If a change cannot be attributed, gated, and rolled back, it does not ship. The rule applies to humans and agents alike, and with agents the delivery system itself can enforce it rather than relying on convention.

06

SOC 2, ISO 27001, and the EU AI Act

Engineering leaders keep asking what their auditors expect for AI-generated code, and as of mid-2026 there is no authoritative standard to point them to. Schellman, one of the largest SOC 2 audit firms, wrote in April 2026 that "we have nothing authoritative to cite from the AICPA at this time." NIST's secure-development guidance for AI (SP 800-218A) governs building AI systems, not code written by AI, and its agent-focused control overlays are still drafts.17 In the absence of a standard, auditors will judge how convincingly your existing controls extend to AI-assisted changes.

The regulatory clock

Figure 10 — the regulatory clockEU AI Act
Aug 2, 2025

EU AI Act obligations for general-purpose AI models apply. Governance rules for the model providers your tools are built on.

Aug 2, 2026

The AI Act becomes fully applicable, including its transparency obligations. Enforcement powers are live.

2027-2028

High-risk system obligations phase in (pushed to Dec 2027 and Aug 2028 for certain categories under the simplification agreement).

Source: Regulation (EU) 2024/1689, Art. 50 and Art. 113, and the European Commission implementation timeline.

Most engineering organizations are deployers of AI systems rather than providers, which keeps their direct obligations modest. For coding tools specifically, the Commission's draft Article 50 guidelines (May 2026) exempt generated source code from the AI-content marking obligation, while natural-language output from the same tools, such as documentation, remains in scope. It is draft guidance, but it is the first regulatory line drawn through AI-generated code.18 The near-term exposure is indirect: data protection law already applies when AI tools read production credentials and regulated data, and customers' security questionnaires are already asking AI-governance questions that the 18% can answer and the 82% cannot.

What your auditor will ask

  • Can you identify which production changes were AI-generated or AI-assisted?
  • Who approved each change, and does the approval depth match your stated policy?
  • What could the AI read at the time it produced the change? Could it access credentials or regulated data?
  • How do you detect, attribute, and roll back a defective AI-assisted change?
  • Does your incident process record AI involvement, and is there evidence the findings feed back into policy?

Every question maps to a control principle that predates AI: change management, least privilege, auditability, and incident response. The organizations that answer these questions well are the ones whose architecture makes the answers true by default, which is the subject of the next section.

07

Governance by construction

Every control in this guide comes in two versions: one that depends on human attention, and one the architecture enforces. At the output volume agents produce, only the second kind holds. Policies, training, and scanning reduce the frequency of failures, while removing the failure surface eliminates the class.

Figure 11 — the same control, two ways to enforce itReview vs construction

Secrets exposure · By review: scanning, training, pre-commit hooks. By construction: credentials live in the platform, outside the repo, leaving nothing for AI tools to read or leak.

Infrastructure changes · By review: humans review AI-written IaC. By construction: infrastructure derived from typed declarations in application code. No IaC surface for agents to touch.

Unsafe patterns · By review: reviewer knowledge, checklists. By construction: typed resources and least-privilege defaults. Unsafe configurations fail at compile time.

Environment drift · By review: release checklists, staging sign-off. By construction: local, preview, and production derived from the same source, identical by construction.

Audit trail · By review: commit discipline, manual records. By construction: every resource and deployment traceable to the code that declared it, automatically.

Governing by review depends on human attention holding at agent output volume. Governing by construction removes the failure surface instead.

This is the model Encore implements: infrastructure semantics live in the application code as typed declarations, the platform provisions and operates the resources, and credentials and infrastructure state never enter the repository. AI tools, including agents, work in the one place they measurably perform well, application code, inside guardrails that do not depend on human attention. The compliance conversation changes accordingly: "the AI never had access to production credentials" becomes an argument an auditor can verify by construction rather than a promise backed by training records.

Figure 12 — what the model changesEncore
Infrastructure derived from application codePlatform
What AI tools seeBusiness logic and typed resource declarations. No credentials, no cloud config, no state files. Full application context for generating deployable code.
What the platform enforcesType-safe infrastructure semantics at compile time. Least-privilege defaults on every resource. Identical local, preview, and production environments.
What the audit trail showsEvery resource traceable to the code that declared it. Every deployment attributable and reversible. Architecture diagrams generated from the code.

"In conventional IaC workflows, AI systems require access to environment variables and infrastructure configuration to diagnose issues, which creates compliance challenges under data protection law. With Encore's code-first approach, infrastructure is managed independently, so the AI can assist effectively without accessing sensitive configuration or regulated data."

Leonardo Marciano
CTO & Founder · AI and Cybersecurity
08

Getting started

Answer each question yes or no. Where the noes cluster matters more than how many there are.

Figure 13 — the ten-question checkYes / No
Do you know what share of your merged code is AI-assisted?Y / N
Is AI involvement labeled on every commit or pull request?Y / N
Is there an approved-tool list, with an owner for adding to it?Y / N
Are data boundaries defined: what AI tools may and may not read?Y / N
Are production credentials inaccessible to AI tools by construction?Y / N
Do autonomy ceilings exist per change class, in writing?Y / N
Is review capacity measured against AI output volume?Y / N
Can you roll back any AI-merged change, and attribute it?Y / N
Do incident postmortems record AI involvement?Y / N
Does one named person own the AI development policy?Y / N
Ten questions, answered with your platform and engineering leads.
How to read your answers

Close the attribution and data-boundary noes first, because every other control depends on knowing what AI touched and what it could read. Noes on autonomy ceilings and review capacity mean the policy exists on paper but not in the pipeline, and a no on credentials is the largest single exposure.

Figure 14 — three moves, in orderMeasure → Remove
Step 01MeasureInstrument AI attribution first. Two weeks of labeled commits shows your real exposure.
Step 02Set ceilingsAdopt the figure 08 ceilings and publish them. That ends the silent drift toward unreviewed autonomy.
Step 03Remove the biggest surfaceMove credentials and infrastructure state out of AI reach by platform choice. It is the only risk class you can eliminate outright.
Attribution comes first because every later control depends on it. Illustrative, not to scale.
The August 2026 deadline

The EU AI Act becomes fully applicable on August 2, 2026, and customer security questionnaires already ask AI-governance questions. The gap between the 18% with a policy and everyone else is now a sales and audit differentiator.

"Encore lets us scale both our product and infrastructure footprint, without additional hiring. The ROI we've seen is outstanding, easily 10x."

Daniel Stocks, CTO
Carla · the case study reports annual savings of over $200,000 on headcount costs
09

About Encore

Encore is a development platform for the AI era, built for a world where AI multiplies software delivery 10–100x rather than making each developer slightly faster. Developers and AI agents declare the infrastructure they need — databases, queues, buckets, cron jobs — directly in ordinary TypeScript or Go, and Encore provisions it in your own AWS or GCP account.

The same application model runs locally, in preview environments, and in production, so changes are validated against real infrastructure before they reach the production loop. There is no separate Terraform layer for anyone, human or agent, to write and keep in sync.

From declaration to running systemorders.ts → live in 42s
orders.tstypescript
01import { api, SQLDatabase, Topic, Bucket } from "encore.dev";
02
03// declare what you need, Encore provisions it
04const db = new SQLDatabase("orders");
05const events = new Topic<OrderEvent>("orders");
06const receipts = new Bucket("receipts");
07
08export const create = api({ method: "POST" }, async (o) => { ... });
TerminalProblemsOutput
$ git push encore
✔ Building application graph
✔ Provisioning Postgres (RDS) · Pub/Sub (SNS+SQS) · Object Storage (S3)
✔ Deploying 6 services to your AWS account (ECS Fargate)
✔ Wiring distributed tracing + metrics
 
→ Live at https://staging-orders-r2qa.encr.app· 42s
→ Dashboard at https://app.encore.dev/orders
Declare in codeType-safe APIs, databases, queues, caches and cron jobs in standard language patterns, no DSLs or YAML. Infrastructure semantics are checked at compile time.
Deploy anywhereAWS or GCP, in your own cloud account, with preview environments per pull request and production deployments automated end to end.
Observe everythingDistributed tracing with zero configuration, plus metrics, logging, a service catalog, and architecture diagrams generated from the code.

Why this matters for this guide

  • The secrets problem (section 03): credentials and infrastructure state live in the platform, outside the repository and outside AI reach, so the tools that write the code never see production secrets.
  • Governance by construction (section 07): typed resources and least-privilege defaults mean unsafe configuration fails at compile time rather than in an audit.
  • SOC 2, ISO 27001, and the EU AI Act (section 06): an automatic audit trail and "the AI never had access to production credentials" is the strongest control argument available.
  • How much autonomy (section 04): the platform, not the reviewer, enforces what an agent can change — so autonomy scales without widening the blast radius.

"Encore is our foundation for all new development. Since adopting it, we've seen a 2–3x increase in development speed and 90% shorter project lead times. What used to take days or weeks of back-and-forth between developers and infra teams is now automated and completed in minutes."

Josef Sima, Engineering Director
Groupon
Book a demoRead the docs

Sources

  1. Alphabet Q3 2024 earnings (Pichai: "more than a quarter"); Alphabet Q1 2025 earnings call ("well over 30%"); Alphabet Q4 2025 earnings call (CFO: "about 50%... written by agents... reviewed by our own engineers"); Google Cloud Next 2026 (Pichai: "75% of all new code at Google is now AI-generated and approved by engineers")
  2. Satya Nadella, LlamaCon fireside chat, Apr 29, 2025 ("maybe 20%, 30% of the code that is inside of our repos today")
  3. Checkmarx, "Future of Application Security in the Era of AI", Aug 2025, n=1,500+ CISOs, AppSec managers and developers
  4. ISACA, 2025 AI Pulse Poll, 3,029 digital trust professionals worldwide
  5. Cloud Security Alliance with Google Cloud, "The State of AI Security and Governance", Dec 2025, n=300
  6. Veracode, "2025 GenAI Code Security Report" (80 tasks, 100+ LLMs) and "Spring 2026 GenAI Code Security Update" (150+ models)
  7. CodeRabbit, "State of AI vs. Human Code Generation", Dec 2025, 470 open-source PRs
  8. Sonar, "The Coding Personalities of Leading LLMs", Aug 2025, over 4,400 Java assignments, 5 LLMs
  9. Perry et al., "Do Users Write More Insecure Code with AI Assistants?", ACM CCS 2023, n=47
  10. METR, "Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity", Jul 2025 (arXiv:2507.09089)
  11. Google Cloud DORA, "State of AI-assisted Software Development", 2025
  12. Lightrun, "The State of AI-Powered Engineering 2026", Global Surveyz, n=200 senior SRE/DevOps leaders, US/UK/EU enterprises 1,500+ employees
  13. Amazon, aboutamazon.com, Mar 2026; Fortune, Mar 12, 2026; Financial Times and CNBC reporting; Wharton Accountable AI Lab, Apr 2026
  14. LinearB, "2026 Software Engineering Benchmarks Report", 8.1M+ pull requests, 4,800+ organizations
  15. GitGuardian, "The State of Secrets Sprawl 2026"
  16. Spacelift, "The Infrastructure Automation Report 2026: The AI Readiness Gap", n=406, fielded by Panterra Group
  17. Schellman, "What Does the AICPA Require of Artificial Intelligence?", updated Apr 2026; NIST SP 800-218A, Jul 2024; NIST Control Overlays for Securing AI Systems (COSAiS), drafts 2025-2026
  18. Regulation (EU) 2024/1689, Art. 50 and Art. 113; European Commission, draft Guidelines on Article 50 transparency obligations, May 8, 2026