This file lands the full operational flow from the reference dispatch project into agent-dispatch.
These flows are now interpreted through the local prompt + CLI runtime, not through a host-specific skill implementation.
Primary source:
skills/dispatch/SKILL.mdin the upstreamdispatchreference repo
Supporting sources:
skills/dispatch/references/first-run-setup.mdin the upstream reference reposkills/dispatch/references/config-modification.mdin the upstream reference reposkills/dispatch/references/proactive-recovery.mdin the upstream reference reposkills/dispatch/references/ipc-protocol.mdin the upstream reference repo
Trigger:
- no dispatch config exists
Steps:
- detect installed CLIs
- discover models
- choose a sensible default
- generate config
- continue with the original request
CLI detection targets:
agentclaudecodexpi
Model discovery policy:
- prefer native discovery commands when available
- use backend preference rules when multiple CLIs expose overlapping models
- group all discovered models into the generated config
Trigger:
- user requests config changes instead of task execution
Supported operations:
- add model
- remove model
- change default
- add alias
- repair backend mapping
Rule:
- stop after config is updated
- do not continue into task dispatch automatically unless the user asked for both
- resolve backend and model
- parse directives
- create task plan
- persist task state
- build backend invocation
- launch worker
- capture stdout and stderr
- capture or persist session reference
- report task id and summary
- return control immediately
In the current runtime, the dispatcher prompt decides which command to run and the CLI performs the durable side effects.
Mailbox traffic is worker-initiated only.
Directory:
.dispatch/tasks/<task-id>/mailbox/
001.question
001.answer
001.done
.done
Rules:
- dispatcher must not write unsolicited mailbox files
- answers are atomic writes
- unanswered questions must be detected on restart
Trigger:
- worker timed out waiting for mailbox answer
- worker exited after marking
[?]
Steps:
- read the blocked step
- read
context.mdif present - ask the user for the missing input
- start a new worker
- inject the saved context and answer
- continue from the blocked step
Trigger:
- worker failed to start
- CLI disappeared
- auth failed
- quota failed
Steps:
- verify current CLI availability
- determine which alternatives still exist
- present a compatible replacement
- update config if the replacement should persist
- re-dispatch
When the user asks for status:
- read canonical task state
- read plan markers
- read recent events
- check whether there is a pending mailbox question
- summarize only what matters
The host should prefer inspect as the default progress read because it combines task snapshot, recent events, and pending questions.
Parallel:
- separate task ids
- separate session refs
- separate outputs
Sequential:
- task B waits until task A completes
- do not merge dependent tasks unless the dependency is trivial
At minimum:
- task metadata
- backend selection
- execution mode
- session reference
- last invocation
- event log
- stdout/stderr artifacts
This is the durable minimum needed to recover after host restarts.