Skip to content

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 decide

Decision

// 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

  1. File kind. A file named *.eval.vibe or *.eval.vibex is an eval file. Its default export is one suite or an array of suites.
  2. Declaration. Experimental.Eval.suite(name, { target, cases, scorers, trials?, gate? }) builds a suite and runs nothing. Importing an eval file never spends a token.
  3. Typing. target is any function that returns an Effect: an effect function, a task or a workflow. input is the target's parameter tuple and expected is its success type. Both are inferred; a wrong case is an ordinary type error.
  4. Identity. A case's baseline key is the suite name, the case name and the target's tag. A task or workflow supplies its derived tag. A plain function supplies its name.
  5. Discovery is static. vibelang eval --list imports each eval file and prints suites and cases. It calls no target.
  6. The default run spends nothing. vibelang eval provides a model that replays recordings (std-test). A call with no recording is not sent: the case is undecided and the run exits 5. vibelang eval --live calls models and writes recordings. No environment variable changes which of the two runs.
  7. Baselines. A run compares scores with the committed baseline file beside the eval file (greet.eval.baseline.json) and exits 0, 1 or 5, the codes of Gate.ciGrade in the reference engine (an existing Effect durable-execution framework these built-ins are modelled on). --update rewrites the baseline, and never when a case failed or went undecided.
  8. Bundles. An eval file is never reachable from an application entry. The bundler plugins refuse an import of one from a non-eval file.
  9. No keyword. eval stays what it is in JavaScript, and what VIP-1 bans.

Why no syntax

A keyword would have to earnDoes it?
Something the compiler must deriveNo. Parameters and the success type come from inference.
Something the compiler must eraseNo. A file kind keeps evals out of bundles, as it does tests.
Fewer tokensAbout 8 per suite, for export default Experimental.Eval.suite( against eval greet {.
A TypeScript or TC39 precedentNone. 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.vibe or *.eval.vibex is 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. target is any function that returns an Effect: an effect function, a task or a workflow. Design · Review.
  • input is the target's parameter tuple and expected is 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 task or workflow supplies its derived tag. Design · Review.
  • A plain function supplies its name. Design · Review.
  • Discovery is static. vibelang eval --list imports each eval file and prints suites and cases. Design · Review.
  • It calls no target. Design · Review.
  • The default run spends nothing. vibelang eval provides 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 --live calls 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 exits 0, 1 or 5, the codes of the reference engine's Gate.ciGrade. Design · Review.
  • --update rewrites 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. eval stays 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. Parameters and the success type come from inference. Design · Review.
  • Parameters and 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( against eval 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.
  • theorem earned 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.X names 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)))
ProgramTokens (o200k_base)Lines
Vibe, proposed699
Reference engine 1.x32031

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.vibe files anyone can run for nothing.

What this changes

  • The toolchain learns one file kind and one command, vibelang eval, with --list, --live, --update and --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's eval, has no precedent, saves about 8 tokens and gives the compiler nothing to do.
  • Live by default, replay by flag. A plain vibelang eval in 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 keep vitest from spending.
  • eval as a member of a task, 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

  1. Command or Vitest? vibelang eval is a new command. The alternative runs evals as a Vitest project with a reporter. Recommendation: the command, because exit code 5 and --update have no Vitest equivalent.
  2. 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.
  3. 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 --trials above 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 --live

The 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, coverage and directories whose name starts with . are skipped.
  • Recording. One recording per eval file, greet.eval.recording.json, in the format Experimental.Test.record writes. Its suites share it; a recorded call is claimed once.
  • Live model. Under --live, a call with no recording goes to the eval file's live export, a LanguageModel layer such as export const live = Experimental.Model.use("anthropic:…"). A file with no live export 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.write prints. 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's gate thresholds still decide the exit code.
  • No baseline. A run with no baseline file exits 1 and names --update. It writes nothing.
  • Exit codes. 0, 1 and 5 as above; 1 outranks 5 across suites and files. An eval file that does not compile or exports no suite is 5, and so is a run that finds no eval file. A wrong command line, including --trials above 1 without --live, is 2 and runs nothing. --list with no eval file is 0.
  • 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.jsx id and a module declaration's output.

Not done here:

  • Rule 4, the target's tag. --list prints it. The runtime's baseline record is keyed by suite, case, scorer and step key; adding the tag is a change to Experimental.Eval, which std-eval owns.
  • Decision models. The default run replaces LanguageModel only. A DecisionModel a target needs is not provided.

Depends on

  • std-eval: Eval, Scorer, baselines, gates.
  • std-test: the recorded model behind the default run.