Code reviews with local models in Liana
I work in a high security environment (space). We cannot leak any of our code to external APIs, even with Zero Data Retention, so cloud coding assistants are out of the question, and that includes the ones that review code. If I want an AI to look at a diff, the model has to run locally, on machines we control.
At work we started with opencode and Qwen3.6-35B-A3B. It is fast, since only 3B parameters are active per token, but the review quality was not enough and the comments stayed generic, missing the problems that mattered. Then I tried Qwen3.8-27B, the dense model I run with llama.cpp (described in my previous post). As a reviewer it is much better, it reads the diff carefully and points to real issues. But it is dense, every parameter works on every token, so it is much slower. And as an agent inside opencode the reviews were never finishing: the agent kept making tool calls, the model kept being slow, and the session stalled without delivering a complete review.

So I changed the approach. I converted my git client Liana into an agent to do code reviews. It already knows the repository (the graph, the diffs, the remotes) and it posts the review where it belongs, a GitLab merge request or a GitHub pull request. Making this work has been my own odyssey the last weeks. Local models have reduced context, moderate reasoning and little speed to spare, so every design decision goes in the same direction: the harness has to spend every token well.
What makes it work
- The diff is divided in batches. Liana splits the code diff in batches that fit in the reduced context of local models. Each batch is reviewed on its own and the comments accumulate into a single review, so even a pull request bigger than the context window gets fully reviewed.
- A reduced tools set. The model does not get a shell or the usual coding-agent toolkit. It gets a small harness with the few tools a reviewer needs, enough to look closer at the code under review and not enough to wander. Fewer tools also mean fewer wasted tokens at every step, and on a slow dense model that is the difference between a review that ends and one that does not.
- Reviews can be paused and continued. A dense 27B model takes its time. You can pause a review at any moment and continue later keeping all the previous context, so the model does not read the diff again and does not rebuild its understanding from zero.
- Loop recovery. Sometimes the local models loop and a batch ends abruptly. Liana lets you continue that batch from a previous point, keeping the work already done instead of throwing the whole review away and starting over.
- Human in the loop. The review comments are reviewed by a human before being posted to GitLab or GitHub. The model drafts the comments, I decide which reach the merge request and how they read. With local models this is not a luxury, it is how they stay useful.
The source and releases of Liana are on my GitHub: github.com/albertoruibal/liana. I just released Liana 0.5.2 and I am quite satisfied with how it works. I am still using it experimentally, but the review quality of the dense 27B model arrives at a pace the review can actually finish, and nothing gets posted to GitLab or GitHub before a human approves it.
