💡 Inspiration
The rapid adoption of AI coding assistants has introduced a dangerous new paradigm in software engineering: "vibe coding." Developers are rapidly generating massive volumes of code, which has shifted the enterprise bottleneck directly onto Senior Code Reviewers. We noticed our senior engineers were devolving into human linters—repeating the exact same feedback on Pull Requests day after day ("Use our custom logger, not print()" or "We use const, not var").
We tried using standard LLMs to automate this, but we discovered a fatal flaw: Stateless AI has amnesia. Standard AI reviewers evaluate code in a vacuum. They don't know your team's history, your custom libraries, or your previous architectural decisions. We were inspired to cure this amnesia by building an AI reviewer that actually remembers and scales the institutional knowledge of a senior engineer.
⚙️ What it does
SAGE (Stateful Audit & Generation Engine) is an autonomous code review agent that acts as an organizational immune system. Instead of generic syntax checks, SAGE enforces your team's unique engineering culture.
It operates on a continuous learning loop:
- Recall: When a developer submits code, SAGE queries its vector memory banks for historical mistakes, past human corrections, and specific engineering rules unique to that exact repository or team.
- Audit: SAGE injects this historical context into a high-speed LLM, allowing it to audit the new code for strict adherence to internal standards and flag anti-patterns before they reach production.
- Retain (The Feedback Loop): If a human reviewer disagrees with SAGE or introduces a new standard, they simply click a "Thumbs Down" UI button and type a one-line correction. SAGE vectorizes this feedback and permanently saves it to its memory bank—ensuring the mistake is never repeated.
🛠️ How we built it
SAGE is built on a modern, event-driven RAG (Retrieval-Augmented Generation) architecture.
- Frontend: We built a sleek, dark-mode web application using React, Vite, and Tailwind CSS. It is fully deployed on Vercel.
- Backend: Our API is powered by a Node.js/Express web service hosted on Render.
- Inference Engine: We used Groq (LLaMA-3) for blazing-fast inference, allowing us to process massive contextual prompts with near-zero latency.
- Stateful Agent Memory: We utilized Hindsight (by Vectorize) as our core vector database. We structure our memories by separating searchable semantic
contentfrom hard-filterablemetadata(liketeamNameandlanguage).
🚧 Challenges we ran into
- Database Concurrency & Locks: While initially seeding the Hindsight vector database with historical PR data, we hit PostgreSQL
max_locks_per_transactionout-of-memory errors because we overwhelmed the API with a synchronous loop. We had to pivot and implement background queueing to keep the pipeline stable under load. - Taming LLM Output in a UI: Getting an LLM to cleanly populate a React component library is notoriously difficult. Groq kept wrapping its JSON in Markdown blockquotes, which crashed our
JSON.parse()logic. We overcame this by ruthlessly optimizing our system prompts to enforce strict JSON schemas. - Vector Cross-Contamination: Initially, if the Marketing team saved a rule, the AI would hallucinate and apply it to the Payments team's code because the semantics were similar. We solved this by strictly enforcing pre-filter metadata (
$eq: teamName) before the vector search executes.
🏆 Accomplishments that we're proud of
We successfully cured LLM amnesia! We are incredibly proud of the "Aha!" moment when we tested SAGE. We fed it a bad Python snippet, corrected its generic review with a specific team rule, and then submitted the snippet again. Watching the AI instantly adapt and aggressively enforce the new custom rule without any manual prompt engineering was incredible. We built a system that actively turns human frustration into permanent institutional knowledge.
🧠 What we learned
- Stateless AI is a toy; Stateful AI is a teammate. A code reviewer without a persistent memory layer only catches syntax. Context is the ultimate moat for internal developer tools.
- RAG > Fine-tuning. We learned that organizational knowledge changes too rapidly to rely on fine-tuning. By using Hindsight for RAG, we can dynamically alter the AI's behavior in milliseconds via a database insert, without ever touching the model weights.
- UX drives Data Quality. The AI will only ever be as smart as the feedback it receives. Building a frictionless, one-click feedback loop in our UI was essential to incentivize developers to codify their tribal knowledge.
🚀 What's next for SAGE
- Direct GitHub PR Integration: Moving beyond the web UI to build a GitHub App webhook that automatically listens to pull requests, comments on specific lines of code, and accepts feedback directly via GitHub replies.
- 1-Click Auto-Remediation: Enhancing the UI so SAGE doesn't just point out the error, but generates a side-by-side Diff Viewer with a one-click "Apply Fix" button.
- The CTO Dashboard: Building a data visualization tab that aggregates vector memories to show engineering managers exactly where their teams are generating the most technical debt over time.
Built With
- cursor
- express.js
- groq
- hindsight
- llama-3
- lucide-react
- node.js
- react
- react-router
- render
- rest-apis
- stitch-ai
- tailwind-css
- vercel
- vite
Log in or sign up for Devpost to join the conversation.