/hermitd:docker-setupfrom hermitd
Generates Docker scaffolding for running hermit as an always-on autonomous agent in a container. Walks through token setup, build, start, MCP plugin configuration, workspace trust, and verification. Host-only, run after /hatch.
Ships in hermitd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Generate Docker scaffolding for running hermit as an always-on autonomous agent in a container. Docker provides isolation, crash recovery, and a reproducible environment. The default auto mode (classifier-reviewed autonomy) works well for most Docker hermits. Operators who need zero prompts for fully unattended operation can opt into bypassPermissions via /hermit-settings permissions.
Tone: Friendly guided wizard. Celebrate progress. When something fails, help fix it.
Important: Step 0's container check is a hard short-circuit — run it first and abort on container before anything else. After confirming host execution, run docker-preflight.ts once (Step 1) — it gathers all the read-only signals (docker presence, config existence, WSL path, existing docker files, host ~/.gitconfig, auto-memory seed, a live non-Docker owner of the state dir) as a single JSON blob, so don't fan those probes out into separate Bash calls. Reuse its result for the git-identity (Step 4) and auto-memory (Step 5) decisions rather than re-probing. Step 2's project-dependency scan stays normal file reads (Read tool) plus analysis. Everything that mutates state or drives the container (file backups, docker compose, tmux, mkdir/touch setup-mode, status polls) must run strictly sequentially in its documented order — never batch those.
Templates live in ${CLAUDE_SKILL_DIR}/../../state-templates/docker/.
channel-pair: bun ${CLAUDE_PLUGIN_ROOT}/scripts/channel-access.ts "<hermit_state_dir>" pair <channel> <code>channel-policy: bun ${CLAUDE_PLUGIN_ROOT}/scripts/channel-access.ts "<hermit_state_dir>" policy <channel> allowlistchannel-show: bun ${CLAUDE_PLUGIN_ROOT}/scripts/channel-access.ts "<hermit_state_dir>" show <channel>channel-ensure-defaults: bun ${CLAUDE_PLUGIN_ROOT}/scripts/channel-access.ts "<hermit_state_dir>" ensure-defaults <channel>channel-bot-id: bun ${CLAUDE_PLUGIN_ROOT}/scripts/channel-bot-id.ts "<hermit_state_dir>" <channel> --writechannel-config-merge: bun ${CLAUDE_PLUGIN_ROOT}/scripts/hatch-config.ts "$(pwd)" --reinitThis skill is host-only — it generates Docker scaffolding on the host filesystem and drives docker compose up.
Run: [ -f /.dockerenv ] || [ -f /run/.containerenv ] && echo container || echo host
If the output is container, stop immediately — do not proceed to step 1. Print:
For an existing install, run
hermitd setup docker-setupfrom a host terminal at the project root. For a first-time install, open Claude Code on the host and run/hermitd:docker-setup. To pair a channel later, runhermitd setup channel-setup. To check the running container from inside it, run/hermitd:hermit-doctor.
Run the pre-flight probe once and parse its JSON: bun ${CLAUDE_PLUGIN_ROOT}/scripts/docker-preflight.ts "$(pwd)" — pass "$(pwd)" so the auto-memory path key is keyed off the shell's logical path, matching Claude Code even through a symlinked project root. It returns { docker_version, config_exists, is_wsl, existing: {dockerfile, entrypoint, compose}, gitconfig_exists, memory: {path_key, seed_exists}, live_owner }. Hold the result — Steps 4 and 5 reuse gitconfig_exists and memory instead of re-probing. Apply these gates:
docker_version is null: "Docker isn't installed — grab it from https://docs.docker.com/get-docker/ and come back!"config_exists is false: "Run /hermitd:hatch first, then come back."is_wsl is true: abort — "Clone inside WSL2 (e.g. /home/you/project) and run from there."live_owner is non-null ({ mode, age_secs }): abort: "A live <mode> hermit owns this project's state (activity <age_secs>s ago). Stop it first with hermitd stop (run it from a separate terminal if this session is that hermit), then re-run this skill." Drop the parenthetical when age_secs is null. The container's entrypoint refuses to boot beside it and goes inert, so this must abort before anything is backed up, written, or built. Do not offer to stop it for the operator, and do not suggest HERMIT_FORCE_BOOT=1: that override is for split-state recovery, not for a hermit that is simply still running. If the operator reports that hermitd-stop itself refused ("No tmux session … but state activity Ns ago"), the recorded owner is a stale record, not a live hermit — the liveness it sees is this session's own; have them follow the pgrep -af "claude --channels" line hermitd-stop prints, kill any orphan it names, and re-run hermitd-stop once nothing is left.existing.dockerfile / existing.entrypoint / existing.compose is true:
AskUserQuestion (header: "Docker files"): No — keep existing (abort; remove or rename manually, then re-run) / Yes — back up (move to docker-backup/ and regenerate).docker-backup/, continue.env — only append missing vars (step 5).Determine whether to run in Quick or Advanced mode.
Argument-driven: if invoked with the positional argument quick (e.g. /hermitd:docker-setup quick), skip the question below and run Quick directly. The operator can always re-invoke /hermitd:docker-setup without the arg later to drop into Advanced.
Otherwise, ask:
questions: [
{
header: "Setup mode",
question: "How would you like to configure Docker?",
options: [
{ label: "Quick", description: "OAuth + bridge networking, auto-mirror trusted plugins, build immediately" },
{ label: "Advanced", description: "Full wizard — pick auth, networking, every plugin, every package" }
]
}
]
Quick-mode contract — security non-negotiables. Quick mode never bulk-accepts third-party plugins, never weakens the safelist, never skips the public-repo pre-flight, and never bypasses the write-time assertion. Those gates exist because that's the line where defaults stop being safe. Quick only auto-defaults the choices that have one obviously-correct answer (auth, networking, build-now) and the SAFE plugin batch (claude-plugins-official + gtapps/* — already vetted by the safelist). Minting the long-lived setup token is never one of those auto-defaulted choices — in both Quick and Advanced it's a post-login question at Step 8.
Branch on the choice for the rest of the skill:
Browser choice: read browser.enabled from config now. Default to on unless it is already exactly false. Every setup run records this choice; upgrades also add or remove the managed block through the normal Dockerfile merge.
Quick: silently keep that browser choice and apply auth = oauth-token, docker.network_mode = "bridge". Skip the AskUserQuestion below. Continue at the project-dependencies scan below.
Advanced: ask auth method, networking, and browser choice in a single AskUserQuestion call:
questions: [
{
header: "Auth",
question: "Authentication method for the container?",
options: [
{ label: "Subscription", description: "Log in inside the container — the long-lived setup token is offered right after login (recommended)" },
{ label: "API Key", description: "Set ANTHROPIC_API_KEY in .env — bills per token instead of using a subscription" }
],
},
{
header: "Networking",
question: "Container network mode?",
options: [
{ label: "Bridge", description: "Isolated from host-local services (default)" },
{ label: "Host", description: "Direct access to localhost services — use if hermit needs host-bound services" }
]
},
{
header: "Browser",
question: "Include the hermit’s own browser?",
options: [
{ label: "On (Recommended)", description: "Public sites work without your laptop; full parallel use needs 4 GiB" },
{ label: "Off", description: "Leave browser automation to your existing setup" }
]
}
]
Record the browser answer as browser.enabled (true or false). Record auth choice as auth = oauth-token for Subscription, auth = api-key for API Key. Record networking choice as docker.network_mode ("bridge" or "host").
Project dependencies scan: Scan for signals that suggest extra system packages:
package.json native addons (sqlite3, sharp, canvas, bcrypt, etc.)requirements.txt, pyproject.toml, Pipfile)Makefile, CMakeLists.txt), version managers (.tool-versions).claude/settings.json and .claude/settings.local.json permissions.allow entries — allowed Bash commands reveal tools the project expects (e.g. Bash(docker *) → docker CLI, Bash(python *) → python3, Bash(psql *) → postgresql-client). Check for commands that need system packages not in the base image.Present findings conversationally with reasoning. If nothing found, say so. Collect as provisional candidates — confirmation is deferred to step 7b.packages after plugin selection, where plugin-declared deps are unioned in.
Read .hermit/config.json and extract:
tmux_session_name — resolve {project_name} with actual directory nameagent_namepwdCollect choices for config; the renderer reads only <PROJECT_ROOT>/.hermit/config.json, never stdin or installed Docker files. Do not write templates directly.
docker.packages: finalized apt package union from Step 7b.packages.docker.network_mode: "bridge" or "host" from Step 2.docker.recommended_plugins: confirmed entries from Step 7b.docker.git_identity_mount: Step 1 preflight gitconfig_exists. If false, note: "No ~/.gitconfig found; commits inside the container have no host author identity. Create one and enable docker.git_identity_mount, or configure Git inside the container."browser.enabled: Step 2 browser choice. Preserve browser.port on reruns; the renderer puts it on netguard when LAN containment is enabled, otherwise in the base stack.docker.fleet_mesh: preserve the config value, absent means false. When true, the external volumes and pid namespace holder in docs/always-on.md must exist before startup.Auth does not affect rendering. API keys belong in .env (env_file delivers them); subscription credentials live on the named volume. Never put the setup token in .env.
The Step 1 preflight already resolved memory.path_key (Claude Code's own scheme: every non-alphanumeric character becomes -, dots included, leading dash kept — e.g. -home-user-myproject) and memory.seed_exists (whether MEMORY.md exists under <config-dir>/projects/<path_key>/memory/, where <config-dir> is CLAUDE_CONFIG_DIR when set and ~/.claude otherwise). Reuse those:
memory.seed_exists is true: Copy MEMORY.md from that same <config-dir>/projects/<memory.path_key>/memory/ to .hermit/MEMORY-SEED.md. Tell the operator: "Found existing Claude Code memory for this project — seeding it into the container so your hermit starts with full context." Then ensure .hermit/MEMORY-SEED.md is in .gitignore (append if missing).Only the top-level project memory is seeded — not agent-scoped memories at <path-key>/<agent-name>/.
.env doesn't exist, create it. If it does, read it first.ANTHROPIC_API_KEY= is present in .env. If missing, append:
# --- hermitd ---
ANTHROPIC_API_KEY=your-api-key-here
If already present, leave it — note for step 8.
If subscription (oauth): No auth var needed in .env. Check whether ANTHROPIC_API_KEY is set (non-empty) in .env. If so, warn and ask with AskUserQuestion (header: "API key"): Yes — comment out (prefix with # to disable it) / No — keep (container will run in API key mode).
Also remove any CLAUDE_CODE_OAUTH_TOKEN line you find in .env — this is not a preference. A token stored there is baked in at container creation, so renewing it would require recreating the container from the host, which is exactly the manual access token mode exists to remove. The hermit stores it on the config volume and exports it at process start instead..env is listed in both .gitignore and .dockerignore (create the files if needed, append if missing)./sandbox. bubblewrap/socat are installed in the image so it's available if wanted. The container boundary (cap_drop:ALL, no-new-privileges, network policy) is the isolation layer here, per Anthropic recommendation for unattended runs (https://code.claude.com/docs/en/sandbox-environments), so the nested bwrap sandbox is optional rather than required. Note: on Ubuntu 24.04+/26.04 hosts (and any host with kernel.apparmor_restrict_unprivileged_userns=1) the AppArmor docker-default policy blocks bwrap from creating user-namespaces in-container, so an in-container sandbox may not start there and could kill heartbeat and /watch monitors if forced on regardless.Skip if no enabled channels in config.json. Read .hermit/config.json from the project root (same root verified in Step 1 — do not rely on cwd). A channel counts as present when config.channels[<name>].enabled !== false (missing enabled is treated as enabled). Empty channels: {} skips.
For each enabled channel, follow the channel credential stage on the host, passing --docker to the Private file command, and keep its outcome for Step 8. Skip iMessage after noting it is macOS-only.
Record channels.<channel>.state_dir for Step 7b.6 as .claude.local/channels/<channel>. The directory uses the channel key. The renderer and launch environment supply the state folder to the channel.
Mirror host-installed plugins into the container so the container starts with the same plugin set the operator already curated — including any domain hermit (e.g. hermitd-homeassistant) that may have triggered this setup flow.
SECURITY-CRITICAL STEP. Every plugin written here is auto-installed on container boot with whatever
permission_modethe operator chose — forbypassPermissionshermits, this means full unrestricted execution.
Run bun ${CLAUDE_PLUGIN_ROOT}/scripts/resolve-siblings.ts "$(pwd)" --dedupe to enumerate plugins. It emits a JSON array of the project-or-local + enabled entries (each carrying plugin, id, marketplace_name, scope, installPath), with user-scope, managed, disabled, and cross-project entries already dropped, and deduped by (plugin, marketplace_name) keeping the local entry over project (local is the override scope in Claude Code's overlay model). Different marketplaces remain distinct entries.
If the operator wants a user-scope plugin in the container, they install it at project scope on the host first and re-run this skill.
Filter out additionally:
hermitd@hermitd — the entrypoint already handles it unconditionally.config.channels. Keep third-party channel plugins in scope for the recommended-plugin install path.Run claude plugin marketplace list --json and build a marketplace_name → repo map from each entry's name and repo fields. Split each plugin id as <plugin>@<marketplace_name> and look up marketplace_name in the map to get the org/repo. Only the org/repo is recorded on each docker.recommended_plugins entry — the entrypoint resolves the canonical marketplace name at boot via the same marketplace list --json lookup, so storing it twice would just duplicate the source of truth.
source != "github" or no repo field (e.g. a locally-added marketplace), ask: "What's the GitHub source for the <marketplace_name> marketplace? (e.g. org/repo)" before presenting the plugin list.Validation gate — apply to every org/repo before it reaches the plugin list or config.json:
^[A-Za-z0-9][\w.-]*/[A-Za-z0-9][\w.-]*$repo values read from the marketplace JSON AND values typed by the operator.config.json and being passed to claude plugin install --marketplace on boot.Partition the filtered list using the safelist:
def is_safelisted(marketplace):
# marketplace is always org/repo after the step 7b.3 lookup — no literal-name shortcut.
return (
marketplace == "anthropics/claude-plugins-official"
or marketplace.startswith("gtapps/")
)
The marketplace value passed to is_safelisted is always the org/repo resolved in step 7b.3 — never the marketplace name and never the slug from the <plugin>@<name> id.
Split into two groups:
is_safelisted(marketplace) is True. Examples: anthropics/claude-plugins-official, gtapps/hermitd-homeassistant.obra/superpowers-marketplace, any non-gtapps org/repo, any locally-added marketplace without a GitHub source.The SAFE group can be accepted as a batch. The THIRD-PARTY group must be confirmed one-by-one — the host list is the candidate set, not the trusted set.
Present the choices in plain text first, so the operator sees the full list before any prompt (AskUserQuestion caps options at 4, so we cannot enumerate plugins in a single question):
Host-installed plugins detected (project + local scope only):
Safelisted (trusted sources):
- context7 @ anthropics/claude-plugins-official (project)
- hermitd-homeassistant @ gtapps/hermitd-homeassistant (project)
Third-party (require individual opt-in):
- superpowers @ obra/superpowers-marketplace (local)
If the SAFE group is non-empty:
Quick: silently treat as if "Mirror all" was chosen — add every SAFE plugin to docker.recommended_plugins with enabled: true. No prompt.
Advanced: ask once with AskUserQuestion (header: "Plugins"):
"Mirror all" (Recommended) / "Pick each" / "Skip all".Mirror all: add every SAFE plugin to docker.recommended_plugins with enabled: true.Pick each: loop through the SAFE plugins; for each, ask a 2-option yes/no ("Include" / "Skip"). Only include the ones the operator confirms.Skip all: add nothing from this group.For the THIRD-PARTY group, loop through each plugin individually. For each, ask a 2-option AskUserQuestion (header: "Third-party") — "Include" / "Skip". Include only when the operator explicitly confirms.
8b. Public-repo pre-flight (for every non-claude-plugins-official entry that the operator has tentatively confirmed in steps 7 or 8). From the host, run an unauthenticated check against https://github.com/<org>/<repo> (e.g. curl -fsI -o /dev/null -w '%{http_code}' https://github.com/<org>/<repo>). If the response is not 200 (i.e. 404, redirect-to-login, or network error), the repo is private or unreachable. Tell the operator:
<org>/<repo>appears private or unreachable. The container cannot clone private repos automatically.
Then ask with AskUserQuestion (header: "Private repo") — "Include anyway" / "Skip". On Skip: drop the entry. On Include anyway: keep it. Do not suggest remediations.
After both groups are processed: any plugin not explicitly confirmed must not be written to docker.recommended_plugins. Write only confirmed entries with enabled: true.
Write-time assertion — run this before handing entries to step 7c. For each confirmed entry:
marketplace matches ^[A-Za-z0-9][\w.-]*/[A-Za-z0-9][\w.-]*$ (has a slash; is org/repo). Uniform across official and third-party entries — official stores anthropics/claude-plugins-official.org/repo from the claude plugin marketplace list --json output (look up the marketplace name from the plugin's id to get the repo). If the lookup cannot produce a valid org/repo, prompt the operator (same prompt as step 3). Re-run the assertion. Only proceed to step 7c once every entry passes.If the filtered list is empty (no extras installed on the host), skip silently — no prompt, no entries written.
Record the confirmed selection as docker.recommended_plugins. Each entry has:
{"plugin": "<plugin-name>", "marketplace": "<org/repo>", "scope": "<scope>", "enabled": true}
The entrypoint installs every enabled entry on first boot with claude plugin install <plugin> --marketplace <org/repo>, which adds the marketplace if missing, so the entry needs no marketplace name. See Recommended Plugins for the full policy.
This step rebuilds docker.recommended_plugins from the confirmed host plugin list. Keep existing entries for enabled channels with a marketplace by matching the resolved plugin name and marketplace repository, preserving their scope and enabled flag and taking precedence over duplicate selections. The entrypoint warns and skips any entry whose marketplace is not an org/repo until this skill is re-run.
On container-side claude plugin install failure (either in entrypoint logs or when re-running the command manually after boot): if the error mentions SSH auth, HTTPS credentials, gh not found, or .gitconfig read-only, stop immediately — do not attempt workarounds inside the container. The container has no SSH client, no gh CLI, and .gitconfig is bind-mounted read-only by design. Iterating on GIT_CONFIG_NOSYSTEM, git config --global url...insteadOf, or similar is guaranteed to fail and wastes the operator's time. Surface the error to the operator verbatim and move on — no retry unless the operator changes something host-side (makes the repo public, mirrors it, etc.) and asks to retry.
After plugin selection is finalized, union the two sources of apt package candidates before writing to config:
Project candidates (from step 2.3 scan) — project-owned signals (native addons, Python stack, build tools, etc.). Live-scanned from project files each run.
Plugin declarations — for each confirmed entry in docker.recommended_plugins, locate the plugin's installed root via claude plugin list --json (inspect path fields). In the plugin root:
## Docker apt dependencies section in skills/hatch/SKILL.md.DOCKER.md file at the plugin root with the same section.## heading). Ignore lines starting with #.^[a-z0-9][a-z0-9+\-.]+$. Entries that fail are dropped with a clear warning to the operator — never passed to Dockerfile rendering.<package-name> — declared by <plugin-name>.Unified confirmation prompt — present the combined deduped list with origin labels:
Proposed image packages:
libsqlite3-dev — project signal (package.json sqlite3)
<package-a> — declared by <plugin-name>
<package-b> — declared by <plugin-name>
Operator approves, removes, or adds entries. Write the approved set as the final docker.packages (persisted before Step 7b.6 renders).
Quick mode auto-accept: if every entry in the combined list (a) passed the validator regex and (b) came from a safelisted source — meaning project-signal entries OR entries declared by plugins where is_safelisted(marketplace) is true (claude-plugins-official + gtapps/*) — skip the prompt and accept the list silently. Print a one-line summary so the operator sees what landed: Quick auto-accepted N image packages (all from safelisted sources). Configure later via /hermit-settings docker. If ANY entry came from a third-party plugin (operator-confirmed in Step 7b), fall through to the prompt — defaults stop applying once a third-party source contributed apt deps.
Pre-write gate for docker.recommended_plugins: Re-run Step 7b.10's assertion on every entry. If any fails, return to Step 7b.3 without writing.
Before rendering, persist all resolved choices using bun ${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts <PROJECT_ROOT>/.hermit/config.json set <path> <JSON-value>:
docker.packages (Step 7b.packages)docker.network_mode (Step 2)docker.recommended_plugins (Step 7b, post-gate)docker.git_identity_mount (Step 1 preflight gitconfig_exists)browser.enabled (Step 2)channels.<channel>.state_dir (Step 7, when applicable)Complete native permission requests for protected paths. Preserve all other config keys. Each successful write precedes rendering, so an interrupted setup retains the choices.
Run the config-driven CLI with the absolute project root and no stdin:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/render-docker-templates.ts <PROJECT_ROOT>
Parse the JSON verdict before proceeding:
{"status":"skipped","reason":"not_converted"}: stop setup. Tell the operator to run /hermitd:docker-customize "Convert", then retry setup. Never continue deployment against these unconverted files.{"status":"skipped","reason":"newer_renderer"}: stop and ask the operator to update the host plugin before retrying.error or nonzero exit: stop with the error; do not build.Dockerfile.hermit and docker-compose.hermit.yml. It copies the entrypoint only if the project has none. If docker.git_identity_mount is false, include Step 4's note.When the result contains manifest_seed, pipe only that field's value to manifest-seed.ts, preserving its absolute paths and plugin version:
echo '<the manifest_seed object only: {"plugin_version":...,"entries":[...]}>' | bun ${CLAUDE_PLUGIN_ROOT}/scripts/manifest-seed.ts <PROJECT_ROOT>/.hermit
This seeds only docker/docker-entrypoint.hermit.sh, hashing the newly copied on-disk entrypoint. Existing entrypoints are untouched and emit no seed. Do not hand-compute hashes or seed generated Docker templates. manifest-seed.ts preserves unrelated baselines and refuses a corrupt manifest.
Read back the settings persisted before Step 7b.6. They are the renderer's source of truth; do not write a second set of defaults after rendering. Confirm the protected writes succeeded before deployment.
For every direct Compose command below, build the array immediately before use in the same Bash call, including after an overlay is created:
COMPOSE_FILES=(-f docker-compose.hermit.yml)
[ ! -f docker-compose.security.yml ] || COMPOSE_FILES+=(-f docker-compose.security.yml)
[ ! -f docker-compose.override.yml ] || COMPOSE_FILES+=(-f docker-compose.override.yml)
The order is base, security overlay, operator override. Use docker compose "${COMPOSE_FILES[@]}" for all operations.
Print generated files summary:
Dockerfile.hermit — container image definition
docker-entrypoint.hermit.sh — startup script
docker-compose.hermit.yml — orchestration config
.env — auth credentials
Auth token (apikey only): If operator chose apikey and .env already has a real key (not placeholder), skip. Otherwise ask with AskUserQuestion (header: "API key"): Skip (add ANTHROPIC_API_KEY to .env manually before starting) / Enter now (paste key via Other). If "Enter now" and a key was typed via Other: update .env.
Build and start:
Install the host operator command from the project root before either deployment path:
bun "${CLAUDE_PLUGIN_ROOT}/scripts/hermitd-cli.ts" install
Quick: silently treat as Yes — build now and proceed directly to the build sub-section below. No prompt.
Advanced: ask with AskUserQuestion (header: "Deploy"): Yes — build now (run hermitd-docker up immediately) / No — manual (print commands to run later).
If "No — manual": Print the full manual deployment guide below, then skip directly to Step 9 (do not attempt Login, Workspace trust, or Channel pairing — the container is not running yet):
Manual deployment guide
──────────────────────
1. Start the container:
hermitd start
2. (Subscription auth only) From a second terminal, complete login:
hermitd docker login
Then, optionally (recommended), mint the long-lived token so future renewals need only a browser tap and no server access — skip it and you'll re-run `hermitd-docker login` from a terminal when the `/login` credentials expire:
hermitd docker setup-token
3. Accept first-run prompts (press Ctrl+B D to detach when done):
hermitd attach
Screen 1 — Workspace trust: press Enter to accept.
Screen 2 — Permission mode acknowledgement (appears for bypassPermissions AND auto; skip for acceptEdits/default/dontAsk):
- bypassPermissions: arrow keys → "Yes, I accept" → Enter.
- auto: "Enable auto mode?" → press 1 then Enter (persists in the named volume).
4. (Channels only) Pair each bot from a host terminal:
hermitd setup channel-setup
5. Verify everything is healthy:
hermitd status
For guided help on this install, run hermitd setup docker-setup.
If "Yes — build now":
docker compose up creates it owned by root, making it unwritable by the claude user inside the container. For each enabled channel run mkdir -p .claude.local/channels/<channel> using the channel key. Then run mkdir -p .hermit/state && touch .hermit/state/.setup-mode to put the container in setup mode (suppresses the bootstrap prompt while setup runs), and rm -f .hermit/state/.boot-conflict, because the entrypoint only clears that marker at its own §4b guard, minutes into the boot, so a marker left by an earlier inert container would otherwise read as this boot's verdict. Export the browser and transcription build arguments from config with export HERMIT_BROWSER=$(bun -e "const c = JSON.parse(require('fs').readFileSync('.hermit/config.json', 'utf8')); console.log(c.browser?.enabled === false ? '0' : '1')") and export HERMIT_TRANSCRIPTION=$(bun -e "const c = JSON.parse(require('fs').readFileSync('.hermit/config.json', 'utf8')); console.log(c.transcription?.enabled === false ? '0' : '1')"). Then run docker compose "${COMPOSE_FILES[@]}" up -d --build to build and start. Help fix errors (daemon not running, network, disk). Step 9 supplies the attach and detach instructions.docker compose "${COMPOSE_FILES[@]}" ps --status running --format '{{.Service}}' every 2s for up to 10s, checking .hermit/state/.boot-conflict on each tick. If the marker exists, the container is up but inert: the entrypoint found a live non-Docker instance owning this project's state and is holding PID 1 without starting claude, so ps --status running reports it healthy and every later step (login, trust, pairing) would run against a container with no tmux session. Show the marker's contents, then stop with: "Container is up but inert. Stop the other instance (hermitd stop), then hermitd restart." (Step 1's live_owner gate catches this before the build; this poll covers a host hermit restarted mid-wizard.) An absent marker at this point is not an all-clear: the entrypoint writes it at §4b, after the credential wait and the first-run plugin install, so on a first boot it cannot exist yet — the first-run acceptance poll below re-checks it once the container has had time to get there. If the service appears and no marker exists — continue to the next sub-section. If it never appears after 10s, run docker compose "${COMPOSE_FILES[@]}" logs --tail=30 hermit and show the output. Suggest a targeted fix based on the log:
docker info errors → start Docker Desktop or sudo systemctl start docker, then re-run this skill.env var → docker compose "${COMPOSE_FILES[@]}" config 2>&1 | grep -i error names itss -tlnp | grep <port> finds what's using the published port
Do not continue to Login / Workspace trust / Channel pairing while the container is down or inert — stop here and ask the operator to fix and re-run the skill.After the first successful start, run hermitd approve from the project root to record the initial Docker inputs. If it reports pending changes on an existing install, ask the operator to run hermitd approve in their terminal and wait for confirmation before continuing.
Login (subscription auth only): If operator chose subscription auth, proceed only once the container is confirmed running. Guide them through login:
hermitd docker login
This opens a claude REPL inside the container. Type /login, follow the URL in a browser, then paste the code back when prompted. Type /exit when done — the hermit starts automatically.AskUserQuestion (header: "Login") — "Done — login succeeded" / "Failed — couldn't complete login". Do not poll logs in a loop. Do not rebuild or restart the container. hermitd-docker login already verifies .credentials.json and exits non-zero if absent, so a "Done" answer means creds are present."Failed": run docker compose "${COMPOSE_FILES[@]}" logs --tail=30 hermit and show output. Suggest the targeted fix:
hermitd-docker login (codes expire in ~10 min)docker compose "${COMPOSE_FILES[@]}" exec -T hermit ls /home/claude/.claude/.credentials.json (should exist after login); missing = named volume not mounted — check docker-compose.hermit.yml volume entry
Then stop. The operator runs hermitd setup docker-setup after resolving the issue.Post-login decision — which credential this hermit runs on: ask immediately after the login above succeeds. The attended login is still required first — the first-launch wizard demands an interactive login and will not accept the env token (confirmed live), and initial setup is attended anyway.
Both options renew from chat with no server access; they differ in cadence and in what the credential can do. Present them neutrally, with no recommendation — background on the two credential types is at https://code.claude.com/docs/en/authentication.
Ask with AskUserQuestion (header: "Auth method") — Sign in with claude.ai (the credential you just created; renewed about every 30 days from chat, and Remote Control works on it, so you can reach this hermit from claude.ai/code or your phone) / Long-lived token (a one-year token stored only on the container's config volume, never printed or written to .env; renewed yearly from chat, and Remote Control does not work on this credential today).
Sign in with claude.ai:
bun "${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts" .hermit/config.json set auth_mode login
hermitd docker setup-token. Continue to first-run acceptance.Long-lived token:
hermitd docker setup-token
It prints a sign-in link, takes the code back, writes the token to the container's config volume, and restarts the hermit. The token is never printed and never stored in .env.AskUserQuestion (header: "Token") — "Done" / "Failed". On "Failed", the hermit still works on the /login credentials from the previous step; tell the operator that plainly and that they can retry hermitd-docker setup-token any time. Do not block setup on it.hermitd docker login. Continue to first-run acceptance.First-run acceptance (workspace trust + bypass mode): Before asking the operator to attach, verify the tmux session exists inside the container (the entrypoint may still be installing plugins):
docker compose "${COMPOSE_FILES[@]}" exec -T hermit tmux has-session -t <TMUX_SESSION_NAME>
If the session is not ready, retry every 5s until one of two outcomes lands: the tmux session appears (continue), or .hermit/state/.boot-conflict appears (stop). This is where an inert container actually surfaces, since the entrypoint reaches its §4b guard only after the credential wait and the first-run plugin install, well past step 8.2's poll. On the marker, show its contents and stop with the same message step 8.2 uses ("Container is up but inert. Stop the other instance (hermitd stop), then hermitd restart."); do not continue to workspace trust or channel pairing. A first run installs plugins over the network, so a slow boot here is normal: give up only after 10 minutes with neither outcome, then show the last 30 lines of entrypoint logs (docker compose "${COMPOSE_FILES[@]}" logs --tail=30 hermit) and stop.
Note: a running tmux session does not mean claude has finished booting — it may still be sitting on an acceptance screen waiting for input.
Once the session exists, tell the operator:
"Attach now and accept two prompts in order — claude will look frozen until you do, and later steps will misdiagnose it as a crash if you skip this:"
hermitd attachScreen 1 — Workspace trust (always): You'll see "Accessing workspace … Quick safety check: Is this a project you created or one you trust?" — press Enter to accept.
Screen 2 — Permission mode acknowledgement (only if
permission_modeisbypassPermissionsORauto):
- If
bypassPermissions: you'll see the--dangerously-skip-permissionsacknowledgement. Use the arrow keys to select "Yes, I accept", then press Enter.- If
auto: you'll see "Enable auto mode?" with three options. Press 1 then Enter ("Yes, and make it my default mode") so the acknowledgement persists in the named volume and won't re-prompt on future restarts.After accepting, you'll see a blank claude prompt — that's expected during setup. Leave the agent at that prompt while setup continues on the host.
Then press Ctrl+B, D to detach.
Read config.permission_mode from .hermit/config.json. If it is NOT bypassPermissions AND NOT auto, omit the "Screen 2" paragraph entirely. Otherwise emit it, and inside the paragraph keep only the branch matching the resolved mode (drop the other bullet).
Wait for the operator to confirm they have detached before continuing.
Channel pairing (skip if no enabled channels):
For each enabled Docker-compatible channel with a configured credential from Step 7, follow the channel access stage. For a skipped credential, tell the operator to run hermitd setup channel-setup from the host when ready, then move to the next channel.
If the operator reports that the bot sent no code, run docker compose "${COMPOSE_FILES[@]}" exec -T hermit tmux capture-pane -t <session> -p, show the output, and continue setup with the next channel.
Later changes: /hermitd:hermit-settings channels (groups, recall, recording, operators).
If "skip": tell them to DM the bot later and run the commands manually.
Skip this step entirely if the operator chose "No — manual" at step 8. The container isn't running, so there's nothing to restart.
Tell the operator (set expectations — this step takes ~30-60s and otherwise looks like a hang):
"Finalizing setup with a clean restart so the first real hermit session starts with everything configured and plugins fully loaded."
Then run, in sequence:
hermitd stop; sends the configured shutdown skill, if any, and polls for a fresh execution boundary up to 60s before removing the container. If it prints "Timed out waiting for graceful close; forcing stop", flag it in the final summary (session that witnessed setup didn't close cleanly; not blocking but worth noting).
hermitd start recreates the container. Docker's named volume preserves credentials, plugins, workspace trust. Bind-mounts preserve .claude.local/channels/<plugin>/access.json and .hermit/.
Re-verify the container stayed running (same poll as step 8.2). If it failed to come back up, run docker compose "${COMPOSE_FILES[@]}" logs --tail=30 hermit, show the output, and apply the same targeted hints as step 8.2 (daemon down, build failure, port conflict). Stop — don't proceed to step 9.
Why this step exists: mid-setup, claude REPL starts before plugins are fully enabled and channel pairing completes. The session it was running is a "bootstrap session" full of setup chatter. A clean restart gives the operator a first real session with correctly-loaded plugins, fresh tmux state, and no config-time noise.
Why down + up rather than hermitd-docker restart: a recreated container clears ephemeral container-layer state and re-runs the entrypoint from a clean slate.
If browser.enabled is true, finish with one public-page check inside the container: docker compose "${COMPOSE_FILES[@]}" exec -T -e HERMIT_PLUGIN_ROOT=/home/claude/.claude/plugins/marketplaces/hermitd/plugins/hermitd hermit agent-browser --session setup-check open https://example.com, then close that session with agent-browser --session setup-check close through the same compose exec. The -e is required because exec does not inherit the entrypoint's environment. Report whether the page loaded; surface a failure rather than switching browsers.
Runs whether or not steps 8/8b were skipped. This step sits after the deployment steps on purpose: it seeds Bash(docker *) / Bash(ssh *) / Bash(kubectl *) into permissions.ask, and ask rules hot-reload — seeding earlier would make every docker compose call in steps 8/8b raise its own approval prompt mid-wizard.
Resolve hatch_target using the same fallback chain as hermit-evolve SKILL.md §2a (.hermit/state/hatch-options.json "target" field → claude plugin list --json scope detection). Do not silently default to committed when the state file is absent — that can leak operator-personal hardening into the repo. Map: hatch_target == "local" → .claude/settings.local.json; hatch_target == "committed" → .claude/settings.json.
Run: bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> deny standard
(Reads canonical deny + ask from state-templates/deny-patterns.json. Purely additive and idempotent; previously offered ask entries deleted by the operator stay deleted through state/ask-offered.json. It never removes an existing entry, so a hermit hatched Hardened keeps its hard blocks and a hermit already seeded at hatch gets nothing new. Risky ops such as docker/ssh/kubectl land as permissions.ask, so future host sessions prompt on them rather than hard-block.)
Tell the operator: "Added safety deny rules for always-on operation — protects against destructive commands and casual credential dumps. Risky ops (docker, ssh, kubectl, git push, settings edits) prompt for approval. Written to {.claude/settings.local.json | .claude/settings.json}."
Enable the Docker watchdog. Docker hermits run the watchdog from the entrypoint loop, so turn it on now:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts .hermit/config.json set watchdog.enabled true
This only flips .watchdog.enabled — the other watchdog tuning keys (stale_factor, wedge_floor, escalate_after, operator_grace) are preserved, the whole config is validated, and the change lands in the settings ledger. Never write config.json with Edit/Write or a shell redirect; direct Edit calls raise an approval prompt (seeded ask rule) and skip validation and the ledger.
Run hermitd status and show output. The table reports transport, execution and its age, open and waiting task counts, and the task in progress, including one a worker or helper runs. Transport up means the hermit service is running; a sidecar alone reports down. Execution can be unknown until the first execution stamp appears. Do not add sleep before the status check.
If healthy:
You're all set! Your hermit is live and running autonomously.
hermitd start — start container
hermitd stop — graceful stop (--force to skip)
hermitd attach — connect to tmux session
hermitd docker bash — shell into container
hermitd docker login — subscription login (first boot)
hermitd docker setup-token — (optional) mint/renew the long-lived login token
hermitd docker logs -f — follow logs
hermitd restart — restart container
hermitd update — update host core, update plugins and evolve, build, then restart once
hermitd status — quick check
If something looks wrong, help diagnose — suggest concrete next steps.
Why .hermit suffix? The project may already have its own Dockerfile / docker-compose.yml. Hermit-namespaced files avoid conflicts.
Customizing the boot: docker-entrypoint.hermit-local.sh. docker-entrypoint.hermit.sh is hermit-managed — hermit-evolve replaces it whenever upstream changes, so edits there are lost on upgrade (parked as a .bak, and re-homed into the sidecar automatically when a baseline is available). The supported place is <project-root>/docker-entrypoint.hermit-local.sh, which upgrades never touch. It is sourced at two points, with HERMIT_ENTRY_PHASE naming which: pre-boot (channel dirs exist, env resolved, before plugins install — extra packages, env, mounts) and pre-launch (immediately before hermitd-start — side services, last-second overrides). It inherits set -euo pipefail, so a failing command aborts the boot exactly as an in-file edit would: guard anything optional with || true. It lives on the project bind mount, so edits apply on hermitd restart with no rebuild.
Channel state: *_STATE_DIR env vars and bind-mounts. Why MCP servers need OS env rather than settings.local.json, and why the channel state dir is bind-mounted rather than symlinked, are in Always-On — channel state. The one thing to carry while running this skill: pre-create each .claude.local/channels/<plugin>/ on the host before docker compose up, or Docker creates it root-owned and the claude user can't write to it.
Why a named volume for config? The container gets its own /home/claude/.claude instead of sharing the host's, so container state (onboarding, auto-memory, plugin cache) never leaks into host interactive sessions. It persists across restarts; first run is slower while it populates.
Want shared config instead? Replace the claude-config named volume through docker-compose.override.yml: - ${HOME}/.claude:${HOME}/.claude and set CLAUDE_CONFIG_DIR=${HOME}/.claude. Not recommended — changes in either direction leak.
Domain-plugin apt dependencies. Declare system packages your plugin needs in a ## Docker apt dependencies section in the plugin's hatch SKILL.md or a DOCKER.md at the plugin root. See step 7b.packages and Creating Your Own Hermit — Docker dependencies.
Why the three hardening stanzas (no-new-privileges, cap_drop, pids_limit)? Full per-stanza weighting is in Security — Container Hardening. The only operational consequence while running this skill: an operator extending the container with services on privileged ports (<1024), setuid helpers, or high-PID workloads has to relax the relevant stanza explicitly.
Want stronger isolation? /hermitd:docker-security is an opt-in wizard that adds LAN containment with DNS policy (firewall + DNS sidecar with port-53 redirect for actual enforcement), a read-only root filesystem with smoke test, resource bounds with kernel hygiene sysctls, and a boot-time plugin-install audit log. Each toggle is verified against the live container and is fully reversible. Note: the LAN containment toggle is hard-skipped when docker.network_mode: "host" is in use — bridge networking required. See Docker Security.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gtapps/hermitd --plugin hermitd41 skills in this plugin
/briefReturns a 5-line executive summary of recent work. Checks open records first, then recent task outcomes. Activates on messages like "brief", "what happened", "morning update", "overnight summary", "progress", "what are you working on", "how's it going"./browserDrives the agent's own browser, or the operator's Chrome for their accounts. Use before giving steps that send someone to a web console to create or change something on an account (an API key, a bot, an app registration), even when the person will do them by hand or no browser is available. Also use when WebSearch fails, or when WebFetch cannot read a page: it is refused (such as 402 or 403), stays rate-limited after a retry, times out, or returns an empty page, a JavaScript-only shell, or a block notice in place of the content asked for. Use it before answering from other sites or searches, above all when the person named or linked the page, even if the browser may be off. Also use when a page needs clicks, forms, scrolling or sign-in; or when a screenshot or exact rendered text is needed. Public read-only lookups start with WebSearch or WebFetch./capability-brainstormMonthly routine plus on-demand hermit-voice brainstorm — synthesizes memory, capabilities, recent artifacts, and codebase shape into at most 2 capability ideas, each gated by proposal-triage before becoming a proposal task. Runs on the capability-brainstorm routine and when the operator asks to brainstorm capabilities or ideate, e.g. "brainstorm capabilities", "any capability ideas?"./channel-accessManage chat access. Let someone talk in a chat, remove them, see who can talk here, open a chat to everyone, turn a chat off, or remove someone who is no longer an approver./channel-responderHandles inbound messages tagged <channel source=...> from Claude Code Channels, routing replies, task work, approvals, and operator controls with session context./channel-setupGuided channel activation for local/tmux users; adds a channel entry when none is configured, installs the plugin, configures the bot token in the project-local state dir, and walks through pairing. Run after hatch, or any time to add or re-enable a channel.Other plugins' skills for the same job