Husk
GitHub

Reference

CLI reference

Every command, every flag it actually parses, and its exit code.

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.

husk --help

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.

FlagEffect
--jsonMachine-readable output, and the only thing on stdout
-q, --quietErrors only
--no-colorPlain text. Also automatic when piped, and with NO_COLOR
--colorForce colour on, even when piped
--debugFull stack traces, including cause chains
-y, --yesAnswer every confirmation with yes
-h, --helpHelp 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 ps

Exit codes

Frozen, because scripts and CI key off them.

CodeMeaning
0Success
1Error
2Usage mistake
130Interrupted (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 typeYou get
ls, listps
createup
destroy, deleterm
shshell
checkdoctor
quickstartonboard

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.

FlagValueDefault
--providerdocker | podman | local | ssh | flybest available
--flavorbase | python | node | fullbase
--memory2g, 512m, or a plain number of MBprovider default
--cpusa positive numberprovider default
--networknone | egress | fullno policy: all but internal addresses
--packagespackage names, comma-separated or repeated—
--persistbooleanoff
--envKEY=VALUE, repeatable—
--idle-timeoutseconds unused, after which the shared Husk destroys itnever
--jsonprint 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]
FlagEffect
-a, --allInclude stopped machines
--jsonPrint 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]
FlagEffect
--allDestroy every computer
--eraseAlso 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, --yesSkip the confirmation
-f, --forceSkip 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 back

husk exec

husk exec <name|id> [flags] -- <command...>
FlagValueDefault
--cwdpath inside the machine/work
--timeoutseconds; the process tree is killed120
--envKEY=VALUE, repeatable—
--stdintext piped to the command—
--jsonbuffer and print the full ExecResultstream

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 .exitCode

husk 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/src

A 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]
FlagEffect
--outWhere to write. Default husk.yaml
--forceOverwrite an existing file
-y, --yesAccept every default without asking

Asks a few questions on a terminal; with --yes, or when piped, it writes defaults.

the file husk init --yes writes

husk run

husk run <husk.yaml|name> [prompt] [flags]
FlagValueDefault
--modelalias or provider/modelfrom the spec
--max-stepspositive integerlimits.maxSteps
--max-costUSDlimits.maxCostUsd
--approveauto | ask | readonlyguardrails.approvalMode
--no-computerbooleanoff
--varKEY=VALUE, repeatable, for {{KEY}} in the persona. KEY is letters, digits and _; anything else is refused—
--jsonprint 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-triage

The 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 chat

On 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 reasonExit code
complete0
step_limit, budget, timeout, error1
aborted130

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>]
FlagValueDefault
--sourceclaude-code | chatgpt | codex | cursor | gemini | markdown | universaldetected
--pickchoose by number without being asked—
--limithow many candidates to list20
--jsonthe 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 jsonl

Every transcript found in the chosen file is written to ~/.husk/transcripts/<id>.json, unredacted.

husk distill

husk distill <transcript-id|path> [flags]
FlagValueDefault
--modelthe model to distill withauto
--no-modelforce the free heuristic pathoff
--outwhere to writehusk.yaml
--nameoverride the generated husk namefrom the transcript
--forceoverwrite an existing fileoff
--jsonprint { 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]
FlagEffect
-y, --yesDo not ask, and create the throwaway computer even without a terminal
--skip-checksDo not create the throwaway computer
--jsonThe 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]
FlagEffect
--computerWhere chats' computers run: docker, podman, local, ssh, fly or auto
--flavorThe image: base, python, node or full, the one with the browser. Containers only
--appsall for every chat app found, or ids such as claude-desktop,cursor
-y, --yesDo not ask. Without a terminal, nothing changes without it
--removeTake Husk out of every chat app it is in
--no-startDo not get the computer's image or start Husk
--jsonWhat 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>]]
FlagDefault
--port7377, or HUSK_PORT
--host127.0.0.1, or HUSK_HOST — loopback only unless you change it
--remoteoff. Serves /mcp to chat apps on the web, for the owner only
--public-urlnone. The fixed https name your tunnel gives remote access; --remote needs it
--providerdocker. 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-host127.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.

ActionEffect
claimA new claim code, while there is no owner
offSigns every app out, and makes the public URL a 404 until on
onTurns it back on; refused while a high or critical advisory stands
resetRemoves 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]
FlagEffect
--providerForce a computer provider
--flavorThe image: base, python, node or full. Default full, the one that runs the browser
--session-keyReuse one machine across calls
--keepLeave 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

VariableRead byEffect
HUSK_HOMEeverythingState directory. Default ~/.husk
HUSK_HOST, HUSK_PORThusk serveBind address and port
HUSK_TOKENhusk serve, @husk-ai/sdkBearer token
HUSK_URL@husk-ai/sdkControl-plane address. Default http://127.0.0.1:7377
HUSK_LOG_LEVEL, HUSK_LOG_JSONeverythingLogger verbosity and format
NO_COLOR, HUSK_NO_COLOR, FORCE_COLORthe CLIColour
HUSK_SESSION@husk-ai/mcpDefault session key
HUSK_DAEMON@husk-ai/mcpoff runs a chat's tools in its own process, not through the shared Husk
HUSK_JOBS_PORTthe job hostIts loopback port. Default: any free one
HUSK_AUTO_FLYchoosing a provider1 lets auto pick Fly, which it leaves out because Fly is paid
HUSK_REGISTRY, HUSK_IMAGE_TAGcontainer providersOverride the Husk image pair
HUSK_SSH_TARGET, HUSK_SSH_KEYthe ssh providerRemote host and key
HUSK_FLY_TOKEN (or FLY_API_TOKEN, FLY_ACCESS_TOKEN)the fly providerFly 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_APIthe fly providerApp, region, API base
HUSK_ADVISORY_ENDPOINTremote accessWhere the security-advisory check is sent. Default npm's bulk advisory endpoint
HUSK_CLAUDE_CLI, HUSK_CODEX_CLIthe claude-code and codex enginesPath 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 bundleEnables web_search; Tavily wins if both are set
CLAUDE_CONFIG_DIRthe Claude Code importerWhere to look for sessions
CODEX_HOMEthe Codex importer, husk importWhere Codex keeps its sessions. Default ~/.codex

Model provider keys are listed on Providers.