Guide7 min read
Subagents and worktrees: why the rule you said in chat never reaches the fourth worker
Claude Code, Codex and Cursor start every subagent from a brief the main agent writes, and a worktree isolates files and nothing else. What each one documents, a 20-minute drill and where a decision has to live so every worker reads it.

You split a refactor across four workers. Twenty minutes earlier, in the main session, you had said: leave the legacy billing adapter alone, the mobile app still calls it. Three workers leave it alone. The fourth rewrites it. No error is printed and git has no complaints: every worker had its own worktree and nothing collided. The rule was in your conversation, the fourth worker started from a shorter brief, and the sentence was not in it.
This is not one product's bug. Parallel work in a coding harness rests on two kinds of isolation, both deliberate. A worktree isolates files. A subagent isolates context. They are why you can run four workers at once, and neither of them carries a decision from one worker to the others.
What a worker starts with
A subagent does not continue your conversation. The main agent writes it a brief and the worker starts from that. In the vendors' words, read on November 29, 2026:
- Claude Code: "Each subagent starts with a fresh, isolated context window. It doesn't see your conversation history, the skills you've already invoked, or the files Claude has already read."
- Cursor: "Subagents start with a clean context. The parent agent includes relevant information in the prompt since subagents don't have access to prior conversation history."
- Codex: the subagents page lists what a subagent inherits (model, sandbox and approval settings, skills, MCP servers) and recommends telling Codex "what summary or output to return". It does not say whether a subagent sees the parent conversation.
The way back is as narrow as the way in. In Claude Code the subagent returns "only the summary", in Cursor "The parent only sees the final summary", and in Codex a summary is the recommended pattern. So a fact reaches a worker if the main agent thought of putting it in the brief, and a finding reaches the main agent if the worker thought of putting it in the summary.

