Urgent.News

600+ sources. One page. See who else covered it.

Editions

Tech

How I built a 2-agent code review loop for local Ollama workflows

When running code reviews with local LLMs, a single model can either hallucinate non-existent bugs or generate generic advice you end up ignoring. To make local AI code review more useful, I built a closed Reviewer vs. Verifier loop for local Ollama workflows. The Architecture: Two Local Agents, One Loop Instead of trusting one model's output, the workflow splits the job into two roles: Agent 1…

In an effort to enhance the utility of local LLMs for code reviews, a developer has created a closed Reviewer vs. Verifier loop tailored for local Ollama workflows. Rather than relying on a single model's output, this workflow divides the task into two distinct roles: Agent 1, the Reviewer, and Agent 2, the Verifier.

Agent 1, the Reviewer, meticulously examines the git diff or file changes. Its primary focus is on identifying various issues such as logical flaws, security vulnerabilities, edge cases, or the absence of unit tests. Meanwhile, Agent 2, the Verifier, takes the findings presented by the Reviewer and rigorously challenges them. If a finding appears weak or unsupported, the Verifier discredits it, thus preventing it from moving forward in the process.

Conversely, if a finding remains robust and well-founded, it progresses to the next step, remaining visible for further consideration.

The primary objective of this loop is not to render the model always accurate but to make weak claims more apparent before any action is taken on them. This approach aims to catch potential issues early, thereby streamlining the code review process. To facilitate this workflow, the developer has packaged it into HAICHI, a desktop workspace designed for Windows and Linux operating systems. HAICHI connects to local Ollama models and allows for inspectable workflow state management.

Key features of HAICHI include a local-first workflow, enabling the execution of Reviewer and Verifier style loops around local models. This setup ensures a visible evidence trail, keeping task, review, challenge, and result all within one workspace, instead of scattered across various chat tabs. Additionally, HAICHI enforces scoped execution, keeping actions confined to the specific workflow in use.

Practical limits are also taken into account. Users can control the degree of concurrent agent work running on their machine, ensuring efficient resource management. The workflow can be tested on personal code using HAICHI Personal, which is available for free. The website (https://haichi.app) provides more information about the application and supports various operating systems, including Windows 10/11 and Linux distributions such as Ubuntu, Debian, and Arch.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Monday 3 August →