Build Buddy: a local model fixed 6 of 6 C# build errors
A developer spent MLH Global Hack Week building Build Buddy, a small .NET tool that parses dotnet build output, sends each CS#### error to a local model and asks for an explanation plus a corrected file. With Gemma 3 4B via Ollama it fixed all six single-error samples, though the author is careful to call that a starting point rather than proof.
Key points
- The tool parses every CS#### line from dotnet build and feeds a few surrounding source lines to the model
- --verify copies the project to a temp folder, applies the patch and rebuilds; a fix only counts if the build is clean
- Gemma 3 4B runs locally through Ollama at temperature 0, so no code leaves the machine
- 6 of 6 single-error samples fixed, averaging about 11 seconds per error
- When Ollama could not allocate roughly 1.5 GB for the model, the tool now logs a failure instead of crashing
- Next up: two errors in one file, cross-file errors, async mistakes and generics
Build Buddy runs dotnet build, parses every CS#### line, reads a few lines of source around the error and asks Gemma 3 4B through Ollama, at temperature 0, for an explanation and a corrected file. The interesting part is --verify: the project is copied to a temp folder, the suggested patch is applied and the build is rerun. A sample only counts as fixed when the patched project compiles with zero errors, not merely when the original message disappears.
Day 1 landed 6 of 6 on deliberately easy single-error samples — CS0029, CS0103, CS0161, CS0246, CS1002 and CS1061 — at roughly 11 seconds per error. The author is explicit that this proves little about real C# code. One run also crashed when Ollama could not allocate about 1.5 GB for the model; the tool now records that as not fixed and keeps going. Harder cases are next.
Real-world use
- A local, offline helper for developers who want a quick explanation of compiler errors in a new C# project
- Generating build-error explanations in environments where source code may not be sent to a cloud service
- Teams that want a patch-and-rebuild verification step modelled on this tool in their own pipeline
- Setting up a small evaluation harness to measure how well local models handle C# compiler errors
Why it matters
It is a concrete, honestly scoped experiment on how far local models get with compiler errors, and its rebuild-based definition of "fixed" is a pattern worth copying in any AI-assisted tooling you build.