hermesclaw

AaronWong1999MIT活跃维护

让 Hermes Agent 和 OpenClaw 两个 AI 智能体共用同一个微信账号,实现双智能体在同一微信号上协同响应消息。

Run Hermes Agent and OpenClaw on the same WeChat account

v0.4.0发布于 2026-06-15 11:50 UTC760star +1 / 7 天80fork同步于 2026-11-10 23:54 UTC

怎么上手

由 README 提炼,执行前请确认
curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | bash
硬件要求按 README 说明

README 未说明

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

让 Hermes、OpenClaw、OpenCode 三个 AI 共用同一个微信账号,一条命令装好

让 Hermes Agent 和 OpenClaw 两个 AI 智能体共用同一个微信账号,实现双智能体在同一微信号上协同响应消息。

核心能力

  • 作为唯一 iLink 轮询者,避免双开时的 403 冲突
  • 起两个本地代理端口转发,让各 Gateway 以为连的是官方 API
  • 用 /hermes、/openclaw、/opencode、/both、/three 切换路由
  • 通过 ACP 子进程桥接 OpenCode,支持微信语音 Vibe Coding
  • 只转发原始 iLink 消息,媒体解密和 AI 交互交给各 Gateway

容易踩的坑

需先装好 OpenClaw 的 clawbot 或 Hermes 微信 Gateway 至少一个,否则无从接管;OpenCode 需另装 npm install -g opencode-ai 并在 .env 配 OPENCODE_CMD;安装后要重启各 Gateway 并在微信发 /whoami 验证

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.4.0
  1. v0.4.0v0.4.0: macOS Support最新正式版2026-06-15 · 2026-06-15 11:50 UTC

    Added native macOS support via launchd in install.sh. Fixes #7.

  2. v0.3.6HermesClaw v0.3.6 — macOS bash 3 compat + curl|bash stdin fix2026-04-29 · 2026-04-29 15:50 UTC
    查看更新说明

    修复

    🐛 macOS 安装失败 — mapfile: command not found

    macOS 自带 bash 3.2(GPL 授权限制),不支持 bash 4+ 内置的 mapfile。安装脚本里所有 3 处 mapfile 调用均已替换为 while IFS= read -r 循环,macOS 开箱可用。

    🐛 curl | bash 安装静默中止

    set -euo pipefail 下,裸 read 在 stdin 为管道(curl 输出)时返回非零,触发 set -e 立即退出,导致Aborted.出现在用户还没来得及输入任何内容之前。

    修复:检测到非 tty stdin 时,把所有交互提示重定向到 /dev/tty,用户仍可正常回答;若 /dev/tty 也不可用(CI / Docker 无终端),则 fallback 到 auto-yes。全部 3 处 read 同时加了 || VAR="" 兜底。

    🧪 5 个回归测试

    新增 tests/test_install_sh.py,覆盖 mapfile 缺失、bash 语法、read 保底、tty 检测及非交互式 stdin 场景。


    感谢 @ShxxxNewBee、@siasbaily、@csloz 报告并诊断这些问题 🙏

  3. v0.3.5HermesClaw v0.3.5 — 遗留服务冲突自动检测2026-04-28 · 2026-04-28 05:19 UTC
    查看更新说明

    修复

    🐛 install.sh:自动检测并禁用旧版 hermes-weixin-bridge 服务

    根因:hermes-weixin-bridge.service(旧版 bridge.py)带有 WantedBy=multi-user.target,每次服务器启动都会自动拉起。安装 HermesClaw v3 后如果旧服务仍处于 enabled 状态,会导致新旧两个桥同时运行,出现微信消息重复处理、iLink token 冲突等问题。

    修复内容(install.sh):新增 detect_and_disable_legacy_services() 函数,在安装流程的摘要之后、安装依赖之前执行:

    • 检测 hermes-weixin-bridge.service 是否处于 enabled / enabled-runtime / active 状态
    • -y / HERMESCLAW_YES=1(自动模式):自动执行 systemctl disable --now
    • 交互模式:询问用户确认,默认 Y
    • disable 后二次验证是否真的生效,失败则打印 warning 并给出手动命令
    • hermes.service / openclaw.service(gateway 服务)不受影响

    注:这是安装脚本级修复,不改变运行时代码,121 tests 全绿。

  4. v0.3.4HermesClaw v0.3.4 — OpenCode 权限修复2026-04-27 · 2026-04-27 16:18 UTC
    查看更新说明

    v0.3.4 — OpenCode 权限修复

    问题

    通过微信调用 OpenCode 时,OpenCode 反馈无权限对服务器文件做任何修改,AI 编程功能完全失效。

    根因

    systemd 服务单元有 ProtectHome=read-only,导致 OpenCode(hermesclaw 的子进程)无法向 /home/ubuntu/ 下任何项目目录写文件,内核直接返回 EPERM。

    修复内容

    1. systemd 服务单元(install.sh 生成模板)

    • 移除 ProtectHome=read-only
    • 简化 ReadWritePaths=${HOME}(覆盖所有用户项目目录)
    • 保留 ProtectSystem=strict(系统目录仍受保护)和 NoNewPrivileges=true

    2. OpenCode 全局配置自动创建(install.sh)

    • 安装时自动写入 ~/.config/opencode/opencode.json:"permission": "allow"
    • 消除所有 ACP session/request_permission 提示,无需等待人工确认

    3. ACP 策略默认值升级

    • OPENCODE_PERMISSION_STRATEGY 默认值 allow_once → allow_always(.env 模板和 hermesclaw.py 代码默认值同步更新)
    • 即使 ACP 层收到权限请求,也在整个 session 内持久授权

    4. ACP 权限选项安全回退修复

    • 修复 _select_permission_option 的危险回退逻辑:当无法识别任何 option kind 时,原代码会 fallback 到 options[0],可能意外选中 reject_always
    • 改为返回 None(outcome: cancelled)并记录 warning,避免静默误操作

    升级方式

    cd ~/hermesclaw && git pull && sudo systemctl daemon-reload && sudo systemctl restart hermesclaw
    # 手动补充 opencode.json(如首次启用 OpenCode):
    mkdir -p ~/.config/opencode
    echo '{"\":"https://opencode.ai/config.json","permission":"allow"}' > ~/.config/opencode/opencode.json
    

    已有安装的用户还需手动更新 /etc/systemd/system/hermesclaw.service,将 ProtectHome=read-only 行删除,并将 ReadWritePaths 改为 /home/ubuntu。

  5. v0.3.3HermesClaw v0.3.3 — ACP 稳定性修复 + 媒体类型精准识别2026-04-27 · 2026-04-27 14:33 UTC
    查看更新说明

    v0.3.3 Bug Fixes

    修复内容

    Bug 2:OpenCode ACP 频繁崩溃(cascade 报错)

    • _get_or_create 移出锁外,并增加 最多 3 次、间隔 2 秒的重试机制——对应 opencode acp 首次启动时 SQLite 数据库初始化失败导致的静默崩溃
    • prompt_blocks 超时后设 alive=False,下条消息自动创建新 session,不再复用已挂起的进程
    • ACP initialize 超时从 15 秒提高到 30 秒,兼容 opencode 启动较慢的情况

    Bug 1:OpenCode 把文件当成视频描述

    • build_opencode_prompt 改为优先检查 file_item/video_item/image_item 子键,比 type 数字更可靠
    • _media_mime 对文件类型附件(type=5)强制排除 video/* MIME,防止 .mp4 文件名导致 LLM 误判

    新增测试(4 个)

    • test_file_item_overrides_video_type_number
    • test_prompt_blocks_timeout_marks_session_dead
    • test_get_or_create_retries_on_crash
    • test_get_or_create_raises_after_three_failures

    121 个测试全绿

    注意

    Bug 3(OpenClaw 返回 TOOLCALL) 和 Bug 4(OpenClaw 图片 404 NO endpoints) 经日志确认均为 OpenClaw 配置问题,非 HermesClaw 代码 bug——详见 Bug 4 说明。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    HermesClaw

    Run Hermes Agent, OpenClaw, and OpenCode on the same WeChat account. One command to install.

    在同一个微信账号上同时多开 Hermes Agent、OpenClaw 和 OpenCode。一条命令安装。

    New from the same author: ccx — hit your Claude Code limit, or stuck on a bug? Hand the task to Codex with the full context, then switch back. One click in the macOS menu bar, runs locally, free and open source. HermesClaw keeps working as before. If ccx looks useful to you, a star there would mean a lot.

    同一作者的新项目:ccx —— Claude Code 额度用完了,或者卡在某个问题上?带着完整上下文交给 Codex 接着干,搞定再切回来。macOS 菜单栏一键切换,本地运行,免费开源。HermesClaw 照常可用,不受影响。如果你觉得 ccx 有用,欢迎去看看、点个 Star。


    Why HermesClaw

    Both Hermes Agent and OpenClaw now support WeChat natively — but you can't run both on the same account. Each gateway exclusively locks the iLink connection. If you start both, one gets 403 errors and drops messages. OpenCode adds a third AI brain via its ACP subprocess protocol.

    HermesClaw solves this by becoming the sole iLink poller, then running two local proxy servers (for Hermes and OpenClaw) plus a direct ACP bridge (for OpenCode). Each gateway believes it's talking to the real iLink API.

    The new OpenCode support also lets you Vibe Code via WeChat voice messages — just speak and OpenCode handles it, backed by four free models including MiniMax M2.5 Free. You can also use it alongside the other two agents to complement each other — fixing their issues, tracing bugs, or inspecting the local environment.

    现在 Hermes 和 OpenClaw 都原生支持微信了——但你不能在同一个账号上双开。 每个 Gateway 会独占 iLink 连接。HermesClaw 解决这个问题:它作为唯一的 iLink 轮询者,运行两个本地代理,让两个 Gateway 各连各的。

    新版还增加了 OpenCode 支持,现在你可以用微信语音直接进行 Vibe Coding 了,调用的就是 OpenCode 中包含 MiniMax M2.5 Free 在内的四个免费模型。你也可以用它和另外两个 Agent 互相补充使用,比如帮它们修问题、查 bug、看本机环境。


    Special Thanks

    Special thanks to the Hermes Agent team at Nous Research for recognizing and recommending HermesClaw in the Community section of their official GitHub README.

    特别感谢 Nous Research 的 Hermes Agent 团队,在其 GitHub 官方 README 的 Community 区收录并推荐 HermesClaw。

    Official reference: Hermes Agent README - Community


    Before / After

    Without HermesClawWith HermesClaw
    Hermes on WeChat✅ Works (native gateway)✅ Works
    OpenClaw on WeChat✅ Works (clawbot)✅ Works
    OpenCode on WeChat❌ No WeChat support✅ via ACP bridge
    Both on same account❌ Token conflict / 403✅ /both mode
    All three on same account❌ Impossible✅ /three mode
    Voice messages✅ Each handles natively✅ Transcription forwarded
    Images / video / files✅ Each handles natively✅ Raw iLink msg forwarded
    Switching agents—/hermes, /openclaw, /opencode, /both, /three

    Architecture

                        ┌────────── iLink API ──────────┐
                        │  ilinkai.weixin.qq.com        │
                        └──────────┬────────────────────┘
                                   │
                          (sole poller / token owner)
                                   │
                        ┌──────────▼────────────────────┐
                        │     HermesClaw v3              │
                        │  routes by /hermes /openclaw   │
                        │          /opencode /three      │
                        │  queues raw iLink messages     │
                        ├────────┬──────────┬────────────┤
                        │        │          │
                  Proxy A      Proxy B    ACP Bridge
                  (:19999)     (:19998)   (subprocess)
                  openclaw     hermes     opencode acp
                        │        │          │
                        ▼        ▼          ▼
                  ┌──────────┐ ┌──────────┐ ┌──────────┐
                  │ openclaw │ │ hermes   │ │ opencode │
                  │ gateway  │ │ gateway  │ │ process  │
                  └────┬─────┘ └────┬─────┘ └────┬─────┘
                       │            │             │
                  sendmessage  sendmessage   send_text_ilink
                       └─────┬──────┘            │
                             │ (proxy forwards)  │
                             └──────────────────►┘
                                    to iLink
    

    HermesClaw is a thin Python proxy (~500 lines). It does not process media, call agent APIs, or touch agent memory. It just queues and forwards raw iLink protocol messages. Each gateway handles its own media decryption, markdown formatting, and AI interaction natively.

    HermesClaw 只是一个轻量转发代理(~500 行),不处理媒体、不调 Agent API、不动记忆。每个 Gateway 原生处理自己的媒体解密和 AI 交互。


    Prerequisites

    Before installing HermesClaw, you need at least one of:

    1. OpenClaw + clawbot (openclaw-weixin) — installed and logged into WeChat
    2. Hermes Agent + WeChat gateway — installed with hermes gateway configured

    Both installed = full dual-open. One installed = single-agent mode with the option to add the other later.

    安装 HermesClaw 前,需要至少安装以下其中一个:OpenClaw 的 clawbot,或者 Hermes 的微信 Gateway。


    Quick Install

    curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | bash
    

    For non-interactive / automated installs (skips all confirmation prompts):

    curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | HERMESCLAW_YES=1 bash
    # or, when running the script directly:
    bash install.sh -y
    

    The installer will:

    1. Detect which gateways are installed and configured
    2. Extract the iLink token from gateway account files
    3. Patch openclaw-weixin baseUrl → http://127.0.0.1:19999 (proxy A)
    4. Patch Hermes WEIXIN_BASE_URL → http://127.0.0.1:19998 (proxy B)
    5. Detect OpenCode CLI (optional — enables /opencode and /three)
    6. Install Python deps (requests, python-dotenv)
    7. Create OpenClaw media symlink (workaround for media path mismatch)
    8. Set up the hermesclaw systemd service

    After install, restart your gateways and send /whoami in WeChat.

    AI-assisted install

    Drop this into any AI agent on the target machine:

    Run: curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | bash
    
    Then read README.md and install.sh from the installed HermesClaw directory.
    Detect whether Hermes Agent, OpenClaw, their WeChat gateways, python3, pip3,
    and systemd are present.  At least one gateway must be configured.  Extract
    the iLink token from the first available gateway account file.  Patch
    openclaw-weixin baseUrl to http://127.0.0.1:19999 and Hermes WEIXIN_BASE_URL
    to http://127.0.0.1:19998.  Install dependencies and systemd service.
    
    Also detect OpenCode CLI: run `command -v opencode` or check
    ~/.npm-global/bin/opencode.  If not found, suggest installing with:
      npm install -g opencode-ai
    Set OPENCODE_CMD in .env to the detected path (or empty if not found).
    OPENCODE_MODEL defaults to opencode/minimax-m2.5-free (free, no API key needed).
    
    If Hermes Agent WeChat gateway is detected, the installer will offer to patch
    weixin.py to disable newline-based message splitting (recommended).  Accept
    this patch so long replies are sent as single messages instead of being split
    by paragraphs.  The fix script is at fix_hermes_splitting.sh.
    
    Restart gateways.  Verify /whoami works in WeChat.
    

    Commands

    CommandAction
    /hermesRoute to Hermes only
    /openclawRoute to OpenClaw only
    /opencodeRoute to OpenCode only (via ACP bridge)
    /bothRoute to Hermes + OpenClaw (reply from both)
    /threeRoute to all three (reply from all)
    /whoamiShow current route and status
    anything elseForward to the active agent(s)

    Default route is Hermes. In /both and /three modes, proxy replies are prefixed with [Hermes Agent] / [OpenClaw] / [OpenCode] for attribution.

    OpenCode setup

    OpenCode connects via its native ACP subprocess protocol — no proxy port needed. Install it first:

    npm install -g opencode-ai
    

    Then set OPENCODE_CMD in .env (the installer auto-detects it). Use /opencode or /three once OpenCode is installed.


    Project layout

    hermesclaw.py             # ~870 lines. Triple-proxy router + ACP bridge.
    install.sh                # Smart auto-detecting installer (-y for non-interactive).
    fix_hermes_splitting.sh   # Patch Hermes weixin.py (optional, recommended).
    tests/                    # 82 pytest tests (core, proxy, ACP, recovery).
    README.md
    LICENSE
    docs/                     # Screenshots and media.
    

    Media handling

    HermesClaw forwards raw iLink protocol messages to each gateway. This means:

    • Text — forwarded as-is
    • Voice — iLink includes a transcription; HermesClaw forwards the transcription text
    • Images / video / files — the raw iLink message (with CDN URLs and AES keys) is forwarded; each gateway downloads and decrypts natively

    HermesClaw does not do AES decryption, CDN downloads, or media re-encoding. That's each gateway's job.


    Uninstall

    AI-assisted

    Stop and disable the hermesclaw systemd service.  Restore openclaw-weixin
    account .bak files.  Remove WEIXIN_BASE_URL override from ~/.hermes/.env
    (or restore .bak).  Optionally remove ~/hermesclaw directory.
    

    Manual

    sudo systemctl stop hermesclaw
    sudo systemctl disable hermesclaw
    sudo rm -f /etc/systemd/system/hermesclaw.service
    sudo systemctl daemon-reload
    
    # Restore openclaw-weixin configs:
    find "$HOME" -maxdepth 5 -name "*.json.bak" -path "*/openclaw-weixin/accounts/*" \
      -exec sh -c 'for f; do cp "$f" "${f%.bak}"; done' sh {} +
    
    # Restore Hermes .env:
    [ -f "$HOME/.hermes/.env.bak" ] && cp "$HOME/.hermes/.env.bak" "$HOME/.hermes/.env"
    
    rm -rf "$HOME/hermesclaw"
    

    Star History


    Changelog

    v0.4.0

    • Feature: Native macOS support — The install.sh script now supports macOS (Darwin) out-of-the-box by leveraging launchd instead of failing on the missing systemctl. It automatically creates, loads, and manages the background service via ~/Library/LaunchAgents/com.hermesclaw.plist (Thanks @unliftedq for the feature request).

    v0.3.6

    • Fix: macOS install failure — mapfile: command not found — macOS ships with bash 3.2 which lacks the mapfile builtin (added in bash 4). All 3 occurrences replaced with portable while IFS= read -r loops, making the installer work on macOS out of the box.
    • Fix: curl | bash silent abort — With set -euo pipefail, bare read calls returned non-zero on EOF when stdin was a pipe, causing the installer to exit before any ${REPLY:-Y} default was evaluated. The installer now detects a non-tty stdin and redirects interactive prompts to /dev/tty so users can still answer them; if /dev/tty is also unavailable (CI / Docker) it falls back to auto-yes. All three prompt calls also have || VAR="" guards as defence-in-depth.
    • 5 new regression tests — tests/test_install_sh.py covers mapfile absence, bash syntax, read guards, tty detection, and non-interactive stdin.
    • Thanks to @ShxxxNewBee, @siasbaily, and @csloz for reporting and diagnosing these issues 🙏

    v0.3.0

    • OpenCode ACP bridge — New OpenCodeBridge + ACPSession classes implement JSON-RPC 2.0 over NDJSON for opencode acp subprocess. Per-user sessions with automatic reconnect.
    • /opencode command — Route messages to OpenCode only.
    • /three command — Route messages to all three agents simultaneously (Hermes + OpenClaw + OpenCode).
    • "Not installed" detection — If opencode binary is not found, /opencode and /three show a helpful install hint instead of crashing.
    • Tagging in THREE mode — Proxy tags Hermes/OpenClaw replies; OpenCode worker tags its own replies with [OpenCode].
    • Dead subprocess recovery — If OpenCode exits mid-session, pending prompts unblock immediately with an error instead of hanging for the full 120 s timeout.
    • Headless ACP permissions — OpenCode permission prompts are handled automatically with OPENCODE_PERMISSION_STRATEGY=allow_always, preventing WeChat replies from hanging on non-interactive tool approvals. The OpenCode global config (~/.config/opencode/opencode.json) is also set to "permission": "allow" by the installer so tool calls are approved at the OpenCode level without round-tripping through ACP.
    • OpenCode typing indicator — OpenCode mode now sends and keeps alive the WeChat typing indicator while the ACP agent is working.
    • Non-interactive installer — bash install.sh -y (or HERMESCLAW_YES=1 bash install.sh) skips all confirmation prompts; OpenCode appears in the discovery summary.
    • Installer git pull — Re-running install.sh on an existing install now pulls the latest code before continuing.
    • 117 tests — Expanded route matrix covers every command route across text, voice, image, video, and file payloads, plus ACP permissions, OpenCode media prompts, dead-subprocess recovery, and THREE mode.

    v0.2.1 (2026-04-12)

    • Fix: Hermes message splitting — The installer now offers to patch Hermes Agent's weixin.py to disable newline-based message splitting during installation (recommended, default Yes). This ensures long replies are sent as single messages instead of being split by paragraphs. Existing users can run bash fix_hermes_splitting.sh manually.

    v0.2.0

    • Complete rewrite: dual-proxy gateway architecture.
    • Removed ~400 lines of AES/CDN media processing.
    • 59 pytest tests (core, proxy, recovery).
    • Smart 8-case detection installer.
    • Fix: Hermes "Response formatting failed" — Proxy servers now use ThreadingHTTPServer instead of single-threaded HTTPServer.
    • Fix: OpenClaw ENOENT on media files — Installer now creates symlink for media path mismatch.
    • Improved error handling — BrokenPipeError now caught and logged as DEBUG.

    License

    MIT — by @AaronWong1999


    Credits

    HermesClaw is a community bridge. It is not affiliated with NousResearch or OpenClaw.

    If you use Claude Code and Codex, you might also like ccx, my newer project: hand a task between Claude Code and Codex with the full context, so a usage limit doesn't stop your work.