From 23270d41b947acec24bc7a022e7c004dc2a7f23c Mon Sep 17 00:00:00 2001 From: teknium1 Date: Tue, 10 Mar 2026 20:45:18 -0700 Subject: [PATCH] feat: add --quiet/-Q flag for programmatic single-query mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds -Q/--quiet to `hermes chat` for use by external orchestrators (Paperclip, scripts, CI). When combined with -q, suppresses: - Banner and ASCII art - Spinner animations - Tool preview lines (┊ prefix) Only outputs: - The agent's final response text - A parseable 'session_id: ' line for session resumption Usage: hermes chat -q 'Do something' -Q Used by: Paperclip adapter (@nousresearch/paperclip-adapter-hermes) --- cli.py | 22 ++++++++++++++++++---- hermes_cli/main.py | 6 ++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cli.py b/cli.py index fc1f9f82..aa98de5a 100755 --- a/cli.py +++ b/cli.py @@ -4356,6 +4356,7 @@ def main( base_url: str = None, max_turns: int = None, verbose: bool = False, + quiet: bool = False, compact: bool = False, list_tools: bool = False, list_toolsets: bool = False, @@ -4498,10 +4499,23 @@ def main( # Handle single query mode if query: - cli.show_banner() - cli.console.print(f"[bold blue]Query:[/] {query}") - cli.chat(query) - cli._print_exit_summary() + if quiet: + # Quiet mode: suppress banner, spinner, tool previews. + # Only print the final response and parseable session info. + cli.tool_progress_mode = "off" + cli.agent = cli._init_agent() + if cli.agent: + cli.agent.quiet_mode = True + result = cli.agent.run_conversation(query) + response = result.get("final_response", "") if isinstance(result, dict) else str(result) + if response: + print(response) + print(f"\nsession_id: {cli.session_id}") + else: + cli.show_banner() + cli.console.print(f"[bold blue]Query:[/] {query}") + cli.chat(query) + cli._print_exit_summary() return # Run interactive mode diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 21b4ec89..031acba7 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -486,6 +486,7 @@ def cmd_chat(args): "provider": getattr(args, "provider", None), "toolsets": args.toolsets, "verbose": args.verbose, + "quiet": getattr(args, "quiet", False), "query": args.query, "resume": getattr(args, "resume", None), "worktree": getattr(args, "worktree", False), @@ -1918,6 +1919,11 @@ For more help on a command: action="store_true", help="Verbose output" ) + chat_parser.add_argument( + "-Q", "--quiet", + action="store_true", + help="Quiet mode for programmatic use: suppress banner, spinner, and tool previews. Only output the final response and session info." + ) chat_parser.add_argument( "--resume", "-r", metavar="SESSION_ID",