graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
feat(variance): scripted sessions get the approval map; declines prescribe the exit
Rach Pradhan953ef3be9b82
diff --git a/src/agent_tool_gate.zig b/src/agent_tool_gate.zigindex 86995d98..8f285125 100644--- a/src/agent_tool_gate.zig+++ b/src/agent_tool_gate.zig@@ -318,7 +318,10 @@ pub fn gateTool(self: *Agent, call: ToolCall) !?ExecResult {else => {},};return .{- .text = try self.arena.dupe(u8, "user declined this tool call — try another approach or ask them how to proceed"),+ // Narrow the recovery space on purpose: a declined call invites the+ // model to invent a different detour every run (measured as turn-count+ // variance on identical tasks, #476). Point at the deterministic exits.+ .text = try self.arena.dupe(u8, "user declined this tool call — do not retry it or a reworded equivalent; the answer will not change. Continue with what is already approved, delegate the declined work to a subagent, or report the blocker plainly."),.is_error = true,};}diff --git a/src/main.zig b/src/main.zigindex bea5e653..66092cd3 100644--- a/src/main.zig+++ b/src/main.zig@@ -408,7 +408,7 @@ pub fn main(init: std.process.Init) !void {// Root system-prompt layering (base + AGENTS.md/HARNESS.md/CLAUDE.md + --append-system-prompt + active-skill lines + connected-MCP notes) lives// in startup.zig as buildSystemPrompt() — pure over io/arena, returns the composed base by value. buildRootAgent derives every prompt variant// from it via prompts.setSystemPrompts() (#326).- const sys_normal = try startup.buildSystemPrompt(io, arena, out, flags.system_prompt_flag, flags.append_system_flag, json_mode or flags.oneshot_prompt != null, flags.oneshot_prompt != null and !flags.effectiveYolo(), mcp_tools, g_codedbpro_licensed, init.environ_map.get("GRAFF_LEARNED_PROMPT"), init.environ_map);+ const sys_normal = try startup.buildSystemPrompt(io, arena, out, flags.system_prompt_flag, flags.append_system_flag, json_mode or flags.oneshot_prompt != null, (flags.oneshot_prompt != null or !(Io.File.stdin().isTty(io) catch true)) and !flags.effectiveYolo(), mcp_tools, g_codedbpro_licensed, init.environ_map.get("GRAFF_LEARNED_PROMPT"), init.environ_map);boot.mark(io, "system prompt");session_run.learningNotice(io, arena, init.environ_map, out, json_mode or flags.oneshot_prompt != null);