graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
GUI Port Review Handoff
Context
This repository is the Zig-native Codegraff target at <workspace>/codegraff-zig. The GUI was copied from the Rust/Tauri/React Codegraff2 source repository and adapted in place so it can be tested locally against the Zig-native graff binary.
The chosen migration strategy is copy-first: preserve the existing GUI shell and progressively replace source-specific runtime coupling.
Current Working Tree Scope
Expected target-repo changes for this port:
.gitignoreadds generated GUI/Zig artifact coverage.src/main.zighas formatter-only whitespace changes required by the repo's Zig 0.16 formatter.gui/is newly copied and adapted.
The original source repo at <workspace>/codegraff has a pre-existing codedb.snapshot modification that is not part of this port. Do not include it in the target port commit.
Major Decisions
- Copied the full GUI directory rather than designing a new Zig-native UI from scratch.
- Kept the React/Tauri shell initially to preserve product behavior and make the migration testable.
- Replaced source-coupled Rust runtime dependencies with a simplified Tauri adapter that shells out to the Zig-native
graffbinary. - Treated the target repo's declared Zig toolchain as authoritative: Zig 0.16. Local Homebrew Zig 0.15.2 is not compatible with this repo.
- Mapped GUI auth to the target CLI's actual credential flows.
Important Files
gui/package.json- Copied GUI frontend scripts and package metadata adapted for Codegraff.
gui/src-tauri/Cargo.toml- Copied Tauri backend crate adapted to avoid original source-local
forge_*path dependencies.
- Copied Tauri backend crate adapted to avoid original source-local
gui/src-tauri/src/runtime/simple.rs- Simplified runtime adapter used by the copied GUI.
- Prompt execution delegates to
graff --print <prompt> --yolo. - Provider/auth actions delegate to the Zig-native CLI.
gui/src/components/chat/ChatThread.tsx- Fixed copied frontend compatibility with the installed
@legendapp/listAPI.
- Fixed copied frontend compatibility with the installed
.gitignore- Covers generated GUI and Zig build artifacts.
src/main.zig- Zig 0.16 formatter-only whitespace changes.
Runtime/Auth Behavior
The GUI backend resolves the graff binary in this order:
CODEGRAFF_GUI_BINARYenvironment variable.../../zig-out/bin/graffrelative togui/src-tauri.grafffromPATH.
Auth mapping:
- API-key providers call
graff key set <provider> <api_key>. - Codegraff device login launches
graff login. - Codex/ChatGPT login launches
graff login codex. - On macOS, interactive login is launched through Terminal so the Tauri backend does not block waiting for terminal input.
Provider list currently exposed in the GUI adapter:
- codegraff
- anthropic
- deepseek
- openai
- minimax
- xiaomi
- kimi
- xai
- zai
- codex
Known Warnings
cargo check and tauri dev currently emit unused-code warnings from copied compatibility modules. This is expected for the copy-first MVP because the simplified adapter only exercises a subset of the original GUI backend surface. The build still succeeds.
Examples of intentionally copied-but-currently-unused areas:
- Activity/tool-call DTO mapping helpers.
- Follow-up bridge helpers.
- Provider OAuth callback bridge pieces.
- Some project-store metadata and layout helpers.
- Desktop open helper variants.
A later cleanup pass can remove, gate, or re-enable these pieces as feature parity decisions are made.
Verification Completed
From <workspace>/codegraff-zig:
zig build
zig build test --summary all
cargo check --manifest-path gui/src-tauri/Cargo.toml
cd gui && npm run build
The GUI was also launched locally with:
cd <workspace>/codegraff-zig
zig build
cd gui
CODEGRAFF_GUI_BINARY=../zig-out/bin/graff npm run tauri dev
Current Local GUI Process Notes
The latest launch was started in the background with logs at:
/tmp/codegraff-gui.log
PID file:
/tmp/codegraff-gui.pid
Review Checklist
- Confirm copied
gui/should be committed as one port commit or split later. - Confirm provider IDs match the Zig CLI's actual supported provider identifiers.
- Confirm macOS Terminal launch is acceptable for
graff loginandgraff login codex. - Decide whether unused copied modules should remain for future parity or be removed/gated now.
- Tauri versions:
tauriRust crate v2.10.3 and@tauri-apps/apiv2.10.1 (pergui/package.json) are compatible; no action needed. (An earlier draft of this checklist cited v2.11.0, which was incorrect.) - Smoke test workspace open, new chat, prompt send, API-key provider setup, Codegraff login, and Codex login.
Validation Notes (2026-06-15 review)
Reviewed the port against the actual Zig CLI. Two things that look suspicious but are correct — do not "fix" them:
- The prompt invocation passes
--print, the prompt, and--yoloas separate argv tokens (.arg("--print").arg(prompt).arg("--yolo")). The Zig CLI parses this correctly as flag + positional prompt + flag. Correct. remove_provider's message referencing~/.simple-harness-keys.jsonis accurate: the Zig CLI's key store really uses Keychain servicesimple-harnessand fallback file.simple-harness-keys.json(src/main.zig:6143-6144).
Fixes applied in this review (see gui/src-tauri/src/runtime/simple.rs):
- macOS interactive login now uses
osascript ... do scriptinstead ofopen -a Terminal <bin> --args login(the latter passedlogin/codexto Terminal.app, not tograff, so login never ran). stop_promptnow tracks the in-flightgraffchild PID and kills it, instead of only clearing in-memory request IDs.