Multi-Agent Coordination Patterns: Pull Task Boards, File Mailboxes, Two-Level Abort & Batching
Production coordination primitives from modern coding harnesses: lockfile-backed pull task boards, append-only JSON mailbox IPC, nested two-level AbortControllers, and concurrent-read / serial-write tool partitioning.
- 01Push-based central coordinators bottleneck on worker tracking and crash recovery; disk-backed pull task boards with
blocks/blockedByarrays let idle agents self-assign unblocked work atomically. - 02Append-only per-agent JSON mailboxes guarded by
proper-lockfilesurvive process crashes, require zero broker infrastructure, and multiplex chat turns with structured control messages. - 03Nesting a turn-level
AbortControllerinside a lifecycle-levelAbortControllerlets operators interrupt a runaway tool call and redirect the agent without destroying session state. - 04Partitioning multi-tool model turns into consecutive concurrent read batches (
isConcurrencySafe) and isolated serial writes eliminates state-mutation race conditions automatically.
2. File-Based Mailbox IPC & Nested Two-Level Abort Control
Sockets and message brokers add operational fragility to local and containerized agent teams. One JSON inbox file per agent (inboxes/<agent>.json), written under an exclusive lock after re-reading disk contents, works identically across in-process threads and separate OS processes while remaining inspectable with standard CLI tools.
Long-running agents also require two distinct stop granularities—pausing a mistaken tool call versus terminating the worker outright:
- Multiplexed Control & Conversation Payloads: A single
typediscriminator routes plain text as conversation turns alongsideshutdown_request,permission_request,plan_approval_request,task_assignment, andidle_notificationenvelopes. - Lifecycle vs. Turn
AbortController: AbortingcurrentWorkAbortControllerstops only the active turn (signal.reason === "interrupt"when a user sends a mid-turn correction) so the agent stays alive and reads its next mailbox message; aborting the parentlifecycleAbortControllerruns full teardown. - Per-Tool Interrupt Contracts: Read-only search tools declare
interruptBehavior: "cancel"to abort immediately on new input, whereas transactional writes declare"block"so in-flight mutations finish cleanly.
3. Concurrent Read / Serial Write Batching Over a Shared Ontology
When a model emits seven tool calls in a single turn, running them serially wastes wall-clock seconds, while running all seven in parallel risks write races. Automatic batch partitioning resolves both:
partitionToolCallsScheduling: Consecutive tools markedisConcurrencySafe: trueexecute concurrently (up to a bounded pool such as 10), while any state-mutating tool starts a dedicated serial batch.- Deferred Context Modifiers: Side effects on session context produced by concurrent reads are queued and applied deterministically only after the entire parallel batch completes.
Lockfiles and mailboxes prevent file corruption, not business contradiction. Ensure every worker on the task board queries one shared enterprise ontology so financial, inventory, and planning agents compute identical numbers.
Glossary Concepts Referenced in This Guide
Agent = Model + Harness) responsible for tool-calling loops, context compaction, retries, sandboxing, and execution traces.UPDATE/INSERT statements on ERP/CRM databases, requiring typed action proposals validated against preconditions and approved by a named human role.Free to reference in engineering docs, ADRs, articles, and course syllabi with attribution.
[Multi-Agent Coordination Patterns: Pull Task Boards, File Mailboxes, Two-Level Abort & Batching — Ontoloji.org](https://ontoloji.org/en/guides/claude-code-multi-agent-patterns-task-boards-mailboxes-and-abort)