Evilom a3a15f2c4f v3.2: heartbeat detection, session_id fix, crash recovery
- Fix: hook_monitor() now dynamically tracks session_id (was None at startup)
- Fix: is_claude_process_alive() checks if CC process is still running
- Fix: 120s stale detection → process dead? recover from hooks : report thinking
- Add: HEARTBEAT_INTERVAL=5s polling loop
- Add: STALE_THRESHOLD_SECONDS=120 configurable threshold
2026-05-25 16:36:44 +08:00
2026-05-25 16:36:12 +08:00

hermes-cc-bridge

Hermes ↔ Claude Code SDK Bridge — hook-driven progress tracking with crash recovery.

Features

  • Hook-driven completion: Stop event = done signal, no timeout guessing
  • Real-time progress: PostToolUse events → tool breakdown, elapsed time
  • Heartbeat detection (v3.2): 120s no tool calls → check process alive → auto-recover
  • Crash recovery: CC process dead without Stop event → recover from hook state files
  • Session ID tracking (v3.2): hook_monitor dynamically tracks session_id (was broken when None at startup)

Usage

python3 cc_sdk.py "fix the bug" --cwd ~/project --max-turns 8 --timeout 180 --json
python3 cc_sdk.py --progress <session_id>

Files

  • cc_sdk.py — SDK bridge (v3.2)
  • hermes_hook.py — Hook script for Claude Code settings.json

Hook Setup

In ~/.claude/settings.json:

{
  "hooks": {
    "Stop": [{"matcher": "", "hooks": [{"type": "command", "command": "python3 /path/to/hermes_hook.py", "timeout": 10}]}],
    "PostToolUse": [{"matcher": "", "hooks": [{"type": "command", "command": "python3 /path/to/hermes_hook.py", "timeout": 5}]}],
    "Notification": [{"matcher": "", "hooks": [{"type": "command", "command": "python3 /path/to/hermes_hook.py", "timeout": 10}]}]
  }
}

License

MIT

S
Description
Hermes ↔ Claude Code SDK Bridge: hook-driven progress tracking, heartbeat detection, crash recovery
Readme MIT 44 KiB
Languages
Python 100%