graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fix(lean): hide load_tool_schemas on -p even with home MCP
Cursor Agenteba806ab4898
diff --git a/src/mcp_schema_gate.zig b/src/mcp_schema_gate.zigindex f7eda7bd..e4d89845 100644--- a/src/mcp_schema_gate.zig+++ b/src/mcp_schema_gate.zig@@ -295,9 +295,9 @@ pub fn hiddenSpec(name: []const u8, all: []const mcp.Tool) bool {std.mem.eql(u8, name, "mcp_search_tools") orstd.mem.eql(u8, name, "mcp_select_tool");if (!progressive) return false;- // Lean still consults this: schema.zig skips only when nothing is- // deferred (empty MCP / all eager). A connected server (Smolify)- // stays advertised so the listing in the description is reachable.+ // -p: even a deferred home MCP kept the 1.4kB meta tool on every+ // turn. One-shots that need MCP pass --no-lean (ADR 0024).+ if (@import("no_local_tools.zig").lean) return true;return !anyDeferred(all);}diff --git a/src/mcp_schema_gate_tests.zig b/src/mcp_schema_gate_tests.zigindex cc866143..1543396c 100644--- a/src/mcp_schema_gate_tests.zig+++ b/src/mcp_schema_gate_tests.zig@@ -357,10 +357,9 @@ test "an eager tool is never blocked, and the load tool is advertised only whentry testing.expect(!gate.blocked(fat, "mcp__fat__ghost"));}-test "lean hides load_tool_schemas only when nothing is deferred" {- // -p / --lean must not always-hide: Smolify (and any connected MCP)- // lists public tools in the meta tool's description. Empty MCP still- // drops the 1.4kB stub (schema.zig's lean-or-!anyFolded skip).+test "lean hides load_tool_schemas even when MCP is deferred" {+ // Home Smolify still counts as deferred and used to keep the 1.4kB+ // meta tool on every -p turn. --no-lean is the MCP one-shot.const schema = @import("schema.zig");const no_local = @import("no_local_tools.zig");withDefaults();@@ -378,9 +377,9 @@ test "lean hides load_tool_schemas only when nothing is deferred" {try testing.expect(std.mem.indexOf(u8, empty, gate.tool_name) == null);const fat = try fixture(arena, "fat", 8, 2000);- try testing.expect(!gate.hiddenSpec(gate.tool_name, fat));+ try testing.expect(gate.hiddenSpec(gate.tool_name, fat));const with_mcp = try schema.renderRootTools(arena, .openai, specs, fat);- try testing.expect(std.mem.indexOf(u8, with_mcp, gate.tool_name) != null);+ try testing.expect(std.mem.indexOf(u8, with_mcp, gate.tool_name) == null);}test "tool_desc stays JSON-escape-free (it is spliced into a raw schema string)" {diff --git a/src/session_start.zig b/src/session_start.zigindex d6637775..44332bd1 100644--- a/src/session_start.zig+++ b/src/session_start.zig@@ -435,10 +435,9 @@ pub fn initRegistryConsent(io: Io, gpa: Allocator, arena: Allocator, out: *Io.Wrconst mcp_count = mcp_cli.countMcpServers(merged);const defer_join = flags.effectiveYolo() and flags.oneshot_prompt == null and !json_mode;var connect_mcp = flags.yolo_flag or mcp_count == 0;- // Lean -p: home MCP (Smolify) was 1.4kB of load_tool_schemas on every- // turn. One-shots that need MCP pass --no-lean (ADR 0024).- if (leanMode(flags.effectiveLean(), environ_map) and flags.oneshot_prompt != null)- connect_mcp = false;+ // Lean: home MCP (Smolify) was 1.4kB of load_tool_schemas on every+ // turn. Sessions that need MCP pass --no-lean (ADR 0024).+ if (leanMode(flags.effectiveLean(), environ_map)) connect_mcp = false;if (mcp_count > 0 and !flags.yolo_flag and !json_mode and use_color) {sink.emit(io, .{ .mcp_consent_prompt = .{ .count = mcp_count } });// Still an inline read: only the QUESTION is inverted here, and the