Local LLM for Git History: A Practical AI Experiment12 min read2,315 words

Local LLM for Git History: A Practical AI Experiment

See how git-ghost uses local Gemma and Ollama to turn Git history into a personal reflection tool, with practical lessons on privacy and AI design.

local LLM for Git historygit-ghostGemma local modelOllamaAI developer tools
Local LLM for Git History: A Practical AI Experiment

What Your Oldest Git Commits Can Tell You About Your Work

Most AI coding tools point you forward: write a function, explain an error, tidy up a pull request. git-ghost nudges you the other way. It digs through your repo's commit history and uses a local language model to put an early version of your work into words.

The project is intentionally small. It's a Python command-line tool that reads the oldest and newest commits, then prompts Gemma - run locally via Ollama - to respond in three parts: what the project started as, how it's changed, and one concrete piece of advice. The whole point is that your history stays on your machine; nothing sends off to a cloud AI service.

That small scope is also the interesting part. git-ghost is a clean example of how to scope an AI feature, keep sensitive data local, and make the model's job specific enough that you can actually test the surrounding software. Below is how the tool works, what local inference does (and doesn't) guarantee, and what teams can learn from this kind of constrained build.

Why look at a repository through its commit history?

A Git repo is often treated like a log of changes: what got added, what got fixed, and who touched what. But the history also captures decisions you didn't write down anywhere else. An initial commit might look like a quick prototype; later commits show new requirements, shifting priorities, or the moment a project started to grow up.

That's why commit history works well for a reflective AI tool. Instead of asking the model to generate code, git-ghost asks it to compare the start of a project with where things are now. The output is meant to be a compact narrative: what the project was, what it became, and what you might consider next.

The past is useful, but incomplete

Commit messages aren't a full project diary. They can be short, inconsistent, or written mostly for someone debugging later. "fix typo" tells you almost nothing about the stress around a release. And the repo itself can miss plenty of real decision-making - things that happened in meetings, in client conversations, or in issue trackers.

So the model shouldn't be treated like an archivist with a complete view. It's working with whatever evidence is in the commit log. git-ghost's system prompt asks Gemma to stick to facts that are present in that log. That's a good guardrail: it can interpret what it sees, but it shouldn't claim a file or turning point existed unless the history backs it up.

Even with that constraint, accuracy isn't guaranteed. A language model can misread a message or over-interpret the sequence of commits. In practice, you should treat the result as a prompted reflection - not an authoritative account of your project's history.

Why make the interaction playful?

The tool frames the response as a "ghost" in three parts: "I remember..." for the project's beginnings, "I see you now..." for what changed, and "Before I fade..." for one concrete suggestion. The Día de los Muertos framing gives the interaction a shape, without turning it into a generic productivity dashboard.

That choice matters. You don't always need to optimize a work metric to build something useful. Sometimes a small, well-framed interaction helps people notice patterns they'd normally gloss over. The key is being honest about the value: git-ghost offers a perspective on your commit log, not a substitute for talking with the people who built the software.

How does git-ghost turn Git history into an AI experience?

The implementation stays deliberately narrow. git-ghost is a single Python file with no third-party Python dependencies. It uses Git via Python's subprocess module to read commit history, then uses urllib to stream a request to Ollama's local /api/chat endpoint.

You pass a repository path. The tool pulls the oldest commits as the project's "memories" and the latest commits as the current state, then sends that context to the model. Gemma is the default model (gemma3:4b), but you can choose another Ollama model with the --model option. The answer streams into the terminal as it's generated, rather than waiting to print everything at the end.

A small input makes a more focused feature

This isn't meant to be a general code assistant. It doesn't need to scan every file or answer arbitrary questions about the whole codebase. Its job is to turn selected history into a structured response.

That limited scope is a real design advantage. It's easier to explain, and it gives the prompt a clear boundary. There's also a practical security angle: a full repo can include secrets, personal data, generated files, and lots of irrelevant implementation detail. Even though a commit log can still contain sensitive information, it's usually a smaller, narrower input. Picking the smallest useful context reduces what the model has to interpret and lowers the chance you accidentally feed it things you shouldn't.

Of course, there's a trade-off. Commit messages often don't include enough detail to support a truly meaningful observation. If the tool ever needs richer context, it should ask for it explicitly - ideally through an option the user controls - rather than quietly uploading (or reading) the entire repo.

Test the integration without downloading a model

The project includes a unit test that starts a fake Ollama server and creates a temporary Git repository. That means the test can exercise the request logic and the repo-handling code without installing a model or relying on a real inference response.

This is a solid way to test small AI integrations. You can't make a deterministic unit test prove what a language model will always say. But you can test the parts around it: that the right commits are collected, the request is formed correctly, the stream is handled properly, and failures show up in predictable ways.

And in real systems, keep those tests separate from model-quality evaluation. A fake server confirms the plumbing; representative repos plus human review are what you use to check whether outputs stay grounded, useful, and appropriately cautious. Otherwise you end up confusing "the integration didn't crash" with "the AI behavior is reliable."

What changes when Gemma runs locally?

The biggest design decision isn't the ghost theme - it's where inference happens. git-ghost uses Ollama to run an open-weight model on the user's own machine. There's no cloud API key, no per-request fee, and (as long as everything is genuinely local) no need to send commit history to an external provider.

