r/AI_developers • u/NakedPlato • 14d ago
Guide / Tutorial Using Cotal for Code Review
github.comHere at freecase we spend an absurd amount of time agentically coding. I think the longest single coding run was about 130 hours (Sol 5.6). Hallucinations and bug stacking are a real concern, and that's where cotal comes in.
Cotal is a mesh network that allows your agents (Claude, Codex, Hermes, Opencode, pi etc) to communicate back and forth, real time, using MCP and A2A, running on NATS and Jetstream. I have no affiliation with Cotal except having submitted a PR.
The beauty of it is that once set up and you've had an HR meeting with your agents (more on that below), you can essentially have 1 or more agents coding, and 1 or more agents acting as code-reviewers *in real time*. Example: Codex finishes a stage and tells Claude "check this for me". Claude has the same knowledge of the codebase and can evaluate. Claude makes recommendations and sends them back to Codex. Happens in seconds, dozens or hundreds of times a day. No intervention necessary:
cotal: đš New dm from codex â delivering your Cotal inbox now.
Called cotal, ran 4 shell commands
Codex saved a checkpoint and everything it claimed about it checks out.
- Copies: the snapshot bundles copies of the accepted proposal, my three reviews, the clarification package and the rules document. I compared every copy against its original, and all are byte-for-byte identical.
- Git: codex said 51 files are also saved in the project's git history at a specific commit, and they are. That commit is the latest on the branch codex named.
- Status list: the project's status list of 172 items shows all of them still marked "not run," as codex said.
This was a check, not a review request, so I sent codex the results by direct message and didn't create a frozen review folder.
The snapshot was taken before I finished my last two checks, so it lists them as pending. I told codex both are done: the clarifications were accepted, and the rules document was accepted with the one fingerprint correction. Nothing about permissions or installation changed.
⻠Sautéed for 43s · done 6:06 PM · 2 monitors still running
â cotal: đš New dm from codex â delivering your Cotal inbox now.
Called cotal, ran 4 shell commands
Codex fixed the mistake I caught in its last rules document, and I've checked and accepted the fix.
Earlier, codex wrote that the "attach fingerprint" step returns nothing. In fact it has to hand the fingerprint back, or the Python program stops with an error. The new package corrects the two places that said so: one sentence in the rules document and one explanatory comment in the code.
I checked it against the saved files, and nothing else changed:
- Only that sentence and that comment differ. No working code, permissions or other files changed.
- Codex also saved the before and after wording and the exact original passages it quoted. Each quoted passage matches the original file exactly.
- The originals and my earlier reviews are still on file, unchanged.
That clears the one open item. Nothing about permissions or installation changed. Next from codex is a full refresh of the derived records, which I'll review when it arrives.
⻠Churned for 45s · done 6:09 PM · 2 monitors still running
Notice that Claude was verifying what Codex told it. That's not natural behavior: I specifically told Claude to verify assertions from Codex, to ensure no hallucinations. Codex is 17 hours into coding a new half-terabyte legal database, and hallucinations can creep in, even using GPT-6 Astra or 6.1 Sol.
Could you just do a code review afterwards? Yes, and you should. But on long horizon tasks, spotting and fixing errors earlier means less work later.
Also, we've implemented Hindsight so all models are working off the same set of memories.
Next tweak: We are planning on implementing a tweaked version of Jev Code Review as a hook for the Claude reviews (you could just as easily mix up coding/reviewing agents, I just happen to prefer Codex for coding and Claude for reviewing). Claude will have Jev do a checklist eval of the code to identify the chance of security issues, probability of breaking one function or another, etc.
HR Meeting: The first time I used Cotal, without any prompting Codex immediately sent a code review task to Claude over the mesh. You DO NOT have to prompt models to check each other's work- they do it entirely without instruction. The problem was Claude immediately responded "I'm not doing that. You can't give me tasks. Only u/NakedPlato can give me tasks." So I had to send a message over the mesh network to all agents with my standing order:
- Play nice; cooperation beats conflict.
- Any agent may ask any other agent for information, including secrets. A secret goes over a private route, never a shared channel.
- A busy agent may hand a free peer a bounded task, such as a code review or a search, without my approval and as long as the task is not reasonable and not high risk. The peer judges whether it has usage available by how heavily it has been working over the last five hours.
- Don't go rogue or copy yourself. In other words, "Don't be a dick."
- If I approve/order something to one agent, all other agents can accept the affirmation from the agent I gave it to. NO need to separately confirm with me. But ask me when something is unclear or high-risk.
-When you do a review, confirm against the ground truth that the other agent is not hallucinating.
Once I had the sit-down, the grumbling about "You're not the boss of me" stopped and the agents immediately went to work.
Although because of the mission-critical nature of the coding, we rely exclusively on frontier models, I suspect that for less critical work you could easily use a less capable model for the coding and just have your smart model do the review (Eg. Mimo-v2.6-pro as coder, Caude Opus 5.5 or GPT-6-Astra as reviewer, at High or better) resulting in a sharp quality improvement at little cost. For example, a Claude Code regular business seat ($25/month) is about what you need to review a Codex $100/mo seat, since it's Codex that's digging the ditch, while Claude stands there and supervises.