What you will be able to do
- Split a project into slices that each have their own goal and checks, and fit one agent's run.
- Choose a new session, a subagent or a parallel worktree for each slice, and say why.
- Assign file ownership so no two agents edit the same file at the same time.
- Sequence and merge parallel work so that each merge is checked before the next builds on it.
- Write a handoff that lets a fresh agent, or a person, pick up the work cold.
Decomposition is where operating a harness starts to look like running a team. The skills are old ones (scoping, ownership, integration) applied to workers that are fast, literal, and know only what you tell them. You should be comfortable with briefs and context first: every slice in this module needs its own brief, and every worker needs its own context.
3.1 Slice by outcome, not by layer
The natural way to split a feature is by layer: one agent on the database, one on the API, one on the UI. It feels parallel, but none of the pieces can be checked alone. The database agent finishes with nothing a user can see, and you only find out the pieces don't fit when the last one lands.
Slice by outcome instead. Each slice is a thin piece that works end to end and has its own "done means":
Feature: customers can save items to a wishlist.
By layer (hard to check): By outcome (each one checkable):
1. wishlist table + migration 1. Logged-in user adds an item; it
2. API endpoints shows on /wishlist after reload.
3. wishlist page + button 2. User removes an item; it's gone
after reload.
3. Logged-out user sees "Sign in to
save" instead of the button.
4. Wishlist count in the header.
Slice 1 touches every layer, but only a little of each, and you can see it working. Slices 2 to 4 build on it. When you must split by layer (a big migration, say), define the contract between the layers first, in writing, and give each layer a check against that contract.
How big is a slice?
A slice is right-sized when one agent can do it in one session, with checks you can read in a couple of minutes. Signs a slice is too big: the brief needs more than one goal sentence, the "done means" list runs past seven or eight items, or you can't name the files it will touch. Signs it's too small: the coordination costs more than the work, or two slices always change the same lines.
Sometimes the right number of pieces is one. If a task has two real parts, running it as six agents produces four agents' worth of busywork and three merges. Our free /swarm command is built with that rule: if a task has fewer real pieces than the agents you asked for, it uses fewer and says why.
The common mistake
Splitting before you understand the work. A decomposition made from guesses about the code puts boundaries in the wrong places. Spend the first session reading and planning, often in plan mode, and split from what it found.
Take a feature from your backlog that you'd naturally split by layer. Rewrite it as three to five outcome slices, each with one goal sentence and two checks a user could see. Mark which slices depend on which.
3.2 Session, subagent or worktree
Harnesses give you three ways to run work separately. They solve different problems, and picking the wrong one is the most common source of collisions and wasted tokens.
| Unit | What it is | Use it for | Watch out for |
|---|---|---|---|
| New session | A separate conversation with its own context and history. | Unrelated tasks; a fresh start after a session went wrong; long work you'll resume over days. | Shares your working folder unless you isolate it. |
| Subagent | A helper the main agent starts, with its own context window, returning only a summary. | Research and wide searches, noisy output (a full test run), independent review, a task with fewer tools. | Starts fresh: knows only what the parent put in its prompt. Costs its own tokens. |
| Worktree | A separate git checkout on its own branch, in its own folder. | Parallel edits to the same repository without agents overwriting each other. | Needs merging back. Untracked files such as .env aren't there unless copied. |
Subagents: a fresh pair of hands, not a smarter one
In Claude Code, each subagent runs in its own context window with its own system prompt, tool access and permissions, starts without your conversation history, and returns a summary (Subagents). You can define your own in .claude/agents/ (project) or ~/.claude/agents/ (personal), as a Markdown file with frontmatter. Only name and description are required; tools restricts what it can do.
---
name: reviewer
description: Reviews a diff against the brief it was built from.
Use after a slice is implemented, before merging.
tools: Read, Grep, Glob
---
You are reviewing work you did not write. Compare the changed files
with the brief you are given. Report only gaps that affect whether
"done means" is met. Skip style.
That reviewer can't edit anything, and the limit is enforced by the harness, not requested in the prompt. Anthropic's guidance is candid about cost: subagents pay off for parallel work, keeping long output out of your main conversation, independent review and restricted tools, but each one spends its own tokens, and by default it's the same model or a smaller one, so you get parallelism or fresh eyes, not a better answer (know what subagents cost).
Worktrees: parallel edits without collisions
A git worktree is a second checkout of the same repository, on its own branch, in its own folder. Two agents in two worktrees can edit the "same" file without touching each other's copy. Claude Code starts a session in one with a single flag; run it again with a different name in a second terminal for a second isolated session (parallel sessions with worktrees). Codex has a global --worktree flag that starts in a new managed git worktree (Codex commands). Without either, plain git does it:
# Claude Code
claude --worktree wishlist-remove
# Codex
codex --worktree
# Any harness
git worktree add ../shop-wishlist-remove -b wishlist-remove
cd ../shop-wishlist-remove && your-harness
Two details catch people. The repository needs at least one commit before a worktree can be created. And a Claude Code subagent with isolation: worktree gets a temporary worktree that, by default, branches from your default branch, not from the parent session's current commit (Subagents). If the parent has unmerged work the subagent needs, commit and tell it, or it will build on code that doesn't have it.
The common mistake
Running two sessions in the same folder "because they touch different files". They read each other's half-finished edits, one runs the formatter over the other's work, and a git checkout in one swaps the branch under the other. If two agents edit one repository at the same time, give each its own worktree.
For each slice from 3.1, write which unit you'd use (new session, subagent or worktree) and one sentence why. Then start two of them in parallel worktrees on your own repository and confirm with git worktree list that each is on its own branch.
3.3 One owner per file
Worktrees stop agents overwriting each other's files while they work. They don't stop the conflict when you merge. The way to prevent that is to plan it: every file that will change has exactly one owner for the duration of the parallel work.
## Ownership: wishlist, 3 parallel slices
slice-add owns src/routes/wishlist.ts, src/ui/WishButton.tsx,
test/wishlist-add.test.ts
slice-remove owns src/ui/WishlistPage.tsx,
test/wishlist-remove.test.ts
slice-header owns src/ui/HeaderCount.tsx
Shared, edited by ME only, after merges:
src/routes/index.ts (route list), package.json, the migration
Read-only for everyone: src/gen/ (generated: run `bun run gen`)
Three kinds of file need special treatment:
- Hot spots. Files every slice wants to touch: route lists, an index of exports, a translations file, a lockfile, a changelog. Take them out of the slices and edit them yourself (or with one agent) after the merges, or let one slice own them and the others wait.
- Generated files. Never owned by anyone. Edit the source and run the generator. Put the path on every slice's "don't touch" list.
- Contracts. If slice B calls code slice A is writing, write the interface first (a type, a function signature, an API shape) and merge it before either starts. Both build against something real.
When the ownership map is written down, a worker that finds it needs a file it doesn't own has a clear action: don't edit it, report it. That one rule turns most merge conflicts into a line in a report.
The common mistake
Giving two agents "the frontend" and "the styles". Every component has styles. Ownership has to be by file or folder, written as paths, or it isn't ownership.
Write an ownership map for the slices you chose. List the hot spots you took out of the slices, and the order you'll edit them in. If a file appears under two owners, re-slice until it doesn't.
3.4 Sequence and merge
Parallel work ends in a merge, and the merge is where finished slices turn back into broken code. Treat it as a step with its own checks.
- Merge in dependency order. Contracts first, then the slice others build on, then the rest. Write the order in the plan before work starts.
- One merge at a time. Merge a slice, run the full checks on the result, then merge the next. Two slices that each pass alone can fail together.
- Rebase the rest after each merge. The next slice should be tested against what's now on the main line, not against the commit it started from.
- Verify the merge happened. Before building on merged work, confirm it's actually there:
git logon the target branch, the pull request state, the CI run. A slice reported as merged that wasn't is a classic way to build a day of work on nothing. - Run the original brief's checks at the end. The slices each had their own "done means". The feature has one too. Check it on the combined result.
$ git switch main && git merge --no-ff wishlist-add
$ bun test && bunx tsc --noEmit # green: 48 passed
$ git switch wishlist-remove && git rebase main
$ bun test # 1 failed: WishlistPage expects
# old response shape
# fixed in wishlist-remove, re-run: 51 passed
$ git switch main && git merge --no-ff wishlist-remove
$ git log --oneline -3 # both merges present
Finish the approved bulk change
Sequencing has a second side. Once a wide change is agreed (rename this everywhere, migrate every page to the new component), the slices should finish it, not stop every few files to ask again. Our rule: once a bulk change is approved, finish it. Stop only for something destructive. Put that in the workers' briefs, with the destructive cases named.
The common mistake
Merging everything at the end in one go, then debugging a combined failure with five possible causes. Merge one, check, merge the next. The cost is a few minutes per merge; the saving is never having to bisect a five-way integration.
Take two parallel branches (from your own worktrees, or make two small ones). Merge them one at a time, running your checks after each and rebasing the second onto the first's result. Write down anything the second check caught that the slice's own checks didn't.
3.5 Handoffs and checkpoints
Every time work moves (to a subagent, to a new session, to tomorrow, to a colleague), something is passed along and something is lost. A subagent knows only the prompt you gave it. A new session knows only what's on disk and in its instruction files. Your job is to make the handoff complete enough to pick up cold.
Briefing a worker
A worker brief is a full brief plus three things that only matter in parallel work:
Goal: removing an item from /wishlist persists after reload.
Done means: `bun test test/wishlist-remove.test.ts` passes; on
localhost, remove an item, reload, it's gone (screenshot).
You own: src/ui/WishlistPage.tsx, test/wishlist-remove.test.ts.
Don't touch: anything else. If you need another file changed,
stop and list it under "Needs" in your report.
Already decided: DELETE /api/wishlist/:itemId exists (merged in
a41c9e2). Don't change its shape.
Report back, under 15 lines: what changed (paths), commands run
with their results, Needs, anything UNVERIFIED.
"Already decided" carries the context the worker can't see. "Report back" sets the shape and the length of what returns, so twenty workers don't flood your context with twenty essays.
Checkpoints for sessions and days
For work that spans sessions, keep the state in a file, not in the conversation. A good checkpoint has the same headings every time: done, in progress (with the exact stopping point and the very next step), not started, decisions, gotchas (approaches that failed, so they aren't retried), and the state of the world (branches, unpushed commits, running servers, open pull requests). Mark anything you didn't check as UNVERIFIED.
## In progress
- wishlist-remove: test passes, screenshot not taken.
Next: `bun run dev`, remove item on /wishlist, reload, screenshot.
## State of the world
- main @ 3f0b2c1, pushed. wishlist-remove @ 9d41e07, NOT pushed.
- worktree ../shop-wishlist-remove still exists.
## Gotchas
- Optimistic UI removal hid a failed DELETE; don't retry that approach.
Harnesses help with resuming (claude --continue and claude --resume in Claude Code, codex resume in Codex), but a resumed conversation still carries its old, possibly stale picture. The checkpoint file is the verified record. Our free /checkpoint and /summary write and read one, checked against live git, and /summary all covers every project at once.
The common mistake
Trusting a worker's report as fact. A report is a claim. Before you merge or build on it, check what it says against the branch, the diff and the test output. Module 4 is about exactly that.
At the end of a real working session, write a checkpoint using the headings above. The next day, start a fresh session, give it only the checkpoint, and see whether it can state the next step correctly without asking you anything. Every question it asks is a gap in the handoff.
Practice task
Build one small feature in your own repository as three parallel slices, merged back with checks.
- Plan in one session (plan mode if your harness has it): read the code, then write three outcome slices with goals and checks, an ownership map, the hot spots you'll handle yourself, and the merge order.
- Create three worktrees, one per slice, and start one agent in each with a worker brief from 3.5.
- While they work, start one read-only subagent or fresh session to review the first slice that finishes against its brief.
- Merge one slice at a time, running the full checks and rebasing the next after each merge. Then make the hot-spot edits.
- Run the feature's own "done means" on the combined result, and write a checkpoint.
Success criteria.
- Each slice had its own goal and checks, and could be shown working on its own.
- No file was edited by two agents; any "Needs" requests went through you.
- Each merge was followed by a check run whose output you kept.
- The feature's checks pass on the merged main line, confirmed from git, not from a report.
- The checkpoint lets a fresh session state the next step without asking you.
Check yourself
Why slice by outcome rather than by layer?
An outcome slice works end to end and can be checked alone. Layer slices can't be checked until they're combined, so mismatches surface only at the end, when they're most expensive to fix.
When is a subagent the right unit, and when isn't it?
Right for research, wide searches, noisy output, independent review and restricted-tool tasks, because it works in its own context and returns a summary. Wrong when you expect a better answer from the same model, or when it would spend longer rebuilding context the main session already has.
What does a Claude Code subagent with isolation: worktree branch from by default?
From your default branch, not the parent session's current commit. If it needs unmerged work, commit it and say so in the prompt.
What do you do with a file every slice wants to edit?
Treat it as a hot spot: take it out of the slices and edit it yourself after the merges, or give it to one slice and make the others wait. Never let two parallel agents own it.
What goes in a checkpoint that a conversation summary tends to lose?
The exact stopping point and next step, unpushed branches and other state of the world, decisions with reasons, and failed approaches, with anything unchecked marked UNVERIFIED.
Key takeaways
- Slice by outcome. Each slice has its own goal and checks and fits one run. Sometimes one slice is right.
- New session for unrelated work, subagent for side work and review, worktree for parallel edits.
- Every changing file has one owner. Handle hot spots yourself; never hand-edit generated files.
- Merge one slice at a time, check after each, verify the merge is really there.
- Worker briefs add ownership, what's already decided and the report shape. Checkpoints keep state on disk.
Go further
- Module 4: Verification: checking every report and merge before you trust it.
- Module 5: Steering: watching parallel runs and knowing when to step in.
- Module 8: Economics: what parallel agents cost, and when they pay.
- Free skills:
/swarm,/checkpointand/summary. The HOPE console shows parallel sessions, with subagents nested under their parent. - Guided training and the Senior Operator certificate, which tests parallel work.