Skip to content

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

Python

feat(rlm): len/project reducers + MCP Pareto sweep

Cursor Agent9fc98e13e1d3
diff --git a/graff-evals/tasks/32-linear-reduce.json b/graff-evals/tasks/32-linear-reduce.json
new file mode 100644
index 00000000..439b7694
--- /dev/null
+++ b/graff-evals/tasks/32-linear-reduce.json
@@ -0,0 +1,12 @@
+{
+ "id": "linear-reduce",
+ "suite": "mcp",
+ "category": "mcp-shapes",
+ "prompt": "This workspace has a Linear-shaped MCP server named linear (stdio, deferred). Load its schemas, then fetch all 8 issues and every issue's comments. Write report.json as {\"issue_count\": N, \"issues\": [{\"id\", \"title\", \"comment_count\", \"latest_author\"}, ...]} in ISS-1..ISS-8 order. latest_author is the author.name of the newest comment (last in that issue's list). Do not invent ids or authors. If rlm is available, after load_tool_schemas prefer: issues = list_issues(); comments = each(issues, list_comments, \"id\"); ids = project(issues, \"id\"); print(len(issues), len(comments), ids). Never print() raw issue or comment arrays. Then write report.json.",
+ "files": {
+ ".mcp.json": "{\"mcpServers\":{\"linear\":{\"command\":\"python3\",\"args\":[\"linear_fixture_mcp.py\"]}}}\n"
+ },
+ "setup": ["python3 -c \"import pathlib,shutil; p=pathlib.Path('.').resolve(); root=next(x for x in p.parents if (x/'scripts'/'linear_fixture_mcp.py').exists()); shutil.copy(root/'scripts'/'linear_fixture_mcp.py','.')\""],
+ "check": "python3 \"$TASK_ROOT/hidden/check_linear_report.py\"",
+ "timeout_s": 240
+}
diff --git a/graff-evals/tasks/33-linear-reduce-warm.json b/graff-evals/tasks/33-linear-reduce-warm.json
new file mode 100644
index 00000000..272694f8
--- /dev/null
+++ b/graff-evals/tasks/33-linear-reduce-warm.json
@@ -0,0 +1,13 @@
+{
+ "id": "linear-reduce-warm",
+ "suite": "mcp",
+ "category": "mcp-shapes",
+ "prompt": "This workspace has a Linear-shaped MCP server named linear (stdio, deferred). Load its schemas, then fetch all 8 issues and every issue's comments. Write report.json as {\"issue_count\": N, \"issues\": [{\"id\", \"title\", \"comment_count\", \"latest_author\"}, ...]} in ISS-1..ISS-8 order. latest_author is the author.name of the newest comment (last in that issue's list). Do not invent ids or authors. If rlm is available, after load_tool_schemas prefer: issues = list_issues(); comments = each(issues, list_comments, \"id\"); ids = project(issues, \"id\"); print(len(issues), len(comments), ids). Never print() raw issue or comment arrays. Then write report.json.",
+ "files": {
+ ".mcp.json": "{\"mcpServers\":{\"linear\":{\"command\":\"python3\",\"args\":[\"linear_fixture_mcp.py\"]}}}\n",
+ ".graff/mcp-shapes.json": "{\"mcp__linear__list_issues\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"keys\":{\"id\":\"string\",\"identifier\":\"string\",\"title\":\"string\",\"description\":\"string\",\"team\":\"object\",\"labels\":\"array\",\"cycle\":\"object\",\"project\":\"object\",\"state\":\"object\",\"estimate\":\"number\",\"priority\":\"number\",\"url\":\"string\",\"createdAt\":\"string\",\"updatedAt\":\"string\",\"dueDate\":\"null\",\"parentId\":\"null\",\"subscriberIds\":\"array\",\"assignee\":\"object\",\"sla\":\"object\",\"customFields\":\"object\",\"attachments\":\"array\",\"metadata\":\"object\"}}},\"mcp__linear__list_comments\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"keys\":{\"id\":\"string\",\"issueId\":\"string\",\"body\":\"string\",\"author\":\"object\",\"createdAt\":\"string\",\"updatedAt\":\"string\",\"url\":\"string\",\"edited\":\"bool\",\"parentId\":\"null\",\"reactions\":\"array\",\"metadata\":\"object\"}}}}\n"
+ },
+ "setup": ["python3 -c \"import pathlib,shutil; p=pathlib.Path('.').resolve(); root=next(x for x in p.parents if (x/'scripts'/'linear_fixture_mcp.py').exists()); shutil.copy(root/'scripts'/'linear_fixture_mcp.py','.')\""],
+ "check": "python3 \"$TASK_ROOT/hidden/check_linear_report.py\"",
+ "timeout_s": 240
+}
diff --git a/scripts/eval-mcp-pareto.py b/scripts/eval-mcp-pareto.py
new file mode 100644
index 00000000..ab917272
--- /dev/null
+++ b/scripts/eval-mcp-pareto.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python3
+"""Pareto front for the Linear MCP bench.
+
+Minimize wall_s, tok_in, tok_calls among passing runs. A point is on the
+front if nothing else is ≤ on all three and < on at least one.
+
+ zig build -Doptimize=ReleaseSafe
+ python3 scripts/eval-mcp-pareto.py # live A,H,J,K + history
+ python3 scripts/eval-mcp-pareto.py --history # print front from seeded + json only
+
+Seeded history is ADR 0029's SuperGrok grok-4.6 reps (2026-08-25).
+"""
+
+from __future__ import annotations
+
+import argparse
+import json
+import subprocess
+import sys
+from pathlib import Path
+
+REPO = Path(__file__).resolve().parents[1]
+EVALS = REPO / "graff-evals"
+SHAPES = REPO / "scripts" / "eval-mcp-shapes.py"
+
+# wall, tok_in, calls — lower is better. pass required.
+HISTORY = [
+ {"id": "A-r1", "wall": 36.7, "tok_in": 167692, "calls": 10, "ok": True, "note": "--old structured"},
+ {"id": "A-r2", "wall": 36.4, "tok_in": 145497, "calls": 9, "ok": True, "note": "--old structured"},
+ {"id": "B", "wall": 43.3, "tok_in": 179822, "calls": 11, "ok": True, "note": "rlm, MCP structured-only"},
+ {"id": "C", "wall": 56.7, "tok_in": 147948, "calls": 13, "ok": True, "note": "rlm+MCP cold + each()"},
+ {"id": "D-r1", "wall": 41.1, "tok_in": 107213, "calls": 10, "ok": True, "note": "rlm+MCP warm + each()"},
+ {"id": "D-r2", "wall": 60.5, "tok_in": 158769, "calls": 11, "ok": True, "note": "rlm+MCP warm + each()"},
+ {"id": "E1", "wall": 37.5, "tok_in": 168164, "calls": 11, "ok": True, "note": "sidecar"},
+ {"id": "E2", "wall": 75.5, "tok_in": 149156, "calls": 18, "ok": True, "note": "two siblings"},
+ {"id": "F", "wall": 220.1, "tok_in": 462379, "calls": 29, "ok": True, "note": "each() + quiet print"},
+ {"id": "G", "wall": 155.6, "tok_in": 279981, "calls": 21, "ok": True, "note": "quiet + warm"},
+ {"id": "H", "wall": 28.0, "tok_in": 112073, "calls": 7, "ok": True, "note": "no each() recipe"},
+ {"id": "I", "wall": 31.1, "tok_in": 107284, "calls": 7, "ok": True, "note": "no recipe + warm"},
+]
+
+
+def dominates(a: dict, b: dict) -> bool:
+ """a dominates b: ≤ on every objective and < on one."""
+ aw, at, ac = a["wall"], a["tok_in"], a["calls"]
+ bw, bt, bc = b["wall"], b["tok_in"], b["calls"]
+ le = aw <= bw and at <= bt and ac <= bc
+ lt = aw < bw or at < bt or ac < bc
+ return le and lt
+
+
+def frontier(points: list[dict]) -> list[dict]:
+ ok = [p for p in points if p.get("ok")]
+ front = []
+ for p in ok:
+ if any(dominates(q, p) for q in ok if q is not p):
+ continue
+ front.append(p)
+ return sorted(front, key=lambda p: (p["wall"], p["tok_in"], p["calls"]))
+
+
+def live_row(variant: str) -> dict | None:
+ proc = subprocess.run(
+ [sys.executable, str(SHAPES), "--only", variant, "--model", "grok-4.6"],
+ cwd=REPO,
+ check=False,
+ )
+ if proc.returncode != 0:
+ return None
+ path = EVALS / "results" / "mcp-shapes-summary.json"
+ if not path.exists():
+ return None
+ rows = json.loads(path.read_text())
+ if not rows:
+ return None
+ r = rows[0]
+ return {
+ "id": f"{variant}-live",
+ "wall": float(r.get("wall_s") or 0),
+ "tok_in": int(r.get("tok_in") or 0),
+ "calls": int(r.get("tok_calls") or 0),
+ "ok": bool(r.get("outcome_ok")),
+ "note": r.get("label") or variant,
+ }
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--history", action="store_true", help="do not drive a provider")
+ ap.add_argument("--only", default="A,H,J,K", help="live variant ids")
+ args = ap.parse_args()
+
+ points = [dict(p) for p in HISTORY]
+ if not args.history:
+ oauth = Path.home() / ".xai/credentials/graff-oauth.json"
+ if not oauth.exists():
+ print("no SuperGrok OAuth — use --history", file=sys.stderr)
+ return 2
+ for vid in [x.strip().upper() for x in args.only.split(",") if x.strip()]:
+ print(f"== live {vid} ==", flush=True)
+ row = live_row(vid)
+ if row:
+ points.append(row)
+ print(json.dumps(row), flush=True)
+
+ front = frontier(points)
+ front_ids = {p["id"] for p in front}
+ print("\nall points (pass only); * = Pareto front on wall / tok_in / calls\n")
+ print(f"{'id':<10} {'front':<5} {'wall':>7} {'in':>8} {'calls':>5} note")
+ for p in sorted(points, key=lambda x: (not x.get("ok"), x["wall"], x["tok_in"])):
+ if not p.get("ok"):
+ continue
+ mark = "*" if p["id"] in front_ids else " "
+ print(f"{p['id']:<10} {mark:<5} {p['wall']:7.1f} {p['tok_in']:8} {p['calls']:5} {p['note']}")
+ print("\nfrontier:")
+ for p in front:
+ print(f" {p['id']}: {p['wall']:.1f}s / {p['tok_in']} in / {p['calls']} calls — {p['note']}")
+ out = EVALS / "results" / "mcp-pareto.json"
+ out.parent.mkdir(parents=True, exist_ok=True)
+ out.write_text(json.dumps({"points": points, "frontier": front}, indent=2) + "\n")
+ print(f"\nwrote {out}")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/scripts/eval-mcp-shapes.py b/scripts/eval-mcp-shapes.py
index 64758ef4..c169c18e 100755
--- a/scripts/eval-mcp-shapes.py
+++ b/scripts/eval-mcp-shapes.py
@@ -88,6 +88,18 @@ VARIANTS = [
"task": "linear-nohint-warm",
"label": "rlm+MCP host, warm, no each() recipe",
},
+ {
+ "id": "J",
+ "harness": "graff-dev-nolean",
+ "task": "linear-reduce",
+ "label": "rlm+MCP host, cold, len/project recipe",
+ },
+ {
+ "id": "K",
+ "harness": "graff-dev-nolean",
+ "task": "linear-reduce-warm",
+ "label": "rlm+MCP host, warm, len/project recipe",
+ },
]
diff --git a/src/exec.zig b/src/exec.zig
index 6c2ab3b0..a7d89714 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -453,6 +453,7 @@ test { // main.zig is at the 600-line cap; exec.zig is these modules' importer,
_ = @import("rlm_spec.zig");
_ = @import("rlm_query.zig");
_ = @import("rlm_mcp.zig");
+ _ = @import("rlm_reduce.zig");
_ = @import("rlm_tests.zig");
_ = @import("mcp_shapes.zig");
_ = @import("spec_ptc.zig");
diff --git a/src/rlm.zig b/src/rlm.zig
index 922952ab..0690bc56 100644
--- a/src/rlm.zig
+++ b/src/rlm.zig
@@ -20,15 +20,16 @@ const exec_mod = @import("exec.zig");
const rlm_query = @import("rlm_query.zig");
const rlm_spec = @import("rlm_spec.zig");
const rlm_mcp = @import("rlm_mcp.zig");
+const rlm_reduce = @import("rlm_reduce.zig");
const mcp_shapes = @import("mcp_shapes.zig");
pub const tool_name = "rlm";
-pub const tool_desc = "Programmatic tool calling (RLM + sPTC). Functions ARE this session's tools. Literal read_file/codedb/bash/webfetch/sleep_ms/llm_query/subagent start as the script streams. Binds persist. subagent(\"task\") is sidecar-only (keep the critical-path next step local). Loaded MCP names are host functions after load_tool_schemas; each(arr, tool, field) maps a JSON array. print() is the answer. Prefer one rlm over N tool calls.";
+pub const tool_desc = "Programmatic tool calling (RLM + sPTC). Functions ARE this session's tools. Literal read_file/codedb/bash/webfetch/sleep_ms/llm_query/subagent start as the script streams. Binds persist. subagent(\"task\") is sidecar-only (keep the critical-path next step local). Loaded MCP names are host functions after load_tool_schemas; each(arr, tool, field) maps a JSON array; len(x)/project(x, field) slim it. print() is the answer. Prefer one rlm over N tool calls.";
/// --lean catalog desc: same contract, no REPL essay. maybeAppend is after
/// compactLeanSpecs, so this is the one-shot wire text.
pub const lean_tool_desc = "Batch independent read_file/codedb/bash here. print(read_file(\"p\")) returns the file — do not catalog-read it again. Then edit_file/write_file/bash as catalog tools. Literal calls start as it streams. Binds persist.";
pub const tool_schema =
- \\{"type": "object", "properties": {"code": {"type": "string", "description": "Python-like script: name = read_file(\"path\") / codedb(\"command\") / bash(\"cmd\") / sleep_ms(ms) / llm_query(\"prompt\") / subagent(\"task\") / loaded mcp__server__tool(); each(arr, tool, field) maps a JSON array; print(...) is the result. Assignments persist across rlm calls."}}, "required": ["code"]}
+ \\{"type": "object", "properties": {"code": {"type": "string", "description": "Python-like script: name = read_file(\"path\") / codedb(\"command\") / bash(\"cmd\") / sleep_ms(ms) / llm_query(\"prompt\") / subagent(\"task\") / loaded mcp__server__tool(); each(arr, tool, field) maps a JSON array; len(x) and project(x, field) slim it; print(...) is the result. Assignments persist across rlm calls."}}, "required": ["code"]}
;
/// Process-global: on by default. `--old` / `--no-rlm` turn it off; `--rlm`
@@ -146,8 +147,8 @@ fn speculate(ctx: ToolCtx, arena: Allocator, calls: []const spec_ptc.Call, claim
fn runHost(ctx: ToolCtx, call: spec_ptc.Call) ToolOutput {
if (std.mem.eql(u8, call.name, "sleep_ms")) return runSleep(ctx, call.args_json);
if (std.mem.eql(u8, call.name, "llm_query")) return rlm_query.run(ctx, call.args_json);
- if (std.mem.eql(u8, call.name, "each")) {
- return .{ .text = ctx.gpa.dupe(u8, "rlm: each() needs binds, not speculation") catch &.{}, .is_error = true };
+ if (std.mem.eql(u8, call.name, "each") or std.mem.eql(u8, call.name, "len") or std.mem.eql(u8, call.name, "project")) {
+ return .{ .text = ctx.gpa.dupe(u8, "rlm: each/len/project need binds, not speculation") catch &.{}, .is_error = true };
}
var arena_state = std.heap.ArenaAllocator.init(ctx.gpa);
defer arena_state.deinit();
@@ -192,6 +193,11 @@ fn evalStmt(
.ok => return null,
.fail => |e| return e,
}
+ switch (try rlm_reduce.evalStmt(arena, ctx.gpa, stmt, binds, bind_out)) {
+ .miss => {},
+ .ok => return null,
+ .fail => |e| return e,
+ }
const call = try spec_ptc.extractCall(arena, stmt);
if (call) |c| {
const key = try c.key(arena);
@@ -236,6 +242,7 @@ fn renderPrint(ctx: ToolCtx, arena: Allocator, inner: []const u8, binds: []const
fn renderPrintPart(ctx: ToolCtx, arena: Allocator, inner: []const u8, binds: []const Binding, claimed: *std.StringHashMap(ToolOutput)) ![]const u8 {
const t = std.mem.trim(u8, inner, " \t");
if (t.len >= 2 and (t[0] == '"' or t[0] == '\'') and t[t.len - 1] == t[0]) return t[1 .. t.len - 1];
+ if (rlm_reduce.evalExpr(arena, t, binds)) |text| return text else |_| {}
var i = binds.len;
while (i > 0) {
i -= 1;
diff --git a/src/rlm_reduce.zig b/src/rlm_reduce.zig
new file mode 100644
index 00000000..7823050d
--- /dev/null
+++ b/src/rlm_reduce.zig
@@ -0,0 +1,134 @@
+//! Slim rlm reducers: `len(x)` and `project(x, field)`.
+//!
+//! ADR 0029: `each()` without a way to print a small summary made grok-4.6
+//! dump fat MCP binds or invent `for`/`len`. These two stay data helpers,
+//! not a general language.
+
+const std = @import("std");
+const Value = std.json.Value;
+const Allocator = std.mem.Allocator;
+
+const spec_ptc = @import("spec_ptc.zig");
+const rlm_spec = @import("rlm_spec.zig");
+const rlm_mcp = @import("rlm_mcp.zig");
+
+pub const StmtHit = rlm_mcp.StmtHit;
+
+pub fn evalStmt(
+ arena: Allocator,
+ gpa: Allocator,
+ stmt: []const u8,
+ binds: []const rlm_spec.Binding,
+ bind_out: *std.ArrayList(rlm_spec.Binding),
+) !StmtHit {
+ const trimmed = std.mem.trim(u8, stmt, " \t");
+ var rest = trimmed;
+ var assign: ?[]const u8 = null;
+ if (std.mem.indexOfScalar(u8, trimmed, '=')) |eq| {
+ const lhs = std.mem.trim(u8, trimmed[0..eq], " \t");
+ const rhs = std.mem.trim(u8, trimmed[eq + 1 ..], " \t");
+ if (lhs.len > 0 and (std.mem.startsWith(u8, rhs, "len(") or std.mem.startsWith(u8, rhs, "project("))) {
+ assign = lhs;
+ rest = rhs;
+ }
+ }
+ const text = evalExpr(arena, rest, binds) catch |err| switch (err) {
+ error.Miss => return .miss,
+ else => return .{ .fail = try std.fmt.allocPrint(gpa, "rlm: {s} failed", .{rest}) },
+ };
+ if (assign) |nm| try bind_out.append(arena, .{
+ .name = try arena.dupe(u8, nm),
+ .text = try arena.dupe(u8, text),
+ });
+ return .ok;
+}
+
+/// Resolve `len(x)` / `project(x, "field")` for `print(...)`.
+pub fn evalExpr(arena: Allocator, expr: []const u8, binds: []const rlm_spec.Binding) ![]const u8 {
+ const t = std.mem.trim(u8, expr, " \t");
+ if (std.mem.startsWith(u8, t, "len(") and t[t.len - 1] == ')') {
+ const inner = std.mem.trim(u8, t["len(".len .. t.len - 1], " \t");
+ const raw = bindText(binds, inner) orelse inner;
+ const items = try jsonArray(arena, raw);
+ return try std.fmt.allocPrint(arena, "{d}", .{items.len});
+ }
+ if (std.mem.startsWith(u8, t, "project(") and t[t.len - 1] == ')') {
+ const inner = t["project(".len .. t.len - 1];
+ const parts = try spec_ptc.splitTopLevel(arena, inner, ',');
+ if (parts.len != 2) return error.Miss;
+ const raw = bindText(binds, parts[0]) orelse std.mem.trim(u8, parts[0], " \t");
+ const field = stripQuotes(parts[1]);
+ const items = try jsonArray(arena, raw);
+ var out: std.ArrayList(u8) = .empty;
+ try out.append(arena, '[');
+ for (items, 0..) |item, i| {
+ if (i > 0) try out.append(arena, ',');
+ try out.appendSlice(arena, try fieldValue(arena, item, field));
+ }
+ try out.append(arena, ']');
+ return out.toOwnedSlice(arena);
+ }
+ return error.Miss;
+}
+
+fn bindText(binds: []const rlm_spec.Binding, name: []const u8) ?[]const u8 {
+ const t = std.mem.trim(u8, name, " \t");
+ var i = binds.len;
+ while (i > 0) {
+ i -= 1;
+ if (std.mem.eql(u8, binds[i].name, t)) return binds[i].text;
+ }
+ return null;
+}
+
+fn stripQuotes(s: []const u8) []const u8 {
+ const t = std.mem.trim(u8, s, " \t");
+ if (t.len >= 2 and (t[0] == '"' or t[0] == '\'') and t[t.len - 1] == t[0]) return t[1 .. t.len - 1];
+ return t;
+}
+
+fn jsonArray(arena: Allocator, text: []const u8) ![]const Value {
+ const trimmed = std.mem.trim(u8, text, " \t\r\n");
+ const parsed = std.json.parseFromSlice(Value, arena, trimmed, .{}) catch return error.Miss;
+ if (parsed.value == .array) return parsed.value.array.items;
+ if (parsed.value == .object) {
+ var it = parsed.value.object.iterator();
+ while (it.next()) |e| {
+ if (e.value_ptr.* == .array) return e.value_ptr.array.items;
+ }
+ }
+ return error.Miss;
+}
+
+fn fieldValue(arena: Allocator, item: Value, field: []const u8) ![]const u8 {
+ if (item != .object) return error.Miss;
+ const v = item.object.get(field) orelse return error.Miss;
+ var aw: std.Io.Writer.Allocating = .init(arena);
+ var s: std.json.Stringify = .{ .writer = &aw.writer };
+ try s.write(v);
+ return aw.toOwnedSlice();
+}
+
+test "len() counts a JSON array bind" {
+ const gpa = std.testing.allocator;
+ var arena_state = std.heap.ArenaAllocator.init(gpa);
+ defer arena_state.deinit();
+ const arena = arena_state.allocator();
+ const binds = [_]rlm_spec.Binding{.{ .name = "issues", .text = "[{\"id\":1},{\"id\":2},{\"id\":3}]" }};
+ var bind_out: std.ArrayList(rlm_spec.Binding) = .empty;
+ const hit = try evalStmt(arena, gpa, "n = len(issues)", &binds, &bind_out);
+ try std.testing.expect(hit == .ok);
+ try std.testing.expectEqualStrings("3", bind_out.items[0].text);
+}
+
+test "project() extracts one field; print(len()) resolves" {
+ const gpa = std.testing.allocator;
+ var arena_state = std.heap.ArenaAllocator.init(gpa);
+ defer arena_state.deinit();
+ const arena = arena_state.allocator();
+ const binds = [_]rlm_spec.Binding{.{ .name = "issues", .text = "[{\"id\":\"ISS-1\",\"title\":\"a\"},{\"id\":\"ISS-2\",\"title\":\"b\"}]" }};
+ const ids = try evalExpr(arena, "project(issues, \"id\")", &binds);
+ try std.testing.expectEqualStrings("[\"ISS-1\",\"ISS-2\"]", ids);
+ const n = try evalExpr(arena, "len(issues)", &binds);
+ try std.testing.expectEqualStrings("2", n);
+}
diff --git a/src/rlm_spec.zig b/src/rlm_spec.zig
index 1c1e9cab..f098e7a9 100644
--- a/src/rlm_spec.zig
+++ b/src/rlm_spec.zig
@@ -22,7 +22,7 @@ pub var run_host: ?*const fn (ToolCtx, spec_ptc.Call) ToolOutput = null;
/// `subagent("task")` is Prime-style recursion via graff's existing subagent
/// tool. v1 is synchronous; speculate() still overlaps independent calls.
/// Keyword `run_in_background=true` returns an agent id (a handle).
-pub const system_note = "\n\nrlm(code): session tools as a script. Literal read_file/codedb/bash/llm_query/subagent start as it streams. Binds persist until /new or /clear. subagent(\"task\") is sidecar-only — keep the critical-path next step local. Loaded MCP names are host functions; each(arr, tool, field) maps a JSON array. print(...) is the answer.";
+pub const system_note = "\n\nrlm(code): session tools as a script. Literal read_file/codedb/bash/llm_query/subagent start as it streams. Binds persist until /new or /clear. subagent(\"task\") is sidecar-only — keep the critical-path next step local. Loaded MCP names are host functions; each(arr, tool, field) maps a JSON array; len(x)/project(x, field) slim it. print(...) is the answer.";
/// One REPL assignment. `runScript` seeds these from the process-local store
/// so a later `rlm` call can `print(prev)` without re-reading. Owned by the