Skip to main content
Parallel collaboration

Parallel Tasks

Overview

When you want to drive multiple tasks forward in the same repository without them interfering with each other, use parallel collaboration. Qoder CLI CN offers several isolation mechanisms: put tasks into separate Git checkouts with Worktrees, drive multiple subtasks in parallel with background Agents / Tasks, and split complex work across dedicated subagents with Subagents. This way each task has its own workspace and context, avoiding multiple sessions sharing one directory and overwriting each other's changes.

Worktree isolation

Worktrees let each task proceed in a separate Git working tree without affecting the others. Start with --worktree:
qodercn --worktree feature-a
qodercn --worktree feature-a "Implement the login fix"
qodercn --worktree
  • If no name is given, Qoder generates a worktree name automatically.
  • A new named worktree is placed under <repo>/.qoder/worktrees/<flattened-name>, with a corresponding temporary branch created.
  • If a worktree with the same name already exists, it is reused instead of being recreated.
This requires running inside a Git repository with Git installed locally. For the full description of worktree creation, file copying, resuming, and cleanup, see Running Tasks.

Parallel sessions

With worktrees, you can start a session per task and let them proceed in parallel in their own directories:
# Terminal 1: work on task A in the feature-a worktree
qodercn --worktree feature-a "Implement the login fix"

# Terminal 2: work on task B in the feature-b worktree
qodercn --worktree feature-b "Refactor the logging module"
Each session has its own working tree and branch, with changes isolated from each other; when done, they can be committed or merged separately.

Background Agents and Subagents

For a single complex task, you can split it across multiple Subagents and drive the subtasks in parallel. Use /tasks to see the background tasks currently running:
/tasks
Subagents support worktree isolation too: when a Markdown Subagent needs to modify files in a separate checkout, add isolation: worktree to its definition. A clean Subagent worktree is deleted automatically when it finishes; one with changes is kept. For creating, configuring, and orchestrating Subagents, see Subagents.

Resuming and cleanup

When a session ends, Qoder prints the worktree path and the command to resume that session. An interactive exit checks the worktree for uncommitted files and new commits: a clean worktree can be deleted automatically, while one with local files or commits prompts you to keep or delete. To clean up manually:
git worktree remove <worktree-path>
git branch -d worktree-<flattened-name>

Tips

  • One task, one worktree: put unrelated tasks into their own worktrees to avoid overlapping changes.
  • When you need local files: a new worktree is a clean checkout with no untracked files by default. To copy files like .env, declare them in a .worktreeinclude at the repository root — see Running Tasks.
  • Clean up promptly: after a task is done and merged, delete worktrees and temporary branches you no longer need, keeping the repository tidy.