Nit: Git Rebuilt in Zig Saves AI Coding Agents 71% on Tokens

Available in: 中文
2026-03-26T05:29:12.279Z·2 min read
Nit is a Git replacement written in Zig that reduces AI agent token usage by 71% and runs 1.4-1.6x faster by stripping human-oriented formatting. Built on libgit2 with a smart passthrough design for unimplemented commands.

Nit: A Git Replacement Optimized for Machines, Not Humans

Developer Fielding has built Nit, a native Git replacement written in Zig that reduces token usage by 71% for AI coding agents like Claude Code and Codex, while also running 1.4-1.6x faster than Git.

The Problem

AI agents call Git constantly: status, diff, log, show. Analysis of 3,156 real coding sessions showed Git accounted for roughly 459,000 tokens of output — 7.4% of all shell commands. For Codex, over 10% of bash calls are Git.

Git's output was designed for humans: verbose headers, instructional text, column padding, decorative formatting. Machines do not need the tissue paper.

The Numbers

CommandGit TokensNit TokensSavings
status~125~3671%
log -20~2,273~30187%
diff~1,016~65735%
show --stat~260~11855%

Across real session data, Nit would save 150-250K tokens per coding session.

Performance

CommandGitNitSpeedup
status13.7ms8.4ms1.64x
diff14.3ms9.9ms1.44x
show10.2ms7.3ms1.39x

How It Works

Nit talks directly to the Git object database via libgit2 — no subprocess overhead, no text parsing. Zig's C interop is zero-cost, calling libgit2 functions directly. For unimplemented commands, it falls through to Git via execvpe(), making alias git=nit safe.

The U1 Experiment

The developer reduced diff context from Git's default 3 lines to 1 line. Testing with Claude showed no comprehension difference at U1 versus U3. Analysis of 561 real Claude Code sessions showed only 3.9% of agents read the source file after diffing, suggesting the diff itself is the primary context source.

Two Modes

Engineering

78 conformance tests covering Git edge cases: detached HEAD, merge commits, renamed files, binary diffs, submodules. The passthrough design allowed shipping early with the highest-impact commands first.

Installable via: brew install fielding/tap/nit

↗ Original source · 2026-03-26T00:00:00.000Z
← Previous: OpenAI Invests in AI Startup Isara at $650 Million ValuationNext: Lightfeed Extractor: TypeScript Library for Robust LLM-Based Web Scraping →
Comments0