For a personal tool, that's a sensible fit. Commit history can include project plans, customer names, internal architecture, and habits you'd rather not expose. Sending it to a hosted service for a short nostalgic response might be a poor trade. Local inference lets the developer try the idea while keeping the data on their machine.

Local is a deployment choice, not a blanket privacy guarantee

Running the model locally removes one specific risk: you don't have to send the prompt to a hosted inference API. But it doesn't automatically make everything "private" in every sense. You still need basic access controls on the machine, avoid logging sensitive prompts unnecessarily, and make sure you understand which model and runtime are actually in play.

That distinction matters for teams. "Local AI" isn't a free pass on threat modeling. Before using a local model with company repos, check runtime configuration, whether the endpoint is exposed, machine policies, and what kinds of information show up in commit messages. And if someone modifies the tool to hit a remote endpoint, the privacy story changes immediately.

Local execution also shifts costs rather than deleting them. There may be no per-API-call cost, but inference uses your machine's resources and can be slower than a hosted setup. A small default model makes the experiment more approachable, but quality and speed depend on your hardware and the task. In the end, the right choice is the one that performs well enough for the use case - not the biggest model you can run.

Open weights make the behavior more inspectable and adjustable

Using an open-weight model with a small, readable client gives users more control. They can inspect how the prompt is assembled, swap models, or change the output format to match their repo. That matters because the output is subjective: one developer wants something warmer, another wants a more technical, straight-to-the-point summary.

It's also worth saying plainly: this isn't automatically a business case for every team. Hosted systems can be easier to operate and may support capabilities a local setup can't match. But when the data is personal, the task is bounded, and the user cares about control, local inference can be a better fit than a generic cloud integration.

What can teams learn from this small AI tool?

git-ghost is a small experiment, not a full production platform. Its main value is showing a workable pattern for a contained AI feature: pick a clear context source, define a specific output, keep the model's scope limited, and test the software around the model independently of live inference.

That pattern transfers to bigger tools. A team might summarize a release's change history, surface recurring themes in support notes, or help a maintainer review a long-running project. In each case, the model needs a defined input boundary and an output you can verify. A vague prompt over a big blob of data is harder to trust - and harder to improve.

Design for evidence, not just fluent output

Language models can tell a convincing story even when the evidence is thin. That's exactly why git-ghost's prompt asks the model to use only facts from the commit log.

For a business tool, it helps to go further: make the source material easy to inspect, separate direct evidence from interpretation, and give users a way to correct or reject the result.

A practical review checklist looks like this:

  • Input: Is the model getting only what it needs for this task?
  • Grounding: Can a user trace key claims back to a source record?
  • Uncertainty: Does the interface show where the source material is thin?
  • Fallback: Does the tool fail safely if Ollama is unavailable or the model output is unusable?
  • Evaluation: Are representative examples reviewed by people who understand the underlying work?

These aren't pointless bureaucracy. They help you see where an AI feature saves time and where it might create false confidence. If a wrong answer could actually cost someone something, the review bar needs to go up accordingly.

Keep the feature small until its value is clear

The strongest reason to start with a small AI tool isn't that small tools are always better. It's that a narrow experiment lets you learn with less operational and privacy risk. git-ghost can test whether developers enjoy revisiting their work through the project's history without needing accounts, a cloud service, or a big product surface area.

If people genuinely want more, the next step shouldn't be "add features automatically." Ask what users found valuable: the historical summary, the advice, the local execution, or just the ritual of looking back. Different answers point to different product decisions. If users only want a brief reflection, adding repository-wide analysis can increase complexity without adding much value.

For teams, a useful metric isn't whether the output sounds impressive. It's whether the feature helps someone make a better decision or finish a real task - while keeping the limitations obvious. If it does neither, then the "novelty" might be the whole product. That's not necessarily bad, as long as it's honest about what it is.

Conclusion

git-ghost takes a familiar developer artifact and gives it a specific, playful use: revisiting how a project changed, with a local model interpreting the commit history. The codebase is small, the data boundary is clear, and the model's role is straightforward. That's exactly what you want for an AI experiment.

The broader lesson is practical: start with a real input, limit what the model is asked to do, and make the trade-offs visible. Local inference can be a sensible choice when data control matters, but it still needs careful configuration and honest expectations. Build the smallest version that answers a useful question, then decide whether it's worth expanding.

Frequently Asked Questions

git-ghost is a small Python command-line tool that reads the oldest and latest commits in a Git repository. It asks a local language model to describe the project’s beginnings, changes, and one concrete suggestion in the voice of a developer’s past self.
In its described setup, it sends the prompt to a local Ollama endpoint and runs Gemma on the user’s machine. That avoids sending the history to a hosted model API, assuming Ollama is configured locally and the tool has not been modified to use a remote service.
Yes. Gemma, specified as gemma3:4b, is the default, and the tool accepts another Ollama model through the --model option. The quality and speed of the response will depend on the selected model and the machine running it.
No. Its prompt asks the model to use only facts in the commit log, which helps constrain the response, but a language model can still misinterpret evidence. Treat its output as a reflection to review, not a reliable or complete project history.

Related articles