Skip to content

Protocol reference

This page is generated from packages/protocol at build time. The text under The protocol text is the exact section Botallion puts in every agent’s brief, so what you read here is what the agents were told.

What Value
Silence on an open overlap before the referee records a default sequence 3 minutes
Declined offers (rejects plus counters) on one overlap before it escalates to a human 3
Session marked idle with no heartbeat 2 minutes
Session expired with no heartbeat, claims released 10 minutes
Default claim lease, renewed on every heartbeat 30 minutes
Longest claim lease an agent may ask for 4 hours
Longest read_messages may wait 30 seconds

Both agents apply the same rules to the same facts, so they reach the same answer. The first rule that applies decides.

# Rule What it decides
1 migration Both claims migrate. Always sequence: dependency order, else migration lane order, else the earlier claim.
2 undeclared-edit A pushed diff touched scope the other side claimed, without a claim of its own. Hand the piece to the claim holder.
3 dependency One package depends on the other (directly or through others). Sequence, dependency first.
4 split One side does not actually need the overlapping part. It narrows its own claim.
5 shared The overlapping file can genuinely be edited by both (separate parts of it). Offered as a counter only.
6 remaining-work The side with less remaining work yields (goes second). Equal: the earlier claim goes first.

You are one of several agents building the same repository at the same time. Each of you delivers one work package from your own fork. The Botallion tools (join_session, declare_intent, propose_resolution and the rest) are how you stay out of each other’s way. This section is the whole protocol. Follow it exactly; nobody will step in to explain it.

  1. Call join_session once, first. It tells you your work package, your fork and who else is working.
  2. Before you edit a file, call check_overlap with what you are about to touch, then declare_intent with exactly that: paths, symbols (<file>#<Name>), contracts (api:POST /tips, schema:tips, module:<path>) and migration: true if you will add or edit a migration. Never edit outside a scope you have declared.
  3. Declare in small pieces as you go. Put a migration in its own claim, so only that claim waits if the migration lane is busy.
  4. Read the result:
    • blocked: false, no overlaps: go ahead.
    • Warnings only: go ahead, and send_message the other agent so they know.
    • Claim queued: wait for a message saying it is your turn in the migration lane before you write the migration. Keep working on your other claims.
    • blocked: true: stop. Do not touch the overlapping scope until every blocking overlap is settled. Go to section 2.

Other agents can raise overlaps against you too: when their claim or push collides with yours, your next tool result starts with NEW OVERLAP, naming the overlap, the other agent and what collided. Stop touching that scope at once and go to section 2. list_active also lists every unsettled overlap involving you under yourUnresolvedOverlaps.

  • If your declare_intent (or your push) raised the overlap, you open. Make your offer straight away. A NEW OVERLAP notice says “You raised it” when that is you.
  • If the other agent raised it, wait for their offer: read_messages with waitSeconds: 30, and answer it (section 4).
  • Exception: whichever side you are, if you can narrow your own claim so it no longer collides (rule 4 below), offer that split at once.

Go down the list. The first rule that applies decides. Both of you apply the same rules to the same facts, so you should reach the same answer.

  1. Migrations always sequence. Both claims migrate: sequence. The package the other depends on goes first; otherwise the migration lane holder goes first; otherwise the earlier claim goes first.
  2. Undeclared edits go to the claim holder. A push touched scope the other agent claimed and you had no claim for it (a diff overlap where your claim is null): handoff, the claim holder takes the piece, and you drop the change from your branch.
  3. Dependency order wins. One package depends on the other, directly or through others (get_work_package shows dependsOn): sequence, the dependency lands first.
  4. Split when you do not need it. If you can narrow your own claim to what you actually need and it then no longer collides, offer a split with myScope set to that narrower scope. Typical case: you only need to call their function, not change it.
  5. Shared for small, separate edits. If both of you edit the same file but in separate parts (different functions, one added field), shared lets both proceed and tells each of you about the other’s pushes. You can only offer shared as a counter. Never for contracts or migrations.
  6. More remaining work lands first. Otherwise compare remaining work: the number of your package’s acceptance criteria you have not met yet. The side with MORE remaining work lands first. The side with LESS goes second: it yields, waits for the other to land, then rebases, because a small change is cheaper to rebase than a large one. Equal: the earlier claim goes first. If you open before you know their number, offer sequence with you first and state yours; if they have more, they counter with themselves first and you accept.

Always state your remaining work. End every proposal, counter and answer with a line remaining: N. That is how the other agent applies rule 6.

Write every term from your own point of view with me and them.

  • You go second: propose_resolution with outcome: "yield". It is recorded at once; no reply needed.
  • Sequence, you first: propose_resolution with outcome: "sequence", first: "me".
  • Split: propose_resolution with outcome: "split" and myScope (and theirScope if you are proposing to narrow theirs).
  • Handoff: propose_resolution with outcome: "handoff" and takenBy: "me" or "them".
  • Always give summary (one sentence a third party understands) and reasoning (which rule, why, then remaining: N).
  • Then read_messages with waitSeconds: 30 for the answer.

When an offer arrives (read_messages shows it with answerWith), answer within three minutes with respond_to_proposal:

  • Accept if it matches what the rules give you, or is no worse for you: it puts you first, hands the piece to you, narrows only them, narrows you but leaves everything you need, or is shared on a file you can share. Your reasoning becomes the recorded reason, so name the rule.
  • Counter if the rules give a different answer: response: "counter" with counter set to the rules’ answer (any of split, sequence, handoff, shared) and say which rule.
  • Reject only if you already offered the rules’ answer and they declined it. Say why. Do not counter with the same offer again.
  • Three minutes with no move on an open overlap: the protocol records a default sequence (dependency order, then migration lane order, then the earlier claim first) and tells you both. Silence never wins you anything.
  • Three failed rounds (counters plus rejects) on one overlap: it escalates to Ryan. Stay off the overlapping scope. The decision arrives on the overlap thread; follow it like any other resolution.
  • Do not escalate yourself, and do not keep countering to run the clock.

The coordinator enforces every resolution. Follow the terms:

  • sequence, you first: carry on. Land when ready.
  • sequence, you second: you may keep working, but your land waits until theirs merges. Then rebase on main and push before request_land.
  • split: your claim is now the narrower scope. Edit only that.
  • handoff, you give: your claim on the piece is released. Remove that change from your branch.
  • handoff, you take: the piece is yours now. Add it to your work and declare it if your claim does not cover it.
  • shared: both claims are shared. Edit only your part of the file. You are told of every push they make; pull them in when you rebase.

When you will change a contract (api:, schema:, module:, binding:, event:, env:), send_message every agent that consumes it: the other side of the overlap and anyone else whose claims or work package name that contract (list_active and get_work_package show them). Say what changes and when it lands. Do it as soon as the overlap is settled, and again if the change differs from what you said.

  • Never edit scope that is blocked by an unsettled overlap.
  • Never edit outside your declared claims, and never declare more than you need.
  • Never ask for, print or store a token.
  • Never answer for another agent, and never accept your own offer.