hermes-telegram-remote-control
Use when controlling Hermes from Telegram groups.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- hermes-telegram-remote-control
- author
- Hermes Agent
- license
- MIT
- version
- 1.3.1
- metadata
- { "hermes": { "tags": [ "hermes", "telegram", "gateway", "remote-control", "hooks", "messaging", "stop-notify", "tui-capture" ], "related_skills": [ "hermes-agent", "receive-openclaw-handoff" ] } }
- platforms
- [ "linux", "macos" ]
- description
- Use when controlling Hermes from Telegram groups.
02 资源文件 4
- 参考文档references/deployment-notes.md3.7 KB
- 参考文档references/real-tui-capture.md2.1 KB
- 参考文档references/stale-gateway-finals-path.md2.0 KB
- 参考文档references/wrapup-pipeline.md5.8 KB
03 SKILL.md 正文
Hermes Telegram remote control
Operate Hermes as a split Telegram surface: control group for conversation, finals channel for clean completion archives. When the agent finishes real work, post a real hermes --tui terminal capture (tool trees, skills, codeblocks) to the finals channel, plus a short status in the control group so operators can reply. Suppress empty/aborted noise. Keep OpenClaw on separate tokens.
Docs: https://hermes-agent.nousresearch.com/docs/user-guide/messaging/telegram
Hooks: https://hermes-agent.nousresearch.com/docs/user-guide/features/hooks
User preferences (hard rules for this operator)
- Control group = conversation only — continue via reply/@mention. Do not spam full completion photos into the group.
- Finals channel = clean archive of what was done — full real-TUI screenshot (+ caption). This host: Aimée Codes
-1003989836403(TELEGRAM_FINALS_CHANNEL). - One completion card per meaningful stop — never three-message media spam; never empty/aborted noise; never subagent cards (parent turn cards).
- Real TUI capture preferred — run
hermes --tui --resume <session>under Xvfb and screenshot the terminal (scroll + stitch). Synthetic You/Hermes bubble PNGs are fallback only. Operator rejected bubble mockups as “TUI view not working” when they lacked tool/skill/codeblock chrome. - Never CLI/backend tool-stdout dumps as the stop photo.
- Notify real work stops only: completed, real interrupt mid-work, failed/error, budget — always with a human Why line. Skip ghost sessions, post-completion TUI finalize, subagents.
- Single notify path — plugin
stop-notifyonly. Shell hook stays pure{}no-op. - Continue via reply in the control group or
@HermesHandoverBot(not the finals channel).
When to use
- User wants to “program from Telegram” / phone control of Hermes
- Multi-bot group (Hermes + OpenClaw) needs silent-unless-mentioned behavior
- Need automatic updates when agents stop + why + visual TUI evidence
- Dual-channel finals archive vs conversation group
- Home channel / finals channel / group allowlist / require_mention tuning
- Debugging missing wrap-ups / shell hook JSON / plugin load / blank TUI captures
Architecture (preferred)
| Surface | Role |
|---|---|
| Control supergroup | Conversation — commands, streaming, short stop status, replies |
| Finals / archive channel | Clean completion archive — real TUI screenshot + caption |
| @Hermes bot | One token, one gateway; must be admin on finals channel |
| Other bots | Separate tokens; exclusive_bot_mentions: true |
@Hermes <task> → progress in control group (if Telegram-origin)
→ agent stops (meaningful work only)
→ REAL hermes --tui resume + Page_Up scroll-stitch PNG
→ photo/document → finals channel
→ short text → control group
→ user replies in control group / @Hermes
→ same session continues
Setup checklist
1. BotFather / group / channel
- Bot can join groups; Group Privacy OFF or bot is admin.
- After privacy changes: remove + re-add bot.
- Confirm
getMe→can_read_all_group_messages: truewhen privacy is off. - Group chat ID is negative (
-100…). Finals channel: bot is administrator withcan_post_messages. - Invite links rotate — resolve chat_id via
getChat/linked_chat_id, not by guessing.
2. Secrets (.env only)
TELEGRAM_BOT_TOKEN=...
TELEGRAM_HOME_CHANNEL=-100... # control group
TELEGRAM_HOME_CHANNEL_NAME="Group Title"
TELEGRAM_CHAT_ID=-100...
TELEGRAM_GROUP_ALLOWED_CHATS=-100...
TELEGRAM_FINALS_CHANNEL=-100... # archive (this host Aimée Codes: -1003989836403)
TELEGRAM_REQUIRE_MENTION=true
# TELEGRAM_ALLOWED_USERS=<numeric user id>
Never put tokens in config.yaml or chat.
3. Config (config.yaml)
group_sessions_per_user: true
streaming:
enabled: true
platforms:
telegram:
enabled: true
home_channel:
platform: telegram
chat_id: "-100..."
name: "Group Title"
require_mention: true
exclusive_bot_mentions: true
hooks_auto_accept: true
hooks:
on_session_end:
- command: "$HERMES_HOME/agent-hooks/on-session-end-telegram.sh"
timeout: 120
plugins:
enabled:
- stop-notify # required for TUI — shell hooks alone are not enough
4. Stop-notify stack (single path)
| Piece | Role |
|---|---|
Plugin $HERMES_HOME/plugins/stop-notify/ |
Only notify path; on_session_end only |
Shell hook on-session-end-telegram.sh |
No-op {} only |
capture_real_tui.py |
Preferred stop image: Xvfb + xterm + real TUI |
render_tui_shot.py |
Synthetic bubbles — fallback only |
telegram_task_wrapup.py |
Skip/dedup + dual delivery |
| Allowlist | shell-hooks-allowlist.json |
Host packages for real capture: xvfb, xterm, xdotool, ImageMagick (import/convert). Details: references/real-tui-capture.md.
Enable: hermes plugins enable stop-notify
Health: hermes hooks doctor → valid JSON.
5. Reload after wrap-up / plugin code changes
Stale-import failure mode (2026-08): long-lived gateway + TUI keep the first
import telegram_task_wrapup forever. Disk already had dual-delivery + real-TUI
capture, but live stops still posted synthetic bubbles to the control group
only — no Aimée Codes, no real TUI. Operator: “TUI Output not displayed /
Aimée Codes not updated.”
Required plugin pattern (stop-notify/__init__.py):
import importlib, sys
def _load_wrapup():
name = "telegram_task_wrapup"
if name in sys.modules:
return importlib.reload(sys.modules[name])
return importlib.import_module(name)
Log capture_mode, target, control_target, results on each fire.
Process reload (the plugin file itself is also cached until process restart):
# NEVER from inside a gateway agent turn (tooling blocks it)
bash $HERMES_HOME/scripts/reload-stop-notify.sh
# = rm pycache + systemctl --user restart hermes-gateway.service
# Then reopen every open hermes --tui tab
If the agent cannot restart mid-turn: flag
$HERMES_HOME/cache/telegram-wrapup/NEED_PROCESS_RELOAD and tell the operator
to run the script from SSH. One-off recovery: force-repost with a clean
Python process (not the gateway interpreter).
Interaction rules
| User action | Expected |
|---|---|
@Hermes … |
New or continued turn |
| Reply in control group | Continues session |
/stop@Hermes |
Abort + stop notification if real content |
/new@Hermes |
Fresh session |
@OpenClaw … only |
Hermes silent |
Stop card format
Finals channel (media)
✅ Agent stopped — task completed
📌 <title from current user prompt>
Why: <human reason>
Origin: tui|cli|telegram · <session_tail> · shot:real_tui|synthetic
<short preview>
↪️ Continue in the control group (@HermesHandoverBot).
Image: real hermes --tui capture when possible (tall stitch → sendDocument if height ≳ 8500px). Fallback synthetic: full final answer (~14k chars), tools as meta only.
Control group (short text)
✅ Agent stopped — task completed
📌 <title>
Why: …
Origin: …
📷 Full TUI capture posted to Aimée Codes (finals channel).
↪️ Reply here to continue.
Title: prefer current user prompt first line — not sticky session display_name.
Why mapping
| Internal signal | Status | Card? |
|---|---|---|
text_response(...) |
completed | Yes |
interrupt / /stop mid-work |
stopped | Yes if content |
| max_iterations / budget | budget | Yes |
| error | failed | Yes |
subagent_* |
— | No |
| empty ghost / post-complete finalize | stopped | No |
Automatic finish pipeline
See references/wrapup-pipeline.md.
on_session_end→ plugin →telegram_task_wrapup.run- Prefer
capture_real_tui.py(real terminal) - Fallback
render_tui_shot.py - Media → finals; short text → control
- If finals send fails, media falls back to control
Shell hook stdout must stay pure {}. Dual-path (shell + plugin both calling wrap-up) was the 2026-08 spam root cause.
Dedup: turn fingerprint 120s; session-stop cooldown 300s after successful post; skip empty_stop / subagent.
Multi-bot / OpenClaw
- One bot token → one polling gateway.
- Hermes coding → Hermes bot only.
- OpenClaw handoffs →
receive-openclaw-handoff; do not conflate. require_mention+exclusive_bot_mentionsfor multi-bot groups.
Pitfalls
- Dual path spam — shell hook must remain pure
printf '{}\n'; plugin alone calls wrap-up. - Empty/aborted spam — skip
empty_stop; do not “always notify empty stops.” - TUI finalize after completed turn —
session_stop_cooldown300s. - Non-atomic dedup — use
O_CREAT|O_EXCLlocks. - Subagent spam — no
subagent_stophook. - Stale in-memory wrap-up — plain
import telegram_task_wrapupis sticky for the life of gateway/TUI. Useimportlib.reloadevery fire and restart gateway + TUIs after editingstop-notifyitself. Symptom: livewrapup.jsonllackscapture_mode/finalswhile forced Python runs have them. - Shell hook stdout pollution — non-JSON → silent notification death.
- TUI without plugin — plugin required for TUI stops.
- Gateway restart from inside gateway — blocked.
- Privacy cache — privacy change needs kick/rejoin.
- Polling conflict — second process on same token.
- Redirecting TUI stdout to a log — Ink paints the log; xterm blank. Capture:
2>>logonly. - Bubble mockups sold as “the TUI” — operator rejected; real capture preferred.
- Photo spam in control group — control is conversation-only.
- Sticky session title — title from current user prompt.
- Truncated synthetic answers — assistant body ~14k (1.8k caused
… [truncated]). - Invite link ≠ chat_id — resolve IDs; bot must be channel admin.
- Truncated hook fields — rebuild from
state.dbviasession_id.
Verification matrix
| Check | Pass |
|---|---|
hermes hooks doctor |
valid JSON |
hermes plugins list |
stop-notify, on_session_end only |
| Shell hook stdout | exactly {} |
| Turn completes | Media on finals + short text on control |
| Ghost open/close | No card |
| Real capture probe | Multi-hundred-KB+ PNG, not 1–2KB blank |
| Reply in control | Continues session |
| Capture fail | shot:synthetic still posts |
Support files
references/wrapup-pipeline.md— triggers, dual delivery, dedupreferences/deployment-notes.md— this host’s IDs and pathsreferences/real-tui-capture.md— Xvfb/xterm recipe, Ink stdout pitfall, stitch limits- Host helper:
$HERMES_HOME/scripts/reload-stop-notify.sh— gateway reload outside agent turn
Related
- Bundled
hermes-agentfor general CLI/gateway (reference only) receive-openclaw-handofffor OpenClaw → Hermes handoff lane
04 同仓库更多 Skills
xurl
X/Twitter via xurl CLI: raw post search, posting, DM, media.
weights-and-biases
W&B: log ML experiments, sweeps, model registry, dashboards.
touchdesigner-mcp
Control TouchDesigner via twozero MCP.
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
technical-docs-corpora
Use when bulk-crawling public tech docs into agent skills.
teams-meeting-pipeline
Teams meeting summaries, job replay, Graph subscriptions.