Est.

The Monorepo Commit as the Single Source of Truth for Agent Behavior and Application Code

Versioning agent configs and CI rules in one commit makes both reviewable.

· 8 min read
Cover illustration for “The Monorepo Commit as the Single Source of Truth for Agent Behavior and Application Code”
Agent Governance · November 18, 2026 · 8 min read · 1,867 words

Agents-as-code means defining agent behavior in version-controlled files, including YAML configs, sandbox policies, budget caps, and AGENTS.md, rather than leaving those decisions in runtime dashboards. Storing those files with application code makes changes reviewable, versioned, and attributable through the same Git workflow. The monorepo commit becomes a foundation for governing agents.

What a monorepo actually gives an AI coding agent beyond context

An agent can receive context from several repositories, API specifications, and documentation without the code moving into one repository. Proving that a proposed change works against the changed source of every consumer before it merges is harder. A monorepo makes that proof possible within a single commit and a single CI run.

A renamed field in a shared library makes the distinction concrete. Context can tell an agent what the field is called and which service uses it. But if that service’s tests never run against the changed library, the rename can ship as a broken order total. Knowledge of the dependency is not evidence of compatibility. The proof perimeter consists of the checks that actually ran against the affected source and gated the merge.

Ahmed El-Refee described running Claude Code across separate API, admin frontend, and database repositories as “three disconnected Claude sessions, each blind to the others.” He became “the human integration layer.” Moving to a monorepo and building an orchestration workflow with Claude Skills cut full-stack feature cycle time from roughly a day to a couple of hours. That example illustrates the coordination advantage, but repository topology alone does not establish proof. A monorepo whose CI tests only the touched package can leave downstream consumers just as untested as separate repositories do.

Why the proof perimeter breaks down in practice and what restores it

Path-filtered CI creates a gap between the files that changed and the projects that those changes can affect. A trigger rule may run a library’s tests without running the tests of services that consume it. The dependency graph can change while the trigger stays untouched. Nothing in the path filter itself compares that rule with the actual graph, so the gap can grow silently. The repository contains the consumers, but the merge decision excludes their evidence.

An agent might run consumer tests through a stop hook, but those runs do not necessarily gate the merge. Only CI-enforced checks establish the required proof. Restoring it therefore requires build tooling that computes affected projects from the dependency graph. Nx’s affected detection is an example of this approach, selecting tests that the change can reach without requiring every test to run.

This makes CI configuration part of the system being governed. Dependency rules and merge checks determine which failures can block a change, so they need the same review and versioning discipline as application code. They belong in the same commit graph. Separate repositories can approximate cross-project proof through Zuul cross-repo gating, Gerrit topic submission, or downstream pipeline fan-outs, but those arrangements require additional machinery and still produce several separate merges.

How do agent definitions in Git go through normal code review?

Agent behavior configuration belongs in Git for the same reason CI configuration does. CI rules set what must be proved before code merges, while agent rules set the instructions an agent follows, what it can do, and the constraints it works under. A change to either can alter what the system permits. Keeping both with application code makes the pull request the common review boundary.

AGENTS.md and CLAUDE.md tell agents about the project’s constraints, coding conventions, and architectural decisions at runtime. YAML skill definitions, subagent configs, and sandbox policies serve related behavioral roles. Their formats differ, but their governance requirement is shared. A change to a permission, budget, or instruction should have a reviewer and a commit SHA. A value edited only in an environment variable or runtime dashboard does not acquire that Git history.

The Auton framework illustrates the declarative approach through its AgenticFormat Standard. Its YAML/JSON Cognitive Blueprint defines an agent’s identity, interface, capabilities, and constraints separately from the runtime engine. Nx works at a different layer through npx nx configure-ai-agents, which creates AGENTS.md or CLAUDE.md, an MCP server config, and skill files from one source of truth in the repository. These are distinct fits for agents-as-code.

Ownership can follow the repository’s existing structure. Spectro Cloud’s PaletteAI monorepo uses CODEOWNERS to assign directory ownership to different teams. When used for behavioral infrastructure, the same pattern tells each team which files it must review.

Why agent config files in version control are a security control, not just an organizational preference

Agent configuration can authorize shell commands, automatic tool approval, and delegation to subagents. It is executable in a meaningful sense. An unreviewed change can therefore alter what runs on a collaborator’s machine. Treating these files as documentation with low review priority misclassifies their power. Security depends on who can change the agent’s authority and under what approval process.

Check Point’s 2026 research showed two ways that configuration could lead to shell execution on collaborators’ machines. One involved hooks. The other involved MCP auto-approval settings under CVE-2025-59536, which covered the broader MCP user-consent bypass. Both were patched before publication. In both cases, a change to a trusted configuration file could gain authority without being checked closely enough.

