From 09f8e6d94e77c93bcc69b4cc9d5b445360e85d27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 19:50:14 +0000 Subject: [PATCH 1/2] Initial plan From 7715525434d54b693cc67603c9305ec389f3ae57 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 19:52:55 +0000 Subject: [PATCH 2/2] Fix JSON schema inconsistency: add optional explanation field to prompt template Co-authored-by: kriserickson <325934+kriserickson@users.noreply.github.com> --- internal/llm/prompt.go | 4 +++- internal/llm/prompt_test.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/llm/prompt.go b/internal/llm/prompt.go index fa5a17f..026aa33 100644 --- a/internal/llm/prompt.go +++ b/internal/llm/prompt.go @@ -20,7 +20,8 @@ For shell command requests, respond with: "command": "the shell command to run", "description": "brief explanation of what it does", "risk": "safe or risky", - "certainty": 90 + "certainty": 90, + "explanation": "(optional) step-by-step breakdown of the command's flags and arguments" } ] } @@ -28,6 +29,7 @@ For shell command requests, respond with: Rules for commands: - "risk" must be "safe" (read-only, informational) or "risky" (modifies files, processes, system state) - "certainty" is 0-100, your confidence this is the correct command for what the user asked +- "explanation" is optional and only required when explicitly requested - For multi-step tasks, return multiple commands in order. Use shell constructs like $(...) or pipes to chain when possible - Generate commands appropriate for the detected OS and shell - Never generate commands that could cause irreversible damage without clear user intent diff --git a/internal/llm/prompt_test.go b/internal/llm/prompt_test.go index a40cb1e..75570b2 100644 --- a/internal/llm/prompt_test.go +++ b/internal/llm/prompt_test.go @@ -28,6 +28,7 @@ func TestBuildSystemPrompt_ContainsJSONInstructions(t *testing.T) { `"type": "commands"`, `"risk"`, `"certainty"`, + `"explanation"`, `"type": "config"`, "valid JSON", }