You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/init-hooks.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,8 @@ Init hooks receive the following environment variables:
34
34
-`MUX_PROJECT_PATH` - Absolute path to the project root on the **local machine**
35
35
- Always refers to your local project path, even on SSH workspaces
36
36
- Useful for logging, debugging, or runtime-specific logic
37
-
-`MUX_RUNTIME` - Runtime type: `"local"` or `"ssh"`
38
-
- Use this to detect whether the hook is running locally or remotely
37
+
-`MUX_RUNTIME` - Runtime type: `"worktree"`, `"local"`, or `"ssh"`
38
+
- Use this to detect whether the hook is running in a worktree, directly in your project directory, or on a remote machine
39
39
40
40
**Note for SSH workspaces:** Since the project is synced to the remote machine, files exist in both locations. The init hook runs in the workspace directory (`$PWD`), so use relative paths to reference project files:
Local (in-place) workspaces operate directly inside your project directory. Unlike [worktree workspaces](./worktree.md), they do **not** create a separate checkout. The agent works with the branch, index, and working tree that you already have checked out.
4
+
5
+
## When to Use
6
+
7
+
- You want zero-copy workflows (benchmarks, quick experiments, or short-lived agents)
8
+
- You need the agent to see files that are too large to duplicate efficiently
9
+
- You plan to drive the session from another terminal that is already inside the project directory
10
+
11
+
## Key Behavior
12
+
13
+
-**Single workspace per project**: mux enforces one in-place workspace per project to avoid conflicting agent sessions.
14
+
-**Current branch only**: the agent starts on whatever branch is currently checked out in your repository. Branch switches affect your main working tree immediately.
15
+
-**Shared Git state**: any uncommitted changes are visible to both you and the agent. The agent can stage, commit, and push directly from your checkout.
16
+
-**No automatic cleanup**: deleting the workspace inside mux only removes it from the workspace list—your project directory remains untouched.
17
+
-**Init hooks**: `.mux/init` still runs in the project directory. Use `MUX_RUNTIME=local` to special-case logic if needed.
18
+
19
+
## Recommended Safeguards
20
+
21
+
- Commit or stash important work before starting an in-place session.
22
+
- Consider creating a temporary branch manually before opening the workspace if you want to isolate commits.
23
+
- Use descriptive workspace names so it is clear what the agent is attempting.
24
+
- Review the agent's Git operations carefully—there is no isolation layer to fall back on.
25
+
26
+
## Switching Between Modes
27
+
28
+
You can select **Local (in-place)** from the workspace creation dialog or via the `/new` command (`/new -r local`). Switch back to **Worktree** or **SSH** at any time for isolated workspaces.
Copy file name to clipboardExpand all lines: docs/workspaces.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,26 @@ Workspaces in mux provide isolated development environments for parallel agent w
4
4
5
5
## Workspace Types
6
6
7
-
mux supports two workspace backends:
8
-
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.
7
+
mux supports three workspace backends:
10
8
9
+
-**[Worktree Workspaces](./worktree.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.
10
+
-**[Local (In-Place) Workspaces](./local-in-place.md)**: Reuse your existing project directory with no additional checkout. The agent operates on the branch and working tree you already have checked out.
11
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.
12
12
13
13
## Choosing a Backend
14
14
15
15
The workspace backend is selected when you create a workspace:
16
16
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
17
+
-**Worktree**: Best for fast iteration, local testing, and when you want an isolated checkout that still lives on your machine.
18
+
-**Local (in-place)**: Ideal for zero-copy workflows or when you need the agent to operate on your existing working tree without creating a new worktree.
19
+
-**SSH**: Ideal for heavy workloads, long-running tasks, or when you need access to remote infrastructure.
19
20
20
21
## Key Concepts
21
22
22
23
-**Isolation**: Each workspace has independent working changes and Git state
23
24
-**Branch flexibility**: Workspaces can switch branches, enter detached HEAD state, or create new branches as needed
24
25
-**Parallel execution**: Run multiple workspaces simultaneously on different tasks
25
-
-**Shared commits**: Local workspaces (using worktrees) share commits with the main repository immediately
26
+
-**Shared commits**: Worktree and local (in-place) workspaces share commits with the main repository immediately; SSH workspaces require pushing to sync
26
27
27
28
## Reviewing Code
28
29
@@ -39,9 +40,9 @@ Here are a few practical approaches to reviewing changes from workspaces, depend
39
40
Some changes (especially UI ones) require the Human to determine acceptability. An effective approach for this is:
40
41
41
42
1. Ask agent to commit WIP when it's ready for Human review
42
-
2. Human, in main repository, checks out the workspace branch in a detached HEAD state: `git checkout --detach <workspace-branch>` (for local workspaces)
43
+
2. Human, in main repository, checks out the workspace branch in a detached HEAD state: `git checkout --detach <workspace-branch>` (for worktree workspaces)
43
44
44
-
**Note**: For local workspaces, 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.
45
+
**Note**: For worktree workspaces, 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. For local (in-place) workspaces, the agent and human are literally sharing the same checkout—coordinate commits carefully.
45
46
46
47
If you want faster iteration in between commits, you can hop into the workspace directory and run a dev server (e.g. `bun dev`) there directly and observe the agent's work in real-time.
Copy file name to clipboardExpand all lines: docs/worktree.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Local Workspaces
1
+
# Worktree Workspaces
2
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.
3
+
Worktree 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
4
5
5
## How Worktrees Work
6
6
@@ -10,7 +10,7 @@ It's important to note that a **worktree is not locked to a branch**. The agent
10
10
11
11
## Filesystem Layout
12
12
13
-
Local workspaces are stored in `~/.mux/src/<project-name>/<workspace-name>`.
13
+
Worktree workspaces are stored in `~/.mux/src/<project-name>/<workspace-name>`.
0 commit comments