aq.dev / docs/workspaces

AI Coding Agent Workspaces: How Isolation and Lifecycle Work

A coding agent workspace is the isolated slice of a codebase, plus the running session and status around it, that one AI coding task occupies from creation to cleanup: a separate checkout so concurrent tasks cannot overwrite each other's files, a session (terminal, container, or VM) that holds the work in progress, and a lifecycle state that tracks whether the task is still running, waiting on review, or finished. Every agentic coding platform needs some version of this, whether it calls the unit a workspace, a session, a task, or a machine, because letting two agents edit the same working directory at the same time corrupts the codebase.

Why isolation is not optional once agents run concurrently

One agent editing one checkout is safe by default: it is the same thing a human developer does. The problem starts the moment a second task begins before the first finishes. Two processes writing to the same files, running the same test suite, or checking out the same branch will race, and the failure mode is not a crash, it is silently wrong code. Every platform that lets you run more than one agent task at a time has had to solve this, and they have converged on a small number of answers.

Three ways platforms isolate a workspace

Strip away branding and there are three underlying isolation strategies, trading spin-up speed and cost against how strong the boundary is:

The git worktree pattern, in more detail

A worktree is a second working directory attached to the same git repository: same commit history, same remotes, same object database, but its own files on disk and its own checked-out branch. That is why it is the cheapest isolation primitive on this list, but it is also why teams that lean on worktrees run into a specific set of problems once they accumulate: deleting a worktree directory by hand (instead of running git worktree remove) leaves a stale administrative entry behind, git still considers the branch checked out elsewhere, and later commands fail with a confusing "branch is already checked out" error. Left unmanaged, worktree count and disk usage climb quietly; teams have reported hundreds of stale worktrees consuming tens of gigabytes, most referencing branches merged months earlier. git worktree prune clears orphaned administrative entries, and treating cleanup as part of a task's completion, not a separate chore, avoids the pile-up in the first place.

# Safe teardown once a task's branch is merged or abandoned
git worktree remove path/to/worktree   # not rm -rf
git worktree prune                     # clear any stale entries left behind

Lifecycle: the states a workspace moves through

Regardless of isolation strategy, a workspace's lifecycle has the same four stages:

The practical difference that matters when you are picking a platform is whether cleanup is automatic or something your team has to remember to do, and whether "active" survives you closing your laptop or dropping your SSH connection. A session tied to your local machine's process table ends when that process ends; a session on a VM or in a cloud container keeps running.

PlatformIsolation unitSurvives your laptop closingCleanup
Cursor Cloud AgentDedicated VM per taskYes, cloud-hostedAutomatic on task end
DevinVM per session, reset to saved machine stateYes, cloud-hostedSession ends, sub-task VMs torn down
Codex CloudEphemeral container per taskYes, cloud-hostedContainer destroyed automatically
OpenHands (self-hosted)Docker sandbox per sessionOnly if the host stays upManual or scripted, your infrastructure
Claude Code --worktreeGit worktree on your machineNo, tied to your local sessionManual (git worktree remove)
ConductorGit worktree per workspaceNo, local Mac appManaged by the app per workspace

What this term does not mean by itself

"Workspace" is not a standardized word in this space; it usually just means "the isolation and state around one task," and every vendor's marketing calls it something slightly different (session, machine, task, environment). When comparing tools, the specific questions that matter are: is the isolation a full VM, a container, or a worktree; does the session survive your laptop closing; is cleanup automatic or your job; and can more than one person actually see and interact with the same running session, or is it single-player by design.

Where AQ fits

AQ is the multiplayer coding harness where engineering teams run AI coding agents like Claude Code and Codex together: shared live terminals, a code editor, and app previews, in your own cloud. A workspace in AQ is the unit this whole page has been describing, made explicit: every workspace gets its own isolated git worktree (branch ai/{id}-{slug}, automatic dependency install, one-click rebase onto main) so parallel tasks never collide on files, and each workspace's status is either active or closed rather than a single unlabeled session that quietly goes stale.

The difference from the plain worktree pattern above is what runs inside the workspace and who can reach it. Agents run as real CLIs (Claude Code, Codex, Cursor Agent, Kimi, Grok, or plain shells) in a persistent session on your team's own VM, so a workspace survives you closing your laptop the same way a cloud VM or container would, without giving up the low overhead of a worktree. Any teammate with access can open that same workspace and see and steer the same live session instead of inheriting a finished diff, each person signs into the CLIs with their own account, and agents commit, push, and open pull requests through each user's own GitHub access, with every PR tracked against its workspace. Work can enter a workspace from a manual prompt, a GitHub PR or branch, or a Linear issue labeled ai-task, and there is no shared multi-tenant execution tier: your workspaces run on your VM, whether that is a dedicated AQ-managed machine on the Team plan or one you connect yourself on the Free plan.

If you are one person running Claude Code on your own laptop, a plain --worktree session is enough, and this page's worktree section covers exactly how to set that up. AQ's workspace model earns its place once a second person needs to see the same session, or the task needs to keep running after you disconnect.

Frequently asked questions

What is a workspace in an AI coding agent platform?

The isolated checkout and running session one AI coding task occupies: a separate copy of the code so concurrent tasks do not overwrite each other, a session (terminal, container, or VM) that holds the work, and a status tracking whether the task is active, awaiting review, or done. Different platforms call it a workspace, session, task, or machine, but the underlying problem it solves is the same.

Why can't two AI agents just share the same checkout of a repository?

Two processes writing to the same files, running the same tests, or holding the same branch checked out will race each other, and the result is usually silently wrong code rather than a visible crash. Every platform that supports concurrent agent tasks isolates each one in its own checkout, container, or VM to avoid this.

Is a git worktree a secure way to isolate an AI coding agent?

A worktree isolates the filesystem and the checked-out branch, which is enough to stop two agents from stepping on each other's files. It does not isolate the process, the machine, or any credentials available on that host the way a container or a dedicated VM does, since worktrees on the same machine still share CPU, memory, and whatever secrets the host process can reach. Whether that matters depends on what the agent has access to.

What happens to a workspace after the AI agent finishes its task?

It depends on the platform. Ephemeral backends like Codex Cloud's containers or Cursor's per-task VMs get torn down automatically once the task ends. Worktree-based and persistent-VM setups (a local --worktree session, Conductor, or AQ) need either a deliberate teardown step or a scheduled cleanup sweep, since nothing forces the checkout to disappear on its own.

Does AQ isolate workspaces with containers or with git worktrees?

Git worktrees. Every AQ workspace gets its own worktree and branch on your team's VM, which is cheap enough to create per task without full container or VM provisioning, and each workspace runs its own persistent terminal session so it survives you closing your laptop the same way a cloud-hosted VM would.