Skip to content

Commit 9789ec6

Browse files
committed
docs: reorganize workspace documentation structure
Move local workspace details from workspaces.md into new local.md page, making it subordinate to Workspaces (matching SSH structure). Changes: - Create docs/local.md with local workspace details (worktrees, reviewing, filesystem layout) - Simplify docs/workspaces.md to high-level overview with links to specific workspace types - Update SUMMARY.md to include Local as sub-page under Workspaces Structure now: - Workspaces (overview) - Local (git worktree details) - SSH (remote workspace details) - Forking - Init Hooks This provides better organization and makes it easier to find workspace-type-specific information.
1 parent 8de4246 commit 9789ec6

File tree

3 files changed

+59
-47
lines changed

3 files changed

+59
-47
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# Features
1010

1111
- [Workspaces](./workspaces.md)
12+
- [Local](./local.md)
1213
- [SSH](./ssh.md)
1314
- [Forking](./fork.md)
1415
- [Init Hooks](./init-hooks.md)

docs/local.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Local Workspaces
2+
3+
Local workspaces use [git worktrees](https://git-scm.com/docs/git-worktree) on your local machine. Worktrees share the `.git` directory with your main repository while maintaining independent working changes and checkout state.
4+
5+
## How Worktrees Work
6+
7+
A worktree is a separate directory on the same filesystem as the main repository that shares a `.git` but has independent working changes and checkout state. **All committed changes from any worktree are visible to all other worktrees including the main repository.**
8+
9+
It's important to note that a **worktree is not locked to a branch**. The agent can switch to new branches, enter a detached HEAD state, etc. When you create a workspace, the agent will begin at the selected branch but may switch freely in the course of the session. **We empower users to define their agent's branching strategy in AGENTS.md**
10+
11+
## Filesystem Layout
12+
13+
Local workspaces are stored in `~/.cmux/src/<project-name>/<workspace-name>`.
14+
15+
Example layout:
16+
17+
```
18+
~/.cmux/src/
19+
cmux-main/
20+
improved-auth-ux/
21+
fix-ci-flakes/
22+
```
23+
24+
## Reviewing Code
25+
26+
Here are a few practical approaches to reviewing changes from workspaces, depending on how much you want your agent to interact with `git`:
27+
28+
- **Agent codes, commits, and pushes**: Ask agent to submit a PR and review changes in your git Web UI (GitHub, GitLab, etc.)
29+
- Also see: [Agentic Git Identity](./agentic-git-identity.md)
30+
- This is the preferred approach for `cmux` development but requires additional care with repository security.
31+
- **Agent codes and commits**: Review changes from the main repository via `git diff <workspace-branch>`, push changes when deemed acceptable.
32+
- **Agent codes**: enter worktree (click Terminal icon in workspace top bar), run `git add -p` and progressively accept changes into a commit.
33+
34+
## Reviewing Functionality
35+
36+
Some changes (especially UI ones) require the Human to determine acceptability. An effective approach for this is:
37+
38+
1. Ask agent to commit WIP when it's ready for Human review
39+
2. Human, in main repository, checks out the workspace branch in a detached HEAD state: `git checkout --detach <workspace-branch>`
40+
41+
**Note**: This workflow uses the detached HEAD state because the branch is already checked out in the workspace and you cannot check out the same branch multiple times across worktrees.
42+
43+
If you want faster iteration in between commits, you can hop into the worktree directory and run a dev server (e.g. `bun dev`) there directly and observe the agent's work in real-time.

docs/workspaces.md

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,27 @@
11
# Workspaces
22

3-
cmux supports multiple workspace backends for different use cases:
3+
Workspaces in cmux provide isolated development environments for parallel agent work. Each workspace maintains its own Git state, allowing you to explore different approaches, run multiple tasks simultaneously, or test changes without affecting your main repository.
44

5-
- **Local workspaces**: [git worktrees](https://git-scm.com/docs/git-worktree) on your local machine
6-
- **SSH workspaces**: Regular git clones on a remote server accessed via SSH
5+
## Workspace Types
76

8-
The backend is selected based on your runtime configuration. Local workspaces use git worktrees which share the `.git` directory with your main repository, while SSH workspaces are independent git clones on the remote machine.
7+
cmux supports two workspace backends:
98

10-
## Basics of worktrees
9+
- **[Local Workspaces](./local.md)**: Use [git worktrees](https://git-scm.com/docs/git-worktree) on your local machine. Worktrees share the `.git` directory with your main repository while maintaining independent working changes.
1110

12-
A worktree is a seperate directory on the same filesystem as the main repository that shares a `.git`
13-
but has independent working changes and checkout state. **All committed changes from any worktree are
14-
visible to all other worktrees including the main repository.**
11+
- **[SSH Workspaces](./ssh.md)**: Regular git clones on a remote server accessed via SSH. These are completely independent repositories stored on the remote machine.
1512

16-
It's important to note that a **worktree is not locked to a branch**. The agent can switch to new
17-
branches, enter a detached HEAD state, etc. When you create a workspace, the agent will
18-
begin at the selected branch but may switch freely in the course of the session. **We empower users to define their agent's branching strategy in AGENTS.md**
13+
## Choosing a Backend
1914

20-
## Reviewing code
15+
The workspace backend is selected when you create a workspace:
2116

22-
Here are a few practical approaches to reviewing changes from workspaces,
23-
depending on how much you want your agent to interact with `git`:
17+
- **Local**: Best for fast iteration, local testing, and when you want to leverage your local machine's resources
18+
- **SSH**: Ideal for heavy workloads, long-running tasks, or when you need access to remote infrastructure
2419

25-
- **Agent codes, commits, and pushes**: Ask agent to submit a PR and review changes in your git Web UI (GitHub, GitLab, etc.)
26-
- Also see: [Agentic Git Identity](./agentic-git-identity.md)
27-
- This is the preferred approach for `cmux` development but requires additional care with repository security.
28-
- **Agent codes and commits**: Review changes from the main repository via `git diff <workspace-branch>`, push changes when deemed acceptable.
29-
- **Agent codes**: enter worktree (click Terminal icon in workspace top bar), run `git add -p` and progressively accept changes into a commit.
20+
## Key Concepts
3021

31-
## Reviewing functionality
22+
- **Isolation**: Each workspace has independent working changes and Git state
23+
- **Branch flexibility**: Workspaces can switch branches, enter detached HEAD state, or create new branches as needed
24+
- **Parallel execution**: Run multiple workspaces simultaneously on different tasks
25+
- **Shared commits**: Local workspaces (using worktrees) share commits with the main repository immediately
3226

33-
Some changes (esp. UI ones) require the Human to determine acceptability. An effective approach
34-
for this is:
35-
36-
1. Ask agent to commit WIP when its ready for Human review
37-
1. Human, in main repository, checks out the workspace branch in a detached HEAD state: `git checkout --detach <workspace-branch>`
38-
39-
Note: this workflow uses the detached HEAD state because the branch is already
40-
checked out in the workspace and you cannot check out the same branch multiple times
41-
across worktrees.
42-
43-
If you want faster iteration in between commits, you can hop into the worktree directory and run a
44-
dev server (e.g. `bun dev`) there directly and observe the agent's work in real-time.
45-
46-
## Filesystem Layout
47-
48-
Local workspaces are stored in `~/.cmux/src/<project-name>/<workspace-name>`.
49-
50-
SSH workspaces are stored on the remote machine at `~/workspace/<project-name>/<workspace-name>` (or your configured remote path).
51-
52-
Example layout:
53-
54-
```
55-
~/.cmux/src/
56-
cmux-main/
57-
improved-auth-ux/
58-
fix-ci-flakes/
59-
```
27+
See the specific workspace type pages for detailed setup and usage instructions.

0 commit comments

Comments
 (0)