arrow_back Back to AIFC
K
pending Claude

A Code Review Agent That Remembers What Your Team Actually Wants

Grounded / Real Inflated / Uruttu
45% real
55% uruttu
article Original Content

I built a self-evolving code review agent! Most code review agents use the same prompt every time they run. They can review a diff and generate comments, but they do not remember what your team accepted, rejected, or corrected in previous reviews. That means the same mistakes can keep showing up across review cycles. This project adds persistent experiential memory to the review loop. Before every review, the agent retrieves relevant team rules and similar past review trajectories from memory, then uses that context alongside the current diff to generate review comments. After the review, the engineer can accept, reject, or edit every comment. That feedback becomes the learning signal. Accepted comments reinforce useful rules. Rejected comments create lessons about what should not be flagged. Edited comments refine the team’s preferred convention, scope, or wording. The agent adapts non-parametrically. Instead of fine-tuning the underlying model, it improves by storing review outcomes as reusable memory and retrieving the most relevant experience before the next review. Here is how the loop works: • Retrieve: search memory for relevant insights and similar past reviews before generating comments • Review: generate structured feedback using the current diff plus retrieved memory • Human feedback: pause the workflow and collect an accept, reject, or edit decision for every comment • Reflect: convert those decisions into reusable natural-language rules with rationale, polarity, scope, and confidence • Persist: store both the learned insights and complete review trajectory for future retrieval Over time, the agent builds a memory of how your team actually reviews code without retraining the underlying model. The full workflow runs locally with LangGraph, Ollama, BGE embeddings, and a vector database for long-term memory. The interesting part is that every review leaves behind experience that can be retrieved and reused on the next one. I've shared the complete implementation and setup in the comments!


    verified Validated Content
    Most code review agents run the same prompt on every review without retaining memory of what a team has previously accepted, rejected, or corrected, which can allow the same mistakes to recur across review cycles. This project adds persistent experiential memory to the review process: before each review, the agent retrieves relevant team rules and similar past review trajectories from memory, then uses that context alongside the current diff to generate comments. After review, engineers can accept, reject, or edit each comment, and that feedback becomes the learning signal — accepted comments reinforce useful rules, rejected comments create lessons about what not to flag, and edits refine preferred conventions, scope, or wording. Rather than fine-tuning the underlying model, the agent adapts non-parametrically by storing review outcomes as reusable memory and retrieving relevant past experience before each new review. The workflow follows a five-step loop — retrieve, review, collect human feedback, reflect (converting decisions into natural-language rules with rationale, polarity, scope, and confidence), and persist — and runs locally using LangGraph, Ollama, BGE embeddings, and a vector database for long-term memory storage.