vexdroid
Git that speaks AI agent: same commands, far fewer tokens, cheaper code reviews in Claude Code, Codex, Cursor and Gemini CLI.
When your agent runs git diff, git log or git show, vexdroid gives it the same information in a fraction of the text, so commit reviews cost up to 20% less. Nothing changes in how you or your agent work. It runs on your machine and only reads your repo, never changes it. The short command is vxd. One-command setup for Claude Code, Codex, Cursor and Gemini CLI; any agent that speaks MCP or runs shell commands can use it. Coding agents use git through the shell. Across 229 real Claude Code sessions, git took up 17% of tool calls and about 15% of tool output.
Summary extracted from the README.
vexdroid
Stop paying your AI agent to read git noise.
When your agent runs git diff, git log or git show, vexdroid gives it the same information in a fraction of the text, so commit reviews cost up to 20% less. Nothing changes in how you or your agent work. It runs on your machine and only reads your repo, never changes it. The short command is vxd.
One-command setup for Claude Code, Codex, Cursor and Gemini CLI; any agent that speaks MCP or runs shell commands can use it.
Coding agents use git through the shell. Across 229 real Claude Code sessions, git took up 17% of tool calls and about 15% of tool output. vexdroid makes that output smaller without changing how agents work:
- A hook rewrites read-only git commands (
status,diff,show,log,blame) tovxd git …. That runs the same git command and returns compact output. For example,git show <commit>returns the full message plus a summary of what changed in each function, about 10–18x smaller. Nothing is blocked, and write commands are never touched. - One-shot answers to questions git answers badly:
vxd history,vxd search,vxd impact,vxd overview. - Read-only. vexdroid never commits, branches, stages or edits files, and adds nothing to
.git/. Agents and humans do all of that with git as usual. Its only state is an index in~/.vexdroid/, which can be deleted at any time.
Measured (140 Claude Code runs on three repos):
- Reviewing several commits costs 16–23% less with Sonnet, 20% across all three repos combined (statistically significant), with the same correctness. Big diffs arrive in one read instead of being re-asked file by file past Claude Code's output limit.
- Across all tasks, cost dropped 7–14%, almost all of it from the reviews. Small tasks, long sessions and the Haiku model showed no real difference.
Methods, all runs, and what didn't work are in bench/RESULTS.md.
Humans keep using git normally. Removing vexdroid leaves a plain git repo.
Install
cargo install vexdroid
vexdroid init --global # connect your agents for every repo on this machine
Needs Rust (rustup.rs). Drop --global to set up only the current repo.
Or from GitHub, for the latest main:
cargo install --git https://github.com/ajitpatel28/vexdroid
vexdroid init --global
Tested on macOS and Linux. Windows is untested and doesn't support add-on languages yet.
vexdroid init [--global] is the whole setup. It detects which agents you have installed and sets them up:
| Agent | What it gets |
|---|---|
| Claude Code | The PreToolUse hook only. It rewrites git calls to the compact versions, with no extra turns. An MCP server and a skill both measurably cost extra turns, so they are left out |
| Codex, Cursor, Gemini CLI | The MCP server, plus a short guide (AGENTS.md, a Cursor rule, GEMINI.md) |
| Flag | Effect |
|---|---|
--global |
Set up for every repo on this machine instead of the current one |
--agents claude,codex |
Only these agents |
--dry-run |
List the files it would change, change nothing |
--disable |
Turn the hook off for this repo |
vexdroid uninstall [--global] removes exactly what init added. Files you already had get their original bytes back. vexdroid status shows what is set up.
The hook
| Agent runs | Actually runs | Output |
|---|---|---|
git status |
vxd git status |
Branch and a short list of changes |
git diff … |
vxd git diff … |
The same patch without the index, --- and +++ file-header lines. Lockfile diffs over 200 lines are summarised. Output over 24k characters is packed into one read: full diffs for the files that matter most, then one line per remaining file with the functions it touches and the command to see it |
git show <commit> |
vxd git show <commit> |
The full message plus a summary of what changed in each function |
git log … |
vxd git log … |
One line per commit, including the first line of the body (the "why") |
git blame <file> |
vxd git blame <file> |
Line ranges grouped by commit |
git add/commit/push/… |
unchanged | — |
The hook only rewrites a command when every part of it is a read-only git call or a safe filter (head, grep, …). Commands with $, backticks, redirections or other programs are left alone, so normal permissions apply to them. Options that can run a program or write a file (-c, --config-env, --exec-path, --output, --ext-diff) are never rewritten, so they get your normal permission prompt. A git log piped into another command (| grep, | wc -l) stays raw, so counts and searches see every commit. To get raw output, prefix the command with VEXDROID_ALLOW_GIT=1.
Commands
The same commands are available over MCP and the CLI.
| Command | Returns |
|---|---|
history <path|symbol|commit> |
Who changed it, when and why. Loose path matching: user-profile finds UserProfile/ |
search <words> |
Past commits ranked by match, with the "why" line from the body |
impact <symbol> |
Definitions, caller files, test files, and files that usually change together with it |
overview [path] |
Areas of the repo and the files most others depend on |
changes [--level] |
Work since the last commit, including new files, at symbol level, ranked: ~ signature, * body, > renamed, + added, - removed |
git <args> |
Compact git, which is what the hook rewrites to |
stats |
How much of your Claude Code sessions goes to git (it only reads local transcripts) |
selfcheck [--commits N] |
Replays compact git commands over recent commits and checks each against git's own output |
How it works
- Semantic diff: both versions of each file are parsed with tree-sitter, and symbols are compared by name. An unchanged body under a new name counts as a rename. Changes are ranked by public API, then by how many files call the symbol.
- Code graph: symbols and references are cached per git blob, so the index updates incrementally. References are matched by name.
- History graph: commits link to files and symbols, plus which files change together, so questions get answers instead of log dumps.
- Checked against git: before an agent sees compact output, vexdroid compares it with git's own: every changed line, commit, message line, path and blame line must be there, or be listed with the command that shows it. If a check fails, or vexdroid crashes, the agent gets plain git output instead, and the case is logged in
~/.vexdroid/mismatches.log. The comparison runs alongside the compact version, so it adds almost no time. - Read-only by construction: uncommitted work is read straight from disk, never staged or snapshotted. Every git call runs with
GIT_OPTIONAL_LOCKS=0, so evengit statusdoesn't refresh the index file, and commands that compare with the working tree (git diff,changes) work on a temporary copy of the index, becausegit diffrefreshes it regardless. A test checks that refs, objects, the index and.git/info/excludeare byte-for-byte the same after every command.
The index lives in ~/.vexdroid/repos/<repo>-<hash>/, outside the repo. The only files vexdroid writes in a project are the agent config files init lists, and only when you run it.
Languages
Compact git output and one-read packing work for every language and file type. Function-level detail comes in three layers, picked automatically:
| Layer | Languages | What you get |
|---|---|---|
| Built in, with language-specific rules | TypeScript, TSX, JavaScript, Python, Rust, Go | Functions, classes and calls, plus import-aware "who uses this" for TS/JS and Python |
| Add-ons, using one generic rule set | Java, Kotlin, Swift, C#, C, C++, Ruby, PHP, Scala, Dart, Lua, Bash | Functions, methods, classes and calls, once added |
| Git's own detection | Everything else, and add-ons you haven't added | "Changed near def get(id)", from git's function detection in diff headers |
Add only the languages you need, so the binary stays small (about 8.5 MB):
vxd lang list # what's built in, what's added
vxd lang add kotlin swift # add languages
vxd lang remove swift
vexdroid init --langs auto # at setup: add the languages this repo uses
init also tells you which languages a repo uses that aren't added yet.
Adding a language downloads that grammar's source from crates.io once (a pinned version, verified against a checksum in vexdroid's source), compiles it with your C compiler (on macOS: xcode-select --install), and stores it in ~/.vexdroid/grammars/. Nothing else ever downloads. For offline machines, point VEXDROID_GRAMMAR_SRC at a folder of unpacked grammar crates.
Adding a new add-on language is one line in src/grammars.rs and one in src/lang.rs, plus a test.
Limitations
- The cost saving is narrow: reviews of large changes with Sonnet, measured on three TypeScript repos. Small tasks, long sessions and Haiku showed no real difference (see the benchmark).
- "Who uses this" is import-aware only for TS/JS and Python. Other languages match by name, so common names can overcount.
- Add-on languages need a C compiler the first time they're added.
- Callers come from the last commit.
changes,impactandoverviewcount who uses a function from committed code, so calls added in uncommitted files aren't counted yet.
Development
cargo test # unit + end-to-end tests (they use a throwaway HOME)
cargo clippy --all-targets
cargo run --example probe -- some/file.kt # what the parser finds in a file
cargo run --example tree -- some/file.kt # the raw syntax tree, for writing language rules
python3 bench/agent_bench.py --help
License
MIT