From 7f670a06cff300ab0cec44c2dade9fe29fcd7a49 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 31 Mar 2026 12:10:12 -0700 Subject: [PATCH] feat: add --max-turns CLI flag to hermes chat Exposes the existing max_turns parameter (cli.py main()) as a CLI flag so programmatic callers (Paperclip adapter, scripts) can control the agent's tool-calling iteration limit without editing config.yaml. Priority chain unchanged: CLI flag > config agent.max_turns > env HERMES_MAX_ITERATIONS > default 90. --- hermes_cli/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 315e0f974..a420aafcc 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -643,6 +643,7 @@ def cmd_chat(args): "worktree": getattr(args, "worktree", False), "checkpoints": getattr(args, "checkpoints", False), "pass_session_id": getattr(args, "pass_session_id", False), + "max_turns": getattr(args, "max_turns", None), } # Filter out None values kwargs = {k: v for k, v in kwargs.items() if v is not None} @@ -3808,6 +3809,13 @@ For more help on a command: default=False, help="Enable filesystem checkpoints before destructive file operations (use /rollback to restore)" ) + chat_parser.add_argument( + "--max-turns", + type=int, + default=None, + metavar="N", + help="Maximum tool-calling iterations per conversation turn (default: 90, or agent.max_turns in config)" + ) chat_parser.add_argument( "--yolo", action="store_true",