Claude Code

Multiple agents, background work, and workflows

Agent View, background sessions, batch, fork, goals, loops, dynamic workflows, teams, and cache/cost boundaries.

Parallel execution includes several different mechanisms:

MechanismUnitUse
SubagentFocused delegation in a sessionResearch, review, context isolation
Background sessionComplete session in the backgroundLong work with a free terminal
Agent ViewMultiple background sessionsMonitor task progress
BatchBundled migration skillRepeated changes across worktrees
Dynamic workflowScript-orchestrated subagentsAudits, migrations, research, repair loops
Agent teamsNamed collaborating teammatesSustained coordinated work

See Teams and channels for configuration and Advanced workflows for comparisons.

#Background sessions

/background
/bg Continue running tests and repair failures

Manage from the shell:

claude agents
claude agents --json
claude attach <id>
claude logs <id>
claude stop <id>
claude respawn <id>
claude rm <id>
ActionCache effect
BackgroundSame session continues within TTL
AttachResume its existing history
RespawnRetains conversation; changed version/environment can alter prefix
StopNo further TTL refresh

#Agent View

CapabilityPurpose
MonitorState and input needs
Peek/replySend input without fully attaching
AttachEnter a background session
DispatchStart a new task
FilterDirectory, status, PR
JSONScriptable agents output

Use worktrees to isolate writes and clean completed workspaces when the directory grows.

#Fork versus branch

CommandBehaviorUse
/branch [name]Copy conversation and switch to itPersonally explore another route
/forkSend current context to a background subtaskIndependent side work

Both inherit a prefix that may remain reusable within TTL.

#Batch

Batch typically:

  1. Studies the repository.
  2. Splits work into roughly 5–30 independent units.
  3. Presents a plan for approval.
  4. Creates isolated worktrees and background agents.
  5. Implements/tests each unit and returns PRs or results.
Suitable taskExample
Migration/batch migrate src from Redux to Zustand
Repeated replacement/batch replace deprecated API usage across packages
Test coverage/batch add missing tests for service modules
Broad review/batch audit every package for unsafe env access
Poor fitReason
Vague requirementsIncorrect task decomposition
Strongly coupled editsMerge conflicts
No validation criteriaHard to converge
Every step needs manual reviewBackground concurrency obscures sequencing

#Dynamic workflows

Claude writes an orchestration script that calls subagents for repeatable, separable work and aggregates results.

Use a workflow to audit all content/docs pages for untranslated UI text and broken links.
Return one consolidated report.
Migrate each package's ESLint configuration with one subagent per package,
then run the combined validation.
AspectBatchDynamic workflow
PurposeLarge code-change skillGeneral orchestration
UnitsWorktrees/subagentsScript-defined
ReuseTask-orientedScript can be retained
ObservationBackground sessions/progress/workflows

#Goals

A goal defines completion criteria and lets Claude continue until achieved or genuinely blocked.

/goal Complete the documentation migration: new pages build, no raw directives,
new routes return 200, and mobile pages have no horizontal overflow.
Good goalWeak goal
Verifiable conditionsMake it good
Test/check commandsImprove it as much as possible
Autonomous progressWait for approval on every routine step
Defined blockersStop at every small error

Goal state itself does not rebuild the system prompt. Continued turns append normally and refresh TTL; compaction/model changes retain their usual effects.

#Loops and schedules

MechanismUseCache consideration
LoopPeriodic checks in current sessionIntervals within TTL help
ScheduleOne-off or recurring workLonger intervals may benefit from supported longer TTL
RoutinesHosted automationIndependent cloud cache

Do not expect a five-minute cache to remain warm through long gaps. Short prompts, stable rules, and explicit output limits matter. See Scheduling.

#Cache and cost boundaries

UnitRelationship
Main sessionOwn prompt/project/history
SubagentSeparate conversation, typically its own default TTL
Background sessionComplete history and TTL
WorktreeDifferent paths can change prompt prefixes
Cloud sessionSeparate environment, not local Passion8 cache
AdvisorToggle preserves main cache; advisor requests have separate behavior

#Practical recommendations

  1. Use the main session for small work.
  2. Isolate broad research in subagents.
  3. Plan decomposition before batch/workflow migrations.
  4. Combine parallel writers with worktrees and shared acceptance criteria.
  5. Give every task an explicit validation command.
  6. Avoid overlapping file regions; conflict resolution can erase concurrency gains.

#Official references

Support

Need help?

For setup, billing, or model issues, email us. Check the status page for uptime.

WeChat / QQ support is available at the bottom right.