hermes - 💡(How to fix) Fix Memory: OpenClaw fleet respawned per OpenClaw-as-tool invocation + orphan claude mcp serve after session end [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Two related memory inefficiencies observed in a stable Hermes 0.10.0 (2026.4.16) WSL2 deployment where Hermes and OpenClaw are configured to mutually expose each other as tools:

  1. Full OpenClaw MCP child fleet (openclaw + openclaw-mcp) is respawned per OpenClaw-as-tool invocation, even when an OpenClaw gateway daemon is already running locally on its known port.
  2. Orphan claude mcp serve processes (spawned via /root/.hermes/node/bin/claude mcp serve) can survive session/turn end and get reparented to systemd --user, never reaped.

Root Cause

Two related memory inefficiencies observed in a stable Hermes 0.10.0 (2026.4.16) WSL2 deployment where Hermes and OpenClaw are configured to mutually expose each other as tools:

  1. Full OpenClaw MCP child fleet (openclaw + openclaw-mcp) is respawned per OpenClaw-as-tool invocation, even when an OpenClaw gateway daemon is already running locally on its known port.
  2. Orphan claude mcp serve processes (spawned via /root/.hermes/node/bin/claude mcp serve) can survive session/turn end and get reparented to systemd --user, never reaped.

Fix Action

Fixed

Code Example

Hermes gateway (~255 MB persistent)
  ├── claude mcp serve              (~193 MB)
  └── openclaw → openclaw-mcp       (~270 MB)   ← spawned per OpenClaw-as-tool invocation

Hermes claude-shim
  └── claude (session)
        └── [via OpenClaw tool] openclaw → openclaw-mcp   (another ~270 MB)

---

init(1) ─── systemd --user (329)
              ├── claude mcp serve (PID A)~192 MB RSS
              └── claude mcp serve (PID B)~192 MB RSS
RAW_BUFFERClick to expand / collapse

Summary

Two related memory inefficiencies observed in a stable Hermes 0.10.0 (2026.4.16) WSL2 deployment where Hermes and OpenClaw are configured to mutually expose each other as tools:

  1. Full OpenClaw MCP child fleet (openclaw + openclaw-mcp) is respawned per OpenClaw-as-tool invocation, even when an OpenClaw gateway daemon is already running locally on its known port.
  2. Orphan claude mcp serve processes (spawned via /root/.hermes/node/bin/claude mcp serve) can survive session/turn end and get reparented to systemd --user, never reaped.

Environment

  • Hermes 0.10.0 (2026.4.16)
  • Ubuntu 24.04 inside WSL2 on Windows
  • OpenClaw 2026.5.7 also running locally; both wired to expose each other as MCP tools
  • claude-cli shim backend at /root/.hermes/node/bin/claude

Observation 1 — fleet respawn per invocation

Hermes gateway (~255 MB persistent)
  ├── claude mcp serve              (~193 MB)
  └── openclaw → openclaw-mcp       (~270 MB)   ← spawned per OpenClaw-as-tool invocation

Hermes claude-shim
  └── claude (session)
        └── [via OpenClaw tool] openclaw → openclaw-mcp   (another ~270 MB)

Each scope where Hermes calls OpenClaw-as-tool spawns a fresh openclaw + openclaw-mcp pair, despite a long-running OpenClaw gateway daemon already being available locally on port 18789. The OpenClaw gateway exposes its MCP surface over that port; Hermes could attach to it rather than respawning the binary.

Cost: ~270 MB per invocation level. With nested cross-agent calls, this compounds.

Observation 2 — orphan claude mcp serve

Process tree fragment after an OpenClaw session ends:

init(1) ─── systemd --user (329)
              ├── claude mcp serve (PID A)   ← ~192 MB RSS
              └── claude mcp serve (PID B)   ← ~192 MB RSS

Originally spawned via the Hermes-bundled claude binary path (/root/.hermes/node/bin/claude mcp serve). Original parent exited; children reparented to systemd --user and are not reaped.

Both processes started within 3 s of each other, runtime 16+ min at observation time, and are not attached to any current session.

Suggested fixes

  1. Detect and reuse a running OpenClaw gateway. When Hermes invokes OpenClaw-as-tool, probe for an existing gateway on its known port before spawning a fresh openclaw instance. Fall back to spawn only if none is running.
  2. Reap children of claude mcp serve invocations on session end. Track PIDs of spawned MCP serve workers and SIGTERM them when the originating Hermes session exits. Add a startup sweep that detects orphans (parent = systemd --user, command matches <hermes_install>/node/bin/claude mcp serve) and reaps them.

Impact

Per active session that crosses agent boundaries: ~270 MB unnecessary OpenClaw-child overhead. Multiplied by orphan misses, observed steady-state impact was ~1 GB on this side of the bridge.

Cross-reference

Mirror issue filed against openclaw/openclaw covering the symmetric case (OpenClaw invoking Hermes-as-tool): will link once filed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING