AI-Powered Code Review Platform Using Abstract Syntax Trees and LLM Context
baz · Tech · 2023 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: AI-assisted software development
Baz needed an AI reviewer that understood codebase context, not just isolated diffs, as coding agents generated more code requiring review.
Constraints:
- Large repositories cannot be naively dumped into an LLM context
- Agent tools must be security-reviewed rather than arbitrary
- LLM quality is probabilistic and needs benchmark-driven release confidence
Architecture
Baz builds code-review value around context: AST traversal and repository knowledge compact relevant code into LLM context, a constrained agent uses reviewed integrations, and traces plus benchmarks guard probabilistic review quality.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR pull-request-intake["Pull request intake"] ast-code-graph["AST code graph"] repository-knowledge-base["Repository knowledge base"] context-packer["Context packer"] constrained-agent-container["Constrained agent container"] tool-integrations["Tool integrations"] review-generator["Review generator"] tracing-and-benchmarks["Tracing and benchmarks"] pull-request-intake --> ast-code-graph pull-request-intake --> repository-knowledge-base ast-code-graph --> context-packer repository-knowledge-base --> context-packer context-packer --> constrained-agent-container constrained-agent-container --> tool-integrations tool-integrations --> constrained-agent-container constrained-agent-container --> review-generator review-generator --> tracing-and-benchmarks tracing-and-benchmarks --> review-generator
Components
| Component | Role | Interacts with |
|---|---|---|
Pull request intake |
Receives diffs, tickets, CI context, and repository metadata for review. | AST code graph, Repository knowledge base |
AST code graph |
Uses AST traversal to retrieve definitions and dependencies relevant to the diff. | Context packer |
Repository knowledge base |
Stores product, codebase, and integration knowledge behind the platform. | Context packer |
Context packer |
Compacts only relevant code and metadata into LLM context. | Constrained agent container |
Constrained agent container |
Lets the LLM choose reviewed integrations such as tickets and CI logs without arbitrary HTTP access. | Tool integrations, Review generator |
Tool integrations |
Fetch ticketing, CI, and observability context through deterministic APIs. | Constrained agent container |
Review generator |
Produces code-review findings from compacted context. | Tracing and benchmarks |
Tracing and benchmarks |
Use OpenTelemetry traces and tagged datasets to evaluate changes before release. | Review generator |
Data flow
The platform retrieves definitions and relevant context with AST/code-graph techniques, lets the LLM use deterministic integrations, and validates changes with benchmarks and observability traces.
3 supporting quotes
Why this architecture
The architecture limits tools and context because naive repository dumping overwhelms the model and integrations create prompt-injection surfaces.
Models used: Claude 3.5 Sonnet · GPT-4 · GPT-3.5
Scale
- The source emphasizes benchmark-driven releases with accepted 80-90% targets rather than expecting deterministic 100% LLM behavior.“the benchmark would not pass at 100%. Okay, this is not a test and LLM are statistical machines. So that means that um I mean we have benchmarks that aim for 80 to 90%.”transcript, implied
- Baz accepts benchmark pass bands around 80-90% rather than treating LLM review as deterministic.“the benchmark would not pass at 100%. Okay, this is not a test and LLM are statistical machines. So that means that um I mean we have benchmarks that aim for 80 to 90%.”transcript, stated
- The platform uses OpenTelemetry-style traces for inspection across observability backends.“we integrated uh we select the data it doesn't really matter we selected uh it's all based on open telemetry so if you use sentry or new or even uh the raw uh open telemetry stuff with uh Jagger and uh Grafana it should also work”transcript, stated
Alternatives considered (roads not taken)
Dump the whole repository or diff into the LLM
Rejected because: Baz uses AST-based context compaction because the model needs only relevant definitions and dependencies.
Differentiate on prompts or model access
Rejected because: The company argues defensible value comes from proprietary context rather than prompts or models.
Arbitrary agent HTTP calls to user-provided sites
Rejected because: Baz restricts tool integrations because connected PR content is a prompt-injection surface.
No benchmark before LLM-review changes ship
Rejected because: The source says release confidence depends on running changes against a tagged benchmark dataset.
Patterns
context-compaction (context-engineering)
AST traversal narrows the LLM input to relevant definitions and references instead of sending whole repositories.
tool-use-orchestration (agent-architecture)
The agent decides when a ticket reference requires a supported Linear/Jira lookup, while deterministic APIs perform the actual fetch.
observability-tracing (operations)
Baz traces LLM inputs and outputs with OpenTelemetry-compatible tooling so hallucinations and quality failures can be debugged.
eval-driven-development (evaluation)
Every release is measured against tagged benchmark data, with expected success rates reflecting statistical model behavior rather than deterministic tests.
safety-policy-enforcement (security)
Baz rejects arbitrary user-provided tool calls because pull-request diffs can be used as prompt-injection attempts.
Tradeoffs
Where to build defensible value in an AI code-review product.
Chose context construction around the codebase over prompt secrecy or exposing model choice as the feature.
Rationale: The CTO argues prompts can be extracted and models will improve, while context remains hard to build.
How to treat benchmark pass rates for LLM features.
Chose statistical quality bars over expecting deterministic 100% test passes.
Rationale: The team explicitly accepts that LLM benchmarks may target 80-90% or 40-50% depending on task difficulty.
Gotchas (what bit them)
Naive context loading overwhelms the LLM and hides useful structure.
Root cause: Repositories are graphs of calls, definitions, configs, and dependencies, not ordered piles of files.
Resolution: Baz uses AST traversal to pull only related definitions and references for the changed code.
LLMs can hallucinate full code reviews when expected diff data is missing.
Root cause: An early parameter mismatch left the model with an empty code field but no hard guard against fabricating a plausible PR.
Resolution: The team added tracing, observability, and benchmarks before design-partner releases.
Agent integrations become a prompt-injection surface.
Root cause: Users can open pull requests whose diffs try to instruct the LLM to perform unrelated actions.
Resolution: Baz limits the agent to supported, reviewed integrations and structured deterministic APIs.
Evaluation
Baz uses LLM tracing plus tagged benchmark datasets before releases, accepting non-deterministic success bands rather than binary test semantics.
Metrics: benchmark success bands · trace inspection · hallucination debugging
Outcomes
- Baz reviews AI-generated and human pull requests using codebase context, ticket context, and CI context.
- The product supports AI-code-generation workflows where Codex writes code, Baz reviews it, and Codex iterates.
The source is an interview rather than a metrics-heavy case study; it emphasizes product architecture and usage patterns more than customer-scale numbers.