Background Agents in Claude Code
Push sub-agents to the background with Ctrl+B and keep working while they run.
Problem: A sub-agent used to freeze your session. The main agent would spawn it for research or a heavy analysis pass, and you had to sit there until it came back.
Quick Win: Hit Ctrl+B the moment a sub-agent starts, and it drops to the background:
You: Research authentication best practices for our Next.js app
Claude: I'll spawn a sub-agent to research this...
[Sub-agent starts]
You: [Press Ctrl+B]
You: While that runs, let's work on the database schema...You stay in the chat. The sub-agent keeps working on its own. When it finishes, the results pop back in.
True Parallel Execution
Async sub-agents are now a first-class feature. Any time the main agent spawns one, you can push it to the background and pick up a different thread of work with Claude.
The flow:
- Request: Hand Claude a task that fits a sub-agent.
- Claude spawns: The main agent creates a sub-agent to run it.
- Background it: Press
Ctrl+Bwhile the sub-agent is still working. - Keep going: Talk to the main agent about anything else.
- Auto-resume: On completion, the sub-agent wakes the main agent and drops off its results.
Want to see what's running? Type /tasks:
/tasks
Each background agent shows up with a status, a token count, and a progress indicator. Click one to dig into the details.
When to Background an Agent
Great candidates:
- Research that needs web searches
- Code analysis across large codebases
- Documentation generation
- Security audits and vulnerability scans
- Performance profiling reports
Keep these up front:
- Anything that needs your answer next
- File edits you want to eyeball before they land
- Work that depends on what you're doing right now
Shell Commands Too
The same trick covers slow shell commands. If Claude kicks off npm install, docker build, or an ffmpeg job, push it back:
Claude: Running npm install...
[Command starts]
You: [Press Ctrl+B]
You: While that installs, can you review the API routes?Check on it with /tasks, just like you would with an agent.
The --agent Flag
A new CLI flag starts Claude Code already wearing a sub-agent's hat:
claude --agent plan
That line boots Claude with the planning agent's config loaded. You can prompt it, poke at its behavior, and see how it handles edge cases before you wire it into a real workflow.
When it helps:
- Debugging a custom sub-agent before you rely on it
- Checking an agent's instructions and tool access
- Running a specialist directly for a one-off job
- Learning what the built-ins actually do
Built-in agents work (plan, explore, and the rest), and so does anything you've defined in .claude/agents/.
Shipped Alongside
Anthropic bundled several other upgrades into the same release.
Instant compaction: /compact no longer makes you wait. Claude keeps a live session summary in the background, so the command just loads that summary into a clean context.
Session memory architecture: Every session now carries a structured summary. It tracks status, finished work, discussion threads, and a work log.
Stats dashboard: /stats shows your usage patterns, favourite models, token totals, and streaks. Hit Ctrl+S to copy the output for sharing.
Session naming: /rename labels a session, and claude --resume session-name brings it back by name. The /resume screen now groups forked sessions and has keyboard shortcuts too (P to preview, R to rename, B to browse forks).
MCP quick toggle: Flip MCP servers on or off without touching the config file.
Slack integration: Hand tasks to Claude Code from a Slack channel. Tag @Claude on a bug or a feature request, and the team workflow picks it up.
Common Issues
The agent won't background: Ctrl+B only works while the agent is actually running. Hit it during the work, not after it finishes.
You lost track of your agents: Run /tasks. It lists every background process with an ID.
Agent finished but nothing surfaced: Results usually come back through AgentOutputTool on their own. If you missed one, find it in /tasks and grab the output from there.
Next Steps
- Execution patterns: Parallel, sequential, background. Pick the right one for the job.
- Foundation: Read the agent fundamentals before you build anything bigger.
- Design patterns: Sub-agent design covers how to split work cleanly.
- Distribution: Task distribution handles multi-agent orchestration.
- Custom agents: Custom agent patterns show how to build your own specialists.
Backgrounding turns Claude Code into something closer to a parallel workstation than a turn-based chat. Start a research pass. Keep shipping code. Pick up the results when they're ready.
Stop configuring. Start building.