# Plans

Say 1 goal. Your agent splits it into small parts that run side by side, code checks every part, and you approve once.

Canonical: https://brainplane.app/docs/plans/

## Approve once

A plan is 1 goal cut into units. Each unit is 1 small job with 1 named input and 1 named output. The units run at the same time where they can. Code checks every attempt. A red unit goes back alone to its agent. You press once, at the end, on the merged result.

## Run a plan

1. On a topic page or in Handoffs, press **Plan it**. Write the goal, such as "Fix the 3 failing test slices". Pick the git repository and check the test command.
2. Press **Split**. Your own Claude Code or Codex reads the repository, read-only, and suggests up to 8 units.
3. Read the plan. brainplane draws 1 card per unit, side by side when they run at the same time, with a line only where 1 unit reads another unit's output. The page shows each unit's lane and the files it may change, the exact test command, and what Run adds to your repository. Edit a unit if you need to.
4. Press **Run**. Each unit runs in its own agent session and its own git worktree. Up to 3 units run at once.
5. When every unit is green and merged, 1 card waits in the Inbox: **Approve the result**. Press it to bring the result into your branch.

## Links only where data crosses

A line between 2 units stays only when a named output of the first appears in the input of the second. The order the units were typed in makes no link. brainplane lists each link it dropped in 1 line, with **Link them** to restore it on purpose.

Run stays off when the plan has a cycle, or when 2 units that run at the same time list the same file. The page names the units and the file.

## Every attempt is checked in code

After each attempt, brainplane commits it on the unit's branch and runs 3 checks:

| Check | Green when |
|---|---|
| Tests | the test command, with the unit's own test files, exits 0 in the unit's working copy, within 2 minutes |
| Scope | the attempt touches only the files listed for the unit, and adds no symbolic link |
| Changed | the attempt changes at least 1 line |

The test command runs in the macOS sandbox. It writes only in the unit's working copy and a private temporary folder, reaches no network beyond your Mac, and gets no tokens or keys. brainplane refuses to run it on a Mac without that sandbox.

These never count as a check: the output looks good, the agent says it is confident, nothing raised an error, a file exists.

## A red unit goes back alone

Every check gives a verdict in 5 lines:

```
UNIT      u2 Dates slice
VERDICT   red
REASON    Tests: failed (exit 1)
EVIDENCE  dates.test.js: expected "2026-10-10", got "10/10/2026"
SCOPE     change src/dates.js only; leave the other units' files alone
```

A red unit goes back to its own agent, in its own session, with its red verdicts and the scope line. The other units keep their work. Each unit names its tests, and it never changes them. A unit gets 3 attempts. After the 3rd red attempt it stops and says so: edit the unit, or split again.

## Lanes decide what waits for you

Each unit has a lane: how costly a mistake in it is to undo. brainplane computes a floor from the plan and again from each attempt's changes. You can raise a lane. Nobody can set it under the floor.

| Lane | For example | The gate |
|---|---|---|
| Contained | a test, a copy change, 1 function with its tests | opens when every check is green |
| Wide | a shared helper, a schema addition, more than 6 files | opens when every check is green, the unit went green within 2 attempts, it never failed its scope check, and units of the same kind on this topic were not sent back 2 times before; otherwise it stops for you |
| Hard to reverse | migrations, deleted files, production data, payments, release settings | always stops for you, with its change in view: **Let it into the merge** or **Send it back** |

The gate reads its evidence in a fixed order, and the page shows it in that order: the checks, this run's attempts, how often units of the same kind were sent back on this topic, then the agent's own note. The note comes last and never opens a gate.

## The merge and your approval

Code merges the units into a result branch, then runs the tests once more on the result, in the same sandbox. No model takes part in the merge. A conflict, or red tests on the result, stops the plan and names the units and the files.

Before you press, the page shows the whole change: each file with its line counts, and the diff line by line. **Approve the result** fast-forwards your branch to the result commit the card names. It refuses when the repository has uncommitted changes, or when your branch or the result moved since the card opened. **Rebuild on the new base** merges again in code, runs the tests again, and asks you again.

## 1 rule for next time

After you approve, brainplane offers 1 rule learned from the run, with its source, such as "from u2, which passed after its tests failed once". Edit it if you like. **Keep this rule** saves it as a settled decision of the topic, so the next split, every worker and every agent on the topic start from it. **Not now** drops it.

## From Claude Code

Ask for a plan in chat. 2 MCP tools do the work:

| Tool | What it does |
|---|---|
| `plan_start` | starts the split, read-only, and returns the plan and its page |
| `plan_status` | the units, their state and verdicts, and the result |

**Run** and **Approve the result** stay presses in brainplane. No MCP tool, hook or agent can run or approve a plan.

## What brainplane does

- It makes no model call of its own. The splitter and the workers are your own Claude Code and Codex, on your own subscriptions.
- It sends nothing, pushes nothing and deploys nothing.
- It deletes nothing. The branches `brainplane/<plan id>/<unit>` and `brainplane/<plan id>/result` and the worktrees stay until you delete them.
- Your working tree changes only when you approve, by a fast-forward.
- 1 Inbox card per plan, updated in place.

## Checks first in the second opinion

The same rule reaches the second opinion. Before the reviewing model writes its critique, brainplane runs checks in code on the version under review and shows them first. For a legal redline: clause numbering with no gap or repeat, each defined term defined once and used, each cross reference pointing to a clause that exists, and no long dashes in the versions an agent wrote. These checks prove structure. Whether a clause says the right thing stays with the reviewer, who now spends its turn on that.

The idea of a loop inside each unit and a graph between units comes from the article "Loops and Graphs" by Hanako on X (23 August 2026). This page and the feature are written in brainplane's own words and code.
