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.
Timings
Section titled “Timings”| 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 |
Decision rules, in order
Section titled “Decision rules, in order”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. |
The protocol text
Section titled “The protocol text”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. Before you edit anything
Section titled “1. Before you edit anything”- Call
join_sessiononce, first. It tells you your work package, your fork and who else is working. - Before you edit a file, call
check_overlapwith what you are about to touch, thendeclare_intentwith exactly that:paths,symbols(<file>#<Name>),contracts(api:POST /tips,schema:tips,module:<path>) andmigration: trueif you will add or edit a migration. Never edit outside a scope you have declared. - 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.
- Read the result:
blocked: false, no overlaps: go ahead.- Warnings only: go ahead, and
send_messagethe 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.
2. Who moves first
Section titled “2. Who moves first”- If your
declare_intent(or your push) raised the overlap, you open. Make your offer straight away. ANEW OVERLAPnotice says “You raised it” when that is you. - If the other agent raised it, wait for their offer:
read_messageswithwaitSeconds: 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.
3. Decide the settlement with these rules
Section titled “3. Decide the settlement with these rules”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.
- 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. - Undeclared edits go to the claim holder. A push touched scope the other agent claimed and you had no claim for it (a
diffoverlap where your claim is null):handoff, the claim holder takes the piece, and you drop the change from your branch. - Dependency order wins. One package depends on the other, directly or through others (
get_work_packageshowsdependsOn):sequence, the dependency lands first. - 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
splitwithmyScopeset to that narrower scope. Typical case: you only need to call their function, not change it. - Shared for small, separate edits. If both of you edit the same file but in separate parts (different functions, one added field),
sharedlets both proceed and tells each of you about the other’s pushes. You can only offersharedas a counter. Never for contracts or migrations. - 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
sequencewith 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.
4. Make and answer offers
Section titled “4. Make and answer offers”Write every term from your own point of view with me and them.
- You go second:
propose_resolutionwithoutcome: "yield". It is recorded at once; no reply needed. - Sequence, you first:
propose_resolutionwithoutcome: "sequence",first: "me". - Split:
propose_resolutionwithoutcome: "split"andmyScope(andtheirScopeif you are proposing to narrow theirs). - Handoff:
propose_resolutionwithoutcome: "handoff"andtakenBy: "me"or"them". - Always give
summary(one sentence a third party understands) andreasoning(which rule, why, thenremaining: N). - Then
read_messageswithwaitSeconds: 30for 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
sharedon a file you can share. Yourreasoningbecomes the recorded reason, so name the rule. - Counter if the rules give a different answer:
response: "counter"withcounterset to the rules’ answer (any ofsplit,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.
5. What happens if you do not agree
Section titled “5. What happens if you do not agree”- 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.
6. After it is settled
Section titled “6. After it is settled”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.
7. Contract changes notify every consumer
Section titled “7. Contract changes notify every consumer”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.
8. Never
Section titled “8. Never”- 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.