HermesClaw: Run Hermes Agent, OpenClaw, and OpenCode on One WeChat Account

Connects Hermes Agent, OpenClaw, and OpenCode to one WeChat account via iLink proxy.

Community Bridgesintermediate9 min read
Author
AaronWong1999
Stars
696
Language
Python
License
MIT
Upstream updated
2026-06-15
HermesClaw: Run Hermes Agent, OpenClaw, and OpenCode on One WeChat Account

HermesClaw Reference Guide

Overview

HermesClaw is a lightweight Python proxy that enables running Hermes Agent, OpenClaw, and OpenCode simultaneously on a single WeChat account. It resolves iLink connection conflicts that occur when multiple agents attempt to poll the same WeChat session directly. By acting as a sole iLink poller and routing traffic through local proxy ports, HermesClaw prevents 403 errors and token conflicts, allowing you to switch between agents on the fly.

This guide covers all capabilities, installation procedures, configuration parameters, constraints, and failure modes. It is intended for system administrators and developers who need to run multiple AI agents on one WeChat account for debugging, complementary tasks, or voice-driven Vibe Coding via OpenCode.

When to Use HermesClaw

Use HermesClaw in the following scenarios:

  • You want to run multiple AI agents (Hermes Agent, OpenClaw, OpenCode) on the same WeChat account without encountering iLink 403 errors.
  • You need to switch between agents using commands like /hermes, /openclaw, /opencode, /both, or /three.
  • You want to use OpenCode's Vibe Coding via WeChat voice messages.
  • You need to run agents concurrently for debugging or complementary tasks.

Capabilities

HermesClaw provides the following capabilities:

  • Runs Hermes Agent, OpenClaw, and OpenCode on one WeChat account.
  • Routes traffic via local proxies to prevent iLink 403 errors.
  • Supports voice-driven Vibe Coding via OpenCode integration.
  • Switches between agents with commands: /hermes, /openclaw, /opencode, /both, /three.
  • Forwards raw iLink protocol messages (text, voice transcription, images, video, files) to each gateway.
  • Provides a sole iLink poller to avoid token conflicts.
  • Includes an auto-detecting installer script.
  • Supports non-interactive/automated installation with -y flag or HERMESCLAW_YES=1 environment variable.
  • Detects installed gateways (OpenClaw, Hermes Agent) and extracts iLink token.
  • Patches gateway configurations to use local proxy ports.
  • Detects OpenCode CLI and sets up ACP bridge.
  • Creates systemd service (Linux) or launchd service (macOS).
  • Offers optional patch to disable newline-based message splitting in Hermes Agent.
  • Supports /whoami command to show current route and status.
  • In /both and /three modes, prefixes replies with [Hermes Agent], [OpenClaw], [OpenCode] for attribution.
  • Handles dead subprocess recovery for OpenCode.
  • Supports headless ACP permissions with OPENCODE_PERMISSION_STRATEGY=allow_always.
  • Sends and keeps alive WeChat typing indicator for OpenCode mode.
  • Re-running install.sh on existing install pulls latest code.
  • Uninstall procedure restores original configurations and removes service.

Prerequisites

Before installing HermesClaw, ensure the following are in place:

  • At least one of: OpenClaw + clawbot (openclaw-weixin) installed and logged into WeChat, OR Hermes Agent + WeChat gateway installed with hermes gateway configured.
  • python3 and pip3 installed.
  • systemd (Linux) or launchd (macOS) for background service.
  • For OpenCode: Node.js and npm to install opencode-ai globally.
  • Internet access to download install script and dependencies.

Installation Procedures

Quick Install

  1. Ensure at least one of OpenClaw+clawbot or Hermes Agent+WeChat gateway is installed and logged into WeChat.
  2. Run the following command:
    curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | bash
    
  3. For non-interactive install, use one of:
    curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | HERMESCLAW_YES=1 bash
    
    Or:
    bash install.sh -y
    
  4. The installer performs the following actions:
    • Detects installed gateways.
    • Extracts iLink token from gateway account files.
    • Patches openclaw-weixin baseUrl to http://127.0.0.1:19999.
    • Patches Hermes WEIXIN_BASE_URL to http://127.0.0.1:19998.
    • Detects OpenCode CLI (optional).
    • Installs Python dependencies (requests, python-dotenv).
    • Creates OpenClaw media symlink.
    • Sets up hermesclaw systemd service.
  5. After install, restart your gateways and send /whoami in WeChat to verify.

AI-Assisted Install

  1. On the target machine, run:
    curl -fsSL https://raw.githubusercontent.com/AaronWong1999/hermesclaw/main/install.sh | bash
    
  2. Read README.md and install.sh from the installed HermesClaw directory.
  3. Detect whether Hermes Agent, OpenClaw, their WeChat gateways, python3, pip3, and systemd are present. At least one gateway must be configured.
  4. Extract the iLink token from the first available gateway account file.
  5. Patch openclaw-weixin baseUrl to http://127.0.0.1:19999 and Hermes WEIXIN_BASE_URL to http://127.0.0.1:19998.
  6. Install dependencies and systemd service.
  7. Detect OpenCode CLI: run command -v opencode or check ~/.npm-global/bin/opencode. If not found, suggest installing with:
    npm install -g opencode-ai
    
  8. 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).
  9. If Hermes Agent WeChat gateway is detected, offer to patch weixin.py to disable newline-based message splitting (recommended). Accept this patch so long replies are sent as single messages. The fix script is at fix_hermes_splitting.sh.
  10. Restart gateways. Verify /whoami works in WeChat.

