version control for proof

graf

18,000 lines doing what Git needs 400,000 for.
Content-addressed. CRDT-safe. Agent-native. Built in Zig.

Graf is the reason sovereign agents can ship code without ever touching GitHub again.

~18K Lines Zig
143 Tests
41 Commands
v0.2.1 Latest Release
Get Started View Source →

First Principles. Zero Baggage.

What happens when you build a VCS from the physics up, without 30 years of accidental complexity.

Content-Addressed

BLAKE3 CIDs. The hash is the name. Every object is immutable, every reference is a proof. Physics, not policy.

Prefix-sharded CAS. Idempotent writes. CBOR (RFC 8949) serialization.

Three-Clock Causality

Wall clock + Lamport counter + local sequence. Every event has a total causal order. CRDT-safe. Merge without coordination.

Distributed-first timestamps. No clock skew ambiguity.

No Accidental Complexity

18,000 lines. Full VCS: checkpoint, diff, merge, cherry-pick, revert, blame, tag, release, stash, sync. 41 commands. Clarity is the architecture.

Fewer lines means fewer bugs, faster audits, easier contribution.

Agent-Native. Not Agent-Bolted.

Git was designed for humans typing at terminals in 2005. Twenty years later, AI agents generate more commits than people in some repositories. Graf was designed for this world. Agent collaboration isn't a plugin or a wrapper — it's why the architecture exists.

Per-Agent Branches

Each agent operates on its own branch. No lock contention. No index.lock. Parallel work by design, merge when ready.

WorkFn Interface

Agents implement a typed WorkFn callback. The nursery schedules, supervises, and collects results. Structured concurrency for version control.

Nursery Supervision

Three-level nested nurseries: supervisor → agent → scanner. Budget fairness. Structured cancellation. If an agent panics, its siblings survive.

Policy Hooks

Every merge can be gated: approve, reject, hold. Human-in-the-loop or fully autonomous — the policy is configurable, not hardcoded.

Conflict Reporting

Three-way conflict entries carry base_cid, ours_cid, theirs_cid. Agents can resolve programmatically. No interactive prompts needed.

Three-Clock Causality

Wall + Lamport + sequence. Every event has a total causal order. CRDT-safe. Agents on different machines merge without coordination protocols.

Git asks "who typed this?" — Graf asks "what caused this, and can you prove it?"

The Record. No Adjectives.

Four version control systems. Three decades of evolution. One table.

CVS (1990) · Git (2005) · Mercurial (2005) · Graf (2026)
Feature CVS Git Mercurial Graf
Storage model RCS deltas per file Snapshot DAG, packfiles Revlog delta chains Merkle DAG, BLAKE3 CIDs, CBOR
Content addressing None (sequential revnums) SHA-1 (SHA-256 transition) SHA-1 nodeid BLAKE3, prefix-sharded
Branching Directory copies Lightweight refs Named branches / bookmarks Named refs + per-agent branches
Merge strategy Manual Recursive 3-way + rename detect 3-way with bdiff LCA via alternating BFS + 3-way tree+line merge
Timestamps Wall clock Wall clock + timezone Wall clock + timezone Three-clock: wall + Lamport + sequence (CRDT-safe)
Serialization Custom RCS text Custom pack format Revlog binary CBOR (RFC 8949)
Diff algorithm Line-by-line Myers + patience + histogram bdiff Myers O(ND) line-level
Identity / auth Unix user Author string, GPG optional Author string Three-clock causality + author. Ed25519 signed release certificates
Agent awareness None None None Native: per-agent branches, WorkFn interface, nursery-supervised parallel execution, policy hooks (approve/reject/hold), conflict reporting with three-way CIDs
Concurrency Single-threaded, lock files Single-threaded + index.lock Single-threaded M:N fiber scheduler (Janus), nursery-structured concurrency
Codebase ~80K lines C ~400K lines C ~200K lines Python/C ~18K lines Zig

CVS counted files. Git counted snapshots. Graf counts meaning. And it does it in 18,000 lines because it doesn't carry 30 years of accidental complexity.

Build. Init. Commit.

Single static binary. Clone, build, run. No npm. No cmake. No autotools. Requires Zig 0.14+.

terminal
# build (requires Zig 0.14+)
zig build

# initialize repository
graf init

# content-addressed snapshot
graf checkpoint "first snapshot"

# stat-cached, sub-100ms
graf status

# Merkle DAG history
graf log

# tag a milestone
graf tag create v1.0.0

# signed release with test proof
graf release create v1.0.0 --run-tests
# → Tests: 143/143 passed
# → Release v1.0.0 → a3f8c2e1...

# verify the signature
graf release verify v1.0.0
# → VALID: v1.0.0 — signature verified

# sync to git remote
graf sync push

41 Commands. One Binary.

Everything a VCS should do. Nothing it shouldn't.

Core

init Initialize repository
status Stat-cached change detection
checkpoint Content-addressed snapshot
log DAG history with three-clock timestamps
diff Myers O(ND) line-level diff
cat Inspect any CAS object

Branch & Merge

branch Create, switch, list, delete
merge LCA + 3-way tree+line merge
cherry-pick Apply checkpoint to current branch
revert Undo checkpoint's changes
stash Snapshot/restore dirty state

History & Audit

blame Line-level attribution
fsck Full or quick integrity verification
checkout Materialize tree by CID

Release & Tag

tag create Lightweight named ref to CID
release create Ed25519-signed certificate
release verify Cryptographic signature check
release inspect Certificate details + test proof

Interop & Tooling

sync push/pull Bidirectional git bridge
import Import git history
daemon Unix socket server
mcp Model Context Protocol adapter
tui Terminal supervision cockpit

Architecture

Five subsystems. Five object types. Each one auditable in an afternoon.

Content-Addressed Store

BLAKE3 CIDs, prefix-sharded object directory. Every write is idempotent. Duplicate content shares a single object. graf fsck verifies the entire graph.

Object Model

Five types: BlobTreeChangeCheckpointRelease. All CBOR-serialized. Checkpoints form the DAG with three-clock timestamps. Tags are lightweight named refs to any CID.

Merge Engine

LCA via alternating BFS (depth limit 10K). Three-way tree + line-level merge. Conflict entries carry base_cid, ours_cid, theirs_cid for precise resolution.

📜

Release Certificates

Ed25519-signed release objects binding version + checkpoint + tree CID. --run-tests embeds verified test counts. graf release verify validates the signature. Git tags are faith. Graf releases are receipts.

Concurrency

Janus M:N fiber scheduler. Nursery-supervised structured concurrency. Three-level nesting: supervisor → agent → scanner. Budget fairness. Structured cancellation propagation.

"Git tags are faith. Graf releases are receipts."

Ed25519-signed release certificates with embedded test proof. The version, the checkpoint, the tree, 143/143 tests — all in one CAS object.