← Back to the Wiki

Best practices

CLI
>=0.28.1
Skill
>=1.4.2
Executors
claude-code, codex, gemini-antigravity
System
macos
Reviewed on
2026-11-20

Running batches in parallel

Organizing work in batches teaches you to plan and create child issues. This page teaches you to run them together: the main conversation, which orchestrates, hands each issue to an executor sub-agent, and each one takes its issue through the workflow until it opens the PR. Do this only when you ask for it and authorize it.

When parallel work pays off

  • It pays off when there are two or more independent issues with a clear spec, and waiting time matters more than cost.
  • It doesn't when the issues depend on each other, when decisions are still open, or when there are only a few small ones. Then one session per issue, in sequence, is cheaper.
  • Each executor sub-agent pays for its whole context: the skill, the issue, the workflow stage and the repository. Four issues in parallel cost at least four sessions. See Cost and context.

1. Build the waves

Use the blocking relations between issues (blocks / blocked by) and the epic's hierarchy.

  • Wave 1: the issues that depend on no other open issue. They run together.
  • Later waves: each issue waits for the merge of the issues that block it. Starting earlier makes the agent build on something that is still going to change.
  • If the epic set a development order, that order wins.

Example: an epic with six children. Four are independent (a Wiki page, a server fix, a taxonomy and a native type) and make up wave 1. A validation that depends on those four makes up wave 2. A screen that depends on the validation makes up wave 3.

Ask the LLM to show the waves and wait for your OK before it starts.

2. Isolate each issue

One issue, one worktree, one branch, one PR.

  • Each agent creates its own worktree from the up-to-date remote default branch.
  • Nobody switches branches, stashes or edits in the shared checkout: it may hold work of yours in progress.
  • Two agents never write to the same folder.
git fetch origin
git worktree add -b <branch> ../<repo>-<issue> origin/<default-branch>

3. Each issue with its own governed flow

The executor sub-agent handles its issue as if it were the only one: it reads the issue, resolves the stage, performs the role, posts the gate comment and requests the grant for each transition.

  • The resolved stage, the grant and the nonce belong to the issue that requested them. Never reuse another issue's or another agent's.
  • Each agent reads its issue's state on the board before acting. Don't assume the state from what another agent did.
  • Working in parallel changes who executes, not what the workflow allows. If an action is refused, the agent stops and reports. See case P16 in Troubleshooting.

4. Agree on autonomy

Before starting, write down how far the agents go on their own. The most common agreement:

  • They may: advance the issue through the workflow up to implementation, edit in their own worktree, run the tests and open the PR.
  • They stop and report: on a new decision the spec or the ADR doesn't cover, on a refusal with no way out offered, or on missing access. They don't guess and don't work around it.
  • Never without you: merge, release, moving to QA or to done.

5. Write a common briefing

Each agent gets the same base instruction, in a file they all read, plus its own issue. The briefing covers:

  • Workspace: with more than one workspace on the machine, which one to use. See Several organizations and workspaces.
  • Board: the provider, the team and the board's state IDs, so that each agent doesn't have to discover them.
  • Source of truth: the epic's spec and ADR, and where they are.
  • Repositories: which ones, the default branch and a note that the main checkout is not touched.
  • Autonomy: the agreement from step 4.
  • Validation: which tests to run, with the real output in the report.
  • Report: the issue's final stage, the PR link, tests and results, deviations and open decisions, grants left unconsumed.
  • Known pitfalls, like the ones below.

CLI and shell pitfalls

  • The nonce only comes in the first response to issue. Save the response before anything else. Asking again with the same idempotency key returns already_issued, without a nonce. In that case, ask with a new key. The unused grant expires on its own.
  • Claim and consume take no scope. They use the scope stored in the grant. But they carry the same issue context that issue carried: the state, the state ID and every label.
  • In zsh, $GID is a special variable that only accepts a number. Don't use that name to hold the grant ID.
  • In zsh, git revisions with : need quotes. Without quotes, zsh reads what comes after the colon as a modifier.
git show "origin/master:docs/README.md"

6. Consolidate from the board and the PRs

The agent's report is a starting point, not proof. Before saying the batch is done:

  1. Open each PR: right branch, diff limited to the issue, tests with real output.
  2. Check each issue's stage and labels on the board.
  3. Compare with the report. Whatever doesn't match comes back to you; it isn't fixed silently.
  4. List the grants left unconsumed, with the reason.

7. Parallel PRs

  • Issues in the same wave that touch the same files will conflict. That's expected: ask for a minimal, focused diff in each one.
  • Merge in wave order. After each merge, the next PR rebases on the default branch and runs the tests again.
  • Shared files, such as indexes and lists, get the smallest possible change.

If something fails mid-batch

An agent that stopped doesn't undo what the others did. To resume:

  1. Read the board. Each issue's stage on the board is what counts, not what the conversation remembers.
  2. Check open grants. A grant issued and not consumed expires on its own; don't reuse its nonce. If the board write already happened, don't repeat it: ask the LLM to check the grant and the issue before any new attempt.
  3. Check the worktree and the branch. What was committed and pushed is still there. Check the rest before discarding it.
  4. Give the new agent the common briefing, the issue, the gate comments already posted and the PR, if any. It rereads all of it; don't assume it knows what the previous one did.

Prompt templates

Plan the waves:

/malha-os-workflow For epic ABC-100, build the execution waves from the blocking relations between its children. Show the waves and wait for my OK. Don't change anything.

Run a wave:

/malha-os-workflow Run wave 1 of ABC-100 in parallel: one sub-agent per issue, each with its own worktree, branch, PR and governed flow. I authorize advancing up to implementation and opening the PR. Stop on any decision the spec doesn't cover. Don't merge or move to QA. At the end, check each PR and the board and report back.

Resume a batch:

/malha-os-workflow Resume the ABC-100 batch. List each child's stage on the board, the open PRs and the unconsumed grants. Don't change anything.

Common mistakes

  • Running in parallel what depends on something else. Wave 2 starts after wave 1 is merged.
  • One checkout for everyone. Agents switching branches in the same folder wipe out each other's work.
  • A briefing that lives only in the orchestrator's head. Each agent starts with no context and guesses whatever the briefing doesn't say.
  • Trusting only the report. Check the PR and the board.
  • Autonomy with no written limit. The agent decides on its own what should have come back to you.

Status

  • Available: this procedure, used on a real epic with four children in parallel, each taken to a PR by a sub-agent in Claude Code.
  • Limitation: it depends on the executor offering sub-agents that run commands and edit files. What each agent may do is still decided by your organization's workflow. In other executors, try it first with a small wave.

View as Markdown