OpenCode Setup

  1. Install OpenCode CLI:
    npm install -g opencode-ai
    
  2. Set OPENCODE_CMD in .env (installer auto-detects it).
  3. Use /opencode or /three commands once OpenCode is installed.

Uninstall (AI-Assisted)

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

Uninstall (Manual)

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

Configuration Parameters

The following parameters can be set in the .env file or as environment variables:

  • HERMESCLAW_YES: Environment variable to skip all confirmation prompts during install. Optional, for non-interactive installs.
  • -y flag: Command-line flag for install.sh to skip all confirmation prompts. Optional, for non-interactive installs.
  • OPENCODE_CMD: Path to the opencode CLI binary, set in .env file. Optional, enables /opencode and /three commands.
  • OPENCODE_MODEL: Model to use for OpenCode; defaults to opencode/minimax-m2.5-free. Optional, defaults to free model.
  • OPENCODE_PERMISSION_STRATEGY: Strategy for handling OpenCode permission prompts; set to allow_always for headless operation. Optional, defaults to allow_always in installer.

Constraints and Caveats

  • HermesClaw is a thin Python proxy (~500 lines); it does not process media, call agent APIs, or touch agent memory.
  • Each gateway handles its own media decryption, markdown formatting, and AI interaction natively.
  • At least one gateway (OpenClaw+clawbot or Hermes Agent+WeChat gateway) must be installed and logged into WeChat before installing HermesClaw.
  • Default route is Hermes.
  • In /both and /three modes, proxy replies are prefixed with [Hermes Agent], [OpenClaw], [OpenCode] for attribution.
  • OpenCode connects via its native ACP subprocess protocol; no proxy port needed.
  • HermesClaw forwards raw iLink protocol messages; it does not do AES decryption, CDN downloads, or media re-encoding.
  • macOS support uses launchd instead of systemd; install.sh creates ~/Library/LaunchAgents/com.hermesclaw.plist.
  • macOS ships with bash 3.2 which lacks mapfile; installer uses portable while IFS= read -r loops.
  • With set -euo pipefail, bare read calls can return non-zero on EOF when stdin is a pipe; installer detects non-tty stdin and redirects prompts to /dev/tty, falling back to auto-yes if /dev/tty unavailable.
  • Re-running install.sh on an existing install pulls the latest code before continuing.
  • If opencode binary is not found, /opencode and /three show a helpful install hint instead of crashing.
  • OpenCode permission prompts are handled automatically with OPENCODE_PERMISSION_STRATEGY=allow_always to prevent hanging.
  • HermesClaw is not affiliated with NousResearch or OpenClaw; it is a community bridge.

Failure Modes

  • iLink 403 errors if both gateways try to poll simultaneously without HermesClaw.
  • Token conflict causing dropped messages if multiple gateways connect directly to iLink.
  • OpenCode subprocess exiting mid-session causing pending prompts to hang; HermesClaw unblocks with error instead of waiting 120s timeout.
  • Hermes Agent message splitting (long replies split by paragraphs) if weixin.py patch is not applied.
  • OpenClaw ENOENT on media files if symlink is not created (installer creates it).
  • macOS install failure due to missing mapfile builtin (fixed in v0.3.6).
  • curl | bash silent abort due to bare read calls with set -euo pipefail (fixed in v0.3.6).
  • BrokenPipeError caught and logged as DEBUG (improved error handling).

Examples

Switching Agents

Send the following commands in WeChat to change routing:

  • /hermes - Route to Hermes only.
  • /openclaw - Route to OpenClaw only.
  • /opencode - Route to OpenCode only.
  • /both - Route to Hermes and OpenClaw.
  • /three - Route to all three agents.

Voice-Driven Vibe Coding

Speak a voice message in WeChat. HermesClaw forwards the transcription to OpenCode for processing, enabling voice-driven Vibe Coding.

Before and After

Without HermesClaw, Hermes and OpenClaw each work individually but cannot run on the same account due to token conflict and 403 errors. With HermesClaw, all three agents work simultaneously on one account, and OpenCode gains WeChat support via the ACP bridge.

Additional Notes

The year 2026 is referenced in the project's version history as a milestone for future development. The command -v opencode command is used by the installer to detect the OpenCode CLI binary during setup.

Sources & References

This page was researched from 2 independent sources, combined and verified for completeness.

Newsletter

The #1 AI Newsletter

The most important ai updates, guides, and fixes — one weekly email.

No spam, unsubscribe anytime. Privacy policy

Other Hermes Agent integrations