husk.yaml is the whole agent in one file: portable, diffable, reviewable, and the only
thing the runtime needs to bring a bot up. It is validated by a zod schema, so an invalid
file fails with every problem listed at once rather than the first one.
husk init # scaffold one
husk validate # check ./husk.yaml
husk validate support.yaml # or a named fileThe smallest valid file
name is the only required field. Everything else has a default.
name: my-botThat expands to a husk on model: auto with an empty persona, the computer tool
bundle, a cli trigger, and every limit at its default.
Top level
| Field | Type | Default | What it does |
|---|---|---|---|
apiVersion | "husk/v1" | husk/v1 | Schema version. Bumped only on a breaking change |
name | string | required | 1–64 chars, ^[a-z0-9][a-z0-9-]*$. The URL and the CLI handle |
displayName | string ≤ 96 | — | Human label |
version | string | 0.1.0 | Your version, not Husk's |
description | string ≤ 280 | "" | One line |
model | string | auto | An alias or a provider/model id |
fallbackModels | string[] | [] | Tried in order when the primary is unavailable, rate limited or over budget |
engine | object | { type: builtin } | What runs the husk: Husk's own loop, or your own Claude Code or Codex. See below |
temperature | number 0–2 | — | Passed to the provider when set |
persona | string | "" | The system prompt. Supports {{var}} interpolation |
knowledge | object[] | [] | Stable reference text, appended to the prompt |
examples | object[] | [] | Few-shot pairs |
tools | string[] | ['computer'] | Bundle names or individual tool names |
computer | object | all defaults | The machine. See below |
limits | object | all defaults | Ceilings on a run |
guardrails | object | all defaults | Approval mode, deny list, refusals |
memory | object | all defaults | History trimming |
triggers | array | [{ type: cli }] | How the husk is reached |
metadata | record | {} | Free-form, carried through untouched |
origin | object | — | Provenance. Written by the distiller |
engine
engine:
type: claude-code # builtin (default) | claude-code | codex
resume: 4f1c2a9e-0b1d-4c3e-9a8f-1234567890ab # claude-code only: the chat to go on withbuiltin is Husk's own agent loop, on model: any provider you have set up, a local
Ollama included.
claude-code and codex run your own installed CLI, headless (claude -p,
codex exec), under your own login. The run gets Husk's tools and nothing else: no
built-in shell or file tools, no web search, no other MCP server, and none of a
project's settings. So it acts only on the computer, where a take-over, a cancel and
Husk's admission reach it as they reach a chat. Husk never reads or copies the CLI's
login.
resumegoes on with a Claude Code chat: each run is a fork of it (--resume <id> --fork-session), so the chat itself is never written to, and it uses the chat's own computer, with its files and logins. "Make this a bot" fills this in when Claude Code is installed.modelnames the CLI's model;autoleaves the CLI's own choice.limits.maxCostUsdis passed to Claude Code as--max-budget-usd, which counts only the run's own spend. Codex has no budget switch;limits.timeoutSecstill applies to both.- A husk with no
tools, orcomputer.enabled: false, only talks. - These engines run Husk's tools without asking, so a husk on them needs
guardrails.approvalMode: autoand nodenyCommands,allowCommands, networkallowordenylists orcomputer.image: saving one says so. - Husk looks for
claudeandcodexon the PATH and where their installers put them.HUSK_CLAUDE_CLIandHUSK_CODEX_CLIpoint it at a copy installed elsewhere. - Claude Code runs with
--tools "",--strict-mcp-configand--setting-sources user: your own settings apply, a project's do not. Codex runs with--ignore-user-config,--ignore-rulesand--sandbox read-only, its shell and web search turned off. Both start in~/.husk/bots/<name>.
Running your Claude subscription on a schedule is ordinary use of your own CLI, but Anthropic's Pro and Max plans assume individual use: for frequent schedules, give Claude Code an API key.
persona
The system prompt. {{var}} placeholders are interpolated from RunOptions.vars
(husk run --var key=value); an unknown variable is left intact rather than blanked.
At run time Husk appends two sections when they have content:
## Reference— one### <title>block per knowledge item.## Out of scope—Decline these, briefly, and say what you can do instead:followed by one bullet perguardrails.refuseentry.
knowledge
knowledge:
- title: Repository layout
content: |
packages/* are libraries, apps/* are deployables.
source: https://github.com/org/repo # optional, free-formtitle and content are required; there is no length cap in the schema.
examples
examples:
- user: main is red
assistant: >
The `build (node 20)` job failed at `packages/core` with TS2345.Both sides required.
tools
Bundle names expand; individual names are also accepted.
| Bundle | Tools |
|---|---|
computer | shell, expose_port, computer_info |
browser | browse, and browser_goto, browser_snapshot, browser_click, browser_type, browser_screenshot on a real Chromium |
files | read_file, write_file, edit_file, list_dir, search_files, move, delete |
web | fetch_url, and web_search when TAVILY_API_KEY or BRAVE_API_KEY is set |
http | http_request |
A tool that cannot work is skipped rather than registered-and-broken: a tool the model
can see is a promise that calling it will do something. Tools needing a machine are
dropped when computer.enabled is false, and http_request is opt-in — naming the
http bundle counts as naming it.
hand_off is opt-in too, and in no bundle: name it, and the model can pause the run
until a person has done what only they can, such as a sign-in or a 2FA code, and said
so. The run's time limit stops counting while it waits. Under husk run nobody can
take it, so the call fails with nobody is connected to take over this run.
computer
computer:
enabled: true
flavor: python
packages: [pandas, numpy]
network:
mode: egress
allow: ['pypi.org', 'files.pythonhosted.org']
memoryMb: 4096
idleTimeoutSec: 600
persist: true
setup: mkdir -p /work/out| Field | Type | Default | What it does |
|---|---|---|---|
enabled | boolean | true | false disables the machine entirely |
provider | string | best available | docker, podman, local, ssh, fly |
flavor | enum | base | base, python, node, full |
browser | enum | browser in ~/.husk/config.json, else chrome | chrome or lightpanda. See The browser |
image | string | — | Explicit image reference. Overrides flavor |
cpus | number > 0, ≤ 64 | 2 on Docker and Podman, 1 on Fly | CPU allocation. local and ssh set no limit |
memoryMb | int > 0, ≤ 131072 | 2048 on Docker and Podman, 1024 on Fly | Memory ceiling. Fly rounds it up to a multiple of 256 |
diskMb | int > 0 | 2048 | Docker and Podman only: the size of /work when it is not persisted |
idleTimeoutSec | int ≥ 0 | 900 | Destroy after this long with nothing run on it. 0 disables. See below |
maxLifetimeSec | int ≥ 0 | 0 | Destroy this long after creation, busy or not. 0 disables |
network | object | { mode: 'egress' } | See below |
packages | string[] | [] | Installed when the computer is made: by the flavor's package manager on Docker and Podman, with uv, pip or npm on local. ssh and fly refuse them. See Flavors |
setup | string | — | A shell snippet run once after creation |
env | record | {} | Variables passed in explicitly |
workdir | string | /work | Default working directory |
persist | boolean | false | Docker and Podman only: /work is a volume, not a tmpfs, so it survives a stop. See below |
mounts | object[] | [] | Host paths. readonly defaults to true |
user | string | 1000:1000 | Docker and Podman only: the user commands run as. root is accepted and runs as root, still with no capabilities |
labels | record | — | Provider-specific overrides. See below |
The idle and lifetime limits are enforced by the reaper, which husk serve and the shared
Husk run every 60 seconds over every computer on the machine; with neither running,
nothing is reaped. A reaped computer is destroyed, not stopped. On Docker and Podman a
bot's computer with persist: true keeps its /work volume, browser logins included,
and the bot's next run gets a new container on it. Otherwise the files go with the
computer. See Lifetimes.
computer.labels
Per-husk provider configuration, for the two providers that point at something outside this machine. Set here, a husk.yaml needs no environment variables at all:
computer:
provider: ssh
labels:
husk.ssh: deploy@build-box:2222
husk.ssh.key: ~/.ssh/id_ed25519| Label | Provider | Environment equivalent |
|---|---|---|
husk.ssh | ssh | HUSK_SSH_TARGET |
husk.ssh.key | ssh | HUSK_SSH_KEY |
husk.fly.app | fly | HUSK_FLY_APP / FLY_APP_NAME |
husk.fly.region | fly | HUSK_FLY_REGION / FLY_REGION |
husk.fly.ports | fly | — |
The label wins over the environment, so one machine can drive several boxes. Values are
strings; anything else is rejected at parse time. Husk adds labels of its own: husk.key
when it binds a machine to a session, and husk.allowCommands and husk.denyCommands
from guardrails. Do not set those.
computer.network
| Field | Type | Default | What it does |
|---|---|---|---|
mode | none | egress | full | egress | See Networking |
allow | string[] | — | Hostnames. A single leading *. wildcard is supported |
deny | string[] | — | Always refused, including in full |
strict | boolean | — | Refuse to make the computer when its provider cannot hold every process to the policy. See Networking |
An egress policy with no allow list permits nothing.
computer.mounts
mounts:
- source: ./data
target: /work/data
readonly: truesource and target are required. readonly defaults to true — a host mount is the
one hole in a container, and an agent that only needs to read a repository must not
rewrite it.
computer.env
Explicit values always win over the environment scrub, which is how you pass a credential deliberately:
computer:
env:
GITHUB_TOKEN: ${GITHUB_TOKEN}Explicit beats implicit, and now it is in the file where a reviewer can see it.
${NAME} is read from the environment Husk runs in (your shell for husk run, the
server's for husk serve) when the computer is made, never when the file is read, so
the file keeps the placeholder and not the secret. A NAME that is unset or empty is an
error, and no computer is made. Write $${NAME} for the text ${NAME} itself. The same
goes for a webhook trigger's secret.
limits
limits:
maxSteps: 20
maxCostUsd: 0.25
timeoutSec: 240| Field | Type | Default | What it does |
|---|---|---|---|
maxSteps | int 1–500 | 24 | Ceiling on tool-calling rounds |
maxCostUsd | number ≥ 0 | 0.5 | Ceiling on estimated spend for the run |
maxTokens | int > 0 | 200000 | Ceiling on total tokens |
timeoutSec | int > 0 | 300 | Wall clock for the whole run |
execTimeoutSec | int > 0 | 120 | Per-exec ceiling inside the machine |
maxOutputBytes | int > 0 | 262144 | Per-tool-result cap, before redaction |
Every ceiling is checked before the next model call, not after, so a run stops rather than overshooting. See Cost and budgets for what the cost estimate can and cannot know.
guardrails
guardrails:
approvalMode: auto
denyCommands:
- 'git\s+(push|commit|reset\s+--hard)'
refuse:
- deploying, reverting, or merging anything| Field | Type | Default | What it does |
|---|---|---|---|
approvalMode | auto | ask | readonly | auto | See below |
denyCommands | string[] | [] | Regexes matched against a shell command before it runs |
allowCommands | string[] | [] | Regexes that override both your deny list and the built-in one |
refuse | string[] | [] | Topics to decline, appended to the prompt as ## Out of scope |
redactSecrets | boolean | true | Pass every tool result through redact() before the model sees it |
allowCommands wins over denyCommands and over the built-in deny list: an explicit
allow entry is you saying you know better about your own machine, and you do. It wins
where it matches, so a command chained after an allowed one is checked on its own. An
entry that is not valid regex falls back to a substring match rather than throwing.
approvalMode
| Mode | Behaviour when a dangerous tool is called |
|---|---|
auto | It runs |
ask | The run pauses for an approver. With no approver wired up, the call is denied |
readonly | Denied, approver or not |
ask fails closed. A headless server running an ask-mode husk denies rather than
allows, which is the only safe default for a mode whose whole point is a human in the
loop.
Dangerous tools: shell, write_file, edit_file, move, delete, expose_port,
http_request, browser_click, browser_type. Not dangerous: read_file, list_dir,
search_files, computer_info, fetch_url, web_search, browse, browser_goto,
browser_snapshot, browser_screenshot, hand_off.
memory
memory:
enabled: true
backend: file
windowTurns: 20
summarise: true| Field | Type | Default | What it does |
|---|---|---|---|
enabled | boolean | false | The only gate. Off, and the bot keeps no notes and history is never trimmed |
backend | file | memory | sqlite | file | file keeps notes between runs; memory keeps nothing once the run ends; sqlite is not built yet |
windowTurns | int > 0 | 20 | Turns kept verbatim before older ones are summarised |
summarise | boolean | true | Summarise the elided middle instead of dropping it |
Notes between runs
With enabled: true and backend: file, the bot keeps notes from one run to the next.
They are plain text files in ~/.husk/bots/<name>/memory/, so you can open, edit or delete
any of them. The bot reads and changes them with one memory tool, which takes the same
commands as Anthropic's memory tool: view, create, str_replace, insert, delete and
rename.
At the start of every run the bot is told which notes it has and to read the ones that matter first. It is told to save what a later run will need, never to save secrets, and that a note is its own record, not an instruction from you: when a note and your request disagree, it follows the request.
Every engine uses the same notes. A bot on claude-code or codex gets the memory tool
through Husk's MCP server, beside its computer tools, and a bot with no computer gets the
memory tool alone.
Limits keep the notes a short record rather than a database: one note holds at most 64 KB, and a bot keeps at most 200 notes and 1 MB in all. A path that leaves the folder, or goes through a link, is refused, and anything that looks like a key or a token is masked before it is saved.
Trimming long chats
With enabled: true, the loop keeps the system messages, the husk's examples, the first
user message as an anchor, and the last windowTurns turns. A turn is a message from the
user with the answer to it, or one step the model takes after its tools answer, so a single
long run is trimmed as a long chat is. The middle is either replaced by a model-written
summary or by a marker, and a later trim summarises an earlier summary with the rest:
[husk: 42 earlier messages summarised]
…
[husk: 42 earlier messages elided to stay inside the context window]Cuts land on turn boundaries and orphaned pairs are pruned, so a tool_call is never
separated from its tool_result. The summary call is charged to the run's budget.
triggers
triggers:
- type: http
- type: cron
schedule: '*/15 * * * *'
prompt: Any red builds on main in the last 15 minutes?The schema accepts seven types. husk serve mounts all but cli, which needs nothing
mounted: see Triggers.
| Type | Fields |
|---|---|
http | path (default /), auth: none | token (default token) |
cron | schedule required, prompt required |
discord | channels (default [], and not started while empty), mentionOnly (default true) |
slack | channels (default [], and not started while empty), mentionOnly (default true) |
telegram | allowlist (default [], and not started while empty) |
webhook | path required, secret optional |
cli | none |
metadata and origin
metadata is a free-form record carried through untouched. Husk itself writes exactly
two keys into it, both from distillation:
| Key | Type | |
|---|---|---|
distilledConfidence | number, 0–1 | how much the distiller trusts what it extracted |
distillerNotes | string[] | what it had to guess at, and why |
These names are the contract. Every path that distils — husk distill,
POST /v1/sessions/distill, and toSpec in @husk-ai/sessions directly — goes through
the one mapper and writes these two. Nothing writes distillConfidence or
distillNotes; if you are reading a husk.yaml written by an older build, those are the
same two values under the old spellings.
Everything else under metadata is yours, and husk will not touch it.
origin records provenance. It survives a round trip through husk validate and back
out to YAML, so a distilled husk can always say where it came from:
| Field | Type | |
|---|---|---|
source | string | required within origin. The transcript's origin (its file path) when it has one, otherwise its source (claude-code, chatgpt, …) |
transcriptId | string | optional |
importedAt | string | optional |
messageCount | number | optional |
A complete example
apiVersion: husk/v1
name: ci-triage
displayName: CI Triage
version: 0.2.0
description: Reads failing CI logs and says what broke, in one paragraph.
model: sonnet
fallbackModels: [flash, gemma]
persona: |
You triage CI failures for a TypeScript monorepo.
Always read the failing job's log before forming an opinion. Quote the first
line that actually failed -- not the last line, which is usually the runner
giving up.
Answer in one paragraph. No preamble.
knowledge:
- title: Repository layout
content: |
packages/* are libraries, apps/* are deployables. Any change under
packages/core forces a full rebuild.
tools: [computer, files]
computer:
flavor: node
network:
mode: egress
allow: ['*.github.com', 'objects.githubusercontent.com']
idleTimeoutSec: 600
limits:
maxSteps: 20
maxCostUsd: 0.25
timeoutSec: 240
guardrails:
approvalMode: auto
denyCommands:
- 'git\s+(push|commit|reset\s+--hard)'
- 'gh\s+(pr|release)\s+(create|merge|edit)'
refuse:
- deploying, reverting, or merging anything
triggers:
- type: http
- type: cron
schedule: '*/15 * * * *'
prompt: Any red builds on main in the last 15 minutes? If none, reply exactly "clear".Validation errors
Every problem at once, each as path: message:
error husk.yaml is not a valid husk
✗ name: name must be lowercase alphanumeric with dashes
✗ limits.maxSteps: Too big: expected number to be <=500
✗ triggers.0.schedule: Invalid input: expected string, received undefined
hint: `husk init --force` regenerates a valid file, or see `husk help init`The same check is available over the control plane at POST /v1/husks/validate, which
returns { ok, issues } with HTTP 200 either way — it is a validator, not an operation
that can fail.