Learn how background agents and Git worktrees make async coding faster, safer, and easier to scale across parallel tasks. Read the full guide.
I used to think async coding was just "doing more in parallel." That's the wrong mental model. The real shift is that background agents plus worktrees turn AI coding from a chatty sidekick into a workflow you can schedule, isolate, and trust.
Async coding became real when teams stopped treating agents like autocomplete and started treating them like workers in a pipeline. Official docs now frame agents as reusable workflow components, not one-off chat sessions [1]. The important change is that the workflow, not the model reply, becomes the unit of planning, review, and automation.
That matters because coding is mostly coordination. You need isolation, handoff points, and a clean way to resume work after interruption.
Background agents solve the "human bottleneck" problem. I can only review one thing at a time, but an agent can keep moving on a second task while I inspect the first. The catch is that the agent needs a bounded job: a feature slice, a file group, or a test-fix loop. If the task is too broad, the agent just creates more noise.
That's why async coding works best when the task is decomposed before execution.
Git worktrees are a near-perfect match for background agents because they separate workspaces without duplicating the repo. In practice, each agent gets its own directory, its own branch, and its own context window for local changes. That matches what people already observed in the field: once instructions drift far back in context, agents start forgetting the active file or task [3].
Worktrees reduce that drift by making the task local and persistent.
The research is clear: more agents do not automatically mean better output. A recent survey of workflow optimization treats agent systems as executable graphs and shows that structure, scheduling, and verification matter as much as raw model quality [2]. Another new paper on multi-agent coding formalizes the trade-off directly: parallelism shortens the critical path, but cross-agent communication adds cost and can erase the gains [4].
So async coding wins when the dependency graph is favorable. It loses when everyone keeps stepping on everyone else.
The best structure is "one owner, one slice, one review path." In other words, give each background agent a worktree, a clear outcome, and a stopping rule. If two agents need to edit the same conceptual area, they should not run independently. They should either share a worktree or be sequenced.
Here's the practical rule: parallelize by dependency boundaries, not by vibes.
A good workflow starts with task slicing, then worktree creation, then agent execution, then review. In real use, people often map kanban-style tasks to worktrees so each session stays anchored to its own markdown task file [3]. That simple structure keeps the agent from wandering and makes handoff much cleaner.
The result is less "please remember what we were doing" and more "here's the next deterministic step."
| Stage | Human does | Agent does | Why it helps |
|---|---|---|---|
| Task split | Define a narrow slice | Read the task prompt | Reduces ambiguity |
| Worktree setup | Create isolated branch/workspace | Work in one directory | Prevents context bleed |
| Build phase | Set acceptance criteria | Implement changes | Keeps progress measurable |
| Review | Inspect diffs and tests | Fix failures | Adds a control gate |
| Merge | Combine completed slices | Stop and hand off | Avoids merge surprises |
You should write prompts like operating instructions, not like brainstorming notes. I want the prompt to state the task, the files, the constraints, the tests, and the "done" condition. If the prompt is messy, tools like Rephrase can automatically tighten it into something an agent can execute faster.
Before:
Can you improve the auth system and maybe make it cleaner? Also check if anything breaks.
After:
In this worktree, update the auth flow so password reset uses the new token format.
Files likely affected: auth.ts, reset.ts, auth.test.ts.
Constraints: do not change public API signatures.
Done when tests pass and you summarize the diff.
That tiny rewrite changes everything.
The main risk is over-parallelization. Research on workflow graphs and multi-agent coding keeps repeating the same warning: communication overhead is real [2][4]. If you split a tightly coupled feature into too many worktrees, you get duplicated logic, merge conflicts, and half-finished branches. The worktree is not magic. It's just a cleaner container for discipline.
Use background agents when the task can be partitioned, verified, and merged independently. Use a single agent when the feature is small, the codebase is tightly coupled, or the implementation needs lots of back-and-forth judgment. In other words, parallelism is an optimization, not the default.
A simple heuristic: if you can describe the task as two or more independent diffs, background agents are probably worth it.
Async coding became first-class the moment we stopped asking agents to "help" and started assigning them work. Git worktrees give that work a safe place to live, and structured prompts keep it from drifting. If you're trying to build this habit into your own workflow, start with one narrow task, one worktree, and one crisp prompt.
For more prompt engineering and AI workflow breakdowns, check the Rephrase blog.
Documentation & Research
Community Examples 5. AI Agents - Workflow Tool - r/PromptEngineering (link)
Background agents are AI-powered workers that keep making progress while you review, approve, or switch contexts. They work best when each task has clean boundaries, a stable workspace, and a clear definition of done.
Not always. Research on agent workflows shows that more agents can add communication overhead, so async coding wins when the task is partitionable and the coordination cost stays low.