Skip to lesson
Exit
Cursor team workflows in a shared repo1 / 2

2 min lesson

Sub-agents: parallel work with isolated context

Take this case and make the call: "A team wants every PR's generated code automatically cleaned of AI slop, and separately wants a dedicated 'test writer' persona the main agent can hand work to. Which primitive is each?"

Step 1 of 2

Sub-agents: parallel work with isolated context

Sub-agents let a parent agent spawn smaller agents that run simultaneously, each with its own contained context window - solving the old multi-tab collision problem where two agents editing the same file would stall. Each sub-agentA child agent a main agent spawns to work in parallel with its own context window, handing results back so the parent's context stays clean. Press Enter for the full definition. writes its findings to a file; the parent reads the file and pulls only the relevant part into its own context. The payoff: agents run faster, fill the parent context more slowly, cost fewer tokens, and the model stays accurate longer. Cursor ships built-in sub-agents and you can author custom ones.

Rule = what

Static content applied always or to a file set.

'Use Tailwind.' '100% test coverage.' Decided ahead of time, always enforced.

Skill = how / action

A single codified action the agent takes when relevant.

A codified cleanup pass; 'here's the design system and how to apply it.' Replaces apply-intelligently rules.

Sub-agent = role

A persona the parent spawns for a job.

The test-writer, the technical-writer for docs, a devil's advocate. Give it a role + description.

Say it like this

"A rule is what we always do. A skill is how we do a specific thing. A sub-agentA child agent a main agent spawns to work in parallel with its own context window, handing results back so the parent's context stays clean. Press Enter for the full definition. is who does it. All three live under .cursor, go through review and can be pushed to the whole org - so customization is a governed control surface, not tribal knowledge."

Heuristic for the parallelism question: if task B is unrelated to task A, start a new chat; if B and C both depend on A's output but are unrelated to each other, use sub-agents. And remember the cost note from the context section - all three primitives sit in the context window, so they count toward tokens only when actually invoked.

Learn more

Optional practice

Practice: Sub-agents: parallel work with isolated context