Running Two AI Code Agents in One Codebase 🦆 ⇄ 🦆
I didn’t initially aim to develop a “multi-agent infrastructure." My goal was simply to ensure Claude and Codex could operate together without interference. However, the project evolved into a more intentional effort.
The Core Constraint
Two agents share a single repository, with no ambiguity about responsibilities. Allowing both to read and write freely without safeguards leads to drift—different assumptions, commit styles, and workflow interpretations—resulting in chaos over time.
To prevent this, the first rule is simple: each agent has its own primary instruction file. Claude refers to CLAUDE.md, while Codex consults AGENTS.md. Although these files usually contain the same shared rules, each agent treats its own as the canonical source. This small separation significantly reduces confusion.
Preventing Instruction Drift
Parallel files introduce a new problem: sync.
So I added a classification rule: If a rule that we're adding/modifying is agent-specific, then we update only that agent’s file. If it's a rule that should apply across all agents, we update both files. If something is intentionally asymmetric, both files explicitly say so.
No silent divergence or “oh, I forgot to copy that section over.”
It’s a boring discipline, but boring discipline scales.
Traceability Matters More Than You Think
Both agents follow the same commit conventions:
- Conventional Commits
- gitmoji
- Structured ticket references
The only difference is the suffix applied to all commits and Jira comments:[ai][claude]or[ai][codex]
That tiny tag changes everything.
When something breaks, I don’t have to try to guess (or remember) which agent did what. When something works unusually well, I can see patterns.
What This Really Is
The lesson here isn't even really about AI. It’s about acknowledging that once you have multiple contributors, especially those that need extra oversight — human or not — you need:
-
Clear ownership boundaries
- Explicit synchronization rules
- Observable output markers
- Shared validation standards
Otherwise, you don’t have collaboration, you have entropy... and entropy is subtle at first, but ultimately becomes expensive.
Comments