Husk
GitHub

Chat to bot

husk.yaml reference

Every field of the spec, its type, its default and what it does — taken field by field from the zod schema in packages/core/src/spec.ts.

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 file

The smallest valid file

name is the only required field. Everything else has a default.

name: my-bot

That 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

FieldTypeDefaultWhat it does
apiVersion"husk/v1"husk/v1Schema version. Bumped only on a breaking change
namestringrequired1–64 chars, ^[a-z0-9][a-z0-9-]*$. The URL and the CLI handle
displayNamestring ≤ 96—Human label
versionstring0.1.0Your version, not Husk's
descriptionstring ≤ 280""One line
modelstringautoAn alias or a provider/model id
fallbackModelsstring[][]Tried in order when the primary is unavailable, rate limited or over budget
engineobject{ type: builtin }What runs the husk: Husk's own loop, or your own Claude Code or Codex. See below
temperaturenumber 0–2—Passed to the provider when set
personastring""The system prompt. Supports {{var}} interpolation
knowledgeobject[][]Stable reference text, appended to the prompt
examplesobject[][]Few-shot pairs
toolsstring[]['computer']Bundle names or individual tool names
computerobjectall defaultsThe machine. See below
limitsobjectall defaultsCeilings on a run
guardrailsobjectall defaultsApproval mode, deny list, refusals
memoryobjectall defaultsHistory trimming
triggersarray[{ type: cli }]How the husk is reached
metadatarecord{}Free-form, carried through untouched
originobject—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 with

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

  • resume goes 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.
  • model names the CLI's model; auto leaves the CLI's own choice.
  • limits.maxCostUsd is passed to Claude Code as --max-budget-usd, which counts only the run's own spend. Codex has no budget switch; limits.timeoutSec still applies to both.
  • A husk with no tools, or computer.enabled: false, only talks.
  • These engines run Husk's tools without asking, so a husk on them needs guardrails.approvalMode: auto and no denyCommands, allowCommands, network allow or deny lists or computer.image: saving one says so.
  • Husk looks for claude and codex on the PATH and where their installers put them. HUSK_CLAUDE_CLI and HUSK_CODEX_CLI point it at a copy installed elsewhere.
  • Claude Code runs with --tools "", --strict-mcp-config and --setting-sources user: your own settings apply, a project's do not. Codex runs with --ignore-user-config, --ignore-rules and --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 per guardrails.refuse entry.

knowledge

knowledge:
  - title: Repository layout
    content: |
      packages/* are libraries, apps/* are deployables.
    source: https://github.com/org/repo   # optional, free-form

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

BundleTools
computershell, expose_port, computer_info
browserbrowse, and browser_goto, browser_snapshot, browser_click, browser_type, browser_screenshot on a real Chromium
filesread_file, write_file, edit_file, list_dir, search_files, move, delete
webfetch_url, and web_search when TAVILY_API_KEY or BRAVE_API_KEY is set
httphttp_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
FieldTypeDefaultWhat it does
enabledbooleantruefalse disables the machine entirely
providerstringbest availabledocker, podman, local, ssh, fly
flavorenumbasebase, python, node, full
browserenumbrowser in ~/.husk/config.json, else chromechrome or lightpanda. See The browser
imagestring—Explicit image reference. Overrides flavor
cpusnumber > 0, ≤ 642 on Docker and Podman, 1 on FlyCPU allocation. local and ssh set no limit
memoryMbint > 0, ≤ 1310722048 on Docker and Podman, 1024 on FlyMemory ceiling. Fly rounds it up to a multiple of 256
diskMbint > 02048Docker and Podman only: the size of /work when it is not persisted
idleTimeoutSecint ≥ 0900Destroy after this long with nothing run on it. 0 disables. See below
maxLifetimeSecint ≥ 00Destroy this long after creation, busy or not. 0 disables
networkobject{ mode: 'egress' }See below
packagesstring[][]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
setupstring—A shell snippet run once after creation
envrecord{}Variables passed in explicitly
workdirstring/workDefault working directory
persistbooleanfalseDocker and Podman only: /work is a volume, not a tmpfs, so it survives a stop. See below
mountsobject[][]Host paths. readonly defaults to true
userstring1000:1000Docker and Podman only: the user commands run as. root is accepted and runs as root, still with no capabilities
labelsrecord—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
LabelProviderEnvironment equivalent
husk.sshsshHUSK_SSH_TARGET
husk.ssh.keysshHUSK_SSH_KEY
husk.fly.appflyHUSK_FLY_APP / FLY_APP_NAME
husk.fly.regionflyHUSK_FLY_REGION / FLY_REGION
husk.fly.portsfly—

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

FieldTypeDefaultWhat it does
modenone | egress | fullegressSee Networking
allowstring[]—Hostnames. A single leading *. wildcard is supported
denystring[]—Always refused, including in full
strictboolean—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: true

source 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
FieldTypeDefaultWhat it does
maxStepsint 1–50024Ceiling on tool-calling rounds
maxCostUsdnumber ≥ 00.5Ceiling on estimated spend for the run
maxTokensint > 0200000Ceiling on total tokens
timeoutSecint > 0300Wall clock for the whole run
execTimeoutSecint > 0120Per-exec ceiling inside the machine
maxOutputBytesint > 0262144Per-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
FieldTypeDefaultWhat it does
approvalModeauto | ask | readonlyautoSee below
denyCommandsstring[][]Regexes matched against a shell command before it runs
allowCommandsstring[][]Regexes that override both your deny list and the built-in one
refusestring[][]Topics to decline, appended to the prompt as ## Out of scope
redactSecretsbooleantruePass 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

ModeBehaviour when a dangerous tool is called
autoIt runs
askThe run pauses for an approver. With no approver wired up, the call is denied
readonlyDenied, 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
FieldTypeDefaultWhat it does
enabledbooleanfalseThe only gate. Off, and the bot keeps no notes and history is never trimmed
backendfile | memory | sqlitefilefile keeps notes between runs; memory keeps nothing once the run ends; sqlite is not built yet
windowTurnsint > 020Turns kept verbatim before older ones are summarised
summarisebooleantrueSummarise 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.

TypeFields
httppath (default /), auth: none | token (default token)
cronschedule required, prompt required
discordchannels (default [], and not started while empty), mentionOnly (default true)
slackchannels (default [], and not started while empty), mentionOnly (default true)
telegramallowlist (default [], and not started while empty)
webhookpath required, secret optional
clinone

metadata and origin

metadata is a free-form record carried through untouched. Husk itself writes exactly two keys into it, both from distillation:

KeyType
distilledConfidencenumber, 0–1how much the distiller trusts what it extracted
distillerNotesstring[]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:

FieldType
sourcestringrequired within origin. The transcript's origin (its file path) when it has one, otherwise its source (claude-code, chatgpt, …)
transcriptIdstringoptional
importedAtstringoptional
messageCountnumberoptional

A complete example

ci-triage.yaml
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.