Skip to content

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

Python

Merge #687 into release/v0.0.281: eval frontier + hardlink learn pin

Cursor Agent718d03373d2d
diff --cc graff-evals/README.md
index f1707b79,a1e5773f..4a7c47ab
--- a/graff-evals/README.md
+++ b/graff-evals/README.md
@@@ -25,12 -26,7 +26,14 @@@ harness under test spends model calls
```sh
./run.py --suite swe --harness graff-dev-old,graff-dev --model grok-4.6 -j 12
./run.py --suite core,rlm,swe --harness graff-dev-old,graff-dev -j 8
+# Pi on the same SuperGrok seat (`npm i -g @earendil-works/pi-coding-agent`):
+./run.py --suite swe --harness graff-dev,pi-xai --model grok-4.6 -j 6
+# same SuperGrok-shaped A/B on the Codegraff gateway (set CODEGRAFF_API_KEY):
+CODEGRAFF_API_KEY=cg_sk_… ./run.py --suite swe --harness graff-dev,pi-codegraff --model glm-5.3-flash -j 6
+# same seat, other models (ADR 0047): deepseek-v4-flash, gemini-3.7-flash, kimi-k2.6
+CODEGRAFF_API_KEY=cg_sk_… ./run.py --suite swe --harness graff-dev,pi-codegraff --model deepseek-v4-flash -j 6
++# multi-harness in-house PR suite (OpenCode needs --dir; see harnesses.json):
+ ./run.py --suite inhouse --harness graff-dev,grok,opencode --model grok-4.6 -j 1
```
## Run it
diff --cc graff-evals/harnesses.json
index c09d7c3e,afaae1df..b17c0caa
--- a/graff-evals/harnesses.json
+++ b/graff-evals/harnesses.json
@@@ -129,12 -149,39 +149,47 @@@
"default_model": "gemini-3.7-flash",
"note": "uses ~/.pi/agent/models.json provider codegraff → gateway.codegraff.com; Gemini tool loops need the codegraff-gemini-echo extension"
},
+ "pi-xai": {
+ "cmd": ["{repo}/graff-evals/pi-xai.sh", "-p", "--mode", "json", "--provider", "xai", "--model", "{model}", "--no-session", "{prompt}"],
+ "answer": "pi-json",
+ "usage": "pi-json",
+ "capabilities": [],
+ "default_model": "grok-4.6",
+ "note": "same SuperGrok seat as graff-dev. Wrapper reads graff-oauth.json into XAI_API_KEY. `pi` must be on PATH."
++ },
+ "opencode": {
+ "cmd": ["opencode", "run", "--format", "json", "--auto", "--pure", "--dir", "{sandbox}", "-m", "{model}", "{prompt}"],
+ "answer": "opencode-json",
+ "usage": "opencode-json",
+ "capabilities": [],
+ "model_prefix": "xai",
+ "default_model": "xai/grok-4.6",
+ "note": "OpenCode 1.18 headless. --dir is the eval sandbox (Popen cwd is not enough — OpenCode binds a project root). --pure skips plugins. SuperGrok via OpenCode xai auth."
+ },
+ "opencode-zen": {
+ "cmd": ["opencode", "run", "--format", "json", "--auto", "--pure", "--dir", "{sandbox}", "-m", "{model}", "{prompt}"],
+ "answer": "opencode-json",
+ "usage": "opencode-json",
+ "capabilities": [],
+ "default_model": "opencode/big-pickle",
+ "note": "OpenCode native Zen free model — NOT grok-4.6. Plot on the mixed-model chart only."
+ },
+ "dsh-grok": {
+ "cmd": ["dsh", "--profile", "headless", "--patch", "{repo}/graff-evals/dsh-grok.yml", "{prompt}"],
+ "answer": "stdout",
+ "usage": null,
+ "capabilities": [],
+ "env": {"DSH_PERMISSION_MODE": "danger-full-access"},
+ "default_model": "grok-4.6",
+ "note": "Same-model attempt. dsh 0.1.1-rc.2 pi-ai catalog has no grok-4.6 (only grok-4.5 / 4.3 / grok-build-0.1). Expect UNKNOWN_MODEL. Use dsh-xai for a live dsh point."
+ },
+ "dsh-xai": {
+ "cmd": ["dsh", "--profile", "headless", "--patch", "{repo}/graff-evals/dsh-xai.yml", "{prompt}"],
+ "answer": "stdout",
+ "usage": null,
+ "capabilities": [],
+ "env": {"DSH_PERMISSION_MODE": "danger-full-access"},
+ "default_model": "grok-4.5",
+ "note": "deepseek-harness on grok-4.5 (nearest xAI id in its catalog). NOT grok-4.6. Mixed-model chart only. Needs Node >=22.15 (zstd). SuperGrok OAuth → XAI_API_KEY via attach-dsh-xai-oauth.py (local; see dsh-local-oauth.md). No usage footer."
}
}
diff --cc graff-evals/run.py
index 666ef9bd,e6886855..1a4c21be
--- a/graff-evals/run.py
+++ b/graff-evals/run.py
@@@ -10,8 -10,8 +10,9 @@@ outcome, and writes JSONL results plus
./run.py --harness graff --model grok-4.6 # full suite (core + rlm + swe)
./run.py --suite rlm --harness graff-dev-old,graff-dev # scatter-gather A/B
./run.py --suite swe --harness graff-dev-old,graff-dev -j 12 # DeepSWE-shaped A/B, parallel
+ ./run.py --suite swe --harness graff-dev,pi-xai --model grok-4.6 -j 6 # same SuperGrok seat
./run.py --suite mcp --harness graff-dev-old-nolean,graff-dev-rlm-struct,graff-dev-nolean
+ ./run.py --suite inhouse --harness graff-dev,grok,opencode # shipped-PR fixtures
./run.py --harness grok --task fix-fib --reps 3 # one task, 3 reps
./run.py --interactive # pick + watch live
"""
diff --cc src/session_run.zig
index 0ff4c2df,193d042b..e8af4b1b
--- a/src/session_run.zig
+++ b/src/session_run.zig
@@@ -509,19 -506,12 +509,21 @@@ fn autoInitLearning(gpa: Allocator, io
return true;
}
+/// One-shots and `--json` are not a workspace opting into a spending cadence.
+/// `-p` evals land on exactly 5 model calls (the bootstrap floor) and then
+/// copy 132M `graff-pinned` + generate suites (~38s CPU). Interactive
+/// REPL/TUI/ACP still auto-init. Off with `GRAFF_LEARN_AUTO=off`.
+pub fn shouldAutoLearn(unattended: bool, json_mode: bool) bool {
+ return !unattended and !json_mode;
+}
+
/// Closing the learning loop: a session that did real model work counts toward
/// this workspace's next trial and, on cadence, starts one in the background.
- /// The first such session in a workspace also creates the store it counts into.
+ /// The first such session also starts `graff learn init` detached so teardown
+ /// does not wait on suite generation; the next session that finds a store
+ /// starts the cadence.
pub fn startBackgroundLearning(gpa: Allocator, arena: Allocator, io: Io, environ_map: *const std.process.Environ.Map, budget: *const run_budget_mod.RunBudget, telemetry_allowed: bool) void {
+ if (!shouldAutoLearn(main_mod.unattended, main_mod.json_mode)) return;
const options: learn_auto.Options = .{
.model_calls = budget.used(),
// A session launched with --no-telemetry keeps its trial local, even