Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat(lean): skip home MCP, skills, and parallel essays on -p

Cursor Agent01df47fad75b
diff --git a/src/no_local_tools.zig b/src/no_local_tools.zig
index 7fc7572e..163dc797 100644
--- a/src/no_local_tools.zig
+++ b/src/no_local_tools.zig
@@ -374,6 +374,7 @@ test "lean prompt diet: no fan-out / trace / issue-filing; short local-tools not
try std.testing.expect(std.mem.indexOf(u8, out, ".graff/traces") == null);
try std.testing.expect(std.mem.indexOf(u8, out, "gh issue create") == null);
try std.testing.expect(std.mem.indexOf(u8, out, "fan out") == null);
+ try std.testing.expect(std.mem.indexOf(u8, out, "Parallelize") == null);
try std.testing.expect(std.mem.indexOf(u8, out, "not covered by /rewind") == null);
try std.testing.expect(std.mem.indexOf(u8, out, "rlm") != null);
try std.testing.expect(std.mem.indexOf(u8, out, "SPEC.md") != null);
diff --git a/src/prompt_text.zig b/src/prompt_text.zig
index e5e290db..e991e715 100644
--- a/src/prompt_text.zig
+++ b/src/prompt_text.zig
@@ -294,7 +294,7 @@ pub fn leanSegment(name: []const u8, original: []const u8, is_lean: bool) ?[]con
if (!is_lean) return original;
if (std.mem.eql(u8, name, "trace") or std.mem.eql(u8, name, "harness_issue") or
std.mem.eql(u8, name, "headsup") or std.mem.eql(u8, name, "git_safety") or
- std.mem.eql(u8, name, "root_cause")) return null;
+ std.mem.eql(u8, name, "root_cause") or std.mem.startsWith(u8, name, "parallel_")) return null;
if (std.mem.eql(u8, name, "intro")) return lean_intro_note;
if (std.mem.eql(u8, name, "local_tools")) return lean_local_tools_note;
if (std.mem.eql(u8, name, "work")) return lean_work_note;
diff --git a/src/session_start.zig b/src/session_start.zig
index eef52db4..d6637775 100644
--- a/src/session_start.zig
+++ b/src/session_start.zig
@@ -435,6 +435,10 @@ pub fn initRegistryConsent(io: Io, gpa: Allocator, arena: Allocator, out: *Io.Wr
const 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;
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
diff --git a/src/startup.zig b/src/startup.zig
index 211a0dcd..cb6253bf 100644
--- a/src/startup.zig
+++ b/src/startup.zig
@@ -131,17 +131,21 @@ pub fn buildSystemPrompt(
sys_normal = try std.fmt.allocPrint(arena, "{s}{s}", .{ sys_normal, @import("rlm_spec.zig").system_note });
// Codex-style skills: one capability line per installed optional
// companion (skills_registry) — metadata in context, --help on demand.
- for (skills.skills_registry) |sk| {
- if (sk.note.len == 0 or !skills.skillActive(io, sk)) continue;
- sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, sk.note });
- }
- // Same idea for known MCP servers: a usage note enters the context only
- // when the server actually connected this session (consent given, spawn
- // succeeded). Native tools remain the fallback either way.
- for (skills.mcp_notes) |mn| {
- if (!skills.mcpServerConnected(mcp_tools, mn.server)) continue;
- const note = skills.codedbproNote(mn.server, codedbpro_licensed, mn.note);
- sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, note });
+ // Lean one-shots do not need companion essays (ADR 0024 prefix tax).
+ const lean = @import("no_local_tools.zig").lean;
+ if (!lean) {
+ for (skills.skills_registry) |sk| {
+ if (sk.note.len == 0 or !skills.skillActive(io, sk)) continue;
+ sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, sk.note });
+ }
+ // Same idea for known MCP servers: a usage note enters the context only
+ // when the server actually connected this session (consent given, spawn
+ // succeeded). Native tools remain the fallback either way.
+ for (skills.mcp_notes) |mn| {
+ if (!skills.mcpServerConnected(mcp_tools, mn.server)) continue;
+ const note = skills.codedbproNote(mn.server, codedbpro_licensed, mn.note);
+ sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, note });
+ }
}
// #352: mirror the Codex imagegen skill into ~/.harness/skills BEFORE the
// scan below, so the copied playbook is in this session's catalog. The same
@@ -156,10 +160,12 @@ pub fn buildSystemPrompt(
// Pinned once into the system-prompt prefix so later turns hit the
// prompt cache (Codex: old prompt is an exact prefix of the new one).
// The `skill` tool rescans without rewriting this prefix.
- skill_docs.g_skills = skill_docs.load(io, arena, fleet.g_home);
- const skill_catalog = skill_docs.promptCatalog(arena, skill_docs.g_skills);
- if (skill_catalog.len > 0) {
- sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, skill_catalog });
+ if (!lean) {
+ skill_docs.g_skills = skill_docs.load(io, arena, fleet.g_home);
+ const skill_catalog = skill_docs.promptCatalog(arena, skill_docs.g_skills);
+ if (skill_catalog.len > 0) {
+ sys_normal = try std.fmt.allocPrint(arena, "{s}\n\n{s}", .{ sys_normal, skill_catalog });
+ }
}
// #326: this returns the composed BASE only. prompts.setSystemPrompts()
// (called once by buildRootAgent, the sole consumer) derives