From 0976bf6cd0653a6097dd01cd2a15e160af9dda55 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 30 Mar 2026 11:17:09 -0700 Subject: [PATCH] feat: add /yolo slash command to toggle dangerous command approvals (#3990) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a /yolo command that toggles HERMES_YOLO_MODE at runtime, skipping all dangerous command approval prompts for the current session. Works in both CLI and gateway (Telegram, Discord, etc.). - /yolo -> ON: all commands auto-approved, no confirmation prompts - /yolo -> OFF: normal approval flow restored The --yolo CLI flag already existed for launch-time opt-in. This adds the ability to toggle mid-session without restarting. Session-scoped — resets when the process ends. Uses the existing HERMES_YOLO_MODE env var that check_all_command_guards() already respects. --- cli.py | 13 +++++++++++++ gateway/run.py | 13 +++++++++++++ hermes_cli/commands.py | 2 ++ 3 files changed, 28 insertions(+) diff --git a/cli.py b/cli.py index 706221506..223c40563 100644 --- a/cli.py +++ b/cli.py @@ -3836,6 +3836,8 @@ class HermesCLI: self.console.print(f" Status bar {state}") elif canonical == "verbose": self._toggle_verbose() + elif canonical == "yolo": + self._toggle_yolo() elif canonical == "reasoning": self._handle_reasoning_command(cmd_original) elif canonical == "compress": @@ -4434,6 +4436,17 @@ class HermesCLI: } _cprint(labels.get(self.tool_progress_mode, "")) + def _toggle_yolo(self): + """Toggle YOLO mode — skip all dangerous command approval prompts.""" + import os + current = bool(os.environ.get("HERMES_YOLO_MODE")) + if current: + os.environ.pop("HERMES_YOLO_MODE", None) + self.console.print(" ⚠ YOLO mode [bold red]OFF[/] — dangerous commands will require approval.") + else: + os.environ["HERMES_YOLO_MODE"] = "1" + self.console.print(" ⚡ YOLO mode [bold green]ON[/] — all commands auto-approved. Use with caution.") + def _handle_reasoning_command(self, cmd: str): """Handle /reasoning — manage effort level and display toggle. diff --git a/gateway/run.py b/gateway/run.py index 2bd623b62..de077ede8 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1877,6 +1877,9 @@ class GatewayRunner: if canonical == "verbose": return await self._handle_verbose_command(event) + if canonical == "yolo": + return await self._handle_yolo_command(event) + if canonical == "provider": return await self._handle_provider_command(event) @@ -4109,6 +4112,16 @@ class GatewayRunner: else: return f"🧠 ✓ Reasoning effort set to `{effort}` (this session only)" + async def _handle_yolo_command(self, event: MessageEvent) -> str: + """Handle /yolo — toggle dangerous command approval bypass.""" + current = bool(os.environ.get("HERMES_YOLO_MODE")) + if current: + os.environ.pop("HERMES_YOLO_MODE", None) + return "⚠️ YOLO mode **OFF** — dangerous commands will require approval." + else: + os.environ["HERMES_YOLO_MODE"] = "1" + return "⚡ YOLO mode **ON** — all commands auto-approved. Use with caution." + async def _handle_verbose_command(self, event: MessageEvent) -> str: """Handle /verbose command — cycle tool progress display mode. diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py index 26247c066..f043ec73f 100644 --- a/hermes_cli/commands.py +++ b/hermes_cli/commands.py @@ -90,6 +90,8 @@ COMMAND_REGISTRY: list[CommandDef] = [ CommandDef("verbose", "Cycle tool progress display: off -> new -> all -> verbose", "Configuration", cli_only=True, gateway_config_gate="display.tool_progress_command"), + CommandDef("yolo", "Toggle YOLO mode (skip all dangerous command approvals)", + "Configuration"), CommandDef("reasoning", "Manage reasoning effort and display", "Configuration", args_hint="[level|show|hide]", subcommands=("none", "low", "minimal", "medium", "high", "xhigh", "show", "hide", "on", "off")),