Hermes Forwards Unbounded Shell Output to Provider — 150KB+ Payloads, No Truncation

#50807 — P2: Shell tool output sent to provider with no size bounding, wasting context window and inflating API costs

Issue Summary

Hermes Agent forwards shell tool output back to the provider without any size bounding. A standalone Docker-based reproducer shows 150,402 bytes of tool-result payload submitted to the provider — nearly 20x the 8,192 byte expected limit. Every shell command that produces substantial output triggers this — cat, find, grep, build logs, test output.

Reproducer

Self-contained Docker + Python script at gist.github.com/N0zoM1z0 — prints 100,000 characters via shell, verifies Hermes submits >8,192 bytes to provider. Confirmed against [email protected] (npm latest).

Reproduction steps:

  1. Run the Docker-based reproducer from the linked gist
  2. Execute a shell command that outputs 100,000 characters
  3. Observe Hermes submits 150,402 bytes of tool-result payload to the provider
  4. Compare against expected 8,192 byte limit — 18.4x over the limit

Why It Matters

Context Window Waste

Every oversized shell output consumes provider context window that should be reserved for reasoning, planning, and user interaction. A single cat of a log file can consume the entire window.

Observed payload150,402 bytes
Expected limit8,192 bytes

API Cost Inflation

Unbounded tool output directly increases per-request token counts. For providers that charge per-token, this means paying for 18x more tool-result tokens than necessary on every shell command.

Overhead18.4x

Downstream Failures

Oversized payloads can cause provider-side truncation, malformed responses, or outright request rejection. The agent may receive garbled or missing context and make decisions on incomplete data.

Risk levelHigh

Silent Degradation

No error is raised. The agent doesn't know it's wasting context. The user doesn't know they're paying for garbage. The failure is invisible until costs are audited or context-dependent errors surface.

Detectable?No

Proposed Fix

Bound/truncate oversized tool output before provider submission, surface clear local error when output exceeds bound. The fix should:

  • Enforce a configurable maximum tool-result payload size (default ~8KB)
  • Truncate with a clear marker: "[Output truncated: 142,210 bytes omitted]"
  • Surface a local warning when truncation occurs
  • Apply to all tool outputs, not just shell — any tool can produce unbounded output

Comparison: Gobii's Approach

Gobii Managed enforces tool-output bounding at the platform level. All tool results are truncated to a configurable maximum before being injected into the context window. Truncation is logged with byte counts, and agents are informed of truncation so they can request specific data if needed. This prevents context-window exhaustion, controls API costs, and ensures agents operate on bounded, manageable data.

Hermes has no equivalent bounding — tool output is forwarded raw to the provider regardless of size.

Source Evidence

GitHub Issue: NousResearch/hermes-agent#50807

Opened: June 22, 2026 | Reporter: @N0zoM1z0 | Labels: P2, comp/agent, tool/terminal, type/bug

Hermes: v0.17.0 | Environment: Linux x86_64 Docker

Reproducer: gist.github.com/N0zoM1z0