DEV Community

Cover image for GitWhisper – CLI that explains why your code changed, not just what
Shreeshanth Shetty
Shreeshanth Shetty

Posted on

GitWhisper – CLI that explains why your code changed, not just what

The problem

git log tells you what changed. It never tells you why.
Every senior engineer has spent hours reading through 50 commits
trying to understand a decision made 3 months ago by someone
who left the company.

What GitWhisper does

It installs a post-commit hook that silently captures developer
context at commit time — branch name, recent terminal commands,
IDE state, and the full diff — and stores it as JSON inside
.git/gitwhisper/.json.

When you run:

gitwhisper explain src/auth.rs
Enter fullscreen mode Exit fullscreen mode

It loads the full commit history for that file, pulls the captured
context for each commit, compresses everything into a 12k char
prompt budget, and asks Gemini or a local Ollama model to explain
why the file evolved the way it did.

Why Rust

Single binary. No runtime. Drop it into any repo without asking
teammates to install anything. Cold start is ~12ms.

Interesting engineering problems

The context optimizer was the hardest part. Naively passing full
history blows every model's context window. I ended up scoring
each commit by recency + file overlap + diff size then truncating
greedily until under budget.

Other commands that are useful day-to-day:

gitwhisper owners src/        # contribution-weighted ownership
gitwhisper security src/ # risky change pattern scan

gitwhisper bug-predict src/ # files statistically likely to have bugs
gitwhisper knowledge-risk src/ # bus factor analysis
gitwhisper dashboard # web dashboard at :7878
Enter fullscreen mode Exit fullscreen mode




Current rough edges

  • Terminal output is still plain println — colored crate is wired up in Cargo.toml but not applied yet
  • Dashboard is single-threaded TCP, blocks on one connection
  • Diff analysis is heuristic, no tree-sitter yet

GitHub

https://github.com/SHREESHANTH99/GitWhisper

Would love feedback on the context optimizer approach — happy to
go deep on any of the design decisions in the comments.****

Top comments (0)