Skip to content

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

Python

docs(release): comprehensive v0.0.282 notes — deep overview, transport resilience, the remeasured frontier

Rach Pradhan80fd157b1e28
diff --git a/docs/releases/v0.0.282.md b/docs/releases/v0.0.282.md
index c1be65fa..9a9182aa 100644
--- a/docs/releases/v0.0.282.md
+++ b/docs/releases/v0.0.282.md
@@ -5,8 +5,84 @@ headline is three yxlyx product PRs that were open against the old
main tip: atomic paste spans, terminal Codex WS errors, and
recoverable HTTP client generations.
-281 stays published as-is. This is not a retag. No GitHub tag until
-asked; download / notarization ids land after the build.
+281 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 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.
+
+**Resilience is engineered, not hoped for.** This cut is largely the
+transport hardening that keeps a whole workday alive: TLS client
+generations rotate on a poisoned construction (ADR 0048), a Codex
+`type:error` frame is honored as a terminal API answer instead of a redial
+(#693), deterministic short flakes on the Codegraff seat retry twice while
+auth and quota stay fail-fast (ADR 0053), and lean one-shots bounce a
+prose-only fake completion (ADR 0052).
+
+**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 (see the frontier below) — without a 4-tool
+catalog or a 1 GB heap (ADR 0024).
+
+**Sessions are durable and forkable.** Every conversation autosaves to
+`.graff/sessions`; `/resume` restores provider history, and this cut adds
+clone-on-write branches — `--resume SOURCE --branch DEST` forks a saved
+session once and the two lives never write each other's files again
+(ADR 0049). The GUI sidebar is the same directory.
+
+**A learning loop that runs itself.** Sessions record behavior metrics; a
+workspace that does real model work bootstraps its own learning store once,
+detached so teardown never waits on suite generation; 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 Codex-class harness introduced in 281 (files pane, git Changes
+review, per-tab agents, session-history sidebar) — unchanged here, it rides
+the same ACP wire.
## Atomic pasted-text placeholders (#674 / #673)
@@ -51,7 +127,11 @@ prewarmed replacement. In-flight callers keep the retired generation
through reference-counted leases; later retries resolve the original
launch pointer to the replacement. The original launch client is never
reclaimed by the manager (unrelated launch consumers still hold its
-pointer). WebSocket transport stays independently managed.
+pointer). WebSocket transport stays independently managed. The two
+production constructor catches share one predicate now: a handshake that
+dies mid-read — on Windows an aborted peer surfaces as `error.Unexpected`
+(NTSTATUS `LOCAL_DISCONNECT`), not `TlsInitializationFailed` — traverses
+the same recovery, so the malformed-peer contract holds on every platform.
`#694` recorded this as ADR 0042. That number is already TUI claims
screen on main. This cut remaps the record to **0048**. The follow-up
@@ -125,6 +205,36 @@ Pi's four-tool catalog or OpenCode's ~1G heap.
to **0052–0055**. Keep-alive-only bodies share the short-flake retry
in `agent_gateway_retry.zig` so 282's request-scratch split stays.
+## We are the Pareto frontier — remeasured on this tip
+
+Same SuperGrok seat, same 12 shipped-PR fixtures, jobs=1, grok-4.6,
+`x_search` on — re-run against this exact release tip (`b1fcf67`, session
+branches and the empty-catalog omit included). Every axis named is
+lower-is-better, and graff is still the unique frontier on all of them
+(`run-20260831-021035-composite`):
+
+| harness | pass | wall | calls | tokens | list$ | RSS |
+|---|---:|---:|---:|---:|---:|---:|
+| **graff** | **12/12** | **200.9s** | **52** | **230k** | **$0.34** | **8.8M** |
+| grok-build | 12/12 | 387.7s | 64 | 1.17M | $1.05 | 160.9M |
+| OpenCode | 12/12 | 310.4s | 81 | 737k | $0.93 | 1149.9M |
+
+Calls stayed exactly 52 and list price ticked **down** ($0.3504 → $0.3410)
+with session branching in the tree. Wall is +8.8s vs the 281 pin, almost
+all of it one model-variance retry on `atomic-symlink-write` — not a
+regression. `peer-resume` (the fixture shaped like #697 itself) passed and
+got faster.
+
+![Pareto frontier, 12 in-house fixtures remeasured on the v0.0.282 tip: wall and tool calls vs list price — graff lower-left](https://raw.githubusercontent.com/justrach/codegraff/v0.0.282/graff-evals/hillclimb/frontier-inhouse-12-20260831-282.svg)
+
+For scale, the spine loop you feel per keystroke was **3/3 in 19.9s /
+0.6s first / 8 calls** on the same seat. Full tables, methodology, and the
+prior pin:
+[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 learn pin. We do not steal grok-build's heap or a 4-tool
+catalog to win (ADR 0024).
+
## Parked
`#277` (Streamable HTTP OAuth / Smolify) and `#200` (idle localhost