Skip to content
ArchBeagle

← Blog ·

Agents write the code. Who checks the architecture?

Coding agents have made writing code cheap. Claude Code, Codex and Cursor open pull requests faster than a team can read them. The diffs got bigger and the reviewers got busier. The hard part is no longer writing the change. It’s knowing whether the change fits the system it lands in.

Tests don’t answer that question. Here’s a pull request an agent might open on a Tuesday afternoon:

A pull request from claude-code: the tests pass, but the architecture check reports that checkout now depends on billing.internal, which the approved model doesn’t allow (ADR-0012).

Every test passes. The feature works. And checkout now imports straight from billing.internal, which the team decided two years ago only payments may do. Nothing in the test suite knows that. The decision lives in an ADR, an old diagram and the memory of whoever wrote them. If that person isn’t reviewing this pull request, it merges.

Do that a few hundred times a month and the architecture drifts, one reasonable-looking change at a time, each one unchecked against the decisions already made.

We built ArchBeagle to make those decisions checkable.

The architecture, as something a machine can check

ArchBeagle starts from a model of your architecture, kept in Git next to the code: the components, which component may depend on which, and the ADRs behind each rule. If you already have one in LikeC4, Structurizr, C4-PlantUML or Backstage, it reads that. If you don’t, it drafts one from the code, and a person reviews and approves it before it counts.

With a model in place, ArchBeagle checks every pull request against it and reports on the pull request where the code and the model disagree:

  • Dependencies the model doesn’t allow, with the rule and the ADR that explain why.
  • Contract changes in OpenAPI, AsyncAPI, JSON Schema, Protobuf and MCP tool lists, so a breaking change to another team’s API is visible before it ships.
  • History: a finding keeps its identity across runs, so you can see when it opened, when it was fixed and whether it came back.

It also indexes each repository (modules, symbols, calls, complexity and which tests touch what) for Python, TypeScript, JavaScript, Go, Java, PHP and Ruby, so a reviewer can see what a change reaches before approving it.

Agents can ask first

A check on the pull request catches the problem after the code is written. It’s cheaper to catch it before.

ArchBeagle runs an MCP server, so a coding agent can ask the architecture questions while it plans. Each agent gets its own token. Before editing a file, it can ask which component owns it and which ADRs apply. Before adding an import, it can ask whether the model allows it:

A sequence: the agent calls architecture_context for checkout/cards.py, then check_planned_change for checkout to billing.internal, which comes back not allowed under ARCH-DEP-3. The agent changes its plan to use the payments API, opens the pull request, and the architecture check reports 0 findings.

The answer is a guide, not a gate. The pull request’s own check stays the authority, so an agent that skips the question still gets caught. But an agent that asks first usually doesn’t need to be caught at all. Claude Code, Codex and Cursor each take a few lines of configuration.

A self-report isn’t evidence

Agents are good at describing their own work, and the description is usually right. “Usually” is the problem. When an agent reports what it did, ArchBeagle keeps the report and labels it self-reported. Next to it, for the same pull request, it shows what the check found:

Pull request 412 side by side. The agent’s session report, labelled self-reported, says it added saved cards, that all tests pass and that there were no architecture changes. ArchBeagle’s check shows 214 tests passed from CI, a non-breaking contract addition, and a new dependency from checkout to billing.internal that the model doesn’t allow.

The two are never mixed. A reviewer sees the agent’s account and the independent result side by side, and the mismatch is the interesting part.

What ArchBeagle never does

It never stores your source code. The database holds facts about the code: paths, names, line ranges, metrics, check results, and the text of your ADRs and docs. Code is read only inside a sandboxed job, with no network while it parses, and it isn’t kept.

It doesn’t decide your architecture for you either. On the free plan the pull request check reports and never blocks a merge, and a model ArchBeagle drafts counts only after a person approves it.

And it isn’t a code reviewer. A code reviewer reads the diff. ArchBeagle reads the diff against the system. Teams use both.

Try it

ArchBeagle is in early access, and during the launch every account gets every feature, free. It connects to your GitHub organisation through a GitHub App.

We’d like to hear how your team keeps its architecture in check now that agents write so much of the code. Reply here or write to support@archbeagle.com.

The pull request, components and ADR in the pictures are sample data.