graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
docs(release): v0.0.281 — deep overview, the new GUI, and the Pareto frontier
Rach Pradhan7546dbbf1ab9
diff --git a/docs/releases/v0.0.281.md b/docs/releases/v0.0.281.mdindex 37321912..ab45e91f 100644--- a/docs/releases/v0.0.281.md+++ b/docs/releases/v0.0.281.md@@ -7,6 +7,128 @@ same-model 12-task in-house frontier (`#690`).280 stays published as-is. This is not a retag.+## What graff is, and how it works++graff is one static Zig binary — about 3.7 MB, zero dependencies, its HTTP+client brings its own TLS — that turns the AI subscriptions you already pay+for into an agent that does work on your machine. You sign in with Codex,+SuperGrok, Kimi, Claude, or any API key; you hand it a task in plain English;+it plans, writes and runs code, edits your real files, and keeps going until+the task verifies — including spinning up a team of subagents in parallel+worktrees. You don't chat with it. You give it work.++**One agent, many faces.** A single `Agent` type is the unit of execution:+the line REPL's root, every subagent, `graff acp`'s session, the embedded+`libgraff`/wasm engine (ADR 0038), and the TUI's in-process client (ADR 0041)+are all the same struct running the same turn loop. Nothing is re-implemented+per surface — a surface is a sink.++**Many seats, one wire contract.** Provider adapters decouple *wire format*+from *auth style*, so subscription logins and API keys are interchangeable:+ChatGPT OAuth speaks the Responses API (with server-side compaction that+carries the lossless compact blob, and a WebSocket turn transport), Claude+Code OAuth speaks Anthropic Messages, SuperGrok tokens speak xAI's Responses+wire over WebSocket with hosted `x_search`, and plain API keys speak OpenAI+Chat or Anthropic. A model election ranks signed-in plans above metered keys+on the same model (ADR 0017), so a flat-rate seat is what actually gets used.++**The turn loop.** `buildBody` serializes the request against a+**stable prompt-cache prefix** — the catalog, tool schemas, and skill list+are pinned so a warm cache hit survives every load — then streams the+response over SSE and normalizes everything into typed `EngineEvent`s. Sinks+render those events; the REPL, `--json` stream, and TUI are proven+byte-identical against the same trace. Tool calls fan out on the Io thread+pool: built-ins (`bash`, `edit_file`/`write_file`/`read_file` — exact-string+replaces, path-confined), `subagent` and `workflow` (dynamic fan-out as+data), and MCP servers from `.mcp.json` (namespaced, schemas loaded lazily,+deferred past first paint). A structural permission gate sits under every+state-changing call — metacharacter-aware bash matching, cwd lock, path+confinement that `/yolo` cannot bypass — so autonomy is a dial, not a hope.++**Context discipline is the product.** The transcript is append-only and+compaction cannot rewrite it (ADR 0021); OpenAI routes use first-party+server-side compaction with a local transactional fallback; oversized tool+results spill to a 4 KB handle the model can open instead of occupying+context turn after turn; the RLM + mid-stream spec-ptc loop lets the model+*program over* context instead of pasting it back into the prompt (ADR 0022).+That stack is why the same model on the same seat below runs 2–6× cheaper+and faster than peer harnesses at ~92M RSS — without a 4-tool catalog or a+1 GB heap (ADR 0024).++**A learning loop that runs itself.** Sessions record behavior metrics; a+workspace that does real model work bootstraps its own learning store once,+detaching `graff init` so teardown never waits on suite generation (the+`-p` change below); the kit pins the live binary by **hardlink** — no 127M+copy; generated suites and independent holdouts drive background tournaments+that promote a new genome only through statistical gates.++**Surfaces.** `graff` (line REPL), `graff tui` (the Grok-style fullscreen+pager), `graff acp` (Agent Client Protocol for Zed and the desktop apps),+`@codegraff/sdk` (TypeScript + Python, embeddable in-process or remote), and+two GUIs: the Tauri desktop app in `gui/` with its auto-updater, and the+native harness below.++## The new GUI: a Codex-class native harness++The native app (merjs desktop shell — Zig → ObjC → `NSWindow` + `WKWebView`,+no Electron — over Beautiful UI primitives) grew the pieces that make it a+real harness instead of a chat window, this cut:++- **One agent per tab.** Each chat tab owns its `graff acp` child, keyed+ `<page>:<chat>` so a reload never adopts a stale agent; tabs run turns+ concurrently, and closing one reaps its agent after it writes its exit+ save.+- **graff's own session history in the sidebar.** The sidebar is the+ workspace's `.graff/sessions` directory — every conversation, REPL or+ native, bucketed by day and searchable. Opening one renders its saved+ transcript immediately and resumes it, so a follow-up continues with the+ model's memory intact.+- **A files pane and a Changes review.** The files pane walks the agent's+ cwd with breadcrumbs, a text viewer with gutter and wrap, and inline+ images. After editing turns, a Codex-style+ `Changed N files +A −D · Review` bar surfaces the real git diff.+- **A live model picker** backed by `graff --models`: authenticated seats+ with election order, type-to-filter, and current-model sync after a+ respawn.+- **It reads like an AI app now.** Assistant markdown streams through a+ zero-dependency renderer with clickable workspace paths; text drains at a+ backlog-proportional pace instead of arriving in chunks; thinking carries+ a duration stamp and shimmer, running tools tick a wall-clock counter, the+ active tab pulses while its turn works, and the send button morphs into a+ stop.++## We are the Pareto frontier++Same grok-4.6, same SuperGrok seat, same shipped-PR fixtures. Every axis+named is lower-is-better, and graff is the unique frontier on all of them.++**12 shipped-PR fixtures** (`run-20260830-141658`, `--suite inhouse`):++| harness | pass | wall | calls | tokens | list$ | RSS |+|---|---:|---:|---:|---:|---:|---:|+| **graff** | **12/12** | **192s** | **52** | **228k** | **$0.35** | **92M** |+| grok-build | 12/12 | 462s | 63 | 1.18M | $1.12 | 170M |+| OpenCode | 12/12 | 236s | 74 | 675k | $0.79 | 1.1G |++++**6-task in-house Pareto run** (`run-20260830-122731`): graff **6/6** in+**164.7s** / 0.7s first token / 26 calls, vs grok-build 530.9s and OpenCode+168.4s.++++**3-task spine** (`run-20260830-124315`): graff **3/3** in **19.9s** /+0.6s first / 8 calls — the loop overhead you feel per keystroke.++++Full tables and methodology:+[graff-evals/hillclimb/baseline.md](../../graff-evals/hillclimb/baseline.md).+How: the stable cache prefix, the RLM + spec-ptc loop, slim tool results,+and the hardlink pin + detached init below. We do not steal grok-build's+heap or a 4-tool catalog to win.+## One-shots skip learn auto-init (ADR 0044 / #668)Every graff-dev SWE task used to make exactly 5 API calls (the