Two rows of the comparison matter for the rest of this post. The first is a match: in all three, a subagent inherits the main agent's MCP servers. It is the one channel that reaches a worker without anyone remembering to put it in the brief. Cursor's cloud subagents are the exception, since they run on a VM and take their servers from the team configuration. The second is a real difference: Claude Code and Codex let a hook add text to every subagent the moment it starts, while Cursor's hook at that point can only allow or deny.
A worktree isolates files, and that is all
Before the context problem there is a git one. Cursor warns: "Subagents share the parent agent's checkout by default. When several subagents edit files at once, they can overwrite each other's changes."
There is a quieter version that produces no conflict at all. Agents in one working tree share one git index. On October 11, 2026, three agents on our team were working in the same checkout. One ran git add on its own file and committed, and the commit took along 31 files another agent had just staged. Nothing failed. The message described one fix and the diff carried another agent's half-done work. The rule we wrote down that day:
# commit only your own paths; whatever else is staged stays out
git commit -m "fix: parse nested brackets" -- src/parser.ts test/parser.test.ts
With one worktree per worker the index is no longer shared and this goes away. That is what a worktree is for, and it is all it is for. It says nothing about what each worker knows.
Four things that do not cross on their own
- A rule you only said in chat. The brief is a summary written by the main model, and the rule gets in if the model judged it relevant to that subtask. Claude Code's documentation gives the workaround: restate the rule in the delegation prompt. Putting it in
CLAUDE.mdhelps, with one exception: the built-in Explore and Plan agents start without it. - A decision made after the worker started. The brief is a snapshot. Background workers keep running while you keep talking to the main agent, and what you decide ten minutes later reaches a running worker only if something takes it there.
- What a worker tried and dropped. The summary is the worker's own choice of what matters. A dead end that cost it fifteen minutes rarely makes it in, and the worker next to it never hears about it.
- Anything that lives in one checkout or on one machine. A worktree created from the default branch does not have the instruction-file edit you have not committed. Claude Code's auto memory is one directory per repository on one machine. Codex's memories are local files. A teammate's laptop has none of it.
A 20-minute drill
- Open a session in a scratch repository with two small independent tasks, such as two functions in different files, each with a test.
- Before delegating, say three facts in plain sentences without writing them to any file: a rule ("never edit anything under legacy/"), a rejected approach with the reason, and a number ("that API allows 40 requests per minute").
- Ask for two subagents, one per task. Do not repeat the facts.
- While they run, give the main agent a fourth fact, a decision: "the config key is
timeout_msfrom now on, nottimeout". - At the end, read the first message each worker received. Count how many of the three early facts are in each brief, check whether either worker used
timeout_ms, and ask the main agent what the first worker tried and gave up on.
Write the numbers down, apply the next section and run it again. We did not run this drill for this post. What is above is what each vendor documents, and the drill shows what your version, your model and your files do with it.
Three places a decision can live
A rule that always holds, in the instruction file. It is the cheapest place, and the vendors point to it first. Codex's memories page says: "Keep required team guidance in AGENTS.md or checked-in documentation." Commit it before you fan out, because a worktree created from the default branch gets the committed file.
The task's state, at the start of every worker. Where the harness lets a hook add context to a subagent, a few lines hand each worker the decisions so far, whatever the main agent wrote in the brief. In Claude Code that is SubagentStart with additionalContext; in Codex the same event takes plain text on stdout. Cursor documents no way to add context at that point, so the instruction goes in the rules file. This covers a worker started after the decision. One that is already running does not get it.
What gets decided and found during the run, in a record outside the session and the checkout. For the late decision and the dead end, one worker has to write and the others have to read while everything is still running. A file does that on one machine. Across machines, cloud agents and teammates it has to be a server. Since all three harnesses hand the main agent's MCP servers to the subagent, a memory connected over MCP is already inside the worker.
The full table of what each harness documents, the hook example and the step-by-step drill are in the guide: Subagents and worktrees: what parallel coding agents share.
What ValorBrain does and does not do
In ValorBrain that record is task_state, a ledger on the server that the agent writes over MCP. Give each fan-out its own named ledger (session: "<task-name>"), because without a name the main agent and the workers land in the default ledger of the credential and agent, together with any other task running on the same token in the same harness. A decision that changes what other workers should do goes into memory_store as a decision, when it is made, and is visible to the rest of the team.
A worker does not need to know the ledger exists. memory_prepare returns up to two open ledgers along with the relevant memory, and each one comes back with a line saying who wrote it last and when. Another agent's ledger shows up when the message passed to memory_prepare names its subject, one more reason to name the ledger after the task. A brief never carries that origin line: the worker that reads "next: write both files" also reads whose step that is and how old it is.
What it does not do, today:
- It does not put anything into a subagent when it starts.
@valorbrain/connectinstalls session-start, prompt and stop hooks, and no subagent-start hook. A worker reaches ValorBrain two ways: the MCP tools it inherits from the main agent, and the rules block connect writes into the user-level instruction file. Claude Code documents that a subagent loads that file (Explore and Plan excepted). Codex and Cursor do not say. - It does not interrupt a running worker. A decision stored at 14:05 reaches the worker that asks after 14:05. One that never asks again finishes with what it had.
- It does not isolate files, merge branches or resolve conflicts. That is git and the worktrees.
- It does not reach a Cursor cloud subagent through your local configuration. The server has to be in the team configuration.
- It does not write the brief. What the main agent tells a worker is still the model's summary. The record gives you something to check the brief against.
- We did not run a subagent for this post. Harness behavior is what the documentation said on November 29, 2026, and we did not measure how often a worker follows the instruction to call
memory_prepare. The 20-minute drill is how you measure that on your setup.
ValorBrain works over MCP, in Claude Code, Codex, Cursor and any compatible client. The free plan doesn't ask for a card: valorbrain.com.br.
Sources, read on November 29, 2026: Claude Code, Subagents, Run agents in parallel, Worktrees, Memory and Hooks reference; Codex, Subagents, Git worktrees, Memories and Hooks; Cursor, Subagents, Worktrees, Cloud agents and Hooks. What ValorBrain and connect do is described in the guide, from the server code and the public @valorbrain/connect manifests of November 29, 2026.
Next step
Less starting over. More continuity
Bring a real project. In one conversation we map where context gets lost between the people and agents on your team, and where to start.