VIP-59: Eval declarations: a file kind and a function, no syntax
Status: accepted by Will, 2026-11-23 (toolchain/CLI — *.eval.vibe file kind, vibelang eval, bundler refusal; no grammar changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implemented: vibelang eval with --list, --live, --update and --trials in the vibelang package (packages/compiler/eval.mjs), and the refusal of eval-file imports in vibelang-vite and vibelang-unplugin. See Implementation.
Will's words
Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them
Summary
Agentic behavior is probabilistic, so evals are as fundamental as tests.
One sentence. An eval is declared with one function call, Experimental.Eval.suite, in a file named *.eval.vibe, and it gets exactly the standing a test has: a file kind, a runner command and an exit code, with no new syntax.
One paragraph. This proposal gives evals no syntax, following the same convention as Vibe tests. A test is it.effect(…) in a *.test.vibe file. An eval is Experimental.Eval.suite(…) in a *.eval.vibe file. The compiler understands nothing about either, and TypeScript's inference already types an eval's cases against its target. What evals need from the toolchain is what tests have: discovery by file name, a command that runs them, and exclusion from production bundles. One thing differs: an eval can spend money, so the command calls no model unless it is told to. The runtime, with scorers, judges, baselines and gates, is std-eval.
a test an eval
file src/greet.test.vibe src/greet.eval.vibe
declares it.effect("…", () => effect { … }) export default Experimental.Eval.suite("greet", { target, cases, scorers })
asserts equal, or it fails a score in [0, 1], compared with a committed baseline
command vitest vibelang eval replays recordings, spends nothing
vibelang eval --live calls models, writes recordings
exit code 0 pass, 1 fail 0 pass, 1 regressed, 5 could not decideDecision
// proposed: src/greet.eval.vibe
effect function greet(name: string) {
return `Hello, ${name}`
}
export default Experimental.Eval.suite("greet", {
target: greet,
cases: [{ name: "ada", input: ["Ada"], expected: "Hello, Ada" }],
scorers: [Experimental.Scorer.exact]
})$ vibelang eval
greet ada exact 1.00 (baseline 1.00)
1 suite, 1 case, 0 regressed. 0 model calls.Rules
- File kind. A file named
*.eval.vibeor*.eval.vibexis an eval file. Its default export is one suite or an array of suites. - Declaration.
Experimental.Eval.suite(name, { target, cases, scorers, trials?, gate? })builds a suite and runs nothing. Importing an eval file never spends a token. - Typing.
targetis any function that returns an Effect: aneffect function, ataskor aworkflow.inputis the target's parameter tuple andexpectedis its success type. Both are inferred; a wrong case is an ordinary type error. - Identity. A case's baseline key is the suite name, the case name and the target's tag. A
taskorworkflowsupplies its derived tag. A plain function supplies its name. - Discovery is static.
vibelang eval --listimports each eval file and prints suites and cases. It calls no target. - The default run spends nothing.
vibelang evalprovides a model that replays recordings (std-test). A call with no recording is not sent: the case is undecided and the run exits5.vibelang eval --livecalls models and writes recordings. No environment variable changes which of the two runs. - Baselines. A run compares scores with the committed baseline file beside the eval file (
greet.eval.baseline.json) and exits0,1or5, the codes ofGate.ciGradein the reference engine (an existing Effect durable-execution framework these built-ins are modelled on).--updaterewrites the baseline, and never when a case failed or went undecided. - Bundles. An eval file is never reachable from an application entry. The bundler plugins refuse an import of one from a non-eval file.
- No keyword.
evalstays what it is in JavaScript, and what VIP-1 bans.
Why no syntax
| A keyword would have to earn | Does it? |
|---|---|
| Something the compiler must derive | No. Parameters and the success type come from inference. |
| Something the compiler must erase | No. A file kind keeps evals out of bundles, as it does tests. |
| Fewer tokens | About 8 per suite, for export default Experimental.Eval.suite( against eval greet {. |
| A TypeScript or TC39 precedent | None. The precedent in TypeScript is Evalite: evalite("name", { data, task, scorers }) in *.eval.ts. |
theorem earned syntax in VIP-43 because the compiler lowers and erases it. An eval is run, not lowered. A sampled score also proves nothing universal, so evals and theorems stay separate.
Maintainers' decisions
This is the decision record for the design above, including each API signature, rule and diagnostic table entry. The code examples illustrate those decisions. Will has not reviewed these choices.
- File kind. A file named
*.eval.vibeor*.eval.vibexis an eval file. Design · Review. - Its default export is one suite or an array of suites. Design · Review.
- Declaration.
Experimental.Eval.suite(name, { target, cases, scorers, trials?, gate? })builds a suite and runs nothing. Design · Review. - Importing an eval file never spends a token. Design · Review.
- Typing.
targetis any function that returns an Effect: aneffect function, ataskor aworkflow. Design · Review. inputis the target's parameter tuple andexpectedis its success type. Design · Review.- Both are inferred; a wrong case is an ordinary type error. Design · Review.
- Identity. A case's baseline key is the suite name, the case name and the target's tag. Design · Review.
- A
taskorworkflowsupplies its derived tag. Design · Review. - A plain function supplies its name. Design · Review.
- Discovery is static.
vibelang eval --listimports each eval file and prints suites and cases. Design · Review. - It calls no target. Design · Review.
- The default run spends nothing.
vibelang evalprovides a model that replays recordings (std-test). Design · Review. - A call with no recording is not sent: the case is undecided and the run exits
5. Design · Review. vibelang eval --livecalls models and writes recordings. Design · Review.- No environment variable changes which of the two runs. Design · Review.
- Baselines. A run compares scores with the committed baseline file beside the eval file (
greet.eval.baseline.json) and exits0,1or5, the codes of the reference engine'sGate.ciGrade. Design · Review. --updaterewrites the baseline, and never when a case failed or went undecided. Design · Review.- Bundles. An eval file is never reachable from an application entry. Design · Review.
- The bundler plugins refuse an import of one from a non-eval file. Design · Review.
- No keyword.
evalstays what it is in JavaScript, and what VIP-1 bans. Design · Review. - A keyword would have to earn Something the compiler must derive: Does it?: No.
Parametersand the success type come from inference. Design · Review. Parametersand the success type come from inference. Design · Review.- A keyword would have to earn Something the compiler must erase: Does it?: No. A file kind keeps evals out of bundles, as it does tests. Design · Review.
- A file kind keeps evals out of bundles, as it does tests. Design · Review.
- A keyword would have to earn Fewer tokens: Does it?: About 8 per suite, for
export default Experimental.Eval.suite(againsteval greet {. Design · Review. - A keyword would have to earn A TypeScript or TC39 precedent: Does it?: None. The precedent in TypeScript is Evalite:
evalite("name", { data, task, scorers })in*.eval.ts. Design · Review. - The precedent in TypeScript is Evalite:
evalite("name", { data, task, scorers })in*.eval.ts. Design · Review. theoremearned syntax in VIP-43 because the compiler lowers and erases it. Design · Review.- An eval is run, not lowered. Design · Review.
- A sampled score also proves nothing universal, so evals and theorems stay separate. Design · Review.
Adopted review answers
- Keep
Experimental.Xnames under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
Compared
The same suite for the reference engine 1.x. It type-checks against the reference engine's evaluation and scoring packages at 1.0.0-rc.16.
import { CaseExecutor, Runner, Suite } from "@smthrs/evals"
import { Binding, Scorer } from "@smthrs/scorers"
import { Effect, Layer } from "effect"
const greet = (name: string) => Effect.succeed(`Hello, ${name}`)
const exact = Scorer.make({
id: "example/exact",
version: "1",
name: "exact",
score: ({ groundTruth, output }) => Effect.succeed({ score: output === groundTruth ? 1 : 0 })
})
const executor = CaseExecutor.make((suiteCase) =>
Effect.map(greet(suiteCase.input as string), (output) => ({
output,
stepKey: suiteCase.name,
latencyMs: 0,
target: { name: "greet" }
}))
)
export const program = Effect.gen(function*() {
const suite = yield* Suite.make({
name: "greet",
cases: [{ name: "ada", input: "Ada", expected: "Hello, Ada" }],
bindings: [Binding.make({ scorer: exact, appliesTo: { name: "greet" }, groundTruth: "Hello, Ada" })],
concurrency: 1
})
return yield* Runner.run(suite, { runId: "local", at: "2026-11-09T00:00:00.000Z" })
}).pipe(Effect.provide(Layer.succeed(CaseExecutor.CaseExecutor)(executor)))| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 69 | 9 |
| Reference engine 1.x | 320 | 31 |
In the reference engine a case's input is unknown, so the executor casts it. The cast is the type error rule 3 removes.
Checked. The Vibe example uses only existing syntax. It compiles under vibelang 0.0.13 against a declaration of the proposed Eval.suite and Scorer.exact, including the inferred input and expected types. The reference-engine program type-checks as shown.
Principles
- TypeScript-first. A call and a file name, the pattern Vitest and Evalite set.
- Effect-second. A target is an Effect. A suite run is an Effect. Nothing new.
- Optimized for agentic programs. The eval example uses 69 tokens in Vibe and 320 in TypeScript.
- Highly forkable. A fork replaces the runner or the baseline format in the library.
- Factory-first. The factory's own evals, which measure how well agents write Vibe, are
*.eval.vibefiles anyone can run for nothing.
What this changes
- The toolchain learns one file kind and one command,
vibelang eval, with--list,--live,--updateand--trials. - The bundler plugins refuse to bundle an eval file into an application.
- No grammar changes.
Alternatives
- An
eval Name { case … }declaration. It clashes with JavaScript'seval, has no precedent, saves about 8 tokens and gives the compiler nothing to do. - Live by default, replay by flag. A plain
vibelang evalin CI or in an agent's loop would then spend. An unguarded live eval can start many coding-agent sessions before anyone stops it. - Evals inside test files,
it.eval(…). One file kind fewer. A test run must be free and fast; a live eval run calls models. Separate commands keepvitestfrom spending. evalas a member of atask, so a step carries its own cases. It welds test data to production code and into the plan's identity.- No standing at all: evals are scripts. That is today, and each project invents discovery, baselines and exit codes.
Follow-up questions
- Command or Vitest?
vibelang evalis a new command. The alternative runs evals as a Vitest project with a reporter. Recommendation: the command, because exit code5and--updatehave no Vitest equivalent. - Where baselines and recordings live. Beside the eval file, or in one directory. Recommendation: beside the file, so a review shows the score change next to the code change.
- Trials. Declared on the suite, chosen per run with
--trials, or both? Recommendation: both, and the flag wins. Replaying one recorded answer many times measures replay, so--trialsabove 1 requires--live.
Implementation
vibelang eval [--list] [--live] [--update] [--trials N] [path...] is packages/compiler/eval.mjs. It imports each eval file through the Node loader (vibelang/register) and runs its suites with the runtime's Experimental.Eval and Experimental.Test, resolved from the eval file so the suite and the runner share one copy of the runtime and of effect.
src/greet.eval.vibe the suites
src/greet.eval.baseline.json committed scores; written only by --update
src/greet.eval.recording.json model calls; written only by --liveThe rules above left these choices to the implementation. Will has not reviewed them.
- Paths. A path argument is an eval file or a directory searched for eval files. The default is the working directory.
node_modules,dist,build,coverageand directories whose name starts with.are skipped. - Recording. One recording per eval file,
greet.eval.recording.json, in the formatExperimental.Test.recordwrites. Its suites share it; a recorded call is claimed once. - Live model. Under
--live, a call with no recording goes to the eval file'sliveexport, aLanguageModellayer such asexport const live = Experimental.Model.use("anthropic:…"). A file with noliveexport fails the case that called a model. A suite that calls no model needs none. - Several suites. A file with one suite stores the baseline
Experimental.Eval.writeprints. A file with several stores{"suites":[…],"version":1}, one such baseline per suite. Two suites of one name in a file are refused. --update. The baseline is rewritten only when no case of the file failed, went undecided or had an inconclusive scorer. The run is then graded against the baseline it wrote, so the suite'sgatethresholds still decide the exit code.- No baseline. A run with no baseline file exits
1and names--update. It writes nothing. - Exit codes.
0,1and5as above;1outranks5across suites and files. An eval file that does not compile or exports no suite is5, and so is a run that finds no eval file. A wrong command line, including--trialsabove 1 without--live, is2and runs nothing.--listwith no eval file is0. - Bundlers. The plugins refuse at resolution: an import that resolves to an eval file from an importer that is not an eval file throws, in a build and in a dev server. An eval file may be an entry and may import another eval file. The name test also covers a served
x.eval.vibex.jsxid and a module declaration's output.
Not done here:
- Rule 4, the target's tag.
--listprints it. The runtime's baseline record is keyed by suite, case, scorer and step key; adding the tag is a change toExperimental.Eval, which std-eval owns. - Decision models. The default run replaces
LanguageModelonly. ADecisionModela target needs is not provided.