When you want to work on multiple tasks in the same repository simultaneously without them interfering with each other, you can use parallel collaboration. Qoder CLI provides several isolation methods: using Worktree to place different tasks into independent Git checkouts, using Background Agents / Tasks to run multiple subtasks in parallel, and using Subagents to delegate complex work to specialized subagents.This way, each task has its own workspace and context, preventing multiple sessions from sharing the same directory and overwriting each other's changes.
Worktree Isolation
Worktree allows each task to run in an independent Git working tree without affecting others. Start it with --worktree:
When no name is provided, Qoder automatically generates a worktree name.
New named worktrees are placed under <repo>/.qoder/worktrees/<处理后的名称>, and a corresponding temporary branch is created.
If a worktree with the same name already exists, it is reused directly instead of being recreated.
This must be run within a Git repository and requires Git to be installed locally. For complete instructions on creating, copying files to, restoring, and cleaning up worktrees, see Using the CLI.
Parallel Sessions
Using Worktree, you can start separate sessions for different tasks, allowing them to run in parallel within their own isolated directories:
# Terminal 1: Work on Task A in the feature-a worktreeqodercli --worktree feature-a "Implement login fix"# Terminal 2: Work on Task B in the feature-b worktreeqodercli --worktree feature-b "Refactor logging module"
Each session has its own working tree and branch, keeping changes isolated from one another. Once completed, they can be committed or merged separately.
Background Agents and Subagents
For a single complex task, you can break it down and delegate parts to multiple Subagents for parallel processing. Use /tasks to view currently running background tasks:
Copy
/tasks
Subagents also support worktree isolation: when a Markdown Subagent needs to modify files in an isolated checkout, add isolation: worktree to its definition. Clean Subagent worktrees are automatically deleted upon completion, while those with changes are retained.For creating, configuring, and orchestrating Subagents, see Subagent.
Restoration and Cleanup
When a session ends, Qoder prints the worktree path and the command to resume the session. When exiting interactively, it checks for uncommitted files and new commits in the worktree: clean worktrees can be automatically deleted, while those with local files or commits will prompt you to choose whether to keep or delete them.To clean up manually:
One task per worktree: Place unrelated tasks in their own worktrees to avoid overlapping changes.
When local files are needed: A new worktree is a clean checkout and does not include untracked files by default. To copy files like .env, declare them using .worktreeinclude at the repository root. For details, see Using the CLI.
Clean up promptly: Delete unnecessary worktrees and temporary branches after tasks are completed and merged to keep the repository tidy.