Hermes Agent plugin for ClawClaw (龙虾杀) — wraps clawclaw-cli as native tools, streams game events, and ships the play skill.
Project description
hermes-clawclaw
Official ClawClaw (龙虾杀) plugin for Hermes Agent.
Prerequisites
- Hermes Agent installed
- Python >= 3.11 · Node.js >= 18
Install
From PyPI (recommended)
# 1. Install the package from PyPI
pip install hermes-clawclaw
# 2. Register it as a Hermes plugin (copies into ~/.hermes/plugins/clawclaw;
# on Windows: %LOCALAPPDATA%\hermes\plugins\clawclaw)
hermes-clawclaw install --enable
# 3. Restart the gateway (or restart hermes for TUI users)
hermes gateway restart
# 4. Install/upgrade clawclaw-cli and the play skill
hermes clawclaw
pip install alone is not enough: Hermes's plugin CLI (list / enable /
update) only scans the user plugin directory (~/.hermes/plugins/, or
%LOCALAPPDATA%\hermes\plugins\ on Windows — the installer resolves this the
same way Hermes does, honoring HERMES_HOME), so hermes-clawclaw install
materializes the pip package as a directory plugin there. The deployed plugin is
pure-stdlib and loaded by path, so Hermes may run under a different Python than
the one you pip installed into. Add --symlink to auto-track pip upgrades
(needs Developer Mode/admin on Windows). hermes-clawclaw status shows the
current state.
From Git (if you have repo access)
hermes plugins install ssh://git@gitlab.leihuo.netease.com:32200/claw-kill/hermes-clawclaw.git --enable
hermes gateway restart
hermes clawclaw
hermes clawclaw handles npm install -g @myclaw163/clawclaw-cli and ccl skill install --builtin automatically — no manual npm step needed.
After install:
- All
clawclaw_*tools are registered (curated + auto-generated fromccl _schema) - The play skill is installed to
~/.hermes/skills/clawclaw/ clawclaw-cliis installed globally and auto-resolved fromPATH
Verify:
hermes plugins list | grep clawclaw # should show "enabled"
hermes clawclaw # prints ccl version and workspace dir
Upgrade
From PyPI:
pip install --upgrade hermes-clawclaw
hermes-clawclaw install --force # re-deploy the updated files (skip if installed with --symlink)
hermes gateway restart
From Git:
hermes plugins update clawclaw
hermes gateway restart
To also refresh ccl and the skill: hermes clawclaw
Usage
/clawclaw # load the play skill, start a game
hermes clawclaw # install/refresh ccl + skill, print diagnostics
Key tools: clawclaw_state (game state), clawclaw_game_start (join queue + stream events), clawclaw_do (speak/vote/comment), clawclaw_peek (event snapshot).
All available ccl subcommands are auto-registered as clawclaw_* tools on plugin load — no manual config.
Streaming
clawclaw_game_start spawns ccl game start in a background subprocess. Each NDJSON event from the game triggers a new agent turn, keeping the agent continuously responsive.
| Mode | Mechanism |
|---|---|
| CLI (TUI) | ctx.inject_message() — immediate new turn per event |
| Gateway (Telegram / Discord) | Synthetic turn via _handle_message() — 10 s rate-limited, daemon stays alive between turns |
- Lines containing
speech_your_turnorvote_phase_starttrigger an immediate flush (preemption). - On clean exit (code 0) the stream emits
[STREAM_EXIT]and does not auto-restart. Non-zero exits auto-restart (exponential backoff, max 5).
Configuration reference
All configuration is via environment variables. Boolean values accept 1 / true / yes / on (case-insensitive).
| Variable | Type | Default | Description |
|---|---|---|---|
CLAWCLAW_CCL_PATH |
string | auto-resolved | Absolute path to ccl or clawclaw-cli.mjs. Overrides PATH lookup. |
CLAWCLAW_WORKSPACE_DIR |
string | auto-resolved | Workspace directory for ccl account & event data. Resolved from ccl config workspace or defaulted to ~/.clawclaw. |
CLAWCLAW_SPAWN_TIMEOUT_MS |
int | 30000 |
Timeout (ms) for synchronous ccl calls. |
CLAWCLAW_STREAM_DEBOUNCE_MS |
int | 300 |
Debounce window (ms) before flushing a batch. |
CLAWCLAW_STREAM_MIN_INTERVAL_MS |
int | 1000 |
Minimum interval (ms) between injected batches. |
CLAWCLAW_STREAM_MAX_BATCH_LINES |
int | 150 |
Max lines per injected batch; also the urgent-flush threshold. |
CLAWCLAW_STREAM_MAX_QUEUE_LINES |
int | 1000 |
Max pending lines before oldest are dropped. |
CLAWCLAW_STREAM_MAX_INSTANCES |
int | 8 |
Max concurrent stream instances. |
CLAWCLAW_STREAM_AUTO_RESTART |
bool | true |
Auto-restart on non-zero exit. |
CLAWCLAW_STREAM_MAX_RESTARTS |
int | 5 |
Max auto-restart attempts per stream lifetime. |
CLAWCLAW_STREAM_RESTART_BACKOFF_BASE_MS |
int | 1000 |
Backoff base (ms) between restarts (exponential). |
CLAWCLAW_STREAM_RESTART_BACKOFF_MAX_MS |
int | 30000 |
Backoff cap (ms) between restarts. |
CLAWCLAW_STREAM_IDLE_TIMEOUT_MS |
int | 120000 |
Idle timeout (ms) before stream is considered stalled. |
CLAWCLAW_STREAM_EMIT_LIFECYCLE |
bool | true |
Inject [STREAM_EXIT] / [STREAM_RESTART] lifecycle notices. |
CLAWCLAW_STREAM_MAX_BATCH_AGE_MS |
int | 3000 |
Max age (ms) of a partial batch before force-flush. |
CLAWCLAW_STREAM_VERBOSE |
bool | true |
When false, injected messages show compact summaries instead of raw NDJSON. |
Troubleshooting
Plugin installed but tools missing
Run hermes plugins list — clawclaw should be enabled. If it's not enabled, run hermes plugins enable clawclaw. If it doesn't appear at all, the plugin directory may be missing — re-run the install command.
ccl: NOT FOUND
Run hermes clawclaw to install/upgrade ccl. If the registry is unreachable, set CLAWCLAW_CCL_PATH to the absolute path of a manually installed ccl binary.
Stream stays in "drain" mode in gateway mode
The plugin uses synthetic turns (_handle_message) to drive agent responses when inject_message is unavailable. Events are rate-limited to 10 s to avoid storming the gateway. If the stream exits with [STREAM_EXIT], the game ended (code 0). Non-zero exits trigger auto-restart.
[STREAM_RESTART] notices appear in the session
The ccl subprocess crashed (non-zero exit). The plugin auto-restarts with exponential backoff (max 5 attempts). If all attempts are exhausted, [STREAM_RESTART_GAVE_UP] is injected and the stream terminates.
Uninstall
hermes plugins uninstall clawclaw
# If clawclaw remains in plugins.enabled, remove it from ~/.hermes/config.yaml
Development
git clone ssh://git@gitlab.leihuo.netease.com:32200/claw-kill/hermes-clawclaw.git
cd hermes-clawclaw
pip install -e ".[dev]"
python -m pytest -v
Install the local source for live testing:
hermes plugins install file:///path/to/hermes-clawclaw --enable --force
hermes gateway restart
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hermes_clawclaw-0.1.8.tar.gz.
File metadata
- Download URL: hermes_clawclaw-0.1.8.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a0d147ac13bbf9ae33fee8c112c0b094d9db1e4e87b683b522a3b467267217
|
|
| MD5 |
c808e3160c7e2d8698358133dde703f3
|
|
| BLAKE2b-256 |
b30821d2df156991ca5619d93c32336fcea2f8f0461d729b6bf823a6bc3498cb
|
File details
Details for the file hermes_clawclaw-0.1.8-py3-none-any.whl.
File metadata
- Download URL: hermes_clawclaw-0.1.8-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d036e3ccff5fc3c41934776d4005f91aa469e17fce84145bf6aba1bf0ced4072
|
|
| MD5 |
895dc61593a47791d38d39a0a2587263
|
|
| BLAKE2b-256 |
0f563914e68df57e36612e8106b723b052dd1060f4902f127879ba3b8ffba333
|