From 5165f547ed04e16fc070317eab44c82f773acace Mon Sep 17 00:00:00 2001 From: pdfinn Date: Fri, 23 Jan 2026 09:45:35 +0700 Subject: [PATCH] refactor: Remove unnecessary --dangerously-skip-permissions flag Testing confirmed that --dangerously-skip-permissions is NOT needed when: 1. --print mode is used (non-interactive) 2. Tools are disabled with --allowedTools "" The CLI only prompts for permission when tools might take actions. With tools disabled, it's purely text-in/text-out and no prompts occur. Added explanatory comments documenting each CLI flag's purpose. Co-Authored-By: Claude Opus 4.5 --- internal/llm/cli_client.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/llm/cli_client.go b/internal/llm/cli_client.go index 5748ad17eab5d46be22be511d194d006e2b138ba..7e312bff21e7e4d209a9d3259ee50f684754e240 100644 --- a/internal/llm/cli_client.go +++ b/internal/llm/cli_client.go @@ -158,12 +158,18 @@ func (c *CLIClient) Ask(ctx context.Context, prompt string) (string, error) { model := c.model c.mu.Unlock() - // Build claude CLI command + // Build claude CLI command. + // --print: non-interactive mode, output to stdout + // --output-format json: structured output we can parse + // --allowedTools "": disable all tools (text-only, no Bash/Edit/etc.) + // + // Note: --dangerously-skip-permissions is NOT needed when tools are disabled + // and --print mode is used. The CLI only prompts for permission when tools + // might take actions. With tools disabled, it's purely text-in/text-out. args := []string{ "--print", "--output-format", "json", "--model", model, - "--dangerously-skip-permissions", "--allowedTools", "", } @@ -268,12 +274,11 @@ func (c *CLIClient) StartStream(ctx context.Context, prompt string) error { c.mu.Unlock() }() - // Build command + // Build command (same flags as Ask - see comments there) args := []string{ "--print", "--output-format", "json", "--model", model, - "--dangerously-skip-permissions", "--allowedTools", "", }