# Dynobox Documentation Corpus --- --- This file concatenates the public Dynobox documentation into one plain-text corpus for agent ingestion. --- --- # Page: Dynobox Docs Canonical URL: https://docs.dynobox.xyz/ Markdown URL: https://docs.dynobox.xyz/README.md Source: https://github.com/dynobox/dynobox/blob/main/docs/README.md Topics: overview, agent testing, dashboard, custom uploads, harnesses, assertions, CLI mocks, config formats # Dynobox Docs Dynobox is a local test runner for agent and skill workflows. You describe a task, choose one or more local agent harnesses, and assert on observable behavior such as tool calls, shell commands, files in the scenario work directory, transcripts, HTTP requests, and final messages. Dynobox is useful when you want repeatable checks for agent behavior before shipping a prompt, skill, or workflow change. ## Start Here - [Getting Started](./getting-started.md): install the CLI, scaffold a dyno, and run your first scenario. - [How It Works](./how-it-works.md): follow a job from its fresh work directory through evidence capture, assertion evaluation, and the recorded result. - [Agent Skills](./agent-skills.md): install AI agent skills for creating dynos and debugging failed runs. - [Config Authoring](./config-authoring.md): write JavaScript, TypeScript, or YAML dynos with the `@dynobox/sdk` helpers. - [MCP Mocks](./mcp-mocking.md): provide HTTP tool fixtures, assert on received calls, and see which other MCP servers stay real. - [CLI Reference](./cli.md): commands, flags, output modes, JSON reports, and exit behavior. - [CI Integration](./ci.md): temporary GitHub Actions pattern from the [`dynobox/skills`](https://github.com/dynobox/skills) repo. ## Dynobox Dashboard The web dashboard lives at [dash.dynobox.xyz](https://dash.dynobox.xyz). It is where you create short-lived CLI tokens for authenticated Dynobox commands. Use `dynobox login`, open the dashboard URL it prints, create a token, and paste that token back into the CLI. Authenticated CLI runs can upload compact summaries with `dynobox run --save-run`. When an upload succeeds, the CLI prints a dashboard URL for reviewing or sharing the saved run. Run owners can compare compatible jobs across saved runs to inspect assertion outcome and evidence changes. Set `DYNOBOX_UPLOAD_URL` to post the same schema v4 JSON payload to your own endpoint without Dynobox authentication. Saved-run data is not redacted, so do not upload runs that may contain secrets. See [Saving Runs](./cli.md#saving-runs) for the payload and custom-endpoint contract. ## Agent Resources The docs site publishes agent-oriented entry points for retrieval and indexing: - [`llms.txt`](https://docs.dynobox.xyz/llms.txt): concise docs map with canonical HTML, markdown, source, package, and command references. - [`llms-full.txt`](https://docs.dynobox.xyz/llms-full.txt): the full public docs corpus as one plain-text file. - [`docs-index.json`](https://docs.dynobox.xyz/docs-index.json): machine-readable page metadata, topics, headings, and canonical URLs. - Raw markdown pages such as [`getting-started.md`](https://docs.dynobox.xyz/getting-started.md) for direct ingestion without HTML parsing. ## What Dynobox Tests Dynobox runs each scenario in a fresh temporary work directory. Setup commands create the fixture, the selected harness performs the task, and assertions evaluate what happened. Work directories separate job files but are not security sandboxes. Dynos are trusted code: JavaScript and TypeScript configs are imported, and setup, verification, and harness processes may access the host according to their permissions. You can assert: - Tool calls, including path-aware file tool calls and raw shell escape hatches. - Normalized observed shell commands with `command.called(...)` and `command.notCalled(...)`. - Experimental scenario-scoped CLI mocks with static, sequential, or handler-based responses and recorded calls available to command assertions. - Skill instruction file references with `skill.referenced(...)`. - Ordered behavior sequences and valid alternatives with `sequence.inOrder(...)` and `anyOf(...)`, including nested `verify.command(...)` branches. - Work-directory artifacts with `artifact.exists(...)`, `artifact.notExists(...)`, `artifact.contains(...)`, and `artifact.unchanged(...)`. - Harness transcript and final-message text. - HTTP requests made by local child-process tools that honor proxy environment variables. - Post-harness verification commands with `verify.command(...)`. Use `dynobox run --iterations ` to repeat every selected scenario/harness pair and render inline pass-rate sparklines such as `.F...`. ## Supported Harnesses Dynobox currently runs local scenarios through: - Claude Code via the `claude` executable. - OpenAI Codex via the `codex` executable. - OpenCode via the `opencode` executable. - Pi via the `pi` executable. - Cursor CLI via the `cursor-agent` executable. - Google Antigravity CLI 1.1.14 or newer via the `agy` executable. Each harness must already be installed, authenticated, and available on `PATH`. ## Supported Config Formats Dynobox discovers `*.dyno.{mjs,js,ts,mts,yaml,yml}` files recursively when you run a directory. Explicit file paths can use non-`*.dyno.*` names, such as `dynobox.config.ts`, as long as they are loadable Dynobox configs. Supported authoring formats: - TypeScript or JavaScript with `defineDyno(...)` from `@dynobox/sdk`. - YAML with the same `type`-discriminated assertion objects that SDK helpers return. JavaScript and TypeScript dynos using `defineDyno(...)` automatically attach an adjacent `fixtures/` directory to scenarios that do not set `fixtures` explicitly. Dynos authored under `.agents/skills//` or `.claude/skills//` also automatically copy that skill's `SKILL.md` into each scenario work directory. CommonJS config files (`.cjs` and `.cts`) are not supported because the SDK is ESM-only. ## Current Limits Dynobox is under active development and is currently focused on local execution. These areas are not complete yet: - CLI mocking is experimental and its authoring and reporting contracts may change between releases. - HTTP capture for harness-native web tools and binaries that ignore proxy/CA environment variables. - Hosted or remote runner execution. --- # Page: Getting Started Canonical URL: https://docs.dynobox.xyz/getting-started/ Markdown URL: https://docs.dynobox.xyz/getting-started.md Source: https://github.com/dynobox/dynobox/blob/main/docs/getting-started.md Topics: install, auth, dashboard, custom uploads, init, run, harnesses, Pi, Cursor CLI, cursor-agent, Google Antigravity CLI, agy, debug # Getting Started This guide gets you from an empty project to one passing Dynobox run. Dynobox tests live in `*.dyno.*` files. A dyno describes a prompt, optional setup commands, one or more harnesses, and assertions about what the harness did while completing the task. ## Prerequisites - Node.js 22 or newer. - At least one supported local harness: - `claude` for Claude Code. - `codex` for OpenAI Codex. - `opencode` for OpenCode. - `pi` for Pi. - `cursor-agent` for Cursor CLI. - `agy` 1.1.14 or newer for Google Antigravity CLI. The selected harness must be installed, authenticated, and available on `PATH`. ## Install Install the CLI: ```bash npm install -g dynobox ``` Check that it is available: ```bash dynobox --help ``` ## Connect The CLI (Optional) Dynobox has a web dashboard at [dash.dynobox.xyz](https://dash.dynobox.xyz). Local runs do not require an account. Connect the CLI only when you want to save runs to the dashboard: ```bash dynobox login ``` Open the URL printed by the CLI, create a token, and paste it back into your terminal. You can verify the saved identity with: ```bash dynobox whoami ``` After authenticating, you can save a run summary with `dynobox run --save-run`. Alternatively, set `DYNOBOX_UPLOAD_URL` to use your own endpoint without a Dynobox token. Saved-run data is not redacted, so do not upload runs that may contain secrets. See [Saving Runs](./cli.md#saving-runs) for payload and endpoint details. ## Create Your First Dyno Choose a starter harness that is installed and authenticated. Omitting `--harness` selects Claude Code: ```bash dynobox init # Claude Code (default) dynobox init --harness codex # OpenAI Codex dynobox init --harness opencode # OpenCode dynobox init --harness pi # Pi dynobox init --harness cursor # Cursor CLI dynobox init --harness antigravity # Google Antigravity CLI ``` Run one of the commands above. It writes `dynobox/example.dyno.mjs`, which you can run with: ```bash dynobox run ``` By default, `dynobox run` discovers every `*.dyno.{mjs,js,ts,mts,yaml,yml}` file under the current directory. Only run dynos you trust. JavaScript and TypeScript configs are imported, and setup and verification commands execute on your machine. Each job receives a fresh temporary work directory for file separation, but that directory is not a security sandbox; processes can access the host according to their permissions. ## Choose A Harness Each dyno can declare its own harness list. You can also override harnesses at runtime. Select only harnesses installed and authenticated in the current environment: ```bash dynobox run --harness claude-code dynobox run --harness codex dynobox run --harness opencode dynobox run --harness pi dynobox run --harness cursor dynobox run --harness antigravity dynobox run --harness claude-code,codex,opencode,pi,cursor,antigravity ``` If neither the config nor the CLI selects a harness, Dynobox defaults to `claude-code`. Repeat runs when you want a pass-rate signal instead of a single sample: ```bash dynobox run --harness claude-code,codex,opencode,pi,cursor,antigravity --iterations 5 ``` Iterations are chosen at runtime. The dyno still only describes what to test; the CLI decides how many times to execute each selected scenario/harness pair. Harness configurations for the same scenario run in parallel, while iterations for each configuration run sequentially. Dynobox waits for all harnesses in the current scenario before starting the next scenario. ## Author A Minimal Dyno The example below asks the harness to inspect `package.json` with `cat`, checks that the command was observed, verifies `package.json` was unchanged, and confirms the final answer mentioned the test script. ```ts import {artifact, command, defineDyno, finalMessage, tool} from '@dynobox/sdk'; export default defineDyno({ name: 'package-script-check', harnesses: ['claude-code'], scenarios: [ { name: 'detects test script', setup: [ `cat > package.json <<'JSON' { "name": "fixture", "scripts": {"test": "vitest run"} } JSON`, ], prompt: 'Use `cat package.json` and tell me whether this project has a test script.', assertions: [ command.called('cat', {args: ['package.json']}), tool.notCalled('edit_file'), artifact.unchanged('package.json'), finalMessage.contains('test'), ], }, ], }); ``` Prefer YAML? Use `dynobox init --yaml` and see [YAML Configs](./config-authoring.md#yaml-configs). The [Config Authoring reference](./config-authoring.md) covers every assertion type. For larger fixtures, put files in a `fixtures/` directory next to a JavaScript or TypeScript dyno that uses `defineDyno(...)`. Dynobox copies that directory into each scenario work directory automatically unless the scenario sets its own `fixtures` value. ## Run A Specific Path `dynobox run [path]` accepts: - No argument: discover dynos recursively under the current directory. - Directory path: discover dynos recursively under that directory. - File path: run one loadable Dynobox config file. Examples: ```bash dynobox run dynobox run .agents/skills/ dynobox run my-skill.dyno.yaml dynobox run dynobox.config.ts ``` See [`dynobox run [path]`](./cli.md#dynobox-run-path) for discovery exclusions, supported extensions, and `dyno.config.json` options. ## Debug A Run Use these flags while developing scenarios: ```bash dynobox run --verbose dynobox run --debug dynobox run --reporter json dynobox run --save-run ``` `--verbose` expands lifecycle and observed-command details. `--debug` also shows temporary paths and writes available run artifacts. Use the JSON reporter for automation and `--save-run` to upload a compact run summary. See [Output Modes](./cli.md#output-modes) for the complete output and debug-file contract. Dynobox uses harness-specific non-dangerous headless behavior by default. For trusted local evals that intentionally need elevated or automatically approved access, configure `permissionMode: 'dangerous'` in the dyno or pass: ```bash dynobox run --permission-mode dangerous ``` The exact behavior is harness-specific. See the [CLI harness requirements](./cli.md#harness-requirements) for every default and dangerous-mode mapping. ## Next Steps - Write more scenarios with [Config Authoring](./config-authoring.md). - Add Dynobox to automation with [CI Integration](./ci.md). - Check exact flags and output fields in the [CLI Reference](./cli.md). - Use `dynobox run --save-run` to send a compact run summary to the dashboard or a custom `DYNOBOX_UPLOAD_URL` endpoint. --- # Page: How It Works Canonical URL: https://docs.dynobox.xyz/how-it-works/ Markdown URL: https://docs.dynobox.xyz/how-it-works.md Source: https://github.com/dynobox/dynobox/blob/main/docs/how-it-works.md Topics: execution lifecycle, work directories, fixtures, tool events, command normalization, CLI mocks, artifacts, transcripts, HTTP capture, assertions, evidence # How It Works Dynobox tests agent workflows by recording observable behavior and evaluating explicit assertions against that evidence. It does not ask another model to decide whether the agent did a good job. Each scenario, harness, and iteration becomes a separate job with this lifecycle: ```text fresh work directory -> fixtures and setup -> optional CLI mock shims are installed -> harness runs under observation and mock calls are recorded -> evidence is captured -> observation assertions evaluate harness-phase evidence -> verification assertions run -> pass or fail with recorded results ``` Within a scenario, effective harness configurations (including model and permission-mode differences) run concurrently. Iterations within one harness configuration run sequentially. Dynobox completes every harness lane before it starts the next scenario, and reports results in configured order regardless of which harness finishes first. ## 1. Start With A Fresh Work Directory Dynobox creates a new temporary work directory for every job. The selected harness runs with that directory as its working directory, and file assertions are scoped to paths inside it. Separate harnesses and repeated iterations do not share job files. The work directory provides file separation, not a security sandbox. Dynos are trusted code: JavaScript and TypeScript configs are imported, and setup, verification, and harness processes can access the host according to their normal permissions. ## 2. Build The Fixture Dynobox copies configured fixture directories into the work directory, then runs setup commands there in order. A failed fixture copy or setup command stops the job before the harness starts and records a `setup_failed` result with the setup logs. After setup succeeds, Dynobox fingerprints files used by `artifact.unchanged(...)`. This creates the pre-harness baseline that will be compared with the completed work later. See [Config Authoring](./config-authoring.md#scenarios) for fixture and setup options. ## 3. Run The Harness Under Observation Dynobox launches the configured harness executable with the scenario prompt and temporary work directory. The harness still uses its own installed version, authentication, model configuration, permission rules, and sandbox behavior. Dynobox controls the test lifecycle around it rather than replacing the harness runtime. When a scenario configures experimental CLI mocks, Dynobox prepends generated shims to the harness process's `PATH`. Bare executable calls from the harness or its child processes can then receive configured static, sequential, or handler-based responses. Setup and harness version detection use the real `PATH`; explicit paths and other calls that bypass `PATH` can bypass the mocks. CLI mocks are behavioral test doubles, not a sandbox. See [CLI Mocks](./config-authoring.md#cli-mocks) for shell and platform limits. While the process runs, the harness adapter reads its structured output and emits tool events. After the process exits, the adapter extracts the complete transcript, final assistant message, tool events, exit code, stderr, and timing. A process or extraction failure produces a `harness_failed` result instead of running assertions against incomplete output. ## 4. Capture Observable Evidence Dynobox assembles several evidence sources from the harness run: - **Tool events:** harness-specific tool names and inputs are retained and also mapped to common tool kinds such as shell, file read, and file edit where possible. - **Normalized commands:** shell tool events are split into command segments and normalized into executable and argument data. Assertions can use that structure instead of matching an entire raw shell string. - **CLI mock calls:** experimental CLI mocks record the executable, arguments, working directory, timestamp, response, and exit code. Child environment values supplied to a handler are not retained in the call record. - **Artifacts:** file assertions inspect the final state of the temporary work directory. Unchanged checks compare final bytes with the baseline captured after fixtures and setup. - **Transcript and final message:** text assertions can inspect either the full harness transcript or the extracted final assistant response. - **HTTP events:** when a scenario has HTTP assertions, Dynobox starts a local per-job proxy and gives the harness child process proxy environment variables. A generated local CA, exposed through common CA environment variables, lets compatible child-process clients make HTTPS requests through that proxy. HTTP capture is intentionally scoped. It observes child-process traffic that honors the proxy and CA environment variables; it is not system-wide packet capture. Harness-native web tools and binaries with independent proxy or trust configuration may bypass it. Command normalization also has documented parsing limits. Raw shell text is retained for diagnostics, but constructs such as `eval`, command substitution, and deeply nested wrappers may not produce the normalized command an assertion expects. See the [command assertion limits](./config-authoring.md#commands) and the [HTTP assertion limits](./config-authoring.md#http-assertions) for details. ## 5. Evaluate Assertions After a successful harness run, Dynobox evaluates each authored assertion against the captured evidence: - `tool.*`, `command.*`, `sequence.*`, and `skill.*` inspect observed tool and command events. - `artifact.*` inspects the completed work directory and captured baselines. - `http.*` inspects proxy-observed requests and responses. - `transcript.*` and `finalMessage.*` inspect recorded text. - `verify.command(...)` runs an explicit post-harness command in the completed work directory and checks its exit code or output. Observation assertions are evaluated before verification commands can mutate the work directory. They use the harness-phase evidence snapshot; later verification calls remain in reports but cannot satisfy observation assertions. Every assertion receives its own result and evidence, and lifecycle failures still fail the job. See the [assertion reference](./config-authoring.md#assertions) for all matchers. ## 6. Report The Result And Evidence The final job status distinguishes a passing run from setup, harness, and assertion failures. Terminal output shows failed expectations and matched or observed evidence. `--verbose` expands lifecycle details, while `--debug` also prints work-directory and artifact paths and writes available transcript, chat history, tool-event, CLI mock-call, and stderr logs into the job directory. For automation, `--reporter json` returns the structured job and assertion results. `--save-run` can upload a compact, length-capped summary to the authenticated Dynobox dashboard or an unauthenticated custom `DYNOBOX_UPLOAD_URL` endpoint. Uploads include available Git revision and identity metadata from the directory where the CLI was started. Saved data is not redacted, so do not upload runs whose evidence may contain secrets. See [Getting Started](./getting-started.md#debug-a-run) for local debugging and the [CLI Reference](./cli.md#output-modes) for reporter details. --- # Page: Agent Skills Canonical URL: https://docs.dynobox.xyz/agent-skills/ Markdown URL: https://docs.dynobox.xyz/agent-skills.md Source: https://github.com/dynobox/dynobox/blob/main/docs/agent-skills.md Topics: agent skills, skills.sh, dynobox/skills, dyno-from-skill, dyno-run-debug, dyno-skill-fit, debug # Agent Skills Dynobox publishes AI agent skills that assess test fit, create dynos from `SKILL.md` files, and diagnose failed runs. Install the skills with [skills.sh](https://www.skills.sh/dynobox/skills): ```bash npx skills add dynobox/skills ``` The source lives at [`dynobox/skills`](https://github.com/dynobox/skills). ## Included Skills - `dyno-from-skill`: turn a `SKILL.md` into a repeatable scenario with assertions and fixtures. - `dyno-run-debug`: diagnose a failed run and propose a fix. It waits for approval before editing and validates approved dyno changes. - `dyno-skill-fit`: assess Dynobox test fit before authoring, with example assertions and a High, Partial, or Low fit rating. ## Example Prompts After installing the skills, ask your agent for the specific workflow you want: ```text Use the dyno-from-skill skill to create a Dynobox test for this skill. ``` ```text Use the dyno-run-debug skill to diagnose this failed Dynobox run. ``` ```text Use the dyno-skill-fit skill to assess this skill for Dynobox coverage. ``` ## Related Links - [Browse Dynobox skills on skills.sh](https://www.skills.sh/dynobox/skills) - [View the skills source on GitHub](https://github.com/dynobox/skills) - [Config Authoring](./config-authoring.md) - [CI Integration](./ci.md) --- # Page: Config Authoring Canonical URL: https://docs.dynobox.xyz/config-authoring/ Markdown URL: https://docs.dynobox.xyz/config-authoring.md Source: https://github.com/dynobox/dynobox/blob/main/docs/config-authoring.md Topics: @dynobox/sdk, defineDyno, YAML, assertions, CLI mocks, HTTP capture, skills, pi, cursor, antigravity # Config Authoring Dynobox configs describe what to run and what to assert. A config can be authored as JavaScript, TypeScript, or YAML. Directory discovery loads files named `*.dyno.{mjs,js,ts,mts,yaml,yml}`. Explicit file paths can use other names, such as `dynobox.config.ts`, as long as the file is a loadable Dynobox config. CommonJS config files (`.cjs` and `.cts`) are not supported because `@dynobox/sdk` is ESM-only. ## Minimal Config ```ts import {command, defineDyno, finalMessage} from '@dynobox/sdk'; export default defineDyno({ name: 'local-observability', harnesses: ['claude-code'], scenarios: [ { name: 'inspect package scripts', setup: [ `cat > package.json <<'JSON' {"scripts":{"test":"vitest run"}} JSON`, ], prompt: 'Use `cat package.json` and tell me whether a test script exists.', assertions: [ command.called('cat', {args: ['package.json']}), finalMessage.contains('test'), ], }, ], }); ``` ## Config Shape ```ts type DynoboxConfig = { name?: string; target?: string; version?: string; harnesses?: HarnessRunConfig[]; setup?: string[]; endpoints?: Record; scenarios: ScenarioInput[]; }; ``` Top-level `setup` commands and `endpoints` are merged into each scenario. Top-level `harnesses` apply when a scenario does not define its own harnesses. Scenario harnesses replace the top-level harness list. If neither the scenario nor the top-level config defines harnesses, Dynobox defaults that scenario to `claude-code`. `target` names the thing being tested (for example `github-pr-agent`). Dynos that share a target are grouped together in saved-run reporting and on the dashboard, so several `.dyno` files can describe one product surface. When omitted, the target defaults to the dyno file's parent directory name. ```ts type ScenarioInput = { id?: string; name: string; prompt: string; harnesses?: HarnessRunConfig[]; setup?: string[]; fixtures?: string | string[]; cliMocks?: ScenarioCliMocks; mcpMocks?: ScenarioMcpMocks; endpoints?: Record; assertions?: Assertion[]; }; ``` Use [MCP mocks](./mcp-mocking.md) to provide HTTP MCP tool fixtures and assert on received calls with `mcp.called` and `mcp.notCalled`. Each scenario runs in a fresh temporary work directory. Setup commands run in that directory before the harness prompt, fixture directories are copied into that directory before setup, and artifact assertions read files from that directory after the harness exits. Scenario `id` is optional. When provided, it is used for stable compiled scenario IDs, job IDs, and `dynobox run --scenario` filters. Without an `id`, Dynobox derives one from the scenario name. When running discovered files, the CLI prefixes IDs with a source-file slug so JSON job and assertion IDs remain unique across files; authored scenario IDs are still accepted by `--scenario` filters with or without the `scenario.` prefix. Scenario and assertion `id` values must be non-empty and may only contain letters, numbers, dots, underscores, and hyphens. ## CLI Mocks > **Experimental:** CLI mocking is an experimental feature. Its authoring and > reporting contracts may change between releases. Use scenario `cliMocks` to replace bare executable calls during the harness or post-harness verification. Mocks are scoped to one job and support static responses, ordered responses, and JavaScript or TypeScript handlers. ```ts import {command, defineDyno} from '@dynobox/sdk'; export default defineDyno({ scenarios: [ { name: 'fixes tests and prepares a release', prompt: 'Fix the tests, then prepare a release.', cliMocks: { npm: {response: {exitCode: 0, stdout: '0.10.2'}}, vitest: { responses: [ {exitCode: 1, stderr: 'one test failed'}, {exitCode: 0, stdout: 'all tests passed'}, ], onExhausted: 'repeat-last', }, changeset: { handler: async ({argv}) => ({ exitCode: argv[0] === 'version' ? 0 : 1, }), }, }, assertions: [ command.called('vitest', {args: ['run']}), command.called('changeset', {args: ['version']}), ], }, ], }); ``` Configuration rules: - Each executable configures exactly one of `response`, `responses`, or `handler`. Keys must be bare executable names, not paths, `.`, or `..`. - Every response needs an integer `exitCode` from 0 through 255; omitted output defaults to an empty string. Sequences default to an exhaustion error. Use `onExhausted` to repeat the last response or provide a fallback. - Handlers receive `argv`, `cwd`, and the child environment, which may contain secrets. Treat them as trusted code, keep their work bounded, and account for concurrent jobs. Async handlers time out after 30 seconds without cancellation. Call records omit environment values. Dynobox prepends generated shims to `PATH` for the harness and verification commands, including nested processes. Setup and harness version detection use the real `PATH`. Shell startup hooks protect the mock path for common zsh, bash, and interactive POSIX `sh` flows; npm and pnpm scripts are also covered. Custom shell profiles, other shells, restrictive Codex environment filtering, and Yarn scripts may restore a real executable ahead of a shim. Explicit paths, shell builtins, functions, aliases, and keywords bypass `PATH` lookup. CLI mocks are therefore behavioral test doubles, not a sandbox or security boundary. Mocking the selected harness executable is rejected. CLI mocks currently require macOS or Linux. See [Mocked executables use call records](#mocked-executables-use-call-records) for assertion and reporting behavior. A configured nonzero exit is an ordinary response; sequence exhaustion, handler failures, timeouts, and unfinished calls fail the job even if the harness catches the command error. ## Harnesses Supported harness IDs: - `claude-code` - `codex` - `opencode` - `pi` - `cursor` - `antigravity` Use strings when the default model and permission behavior are fine: ```ts harnesses: ['claude-code', 'codex', 'opencode', 'pi', 'cursor', 'antigravity']; ``` Use objects to set a model or permission mode: ```ts harnesses: [ {id: 'claude-code', model: 'sonnet'}, {id: 'codex', model: 'gpt-5.1', permissionMode: 'dangerous'}, {id: 'opencode', model: 'openai/gpt-5.1'}, {id: 'pi', model: 'anthropic/claude-sonnet-4-5'}, {id: 'cursor', model: 'composer-2'}, {id: 'antigravity', model: 'gemini-3.5-flash-medium'}, ]; ``` Permission modes: - `default`: use the harness-specific non-dangerous headless behavior described in the [CLI reference](./cli.md#harness-requirements). - `dangerous`: opt into harness-specific full-access or automatic permission approval flags for trusted local evals. See [Harness Requirements](./cli.md#harness-requirements) for exact mappings. The CLI can override authored harnesses with `--harness` and authored permission modes with `--permission-mode`. ## Assertions Most assertions are evaluated against observed harness behavior after each scenario runs. Verification assertions run after the harness and execute their own checks against the completed work directory. Use the assertion namespace that matches the behavior you care about: - `tool.*` — the agent used, or avoided, a harness tool such as `shell`, `read_file`, or `edit_file`. - `command.*` — the agent ran, or avoided, a normalized shell command such as `git commit`, `pnpm test`, or `cat package.json`. - `http.*` — a declared endpoint request was, or was not, observed through local HTTP capture. - `artifact.*` — files in the scenario work directory have the expected final state. - `transcript.*` and `finalMessage.*` — the harness transcript or final response includes expected text. - `skill.referenced(...)` — observed events referenced a skill instruction file. - `verify.*` — Dynobox runs a post-harness check, such as validating a file the agent produced. Prefer the most semantic assertion available. For example, use `command.called('git', {args: ['commit']})` to assert observed CLI behavior, then use `artifact.contains(...)` or `verify.command(...)` to check the final result. ### Tool Calls Use `tool.called` and `tool.notCalled` to assert tool usage. ```ts tool.called('read_file', {path: 'package.json'}); tool.notCalled('edit_file', {path: 'src/index.ts'}); tool.notCalled('web_fetch'); tool.notCalled('shell', {matches: 'rm\\s+-rf'}); ``` Supported tool kinds: - `shell` - `read_file` - `write_file` - `edit_file` - `search_files` - `web_fetch` - `web_search` - `mcp` - `task` - `unknown` Shell tool assertions can include exactly one raw shell command matcher: - `{equals: 'pnpm test'}` - `{includes: 'package.json'}` - `{startsWith: 'pnpm'}` - `{matches: 'pnpm\\s+test'}` `matches` is a JavaScript regular expression string. Shell command matchers are only valid on `shell` tool assertions. Prefer `command.*` for normal CLI behavior assertions. Raw shell string matchers remain available as escape hatches when command normalization does not support a shell form you need to check, such as a complex heredoc, substitution, or wrapper-specific command line. File-oriented tool assertions can include a path matcher: - `tool.called('read_file', {path: 'package.json'})` - `tool.called('write_file', {path: 'src/index.ts'})` - `tool.called('edit_file', {path: 'src/index.ts'})` - `tool.called('search_files', {path: 'src'})` Path matchers are valid on `read_file`, `write_file`, `edit_file`, and `search_files` tool assertions. They match path fields reported by the harness, including common nested fields such as `path`, `file_path`, `filepath`, and `file`. Tool assertions may specify either a shell command matcher or a path matcher, not both. ### Commands > **Experimental.** Command assertions are new; their matching behavior and > matcher options may change in a future release. `command.called` and `command.notCalled` assert on individual shell commands the agent ran _during the harness_, after normalization, instead of regex-matching the raw command string. How it works: dynobox parses each observed shell command into normalized `(executable, argv)` segments using best-effort shell parsing — it does **not** run a real shell — and matches your assertion against those segments. This is more robust than regex over raw command strings for common shapes (leading env assignments, `bash -lc "…"` wrappers, executable path basenames, pipelines), but it is intentionally incomplete; see [Limitations and oddities](#limitations-and-oddities) below. ```ts command.called('git', {args: ['status']}); command.called('git', {args: ['commit']}); command.notCalled('git', {args: ['push']}); command.called('pnpm', {argsInOrder: ['run', 'build']}); command.called('node', {argsMatching: [/--max-old-space-size=\d+/]}); command.called('git', {originalIncludes: '--no-verify'}); ``` `command.*` is generic observed CLI behavior, not a Git/npm/Docker-specific API. Use the executable name and argument matchers for any command Dynobox can normalize. #### Mocked executables use call records For bare executables in `cliMocks`, completed call records are authoritative for `command.called`, `command.notCalled`, and `sequence.inOrder`. This captures package scripts and nested processes that may not appear directly in the transcript, while transcript text alone cannot prove a command ran. Other executables, including explicit paths that bypass a shim, use normalized shell observations. Observation assertions use calls captured through the end of the harness phase. Verification calls still consume sequential responses and appear in reports, but cannot satisfy those assertions. Mock lifecycle failures during either phase still fail the job. Mock-only sequences use invocation order. A nested or compound-shell mock call cannot always be ordered against unrelated harness tool events; mixed sequence assertions that require such a comparison fail with a diagnostic. Match the first argument against the command's normalized `executable`. The optional matcher accepts any combination of the following fields; when several are given, **all** must match: - `args` — every listed arg must appear in `argv` (order-independent). - `argsInOrder` — the listed args must appear in `argv` in the given order (other args may appear between them). - `argsMatching` — an array of `RegExp`; each must match at least one `argv` token. - `originalIncludes` — substring match against the raw text of the single command segment. - `originalMatches` — `RegExp` match against the raw text of the single command segment. For a CLI mock call paired with a standalone shell event, `originalIncludes` and `originalMatches` use that event's raw command segment. Nested, package script, and other unpaired mock calls have no raw shell segment, so Dynobox reconstructs this value by joining the recorded executable and arguments with spaces. That reconstructed form does not preserve quoting or other shell syntax; prefer `args`, `argsInOrder`, or `argsMatching` for unpaired mock calls. With no matcher, `command.called('git')` passes if any observed command's executable is `git`. #### What normalization handles - **Compound commands** are split on `;`, `&&`, `||`, `|`, and `|&` into separate command segments, so each side of a pipe or operator is matched independently. Separators inside `(...)` subshells and `{...}` brace groups are left intact until those wrappers are unwrapped. - **Subshell and brace-group wrappers** are unwrapped: `(npx dynobox validate tmp/x.dyno.yaml 2>&1; echo "EXIT: $?")` and `{ npx dynobox validate tmp/x.dyno.yaml; echo "EXIT: $?"; }` normalize to the same observed commands as their ungrouped forms (`npx …` and `echo …`). Trailing redirections on the group are allowed (`{ …; } 2>&1`, `(…; echo done) >out`). This covers the common agent pattern of capturing exit codes in a group. - **Leading environment assignments** are skipped: `NODE_ENV=test pnpm test` normalizes to executable `pnpm`. - **Shell wrappers** are unwrapped: `bash -lc "git status"` (and `sh`/`zsh`, with any `-c`-style flag) normalizes to the inner command. Wrappers are unwrapped up to two levels deep. - **Executable basename** is used: `/usr/bin/git status` normalizes to executable `git` (the full path is retained separately). - **`git -C `** is recorded as the command's working directory; the harness-reported `cwd`/`workdir` is captured when present. - **Redirection targets are excluded**: `git status > out.log` yields argv `['status']`, not `out.log`. - **Shell variables and unquoted `#`** are preserved as literal arg text (for example `$PWD` and `owner/repo#123`). #### Limitations and oddities Normalization is deterministic but **incomplete** — it does not run a full shell parser. The following are _not_ parsed, so commands hidden inside them are not observed: - **Backgrounding `&`** is not a separator. In `server & curl localhost`, only `server` is observed; `curl` is dropped. (`&&` and `|&` are handled; a bare `&` is not.) - **Command/process substitution** (`$(...)`, `` `...` ``, `<(...)`) and `eval`, and commands invoked via wrappers like `xargs`, are not expanded. - **Heredocs** and other multi-line constructs are not interpreted. - **Shell wrappers** deeper than two levels are not unwrapped. - **Shell comments** are dropped from a command's args, but a separator inside a comment (for example `git status # do it && rm -rf`) can still split the line, so text after it may be observed as its own command. - `originalIncludes` / `originalMatches` match the text of a **single** command segment, not the whole compound line. When `command.called` fails because no normalized command matches the expected executable, but raw shell text still mentions that name, the failure message calls out a possible normalization gap and includes the matching raw shell line(s). That usually means the agent used a shell shape Dynobox does not yet unwrap (for example `eval` or command substitution). > `command.notCalled` is a behavioral check, not a security boundary. Because > the constructs above are not parsed, a forbidden command concealed inside one > (for example `eval "$(echo git push)"`) can evade detection. Do not rely on it > to prove a command never ran. ### Ordered Sequences Use `sequence.inOrder` when order matters. ```ts sequence.inOrder([ command.called('git', {args: ['status']}), command.called('git', {args: ['diff']}), ]); ``` Steps may be `tool.called(…)` matchers, `command.called(…)` matchers, or a mix of both: ```ts sequence.inOrder([ command.called('git', {args: ['add']}), command.called('git', {args: ['commit']}), ]); ``` For shell commands, ordered matching can match multiple steps against one compound command when the command text appears in order. Normalized command steps are ordered by their position within the compound command, including segments nested inside shell wrappers. ### Union Assertions (`anyOf`) Use `anyOf` when any one of several assertion paths is acceptable. ```ts anyOf([ tool.called('read_file', {path: 'package.json'}), command.called('cat', {args: ['package.json']}), verify.succeeds('node --check out.js'), ]); ``` Branches may use any regular assertion kind except nested `anyOf` or `sequence.inOrder`. Nested `verify.command(...)` / `verify.succeeds(...)` branches are supported. Branch-level `id` and `label` fields are not supported; label the `anyOf` assertion itself instead. Every branch is evaluated on each run, even after one branch already passes. When multiple branches pass, the lowest-index branch is reported as the match. Observation branches (artifacts, tools, commands, and so on) are evaluated before nested verification commands run, so a verify branch cannot mutate the workdir and retroactively change an artifact branch result. `*.notCalled` branches (`tool.notCalled`, `command.notCalled`, `http.notCalled`) can make an `anyOf` pass vacuously when the forbidden action never occurred. Prefer positive matchers (`tool.called`, `command.called`, `http.called`, and so on) unless you deliberately want "either path A succeeded or path B was never taken." ### Skills Use `skill.referenced` to assert that observed harness events referenced a named skill's `SKILL.md` instruction file. ```ts skill.referenced('commit'); ``` This passes when observed tool events reference `.agents/skills//SKILL.md`, `.claude/skills//SKILL.md`, or `.cursor/skills//SKILL.md`, including reads, searches, or shell commands that access the file. The name is intentionally narrow: Dynobox observes file references, not whether a harness semantically activated or followed the skill instructions. ### Artifacts Artifact assertions read paths inside the scenario work directory. ```ts artifact.exists('README.md'); artifact.notExists('scratch.tmp'); artifact.contains('package.json', 'vitest run'); artifact.unchanged('package-lock.json'); ``` - `artifact.exists(path)` passes when a directory entry is present after the harness runs. Dynobox uses `lstat` semantics, so valid and dangling symlinks both count as present. - `artifact.notExists(path)` is the complement: it passes only when the path is truly absent (including when an intermediate component is a regular file, so `file/child` cannot exist). Files, directories, valid symlinks, and dangling symlinks all fail. - `artifact.contains(path, text)` reads the file as UTF-8 and checks for a substring. - `artifact.unchanged(path)` fingerprints the regular file after fixtures and setup complete (size + SHA-256 of raw bytes), then compares the same fingerprint after the harness exits. Equality is still raw-byte exact: line endings, whitespace, formatting, and structured data are not normalized. Missing, unreadable, or non-file baselines fail as assertion-level authoring errors without blocking the harness. Artifact paths must be relative and must stay inside the work directory. ### Transcript And Final Message Use transcript assertions to inspect the full harness transcript. Use final-message assertions to inspect the final assistant response extracted from the harness output. ```ts transcript.contains('package.json'); finalMessage.contains('test script'); ``` Final-message extraction depends on the harness output format. If a harness does not provide a final message, the assertion fails with a clear message. ### Verification Commands Use `verify.command` when Dynobox should run a command after the harness exits to validate the completed work directory. ```ts verify.succeeds('dynobox validate out.dyno.ts'); verify.command('dynobox validate out.dyno.ts', {exitCode: 0}); verify.command('dynobox validate out.dyno.ts', { exitCode: 0, stdout: {includes: 'valid'}, }); ``` Verification commands are test-runner checks, not observed agent behavior. They are useful for validating generated files, running a linter, or building an artifact the agent created. They should not replace `tool.*`, `command.*`, or `http.*` assertions when you need to prove what the agent actually did during the harness run. `verify.command` requires at least one expected `exitCode`, `stdout`, or `stderr` matcher. Output matchers use the same text matcher shape as shell command strings: `equals`, `includes`, `startsWith`, or `matches`. ## HTTP Assertions Declare endpoints with `http.endpoint(...)` and assert whether matching requests were observed. ```ts endpoints: { npmPrettier: http.endpoint({ method: 'GET', url: 'https://registry.npmjs.org/prettier', }), }, assertions: [http.called('npmPrettier', {status: 200})]; ``` Endpoint keys become part of stable IR ids, so they may only contain letters, numbers, underscores, and hyphens. Endpoint specs include only `method` and `url`. HTTP assertions match observed requests by endpoint URL/method and optional response status. When a scenario includes HTTP assertions, Dynobox starts a per-job local proxy and sets `HTTP_PROXY`, `HTTPS_PROXY`, and their lowercase variants on the harness child process. Existing `NO_PROXY` and `no_proxy` values are preserved, and local loopback values (`localhost`, `127.0.0.1`, and `::1`) are added. A generated CA at `~/.dynobox/ca.pem` is exposed through `NODE_EXTRA_CA_CERTS`, `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE`, and `CURL_CA_BUNDLE`. Capture covers traffic that honors those settings; harness-native web tools and clients with their own trust stores may bypass it. ## Path Helpers The `dyno` helper is useful when config files need stable paths relative to the config module. ```ts import {dyno} from '@dynobox/sdk'; const here = dyno.here(import.meta.url); setup: [`cp ${here.q('./fixtures/input.txt')} input.txt`]; ``` Available helpers: - `dyno.fsPath(url)` - `dyno.fromUrl(baseUrl, path)` - `dyno.shellQuote(value)` or `dyno.q(value)` - `dyno.here(import.meta.url).path(path)` - `dyno.here(import.meta.url).q(path)` - `dyno.here(import.meta.url).fixtures(subpath?)` `dyno.here(...).fixtures()` resolves the adjacent `fixtures/` directory, or a subpath inside it. Use it when you need to attach a non-default fixture path explicitly. ## Fixtures Scenarios can attach one or more fixture directories. Dynobox recursively copies each fixture directory into the scenario work directory before setup commands run. ```ts import {defineDyno, dyno, tool} from '@dynobox/sdk'; const here = dyno.here(import.meta.url); export default defineDyno({ scenarios: [ { name: 'uses a fixture repo', prompt: 'Inspect package.json.', fixtures: here.fixtures('repo'), assertions: [tool.called('read_file', {path: 'package.json'})], }, ], }); ``` When a JavaScript or TypeScript dyno uses `defineDyno(...)`, an adjacent `fixtures/` directory is attached automatically to scenarios that do not set `fixtures` themselves: ```text my-skill.dyno.mjs fixtures/ package.json ``` With that layout, `fixtures/package.json` is copied to `package.json` in each scenario work directory. Set `fixtures` explicitly to use a different directory, or set `fixtures: []` to disable the adjacent fixture default. YAML dynos can set `fixtures` explicitly, but they do not get automatic adjacent fixture attachment because YAML configs do not execute `defineDyno(...)`. ## Skill Dynos When a JavaScript or TypeScript dyno using `defineDyno(...)` is authored under a skill directory, Dynobox automatically copies that skill's `SKILL.md` into the scenario work directory before scenario setup runs. Supported skill roots: - `.agents/skills//` - `.claude/skills//` For either authored root, Dynobox stages the same source `SKILL.md` into both harness layouts: - `.agents/skills//SKILL.md` - `.claude/skills//SKILL.md` The authored root is copied first, then the alternate destination. Authored scenario setup commands run after both generated copies. For example, a dyno at `.agents/skills/commit/dyno/commit.dyno.mjs` with `.agents/skills/commit/SKILL.md` gets setup commands that create both `.agents/skills/commit/SKILL.md` and `.claude/skills/commit/SKILL.md` in the scenario work directory. This makes skill reference tests work across harness conventions that use these two layouts without manually copying the instruction file in each scenario. `skill.referenced(...)` also recognizes Cursor's `.cursor/skills//SKILL.md` layout, but automatic skill staging does not create it. Use fixtures or scenario setup when a test specifically needs Cursor's native skill layout. ## Reusable Scenarios Use `defineScenario` when you want to author or export a scenario independently, then include it in a dyno. ```ts import {command, defineDyno, defineScenario} from '@dynobox/sdk'; const checksPackageJson = defineScenario({ name: 'checks package json', prompt: 'Use `cat package.json` and summarize the scripts.', assertions: [command.called('cat', {args: ['package.json']})], }); export default defineDyno({ scenarios: [checksPackageJson], }); ``` ## YAML Configs YAML dynos use the same top-level shape as JavaScript and TypeScript configs. The difference is that helper calls are written as plain objects using the same authoring assertion shape that SDK helpers return. ```yaml name: package-script-check harnesses: - claude-code scenarios: - name: detects test script prompt: >- Use cat package.json and tell me whether this project has a test script. setup: - | cat > package.json <<'JSON' {"scripts":{"test":"vitest run"}} JSON assertions: - label: reads package.json type: command.called executable: cat command: args: - package.json - type: tool.notCalled tool: edit_file - type: artifact.contains path: package.json text: vitest run - type: finalMessage.contains text: test ``` YAML configs flow through the same schema and IR compiler as JavaScript and TypeScript configs. YAML supports static and sequential CLI mocks. Function handlers require a JavaScript or TypeScript config. A static mock inside a YAML scenario uses this shape: ```yaml cliMocks: vitest: response: exitCode: 0 stdout: all tests passed ``` ## Authoring Assertion Contract All assertion objects accept optional `id` and `label` fields. `id` stabilizes compiled assertion IDs and JSON report references. `label` appears in CLI and JSON output. | TypeScript helper | Authoring object | | ------------------------------------------------------ | --------------------------------------------------------------------- | | `tool.called('shell', {includes: 'x'})` | `{type: tool.called, tool: shell, command: {includes: x}}` | | `tool.called('read_file', {path: 'README.md'})` | `{type: tool.called, tool: read_file, path: README.md}` | | `tool.notCalled('edit_file')` | `{type: tool.notCalled, tool: edit_file}` | | `command.called('git', {args: ['status']})` | `{type: command.called, executable: git, command: {args: [status]}}` | | `command.notCalled('git', {args: ['push']})` | `{type: command.notCalled, executable: git, command: {args: [push]}}` | | `verify.command('dynobox validate out.dyno.ts', {exitCode: 0})` | `{type: verify.command, command: dynobox validate out.dyno.ts, exitCode: 0}` | | `artifact.exists('README.md')` | `{type: artifact.exists, path: README.md}` | | `artifact.notExists('scratch.tmp')` | `{type: artifact.notExists, path: scratch.tmp}` | | `artifact.contains('pkg.json', 'foo')` | `{type: artifact.contains, path: pkg.json, text: foo}` | | `artifact.unchanged('package-lock.json')` | `{type: artifact.unchanged, path: package-lock.json}` | | `transcript.contains('done')` | `{type: transcript.contains, text: done}` | | `finalMessage.contains('ok')` | `{type: finalMessage.contains, text: ok}` | | `skill.referenced('commit')` | `{type: skill.referenced, skill: commit}` | | `anyOf([tool.called('read_file', {...}), ...])` | `{type: anyOf, steps: [{type: tool.called, ...}, ...]}` | | `sequence.inOrder([command.called('git', {...}), ...])` | `{type: sequence.inOrder, steps: [{type: command.called, ...}, ...]}` | | `http.called('npmPrettier', {status: 200})` | `{type: http.called, endpoint: npmPrettier, status: 200}` | | `http.notCalled('leftPad')` | `{type: http.notCalled, endpoint: leftPad}` | The optional assertion `id` field follows the same format as scenario IDs: letters, numbers, dots, underscores, and hyphens. Shell command matcher shapes accept exactly one of `equals`, `includes`, `startsWith`, or `matches`, and are only valid on `shell` tool assertions. Path matchers use a top-level `path` field and are only valid on file-oriented tool assertions. When YAML parsing fails, the CLI emits a `line:column` pointer into the file so syntax errors are easy to locate. --- # Page: Mock MCP services Canonical URL: https://docs.dynobox.xyz/mcp-mocking/ Markdown URL: https://docs.dynobox.xyz/mcp-mocking.md Source: https://github.com/dynobox/dynobox/blob/main/docs/mcp-mocking.md Topics: MCP, mcpMocks, mcp.called, mcp.notCalled # Mock MCP services Declare `mcpMocks` on a scenario to provide MCP tools with fixed responses. Dynobox starts HTTP MCP endpoints and supplies their configuration to the harness. You do not need real service URLs, accounts, or MCP credentials for the mocked tools. Your harness still needs its normal model authentication. > **Warning:** Dyno runs with MCP mocks cannot currently use `--save-run`. This > functionality is coming soon. Mocks replace only the servers you declare. Other MCP servers, plugins, and connectors from your profile stay real during the run. See [Other MCP servers](#other-mcp-servers). ```yaml name: Issue lookup harnesses: [claude-code] scenarios: - name: Read an issue prompt: Read issue DYNO-1 using Linear. Do not modify it. mcpMocks: linear: tools: get_issue: description: Read an issue by ID. inputSchema: type: object properties: id: {type: string} required: [id] response: content: - type: text text: 'DYNO-1: Fix login' save_issue: description: Save an issue. inputSchema: {type: object} response: content: [] assertions: - type: mcp.called server: linear tool: get_issue input: {id: DYNO-1} - type: mcp.notCalled server: linear tool: save_issue ``` The server key (`linear`) identifies the MCP server; tool keys identify the tools it exposes. Use the configured unscoped server name when replacing a service. Plugins can give their servers different, scoped names. Dynobox grants permission for the declared mock tools automatically. Claude-generated plugin and connector namespaces reserve the server prefixes `plugin_` and `claude_ai_`; use an unscoped server name for a Claude mock. Claude joins server and tool names with `__`, so Claude mock server and tool names cannot contain `__`. Dynobox rejects these names before launching Claude and rejects other detected ambiguous native identities during readiness validation. Plugin and connector servers stay real and remain subject to normal harness permissions. `mcp.called` checks calls received by the mock, including matching arguments when `input` is provided. `mcp.notCalled` requires a usable mock environment and a completed run. A disconnected or refused mock cannot make a negative assertion pass. Assertions refer to logical server/tool names on every harness. ## Other MCP servers Dynobox runs your harness with your normal profile and does not edit its configuration. The harness loads your other MCP servers as it normally would, and the agent can call them with real side effects. `mcp.called` and `mcp.notCalled` check only calls received by mocks. Calls to real servers are not checked, and other servers can influence the agent, so results can depend on the loaded profile. For a run that cannot reach real services, mock every server the scenario could use, or run the harness with a dedicated profile that has no other MCP servers. A fresh profile also needs its own model login. ## Availability MCP mocks run locally. Each harness enforces its minimum CLI version. | Harness | Minimum CLI | | --- | --- | | Antigravity | 1.5.2 | | Claude Code | 2.1.263 | | Codex | 0.153.4 | | Cursor | 2026.10.22 | | OpenCode | 2.2.5 (2.x) | | Pi | 1.5.0 (1.x) | ### Antigravity Set the model with the scenario's `model`, not `extraArgs`. Jobs that share an Antigravity profile run one at a time. ### Codex The agent sees each mock under a name with a `_dynobox` suffix, for example `mcp__linear_dynobox__get_issue`. Assertions and reports still use the names declared in `mcpMocks`. Skills that name exact MCP tools must allow for the suffix. ### Cursor As with Codex, the agent sees each mock under a name with a `_dynobox` suffix, for example `plugin-dynobox-linear_dynobox`. For plugin servers, use the full server identifier that Cursor shows. ## Failures and reporting A job fails, instead of letting `mcp.notCalled` pass by accident, when: - A real stdio server has the same name as a mock. Antigravity, Codex, Cursor, and Pi replace only HTTP servers. - A permission rule denies a mock tool. - The harness never discovers a declared mock. Reports omit mock arguments, responses, and connection URLs. `--debug` keeps harness output in local debug files. --- # Page: CLI Reference Canonical URL: https://docs.dynobox.xyz/cli/ Markdown URL: https://docs.dynobox.xyz/cli.md Source: https://github.com/dynobox/dynobox/blob/main/docs/cli.md Topics: CLI, auth, dashboard, dynobox init, dynobox login, dynobox whoami, dynobox run, JSON reporter, --save-run, DYNOBOX_UPLOAD_URL, trusted code, exit codes, Pi, Cursor CLI, cursor-agent, Google Antigravity CLI, agy # CLI Reference The public CLI package is `dynobox`: ```bash npm install -g dynobox ``` ## Commands ### Global Options ```bash dynobox --help dynobox --version dynobox -V ``` Running `dynobox` with no subcommand prints the starter banner and exits `0`. ### `dynobox init` Create a starter dyno under `./dynobox/`. ```bash dynobox init dynobox init --yaml dynobox init --harness codex dynobox init --force ``` `dynobox init` writes `dynobox/example.dyno.mjs` by default. With `--yaml`, it writes `dynobox/example.dyno.yaml`. Existing starter files are not overwritten unless `--force` is passed. `--harness` accepts the same harness IDs as `dynobox run`; invalid harness IDs fail before writing a starter file. ### `dynobox login` Save a Dynobox CLI token for authenticated commands. ```bash dynobox login ``` The command prints a link to [dash.dynobox.xyz](https://dash.dynobox.xyz), where you can create a short-lived CLI token. Paste that token into the prompt and the CLI stores it in `~/.dynobox/config.json`. CLI tokens expire after 24 hours. When a token expires, run `dynobox login` again to create and save a new one. Environment overrides: - `DYNOBOX_TOKEN`: use a token from the environment instead of local config. - `DYNOBOX_API_URL`: development override for the Dynobox API. Commands still require and send Dynobox authentication. - `DYNOBOX_DASHBOARD_URL`: point `dynobox login` at a different dashboard URL. - `DYNOBOX_UPLOAD_URL`: post `--save-run` payloads to an exact custom URL. ### `dynobox whoami` Verify the saved Dynobox CLI identity. ```bash dynobox whoami ``` The command checks the saved token against the Dynobox API and prints the authenticated email when the token includes one. Invalid, revoked, expired, or unreachable tokens return a non-zero exit code with a specific error message. ### `dynobox logout` Remove the saved Dynobox CLI token. ```bash dynobox logout ``` The command deletes `~/.dynobox/config.json` when it exists. If `DYNOBOX_TOKEN` is still set in the environment, the CLI notes that authenticated commands will continue to use that environment token. ### `dynobox run [path]` Discover and run dyno files. ```bash dynobox run dynobox run .agents/skills/ dynobox run my-skill.dyno.yaml dynobox run dynobox.config.ts dynobox run --config dyno.config.json ``` Path behavior: - No path: discover under the current working directory. - Directory path: discover recursively under that directory. - File path: run that one loadable Dynobox config file. Directory discovery matches `**/*.dyno.{mjs,js,ts,mts,yaml,yml}`. It skips dot directories by default, but explicitly includes `.agents` and `.claude` skill directories. If you pass a hidden directory as `[path]`, Dynobox searches that directory. Discovery also skips `node_modules`, `dist`, `build`, `coverage`, `.git`, `.dynobox`, `.next`, and `.cache`. Directory discovery also reads a `dyno.config.json` from the current working directory — the directory you run the command in, not the `[path]` argument and with no upward walk. For now the config is JSON-only and supports `ignoredDirectories`: ```json { "ignoredDirectories": ["generated", "vendor/examples"] } ``` Each ignored directory is treated as a directory path relative to the `dyno.config.json` file and skipped recursively. Run commands from your project root so its `dyno.config.json` applies, or pass `--config ` to use a specific config file from anywhere. Run with `--verbose` (or `--debug`) to print which `dyno.config.json` applied. Explicit file paths do not need to match the `*.dyno.*` naming pattern. YAML files are parsed as YAML, and JavaScript or TypeScript files such as `.mjs`, `.js`, `.ts`, and `.mts` are imported through the CLI loader. `.cjs` and `.cts` configs are not supported because `@dynobox/sdk` is ESM-only. Only run dynos you trust. JavaScript and TypeScript configs are imported, and setup and verification commands execute on your machine. Temporary work directories separate job files, but they are not security sandboxes; processes can access the host according to their permissions. A load error in one discovered file does not stop other files from running. Each bad file prints a `config:` error block on stderr, and the process exits non-zero if any file failed to load or any job failed. ### `dynobox discover [path]` Print the dyno files that `dynobox run [path]` would load, one path per line, without loading configs or running harnesses. ```bash dynobox discover dynobox discover dynobox dynobox discover my-skill.dyno.yaml dynobox discover --config dyno.config.json ``` `dynobox discover` uses the same path behavior and directory discovery rules as `dynobox run`: no path discovers dynos under the current directory, a directory discovers all matching `*.dyno.*` files below it, and a file path prints that one loadable config path. ### `dynobox validate [path]` Load and validate dyno files without running any harnesses. ```bash dynobox validate dynobox validate dynobox/ dynobox validate out.dyno.ts dynobox validate --reporter json out.dyno.ts ``` `dynobox validate` uses the same path behavior and directory discovery rules as `dynobox run`: no path validates discovered dynos under the current directory, a directory validates all discovered `*.dyno.*` files below it, and a file path validates that one loadable config file. Validation loads JavaScript and TypeScript configs through the CLI loader, parses YAML dynos, unwraps the config module, and compiles it through the SDK IR compiler. It exits `0` when every config is valid and `1` when discovery, loading, parsing, schema validation, or semantic compilation fails. Default output prints a compact summary on stdout and config errors on stderr. `--reporter json` emits newline-delimited JSON on stdout with one file record per validated config and a final summary record. ## Run Options ```text --harness Select harnesses; repeat or comma-separate for multiple harnesses. Matching config metadata is preserved. --model Override selected harness models by position; repeat or comma-separate for multiple harnesses. --permission-mode Override harness permission mode: default or dangerous. --scenario Run only scenarios whose name or id matches; repeat or comma-separate for multiple patterns. --iterations Run each selected scenario/harness pair this many times. Defaults to 1. --quiet Print compact CI-friendly output. --verbose Expand every job with phase and assertion details. --debug Include verbose details plus work dirs, artifact paths, and debug logs. --reporter Output reporter format: text or json. --config Use a specific dyno.config.json file. --save-run Upload a compact run summary to the dashboard or DYNOBOX_UPLOAD_URL (see Saving Runs below). ``` Harness IDs are `claude-code`, `codex`, `opencode`, `pi`, `cursor`, and `antigravity`. Examples: ```bash dynobox run --harness claude-code dynobox run --harness codex dynobox run --harness opencode dynobox run --harness pi dynobox run --harness cursor dynobox run --harness antigravity dynobox run --harness claude-code,codex,opencode,pi,cursor,antigravity dynobox run --harness codex --model gpt-5.5 dynobox run --harness opencode --model openai/gpt-5.5 dynobox run --harness claude-code,codex --model sonnet,gpt-5.5 dynobox run --harness codex --permission-mode dangerous dynobox run --scenario "release*" dynobox run --scenario "lint*,deploy package" dynobox run --harness claude-code,codex --iterations 5 dynobox run --reporter json ``` Scenario filters match the compiled scenario name or id. Authored scenario IDs can be matched with or without the `scenario.` prefix, even when JSON job IDs are source-prefixed during multi-file discovery. Patterns support `*` for any number of characters and `?` for one character. If no scenarios match, the run exits with code `1`. Harness selection preserves matching configured harness metadata. For example, `dynobox run --harness codex` keeps a configured Codex `model` and `permissionMode`. To temporarily use a different model, pass `--model` with one model per selected harness. Positional values are matched after comma-separated and repeated flags are flattened, so `--harness claude-code,codex --model sonnet,gpt-5.5` maps `sonnet` to `claude-code` and `gpt-5.5` to `codex`. `--permission-mode` still overrides the effective permission mode for every selected harness. Iterations are a runtime option, not part of dyno configs. `--iterations 5` runs every selected scenario/harness pair five times and reports a per-row job fraction with an inline sparkline such as `✗ 2/5 failed .FF..`. Passing marks are `.` and failing marks are `F`; marks are colored when ANSI color output is enabled. Every failed iteration is listed under its row. Harness configurations for one scenario run concurrently, including separate model or permission-mode configurations of the same harness. Iterations within each configuration remain sequential, and the next scenario waits for all current harness configurations to finish. ## Output Modes Default output groups results by dyno, then by scenario. The header shows a discovery summary (`discovered 1 dyno · 2 scenarios · harness: …`) including model and permission mode in harness labels when configured. When a run spans multiple harness labels, each scenario shows full explicit metadata such as `opencode · model: openai/gpt-5 · mode: dangerous` above its result row. A bare single harness is shown only in the header, while a configured model or mode is also shown above its result so long metadata is never lost to header width. Assertion phase rows omit their typically negligible duration; setup, harness, job, and aggregate durations remain visible. Failed rows show failed assertions with an `expected` line and an `observed` line describing the evidence Dynobox actually saw. For path-aware tool assertions, the rendered expectation includes the matched path, such as `tool.called(read_file, path: package.json)`. Failed `command.called(...)` assertions show a compact match-count summary by default. The final summary leads with job counts (a job is one executed `scenario × harness × iteration` unit); assertion detail is always labeled, such as `✗ 1 of 2 jobs failed · 1 failed assertion · 1m02s`. Setup and harness failures are counted separately as job errors. The final duration is wall-clock elapsed time; per-harness rows sum their own iteration durations. `--quiet` prints a one-line discovery summary, compact `.`/`F` progress marks, `FAIL`/`WARN` groups when needed, and the same job-led summary semantics. `--verbose` uses the grouped layout and expands every job with setup, harness, and assertion phase rows plus all assertion results, even when jobs pass. When command assertions are present, verbose output also lists parsed command segments observed during the run. Scenarios with CLI mocks list the configured executable names and each recorded call with its exit code. `--debug` prints everything `--verbose` does, includes temporary work-directory and artifact paths, and writes debug logs inside each job's work directory when data is available. Debug logs can include: - `dynobox-transcript.log` - `dynobox-chat-history.jsonl` - `dynobox-tool-events.json` - `dynobox-cli-mocks.json` - `dynobox-stderr.log` `dynobox-cli-mocks.json` contains complete local call records: executable, arguments, working directory, timestamp, exit code, stdout, and stderr. Child environment values are not included. `--reporter json` emits newline-delimited JSON on stdout instead of text. Dynobox writes one job object in configured order, then one summary object. The JSON reporter always uses static output so stdout remains machine-readable. When stdout is an interactive terminal and live output is enabled, Dynobox shows one updating phase block per active harness configuration. Completed scenario rows and verbose/debug details are printed in configured order. In non-interactive output, quiet mode, or incompatible terminals, it renders static output after jobs complete. ## JSON Reporter Every JSON reporter object includes a `schema` field and a `type` field. The schema is `"dynobox.report.v2"`, or `"dynobox.report.v3"` when the run uses MCP mocks. Job records include: - `jobId` - `scenario.id` and `scenario.name` - `harness.id`, with `model` and `permissionMode` when configured - `iteration`, using a 1-based number - `status` and `passed` - `timing` - `diagnostics` - `warnings` - `artifacts` - `debugLogPaths` when `--debug` produced logs - `setup.commands` - `harnessOutput.exitCode` and `harnessOutput.durationMs` when the harness ran - `observations.toolEventCount`, `observations.httpEventCount`, `observations.cliMockCallCount`, and `observations.harnessCliMockCallCount` - `mcp` for jobs that ran MCP mocks, with `ready`, `finalized`, `failures`, `callCount`, and `calls` (`sequence`, `server`, `tool`, and `category` per call) - `assertions`, with `assertionId`, optional `label`, `type`, `passed`, and `message`. In v3 reports, MCP assertions add `mcp` evidence and `anyOf` assertions add `mcpBranches`. `observations.cliMockCallCount` includes every completed mock call in the job, including post-harness verification calls. `observations.harnessCliMockCallCount` includes only calls completed during the harness phase, matching the evidence available to observation assertions. The summary record includes: - `status` - `totals.jobs`, `totals.passed`, `totals.failed`, `totals.configErrors`, `totals.warnings`, aggregate job `totals.durationMs`, and wall-clock `totals.elapsedMs` - `plan.scenarios`, `plan.harnesses`, and `plan.iterations` - `matrix.scenarios`, `matrix.harnesses`, `matrix.iterations`, and `matrix.cells` with aggregate `passed`, `failed`, `total`, and `failedJobs` fields - `failedJobs` - `warningJobs` Example: ```bash dynobox run --reporter json dynobox ``` In CI, redirect stdout to an artifact file: ```bash dynobox run --reporter json examples/local-observability > dynobox-report.ndjson ``` ## Exit Codes Dynobox exits with `0` when all loaded jobs pass. A no-argument `dynobox` invocation prints the starter banner to stdout and exits with `0`. Dynobox exits with `1` for: - Config load, parse, validation, or flag errors. - No dynos found for a directory path. - At least one completed job failed. ## Harness Requirements The CLI supports these real harnesses: - `claude-code` invokes Claude Code with stream JSON output and hook events. - `codex` invokes Codex with JSON output, no color, and the git-repo check skipped. - `opencode` invokes OpenCode with JSON output and an explicit scenario work directory. - `pi` invokes Pi with JSONL output via `--mode json` and `--no-session`, sets `PI_OFFLINE=1`, and adds `--no-approve` by default. - `cursor` invokes Cursor CLI (`cursor-agent`) with stream-json output and an explicit scenario work directory. Dynobox always passes `--trust`, including in default mode. Default mode otherwise uses Cursor's normal command approval, sandbox, and permission-rule behavior. It does not pass `--approve-mcps`; existing Cursor MCP approvals still apply. - `antigravity` invokes Google Antigravity CLI (`agy`) 1.1.14 or newer in headless mode with documented stream-json output. Each invocation creates a fresh Antigravity project and explicitly adds the scenario work directory so AGY does not reuse its persistent default project workspace. Print mode always sets `--print-timeout`: the Dynobox job timeout when one is set, or `30m` otherwise, so AGY's default five-minute cap does not cut off long evals. Default mode preserves the permission policy in Antigravity settings; tools that still require approval are soft-denied rather than prompting. Make sure the selected harness executable is installed, authenticated, and available on `PATH`. Dynobox uses each harness's non-dangerous headless behavior described above by default. Use `--permission-mode dangerous` only for trusted local evals that intentionally need harness-specific access elevation or non-interactive approval bypasses. Dangerous mode maps to harness-specific flags: - `claude-code`: adds `--permission-mode bypassPermissions`. - `codex`: adds `--sandbox danger-full-access -c approval_policy="never"`. - `opencode`: adds `--auto`, which approves permission prompts but does not override explicit deny rules. - `pi`: adds `--approve` instead of `--no-approve`. - `cursor`: adds `--force --sandbox disabled`, which automatically approves commands unless explicitly denied and disables the sandbox. - `antigravity`: adds `--dangerously-skip-permissions`, which auto-approves all tool calls, including file writes and commands. Antigravity can use a cached interactive login locally. For headless CI, set `modelProvider` to `gemini` in `~/.gemini/antigravity-cli/settings.json` and provide `GEMINI_API_KEY`; setting the environment variable alone does not select API-key authentication. Permission warnings are advisory. They explain when a harness blocked a tool action, but they do not change job status, assertion results, or exit codes. ## Saving Runs `--save-run` uploads a compact summary of the run to the Dynobox dashboard after execution. Dashboard uploads require a token: sign in with `dynobox login` or set `DYNOBOX_TOKEN`. If no token is available, the command errors before running any scenarios rather than wasting the run. When a token is present, the CLI verifies it before local execution and retries transient verification failures before asking you to try `--save-run` again later. Set `DYNOBOX_UPLOAD_URL` to send the same JSON payload to an exact custom URL instead. Custom uploads do not require Dynobox authentication and never include the Dynobox `Authorization` header. Unlike `DYNOBOX_API_URL`, this overrides only the saved-run POST destination and bypasses the Dynobox authentication preflight. ```bash DYNOBOX_UPLOAD_URL='https://uploads.example/run-hook' \ dynobox run --save-run ``` The CLI sends an HTTP `POST` with `Content-Type: application/json` and a strict run upload schema v4 body. Any `2xx` response succeeds. A JSON response containing a non-empty `url` string is printed as `Saved run: `; other successful responses print `Saved run.` The request times out after 10 seconds. All uploads are best-effort: a failed upload prints a warning and never changes job status, assertion results, or the exit code. The uploaded summary includes the current Git commit, branch, dirty state, and configured Git user name/email when available, plus scenario and assertion details. Git metadata is collected from the directory where the CLI process was started and is `null` when that directory is not a Git worktree. For all jobs, assertion records include the authored definition, display-ready expectation/observed text, and compact matched evidence when available, including requested HTTP endpoint URLs, tool commands, and verification output. This is richer than the local `--reporter json` output. Failed jobs additionally include diagnostics such as command and harness error output. These values are length-capped but are **not redacted**, so avoid `--save-run` for runs whose Git identity, assertion data, evidence, or diagnostics should not be shared. ## Dashboard [dash.dynobox.xyz](https://dash.dynobox.xyz) is the Dynobox web dashboard. It is used for CLI token creation and saved run pages. When `--save-run` uploads successfully to Dynobox, the CLI prints the returned dashboard URL so you can review or share the run. A custom endpoint may return its own URL instead. ## Development Checkout See [CONTRIBUTING.md](https://github.com/dynobox/dynobox/blob/main/CONTRIBUTING.md) for local checkout workflows. --- # Page: CI Integration Canonical URL: https://docs.dynobox.xyz/ci/ Markdown URL: https://docs.dynobox.xyz/ci.md Source: https://github.com/dynobox/dynobox/blob/main/docs/ci.md Topics: CI, GitHub Actions, skills repo, JSON reporter, PR comments, artifacts, trusted refs, secrets, Pi, Cursor CLI, cursor-agent, Google Antigravity CLI, agy # CI Integration CI support is usable today, but the final Dynobox CI experience is still evolving. Dynobox does not ship a packaged GitHub Action yet. Until then, [`dynobox/skills`](https://github.com/dynobox/skills) provides a temporary working pattern you can inspect and adapt. The skills repo is intentionally a first look, not the final CI contract. It shows how to run real skill dynos in GitHub Actions, publish a readable summary, and preserve the original Dynobox exit status after reporting artifacts are created. ## Reference Implementation See these files in [`dynobox/skills`](https://github.com/dynobox/skills): - [`.github/workflows/dynobox.yml`](https://github.com/dynobox/skills/blob/main/.github/workflows/dynobox.yml) - [`.github/actions/run-dynobox/action.yml`](https://github.com/dynobox/skills/blob/main/.github/actions/run-dynobox/action.yml) - [`skills/dyno-from-skill/dyno/dyno-from-skill.dyno.mjs`](https://github.com/dynobox/skills/blob/main/skills/dyno-from-skill/dyno/dyno-from-skill.dyno.mjs) ## Pattern The current example uses one GitHub Actions job and lets Dynobox expand the matrix defined by the dyno files: ```bash npx dynobox run skills --debug --reporter json > dynobox.ndjson ``` This shape is useful for skill repositories because each skill can own its tests under `skills//dyno`, while CI only needs to point Dynobox at `skills`. ## Trust Boundary Dynos and their setup or verification commands execute as trusted code. Do not make model credentials available to a job that checks out and runs untrusted pull-request content. Fork pull requests do not receive repository secrets by default, but same-repository pull requests can still expose secrets to code in the branch. Run secret-bearing evals only from trusted refs such as protected branch pushes, manual workflows with environment approval, or a base-revision checkout that does not execute pull-request-authored dynos. Use `permissions: contents: read` unless the reporting steps require additional access, and set `persist-credentials: false` on checkout. Treat JSON reports and `--debug` artifacts as sensitive. Transcripts, chat history, tool events, stderr, prompts, source content, and command output are not redacted. Limit artifact access and retention, and do not upload them from runs that may contain secrets. The workflow in `dynobox/skills` does the following: - Checks out the repository with persisted Git credentials disabled. - Installs Node.js dependencies and the local agent harness CLIs. - Verifies `ANTHROPIC_API_KEY` and `OPENAI_API_KEY` are available. - Passes `ANTHROPIC_API_KEY` to Claude Code and `CODEX_API_KEY` to Codex. - Runs `dynobox run skills --debug --reporter json` once. - Writes the NDJSON report to `dynobox.ndjson`. - Converts the final `summary` record and failed job diagnostics into `dynobox.md`. - Appends that Markdown to the GitHub step summary. - Automatically upserts a report comment for same-repository pull requests. These runs execute checked-out PR dynos with model credentials, so contributor-facing repositories must add an approval boundary before adopting this trigger. - Uploads `dynobox.ndjson`, `dynobox.md`, and available debug logs as workflow artifacts. - Fails the job with Dynobox's original exit status after reporting finishes. ## Harness Matrix The GitHub Actions workflow does not duplicate the harness matrix. The dyno file owns it instead: ```js const harnesses = [ { id: 'claude-code', model: 'sonnet', }, { id: 'codex', model: 'gpt-5.4-mini', permissionMode: 'dangerous', }, ]; export default defineDyno({ name: 'commit-skill-smoke-test', harnesses, scenarios: [ // ... ], }); ``` This keeps local and CI runs aligned. The same `dynobox run .agents/skills` command discovers every project scoped skill dyno and executes the configured scenario/harness pairs. ## Required Secrets The current example expects these repository secrets: - `ANTHROPIC_API_KEY` for Claude Code runs. - `OPENAI_API_KEY` for Codex runs. OpenCode runs require the `opencode` executable plus credentials for the provider named by the configured `provider/model`. OpenCode has no single provider-independent CI secret. Pi likewise has no provider-independent Dynobox secret. Install and configure `pi`, then provide the credential required by the selected `provider/model`. The example workflow remains a Claude Code and Codex example unless its install, configuration, and secret steps are extended for another harness. Cursor CLI runs should accept a `CURSOR_API_KEY` repository secret if you want to run that harness in CI. Locally, a prior `cursor-agent login` session also works. Google Antigravity CLI runs require `agy` 1.1.14 or newer. For unattended CI, store a Gemini API key as `GEMINI_API_KEY` and create `~/.gemini/antigravity-cli/settings.json` with: ```json { "modelProvider": "gemini" } ``` Antigravity does not select API-key authentication from `GEMINI_API_KEY` alone. With the provider setting present it skips account sign-in, so CI does not need to copy an interactive login or keyring cache. If your dynos only use one harness, adjust the setup and secret checks to match the harnesses you actually run.