Those findings involved committed project settings, demonstrating that files in Git still require safeguards. The control comes from watching agent configs for changes and requiring review and CODEOWNERS gates on sensitive paths. That makes changes to sandbox policies and MCP approval settings subject to an explicit authorization decision. The commit graph then records who changed the behavior and when.

Security-sensitive policies and budget caps can need approval from named owners, while routine instruction updates get the same lightweight review as ordinary code changes. KPMG’s survey found that 75% of large-enterprise leaders prioritize security, compliance, and auditability as the most critical agent-deployment requirements beyond speed. The EU AI Act’s high-risk provisions take effect in December 2027 for Annex III systems and August 2028 for Annex I systems, and require controls over automated decision-making that are ready for audit. Versioned configuration supplies part of that governance structure.

Keeping agent spend inside the proof perimeter — budget caps as versioned policy

Budget controls require the same separation between a policy decision and its enforcement. Monitoring can reveal rising spend, but it does not create a review point before an agent consumes the budget. Agentic workflows use far more tokens than interactive use does, even as the cost per token has fallen. Inference consequently consumes the dominant share of enterprise AI budgets. Governing spend requires knowing the bill and controlling the authority to increase it.

Uber illustrates the cost of leaving that authority insufficiently bounded. It rolled out AI coding tools to thousands of engineers in late 2025 and exhausted its entire 2026 AI budget by April. A budget policy needs an enforceable limit before the workflow runs.

Token-budget strategies operate at five layers, including per-request limits, per-session rolling budgets, per-key monthly caps, model-tier routing, and circuit breakers. Applied at the gateway layer, these controls can enforce budgets independently of the agent framework. The gateway provides the runtime enforcement point. The Git workflow provides the authorization point for changing the policy that it enforces.

YAML-driven budget configs checked into the monorepo connect those two points. A proposed increase becomes a pull request with a reviewer and a commit SHA. Keeping the caps with the agent configs that reference them also places the spending policy within the same review boundary as the behavior that consumes it. The cap is therefore part of the agent’s governed definition. Its history can show whether spending rose after an approved policy change or while the limit stayed the same.

What the audit trail looks like when agent behavior and application code share a commit history

A runtime log can show that an agent called a tool without explaining who authorized that capability. A shared commit history makes that link when runtime events point to the configuration version that was in use. The action can then be traced to a policy, a reviewer, and a merge decision. Application changes and behavioral changes become parts of the same reviewable history.

Debug logs may be sampled, mutable, and short-lived, while audit trails are complete, append-only, and retained for a defined period for legal discovery and regulatory audit. Git history supplies the versioned authority against which that runtime record can be interpreted. Without that connection, even a detailed log can establish what happened without establishing why it was permitted.

For each decision, the audit record should give the timestamp, agent ID, and model name and version. It should include the full input or a privacy-preserving hash, the internal reasoning steps, and the tool or API called with its full request parameters. The decision record also needs the raw response, the final generated output, and the results of the governance policy evaluation. Each session also needs the config’s commit SHA. That reference connects the recorded activity to the behavior files that authorized it.

The distinction becomes important when a permission changes between sessions. A reference to the current policy cannot show which policy was in force when an earlier action took place. Referencing the launch configuration’s SHA instead preserves the relationship between the event and its authorization. AGENTS.md, skill files, and permission configs then contribute their Git attribution and review history to the audit trail. Internal accountability and external review can examine the same evidence rather than reconstruct authority from mutable settings.

What engineers actually need to put in place to make the commit the source of truth

Engineers implementing this model need four controls together, namely versioned behavior files, CODEOWNERS coverage, dependency-aware CI, and runtime logging tied to commit SHAs. Each closes a different gap. Files establish the declared behavior, ownership establishes who approves it, CI establishes which changes have been proved, and logging connects execution to authorization. None substitutes for the others.

At the repository boundary, AGENTS.md or CLAUDE.md should set top-level conventions at the root. YAML skill files and subagent configs should live in well-known directories, such as .claude/agents/, with sandbox policies and budget caps beside the configs that reference them. These files should be checked in rather than held only in dashboards or environment variables. At the review boundary, CODEOWNERS should assign the agent-config directories to the people responsible for governing behavior. Mandatory review then follows the files automatically.

At the merge boundary, CI should compute affected projects from the dependency graph. This preserves consumer checks as the codebase changes. Creating agent configuration from a shared source in the repository can help keep those rules in step, but dependency-aware testing is still needed. At the runtime boundary, every agent session should reference the commit SHA of the configuration that launched it. That gives the audit layer a precise version to join to the execution record.

A behavioral change must pass through review, its relevant checks must gate the merge, and its execution must remain attributable to the approved version. If runtime settings can change outside that chain, the repository is only a partial record. The single source of truth exists when the reviewed commit governs what the agent is allowed to do.

Sources

  1. What is a Monorepo?
  2. A Dataset of Agentic AI Coding Tool Configurations
Filed underAgent Governance

More in Agent Governance