AI agents ship code fast — and they also ship entropy: inconsistent patterns, noisy diffs, and PRs that look done until CI disagrees. The fix isn’t "let the agent rewrite everything." It’s making correctness and consistency non-negotiable, so the agent can’t drift even when it improvises. You get there by building a boring, solid baseline the agent can reliably work within.
Tooling
If you only enforce three things, enforce these:
Typecheck (correctness)
Agents generate plausible code. TypeScript tells you if it typechecks — which eliminates a huge class of "looks right" mistakes. Make pnpm typecheck a hard gate locally and in CI.
Lint (consistency)
AI mixes styles and patterns. ESLint reduces drift by enforcing consistent patterns and catching common footguns. Gate on pnpm lint.
Format (reviewability)
AI often leaves unformatted code. Prettier keeps diffs readable. Gate on pnpm format:check in CI. Claude Code can auto-format via a PostToolUse hook but regardless of editor/agent, CI still enforces format:check.
AGENTS.md docs
Tooling enforces code; AGENTS.md sets expectations and boundaries for agent behavior.
A monorepo should have a root AGENTS.md that defines:
- the repo structure
- the standard commands
- shared rules and boundaries
Each app/package should have its own AGENTS.md tailored to local context:
- what it is and what it owns
- dependencies on other packages
- footguns / gotchas
Docs should stay in sync via a docs sync workflow (e.g. updating docs when adding a new command like pnpm clean). In my experience, Codex is great at mechanical doc updates, while Claude tends to shine on bigger changes — and this repo makes it easy to compare what each agent is best at.
Repo/template: https://github.com/valuecodes/agentic-monorepo-starter
Disclosure: This article was created with the help of AI.
Top comments (0)