husk <command> [flags]husk with no arguments prints the top-level help and exits 0 — a question, not a
mistake, so probing for the binary in a script does not look like a failure.
The … stands for the global flags, five commands to start with, and the exit codes.
Global flags
Every command accepts these. Their meaning never changes between commands.
| Flag | Effect |
|---|---|
--json | Machine-readable output, and the only thing on stdout |
-q, --quiet | Errors only |
--no-color | Plain text. Also automatic when piped, and with NO_COLOR |
--color | Force colour on, even when piped |
--debug | Full stack traces, including cause chains |
-y, --yes | Answer every confirmation with yes |
-h, --help | Help for any command |
--version and -V work only on the bare husk invocation, not after a subcommand.
Parsing is strict: a typo'd flag is a usage error, not a silently ignored string.
error unknown flag --jsno -- run with --help to see what this command accepts
hint: husk help psExit codes
Frozen, because scripts and CI key off them.
| Code | Meaning |
|---|---|
0 | Success |
1 | Error |
2 | Usage mistake |
130 | Interrupted (Ctrl-C) |
husk exec is the one deliberate exception: it exits with the child command's own code,
so husk exec box -- test -f /work/x && echo yes behaves the way you expect.
Command aliases
| You type | You get |
|---|---|
ls, list | ps |
create | up |
destroy, delete | rm |
sh | shell |
check | doctor |
quickstart | onboard |
Computers
husk up
husk up [name] [flags]With no name, Husk generates one (box-a1b2c). The machine is lazy: nothing runs inside
it until you exec.
| Flag | Value | Default |
|---|---|---|
--provider | docker | podman | local | ssh | fly | best available |
--flavor | base | python | node | full | base |
--memory | 2g, 512m, or a plain number of MB | provider default |
--cpus | a positive number | provider default |
--network | none | egress | full | no policy: all but internal addresses |
--packages | package names, comma-separated or repeated | — |
--persist | boolean | off |
--env | KEY=VALUE, repeatable | — |
--idle-timeout | seconds unused, after which the shared Husk destroys it | never |
--json | print the ComputerInfo record | — |
Without --network there is no policy, which allows what full allows: everything but
internal addresses. egress allows only the hosts on an allow list, and husk up has no
flag for one.
--packages installs at create time. Docker and Podman build them into an image of the
computer's own, with the flavor's package manager (apt, pip or npm). local tries uv,
pip and npm, and goes on without them if all three fail. ssh and fly refuse them.
A named provider is never silently substituted:
error provider "docker" is not usable: docker is installed but the daemon is not reachable
hint: start Docker Desktop (or `sudo systemctl start docker`), then re-run `husk doctor`husk ps
husk ps [--all] [--json]| Flag | Effect |
|---|---|
-a, --all | Include stopped machines |
--json | Print the full ComputerInfo records |
Piped output is tab-separated with no colour and no truncation, so
husk ps | cut -f2 works. An empty list exits 0, not 1.
husk rm
husk rm <name|id> [--all] [--erase] [--yes] [--force]| Flag | Effect |
|---|---|
--all | Destroy every computer |
--erase | Also erase what a chat's computer, or a bot's with computer.persist: true, keeps on Docker and Podman: its files and browser logins |
-y, --yes | Skip the confirmation |
-f, --force | Skip the confirmation, and with --all destroy computers used in the last minute too |
Asks first unless --yes or --force is given; --json does not skip the question. On
a non-interactive stdin without one of those it refuses rather than guessing:
error refusing to destroy 3 computers without confirmation on a non-interactive stdin--all --yes still refuses, and destroys nothing, when a computer was used in the last
minute, since it may belong to a run in another terminal; --force destroys them all.
husk stop and husk start
husk stop <name|id>
husk start <name|id>No flags beyond the global set. stop keeps the filesystem:
✓ stopped docsbox — the filesystem is kept; `husk start` brings it backhusk exec
husk exec <name|id> [flags] -- <command...>| Flag | Value | Default |
|---|---|---|
--cwd | path inside the machine | /work |
--timeout | seconds; the process tree is killed | 120 |
--env | KEY=VALUE, repeatable | — |
--stdin | text piped to the command | — |
--json | buffer and print the full ExecResult | stream |
Everything after -- belongs to the command, flags included. Without --, leftover
positionals are still accepted, so husk exec box ls works — but -- is the only form
that can carry flags safely.
stdout and stderr stream live, and Husk exits with the command's own exit code.
husk exec docsbox -- uname -sr
husk exec docsbox -- 'echo hi > /work/a.txt; cat /work/a.txt'
husk exec docsbox --json -- ls /work | jq .exitCodehusk shell
husk shell <name|id> [--cwd <path>]--cwd sets the directory the prompt starts in. Default: the computer's workdir.
husk cp
husk cp <src> <dst>Either side may be name:/path, and exactly one of them must be. Directories are
copied recursively, except on Fly, where husk cp copies one file at a time, of at most
32 MB.
husk cp ./report.csv docsbox:/work/report.csv
husk cp docsbox:/work/out.json ./out.json
husk cp ./src docsbox:/work/srcA single-letter prefix is a Windows drive, not a computer — no computer name is one
character, and husk up x is refused — so husk cp C:\data\x.csv box:/work/ does what a
Windows user expects.
A // after the colon is a URL scheme, not a path, and is treated as local.
Both sides naming a computer is a usage error with the two-step fix in it.
Agents
husk init
husk init [name] [--out husk.yaml] [--force] [--yes]| Flag | Effect |
|---|---|
--out | Where to write. Default husk.yaml |
--force | Overwrite an existing file |
-y, --yes | Accept every default without asking |
Asks a few questions on a terminal; with --yes, or when piped, it writes defaults.
husk run
husk run <husk.yaml|name> [prompt] [flags]| Flag | Value | Default |
|---|---|---|
--model | alias or provider/model | from the spec |
--max-steps | positive integer | limits.maxSteps |
--max-cost | USD | limits.maxCostUsd |
--approve | auto | ask | readonly | guardrails.approvalMode |
--no-computer | boolean | off |
--var | KEY=VALUE, repeatable, for {{KEY}} in the persona. KEY is letters, digits and _; anything else is refused | — |
--json | print the RunResult instead of streaming | — |
The prompt is the remaining positionals, or piped stdin:
husk run husk.yaml "summarise /work/notes.md"
echo "why is main red?" | husk run ci-triageThe first positional is resolved as a path first, then as
~/.husk/husks/<name>/husk.yaml. Neither existing is an error naming both:
error no husk named "triage", and no file at /home/me/triage
hint: run `husk init` to create one, or `husk distill <transcript>` to generate one from a chatOn a terminal the model's text streams to stdout; steps, tool calls and warnings go
to stderr. With stdout piped, every step's text streams to stderr as well, and stdout
gets the answer alone — the last step's text, as --json's text has it — so
husk run husk.yaml "…" > answer.txt captures the answer and nothing else. Under --json,
stdout is the one RunResult document, a failed run's included.
| Stop reason | Exit code |
|---|---|
complete | 0 |
step_limit, budget, timeout, error | 1 |
aborted | 130 |
Ctrl-C stops the run at once and leaves the computer alone — nothing is destroyed — and exits 130.
--max-cost and --max-steps are checked before anything runs: --max-cost abc and
--max-steps 0 are usage errors. --max-cost 0 is allowed, and means a free model.
A husk whose engine is claude-code or codex runs Husk's tools without asking, so an
approval mode other than auto, from --approve or from guardrails.approvalMode, is a
usage error there. --max-steps does not apply to those engines and says so;
--max-cost and limits.timeoutSec do.
husk validate
husk validate [file] [--json]Defaults to ./husk.yaml. Prints every problem at once, not just the first, naming the
file as you typed it. Exits 1 on an invalid file, and --json still emits
{ valid: false, path, issues }, for a file that is missing or not YAML too.
Chats
husk import
husk import [path] [--source <s>] [--pick <n>] [--limit <n>]| Flag | Value | Default |
|---|---|---|
--source | claude-code | chatgpt | codex | cursor | gemini | markdown | universal | detected |
--pick | choose by number without being asked | — |
--limit | how many candidates to list | 20 |
--json | the discovered list, or the imported transcript | — |
With no path, Husk searches its own list of locations, lists what it found, and asks you to choose. When it finds nothing, it says where it looked:
husk looked in:
~/.claude/projects Claude Code sessions
~/.codex/sessions Codex sessions
~/Downloads ChatGPT exports, and ~/Documents
~/.gemini/tmp Gemini CLI chats
Cursor's state.vscdb Cursor chat history
./ markdown and jsonlEvery transcript found in the chosen file is written to
~/.husk/transcripts/<id>.json, unredacted.
husk distill
husk distill <transcript-id|path> [flags]| Flag | Value | Default |
|---|---|---|
--model | the model to distill with | auto |
--no-model | force the free heuristic path | off |
--out | where to write | husk.yaml |
--name | override the generated husk name | from the transcript |
--force | overwrite an existing file | off |
--json | print { path, confidence, agent, spec } | — |
The heuristic path is free, deterministic and needs no API key. If no model is
reachable, husk distill degrades to it rather than failing.
System
husk onboard
husk onboard [--yes] [--skip-checks] [--json]| Flag | Effect |
|---|---|
-y, --yes | Do not ask, and create the throwaway computer even without a terminal |
--skip-checks | Do not create the throwaway computer |
--json | The same decisions as a machine-readable plan |
Five steps: what this machine gives you and how isolated it is, a throwaway computer
created and destroyed in front of you, the shortest route to a model if you have none,
where you will use Husk, and one command to run next. It never asks for an API key; it
prints the export line and checks again. With no terminal it prints the whole path as
text and creates nothing unless --yes is given. husk quickstart is the same command.
husk setup
husk setup [--computer <name>] [--flavor <f>] [--apps all|<id,id>] [--yes] [--remove] [--no-start]| Flag | Effect |
|---|---|
--computer | Where chats' computers run: docker, podman, local, ssh, fly or auto |
--flavor | The image: base, python, node or full, the one with the browser. Containers only |
--apps | all for every chat app found, or ids such as claude-desktop,cursor |
-y, --yes | Do not ask. Without a terminal, nothing changes without it |
--remove | Take Husk out of every chat app it is in |
--no-start | Do not get the computer's image or start Husk |
--json | What was chosen and changed |
Picks where your chats' computers run, adds Husk to the chat apps you choose, gets a
container computer's image, and starts the one Husk every chat goes through, printing its
console link. The apps it knows are claude-desktop, claude-code, cursor, vscode,
windsurf, zed, codex and gemini. For an app with a JSON config it backs the file
up and changes only its own husk entry, and it refuses a file it cannot parse; Claude
Code and Codex are changed through their own commands. Run it again to change the
computer. The console's Connect page does the same.
husk doctor
husk doctor [--json] [--force]--force bypasses the 30-second availability-probe cache.
The first thing to run when something is confusing. Reading the report walks through the output.
husk models
husk models [--all] [--json]--all includes models from providers with no credentials, marked offline.
husk serve
husk serve [--port 7377] [--host 127.0.0.1] [--remote --public-url https://<host> [--provider docker] [--remote-port <n>] [--remote-host <h>]]| Flag | Default |
|---|---|
--port | 7377, or HUSK_PORT |
--host | 127.0.0.1, or HUSK_HOST — loopback only unless you change it |
--remote | off. Serves /mcp to chat apps on the web, for the owner only |
--public-url | none. The fixed https name your tunnel gives remote access; --remote needs it |
--provider | docker. Where remote chats get computers: docker, podman, fly or ssh |
--remote-port | --port plus one. Remote access's own port, the one the tunnel publishes |
--remote-host | 127.0.0.1. Where that port listens |
On a loopback address without HUSK_TOKEN, it makes a token as it starts and keeps it
in ~/.husk/daemon.json, readable only by you. In a terminal it prints a console link
that signs you in once; husk console prints another.
Binding a non-loopback host without HUSK_TOKEN is a hard error, because this API can
execute shell commands. Self-hosting is the full setup.
--remote and --public-url go together, and --remote-port and --remote-host are
refused without them. Remote access will not start while a high or critical security
advisory stands against the install. Chat apps on the web is
the full setup.
husk console
husk console [--json]Prints a link to the console of the Husk running on this machine, with a code in it that
signs you in. The code works once, within 10 minutes, so the link is worth nothing to
anyone who finds it later in scrollback, a log or browser history. The token itself never
leaves ~/.husk/daemon.json. Run it again for another link, or when the console asks you
to sign in. --json prints { "url": "…" }.
husk remote
husk remote [claim|off|on|reset] [--json]Remote access's owner controls, asked of the Husk that husk serve --remote started on
this machine. With no action it says whether remote access is on, whether it has an
owner, and which apps are signed in.
| Action | Effect |
|---|---|
claim | A new claim code, while there is no owner |
off | Signs every app out, and makes the public URL a 404 until on |
on | Turns it back on; refused while a high or critical advisory stands |
reset | Removes the owner, every app that signed in and every token, and prints a claim code for a new owner |
--json prints the status as JSON, or { "code": "…" } for claim and reset.
husk mcp
husk mcp [--provider <p>] [--flavor <f>] [--session-key <k>] [--keep]| Flag | Effect |
|---|---|
--provider | Force a computer provider |
--flavor | The image: base, python, node or full. Default full, the one that runs the browser |
--session-key | Reuse one machine across calls |
--keep | Leave the machine running after the client disconnects |
stdout carries JSON-RPC and nothing else; logs go to stderr.
husk version
husk version [--json]Bare husk version prints one parseable line on stdout — that is what a release script
greps for. The node version, platform and state directory go to stderr where they
cannot break it.
husk help
husk help [command]Identical to <command> --help.
Environment variables
| Variable | Read by | Effect |
|---|---|---|
HUSK_HOME | everything | State directory. Default ~/.husk |
HUSK_HOST, HUSK_PORT | husk serve | Bind address and port |
HUSK_TOKEN | husk serve, @husk-ai/sdk | Bearer token |
HUSK_URL | @husk-ai/sdk | Control-plane address. Default http://127.0.0.1:7377 |
HUSK_LOG_LEVEL, HUSK_LOG_JSON | everything | Logger verbosity and format |
NO_COLOR, HUSK_NO_COLOR, FORCE_COLOR | the CLI | Colour |
HUSK_SESSION | @husk-ai/mcp | Default session key |
HUSK_DAEMON | @husk-ai/mcp | off runs a chat's tools in its own process, not through the shared Husk |
HUSK_JOBS_PORT | the job host | Its loopback port. Default: any free one |
HUSK_AUTO_FLY | choosing a provider | 1 lets auto pick Fly, which it leaves out because Fly is paid |
HUSK_REGISTRY, HUSK_IMAGE_TAG | container providers | Override the Husk image pair |
HUSK_SSH_TARGET, HUSK_SSH_KEY | the ssh provider | Remote host and key |
HUSK_FLY_TOKEN (or FLY_API_TOKEN, FLY_ACCESS_TOKEN) | the fly provider | Fly credentials: a deploy token for the computers' app is enough |
HUSK_FLY_APP (or FLY_APP_NAME), HUSK_FLY_REGION (or FLY_REGION), HUSK_FLY_API | the fly provider | App, region, API base |
HUSK_ADVISORY_ENDPOINT | remote access | Where the security-advisory check is sent. Default npm's bulk advisory endpoint |
HUSK_CLAUDE_CLI, HUSK_CODEX_CLI | the claude-code and codex engines | Path to your claude or codex, when it is not where Husk looks |
TAVILY_API_KEY, BRAVE_API_KEY (or BRAVE_SEARCH_API_KEY) | the web bundle | Enables web_search; Tavily wins if both are set |
CLAUDE_CONFIG_DIR | the Claude Code importer | Where to look for sessions |
CODEX_HOME | the Codex importer, husk import | Where Codex keeps its sessions. Default ~/.codex |
Model provider keys are listed on Providers.