Skip to content

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

Python
5.6 KB
Raw Blame

v0.0.279 (2026-08-26)

Newer cut on main after the v0.0.278 privacy line. The native Beautiful UI app speaks ACP from the first turn, so thinking and tool use render while the agent is still working.

This branch also carries the v0.0.278 product commits (composer-image privacy, bundled Smolify dropped). Those notes stay in v0.0.278.

Native app is an ACP client

apps/native is a merjs desktop shell around Beautiful UI primitives. It used to proxy graff serve NDJSON. That needed a second process and still stacked a second "Thinking" spinner on the thinking chip.

It now owns one graff acp --yolo child via Next.js /api/acp. Mid-turn session/update notifications map onto the same chips the screenshot already showed:

ACP sessionUpdate primitive
agent_thought_chunk ThinkingState
tool_call / tool_call_update ToolChips (+ edit diffs)
agent_message_chunk StreamingText

graff serve is not required. session/cancel sets Esc. A model change respawns the child. Approvals are off this path (--yolo); ACP has no session/request_permission yet.

graff acp streams mid-turn (ADR 0032)

v0 ACP wrote one final agent_message_chunk. During session/prompt the agent now installs a translating writer on root.out / g_out so --json events become v1 session updates (thought, text, tool_call, tool_call_update). Stub turns that emit nothing still write the v0 final chunk. Zed stays on protocolVersion 1.

Run the app

zig build
cd apps/native && npm install && npm run dev

The existing Tauri app in gui/ is unchanged.

Embedding graff

A host embeds graff by spawning the binary, not by linking a library. docs/embedding.md names the two APIs: graff acp (ACP v1 JSON-RPC; thought / tool / text session/update) and @codegraff/sdk Harness (graff --json). @codegraff/sdk/acp is the spawn plus write/read. --no-local-tools still gates local bash/file tools on a trusted host. Modified AGPLv3: a hosted/SaaS embed is a legal event.

Standing constraints (#638)

/never is an ACP slash command (available_commands_update after session/new) and is intercepted as a local prompt, so a native/Zed user can list and retire rules without the REPL. On a TTY, bare /never opens a /model-style searchable picker (constraint text first, id second) and asks twice before a tombstone. ACP / pipes keep the text list. rm accepts an id or a unique text fragment. An explicit "forget / override that rule" in the next user message tombstones the matching item before the model turn (ADR 0033). note_constraint stays append-only. /never rm without an id lists (or opens the picker on a TTY) instead of recording rm as a new constraint; a failed tombstone write says the rule is still active. Traces record never_retire {id, ok} with no constraint text (#644).

Background job waits (#640)

Any bash_output / agent_output wait_ms>0 waits for exit (10h). A model that passes a mid-range "safety timeout" (60s–240s) no longer gets [job N: running] back mid-job and a second billed hop.

Compaction pin budget (#581)

The live unresolved prompt (and its images) stays pinned. If that pinned suffix alone is already over the 8k keep budget, compaction announces once and then stays quiet for the rest of the turn instead of reprinting [compaction skipped…] every cycle. Server-side blob prune / explicit compact refuse a cut that would drop that pin.

Tier-1 wall (#641)

eval-tier1.sh runs the 17 tuiguard PTY probes in a 4–8 process pool, counts the suite and the named invariants by scanning the unfiltered test artifact (no filtered recompiles, no second suite execution on a zig cache hit), and accepts --only tui,tuiguard.

Multiline paste stays one draft (#643)

Pasting several newline-separated lines into the TUI composer — including while a turn is streaming — inserts them as one unsent draft. Embedded \n / \r\n from a bracketed paste (or a wrap-less burst in the same read) cannot invoke Enter/send, so they no longer steer the live turn or queue one prompt per line. An explicit Enter after the paste submits or queues exactly one user prompt.

First-turn tools are immediate (ADR 0035)

The first model call after --yolo / graff acp no longer waits for deferred MCP handshakes (silent stdio probe default 5s). Native tools run on that turn; MCP catalogs merge on the next request. Live ACP tool_call is in_progress and flushed so chips appear as the tool starts. The native app skips the demo fade-up/stagger on live rows and shows elapsed from start.

Codex Computer Use bridge (#618, ADR 0036)

The bundled Computer Use skill's required node_repl tools are now present in Graff. On macOS, Graff preserves the service's authentication boundary by launching Codex's configured node_repl through the sibling signed codex sandbox wrapper and allowlisting only the Computer Use Unix socket. It does not embed V8 or spoof the service. The skill maps its calls to mcp__node_repl__js, keeps the original confirmation policy, and continues to hand nodeRepl.emitImage(...) results through Graff's native MCP image path.

The plugin's raw MCP launcher is no longer advertised when the signed bridge is available; that path fails macOS sender authentication under a standalone Graff parent. /mcp trust / --yolo consent is unchanged.

Tests

Unit suite grows by the ACP translator cases (kindFor, thought/text chunks, minted tool ids, EventSink) plus the #638 picker/retire, #640 deadline, #581 pin-budget, #643 paste-boundary, and #618 signed-bridge cases. The release-cut floor advances to 1715 (slack 25).