gtapps/hermitd/tree/main/plugins/hermitd
hermitd
在 Claude 应用、Discord、Telegram 或自定义 Claude Code channel 中使用你自己的本地 Claude Tag。
关于这个 mod
<p align="center"> <a href="../../LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT 许可证" /></a> <a href="https://code.claude.com/docs/en/plugins"><img src="https://img.shields.io/badge/Claude%20Code-plugin-orange.svg" alt="Claude Code 外挂" /></a> <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.4.10-green.svg" alt="版本 1.4.10" /></a> <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/gtapps/hermitd/_gh_traffic_stats/.github/badges/clones.json" alt="下载量" /> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="欢迎提交 PR" /> <a href="https://discord.gg/54sJqAxhUh"><img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" alt="加入" /></a> </p>注意: Claude Code 2.1.287 会阻止名为
claude*的外挂,因此这个项目从claude-code-hermit更名为hermitd。迁移方式。
你自己的本地 Claude Tag
在自己的电脑或服务器上运行一个持续在线的 Claude Code agent,供自己或团队使用。可以从终端或 Claude 应用通过 Remote Control 使用它,也可以连接 Discord、Telegram、iMessage 或自定义 Claude Code channel。
把持续性的职责交给它:维护研究资料、监控系统、运行例行工作,并跟进未完成的工作。在收到下一次请求之前,它会检查这些职责,跨工作阶段保留进度,并在需要处理事情时联系你。
在 Claude 订阅上运行它,再用自己的 MCP 服务器、skills 和外挂扩展能力。
<p align="center"> <img src="assets/cover.png" alt="持续在线的 Claude Code agent" /> </p><a id="quick-start"></a>
设置
从下面选择一种安装方式。 在你希望放置 agent 的资料夹中执行,可以是空资料夹,也可以是现有项目。Linux、macOS 或通过 WSL2 运行的 Windows 都会使用你的 Claude 订阅。请参阅先决条件。
<details open> <summary>安装 Claude Code 外挂</summary>先安装 Claude Code 2.1.287+ 和 Bun 1.3+:
claude plugin marketplace add gtapps/hermitd
claude plugin install hermitd@hermitd --scope local
claude "/hermitd:hatch"
</details>
<details>
<summary>或者使用引导安装程序</summary>
它会准备 Claude Code、Bun 和 tmux,安装外挂,然后启动设置:
curl -fsSL https://gtapps.github.io/hermitd/install.sh | bash
</details>
两种方式都会为这个资料夹安装 Hermit。Hatch 会引导你设定 agent 的用途和偏好,然后说明如何启动它。选择 Quick 即可采用之后能再调整的预设值。
让它持续运行
设置完成后,按照输出的下一步启动 agent。
在你的电脑上
在持久的 tmux 工作阶段中运行:
hermitd start
需要 tmux。只要电脑保持开机,watchdog 就会恢复失败的工作阶段。无人值守使用时,建议开启 Claude Code 的 /sandbox。要连接聊天,请按照设置交接的指示执行 /hermitd:channel-setup。
在 Docker 中
在 Claude Code 中运行引导设置:
/hermitd:docker-setup
它会建立并启动容器,然后引导你完成身份验证和频道配对。需要 Docker Compose v2。
自定义容器。 让 agent 为 Docker 设置加入工具、套件或服务。例如:“Add ffmpeg to the container.”
可选的 Docker 安全控制涵盖本地网络访问、DNS 策略、资源限制和外挂安装审计。
外挂提供的功能
-
连续性。 持久的工作状态和归档的工作阶段交接会跨越压缩和重启保留进度。外部 watchdog 会恢复失败的工作阶段,而内容管理让长期运行的工作阶段更容易维持。
-
主动工作。 Heartbeat 会定期检查你交给 agent 的职责。Routines 会执行排程工作,watches 会显示变化。它们结合后,agent 不必等待下一次请求就能跟进工作。
-
通过聊天工作。 在已连接的聊天中分派工作并接收结果。较长的指派会以 thread 更新进度;当 agent 需要决定时,会另外回复一则消息。指派也能带有持久任务记录,其中包含请求者、到期日、结果确认,以及按人员查看的仪表板。
-
Token 效率。 借助 Claude Code 的 Monitor,heartbeat 检查和可选的 routine 预检查会在模型之外执行。安静检查和跳过的 routine 不会使用模型 token;同时到期且符合条件的 routine 可以共享一次唤醒。
-
持久知识。 把
raw/中的来源资料转成compiled/中持续维护的知识,与 Claude Code 的自动记忆并存。/recall可以搜索过去的工作阶段、知识、提案和捕获的频道对话。 -
从经验学习。 agent 会检查工作和操作中的证据,保存有用的经验,并在把拟议的行为变更交给你批准前验证它们。
-
控制与可见性。 通过仪表板追踪进度、提案和使用量。暂停会在工具边界强制执行,可选的用量上限可以提醒你,或暂停进一步工作。
成为项目频道的一部分。 使用 passive mode 时,agent 会保存收到的群组消息供之后查看,并在获准的使用者 @提及它时唤醒。它也会记住该频道的指示。例如:“When I ask for a status update, include blockers.”
<a id="configure-it"></a>
配置
在终端中使用 /hermit-settings 调整设置,或从受信任的 Discord 或 Telegram 聊天中修改获准的设置。每次写入都会经过验证,并记录在经过脱敏的审计账簿中;/hermit-settings history [setting] 会显示变更内容。可用设置包括:
| Key | 预设值 / 选项(预设值以 粗体 显示) |
|-----|--------------------------------------|
| agent_name | 你的 assistant 名称 |
| operator_profile | 主要聊天对象:technical / non-technical |
| timezone | 设置时检测;回退为 UTC |
| language | 设置时检测;回退为 en |
| escalation | 询问前会执行多少工作:conservative / balanced / autonomous |
| model | 工作阶段模型:sonnet |
| permission_mode | 无人值守 agent 可以多自由地行动:auto |
| AGENT_HOOK_PROFILE | 防护配置:minimal / standard(互动)/ strict(持续在线) |
| channels | Discord / Telegram / iMessage / 第三方频道外挂(以及 allowed_users) |
| channels.primary | 接收外发提醒的频道 |
| channels.<name>.maintainer_channel_id | 可选的独立聊天,用于技术警报、诊断和用量详情 |
| push_notifications | 警报时使用原生/移动推送:true |
| remote | 远程控制;false 还需要批准跨电脑的对等消息;true |
| ask_gate | 把无人值守的问题转到已配对的频道:true |
| budget | 可选的每日 / 每周 / 每月上限;alert 或绑定的 pause 动作 |
| artifacts | 仪表板 / 提案 / 每周审查:已启用仪表板和提案 |
| heartbeat.enabled | 定时的空闲扫描:true |
| heartbeat.every | 空闲扫描间隔:30m |
| heartbeat.active_hours | 活跃时段:08:00–23:00 |
| routines | 由 /hermit-routines 管理的持久 routines |
| monitors | 由 /watch 管理的持久后台 watches |
| scheduled_checks | 任务完成时触发的工作阶段 skills |
| reflection.graduation_min_sessions | 提案重复出现的门槛:1 |
| quality_gate.tier | 变更后的清理投入:budget / balanced / quality |
| knowledge.compiled_budget_chars | 新鲜/恢复启动时的目录预算:2500 |
| knowledge.raw_retention_days | raw/ 保留时间:14 |
| knowledge.working_set_warn | 编译文件超过 N 份时发出警告:20 |
| auto_session | 开机时自动启动工作阶段:true |
| boot_skill / shutdown_skill | 自定义启动 / 拆除 skill |
| context_hygiene.clear | 安全边界的内容清理:已启用,安静时长 1h,最大年龄 24h,最低 20,000 token |
| context_hygiene.compact | 压缩长期运行的活跃内容:已启用,100000 个可压缩 token / 4h 冷却 |
| CLAUDE_AUTOCOMPACT_PCT_OVERRIDE | 在内容的百分比达到此值时自动压缩:65 |
| MAX_THINKING_TOKENS | 每次工作的思考 token 上限:10000 |
| watchdog.scheduler_enabled | watchdog tick 的操作系统排程器:在 tmux 持续在线模式下为 true(开机时自动安装);false 或 hermitd-watchdog uninstall 可选择退出 |
| watchdog.enabled | 恢复/重启层级:false,直到首次排程器注册(或执行 /docker-setup);清理仍会运行 |
完整架构见 配置参考
观察
产物。 agent 使用 Claude Code Artifacts 提供互动式仪表板和按需生成的自定义页面,你可以查看、互动和分享。让它建立符合实际追踪内容的专属 agent 仪表板。
从终端或已连接的聊天请求更新:
| Command | 提供内容 |
|---------|---------|
| /brief | 当前状态和近期工作的摘要。 |
| /recall | 搜索过去的工作阶段、知识、提案和捕获的对话。 |
| /hermit-health | 警报、routines、频道、阻塞事项和近期学习。 |
| /hermit-doctor | 安装、运行阶段、排程、凭据和权限的诊断。 |
| /hermit-evolution | 成本趋势、提案活动、routines 和 agent 产出的内容。 |
| /cost-reflect | 按 token 类型、工作阶段和工作触发原因拆分用量。 |
| /hermit-dashboard-design | 根据 agent 实际追踪的内容设计仪表板。 |
学习循环
agent 会检查工作和操作中的证据。持久的经验会写入记忆;会改变行为的非平凡想法会经过验证、去重,再交给你批准。
工作产生证据
│
▼
到期时反思
│
▼
验证并去重
│
┌────┴────┐
▼ ▼
记住 提议
一条经验 一项变更
│
▼
你批准吗?
│ │
否 是
│ │
不变更 实作
│
▼
验证结果
│
▼
未来证据
在符合条件的任务或工作阶段暂停时、每日,以及执行配置为进行反思的 routine 后,系统会运行反思。 已批准的变更可以立即开始,变成任务,或留给手动实作。验证通过,或之后的证据显示问题已经消失时,提案会变成已解决状态。
后续验证。 agent 会检查修正或预测是否随着时间保持有效。例如:“/later check tomorrow whether those errors have returned.”
新的帮助方式。 agent 会根据你的工作和可用工具提出新能力。例如:“What else could you be doing for me?”
成本
安静的 heartbeat 检查、跳过的 routines 和 passive chat capture 不会使用模型 token。工作、评估和回复会消耗用量;内容管理会让对话历史保持在可控范围。
- 查看用量来源。 每次调用都会记录 token 用量,包括模型、输入/输出/缓存拆分,以及工作来自 routine、heartbeat、channel 还是其他来源。工作阶段和每日总量会进入仪表板、每周审查和
/cost-reflect。 - 设定上限。 可选的每日、每周和每月上限可以在达到时发出提醒,或绑定暂停动作。
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add gtapps/hermitd claude plugin install hermitd
原文 / README
Notice: Claude Code 2.1.287 blocks plugins named
claude*, so this project moved fromclaude-code-hermittohermitd. How to migrate.
Your own local Claude Tag.
Run an always-on Claude Code agent on your machine or server, for you or your team. Use it from your terminal or the Claude app via Remote Control, or connect Discord, Telegram, iMessage, or a custom Claude Code channel.
Give it ongoing responsibilities: maintain research, monitor systems, run routines, and follow up on unfinished work. Between requests, it checks those responsibilities, carries progress across sessions, and reaches you when something needs attention.
Run it on your Claude subscription and extend it with your own MCP servers, skills, and plugins.
<p align="center"> <img src="assets/cover.png" alt="Always-on Claude Code agent" /> </p><a id="quick-start"></a>
Set up
Choose one installation method below. Run it from the folder where you want your agent, empty or existing. Uses your Claude subscription on Linux, macOS, or Windows via WSL2. See prerequisites.
<details open> <summary>Install the Claude Code plugin</summary>With Claude Code 2.1.287+ and Bun 1.3+ installed:
claude plugin marketplace add gtapps/hermitd
claude plugin install hermitd@hermitd --scope local
claude "/hermitd:hatch"
</details>
<details>
<summary>Or use the bootstrap installer</summary>
Prepares Claude Code, Bun, and tmux, installs the plugin, and launches setup:
curl -fsSL https://gtapps.github.io/hermitd/install.sh | bash
</details>
Both options install Hermit for this folder. Hatch guides you through the agent’s purpose and preferences, then shows how to start it. Choose Quick for defaults you can adjust later.
Keep it running
After setup, follow the printed next steps to start your agent.
On your machine
Run in a persistent tmux session:
hermitd start
Requires tmux. The watchdog recovers failed sessions while your machine stays on. Claude Code's /sandbox is recommended for unattended use. To connect a chat, run /hermitd:channel-setup as directed by the setup handoff.
In Docker
Run the guided setup in Claude Code:
/hermitd:docker-setup
Builds and starts the container, then walks you through authentication and channel pairing. Requires Docker Compose v2.
Customize the container. Ask the agent to add tools, packages, or services to its Docker setup. For example: “Add ffmpeg to the container.”
Optional Docker security controls cover local-network access, DNS policy, resource limits, and plugin installation auditing.
What the plugin adds
-
Continuity. Persistent working state and archived session handoffs carry progress across compaction and restarts. An external watchdog recovers failed sessions, while context management keeps long-running sessions manageable.
-
Proactive work. Heartbeats regularly check the responsibilities you give the agent. Routines run scheduled work, and watches surface changes. Together, they let the agent follow up without waiting for another request.
-
Work through chat. Assign work and receive results in your connected chat. Longer assignments get threaded progress updates, with a separate reply when the agent needs a decision. Assignments can also carry a persistent task record with requester, due date, result confirmation, and a dashboard view by person.
-
Token efficiency. With Claude Code’s Monitor, heartbeat checks and optional routine prechecks run outside the model. Quiet checks and skipped routines use no model tokens; eligible routines due together can share a wake.
-
Lasting knowledge. Turn source material in
raw/into maintained knowledge incompiled/, alongside Claude Code's auto memory./recallsearches past sessions, knowledge, proposals, and captured channel conversations. -
Learning from experience. The agent reviews evidence from its work and operation, saves useful lessons, and verifies proposed behavior changes before bringing them to you for approval.
-
Control and visibility. Track progress, proposals, and usage through the dashboard. Pause is enforced at the tool boundary, and optional usage caps can alert you or pause further work.
Part of your project channel. With passive mode, the agent saves incoming group messages to look back on later, and wakes when someone you allow @mentions it. It also remembers instructions for that channel. For example: “When I ask for a status update, include blockers.”
<a id="configure-it"></a>
Configure
Tune from a terminal with /hermit-settings, or change permitted settings from a trusted Discord or Telegram chat. Every write is validated and recorded in a redacted audit ledger; /hermit-settings history [setting] shows what changed. Some of the settings available:
| Key | Default / options (default bold) |
|-----|--------------------------------------|
| agent_name | your assistant's name |
| operator_profile | primary-chat audience: technical / non-technical |
| timezone | detected during setup; fallback UTC |
| language | detected during setup; fallback en |
| escalation | how much it does before asking: conservative / balanced / autonomous |
| model | session model: sonnet |
| permission_mode | how freely the unattended agent acts: auto |
| AGENT_HOOK_PROFILE | guardrail profile: minimal / standard (interactive) / strict (always-on) |
| channels | Discord / Telegram / iMessage / third-party channel plugins (+ allowed_users) |
| channels.primary | which channel gets outbound pings |
| channels.<name>.maintainer_channel_id | optional separate chat for technical alerts, diagnostics, and usage details |
| push_notifications | native/mobile push on alerts: true |
| remote | remote control; false also requires approval for cross-machine peer messages; true |
| ask_gate | route unattended questions to a paired channel: true |
| budget | optional daily / weekly / monthly caps; alert or binding pause action |
| artifacts | dashboard / proposals / weekly review: dashboard and proposals enabled |
| heartbeat.enabled | timed idle sweeps: true |
| heartbeat.every | idle sweep cadence: 30m |
| heartbeat.active_hours | active window: 08:00–23:00 |
| routines | persistent routines managed via /hermit-routines |
| monitors | persistent background watches managed via /watch |
| scheduled_checks | session-triggered skills at task completion |
| reflection.graduation_min_sessions | proposal recurrence bar: 1 |
| quality_gate.tier | post-change cleanup spend: budget / balanced / quality |
| knowledge.compiled_budget_chars | fresh/resumed startup catalog budget: 2500 |
| knowledge.raw_retention_days | raw/ retention: 14 |
| knowledge.working_set_warn | warn above N compiled docs: 20 |
| auto_session | auto-start session on boot: true |
| boot_skill / shutdown_skill | custom boot / teardown skill |
| context_hygiene.clear | safe-boundary context clear: enabled, quiet 1h, max age 24h, minimum 20,000 tokens |
| context_hygiene.compact | compact long-running active context: enabled, 100000 compactible tokens / 4h cooldown |
| CLAUDE_AUTOCOMPACT_PCT_OVERRIDE | auto-compact at % of context: 65 |
| MAX_THINKING_TOKENS | thinking-token cap per turn: 10000 |
| watchdog.scheduler_enabled | OS scheduler for the watchdog tick: true on tmux always-on (auto-installed at boot); false or hermitd-watchdog uninstall opts out |
| watchdog.enabled | recovery/restart tier: false until first scheduler registration (or /docker-setup); hygiene still runs |
Full schema in the Config Reference
Observe
Artifacts. The agent uses Claude Code Artifacts to provide an interactive dashboard and custom pages generated on demand that you can view, interact with, and share. Ask it to build your own personalized agent dashboard.
Ask for an update from your terminal or connected chat:
| Command | What it gives you |
|---------|-------------------|
| /brief | Current status and a summary of recent work. |
| /recall | Search past sessions, knowledge, proposals, and captured conversations. |
| /hermit-health | Alerts, routines, channels, blockers, and recent learnings. |
| /hermit-doctor | Diagnostics for the installation, runtime, scheduling, credentials, and permissions. |
| /hermit-evolution | Cost trends, proposal activity, routines, and what the agent has produced over time. |
| /cost-reflect | A breakdown of usage by token type, session, and what triggered the work. |
| /hermit-dashboard-design | A dashboard designed around what your agent actually tracks. |
Learning loop
The agent reviews evidence from its work and operation. Durable lessons go to memory; non-trivial ideas that would change its behavior are verified, deduplicated, and brought to you for approval.
Work produces evidence
│
▼
Reflect when due
│
▼
Verify and deduplicate
│
┌────┴────┐
▼ ▼
Remember Propose
a lesson a change
│
▼
You approve?
│ │
no yes
│ │
No change Implement
│
▼
Verify result
│
▼
Future evidence
Reflection runs at eligible task or session pauses, daily, and after routines configured to reflect. Approved changes can start now, become a task, or be left for manual implementation. Proposals are resolved when verification passes or later evidence shows the problem is gone.
Follow-up verification. The agent checks whether a fix or prediction held up over time. For example: “/later check tomorrow whether those errors have returned.”
New ways to help. The agent proposes new capabilities based on your work and the tools available to it. For example: “What else could you be doing for me?”
Cost
Quiet heartbeat checks, skipped routines, and passive chat capture use no model tokens. Work, evaluations, and replies consume usage; context management keeps conversation history bounded.
- See what drives usage. Token usage is recorded per call, including the model, input/output/cache split, and whether work came from a routine, heartbeat, channel, or another source. Session and daily totals feed the dashboard, weekly review, and
/cost-reflect. - Set limits. Optional daily, weekly, and monthly caps can alert you or enforce a pause until the exceeded budget window resets. Under Claude subscription billing, dollar figures are usage estimates rather than additional per-token charges.
- Choose where to spend. Set the session model and optionally assign a different model to individual routines. Routine models run in isolated subagents, so use them for work that can return a concise result.
See budgets and routine scheduling for configuration and scheduler fallback behavior.
Remote work
Reach the running agent through your connected channels or Claude Code Remote Control. You can also start separate sessions for additional work:
- Background sessions with follow-up. Through
/spawn-session, the agent launches a local Claude Code helper in the project, or in another folder with--cwd, and relays its status when it becomes idle. Claude Code isolates the helper's edits in a Git worktree unless the project setsworktree.bgIsolationtonone; pass--worktreeto give it one from the start. Set the helper’s model and effort with options such as--model sonnet --effort high. - Local Remote Control gate. Through
/rc-gate, the agent manages a Remote Control server on your machine or server. While the gate is open, you can spawn new Claude Code sessions from the Claude app, using your local files and tools. Each session gets its own Git worktree, while the agent keeps running.
Both session-spawning paths require a Git workspace. Remote Control requires a Claude sign-in through /login on the machine running the agent.
Watch other sessions. Through Claude Code cross-session messaging, ask the agent to watch a local Claude Code session, including one you started interactively, and notify you when it next becomes idle.
Claude Code controls from chat. Use !model sonnet, !effort high, !advisor opus, !compact, !clear, !doctor (alias !checkup), and !permission-mode auto directly from your connected chat. Control the agent’s work with !pause, !resume, and !snooze 2h. Use /when-done-switch-to --model sonnet to switch automatically at the end of the current turn.
Extensions
Optional plugins that add domain tools and workflows to your agent.
- dev-hermit: Branch discipline, push guards, and gated PR workflows.
- homeassistant-hermit: Home Assistant tools, automation workflows, and safety checks.
- fitness-hermit: Strava integration, activity analysis, and training routines.
- hermitd-feed: Source curation, recurring briefs, and weekly synthesis.
- hermitd-laravel-forge: Laravel Forge deployments, logs, and server management.
- hermitd-scribe: GitHub issues and comments from proposals through a dedicated bot identity.
You can run separate agents for different responsibilities, each with its own working state, knowledge, and routines. See Creating Your Own Hermit.
External orchestration. Other agents and tools can check the agent’s status, health, and recent work through its MCP interface, and request a wake when needed.
Maintenance
Sign-in renewal from chat. When your agent’s Claude sign-in needs renewing, use /relogin from your connected chat. Open the link in your browser, sign in, and send the code back in chat.
Scheduled backups. Optional backups preserve the agent’s knowledge, session reports, settings, and Claude Code memory in Git, with an optional private remote copy. Backups run without model tokens.
Upgrading from claude-code-hermit
Before migrating, update every registered agent in the Claude config directory to core 1.4.8 and stop all of them, including Docker agents. Run once on the host:
curl -fsSL https://gtapps.github.io/hermitd/migrate.sh | bash
The migration records every agent before replacing the marketplace, moves project state to .hermit/, refreshes launchers and permissions, and rebuilds Docker images. Customized managed files receive .bak copies. If interrupted, rerun the same command to resume. Disabled plugin installs are reported and are not reinstalled.
Follow the printed start command for each agent, then run /hermitd:hermit-evolve. Pending later commands that still use old paths are reported for re-arming.
Upgrading
Run hermitd update from the project folder, or hermitd update <name> from anywhere. Docker updates refresh the host core first, then the container.
hermitd list shows registered and discovered hermits on this host, including stopped and missing projects. hermitd status [name] shows transport, execution and its age, open and waiting tasks, and the first runnable task. Both support --json. Listing never removes entries; hermitd prune removes missing projects.
Use hermitd start|stop|restart|attach [name] for lifecycle commands, hermitd pause [name] on|off|snooze <duration>|status, hermitd watchdog [name] run|install|uninstall, or hermitd run [name] <script> [args] for maintenance. Names match the project folder or agent name; with no name, the nearest project above the current folder is used.
See the Upgrade guide for details.
<a id="tips--tuning"></a>
Guides
- Configure: the Config Reference covers the full schema and tuning details.
- Use: Getting Started and the Owner's Guide cover everyday work, decisions, and controls.
- Automate: Routine Authoring covers schedules and prechecks. Channel configuration includes third-party channel plugins.
- Observe: Artifacts explains the dashboard, proposals, and weekly reviews.
- Maintain: Upgrading, Backup, Troubleshooting, and Uninstalling.
- Understand: Architecture, Security, and FAQ.
Community
Join the Discord community for setup help and discussion. See CONTRIBUTING.md for reporting bugs or contributing.
Credits
Andrej Karpathy inspired the raw/ → compiled/ knowledge system.

