Articles

November 17, 2026

Why Ungoverned AI Coding Agents Break Repositories

Five ways ungoverned AI coding agents break repositories, and how modeling one versioned, compiled flow restores ownership, invariants, and audit evidence.

AI coding agents (Claude Code, Copilot Workspace, Cursor Composer, Codex, Devin, Jules, Aider) write code, open PRs, and push changes. Without an explicit, compiled flow they behave like a Separatist droid army after the control ship goes down—locally competent, globally incoherent, and impossible to audit after the fact.

Concrete failure modes

1. Divergent instruction surfaces
Each agent consumes a different mix of system prompts, .cursorrules, CLAUDE.md, Copilot custom instructions, and whatever was in the last chat. A rule that lived only in one engineer’s local config is as effective as a Jedi Council memo after Order 66. Agents generate commits that pass their own context window and fail the rest of the pipeline.

2. Ownership and review collapse
CODEOWNERS is static. Agents open PRs under the invoking user’s identity or a bot account that is not mapped to path owners. A change under packages/auth/ or infra/terraform/ can merge with the same review rigor as a Trade Federation diplomatic droid—none. Required reviewers never see the PR because the agent never consulted the ownership graph.

3. Missing invariant enforcement
Agents do not automatically respect constraints such as:

  • No direct writes to migrations/ (must go through the schema tool).
  • Security-sensitive paths (authz/, *.pem, secrets) require an explicit human gate.
  • Public API changes must update the OpenAPI spec and generated clients in the same change set.

These rules exist as tribal knowledge. Agents optimize for the immediate task and treat the rest as optional, the same way a B1 battle droid treats anything not in its current order packet.

4. Non-reproducible evidence
When the build breaks, the trail is ephemeral session logs, a generated PR description, and git history. There is no durable record of which rule set was active, which checks were required, or which human gate was supposed to fire. Reconstructing intent is closer to piecing together the World Between Worlds than reading a log.

5. Drift under multi-agent use
One engineer uses Claude Code for refactors, another uses Cursor for UI, a third uses Copilot for tests. Each applies a slightly different interpretation of “how we ship.” The repository accumulates conflicting patterns that later agents amplify—exactly the failure mode the Kaminoans avoided by keeping every clone on the same template.

The technical fix: model the flow once

Treat the allowed agent behavior as a single, versioned specification that is compiled into the repository. The model is the source of truth; agents and CI consume only the compiled artifacts.

Minimal elements that matter:

  • Agent roles and path permissions
    Explicit declaration of which agents may edit which paths. Claude Code may touch src/; only a designated role or human may modify auth/ or infra/.

  • Required checks and gates
    Pre-commit, pre-push, and PR checks that must pass, plus explicit human approval nodes for high-risk paths or change types.

  • Invariant rules
    Declarative constraints compiled into both agent instructions and GitHub rulesets. Example:

    path: "migrations/**"
    action: deny_direct_write
    exception: require_human_approval
    
  • Ownership binding
    Flow steps reference CODEOWNERS (or an equivalent graph) so an agent cannot open a PR that bypasses required reviewers.

  • Evidence contract
    Every run records the active flow version, executed checks, and approval events as a durable artifact attached to the PR.

Once modeled, the flow is compiled into the files the tools already understand: agent instruction files, GitHub rulesets, required status checks, and CODEOWNERS updates. Changing the process means updating the model and recompiling. Every agent and every pipeline picks up the new version without manual propagation. The alternative is hoping each agent independently rediscovers the same rules—an approach that has roughly the same success rate as the Jedi Order’s contingency plans.

Model your agent flow once and compile it into GitHub. See how Canon works