@stlw/val
v1.1.0
Published
External eval harness that proves your product does what it claims — deterministic L0 checks + LLM-judged L2 rubric scoring
Readme
Val
The evaluation harness for testing whether your product does what it claims.
Val evaluates product behavior by running scenarios against CLI and HTTP interfaces or importing saved agent traces. It combines deterministic checks with optional model-based judging and writes versioned reports. It also supports repeated trials, comparisons, benchmark-pack validation, reviewed dataset export, hash-chained ledgers, and digest-pinned evidence manifests with optional Sigstore signatures. These results provide evidence for review; they do not prove that a product is correct or safe.
Repeated trials and paired experiments, regression comparisons, judge calibration and consensus, benchmark-pack validation/fetch, and reviewed trace-to-dataset export are part of the 1.x line. See the sections below for each workflow and its limits.
DecisionOps adds labelled decision-model evaluation, probability calibration, cost-aware threshold selection, and CI gates. See the DecisionOps guide for dataset, contract, and CLI details.
npm install -g @stlw/valVal requires Node.js ^20.17.0 or >=22.9.0.
Release status: This README tracks
mainand may describe changes that are not published yet. Check the npm package and GitHub releases for the latest released version and features.
See the compatibility policy for package/API stability and report-reader commitments, the migration guide for legacy reports, and the threat model for security boundaries and limitations. Report vulnerabilities privately as described in SECURITY.md.
For worked software, agent, policy, and memory evaluation paths, see the evaluation workflow guide. Measured local workload examples and scaling guidance are in Performance and scaling, and the judge calibration smoke report includes its dataset and limitations.
How it works
Scenario (YAML) Val harness Judge (LLM)
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ claim: "..." │──────▶│ L0 checks │──────▶│ rubric │
│ steps: [...] │ │ transcript │ │ verdict │
│ rubric: [...] │ │ captures │ │ overall │
└──────────────┘ └──────────────┘ └──────────────┘
│
┌──────▼──────┐
│ report │
│ ledger │
└─────────────┘L0 — Deterministic assertions on every step (exit codes, JSON shape, regex, negation). No model API is required for L0; Val runs these checks when invoked. Run them on every commit by configuring Val in your CI workflow.
L2 — An optional model-based judge scores the transcript against the product's claims via a rubric. Val uses OpenAI-compatible chat completions; Claude is supported through Anthropic's compatibility endpoint for testing and comparison (see its limitations below).
Quick start
- Write a scenario file (
my-product.yaml):
id: my-product
product: my-app
claim: "The CLI exits cleanly with a helpful message on bad input."
steps:
- name: store command
run: my-cli store --content "hello"
expect:
- { exitCode: 0 }
- { jsonPath: "$.id", exists: true }
capture: { id1: "json:$.id" }
- name: retrieve by id
run: "my-cli retrieve ${captures.id1}"
expect:
- { exitCode: 0 }
- { stdoutContains: "hello" }
- name: bad input should fail
run: my-cli store
expect:
- { not: { exitCode: 0 } }
- { stderrContains: "--content" }
rubric:
- id: clean-errors
criterion: "Error messages are human-readable — no stack traces."
weight: high
- id: captures-work
criterion: "Values captured from one step are correctly used in later steps."
weight: medium
judge: { threshold: 0.7 }- Run it:
val run my-product.yaml --judge remote- Review the report:
cat val-report/report.mdBenchmark packs
Val can validate a local benchmark-pack manifest and explicitly fetch one
selected split into a SHA-256-addressed local cache. A pack records its license,
source revision, scorer and metrics, requirements, and split role/visibility.
example, development, and evaluation describe intended use; public means
the assets are marked for public distribution, while restricted does not imply
that Val has or can access hidden data. A restricted split may have no assets.
val benchmark validate ./pack/manifest.json
val benchmark fetch ./pack/manifest.json --split exampleThe manifest contains explicit provenance, license, scorer, and split metadata; for example:
{
"schemaVersion": "val-benchmark-pack/v1",
"id": "sample-pack",
"version": "1.0.0",
"title": "Sample pack",
"description": "A small synthetic example",
"license": { "id": "MIT", "name": "MIT", "url": "https://opensource.org/license/mit", "attribution": "Synthetic example", "useNotes": "For illustration" },
"source": { "repository": "https://example.com/data", "revision": "abc123", "dataset": "sample", "task": "retrieval", "contaminationNotes": [] },
"scorer": { "id": "exact-match", "version": "1", "metrics": ["accuracy"] },
"requirements": { "network": false, "credentials": [] },
"splits": [{ "id": "example", "role": "example", "visibility": "public", "assets": [{ "path": "examples.jsonl", "url": "https://example.com/examples.jsonl", "sizeBytes": 128, "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "mediaType": "application/x-ndjson" }] }]
}Fetch verifies the exact declared size and SHA-256 before publishing each asset to the cache. Only the requested split is fetched. Pack files are treated as untrusted data: Val does not unpack archives, execute pack content, or contact a pack registry. Remote assets require HTTPS; validation itself is local and does not download remote assets. This release does not bundle benchmark datasets.
The manifest format is versioned as val-benchmark-pack/v1; its JSON Schema is
available at schemas/benchmark-pack.schema.json.
Reviewed trace datasets
val dataset export converts explicitly reviewed report fields into a local
JSONL training dataset. It is offline: it does not run an agent, call a model,
or contact a service. The review sidecar references exact report events and
JSON Pointers; it does not copy trace text. Its schemas are
dataset-review.schema.json and
training-example.schema.json.
val dataset export review.json \
--report val-report/report.json \
--output ./training-exportA minimal review sidecar looks like this (replace the digest and IDs with those from the exact report being reviewed):
{
"schemaVersion": "val-dataset-review/v1",
"reportId": "run-123",
"reportSha256": "<sha256-of-exact-report-bytes>",
"candidates": [{
"id": "example-1",
"task": "sft",
"status": "approved",
"reviewerId": "reviewer-1",
"reviewedAt": "2026-10-08T10:00:00Z",
"role": "training",
"license": { "id": "CC-BY-4.0", "attribution": "Source author", "useNotes": "Training permitted" },
"fields": {
"prompt": { "runId": "run-123", "eventId": "event-1", "pointer": "/input" },
"completion": { "runId": "run-123", "eventId": "event-2", "pointer": "/output" }
},
"sources": [{ "runId": "run-123", "eventId": "event-1", "pointer": "/input" }]
}]
}Only approved training candidates export by default. Evaluation and unknown
roles are excluded; held-out candidates are also excluded unless
--include-held-out is supplied explicitly. That flag is unsafe by design and
does not permit unknown-role records. Every exported candidate requires a
license identifier, attribution, and use notes. Val removes credential-named
fields and recognized credential patterns, but redaction is not a guarantee of
anonymity or a substitute for reviewing the emitted dataset. Inspect
dataset.jsonl and manifest.json before using or sharing the artifacts. The
manifest pins both the report and review-sidecar bytes; each JSONL example maps
every payload field to its originating run, event, and JSON Pointer. Do not use
private or restricted traces unless their license and your data
handling policy allow it. Val does not infer licensing rights.
Execution modes
Val runs locally by default. Local execution runs scenario shell commands as the current host user with the host environment and network access; it is intended for trusted scenarios and is not a sandbox. See the threat model for trust boundaries, Docker limitations, and operational guidance.
For scenarios that need a container boundary, opt into Docker explicitly:
val run scenarios/ --judge none \
--execution docker --docker-image local/my-test-image:latest \
--docker-memory 512m --docker-cpus 1 --docker-pids-limit 128Docker mode requires a local Docker Engine/Desktop context and an image that is
already present. Val does not pull or build images. The image must provide
/bin/bash, timeout, sleep, and cp. Val uses one container per scenario
across setup, shell/agent steps, and teardown; it mounts a temporary scenario
workspace read/write and the selected target checkout read-only, then copies
target contents into the writable workspace. The container root is read-only,
capabilities are dropped, no-new-privileges is set, /tmp is bounded, and
CPU, memory, process count, and command time are limited. The Docker daemon and
image remain trusted components; this is not protection against a compromised
daemon or malicious image.
Container networking is disabled by default. To expose a scenario service, use an internal Docker network and bind an explicit port to host loopback:
val run scenarios/api.yaml --execution docker \
--docker-image local/api-test:latest --docker-network internal \
--docker-port 3000:3000--docker-port is repeatable and uses HOST:CONTAINER; host ports bind only to
127.0.0.1. Val's HTTP steps can reach those mapped ports using a loopback URL.
For other HTTP destinations, add exact HOST:PORT entries with repeatable
--http-allow. Each redirect is checked again, DNS results are pinned for the
connection, and private/link-local/metadata addresses are rejected unless an
explicit IP-literal authority is allowed. --docker-network bridge is a
separate opt-in that permits container egress; reports state that egress is
enabled. Never use it when scenarios must have no outbound network.
Docker receives no ambient host environment. Pass scenario environment names
explicitly with repeatable --docker-env-allow NAME; Val's documented
container-local VAL_* built-ins are provided automatically. Reports record
allowed names, never values. Artifact export is off by default. To export exact
relative files, repeat --artifact-allow path/inside/workspace; Val rejects
traversal and symlink escape and copies existing regular files under
<report-dir>/artifacts/. Native execution reports use schema 1.3 and identify
the provider and effective restrictions; legacy 0.1/0.2 formats and schemas
1.0–1.3 remain readable. Local metadata explicitly says trusted-host, not
sandboxed.
Import an existing agent trace
val import-trace evaluates a locally saved trace without starting an agent or
contacting a model provider. It supports OpenAI Agents SDK trace/span exports
and Claude Agent SDK session JSONL:
val import-trace --adapter openai-agents --scenario scenarios/account.yaml ./trace.json --report-dir ./trace-report
val import-trace --adapter claude-agent-sdk --scenario scenarios/account.yaml ./session.jsonl --ledger ./val-ledger.jsonlOpenAI input is an object with the exported trace object and an ordered
spans array. Claude input is newline-delimited session records. The scenario
must use mode: agent and may define agentEvaluation; see the scenario
reference for criteria and the supported local
argument-schema subset. Imported trace reports use schema 1.1. The report
reader also accepts legacy 0.1/0.2 reports and schema versions 1.0–1.3; see the
migration guide. Unrecognized provider records are
retained as bounded opaque evidence.
Import reads one local file, capped at 10 MiB, with at most 100,000 records, 65,536 bytes per normalized event, and nesting depth 12. It does not execute the trace, invoke an SDK, or make network requests. It writes redacted JSON/Markdown reports and, when requested, a versioned hash-chained ledger entry; it never embeds the raw source file verbatim, though normalized messages and actions are retained as report evidence. Credential-like fields and known secret values from environment/scenario settings are redacted, but arbitrary sensitive prose is not detected automatically—review trace reports before sharing them. Metrics without enough source evidence are inconclusive; missing timestamps, token counts, completion markers, and currency conversions are not invented.
Judge modes
| Mode | Flag | Description |
|------|------|-------------|
| Remote | --judge remote | Live LLM via any OpenAI-compatible endpoint |
| TypeSafe | --judge typesafe | Jev score judgments with confidence and probability evidence |
| Mock | --judge mock | Deterministic mock — always passes (use VAL_MOCK_JUDGE_FAIL=id to force failures) |
| None | --judge none | Skip L2 entirely — L0 checks only |
# OpenAI
val run scenarios/ --judge remote --judge-base-url https://api.openai.com/v1 --judge-api-key $OPENAI_API_KEY --judge-model gpt-4o
# Anthropic Claude via its OpenAI-compatible endpoint
val run scenarios/ --judge remote --judge-base-url https://api.anthropic.com/v1 --judge-api-key $ANTHROPIC_API_KEY --judge-model claude-sonnet-4-6
# Local model via Ollama
val run scenarios/ --judge remote --judge-base-url http://localhost:11434/v1 --judge-model llama3
# Deterministic CI
val run scenarios/ --judge mock --ledger val-ledger.jsonl
# TypeSafe Jev (requires TYPESAFE_API_KEY)
val run demo/jev/claim.yaml --judge typesafe --judge-model jev-latestAnthropic describes its OpenAI-compatible chat-completions surface as intended
primarily for testing and model comparison, and not as a long-term,
production-ready solution for most use cases. Val uses this compatibility
protocol; it does not use Anthropic's native Messages API. Choose an active
model ID from
Anthropic's model lifecycle list.
Anthropic documents that response_format is ignored on this compatibility
surface, so JSON response formatting is not enforced there; Val validates the
returned judge structure but provider compatibility is not a structured-output
guarantee. See Anthropic's OpenAI compatibility limitations.
For labelled judge evaluation, val calibrate demo/jev/calibration/dataset.json
--judge typesafe writes accuracy, false-pass/false-fail rates, coverage,
agreement, and paired bias probes. Supply a reviewed dataset with explicit
label provenance for your own product. These metrics apply only to that dataset;
judge-reported confidence is not empirical confidence calibration.
Use --judge-models model-a,model-b with calibration to compare models, or
with val run to opt into strict-majority consensus. Consensus is off by
default, preserves each model's evidence, and marks ties or insufficient votes
inconclusive. Remote consensus requires a configured API key (no mock fallback).
val judge-compare baseline/report.json candidate/report.json --scenario
scenarios/claim.yaml runs a two-order A/B transcript comparison. Val removes
known identities from prompts, but this is best-effort blinding rather than a
guarantee of anonymity; tied or order-sensitive results are inconclusive.
Native execution reports use schema 1.3, preserve the execution provider and
effective restrictions, and include judge-attempt evidence when present.
Legacy 0.1/0.2 and report schemas 1.0–1.3 remain readable. Sensitive prose is
not identified automatically, so inspect reports before sharing.
Scenario reference
This README is a concise capability index. The scenario reference is the source for exact YAML semantics, defaults, template merge rules, scenario discovery, and complete examples.
| Top-level field | Purpose |
|-----------------|---------|
| id | Optional stable scenario identifier (otherwise derived from the file path) |
| product, claim | Required product name and behavior claim |
| tags | Labels used by --filter |
| env, files | Environment variables and files created in the isolated scenario workdir |
| setup, teardown | Shell commands before and after the scenario |
| timeoutMs | Total scenario time budget |
| mode | steps (default) or agent |
| goal, docs, maxSteps | Agent-mode goal, product guidance, and step limit |
| agentEvaluation | Strict success and tool criteria for imported agent traces |
| steps | Shell or HTTP interactions for step mode |
| rubric, judge | L2 criteria and per-scenario judge configuration |
| auth | Headers injected into later HTTP steps |
| extends, imports | Reusable scenario-template references |
| Step field | Purpose |
|------------|---------|
| name, description | Optional human-readable labels |
| run | A shell command (exactly one of run or http) |
| http | An HTTP request: method, url, optional headers and body |
| timeoutMs | Per-step time limit |
| expect | L0 assertions |
| capture | Named values extracted from the step result |
| allowFailure | Record a failed step and continue the scenario |
Interpolation and captures
Use ${name} interpolation in supported scenario strings. The built-ins are ${workdir} (the isolated scenario directory), ${cwd} (the directory from which Val was invoked), and ${target} (the temporary target checkout when --target-ref is used). A capture named id is available to later values as ${captures.id}.
Repeated runs also provide ${seed} and VAL_SEED when --seed is supplied. Trial seeds increment from the base seed. Val records the supplied value but cannot make an arbitrary target or remote judge deterministic.
capture maps names to one of these expressions:
| Expression | Captured value |
|------------|----------------|
| json:<path> | Value at a JSON path in stdout, for example json:$.id |
| regex:<pattern> | First capture group, or whole match, from stdout or stderr |
| stdout: | Trimmed stdout |
Step types
Val supports two step adapters:
Shell — runs bash -c <command> against the target CLI:
steps:
- run: my-cli store --actor alice --content "hello"
expect: [{ exitCode: 0 }, { jsonPath: "$.id", exists: true }]
capture: { id: "json:$.id" }HTTP — drives REST APIs via fetch:
steps:
- http:
method: POST
url: "http://localhost:3000/items"
body: { name: "widget" }
expect: [{ status: 201 }, { jsonPath: "$.id", exists: true }]
capture: { itemId: "json:$.id" }Expectations
L0 checks available on every step:
| Expectation | Applies to | Description |
|-------------|-----------|-------------|
| { exitCode: n } | shell | Exit code equals n |
| { status: n } | http | HTTP status equals n |
| { stdoutContains: s } | both | Stdout contains substring |
| { stderrContains: s } | both | Stderr contains substring |
| { outputContains: s } | both | Combined output contains substring |
| { outputMatches: re } | both | Combined output matches regex |
| { jsonPath: p, ... } | both | Stdout parsed as JSON; equals, exists: true, gte, lte |
| { maxDurationMs: n } | both | Step completed in ≤ n ms |
| { fileExists: path } | both | File exists in the scenario workdir (path supports ${...} interpolation) |
| { fileContains: { path, contains } } | both | File in workdir contains substring |
| { not: <expectation> } | both | Negates any expectation (nestable) |
A timed-out step fails all its expectations. File paths resolve against the scenario workdir; paths escaping it fail the check.
Scenario timeout
Cap an entire scenario (setup + steps) with timeoutMs:
id: slow-suite
product: my-app
claim: "The full flow completes quickly."
timeoutMs: 30000
steps:
- run: my-cli full-flowEach command's timeout is capped to the remaining budget. On expiry the scenario fails with scenario timed out after Nms; teardown still runs.
Shared templates
Reuse config across scenarios with extends (single-inheritance) and imports (compose multiple blocks):
# profiles/base.yaml
product: my-app
tags: [smoke]
env:
DB_URL: sqlite://test.db
setup:
- my-cli provision --db-url "${DB_URL}"# scenarios/login.yaml
id: login
claim: "Users can authenticate."
extends: ../profiles/base.yaml
imports:
auth: ../profiles/auth.yaml
steps:
- run: my-cli login --user aliceMerge rules: scalars override, objects deep-merge, arrays append (setup/teardown/tags). Steps come from the scenario file — templates provide env, files, setup, teardown, tags, auth, and judge config. Child rubric replaces parent rubric entirely. Template files live anywhere; they're loaded by relative path from the scenario file. Cycle detection prevents circular references.
Auth injection
Declare an auth block to auto-inject headers into HTTP steps after a capture is available:
auth:
inject:
headers:
Authorization: "Bearer ${captures.token}"After any step captures captures.token, subsequent HTTP steps automatically get the Authorization header. Step-level headers override injected headers. Auth is inactive before the capture is established (no error).
Agent mode
Let Val drive the product like a user, generating steps from a goal using the same LLM-backed judge endpoint:
id: explore
product: my-app
claim: "Users can create and retrieve items."
mode: agent
goal: "Create an item with content 'hello' and retrieve it by the returned ID."
docs: |
Create: POST /items with { content } → { id, content }
Get: GET /items/:id → { id, content }
maxSteps: 8
rubric:
- id: crud-works
criterion: "An item was created and successfully retrieved."
weight: highThe agent receives shell + HTTP tools, observes outputs, and decides next steps. maxSteps (default 20) caps iterations. timeoutMs is checked only between agent iterations, so a single LLM call or action can exceed it; expiry does not currently mark the scenario timed out. After a successful run, --freeze prints the executed steps as YAML so the same action sequence can be replayed; it does not make the target or model deterministic.
Parallel execution
Run scenarios concurrently with --parallel <n>:
val run scenarios/ --parallel 4 --bailResults are reported in definition order. --bail stops launching new scenarios on first failure and waits for in-flight ones to drain.
Target references
Evaluate scenarios against another branch, tag, or commit of the current Git repository without switching the caller's checkout:
val run scenarios/ --target-ref main --judge mockVal resolves the ref locally first. If it is missing and an origin remote exists, Val fetches only a ref that Git accepts as a branch name, with tags disabled. It then creates one temporary detached Git worktree for the run and exposes its path as ${target} and VAL_TARGET_DIR.
Scenarios remain responsible for preparing the target. Val does not guess the package manager or build command:
setup:
- npm --prefix "${target}" ci
- npm --prefix "${target}" run build
steps:
- run: node "${target}/dist/cli.js" --versionScenario commands still run in their isolated scenario workdirs. The target checkout is removed after the run, including when scenarios fail. --keep-workdir applies only to scenario workdirs.
In CI, the default shallow actions/checkout may not contain the requested ref. Val's narrow origin fallback fetches branch names only; checkout tags or commit IDs explicitly when needed.
Ledger
Every run can append a hash-chained record to val-ledger.jsonl:
val run scenarios/ --ledger
val verify-ledger val-ledger.jsonl
# ledger valid: 3 recordsEach record is chained via SHA-256 of the previous record. Changes to retained records are detectable, but the ledger does not prevent deletion or truncation; protect the file and its backups at the filesystem level. See the threat model.
Evidence manifests and Sigstore
Create a versioned manifest that hashes a report and, optionally, a ledger and explicit scenario/template/dependency inputs:
val evidence create val-report/report.json --ledger val-ledger.jsonl \
--scenario-input scenarios/account.yaml --output val-evidence.json
val verify-evidence val-evidence.json --report-file val-report/report.json \
--ledger val-ledger.jsonl --scenario-input scenarios/account.yaml --allow-unsignedThe manifest records exact-byte SHA-256 digests, Val run/scenario identity, source repository and commit, dirty-tree state, and only allowlisted GitHub Actions metadata. It does not inventory dependencies automatically or copy arbitrary environment variables. Unsigned verification is integrity-only: it detects modifications but does not authenticate who created the evidence.
In a trusted GitHub Actions main or version-tag run, add --sign to create a
Sigstore bundle alongside the manifest:
val evidence create val-report/report.json --ledger val-ledger.jsonl \
--scenario-input scenarios/account.yaml --output val-evidence.json --signThe CI signing job runs after Node and Bun checks, uses job-scoped OIDC permission, self-verifies, and uploads the report, ledger, manifest, and bundle together. Verify using independently chosen trust inputs (never values taken from the manifest):
val verify-evidence val-evidence.json \
--report-file val-report/report.json \
--ledger val-ledger.jsonl \
--scenario-input scenarios/account.yaml \
--bundle val-evidence.json.sigstore.json \
--certificate-issuer https://token.actions.githubusercontent.com \
--certificate-identity 'https://github.com/OWNER/REPOSITORY/.github/workflows/ci.yml@refs/heads/main'Signed verification fails without both the expected issuer and exact certificate identity. Authenticity establishes the integrity and signer identity of the specific manifest bytes; it does not establish that report claims are true.
CLI reference
run is the default — if you omit the subcommand, val scenarios/ is equivalent to val run scenarios/.
val run <paths...> [options]
Load scenarios from YAML files, execute steps, run L0 checks, optionally run L2 judge, and write a report.
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| --judge | "remote", "typesafe", "mock", "none" | "mock" (or "remote" if VAL_JUDGE_API_KEY or OPENAI_API_KEY is set) | Judge mode |
| --judge-model | string | "gpt-4o" / VAL_JUDGE_MODEL for remote; "jev-latest" for TypeSafe | Model name for the selected judge |
| --judge-base-url | string | "https://api.openai.com/v1" or VAL_JUDGE_BASE_URL env var | Base URL for an OpenAI-compatible endpoint |
| --judge-api-key | string | VAL_JUDGE_API_KEY or OPENAI_API_KEY env var | API key for the remote judge |
| --threshold | number (0–1] | 0.7 (or per-scenario judge.threshold) | Minimum overall score for L2 to pass |
| --filter | string | — | Comma-separated tags; runs scenarios matching at least one requested tag and scenarios with no tags |
| --bail | boolean | false | Stop after the first failing scenario |
| --keep-workdir | boolean | false | Do not delete the temp working directory after the run |
| --keep-ansi | boolean | false | Preserve ANSI escape sequences in captured output |
| --report-dir | string | "./val-report" | Directory for the written report file |
| --ledger | string (optional value) | "./val-ledger.jsonl" if flag present | Append a hash-chained ledger record. Use bare --ledger for default path, or --ledger <file> for a custom path. |
| --parallel | positive integer | 1 | Maximum number of scenarios to run concurrently |
| --freeze | boolean | false | For agent-mode scenarios, print executed steps as YAML so the action sequence can be replayed; target behavior is not guaranteed deterministic |
| --target-ref | string | — | Evaluate against a local branch, tag, or commit, or fetch a missing branch name from origin, in a temporary detached target worktree |
| --repeat | positive integer | 1 | Run ordered trials; scenario concurrency from --parallel applies inside each trial |
| --seed | non-negative safe integer | — | Set per-trial VAL_SEED and ${seed} values starting at this seed |
| --execution | local or docker | local | Select trusted-host local execution or opt-in Docker execution |
| --docker-image | image reference | required for Docker | Use an already-present local Docker image; Val never pulls it |
| --docker-memory | Docker memory size | 512m | Per-container memory limit |
| --docker-cpus | positive number | 1 | Per-container CPU quota |
| --docker-pids-limit | positive integer | 128 | Maximum container process count |
| --docker-network | none, internal, bridge | none | bridge explicitly permits container egress |
| --docker-port | HOST:CONTAINER (repeatable) | — | Publish service port on 127.0.0.1; requires internal network |
| --docker-env-allow | variable name (repeatable) | — | Pass a scenario environment variable into the container |
| --http-allow | exact HOST:PORT (repeatable) | — | Allow host-side HTTP destinations in Docker mode; redirects are revalidated |
| --artifact-allow | relative file path (repeatable) | — | Export listed regular files under <report-dir>/artifacts/ |
Native runs use report schema 1.3 and include run events, scores, provenance, execution identity, and, for experiments, aggregates and missing-trial counts. The parser accepts legacy 0.1/0.2 formats and report schemas 1.0–1.3. Tokens are reported only when a provider exposes usage. See Report files and the consumer contract.
val experiment <experiment.yaml> [options]
Run a controlled experiment from YAML. Paths are relative to the YAML file.
id: release-candidate-check
scenarios: [./scenarios]
repeat: 10
seed: 42
baseline: { targetRef: main }
candidate: { targetRef: release-candidate }
gate: ./production-gate.yamlBaseline and candidate must be provided together. Val runs the same scenario
set and seeds against each detached target checkout, then writes each experiment
under val-report/baseline/ and val-report/candidate/, plus the comparison at
the report root.
val compare <baseline/report.json> <candidate/report.json> [options]
Compare legacy 0.1 single-run reports, 0.2 experiment reports, or report schema
versions 1.0–1.3. Outputs are comparison.json and comparison.md under
--report-dir; see the migration guide for legacy input
details.
minSamples: 5
maxSuccessRateDrop: 0.05
maxFailureRateIncrease: 0.05Gates become inconclusive when either side has fewer than minSamples
completed trials (default 5). Inconclusive and passing comparisons exit 0;
failed gates exit 1; malformed inputs exit 2. Intervals describe observed
uncertainty and do not claim statistical significance.
For a ready-to-run Jev walkthrough, see demo/jev. It uses
TYPESAFE_API_KEY only at runtime and shows how to retain and compare TypeSafe and
remote judge reports.
val verify-ledger [file]
Verify the hash-chain integrity of a ledger file.
| Argument | Description |
|----------|-------------|
| [file] | Path to the ledger file. Defaults to "./val-ledger.jsonl"; --ledger <file> may also supply the path. |
Exits 0 with ledger valid: N records on success, or 1 describing the mismatch on tamper detection.
Works with
Remote judge mode uses an OpenAI-compatible /v1/chat/completions endpoint;
TypeSafe/Jev is a separate judge adapter:
- OpenAI and other OpenAI-compatible endpoints
- Anthropic Claude (OpenAI-compatible endpoint; intended mainly for testing and comparison)
- DeepSeek
- Ollama (local models)
- Groq, Together, Fireworks, and other compatible endpoints. Provider behavior, model availability, and structured-output support can differ.
CI
The repository includes a composite GitHub Action that installs Val, exposes passed and exit-code outputs, uploads the report and ledger by default even on failure, and then enforces the result:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # make the pull-request head commit available to --target-ref
- uses: stalewell/[email protected]
with:
scenarios: scenarios/
version: "@stlw/[email protected]"
judge: mock
target-ref: ${{ github.event.pull_request.head.sha }}The action's version input defaults to the latest published @stlw/val
package. Set an explicit package version when you need reproducible CI; pin the
action itself to a full commit SHA in security-sensitive repositories.
GitHub Action reference
| Input | Default | Description |
|-------|---------|-------------|
| scenarios | — (required unless experiment is set) | Scenario file or directory passed to val run |
| experiment | — | Experiment YAML passed to val experiment; takes precedence over scenarios |
| version | @stlw/val@latest | npm package spec to install |
| judge | none | Judge mode or provider |
| report-dir | val-report | Directory for JSON and Markdown reports |
| ledger | val-ledger.jsonl | Path for the evidence ledger |
| target-ref | — | Local branch, tag, or commit, or a missing branch name fetched from origin |
| threshold | — | Passing score threshold |
| parallel | — | Scenario concurrency |
| repeat | — | Ordered trial count |
| seed | — | Non-negative base seed for per-trial VAL_SEED and ${seed} |
| bail | "false" | Stop launching scenarios after the first failure |
| upload-artifacts | "true" | Upload report and ledger even when evaluation fails |
| artifact-name | val-evidence | Uploaded evidence artifact name |
| node-version | "20" | Node.js runtime used by Val |
| Output | Description |
|--------|-------------|
| exit-code | Val process exit code |
| passed | Whether Val exited successfully; inconclusive comparison gates count as success |
Development
npm ci
npm run typecheck # tsc --noEmit
npm test # vitest run
npm run build # tsup → dist/
node dist/cli.js run scenarios/examples/echo.yaml --judge mock