CLI Reference¶
Complete documentation for all Assay commands.
Planning note: see CLI Command Grouping RFC for the selective noun-verb grouping direction and migration contract.
Installation¶
Verify installation:
Commands Overview¶
| Command | Description |
|---|---|
assay run | Run tests against traces |
assay policy | Author, validate, format, and migrate policies |
assay explain | Explain why trace steps were allowed/blocked |
assay bundle | Create/verify replay bundles |
assay replay | Replay from a replay bundle |
assay evidence | Manage evidence bundles, external evidence imports, and receipt schemas |
assay trust-basis | Generate, compare, and assert canonical Trust Basis artifacts |
assay trust-card | Generate Trust Card JSON, Markdown, and static HTML projections |
assay import | Import sessions from MCP Inspector, etc. |
assay migrate | Upgrade config from v0 to v1 |
assay doctor | Diagnose setup and optionally auto-fix known issues |
assay watch | Re-run on config/policy/trace changes |
assay monitor | Runtime Security (Linux Kernel Enforcement) |
assay mcp | MCP runtime commands: wrap, preflight, discover, kill, config-path, and tool signing |
assay project-enforcement-health | Project one health document or verified degradation bundle (lossy observation) |
| CLI Command Grouping RFC | Selective command grouping direction and compatibility contract |
Global Options¶
Common top-level options. --color is global: it parses before or after the subcommand. --quiet and --non-interactive are top-level only: place them before the subcommand (assay --non-interactive doctor --fix ...); after a subcommand each is a clap usage error (except where a command defines its own local spelling: sandbox, monitor, and mcp tool verify define their own local --quiet with its own meaning, and setup keeps a hidden --non-interactive alias for the same posture).
| Option | Description |
|---|---|
--help, -h | Show help message |
--version, -V | Show version |
--quiet, -q | Suppress the Running N tests... banner and progress lines of run/ci/watch/replay only; before the subcommand (env ASSAY_QUIET) |
--color auto\|always\|never | Control colored operator diagnostics, default auto (env ASSAY_COLOR) |
--non-interactive | Fail closed instead of prompting: any code path that would prompt refuses with exit 2 and names the remedy; before the subcommand (env ASSAY_NON_INTERACTIVE) |
Caller posture precedence (#2573, slices S1–S2)¶
| Posture | 1st: explicit CLI flag | 2nd: ASSAY_* env | 3rd: convention env / detection | Default |
|---|---|---|---|---|
| Quiet | --quiet/-q before the subcommand (run/ci/watch/replay progress + banners only) | ASSAY_QUIET (boolish; empty counts as unset) | — (never inferred from pipes) | full progress |
| Colour | --color auto\|always\|never (global) | ASSAY_COLOR (same vocabulary; empty counts as unset) | NO_COLOR (set, even empty, disables) → TTY | auto |
| Non-interactive | --non-interactive before the subcommand (fail-closed) | ASSAY_NON_INTERACTIVE (boolish; empty counts as unset) | TTY detection (refuse when a prompt is not showable; no CI=true inference) | interactive iff showable |
Rules:
- Flag beats env beats convention beats detection.
--colorbeatsNO_COLOR;--quietnever beats diagnostics — warnings, reason codes, fatal errors, and stdout documents are always emitted, with no exceptions: neither the top-level flag norASSAY_QUIETreaches another command's localquiet(sandbox,monitor,mcp tool verifykeep theirs). --non-interactiveis fail-closed: with the flag or env set, any code path that would prompt refuses with exit 2 and names the remedy (--yesfor confirms,OPENAI_API_KEYfor the embedder secret), even on a real terminal — like certbot's--non-interactive("run without ever asking for user input"), unlike zypper/debconf non-interactive mode, which assumes defaults.assay watch(a rerun loop with no one-shot meaning) refuses at startup under the flag. Explicit consent still works:--yes/--dry-runproceed as before.NO_COLORkeeps its long-standing meaning: present (even empty) disables decoration under--color auto.FORCE_COLORandCLICOLOR_FORCEare deliberately not honoured (agent CI images exportFORCE_COLOR; ANSI must not reach parsed output) — like anstream, which reads noFORCE_COLORvariable.- The colour rule above governs the operator-diagnostic sites (
run/ci/watch/replayfailures);validateanddemostill renderformat_terminal()unconditionally and the assay-core legacy policy path still emits raw ANSI — all pre-existing, all not yet covered (follow-up). (Machine-output aliases arrive in a later slice.)
Quick Examples¶
Run Tests¶
# Basic run
assay run --config eval.yaml
# Strict mode (fail on any violation)
assay run --config eval.yaml --strict
# Specific trace file
assay run --config eval.yaml --trace-file traces/golden.jsonl
# Machine-readable run report on stdout
assay run --config eval.yaml --trace-file traces/golden.jsonl --format json > results.json
# CI reports
assay ci --config eval.yaml --trace-file traces/golden.jsonl --sarif sarif.json --junit junit.xml
Generate Policy (With Diff Preview)¶
# Generate policy from trace
assay policy generate --input traces/session.jsonl --output policy.yaml
# Preview changes against existing policy file
assay policy generate --input traces/session.jsonl --output policy.yaml --diff --dry-run
Replay Bundles¶
# Create bundle from latest run artifacts
assay bundle create
# Verify bundle safety/integrity
assay bundle verify --bundle .assay/bundles/12345.tar.gz
# Replay from bundle (offline default)
assay replay --bundle .assay/bundles/12345.tar.gz
# Replay live with seed override
assay replay --bundle .assay/bundles/12345.tar.gz --live --seed 42
Migrate Config¶
# Upgrade to v1 format
assay migrate --config old-eval.yaml
# Preview changes without writing
assay migrate --config old-eval.yaml --dry-run
Validate Config And Trace¶
# Positional config path
assay validate eval.yaml --trace-file traces/golden.jsonl
# Equivalent explicit config flag
assay validate --config eval.yaml --trace-file traces/golden.jsonl
MCP Runtime¶
# Enforcing mode
assay mcp wrap --policy assay.yaml -- <real-mcp-command> [args...]
# Dry-run mode
assay mcp wrap --policy assay.yaml --dry-run -- <real-mcp-command> [args...]
# Discover local MCP servers
assay mcp discover --format json
# Review and explicitly promote one complete observed tool manifest
assay mcp manifest candidate --from-observed observed.json --out candidate.json
assay mcp manifest promote --candidate candidate.json --source observed.json --out declared.json
# Sign or verify MCP tool definitions
assay mcp tool sign tool.json --key private.pem --out signed.json
Diagnose and Watch¶
# Diagnose and auto-fix known issues
assay doctor --config eval.yaml --trace-file traces/dev.jsonl --fix --yes
# Live re-run loop on local edits
assay watch --config eval.yaml --trace-file traces/dev.jsonl --strict
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success (all tests passed) |
| 1 | Test failure (one or more tests failed) |
| 2 | Configuration error |
| 3 | Infrastructure/judge error |
| 4 | Would block (sandbox/policy) |
Environment Variables¶
| Variable | Description | Default |
|---|---|---|
ASSAY_EXIT_CODES | Exit code compatibility mode (v1 or v2) | v2 |
MCP_CONFIG_LEGACY | Enable legacy config mode when set to 1 | disabled |
ASSAY_STRICT_DEPRECATIONS | Fail on deprecated policy/config usage when set to 1 | disabled |
OPENAI_API_KEY | API key for OpenAI-backed judge/embedder paths | unset |
NO_COLOR | Disable colored output (present, even empty, disables under --color auto; --color always beats it) | unset |
ASSAY_QUIET | Boolish (1/0, true/false, yes/no, on/off); enables top-level --quiet (run/ci/watch/replay progress + banners only); empty counts as unset; invalid is a usage error | unset |
ASSAY_COLOR | auto\|always\|never; same meaning as global --color; empty counts as unset | auto |
ASSAY_NON_INTERACTIVE | Boolish (1/0, true/false, yes/no, on/off); enables top-level --non-interactive (fail-closed: refuse rather than prompt); empty counts as unset; invalid is a usage error | unset |
FORCE_COLOR, CLICOLOR_FORCE | Deliberately not honoured; ANSI must not reach parsed output | — |
Configuration File¶
Most run/ci commands read from eval.yaml by default:
version: 1
suite: my-agent
model: gpt-4o-mini
tests:
- id: args_valid
input:
prompt: "Summarize this task."
expected:
type: args_valid
policy: policies/default.yaml
See Configuration for full reference.
Command Details¶
-
assay run
Run tests against traces. The main command for CI/CD.
-
assay explain
Explain blocked/allowed trace steps and evaluated rules.
-
assay policy
Author, validate, format, and migrate policies.
-
assay import
Import sessions from MCP Inspector and other formats.
-
assay migrate
Upgrade configuration from v0 to v1 format.
-
assay doctor
Diagnose environment/config issues and apply known fixes.
-
assay watch
Watch files and rerun Assay on changes.
-
assay replay
Replay runs from a replay bundle (
--bundle), offline by default. -
assay bundle
Create and verify replay bundles.
-
assay evidence
Manage evidence bundles and import external evidence receipts.
-
assay trust-basis
Generate and compare canonical Trust Basis artifacts.
-
assay trust-card
Generate Trust Card JSON, Markdown, and static HTML projections.
-
assay mcp wrap
Wrap a real MCP process with policy enforcement for agent self-correction.
-
assay monitor
Real-time kernel enforcement (SOTA). Blocks attacks before they happen.