Work with agents / Local workspaces
Local workspaces
You run several coding agents at once on one repository, and two agents must never write to the same file. src ws gives each agent a workspace: a plain folder with your code, its own small .git and its own dependencies.
3 min read
A git worktree for each agent is slow to make, and it stays on your disk after the work is done. With src ws, you make a workspace with one command, run commands in it, save checkpoints of it, and close it at the end. Your own checkout never changes.
src keeps a pool of ready workspaces. create takes a folder from the pool, with the files and the dependencies there already, and close gives the folder back. In one test on TanStack Source itself, src ws create took 1.1 s, and git worktree add with pnpm install took 10.8 s. See Measure workspaces on your repository.
You need:
srcon Node.js 22.15 or later. See Install src and log in.- A git checkout with at least one commit.
Note
src ws works on your computer only, and it has no REST route and no MCP tool. It needs no login. With a login, src ws exec can also give your commands the .env values of the vault of the repository.
Pick your task
| You want to | Read |
|---|---|
| Create a workspace, run an agent or a command in it, review its changes, and close it | Start with workspaces |
| Let Claude Code, OpenCode or another agent make its own workspaces | Use workspaces with a coding agent |
| Save the state of a workspace, go back to an older state, or start a new workspace from a checkpoint | Go back with checkpoints |
| Bring the changes of a workspace into your checkout | Review and accept agent work |
| Move the work of an agent onto the new tip of the default branch | Bring a workspace up to date |
| Start one agent from the work of another | Stack workspaces |
Change how src installs dependencies, and give each workspace its ports, .env values, hooks and read-only paths | Configure workspaces |
| Make each workspace a fast clone on a Windows NTFS disk, a Linux ext4 disk, or a Mac disk that is not APFS | Put workspaces on a copy-on-write disk |
| Change how many ready workspaces the pool keeps on your disk | Keep workspaces ready |
Send to my agent on a pull request, an issue or a failed CI run also makes a workspace for you. See Send to your agent.
How it looks on disk
code/app/ your checkout (never changed by src ws)
code/.src-ws/app/ws-1/ the workspace "api"
code/.src-ws/app/ws-2/ the workspace "web"
code/.src-ws/app/ws-3/ a ready workspace of the pool
code/.src-ws/app/.bases/ the files of each baseline, written once
code/.src-ws/app/.layers/ dependency folders, installed once for each lockfile
code/.src-ws/app/.caches/ build caches that all workspaces share
code/.src-ws/app/.candidate-api/ where src ws accept merges and tests the changes of api
- Each workspace is a normal folder. Your editor, your scripts and
gitwork in it as usual. - The folder is a slot,
ws-<n>, and its name is not the name of the workspace.src ws createprints the path, andsrc ws listshows it. - Its
.gitreads the history of your repository, and copies no history. Commits and branches that an agent makes in a workspace stay in that workspace. - Each workspace has its own copy of its dependencies, cloned from
.layerswhen the lockfile is the same. - Checkpoints are kept in a data folder of
src, outside the repository.