CLI reference
The mend CLI talks to the Mend server. Run mend help for the help text installed with your
version. One-shot commands require Node 22.13 or newer. The terminal dashboard requires Node 26 and
node:ffi; every other command still works when the dashboard cannot start.
Install the agent skill
Section titled “Install the agent skill”mend agent install --json installs the bundled skill into every existing supported agent home:
~/.claude/skills/mend, ~/.codex/skills/mend and ~/.pi/agent/skills/mend. It returns each
SKILL.md path in the v1 envelope without a server or sign-in. Repeating it updates a Mend-managed
skill; a custom skill at the destination is preserved with an actionable needs_input result. The
coding-agent guide explains the twelve-part workflow.
Previews, screens and proof
Section titled “Previews, screens and proof”mend service list [session] --json reports Services with separate attempt, forward and target
observations. mend preview <session> --json returns observed readiness and the Preview tab link
for the person’s browser sign-in. It does not mint a ticket. An unprepared preview exits 4.
mend preview project [--project <project>] --json reads the fixed project URL, persisted target
and status. mend preview use <worktree-id-or-name> selects a worktree;
mend preview use --default selects the shared Local default-branch worktree. Selection starts
nothing. mend preview start explicitly creates that shared checkout if needed and starts the
selected Service. All accept --project <project> and --json; without a project, they use the
adopted checkout. Declare one HTTP Service with [preview] service = "web" and fixed = true on
the default branch first.
mend screen look <session> --out shot.png --json saves a current PNG, screen id and observation
time. It never starts a screen, takes input, acts on it or creates a proof artifact.
mend projects image <project> --json reads the effective workspace image. To enable Screen, run
mend projects image <project> --screen on --json, then start a new session in a new worktree. The
setting preserves the rest of the family image. Custom images are refused with a fix; select a
family image in project environment settings first. Use this path when screen look returns
ScreenObservationUnavailable because Screen is off. An already-enabled screen can instead need its
reported start failure resolved.
mend proof list <session> --json returns proof metadata with checkpoint or unknown source.
mend proof get <id> --out proof.png --json downloads stored media and verifies its byte count and
SHA-256. Incomplete output is removed. Both download commands require a new output path and write
private files. --timeout bounds the whole operation, with defaults of 30s for screen looks and 5m
for proof downloads. A timeout exits 124. A proof still recording or not captured exits 4.
mend resource start db --project --project-id <project> --worktree-id <worktree> --wait --json
starts the named resource using that worktree’s definition, then observes it without repeating the
start. Choose --worktree for a worktree resource. The default deadline is 10m. --timeout 5m
changes it; exit 124 leaves accepted work running. A changed definition that needs a restart exits 4
and names the affected worktrees. Ask the person before retrying with --restart.
All resource subcommands accept --json and return the v1 command envelope, including errors.
resource list reports definitions without environment values or command text. resource add
writes a declaration and starts nothing. resource stop, remove, use and reset use the same
explicit project/worktree selectors as their terminal forms. resource env --json lists variable
names and status observations without printing values or shell exports.
mend resource load db --from dump.sql --project-id <project> --worktree-id <worktree> --timeout 10m --json
streams the dump and reports one terminal outcome. A failed restore leaves the target unchanged. The
JSON deadline defaults to 10m; exit 124 returns the last observed load id, when accepted. Inspect
that load before retrying because accepted server work keeps running.
Review from a shell
Section titled “Review from a shell”mend change <session> --json opens a pinned review and returns its slice id, files, stats,
checkpoints, draft findings, checks and record evidence. Findings are observations for the person to
review. mend change <session> --slice <id> --json reads that same snapshot again.
mend diff <session> --slice <id> prints its patch. Add --json for the patch and checkpoint
facts. --from <checkpoint> and --to <checkpoint> instead select an immutable worktree range. The
start defaults to the worktree base and the end defaults to a new review checkpoint. JSON ranges
report truncation and omitted files explicitly.
mend comment add <session> src/auth.ts:42 "This swallows the error" --slice <id> --json saves the
person’s remark on that snapshot. Locations accept path, path:line or path:start-end. Use
--side old for removed lines, --change instead of a location for the whole change, and - as
the text argument to read stdin. Lines outside the pinned hunks are refused.
mend comment send <session> --slice <id> --json delivers unsent open comments through the server’s
correlated follow-up operation, without attaching. Draft findings are excluded. Retry the same
command after an uncertain result to reconcile the saved bundle and request key. Exit 0 reports
delivered; exit 1 reports failed or unconfirmed delivery. Then use mend wait --turn.
mend land <session> --json returns pushed and checkpoint commit ids, the pull request URL and
GitHub’s last observed state. --check --json only discovers an existing pull request. The ordinary
--branch, --title, --no-pr and --project options also apply. Mend never merges.
Setup sessions
Section titled “Setup sessions”mend setup-session [claude|codex] [--note <text>] [--project <p>]Studies the adopted repository and proposes .mend/ files in a new worktree, using your own agent
login. Defaults to Codex. --note adds your own instructions to Mend’s opening prompt. This starts
and attaches a terminal session, with automatic landing off. It writes instructions without running
setup commands, Services or resources. See Setup sessions.
mend adopt offers this only on a terminal, with a default-no question. Non-interactive adoption
and implicit adoption by an agent command never ask. Declining or dismissing starts nothing.
Conversations from a shell
Section titled “Conversations from a shell”mend claude|codex|pi --detach --conversation --json "<prompt>" starts a conversation and returns
its session id, worktree, branch and web link. Pass --project <name> outside an adopted checkout.
No terminal attaches and no name picker opens. --name names or joins a worktree; --worktree
requires an existing one. The ordinary terminal launch remains available without --conversation.
mend wait <session> --turn --json [--timeout 10m] follows the latest recorded turn as it was when
the wait began. A completed turn exits 0, an observed failed, interrupted or cancelled turn exits 1,
and pending human requests exit 3 with the session URL and request details. The default deadline is
10 minutes and covers session resolution and every read. A timeout exits 124; work keeps running.
mend history <session> --json [--since <turn>] reads the conversation’s paginated history,
including messages, tool calls and files touched. --since includes the full turn id and later
turns. Provider metadata is omitted.
Show each pending request to the person. Forward only their explicit answer with
mend respond <request> --decision accept|accept-for-session|decline|cancel --json, or
mend respond <request> --answers '{"question-id":["the person's answer"]}' --json. Use
--answers - for stdin. An outside agent never grants permission itself.
mend message <session> "<text>" --resume --json resumes a stopped conversation and sends one
correlated message. --queue requests a new turn when busy. JSON receipts use the same versioned
contract, omit the submitted words, and retain clientMessageId for reconciliation. An unconfirmed
delivery exits 1, or 124 on timeout. Inspect history before sending again; every invocation creates
a new request key.
mend interrupt <session> --json asks the running turn to stop. mend stop <session> --json stops
the agent while keeping its record and change. All these commands require an explicit session when a
terminal picker would otherwise be needed.
mend stop <session> --services --json stops the session’s Services through their separate route
and returns the observed stopped count. It does not stop the agent.
Onboarding JSON
Section titled “Onboarding JSON”For shell agents, mend adopt --json, mend connect <provider> --json,
mend connect status --json, mend git check --json, mend doctor --json, and
mend server setup|status --json return the versioned command contract. A completed result is
{"v":1,"status":"done","data":{…}}. An unfinished prerequisite returns status: "not_ready", its
items, and error: {code, message, fix}. Errors use the same error object. Exit statuses are 0
for done, 1 for failure, 2 for usage or needs_input, 3 for a human approval with a URL, 4 for
unfinished prerequisites, and 124 for a timeout. JSON adoption never offers a setup session.
Run mend doctor --harness codex --project <project> --json for the person’s chosen harness and
project. Readiness requires a reachable server, a Mend sign-in, the selected harness login on that
server, and observed Git read and push access for the project. Pi uses Codex’s login. Without
--harness, at least one selected Claude or Codex login must be active. Missing local CLI
credentials and unused providers are info items, with fixes, and do not block readiness. A
Codex-only person needs no Claude login. GitHub login is needed only for GitHub landing.
mend help <command> --json returns its help page in data.text without contacting a server.
mend logout --json reports local sign-out and server device revocation separately. If revocation
fails, it removes the local sign-in and returns an error with the remaining server action.
mend connect status --json reports the selected Claude and Codex logins. Pi uses the Codex login;
its saved profile is a separate fact. mend connect <provider> --from-stdin --json reads a
credential from stdin. --api-key also reads stdin and sends the credential as an API key; the
result carries the login’s class and its last four characters. Credential material is never part of
the result. mend connect claude|codex --json [--timeout 10m] starts the provider’s own browser
login in a private temporary directory. It emits authorize events with the provider URL and public
device code when applicable, followed by a completed result. Only the person approves the login. The
provider’s raw output and saved credentials are never printed.
mend login --url <server> --json [--timeout 10m] immediately emits a versioned authorize event
with url, code and expiresAt. After approval it saves the CLI sign-in with mode 0600 and
emits a signed-in event with account and organization. Denial or expiry returns a JSON error.
The timeout bounds the request and polling. JSON mode opens no browser.
On a fresh server, mend server setup --yes --account-email <email> --account-name <name> --json
creates the first account and organization through the existing registration route. It generates an
unknown password internally, saves this machine’s CLI device sign-in privately, and returns
data.firstAccount.webSetupUrl. Give that one-time link to the person to set their web password.
Setup refuses to register another account when the server already has one. Over SSH, the sign-in is
saved on the server machine; the person’s local CLI then uses mend login --url <server> --json.
mend git check [--project <p>] --json asks the server to read origin’s refs and attempt a push
dry-run with the project’s own Git access. Each result includes its method and observation time. It
writes no remote refs. A dry-run does not test server hooks or branch protection. Each failed check
includes the transport’s first error line, with credentials removed. Each transport has a 60-second
deadline. An unfinished push check includes the public deploy key. Mend recommends it only when the
reason indicates authentication; DNS, network and timeout failures get their own recovery steps.
Adding a deploy key with write access requires your approval. An explicit unknown project returns
project_not_found; a duplicate adoption name returns project_name_taken and names --name.
mend server setup --yes --json [--timeout 20m] reports server readiness without a picker.
mend server status --json [--timeout 30s] reports a stopped server as unfinished. JSON setup and
status print only the v1 result. Doctor returns exit 4 if a required checklist item is todo or
failed; advisory checks use info.
| Command | Purpose |
|---|---|
mend login [--url <server>] [--open | --no-open] |
Sign in through the browser. The CLI opens <server>/authorize, waits for you to press Authorize, and saves a revocable device token with mode 0600. Over SSH, or on Linux with no display, it prints the link and code instead of opening a browser; --open and --no-open decide outright. The CLI counts down from the time the server says is left, so a server clock that disagrees with this machine’s does not expire the request |
mend logout [--json] |
Revoke this terminal’s device token on the server and remove it from this machine |
mend uninstall [--all | --server | --home] [--yes] |
Remove the local server (live sessions’ workspaces, containers, volumes, networks, image, private configuration), this machine’s Mend files (sign-in, workspace SSH key, and the ~/.ssh/config blocks of the servers it removes or signs out of), or both, with Mend’s images; asks for the scope and prints the plan first, and needs the word delete before the server goes |
mend connect <claude|codex|github> [--use-my-login] [--from-stdin] [--remove [<name>]] |
Connect or remove a provider for the signed-in user; the credential is stored under your own user and shared with no one; --remove takes the chosen login, or the account of that name |
mend connect <claude|codex> --api-key [--endpoint <url>] [--default] [--remove] |
Read an Anthropic or OpenAI API key from stdin and connect it beside a subscription, never printing it; --default makes it the default login, --remove disconnects the key, which stays valid at the provider until revoked there; --endpoint sends the key’s requests to a compatible endpoint, such as a company gateway |
mend connect pi [--dir <path>] [--dry-run] [--remove] |
Save pi’s agent directory on this machine (~/.pi/agent, or $PI_CODING_AGENT_DIR) as your pi profile, which every pi session you start receives; --dry-run says what would be sent and sends nothing, --remove deletes the profile |
mend accounts |
List the signed-in user’s connected provider accounts |
mend agent-logins [all|selected] |
Show or set which of your own logins your Claude and Codex sessions get: every one connected (all, the default) or the session’s own agent’s only |
mend settings [send-steers [on|off]] [--json] |
Show or set your own messaging setting. send-steers is Send steers the running turn, on by default: on, a message you send while your own turn runs goes into that turn; off, it always starts your next turn. --json prints one versioned object |
mend doctor |
Run a read-only setup checklist and print a repair command for unfinished items: the server, the sign-in, the platform connection, the provider accounts (Claude, Codex, GitHub) and Mend’s own Claude login, the adopted projects, the claude, codex and gh CLIs on this machine, the exposure, whether the server’s host allows rootless Docker, a server clock more than two minutes off this machine’s, and, where it applies, a Mac that sleeps on its own or when its lid closes, and what a stop of the Docker daemon waits for against what systemd allows docker.service |
mend doctor --bundle [--out <path>] [--tail <n>] |
Write one redacted diagnostic archive for a bug report; default path ~/.config/mend/bundles/mend-bundle-<time>.tgz, --tail 1 to 2000 lines per log, default 500 |
mend pair [--url <base-url>] |
Create a single-use, ten-minute pairing code for another device; --url selects one of the server’s configured origins |
mend version |
Print this CLI’s version and the server’s, when it answers within two seconds; mend --version and mend -v do the same |
mend connect claude and mend connect codex log in afresh through the provider’s own flow (a
browser login for Claude, a device code for Codex) into a throwaway directory, send that login and
delete it, so your own logins stay as they are and this machine keeps no copy. Both rotate their
refresh token, and two copies of one login sign each other out; --use-my-login sends the login
this machine already uses instead, and both sides then share it. mend connect github asks gh for
its token. Run mend connect claude or mend connect codex again when Mend says a login needs
reconnecting. --api-key connects an API key instead, billed per token by the provider; set a spend
limit on it there. Read Connect provider accounts for credential
sources and removal.
In a per-person workspace each person’s processes use their own GitHub login, in their own home: git
over HTTPS to GitHub reads it through Mend’s credential helper, and no GITHUB_TOKEN is set in the
environment. A command that needs the token takes it for itself:
GITHUB_TOKEN=$(/run/mend/bin/mend-git-credential token) <command>.
mend connect pi sends extensions, themes, prompt templates, settings, mcp.json and keybindings,
following links, so a setup Home Manager links in is read as the files it points at. Your pi login
stays on this machine: pi runs on the ChatGPT login mend connect codex makes. Run it again after
you change your setup; running sessions keep the profile they started with. Read
Your pi setup.
mend uninstall asks for a scope when none is given, prints exactly what will go, and needs the
word delete before the server is touched (--yes skips the question; with no terminal it is
required); any other answer removes nothing and exits 1. With Docker stopped, --server and --all
refuse and change nothing. The server scope stops and removes its sessions’ workspaces first, live
ones included, then the server’s containers, volumes, networks, image and private configuration; the
mend-store volume and identity.env go last. What Docker would not remove keeps them and is
written to uninstall-left.json, so running mend uninstall again finishes the job and
mend server setup can reinstall over it. Only the ~/.ssh/config blocks of the servers it removes
go; other servers’ blocks stay, and the plan names each. --all also offers the images Mend pulled
and built, with their size, and removes the user-namespace sysctl file setup wrote, putting back the
setting it replaced (a file written by hand stays). Docker’s build cache gets its own question and
stays under --yes. The CLI itself stays: npm uninstall -g @sealant/mend removes it.
mend doctor --bundle collects the CLI and its environment, the doctor lines, the server’s health,
the local server’s compose file and the names of its .env keys (never their values), Docker facts,
container logs, every session with its processes, exit codes, argv and recorded terminal output, the
connected accounts, and the versions of claude, codex, gh, git and docker. A part that
fails leaves a <name>.error.txt in the archive. One redactor runs over every file, and the archive
is written with mode 0600. It still contains logs and configuration; read it before you share it.
See Troubleshooting.
Server commands
Section titled “Server commands”Server commands run on the machine that hosts Mend. They manage the local Docker Compose
installation created by mend server setup; they do not sign this CLI in or change Docker’s global
context.
| Command | Purpose |
|---|---|
mend server setup |
On a terminal: ask how the server is reached, Remote-SSH, the T3 Code gateway, the mirrors and the tenancy, show what is saved on a rerun, then what changes and the same command with flags, and apply on a yes |
mend server setup [options] |
Install or change the local server with flags, for scripts: check the Docker context and Compose plugin, download one release’s assets, claim the persistent volumes, pull and verify the pinned images, start the Mend, Postgres and Garage containers, then verify health |
mend server status |
Show the saved pin, active generation, container state, each mirror’s container, cache and traffic as observed, the edge and the posture declared beside what the server observes, without changing anything; a running Mend must answer health with the exact pinned version |
mend server start [--offline] |
Start the selected generation from preloaded images; never downloads assets or pulls release images |
mend server stop |
Stop Mend, Postgres and Garage without deleting volumes; workspace containers remain |
mend server restart [--offline] |
Restart Mend on the same generation and pin; Postgres and Garage keep running |
mend server logs [--tail <n>] |
Print a bounded tail of each container’s logs, 1 to 1000 lines per service, default 100; no follow mode |
mend server upgrade --version <target|latest> [--assets-dir <dir>] [--offline] [--from-preview] [--keep-backups <n>] |
Upgrade to an explicit version after validating its assets and image label, stopping application writers, and saving a private database backup; the edge and the posture are carried into the new generation, and downgrades are refused. --from-preview moves a X.Y.Z-preview.K server to X.Y.Z-next.N once, after checking the target carries every applied migration. After a healthy upgrade, older completed backups are removed, keeping the newest --keep-backups (default 2; 0 keeps all) |
mend server setup with no flags on a terminal asks its questions in plain words; read
Install Mend for the conversation. The flags below
are the same choices for scripts and CI. On an existing install each changes only what it names, and
the rest is kept from the saved install. With no terminal and no flags, a fresh install is refused
rather than guessed; --yes takes the defaults. On a terminal, a fresh install with more than one
Docker engine answering asks which one Mend runs in, the current context in brackets, and carries
the answer into the command it prints as --context. --context and --docker-socket choose the
Docker engine and answer only that question: on a Mac with Docker Desktop and OrbStack,
mend server setup --context orbstack asks the rest. A fresh install without --context takes
DOCKER_CONTEXT, as docker does, and with --yes or no terminal, the current context, naming the
others. An existing install stays in the engine its data is in; another engine is a new install.
Before anything is pulled, setup checks that Mend’s web and SSH ports are free where they are to be
published, and names what holds one that is not: another Mend with its version, or something else.
On a terminal it offers the next free port; with flags it refuses and names --port or
--ssh-port. After starting, it waits for health from this install (its version and the instance id
the server reports), so another Mend answering on the same port is never taken for it. When this
machine’s CLI points at another server, or at nothing, setup offers to point it at the one it
installed. When setup changes Mend’s URL, a CLI signed in at the old one stays pointed there; setup
prints the command each one runs, mend login --url <new>, which is a new browser authorization.
Two mirrors run beside Mend unless turned off: an npm mirror and a pull-through cache of Docker Hub. Neither publishes a host port. Sessions install npm packages and pull Docker Hub images through them, a project’s own npm settings win, and a mirror that is down sends sessions upstream. An upgrade adds them to an install from before them. Read npm mirror and Docker mirror.
Setup options:
| Option | Meaning |
|---|---|
--yes |
No questions: a fresh install takes the defaults (this machine only, http://localhost:3105), an existing one keeps what is saved |
--context <name> |
Local Unix-socket Docker context to persist; the global context is unchanged. Answers the engine question. Default: DOCKER_CONTEXT on a fresh install, else the saved one |
--version <v> |
Exact Mend server version, or latest; a fresh setup pins the CLI’s own version, and a rerun keeps the existing pin |
--bind <ip> |
Published listen address for web and SSH; default 127.0.0.1 |
--ssh-bind <ip> |
Published address for workspace SSH alone, when not --bind; with --edge, Remote-SSH from another machine needs it. Kept across reruns; the --bind address takes it away |
--url <origin> |
Advertised browser URL; required with a non-loopback bind |
--origin <origin> |
Additional exact browser origin; repeat for more than one. The list given replaces the saved one; none clears it |
--port <n> |
External web port; default 3105; must differ from the SSH port. A saved --url on the old port moves to the new one |
--ssh-port <n> |
External workspace SSH port; default 2222 |
--edge <host> |
Run the Caddy TLS edge for this DNS name on ports 80 and 443; the origin becomes https://<host>, --bind stays on loopback, and the first account must already exist |
--no-edge |
Take a saved edge away; the origin returns to http://localhost |
--exposure <v> |
Declare loopback, private or public; kept across reruns and upgrades. public needs --edge and an existing first account |
--tenancy <v> |
Declare single or multi; kept across reruns and upgrades. multi, like public, also sets the multi mode gate’s variables |
--declare <item> |
State a gate item you verified from outside: core-private, edge-tls, workspace-ssh or t3code-gateway; adds to the saved ones; repeat for more, none clears. public with --ssh-bind beyond loopback needs workspace-ssh |
--undeclare <item> |
Take one statement back; the others stay. Repeat for more |
--t3-gateway |
Turn on the t3code gateway: its own listener, published where Mend’s web port is (loopback, or the tailnet or LAN address); kept across reruns and upgrades. Refused on a Mend image without it, or a port already in use |
--t3-gateway-port <n> |
Its port; default 3120; implies --t3-gateway |
--no-t3-gateway |
Turn it off; its state stays in the mend_mend-t3-gateway volume |
--t3-gateway-origin <host> |
With --edge: the edge serves the gateway over HTTPS on this host of its own, whose DNS points where the edge’s does; implies --t3-gateway |
--no-t3-gateway-origin |
The edge stops serving the gateway; it stays on, on 127.0.0.1 |
--session-runtime <runtime> |
Where new sessions run: docker or boat, saved across reruns and upgrades. Docker by default. Existing worktrees keep their runtime. boat needs Boat set up (the two flags below) and the two remote workspace endpoints; it never falls back to Docker. |
--boat-deployment-id <name> |
Optional. The name Mend labels this server’s Boat VMs with, so servers sharing one Boat account keep apart. Boat doesn’t show it; setup picks one when it is left out. Kept across reruns and upgrades. Run sessions on Boat. |
--boat-api-key-stdin |
Read the Boat API key from standard input. Kept in server.env only. |
--boat-resources, --no-boat-resources |
Whether Boat sessions reach project resources such as @db through a resource gateway on the server. On by default. |
--no-boat |
Forget Boat’s key and settings. Sessions already on Boat stop running. |
--npm-mirror, --no-npm-mirror |
Run or stop the npm mirror; kept across reruns and upgrades. Default: on |
--npm-mirror-max-size <size> |
The npm mirror’s disk cap, such as 20g or 1536m, at least 1g. Default: 10g |
--docker-mirror, --no-docker-mirror |
Run or stop the Docker Hub mirror; kept across reruns and upgrades. Default: on |
--docker-mirror-max-size <size> |
The Docker mirror’s cap, such as 40g; over it the cache is cleared and fills again. Default: 20g |
--docker-hub-username <name> |
The Docker mirror pulls as this Docker Hub account; needs --docker-hub-token-stdin |
--docker-hub-token-stdin |
Read that account’s access token from standard input; kept in server.env, never in argv or a session |
--docker-hub-public-only |
Required with a login: you state the token is scoped Public Repo Read-only, since every session can pull what it can read |
--no-docker-hub-login |
The Docker mirror pulls anonymously again |
--assets-dir <dir> |
Copy compose.v2.yaml and postgres-init.sh from a local release directory; a fresh setup then requires --version |
--offline |
Use retained or supplied assets and preloaded images only; no GitHub requests or release-image pulls |
--docker-socket <path> |
Daemon-side socket mount override for diagnostics; retained on reruns |
--allow-userns |
On a Docker host whose kernel refuses unprivileged user namespaces, allow them without asking: writes /etc/sysctl.d/60-mend-rootless-docker.conf on the host and applies it |
--no-allow-userns |
Leave the host’s kernel as it is without asking; setup prints the command instead |
Setup holds an exclusive lock through startup and health checks, keeps private configuration in
immutable generations, and never deletes Docker volumes. A changed --version on a rerun is
refused; use mend server upgrade. Read Install Mend and the
self-hosting guide for offline
assets, locks, and upgrade recovery, and Exposure and budgets for how the
server is reached. --edge runs the TLS edge and --exposure and --tenancy declare the posture;
all three are written into the generation and kept by every rerun and upgrade. Without them a server
it installs runs as private and single.
Project commands
Section titled “Project commands”| Command | Purpose |
|---|---|
mend adopt [git-url] [--name <name>] [--auth <mode>] [--private|--shared] |
Clone a network Git repository into the store; with no URL, the current checkout’s origin |
mend refresh [project] |
Fetch origin’s branches into the store so new sessions base on current tips |
mend projects [--json] |
List adopted projects and their live sessions; --json for scripts |
mend env load [file] [--secret [A,B]] [--project <name>] |
Load dotenv values into project configuration and secrets; provider login names are refused |
mend env show [--project <name>] |
List configuration, secret, and cluster-binding names; never secret values |
mend env cluster add secret|configmap <name>, remove <kind>/<name>, sa <name>|--clear |
Bind Kubernetes Secrets, ConfigMaps, and a service account to a project’s workspaces; Mend stores names only |
Git authentication modes for mend adopt are mend-key and bridge. The default is your Git
access mode from mend keys mode, which is mend-key until you change it. Local paths, file://
URLs, option-like sources, and Git remote helpers are rejected.
A project is --private by default: only you see it. --shared makes it visible to everyone in
your organization, who can then start sessions in it. See Organizations.
mend projects --json prints {"v":1,"status":"done","data":{"projects":[...]}}, with an empty
list when there are none. The shape is stable:
| Key | Type | Meaning |
|---|---|---|
id |
string | The project’s id |
name |
string | Its name, as --project takes it |
originUrl |
string or null |
The repository it was adopted from, without credentials |
defaultBranch |
string | The branch new worktrees start from |
storePath |
string | Where the store holds it on the server |
liveSessions |
number | Sessions live in it now |
current |
boolean | The current directory is inside it |
The CLI never prints a URL’s credentials in what it says itself: an origin adopted as
https://oauth2:TOKEN@github.com/acme/repo.git reads as https://github.com/acme/repo.git in JSON,
in tables, in messages and in the mend service init preview. The userinfo is everything before the
last @ of the URL’s authority, whitespace and control characters included; an ssh URL keeps its
user and loses only the password (ssh://git:pw@host/… reads ssh://git@host/…). A command’s
recorded output (mend run, mend logs, mend service logs, mend attach) and a file’s contents
(mend memory show) are printed as they are. A session’s record is not its owner’s alone: anyone
who can read the project can read it, so a password a command printed reaches them too.
Start agents and commands
Section titled “Start agents and commands”mend codex ["prompt"] [options]mend claude ["prompt"] [options]mend opencode ["prompt"] [options]mend pi ["prompt"] [options]mend run [--detach] [--json] [options] -- <command...>Agent options:
| Option | Meaning |
|---|---|
--model <id> |
The harness’s model id, one mend models lists. Default: the server’s; Claude and opencode choose their own |
--effort <level> |
low, medium, high, xhigh, max, or ultra where the model takes it. Default: the harness’s own |
--base <ref> |
Create the worktree from another Git base |
--name <worktree> |
Name the worktree; an existing name joins it as a new session |
--worktree <name> |
Join an existing worktree only; fails naming candidates when absent |
--ask |
Restore the harness’s permission prompts |
--fast |
Request the Codex priority service tier |
--detach, -d |
Launch without attaching; reattach anywhere with mend attach |
--foreground |
Stop the session when this CLI exits (the detach key still detaches) |
--no-tunnel |
Do not tunnel the session’s browser Services to this machine |
--land, --no-land |
Land, or do not land, when a turn completes, for this session only |
--project <name> |
Select an adopted project instead of matching the current directory |
A quoted prompt becomes the first message and supplies the initial session name. Interactive
launches ask for the worktree’s name first (enter accepts an automatic one); --name answers it up
front. The CLI creates or joins the worktree, says so when a name joins an existing one, waits for
the workspace and process, then attaches the current terminal. Requesting a --base that differs
from an existing worktree’s base is refused rather than silently re-basing it.
In a per-person workspace, joining a worktree where another person’s session runs says so before the
session starts:
Anna's session is running in this worktree. You share its workspace: everything you run runs as you, on your own logins, but either of you can read the other's files, logins included.
Background sessions
Section titled “Background sessions”Sessions run in the background: closing the terminal, losing the network, or the CLI dying leaves
the session running, and stops are explicit. The Sessions switch in Settings (overridable per
project, inherit · on · off) turns this off for interactive launches, giving them foreground
semantics: the session stops when the launching mend exits. --detach and --foreground override
both for one launch. Foreground stops are best-effort on signals: a SIGKILL or power loss cannot
stop anything; mend sessions shows what still runs and mend stop ends it. A terminal that closes
(its window, tmux kill-session) stops a foreground session as SIGHUP does. The switch applies to
interactive CLI launches (mend codex|claude|opencode|pi); mend run prints the command’s recorded
output without attaching, and browser or phone clients never stop a session by disconnecting.
Inside a session workspace, the staged helper accepts mend stop too, so a workspace shell (or the
agent itself) can end its own session, and mend land, which lands the session’s change as its
owner (see Ask the agent to land).
--land and --no-land override the project’s “Land when a turn completes” setting for one session
(see Landing commands); a project set to off wins over --land. Mend lands
after turns it runs itself, so an agent attached to a terminal lands on its own only once the
session is picked up on the phone. From the terminal, land it with mend land.
Codex uses model, effort, permission, and speed options. Claude uses model, effort, and permission
options. opencode uses model and permission options; its models are named provider/model, and
without one it opens on openai/gpt-6.1-sol through your ChatGPT login. pi uses model and effort
options (effort up to max, as its --thinking) and runs on the ChatGPT login mend connect codex
makes; mend connect pi sends it your setup. See Your pi setup.
Run a command
Section titled “Run a command”mend run starts a session whose process is your command instead of a harness. It takes
--project, --name, --worktree and --base as the agents do, and prints what the command
writes to its terminal, as the record holds it, then exits with the command’s exit code. The command
runs in a terminal, so its stdout and stderr arrive together, on stdout. What mend run says itself
(the project, the worktree, the session, how the command ended) goes to stderr, so a script reads
the command’s output alone:
out=$(mend run --project api -- git log -1 --format=%H)An attached mend run shows output and sends no keys, so a shell given no script and no -c
(mend run -- bash) would wait for input forever: it is refused before anything is created. For a
shell, use Open a shell on the web, mend shell <session>, or mend run --detach -- bash
followed by mend attach; for commands, mend run -- bash -c '…'.
Ctrl+C stops watching and puts back the terminal modes the command’s output set (alternate screen,
hidden cursor, mouse, keyboard); the command keeps running, and mend stop ends it. Output that
could not be given in full, because the server refused a read or the reader went away, fails
mend run with exit 1 even when the command succeeded, and stderr says the command’s own code.
Stopped by a signal, mend run, mend logs and mend wait exit 128 + its number: 130 for
SIGINT (Ctrl+C), 129 for SIGHUP, 143 for SIGTERM. mend run and mend logs put the
terminal back first. A second signal exits at once, and an exit waits at most 5 seconds for a reader
that takes nothing, then says the output may be incomplete and fails.
A reader that stops reading early (mend service list | grep -q web, | head -1) closes the pipe,
and every mend command then exits 0 at once, quietly, so a pipeline under set -o pipefail
reads as the reader’s own result. mend run and mend logs are the exception above: the command’s
output is what they deliver, and output that could not be delivered fails them.
--detach returns as soon as the command runs. --json prints one JSON object on stdout in place
of the output: sessionId, processId, worktree, branch, url, and the process’s status and
exitCode as last observed (exitCode is null until it ended). With --detach it is printed
once the command runs, and says so when it already ended; without, once it ended. Pick the session
up again with mend logs and mend wait:
id=$(mend run --detach --json -- pnpm test | jq -r .sessionId)mend logs "$id" --followmend wait "$id" --timeout 900 # exits with the test run's exit code, or 124| Command | Purpose |
|---|---|
mend logs [session] [--follow|-f] [--from <seq>] [--process <id>] |
Print a session’s recorded terminal output on stdout; settled sessions count |
mend logs [session] --service <name-or-id> [--follow] [--from <seq>] |
Print a Service’s current attempt’s recorded output |
mend wait [session] [--timeout <duration>] [--process <id>] [--json] |
Return once the session’s command ended, with its exit code; 124 when the timeout passes first |
mend logs reads the session’s command (or agent) by default, and another of its processes, a shell
or a Service attempt, with --process and a prefix of its id; a Service’s id or name there reads
its current attempt. --service takes a Service’s id, its name or a prefix of its id, the ids
mend service list prints, and reads its current attempt, ended or not. A full id names its Service
before any name does; a name two Services carry is refused, with both ids listed. A Service with no
attempt (an adopted port, which Mend runs no process for) has nothing recorded, and mend logs says
so and exits 1. --follow keeps printing until the process ends. A record is printed as it is,
with nothing taken out, and it is not the session owner’s alone: anyone who can read the project can
read it with mend logs or mend service logs, so what a command printed, a password included,
reaches them too. mend wait exits with the code the platform reported, or 1 when it reported
none. A session that is still starting (its workspace building, its image pulling) is waited
through, and while a launch or a resume is starting the previous process’s end does not count;
--process binds the wait to one process, the processId that mend run --json prints.
--timeout takes seconds (90, 90s or .5), minutes (5m) or hours (1h), and covers
everything, finding the session and every read and retry; --json then prints the last state read.
Without it, mend wait waits as long as the command runs, as mend run does. Both take the session
id, a prefix of it, or the worktree’s name.
The platform takes a command of at most 64 words and 1 MiB, at most 131,071 bytes a word, whose
program has no leading or trailing whitespace and with no NUL byte in any word. An argument may be
empty, start with a newline or span lines, so bash -lc "<script>" takes any script. mend run
refuses a command outside that before anything is created and names the word by its position.
Workspaces set PAGER=cat, because the workspace images carry no less and git log in a terminal
would otherwise fail with unable to execute pager 'less'. A project variable named PAGER, a
PAGER your shell profile exports, or core.pager in your git config wins.
Models
Section titled “Models”mend models [--json]The server owns the model list, one per harness. mend models prints each harness’s models with
their ids, the one a launch runs when --model is not given marked default, and the efforts a
model takes where they are fewer than the harness’s. Every client offers the same list and
preselects the same default. A launch that names no model runs that default. Claude and opencode
have none marked: a launch of theirs that names no model is sent none, and Claude Code runs the
model your Claude settings name, else its own default, as a claude you run yourself does. The
session records the model and effort it was started with, which mend sessions shows after the
branch. An id the list does not know is passed through as given; the harness decides whether it
exists.
Session commands
Section titled “Session commands”| Command | Purpose |
|---|---|
mend or mend ui [--no-tunnel] |
Open the terminal dashboard of projects, worktrees and sessions |
mend snake |
Open the dashboard with a game of snake over it; Esc or q closes the game |
mend worktrees [--project <name>] [--json] |
List worktrees and the sessions inside them |
mend worktrees rm <name> [--force] [--project <name>] |
Remove a worktree, its sessions and its change, with --force when its change is not landed |
mend sessions [--all] [--project <name>] [--json|--json=v2] |
List live sessions, or include settled sessions with --all |
mend status |
Alias for mend sessions |
mend attach [session-id-prefix] [--no-tunnel] |
Reattach to a running session; a session picked up on the phone moves to this terminal |
mend stop [session-id-prefix] |
Stop the agent; the worktree, record and review remain |
mend stop --all [--project <name>] |
Stop every live session, or every live session in one project |
mend stop --services [session-id-prefix] |
Stop the session’s Services instead of its agent |
mend shell [session-id-prefix] |
Open a shell in a live session workspace |
mend continue [session-id] |
Resume a session with its pending review follow-up |
mend resume [session-id] [--with <harness>] [--project <name>] |
Restore provider state and resume a settled session |
mend rejoin [session-id] [--harness <harness>] [--no-tunnel] |
Attach when live, otherwise resume |
mend workspace replace <session> [--yes] |
The change’s owner replaces a workspace that started before Mend 0.36; prints what would stop first |
With no session ID, attach, stop and shell take the one live session; with several, a picker
opens. A prefix of the ID is enough. Other commands narrow candidates by the current project and
then use a picker when needed. An ID you give is the session acted on, by stop, resume, rejoin
and mend service logs alike.
mend resume --project <name> looks the session up in that project, so it works from any directory.
Without it, the project is the one the current directory matches.
A mend run session has no agent to resume: mend resume on its own harness is refused with
This run session has no agent to resume. Resume it as a shell, or start another session in its worktree.
In a session someone else owns, mend shell is refused: a shell is the owner’s alone.
Services keep running after mend stop, and a running Service keeps the workspace up. The stop then
says so, for example agent stopped · 3 services keep the workspace up. mend stop --services
stops them; once nothing is live, the workspace closes.
mend sessions --json returns the v1 command envelope with a flat list in data.sessions. Unknown
projects and request failures use the same structured errors. mend sessions --json=v2 and
mend worktrees --json preserve the legacy worktree-grouped output ("version": 2); against an
older server every session appears as its own worktree with "id": null, so the shape is stable
either way. Human-readable rows may change as the interface improves.
In a per-person workspace, mend sessions adds a line under a
session when there is something to say about its workspace: who else is live in it
(Shared workspace with Anna · each of you runs as yourself · either of you can read the other's files.),
the waiting line while a turn waits for another person’s work, and the line of a workspace that
waits to be replaced. mend workspace replace is Replace this workspace now from a terminal: it
says when Mend last checked and lists what would stop (terminal sessions, shells, Services started
by hand, processes Mend did not start, running containers, anything it could not check), asks, and
replaces the workspace once its last save is done. It ends nothing that was not on that list: if
more would stop by then, the server refuses. An agent turn in flight is never stopped.
Deleting a session removes only the conversation record; the worktree, with its change and
checkpoints, remains. Removing a worktree is its own explicit act (mend worktrees rm <name>,
dashboard Shift+D, the web app’s worktree menu, or the API), and only the change’s owner, whose
session started it, may do it. It is refused while any session is live, and refused while the
worktree holds work that is not on origin (a change never landed, one changed since its last
landing, or any work in a project with no origin) unless forced. The refusal lists every blocker at
once, and mend worktrees rm prints it as the server said it, with the --force form when force
lifts it. A worktree whose workspace is still saving is refused either way.
Landing commands
Section titled “Landing commands”mend land <session> [--branch <name>] [--no-pr] [--title <text>] [--project <name>]mend land <session> --check [--project <name>]mend pull <session> [--branch <name>] [--force] [--project <name>]<session> is a prefix of the session ID or the worktree’s name; settled sessions count.
mend land publishes a session’s change. Only the change’s owner lands it: the owner of the
worktree’s first session. Mend takes a checkpoint, commits what the agent left uncommitted on top of
the agent’s own commits and the last landing (never squashing or rewriting them, and never moving
the session’s branch), and pushes that to origin with the project’s git access, as mend/<name>
unless --branch names another. The project’s default branch and the pull request’s base are
refused, and a landing with nothing new since the last one pushes nothing and says so. The push only
fast-forwards: when origin’s branch has commits Mend has not seen, or origin refuses, nothing is
pushed and the command prints the remote’s own words. When origin is on GitHub, Mend then opens a
pull request into the session’s base branch or updates the one it opened before, through your
connected GitHub account; --no-pr skips it. The command prints the landing and what Mend observed,
and exits 1 when the push was refused or a step failed:
✓ pushed · mend/fix-login · 3f2a1c0 · pull request #412 · opened checkpoint 9e8d7c6 commit 1a2b3c4 · Mend's, for the work left uncommitted pull request https://github.com/acme/api/pull/412 observed pushed · mend/fix-login · 3f2a1c0 · observed pull request #412 · open · observed 0 s agoA pull request someone opened outside Mend, including one the agent opened with gh, is found and
recorded as the change’s own. Mend looks after the agent pushes a branch and when its turn ends, and
mend land --check looks now without pushing anything. It asks GitHub, as you, about the worktree’s
branch, every branch the agent pushed, and the agent’s head commit. A later landing pushes that pull
request’s branch and updates it. A pull request from a fork is shown and never updated: Mend pushes
to origin only, and opens no second pull request beside it. Read
Land a change.
mend pull fetches a change into the local clone you run it in, as a branch of the same name. Mend
commits the latest checkpoint the way mend land does, without pushing, and sends the commits from
the session’s base as a git bundle, so it works before landing and without origin. Only the change’s
owner gets a checkpoint taken first; anyone else gets the latest one, and pulling moves nothing on
the server. One of the clone’s remotes must be the project’s origin: the same host, port and path,
where ssh, https and git@host:path spellings match and the path’s case counts except on
github.com. --force skips the check. The clone needs the session’s base commit. The working tree,
the index and the current branch are not touched, and an existing local branch only fast-forwards.
The clone records each pull under refs/mend/pulled/<branch>, and the next pull asks the server to
build on it, so pulling again after more work fast-forwards. With nothing new, the branch stays and
the CLI says unchanged since the last pull · nothing moved. A branch that cannot fast-forward (you
committed on it, or the server no longer holds the last pull) is left as it is, and the CLI says
why; --branch <name> fetches into a new local branch instead. A bundle over the server’s
MEND_BUDGET_BUNDLE_BYTES limit is refused with its size.
Handoff command
Section titled “Handoff command”mend handoff ["prompt"] [--with <harness>] [--project <name>] [--yes]mend handoff copies the branch in the current checkout into a new session: the commits ahead of
the merge base with the project’s default branch, the staged files, the unstaged files and the
untracked files. The checkout is not written to. Git runs against copies of HEAD and the index,
and every object it writes goes to a scratch repository, so no file, index, ref or object of the
checkout changes. With a prompt, the session’s agent (--with, default claude) starts on it and
the command returns without attaching; when the agent does not start, the CLI says the prompt was
not sent and names mend <harness> --project <project> --worktree <name> '<prompt>', which sends
the same prompt. Without one, Mend holds the workspace with a shell and no agent, and the CLI prints
✓ held · idle, no agent; when the hold fails it names
mend resume <session> --project <project> --with shell.
✓ project newsroom-api · main · from origin✓ fix/login · 2 commits ahead of main · 3 uncommitted files · 1 untracked stays here · gitignored files and .env files: .env.local left out · assets/demo.mov · 212 MiB, over the 8 MiB file limit bundling 2 commits · 4 files → uploading 1.2 MiB → creating worktree✓ handed off as fix-login · your checkout is unchanged · as of 10:42:05 base main 3e73da3 · session 3f2a1c0d✓ running · claude on your prompt attach · mend attach 3f2a1c0d watch · http://localhost:3105/sessions/3f2a1c0d-…Gitignored files and .env* files stay in the checkout, and the CLI names the .env* files. Files
over the server’s per-file limit (MEND_BUDGET_HANDOFF_FILE_BYTES, 8 MiB by default) and files with
a git filter attribute, such as Git LFS files, stay too, each named. In the session each of them
is at its HEAD version, so review shows no change for it. A .env* file that a commit ahead added
or changed travels in that commit, and the CLI names it with the commit
(travels in a commit · .env.local (1a2b3c4)). An edit under assume-unchanged or skip-worktree
travels, and the CLI names the file with its bit
(travels though hidden from git · config/database.yml (skip-worktree)).
The merge base is taken against origin/<default branch> as the checkout last fetched it. The CLI
never fetches; when that ref is missing it refuses and names git fetch origin. Before it adopts,
the CLI takes the default branch from origin/HEAD when that names a branch the checkout has, and
otherwise from origin/main, then origin/master; with none of them it refuses before adopting and
names git fetch origin, or git remote set-head origin -a when branches were fetched. The
checkout’s origin must be the project’s origin, compared by host, port and path, where the path’s
case counts except on github.com, and --project does not skip the check. When no adopted project
matches, the CLI asks to adopt origin first; --yes answers yes, and without a terminal the
command refuses unless --yes is given. A bundle over the server’s MEND_BUDGET_BUNDLE_BYTES limit
is refused before it is sent, with its size. A connection that ends without an answer, or a proxy’s
502, 503 or 504, sends the same bundle again, twice at most. A server older than handoffs is named
with its version, and nothing is created. Read Hand off local work.
Dashboard keys
Section titled “Dashboard keys”The session pane takes three quarters of the screen: a read-only detail of the selected session with
the conversation record it has written so far. The remaining quarter is a sidebar of three stacked
sections, projects, then worktrees, then sessions. The section you are in stands open, and the other
two fold to the line that says what is selected. Every pane carries its number in its title, as
lazygit numbers its panels: [1] projects, [2] worktrees, [3] sessions and [0] for the
session pane. Moving the selection only navigates; nothing takes the terminal until you press a
verb. The footer names the keys that apply where you are and always ends with ? keys.
| Key | Action |
|---|---|
↑ ↓, k j, PgUp PgDn |
Move inside the open section, or scroll the session pane |
1 2 3 0 |
Jump to projects, worktrees, sessions, or the session pane |
Tab, Shift+Tab |
Next or previous pane, coming back round at either end |
Enter, →, l |
Move right: projects, worktrees, sessions, then the session pane |
←, h, -, Backspace |
Move left |
Esc |
Clear this list’s filter, else go back to the pane you came from |
/ |
Filter the focused list; Enter keeps the filter, Esc clears it |
? |
List every key the dashboard answers to |
+ _ |
Cycle the screen mode: normal, half, full |
a |
Attach a live session |
r |
Resume a settled session, on a harness you pick |
n |
Start another session in the selected worktree; on the projects section, start a new worktree |
w |
Start a new worktree |
e |
Rename the session |
v |
Review the change |
o |
Open the session in the browser |
Shift+K or x |
Stop the session (press twice). On the worktrees section, stop every live session in it. On a session whose agent stopped while Services keep the workspace up, stop those Services |
Shift+D |
Remove (press twice). On the worktrees section, remove the worktree, refused while a session is live; elsewhere, remove the session’s record and keep the worktree |
Shift+R |
Refresh |
q |
Quit |
A session you start or resume from the dashboard attaches by itself once it runs, while you are
still waiting on it; moving to another session, column or project, or a dialog open at that moment,
leaves it to a. MEND_AUTO_ATTACH=off leaves every attach to a. A terminal too narrow for both
sides gives the whole width to the side you are on, and one too short for three sections shows the
open section alone. On a server that is not this machine, the selected session’s live Services
declared --http or --https are tunneled to this machine’s loopback while it stays selected,
unless you started the dashboard with --no-tunnel. See
Terminal dashboard and attach.
Terminal attachment
Section titled “Terminal attachment”The CLI sends terminal input and resize events over one WebSocket and replays recorded output before following live frames.
Press Ctrl+] to detach without stopping the process. Set:
export MEND_DETACH_KEY=nonewhen tmux, Zellij, or another outer tool owns detaching.
Ctrl+V with an image on this machine’s clipboard sends the image to the session and pastes its
path; Codex and Claude read it. It needs wl-paste on Wayland or xclip on X11, and nothing extra
on macOS.
Dotfiles commands
Section titled “Dotfiles commands”| Command | Purpose |
|---|---|
mend dotfiles |
Show the configured repository, with its manager, and the synced file snapshot |
mend dotfiles repo <url> [--ref <r>] [--subdirectory <d>] [--manager <m>] [--no-bootstrap] |
Set the repository the server clones at launch; <m> is auto, copy, stow or chezmoi; saving tries the clone once |
mend dotfiles repo --clear |
Remove the repository |
mend dotfiles sync |
Preview known dotfile candidates on this machine |
mend dotfiles sync --all |
Replace the snapshot with all discovered candidates |
mend dotfiles sync <paths...> |
Replace the snapshot with selected home-relative paths |
Read Dotfiles before syncing credentials or machine-specific files.
Secret file commands
Section titled “Secret file commands”| Command | Purpose |
|---|---|
mend secrets |
List your secret files: the path each takes in the workspace, its size, and when it last changed |
mend secrets add <path> [--from <file>] |
Keep a file at <path> under the workspace home, reading it from <file> or stdin; replaces one kept there |
mend secrets rm <path> |
Remove a secret file |
Every session you own receives your secret files before its agent starts. They are never captured. See Secret files.
Skills commands
Section titled “Skills commands”| Command | Purpose |
|---|---|
mend skills [--project [p]] |
List your skill library on the server, or a project’s |
mend skills push [--project [p]] [--prune] [--dir <path>] |
Upload skill bundles from ~/.agents/skills; sessions receive them at launch, and --prune removes server-side skills the directory no longer has |
Your library applies to every session you start; a project’s library applies to sessions in that project. See Skills.
Memory commands
Section titled “Memory commands”| Command | Purpose |
|---|---|
mend memory [list] [--project <p>] |
List your agent memory for the project |
mend memory show <file> [--project <p>] |
Print one file as Mend stores it; a name alone is Claude’s, another harness’s takes its prefix, as in codex:MEMORY.md |
mend memory rm <file> [--project <p>] |
Remove one file; the last version stays on the server, and running sessions keep their copy |
mend memory import [--project <p>] [--dry-run] |
Run inside the repository’s checkout: bring the memory Claude Code keeps on this machine for it, and Codex’s summaries of conversations held in it |
Mend keeps Claude Code’s and Codex’s memory per person per project: every session you start on the
project receives yours, and what the agent learned is saved back when it ends. Other people’s
sessions never see it. An import merges a file both sides have, keeping both sides’ lines, reads no
transcripts, logins or settings, and keeps every version it replaces; --dry-run shows the plan and
writes nothing. See Agent memory.
Git commands
Section titled “Git commands”| Command | Purpose |
|---|---|
mend keys init |
Create your Mend key (Ed25519), held on the server; one key per user |
mend keys show |
Print your Mend public key |
mend keys mode [mend-key|bridge] |
Show or set your Git access mode for new projects; mend-key is the default |
mend keys share |
Relay this machine’s SSH agent to the Mend server until interrupted |
mend git-author [<name> <email>] |
Show or set the name and email your workspaces commit as |
mend git-author --clear |
Go back to your account’s name and email |
Add your Mend public key to your Git account’s SSH keys and every repository you can reach works,
from detached sessions and the phone too. For one repository only, add it as that repository’s
deploy key instead. In bridge mode every attaching mend command and the dashboard relay this
machine’s SSH agent while they run, so mend keys share is for a machine that runs nothing else.
The server takes one signer at a time; a newer share replaces the older one. The bridge requires a
reachable local SSH agent, and signing happens on the machine holding the key. See
Git access.
The Git author is set as system Git config in each workspace before the agent starts (in a
per-person workspace, in your own home’s Git config), so a user section in your dotfiles’
.gitconfig or in a repository’s own config still decides. Until you set one, it is the name and
email you registered with. Sessions launched after a change commit as the new author.
Workspace SSH commands
Section titled “Workspace SSH commands”| Command | Purpose |
|---|---|
mend ssh [status] |
Report the gateway, this client’s registered key, and the managed ~/.ssh/config block; it does not test a connection or verify the host key |
mend ssh <session> [--host <hostname>] |
Print the exact ssh ws-<workspace>@mend-ws-… command for one session’s running workspace; the workspace id is not the container’s name |
mend ssh setup [--key <path>] [--host <hostname>] |
Register this client’s public key and write a server-specific Host block before wildcard defaults; the hostname defaults to the configured Mend URL and the server supplies the port |
mend ssh keys [--json] |
List the keys your account registered from every machine: fingerprint, name, algorithm, the day it was registered, and which one this machine offers |
mend ssh keys remove <fingerprint> |
Remove one of your keys; the gateway refuses it from the next connection, and the removal says whether connections already open with it end. Where the platform cannot end them, it lists each running session with the mend stop that ends it |
You see and remove only your own keys. mend uninstall --home removes the key this machine
registered before it revokes the terminal’s device token. The VS Code extension uses the same
configuration. Read
workspace SSH for identity
selection and host-key verification.
Service commands
Section titled “Service commands”| Command | Purpose |
|---|---|
mend service init [--yes] |
Scaffold .mend/mend.toml from package and Compose files |
mend service run [session] --port <port> [options] -- <command...> |
Start and supervise a Service command; tunnels the port here when remote |
mend service run [session] <name> |
Start a recipe from .mend/mend.toml |
mend service <name> |
Shorthand for a named recipe |
mend service add [session] <port> [--name <name>] [--udp] [--http|--https] |
Forward an existing workspace listener without supervising it |
mend service connect [name...] [--port <port>] |
Bring live Services to this machine’s loopback over an authenticated tunnel |
mend service list [--json] |
List live Services, their process ids and observed endpoints |
mend service logs <name-or-id> [--from <sequence>] |
Replay and follow recorded Service output |
mend service restart <name-or-id> |
Start another attempt for a supervised Service |
mend service stop <name-or-id> |
Stop the process and close its host port |
mend service run accepts --name, --port, --udp, --http, --https, --wait, --timeout
and --no-connect, and for a recipe --setup, which runs .mend/mend.toml’s [setup] even where
it already succeeded. mend service stop <name> also ends a start of that Service still under way,
in its setup or a dependency’s start, before the Service exists. Mend holds the start for up to a
minute until the port answers. --wait keeps waiting while the Service is still starting, which
means its process runs and its port has not answered yet (building, installing, booting), up to
--timeout (a duration as mend wait takes it; default 10m). Mend probes a started Service’s
port every 20 seconds, so the wait ends at the first probe that answers. The exit status says how it
ended:
| Exit | What was observed |
|---|---|
0 |
The port answered |
1 |
Mend refused the start (no such session or recipe, not yours to run, the session not live) or did not answer |
2 |
The Service’s process ended before its port answered; the line says its status and exit code |
3 |
The server no longer has the session; its workspace went with it |
124 |
The Service was still starting when the timeout passed; it keeps starting |
The wait judges the one process this start began: the CLI sends a fresh id with the start, the
server stamps it on the attempt it begins, keyed by the Service (launchCorrelationId
service-start:<service id>:<id>), and the wait finds that attempt by it once, in the session it
started in, whatever another client starts, restarts or stops meanwhile. An id the same Service took
before is refused; another Service’s ids, another person’s included, are neither refused nor seen.
Its port answering counts only from a probe made after that attempt began. A process its workspace
took ends as exited · no exit code reported, exit 2: Mend records the end, not its cause. A
server older than the CLI stamps no id: a start whose answer an edge cut is then not followed, and a
command that exits inside the server’s minute reads as the refusal the server answers with, both
exit 1.
A recipe whose [setup] or depends run first runs to its end on the server whatever happens to
the command: Ctrl-C at the spinner, or an edge cutting the request, leaves it going, and a Stop of
one of its Services ends it. --wait follows it, with a line for setup’s steps and for each
dependency as it starts and answers, for as long as --timeout allows.
A waited start returns and opens no tunnel; mend service connect reaches the port. --wait takes
TCP ports only (UDP has no probe), and not a recipe that declares only a port, which Mend adopts
once it answers within its ready timeout.
mend service list prints each Service’s id beside its current attempt’s process id, which is what
mend logs --process and mend wait --process take. --json prints one object: version 1 and
services, each with id, name, sessionId, processId (null for an adopted port), status
as last observed, workspacePort, protocol, and hostPort, authority and browserUrl (null
when not bound).
mend service run "$id" --port 3000 --name web --wait --timeout 15m -- pnpm devstatus=$?[ "$status" -eq 124 ] && echo "web is still starting; it keeps starting"[ "$status" -ne 0 ] && { mend logs --service web; exit "$status"; }On a server that is not this machine, mend attach, mend codex|claude|opencode|pi, mend rejoin,
and the dashboard tunnel the session’s live Services declared --http or --https to this
machine’s loopback while attached, on the Service’s own port when it is free. One line each says
where it opens (web → http://localhost:5173); a Service that stops closes its tunnel, and
detaching closes them all. --no-tunnel opts out.
Read Development services for network and authentication boundaries.
mend inside the workspace
Section titled “mend inside the workspace”Every session workspace has a mend command of its own on the PATH. It is not the CLI above and not
part of the workspace image: the server stages a small helper into the session’s run directory,
mounted read-only at /run/mend and linked to /usr/local/bin/mend, so it is always version-locked
to the server. It talks only to its own session, over the session socket (or the authenticated
session endpoint), and it speaks Services, repositories, mend land and mend stop:
| Command | Purpose |
|---|---|
mend service or mend service list |
List this session’s live Services |
mend service run --port <port> [--name <n>] [--udp] [--http|--https] -- <command...> |
Start and supervise a Service |
mend service run <name> or mend service <name> |
Start a recipe from .mend/mend.toml |
mend service add <port> [--name <n>] [--udp] [--http|--https] |
Adopt an existing workspace listener |
mend service stop <name-or-id> |
Stop a Service |
mend service restart <name-or-id> |
Start another attempt |
mend repo or mend repo list |
List the repositories added beside /workspace/repo, with their state |
mend repo projects |
List the projects of the store this session may add |
mend repo add <project> [--as <name>] [--worktree <name>] |
Add a project as a repository of this session at /workspace/repos/<name> |
mend land |
Land the session’s change as its owner: the push, the pull request, or why not |
mend stop |
Stop this session; the record and review remain |
The helper has no init, no logs, and no connect: history and reaching the endpoint stay on
your side. Its job is declaration: an agent that starts a dev server can register it as a real
Service instead of leaving an unobserved listener, and --http/--https says it is something to
open in a browser (refused with --udp). mend repo add makes the worktree, answers, and brings
the files in while the session goes on; read
Several repositories in one session for what a repository is
and how it is saved.
Organization commands
Section titled “Organization commands”| Command | Purpose |
|---|---|
mend org |
Print the organization this sign-in acts in, your role, and one row per organization you belong to |
mend org switch <name|id> |
Move this CLI’s sign-in to another of your organizations; the web and other devices stay put |
mend org leave <name|id> [--yes] |
Leave one of your organizations; asks first, refused for its last owner or your only organization |
mend members |
Print the organization’s name and one row per member: name, email, role and the day they joined |
mend invite [--role member|owner] [--email <address>] [--days <n>] |
Owners only. Print a single-use invitation link; default role member, default 7 days, at most 30 |
mend folder list |
List the organization’s folders |
mend folder create <name> |
Owners only. Create a folder; names use lowercase letters, digits, dots, underscores and dashes |
mend folder push <name> <dir> [--replace] |
Owners only. Upload a local directory into a folder; --replace empties the folder first |
mend folder rm <name> |
Owners only. Remove a folder; refused while a project still selects it |
mend session share <session> on|off [--yes] |
Turn shared control on or off for a session; turning it on asks first, --yes answers for a script |
Every command acts in the organization this CLI’s sign-in has; mend org says which. Mend sends no
email: you share the invitation link yourself. With --email, only an account with that address can
accept it. Someone already signed in joins with the account they have. Owners change roles and
remove members in Settings on the web.
A project selects which folders its sessions receive, at /workspace/home/<name>, read-only unless
chosen otherwise, from its next session. mend folder push skips .git and node_modules
directories, symlinks, and files over 1 MiB, and counts what it skipped. See
Folders.
Only the session’s owner turns shared control on; the owner or an organization owner turns it off. While it is on, anyone who can see the project sends turns, answers approvals and interrupts. In a workspace that shares one home they do so on the owner’s provider logins and Git access; in a per-person workspace each turn runs on its sender’s login. They can attach to the terminal to read it; only the owner types in it, opens a shell or starts a Service. Every act is recorded with who did it. See Organizations.
Operator commands
Section titled “Operator commands”These commands need the operator role, which the instance’s first account holds. The operator administers the instance and reads no organization content.
| Command | Purpose |
|---|---|
mend operator exposure |
Print MEND_EXPOSURE as declared and each item of the public exposure gate |
mend operator gate |
Print each item of the multi mode gate, what this instance shows, and what would satisfy it |
mend operator org list |
List organizations with their member and owner counts |
mend operator org create <name> |
Create an organization; only with MEND_TENANCY=multi |
mend operator org rename <org> <name> |
Rename an organization |
mend operator org invite-owner <org> [--email <address>] |
Print a single-use link that makes whoever opens it an owner of the organization |
mend operator org add-member <org> <email> [--role <r>] |
Add an account of another organization to this one; only with MEND_TENANCY=multi |
mend operator grant-owner <org> <email> |
Make an existing member an owner, for an organization whose owners are gone or locked out |
mend operator reset-link <email> |
Print a single-use password reset link, valid for a day |
mend operator exposure marks each gate item observed (the server read it), carried (this build
contains it and the server cannot see it in effect), declared (you stated it and the server cannot
check it) or open. MEND_EXPOSURE=public refuses to start while an item the server can observe is
open. The report is what was observed; it does not say an instance is fit to expose. See
Exposure and budgets.
MEND_TENANCY=multi refuses to start while any item of the multi mode gate is open. Organization
changes the operator makes are recorded in that organization’s audit log. Setting a password with a
reset link signs the account out everywhere; owners reset their members’ passwords from Settings.
Shell completion
Section titled “Shell completion”mend completions zshmend completions bashThe generated hook completes command names and live session IDs. Add its output to the matching shell configuration. Fish completion is not currently generated.
CLI configuration
Section titled “CLI configuration”The CLI reads:
| Input | Default |
|---|---|
MEND_URL |
http://localhost:3105 |
MEND_TOKEN |
Saved token from the configuration file |
MEND_DETACH_KEY |
Ctrl+]; none turns the detach key off |
MEND_AUTO_ATTACH |
On; off keeps the dashboard from attaching a session you started there once it runs |
MEND_DEBUG |
Off; 1 prints each refused call, its status and its tag on stderr |
$XDG_CONFIG_HOME/mend/cli.json |
~/.config/mend/cli.json when XDG is unset |
The configuration file contains:
{ "url": "http://localhost:3105", "token": "<redacted>"}A legacy ~/.mend directory remains authoritative when it is the only Mend configuration directory
on the machine.
Exit behavior
Section titled “Exit behavior”One-shot commands print a readable server error and exit nonzero when a request fails. Interactive
commands return terminal control when the process ends or the user detaches. mend doctor does not
change server or machine state.
mend help <command> prints one command’s page and mend man <command> opens the same page in
man; the npm package also installs mend(1) and mend-<command>(1) for a global install.