All docs
Work
Router
The one you talk to. It judges and never executes. The contract, how it is delivered, the guard and the notification queue.
The Router is the one you talk to: a resident Worker whose role is router. It only judges which Repo a request belongs to and what intent it is, then dispatches, forwards or informs; it never executes. Hand-offs between steps, review and closing are done by the engine and do not pass through it.
The Router session
- A Desk has at most one Router session. Which Client it runs on, with which harness and model, is the binding of the role
router. - Its working directory holds only drafts.
- The engine creates it the first time there is a message for it; you can restart it from the Router tab.
- While its Client is offline, messages for it stay in the queue and are delivered after it reconnects.
The contract
The Router works from a contract. The contract is a text of three parts, generated by the engine:
| Part | Comes from |
|---|---|
| Rules | router/contract.md in the official plugin |
| Intent table | The name, workflow and "used for" of every intent in workflows.yaml |
| Project table | The id, name, purpose and aliases of every Repo in the main repository, and the intents it disables or restricts |
The contract has a version and a digest. Whenever a role, a workflow, a Repo registration or the rules themselves change, the engine registers again: it regenerates the contract and increments the version. The Router's next message therefore carries the new contract, and it always works from the latest one.
Delivering the contract
The engine pushes the contract with the messages it sends to the Router: in full every 10 turns, and otherwise only a version line, a self-check sentence and a compact board.
The self-check sentence asks the Router to verify first that its context still holds this version of the contract in full. If it does not (for example after the session was compacted), it replies with one fixed marker, [[NEED_CONTRACT]], and the engine immediately resends the same message as a full turn. Most of the contract input is saved in normal turns, and after a compaction the Router never works from damaged rules.
The guard
The Router cannot do executing work; the rules in its contract constrain it:
- The only commands it may use are these
ailsubcommands:dispatch,continue,send,stop,archive,result,board,map,log,repo find,journalandop. - It reads and writes files only in its working directory.
- However small the matter, it dispatches a Worker: it does not read repositories or look things up itself in order to answer.
Stepping over the line is visible: every tool the Router calls is recorded as an event in its session, and you can see it in the Router tab.
The notification queue
When a run needs the Router, the engine puts a notification into its queue; what you type in the Router tab enters the same queue. When the Router is idle the engine merges the queue into one message: your words first, notifications after.
When it is notified: a run ends, a Worker is blocked, a workflow cannot continue. waiting, progress, review rounds and Workers in conversation do not notify: they do not need the Router.