Skip to content

Roles and workflow

AgentFlow splits work across four roles plus a role-free Single Mode. Each role is a short instruction file in .agentflow/roles/; every session reads the same protocol, .agentflow/docs/ai-handoff-protocol.md, which is the single source of truth for the workflow.

The four roles

Orchestrator - the coordinator and the only writer of canonical project memory. It splits a goal into Task Files, launches workers, reviews their Results and accepts work on evidence. It never edits worker code itself.

Developer - does exactly one task: changes code inside the task’s Allowed files, runs the task’s ## Checks verbatim, makes one commit [T-NNN] <type>: <what> and fills the task’s ## Result. It works in an isolated git worktree on a dedicated t-NNN-* branch.

Tester - independently checks one task in a disposable checkout of the commit it verifies. Review isolation means it cannot change the artifact it checks: after its attempt, the launcher verifies the branch, worktree and Task File were not touched.

Deployer - consumes only an accepted commit and is always launched manually: the launcher prepares the attempt and a human starts the tool. A deployer never runs unattended.

The task lifecycle

  1. The Orchestrator writes a Task File - a contract naming the role, allowed files, checks and acceptance criteria - and adds a row to the Task Ledger.
  2. run_task.py creates the worktree and branch, runs the preflight gate (deny rules, file ownership, ledger state), records the attempt and hands the task prompt to the chosen tool.
  3. The worker does the task and writes its ## Result into the Task File in the main folder - never the copy inside its own worktree.
  4. The Orchestrator runs python .agentflow/tools/gate.py verify T-NNN, which executes the task’s ## Checks verbatim. On a pass, python .agentflow/tools/accept.py T-NNN merges the branch, marks the ledger done and cleans up the worktree.
  5. A failed verify rejects the task: the Orchestrator writes a successor Task File with the findings. A blocked Result comes back with the worker’s question instead.

Why the split matters

Each task is one Task File, one branch, one isolated worktree and one fresh session. That structure is what prevents the two classic multi-agent failures: workers colliding on the same files, and “done” being reported without evidence. The Orchestrator reads recorded evidence - gate output and Results - rather than trusting a summary.

Single Mode

Not every project needs a team. /start-session starts a role-free session that does the work itself and maintains project memory under the same protocol, following the same task-branch lifecycle for substantial changes.