AltSenior AI: the code reviewer that thinks in trees, remembers the repo, and scores the noise

A deep-dive into the open-source review engine that pairs Tree-sitter parsing, repo-wide retrieval, and severity scoring to act less like a chatbot and more like a senior engineer.

11 min read • View on GitHub • More from evinjohnn

A black-ink editorial illustration of a code review pipeline built like a machine. A stack of source files feeds into a branching tree, then into a careful inspection chamber, and finally into a stamped scorecard. It explains that AltSenior AI turns code review into a sequence of evidence-based steps instead of a single prompt.
AltSenior does not ask the model to start from zero. It assembles evidence first, then asks for judgment.
Key Takeaways

Most AI code review tools start at the wrong end. They hand a diff to a model, ask for comments, and hope the model somehow infers the rest of the repository. AltSenior AI flips that sequence: it maps the codebase, extracts structure, pulls in context, and only then asks the model to judge what matters.

The real trick is sequencing

The repository’s own pipeline makes the thesis plain. A FileSystemAnalyzer maps what exists. A QualityDetector catches obvious patterns. An ASTAnalyzer turns source into structure with Tree-sitter. Then RAGService retrieves repo-wide context before AIProvider writes findings and SeverityScorer compresses the output into a quality score. That order matters. It pushes the probabilistic part of the system to the end, after the deterministic pieces have already narrowed the search space.

The review only becomes opinionated after it has been given structure, memory, and a ranking layer.

That design gives AltSenior a different personality from the average AI assistant. It is not trying to sound smart first. It is trying to be hard to fool. The repo brief also shows a dual personality architecture, with a TypeScript CLI at the center, a NestJS application context for dependency injection, and a Streamlit sidecar for visualization. That mix suggests a team thinking about adoption, not just model calls.

A close-up editorial illustration of a code diff being examined under a magnifying lens. Thin threads connect the diff to sibling files in the margin, while a compact index card stack sits behind it as repository memory. It explains how AltSenior combines local syntax with cross-file context before making a judgment.
The system does not review a diff in isolation. It pulls the surrounding files into the frame first.

Why Tree-sitter changes the game

Tree-sitter is the difference between text search and actual syntax awareness. A regex linter can spot a suspicious token sequence, but it cannot reliably tell whether that token lives inside a function body, a nested scope, or a different construct altogether. Tree-sitter gives AltSenior a structural backbone across many languages, which is why the repository can aim at broad language coverage instead of becoming a TypeScript-only toy.

const files = await fileSystemAnalyzer.scan()
const patterns = await qualityDetector.run(files)
const ast = await astAnalyzer.parse(files)
const context = await ragService.retrieve({ files, ast })
const review = await aiProvider.review({ ast, context, patterns })
return severityScorer.score(review)

The other half of the story is retrieval. By pairing AST parsing with repo-wide context, AltSenior can answer a question that a plain chat prompt usually cannot: what does this change mean in the rest of the codebase? That is the senior-reviewer instinct the project is chasing. It does not just inspect a patch. It assembles evidence from nearby files, then lets the model weigh the evidence in context.

What it looks like next to the blunt instruments

Review styleWhat it gets rightWhat it missesBest use
Prompt-only LLM reviewFast to prototype and easy to understandWeak memory, more hallucination risk, shallow contextQuick triage or one-off summaries
Static linterDeterministic, cheap, and precise about known rulesMisses cross-file reasoning and design intentStyle, correctness, and basic bug checks
CodeQLTreats code as data and supports semantic queriesRequires specialized queries and security expertiseSecurity analysis and large codebases
AltSenior AICombines structure, retrieval, judgment, and scoringMore moving parts than a single promptPrioritized AI-assisted code review

That is the interesting part of the project. It is not trying to replace static analysis, and it is not pretending an LLM can review code from scratch. It is building a smaller, stricter system around the model so the model has less room to be wrong. In practice, that means the output should feel less like chatbot prose and more like a review queue with reasons attached.

The repo’s practical signal

The implementation choices read as deliberate. A NestJS application context lets the CLI use dependency injection without starting a server. A separate web bridge lets the project show results without forcing a heavy frontend stack. A severity score turns a pile of findings into something a developer can act on in a minute, not an afternoon. Even the broad parser support points to the same idea: the system is trying to scale judgment, not just language coverage.