docs.na.id.au

This page covers the two operational patterns that make multi-agent work reliable in a shared git workspace: **parallel orchestration** (slots and mailboxes) and the **task-state harness** (a shared `…

05 — Orchestration & Task State

How a main agent (the “master orchestrator”) fans work out to multiple parallel sub-agents without write conflicts, and how task state survives long runs and context compaction.

This page covers the two operational patterns that make multi-agent work reliable in a shared git workspace: parallel orchestration (slots and mailboxes) and the task-state harness (a shared notes.md file driven by load_state / checkpoint). They sit on top of the sub-agent pattern in 04 and the tooling in 06.

Parallel orchestration: slots and mailboxes

When the orchestrator delegates to several sub-agents at once, two problems appear: they may try to write to the same files (git merge / write conflicts in the shared workspace), and the orchestrator needs a clean way to collect what each one did. The pattern used here resolves both with fixed slots and one mailbox per slot.

This is the multi-file version of the self-contained-prompt rule in 04: the prompt carries the task, the mailbox carries the return, and the slot isolates the write surface.

Local tooling: uv as the default

When agents — the orchestrator or its parallel sub-agents — run local Python tooling (scripts, linters, tests), the convention is to always go through uv, so the interpreter and dependency set are pinned by the workspace instead of drifting across whatever system Python happens to be installed:

The point is reproducibility: the same environment whether a human, the main agent, or a parallel sub-agent runs the command, and a verifiable git workspace before anything is committed.

Keeping task state across a long run: the notes.md harness

A long, tool-heavy task has two failure modes a plain chat transcript doesn’t solve: compaction (the model’s context is summarised mid-task, losing detail) and coordination (the orchestrator must remember which files are done, what each sub-agent did, and what comes next). The pattern used here is a small task-state harness — two tools, load_state and checkpoint, operating on one shared notes.md file.

notes.md is a small markdown state doc: frontmatter (task, status, created, updated) plus a fixed set of hot sections kept near the top so they are cheap to re-read.

# TASK STATE
task: <title>
status: in_progress

## OBJECTIVE        1-3 sentences: what "done" looks like
## CURRENT STATE    verified state (<= ~800 tokens), e.g. "28 tests pass"
## NEXT STEPS       ordered list of what happens next
## FILE MAP         one line per file + status (added / tested / done)
## HANDOFF          what you are about to do, exact commands, expected outcome
## LOG              append-only run log, one line per checkpoint

The two tools:

Rules that make it work:

Status is a small fixed set — pending, in_progress, blocked, done — which keeps the frontmatter greppable and lets other tools or agents reason about progress at a glance. The tools are plain Python (task-harness-tools.py, a small module on pydantic) and are covered by a pytest suite (tests/test_task_harness.py) that specifically checks the concurrency guarantee (many concurrent checkpoint calls must not corrupt the file) and the LOG-rolling behaviour. Treat it as a tested part of the stack, not a script you paste in.


Source Disclaimer