> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mka1.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parallel work and worktrees

> Separate simultaneous coding tasks with branches, worktrees, and desktop panels.

export const ScreenshotCrop = ({src, alt, width, height, x = 0, y = 0, cropWidth = width, cropHeight = height, maxWidth = "100%"}) => <div className="not-prose" style={{
  position: "relative",
  overflow: "hidden",
  width: "100%",
  maxWidth,
  margin: "0 auto",
  aspectRatio: `${cropWidth} / ${cropHeight}`
}}>
    <img src={src} alt={alt} width={width} height={height} style={{
  position: "absolute",
  display: "block",
  margin: 0,
  maxWidth: "none",
  width: `${width / cropWidth * 100}%`,
  height: "auto",
  left: `${-x / cropWidth * 100}%`,
  top: `${-y / cropHeight * 100}%`
}} />
  </div>;

Choose a workspace based on where the files and development tools should live. A separate worktree gives a parallel task its own repository files; a remote workspace runs the agent and tools in the selected SSH, WSL, or Docker environment.

## Branches and worktrees

You can arrange open sessions in up to four panes. Each session has its own conversation history, but the project folder determines which files it works on. Two sessions pointed at the same folder can change the same files, even when their conversations are separate.

For a Git project, you can choose among these workspace arrangements:

| Choice | When to use it |
| - | - |
| Current branch | Continue the work already in your checkout. |
| New branch | Give a change its own branch while working in the same checkout. |
| Separate worktree | Work on another branch in a separate directory while your original checkout remains available. |

For two fixes that need to run at the same time, give each its own worktree so their working files are separate. Each checkout may need the project's dependency installation and local configuration before tests can run. A worktree separates repository files; commands still run with the access granted by the operating system.

### Prepare an isolated task

1. Start a new Code session and select the Git project.
2. Check the branch in the composer. Select the starting branch and enable a separate worktree before the first run.
3. Send a request that includes any setup the new checkout needs, such as reading the README and identifying the test command.
4. Confirm the session's folder and branch before allowing edits. Install the project's dependencies in that checkout when required.

A worktree is useful when one session is fixing checkout quantities while another is reviewing a different feature. Giving them different conversation names alone does not separate their files. See [Review and commit](/docs/mka1-code/review-changes) when each change is ready.

<Frame caption="Enable worktree before the first run to give the task a separate checkout.">
  <ScreenshotCrop src="/images/mka1-code/guides/workspaces.jpg" alt="Task composer with a project, branch, and checked worktree option" width={2720} height={1660} x={470} y={1365} cropWidth={1080} cropHeight={275} maxWidth="100%" />
</Frame>

### Arrange sessions in panels

Open **Search sessions** and use the panel actions to choose one panel, two or three side-by-side panels, or four in a grid. A session's sidebar menu offers **Open in panel** to place that session in a specific panel. Closing a panel leaves the session in the sidebar.

Use panels to compare an implementation and its review or to watch two independent tasks. Panel layout changes what is visible; each session still uses its selected workspace.

## Remote environments

Use [Remote development](/docs/mka1-code/remote-development) when the repository and tools should run on an SSH host, in WSL, or in Docker. The desktop interface stays on your computer, while file operations and commands run in the selected environment.

<span id="enter-connection-details" />

<span id="reconnect-to-existing-work" />

The remote guide covers connection fields, tool and credential transfer, saved connections, and what happens when you disconnect. A new session is required to change execution destinations.

Continue with [Remote development](/docs/mka1-code/remote-development).
