<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8" -->

---
title: Hybrid Automated Code Review: Deterministic AST Rules + LLMs
description: A two-tier CI code review architecture combines deterministic static analysis (ESLint AST rules and the TypeScript compiler) with an LLM-based semantic...
canonical: https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Hybrid Automated Code Review: Deterministic AST Rules + LLMs | daily.dev
og:description: A two-tier CI code review architecture combines deterministic static analysis (ESLint AST rules and the TypeScript compiler) with an LLM-based semantic...
og:url: https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8
og:image: https://api.daily.dev/og/posts/CPB0Eabf8.png
og:image:alt: Hybrid Automated Code Review: Deterministic AST Rules + LLMs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Hybrid Automated Code Review: Deterministic AST Rules + LLMs

**[SitePoint](https://daily.dev/sources/sitepoint)** · 20 min read · 0 upvotes · 0 comments

## Summary

A two-tier CI code review architecture combines deterministic static analysis (ESLint AST rules and the TypeScript compiler) with an LLM-based semantic reviewer gated behind that first tier. Tier 1 catches syntactic issues and short-circuits the pipeline before any LLM call if errors are found, saving cost and latency. Tier 2 extracts structured diff chunks via a custom parser, batches them within a token budget, and sends them to an LLM constrained to a strict JSON schema output (validated with Zod), de-duplicating against Tier 1 findings before posting inline PR comments via the GitHub REST API. The full walkthrough includes the GitHub Actions workflow YAML, a Node.js/TypeScript orchestrator script, a diff parser, security considerations (SHA validation, minimal permissions, avoiding untrusted input in shell commands), and cost/tuning guidance around model choice, temperature, and token budgets.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.sitepoint.com/build-hybrid-automated-code-review-deterministic-rules-llms>

## Questions this post answers

### Why do pure-LLM code reviewers generate so much noise on pull requests?

Pure-LLM reviewers tend to flag non-issues and invent style rules that contradict a project's existing ESLint or Prettier configuration, producing inconsistent feedback across identical diffs. In one internal evaluation, a pure-LLM reviewer generated roughly 4x the comments of a human reviewer on the same pull request, mostly hallucinated style nitpicks, causing developers to dismiss bot comments and lose trust once accept rates drop below roughly 50%.

_Teams weighing AI code review tools can compare real-world tradeoffs like this one on daily.dev before adopting._

### How can I stop an LLM code reviewer from calling the model on every pull request to save token costs?

Gate the LLM call behind a deterministic first tier: run ESLint and the TypeScript compiler with --noEmit first, and only invoke the LLM if that tier passes cleanly. In testing, roughly 30-50% of review runs had basic issues caught by ESLint or tsc, letting the pipeline skip the LLM call entirely and avoid its token cost for those PRs.

_Developers optimizing AI tooling costs can track patterns like this token-saving gate on daily.dev._

### How much does an LLM code review of a large pull request diff cost with GPT-4o-mini?

A 40-file monorepo diff review cycle can take 3-5 minutes and cost approximately $0.12 per run at GPT-4o-mini pricing when full file contents are sent naively. Restricting the LLM to structured diff chunks rather than full files, batched within a roughly 4,000-token budget per call, keeps token usage proportional to the actual change size instead of repository size, reducing this cost.

_Engineers budgeting for AI-assisted review workflows can dig into cost breakdowns like this on daily.dev._

## Similar posts on daily.dev

- [Build Automated PR Verification Gates for AI Code](https://daily.dev/posts/build-automated-pr-verification-gates-for-ai-code-lrynfep5j) · SitePoint · 0 upvotes · 0 comments
- [Linter integration with Copilot code review now in public preview](https://daily.dev/posts/linter-integration-with-copilot-code-review-now-in-public-preview-wspm2tt8d) · GitHub Changelog · 0 upvotes · 0 comments
- [The two-pass compiler is back – this time, it’s fixing AI code generation](https://daily.dev/posts/the-two-pass-compiler-is-back-this-time-it-s-fixing-ai-code-generation-itqmjdmpd) · InfoWorld · 0 upvotes · 0 comments
- [LLM Security Automation Isn’t a Drop-In Scanner Yet](https://daily.dev/posts/llm-security-automation-isn-t-a-drop-in-scanner-yet-08iduwsiq) · Liran Tal · 0 upvotes · 0 comments
- [AI Pull Request Security: AST Audit Harness in GitHub Actions](https://daily.dev/posts/ai-pull-request-security-ast-audit-harness-in-github-actions-d0knnt0pu) · SitePoint · 1 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#llm](https://daily.dev/tags/llm), [#typescript](https://daily.dev/tags/typescript), [#github-actions](https://daily.dev/tags/github-actions), [#code-review](https://daily.dev/tags/code-review)

[View this post on daily.dev](https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Hybrid Automated Code Review: Deterministic AST Rules + LLMs","url":"https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8"},"datePublished":"2026-09-14T21:12:13.693Z","dateModified":"2026-09-14T22:18:27.018Z","description":"A two-tier CI code review architecture combines deterministic static analysis (ESLint AST rules and the TypeScript compiler) with an LLM-based semantic...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/40c49e47e18e90e6a7add19ce540f3fd?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/40c49e47e18e90e6a7add19ce540f3fd?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SitePoint","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SitePoint","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/sitepoint","url":"https://daily.dev/sources/sitepoint"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,llm,typescript,github-actions,code-review","timeRequired":"PT20M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SitePoint","item":"https://daily.dev/sources/sitepoint"},{"@type":"ListItem","position":3,"name":"Hybrid Automated Code Review: Deterministic AST Rules + LLMs"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/hybrid-automated-code-review-deterministic-ast-rules-llms-cpb0eabf8#faq","mainEntity":[{"@type":"Question","name":"Why do pure-LLM code reviewers generate so much noise on pull requests?","acceptedAnswer":{"@type":"Answer","text":"Pure-LLM reviewers tend to flag non-issues and invent style rules that contradict a project's existing ESLint or Prettier configuration, producing inconsistent feedback across identical diffs. In one internal evaluation, a pure-LLM reviewer generated roughly 4x the comments of a human reviewer on the same pull request, mostly hallucinated style nitpicks, causing developers to dismiss bot comments and lose trust once accept rates drop below roughly 50%. Teams weighing AI code review tools can compare real-world tradeoffs like this one on daily.dev before adopting."}},{"@type":"Question","name":"How can I stop an LLM code reviewer from calling the model on every pull request to save token costs?","acceptedAnswer":{"@type":"Answer","text":"Gate the LLM call behind a deterministic first tier: run ESLint and the TypeScript compiler with --noEmit first, and only invoke the LLM if that tier passes cleanly. In testing, roughly 30-50% of review runs had basic issues caught by ESLint or tsc, letting the pipeline skip the LLM call entirely and avoid its token cost for those PRs. Developers optimizing AI tooling costs can track patterns like this token-saving gate on daily.dev."}},{"@type":"Question","name":"How much does an LLM code review of a large pull request diff cost with GPT-4o-mini?","acceptedAnswer":{"@type":"Answer","text":"A 40-file monorepo diff review cycle can take 3-5 minutes and cost approximately $0.12 per run at GPT-4o-mini pricing when full file contents are sent naively. Restricting the LLM to structured diff chunks rather than full files, batched within a roughly 4,000-token budget per call, keeps token usage proportional to the actual change size instead of repository size, reducing this cost. Engineers budgeting for AI-assisted review workflows can dig into cost breakdowns like this on daily.dev."}}]}
```

