Commands and Kits
A Kit packages a command's image, network policy, and credentials for Docker Sandboxes. marsh registers it under a shell name and runs each invocation in a fresh nonroot container. For example, in your marsh shell:
shell -c 'uname -sm'
shell is a packaged command. To add your own, use marsh kit install NAME REPOSITORY:TAG, substituting its published image. marsh uses the native Docker Sandboxes Kit v3 format. Commands update themselves; see Updates.
The default commands
| Command | Kit | What it is |
|---|---|---|
claude | marsh-claude | Claude Code, and its ACP adapter |
codex | marsh-codex | OpenAI Codex CLI, and its ACP adapter |
opencode | marsh-opencode | OpenCode, and its built-in ACP server |
pi | marsh-pi | The Pi coding agent, and its ACP adapter |
shell | marsh-shell | A plain /bin/sh, with no credentials |
hermes | marsh-hermes | Hermes Agent, sharing the marsh home's skills folder |
Releases pin the first five images by digest (docker.io/mcavage/marsh-*@sha256:...); the list is in the installed libexec/marsh/commands.json. hermes follows its :stable tag: a release build adds it shortly after the daemon first starts, which needs the network. Until then the name is not there yet; a problem shows in marsh status. If you already have your own command with that name, marsh leaves it alone. marsh kit uninstall hermes removes it for good, until you run marsh kit install hermes again.
A foreground call that boots a Kit VM prints [starting NAME worker VM…]. To prepare VMs before the prompt, start marsh with marsh --load KIT,... or marsh --load all. That also starts VMs marsh workers stop stopped (Stopping VMs).
What shell is for
shell is not a second marsh shell. It runs a plain /bin/sh as a job in the shell Kit's own VM, separate from the VM your prompt runs in. The first call prints [starting shell VM…]. Typed bare on a terminal it opens an interactive /bin/sh in that VM. It has no Brush, so no split { } or fanout { }, and the marsh inside it is the in-job CLI, which can't open a shell (How a child job starts).
Use it to run scripts and pipeline stages with no credentials, in their own container. It is also the second, different Kit in marsh's own tests, and a base image for your own Kit.
It is not a place to explore or install tools:
- The image is a minimal Debian runtime with POSIX text tools and
python3. It has no package manager, nosudo, and no Docker. - The job runs as your Mac user ID, which the image has no name for.
idcan fail withcannot find name for user ID 501, and installers that callidorwhoamican stop on it.
For that, use your marsh prompt. Its VM has a normal user with passwordless sudo and a private Docker Engine (The shell VM).
Signing in
marsh has no login of its own. Docker Sandboxes (sbx) holds the credentials on your Mac. Run sbx login once, then give sbx a credential for each provider:
| Host command | Used by |
|---|---|
sbx secret set anthropic | claude, opencode, and pi |
sbx secret set openai | codex, opencode, and pi |
sbx secret set google, mistral, xai | opencode and pi |
sbx secret set openrouter | opencode |
sbx secret import takes keys from your environment variables instead. The Claude and Codex Kits also accept an OAuth login that sbx holds. The sbx proxy adds the credential to the agent's requests, and the container sees a placeholder. A Claude job's own key, token, saved login or custom endpoint always wins over a login that sbx holds.
If nothing is bound, an agent can still sign in from inside its container (codex login, or Claude's /login). That login is stored in the guest home (~/.marsh/home on the Mac) as ordinary files, and every job in the scope can read it. Prefer sbx secret.
The Pi and Pix Kits declare an API key credential for each of anthropic, openai, google, mistral and xai, and allow only those providers' API hosts; a provider you hold no key for is simply not used. shell has no credentials.
Updates
Each Kit image pins its agent's version. Each time the marsh daemon starts, and once an hour while it runs, marsh checks in the background whether a command's tag names a newer image, so you get a new Claude Code, Codex, Pi, Pix or Hermes without waiting for a marsh release. It never delays what you are doing, and an offline check is reported only in marsh status.
The packaged commands follow the image tag of your release channel (
:latestfor stable,:nightlyfor nightly) on a release build. A Kit you installed from a tag follows that tag.The new image is prepared first, in a second Kit VM. Running jobs do not hold the switch back: new jobs start on the new image at once, and the jobs already running finish on the old VM, which is removed when it goes idle (up to a minute later). Both VMs exist meanwhile, and the per-job-tree Kit VM limit counts a command's old and new image once. A failure keeps the old image. An image that needs a newer marsh (its
org.marsh.kit.contractlabel) is refused. A VM that was still draining when the daemon stopped is removed by garbage collection once it is stopped, or bymarsh resetormarsh stop.After a switch, the next time you run that command at a terminal, or open a marsh shell, marsh prints one line on stderr, once:
marsh: claude updated (2.1.305 → 2.1.307)A rebuild with the same version switches without a notice.
marsh statusshows when the last check ran, any problem, commands whose switch has not started yet, and recent updates (kit_updatesinmarsh status --json).To update right now, run
marsh stopwhen nothing is running, then use marsh again.To turn updates off for a
MARSH_HOME, runmarsh config auto-update off, or start the daemon withMARSH_AUTO_UPDATE=0. That also stopshermesfrom being added.
A command you installed by digest never changes, and neither does a packaged command you pointed at a different image or a Kit folder in commands.json. A packaged command keeps updating after an automatic update moved it to a newer image of its own repository; one you pinned there by hand stays. ACP agents for a packaged command, or for a command installed from a tag, follow its updates.
Upgrading marsh itself also brings the versions it ships. When the daemon of a new marsh starts, each packaged command that an update had moved to an image of its own repository (a commands.json entry marsh wrote, not a tag you installed) is checked against the image this release pins:
- if an automatic update wrote that entry (marsh records which ones; a digest you put in
commands.jsonyourself stays) and its image is older than the pin, the command moves to the pin, like an update: the pinned image's VM is prepared first, then new jobs use it, andmarsh statuslists the switch. A newer image stays, and later updates apply as before. If the order cannot be told, the command stays and marsh retries every ten minutes. - a dev or local build (
make dev,make dist-local) always runs the source Kits it installed: before the first job, each packaged command that an automatic update had pinned to a publisheddocker.io/mcavage/marsh-NAMEimage runs itskits/marsh-NAMEsource Kit again, and updates never move it to a published image.
"Older" is the version each image names (its org.opencontainers.image.version, else its agent's) when both are numbers and differ, else the created time of its image configuration. An update never moves a command to an older image, and one whose order cannot be told is not taken (it is retried at the next check).
This happens even with automatic updates off. See Upgrade.
Two images are retired: docker.io/mcavage/marsh-gog and docker.io/mcavage/marsh-bamboohr are no longer built, because gog and bamboohr now come from one Kit, docker.io/mcavage/marsh-tools. When the daemon starts, a command installed from either repository (from a tag, or from a digest of it) moves to docker.io/mcavage/marsh-tools:stable under the same name and follows that tag from then on. It is an update's switch: the new image's VM is prepared first, new jobs use it at once, and running jobs finish on the old VM, which is removed when it goes idle. marsh status says so once, under the Kit updates (gog and bamboohr moved to marsh-tools). A command from any other repository stays, whatever its tag or digest. A move that fails (an unreachable registry, say) changes nothing and is retried every ten minutes. This happens even with automatic updates off, since those repositories get no updates.
Changes while jobs run
A Kit change never waits for running work and never stops it. An update, marsh kit install, marsh kit uninstall, and the move to the Kits a new marsh ships switch the name at once: new jobs use the new Kit, while jobs already running (and shells that ran them) keep the previous Kit's VM until they end. The command prints, for example:
claude is back to the version this marsh shipped
claude updates when its running jobs end; new jobs already use the new Kit
marsh status lists each change still finishing under pending, with its VM and running jobs (kit_updates.pending in marsh status --json: command, change, from, to, vm, running_jobs, message). marsh removes the previous VM within about a minute of its last job ending. Both VMs exist meanwhile. A VM still draining when the daemon stops is removed by garbage collection once it is stopped, or by marsh reset or marsh stop.
Inside marsh, claude --version, codex --version, and pi --version show the installed versions. Resetting a VM alone does not update its pinned image.
The packaged Claude Kit disables self-updates in CLI and ACP sessions; claude update and claude upgrade exit 125.
How a call runs
When you invoke a registered command:
- The shell asks the marsh daemon on your Mac to start a job.
- The daemon finds a warm VM for the command's Kit, or creates one.
- Inside that VM, a fresh container starts from the Kit image. It runs as a nonroot user with your UID.
- Your project is mounted read/write at its Mac path. In a split, the job instead mounts its fork at the fork's own host path. Your guest home is mounted read/write as
$HOMEin both cases, unless the Kit declares that it takes no home (Mounts). - stdin, stdout, stderr, signals, and the exit status pass through as for a local program. A child job started by another job gets no terminal (Agents running agents).
- When the program exits, the container is deleted and the deletion is checked. The VM stays warm for the next call.
Each call gets its own container, including concurrent and background calls. Up to 64 jobs run at once per scope by default, and at most 64 in one Kit VM (Job limits).
An agent can edit or delete the project files its container mounts. The packaged agent Kits disable their agents' own sandboxes and permission prompts (details). Use split to give an agent a private project copy. The guest home remains shared even in a split.
Network and credentials
Credentials go through the Docker Sandboxes proxy; see Signing in. Each Kit VM has the network policy its Kit declares. The codex Kit, for example, allows the listed OpenAI endpoints, GitHub download hosts, npm, and package repositories. The exact hosts and ports are in the Kit's descriptor (kits/marsh-codex/codex.yaml).
Limits per job
| Limit | Default |
|---|---|
| CPUs | half the Mac's cores, at least 2 |
| Memory | a quarter of the Mac's memory, 4 to 8 GiB |
| Processes | 4,096 |
| Writable layer | 10 GiB |
| Output | 256 MiB |
| Wall time | 24 hours |
To change these, see Configuration.
Agents inside jobs
Inside a job, every registered name is on PATH. An agent can start another agent as a child job. See Agents running agents.
Adding a command
marsh kit install mytool registry.example.com/me/mytool-kit:stable
marsh kit uninstall mytool
marsh kit install NAME REPOSITORY:TAG asks sbx which image the tag names now, prepares that image, and registers NAME. marsh records the digest, never the tag, so the command runs exactly that image until an update moves it to a newer one. You can also install a digest (REPOSITORY@sha256:DIGEST); such a command never changes. The shell you run it from sees the name immediately; other open shells see it once reopened. An existing name, including a packaged one, is refused. marsh kit install hermes, with no reference, installs that Kit right away.
Removing a command
marsh kit uninstall NAME removes a command you installed, including hermes. For a packaged command that was updated, it returns to the version your marsh shipped. Running jobs of the command do not hold it back; they finish on the old Kit (Changes while jobs run).
The tags installed commands follow are recorded in kit-sources.json next to commands.json. Updates keep their record in kit-updates.json in the same directory.
Changing or replacing a command
Edit commands.json in the scope's host control directory. marsh status prints that directory. Entries there override the packaged ones by name:
{
"mytool": "registry.example.com/me/mytool-kit@sha256:0123…",
"local-tool": "/Users/you/kits/local-tool"
}
Each value is one of:
- an image reference pinned by digest (tags are refused here;
marsh kit installresolves a tag to its digest and updates follow it); - the absolute path of a Kit source directory.
Manual edits take effect when the daemon starts: finish active work, exit open shells, run marsh stop, then launch marsh again. A worker reset alone does not reload commands.json.
A malformed commands.json stops the daemon from starting, and the error names the file.
Rules for names and sources
- Names are 1 to 128 letters, digits,
_, or-, and do not start with-. - These names are reserved:
marsh,msh,brush,sh,bash,zsh,fanout,collect,acp,mcp,ps,top. (xdg-openandopenare not: a Kit with one of those names replaces themarsh openlink.) - A source directory must be outside your project and guest home, so the normal project and home mounts do not expose it to guest code.
- Running a Kit from source needs Docker Desktop with Buildx on the Mac.
- Docker Sandboxes must allow the image's registry in its Kit sources policy.
Writing a Kit
A Kit is a directory with a descriptor and a Dockerfile. The shell Kit is a small example:
# syntax=docker/sandbox-kit:3
schemaVersion: "3"
displayName: Generic shell
kind: workload
dockerfile: ./shell.dockerfile
capabilities:
- type: com.docker.sandbox/sbx@1
The image's ENTRYPOINT receives the command's arguments. It runs as a nonroot user in the caller's directory, with these mounts and variables:
HOMEset to the mounted guest home. The same path is inMARSH_SELECTED_HOME./run/marsh/binfirst onPATH. It holds the registered commands, an in-jobmarsh, andxdg-openandopen(opening links).BROWSER=xdg-openunless the job already has aBROWSER./run/marsh/context.md, a short text telling an agent what it may start, followed by the Kit's own instructions (agent-context).
The same image also boots the outer Kit VM. That VM must provide Docker Engine and the stock sandbox runtime plumbing for marsh's fresh job containers; a standalone minimal Python or Alpine image is not enough. Derive from a suitable packaged marsh workload/base rather than putting host Docker sockets into jobs.
Keep tool state under $HOME so it persists between calls. Other jobs in the scope can read it.
Mounts
A Kit that needs only its arguments and the project, like a tool that calls one service, can refuse the guest home, which holds other agents' settings and saved logins:
capabilities:
- type: org.marsh/home@1
optional: true # stock SBX refuses a required capability it doesn't know
config:
mount: none # or "selected", the default
marsh then never mounts the guest home into the Kit's VM or its jobs, even when a job that has the home, such as an agent, starts the command. HOME and MARSH_SELECTED_HOME are the job's own /tmp, deleted with the job, and children it starts get no home either. A call from a project folder under the guest home mounts only that project, as for a project elsewhere. A call from the home itself or from a dot-directory of it (any path component under the home starting with ., such as ~/.config), or from a project that is the home, a folder above it (that would mount the home with it, including macOS's /System/Volumes/Data and its Users, which are the same directories under another name; a Linux bind mount of the home is not recognised), or a dot-directory (after symlinks), is refused. A lane of marsh split (<project>/.marsh/split/<id>/<lane>) counts as the project it forks, so a Kit that declares no home runs from a lane of a project under the home; the home's own ~/.marsh does not. In a Kit set, any component that declares none wins.
marsh reads the declaration from the Kit's descriptor the first time the Kit runs (from the registry for a published Kit) and keeps it. If it can't read it, the command does not start. Mark the capability optional: stock Docker Sandboxes then skips it (it refuses to create a VM for a required capability type it doesn't know), and marsh still applies it. The marsh-tools Kit uses it.
The packaged Kits are in kits/. They show how the agent Kits pass context.md to their agent.
Adding skills and instructions with mixins
To add to an existing agent without changing its image, publish a mixin with your skills and instructions, then combine it with the agent in a kit set:
# syntax=docker/sandbox-kit:3
schemaVersion: "3"
kind: set
displayName: Team Pi
kits:
- ref: docker.io/mcavage/marsh-pi
digest: sha256:…
- ref: registry.example.com/team/skills
digest: sha256:…
Publish the set with Docker Buildx and install it like any other Kit (marsh kit install team-pi registry.example.com/team/pi:stable). Each job receives what the set declares:
- Instructions (
agent-context) are added to/run/marsh/context.md. - Skills (
agent-skill@1) are linked by Docker Sandboxes into each skills folder the agent declares (agent-skills@1), beside the skills in its skills store (sbx skills add, and the folders marsh mirrors; perskills.defaultMode,offleaves them out). Each job sees those folders read-only where its agent reads them: a folder under/home/agentappears under the job's home instead (~/.claude/skills), over that folder in~/.marsh/home.
marsh reads the instructions and skills folders from the image's published descriptor the first time a command runs, and keeps the result. A Kit run from a source directory has none.
Publishing a Kit
Build and push the Kit with Docker Buildx to get a digest reference. In the repository, make kit-publish does this for the packaged Kits (Kit publication).
To share a Kit, post it in Show and tell.
Stopping VMs
A Kit VM keeps running between calls so the next one starts fast. To free its memory and CPU without losing it, stop it:
| Command | Stops |
|---|---|
marsh workers stop codex | The idle Codex Kit VM |
marsh workers stop claude,pi | Those idle Kit VMs |
marsh workers stop all | All idle Kit VMs |
The VM and its disk are kept, including the Kit image loaded into it. The Kit's next call, or marsh --load codex, starts the same VM again; the image is not loaded again. marsh status lists a stopped VM as stopped ("health": "stopped" in --json).
A stop never ends running work and does not wait for it. A VM with running jobs is not stopped, and marsh says how many:
$ marsh workers stop claude
claude has 2 running jobs; not stopped (nothing was cancelled; stop it once they have ended)
The same goes for a VM an attached marsh shell holds because it ran that Kit: exit the shell first. The command exits 1 when any selected VM was not stopped, and stops the rest. --json prints one entry per VM, with action (stopped, already_stopped, absent, refused, removed, failed), running_jobs, and the message.
If a stopped VM does not come back healthy, its next call replaces it with a new VM. A stopped VM that stays unused is still removed after marsh config vm-idle-days (Garbage collection).
Removing VMs
| Command | Removes |
|---|---|
marsh workers reset codex | The idle Codex Kit VM |
marsh workers reset all | All idle Kit VMs |
The next call creates a new VM. Use this to clear a quarantined VM (Troubleshooting).
Next: Troubleshooting, Configuration.