/hermitd:hatchfrom hermitd
Initializes the autonomous agent in a project by creating state directory, templates, OPERATOR.md, and config.json. Run once per project like git init.
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.
Set up the autonomous agent for this project. This creates the per-project state directory, configures the project for session-based work, and optionally activates hermits.
AskUserQuestion convention — applies to every question in this skill, both branches. Each question needs 2-4 options (Other is auto-provided for free text), and each option needs both a label and a description; a bare label is rejected as an invalid tool parameter. Where a step lists options as bare labels (the tables in Step 5a, the activation prompts), write a short description for each before sending the call.
Check whether .hermit/config.json exists in the current project. That file (written at Step 5) is the authoritative "already initialized" signal — not the bare presence of the .hermit/ directory. An empty state/ tree or a half-written tree left by an aborted prior run both count as not initialized.
.hermit/config.json exists: inform the operator that the agent is already initialized. Ask if they want to reinitialize (which resets templates but preserves sessions, proposals, config, and OPERATOR.md). Record the choice as is_reinit (true if operator opted to reinitialize).is_reinit = false, proceed with initialization.Before the setup-mode gate or any file writes, gather context silently. Run all commands in parallel where possible:
Silent hermit detection + core scope detection (split out so it's available before the mode gate without an operator prompt):
bun ${CLAUDE_PLUGIN_ROOT}/scripts/resolve-siblings.ts "$(pwd)" --role core-scope. It emits { "core_scope": "local"|"project"|"user"|null, "target": "committed"|"local" } — set core_install_scope from core_scope and hatch_target from target. (project → committed; local/user/null → local, the safer default the operator can override in Advanced.)bun ${CLAUDE_PLUGIN_ROOT}/scripts/resolve-siblings.ts "$(pwd)" --role siblings --core-root "${CLAUDE_PLUGIN_ROOT}". It emits a JSON array of the project-or-local + enabled hermit siblings (each carrying plugin, id, marketplace_name, installPath), already excluding user-scope, disabled, cross-project, and hermitd itself.detected_hermits. Step 3 reads activation metadata from each entry's installPath directly./hermit-settings.Detect git-init eligibility — run in parallel with scope detection. Set git_init_eligible = true if and only if all three hold:
is_reinit == false.git rev-parse --is-inside-work-tree 2>/dev/null is falsy (not already under version control).ls -A of the project root yields only names from this explicit allowed set: .hermit, .claude, .gitignore, .worktreeinclude, .bash_profile, .bashrc, .zshrc, .zprofile, .profile, .gitconfig, .ripgreprc. The dotfile entries (.bash_profile through .ripgreprc) come from the sandbox-dotfile block at the bottom of state-templates/GITIGNORE-APPEND.txt — keep those in sync if that block changes.Print one summary line so the operator sees what was detected:
Initializing hermit in
<project-name>. Detected: scope=<project|local|user>, target=<committed|local>, hermit candidates= (<comma-separated names or "none">), git=<fresh|existing|n/a>.
If is_reinit == true: skip this gate entirely and run Advanced — Quick is for first-time install. Re-init operators have existing customizations to preserve, and Advanced's merge logic is the right tool. Quick re-running on an existing config would risk destructive overwrites of operator-tuned fields.
Otherwise, ask:
questions: [
{
header: "Setup mode",
question: "How would you like to configure your agent?",
options: [
{ label: "Quick", description: "Sensible defaults, four core questions including this choice, ~3 min. Tweak via /hermit-settings later." },
{ label: "Advanced", description: "Full wizard — every option exposed (~15 questions, ~15 min)." }
]
}
]
Branch on choice:
Both branches share Step 2 and Steps 5-9. Quick replaces Steps 3-4 with the Quick Branch turns below.
Run the scaffold script once (it builds the whole tree and seeds every static file; the layout is state-templates/ plus hatch-scaffold.ts's own enumeration):
bun ${CLAUDE_PLUGIN_ROOT}/scripts/hatch-scaffold.ts <PROJECT_ROOT> --reinit=<is_reinit>
Pass --reinit=true only when Step 1 recorded is_reinit = true; otherwise --reinit=false. The script:
state/reflection-state.json (with a live ISO counters.since), the empty append-only ledgers state/routine-metrics.jsonl, state/proposal-metrics.jsonl, state/observations.jsonl, state/update-history.jsonl, state/channel-replies.jsonl, plus state/alert-state.json, the templates/ files, HEARTBEAT.md, knowledge-schema.md, OPERATOR.md, and copies + chmod +x every file under state-templates/bin/ (enumerated, not hardcoded).OPERATOR.md, HEARTBEAT.md, knowledge-schema.md, and every state/* file are created only if absent (in both modes), so re-init never clobbers accumulated learning/proposal state or operator edits. --reinit=true only refreshes the hermit-owned pristine files (templates/*, bin/*).Parse the JSON it prints — { created, overwritten, preserved, operator_existed } — and remember operator_existed for Step 5a (the OPERATOR.md guard).
The reasoned artifacts are NOT scaffolded here: config.json (Step 5), the OPERATOR.md content draft (Step 5a) keep their own steps.
state/template-manifest.json is seeded at the end of Step 8, once the bun */scripts/manifest-seed.ts* permission is in place.Quick mode handles activation in Quick Turn 1 — skip this entire step in the Quick branch.
Use the detected_hermits list cached in Step 1.5 (no re-globbing).
If the list is non-empty:
detected_hermits as activated_hermit (carries plugin, id, marketplace_name, installPath).
activated_hermit.plugin as slug in the hatch-config.ts answers payload. Do not read the sibling's plugin.json version — core does not stamp _hermit_versions for an activated hermit.Collect project preferences in the phases below. Use AskUserQuestion for all questions, following the label+description convention at the top of this skill.
Step 1.5 gathers scope and sibling metadata. Language and timezone choices follow below.
4a. Agent name — ask with AskUserQuestion (header: "Agent name"). Options: Atlas / Hermit / Skip — plus Other for a custom name.
agent_name: nullagent_name4b+4c. Language + Timezone — batch both in one AskUserQuestion call (header: "Language" / "Timezone"). Language offers Match what I write / en / Other. Timezone offers This machine's zone / UTC / Other.
language; "This machine's zone" omits timezone. Record any other selected label or Other free-text as the value.Ask both in a single AskUserQuestion call (the option marked (default) is the Recommended pre-selection):
| Header | Question | Options (label: description) |
|---|---|---|
| Autonomy | How autonomous should your assistant be? | Balanced: act on routine tasks, escalate significant changes (default) / Conservative: ask before most non-trivial actions / Autonomous: proceed unless blocked, minimize interruptions |
| Remote ctrl | Enable remote control via claude.ai/code? | Yes: connect from claude.ai/code or phone (default) / No: local terminal only |
Record: escalation (conservative/balanced/autonomous), remote (true/false).
questions: [
{
header: "Channels",
question: "How do you want to communicate with your agent?",
options: [{ label: "Telegram", description: "Communicate with your agent via Telegram" }, { label: "Discord", description: "Communicate with your agent via Discord" }, { label: "Claude app (for now)", description: "One-way one-line pushes; a reply in the app loses its context on /clear. Pair Telegram or Discord anytime later." }]
}
]
If Claude app (for now): record channels: {}. Proceed to Phase 5. Do not ask channel follow-ups.
If Discord or Telegram: create a channel entry under the channels object (e.g., channels.discord). Boot script maps the key to the full plugin identifier. Then ask follow-ups below.
Channel plugins require Bun; /hermitd:channel-setup guides bot creation, credentials and pairing, with Other for conforming third-party plugins. After saving the preference to config.json, note:
Channel preference saved. Activation depends on how you run hermit:
- Docker (always-on):
/hermitd:docker-setuppairs during first run. For channels or tokens added later, runhermitd setup channel-setupfrom the host. The wizard tells you when to start or restart in your terminal and continues with pairing.- tmux (always-on, host): type
/hermitd:channel-setup startto set the token, start the agent, and pair.- Interactive (just trying it): run
/hermitd:channel-setupfor token + pairing, then restart withclaude --channels plugin:<channel>@claude-plugins-officialso the channel is active in your session.- Full guide: https://code.claude.com/docs/en/channels
Channel follow-up (only if Discord or Telegram was selected above — one AskUserQuestion call; the option marked (default) is the Recommended pre-selection):
| Header | Question | Options (label: description) |
|---|---|---|
| Brief | Enable morning brief delivery via channel? | Yes — 07:00: daily summary delivered each morning / No: no automated brief delivery (default) |
channels.<channel>.morning_brief: { "enabled": true, "time": "07:00" }. If "No", omit the key (or set to null).The Visibility question uses the scope-derived hatch_target to recommend an option. Place the recommended option at index 0 with (recommended) in the label so the recommendation is clear:
hatch_target == "local" (scope=local or scope=user): .local files is position 0 with (recommended).hatch_target == "committed" (scope=project): Committed files is position 0 with (recommended).questions: [
// The Deployment question from Quick Turn 2, verbatim
{
header: "Permissions",
question: "Permission mode for Claude Code?",
options: [
{ label: "auto", description: "**Default.** Classifier-reviewed autonomy — each action reviewed before it runs. Generally available to all users across subscription plans and API usage; supported models and provider configuration can vary. If Claude reports it unavailable for the current selection, choose a supported model or another permission mode." },
{ label: "acceptEdits", description: "Auto-approve file edits, prompt for shell commands. Good balance if auto is unavailable on your plan." },
{ label: "default", description: "Prompt for permission on first use of each tool" },
{ label: "bypassPermissions", description: "No permission prompts. Opt-in for fully unattended Docker-isolated hermits that cannot tolerate any pause." }
]
},
{
header: "Routines",
question: "Set up morning and evening routines? (morning brief reviews priorities, evening summarizes the day)",
options: [
{ label: "Yes", description: "Morning at 08:30, evening at 22:30 (default)" },
{ label: "No", description: "No scheduled routines" }
]
},
{
header: "Visibility",
question: "Where should hermit-personal hatch outputs live? (hook permissions, deny patterns, hermit-created skills/agents)",
// Build options with recommended at index 0 based on hatch_target:
// When hatch_target == "local":
// options: [
// { label: ".local files (recommended)", description: "Gitignored — operator-personal. Plugin installed at <scope> scope." },
// { label: "Committed files", description: "Shared with teammates. Override scope-derived default." }
// ]
// When hatch_target == "committed":
// options: [
// { label: "Committed files (recommended)", description: "Shared with teammates. Plugin installed at project scope." },
// { label: ".local files", description: "Gitignored — operator-personal. Override scope-derived default." }
// ]
}
]
Substitute <scope> with the actual core_install_scope value.
Record the operator's Visibility choice as hatch_target (overrides scope-derived default if different).
After Phase 5's four questions, make a second AskUserQuestion call with these three questions:
browser.enabled.answers.transcription, which overlays transcription.enabled. Quick mode asks nothing and keeps the template default.browser.default: agent-browser) / "Claude in Chrome" (browser.default: chrome, also set chrome: true, requires Claude login). Do not switch after a failure.Record deployment, mapping the labels to docker / tmux / interactive as Quick Turn 2 does.
Record: permission_mode (auto/acceptEdits/default/dontAsk/bypassPermissions/plan). plan and dontAsk (denies every tool not in permissions.allow, so it needs a curated allowlist) can be typed via Other.
For routines — if Yes: use the config defaults (active_hours.start = 08:00, end = 23:00) to derive morning = 08:30 and evening = 22:30. Add to routines array:
{"id":"hermitd:morning","schedule":"30 8 * * *","skill":"hermitd:brief --morning","enabled":true}{"id":"hermitd:evening","schedule":"30 22 * * *","skill":"hermitd:brief --evening","enabled":true}hermitd-start.ts (one persistent routine monitor with CronCreate fallback if the first tick never lands). Interactive users who want routines active in interactive mode must run /hermitd:hermit-routines load themselves. Mention this once at the end of hatch if the operator is running interactively."precheck": "reflect" on the reflect routine: it is the wake gate, and it is what keeps a day with nothing to reflect on from waking the session at all.precheck wake gate with its optional precheck_timeout_s) rather than hand-deriving it.Source of truth: ${CLAUDE_SKILL_DIR}/../../state-templates/config.json.template. hatch-config.ts reads it as the base — it encodes every default field shipped by the current plugin version (including model, always_on, monitors, chat_commands, compact, knowledge, etc.). Do NOT maintain a parallel inline default object here — anything written inline in this skill drifts the moment a field is added to the template.
Build an answers payload from the wizard's collected answers, then run:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/hatch-config.ts <PROJECT_ROOT> [--reinit]
with the answers payload as JSON on stdin. The script reads the template (or, on --reinit, the existing .hermit/config.json), overlays the answers, validates the result, and writes .hermit/config.json.
Answers payload — include a key only when the wizard actually collected that answer (the script overlays by presence, so an omitted key leaves the existing/template value untouched):
{
"project_name": "<project directory name, fresh hatch only>",
"activated_hermit": { "slug": "<plugin>" },
"agent_name": "...", "language": "...", "timezone": "...",
"escalation": "...", "remote": true,
"permission_mode": "...",
"routines": { "enabled": true, "morning_time": "08:30", "evening_time": "22:30" },
"channels": { "discord": { "enabled": true, "morning_brief_time": "07:00" } }
}
agent_name, language, timezone. An invalid_config error naming timezone wrote nothing: ask for the zone again and re-run.escalation, remote.channels.<name>: enabled, morning_brief_time (omit if declined; on re-init, send it as null to turn off a brief the operator previously enabled). The script fills in default_chat_id: null, and state_dir: .claude.local/channels/<name> on first creation and preserves both (plus any other channel it doesn't recognize, channels.primary, and third-party marketplace channels) on re-init merge. Do not include push_notifications in the payload — the script never touches it; it stays at the template default (true) or, on re-init, whatever value is already on disk. The runtime channel-first/push-fallback guard in prompts/resident.md already prevents double-notification.browser.enabled, browser.default, transcription (boolean), chrome when Chrome is chosen, permission_mode, routines (morning/evening only. This payload leaves other template and existing routines in place).auth_mode. It records which credential the hermit already runs on, and hatch has not established one yet; it stays at the template default (null, resolved from the credential volume at read time) and is written later by /docker-setup, hermitd-docker login, or a completed renewal.activated_hermit. slug is activated_hermit.plugin. Hatch never writes the operator’s startup skill.Re-initialization is --reinit on the same call — the script reads the existing config as its base (never the template), so any field the payload doesn't mention (custom operator keys, push_notifications, docker, monitors, ...) survives untouched, _hermit_versions entries are never advanced (only added if a slug is newly absent), and session-triggered scheduled_checks, channels, and routines are reconciled/merged by id rather than replaced wholesale. shutdown_skill is never written by this script — leave it null; the operator sets it via config edit if they run always-on services that need stopping on full close.
Periodic plugin checks are registered as ordinary routines by domain hatches, for example skill: "hermitd:reflect --check-id my-check --check my-plugin:my-audit-skill" with a cron schedule. scheduled_checks holds only task-completion checks.
Template-only fields (the wizard never asks about these; they come straight from config.json.template, and hatch-config.ts never touches them; the operator can tune them via /hermit-settings later): model, effort, delegation, auto_session, always_on, monitors, compact, heartbeat, knowledge, env, quality_gate, watchdog, budget, remote_environments, telemetry_export, artifacts, context_hygiene, channel_recovery, reflection, routine_wake_lint, routine_max_lateness_minutes, doctor, storage_drift, backup, ask_gate, operator_profile, skills. Defaults and semantics for each: docs/config-reference.md. Publish authorization for unattended sessions is Step 9c below. voice is the one exception in the other direction: the template ships it unset and §5a Phase 4b writes it through settings-edit, not through this payload; the questionnaire that asks for it runs after this step.
tmux_session_name is derived from project_name on fresh hatch only (hermit-<project_name>) — re-init never re-substitutes it.
Start the host browser install. After config is written, for deployment: tmux or interactive and browser.enabled not false, launch once in the background:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/browser-install.ts >/dev/null 2>&1 &
Do not wait for downloads or run sudo. The final report names hermitd run browser-host when prerequisites are missing. For Docker, /docker-setup builds the browser into the image.
Start transcription preparation. Beside the browser install, for deployment: interactive with transcription.enabled not false, launch once in the background:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/transcribe.ts --prepare >/dev/null 2>&1 &
Do not wait or run sudo. This installs the local engine and downloads the model. Tmux and Docker deployments prepare transcription at boot. Include the transcription line from will_apply in the preview and from the final report in the summary.
Persist hatch options. After config.json is written, before any settings or CLAUDE write, run:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/domain-hatch.ts ensure-target hermitd --target <local|committed>
with this run's final hatch_target (the Step 1.5 scope default or the Advanced Visibility answer). The script owns the whole schema: it stamps the five canonical fields on a fresh file, and on an existing one (a domain hatch may have stamped it first) it preserves the original stamped_at/stamped_by and records this run in last_updated_at/last_updated_by. It also repairs a file that exists without a usable target. It prints {action, target, path} (or {error} at exit 1), where action is created, repaired, updated or unchanged.
This file is read by hermit-evolve, docker-setup, and every domain hatch to inherit the operator's target choice without re-running scope detection.
en operators only)Two kinds of fixed text are written by scripts, not the model: the Artifact pages' UI chrome (.hermit/state/artifact-strings.json, overlaid per key over the English defaults) and the script notices sent to the channel, such as watchdog, status, budget and login messages (.hermit/state/messages.json). A missing key or an absent file falls back to English, so model-authored content and these surfaces only match when both are translated.
Run only when the chosen language is set and is not en:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/artifact.ts scaffold-strings <language> <current-ISO-timestamp>. Translate every value inside its strings object, leave the language and generated fields as emitted, and write the result to .hermit/state/artifact-strings.json.bun ${CLAUDE_PLUGIN_ROOT}/scripts/messages.ts scaffold .hermit <language>. Translate each todo entry's en text, using its note for context, and write .hermit/state/messages-draft.json as {"language":"<language>","locale":"<BCP 47 tag, e.g. pt-PT>","strings":{"<key>":"<translation>"}}. Then run bun ${CLAUDE_PLUGIN_ROOT}/scripts/messages.ts apply .hermit; translate again any key it lists under rejected.In both, keep keys and {placeholder} tokens verbatim (word order may move around a token, but the token text must not change or be translated).
When language is en or unset, skip: no file means English.
Generate OPERATOR.md through a project scan and targeted conversation instead of asking the operator to edit it manually.
Re-init guard: If operator_existed is true (from step 2):
.hermit/OPERATOR.md.bak, then proceed with phases below.Scan the target project for context. Read ONLY the following if they exist — never read source code files. Read all existing files in parallel (batch into a single tool-call turn) to minimize scan time:
| File | Read scope |
|---|---|
CLAUDE.md | Full file |
README.md | First 200 lines |
package.json | Full file |
requirements.txt | Full file |
pyproject.toml | Full file |
Cargo.toml | Full file |
go.mod | Full file |
docker-compose.yml | Full file |
.github/workflows/ | List filenames; read the first workflow file |
.gitlab-ci.yml | First 100 lines |
Makefile | First 50 lines |
Also get the directory structure (2 levels deep) to understand the project layout.
Collect findings silently. Do NOT print scan results to the operator.
Using the scan results, draft concise standing instructions addressed to the agent. Follow these rules:
config.json fields. routines, channels (including Discord/Telegram user IDs and morning_brief), permission_mode, agent_name, escalation, boot_skill, shutdown_skill, and _hermit_versions are already loaded structurally; do not restate them as prose. OPERATOR.md is for instructions the model can't infer from config (mission, focus, red lines, what to ask first). Tone and comms style have their own home: config.json's voice block, written in Phase 4b.Write the draft to .hermit/OPERATOR.md.
Advanced only: questions are split into two AskUserQuestion calls (max 4 per call). Q1–Q4 are never skipped and always form the first call. Call 2 always carries the Mission question.
Call 1 — always sent (4 questions):
| # | Header | Question | Options (+ Other for free text) |
|---|---|---|---|
| 1 | Focus | "What should I focus on when you're not around?" | Active development / Stabilization / Exploration |
| 2 | Red lines | "Is there anything I should never do on my own?" | Nothing extra / Spending or purchases |
| 3 | Ask first | "What should I check with you before doing on my own?" | Outbound messages / Deploys and releases / Nothing extra |
| 4 | Comms style | "How do you prefer I communicate?" | Default / Concise |
Accept any answer including free-text via Other. Expand Q1–Q3 into OPERATOR.md prose in Phase 4 — don't take options too literally.
Call 2: always send the Mission question:
| # | Header | Question | Options |
|---|---|---|---|
| 5 | Mission | "Who do I serve, and what am I here for?" | Just me / My team / My clients |
In Advanced, after "My team" or "My clients", call hatch-config with the project root, --reinit, and exactly {"approvals":"team"} on stdin, using the re-initialization call form above. Tell the operator that approvals now happen at the terminal, in the Claude app, or through a DM-paired approver in the maintainer chat (with a 60-second prompt deadline). Approving from chat needs maintainer_channel_id set to a chat the agent listens in: an approver's DM or an enrolled group. Setting approvals to personal reverts this at the next start. After "Just me", do nothing.
Tell the operator before Call 1: "I've scanned your project and drafted OPERATOR.md. A few questions to fill in what I couldn't infer:"
All questions use the AskUserQuestion structures defined above. Accept short answers or free-text via Other; expand into prose in Phase 4. If the operator selects "Skip", leaves Other blank, or gives a minimal answer, don't include that topic in OPERATOR.md.
Hermit extension: If a hermit was activated in step 3 and provides a file at <activated_hermit.installPath>/state-templates/OPERATOR-QUESTIONS.md, read it and append those questions to Call 2 (or start a Call 3 if Call 2 is already at 4).
Incorporate the operator's answers into the draft:
Draft from Q1-Q3 and the Mission answer, written to the agent. Q4 (comms style) belongs in config.json's voice block, written in Phase 4b, and must not reach this file. Keep an answer about the codebase itself (a directory, file type or workflow every session must respect) out of OPERATOR.md; carry it forward as a set-aside line for the project's CLAUDE file after the report. Suggest a permission rule instead for a limit that a command pattern can match.
Before writing, re-check the draft against Phase 2 rule 2 (no config.json mirroring). If removing a sentence leaves a paragraph hollow, drop the paragraph.
Write the final version to .hermit/OPERATOR.md.
In Advanced, no dialog here — this applies the Q4 answer from Phase 3. The hermit's tone lives in a native Claude Code output style, so it reaches the system prompt instead of SessionStart context: it holds for the whole session and survives compaction. config.json's voice block is what the operator owns; the style key and the style file are rendered from it, at hatch and again at every boot.
If .claude/output-styles/hermit-voice.md already exists, its prose is the operator's — adopt it instead of asking again. Take the text between the closing --> of its comment block and the ## Precedence heading and write it into voice.prose, then set style = custom (the two commands in step 2's Other branch, in that order). The next render reproduces that prose verbatim. Skip the Q4 answer entirely and go to step 3.
Otherwise write the Q4 answer:
Default → apply-known voice default. Concise → apply-known voice Concise. Neither writes a file.
Other (free text) → the operator's own words become the voice, verbatim. Write the prose first, then the style (the reverse order is refused — custom without prose is invalid):
bun ${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts .hermit/config.json set voice.prose '"<their words>"'
bun ${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts .hermit/config.json apply-known voice custom
Pass their wording through unchanged, or with only mechanical wrapping into instructions-to-yourself form (depth, cadence, how much reasoning to show, when to lead with the answer). Never paraphrase it into something weaker than a built-in already provides. Don't restate channel-routing rules (they ship with the plugin), don't put work context here (that's OPERATOR.md), and keep it short: it costs tokens on every API call.
Render it:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts .claude/settings.local.json voice-render
Local scope, not the hatch target — that is the scope Claude Code's own /config picker writes and the one that outranks committed settings, and a custom voice file is gitignored, so a committed pointer would name a file a teammate doesn't have. The op refuses any other target. It prints the applied style; carry that into Phase 5.
Tell the operator: "OPERATOR.md is ready. You can review it at .hermit/OPERATOR.md. Edit it anytime, or tell me the change and I'll make it with your approval, or propose the diff if edits are blocked." Add: "OPERATOR.md: what only the agent needs. CLAUDE.md: what every session here needs, helpers and subagents included."
Then report the style from what Phase 4b step 3 printed:
default / Concise): "Communication style is set to <style>. Change it any time with /hermitd:hermit-settings voice — from a chat too, once a channel is set up."hermit-voice): "How I talk to you is your own wording, at .claude/output-styles/hermit-voice.md. Change it with /hermitd:hermit-settings voice; it takes effect next session."Either way the file is a render of config.json — say so if the operator asks about editing it directly, so they don't lose an edit at the next restart.
Use ${CLAUDE_SKILL_DIR}/../../state-templates/GITIGNORE-APPEND.txt.
First, check for the backup marker. If .gitignore contains the line # .hermit state is tracked here, workspace-mode backup owns this file — it deliberately un-ignored the hermit-state lines so they can be committed. Skip this whole step silently; re-adding them would silently stop that hermit's backups.
Read the template. Determine which lines are missing from the project's .gitignore (per-line idempotent check — do not re-add lines already present). Only the missing lines are candidates to append.
.gitignore exists and candidate lines are non-empty: show the operator only the missing lines that will be appended, and ask with AskUserQuestion (header: "Update .gitignore") — options: Yes — append (add missing entries, default) / No — skip (you'll manage .gitignore manually). Append only if confirmed..gitignore exists and no lines are missing: skip silently..gitignore doesn't exist: show the operator the full template that will be written, and ask with AskUserQuestion (header: "Create .gitignore") — options: Yes — create (default) / No — skip. Create only if confirmed.Use ${CLAUDE_SKILL_DIR}/../../state-templates/WORKTREEINCLUDE-APPEND.txt.
The file contains a managed block bounded by marker comments (# >>> hermitd ... / # <<< hermitd >>>). This block carries hermit context (OPERATOR.md, config.json, bin/hermitd-run, compiled/) into claude --worktree worktrees; config.json is there so config keys such as commands.* are readable at the relative path inside the worktree, and bin/hermitd-run so the state-writing commands the resident prompt documents resolve there too (a worktree session has Write/Edit blocked, so Bash is its only path to them). The rest of bin/ is deliberately left out — those are lifecycle wrappers that act on the main hermit. Write it even in a non-git project: a .worktreeinclude there is harmless and ready when the operator later runs git init.
.worktreeinclude is absent: show the operator the template that will be written, and ask with AskUserQuestion (header: "Create .worktreeinclude") — options: Yes — create (default) / No — skip. Create only if confirmed..worktreeinclude exists and the # >>> hermitd marker is already present: skip silently..worktreeinclude exists and the marker is absent: append the managed block (preceded by a blank line) — ask with AskUserQuestion (header: "Update .worktreeinclude") — options: Yes — append (default) / No — skip. Append only if confirmed.Skip this step entirely if git_init_eligible is false. Skip silently with no operator interaction.
If git_init_eligible:
AskUserQuestion (header: "Git init") — "Initialize a local git repo here? The hermit's build output will be tracked; its internal churn (sessions, proposals, state) stays gitignored." — options: Yes (default) / No. Run git init only on Yes.git init without asking.When run, git init creates the repo at the project root. The .gitignore written in Step 7 is immediately in effect.
The plugin's hooks and boot scripts require specific Bash permissions to run without prompting. The target settings file is determined by hatch_target:
hatch_target == "local" → merge into .claude/settings.local.json (gitignored)hatch_target == "committed" → merge into .claude/settings.json (committed, current behavior)Do not restate the permission list here or anywhere else. apply-settings.ts holds the
only copy (its sealed HERMIT_ALLOW); ask it what the target file is missing:
bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> permissions-plan
It writes nothing and prints one JSON line: {"missing":[...],"obsolete":[...],"obsolete_deny":[...]} — the
sealed entries the target lacks, and any entries from retired plugin versions it still carries in
permissions.allow and permissions.deny respectively.
What the permissions buy:
bun */scripts/<name>.ts; Stop hooks (cost-tracker) and precheck scripts (heartbeat.ts precheck, reflect-precheck), scoped to plugin scripts only. Includes manifest-seed.ts, which the seeding sub-step below runs to write the template-manifest baseline (deferred from Step 2 so the permission is in place first). Includes channel-log.ts for age-based pruning and dream.ts for nightly transcript-based memory maintenance and undo. Includes proposal.ts for task-backed creation, triage, migration, routine upserts and metrics, and transcript-digest.ts for bounded behavioral telemetry. Includes setup-token-mint.ts; the login-token renewal driver /relogin runs; that skill exists to be driven from chat when the hermit's login is about to lapse, so a permission prompt there is an outright denial and the renewal it was meant to perform never happens.hermit/bin/hermitd-run proposal metrics * — domain plugins (the domain-brainstorm skills) reach core's shared scripts through the project-resident bin/hermitd-run, since their own ${CLAUDE_PLUGIN_ROOT} can't resolve core's versioned cache dir. The grant is pinned to the one verb they need, never a bare hermitd-run proposal * — that would also expose create, patch and routine, i.e. arbitrary state-dir writes. The space before * is a word boundary, so a metrics…-prefixed verb does not match, and hermitd-exec.sh additionally rejects //.. in the script name, so the route can't reach a script outside core's scripts/. Without it, headless domain metrics checks are functionally denied.hermit/bin/hermitd-run domain-hatch preflight * / ensure-target *: the shared domain-hatch protocol checks core's version floor and resolves and stamps the settings target. Grants stay pinned per verb so a read-only preflight call cannot write core state..hermit/bin/hermitd-run channel-send * / observations observe * / task note * — the scripts the model invokes ad hoc mid-session, rather than from a skill's verbatim command block. The resident prompt names the send, observation and task-note routes; sibling skills use task notes. Notes apply only inside an open record's turn, with no note otherwise. Their bun */scripts/<name>.ts twins are wildcarded-interpreter rules, which auto mode suspends (docs/security.md § Auto-mode Classifier), so on the fleet's default permission mode the model was left hand-deriving a versioned plugin-cache path — and the shortenings it improvises (an env-var prefix) both draw classifier denials and fall outside every prefix-match rule. channel-send is granted mode-less rather than verb-pinned because it has modes (--notice/--tier), not verbs; that is safe only because channel-send.ts pins its own state dir, so the grant confers exactly what the existing bun */scripts/channel-send.ts* entry already confers. Without these, proactive operator notifications and settled-knowledge bookkeeping are classifier-stochastic on an auto-mode installbash -c 'AGENT_DIR=... — SessionStart hook that loads session context on every startupEdit on .hermit/**; scripts maintain runtime state and skills update operator-editable content without prompting (Edit rules cover all file-editing tools, including Write)Steps:
permissions-plan (command above) against the resolved settings file and parse the JSON line.missing, obsolete and obsolete_deny are all empty: skip silently.permissions.allow (obsolete) and permissions.deny (obsolete_deny) — and ask with AskUserQuestion (header: "Hook perms") — options: Yes — add (merge so hooks run without prompting, default) / No — skip (you'll be prompted during sessions).bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> permissions-sync
(Adds every missing sealed entry and removes only entries from retired plugin versions. Operator-authored rules are never touched.)
When its output has other_file, tell the operator which retired entries were also removed from that settings_file, naming each obsolete_deny entry verbatim.
(No auto-mode step here: the classifier reads autoMode only from user scope, managed settings, or --settings, so there is nothing useful to seed into a project settings file. hermitd-start renders the hermit's classifier policy into a per-session overlay at every boot and launches with --settings.)/hermitd:hermit-settings permissions to add them later."Seed state/template-manifest.json (deferred from Step 2 — now that the bun */scripts/manifest-seed.ts* permission is in place). It records the sha256 pristine-baseline that the hermit-evolve drift signals depend on. The script computes the hashes (an LLM cannot sha256 reliably). Read the current plugin version from ${CLAUDE_SKILL_DIR}/../../.claude-plugin/plugin.json and run bun ${CLAUDE_PLUGIN_ROOT}/scripts/manifest-seed.ts .hermit with this JSON on stdin:
{
"plugin_version": "<version>",
"entries": [
{ "key": "templates/PROPOSAL.md.template", "file": "${CLAUDE_PLUGIN_ROOT}/state-templates/PROPOSAL.md.template" },
{ "key_prefix": "bin", "dir": "${CLAUDE_PLUGIN_ROOT}/state-templates/bin" }
]
}
The bin entry enumerates the source state-templates/bin/ (the authoritative core set), never the project's .hermit/bin/ (which can hold operator/add-on files). The script writes { "version": 1, "files": { ... } } and on re-init preserves foreign keys (add-on hermit entries) while overwriting only the keys it re-seeds; it refuses to overwrite a present-but-corrupt manifest. The source files it hashes are stable, so seeding here does not change the recorded hashes.
The bare .hermit argv is cwd-relative, which is safe here: hatch runs from the project root and never invokes docker compose or tmux, so cwd does not drift (unlike /docker-setup Step 7b.6, which anchors to an absolute <PROJECT_ROOT> for that reason).
Seed native Claude Code permission rules into the target settings file. Canonical source: state-templates/deny-patterns.json (deny + ask). The target file is the same as Step 8 (hatch_target == "local" → .claude/settings.local.json; else → .claude/settings.json). After this seed, the operator owns the file — later upgrades never re-apply or remove these entries.
questions: [
{
header: "Safety rules",
question: "Which permission rules should I seed?",
options: [
{ label: "Standard", description: "Safety denies + approval prompts for risky ops (default)" },
{ label: "Hardened", description: "Everything hard-blocked — client-facing/prompt-averse" },
{ label: "Skip", description: "Nothing seeded — add later in the settings file" }
]
}
]
bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> deny standard. Merges deny into permissions.deny and ask into permissions.ask.bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> deny hardened. Merges both arrays into permissions.deny.permissions.deny / permissions.ask. To seed Standard later from a terminal session: bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> deny standard."If the operator picked permission_mode: dontAsk earlier in hatch, note: "permission_mode: dontAsk turns ask entries into denies — Standard's approval prompts will hard-block instead of prompting."
Claude Code ships its own native bash sandbox (sandbox.* settings, bwrap/sandbox-exec) with its own setup command (/sandbox). Hermit does not probe for it or configure it: whether CC's own sandbox spawn will succeed cannot be predicted from outside CC. This step only prints a one-time pointer; it never writes sandbox.*.
Step:
Resolve target settings file using hatch_target (local → .claude/settings.local.json; committed → .claude/settings.json).
Branch on deployment:
If deployment == docker: print a one-line informational note (never a recommendation — recommending an in-container sandbox would push operators toward the Ubuntu 24.04+ AppArmor path where bwrap can't start in-container): "In Docker the container is your isolation boundary — one of the approaches Anthropic lists for unattended runs (https://code.claude.com/docs/en/sandbox-environments). Claude Code's bash sandbox is off by default; bubblewrap/socat are installed, so /sandbox is available if you want in-container defense-in-depth." No settings write.
For non-Docker deployments (tmux or interactive), check the target settings file for an already-declared sandbox.enabled key (either value):
/sandbox to enable it (its Dependencies tab checks bubblewrap/socat for you); docs: https://code.claude.com/docs/en/sandboxing. For the managed browser, add bun */scripts/browser-agent.ts * to sandbox.excludedCommands so Chrome can use its own sandbox. Settings the agent needs: https://github.com/gtapps/hermitd/blob/main/plugins/hermitd/docs/security.md#recipe-for-tmux-installs"No AskUserQuestion — enabling or disabling sandbox.* is entirely the operator's call via /sandbox or by editing their settings file directly.
Skip this step entirely if artifacts.dashboard and artifacts.weekly_review are both false in the config just written (Step 5) — nothing to authorize.
Otherwise, run bun ${CLAUDE_PLUGIN_ROOT}/scripts/apply-settings.ts <resolved-settings-file> artifact-allow (same target-file resolution as Step 8; additive merge, never removes existing entries). This adds Artifact to permissions.allow so unattended sessions never stall on the first-publish permission ask — a headless "ask" is an effective deny, which would otherwise silently no-op every artifact refresh. No prompt: it follows the same opt-out model as the feature itself (default-on, disable any page via /hermit-settings), and rides Claude Code's own governed Artifacts path (org toggle, RBAC, retention, audit log).
Then run bun ${CLAUDE_PLUGIN_ROOT}/scripts/settings-edit.ts .hermit/config.json set artifacts.publish_authorized true — this arms hermitd-start's boot-time grant (applyArtifactGrant) so the permission stays in place even if the settings file is later wiped or migrated, without ever needing another unattended settings write.
Note to the operator: "Artifact publishing is on — added Artifact to permissions.allow so refreshes from /brief, /weekly-review, /proposal-create never prompt. Re-ensured at every boot; revoke with /hermit-settings artifact-authorization (bank first publishes instead). Disable any page via /hermit-settings artifact-dashboard|artifact-weekly-review."
Quick asks four core questions covering setup mode, deployment, chat and who the agent serves. Conditional activation and extension questions can add to that count. Collect answers, write config once, draft OPERATOR.md from the scan and Mission answer, then apply voice.
Entry condition: Step 1.6 returned Quick AND is_reinit is false (re-init forces Advanced).
Only fires if detected_hermits from Step 1.5 is non-empty. Same prompt shape as Step 3 of the Advanced branch — uses the cached candidate list, does not re-glob. If multiple hermits detected, list all + Skip. If none, this turn is skipped entirely.
If a hermit is selected: record the full entry from detected_hermits as activated_hermit (carries plugin, id, marketplace_name, installPath). Pass only its plugin slug in Step 5’s hatch-config.ts answers payload.
Quick sends no agent_name, language or timezone. The name and language stay unset; the script stores the machine's zone.
Ask both questions in one AskUserQuestion call.
questions: [
{
header: "Deployment",
question: "How will you run the agent?",
options: [
{ label: "tmux always-on", description: "Runs on the host as you, no image build. Boots via hermitd start; the watchdog scheduler installs on first boot (opt out with watchdog.scheduler_enabled: false)" },
{ label: "Docker always-on", description: "Isolated container that restarts itself; guided end to end by /docker-setup" },
{ label: "Interactive", description: "Just trying it, right here in your terminal" }
]
},
{
header: "Chat",
question: "How do you want to communicate with your agent?",
options: [
{ label: "Telegram", description: "Communicate with your agent via Telegram + Remote Control if available" },
{ label: "Discord", description: "Communicate with your agent via Discord + Remote Control if available" },
{ label: "Claude app (for now)", description: "One-way one-line pushes; a reply in the app loses its context on /clear. Pair Telegram or Discord anytime later." }
]
}
]
Record deployment (one of docker / tmux / interactive), channel (one of none / discord / telegram). Map "Claude app (for now)" to none for Step 5's channels overlay.
push_notifications is left at the template default (true) — no follow-up question. Push is dormant whenever a channel is reachable (the runtime guard in prompts/resident.md sends channel-first) and fires only as fallback when a channel is unreachable or absent.
Derived values from this turn (used in shared Steps 5 and 9):
permission_mode: auto (same default for both Docker and non-Docker deployments). Generally available to all users across subscription plans and API usage; supported models and provider configuration can vary. If Claude reports it unavailable for the current selection, choose a supported model or run /hermit-settings permissions to select another mode.deny standard). Applied at Step 9 silently.Run the scan from 5a Phase 1 silently without writing OPERATOR.md. Ask only the Mission question from 5a Phase 3, plus any activated hermit's OPERATOR-QUESTIONS.md questions. Collect answers without calling hatch-config --reinit or writing config. For "My team" or "My clients", include "approvals":"team" in the fresh Step 5 payload and, after config is written, tell the operator what 5a Phase 3 says about team approvals.
Run shared Step 5 once with the collected payload, including approvals when selected. Draft and write OPERATOR.md using 5a Phases 2 and 4 from the scan and Mission answer. Skip Advanced's Focus, Red lines, Ask first and Comms style questions and its approvals re-init call. Apply the default voice in 5a Phase 4b (apply-known voice default, then voice-render), or adopt an existing hermit-voice.md as described there. Continue shared Steps 5b-9 without repeating Step 5 or 5a.
Quick replaces Step 4 entirely and applies these defaults silently at the shared Steps 5-9c (no prompts):
| Source | Field | Quick value |
|---|---|---|
| Advanced Phase 3 equivalent | escalation, remote | template defaults (balanced, true) — don't override |
| Advanced 5a Phase 4b equivalent | voice | After config and OPERATOR.md, apply Default and render, or adopt an existing hermit-voice.md; ask no style question |
| Step 5 (end) | persist hatch options | run ensure-target with this run's final hatch_target before settings or CLAUDE writes |
| Step 5b | fixed-text localization | run verbatim: generate both translated tables only when language is set and not en; skip silently otherwise |
| Advanced Phase 4 equivalent | channels..* | state_dir + enabled + default_chat_id=null; omit morning_brief |
| Quick Turn 2 channel choice | push_notifications | template default (true) — don't override |
| Advanced Phase 5 browser equivalent | browser | template defaults: enabled, default agent-browser; ask no browser question, preserve an existing re-init choice |
| Advanced Phase 5 equivalent | permission_mode, routines | permission_mode = auto; routines = morning 08:30 + evening 22:30 |
| Step 7 | .gitignore append | apply silently (per-line idempotent) |
| Step 7a | .worktreeinclude managed block | apply silently (marker-block idempotent — skip if marker already present) |
| Step 7.5 | git init (fresh dirs only) | run git init if git_init_eligible; omit otherwise |
| Step 8 | plugin permissions (target settings file) | merge silently into hatch_target settings file (auto-mode policy needs no seeding — it ships in the per-session overlay hermitd-start renders at boot) |
| Step 9 | deny patterns (target settings file) | Standard (deny standard) silently; write to hatch_target settings file |
| Step 9c | Artifact publish permission | same as Advanced — artifact-allow applied silently (skip entirely if all three artifacts.* are false) and artifacts.publish_authorized set to true in config |
On the host, install the operator command after setup, from the project root:
.hermit/bin/hermitd-run hermitd-cli install
bun ${CLAUDE_PLUGIN_ROOT}/scripts/hatch-report.ts final <PROJECT_ROOT> --deployment <docker|tmux|interactive> [--quick]
Pass --quick for Quick and omit it for Advanced. Run with no stdin.
Compose the report from its JSON as message text (the operator cannot see Bash output), stating only what the JSON carries, because it is what the script observed on disk rather than a file list from this session:
status: "incomplete": hatch did not complete (.hermit/config.json is not present); tell them to re-run /hermitd:hatch and report nothing else.browser.enabled and browser.default; say "agent_name is hatched" when set, or "Your agent is ready" when unset; each absence in observed (null permissions_file, false gitignore or worktreeinclude, any missing_bin_scripts) as a warning you offer to fix; next_steps as a numbered list in order, labeling optional: true steps as optional and from: "terminal" commands as host terminal commands, saying nothing runs until step running_after_step finishes; then the anytime commands, and that they edit OPERATOR.md themselves, or tell you the change and you make it behind the approval prompt.For Quick, render defaults_applied on one line starting "Applied defaults:" and ending "Change any with /hermit-settings." Include the observed permission mode, enabled routine IDs, heartbeat cadence and whether Standard deny rules are present. Add "initialized a git repo" only if Step 7.5 ran git init and it exited 0.
Pass the deployment recorded in Quick Turn 2 or Advanced Phase 5.
After the report, add: .hermit/claude-settings.json is the optional hermit-only settings file.
After the report, without another question, check the project-root instruction files. Never write or edit AGENTS.md. Resolve the destination from hatch_target: committed uses CLAUDE.md; local uses CLAUDE.local.md.
CLAUDE.md or CLAUDE.local.md already exists, show any set-aside codebase lines from Phase 4 as suggested additions. Write nothing.AGENTS.md exists, do not run /init. Create the target's CLAUDE file only when set-aside lines exist, starting with @AGENTS.md on its first line, then a short ## Project rules heading and those lines.Skill(init) yourself. For a committed target, let it write CLAUDE.md. For a local target, invoke Skill(init) with args Write the result to CLAUDE.local.md instead of CLAUDE.md, titled # CLAUDE.local.md. Append any set-aside lines under a short ## Project rules heading.Report the file actually created and who sees it: "Created CLAUDE.local.md with Claude Code's /init: project notes every session here reads, kept out of git." Or: "Created CLAUDE.md with Claude Code's /init: project notes every session here reads, tracked by git so your team sees it." For an AGENTS.md import, report the import and the added project rules instead of claiming /init ran. Follow the report with any appended lines.
Applies on both Quick and Advanced paths and is the last action of the skill. After the report, build the pending set from detected_hermits (Step 1.5). A sibling is pending when a file exists at <installPath>/skills/hatch/SKILL.md and its plugin was not already present in config.json._hermit_versions when Step 1 read the config. An activated hermit is never stamped by core, so the generic rule covers it.
For each pending sibling, print the block below with its plugin field substituted for <slug> — the bare plugin name, not id, which carries an @marketplace suffix. Repeat the complete block once per pending sibling. Do not invoke the Skill tool. If none are pending, stop after the report.
## ▶ Next step — type this now
/<slug>:hatch
I can't run setup wizards for you (they're operator-run by design).
After it finishes, that hermit's setup is complete; then type the next printed domain-hatch command, if any.
These blocks are terminal output. Print nothing after the final block.
What SKILL.md sets; muted values are Claude Code's defaults
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?".Other plugins' skills for the same job