From df1bbdf92471977901af19651dca5c578bc745d9 Mon Sep 17 00:00:00 2001 From: terp Date: Wed, 27 May 2026 12:32:31 -0400 Subject: [PATCH] docs: fix two code example accuracy issues Re-apply the valid parts of #4 on top of current main: - part6: the fallback branch in the compression example now assigns compressed_context = messages_to_compress instead of returning undefined original_context, matching the surrounding assignment style. - part11: the gateway health-check script now uses df -Ph so awk NR==2 is stable even when long device names would make df -h wrap lines. Intentionally does not apply #4's part7 change. Current Hermes source (/home/terp/.hermes/hermes-agent/tools/session_search_tool.py) explicitly states that session_search has no LLM calls and no summary LLM path, so the existing no-API-call wording remains accurate. --- part11-gateway-recovery.md | 2 +- part6-context-compression.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/part11-gateway-recovery.md b/part11-gateway-recovery.md index 83af1d9..8f9f1c1 100644 --- a/part11-gateway-recovery.md +++ b/part11-gateway-recovery.md @@ -187,7 +187,7 @@ if ! curl -s http://localhost:8642/health > /dev/null 2>&1; then fi # Disk space OK? -USAGE=$(df -h ~/.hermes | awk 'NR==2 {print $5}' | tr -d '%') +USAGE=$(df -Ph ~/.hermes | awk 'NR==2 {print $5}' | tr -d '%') if [ "$USAGE" -gt 90 ]; then echo "WARNING: Disk usage at ${USAGE}%" exit 1 diff --git a/part6-context-compression.md b/part6-context-compression.md index 7639968..48ba380 100644 --- a/part6-context-compression.md +++ b/part6-context-compression.md @@ -47,7 +47,7 @@ try: compressed_context = summary except Exception as e: logger.warning(f"Context compression failed: {e}, preserving original context") - return original_context # Don't compress, don't lose data + compressed_context = messages_to_compress # Don't compress, don't lose data ``` **The rule:** If compression can't succeed, keep the uncompressed context. A slower response is better than a wrong one.