How to run an economy chain¶
Use this page when you have a long chain of small tickets and you want the fewest tokens. In economy mode, the engine builds the tickets one after the other. Each ticket builds on the one before it. The engine verifies once for each stack, at the end of the chain.
If you need to find a defect before the next ticket builds on it, use assure mode. See the workflow reference for the two modes.
Before you start¶
- Make the agent pair for your stack. See how to bootstrap a single-stack repository.
- Commit the agent files. The engine builds in git worktrees, and a worktree holds only what you committed.
- Write each ticket as behaviour. A ticket holds no file path. The engine adds the file boundary to the brief.
Steps¶
1. Write the workflow¶
Set mode = "economy". Put the order of the chain in blocked-by. Here ticket 3 waits for ticket 2, and ticket 2 waits for ticket 1.
base-branch = "main"
run-branch = "run/chain"
mode = "economy"
adapter = "claude-code"
[stacks.python]
specialist = "python-specialist"
verifier = "python-verifier"
gates = ["python3 -m unittest"]
# The engine also reserves .claude/agents/ and .opencode/agents/ in every stack.
hotspots = ["workflow.toml"]
# The time limits of one gate run and of one agent session, in minutes.
gate-timeout = 30
agent-timeout = 90
[[tickets]]
id = "1"
text = "The export command reads the data set."
stack = "python"
blocked-by = []
[[tickets]]
id = "2"
text = "The export command writes a header row."
stack = "python"
blocked-by = ["1"]
[[tickets]]
id = "3"
text = "The export command quotes a comma."
stack = "python"
blocked-by = ["2"]
The specialists run on the tier standard. To use a cheaper tier, add [tier-overrides] with specialist = "cheap". The verifier tier never goes down, in any mode.
2. Check the plan¶
The command prints the tickets in the order of the chain, and then the quality check. It builds nothing. Read each warn line of the quality check. See how to write a workflow for a run.
3. Run the chain¶
The engine does these things:
- It makes the run branch
run/chain. - It builds ticket
1in a worktree. It runs no gate for one ticket. - It builds ticket
2on the branch of ticket1, and ticket3on the branch of ticket2. - It runs the gates of the stack once, on the end of the chain.
- It starts one blind verifier for the stack. The verifier gets the text of the three tickets, the diff of each ticket, and the output of the green gates.
- On ACCEPT, it moves the run branch to the end of the chain.
When the run starts, the command prints run <run id>, journal <path>, and a line that tells how to follow and pause the run. When the run ends, it prints a summary line, for example run built · 2s · 3 built · 0 failed · 0 skipped · 0 new · 0 cache. It exits 0 when every ticket is built and accepted.
4. Read the result¶
Each ticket has one row in the ticket table. The state built and the verdict ACCEPT mean that the ticket is done and checked. The verdict of the stack covers each ticket in the chain.
5. Take the work¶
The engine never merges to your base branch. The run branch holds only accepted work, so a fast-forward is enough.
When the gates are red or the verifier rejects the chain¶
Red gates at the end of the chain start a fix-up round. The fix-up brief gives the end of the output of each red gate. It also names a copy of the full log of each red gate, in the scratch directory of the fix-up session. See the copy of the log of a red gate. The fix-up is a new commit on the end of the chain, and the engine then runs the gates again.
A REJECT also starts a fix-up round. The engine runs the gates on the new commit, and a fresh verifier then checks the new commit and the findings.
Red gates and a REJECT share two fix-up rounds for each stack. A third problem fails the stack, and the run branch does not move.
The verifier starts each finding with the id of its ticket in square brackets. For example, the finding [2] The header row is missing. is about ticket 2. The engine uses the label to name the ticket. See the chain verification for the rules of the finding map.
To follow a run, to pause it, or to add a ticket to the chain, see how to watch and resume a run. That page also tells how to go on after an interruption. A ticket that a resume adds after the chain verification gets its own gates and verifier.