arch-guard
The architecture and quality guardrail for AI-generated code — a static linter that blocks AI PRs from introducing architectural technical debt, in under a second.
the deep dive — architecture & implementation
Created arch-guard after watching AI coding agents invent duplicate helpers, import database models into React components, and introduce circular dependencies. arch-guard runs as a static architecture linter in pre-commit hooks and GitHub Actions: layered boundary enforcement with declarative rules, duplicate-utility detection against src/utils, and an instant cyclic module graph checker — a zero-overhead CLI that completes a full audit in under one second using fast AST parsing.
arch-guard — guardrails for machine-written code
As AI tools write more of your codebase, architecture decays quietly: agents reinvent helpers that already exist, reach across layers they should never touch, and spin dependency cycles. arch-guard is the static linter that says no — in pre-commit hooks and in CI.
What it enforces
- Layered Boundary Enforcement: declarative rules like “UI components cannot import DB models directly” — defined per-layer in
arch-guard.config.json. - Duplicate Utility Detection: flags when an agent writes a helper that already exists in
src/utils/. - Circular Dependency Prevention: instant cyclic module graph checker.
- Zero-Overhead CLI: a full audit in < 1 second using fast AST parsing — cheap enough to run on every commit.
Why it exists
The AI-codegen era needs referees, not just players. arch-guard is one of a pair with langgraph-zod: one guards the graph at runtime, the other guards the repo at commit time.