From 9f231dae564d3193b7e16a1c75e7c702b2508d33 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 16 Apr 2026 06:07:14 -0700 Subject: [PATCH] fix: quiet mode (-Q) outputs only raw response text (#11024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues when running hermes chat -Q -q: 1. The streaming 'Hermes' response box was rendering to stdout because stream_delta_callback was wired during _init_agent() before quiet_mode was set. This caused the response to appear twice — once in the styled box and once as plain text. 2. session_id was printed to stdout, making piped output unusable. Fix: null out stream_delta_callback and tool_gen_callback after agent init in the quiet-mode path, and redirect session_id to stderr. Now 'hermes chat -Q -q "prompt" | cat' produces only the answer text. session_id is still available on stderr for scripts that need it. Reported by @nixpiper on X. --- cli.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index b9b1117254..aaed32e153 100644 --- a/cli.py +++ b/cli.py @@ -10039,6 +10039,11 @@ def main( ): cli.agent.quiet_mode = True cli.agent.suppress_status_output = True + # Suppress streaming display callbacks so stdout stays + # machine-readable (no styled "Hermes" box, no tool-gen + # status lines). The response is printed once below. + cli.agent.stream_delta_callback = None + cli.agent.tool_gen_callback = None result = cli.agent.run_conversation( user_message=effective_query, conversation_history=cli.conversation_history, @@ -10046,7 +10051,8 @@ def main( response = result.get("final_response", "") if isinstance(result, dict) else str(result) if response: print(response) - print(f"\nsession_id: {cli.session_id}") + # Session ID goes to stderr so piped stdout is clean. + print(f"\nsession_id: {cli.session_id}", file=sys.stderr) # Ensure proper exit code for automation wrappers sys.exit(1 if isinstance(result, dict) and result.get("failed") else 0)