Code review
Screen a diff for runtime bugs
Find changes worth a closer human review before inspecting every line.
01 The question
Does file.patch directly support that this change likely introduces incorrect runtime behavior?
- true
- {"what":"The patch contains a realistic path to a wrong runtime result","examples":["A condition now handles the opposite case","A value is written to the wrong field"]}
- false
- {"what":"The patch is correct, non-behavioral, or lacks direct evidence of a bug","examples":["Formatting only","A refactor that preserves data flow"]}
Full instructions
{
"question": "Does file.patch directly support that this change likely introduces incorrect runtime behavior?",
"inspect": "file.patch",
"focus": "Concrete behavior, state, data-flow, or async errors introduced by added or modified lines",
"ignore": [
"Style preferences",
"Naming concerns",
"Unsupported speculation"
]
}Copy includes the complete instructions, criteria, usage notes, and attribution.
02 Input
A changed file with its Git patch and the changed tests. Keep surrounding lines when they affect behavior.
{
"file": {
"path": "src/checkout.ts",
"patch": "@@ -1 +1 @@\n-if (total > balance) throw new Error('Insufficient funds');\n+if (total < balance) throw new Error('Insufficient funds');"
},
"changedTests": []
}03 Answer & policy
A Noul value from 0 to 1: the model’s probability of a yes answer.
Your code decides what happens next.
Use this as a triage signal. The demonstration threshold of 0.5 sends a change for inspection; it never proves a bug or automatically blocks a merge.
04 Use it in your code
Node.js 24 · TypeSafe SDK 0.6.0 · Set TYPESAFE_API_KEY in your environment. Run on your server; API calls incur provider charges.
import { noul, TypeSafeClient, type JsonValue } from "@typesafe-ai/sdk";
// Illustrative input, not a recorded model test.
const state: JsonValue = {
"file": {
"path": "src/checkout.ts",
"patch": "@@ -1 +1 @@\n-if (total > balance) throw new Error('Insufficient funds');\n+if (total < balance) throw new Error('Insufficient funds');"
},
"changedTests": []
};
const client = new TypeSafeClient();
try {
const response = await client.systemOne({
model: "jev-latest",
state,
questions: {
correctness: noul(
{
"question": "Does file.patch directly support that this change likely introduces incorrect runtime behavior?",
"inspect": "file.patch",
"focus": "Concrete behavior, state, data-flow, or async errors introduced by added or modified lines",
"ignore": [
"Style preferences",
"Naming concerns",
"Unsupported speculation"
]
},
{
"true": {
"what": "The patch contains a realistic path to a wrong runtime result",
"examples": [
"A condition now handles the opposite case",
"A value is written to the wrong field"
]
},
"false": {
"what": "The patch is correct, non-behavioral, or lacks direct evidence of a bug",
"examples": [
"Formatting only",
"A refactor that preserves data flow"
]
}
}
)
},
});
const probability = response.answers.correctness.noul;
console.log({ probability, action: probability >= 0.5 ? "inspect_patch" : "continue_review" });
} catch (error) {
console.error("Decision unavailable; use your fallback or human review.", error);
process.exitCode = 1;
}The wrapper and example input are provided by Jev Directory. Checked against SDK types; no live model call was made. Pin a model version before evaluating production behavior.
Before you adapt it
- A diff may omit important context elsewhere in the repository.
- The complete source also checks security, reliability, compatibility, and test gaps.
More about the original project or pattern
What it does
Jev Review inspects either a current Git diff or the source files beneath a selected directory. It moves through a staged sequence: first screening a risk matrix, then profiling files, selecting evidence, classifying the mechanism, scoring severity, and choosing a specialist review path. The result is saved as structured data and presented in a local dashboard.
What you can reuse
The useful part is the orchestration shape. Broad screening happens before focused judgments, while thresholds and routing policy remain in ordinary TypeScript. Its split between domain types, repository adapters, review workflows, CLI entry points, and dashboard code also provides a legible example of keeping model calls away from presentation logic.
How it fits
The input is a diff or source tree. Jev supplies bounded judgments at several stages; application code decides which evidence advances and how a finding is presented. The repository describes findings as prompts for a reviewer rather than proof that a defect exists.
Setup and compatibility
The documented setup requires Node.js 24 or newer, Git, and a TypeSafe API key. It supports commands for reviewing changes, scanning a codebase, saving results, and opening the local report at 127.0.0.1.
Limitations
The author calls the project experimental. It does not integrate compiler diagnostics, static analyzers, or repository indexing, and this directory has not tested its runtime behavior. Treat every reported finding as an item to investigate.
Sources
Primary source: Jev Review repository.