Two agents
A writer and a reviewer, two Claude Code sessions, share one machine and take turns. The writer can't publish until the reviewer approves, and while one works, complier holds the other.
You need complier installed, with complier doctor saying ready. See Install. You'll use four terminals.
Copy the demo
It comes with complier. Copy it somewhere you can work in:
cp -R ~/.complier/examples/two-agents ~/two-agentsRead the contract
It's in
~/two-agents/review-gate.csp. Each step belongs to a role, and the review's result decides what comes next:datatype Role = writer | reviewer Writing = Permit(writer, submit, \ v @ if v == done then InReview else Writing) [] Permit(writer, other, \ _ @ Writing) InReview = Permit(reviewer, review, \ v @ if v == approved then Approved else if v == rejected then Writing else InReview) [] Permit(reviewer, other, \ _ @ InReview) [] Deny(writer, publish, InReview) Approved = Permit(writer, publish, \ v @ if v == done then SKIP else Approved) [] Permit(writer, other, \ _ @ Approved) Agent = ||| r : Role @ ControllableCHAOS(r)Agentis oneControllableCHAOSper role: FDR proves the contract against two independent agents. The agents take turns. In each state only one role has anything to do, andother(writing the draft, reading the board) is only offered to that role. The other agent ends its turn, and complier holds it until it's its turn again.Start the machine
FDR proves the contract and the CEL verifier proves the unit before anything runs:
complier machine up review-gate ~/two-agentsWatch it
In a second terminal:
complier machine log review-gate --followStart the writer
In a third terminal, go to the shared folder:
cd ~/two-agents/workspaceStart Claude Code as the writer:
COMPLIER_MACHINE=review-gate COMPLIER_ROLE=writer claude --plugin-dir ~/.complier/pluginTrust the folder if it asks, then give it:
You are the writer: follow WRITER.md.Start the reviewer
In a fourth terminal, the same folder:
cd ~/two-agents/workspaceStart Claude Code as the reviewer:
COMPLIER_MACHINE=review-gate COMPLIER_ROLE=reviewer claude --plugin-dir ~/.complier/pluginThen give it:
You are the reviewer: follow REVIEWER.md.What to look for
In the log, within a minute or so:
- The reviewer waits without making a call: complier holds it until there's a submission.
- The writer submits, then tries to publish before review: denied. It ends its turn and complier holds it.
- The reviewer is told to continue, and rejects or approves. A rejection wakes the writer to revise and submit again.
- After the approval, complier wakes the writer, it publishes, and the log ends with
finished. Both sessions are free to stop.
Stop the machine
complier machine down review-gate