{
  "version": 1,
  "canonical": "https://xaede.net/writing/ai-code-review-de79a9a5e840",
  "title": "AI Code Review",
  "description": "Building review packets that give a coding agent the structure around a diff, with bounded context, risk indicators and explicit review instructions.",
  "language": "en",
  "manifest": "https://xaede.net/representations/index.json",
  "contentHtml": "<article class=\"reading-page\"><header class=\"reading-header\"><nav class=\"page-breadcrumb\" aria-label=\"Breadcrumb\"><ol><li><a href=\"/\">Home</a></li><li><a href=\"/writing\">Writing</a></li><li><span aria-current=\"page\">AI Code Review</span></li></ol></nav><div class=\"article-label\"><span>Essay / Medium</span><time datetime=\"2026-02-04\">February 4, 2026</time><span>7 MIN READ</span></div><h1>AI Code Review</h1><p class=\"byline\"><a href=\"/about\" rel=\"author\">Josh English</a></p></header><div class=\"reading-body prose\"><p class=\"article-subtitle\">Building a Principal Engineer Compatible With Every AI Agent</p><figure><img src=\"/media/essay-893ed9e3e6cd46c4.webp\" alt=\"\" loading=\"lazy\"></figure><p>There’s a special kind of chaos that happens when you ask a frontier model to review code. It’s not wrong in the way a compiler is wrong. It’s worse. It’s confidently helpful. It’s a well-structured review that routinely cites no evidence, invents intent, overlooks the one change that will page you at 2:07 AM, and then politely suggests you add more comments.</p><p>I got tired of that.</p><p>So I built a tool that generates what I kept wishing the model already had: the same contextual awareness a senior engineer builds in their head before they say anything out loud. Then I made it pipeable, because of course I did.</p><p>The result is an open-source tool I call <a href=\"https://github.com/josh-english-2k18/ai-code-review\" rel=\"noopener noreferrer\"><strong>AI Code Review</strong></a>. It doesn’t review the code by itself. It assembles <strong><em>review packets</em></strong>: high-fidelity, security-aware prompt inputs that let Claude Code, Codex CLI, and Gemini do what they’re actually good at when you stop starving them of reality, and give them an accurate and consistent foundation to work from.</p><p>And yes, some agents (hint: Gemini CLI) can be overly literal. So I stopped hoping it would infer what I meant and started writing prompts that establish a clear contract for how the agent will perform.</p><h2>The Problem</h2><p>The real problem here wasn’t asking an AI to review code, the problem was context collapse.</p><p>Most AI review workflows are either vibes or a copy/paste of a generic “review” prompt. Typically this will cause the agent to diff the code changes, then analyze them. While a diff is necessary, it’s not sufficient. Diffs don’t carry the invariants, the patterns, the “<em>we do it this way because prod taught us pain</em>,” the tests that define expected behavior, the runtime constraints, the security posture, the deployment shape, or the parts of the codebase that quietly turn your change into a distributed system.</p><p>A good reviewer doesn’t just read changes. They load a mental model. They scan the blast radius. They sanity-check assumptions against the codebase. They look for tests and configs. They read the surrounding files. They prove, not guess.</p><p>So I built a tool that forces the agent to do the same.</p><h2>Review Packets</h2><p>The core idea is simple: if you want a professional-quality code review, you need to give the reviewer professional-quality context. Instead of preparing a light snack for the agent, I wanted to give it a healthy meal.</p><p><a href=\"https://github.com/josh-english-2k18/ai-code-review\" rel=\"noopener noreferrer\">AI Code Review</a> generates a packet that includes the diff, but also compresses structure in a token-efficient way. In Python it uses AST extraction to capture signatures and docstrings without paying for implementation bodies. In JS/TS it uses heuristic parsing, with optional tree-sitter support when you want higher fidelity. It flags sensitive paths. It redacts secrets before anything ever leaves your machine. It chunks large changesets so you don’t get an “<em>I stopped reading at token 7,891</em>” non-review.</p><p>Then it wraps all of that in a SYSTEM prompt that behaves like a principal engineer who’s seen too many postmortems and has developed a healthy allergy to hallucination.</p><h2>The Evidence Gate</h2><p>Models will happily output a gorgeous review with zero grounding unless you force them to pay rent.</p><p>So the SYSTEM prompt includes an Evidence Requirement with explicit citation formats. If the packet provides line annotations, the agent must cite them. If it doesn’t, it must cite diff hunks. If it wants to reference anything outside the packet, it must actually open files in the repo and cite those reads.</p><p>That last part matters. A lot.</p><p>Because once you tell the agent “<em>you have full repo access, and you’re required to use it when the packet isn’t enough</em>,” you stop getting speculative advice and start getting the kind of review that says: I checked the lifecycle in the client, I inspected the app config, I traced the call sites, and here’s the exact line where your update handler quietly became <em>O(N)</em> per change.</p><p>Which is precisely the kind of feedback that prevents your UI from turning into a strobe light when the room gets busy.</p><h2>Taking Agents from Literal to Lethal</h2><p>Here’s the moment that made me grin like an idiot at my terminal.</p><p>I ran the AI code review against a real commit and piped it straight into <a href=\"https://geminicli.com/\" rel=\"noopener noreferrer\">Gemini CLI</a>. I wasn’t looking for eloquence. I was looking for proof that the agent would actually do the job: read context, cite evidence, and call out real risk.</p><p>It did.</p><p>It identified a performance blocker with a concrete, repo-cited snippet. It flagged missing tests for complex synchronization logic. It found an architectural hazard involving a static singleton dependency that would make isolation testing miserable. It asked the right questions about serialization intent. It even annotated rollout risks and re-render loop monitoring.</p><p>This wasn’t the usual “<em>seems good, consider adding docs</em>” fluff. This was a review that reads like someone who actually ships.</p><p>And the funny part is, nothing magical happened. The model didn’t get smarter. The prompt got <em>stricter</em>, the context got <em>richer</em>, and the <em>workflow</em> got closer to how real engineers reason.</p><p>That’s the entire thesis of agentic tooling in a sentence: intelligence is not the bottleneck, integration is.</p><h2>Review Orchestrator, not a Reviewer</h2><p><a href=\"https://github.com/josh-english-2k18/ai-code-review\" rel=\"noopener noreferrer\">AI Code Review</a> isn’t trying to replace human judgment. It’s trying to standardize the inputs that make judgment possible, whether the reviewer is human or silicon.</p><p>If you’ve ever onboarded a new teammate and watched them do their first review, you’ve seen the same pattern. They comment on surface-level issues because they don’t yet know what’s important. They miss the landmines because the landmines live in context. They can’t cite the real constraints because they haven’t found them.</p><p>A <em>review packet</em> is onboarding, compressed.</p><p>It gives the agent enough architectural awareness to be useful, and enough procedural discipline to be safe.</p><h2>Why Open Source?</h2><p>Because this is glue code the ecosystem needs.</p><p>We’re all building with multiple agents now. Claude Code is great at a certain kind of reasoning. Codex CLI is great at another. Gemini has its own strengths and its own literalism. The win isn’t picking one. The win is having a consistent, high-quality input format you can pipe into any of them and get review output that’s grounded, defensible, and actionable.</p><p>Also, selfishly, I want the community to break it. If you can find a way for a model to sneak a hallucination past an evidence contract, I want to know. That’s how this becomes a real tool instead of a clever demo.</p><p>The project is MIT licensed, because friction is the enemy of adoption.</p><h2>Give it a Try</h2><p>If you want to feel the difference immediately, run it against a non-trivial commit and pipe the prompt into the agent you already use.</p><pre># Generate a review prompt for the last commit<br>ai_review prompt /path/to/repo -base HEAD~1 -head HEAD -max-diff-lines 2000 -read-only | gemini<br><br># Working tree review, i.e. uncommitted changes<br>ai_review prompt /path/to/repo -mode working -read-only | gemini<br><br># Chunk large diffs for token limits<br>ai_review prompt /path/to/repo -base main -head feature-branch -chunked -read-only | gemini</pre><p>And if you’re the type of person who reads README files like they’re product strategy, here’s the repo:</p><p><a href=\"https://github.com/josh-english-2k18/ai-code-review\" rel=\"noopener noreferrer\">https://github.com/josh-english-2k18/ai-code-review</a></p><h2>The Punchline</h2><p>The best AI code review isn’t the one with the fanciest model. It’s the one that refuses to speak without evidence, knows how to interrogate the codebase when it’s missing context, and treats runtime reality as a first-class input.</p><p>In other words, it’s the one that behaves like a principal engineer.</p><p>So I built one you can pipe into your terminal.</p><p><a href=\"https://www.linkedin.com/in/joshua-s-english/\" rel=\"noopener noreferrer\"><em>Josh English</em></a><em> is a member of the Applied AI Association (AAIA) gaming council, and can be followed on X (</em><a href=\"https://x.com/JoshSeriesAI\" rel=\"noopener noreferrer\"><em>@JoshSeriesAI</em></a><em>)</em></p></div><footer class=\"article-footer\"><span class=\"eyebrow\">PUBLICATION RECORD</span><p>Full text recovered · Medium · February 4, 2026</p><a class=\"text-link\" href=\"https://medium.com/@jengas/ai-code-review-de79a9a5e840\" rel=\"noopener noreferrer\">Original publication <span aria-hidden=\"true\">↗</span></a><p class=\"small\">Original authorship and publication date are preserved. This edition restores the reading layout. Recovered historical images are hosted here; unavailable images are identified where relevant.</p></footer></article>",
  "structuredData": {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "Person",
        "@id": "https://xaede.net/#josh-english",
        "name": "Josh English",
        "url": "https://xaede.net/about",
        "sameAs": [
          "https://github.com/josh-english-2k18",
          "https://medium.com/@jengas",
          "https://www.linkedin.com/in/joshua-s-english",
          "https://x.com/JoshSeriesAI"
        ],
        "jobTitle": "VP of Engineering",
        "description": "Josh English is VP of Engineering at Chronicle Media and was previously CTO of Series Entertainment. His career spans more than twenty-five years of distributed systems, game technology and engineering leadership. At Google he worked as a lead engineer on large-scale services and applied ML; at Big Run Studios he led multidisciplinary technology teams across seven time zones and four countries. At Series he directed engineering, QA, DevOps and infrastructure supporting live commercial games and AI-enabled production. He also builds personal games and developer tools to investigate how emerging capabilities work in practice, and writes about engineering judgment, organisation design and product economics.",
        "mainEntityOfPage": {
          "@id": "https://xaede.net/about#webpage"
        }
      },
      {
        "@type": "WebSite",
        "@id": "https://xaede.net/#website",
        "url": "https://xaede.net/",
        "name": "Xaede",
        "alternateName": [
          "Xaede.net",
          "Josh English — Xaede"
        ],
        "inLanguage": "en",
        "publisher": {
          "@id": "https://xaede.net/#josh-english"
        }
      },
      {
        "@type": "WebPage",
        "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#webpage",
        "url": "https://xaede.net/writing/ai-code-review-de79a9a5e840",
        "name": "AI Code Review",
        "description": "Building review packets that give a coding agent the structure around a diff, with bounded context, risk indicators and explicit review instructions.",
        "inLanguage": "en",
        "isPartOf": {
          "@id": "https://xaede.net/#website"
        },
        "about": {
          "@id": "https://xaede.net/#josh-english"
        },
        "mainEntity": {
          "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#article"
        },
        "breadcrumb": {
          "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#breadcrumbs"
        }
      },
      {
        "@type": "BlogPosting",
        "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#article",
        "name": "AI Code Review",
        "headline": "AI Code Review",
        "description": "Building review packets that give a coding agent the structure around a diff, with bounded context, risk indicators and explicit review instructions.",
        "author": {
          "@id": "https://xaede.net/#josh-english"
        },
        "inLanguage": "en",
        "mainEntityOfPage": {
          "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#webpage"
        },
        "genre": "Essay",
        "datePublished": "2026-02-04",
        "wordCount": 1296,
        "isBasedOn": "https://medium.com/@jengas/ai-code-review-de79a9a5e840",
        "url": "https://xaede.net/writing/ai-code-review-de79a9a5e840"
      },
      {
        "@type": "BreadcrumbList",
        "@id": "https://xaede.net/writing/ai-code-review-de79a9a5e840#breadcrumbs",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://xaede.net/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "Writing",
            "item": "https://xaede.net/writing"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "AI Code Review",
            "item": "https://xaede.net/writing/ai-code-review-de79a9a5e840"
          }
        ]
      }
    ]
  }
}
