Rustman documentation
User and developer documentation for Rustman. Pages are added as the features they describe are implemented; the behavior itself is specified in openspec/.
The same pages are published as a book at https://cyberdynecorp.github.io/rustman/, built with mdBook from this folder: docs/SUMMARY.md is its table of contents, and python3 scripts/check_docs.py checks that every page is listed there and every relative link and anchor resolves.
Available
- Install and quick start: building from source, a first workspace and a short tour of the commands
- Migrating from Postman: Postman and Newman concepts mapped to Rustman, a step-by-step migration (export,
rustman import, review the converted scripts, run in CI) and the known gaps - Installing: the release archives per platform and the features they are built with, verifying the Sigstore build provenance (
gh attestation verify) andSHA256SUMS, installing from source withcargo install --locked, and cutting a release - Request files: the workspace layout,
rustman.toml, the*.rman.yamlformat with one example per body type, collections andrustman init - Environments, variables and secrets: environment files, the active environment, variable precedence, dynamic variables,
rustman secret, secret storage and redaction, and the CI pattern - Secret providers:
{{secret:<provider>/<path>#field}}references and provider-backed environment variables, resolution at send time only,[secret_providers.*]inrustman.tomland the user config (no credentials, no commands in the workspace), thekeychain,env,sops(age, PGP viagpg),onepassword(opCLI, Connect),vault(KV v1/v2, token, AppRole, OIDC),cmdand cloud provider types, timeouts, the in-memory cache and Refresh secrets, failures and exit codes, redaction,rustman secret get|test|list-providers, and agents - Safety policy: the rules automated senders (exploration, agents) pass before a request is sent: method gating, the origin allowlist, the production guard, rate, concurrency and budgets,
429backoff, the[safety]table inrustman.toml, andGovernedSender - HTTP requests: transport, timeouts, redirects, TLS and mTLS, proxies, cookie jars, default headers, auth helpers (including OAuth2 and
rustman auth login), timings, response bodies, andrustman import curl/rustman export curl - Code snippets:
rustman export snippetfor curl, HTTPie, wget, Python, JavaScript, Go, Rust, PowerShell and C#, redaction and--show-secrets, signature-auth helpers, placeholder mode and GraphQL requests - Signature auth: Digest (challenge, nonce reuse, replayable bodies), AWS SigV4 (credential sources, redirects, unsigned payloads, clock skew) and JWT (algorithms, keys, claims, placement, redaction)
- OpenAPI import:
rustman import openapifor OpenAPI 3.0/3.1 files and URLs, format and version detection,$refresolution and--allow-remote-refs, validation diagnostics with JSON pointers, the generated collection layout, example bodies and the schema synthesizer, servers as environments, security schemes as auth with secret placeholders, the import snapshot, and--sync(three-way merge,_removed/, the change summary,--json,--dry-run) - OpenAPI exploration:
rustman explore plan,run,status,resumeandexport, dependency discovery (links, heuristics,[explore.producers]), the probe families, seeded fuzzing, the finding rules and their severities, cleanup and resources left behind, the exploration report and coverage, reproducing findings as curl and regression request files, Ctrl+C and resume, exit codes,[explore].disabled_rules, and thebad-apifixture - GraphQL:
kind: graphqlrequest files, their fields and defaults, interpolation (never inside the document), introspection and its legacy fallback, the schema cache in.rustman/graphql/schemas/,schema_fileand[[graphql.endpoints]], how the schema is chosen, validation, sending over HTTP (GET, uploads, APQ), subscriptions over WebSocket (graphql-transport-wsand the legacy protocol) and SSE with their headless limits, GraphQL assertions and captures, history records,kind: graphqlinrustman run,rustman graphql introspect/query, and the TUI GraphQL editor - JSON-RPC:
kind: jsonrpcenvelopes and id handling, notifications, response classification and errors, batches matched by id, timeouts, retries for idempotent calls, the WebSocket transport and its per-run connection reuse, and generic subscriptions with their headless bounds, therpc_errorassertion and envelope-wide JSONPath assertions and captures, history records with redacted params, OpenRPC catalogs ([jsonrpc.catalogs], the cache, validation and--no-validate),rustman rpc call/batch/discover,kind: jsonrpcinrustman runand its JSON report, the TUI editor, method guards and the agentrpc_calltool - EVM toolkit: the
[evm]table inrustman.toml, chain pinning withchain_idin environments and the exact mismatch refusal, node client detection, the known-chain registry and[evm.chains.<id>]overrides, exact unit-aware quantities (hex, decimal, wei, gwei, ether, native symbols, token units),kind: evm-callandkind: evm-txrequest files and their load-time checks (signing: EVM signing), ABI sources (built-in ERC-20/721/1155, JSON ABIs, Foundry and Hardhat artifacts, path containment, the content-hash cache), opt-in explorer ABI fetch with EIP-1967 proxy resolution and.rustman/abi-cache/, and decoding of calls, outputs, reverts (Error,Panic, custom errors), transactions, receipts and logs with token metadata; running calls with block selection, state overrides and gas estimates, call traces (debug_traceCall,trace_call), head and log streams (eth_subscribeor HTTP polling, reorgs marked), ENS names, local Anvil forks with a temporary environment, the send-method guard and the@evm-readpreset;evmassertions (outputs with units,emits,reverts,reverts_with,gas_lt) and captures (evm_output,evm_event,evm_receipt),evm-callinrustman run, therustman evm call/decode/logs/tx/block/ens/forkcommands, the TUI EVM pane and status bar, and the read-only agent tools (evm_call,evm_decode,evm_tx,evm_block,evm_logs_querycapped at 10,000 blocks,evm_ens); blockchain GraphQL presets (geth EIP-1767 and subgraph detection, display-only scalar formatting,--paginate, subgraph freshness and thesubgraphassertion, result links into the toolkit) - EVM signing: the signing gate of
kind: evm-txrequests:[evm] allow_signing,[evm.signers.<id>]keystore, keychain (rustman evm signer import) and hardware-wallet (hw-walletfeature) signers, the refusal of raw private keys everywhere, key material in zeroized secrets, and therustman evm sendpreconditions (--signand the decoded preview, thechain_idpin checked against the node, simulation from the signer and--force-revert) with their exact refusals and exit codes, node-suggested fee and gas ceilings,rustman run --signwith in-run nonces; agents never sign (rustman-mcpdoes not link the gate); signing in CI on a local Anvil - Probing EVM providers:
rustman evm probeover one or more RPC providers (URLs,{{variables}}or environment names), the read-only method catalog (--methods standard|all|list) and support matrix (supported,unsupported,restricted,error), archive detection, latency per method,newHeads/logssubscription checks, multi-provider consistency (head drift, block hash, balance and--callat a fixed block), opt-in rate-limit discovery, safety budgets (skipped (budget)), thesubject: evm-rpcexploration report,--fail-on, exit codes and--vizdashboards - gRPC:
kind: grpcrequest files and their fields, interpolation and metadata redaction, schema sources (server reflection v1 with the v1alpha fallback,.protofiles compiled in-process, descriptor sets), path containment and compile errors, the descriptor cache in.rustman/grpc/descriptors/and offline browsing, the method browser with its message templates, message encoding and unknown-field errors, unary and streaming calls with the message timeline, headless stream bounds, deadlines, binary metadata, TLS, mTLS and h2c, gRPC-Web, rich status details, thegrpc_statusandmetadataassertions andfrom: metadatacaptures,kind: grpcinrustman runand history,rustman grpc list/describe/call/healthwith their exit codes, the TUI gRPC editor, and the agent toolsgrpc_list,grpc_describeandgrpc_call - WebSocket and SSE:
kind: wsandkind: ssesessions, the WebSocket handshake (headers, auth, subprotocols, TLS, proxies, refused upgrades), scripted steps (send,wait_for,sleep,close), ping/pong and close handling, SSE streams over GET and POST and their WHATWG parsing, reconnect and resume withLast-Event-IDandretry, the message timeline, headless bounds and size limits, themessagesandclose_codeassertions with JSONPath over$.messages, therealtimehistory and report record,rustman ws connect/rustman sse listen, the TUI realtime editor and the agentrealtime_listentool - Messaging:
kind: kafka,kind: mqttandkind: amqprequest files (operation: produce|consume, brokers, destinations,limits,start,tls,auth), message payloads (text, compact JSON, base64, workspace files), Kafka produce (explicit partition, Java-compatible murmur2 key hashing, round robin,acks) with recorded partitions and offsets, Kafka consume by partition and offset (earliest,latest, absolute, timestamp) with no consumer group and no commits, bounded memory, TLS and SASL PLAIN/SCRAM with redacted passwords, Schema Registry decoding and encoding (Avro, Protobuf, JSON Schema) with a per-run cache, client limitations; MQTT 3.1.1/5 publish and subscribe (QoS 0-2, retain, MQTT 5 properties, wildcards, clean sessions, TLS, mutual TLS, WebSocket); AMQP publish with confirms andmandatory, temporary-queue consume, named queues withdestructiveorrequeue; AsyncAPI 2.6/3.0 import and payload validation; runs with headless bounds,start: before_next, assertions and captures over consumed messages and history with 64 KiB previews; safety gating of produce and named-queue consume for agents;rustman kafka|mqtt|amqp produce|consume; the TUI messaging pane; and the broker tests - Agents (MCP server):
rustman mcp servefor Claude Code, Claude Desktop and other MCP clients, stdio and Streamable HTTP (loopback bind, bearer token, Origin check), the[agent]table, the read-only default and human confirmation of mutations, redaction of results, output limits andrustman://bodies/, the audit log, background jobs (progress, cancellation, resume), the generated tool reference, and the tool error codes - MCP client: MCP server definitions (
[mcp_servers]inrustman.tomlandmcp/servers/*.yaml), interpolation, workspace trust for stdio commands (.rustman/trust.yaml,--trust), the stdio, Streamable HTTP and legacy HTTP+SSE transports, initialization, version negotiation and capabilities, tools (schema forms, argument validation, results,outputSchema), resources and templates, prompts and completion, notifications, progress, timeouts and cancellation, sampling, elicitation and roots, OAuth,kind: mcprequest files (assertions, captures, runs with one session per server, history),rustman mcp-clientand the TUI MCP inspector - Assertions and captures: status, header, JSONPath, JSON Schema, body and latency assertions, interpolated expected values, captures, and where captured values are kept
- Snapshot testing: the
snapshotassertion and its full form, where snapshots are stored, the snapshot file format, compared parts and the header include list, normalization (secret redaction,ignore, presets,replace,sort) and its fixed order, JSON, text and binary diffs, event-list snapshots, recording, update and CI modes, and reviewing failures in the TUI (Snapshot tab,aapprove,rreject,Alt+Aqueue) - Trace propagation: the
trace:environment block and[trace]inrustman.toml,--trace, W3Ctraceparent/tracestate, B3 single and multi,baggagewith variables,scope: run, headers you set yourself, signed requests, the request kinds covered, recorded trace ids,traceresponseandServer-Timing, link templates and presets,rustman trace openand the TUICtrl+O, OTLP export of client spans ([trace.export], theotlpbuild feature) - Request history: what is recorded and where, retention, redaction at rest,
rustman history listfilters,show,replaywith secret re-resolution, andclear - Importing collections:
rustman importfor Postman collections and environments, Insomnia exports, Bruno collections, HAR captures and.httpfiles: format detection, the destination, dry runs, secret extraction, script handling and Postman script migration, deterministic names, the conflict policy, the import report and exit codes; andrustman export postman/rustman export http - API docs:
rustman docs buildand therustman docs servelive-reload preview, the[docs]table inrustman.toml, thedocs:key of request files, the generated site (sections, endpoint pages, OpenAPI enrichment, search, themes), opt-in examples from history or snapshots, code samples and custom sample templates, Markdown output, GraphQL schema and JSON-RPC method references, redaction and the leak scan, publishing variables, layout template overrides, the output folder and its manifest, and publishing to GitHub Pages - Stability and compatibility: the public contracts frozen for v1.0 (request-file
version: 1,rustman.tomlversion = 1,rustman.report/v1,rustman-viz/1, the plugin WIT API and the exit codes), the additive-only promise within a major version, deprecations, what is not covered, and the tests that guard each contract - CLI reference: every command, global flags,
rustman send(including ad-hoc requests),rustman run(filters, iterations, parallel folders, bail), the pretty, json, junit and tap reporters, terminal output and logs, completions and exit codes - Data-driven runs:
rustman run --datawith CSV and JSON rows, a collection’s default data file, row variables and their precedence, iteration labels in reports,--bail=iterationand secret columns - Reports: the canonical
rustman.report/v1report of runs and explorations,rustman report schema,renderanddiff,--report <format>[=<path>], the JSON, JUnit, SARIF, Markdown and HTML formats with examples, redaction, and CI recipes (GitHub code scanning) - Load testing:
rustman benchfor request files and collections, iterations and virtual users, theconstant-vus,ramping-vusandconstant-arrival-rateexecutors, think time and stages, open and closed models and coordinated-omission correction, data feeding (sequential,per-vu,random,stopandrecycle), the safety policy pinned to--target, the[bench]caps inrustman.toml, metrics and the per-second series, thresholds (--threshold,[bench.thresholds], abort-on-fail!), Ctrl+C, generator lag, the live dashboard and progress lines,--vizstreaming, JSON and HTML reports, redaction, the summary, error classes and exit codes - Load testing internals: VUs as runners over one execution path, the governed gates and the global governor, the crate’s modules, per-second HDR windows and their memory bound, the run controller and monitor, and the executor overhead benchmark with its last result
- Stress testing:
rustman stressand itsbreakpoint,spike,soakandfuzzmodes, fuzz mixing (schema-less or--specmutations, seeds, the baseline phase), malformed payload families, wire faults, therustman.toml [stress]table (targets, production opt-in, costly families, caps), the stress gate and its refusals, SLOs over 5-second windows, breakpoint steps and bisection, failure modes, the first failing endpoint, rate limiting, spike recovery, soak drift, the client-saturation guard and the open-file check, VUs on worker threads, the kill switch and recovery check, minimization, the live dashboard, reports and--viz, regression export, a CI recipe, and exit codes - Monitors:
monitors/*.rman-monitor.yamlfiles (targets, environment,cronoreveryschedules with timezones and DST,timeout,allow_mutations,alerts),rustman monitor listandrustman monitor runfor external schedulers with their exit codes, the read-only monitor policy (the environment’s hosts, mutations opt-in, DELETE never), the whole-run deadline, the result store in.rustman/monitors/(raw day files, hourly aggregates,state.json, locking), retention and compaction ([monitors].retention) and the git-ignore warning, alert rules with deduplication, cooldown and recovery, the desktop, webhook (templates) and email (smtpfeature) channels with redaction andrustman monitor test-alert, the daemon (overlap skip, reload, lock, drain, no port) andschedule-recipefor cron, systemd, launchd and GitHub Actions,rustman monitor statusandhistory, and the TUI Monitors view - Plugins: WebAssembly component plugins, the plugin package and
rustman-plugin.toml,rustman plugin add|list|remove|verify|api|test|new, declaring plugins inrustman.toml(source,sha256,grants,limits), sha256 pinning andrustman.lock, URL sources and their cache, the grant vocabulary, the sandbox (no ambient WASI, files, network through the safety policy, secrets as handles, logs), CPU and memory limits and fault isolation, plugin API versions, therustman-plugin-sdkbindings and project templates, and the host test harness with its fake clock, randomness, network and secrets - Report schema: the JSON Schema of
rustman.report/v1(kind: run,kind: exploration,kind: contract,kind: benchandkind: stress) - Terminal UI: starting
rustman/rustman tui, workspace discovery, the create-or-scratch prompt, the responsive layout, focus, status bar, toasts, mouse, themes and colour detection,--ascii,tui.toml, the command palette, help, vim mode,keybindings.tomland the key reference, the collection tree, tabs, saving and changes on disk, the HTTP editor, the GraphQL editor (diagnostics, completion, schema explorer, refresh, subscriptions), the gRPC editor (method browser, message templates, interactive bidi streams, status details, filtered timeline), variable highlighting, the external editor, sending and cancelling, the environment switcher, secret masking and reveal, the TLS badge, the response viewer (JSON tree, JSONPath filter, search, highlighting, binary and large bodies, timing waterfall, latency sparkline, exchange diff), the viz companion hand-off and HTML report, copy as code (OSC 52), importing from the palette, quitting and terminal restore, rendering screenshots, and the platform checks (pty smoke test, manual terminal matrix) - Viz protocol:
rustman-viz/1, the JSON-lines protocol betweenrustmanand the optional graphical companion: transport, versioning, the handshake, every message with an example, and the companion’s exit codes - Webhook inspector:
rustman webhook listen, the bind address ([webhook]inrustman.toml) and--allow-remote, JSON-lines output (--jsonl) and--max-captures, the TUI webhook pane, HTTP handling and limits (400/408/413/431), what a capture keeps, the capture buffer, the default reply, mocks inwebhook/mocks.yamland their hot reload, the event log, signature verification (GitHub, Stripe, generic HMAC), and replay and save with header hygiene - Traffic recorder:
rustman record, the local recording proxy (loopback by default,--allow-remote,[record]inrustman.toml), the printed proxy exports, plain HTTP forwarding, opaqueCONNECTtunnels and HTTPS interception scoped by--intercept,TLS REJECTEDentries, the per-workspace local CA (rustman record ca init,export,install,uninstall,rotate,remove), its security model, the timeouts, trusting it per platform and in Firefox, saving captures as request files (--save), HAR 1.2 export (--har), and the TUI recorder pane - Mock server:
rustman mock servefor an OpenAPI document, the bind address ([mock]inrustman.toml) and--allow-remote, document loading, route matching, problem+json errors, the response selection order, thePreferheader, content negotiation, seeded synthesis, request validation (400/415/422,--no-validate),--enforce-securityand[mock.security], hand-written overrides inmocks/*.rman-mock.yaml, response templates, latency and faults, stateful mode and/__rustman/reset, request limits (413/431) and Ctrl+C, CORS, the request log (--jsonl) and its sources,--history, hot reload,--proxy-unmatchedand--record, the explorer self-check, and the TUI mock server pane - Contract testing:
rustman contract difffor two OpenAPI documents or--base <git-ref>, exit codes and strictness (--fail-on-unknown,--fail-on non-breaking), thecontracts/allowlist.yamlallowlist (justification,expires, expired and unused entries), a GitHub Actions pull request workflow, Pact contracts (rustman contract pact generatefrom a collection,rustman contract pact verifyagainst a provider with provider states and the safety policy), passive conformance of recorded traffic (rustman contract verify),kind: contractreports, and redaction - Contract rule catalog:
rustman contract diffandrustman contract rules, how two OpenAPI documents are matched and compared (request and response directions,$refs, recursive schemas, compositions), the JSON pointers of each difference, and every rule with its classification, description and example (generated from the catalog, with its version) - Import report schema: the JSON Schema of
rustman.import-report/v1 - JSON schemas: the machine-readable output formats and where their schemas live
Install and quick start
There are no release binaries yet. Build from source with rustup; the pinned toolchain (see rust-toolchain.toml) is installed automatically. No system libraries are needed.
git clone https://github.com/CyberdyneCorp/rustman
cd rustman
cargo install --path crates/rustman-cli --locked
rustman --version
A first workspace
A workspace is a folder with a rustman.toml at its root; request files, environments and collections are plain files inside it, meant to be committed to Git (see Request files).
rustman init my-api && cd my-api # rustman.toml, environments/local.yaml, examples/ping.rman.yaml
rustman env list # '*' marks the active environment (--env > RUSTMAN_ENV > default)
rustman send examples/ping # send one request file and print the response
rustman send GET https://httpbin.org/uuid --body-only # or an ad-hoc request, no file needed
rustman run # run every request and check its assertions (exit 1 on a failure)
rustman run --reporter pretty --reporter junit:out/junit.xml
rustman history list --limit 5 # past exchanges, redacted
rustman export snippet --lang python examples/ping # the request as Python code
rustman # open the terminal UI (or: rustman tui)
rustman --help lists every command, and each one has its own --help.
Where to go next
- Coming from Postman or Newman: Migrating from Postman, then Importing collections for other tools.
- Working interactively: the Terminal UI.
- Scripting and CI: the CLI reference, Assertions and captures, Data-driven runs and Reports.
- Variables and credentials: Environments, variables and secrets and Secret providers.
- Letting an AI agent use the workspace: Agents (MCP server).
Installing Rustman
Rustman is one binary, rustman. Install a release archive, or build it from source.
Release archives
Each GitHub release has one archive per platform, plus a SHA256SUMS file:
| Platform | Archive |
|---|---|
| Linux x86_64 (static, any distribution) | rustman-<version>-x86_64-unknown-linux-musl.tar.gz |
| Linux ARM64 (static, any distribution) | rustman-<version>-aarch64-unknown-linux-musl.tar.gz |
| macOS Intel | rustman-<version>-x86_64-apple-darwin.tar.gz |
| macOS Apple silicon | rustman-<version>-aarch64-apple-darwin.tar.gz |
| Windows x86_64 | rustman-<version>-x86_64-pc-windows-msvc.zip |
An archive holds a rustman-<version>-<target>/ directory with the binary, LICENSE-APACHE, LICENSE-MIT, README.md and completions/ (bash, zsh, fish, PowerShell and elvish scripts, the output of rustman completions). The Linux binaries are statically linked, and the Windows binary needs no Visual C++ redistributable.
What the release binaries include
Release binaries are built with these cargo features of rustman-cli, on top of the defaults (WASM plugins):
| Feature | What it adds | Docs |
|---|---|---|
cloud-secrets | The AWS, Google Cloud and Azure secret provider types | Secret providers |
otlp | OTLP export of client spans, off until [trace.export] turns it on | Trace propagation |
smtp | The email notification channel of monitors | Monitors |
Each one only does something when configured, and none needs a system library. Hardware-wallet signers (hw-wallet, Ledger and Trezor for rustman evm send) are not in release binaries; build from source with --features hw-wallet to get them.
Download and verify
Every archive and SHA256SUMS carry a build provenance attestation signed with Sigstore keyless signing: GitHub Actions signs it with a short-lived certificate bound to the release workflow run, so there is no long-lived key to trust or leak. Checking it proves the file was built by .github/workflows/release.yml in CyberdyneCorp/rustman from the tagged commit.
With the GitHub CLI (2.49 or later):
version=1.0.0 # the release you want
target=aarch64-apple-darwin # your platform, from the table above
gh release download "v$version" --repo CyberdyneCorp/rustman \
--pattern "rustman-$version-$target.tar.gz" --pattern SHA256SUMS
# 1. Provenance: built by this repository's release workflow.
gh attestation verify "rustman-$version-$target.tar.gz" --repo CyberdyneCorp/rustman
# 2. Checksum: the archive matches SHA256SUMS.
sha256sum --check --ignore-missing SHA256SUMS # macOS: shasum -a 256 --check --ignore-missing SHA256SUMS
To tie the check to a release tag as well, add --source-ref "refs/tags/v$version" to gh attestation verify. SHA256SUMS itself can be verified the same way (gh attestation verify SHA256SUMS --repo CyberdyneCorp/rustman). Without the GitHub CLI, download the files from the release page and check the checksum; the attestation can also be verified offline with cosign or the Sigstore tooling from the bundle gh attestation download fetches.
On Windows (PowerShell):
gh attestation verify rustman-1.0.0-x86_64-pc-windows-msvc.zip --repo CyberdyneCorp/rustman
(Get-FileHash rustman-1.0.0-x86_64-pc-windows-msvc.zip -Algorithm SHA256).Hash.ToLower() # compare with SHA256SUMS
Install
tar -xzf "rustman-$version-$target.tar.gz"
install -m 755 "rustman-$version-$target/rustman" ~/.local/bin/ # or any directory on your PATH
rustman --version
On Windows, extract the zip and put rustman.exe in a directory on your PATH. For shell completions, copy the script for your shell from completions/ to where your shell looks for it (see Completions).
macOS marks files downloaded by a browser as quarantined, and Gatekeeper refuses binaries that are not notarized. Archives fetched with gh release download or curl are not quarantined; for one downloaded with a browser, run xattr -d com.apple.quarantine rustman after verifying it.
From source
Build with rustup; the pinned toolchain (see rust-toolchain.toml) is installed automatically. No system libraries are needed.
git clone https://github.com/CyberdyneCorp/rustman
cd rustman
cargo install --path crates/rustman-cli --locked
rustman --version
To check out a release, add --branch v<version> to git clone. A plain build leaves out the optional features. To build what the release binaries ship:
cargo install --path crates/rustman-cli --locked --features cloud-secrets,otlp,smtp
rustman-cli is not published on crates.io, so cargo install rustman-cli does not work; cargo install --locked --git https://github.com/CyberdyneCorp/rustman --tag v<version> rustman-cli builds a release straight from the repository.
Cutting a release (maintainers)
- Set
versionin[workspace.package]and therustman-*entries of[workspace.dependencies]inCargo.toml, runcargo check --workspacesoCargo.lockfollows, and merge that tomain. - Tag the merged commit and push the tag:
git tag -s v1.0.0 -m "rustman 1.0.0" && git push origin v1.0.0. The workflow fails if the tag is notvplus the workspace version. - The Release workflow builds and smoke tests every target on its own runner, writes
SHA256SUMS, attests every file and creates a draft release with generated notes. - Review the draft (notes, the five archives and
SHA256SUMS), then publish it.
Running the workflow by hand (Actions → Release → Run workflow) is a dry run: it builds, smoke tests and attests, and never creates a release. The archives are kept as workflow artifacts.
Migrating from Postman
This guide moves a Postman workspace (collections, environments, scripts, Newman jobs) to Rustman. It covers what maps to what, the steps of a migration, and what does not carry over. Everything here is what this build does; the details of each step live in the linked pages, mainly Importing collections.
Two differences shape the whole migration:
- Rustman runs no scripts. Pre-request and test scripts are kept as comments and never executed. The importer converts the common
pm.*statements into declarative assertions and captures, and lists everything else so you can replace it. - Rustman is local-first. Collections and environments are plain files in a Git repository; there are no accounts, cloud workspaces or sync. Secret values never go into those files: they live in the OS keychain (or an external secret store).
Concept map
| Postman / Newman | Rustman | See |
|---|---|---|
| Workspace | A workspace: a folder with rustman.toml, usually a Git repository | Request files |
| Collection | A folder with a _collection.yaml (name, order:, auth, headers, variables) | Collections |
| Folder | A nested folder with its own _collection.yaml; auth and headers are inherited | Collections |
| Request | A *.rman.yaml request file (kind: http, or kind: graphql for GraphQL bodies) | Request files |
| Saved examples (responses) | Not imported; use snapshot assertions to keep a reference response, or an OpenAPI document for the mock server | Known gaps |
| Collection variables | variables in the root _collection.yaml | Variables |
| Environment | environments/<name>.yaml, selected with --env, RUSTMAN_ENV or default_environment | Environments |
| Globals | Not imported; put shared values in [variables] of rustman.toml | Precedence |
| Secret-type variables | Names listed under secrets: in the environment file, values in the OS keychain | Secrets |
| Postman Vault, external vaults | {{secret:<provider>/<path>#field}} references to 1Password, HashiCorp Vault, SOPS, cloud secret managers, … | Secret providers |
Path variables (:id) | {{id}} in the URL, with id under the request’s variables | Importing collections |
| Dynamic variables | {{$uuid}} (from $guid / $randomUUID), {{$timestamp}}, {{$randomInt}}, {{$isoTimestamp}}, {{$randomString n}}; the faker-style $random* variables have no equivalent | Dynamic variables |
pm.test / pm.expect checks | Declarative assertions: (status, header, JSONPath, JSON Schema, body, latency) | Assertions and captures |
pm.environment.set / pm.collectionVariables.set | captures: (with persist: true for environment and global setters) | Captures |
| Logic in scripts (loops, signing, computed values) | WASM plugins: auth schemes, assertion functions, value generators, transformers | Extension points |
postman.setNextRequest | No equivalent; run order comes from order: in _collection.yaml | Collections |
| Collection Runner | rustman run [paths] with --filter, --iterations, --bail, --parallel | rustman run |
Data files (-d data.csv) | rustman run --data data.csv (CSV or JSON), or data: in _collection.yaml | Data-driven runs |
Newman (newman run ... -r junit) | rustman run --reporter junit:out/junit.xml in CI, with exit codes per outcome | Reporters, Exit codes |
| Newman HTML reporters | rustman run --report html=out/report.html (also markdown, sarif, json, junit) | Reports |
| Auth: Basic, Bearer, API key, OAuth2 (client credentials, authorization code, PKCE) | The same helpers, imported as they are | Auth |
| Auth: Digest, AWS Signature, JWT | Built in, but not converted by the importer: set them again by hand | Signature auth |
| Auth: Hawk, NTLM, OAuth 1.0, Akamai EdgeGrid | Auth-scheme plugins | Auth schemes |
| Cookie jar | One jar per environment in .rustman/cookies/; rustman cookies clear | Cookies |
| Code generation | rustman export snippet --lang <lang> (or Alt+C in the TUI) | Code snippets |
| Mock servers | rustman mock serve <openapi>: served from an OpenAPI document, locally | Mock server |
| Monitors | monitors/*.rman-monitor.yaml, run by rustman monitor run, the daemon, cron, systemd, launchd or a CI schedule | Monitors |
| API documentation | rustman docs build / rustman docs serve from your request files | API docs |
| Interceptor, proxy capture | rustman record (a local recording proxy) | Traffic recorder |
| Performance tests | rustman bench (load) and rustman stress (breaking points) | Load testing, Stress testing |
| Postbot and AI agent features | rustman mcp serve: an MCP server any agent (Claude Code, Claude Desktop, IDE agents) can drive, read-only unless rustman.toml allows more | Agents (MCP server) |
| Postman’s MCP request type | kind: mcp request files and rustman mcp client commands | MCP client |
| Team workspaces, sharing, history sync | Git: review request-file changes in pull requests |
Step by step
1. Export from Postman
- Collections: in Postman, open the collection’s menu, choose Export and pick Collection v2.1 (v2.0 is read too). One file per collection.
- Environments: export each environment you use (the environment’s menu, Export). Each gives a
*.postman_environment.jsonfile. - Globals are not exported in a format Rustman reads; note the values you need (see Known gaps).
Secret values may be in these files. They stay on your machine: the importer moves them to the keychain and never writes them into the workspace, but delete the exported files once the migration is done.
2. Create a workspace
rustman init my-api && cd my-api
rustman init writes rustman.toml, a local environment and a sample request. Pass --bare to skip the sample. If you keep the workspace in an existing repository, run rustman init there instead.
3. Import the environments
rustman import postman-env staging.postman_environment.json
rustman import postman-env prod.postman_environment.json
Each becomes environments/<slug>.yaml. Variables that Postman marks secret, and variables whose name looks like a credential (token, password, api_key, …), are listed under secrets:; their values go to the OS keychain (or .rustman/secrets.yaml when there is none), never into the file. Check the result with:
rustman env list
rustman secret list --env staging
4. Preview, then import the collection
Start with a dry run. It converts everything and prints the planned files, the secrets it would move and the report, without writing anything:
rustman import postman billing.postman_collection.json --into billing/ --env staging --dry-run
Then import for real, keeping both reports:
rustman import postman billing.postman_collection.json --into billing/ --env staging \
--report out/import-report.json --migration-report out/migration.md
--intois the collection folder (default: a folder named after the collection).--envis the environment that receives secrets found in the requests (default: the active environment; without one, a new environment named after the collection).--reportwrites the JSON report (rustman.import-report/v1);--migration-reportwrites the Markdown list of script statements that were not converted, each with a suggestion.- Re-running the import is safe: existing files are skipped by default (
--on-conflict skip|overwrite|rename), and unchanged files are never rewritten.
The summary says what happened:
imported Billing API (postman) into billing/
written: 11 requests, 4 collections, 1 environments; skipped: 0; dropped: 4; secrets moved: 9; unsupported: 1; unmapped: 1
3 scripts preserved as comments, not executed
scripts: 31/40 statements converted (77%)
Every dropped, unsupported, unmapped and secret line names the item it comes from. In CI, --fail-on-unsupported makes an import that loses anything exit with 1.
5. Review the converted scripts
Open a few request files. Each Postman script is kept verbatim in an # imported-script comment block at the top of the file (collection and folder scripts in _collection.yaml), and the statements Rustman understood are also written as assertions: and captures:. For example, a Postman test such as
pm.test("created", () => {
pm.response.to.have.status(201);
const body = pm.response.json();
pm.expect(body.id).to.exist;
pm.environment.set("invoice_id", body.id);
});
is written as
assertions:
- status: 201
- json:
path: $.id
exists: true
captures:
- var: invoice_id
from: json
path: $.id
persist: true
The statements that convert are listed in the script mapping table: status checks, pm.response.to.be.ok, header presence and value, response time, body text, pm.response.json() field checks (equality, existence, length, type, comparisons, include), and the environment, global, collection and plain variable setters whose value comes from the JSON body, a header or a cookie.
Go through out/migration.md for the rest. Typical replacements:
| Script pattern | Rustman replacement |
|---|---|
Checks over every item of an array (items.every(...)) | A schema assertion; the migration report suggests the inline schema to paste |
Validating a response against a JSON Schema with tv4 / ajv | A schema assertion pointing at the schema file |
postman.setNextRequest(...), request chaining | Order the requests with order: in _collection.yaml; values flow between them through captures |
| Logging in from a pre-request script to fetch a token | A login request first in order: with a capture of the token, or the built-in OAuth2 helper |
| Signing requests (HMAC, custom headers) | Built-in Digest, AWS SigV4 or JWT auth, or an auth-scheme plugin |
| Computed values (timestamps, random data) | Dynamic variables, or a value-generator plugin |
| Custom checks with no declarative form | An assertion-function plugin |
Once the replacements are in place, delete the # imported-script blocks you no longer need; they are never run.
6. Fill in what the import left out
- Auth the importer reported as unsupported (
digest,awsv4,hawk,ntlm, OAuth2implicitorpasswordgrants, …) is written asauth: {type: none}, so the request inherits no parent credential. Set Digest, AWS SigV4 or JWT auth by hand (Signature auth); the others need a plugin. - Globals: add the values you used to
[variables]inrustman.toml, or to the environments. Declare credentials as secrets and store them withrustman secret set <name> --env <env>. - OAuth2 tokens Postman had cached are not carried over. For the authorization-code grant, log in once on a workstation with
rustman auth login <request> --env <env>. - Unmapped dynamic variables (
$randomCity, …) are kept as written and reported; replace them with a fixed value, a data file column, or a value-generator plugin.
7. Run the collection
rustman run billing --env staging
rustman run billing --env staging --data customers.csv --data-label email
rustman run . --env staging --filter 'billing/**' --bail
rustman run sends every request under the given folders in collection order, checks the assertions and chains captures, like the Collection Runner. --iterations <n> repeats the run; --data runs once per CSV or JSON row with the columns as variables, like newman run -d.
You can also open the workspace in the terminal UI with rustman and send requests one at a time.
8. Replace Newman in CI
| Newman | Rustman |
|---|---|
newman run collection.json -e staging.json | rustman run billing --env ci |
-d data.csv, -n 5 | --data data.csv, --iterations 5 |
--bail | --bail (or --bail=iteration with data files) |
--folder Invoices | rustman run billing/invoices, or --filter 'billing/invoices/**' |
--env-var token=... | --var token=... for plain values; declared secrets for credentials (below) |
-r cli,junit --reporter-junit-export out.xml | --reporter pretty --reporter junit:out/junit.xml |
-r htmlextra | --report html=out/report.html |
--insecure, --timeout-request | --insecure, --timeout 5s |
Give CI its own environment (environments/ci.yaml) declaring the same secrets, and feed them from the CI’s secret variables into the file store at the start of the job (the CI pattern). In GitHub Actions:
env:
RUSTMAN_ENV: ci
RUSTMAN_SECRET_STORE: file
steps:
- uses: actions/checkout@v5
- run: cargo install --git https://github.com/CyberdyneCorp/rustman rustman-cli --locked
- run: printf '%s' "$API_TOKEN" | rustman secret set api_token
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
- run: rustman run billing --reporter pretty --reporter junit:out/junit.xml
The exit code tells CI what happened: 0 when every request passed, 1 when an assertion failed, 2 for a usage or configuration error, 3 when a request errored (network, TLS, timeout, unresolved variable). Secrets are redacted as «redacted:<name>» in every reporter and log.
9. Move the rest
- Mock servers:
rustman mock serve api.yamlserves an OpenAPI 3.0/3.1 document, with responses from its examples or synthesized from its schemas. If your Postman mock was built from saved examples, describe the API in OpenAPI first (Mock server). - Monitors: write a
monitors/<name>.rman-monitor.yamlwith the targets, environment and schedule, then run it withrustman monitor daemon, or generate a cron, systemd, launchd or GitHub Actions configuration withrustman monitor schedule-recipe <name> --for github-actions. Monitors are read-only unless the file setsallow_mutations(Monitors). - AI features: register
rustman mcp servewith your agent (claude mcp add rustman -- rustman mcp servefor Claude Code) to let it list, send and test your saved requests under the workspace’s permissions and safety policy (Agents (MCP server)). - Going back, or sharing with Postman users:
rustman export postman billing -o billing.postman_collection.jsonwrites a Collection v2.1 file; secrets are exported as{{name}}placeholders, never as values (Exporting).
Known gaps
What the importer does not carry over, or Rustman does not do:
- Script execution. No JavaScript runs, by design. Unconverted statements are listed in the migration report and stay as comments.
- Saved examples (responses) in a collection are not imported.
- Globals exports are not read; move them by hand.
- Folder-level variables are dropped (Postman itself never resolves them) and reported.
- Disabled headers, query parameters, form fields and variables are dropped and reported.
- Request settings (
protocolProfileBehavior: redirects, TLS, encoding options) are not imported; set them undersettings:in the request file or inrustman.toml(Settings). - Auth types other than Basic, Bearer, API key and OAuth2 client-credentials / authorization-code are written as
auth: {type: none}and reported. Digest, AWS SigV4 and JWT exist in Rustman and must be set by hand; the rest need a plugin. - Cached OAuth2 tokens are dropped; Rustman fetches its own.
- Faker-style dynamic variables (
$randomCity,$randomEmail, …) are kept unchanged and reported as unmapped. - Secrets in free text (XML bodies, GraphQL query documents, descriptions, base64 blobs) may not be found; review them after an import (Secrets lists the limits).
- Postman Flows, cloud collaboration, comments, forks and pull requests inside Postman have no equivalent: use Git and your code-review tool.
- Mock servers are served from an OpenAPI document, not from a collection’s examples.
Terminal UI
rustman with no subcommand, or rustman tui [PATH], opens the full-screen terminal UI. The behavior is specified in openspec/specs/tui.
Starting
rustman # open the TUI from the current directory
rustman tui # the same
rustman tui api/ # start the search in api/ instead
rustman tui --theme light --ascii
rustman tui --vim # vim keys for this run
The TUI looks for rustman.toml in PATH (default: the current directory) and then in each parent directory, and opens the first workspace it finds. Running it from /proj/api/users opens the workspace rooted at /proj.
If there is no rustman.toml anywhere above PATH, a prompt offers two choices:
- Create workspace here creates a workspace in PATH, exactly like
rustman init PATH, and opens it. - Scratch session opens an empty session that is not backed by any file.
Use ↑/↓ (or Tab, j/k) and Enter, or press c or s directly. If the workspace can’t be created, the error is shown in the prompt and you can choose again.
rustman with no subcommand only opens the TUI when stdin and stdout are a terminal; in a pipe or a script it prints the help instead. rustman tui without a terminal fails with exit code 2 and error: the terminal UI needs an interactive terminal (stdin and stdout must be a TTY).
Quitting and terminal restore
Ctrl+Q quits. Ctrl+C never quits (it is reserved for cancelling a request in flight).
The TUI runs in raw mode on the terminal’s alternate screen. On exit, and also if Rustman panics, the terminal is restored first (cooked mode, main screen, visible cursor), so any panic message lands on your normal screen and the shell keeps working.
The terminal is also restored when the process is told to stop: SIGTERM, SIGHUP (the terminal window was closed) or SIGINT from kill on Linux and macOS, and closing the console, logging off, shutting down or Ctrl+Break on Windows. Rustman then exits with status 128 plus the signal number (143, 129, 130; 130 on Windows). If background work (loading or creating a workspace) panics, or reading the terminal fails, the TUI also closes cleanly and prints the error, exit status 1.
Layout
The shell adapts to the terminal size:
| Size | Layout |
|---|---|
| 120 columns or more | Sidebar (28 columns by default), request editor and response viewer side by side. Ctrl+B hides or shows the sidebar. |
| 80–119 columns | Request editor above the response viewer. The sidebar is hidden; Ctrl+B shows it as an overlay over the left edge (and again, or Esc, closes it). |
| Under 80 columns or under 24 rows | One pane at a time, with a pane switcher bar (Sidebar, Request, Response) on top and the notice Smaller than the recommended minimum of 80x24 at the bottom. Tab moves between panes; Ctrl+B jumps to the sidebar and back. |
Resizing the terminal re-lays out the screen without losing focus, sidebar width or anything else. The sidebar is 20 to 50 columns wide: drag its right border with the mouse, or use Alt+Right / Alt+Left.
The sidebar shows the workspace as a collection tree, the request editor edits the open request (see Requests) and the response viewer shows its last exchange (see Response viewer).
Focus
Tab and Shift+Tab move the focus around a ring: sidebar, method, URL, editor tabs, editor content, response viewer, and back to the sidebar. A hidden sidebar is skipped. The focused pane has a highlighted border and a › before its title.
Status bar
The bottom line shows, from the left: the workspace name (or Scratch session), the active environment (env: NAME or no environment), TLS verified or a red TLS: INSECURE badge while certificate verification is off (verify_tls = false in rustman.toml, or settings: verify_tls: false in the request open in the current tab), and how many requests are in flight. On the right: the vim mode (NORMAL, INSERT, VISUAL) when vim keys are on, a SECRETS VISIBLE badge in the warning colour while secrets are revealed, the webhook listener’s address while it runs (webhook 127.0.0.1:9090, or a red WEBHOOK ON NETWORK 0.0.0.0:9090 badge when it is reachable from the network; see Webhook pane), the recording proxy’s address while it runs (record 127.0.0.1:8888, or a red RECORDER ON NETWORK badge) and a CA TRUSTED badge while the workspace’s recorder CA is installed in a trust store (see Recorder pane), and the quit hint.
Toasts and the notification log
Messages appear as toasts in the top-right corner, newest on top, at most three at a time. Info and success toasts disappear after 3 seconds; warnings and errors stay until dismissed or for 10 seconds. Esc dismisses the newest toast, and clicking a toast dismisses it. Every toast is also kept in the notification log (the last 500), which Show notification log in the command palette opens; Esc closes it.
Warnings found while loading the workspace, a tui.toml that can’t be read, and bad entries in keybindings.toml are shown as warning toasts.
Requests
Collection tree
The sidebar shows the workspace’s folders and request files in run order (the order rustman run uses). Each request has a badge: its method (GET in the ok colour, POST accent, PUT/PATCH warn, DELETE error) or its kind for other request kinds (GQL, MCP, GRPC, …). A ● (* with --ascii) marks a request open in a tab with unsaved changes.
| Key (sidebar) | What it does |
|---|---|
↑/↓, Home/End, PageUp/PageDown | move the selection |
Enter | open the request in a tab (or focus its tab); on a folder, fold or unfold it |
← / → | fold / unfold the selected folder |
/ | filter: type to keep the requests whose path fuzzy-matches (matched characters are highlighted), Enter opens the selection, Esc clears the filter |
n | new request in the selected folder; a name such as admin/list also creates the folder |
r | rename the selected request or folder (open tabs follow) |
d | delete the selected request or folder, after a confirmation (Cancel is preselected) |
Request kinds this build does not know (for example kind: soap) still load: they open read-only, showing the file as it is, with the notice No editor for kind "soap".
Tabs
Several requests can be open at once; their tabs are listed in the request editor’s top border, the current one highlighted. Ctrl+T opens a new request, Ctrl+W closes the current tab, Alt+1 … Alt+9 go to a tab, and Ctrl+PageUp / Ctrl+PageDown go to the previous / next one (clicking a tab works too). Each tab keeps its own editor state, its last exchange and its in-flight request, so a request can keep running in one tab while you edit another.
Saving and unsaved changes
A tab whose request differs from its file shows ● after its title, and the request shows ● in the sidebar. Ctrl+S saves it (Ctrl+S is safe to use: raw mode turns off XON/XOFF flow control); a new tab asks for a file name first, relative to the workspace root (users/create, .rman.yaml is added). Files are written in Rustman’s canonical layout: a query string typed in the URL is saved as query: rows, and settings, variables, captures and descriptions are kept as they were. In a scratch session nothing is saved.
Closing a tab with unsaved changes, or quitting with any, asks Save / Discard / Cancel (s, d, c, or the arrows and Enter; Esc cancels).
The TUI watches the workspace for changes made by other programs (an editor, git checkout). The sidebar follows them. A tab without unsaved changes reloads its file; a tab with unsaved changes shows a conflict prompt: Keep mine (keep editing; saving overwrites the file) or Load from disk.
The HTTP editor
The first row holds the method and the URL. With the method focused, ←/→, Space or Enter cycle through GET POST PUT PATCH DELETE HEAD OPTIONS, and a letter jumps to the next method starting with it. The URL is a one-line text field.
Below them, the editor tabs: Params, Headers, Body, Auth and Assertions (with the tab bar focused, ←/→ or 1–5 switch; clicking a label does too).
- Params and Headers are tables with an enable toggle per row. Keys in a table:
Enteredits the name, thenTabmoves to the value andEntercommits (Esccancels the edit);Spaceturns the row on or off;a(orInsert) adds a row;x(orDelete) removes it;↑/↓move. A disabled row stays in the file (enabled: false) but is not sent. Params and the URL’s query string stay in sync both ways: adding the rowpage=2tohttps://api.test/usersmakes the URLhttps://api.test/users?page=2, and typing?a=1in the URL adds the row; disabled rows are left out of the URL. - Body:
Alt+Mcycles the mode:none,raw (JSON),raw (XML)(addsContent-Type: application/xmlwhen no content type is set),raw (text),form-urlencodedandmultipart. Raw bodies are text areas (modal with vim keys); form and multipart bodies are tables, where a multipart value@pathsends a workspace file. Atype: filebody is shown, not edited. - Auth:
Alt+Mcyclesinherit(noauth:, the nearest collection’s applies),none,basic,bearerandapi_key; their fields form a table. OAuth2 is shown and kept as is; edit it in the file. - Assertions: the request’s
assertions:as YAML, the same syntax as in the file (see Assertions). A list that does not parse cannot be saved: the error names the problem.
The GraphQL editor
A kind: graphql request (see GraphQL) opens in its own editor. The first row shows how the operation travels (POST, GET, WS or SSE) and the endpoint, a one-line text field. The editor tabs are Query, Variables and Schema (1–3 with the tab bar focused).
- Query is the document, with syntax colours. Its first line says where the schema comes from (
Schema: schema_file schema.graphql · 42 types,Schema: cache, fetched …), orNo schema: syntax onlywhen there is none. The document is checked as you type, without sending: every problem is underlined where it starts (in the error colour, the warning colour for deprecated fields) and the last line shows the one at the cursor, e.g.✖ 2:8: Cannot query field "emial" on type "User"., or✔ Valid. A document fromdocument_fileis shown read-only; edit the file. Ctrl+Spaceopens the completion popup at the cursor: fields, arguments, enum values, variables, directives and fragments, each with its signature.↑/↓choose,EnterorTabinserts, typing narrows the list andEsccloses it.- Variables is the
variables:map as a JSON object;{{variables}}in it are resolved on send. JSON that does not parse is reported on the last line, and the request cannot be saved or sent until it does. - Schema browses the schema: the types with their kind, then (
Enter) a type’s fields with their arguments and types, input fields, enum values, interfaces and possible types; deprecated members are struck through with their reason.Enteron a field opens its type;Backspacegoes back.
The schema is the request’s schema_file, the schema_file of its endpoint in rustman.toml, or the cached introspection result, read when the tab opens. Opening or sending never introspects: Ctrl+G (Refresh GraphQL schema) runs the introspection query against the endpoint, in the active environment, and replaces the cache. Edits are saved to the request file with Ctrl+S; fields the editor does not show (headers, auth, transport, assertions) are kept.
Sending a document with errors asks first: Send anyway sends it without the check, Cancel (the default) does not send. A query or mutation shows its result in the response viewer’s Data, Errors and Extensions tabs. Each of these tabs starts with a summary line: the operation, the result (ok, partial, errors), the subscription protocol (graphql-transport-ws, legacy subscriptions-transport-ws or sse) and the APQ outcome, when there are any (subscription OnMessage · ok · legacy subscriptions-transport-ws). Alt+S (Start GraphQL subscription, or Ctrl+Enter) starts a transport: ws or sse subscription; it runs until the server completes it or you stop it, with no max_events or duration limit. While it runs, the response viewer counts the events and lists the newest (⠋ Subscribed: 3 events · 2.4 s). Alt+X (Stop GraphQL subscription) stops it and keeps what arrived: the Events tab lists every event with its time since the start and why it ended (Ended: stopped, 3 events). Esc cancels it instead, like any request.
The JSON-RPC editor
A kind: jsonrpc request (see JSON-RPC) opens in its own editor. The first row shows RPC (or SUB for a subscription) and the endpoint. The editor tabs are Call, Batch, Headers, Auth and Assertions (1–5 with the tab bar focused).
- Call starts with where method completions come from (
Catalog: 42 methods, from[jsonrpc.catalogs]or therustman rpc discovercache; the endpoint is resolved in the active environment, without reading secrets), then the one-line Method field and the Params as JSON (an array or an object). Typing in the method field opens a popup of the catalog methods starting with what is typed, each with its param names (eth_getBalance(address, block?),?marking optional ones);Ctrl+Spaceopens it too.↑/↓choose,EnterorTabtakes one,Esccloses it.Enteror↓moves from the method to the params,↑on the first params row moves back. Params that do not parse are reported on the last line. A batch file shows its calls in the Batch tab instead. - Batch, Headers, Auth and Assertions are those parts of the file as YAML, the same syntax as in the file. YAML that does not parse, or a file that no longer loads (for example a method left empty), cannot be saved or sent: the error says why.
An edited request is saved with its members in schema order; an unedited one keeps its file text. Ctrl+R sends it; the response viewer shows Result (each call’s result exactly as received, hex included), Error (code, message and data, and server rejected the batch when one error answered a whole batch) and Events, then the usual Body, Headers, Timing and Assertions. A subscription runs until you stop it: the viewer counts the events and lists the newest live (⠋ Subscribed: 3 events · 2.4 s (Esc unsubscribes)). Esc sends the unsubscribe call and stops it, keeping what arrived (Ended: stopped, 3 events); a second Esc cancels outright. A method guard that refuses the method stops the send with its message.
The gRPC editor
A kind: grpc request (see gRPC) opens in its own editor. The first row shows GRPC and the target. The editor tabs are Method, Message, Metadata and Assertions (1–4 with the tab bar focused).
- Method starts with where the schema comes from: the request’s
.protofiles or descriptor set, else the descriptor cache, else the server by reflection (whose answer is then cached). It loads in the background when the tab opens, with the request resolved in the active environment, so errors are redacted.Ctrl+Gasks the server again. When the server cannot be reached and the cache has the target, the cached schema stands in and the line says so:Schema (may be stale, Ctrl+G refreshes): 5 methods from the descriptor cache, fetched …. Below the picked method and its call type, the browser lists every method of every service with its call type;↑/↓select andEnterpicks one. - Message is the request message as JSON, in the proto3 JSON mapping, with its request type on the first line. Picking a method puts its template in the tab (every field at its default, nested messages to depth 3, repeated fields as one-element lists, enums as their first value) unless you typed something there; a client-streaming or bidi method takes a list (
messages), sent in order. JSON that does not parse is reported on the last line. - Metadata and Assertions are those parts of the file as YAML.
Ctrl+R sends the request. While a call streams, the response pane counts the messages and lists the newest live, each with its direction (> sent, < received), time since the call started, size and JSON (⠋ 5 messages · 2.4 s (Ctrl+R sends, Alt+X half-closes)). Interactive streams have no stream bounds: they run until the server ends them, the deadline expires, or you stop them. During a bidi call, Ctrl+R sends the Message tab (each entry of a list) on the open stream instead of starting a new call; a message the schema rejects is not sent and the toast says why. Alt+X half-closes the stream: the server may still answer, and the call ends when it does. Esc cancels the call outright.
The response viewer shows Messages (each received message), Status (the status code, name and message, the decoded google.rpc.Status details such as BadRequest field violations, an unknown detail as its type URL and base64, then the response headers and trailers), Timeline and Assertions. With the response focused, d cycles the timeline between all, sent and received messages, and f filters it by text as you type (Enter keeps the filter, Esc clears it); the filter line shows how many entries match (Direction: received (d) · Filter: more (f) · 1 of 5). Every value is redacted like history: a secret sent in metadata and echoed by the server shows «redacted:token».
The WebSocket and SSE editor
A kind: ws or kind: sse request (see WebSocket and SSE) opens in the realtime editor. The first row shows WS or SSE and the URL. The editor tabs are Timeline, Compose, Headers, Steps (WebSocket) or Body (SSE), and Assertions (1–5 with the tab bar focused).
- Timeline shows the session:
Connected · 12 of 80 entries (3 dropped), the filters, one row per entry (time since the session started,sent,recvorsys, the type, the size and the start of the payload) and, below, the payload of the selected entry, pretty-printed when it is JSON. With the content focused,dcycles the direction filter (all, sent, received, system),tthe type filter (each type seen so far),/starts typing a text filter (Enterends it),cclears the filters,↑/↓(ork/j) select an entry,ggoes to the first andG(orEnd) follows the newest again. Only the rows that fit are drawn, and the pane keeps at mostlimits.max_timelineentries (default 10000), so a long session never slows down input. - Compose holds the frame to send: text, JSON (checked before it is sent) or binary as base64;
Alt+Mchanges the type. It is sent as typed, without interpolation. - Headers, Steps / Body and Assertions are those parts of the file as YAML, as in the JSON-RPC editor.
Ctrl+R connects. The session runs the file’s steps, then stays open until you close it (no headless bounds); while it is open, Ctrl+R sends the Compose frame instead of starting another send, and Esc closes the session with code 1000, keeping its timeline. A second Esc cancels outright. When the session ends, the response viewer shows its record and assertions as for any request, and it is recorded in history. Entries are redacted before they reach the pane: a secret of the request that a server echoes shows as «redacted:<name>».
The messaging editor
A kind: kafka, kind: mqtt or kind: amqp request (see Messaging) opens in the messaging editor. The first row shows PRODUCE or CONSUME and the broker address. The editor tabs are Messages, Compose, Broker and Assertions (1–4 with the tab bar focused).
- Messages shows the consumer:
Consuming · 120 messages, one row per message (where it came from, its key and the start of its value) and, below, the selected message’s value: pretty-printed JSON,decoded from Schema Registry id <n>, text, or a hex dump for binary values. With the content focused,↑/↓(ork/j) select a message,ggoes to the first andG(orEnd) follows the newest, andp(or Space) pauses the list (Paused · 120 messages (8 more since the pause)). The pane keeps at most 10000 messages; when the buffer is full the consumer stops (Buffer full). - Compose holds the messages a produce sends, Broker the destination and connection settings, and Assertions the assertions, each as YAML.
Ctrl+R runs the operation. A consume has no headless bounds: it runs until Esc stops it, keeping what it collected; a second Esc cancels outright. When it ends, the response viewer shows its record and assertions, and it is recorded in history. Messages are redacted before they reach the pane.
Variables
Every {{variable}} in the URL, params, headers, auth and body is highlighted: in the accent colour when it resolves, in the error colour (and underlined, so it shows without colour) when no layer defines it. When the cursor is on a variable (in the URL, a text body, or the selected table row) a line at the bottom of the editor shows its value and the layer it comes from, e.g. {{base_url}} = http://localhost:8080 · environment, or {{base_url}} is not defined in any layer. Variables are looked up with the request’s own precedence (request, collection, active environment, rustman.toml). Secrets are never read for this and show masked, {{token}} = •••••••• · secret (environment), unless you reveal secrets.
External editor
Ctrl+E (editor focused, raw body) writes the body to a temp file named for its type (.json, .xml, .txt), hands the terminal to $VISUAL, else $EDITOR, else vi (notepad on Windows), and waits. When the editor exits the TUI comes back with the edited body (the tab is marked dirty if it changed) and the temp file is deleted. Values with arguments such as EDITOR="code --wait" work. On Unix the value is split like a shell would. On Windows a value that names an existing file (quoted or not) is used as is, so EDITOR=C:\Windows\System32\notepad.exe and paths with spaces work; anything else is split with the Windows command-line rules (backslashes are literal, double quotes group). If the configured editor cannot be started, vi (notepad on Windows) opens instead and a warning toast says why.
Sending and cancelling
Ctrl+Enter sends the current tab’s request (Ctrl+R does too, for terminals that cannot encode Ctrl+Enter). The request is sent in the background with the active environment, through the same engine as rustman send: variables are resolved the same way, cookies, captures and OAuth2 tokens are shared with the CLI, and the exchange is recorded in history (redacted), unless [history] enabled = false. Unsaved edits are sent as they are; the file is not saved. A new tab that was never saved is sent and recorded as untitled.rman.yaml, and in a scratch session nothing is recorded.
While the request is in flight the response viewer shows a spinner and the elapsed time (⠋ Sending… 1.2 s), and the status bar counts the requests in flight. Everything else keeps working: other tabs, the sidebar, editing, even sending from another tab. Esc or Ctrl+C cancels the current tab’s request: the connection is closed at once and the viewer shows Cancelled after 3.0 s. Closing the tab or quitting cancels it too, and sending again from the same tab replaces the request in flight. Ctrl+C with nothing in flight never quits; it shows Press Ctrl+Q to quit.
Copy as code
Alt+C (or Copy as… in the palette) opens a picker of the snippet languages of rustman export snippet, the one you used last first. Type to filter (py req finds python-requests), ↑/↓ choose, Enter copies the current tab’s request, as edited, with the active environment: the toast reads Copied python-requests snippet. Each language is also in the palette as Copy as curl, Copy as go and so on. A graphql request is copied as its HTTP POST; other kinds have no snippet and Alt+C only shows a toast such as No snippet export for kind 'kafka'.
The snippet goes to the clipboard through the OSC 52 escape sequence, which works over SSH and inside tmux and needs no clipboard tool. Rustman uses it in Windows Terminal, iTerm2, WezTerm, kitty, Alacritty, foot, Ghostty, Contour, Rio and VS Code’s terminal (TERM, TERM_PROGRAM, or LC_TERMINAL, which SSH forwards), and inside tmux when tmux’s set-clipboard option is on (set -g set-clipboard on; tmux’s default, external, drops the sequence); set RUSTMAN_OSC52=1 to use it in another terminal, or RUSTMAN_OSC52=0 to never use it. Without it, or when the sequence would be over 100 KB (base64 makes it about 4/3 of the snippet, so a snippet over about 75 KB), the snippet opens in a read-only pane with the hint Select to copy; ↑/↓ scroll, Esc closes.
Snippets are redacted («redacted:token») like export snippet. While secrets are revealed (Alt+R) they hold the secret values instead: the picker shows the row Secrets revealed: snippet will contain secret values, and copying takes a second Enter (moving the selection or typing asks again). A palette Copy as entry opens the picker on its language in that case.
Importing collections
Import… in the palette imports a Postman collection or environment, an Insomnia export, a Bruno collection, a HAR capture or .http files into the workspace, with the engine of rustman import. Type the file or folder (relative to the workspace root, or absolute) and press Enter: the format is detected and a dry run shows its preview, the same summary as rustman import --dry-run: what would be written, skipped or updated, and which secrets move into the active environment (by name only). Enter imports that previewed source; Esc before it cancels without writing anything. Once the import runs it cannot be cancelled: the dialog shows Importing… until it is done, then the result is reported. The collection goes to the folder named after it, existing files are kept (--on-conflict skip), and the sidebar shows the new requests. For --into, other conflict policies, HAR filters or the JSON report, use the CLI.
Environments and secrets
Alt+E (or Switch environment in the palette) lists the workspace’s environments with the active one marked. Below the list it shows the variables the selected environment provides: each name, its layer (environment, or rustman.toml for workspace variables it does not override) and its value. Enter makes the selected environment active for this session: the status bar shows it and the next send resolves its variables from it. The default stays the one in rustman.toml (default_environment); switching in the TUI does not change any file.
Secret values are shown as •••••••• in the variable tooltip, the environment switcher and captured values. Response headers or bodies that echo a secret are redacted by the engine before the viewer gets them and show the engine’s marker, «redacted:token», the same text history, copies and saved bodies hold. Secret values are not read from the keychain or .rustman/secrets.yaml to draw the screen.
Alt+R reveals secrets for this session: the status bar shows a SECRETS VISIBLE badge in the warning colour, and the tooltip and the environment switcher show the active environment’s secret values, read once from the secret store (switching environment reads the new one’s). Press Alt+R again to mask them; the values are dropped from memory. Nothing about the reveal is saved, so the TUI always starts masked. Exchanges stay redacted while secrets are revealed: history, the response viewer, copies, saved bodies, reports and the viz companion never get secret values.
While certificate verification is off for the active environment’s sends (verify_tls = false in rustman.toml, which every environment uses, or verify_tls: false in the settings of the request in the current tab) the status bar shows TLS: INSECURE in the error colour, for as long as it stays off, and each exchange sent that way is marked TLS: INSECURE in its summary line. Environment files have no TLS setting of their own.
Response viewer
The response pane starts with a summary line: the status and reason, coloured by class (2xx ok, 3xx accent, 4xx warn, 5xx error, with ✔/✖ so it reads without colour), the total time, the body size and the assertion tally, e.g. ✔ 201 Created · 84 ms · 1.2 KiB · 3/3 passed. An exchange sent with TLS verification off ends with TLS: INSECURE. When no response arrived the line names the error category and the engine’s message instead (✖ DNS error · cannot resolve api.test: …; also TLS error, Timeout, Connection error, Proxy error, Auth error, Redirect error).
Below it are the viewer tabs Body, Headers, Timing and Assertions (a GraphQL exchange adds Data, Errors, Extensions and Events in front, see The GraphQL editor); with the response focused, ] and [ switch between them, and ↑/↓, PageUp/PageDown, Home/End (j/k, Ctrl+D/Ctrl+U, gg/G with vim keys) scroll.
Everything the viewer shows is redacted with the exchange’s secrets, as in history: a server echoing a token shows «redacted:token», and copying or saving the body copies or saves the redacted text.
- Body: JSON is a collapsible tree, parsed once in the background so even large bodies scroll smoothly (only the rows on screen are drawn).
Enter/Spacefolds or unfolds the selected node,←/→(orzc/zo) fold/unfold,zM/zRfold/unfold everything, and a folded array readsitems: [1000 items].ycopies the selected value (a string without its quotes, anything else as JSON) with the system’s clipboard tool (pbcopy,clip,wl-copy,xcliporxsel), or else through the terminal with an OSC 52 escape sequence, which also works over SSH in terminals that support it.rswitches between the tree and the pretty-printed text.fopens a filter box that takes a JSONPath expression (not jq):$.items[*].idshows only the matching nodes, each named by its path, and the match count. An expression that does not parse shows its error inline and keeps the current view; an empty filter (orEscin the box) shows the whole body again./searches keys and values as you type, unfolding the way to the first match;n/Ngo to the next/previous match. On large trees (above 20,000 nodes) the search runs in the background and the box showssearching…until it finishes; each keystroke cancels the previous search, so typing never waits for it.- HTML, XML, YAML, JavaScript and CSS bodies are highlighted according to the
Content-Type(bodies above 512 KiB, or with a line longer than 20 KiB such as minified HTML, are shown plain); other text is shown as it is. - Binary bodies (images, audio, video, fonts, PDFs,
application/octet-stream, or anything that is not UTF-8) show a hex dump of the first 4 KiB and the total size.ssaves the body to a file (relative paths are taken from the workspace root); an existing file is never overwritten. - Bodies above the engine’s
max_body_bytes(10 MiB by default, see Request files) are kept on disk instead of in memory. Above 50 MiB the tree is disabled: the viewer says so and shows the raw text a page at a time (scrolling past the end of a page loads the next one).
- Headers: every response header in the order received, duplicates included (two
Set-Cookieheaders are two rows), then the request’s captured variables with their new values; secret ones show••••••••. - Timing: a waterfall of the phases the engine measures (DNS, connect, TLS, waiting for the first byte, download), each bar placed and sized by its share of the total, with its duration. Phases that did not happen, such as DNS, connect and TLS on a reused connection, show
—. The response’sServer-Timingmetrics appear as labeled sub-bars under the waiting phase (db 53.2 ms), with their description. When the exchange carried trace context, aTraceblock shows the trace id, the span id, the backend’s own trace id when itstraceresponsenames a different one, and the trace link when one is configured;Ctrl+O(trace.open) opens the link in the system browser. Below it, a sparkline of the total times of the last 30 exchanges of the same request file from history, the newest highlighted, with the min, median, p95 and max; with fewer than two exchanges it saysnot enough history. - Assertions: each assertion as passed or failed, with the expected and actual values of failures (
✖ failed status == 200 · expected 200 · actual 404). - Snapshot (only when a snapshot failed, is missing or was just recorded): each snapshot with its file and diff.
aapproves (writes the received snapshot) andrrejects (keeps the stored file);Alt+Aopens a queue over every failing snapshot in the open tabs. Approving is disabled in CI mode (CI=true).
D diffs the current exchange against an earlier one: a picker lists the exchanges in history, those of the same request first (Enter picks, Esc closes), and the diff compares the status, the headers and the body. JSON bodies are compared by path with key order ignored, so {"a":1,"b":2} against {"b":3,"a":1} reports only $.b: 2 → 3; other bodies are compared line by line.
Viz companion and HTML report
v (response focused) opens the current exchange in the optional graphical companion, rustman-viz, in its response inspector. The companion is looked for as the viz protocol defines: the path in RUSTMAN_VIZ, then rustman-viz on PATH, then rustman-viz (rustman-viz.exe) next to the rustman executable. A RUSTMAN_VIZ that is not an executable file is an error naming it; nothing else is tried. The TUI starts the companion, performs the rustman-viz/1 handshake and sends the exchange (already redacted; a body too large for one protocol line goes through a temp file, removed when the companion exits or when the TUI quits), then leaves the companion running on its own; a toast says Opened in rustman-viz ….
When the companion cannot be used, a warning toast says why and offers the HTML report instead:
| Toast | Why |
|---|---|
Viz companion not found: … | no companion was found, or RUSTMAN_VIZ names a file that is not executable |
Viz companion speaks rustman-viz/2, rustman needs rustman-viz/1; upgrade rustman-viz | the companion rejected the protocol version |
Graphics unavailable (Vulkan) | the companion could not start its graphics (exit code 3) |
Viz companion failed: … | it could not be started, did not answer within 10 s, or answered something else |
Each ends with Export HTML report: H. H (response focused, or Export HTML report in the palette) writes the current exchange as a self-contained HTML page (summary, assertions, response headers and body, all redacted) to .rustman/reports/<request>-<time>.html in the workspace, which rustman init keeps out of Git, or to the temp directory in a scratch session, and the toast gives the path. The run dashboard (v in a run view) arrives with the TUI’s run view.
MCP inspector
Alt+I (or MCP inspector in the palette) shows the MCP inspector in place of the request and response panes; Esc or Alt+I hides it again, and the session keeps running while it is hidden. It lists the workspace’s MCP servers with their connection status, the connected server’s info and capabilities, and the Tools, Resources, Prompts, Notifications and Stderr tabs, with argument forms, the result view and the dialogs for stdio trust, sampling and elicitation. While a sampling or elicitation request waits for you, the status bar shows MCP APPROVAL (<n>) on every screen until it is handled.
Webhook pane
Alt+W (or Webhook inspector in the palette) shows the webhook inspector in place of the request and response panes; Esc or Alt+W hides it again, and the listener keeps running while it is hidden. The pane shows the listener’s state and address with the number of buffered captures and their size, the captures newest first (time, method, path, body size and the signature verdict as a coloured badge: valid, invalid, missing, expired), the selected capture (request line, receive time, every header in order, then the body), and the event log. Values are redacted with the signature verifier secrets; credentials such as Authorization show as placeholders.
| Key | Action |
|---|---|
s | Start or stop the listener. It binds [webhook] host and port from rustman.toml (default 127.0.0.1:9090) and answers with the workspace’s webhook/mocks.yaml. An address reachable from the network asks for confirmation first (Cancel is preselected); while such a listener runs, the pane shows REACHABLE FROM THE NETWORK and the status bar a red badge on every screen. |
↑ ↓ (j k), Home End (g G) | Select a capture. |
PageUp PageDown | Scroll the selected capture’s headers and body a page at a time; the title shows which lines are on screen (41-80 of 655366). The body is prepared once per capture and view, and only the lines on screen are drawn, so even a 10 MiB body scrolls smoothly. |
v | Cycle the body view: auto (JSON pretty-printed, form fields, or text), text, JSON, hex. A body that is not UTF-8 is always shown as hex. |
r | Replay the capture to a URL (asked for; the last one is offered again) through the HTTP engine, with the header hygiene of replay. A toast gives the status. |
w | Save the capture as a kind: http request file: asks for the target URL ({{base_url}}<path> is offered) and the file name (webhook-<id>.rman.yaml). |
h | Save the capture to the workspace history as an inbound entry. |
y | Copy the capture as a curl command sent to the URL it was received on (its Host). |
c | Clear the capture buffer. |
m | Edit webhook/mocks.yaml (a commented template when it does not exist yet). Ctrl+S checks and saves it: a file that does not parse is not written and the error is shown under the text; a running listener reloads the saved mocks. Esc closes the editor without saving. |
? opens the help; other letters do nothing while the pane is shown. Quitting the TUI stops the listener.
Recorder pane
Alt+P (or Traffic recorder in the palette) shows the traffic recorder pane: start and stop the recording proxy, follow its captures live, filter and mark them, inspect one (redacted), and save the marked captures as request files or export them as HAR. The keys and the CA TRUSTED status badge are described in The TUI recorder pane.
Mock server pane
Alt+O (or Mock server in the palette) shows the mock server in place of the request and response panes; Esc or Alt+O hides it again, and the server keeps running while it is hidden. The pane shows the server’s state and address, and the live request log: time, method, status, the response source (example, synthesized, prefer, override, stateful, proxy, cors or error), the path, the operation or override that answered, and the first validation error. Reload notices appear in the log too. Entries are redacted by the server; credentials such as Authorization show as placeholders.
| Key | Action |
|---|---|
s | Start or stop the server. Starting asks for the OpenAPI document (a file, relative to the workspace root, or a URL; the last one is offered again). The server binds [mock] host and port from rustman.toml (default 127.0.0.1:4010), answers with the overrides of the mocks directory and reloads both on change. An address reachable from the network asks for confirmation first (Cancel is preselected). |
c | Clear the log. |
? opens the help; other letters do nothing while the pane is shown. Quitting the TUI stops the server.
Monitors view
Monitors in the palette (monitors.open) lists the workspace’s monitors: last outcome, 24-hour uptime, a latency sparkline and whether a rule is firing, with the selected monitor’s firing rules and latest results. j/k select, r runs the selected monitor now in the background (through the monitor policy, the store and its alerts; the list refreshes when it finishes), v opens the monitors’ trends in the viz companion (or says why it cannot), and Esc closes.
Mouse
When the terminal reports mouse events, clicking focuses a pane, an editor field or a pane switcher label, selects a sidebar row, a request tab or an editor tab; the wheel scrolls the pane under the pointer; and dragging the sidebar’s right border resizes it. Set mouse = false in tui.toml to leave the mouse to the terminal, so its own text selection works; the TUI then doesn’t capture mouse events at all.
Themes, colours and ASCII
Three themes ship: dark (the default), light and high-contrast. Pick one with --theme NAME or theme = "NAME" in tui.toml; the flag wins. Themes are palettes of semantic colours (text, muted, accent, border, focus, selection, ok, info, warn, error, background), so every part of the UI changes together.
The colour depth is detected from the environment:
NO_COLORset to a non-empty value: no colours at all. Focus, selection and badges use bold, dim and reverse video, and status uses symbols (✔,✖).COLORTERM=truecolororCOLORTERM=24bit: 24-bit colour.- Anything else: each theme colour is mapped to its nearest xterm-256 colour.
--ascii (or borders = "ascii" in tui.toml) replaces box drawing and other non-ASCII symbols with ASCII: borders use +, - and |, the pointer is >, and symbols such as ✖ become x. Use it on terminals or fonts that mis-render box drawing.
Settings: tui.toml
The TUI reads tui.toml from the Rustman config directory: $XDG_CONFIG_HOME/rustman/, else ~/.config/rustman/ on Linux and macOS, and %APPDATA%\rustman\ on Windows. Every key is optional:
theme = "dark" # dark | light | high-contrast
borders = "unicode" # unicode | ascii
mouse = true # false leaves the mouse to the terminal
keymap = "default" # default | vim (same as --vim)
Unknown keys are ignored. An invalid file is ignored as a whole, with a warning toast naming the problem.
Keys
Every key runs an action with a stable id such as request.send. Bindings belong to a context: global, sidebar, editor (method, URL, editor tabs and body) or response. A key is looked up in the focused context first, then in global.
While a text input has the focus (the URL, a text body, a table cell being edited, the sidebar filter), typed characters are text: ?, v and other plain keys type themselves instead of running their action. Keys with Ctrl or Alt, function keys, Tab and Esc still work.
Ctrl+C never quits. With a request in flight it cancels it; otherwise it shows Press Ctrl+Q to quit.
Command palette
Ctrl+P opens a fuzzy finder over every action (with its current keys on the right), every request file and every environment. Type to filter: the letters only have to appear in order, so swenv finds Switch environment. ↑/↓ (or Ctrl+P/Ctrl+N) choose, Enter runs, Esc closes. With nothing typed, the entries you used most recently in this session come first.
Choosing an action runs it. Choosing a request file opens it. Choosing an environment makes it the active one for this session; the status bar shows it.
Switch environment (Alt+E) opens the same finder with environments only, the active one marked, and lists what the selected one provides (see Environments and secrets).
Help
? (outside text inputs) or F1 lists the keys for the focused context and the global ones, exactly as they are bound after your keybindings.toml (with vim keys on and the body focused, the modal editing keys too). ↑/↓ scroll; Esc, ? or F1 close it.
Vim mode
keymap = "vim" in tui.toml, or --vim, adds vim keys on top of the defaults:
- In the sidebar and the response viewer:
j/kmove,gg/Gjump to the top or bottom,Ctrl+D/Ctrl+Upage, andh/lmove to the pane on the left or right. - The request body becomes modal. It starts in normal mode;
i,aoroenter insert mode andEscreturns to normal mode;vstarts a visual selection. The status bar showsNORMAL,INSERTorVISUAL.
This is not a full vim: there are no counts, registers, text objects, : commands or search in text areas.
Without vim mode the body is a plain text area: type, Enter, Backspace, Delete, arrows, Home/End. Until the request editor opens request files, the body is a scratch buffer that is not saved.
keybindings.toml
Put your own bindings in keybindings.toml next to tui.toml (~/.config/rustman/keybindings.toml on Linux and macOS, %APPDATA%\rustman\keybindings.toml on Windows). Each table is a context; each entry maps keys to an action id, or to "none" to remove a binding:
[global]
"F5" = "request.send" # F5 sends, in addition to Ctrl+Enter and Ctrl+R
"Ctrl+R" = "none" # Ctrl+R no longer sends
[sidebar]
"Ctrl+J" = "list.down"
Your entries win over the vim preset, which wins over the defaults. Adding a key keeps the action’s other keys; remove one with "none". Help and the palette show your keys first, and on-screen hints (No response yet · press F5 to send, the quit key in the status bar) name your first key, or drop the advice when an action has no key. The keys of the editor’s tables (a add, x remove, Space toggle) are fixed.
Keys are written as modifiers and a key joined by +: Ctrl, Alt and Shift with a character, Enter, Esc, Tab, Backspace, Delete, Insert, Home, End, PageUp, PageDown, Up, Down, Left, Right, Space or F1–F24 (Ctrl+Enter, Alt+E, Shift+Tab, F5). A shifted character is written as itself (G, ?). Up to three keys in a row make a sequence: "gg", or with spaces, "Ctrl+K Ctrl+S". Many terminals can’t tell Ctrl+Enter from Enter; that is why Ctrl+R also sends.
At start-up, every entry with an unknown action id, an unknown context or a key that can’t be parsed is reported in a warning toast (and the notification log) and skipped; the other bindings work. A file that isn’t valid TOML is ignored as a whole, with a warning.
Conflicts are reported the same way:
- Two spellings of the same key in one table (
"Ctrl+R"and"ctrl+r") are both skipped, since the file gives no order to pick one. - A binding that is the start of a longer one (
"g"whenggis bound) wins as soon as it is typed, so the longer one can’t be typed there; the warning names both. - A pane binding (
[editor],[sidebar],[response]) wins over a[global]binding of the same keys while that pane is focused, so binding"Ctrl+Q"under[editor]to another action makes quitting impossible from the editor; the warning names both. - If no key is left for
app.quit,Ctrl+Qis bound to it again (replacing any other use ofCtrl+Q), so the TUI can always be closed.
Key reference
The table below is generated from the action registry; a test fails if it drifts from the code.
Esc (ui.escape) closes overlays and dismisses toasts today. Once requests can be sent, it also cancels the request in flight in the current tab, like Ctrl+C (spec: Default keymap and Sending requests).
| Action | Id | Default keys | Vim preset adds |
|---|---|---|---|
| Send request | request.send | Ctrl+Enter, Ctrl+R | |
| Cancel request | request.cancel | Ctrl+C | |
| Save request | request.save | Ctrl+S | |
| New tab | tab.new | Ctrl+T | |
| Close tab | tab.close | Ctrl+W | |
| Next tab | tab.next | Ctrl+PageDown | |
| Previous tab | tab.prev | Ctrl+PageUp | |
| Go to tab 1 | tab.goto_1 | Alt+1 | |
| Go to tab 2 | tab.goto_2 | Alt+2 | |
| Go to tab 3 | tab.goto_3 | Alt+3 | |
| Go to tab 4 | tab.goto_4 | Alt+4 | |
| Go to tab 5 | tab.goto_5 | Alt+5 | |
| Go to tab 6 | tab.goto_6 | Alt+6 | |
| Go to tab 7 | tab.goto_7 | Alt+7 | |
| Go to tab 8 | tab.goto_8 | Alt+8 | |
| Go to tab 9 | tab.goto_9 | Alt+9 | |
| Command palette | palette.open | Ctrl+P | |
| Help | help.open | ?, F1 | |
| Toggle sidebar | sidebar.toggle | Ctrl+B | |
| Widen sidebar | sidebar.grow | Alt+Right | |
| Narrow sidebar | sidebar.shrink | Alt+Left | |
| Open request | sidebar.open | Enter (sidebar) | |
| Filter requests | sidebar.filter | / (sidebar) | |
| New request file | sidebar.new | n (sidebar) | |
| Rename request or folder | sidebar.rename | r (sidebar) | |
| Delete request or folder | sidebar.delete | d (sidebar) | |
| Collapse folder | tree.collapse | Left (sidebar) | |
| Expand folder | tree.expand | Right (sidebar) | |
| Focus next | focus.next | Tab | |
| Focus previous | focus.prev | Shift+Tab | |
| Focus pane to the left | pane.left | h (response) | |
| Focus pane to the right | pane.right | l (sidebar) | |
| Close or dismiss | ui.escape | Esc | |
| Switch environment | env.switch | Alt+E | |
| Reveal secrets | secrets.reveal | Alt+R | |
| Refresh secrets | secrets.refresh | ||
| Edit in external editor | editor.external | Ctrl+E (editor) | |
| Change body mode or auth type | editor.mode | Alt+M (editor) | |
| Show completions | editor.complete | Ctrl+Space (editor) | |
| Open in viz companion | viz.open | v (response) | |
| Show notification log | notifications.show | ||
| Move up | list.up | Up (sidebar, response) | k (sidebar, response) |
| Move down | list.down | Down (sidebar, response) | j (sidebar, response) |
| Go to top | list.top | Home (sidebar, response) | gg (sidebar, response) |
| Go to bottom | list.bottom | End (sidebar, response) | G (sidebar, response) |
| Page up | list.page_up | PageUp (sidebar, response) | Ctrl+U (sidebar, response) |
| Page down | list.page_down | PageDown (sidebar, response) | Ctrl+D (sidebar, response) |
| Next response tab | response.next_tab | ] (response) | |
| Previous response tab | response.prev_tab | [ (response) | |
| Fold or unfold node | json.toggle | Enter (response), Space (response) | |
| Fold node | json.collapse | Left (response), zc (response) | |
| Unfold node | json.expand | Right (response), zo (response) | |
| Fold all | json.collapse_all | zM (response) | |
| Unfold all | json.expand_all | zR (response) | |
| Copy value | json.copy | y (response) | |
| Toggle raw body | response.raw | r (response) | |
| Cycle gRPC timeline direction | response.timeline_direction | d (response) | |
| Filter body (JSONPath) | response.filter | f (response) | |
| Search body | response.search | / (response) | |
| Next match | search.next | n (response) | |
| Previous match | search.prev | N (response) | |
| Diff with an earlier exchange | response.diff | D (response) | |
| Save body… | response.save_body | s (response) | |
| Export HTML report | report.html | H (response) | |
| Webhook inspector | webhook.open | Alt+W | |
| Mock server | mock.open | Alt+O | |
| MCP inspector | mcp.open | Alt+I | |
| Traffic recorder | recorder.open | Alt+P | |
| Refresh GraphQL schema | graphql.refresh_schema | Ctrl+G | |
| Start GraphQL subscription | graphql.subscription_start | Alt+S | |
| Stop GraphQL subscription | graphql.subscription_stop | Alt+X | |
| Send following subgraph pagination | graphql.paginate | Alt+G | |
| Cycle blockchain scalar display | graphql.display | u (response) | |
| Open result value in EVM toolkit | graphql.links | L (response) | |
| Copy as… | request.copy_as | Alt+C | |
| Import… | import.open | ||
| Review snapshots | snapshot.review | Alt+A | |
| Monitors | monitors.open | ||
| Open trace link | trace.open | Ctrl+O | |
| Quit | app.quit | Ctrl+Q |
In vim mode, text areas (the request body) are modal:
| Keys | What they do |
|---|---|
i a o | insert before / after the cursor, on a new line below |
Esc | back to normal mode |
h j k l | left, down, up, right (also the arrow keys) |
w b e | next word, previous word, end of word |
0 $ | start, end of the line |
gg G | first, last line |
Ctrl+D Ctrl+U | down, up half a page |
x | delete the character under the cursor |
dd | cut the line |
yy | copy the line |
p | paste after the cursor |
u | undo |
v | visual mode: move to select |
y d | in visual mode: copy, cut the selection |
How it works
The UI follows an Elm-style loop (design D2 of the change): key presses, mouse events, resizes, clock ticks and finished background work all become actions on one channel; a pure update function changes the state and returns effects (load or create a workspace, save, create, rename or delete files, re-read a changed file, run the external editor, send a request, filter or page a body, read history, copy or save, read secrets to reveal them, hand an exchange to the viz companion, write an HTML report); an effect runner task executes those off the render loop and reports back with new actions; view draws the state. Nothing on the render loop waits for the disk or the network. A send runs on a thread of its own with the engine’s runner and its own connection pool; cancelling drops the request, which closes its connection.
Screenshots
To render one frame without a terminal, for example for the README:
cargo run -p rustman-tui --example screenshot -- [--ansi] [--size WxH] [--theme NAME] [--ascii] [--no-color] [--open REQUEST] [--response BODY.json] [--keys KEYS] [PATH]
It opens PATH as rustman tui would, runs the start-up work synchronously, and prints a 120x36 frame (or --size) as plain text, or with ANSI colours with --ansi (view it with cat or less -R). It ignores tui.toml and renders in 24-bit colour unless --no-color is given, so the output depends only on the flags and the workspace.
The README images in docs/images/tui-*.svg are real frames rendered off-screen by the screenshot example. crates/rustman-tui/examples/screenshots/ holds the sample workspace (HTTP, GraphQL, JSON-RPC, evm-call, gRPC and Kafka requests, a .proto file, an OpenRPC catalog, MCP server definitions and two monitors) and the sample responses, and its render.sh renders every frame and converts it to SVG with ansi2svg.py next to it. The Monitors view reads its results relative to the current time, so monitor-store.py writes 24 hours of sample results into the copied workspace’s store just before that frame (a fixed seed keeps their shape; only the timestamps change between renders):
crates/rustman-tui/examples/screenshots/render.sh
| Frame | What it shows |
|---|---|
tui-shell | a request’s Headers tab and its JSON response tree |
tui-assertions | failed assertions with expected and actual values |
tui-timing | the timing waterfall and latency sparkline, with a masked bearer token |
tui-environments | the environment switcher with each variable’s layer, the secret masked |
tui-palette | the command palette fuzzy-matching swenv |
tui-help | the help overlay |
tui-graphql | the GraphQL editor’s inline validation and the response’s Errors tab |
tui-graphql-schema | the GraphQL schema browser, with a deprecated field |
tui-jsonrpc | JSON-RPC method completion from an OpenRPC catalog |
tui-evm | the EVM pane’s Function tab: the view functions of the built-in ERC-20 ABI, before anything is sent |
tui-grpc | the gRPC method browser and a server-streaming call’s messages |
tui-grpc-timeline | a gRPC request message and the call’s timeline |
tui-mcp | the MCP inspector asking for workspace trust before running a stdio server |
tui-messaging | the messaging editor’s Compose tab for a Kafka produce request |
tui-monitors | the Monitors view: two monitors’ last outcome, uptime and latency sparkline, a firing rule and the recent runs |
The animated GIF at the top of the README (docs/images/demo.gif) is a real session recorded with VHS: examples/demo/ holds the todo backend it talks to, its workspace, the demo.tape script and a render.sh that builds Rustman, starts the backend and records the tape.
To render a single frame:
cargo run -p rustman-tui --example screenshot -- --ansi --size 136x30 \
[--open pets/get-pet.rman.yaml --response pet.json] [--keys "Ctrl+P s w e n v"] <workspace> > frame.ans
--open opens a request file (relative to the workspace root) in a tab, and its background loads (a GraphQL or gRPC schema, an OpenRPC catalog) run before the frame is captured. --response shows a JSON file as its exchange, so a frame with a response needs no network and is the same on every run: for an HTTP request it is the body of a 200 OK with fixed timings and history, and the request’s assertions are evaluated against it, so the Assertions tab and the summary line’s tally are real results; for a GraphQL request the body is read as a GraphQL result (Data, Errors and Extensions tabs); for a gRPC request the file is the call’s record, the grpc member of a rustman.report/v1 request. --keys presses space-separated chords before the frame is captured (for example Ctrl+P for the palette, F1 for help, Alt+I for the MCP inspector, Tab 2 Tab to show and focus the Headers tab, or Tab Tab Tab ] ] to focus the response and show its third tab; the URL has the focus first, so a printable key such as ? is typed into it). Frames that need a running listener or session (webhook captures, the mock server’s request log, a connected MCP server, the traffic recorder’s captures, a live messaging consume) can’t be rendered this way. Neither can a sent evm-call’s Result tab: --response has no form for an EVM call’s record.
Platform checks
Automated (CI, every pull request). The TUI smoke test opens a fixture workspace at 80x24, opens a request from the command palette, sends it to an in-process mock server, opens a slow request, sends it, cancels it with Esc (the server sees the connection close), and quits with Ctrl+Q.
cargo test -p rustman-tui --test pty_smokeruns the realrustman_tui::runin a pseudo-terminal on all three OSes: a Unix pty on Linux and macOS, ConPTY on Windows. Raw mode, the alternate screen, the input reader and the effect runner are the real ones. Keys are written to the pty and the screen is read back through a terminal emulator (vt100); afterCtrl+Qthe test checks that the emulated screen is back to the main screen with the cursor shown.- On Windows, crossterm turns on VT processing (Windows 10 and later) and writes the same escape sequences as on Unix, so ConPTY sees the alternate screen and cursor changes. ConPTY re-renders the child’s output rather than passing it through byte for byte, so the exact
ESC[?1049h/ESC[?1049lbytes are only asserted on Linux and macOS; Windows checks the resulting screen.portable-ptyopens ConPTY withPSEUDOCONSOLE_INHERIT_CURSOR, which makes ConPTY ask for the cursor position first; the test answers it. cargo test -p rustman-tui --lib smoke_testsalso runs the same flow on every OS through the real event loop, effect runner, engine and mock server with an in-memory 80x24 terminal, so a ConPTY problem on a runner image is told apart from a TUI regression.
Manual check matrix. Pending manual runs: each cell is filled in (ok, or a link to an issue) after opening a workspace, sending, browsing a JSON response, the palette, help and --ascii in that terminal and colour mode.
| Terminal | Truecolor | 256 colours | NO_COLOR |
|---|---|---|---|
| Windows Terminal | pending | pending | pending |
| conhost (classic console) | pending | pending | pending |
| iTerm2 | pending | pending | pending |
| Alacritty | pending | pending | pending |
| kitty | pending | pending | pending |
| tmux (in any of the above) | pending | pending | pending |
| GNOME Terminal | pending | pending | pending |
Force a mode with COLORTERM=truecolor, COLORTERM= TERM=xterm-256color, or NO_COLOR=1.
CLI reference
rustman is the headless face of Rustman, for scripts and CI. Reports and response bodies go to stdout; warnings and errors go to stderr, prefixed with warning: and error:.
This page covers sending and running requests, reporters, terminal behavior, logging, completions and the exit codes. The other commands are described with the features they belong to.
Commands
| Command | What it does | Described in |
|---|---|---|
rustman / rustman tui [path] | Open the terminal UI (rustman alone does so when stdin and stdout are a terminal, and prints help otherwise); --theme, --ascii, --vim | Terminal UI |
rustman init [dir] [--bare] | Create a workspace: rustman.toml, a local environment and a sample request | Request files |
rustman env list | List the environments and mark the active one | Environments |
rustman secret set <name> --env <env> | Store a secret value (read from stdin or a no-echo prompt) | Secrets |
rustman secret list --env <env> | List the declared secrets and whether each is set | Secrets |
rustman secret rm <name> --env <env> | Delete a stored secret value | Secrets |
rustman secret get <ref> | Fetch a secret reference (<provider>/<path>[#field]) from its provider and print •••••••• (<n> chars, <provider>); --reveal prints the value, on a terminal only (exit 2 otherwise); exits 3 when the secret cannot be resolved, whatever the cause (an unknown provider or a provider type not in this build included), as send does; --workspace | Secret providers |
rustman secret test [<provider>] | Check that secret providers (one, or every configured one) can authenticate and be reached; exits 0 when every check passes and 3 otherwise (an unknown provider name included) | Secret providers |
rustman secret list-providers | List the configured secret providers: name, type, auth, origin (workspace or user) and whether the type is in this build, never values; --types lists the provider types this build supports | Secret providers |
rustman cookies clear | Empty the cookie jar of an environment | Cookies |
rustman auth login <request> | Run the OAuth2 authorization-code login for a request and cache its token | OAuth2 |
rustman import curl | Create a request file from a curl command | Curl import |
rustman import <src> / rustman import auto <src> | Import a collection export, detecting its format from the content | Importing collections |
rustman import postman <src> | Import a Postman Collection v2.0 or v2.1 export | Postman |
rustman import postman-env <src> | Import a Postman environment export into environments/ | Postman environments |
rustman import insomnia <src> | Import an Insomnia v4 (JSON) or v5 (YAML) export | Insomnia |
rustman import bruno <src> | Import a Bruno collection folder or a single .bru file | Bruno |
rustman import har <src> | Import the requests of a HAR 1.2 capture, with --host, --method, --content-type and --include-static | HAR |
rustman import http <src> | Import .http / .rest files (a file or a folder) and their environment files | HTTP files |
rustman import <format> <src> | Import a source with an importer plugin that registers <format>: the host checks the request files and environments it returns and writes them (nothing when one is invalid); --into, --dry-run, --on-conflict, --trust-plugins | Importers |
rustman import openapi <file|url> | Create a collection, environments and auth config from an OpenAPI 3.0 or 3.1 document; --into, --allow-remote-refs; --sync (with --dry-run, --json) updates an imported collection | OpenAPI import |
rustman import asyncapi <file|url> | Create Kafka, MQTT and AMQP request files (a folder per channel) and an environment per server from an AsyncAPI 2.6 or 3.0 document; --into, --allow-remote-refs, --workspace; other versions exit 2 | Messaging |
rustman explore plan --spec <file|url> --target <url> | Discover the resource graph and plan exploration probes without sending anything; --probes, --operations, --seed, --fuzz-cases, the safety flags, --graph, --json | Exploration |
rustman explore run --spec <file|url> --target <url> | Discover, plan, send the probes under the safety policy and write the report; the plan flags plus --rate, --concurrency, --max-probes, --max-duration, --fail-on, --report <format>[=<path>] | Exploration |
rustman explore resume <id> | Continue an interrupted exploration with the probes not yet run | Exploration |
rustman explore status [<id>] | Show the phase, progress and findings by severity of an exploration (the latest by default); --json | Exploration |
rustman explore export <id> --findings <ids|all> --into <dir> | Write findings as regression request files for rustman run | Exploration |
rustman report schema | Print the JSON Schema of rustman.report/v1 | Reports |
rustman report render <report.json> --format <format> | Render a run or exploration report as json, junit, markdown, html or sarif, or with a report plugin (<plugin>/<format>, with -o); -o <file>, --fail-on, --trust-plugins | Reports |
rustman report diff <old.json> <new.json> | List new, fixed and unchanged findings, coverage deltas and changed assertions; --fail-on, --format markdown|json | Reports |
rustman export curl <request> | Print a request as a curl command (redacted; secret provider references print as «redacted:<provider>/<path>» without being fetched) | Curl export |
rustman export postman <path> | Write a collection folder or request file as a Postman Collection v2.1 (-o <file>) | Exporting |
rustman export http <path> | Write a collection folder or request file as a .http file (-o <file>) | Exporting |
rustman export snippet --lang <lang> <request> | Print a request as code for one of 11 languages and tools (redacted; secret provider references are never fetched); --list lists them | Code snippets |
rustman send | Send one request and print the response | below |
rustman run | Run the requests under files and folders and report the results | below |
rustman bench [path]... --target <url> | Load test request files and collections as virtual-user iterations under the safety policy pinned to --target; --executor (constant-vus, ramping-vus, constant-arrival-rate), --vus, --duration, --iterations, --think-time, --stage (or rustman.toml [[bench.stages]]), --rate, --max-vus, --data, --data-mode, --data-exhaust, --secret-columns, --allow-mutations, --allow-destructive, --production, --timeout, --insecure/-k, --env, --var, --threshold, --report json=<file>/html=<file>, --viz, --trust-plugins; shows a live dashboard on a terminal (a progress line every 10 s otherwise); capped by rustman.toml [bench]; exits 1 when a threshold fails, 2 on a usage error or a cap, 4 when the policy refuses, 130 on Ctrl+C | Load testing |
rustman stress <mode> [path]... --target <url> | Find where a target listed in rustman.toml [stress] targets breaks, how, and whether it recovers: breakpoint (--start-rps, --step-factor, --step-duration, --refine, --require-rps), spike (--baseline-rps, --baseline, --spike-factor, --spike-duration), soak (--rps, --duration, --drift-threshold) or fuzz; --slo (or rustman.toml [stress.slo]), --treat-throttling-as-failure, --max-vus, --fail-on, --allow-mutations, --allow-destructive, --production, --timeout, --insecure/-k, --env, --var; fuzz mixing with --fuzz-ratio, --malformed, --spec, --seed and the fuzz phase’s --baseline, and wire faults with --wire and --allow-wire-faults, all checked by the stress gate first; the health request (--health, default the first GET) feeds the kill switch and the recovery check (--recovery-timeout, default 2m); a dashboard on a terminal, else one line per step; --report <format>[=<path>] and --viz; the report is kept as .rustman/stress/<id>/report.json; capped by rustman.toml [stress]; exits 1 on a finding at or above --fail-on or a max_sustainable_rps below --require-rps, 2 on a usage error or a cap, 4 when the safety policy or the stress gate refuses, 130 on Ctrl+C | Stress testing |
rustman stress export <id> --findings <ids|all> --into <dir> | Write the findings of a stress run as regression request files (the minimized input and a status: "4xx" assertion), wire faults as .wire.txt comment files | Stress testing |
rustman monitor <command> | Scheduled monitors: monitor files in monitors/*.rman-monitor.yaml, results in .rustman/monitors/ | Monitors |
rustman monitor run <name> / rustman monitor run --all | Run monitors once on the run engine under the read-only monitor policy, store each result, compact old results when due, and evaluate and send alerts; exits 0 (pass), 1 (an assertion failed), 2 (an invalid monitor file, a missing target or environment), 3 (a request errored or the run passed its timeout), 4 (a request was blocked), 130 on Ctrl+C | Monitors |
rustman monitor list | List the monitors with their schedule, environment and targets; --json | Monitors |
rustman monitor daemon | Run every monitor of the workspace on its schedule until Ctrl+C or SIGTERM (10 s drain): overlapping runs skipped, monitor files reloaded, one daemon per workspace (exit 2 for a second one), no listening port, one log line per run on stderr | Monitors |
rustman monitor status | Each monitor’s last result, uptime over 24 h, 7 d and 30 d, p95 latency with a sparkline, coverage and firing rules, from the store only; --json; --viz also opens the trend view in the viz companion, or notes why not | Monitors |
rustman monitor history <name> | The stored results of a monitor, newest first, compacted days as hourly aggregates; --since, --outcome, --json | Monitors |
rustman monitor test-alert <name> | Send [TEST] <name> through every channel of a monitor and print ok or the error per channel; exits 0 when all succeed, 3 otherwise | Monitors |
rustman monitor schedule-recipe <name> --for <scheduler> | Print a cron, systemd, launchd or GitHub Actions configuration that runs the monitor on its schedule; writes only with --write <path> | Monitors |
rustman graphql introspect <endpoint|request> | Fetch a GraphQL schema by introspection and cache it in .rustman/graphql/schemas/; --out <file> also writes it as SDL | GraphQL |
rustman graphql query <request> / --endpoint <url> --query <text> | Validate, send and print a GraphQL operation or subscription; --no-validate, --json, --max-events, --duration, and for blockchain presets --paginate [id_gt|skip], --max-pages, --raw, --units | GraphQL |
rustman rpc call <endpoint|request> [method] [params-json] | Send one JSON-RPC call (or a kind: jsonrpc request) and print its result or error object; --header, --id, --notify, --subscribe / --unsubscribe, --raw, --json, --no-validate; --param name=value for the typed eth_*, net_* and web3_* methods (EVM toolkit) | JSON-RPC |
rustman rpc batch <endpoint> <file|-> | Send calls from a JSON array, a YAML list or JSON lines as batches of 100 and print the results in input order | JSON-RPC |
rustman rpc discover <endpoint> | Fetch an OpenRPC document with rpc.discover and cache it in .rustman/cache/openrpc/ | JSON-RPC |
rustman grpc list <target|request> | List the services and methods of a gRPC target, by reflection through .rustman/grpc/descriptors/ or from the request’s schema; --refresh, --json | gRPC |
rustman grpc describe <target|request> <symbol> | Describe a service, a method (call type, message types and a request template) or a message; --json | gRPC |
rustman evm call <request> / --to <a> --abi <abi> --function <f> [arg]... | Run a read-only eth_call (an evm-call request, or ad hoc) and print the decoded outputs or revert; --block, --from, --value, --estimate, --trace, --rpc, --env, --json | EVM toolkit |
rustman evm decode --abi <abi> <hex> | Decode call data, revert data or (with --topic) a log with an ABI, offline; --json | EVM toolkit |
rustman evm logs | Stream new heads (--heads) or logs (--address, --event, --topic) over eth_subscribe or HTTP polling, reorgs marked REORGED; or query --from-block/--to-block; --max-events, --duration, --poll-interval, --json | EVM toolkit |
rustman evm tx <hash> | Show a transaction and its receipt with input and logs decoded; --json | EVM toolkit |
rustman evm block [number|tag|hash] | Show a block (default latest); --json | EVM toolkit |
rustman evm ens <name|address> | Resolve an ENS name, or an address to its verified primary name; --json | EVM toolkit |
rustman evm fork --chain <chain> | Fork a chain (an environment, chain name or id; or --env/--rpc) with a local Anvil and a temporary fork-<chain> environment until Ctrl+C; --block, --port, --json | EVM toolkit |
rustman evm probe <rpc-or-env>... | Probe EVM RPC providers: method support matrix, archive detection, latency per method, subscriptions, multi-provider consistency (exit 2 for providers on different chains) and, with --rate-discovery, rate limits; --methods, --block, --budget, --call, --address, --max-drift, --drift-interval, --max-rate, --fail-on, --report <format>=<path>, --viz | Probing EVM providers |
rustman evm send <request> | Check an evm-tx request against the signing gate: [evm] allow_signing, a signer (never a raw key), --sign (without it only the decoded preview), the environment’s chain_id against the node, a simulation from the signer (--force-revert to go on after a revert), then the decoded confirmation (typed chain name on chain 1 and protected_chains; --yes-local without a terminal on local chains only), the send and the receipt (--confirmations, --receipt-timeout, exit 3 on timeout) with its assertions, captures and a history audit entry (--no-history); --signer (or RUSTMAN_EVM_SIGNER), --env, --var; refusals exit 4 | EVM signing |
rustman evm signer / rustman evm signer import <id> | Store a private key (no-echo prompt, or stdin) in the OS keychain as signer <id>, used with [evm.signers.<id>] keychain = true; the key is never printed | EVM signing |
rustman grpc call <request> / --target <t> --method <m> --data <json> | Send one gRPC call and print the response messages and status; --metadata, --deadline-ms, --json (one line per message, then a status line) | gRPC |
rustman grpc health <target> | Call grpc.health.v1.Health/Check and print the serving status; --service, --timeout, --json | gRPC |
rustman ws connect <url|request> | Open a WebSocket session (a ws:// / wss:// URL or a kind: ws request), send the lines of a piped stdin as text frames and print the received messages; --json, --max-messages, --duration, --header, --subprotocol, --trace | WebSocket and SSE |
rustman sse listen <url|request> | Listen to a Server-Sent Events stream (an http(s):// URL or a kind: sse request) and print its events; --json, --max-messages, --duration, --header, --trace | WebSocket and SSE |
rustman kafka produce [request] | Produce messages (a kind: kafka request, or --brokers, --topic, --partition, --key, --header and --value, or one message per line of a piped stdin) and print their partitions and offsets; --json | Messaging |
rustman kafka consume [request] | Read a topic from --partitions and an --offset (earliest, latest, a number or an RFC 3339 timestamp) without a consumer group, printing messages as they arrive; --max-messages, --duration, --json (one line per message) | Messaging |
rustman mqtt produce [request] | Publish messages (a kind: mqtt request, --value flags or stdin lines) with --broker, --topic, --qos, --retain | Messaging |
rustman mqtt consume [request] | Subscribe to a topic filter (+, #) with a clean session and print messages as they arrive; --max-messages, --duration, --json | Messaging |
rustman amqp produce [request] | Publish messages with publisher confirms to --exchange with --routing-key (--mandatory fails unroutable messages) | Messaging |
rustman amqp consume [request] | Consume through a temporary queue bound to --exchange with --binding-key, or from an existing --queue with --destructive or --requeue; --max-messages, --duration, --json | Messaging |
rustman history list | List past exchanges, newest first, with --status, --method, --grep, --since, --limit and --json | History |
rustman history show <id> | Print one exchange in full (redacted) | History |
rustman history replay <id> | Send an exchange’s request again, with secrets read from the store now (a plugin auth scheme signs it again: --trust-plugins as for send) | History |
rustman history clear | Delete every recorded exchange | History |
rustman trace open <id> | Open the trace link of a history exchange (an id or a unique prefix) in the browser and print it; --no-browser only prints it; exits 2 without a link template | Trace propagation |
rustman mcp serve | Serve the workspace to AI agents over MCP: stdio by default, or Streamable HTTP with --http [<addr>], --allow-remote and --token-file | Agents (MCP) |
rustman mcp-client tools <server> | List an MCP server’s tools; <server> is a workspace server, stdio:<command line> or an http(s):// URL; --json, --trust, --timeout, --env | MCP client |
rustman mcp-client call <server> <tool> | Call a tool with --args <json> or --arg k=v / --arg k:=<json>; --no-validate, --sampling-response <file>; exits 1 on a tool or protocol error | MCP client |
rustman mcp-client resources <server> | List an MCP server’s resources, or read one with --read <uri> | MCP client |
rustman mcp-client prompts <server> | List an MCP server’s prompts, or get one with --get <name> --arg k=v | MCP client |
rustman mcp-client logout <server> | Delete the OAuth tokens stored for an MCP server | MCP client |
rustman completions <shell> | Print a shell completion script | below |
rustman snapshot list [path] | List snapshot files with their request, name and state (ok, orphaned, unreferenced name); --json | Snapshots |
rustman snapshot prune [path] | Delete snapshot files no request uses anymore; --yes, --dry-run | Snapshots |
rustman webhook listen | Capture inbound webhooks on a local port, answer with mocks, check signatures and print the event log; --host, --port, --allow-remote, --max-body, --max-captures, --jsonl, --env, --workspace | Webhook inspector |
rustman record | Run the local recording proxy (default 127.0.0.1:8888) and print one redacted line per capture until Ctrl+C; HTTPS is decrypted only for --intercept hosts; --host, --port, --allow-remote, --workspace, filters (--include-host, --exclude-host, --method, --content-type, --keep-static), --json, --upstream (reverse proxy, --insecure), --save (--into, --env, --store-secrets), --har (--show-secrets) | Traffic recorder |
rustman record ca init | Create the workspace’s local CA: the key in the OS keychain, the certificate in the user config directory; exits 2 without a keychain | Traffic recorder |
rustman record ca export | Print the CA certificate in PEM (never the key) and its SHA-256 fingerprint; --out | Traffic recorder |
rustman record ca install | Trust the CA in this machine’s trust store after a typed yes (or --yes); declining exits 1 | Traffic recorder |
rustman record ca uninstall | Remove the CA from every trust store Rustman installed it in | Traffic recorder |
rustman record ca rotate | Uninstall and delete the CA, create a new one and print both fingerprints; --yes | Traffic recorder |
rustman record ca remove | Uninstall the CA, then delete its key from the keychain and its certificate, after a typed yes (or --yes); declining exits 1 | Traffic recorder |
rustman viz <report.json> | Open a run, exploration or bench report in the graphical viz companion rustman-viz; --view graph opens the API graph of an exploration | below |
rustman mock serve <openapi> | Serve an OpenAPI document as a local mock server until Ctrl+C; --host, --port, --allow-remote, --allow-remote-refs, --seed, --no-prefer, --no-validate, --enforce-security, --stateful, --env, --workspace, --cors, --no-cors, --jsonl, --history, --proxy-unmatched, --record | Mock server |
rustman contract diff <old> <new> | Compare two OpenAPI 3.0/3.1 documents (files or URLs) and classify every difference as breaking, non-breaking or unknown with a rule id and JSON pointers into both documents; exits 1 on an unallowlisted breaking difference, 2 on an invalid document or allowlist; --base <ref> (old document from Git), --fail-on-unknown, --fail-on, --allowlist, --report, --env, --workspace | Contract testing, Contract rules |
rustman contract rules | List the rule catalog with its version; --json prints a JSON array (id, classification, description, example, catalog_version) | Contract rules |
rustman contract pact generate [<collection>...] | Write a Pact v4 (or --pact-version 3) file from a collection’s http requests and assertions, to contracts/pacts/<consumer>-<provider>.json (or --output); secrets and dynamic values become regex matchers with «redacted:...» examples; assertions without a Pact equivalent warn; --consumer, --provider, --env, --workspace | Contract testing |
rustman contract pact verify <pact-file>... | Replay Pact interactions against --provider-url through the safety policy, with provider states POSTed to --provider-states-url; exits 1 on a mismatch, 2 for stateful interactions without a state URL, 4 when an interaction is blocked (--allow-mutations, --allow-destructive) or the provider is an unconfirmed production host (--production <host>); --report, --env, --workspace | Contract testing |
rustman contract verify --spec <openapi> | Check recorded exchanges (history with --since, --grep, --limit, or --from <run-report>) against a local OpenAPI document (URLs are refused) without sending anything: violations, undocumented exchanges and the operations observed (5/12 operations observed); exits 1 on a violation (or an undocumented exchange with --fail-on-undocumented); --report, --env, --workspace | Contract testing |
rustman docs build | Generate a static, self-contained HTML site (--format html|markdown|both, default html) from the workspace (--workspace) into --out (default site/): one section per collection, one page per request, client-side search, dark and light themes, deterministic output; redacted examples for opted-in requests (--examples history|snapshot), published variables with --env; refuses a non-empty folder it did not generate unless --force; exits 1 when the leak scan finds a secret in an output file | API docs |
rustman docs serve | Preview the docs on 127.0.0.1 only (--port, default 4000; --env, --examples): builds into a temporary folder, rebuilds 200 ms after a workspace change and reloads open pages; build errors appear on stderr and in a page overlay without stopping it; exits 2 when the port is taken | API docs |
rustman plugin add <path|url> | Fetch a plugin from a folder or .wasm file inside the workspace or an https URL (TLS verified, 20 MiB, the workspace ca_bundle trusted), print its manifest and requested capabilities, pin its sha256 and declare it in rustman.toml with grants = [], update rustman.lock; --name, --workspace; exits 2 on http://, a manifest or component error, or a name already declared | Plugins |
rustman plugin list | List the declared plugins (name, version, API, source, grants) and whether this machine trusts their set; --workspace | Plugins |
rustman plugin remove <name> | Remove a plugin’s table from rustman.toml and its rustman.lock entry; --workspace | Plugins |
rustman plugin verify | Re-hash every plugin against its pin (downloading URL sources not cached yet), check manifests and grants and bring rustman.lock in line; exits 0, or 2 on a mismatch; --workspace | Plugins |
rustman plugin api | Print the plugin API package version and the API majors this build supports | Plugins |
rustman plugin test [path] | Run a plugin’s test cases (rustman-plugin-tests.toml, or --cases <file>) in the sandbox with a fake clock, randomness, environment, network and secrets; prints each case’s output (redacted), exits 0 when every case passes, 1 on a failure, 2 when the plugin or cases cannot be read | Plugins |
rustman plugin new <name> --kind <extension point> | Scaffold a no_std Rust plugin project for auth, assertion, generator, transformer, importer, kind or report: manifest, sample, test cases and a cargo build --target wasm32-wasip2 recipe; --dir, --sdk <path> (build against a local rustman-plugin-sdk) | Plugins |
The command groups rustman env, rustman secret, rustman cookies, rustman auth, rustman import, rustman export, rustman explore, rustman report, rustman graphql, rustman rpc, rustman evm, rustman grpc, rustman ws, rustman sse, rustman kafka, rustman mqtt, rustman amqp, rustman history, rustman mcp, rustman mcp-client, rustman mock, rustman snapshot, rustman trace, rustman webhook, rustman contract, rustman contract pact, rustman docs, rustman plugin and rustman record ca only hold the commands above: on their own they print their subcommands and exit with 2. rustman import also takes a source file or folder directly (rustman import export.json), which is the same as rustman import auto export.json.
rustman --help and rustman <command> --help document every flag; rustman --version prints rustman <version>, such as rustman 0.1.0.
Global flags
These work before or after the command name (rustman -v run . or rustman run . -v):
| Flag | Effect |
|---|---|
--color <auto|always|never> | auto (the default) colors stdout only when it is a terminal, NO_COLOR is unset or empty and TERM is not dumb. always forces color, even when piped; never turns it off. |
-v, -vv, -vvv | Logs on stderr: -v one line per request, -vv also the redacted request and response headers, -vvv everything, including the HTTP and TLS libraries. |
rustman send
rustman send <REQUEST> [--env <name>] [--var k=v]... [--timeout <duration>] [--insecure] [--body-only | -o <file>] [--show-secrets]
[-u | --update-snapshots] [--ci] [--trust-plugins]
rustman send <METHOD> <URL> [-H 'K: V']... [-d <body> | --json <body>] [same flags]
rustman send <URL> # an ad-hoc GET
<REQUEST> is a request file (relative to the current directory), its id (the path from the workspace root without .rman.yaml, such as users/get-user) or its name. A name shared by several requests fails with exit code 2:
error: request name 'List' is ambiguous: a/list.rman.yaml, b/list.rman.yaml
By default the status line, the headers and the body are printed:
HTTP/1.1 200
content-type: application/json
x-request-id: req-1
{"id":42,"name":"Ana","email":"ana@example.com","roles":["admin","dev"],"address":{"city":"Lisbon"}}
Headers and bodies are shown redacted: Authorization, Proxy-Authorization, Cookie and Set-Cookie, every secret the request references and every captured value that became a secret. A large body is streamed from its spill file, and a binary body (one that is not valid UTF-8) is redacted byte by byte. --show-secrets prints the headers and body as received instead, on the terminal only: history still stores them redacted. --body-only prints only the response body, redacted the same way (as received with --show-secrets). -o <file> writes the decoded body to a file, always byte for byte; use it to save an image or other binary body exactly:
rustman send get-user --env staging --body-only | jq .id
rustman send logo --env staging -o logo.png
The request’s assertions and captures run as in rustman run. Failed assertions are listed on stderr (fail: status: expected 200, got 404) and the exit code is 1; a request that gets no response prints error: <reason> and exits with 3. When the request carried trace context, stderr also shows trace: <trace id>, trace: backend <id> when the server’s traceresponse names another trace, and trace: <link> when a link template is configured. Snapshot assertions are recorded, compared and updated as in rustman run, with the same --update-snapshots (-u) and --ci flags and the same CI variable; a recorded or updated snapshot is noted on stderr (snapshot default recorded: users/__snapshots__/get-user.default.snap.yaml).
Ad-hoc requests
rustman send <METHOD> <URL> sends a request that has no file. -H adds a header (repeatable), -d / --data sends a body as is and --json sends a JSON body with Content-Type and Accept set to application/json. The flags mean what they mean for curl, and the request is built the same way rustman import curl builds one.
No workspace is needed. Outside a workspace, the request is sent with the default settings, its cookies last for the command only and nothing is written to the current folder; --env, secrets and other environment features need a workspace:
rustman send GET https://httpbin.org/get
rustman send POST https://api.example.com/users -H 'X-Team: core' --json '{"name":"Ana"}'
Inside a workspace, an ad-hoc request uses the workspace settings and the active environment, so {{base_url}} and secrets resolve. A URL that starts with a variable is an ad-hoc URL too; http:// is not added to it, the variable brings the scheme:
rustman send '{{base_url}}/users/42' --env dev
rustman send DELETE '{{base_url}}/users/42?key={{api_token}}' --env dev
rustman run
rustman run [<PATH>...] [--env <name>] [--var k=v]... [--timeout <duration>] [--insecure]
[--bail[=iteration]] [--filter <tag:name | glob>]... [--iterations <n>] [--parallel <n>]
[--data <file> | --no-data] [--data-label <column>] [--secret-columns <a,b>]
[--reporter <format>[:<path>]]... [--report <format>[=<path>]]...
[--max-events <n>] [--duration <duration>] [-u | --update-snapshots] [--ci]
[--trust] [--trust-plugins] [--viz] [--sign [--yes-local]]
Runs every request file (kind: http, kind: graphql and kind: mcp) under the given files and folders (default: the current folder), in collection order: file-name order, or the folder’s _collection.yaml order: (see collections). Paths must exist and lie inside the workspace. Values captured by one request are available to every later request of the run.
| Flag | Effect |
|---|---|
--env <name> | The active environment (default: RUSTMAN_ENV, then default_environment). |
--var k=v | A variable above every other source (repeatable). |
--timeout <duration> | The total timeout of every request, replacing timeout_ms: 500ms, 5s, 2m, or a number of milliseconds. Also on send. |
--insecure, -k | No TLS certificate verification; exchanges are flagged insecure: true. Also on send. |
--no-history | Do not record the exchanges in history. Also on send. |
--trace | Send trace context headers (traceparent) even when no trace: block enables them. Also on send, ws connect and sse listen. |
--bail | After the first failed or errored request, the requests not started yet are reported as skipped (bail). --bail=iteration skips only the rest of the failing iteration and goes on with the next one. |
--filter <value> | Keep only matching requests (repeatable; a request matching any filter runs). tag:<name> matches the request’s tags; anything else is a glob over the request id or file path, where * and ? stay within one folder and ** crosses folders: users/*, **/login. |
--iterations <n> | Run the selected requests n times (default 1). Captures carry over between iterations. Cannot be combined with --data. |
--data <file> | Run the selected requests once per row of a CSV or JSON file, with the row’s values as variables; see data-driven runs. --no-data ignores the data file a _collection.yaml names. |
--data-label <column> | Label each iteration of a data-driven run with this column’s value (default row <n>). |
--secret-columns <a,b> | Data columns whose values are secrets, redacted in every output. |
--parallel <n> | Run up to n folders at once (default 1). |
--reporter <format>[:<path>] | pretty, json, junit or tap, written to stdout or to <path> (repeatable; default pretty on stdout). At most one reporter may write to stdout. A file is replaced atomically, a symlink is followed, and a device such as /dev/stdout is written in place. A report plugin’s <plugin>/<format>:<path> writes the bytes the plugin returns to <path>. |
--report <format>[=<path>] | Also render the canonical report as json, junit, markdown, html or sarif (repeatable), to <path> or stdout; see Reports. With a --report on stdout and no --reporter, the pretty report is not printed. At most one reporter or report may write to stdout. |
--max-events <n> | GraphQL and JSON-RPC subscriptions stop after n events, replacing each request’s max_events (default 10). |
--duration <duration> | GraphQL and JSON-RPC subscriptions stop after this long, replacing each request’s duration or max_duration_ms (default 30s). |
--update-snapshots, -u | Overwrite snapshots that differ from the response and report them updated; matching files are left untouched. |
--ci | CI mode: never write snapshots, and fail a request whose snapshot is missing. Also on when the CI environment variable is true or 1. Combined with --update-snapshots it is a usage error (exit code 2): --update-snapshots cannot be used in CI mode. |
--trust | Spawn the workspace’s stdio MCP servers that are not trusted yet, and record the approvals; without it, kind: mcp requests to an untrusted server error. |
--trust-plugins | Load the workspace plugins even when this machine has not trusted their set yet, and record the approval. Without it, an untrusted set stops the run with exit code 2 before any request is sent. Also on send, bench, history replay, import <format> and report render. |
--viz | Show the run live in the viz companion. Without one, the run continues without visuals and its exit code is unchanged. |
--sign | Sign and send the run’s kind: evm-tx requests through the signing gate, one at a time with in-run nonces; without it they are reported as skipped (signing not requested). A gate refusal makes the run exit with code 4. |
--yes-local | With --sign: confirm evm-tx requests without a prompt on chain 31337 and [evm] headless_signing_chains only. |
A filter or path that selects no request fails with error: no requests to run (check the paths and --filter) (exit code 2).
rustman run api/users --env staging
rustman run . --env ci --filter tag:smoke --bail
rustman run . --env ci --parallel 4 --reporter json:out/report.json --reporter pretty
Parallel folders
With --parallel <n>, each folder is a unit of sequential work and up to n units run at once, so the requests of one folder still run in order and their captures chain. A folder whose _collection.yaml sets parallel: true runs its requests concurrently instead, still up to n at once; with the default --parallel 1 it runs them in order like any other folder. Reports always list requests in collection order, whatever order they finished in.
# load/_collection.yaml
parallel: true
Reporters
pretty prints one line per request, the reasons below each request that did not pass, and a summary:
PASS users/list GET 200 12 ms
FAIL users/create POST 404 8 ms
status: expected 201, got 404
ERROR users/slow
timeout after 500 ms (response)
SKIP users/delete skipped (bail)
4 requests: 1 passed, 1 failed, 1 errored, 1 skipped (35 ms)
json writes a rustman.report/v1 document with "kind": "run", described by the JSON Schema in schemas/report.schema.json. It holds every request (with its redacted exchange, timings, assertion results and capture results) and summary.total, summary.passed, summary.failed, summary.errored, summary.skipped, summary.duration_ms and summary.interrupted. A request is passed when every assertion passed and every required capture matched, failed when an assertion failed or could not be evaluated or a required capture matched nothing, errored when no response arrived (unresolved variables, network, TLS, timeout, auth) and skipped with a skip_reason: bail, interrupted, or unsupported_kind for request kinds this build cannot send. Report files are replaced atomically.
A data-driven or repeated run (--data, or --iterations above 1) groups the pretty report under one iteration <i>/<n> line per iteration, adds [<label>] to JUnit test case names and TAP descriptions. Every JSON request has the 1-based integer iteration; with --data only, it also gets a data_row object (index, total, label); see iteration labels. A kind: jsonrpc request also gets a jsonrpc object with its envelopes, attempts and subscription events; see JSON-RPC in rustman run. A kind: grpc request gets a grpc object with its exchange (protocol: grpc, status, metadata, messages, timeline, timings); see gRPC in rustman run. A kind: evm-call request gets an evm object with the endpoint’s chain and client, the decoded outputs or revert and the gas estimate; see EVM in rustman run.
junit writes JUnit XML for CI systems: one <testsuite name="rustman"> with one <testcase> per request (named by its id, with classname set to its file). A failed request gets a <failure>, an errored one an <error> and a skipped one <skipped>; their message is the first reason, and the element text lists them all:
rustman run . --env ci --reporter junit:out/junit.xml --reporter pretty
<testcase name="users/create" classname="users/create.rman.yaml" assertions="1" time="0.008">
<failure message="status: expected 201, got 404">status: expected 201, got 404</failure>
</testcase>
tap writes a TAP version 14 stream: one test point per request, # SKIP <reason> for skipped requests, and a YAML block with the reasons under each request that failed or errored. An interrupted run ends with Bail out!.
TAP version 14
1..2
ok 1 - users/list
not ok 2 - users/create
---
status: failed
file: "users/create.rman.yaml"
reasons:
- "status: expected 201, got 404"
...
Every reporter writes from the same redacted records: secret values and sensitive headers appear as «redacted:<name>» in all of them.
Runs with snapshot assertions add a summary line such as 1 snapshot recorded, 1 snapshot failed to pretty, a snapshot object to each snapshot assertion and summary.snapshots to json, the diff to the JUnit failure message, and # comments to tap.
Viz companion
rustman-viz is an optional graphical companion that draws runs, explorations and large responses as charts, tables and graphs. It is a separate program: rustman builds, installs and runs without it, and never needs a GPU. rustman talks to it over the viz protocol. Its views and how to install it are in viz.md.
rustman viz <REPORT> [--view dashboard|graph]
rustman run [<PATH>...] --viz
rustman explore run --spec <file|url> --target <url> --viz
rustman explore resume <id> --viz
rustman viz <REPORT>opens a saved JSON report (fromrustman run --reporter json:<file>,rustman explore runorrustman bench --report json=<file>) in the run, exploration or bench dashboard, chosen from the report’skind.--view graphopens the API graph of an exploration report instead. A file that is not a Rustman report exits with 2:error: notes.txt is not a Rustman report. Contract and stress reports have no view in the companion and also exit with 2, with a hint to render them as HTML; so does a bench report when the companion is too old to have the bench view.--vizopens the matching dashboard and streams progress to it as requests or probes finish. The data is redacted before it is sent: secrets appear as«redacted:name», and the companion has no way to reveal them.
rustman finds the companion in this order:
RUSTMAN_VIZ, the path of the executable. When it is set but does not name an executable file,rustmanreports that path and looks nowhere else.rustman-viz(rustman-viz.exeon Windows) onPATH.rustman-viznext to the runningrustmanexecutable.
The first match is started once with --protocol-check to confirm that it speaks rustman-viz/1. Its stderr is appended to .rustman/viz.log in the workspace.
When the companion cannot be used, --viz prints the reason as a warning and the command carries on. Its exit code depends only on the run or exploration. rustman viz prints the same reasons as an error and exits with 2. Either way, the message suggests an HTML report instead.
| Condition | Message |
|---|---|
| Not found | Viz companion not found; continuing without visuals (...) |
| Another protocol version | Viz companion speaks rustman-viz/2, rustman needs rustman-viz/1; upgrade rustman-viz |
| No graphics (no Vulkan driver on Linux or Windows; a VM or remote session) | Graphics unavailable (Vulkan); continuing without visuals |
| Exits or crashes during a run | Viz companion exited; continuing without visuals |
| Stops reading for 5 seconds | Viz companion stopped reading for 5 s; detached from it, continuing without visuals |
Sending to the companion never slows a run down. When it falls behind, progress updates are dropped, but findings and the final summary are always kept. After 5 seconds of back-pressure, rustman stops sending to it.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Every executed request passed. |
| 1 | At least one request failed (an assertion, or a required capture) and none errored; for rustman bench, a threshold failed; for rustman stress, a finding at or above --fail-on, or --require-rps not reached. |
| 2 | Usage or configuration error: a bad flag, no workspace, an invalid file, a missing environment, an ambiguous request name, no request to run. |
| 3 | At least one request errored: network, TLS, timeout, auth or unresolved variable. It wins over 1. |
| 4 | Refused by the safety policy (rustman explore, rustman bench, rustman stress), the stress gate or the monitor policy. |
| 130 | Interrupted by Ctrl+C (SIGINT), or on Unix by SIGTERM or SIGHUP, handled the same way. |
rustman import has its own: 0 when the import completed (even with unsupported features, unless --fail-on-unsupported), 1 with --fail-on-unsupported when a feature was unsupported, dropped or unmapped, and 2 for an unreadable, invalid, oversized or undetectable source (see Importing collections). rustman import openapi and rustman import asyncapi exit 0 on success, 3 when fetching the document failed, and 2 otherwise.
rustman graphql query exits 0 when the result has no errors, 1 when errors is not empty (or an assertion of the request failed), and 3 when no response came back or the document failed validation; rustman graphql introspect exits 3 when the server could not be reached or refused introspection (see GraphQL).
rustman rpc call and rpc batch exit 0 when every call returned a result, 1 when one returned a JSON-RPC error (printed on stdout) or an assertion failed, 2 when the OpenRPC catalog refuses a call, 3 when no usable answer came back, and 4 when a method guard refuses a call; rustman rpc discover exits 1 when the endpoint does not support rpc.discover (see JSON-RPC).
rustman evm commands exit 0 on success, 1 when an assertion fails or something is not found (a transaction, a block, an ENS name), 2 for a bad file, argument or ABI (and anvil not found), 3 when the node cannot be reached or answers with an error, and 4 when the call is refused (a chain mismatch, a send method, a host outside the agents’ allowlist); see EVM toolkit.
rustman grpc call exits 0 when the call passed (status OK without assertions), 1 for another status or a failed assertion, 2 when the call cannot be sent as written (no schema, unknown method or field, invalid metadata), and 3 when no status came back or the deadline expired. rustman grpc health exits 0 for SERVING, 1 for NOT_SERVING, SERVICE_UNKNOWN or UNKNOWN, and 3 when the check fails (UNIMPLEMENTED included); see gRPC.
rustman docs build exits 0 when the site was written, 1 when the post-build leak scan found a secret value in an output file (the file is removed), and 2 for a usage or configuration error: a non-empty --out folder without .rustman-docs-manifest (without --force), a secret in [docs].publish_variables, an unknown --env, an invalid template (see API docs). rustman docs serve exits 0 when stopped with Ctrl+C (or on Unix SIGTERM or SIGHUP), and 2 when it cannot start: the port is already taken or cannot be bound, or no workspace is found. It never exits 1: a failed build (including the leak scan, an unknown --env or an invalid [docs] setting) is printed on stderr and shown in a page overlay, and the server keeps serving the last good build (see API docs).
rustman ws connect and rustman sse listen exit 0 when the session ended normally (its steps done, a bound reached, or closed by the server), 1 when an assertion of the request failed, 3 when the session failed (a refused handshake such as ws: handshake failed: 401 Unauthorized, a transport error, a wait_for timeout, an oversized message) and 130 on Ctrl+C (see WebSocket and SSE).
rustman kafka, rustman mqtt and rustman amqp produce and consume exit 0 when the operation passed (a consume that reached its bounds, even with no message), 1 when an assertion of the request failed, 3 when it failed (an unreachable broker, kafka: unknown topic '<name>', amqp: unroutable, a failed login), 4 when the safety policy refused it, and 130 on Ctrl+C (see Messaging).
rustman explore run and explore resume exit 1 when a finding is at or above --fail-on (default high) instead of on failed requests, and 0 otherwise; see Exploration. rustman report diff exits 1 when a new finding is at or above --fail-on (default high), and report render and report diff exit 2 on a report with an unknown major schema version; see Reports.
On Ctrl+C (and on Unix SIGTERM or SIGHUP), in-flight requests are cancelled, stdio MCP servers are stopped with the processes they started, the requests not finished are reported as skipped with skip_reason: interrupted, every reporter writes its partial report (with summary.interrupted: true), and the exit code is 130. A second Ctrl+C quits at once, also with exit code 130, without waiting for reports to be written (stdio MCP servers still running are killed first).
Terminal output and logs
Reports and response bodies go to stdout; logs, warnings, errors and Ctrl+C notices go to stderr, so rustman run . --reporter json -vv > report.json leaves a valid JSON document in report.json and the logs on the terminal.
The pretty report is colored only when stdout is a terminal and color is not turned off (--color never, a non-empty NO_COLOR, or TERM=dumb); --color always forces it. Piped or redirected output has no ANSI escapes and no carriage-return progress lines. Reports written to a file (--reporter pretty:out/run.txt) are never colored.
Logs are off unless -v or RUST_LOG is given. RUST_LOG takes tracing filter directives and replaces the -v levels: RUST_LOG=rustman_http=debug shows the requests and headers, RUST_LOG=trace everything. Log lines carry only redacted text, and every line is scanned once more for the secret values the run resolved before it reaches stderr.
$ rustman run users -vv --reporter json > report.json
2026-11-17T09:30:00.101Z DEBUG rustman_http::runner::execute: sending request=users/list iteration=1
2026-11-17T09:30:00.113Z INFO rustman_http::runner::execute: GET http://localhost:8080/users -> 200 (12 ms) request=users/list status=Passed
2026-11-17T09:30:00.113Z DEBUG rustman_http::runner::execute: > Authorization: «redacted:Authorization» request=users/list
2026-11-17T09:30:00.113Z DEBUG rustman_http::runner::execute: < content-type: application/json request=users/list
Completions
rustman completions <shell> prints a completion script for bash, zsh, fish, powershell or elvish on stdout:
rustman completions bash > ~/.local/share/bash-completion/completions/rustman
rustman completions zsh > "${fpath[1]}/_rustman"
rustman completions fish > ~/.config/fish/completions/rustman.fish
rustman completions powershell >> $PROFILE
OAuth2 without a terminal
When stdin is not a terminal (as in CI), send and run never open a browser: a request whose authorization_code token is not cached fails with oauth2: interactive login required (run 'rustman auth login <request>'). See OAuth2.
Request files
A Rustman workspace is a folder with a rustman.toml file. Every saved request is one YAML file named *.rman.yaml, and folders group requests into collections. Everything is plain text, meant to be reviewed and versioned in Git.
Every YAML example on this page is loaded by a test (crates/rustman-core/tests/docs.rs): the examples are written into a temporary workspace at the path in their first-line comment, and the workspace must load. The examples are also in the exact form Rustman writes, so saving them produces no diff.
Workspace layout
shop/
├── rustman.toml workspace marker and settings
├── environments/ one file per environment (see environments.md)
│ └── local.yaml
├── users/ a collection
│ ├── _collection.yaml optional: order, parallel, inherited headers, auth and variables
│ ├── login.rman.yaml
│ └── get-user.rman.yaml
└── .rustman/ per-user state (history, secrets): git-ignored
rustman init [dir] creates rustman.toml, environments/local.yaml, a sample examples/ping.rman.yaml, and adds .rustman/ to .gitignore (appending to an existing file). rustman init --bare creates only rustman.toml and the .gitignore entry. Running it where rustman.toml already exists fails with error: <dir> is already a rustman workspace (exit code 2) and changes nothing.
Commands find the workspace by looking for rustman.toml in the current directory and then in each parent directory. --workspace <dir> overrides the search. Without a workspace, commands that need one fail with error: no rustman workspace found (run 'rustman init') (exit code 2).
rustman.toml
# rustman.toml
[workspace]
name = "shop"
version = 1
[defaults]
timeout_ms = 30000 # total request timeout
follow_redirects = true
max_redirects = 10
verify_tls = true
default_environment = "local"
[http]
ca_bundle = "certs/dev-ca.pem" # extra trusted CAs (PEM), relative to the workspace root
proxy = "http://127.0.0.1:3128"
max_body_bytes = 10485760 # larger response bodies are spilled to disk
max_download_bytes = 1073741824 # an undecoded response body larger than this fails
client_cert = "certs/client.pem" # mutual TLS for requests without their own client certificate
client_key = "certs/client.key"
# or: client_pkcs12 = "certs/client.p12" with client_pkcs12_password = "{{p12_password}}"
[variables]
api_version = "v2"
Only [workspace] with name and version = 1 is required; every other key has the default shown above (default_environment, ca_bundle, proxy and the client certificate keys are unset by default). The [http] client certificate (client_cert and client_key, or client_pkcs12 and client_pkcs12_password) applies to every request that sets none of its own. The optional [safety] table (allowed_hosts, production_hosts, rate, concurrency) configures the safety policy for automated senders. Optional [[graphql.endpoints]] entries set a schema_file per GraphQL endpoint (see graphql.md), [graphql] max_schema_bytes (64 MiB by default) caps an introspection response (see graphql.md), and [explore] configures OpenAPI exploration. The optional [bench] table (max_vus, max_duration, max_rps) raises the load-testing caps. Unknown keys produce a warning, not an error (except in [safety], where they are errors). A version newer than this build supports fails with error: rustman.toml version 2 is newer than this rustman supports (1).
Common fields
Every request file has these fields, in this order:
| Field | Required | Meaning |
|---|---|---|
version | yes | Always 1. |
kind | yes | The request kind: http, graphql, jsonrpc, grpc, mcp, ws, sse, evm-call or evm-tx. |
name | yes | The name shown in reports and used by rustman send <name>. |
description | no | Free text. |
tags | no | A list of strings. |
docs | no | How rustman docs shows the request: example: true publishes its latest recorded exchange (redacted), hidden: true leaves it out of the site, description adds Markdown to its page (see API docs). |
variables | no | Request-level variables (see environments.md for precedence). |
assertions | no | Checks on the response (see assertions.md). |
captures | no | Values extracted from the response for later requests. |
graphql files have their own fields (see GraphQL requests); their variables are GraphQL variables sent with the operation, not a layer of Rustman variables. jsonrpc, mcp and grpc files have their own fields too (see their sections below), and rustman run runs them alongside http and graphql requests. evm-call and evm-tx files are described in EVM toolkit. A kind this build does not know is reported as skipped with request kind '<kind>' is not supported by this build.
HTTP requests
A minimal HTTP request:
# users/get-user.rman.yaml
version: 1
kind: http
name: Get user
method: GET
url: '{{base_url}}/users/1'
The kind: http fields, in the order Rustman writes them:
| Field | Meaning |
|---|---|
method | Any RFC 9110 token, so custom methods such as PURGE work. Defaults to GET. GET USERS is rejected with invalid HTTP method 'GET USERS'. |
url | The request URL. {{variables}} are resolved at send time. |
query | An ordered list of name/value pairs. Names may repeat. |
headers | An ordered list of name/value pairs. |
body | One of the body types below. |
auth | none, basic, bearer, api_key, oauth2, digest, aws_sigv4, jwt or plugin (auth plugins). |
settings | Per-request overrides for timeouts, redirects, TLS and transport. |
transform | {request: [...], response: [...]}: plugin transformers (<plugin>/<name>) the request goes through before auth, and the response before assertions and captures. |
Header and query order is kept when the request is sent:
# cache/purge.rman.yaml
version: 1
kind: http
name: Purge tagged pages
method: PURGE
url: '{{base_url}}/path'
query:
- name: tag
value: a
- name: tag
value: b
headers:
- name: X-Purge-Key
value: '{{purge_key}}'
This is sent as PURGE /path?tag=a&tag=b.
A query, headers or form fields row with enabled: false stays in the file but is not sent, and a disabled header does not replace a header inherited from a collection. The TUI’s per-row toggle writes it; the key is left out for enabled rows.
Body types
Every body has a type. File paths are resolved relative to the request file and must stay inside the workspace (see File paths).
json
content is a YAML value converted to JSON, so {name: Ana, age: 3} is sent as {"name":"Ana","age":3} with Content-Type: application/json. Only true and false are booleans and numbers with a leading zero stay strings, so no, on and 0755 are sent as the strings "no", "on" and "0755". Other numbers follow YAML 1.2, which JSON writes in decimal: 0x1F, 0o17 and +12 are sent as 31, 15 and 12. An integer too large for 64 bits can’t be sent exactly, so it is a load error; quote it, or use a string content (below).
# users/create-user.rman.yaml
version: 1
kind: http
name: Create user
method: POST
url: '{{base_url}}/users'
body:
type: json
content:
name: Ana
age: 3
roles:
- admin
active: true
A string content is sent as is, which is useful for JSON that YAML can’t express directly:
# users/create-raw.rman.yaml
version: 1
kind: http
name: Create user from raw JSON
method: POST
url: '{{base_url}}/users'
body:
type: json
content: '{"name":"Ana","age":3}'
text
Sent with Content-Type: text/plain; charset=utf-8. A literal {{ is written as \{{.
# notes/create-note.rman.yaml
version: 1
kind: http
name: Create note
method: POST
url: '{{base_url}}/notes'
body:
type: text
content: |
Shopping list for {{user_name}}
Template syntax looks like \{{this}}
form
URL-encoded fields (application/x-www-form-urlencoded), in order:
# auth/login-form.rman.yaml
version: 1
kind: http
name: Log in with a form
method: POST
url: '{{base_url}}/login'
body:
type: form
fields:
- name: user
value: ana
- name: password
value: '{{password}}'
multipart
Each part has a name and either a text value or a file. A file part is sent with its file name (a.png) and a content type guessed from the extension (image/png), unless content_type is set.
# users/upload-avatar.rman.yaml
version: 1
kind: http
name: Upload avatar
method: POST
url: '{{base_url}}/users/1/avatar'
body:
type: multipart
parts:
- name: caption
value: Profile picture
- name: avatar
file: ./fixtures/a.png
- name: metadata
file: ./fixtures/meta.json
content_type: application/json
file
The raw bytes of a workspace file, sent with Content-Type: application/octet-stream unless a header overrides it.
# blobs/put-blob.rman.yaml
version: 1
kind: http
name: Upload blob
method: PUT
url: '{{base_url}}/blobs/1'
headers:
- name: Content-Type
value: application/pdf
body:
type: file
path: ../fixtures/report.pdf
none
No body. This is the same as leaving body out, but makes the intent explicit.
# users/delete-user.rman.yaml
version: 1
kind: http
name: Delete user
method: DELETE
url: '{{base_url}}/users/{{user_id}}'
body:
type: none
Auth
# auth/basic.rman.yaml
version: 1
kind: http
name: Basic auth
url: '{{base_url}}/me'
auth:
type: basic
username: ana
password: '{{password}}'
The other types:
{type: bearer, token}sendsAuthorization: Bearer <token>.{type: api_key, name, value, in}sends the key as a header (in: header, the default) or a query parameter (in: query).{type: oauth2, grant, token_url, client_id, ...}withgrant: client_credentialsorgrant: authorization_code(which also needsauth_url). Optional:client_secret,scopes.{type: digest, username, password},{type: aws_sigv4, region, service, ...}and{type: jwt, algorithm, ...}compute their credentials for every request; see Signature auth.{type: none}sends no auth, even when the collection defines some.
Auth never replaces an explicit Authorization header.
# auth/oauth2.rman.yaml
version: 1
kind: http
name: OAuth2 client credentials
url: '{{base_url}}/me'
auth:
type: oauth2
grant: client_credentials
token_url: https://auth.example.com/token
client_id: rustman
client_secret: '{{client_secret}}'
scopes:
- read
Settings
Every key is optional and overrides rustman.toml for this request:
# slow/report.rman.yaml
version: 1
kind: http
name: Slow report
url: https://reports.example.com/build
settings:
timeout_ms: 120000
connect_timeout_ms: 5000
follow_redirects: false
max_redirects: 3
verify_tls: true
http2_prior_knowledge: false
proxy: none
cookies: false
decompress: true
ca_bundle: ../certs/dev-ca.pem
client_cert: ../certs/client.pem
client_key: ../certs/client.key
proxy: none bypasses every proxy, including HTTPS_PROXY. A PKCS#12 client certificate uses client_pkcs12 plus client_pkcs12_password, which should reference a secret variable.
Assertions and captures
Each assertion is a one-key mapping naming its type. Captures extract values for later requests in the same run. assertions.md covers every operator.
# users/login.rman.yaml
version: 1
kind: http
name: Log in
method: POST
url: '{{base_url}}/login'
body:
type: json
content:
user: ana
password: '{{password}}'
assertions:
- status: 200
- status: '2xx'
- header:
name: content-type
contains: json
- json:
path: $.access_token
exists: true
- schema:
file: ../schemas/token.json
- body:
not_contains: error
- latency:
total_lt: 500
captures:
- var: token
from: json
path: $.access_token
- var: session
from: cookie
name: sid
persist: true
GraphQL requests
A kind: graphql file names an endpoint and exactly one of document (inline) or document_file (a path relative to the request file). {{variables}} are interpolated in the endpoint, headers, auth and the string values of variables, never in the document. graphql.md lists every field.
# graphql/get-user.rman.yaml
version: 1
kind: graphql
name: User by id
endpoint: '{{base_url}}/graphql'
document: |
query GetUser($id: ID!) {
user(id: $id) { name email }
}
operation_name: GetUser
variables:
id: '{{user_id}}'
headers:
- name: X-Client
value: rustman
JSON-RPC requests
A kind: jsonrpc file sends JSON-RPC 2.0 to an endpoint (http, https, ws or wss; {{variables}} work). It is chain-agnostic: method names are not interpreted and results are shown exactly as received, so hex quantities stay hex. jsonrpc.md describes ids, batches, errors, retries, WebSocket and subscriptions.
| Field | Meaning |
|---|---|
method | The method of a single call. Required unless the file has a batch (or a subscription, which defaults it to subscription.subscribe). |
params | A list (sent as a JSON array) or a map (sent as a JSON object). Left out of the envelope when absent; a scalar fails to load with params must be a list or a map. {{variables}} are interpolated in string values only. |
id | A string or an integer, sent unchanged. Without it, ids are sequential from 1 per connection. |
notification | true sends no id and expects no answer. Assertions on $.result fail to load. |
batch | 1 to 100 calls (method, params, id, notification, assertions, captures each), sent as one JSON array instead of method. |
subscription | {subscribe, unsubscribe, notification} method names, plus optional notification_id_path (default $.params.subscription), max_events (default 10) and max_duration_ms (default 30000). WebSocket endpoints only. |
idempotent | true allows settings.retry; calls are never retried otherwise. |
headers, auth, variables, assertions, captures | As for kind: http. Status and header assertions fail to load for ws:// and wss:// endpoints. |
settings | The kind: http settings, plus retry: {attempts, backoff_ms} (defaults 0 and 500) and validate. |
Quote hex values ('0x10'): YAML reads an unquoted 0x10 as the number 16.
An Ethereum read, retried when the node rate-limits it:
# eth/block-number.rman.yaml
version: 1
kind: jsonrpc
name: Block number
endpoint: '{{rpc_url}}'
method: eth_blockNumber
idempotent: true
settings:
timeout_ms: 5000
retry: {attempts: 2, backoff_ms: 500}
captures:
- {var: head, from: json, path: $.result}
A Bitcoin Core batch with Basic auth:
# btc/tip.rman.yaml
version: 1
kind: jsonrpc
name: Chain tip
endpoint: http://127.0.0.1:8332
auth:
type: basic
username: '{{btc_user}}'
password: '{{btc_password}}'
batch:
- method: getblockcount
- method: getblockhash
params: [800000]
- method: getblockchaininfo
id: info
A Solana call with named params, and an Ethereum newHeads subscription over WebSocket:
# solana/balance.rman.yaml
version: 1
kind: jsonrpc
name: Balance
endpoint: https://api.devnet.solana.com
method: getBalance
params: ['{{wallet}}', {commitment: finalized}]
# eth/new-heads.rman.yaml
version: 1
kind: jsonrpc
name: New heads
endpoint: wss://{{node_host}}/ws
params: [newHeads]
subscription:
subscribe: eth_subscribe
unsubscribe: eth_unsubscribe
notification: eth_subscription
max_events: 3
assertions:
- json: {path: $.events, length: 3}
gRPC requests
A kind: grpc file makes one gRPC call to a target (host:port, grpc://host:port for plaintext HTTP/2, or grpcs://host:port for TLS; {{variables}} work). Message types come from server reflection unless schema names local .proto files or a descriptor set. grpc.md describes schemas, encoding, streaming, deadlines, TLS, gRPC-Web, status details and the rustman grpc commands.
| Field | Meaning |
|---|---|
method | The fully qualified method, package.Service/Method. |
message | The request message of a unary or server-streaming call, in the proto3 JSON mapping. {{variables}} are interpolated in string values. |
messages | The request messages of a client-streaming or bidi call, sent in order before half-close. Exactly one of message or messages is allowed. |
metadata | An ordered list of {name, value} pairs sent as request headers; names ending in -bin take base64. |
deadline_ms | The call deadline (default: [defaults] timeout_ms, else 30000). |
tls | enabled, insecure, ca_bundle, client_cert, client_key, client_pkcs12, client_pkcs12_password. |
transport | grpc (default) or grpc-web. |
schema | protos with import_paths, or descriptor_set; paths are relative to the request file. |
stream | max_messages (default 100) and duration_ms (default 30000): when rustman run stops a response stream. |
variables, assertions, captures | As for kind: http, plus the grpc_status and metadata assertions and from: metadata captures. Without assertions a call expects grpc_status: OK. |
A unary call with a token in its metadata:
# grpc/get-product.rman.yaml
version: 1
kind: grpc
name: Get product
target: '{{grpc_host}}'
method: shop.v1.Catalog/GetProduct
message:
id: p-1
metadata:
- name: authorization
value: 'Bearer {{token}}'
deadline_ms: 5000
assertions:
- grpc_status: OK
- json: {path: $.id, equals: p-1}
captures:
- {var: product_name, from: json, path: $.name}
A server-streaming call compiled from local .proto files, stopped after 3 messages, and a client-streaming upload:
# grpc/list-products.rman.yaml
version: 1
kind: grpc
name: List products
target: grpc://localhost:50051
method: shop.v1.Catalog/ListProducts
message: {pageSize: 10}
schema:
protos: [protos/shop/v1/catalog.proto]
import_paths: [protos]
stream:
max_messages: 3
assertions:
- json: {path: $.messages, length: 3}
# grpc/upload-products.rman.yaml
version: 1
kind: grpc
name: Upload products
target: grpc://localhost:50051
method: shop.v1.Catalog/UploadProducts
messages:
- {id: p-1, name: Mug}
- {id: p-2, name: Plate}
assertions:
- json: {path: $.count, equals: 2}
WebSocket and SSE requests
A kind: ws file opens a WebSocket session and a kind: sse file listens to a Server-Sent Events stream. Both record a message timeline, end on their own under rustman run, and take assertions and captures over the messages they received. realtime.md describes sessions, the timeline, reconnects and the history record.
kind: ws fields:
| Field | Meaning |
|---|---|
url | A ws:// or wss:// URL; {{variables}} work. Any other scheme fails to load with ws: url must use ws:// or wss://. |
headers, auth, variables, assertions, captures | As for kind: http. Headers and auth go into the opening handshake. |
subprotocols | An ordered list offered in Sec-WebSocket-Protocol; the server picks one. |
steps | A scripted sequence, run in order (see below). |
limits | max_messages (default 50), duration_ms (default 30000), max_message_bytes (default 16777216, 16 MiB) and max_timeline (default 10000). |
tls | verify, ca_bundle, client_cert, client_key, client_pkcs12 and client_pkcs12_password, as the kind: http settings of the same names (verify is verify_tls). |
kind: sse fields:
| Field | Meaning |
|---|---|
url | An http:// or https:// URL; any other scheme fails to load with sse: url must use http:// or https://. |
method | GET (default) or another method, such as POST for LLM token streams. |
body | A body of any kind: http type, for POST streams. |
headers, auth, variables, assertions, captures, limits, tls | As for kind: ws. Accept: text/event-stream is sent unless the file sets Accept. |
last_event_id | Sent as Last-Event-ID on the first connection. |
reconnect | max_attempts (default 5; 0 disables reconnecting). |
The headless bounds are named limits.max_messages and limits.duration_ms, next to the other limits of a session. GraphQL and JSON-RPC subscriptions keep their own top-level max_events and max_duration_ms.
A WebSocket step is a map with exactly one key:
| Step | Meaning |
|---|---|
send: {text: <string>} | A text frame. |
send: {json: <value>} | A YAML or JSON value sent compactly as a text frame: {op: subscribe} sends {"op":"subscribe"}. |
send: {binary: <base64>} or send: {binary: {file: <path>}} | A binary frame from base64 text, or from a file relative to the request file. |
send: {ping: <base64>} | A ping carrying that data; its pong is recorded with the round-trip time. |
wait_for: {json: {path, equals | matches | exists}, timeout_ms} or wait_for: {regex: <pattern>, timeout_ms} | Wait for a message received after the step starts that matches, up to timeout_ms (default 5000). A timeout fails the session with ws: wait_for timed out after <n> ms (<matcher>). |
sleep: <ms> | Wait, recording what arrives. |
close: {code, reason} | Close (code default 1000) and wait up to 2000 ms for the server’s close. |
{{variables}} are interpolated in the string values of steps: texts, the strings of JSON frames, base64 data, file paths, wait_for paths, patterns and expected values, and close reasons.
A subscription driven by steps, checked on its first message:
# feeds/ticker.rman.yaml
version: 1
kind: ws
name: Ticker
url: wss://{{feed_host}}/v2/feed?token={{api_token}}
subprotocols:
- v2.feed
- v1.feed
steps:
- send: {json: {op: subscribe, channel: ticker}}
- wait_for: {json: {path: $.type, equals: snapshot}, timeout_ms: 3000}
limits: {max_messages: 20, duration_ms: 10000}
assertions:
- messages: {count_gte: 3}
- json: {path: '$.messages[0].type', equals: snapshot}
captures:
- {var: last_price, from: json, path: '$.messages[1].price'}
A request and response over a socket, then a close:
# feeds/ping.rman.yaml
version: 1
kind: ws
name: Ping
url: ws://localhost:8080/rpc
steps:
- send: {json: {id: 1, op: ping}}
- wait_for: {json: {path: $.id, equals: 1}}
- send: {binary: {file: ./fixtures/blob.bin}}
- sleep: 100
- close: {code: 1000, reason: done}
assertions:
- close_code: 1000
An LLM token stream over a POST, resumed after a drop:
# llm/chat-stream.rman.yaml
version: 1
kind: sse
name: Chat stream
method: POST
url: https://{{llm_host}}/v1/chat/completions
auth:
type: bearer
token: '{{llm_token}}'
body:
type: json
content:
stream: true
messages:
- {role: user, content: Hello}
reconnect: {max_attempts: 2}
limits: {max_messages: 200, duration_ms: 60000}
assertions:
- messages: {count_gte: 1}
- latency: {ttfb_lt: 5000}
Messaging requests
A kind: kafka, kind: mqtt or kind: amqp file is one broker operation: operation: produce sends messages, operation: consume reads them. A missing or other operation fails to load with messaging: operation must be produce or consume. messaging.md describes every field, message payloads, the Kafka client, security and the Schema Registry.
Collections
Every folder under the workspace root is a collection, except environments/, folders whose name starts with . or _ (such as .rustman/, __snapshots__/ or _removed/), and folders with no request file at any depth (such as mocks/). Symlinked folders are not followed.
Requests run in file-name order unless the folder has a _collection.yaml with order:. Entries named there (request file names without .rman.yaml, or sub-folder names) run first, in that order, and the rest follow by file name. An order: entry that matches nothing produces a warning.
A _collection.yaml may also set name, description, parallel: true (under rustman run --parallel <n>, the folder’s requests run concurrently instead of one after another; see the CLI reference), data and secret_columns (the folder’s default data file for rustman run, and its secret columns), and headers, auth and variables that the requests inside inherit. A request’s own value wins. A header set closer to the request replaces every header with the same name (case-insensitive) set further up.
# users/_collection.yaml
name: Users
description: User management endpoints
order:
- login
- get-user
headers:
- name: X-Team
value: core
auth:
type: bearer
token: '{{token}}'
variables:
page_size: 50
With this file, users/get-user.rman.yaml above is sent with X-Team: core and the bearer token, while a request with auth: {type: none} is sent without Authorization.
A collection created by rustman import openapi also records its source (format, location and the sha256 of the document), which --sync uses; see OpenAPI import.
File paths
Paths in body.path, multipart file, settings.ca_bundle, settings.client_cert, settings.client_key, settings.client_pkcs12 and schema file are relative to the request file. The [http] file paths in rustman.toml (ca_bundle, client_cert, client_key, client_pkcs12) are relative to the workspace root. A path that leaves the workspace, through .., an absolute path or a symlink, fails to load:
users/upload.rman.yaml:9: file path escapes workspace: ../../etc/passwd
Paths containing {{variables}} are checked after the variables are resolved, before anything is sent, with the same error (any secret value in the path is redacted from it). rustman.toml values are not interpolated, so {{ there is literal, except [http] client_pkcs12_password, which is resolved with the request’s variables so that it can reference a secret.
Errors
Load errors name the file and line, and Rustman reports every broken file at once:
legacy/soap.rman.yaml:2: unknown request kind 'soap' (expected one of: http, graphql, jsonrpc, grpc, mcp, ws, sse, kafka, mqtt, amqp, evm-call, evm-tx)
users/list.rman.yaml:5: unknown field `header`, expected one of version, kind, name, description, tags, docs, method, url, query, headers, body, auth, settings, transform, variables, assertions, captures
Unknown fields, duplicate keys, wrong types, bad indentation and unclosed quotes are all errors with exact positions. Rustman never guesses what a misspelled key meant.
Stable serialization
When Rustman writes a request file (save or import), keys follow the order in the tables above, indentation is 2 spaces, the file ends with a newline, and strings are quoted only when YAML needs it (for example '{{base_url}}/users', '2xx' or 'no'). Loading and saving a file that Rustman wrote produces no diff. Comments in a hand-edited file aren’t preserved when Rustman rewrites it.
Environments, variables and secrets
An environment is a named set of variables, such as local, staging or prod. Request files refer to variables as {{name}}, and Rustman fills them in when a request is sent. Some variables are secrets: their values never live in workspace files. They’re stored in your OS keychain (or a private, git-ignored file) and redacted everywhere they could leak.
The examples on this page are checked by an integration test (crates/rustman-cli/tests/docs_environments.rs): the files below make up one workspace, every $ rustman command runs against it in order with the output shown, and the error messages shown are the ones Rustman produces. Only the interactive prompt and the CI configuration snippet are not run.
Environment files
Each file environments/<name>.yaml defines one environment. The name is the file stem and must match [A-Za-z0-9_-]+; a file such as environments/my env.yaml is skipped with warning: ignoring environment 'my env': invalid name. A symlinked file is followed when its target is inside the workspace; one that resolves outside it is skipped with warning: ignoring environment '<name>': resolves outside the workspace. A dangling symlink (or a folder named <name>.yaml) is skipped with warning: ignoring environment '<name>': not a readable file.
# environments/local.yaml
variables:
base_url: http://localhost:8080
page_size: 50
verbose: true
variables holds string, number or boolean values. Only true and false are booleans, and a number with a leading zero stays text, so 0755 and no are kept exactly as written. An integer too large for 64 bits can’t be used exactly, so it is a load error; quote it to keep it as text.
secrets lists variables whose values are stored outside the workspace. A secret must not also have a value under variables.
# environments/prod.yaml
variables:
base_url: https://api.example.com
page_size: 100
secrets:
- api_token
production: true
An environment may also set chain_id: <integer> to pin the EVM chain its endpoints must report; see EVM toolkit.
production: true marks an environment as production for the safety policy: automated senders such as OpenAPI exploration refuse to target it unless the host is confirmed, and never send destructive requests to it. Environments named prod or production are treated as production even without the key. It defaults to false.
# environments/ci.yaml
variables:
base_url: http://127.0.0.1:9000
page_size: 10
secrets:
- api_token
Workspace-wide defaults go in rustman.toml:
# rustman.toml
[workspace]
name = "shop"
version = 1
[defaults]
default_environment = "local"
[variables]
api_version = "v1"
A request uses variables anywhere a value is written:
# users/me.rman.yaml
version: 1
kind: http
name: Me
method: GET
url: '{{base_url}}/{{api_version}}/me'
query:
- name: limit
value: '{{page_size}}'
headers:
- name: Authorization
value: Bearer {{api_token}}
The active environment
At most one environment is active. It is chosen by, in order:
--env <name>- the
RUSTMAN_ENVenvironment variable [defaults] default_environmentinrustman.toml- otherwise none.
rustman env list lists the environments and marks the active one with *:
$ rustman env list
ci
* local
prod
$ RUSTMAN_ENV=prod rustman env list
ci
local
* prod
Naming an environment that doesn’t exist fails with exit code 2:
$ rustman env list --env qa
error: environment 'qa' not found (available: ci, local, prod)
Variables
Precedence
When a name is defined in several places, the first source in this list wins:
| # | Source |
|---|---|
| 1 | Runtime overrides: --var name=value |
| 2 | Captures from earlier requests in the same run (in a data-driven run, of the same iteration) |
| 3 | The current row of a data file (rustman run --data) |
| 4 | The request file’s variables |
| 5 | _collection.yaml variables, nearest folder first |
| 6 | Persisted captures (.rustman/state/<env>.yaml) |
| 7 | The active environment, including its secrets |
| 8 | rustman.toml [variables] |
Names are case-sensitive: {{Token}} and {{token}} are different variables.
Where and how {{name}} is filled in
{{name}} is filled in in the URL, query parameters, headers, body content, form and multipart text fields, auth fields and file paths.
- Escaping: write
\{{for a literal{{. The text\{{not_a_var}}is sent as{{not_a_var}}. - No recursive expansion: a value is inserted exactly as written. If
ais{{b}}, then{{a}}becomes the literal text{{b}}. This also applies to values in environment files:{{...}}inside a value is never expanded. - Unresolved names are errors: if any placeholder has no value, the request is not sent at all (no connection is opened), and every missing name is listed:
error: unresolved variable(s): base_url, token. The runner counts this as an error, not as a failed assertion.
Dynamic variables
These are computed again for every occurrence:
| Placeholder | Value |
|---|---|
{{$uuid}} | A random UUID v4 |
{{$timestamp}} | Unix time in seconds |
{{$timestampMs}} | Unix time in milliseconds |
{{$isoTimestamp}} | RFC 3339 UTC time, e.g. 2026-11-17T09:30:00.123Z |
{{$randomInt}} | An integer from 0 to 1000, inclusive |
{{$randomInt min max}} | An integer from min to max, inclusive |
{{$randomString n}} | n random letters and digits (16 if n is omitted) |
{{$env NAME}} | The OS environment variable NAME; unresolved if it isn’t set |
Secrets
Secrets can also come from external stores (Vault, 1Password, SOPS files, cloud secret managers…) through {{secret:<provider>/<path>}} references or variables written {secret: "<provider>/<path>"}: see Secret providers.
Declaring and setting a secret
List the variable under secrets in the environment file (as api_token in prod.yaml above), then store its value:
$ rustman secret set api_token --env prod
value for api_token (prod):
stored secret 'api_token' for environment 'prod' in the OS keychain
On a terminal the value is prompted for without echo. When stdin is not a terminal, the value is read from stdin instead, without its final line break, which is how scripts and CI set secrets (see the CI pattern). Without --env, the active environment is used. Only names listed under the environment’s secrets can be set, and an empty value is refused.
rustman secret list shows each declared secret and whether a value is stored. Values are never printed:
$ rustman secret list
ci/api_token not set
prod/api_token not set
rustman secret rm api_token --env prod deletes a stored value.
Until a value is stored, a request that uses the secret fails without being sent:
error: unresolved variable(s): api_token (secret not set; run 'rustman secret set api_token --env prod')
If the value is stored but can’t be read (the keychain refused access, or .rustman/secrets.yaml is malformed), the hint names the store error instead, for example api_token (could not read secret: OS keychain error: ...).
Where secrets are stored
- OS keychain (the default): the macOS Keychain, the Windows Credential Manager, or the Secret Service (GNOME Keyring, KWallet) on Linux. Entries use the service
rustmanand the account<workspace-id>/<env>/<name>. - Workspace id:
.rustman/workspace-idholds a UUID created the first time a secret is stored in the keychain. It’s per clone and git-ignored, so two clones of the same repository on one machine never share secrets. - File fallback: when no keychain is available (for example on a headless Linux host with no Secret Service running), secrets go to
.rustman/secrets.yaml, and the warningOS keychain unavailable; storing secrets in .rustman/secrets.yamlis printed once. On Unix the file has mode0600(its folder, when Rustman creates it,0700). On Windows, inherited permissions and the broad groups (Everyone, Authenticated Users, Users) are removed and the current user is granted full control (with the built-inicacls);SYSTEMandAdministratorsmay keep access, as root does on Unix. The file is replaced atomically on every write. If its permissions were loosened (say, by a copy or a restore), reading a secret from it printswarning: .rustman/secrets.yaml is readable by other users; ...once, and the nextrustman secret setrestores mode0600. - Git-ignore guard: before writing
.rustman/secrets.yamlor.rustman/workspace-id, Rustman asks Git whether the path is ignored. If the workspace is in a Git repository and.rustman/is not ignored (or the file is tracked), the write is refused witherror: refusing to write secrets: .rustman/ is not git-ignored.rustman initadds.rustman/to.gitignore. Withoutgit, or when Git reports that the folder is not in a repository, the check passes; any other check Git can’t answer (inside a repository, or when Git fails for another reason, such as an unsafe repository owner) is a refusal witherror: refusing to write secrets: could not check that .rustman/ is git-ignored. - No symbolic links: a
.rustmanthat is a symbolic link (or a link in place of the secrets file) could send secrets into a tracked folder or out of the workspace, so the write is refused witherror: refusing to write secrets: .rustman is a symbolic link. - OAuth2 tokens: the access and refresh tokens that
rustman auth loginand OAuth2 requests cache are secrets too, stored the same way. When they go to.rustman/secrets.yaml(no keychain, orRUSTMAN_SECRET_STORE=file),rustman auth loginprints, once,warning: OAuth2 tokens are stored in .rustman/secrets.yaml (git-ignored, readable by you only), not in the OS keychainin place of the generic fallback warning. - Choosing the store: set
RUSTMAN_SECRET_STORE=fileto use only.rustman/secrets.yamland never touch the keychain (useful in CI and containers).RUSTMAN_SECRET_STORE=keychain, or leaving it unset, means the keychain with the file fallback.
When a value exists in both places, the keychain wins. Storing a secret in the keychain removes any old copy from the file.
Redaction
Secret values never appear in any artifact Rustman produces: terminal output, logs, history, reports, copy-as-curl and error messages. They’re replaced by «redacted:<name>», for example «redacted:api_token». The values of the Authorization, Proxy-Authorization, Cookie and Set-Cookie headers are always replaced too, even when they don’t come from a secret:
Authorization: «redacted:Authorization»
Rustman tracks which bytes of a request came from a secret, and also scans every output for the secret values themselves. That second check catches a server that echoes a secret back in its response, as is or in the form a common encoder writes it. It covers the secrets the requests of the command reference (every request of a rustman run, from its first request on, whether or not that request sends them; the one request of rustman send or history replay), resolved before anything is sent, plus captured values that became secrets (see below). An environment secret no request of the command references is not read from the store, so it is not recognized if a server happens to send it. The forms matched:
- JSON string escapes (
\",\\, control characters), each with or without\/for/(PHP), with or without\u0026,\u003cand\u003efor&,<and>and\u2028and\u2029for U+2028 and U+2029 (Go), and with non-ASCII characters as is or as\uXXXXescapes in upper- or lowercase hex (Python, PHP); - Rust
Debugescapes; - percent-encoding in upper- or lowercase hex: every byte but
A-Z a-z 0-9 - . _ ~encoded, with a space as%20or as+(form encoding); the same leaving/as is (Python’squote); or leaving!'()*as is (JavaScript’sencodeURIComponent); - W3C Baggage value encoding (space,
,,;,\,"and%escaped, everything else printable kept), the form abaggageheader carries; - HTML escapes of
&,<and>as&,<and>, with"and'as"and'(Python),"and', or"and'(Go); or every character but letters and digits as a decimal entity such as/.
A secret value longer than 8 KiB is redacted in output only as is, not in these encoded forms: building a matcher over the encoded forms of very long values would take memory out of proportion. Captures are still checked for it through decoding (below), so a captured echo of it in any of these forms is still treated as a secret: never persisted, and redacted wherever a later request uses it.
Not covered: Java’s URLEncoder and PHP’s urlencode (which keep * and encode ~), XML escapes ('), hexadecimal HTML entities other than ', and Go’s \u0008 and \u000c for backspace and form feed.
Redaction happens before anything is quoted or shortened: an assertion message that quotes 200 characters of a body, or the 64 KiB preview of a large body, never ends with the start of a secret, and never splits a «redacted:<name>» placeholder.
Two kinds of files are working state rather than artifacts, and hold what the server sent as is: the cookie jar (.rustman/cookies/), which keeps a cookie whose value echoes a secret so it can be sent back, and a large response body spilled to .rustman/bodies/ while history keeps its entry. Both are readable by the current user only and live in the git-ignored .rustman/ folder.
A secret the server transforms before echoing it (base64-encodes it, changes its case, hashes it, splits it) is not recognized, and is shown as the server sent it. Only the forms listed above are matched.
A captured value that holds any piece of a known secret at least 4 characters long (a capture that straddles the secret, or a masked echo such as ****wP3K) is treated as a secret for the rest of the run and never persisted (see Captures). The piece counts as is, or once the captured value is percent-decoded (+ as a space or as is), JSON-unescaped (\uXXXX, \/, \", \\…) or HTML-unescaped (named and numeric entities), so %2Fc%2Fd%2Fe%2F reveals a/b/c/d/e/f/g; invalid sequences are left as they are. Pieces shorter than 4 characters are too common to tell apart from other text and are not recognized.
Short secrets may also redact unrelated text: every occurrence of the value is replaced wherever it appears, so a 4-digit PIN 1234 also turns "duration_ms":1234 in a report into "duration_ms":«redacted:pin», and a secret shorter than 4 characters is matched in almost any text. rustman secret set warns when it stores a value shorter than 8 characters.
The only exception is an explicit, per-command opt-in, --show-secrets, which affects terminal output only: history, reports and logs stay redacted. rustman send and rustman history replay accept it to print the response headers and body as received, and rustman export curl accepts it to print the real values in the command. Without it, send and replay print the response redacted, a large body streamed from its spill file too:
| Output | Body |
|---|---|
| default (status, headers, body) | redacted |
--body-only | redacted |
--show-secrets (with or without --body-only) | as received |
-o <file> | as received |
A binary body (any body that is not valid UTF-8, such as an image, or JSON in Latin-1) is redacted byte by byte like a text one: every other byte is printed as received. -o writes the file you named byte for byte, as curl -o does: it is how to save a body exactly (an image, say), so treat that file like the response itself.
An end-to-end test (crates/rustman-cli/tests/e2e.rs) checks this contract: it runs a workspace through init, secret set, run with the json and junit reporters and -vvv logs, export curl, a failing request, and history list, show and replay, then searches every file it produced and everything it printed for the secret, and finds nothing. Its secret is non-ASCII and contains a ", and the server also echoes it JSON-escaped, in a failing assertion message cut mid-secret and across the cut of a spilled body’s preview.
The CI pattern
CI systems keep secrets in their own secret variables, and runners usually have no OS keychain. Give CI its own environment (environments/ci.yaml above) that declares the same secrets, and feed each one from a CI secret variable into the file store at the start of the job:
$ printf '%s' "$API_TOKEN" | RUSTMAN_SECRET_STORE=file rustman secret set api_token --env ci
stored secret 'api_token' for environment 'ci' in .rustman/secrets.yaml
$ RUSTMAN_SECRET_STORE=file rustman secret list --env ci
ci/api_token set
Then select the environment with RUSTMAN_ENV=ci (or --env ci) and keep RUSTMAN_SECRET_STORE=file set for the rest of the job. Because api_token stays a declared secret, it is redacted from reports and logs like any other secret. printf '%s' keeps the value off the command line, so it doesn’t show up in the process list or in the job log.
For example, in GitHub Actions:
env:
RUSTMAN_ENV: ci
RUSTMAN_SECRET_STORE: file
steps:
- run: printf '%s' "$API_TOKEN" | rustman secret set api_token
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
A request can also read an OS environment variable directly with {{$env NAME}}. Such values are not secrets, so only the sensitive headers are redacted. Prefer a declared secret for credentials.
Clean up at the end of a job on a shared runner:
$ RUSTMAN_SECRET_STORE=file rustman secret rm api_token --env ci
removed secret 'api_token' from environment 'ci'
Secret providers
Rustman can read secrets from where your team already keeps them: the OS keychain, environment variables, SOPS files, 1Password, HashiCorp Vault, a command you trust, and (in release builds) AWS, Google Cloud and Azure secret managers. A request names a secret with a secret reference. The value is fetched when the request is sent, used on the wire, and never written anywhere.
The behavior is specified in openspec/specs/secret-providers.
Secret references
headers:
- name: Authorization
value: Bearer {{secret:vault/kv/app/stripe#api_key}}
A reference is {{secret:<provider>/<path>[#<field>]}}:
<provider>is the name of a provider configured in[secret_providers.<name>].<path>is handed to that provider as is. Its meaning depends on the type (a Vault path, a 1Passwordvault/item/field, a SOPS file, an environment variable name…).#<field>picks a field of a structured secret (JSON or YAML), as a dotted key path:#db.password,#hosts.0. Strings come out as they are, numbers and booleans as text, objects and arrays as JSON.
The path and field may contain spaces, as 1Password vault and item names often do ({{secret:op/Eng Team/Stripe Key/api token}}), but not at either end; the provider name may not. Tabs, line breaks and braces are not allowed anywhere in a reference.
References work anywhere {{variable}} interpolation does: URLs, query parameters, headers, bodies, auth fields, and the other request kinds. A reference without a path is reported when the workspace loads:
api.rman.yaml:5: invalid secret reference 'secret:vault' (expected secret:<provider>/<path>)
Environment variables backed by a provider
An environment variable can take its value from a provider:
# environments/prod.yaml
variables:
base_url: https://api.example.com
api_token: {secret: "op/Engineering/Stripe/token"}
{{api_token}} then resolves through the op provider when a request is sent with --env prod. It behaves like any secret: it is redacted as «redacted:api_token», and the environment file keeps the reference. Saving the environment from the TUI writes it back unchanged.
When values are fetched
Only when a request is about to be sent, and only for that request. Loading the workspace, listing requests, opening the TUI, browsing and rendering request definitions (rustman export snippet placeholders, agent tools) never contact a provider. Saved request and environment files always keep the reference text.
All references of one request are fetched together, at most 4 at a time.
Configuring providers
Providers are declared in rustman.toml. The workspace file holds settings only, never credentials: every provider type gets its credentials from its own native chain (environment variables, its CLI’s login, files in your home directory).
[secret_providers.ci]
type = "env"
timeout_ms = 5000
cache_ttl_s = 60
Every provider accepts:
| Key | Default | Meaning |
|---|---|---|
type | (required) | One of the types below. |
timeout_ms | 10000 | How long one fetch may take. A fetch that takes longer is unresolved, with <provider>: timed out after <n> ms. |
cache_ttl_s | 300 | How long a fetched value is reused, in seconds. 0 disables caching. |
Keys that look like credentials are refused in rustman.toml, with exit code 2: token, password, secret, secret_id, client_secret, private_key, and any key whose name contains token, password, passwd, secret, private_key, api_key, apikey, access_key or credential (ignoring case, - read as _), such as secret_access_key or auth_token:
error: rustman.toml:4: credentials must not be stored in rustman.toml (token)
The check covers nested values too (a credential key inside an inline table or array is reported by its dotted path, such as auth.token), and a URL with a user:password@ part in any string value is refused as credentials must not be stored in rustman.toml (address: URL with credentials). No provider setting is a table: a nested table such as [secret_providers.vault.auth] is an error (secret provider 'vault': 'auth' must not be a table, exit code 2) rather than being ignored, in rustman.toml and in the user config.
Unknown keys only produce a warning, like other rustman.toml keys.
The user config
Your own config file, config.toml in the user config directory, can also declare [secret_providers.*]:
| Platform | User config file |
|---|---|
| Linux | $XDG_CONFIG_HOME/rustman/config.toml, else ~/.config/rustman/config.toml |
| macOS | $XDG_CONFIG_HOME/rustman/config.toml, else ~/.config/rustman/config.toml |
| Windows | %APPDATA%\rustman\config.toml |
A cloned workspace is untrusted input, so anything that makes Rustman run a program is accepted only from the user config: cmd providers, the binary paths op_path and gpg_path, and the cloud providers’ endpoint (which would otherwise let a workspace send your cloud credentials to a host of its choice). In rustman.toml they are refused with exit code 2 (cmd secret providers can only be defined in user config, or 'op_path' can only be set in user config).
For the same reason, a host named in rustman.toml never receives credentials Rustman finds on your machine. A Vault address from the workspace gets your token (VAULT_TOKEN, ~/.vault-token) or AppRole ids only when VAULT_ADDR names the same address or your user config sets address; otherwise resolution fails with vault: address <url> is set in rustman.toml; set VAULT_ADDR to it, or 'address' in user config, to send your Vault credentials there, an unresolved secret (exit code 3). An OIDC login is allowed, since that token is issued by the server itself. A 1Password connect_host works the same way with OP_CONNECT_HOST and OP_CONNECT_TOKEN. AWS region values must be region names ([a-z0-9-]), since they become part of the endpoint host.
A user table with a type defines a provider (or replaces the workspace’s provider of the same name). A user table without one overrides keys of the workspace’s provider of that name, which is how you point a shared onepassword provider at your own op binary:
# ~/.config/rustman/config.toml
[secret_providers.op]
op_path = "/opt/1password/op"
Provider types
| Type | Built | <path> |
|---|---|---|
keychain | always | <env>/<name> |
env | always | an environment variable name |
sops | always | a workspace-relative SOPS file |
onepassword | always | <vault>/<item>/<field> |
vault | always | <mount>/<path>[?version=<n>] |
cmd | always, user config only | passed as the last argument |
aws-secrets-manager | feature secrets-aws | a secret name or ARN |
aws-ssm | feature secrets-aws | a parameter path |
gcp-secret-manager | feature secrets-gcp | <secret>[@version] |
azure-key-vault | feature secrets-azure | <name>[/version] |
Official release binaries enable every cloud feature. A build without one still accepts the configuration, and every reference to it fails with:
secret provider type 'aws-secrets-manager' is not available in this build (feature secrets-aws)
keychain
The secrets rustman secret set stores (see Environments), read with <path> as <env>/<name>. It honors RUSTMAN_SECRET_STORE like the rest of Rustman.
[secret_providers.kc]
type = "keychain"
{{secret:kc/prod/api_token}} reads what rustman secret set api_token --env prod stored.
env
The process environment: <path> is the variable name. This is the usual CI provider.
[secret_providers.ci]
type = "env"
{{secret:ci/STRIPE_KEY}} is the value of STRIPE_KEY; an unset variable is unresolved.
sops
SOPS-encrypted YAML or JSON files inside the workspace. <path> is the file, relative to the workspace root; #field is a dotted key path into the decrypted document. Paths that leave the workspace are refused (sops: path escapes the workspace).
[secret_providers.sops]
type = "sops"
{{secret:sops/secrets/prod.sops.yaml#db.password}} is the decrypted db.password.
- age recipients are decrypted natively. Identities come from
SOPS_AGE_KEY(inline keys),SOPS_AGE_KEY_FILE, or SOPS’ default key file (sops/age/keys.txtin$XDG_CONFIG_HOME,~/Library/Application Supporton macOS,~/.configon Linux,%APPDATA%on Windows). - PGP recipients are decrypted by running an installed
gpg(gpg --batch --decrypt), found onPATHor atgpg_pathfrom the user config. Without it:sops: PGP decryption requires gpg, which was not found. - The file’s MAC is checked before any value is returned; a modified file fails with
sops: MAC mismatch in <file>.
onepassword
1Password items, with <path> as <vault>/<item>/<field> (or <vault>/<item>/<section>/<field>). Names may contain spaces. A path with fewer parts fails with onepassword: path '<path>' must be <vault>/<item>/<field> before op or Connect is contacted.
[secret_providers.op]
type = "onepassword"
By default the provider runs the 1Password CLI: op read op://<vault>/<item>/<field>. Sign in once with op signin (or the desktop app integration); a signed-out CLI fails with onepassword: not signed in (run 'op signin'). account selects an account when you have several; op_path (user config only) names the binary.
For CI, point the provider at a 1Password Connect server. Its token is read from OP_CONNECT_TOKEN, never from the file:
[secret_providers.op]
type = "onepassword"
connect_host = "https://connect.example.com"
vault
HashiCorp Vault KV secrets. <path> starts with the mount; the provider asks Vault whether the mount is KV v1 or v2 (once per mount) and reads ?version=<n> from KV v2.
[secret_providers.vault]
type = "vault"
address = "https://vault.example.com"
namespace = "team-a"
auth = "token"
{{secret:vault/kv/app/db?version=3#password}} reads version 3 of kv/app/db and returns its password field.
addressdefaults toVAULT_ADDR.namespaceis sent asX-Vault-Namespace(Vault Enterprise and HCP).auth = "token"(the default) usesVAULT_TOKEN, else the~/.vault-tokenfile thatvault loginwrites.auth = "approle"logs in once per session withVAULT_ROLE_IDandVAULT_SECRET_IDfrom the environment;mountchanges the auth mount (defaultapprole).auth = "oidc"opens your browser for an OIDC login once per session and keeps the token in memory.rolepicks the Vault role,mountthe auth mount (defaultoidc), andoidc_portthe local callback port (default8250). The role must allowhttp://localhost:8250/oidc/callbackas a redirect URI, as forvault login -method=oidc.
[secret_providers.vault]
type = "vault"
address = "https://vault.example.com"
auth = "oidc"
role = "developer"
A 403 is reported as vault: permission denied for <path>, without the token.
cmd
Runs a command you trust and uses its trimmed standard output. The argv runs directly, with no shell, and <path> is appended as the last argument. Allowed in the user config only.
# ~/.config/rustman/config.toml
[secret_providers.pass]
type = "cmd"
command = ["pass", "show"]
{{secret:pass/work/api}} runs pass show work/api. A non-zero exit fails with pass: command failed (exit status <n>); its output is never shown. Since the path comes from the workspace, a path starting with - is refused (pass: path '<path>' must not start with '-') so it cannot pass an option to your command. A command that does not finish within the provider’s timeout_ms is killed; on Linux and macOS so are the programs it started (it runs in a process group of its own, so it cannot prompt on the terminal), while on Windows only the command itself is.
Cloud providers
The cloud types are thin REST clients on Rustman’s own HTTP engine: no cloud SDK and no system library. Each one finds credentials through its platform’s documented chain, in the same order as the official SDKs, so whatever already works for the platform’s CLI works here. Instance metadata endpoints, which exist only on cloud machines, get 1 s to answer.
endpoint (user config only, like every setting that could send credentials elsewhere) points a provider at an emulator such as LocalStack:
# ~/.config/rustman/config.toml
[secret_providers.localstack]
type = "aws-secrets-manager"
region = "us-east-1"
endpoint = "http://localhost:4566"
Release binaries include all three (cargo feature cloud-secrets of rustman-cli); a source build adds them with cargo build --features rustman-cli/cloud-secrets, or one at a time with secrets-aws, secrets-gcp or secrets-azure.
aws-secrets-manager and aws-ssm
[secret_providers.aws]
type = "aws-secrets-manager"
region = "eu-west-1"
profile = "prod"
[secret_providers.ssm]
type = "aws-ssm"
region = "eu-west-1"
{{secret:aws/prod/db#password}} returns the password field of the JSON secret prod/db (<path> is a secret name or ARN; a binary secret must be UTF-8 text). aws-ssm reads a parameter with decryption; a reference cannot start its path with /, so {{secret:ssm/app/key}} reads /app/key.
regiondefaults toAWS_REGION, thenAWS_DEFAULT_REGION. Without one, its references are unresolved withaws-secrets-manager: no region (set 'region' or AWS_REGION)(exit code 3).- Credentials come from the AWS default chain:
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN, the shared profile (AWS_PROFILE, elsedefault) in~/.aws/credentialsand~/.aws/config, container credentials (ECS, EKS Pod Identity), then the EC2 instance metadata service (IMDSv2;AWS_EC2_METADATA_DISABLED=trueskips it). Withprofile, only that profile is used. Profiles that need SSO, a role orcredential_processare refused: export temporary credentials (aws configure export-credentials --format env) instead. - Nothing found:
aws-secrets-manager: no credentials found in the default chain. - Requests are signed with SigV4; the endpoint is
https://secretsmanager.<region>.amazonaws.com(orssm.), orAWS_ENDPOINT_URL_SECRETS_MANAGER,AWS_ENDPOINT_URL_SSM,AWS_ENDPOINT_URL.
gcp-secret-manager
[secret_providers.gcp]
type = "gcp-secret-manager"
project = "my-project"
<path> is <secret>[@version] (default latest): {{secret:gcp/db-password@3}}.
projectdefaults toGOOGLE_CLOUD_PROJECT, then the project of the credentials file.- Credentials come from Application Default Credentials: the file named by
GOOGLE_APPLICATION_CREDENTIALS(a service account key), else the filegcloud auth application-default loginwrites, else the metadata server of a Google Cloud machine. Workload identity federation files are refused. Nothing found:gcp-secret-manager: no credentials found (Application Default Credentials).
azure-key-vault
[secret_providers.azure]
type = "azure-key-vault"
vault = "my-vault"
<path> is <name>[/version], read from https://<vault>.vault.azure.net.
- Credentials come from
DefaultAzureCredential’s chain: a service principal fromAZURE_TENANT_ID,AZURE_CLIENT_IDandAZURE_CLIENT_SECRET, workload identity (AZURE_FEDERATED_TOKEN_FILE), managed identity (App Service, or the instance metadata service), then the Azure CLI (az login). Nothing found:azure-key-vault: no credentials found (DefaultAzureCredential).
Network settings
Provider calls (Vault, 1Password Connect and the cloud types) connect directly and verify servers against the operating system’s trust store. The workspace’s TLS files (ca_file, client certificates), insecure and proxy settings, and the HTTPS_PROXY/HTTP_PROXY environment variables, are not applied to them, so a workspace cannot weaken them. A server behind a private CA needs that CA in the system trust store, and a server reachable only through a proxy cannot be used.
Caching
Fetched values are kept in process memory only, per provider and path, for cache_ttl_s (300 s by default). Requests that need the same secret at the same time share one fetch, so a rustman run of 50 requests using {{secret:vault/kv/app#pw}} contacts Vault once. Cached values are zeroized when they expire and when the process exits; nothing is ever written to disk. In the TUI, the Refresh secrets palette action (secrets.refresh) clears the cache so the next send fetches again.
Failures and exit codes
A reference that cannot be resolved (missing secret or field, failed auth, timeout, provider error, unknown provider) stops its request before anything is sent:
unresolved secret vault/kv/app/db#user: field 'user' not found
unresolved secret lastpass/x: unknown secret provider 'lastpass' (configured: ci, vault)
It counts as a request error: rustman send and rustman run exit with code 3. A misconfigured provider (a credential, a command or a binary path in rustman.toml, an unknown type, a missing type) is a configuration error, exit code 2, reported when the configuration loads. A problem found only while resolving a reference (a provider type not in this build, a Vault without an address) makes that reference unresolved: exit code 3, in send, run and secret get alike. Messages never contain a secret value or a credential.
Redaction
Every fetched value joins the redaction set of environments for the life of the process. It is shown as «redacted:<provider>/<path>[#field]», or «redacted:<variable>» when it backs an environment variable, in terminal output, logs, history, reports, snippets and agent results, including when a server echoes it back.
rustman export curl, rustman export snippet and the TUI’s “Copy as…” never contact a provider: a reference is printed as «redacted:<provider>/<path>[#field]» (or «redacted:<variable>» for a provider-backed environment variable), even with --show-secrets, which reveals keychain secrets only. With --placeholders, references stay as written ({{secret:...}}).
The secret commands
$ rustman secret get vault/kv/app#pw
•••••••• (24 chars, vault)
$ rustman secret test
ci: ok
error: vault: authentication failed
$ rustman secret list-providers
NAME TYPE AUTH ORIGIN STATUS
ci env - workspace available
vault vault oidc workspace available
rustman secret get <ref>fetches a reference (<provider>/<path>[#field], also accepted as{{secret:...}}) and prints its length and provider, never the value.--revealprints the value, and only when standard output is a terminal:rustman secret get vault/kv/app#pw --reveal | catfails with--reveal requires an interactive terminal(exit code 2) before contacting the provider. A reference that cannot be resolved exits with code 3, whatever the cause (an unknown provider, or a type not in this build, included), the same codesendandrungive it.rustman secret test [<provider>]checks that each provider (or the one named) can authenticate and be reached, without reading a secret: Vault looks its token up, 1Password runsop whoami(or lists Connect vaults), the cloud types obtain a token (AWS reads a secret name that does not exist: a not-found answer means the keys were accepted). It exits with 0 when every check passes and 3 otherwise, an unknown provider name included; use it to fail a CI job early, before a long run.rustman secret list-providerslists each provider’s name, type, auth method, origin (workspaceoruser) and whether its type is in this build. It contacts no provider.--typeslists the provider types this build supports, without a workspace.
Agents
Agents (rustman mcp serve) can send requests that use secret references: they are resolved inside the engine, through the same providers and cache. No agent tool returns a value: get_request shows the reference text (Bearer {{secret:op/Eng/API/token}}), results show «redacted:op/Eng/API/token» even when a server echoes the value, and there is no tool that reads or tests a secret.
Agents cannot write references themselves. A tool call whose arguments contain a {{secret:...}} placeholder (an ad-hoc URL, header, body, JSON-RPC params, WebSocket frames, gRPC message or metadata, or vars) is refused with invalid_input (secret references ({{secret:...}}) are allowed only in saved request and environment files, not in tool arguments) before any provider is contacted, so a prompt-injected agent cannot choose which secret is fetched or where it is sent. Values inserted from variables and captures are never resolved again, so a server response that contains {{secret:...}} text is sent back as that text. Importers, including the agent-reachable import_openapi tool, write a {{secret:...}} reference found in an imported document escaped (\{{secret:...}}, see Importing collections and Importing OpenAPI), so a document cannot plant a reference either.
Plugins
A value a provider resolved reaches a plugin (an auth scheme’s parameters, a transformer’s message, an assertion’s exchange) only when the plugin holds secrets:read:<name>, where <name> is the environment variable the reference backs, or the reference itself (secrets:read:vault/kv/app#key) when the request uses {{secret:...}} directly. Without the grant the plugin sees «redacted:<name>». Captured secrets and secret data columns are treated the same way, and everything a plugin returns is redacted of all of them.
HTTP requests
How Rustman sends a kind: http request: transport and timeouts, redirects, TLS, proxies, cookies, auth helpers, the timing breakdown, response bodies, and curl import and export. The request file format itself is in request-files.md; variables and secrets are in environments.md.
The examples on this page are tested. The YAML files are written into one workspace that must load, every $ rustman ... line runs against it and must print the lines shown (crates/rustman-cli/tests/docs_http.rs), and the messages listed under Errors and warnings are produced by the engine (crates/rustman-http/tests/docs_http.rs).
Transport
Rustman uses its own HTTP stack (hyper with a timed connector and rustls); it does not use the system’s curl or TLS libraries.
https://URLs negotiate HTTP/2 through ALPN and fall back to HTTP/1.1.http://URLs use HTTP/1.1, unlesssettings.http2_prior_knowledge: true(HTTP/2 over cleartext, “h2c”).- Connections are reused between requests that share the same TLS, proxy and timeout settings.
- When a host name resolves to several addresses (for example
localhostas::1and127.0.0.1), Rustman tries them in resolver order and starts the next one if an attempt fails or has not connected within 250 ms; the first to connect is used (Happy Eyeballs, RFC 8305).
The exchange records the negotiated http_version (HTTP/1.1 or HTTP/2).
Timeouts
| Setting | Default | Covers |
|---|---|---|
timeout_ms | 30000 | The whole exchange: connect, send, response and body. Set in rustman.toml [defaults] or the request’s settings.timeout_ms; --timeout on rustman send and rustman run replaces both. |
connect_timeout_ms | 10000 | DNS, TCP connect, proxy tunnel and TLS handshake. Set in settings.connect_timeout_ms. |
A timeout fails the request with timeout after <n> ms (<phase>), where the phase is connect or response.
Redirects
Redirects are followed by default, up to max_redirects (10) hops, and every hop is recorded in the exchange. A 301, 302 or 303 turns a non-GET/HEAD request into a GET without a body; 307 and 308 keep the method and body. Credentials are dropped when a hop goes to another origin (scheme, host or port): Authorization, Proxy-Authorization, an explicit Cookie header (the cookie jar still sends the cookies that match the new host) and the api_key header or query parameter. Any other header whose value carries a secret (such as X-Api-Key: '{{token}}'), and a 307/308 body that carries one (such as a form with a client_secret), are dropped too, so a secret never follows a redirect to another server; the hop is still sent, without them, and the exchange gets the warning cross-origin redirect to <origin>: dropped header x-api-key, the body, which carry a secret. A secret is found the way output is redacted: a secret variable’s value, or a literal credential in Authorization, Cookie and the like, in any of its encoded forms. An aws_sigv4 request is signed again on each same-origin hop and not at all once a hop leaves the origin (see SigV4). Same-origin hops keep everything. With follow_redirects: false the 3xx response is returned as is. Too many hops fail with too many redirects (<max>).
# http/no-redirects.rman.yaml
version: 1
kind: http
name: Login redirect
url: https://app.example.com/login
settings:
follow_redirects: false
max_redirects: 3
TLS
Certificates and host names are verified against the operating system’s trust store, plus any ca_bundle (PEM) from rustman.toml [http] and the request’s settings.ca_bundle. With a ca_bundle, the operating system’s root certificates are loaded as a list next to the bundle, so OS-only checks such as revocation do not apply to that request. A failure starts with tls: certificate verification failed.
verify_tls: false (in [defaults] or the request’s settings) or --insecure on rustman send and rustman run turns verification off. Every exchange sent that way is flagged insecure: true, plain http:// ones included.
For mutual TLS, give a PEM certificate and key, or a PKCS#12 bundle whose passphrase comes from a secret variable:
# http/mtls.rman.yaml
version: 1
kind: http
name: Internal API with a client certificate
url: https://internal.example.com/health
settings:
ca_bundle: ../certs/dev-ca.pem
client_cert: ../certs/client.pem
client_key: ../certs/client.key
A client certificate in rustman.toml [http] (client_cert and client_key, or client_pkcs12 and client_pkcs12_password, with paths relative to the workspace root) applies to every request that sets none of its own; see request-files.md. The certificate is presented to the origin server only, never to an https:// proxy on the way.
# http/mtls-p12.rman.yaml
version: 1
kind: http
name: Internal API with a PKCS#12 bundle
url: https://internal.example.com/health
settings:
client_pkcs12: ../certs/client.p12
client_pkcs12_password: '{{p12_password}}'
Proxies
The proxy for a request is, in order: settings.proxy, rustman.toml [http] proxy, then the HTTPS_PROXY, HTTP_PROXY and ALL_PROXY environment variables (either case). NO_PROXY lists hosts that bypass a proxy taken from the environment. Supported schemes are http://, https:// and socks5://; https:// URLs go through an HTTP proxy with CONNECT. settings.proxy: none bypasses every proxy.
# http/via-socks.rman.yaml
version: 1
kind: http
name: Through the SOCKS tunnel
url: https://api.internal.local/status
settings:
proxy: socks5://127.0.0.1:1080
Cookies
Each environment has its own cookie jar, .rustman/cookies/<env>.json, kept across runs and following the RFC 6265 domain, path, expiry and Secure rules. A Set-Cookie received under staging is never sent with --env prod. settings.cookies: false leaves the jar out of one request, and an explicit Cookie header replaces the jar’s cookies. Jar files are readable by the current user only, and are written only when .rustman/ is a real folder (not a symbolic link) that Git ignores.
$ rustman cookies clear --env prod
no cookies stored for environment 'prod'
Headers
Unless the request sets them, every request carries User-Agent: rustman/<version> and Accept: */*. The body type sets a default Content-Type, which an explicit header replaces (exactly one is sent):
| Body type | Default Content-Type |
|---|---|
json | application/json |
text | text/plain; charset=utf-8 |
form | application/x-www-form-urlencoded |
multipart | multipart/form-data; boundary=… (a random boundary) |
file | application/octet-stream |
Content-Length and Host are always computed from the body and the URL. A request that sets a different value gets the computed one, and the exchange records a warning such as ignored stale Content-Length: 3 (sent the computed 10).
Auth
Auth is applied after variables are filled in, and never replaces an explicit Authorization header (or, for an API key, an explicit header of the same name).
| Type | Sends |
|---|---|
{type: basic, username, password} | Authorization: Basic <base64 of username:password> |
{type: bearer, token} | Authorization: Bearer <token> |
{type: api_key, name, value, in: header} | the header <name>: <value> (in defaults to header) |
{type: api_key, name, value, in: query} | the query parameter <name>=<value> |
{type: oauth2, ...} | Authorization: Bearer <access token> |
{type: digest, ...}, {type: aws_sigv4, ...}, {type: jwt, ...} | credentials computed per request; see Signature auth |
When a Basic username or password holds a secret, the encoded credential is redacted too, so a server that echoes the Authorization header back cannot leak it.
# http/me.rman.yaml
version: 1
kind: http
name: Me
url: '{{base_url}}/me'
auth:
type: bearer
token: '{{api_token}}'
# http/search.rman.yaml
version: 1
kind: http
name: Search
url: '{{base_url}}/search'
query:
- name: q
value: rust
auth:
type: api_key
name: key
value: '{{api_key}}'
in: query
OAuth2
grant: client_credentials gets a token from token_url with the client id and secret. grant: authorization_code also needs auth_url: Rustman opens the browser (and prints the URL) with a PKCE code_challenge_method=S256 challenge, and receives the code on a loopback listener at http://127.0.0.1:<ephemeral port>/callback. The listener serves at most 16 connections at once (each gets 5 s to send its request), and when accepting a connection fails (for example when the process is out of file descriptors) it retries after a delay that doubles from 10 ms up to 1 s, rather than spinning.
Tokens are cached per environment in the secret store, never in workspace files. A cached token is reused until shortly before it expires, refreshed with its refresh token when there is one, and acquired again when a request gets a 401. Calls to token_url never follow redirects, so the client secret and codes in the form cannot be re-posted elsewhere; point token_url at the final URL.
# http/oauth-login.rman.yaml
version: 1
kind: http
name: Profile
url: '{{base_url}}/profile'
auth:
type: oauth2
grant: authorization_code
auth_url: https://auth.example.com/authorize
token_url: https://auth.example.com/token
client_id: rustman-cli
scopes:
- profile
The authorization-code grant needs a person at a terminal. When rustman send or rustman run has no terminal on stdin (as in CI) and no cached token, the request fails with oauth2: interactive login required (run 'rustman auth login <request>'). Run rustman auth login http/oauth-login --env prod once on a workstation; later runs reuse and refresh the cached token. When the token goes to .rustman/secrets.yaml rather than the OS keychain (no keychain, or RUSTMAN_SECRET_STORE=file), rustman auth login says so once: warning: OAuth2 tokens are stored in .rustman/secrets.yaml (git-ignored, readable by you only), not in the OS keychain. See secret storage.
Timing breakdown
Each exchange records, in milliseconds with microsecond precision:
| Phase | From → to |
|---|---|
dns | name lookup |
connect | TCP connect (and proxy tunnel) |
tls | TLS handshake |
ttfb | connection ready (request start on a reused connection) → first response byte |
download | first response byte → last body byte |
total | the whole exchange; at least the sum of the phases |
auth | a Digest challenge round trip answered before the final one (absent otherwise); total includes it |
Phases that did not happen are null, never 0: tls on plain HTTP, dns for an IP address, and dns, connect and tls on a reused connection.
Response bodies
- Bodies are decompressed (
gzip,br,deflate,zstd) unlesssettings.decompress: false. An unknownContent-Encodingleaves the body as received, with a warning. Decoding goes through a fixed 64 KiB buffer, so memory stays bounded whatever the compression ratio, and a body that decodes to more than 1 GiB fails withnetwork: the decompressed response body is larger than <n> bytes(usedecompress: falseto keep such a body encoded). - A body that is not decoded (no
Content-Encoding, ordecompress: false) is limited byrustman.toml [http] max_download_bytes(1 GiB): past it the request fails withnetwork: the response body is larger than <n> bytes, so an endless stream cannot fill the disk before the timeout. - Bodies up to
rustman.toml [http] max_body_bytes(10 MiB) stay in memory. A larger body is streamed to.rustman/bodies/<uuid>.bin(a random name per exchange; outside a workspace, a folder of the current user in the temp folder:rustman-bodies-<uid>on Unix,rustman-bodiesin the per-user temp folder on Windows); the exchange keeps its first 64 KiB as a preview and its fullsize_bytes. The file is removed again when the request fails or times out before the body ends, and redirect hops keep none. Once the request is done, the file is kept only while a history entry refers to it: with--no-history, history disabled or outside a workspace, it is deleted when the command has used it (afterrustman sendprinted the body). Pruning history deletes it with its entry, along with any spill file no entry refers to that is more than an hour old, andrustman history cleardeletes every spill file. Spill files are readable by the current user only, and, like cookie jars, are written only when.rustman/is a real, git-ignored folder. A spill folder that is a symbolic link, or (on Unix) belongs to another user, is refused; one of ours that others can access is set back to mode0700. A spill file is always created new, never opened when something already exists at its path. A 50 MiB download keeps well under 16 MiB of memory for its body. - A body that is not valid UTF-8 (an image, a PDF) is marked
binary: true, and its bytes are kept exactly as received, never decoded lossily.
# rustman.toml
[workspace]
name = "shop"
version = 1
[http]
max_body_bytes = 1048576 # spill bodies over 1 MiB
max_download_bytes = 104857600 # fail undecoded bodies over 100 MiB
Curl import and export
Import
rustman import curl reads a curl command, from one argument, from its words after --, or from stdin, and prints the equivalent request file. --out <file> writes it instead (an existing file is never replaced).
$ rustman import curl "curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{\"name\":\"ana\",\"admin\":false}'"
version: 1
kind: http
name: POST /users
method: POST
url: https://api.example.com/users
body:
type: json
content:
name: ana
admin: false
| curl option | Becomes |
|---|---|
-X, --request | method |
URL, --url | url (http:// is added when the scheme is missing, unless the URL starts with a variable such as {{base_url}}) |
-H, --header | headers |
-d, --data, --data-ascii, --data-binary, --data-raw, --data-urlencode, --json | body: json when the content type is JSON, form for a=1&b=2 data, a file body for @file, else text |
-F, --form, --form-string | a multipart body (@file parts and ;type= included) |
-u, --user | auth: {type: basic} |
-b, --cookie | a Cookie header (cookie files are not read) |
-k, --insecure | settings.verify_tls: false |
-L, --location | settings.follow_redirects: true |
--compressed | an Accept-Encoding header (responses are always decompressed) |
-G, --get | the -d data becomes query parameters of a GET (an @file is not read) |
Data without -X makes the method POST, as in curl. A Content-Type header that the body type implies is left out of the file. Every other option is reported, not silently dropped:
$ rustman import curl "curl --limit-rate 1k https://api.example.com/health"
warning: ignored unsupported curl option --limit-rate
version: 1
kind: http
name: GET /health
method: GET
url: https://api.example.com/health
Export
rustman export curl <request> prints the request, with its variables filled in for the active environment, as a single POSIX-shell-quoted curl command. Secrets are replaced by «redacted:<name>» unless --show-secrets is passed (a secret provider reference is never fetched: it is always printed as «redacted:<provider>/<path>[#field]»), as are the values of Authorization, Cookie and the other credential headers. A request holding a NUL byte (in its body, for example) is printed as a comment with a warning instead, since a shell argument cannot carry one.
# environments/prod.yaml
variables:
base_url: https://api.example.com
secrets:
- api_token
- api_key
- p12_password
With the secret api_token set for prod:
$ rustman export curl http/me --env prod
curl 'https://api.example.com/me' -H 'Authorization: «redacted:api_token»' -L
$ rustman export curl http/no-redirects
curl 'https://app.example.com/login'
Exporting and importing back gives the same method, URL, headers and body. An OAuth2 token is not part of the export (a warning says so), since it only exists once the request runs. For other languages and tools, see Code snippets.
Errors and warnings
The messages on this page, as Rustman prints them (<...> marks the variable part):
timeout after 500 ms (response)
too many redirects (10)
tls: certificate verification failed for <host>: <reason>
network: the decompressed response body is larger than <n> bytes
network: the response body is larger than <n> bytes
oauth2: interactive login required (run 'rustman auth login <request>')
ignored stale Content-Length: 3 (sent the computed 10)
ignored Host: <value> (sent the URL's host <host>)
cross-origin redirect to <origin>: dropped <parts>, which carry a secret
ignored unsupported curl option <option>
Request failures (network, TLS, timeout, proxy, auth) exit with code 3; a curl command that cannot be imported exits with code 2.
Signature auth: Digest, AWS SigV4 and JWT
Besides basic, bearer, api_key and oauth2 (see HTTP requests), a request or _collection.yaml can use three auth types whose credentials are computed for every request: digest, aws_sigv4 and jwt. Their fields are interpolated like any other auth field, so keys and passwords normally come from secret variables. None of them replaces an explicit Authorization header.
| Type | Sends |
|---|---|
{type: digest, username, password} | Authorization: Digest ..., answering the server’s 401 challenge |
{type: aws_sigv4, region, service, ...} | Authorization: AWS4-HMAC-SHA256 ..., X-Amz-Date, X-Amz-Content-Sha256 and, with a session token, X-Amz-Security-Token |
{type: jwt, algorithm, ...} | Authorization: Bearer <jwt> (or a named header, or a query parameter) with a token signed for this request |
Digest
# auth/digest.rman.yaml
version: 1
kind: http
name: Digest
url: '{{base_url}}/protected'
auth:
type: digest
username: ana
password: '{{password}}'
Digest follows RFC 7616:
- The first request goes out without credentials.
- On a
401withWWW-Authenticate: Digest, Rustman computes the answer and sends the request once more, withnc=00000001and a freshcnonce. A second401(a wrong password, for example) is returned as the response; there is no further retry. - The nonce is cached per environment, host and realm for the rest of the process (a
rustman run), so later requests to the same host send credentials up front with the next count (nc=00000002, …). A401withstale=true(or any401to such a request) gets one retry with the new nonce, counting from00000001again.
Supported: MD5, MD5-sess, SHA-256, SHA-256-sess, qop=auth, and challenges without qop (RFC 2069). When the server offers several Digest challenges (one per algorithm, in one or several WWW-Authenticate headers), Rustman answers the first supported one, preferring SHA-256 (and SHA-256-sess) over MD5; if none is supported, the first one’s error is reported. A challenge that only offers unsupported qop values fails naming them, for example digest: unsupported qop auth-int; one with userhash=true fails with digest: unsupported userhash.
Because the request may be sent twice, a file or multipart body is buffered in memory, up to 10 MiB. A larger body fails before anything is sent, with digest: body larger than 10 MiB cannot be replayed (exit code 3).
When a challenge was answered, the exchange’s timing breakdown has auth: the duration of the challenge round trip. total covers both round trips. In the JSON report these are auth_ms and total_ms.
AWS SigV4
# auth/s3-get.rman.yaml
version: 1
kind: http
name: S3 object
url: https://bucket.s3.amazonaws.com/a.txt
auth:
type: aws_sigv4
region: us-east-1
service: s3
access_key: '{{aws_key}}'
secret_key: '{{aws_secret}}'
Requests are signed with the signer of the AWS SDK for Rust (the aws-sigv4 crate). Signing is the last step before a request is sent, after variables, default headers, collection headers and cookies, so all of them are part of SignedHeaders (except User-Agent, Proxy-Authorization and the other headers proxies may change). Every redirect hop on the request’s origin (same scheme, host and port) is signed again for its own URL. A redirect to another origin is followed unsigned: that hop and every later one, even one that comes back to the original origin, carry no Authorization, X-Amz-Date, X-Amz-Content-Sha256 or X-Amz-Security-Token, so another server never receives a signature, the access key or the session token. For service: s3 the path is signed as sent; other services use SigV4’s double encoding and path normalization. The query string is canonicalized by the same crate; a literal + or * in a query value may be canonicalized differently by other SigV4 implementations (botocore, for example), so percent-encode them (%2B, %2A) when the server must verify the signature.
Credentials come from one of three sources:
| Fields | Credentials |
|---|---|
access_key, secret_key, optional session_token | the given values, usually secret variables |
from: env | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and optional AWS_SESSION_TOKEN |
from: profile, profile: <name> | the static keys of that profile in ~/.aws/credentials (or ~/.aws/config; AWS_SHARED_CREDENTIALS_FILE and AWS_CONFIG_FILE override the paths) |
A profile that uses SSO, an assumed role or credential_process fails, naming the key: aws_sigv4: profile 'dev' uses sso_start_url, which is not supported; export temporary credentials or use a secret provider. The secret key and session token, whatever their source, are redacted everywhere as «redacted:aws_secret_key» and «redacted:aws_session_token».
# auth/api-gateway.rman.yaml
version: 1
kind: http
name: API Gateway
url: https://abc123.execute-api.eu-west-1.amazonaws.com/prod/items
auth:
type: aws_sigv4
region: eu-west-1
service: execute-api
from: env
X-Amz-Content-Sha256 is the SHA-256 of the exact body bytes sent. unsigned_payload: true sends UNSIGNED-PAYLOAD instead and skips hashing the body, which S3 accepts for large uploads. The body itself is still read into memory before it is sent, as every request body is. When AWS rejects a request because of the clock (RequestTimeTooSkewed or Signature expired), the exchange gets the warning check the system clock; request was signed at <X-Amz-Date>.
JWT
# auth/jwt.rman.yaml
version: 1
kind: http
name: JWT
url: '{{base_url}}/me'
auth:
type: jwt
algorithm: HS256
secret: '{{jwt_secret}}'
claims:
sub: '{{user_id}}'
scope: read
A new token is signed for every request, so two requests a few seconds apart carry different tokens. The claims are interpolated (user_id=42 gives "sub": "42"), and iat (now) and exp (iat + ttl) are added unless claims sets them.
| Field | Meaning |
|---|---|
algorithm | HS256, HS384, HS512, RS256 or ES256 |
secret | the HMAC secret (HS algorithms only), usually a secret variable; a secret that resolves to empty text fails the request with jwt: HS256 secret is empty |
private_key | a PEM private key (RS256, ES256), usually a secret variable |
private_key_file | a PEM private key file, relative to the workspace root; it may not leave the workspace |
claims | the token’s claims |
header | extra JOSE header fields: kid, typ, cty, jku, jwk, x5u, x5c, x5t, x5t#S256 |
ttl | the lifetime: 30s, 5m (the default), 1h |
in, name | in: header (default) sends Authorization: Bearer <jwt>, or the bare token in the header name; in: query sends it as the query parameter name |
RS256 needs an RSA key and ES256 an EC (P-256) key in PKCS#8 form (-----BEGIN PRIVATE KEY-----). A key file of the wrong kind fails when the workspace loads, with jwt: RS256 requires an RSA private key.
# auth/jwt-rs256.rman.yaml
version: 1
kind: http
name: JWT RS256
url: '{{base_url}}/me'
auth:
type: jwt
algorithm: RS256
private_key_file: keys/service.pem
claims:
iss: rustman
header:
kid: key-1
ttl: '1h'
Generated tokens never reach history, reports or the terminal: they are shown as «redacted:jwt», and history records the header as Authorization: Bearer «redacted:jwt».
Code snippets
rustman export snippet --lang <lang> <request> prints a request as code for another language or tool, with its variables filled in for the active environment. It uses the same resolved request as rustman export curl, and the same redaction.
Languages
rustman export snippet --list prints the supported languages:
| Id | Prints | Runs with |
|---|---|---|
curl | the rustman export curl command | curl |
httpie | an http command | HTTPie 3.2 or later |
wget | a wget command | GNU Wget |
python-requests | a script using requests | Python 3 with requests |
python-httpx | a script using httpx | Python 3 with httpx |
js-fetch | an ES module using fetch | Node.js 20 or later (or a browser, without files) |
node-axios | an ES module using axios | Node.js with axios |
go | a main.go using net/http | Go |
rust-reqwest | a main.rs using blocking reqwest | Rust, with the reqwest line from the snippet’s first comment |
powershell | Invoke-WebRequest with splatted parameters | PowerShell 7 |
csharp | top-level statements using HttpClient | .NET 10 (dotnet run snippet.cs) |
fetch, python and rust are accepted as aliases of js-fetch, python-requests and rust-reqwest. Any other id exits with code 2 and lists the supported ones:
error: snippet: unknown language 'cobol' (supported: curl, httpie, wget, python-requests, python-httpx, js-fetch, node-axios, go, rust-reqwest, powershell, csharp)
Example
# users/create.rman.yaml
version: 1
kind: http
name: create-user
method: POST
url: '{{base_url}}/users'
auth:
type: bearer
token: '{{api_token}}'
body:
type: json
content:
name: Ada
admin: false
With base_url: https://api.example.com and the secret api_token set for prod:
$ rustman export snippet --lang python-requests users/create --env prod
import requests
response = requests.post(
"https://api.example.com/users",
json={"name": "Ada", "admin": False},
headers={
"Authorization": "Bearer «redacted:api_token»",
"Content-Type": "application/json",
},
)
print(response.status_code)
print(response.text)
Every snippet sends the method, URL (query included), headers and body Rustman would send, plus the Content-Type the body implies. A multipart body names its files relative to the workspace root, so run the snippet from there. Redirects and verify_tls: false are carried over where the language has a switch for them; js-fetch and node-axios cannot turn TLS verification off and print a warning instead. Two multipart limits also print a warning: wget cannot send multipart bodies at all (the snippet says so in a comment), and httpie sends a text part without its own Content-Type.
Rustman sends a non-ASCII header value (X-Label: café) as UTF-8 bytes. Python’s and Node’s clients would write a text value as Latin-1 (or refuse it), and reqwest refuses one, so their snippets pass the bytes: "café".encode() in Python, String.fromCharCode(...new TextEncoder().encode("café")) in JavaScript, "café".as_bytes() in Rust. The .NET client behind powershell and csharp may refuse such a value, so those print a warning: warning: snippet: csharp may refuse the non-ASCII value of header X-Label. A JSON body can be re-encoded by the client (Python’s json= writes é as \u00e9 and adds spaces); the document sent is the same.
Values stay text
Whatever a header, query, form or multipart value holds, the snippet sends it as text and runs nothing:
- Shell snippets (
curl,httpie,wget) single-quote every word that is not plain letters, digits and-_=/,.+, so$(...), backticks,!and line breaks are not expanded; a word starting with=is quoted too (zsh expands=name). No user value can start an option:httpiealways writes--before the method, so a header or part name starting with-(-oFILE,--session-read-only=…) is a request item;wgetalways writes--before the URL;curlgives every value as the argument of its option (-H,--form-string,--data-raw) and a URL starting with-after--url. A shell argument cannot carry a NUL byte, so a request holding one (in its body, for example) gets a comment instead of a command, with a warning: send it with rustman or put the body in a file. httpiereads:,;,=and@in a request item as separators, and a header value starting with=@or:=@(or a part value starting with@) as “read this file”. The snippet backslash-escapes every such character in a name and the first character of a value, writes an empty header asName;(Name:would leave it out), and passes the body as--raw=<text>. httpie cannot write a backslash right before one of those characters: such a header or part is left out with a warning. A method that is not made of letters is read by httpie as the URL, so the snippet is a comment and a warning instead.curlwrites text parts with--form-string, which never reads a file, and quotes-Fvalues. An empty header becomes-H 'Name;'(curl dropsName:). A header name that is not an HTTP token (-H @filereads headers from a file), a part name holding=, and a part content type other than a plaintype/subtype; param=value(curl reads;headers=@fileafter it) are left out with a warning.- Code snippets write every value as a string literal of the language (C# also escapes U+0085, U+2028 and U+2029, which end a line there).
Known fidelity limits
Snippets send the same request as rustman except in these cases:
node-axiosaddsContent-Type: application/x-www-form-urlencodedto aPOSTwithout a body.js-fetchandnode-axiossend a text part that has a content type as a file part (aBlob), with a file name.goescapes"in a part name differently (\"instead of%22).- A backslash in a part name is doubled in
python-requests,python-httpxandgo. - JavaScript reads a JSON body into numbers, so huge integers lose precision and
-0becomes0. - File paths holding
\, and URLs with invalid percent-escapes, may be read differently by each tool.
Secrets
Secrets are replaced by «redacted:<name>» unless --show-secrets is passed (a secret provider reference is never fetched: it is always printed as «redacted:<provider>/<path>[#field]»), as are the credentials in Authorization, Cookie and the other credential headers. In code snippets a credential header keeps its scheme, as in "Bearer «redacted:api_token»"; the curl snippet is exactly the rustman export curl command. Warnings go to stderr and never contain secret values.
Signature auth
Digest, AWS SigV4 and JWT auth are computed per request (from a server challenge or the current time), so they cannot be written as a fixed header. A snippet uses the language’s own helper where there is one:
| Auth | Helper |
|---|---|
digest | --digest -u in curl, --auth-type digest --auth= in httpie, --user/--password in wget, HTTPDigestAuth in python-requests, httpx.DigestAuth in python-httpx |
aws_sigv4 | --aws-sigv4 'aws:amz:<region>:<service>' -u in curl |
jwt | none |
Otherwise the snippet starts with a comment naming the auth type, and stderr has a warning:
$ rustman export snippet --lang go aws/list-buckets --env prod
warning: snippet: aws_sigv4 auth cannot be precomputed for go
// aws_sigv4 auth: sign with the AWS SDK signer
package main
...
Placeholder mode
--placeholders keeps variables unresolved, to show how a request is built rather than one instance of it: {{name}} in curl, httpie and wget, and constants declared at the top of code snippets. Secrets are never read in this mode and always print as «redacted:<name>» (when the environment declares them), so --show-secrets cannot be combined with it.
# users/get.rman.yaml
version: 1
kind: http
name: get-user
url: '{{base_url}}/users/{{id}}'
$ rustman export snippet --lang python --placeholders users/get --env prod
import requests
BASE_URL = "https://api.example.com"
ID = "42"
response = requests.get(
BASE_URL + "/users/" + ID,
)
print(response.status_code)
print(response.text)
$ rustman export snippet --lang httpie --placeholders users/get --env prod
http --ignore-stdin --follow -- GET '{{base_url}}/users/{{id}}'
A constant takes the variable’s value in the selected environment, or {{name}} when it has none.
Request kinds
kind: http, kind: graphql and kind: jsonrpc requests have snippets. A GraphQL request exports as the HTTP POST it sends: {"query", "operationName", "variables"} as JSON, with Accept: application/graphql-response+json, application/json. The document is never interpolated; its variables are. A JSON-RPC call or batch to an http(s) endpoint exports as its POST: the envelope (or the batch array) with explicit ids as written and sequential ids for the rest; a ws(s) endpoint or a subscription exits with code 2. Any other kind exits with code 2:
error: snippet: kind 'mcp' has no snippet export
Library use
The snippet engine lives in rustman-http (rustman_http::snippet), so the CLI, the TUI and generated docs share it: snippet(&resolved, lang, &options) renders one language from a resolved request, and resolve_placeholders resolves a request for placeholder mode. Each language is one minijinja template in crates/rustman-http/src/snippet/templates/ plus its quoting rules.
rustman docs code samples are this engine in placeholder mode, so a page shows byte for byte what rustman export snippet --placeholders prints with no environment selected, for requests that use no secret and no dynamic variable (docs also write secrets declared in any environment as «redacted:<name>» and keep {{$uuid}} as written; see API docs). custom_snippet(&resolved, lang, &options, template) renders a user template ([docs].template_dirs) over the same view; templates see the global docs_context_version (TEMPLATE_CONTEXT_VERSION). A Resolver built with keep_dynamics() writes {{$uuid}} and the other dynamic values back as written instead of evaluating them.
In the TUI, Alt+C or Copy as… in the palette copies the current request as a snippet through OSC 52; see Terminal UI.
Request history
Rustman keeps a local, redacted record of the exchanges it sends, so you can look back at what happened, search it and send a request again. rustman send, rustman run and rustman history replay all record; later front-ends (the TUI and the agent interface) read the same store.
What is recorded
Every request that was resolved and sent is recorded as one exchange, whether it got a response or failed with a network, TLS or timeout error. A request that never left (an unresolved variable, a --bail skip, Ctrl+C before it was sent) is not recorded. An exchange holds:
id: a ULID, so ids sort by time;timestamp(RFC 3339, UTC),request(the request file relative to the workspace root, oradhocforrustman send <METHOD> <URL>) andenvironment;sent: the method, URL with its query, headers and text body as sent;status,total_msanderror;record: the response (status, headers, body), timings, redirects, assertion results and captures, as in a JSON report; for a GraphQL request alsographql, with the operation, its redacted variables, the result status and a subscription’s events (see GraphQL); for an MCP request alsomcp, with the server, transport, protocol version, method, redacted params, the result or error and up to 200 notifications (see MCP client); when the request carried trace context, alsotrace, with the trace and span ids, the backend’s trace id, the redactedtracestateandbaggage, and the link, and the response’sServer-Timingmetrics asexchange.server_timings(see Trace propagation);rustman history showprints the trace lines after the assertions;spill: for a body too large to keep in memory (see[http] max_body_bytesin HTTP requests), the file under.rustman/bodies/that holds it;recordthen keeps only its start;replay: the request asrustman history replaysends it again (see Replay).
Each exchange is one JSON file, .rustman/history/<id>.json, with "schema": "rustman.history/v1".
Where it is stored
- Inside a workspace:
.rustman/history/, next to the cookie jars and persisted captures..rustman/must be git-ignored (rustman initadds it to.gitignore); Rustman refuses to write there otherwise, as it does for secrets. - Ad-hoc requests sent outside any workspace:
<data_dir>/rustman/history/, where<data_dir>is$XDG_DATA_HOME(or~/.local/share) on Linux,~/Library/Application Supporton macOS and%APPDATA%on Windows. SetRUSTMAN_DATA_DIRto use another folder ($RUSTMAN_DATA_DIR/history/).
rustman history uses the workspace found from the current folder (or --workspace DIR), and the ad-hoc history outside any workspace.
Turning it off
# rustman.toml
[workspace]
name = "shop"
version = 1
[history]
# Record exchanges (default: true).
enabled = true
# How many exchanges to keep (default: 500).
max_entries = 500
--no-history on rustman send, rustman run and rustman history replay skips recording for that command only.
Retention
After each write, the oldest exchanges beyond max_entries are deleted, then their spilled bodies, along with any spilled body no entry refers to that is more than an hour old. On Windows, a file another program holds open right now is kept silently and deleted by a later write. rustman history clear deletes every exchange and every spilled body in .rustman/bodies/.
Entries are readable by the current user only, like the secrets file: mode 0600 on Unix, and on Windows the current user’s grant without inherited permissions. Writes are safe across parallel runs and processes: each exchange is written to a temporary file, flushed to disk and renamed into place, so readers never see half an entry, and pruning holds an exclusive lock on .rustman/history/.lock. An entry that cannot be read (a file damaged by hand, say) is skipped with a warning: instead of failing the listing.
Redacted at rest
History is written through the same redaction as every other output (see Environments, variables and secrets): secret values become «redacted:<name>», and the values of the Authorization, Proxy-Authorization, Cookie and Set-Cookie headers become «redacted:<Header-Name>», including when a server echoes them back. --show-secrets never changes what is stored.
Listing and searching
rustman history list prints one line per exchange, newest first: id, time, method, URL, status and total time. The status is the HTTP status; an exchange without one (a plugin request kind) shows its recorded outcome, passed or failed, and one that got no response shows error.
| Flag | Keeps |
|---|---|
--status <code|class> | that status (404) or class (5xx) |
--method <m> | that method, ignoring case |
--grep <text> | exchanges whose URL, request body or response body contains the text, ignoring case (only the stored start of a spilled body is searched) |
--since <duration> | exchanges from the last 30s, 15m, 1h, 2d or 1w |
--limit <n> | the newest n matches (n is at least 1) |
--json | (output) a JSON array of {id, timestamp, request, environment, method, url, status, total_ms, error} |
rustman history show <id> prints one exchange in full (--json prints the stored entry). Ids can be shortened to any unique, non-empty prefix. An entry that cannot be read fails with error: cannot read history entry <path>: <reason> (exit code 2).
Replay
rustman history replay <id> sends the stored request again and records it as a new exchange. It takes --body-only, -o FILE, --show-secrets and --no-history like rustman send, and prints the response the same way. The stored request has {{name}} placeholders where secrets were, and replay reads them from the secret store at that moment: a rotated secret is sent with its new value, and a deleted one fails with unresolved variable(s): <name> before anything is sent. A value from a secret provider (a {{secret:...}} reference, or an environment variable backed by one) is fetched again from its provider, as rustman send would. There are no assertions on a replay; a response is a pass (exit code 0). A request signed by a plugin auth scheme is signed again, so replay loads the workspace plugins under the same trust rule as rustman send (--trust-plugins in CI).
Some exchanges cannot be replayed, because what they sent is deliberately not kept:
- a sensitive header (
Authorization,Cookie…) or an auth credential written literally instead of through a secret variable (only a scheme such asBearermay be written around the secret); - a multipart or file body;
- a GraphQL subscription (its WebSocket or event stream is not a plain exchange);
- a value derived from a secret: a captured value that contained a secret (see Captures). History stores
{{<var>}}in its place, or, if any other stored part still held a secret, nothing but the method.
Replaying one of them fails with this exchange cannot be replayed: ...; send the request from its file instead. An MCP operation keeps no request to replay at all (it is sent over an MCP session, not as a plain exchange): replaying it fails with history entry <id> holds no request to replay.
Example
A workspace with a secret token, and a request that uses it:
# environments/dev.yaml
variables:
base_url: http://localhost:8080
secrets:
- api_token
# users/me.rman.yaml
version: 1
kind: http
name: me
url: '{{base_url}}/me'
headers:
- name: Authorization
value: 'Bearer {{api_token}}'
Send it, find it in history, and replay it:
$ rustman send me --env dev --body-only
{"id":42}
$ rustman history list
01JD8X3F6W2N7Q4R5S6T7V8W9X 2026-11-17T09:30:00.123Z GET http://localhost:8080/me 200 3 ms
$ rustman history replay 01JD8X3F6W2N7Q4R5S6T7V8W9X --body-only
{"id":42}
$ rustman history list --status 2xx --since 1h --limit 1
01JD8X4A1B2C3D4E5F6G7H8J9K 2026-11-17T09:31:12.456Z GET http://localhost:8080/me 200 2 ms
The stored entries show Authorization: «redacted:Authorization», and their replay part holds Bearer {{api_token}}. Once the secret is deleted, replay stops before sending:
$ rustman secret rm api_token --env dev
removed secret 'api_token' from environment 'dev'
$ rustman history replay 01JD8X3F6W2N7Q4R5S6T7V8W9X
error: unresolved variable(s): api_token (secret not set; run 'rustman secret set api_token --env dev')
$ rustman history clear
deleted 2 exchanges from history
Exit codes
history list, show and clear exit 0, or 2 on a bad flag, an unknown id or an unreadable store. history replay exits like rustman send: 0 with a response, 3 when the request could not be completed (including an unresolved secret or an exchange that cannot be replayed), 130 on Ctrl+C. See the CLI reference.
Importing collections
rustman import turns collections exported from other tools into request files, _collection.yaml files and environments in the current workspace. It never writes a secret into a workspace file, never runs a script, and reports exactly what it could not carry over.
This build reads Postman Collection v2.0 and v2.1 exports and Postman environment exports, Insomnia v4 (JSON) and v5 (YAML) exports, Bruno collection folders, HAR 1.2 captures and .http / .rest files. Single curl commands have their own command, rustman import curl, and so do OpenAPI documents, rustman import openapi, which is not detected by rustman import <src>. Other formats can come from a workspace importer plugin: rustman import <format> <src>.
rustman import <src> # detect the format from the content
rustman import auto <src> # the same
rustman import postman <src> # a Postman Collection v2.0 / v2.1 export
rustman import postman-env <src> # a Postman environment export
rustman import insomnia <src> # an Insomnia v4 JSON or v5 YAML export
rustman import bruno <dir> # a Bruno collection folder (or one .bru file)
rustman import har <src> [filters] # a HAR 1.2 capture
rustman import http <src> # a .http / .rest file, or a folder of them
Options (the same for every form):
| Flag | Effect |
|---|---|
--into <dir> | The collection folder to write into. It must be inside the workspace. Default: a folder at the workspace root named after the slug of the source collection (Billing API → billing-api/). |
--dry-run | Convert everything and print the planned files, the secrets that would be moved and the report, without writing any workspace file or keychain entry. |
--on-conflict skip|overwrite|rename | What to do with a file that already exists (default skip). See Re-importing. |
--report <file> | Also write the report as JSON (rustman.import-report/v1). Parent folders are created. A dry run writes this file and the migration report, nothing else. |
--migration-report <file.md> | Also write the script migration report as Markdown. Parent folders are created. |
--max-size <size> | Refuse larger sources (default 100M; bytes, or with K, M or G). For a folder, every file read counts toward the limit. |
--fail-on-unsupported | Exit with 1 when a feature was unsupported, dropped or unmapped. |
--env <name> | The environment that receives secrets moved out of requests (default: RUSTMAN_ENV, then default_environment). |
--workspace <dir> | The workspace (default: search upwards from the current directory). |
Running outside a workspace fails with no rustman workspace found (run 'rustman init'); --into ../elsewhere fails with import: --into must be inside the workspace. Both exit with 2.
Format detection
auto (and a bare rustman import <src>) looks at the content, never the file name:
| Source | Recognized by |
|---|---|
| Postman collection | info.schema (https://schema.getpostman.com/json/collection/v2.1.0/collection.json, or v2.0.0) |
| Postman environment | _postman_variable_scope: environment |
| Insomnia v4 | _type: export and __export_format: 4 |
| Insomnia v5 | a top-level type: collection.insomnia.rest/5.x line |
| HAR | a JSON object with log.entries |
| Bruno | a folder with bruno.json; a single file with a meta { block and a request block |
| HTTP file | a request line such as GET https://... (not JSON); a folder holding .http or .rest files |
Anything else fails with exit code 2:
error: import: cannot detect format of data.json (expected postman, insomnia, bruno, har, http)
Postman collections
| Postman | Rustman |
|---|---|
| Folders | Nested folders (collections), each with a _collection.yaml holding its name and the item order as order: |
| Items | kind: http request files: method, URL, query, headers, body, auth |
| Collection and folder auth | auth in _collection.yaml, inherited by the requests inside |
| Collection variables | variables in the root _collection.yaml (secret ones are moved, see below) |
Folder variable lists | Dropped, each reported as folder variable <name> dropped: Postman ignores folder-level variables: the v2.1 schema allows them, but Postman never resolves them (a request in the folder gets the collection’s value), so importing them would change which value is sent |
Path variables (/users/:id) | /users/{{id}}, with id under the request’s variables. Path variables are a namespace of their own in Postman: when the name is also used elsewhere (a collection variable {{id}}, an auth field), the path variable is renamed (path_id, path_id_2, …) so it never shadows the other |
| Disabled headers, query parameters, form fields and variables | Dropped, and listed in the report |
noauth on a request | auth: {type: none} (turns inherited auth off) |
inherit on a request or folder | No auth (inherits the parent’s auth) |
Body modes:
| Postman body mode | Rustman body |
|---|---|
raw, language JSON (or no language and a JSON Content-Type) | type: json, with the text kept byte for byte, so unquoted placeholders such as {{$timestamp}} survive |
raw, any other language | type: text |
urlencoded | type: form |
formdata | type: multipart; file parts keep their path, made relative to the request file when it is inside the workspace. A path outside the workspace keeps only its file name, with a review note. |
file | type: file |
graphql | A kind: graphql request file with endpoint, document and variables. Variables that are not a flat JSON object are kept as a # graphql-variables: comment, with a review note. |
Auth types basic, bearer, apikey (header or query) and oauth2 with the client-credentials or authorization-code grant (with or without PKCE) map to the auth helpers. Any other type (hawk, digest, awsv4, ntlm, OAuth2 implicit or password grants, …) is written as auth: {type: none} and reported as <type> auth unsupported with the item path. Writing none rather than leaving auth out matters: a request without auth inherits the folder or collection auth, and Postman would never have sent that parent credential to this host. A token Postman cached for OAuth2 is never carried over: Rustman fetches its own.
Postman environments
rustman import postman-env staging.postman_environment.json (or auto-detection) writes environments/<slug>.yaml. Variables Postman marks secret, and variables whose name looks like a secret, are listed under secrets; their values go to the secret store, never into the file:
# environments/staging.yaml
variables:
base_url: https://staging.billing.example.com/v1
secrets:
- api_key
An existing environment file is merged: new variables and secrets are added, and existing ones follow the conflict policy.
Insomnia exports
rustman import insomnia export.json reads an Insomnia v4 JSON export (Preferences → Data → Export, “Insomnia v4”); export.yaml in the v5 YAML format of recent versions is read the same way.
| Insomnia | Rustman |
|---|---|
| Workspace / collection | The collection folder (_collection.yaml with its name and description) |
| Request groups (folders) | Nested folders, in Insomnia’s sort order (metaSortKey / meta.sortKey); folder environment values become variables, folder headers and auth are inherited |
| Requests | kind: http request files: method, URL, query parameters, headers, body, auth |
GraphQL requests (application/graphql body) | kind: graphql request files |
Body application/json / other text, form, multipart, file | json / text, form, multipart, file |
Auth basic, bearer, apikey, oauth2 (client credentials, authorization code), none | The matching auth helper; other types are written as auth: {type: none} (so no parent credential is inherited) and reported as <type> auth unsupported |
| Pre-request and after-response scripts | # imported-script comments, never executed |
| gRPC and WebSocket requests | Left out, reported as unsupported |
| Disabled headers, parameters and form fields | Dropped, and listed in the report |
Environments are flattened: each sub-environment becomes environments/<slug>.yaml holding the base environment’s values with the sub-environment’s overrides (a base host overridden by Prod gives environments/prod.yaml with Prod’s host). A base environment without sub-environments becomes an environment of its own. Values that are objects or arrays become one variable per leaf, named as Insomnia templates reference them: {"auth": {"token": "..."}} gives auth.token (so {{ _.auth.token }} becomes {{auth.token}}) and {"hosts": ["a"]} gives hosts[0]. Each leaf is checked for secrets on its own, so auth.token is moved to the secret store. Every value set by an environment marked private (isPrivate: true) is a secret whatever its name, like the values of http-client.private.env.json: it goes to the secret store and is listed under secrets without a value. Base-environment values a private sub-environment does not override stay plain. Sub-environments whose names give the same file name (Prod and prod) are kept apart: the later one is imported as prod-2, and the report says so (this holds for every source’s environments).
{{ _.name }} becomes {{name}}. Template tags other than plain variables ({% response ... %}, {% uuid %}, {% now %}) have no Rustman equivalent: they are kept as written and each is reported once per request as unsupported template tag: <tag>, with the request’s item path.
Bruno collections
rustman import bruno <folder> (or a bare rustman import <folder> with a bruno.json in it) reads a Bruno collection folder. The collection is named after bruno.json’s name.
| Bruno | Rustman |
|---|---|
| Folders | Nested folders; folder.bru gives the name, order (meta.seq), headers, auth, variables and scripts. Symbolic links to folders are not followed (reported as symlinked folder <path> skipped), and folders nested deeper than 32 levels are an error |
collection.bru | The collection’s _collection.yaml: headers, auth (auth { mode: ... }), variables, scripts |
.bru request files | kind: http request files, ordered by meta.seq, then file name |
Method block (get, post, …) | Method and URL; body: and auth: select the body and auth blocks |
params:query, params:path | Query parameters; /users/:id becomes /users/{{id}} with id under the request’s variables (renamed path_id when id is used elsewhere, as for Postman) |
headers | Headers (entries starting with ~ are disabled: dropped and reported) |
body:json, body:text, body:xml, body:form-urlencoded, body:multipart-form (@file(path) parts), body:graphql + body:graphql:vars | json, text, form, multipart, or a kind: graphql file |
auth:basic, auth:bearer, auth:apikey, auth:oauth2; auth: none / inherit | The matching auth helper; other modes are written as auth: {type: none} (so no parent credential is inherited) and reported as unsupported |
vars:pre-request | Request variables |
vars:post-response reading res.body... | json captures (user_id: res.body.data.id → {var: user_id, from: json, path: $.data.id}); other expressions are reported |
script:pre-request, script:post-response, tests | # imported-script comments, never executed |
docs | description |
environments/*.bru | environments/<name>.yaml; vars:secret [ ... ] names are listed under secrets (Bruno never exports their values: set them with rustman secret set); a name listed there that also has a value in vars is a secret too, and its value goes to the secret store |
assert entries map to declarative assertions:
| Bruno assertion | Rustman assertion |
|---|---|
res.status: eq 200 | status: 200 |
res.body.a.b: eq v / neq v | json: {path: $.a.b, equals: v} / not_equals |
res.body.a: gt n / lt n | json: {path: $.a, gt: n} / lt |
res.body.a: contains v | json: {path: $.a, contains: v} |
res.body.a: isDefined | json: {path: $.a, exists: true} |
Operands are read as JSON when they parse (200, "ok", true), and as strings otherwise. Any other assertion (on headers, res.status with an operator other than eq, matches, …) is reported as unsupported with its line.
A .bru file that does not follow the grammar fails the import with exit code 2 and the line: import: shop/users/get.bru: line 10: block `headers` is not closed.
HAR captures
rustman import har capture.har imports each entry of a HAR 1.2 capture (browser developer tools → “Save all as HAR”) as a request file, in a folder per host (api-example-com/). The file is read one entry at a time, and response bodies are never read into memory or written anywhere.
| Flag (repeatable) | Keeps |
|---|---|
--host <host> | Requests to this host (api.example.com, or with its port) |
--method <method> | Requests with this method |
--content-type <type> | Requests whose request body or response has this MIME type (application/json) |
--include-static | Images, fonts, stylesheets and scripts too |
Without --include-static, static assets (by response MIME type image/*, font/*, text/css or JavaScript, or by URL extension such as .png, .css, .js, .woff2) are dropped, each listed in the report as static asset dropped: GET https://cdn.example.com/app.css. Entries with the same method, URL (query parameters in any order) and body are imported once; the report counts the duplicates and the entries left out by the filters. The filters are only accepted by rustman import har.
Query parameters come from the URL as written (still percent-encoded); the entry’s queryString list, which browsers fill with the same parameters decoded, is used only when the URL has no query, so parameters are never doubled.
Transport and browser-managed headers are not written: Host, Content-Length, Connection, Transfer-Encoding, Accept-Encoding, Keep-Alive, Upgrade, TE, Trailer, HTTP/2 pseudo-headers (:authority, :path, …) and sec-* headers. Cookie and Authorization values are moved to secrets like any other credential.
HTTP files
rustman import http api.http reads a .http or .rest file (JetBrains HTTP Client and VS Code REST Client); a folder imports every .http and .rest file in it, one folder per file.
@api_version = v1
### List items
GET {{host}}/{{api_version}}/items
Accept: application/json
###
# @name create-item
POST {{host}}/{{api_version}}/items
Content-Type: application/json
{"name": "lamp"}
- Requests are separated by
###lines; the text after###, or a# @name/// @namecomment, names the request (default:METHOD /path). - The request line is
METHOD URL [HTTP/version](a bare URL is aGET);?and&lines right after it continue the query. Headers follow up to a blank line, and the body after it. - Bodies are
json(byContent-Type, or a body starting with{or[when there is none),form(application/x-www-form-urlencoded),file(< ./path) ortext. @name = valuelines become the collection’svariables.- JetBrains response handlers (
> {% ... %}) are kept as# imported-scriptcomments and never executed; handler files (> ./script.js) are reported as unsupported.
Environments come from the files next to the .http file (or in the folder):
| File | Becomes |
|---|---|
http-client.env.json | environments/<name>.yaml variables |
http-client.private.env.json | Secrets of those environments (values go to the secret store) |
.vscode/settings.json, rest-client.environmentVariables | environments/<name>.yaml variables |
$shared values apply to every environment that does not set them. Values that are objects (such as JetBrains auth settings) are reported as unsupported. As everywhere, variables whose name looks like a secret are moved to the secret store.
Variables
{{name}} placeholders stay as they are. Dynamic variables are translated: {{$guid}} and {{$randomUUID}} become {{$uuid}}; {{$timestamp}}, {{$randomInt}} and Rustman’s own dynamic variables stay. Any other ({{$randomCity}}) is kept unchanged and reported as unmapped dynamic variable $randomCity.
Secret references from the source
A source cannot name your secrets. A secret reference ({{secret:...}}) found in an imported document is written escaped, as \{{secret:...}}: literal text that is sent as written and never reads a provider secret. This covers every source (Postman, Insomnia, Bruno, HAR, HTTP files), every field that takes templates (URLs, headers, bodies and GraphQL variables, auth including OAuth2 scopes, variables, environments, assertion values), and references a translation produces (Insomnia {{ _.secret:vault/x }}). Each one is listed in the report as a review note:
review: secret reference {{secret:vault/kv/prod/db#password}} from the source neutralized: it is kept as literal text and never resolved (evil.json > Leak)
If you trust the source and want the reference, remove the backslash by hand. Plain {{name}} placeholders, and references the source already escaped, are left as they are. Files returned by an importer plugin get the same treatment.
Secrets
Before anything is written, the importer looks for secrets in three passes.
1. Named fields. A literal value is a secret in:
Authorization,Proxy-AuthorizationandCookieheaders, headers whose name looks like a secret (X-API-Key) or ends in-auth,-token,-key,-secretor-signature(any case:X-Custom-Auth), and headers whose value starts with an auth scheme (see below);- query parameters, form fields and multipart text parts whose name looks like a secret (HAR multipart bodies exported as raw
text, as Chromium does, are split into parts first); "key": "Basic dTpw..."(any auth scheme, see below) under any key of a JSON body: the scheme stays and the credential moves;- the password (or token) in the userinfo of a URL, of a request URL or of any variable holding one (
postgres://admin:p4ss@db/x):https://admin:p4ss@hostbecomeshttps://admin:{{url_password}}@host, and a variabledb_urlgets{{db_url_password}}; "key": "value"pairs of JSON, raw and GraphQL-variables bodies (also every string of a"key": [...]array, and numbers of four digits or more such as"pin": 12345678), andkey=valuepairs of form-encoded raw bodies, whose key looks like a secret ("password": "{{password}}");- basic passwords, bearer tokens, API-key values and OAuth2 client secrets (a cached OAuth2 access token is dropped and reported: Rustman fetches its own);
- collection, folder, request (Postman path variables, Bruno
vars:pre-request) and environment variables whose name looks like a secret, whose value starts with an auth scheme, or that the source marks secret (Postmantype: secret, Brunovars:secret, Insomnia private environments,http-client.private.env.json); - literal values that scripts give to secret-named variables, headers or keys (
pm.environment.set('apiSecret', '...'),req.setHeader("Authorization", "Bearer ..."),const apiKey = '...',secret = '...'), and the literal passed tobtoa(...)oratob(...)(a Basic credential, stored asbasic_credentials).
A name looks like a secret when it matches token|secret|password|passwd|api[_-]?key|client[_-]?secret (case-insensitive); or names a session, cookie, credential, bearer, JWT, access or private key, a signature, passcode or passphrase; or is exactly auth, key, sid, code or auth_code (OAuth authorization codes); or ends in sig, pass or otp (X-Sig); or has pwd, pass, passwd, pin, otp, sid, verifier, csrf or xsrf as a whole segment, split at punctuation and lowercase-to-uppercase changes (X-Pwd, pinCode, code_verifier; spinner and bypass stay plain). A variable or header value that starts with an auth scheme and a credential (Bearer, Basic, Digest, Token, ApiKey, Bot, SSWS, Negotiate or NTLM, any case) is a secret whatever its name; in a header the scheme stays and only the credentials move (X-Client: Token {{x_client}}).
2. Well-known tokens, everywhere. Every text the import writes is scanned for tokens of these formats, whatever field holds them: URLs (paths included), query parameters, headers, bodies, auth fields, variables, request, folder and collection names, descriptions (Bruno docs included), and string literals in scripts. The formats are GitHub (ghp_, gho_, ghu_, ghs_, ghr_, github_pat_), GitLab (glpat-), Slack (xoxa-, xoxb-, xoxp-, …), Stripe live keys (sk_live_, rk_live_), AWS access key ids (AKIA/ASIA and 16 characters), Google API keys (AIza and 35 characters), JWTs (three base64url segments starting eyJ) and PEM private-key blocks. Tokens are also found when percent-encoded (-----BEGIN%20RSA%20PRIVATE%20KEY-----...). Each is stored under a name for its kind (github_token, jwt, aws_access_key, google_api_key, private_key, …).
3. Repeats. Every value moved by the first two passes is then looked for where it repeats in those same texts (another header, the URL path or query, a body, a name or description, an environment variable): as written (raw, also when the value itself holds {{) and, for secret-like values, encoded (percent-encoded in upper or lower case, JSON-escaped with or without \/, HTML-escaped). A value is secret-like when it has at least 8 characters and either comes from at least two of the classes letters, digits and symbols, or has 16 characters or more (p4ssw0rd!, sk-live-42ab, 8473629184736291, a 32-letter token; not password, 123456, example or application). Placeholders are substituted raw when a request is sent, so a repeat becomes {{name}} only where that sends the same bytes under every environment.
A secret moved from the collection itself (stored in the import’s target environment, which the collection’s own placeholders already use) is collection-scoped; a secret of a source environment file (Postman, Insomnia, Bruno, http-client.env.json environments) is environment-scoped: it resolves only while that environment is active.
In requests, collections and folders:
- a raw repeat of a collection-scoped secret-like value that fills the whole field, or sits on token boundaries (no letter or digit right before or after it), becomes
{{name}}(X-Note: SAME-VAL-42→X-Note: {{x_api_key}},/keys/SAME-VAL-42?x=1→/keys/{{x_api_key}}?x=1). A value of a well-known token shape (GitHub, JWT, AWS, Slack, Stripe, Google, PEM) is matched anywhere, also right after letters (abcghp_...→abc{{github_token}}); - an encoded repeat of a collection-scoped secret-like value (
Pa\"ssin a JSON string,ab%2Fcdin a path,p%40ssin a form body), or a raw one inside a longer word (myPassw0rd!), becomes the literal«redacted:name», since{{name}}would send different bytes (invalid JSON, an extra path segment, an extra form field). The report saysrequest <file > item>: field <field> contained secret <name> in encoded form; it was redacted, edit the field to use {{name}}(orinside other text); - any repeat of an environment-scoped secret-like value becomes
«redacted:name», since{{name}}would send another value, or none, under another environment. The report saysrequest <file > item>: field <field> repeated secret <name> of environment <env>; it was redacted, edit the field; - after these, each field is also read percent-decoded (
+as a space), JSON-unescaped (\uXXXXtoo) and HTML-unescaped; when one of these readings still shows a secret-like value (a partly or differently encoded repeat such asp%40ss&w0rd=1,my+secret+pass,p\u0040ss), the whole field becomes«redacted:name», with thein encoded formnote.
In environment files, a raw secret-like repeat of that same environment’s secret, as the whole value or on token boundaries, becomes {{name}} (cb_url: https://x.test/cb?t={{token}}); an encoded or in-word repeat of it, and any repeat of another environment’s secret, becomes «redacted:name» with a note, as above.
Everywhere, a repeat of a value that is not secret-like is left as written, and the report gets a review note the value of secret <name> also appears in <file > item>:<field>; review it, never showing the value. So a Basic password password leaves grant_type=password and /password/reset alone, and a secret 123456 leaves zip=123456 and api.123456.com alone. In free text (names, descriptions) every replacement is «redacted:name»; names and file names change only for secret-like values.
Values shorter than 6 characters or longer than 16 KiB are not looked for. Environment files only get the first rule, and only with the secrets of that same environment: a plain variable whose whole value is one of its environment’s secrets becomes that secret’s placeholder; nothing else in an environment file changes.
Outside repeats, a value moved from a field that takes templates (URLs, headers, bodies, auth, variables) becomes the {{name}} placeholder; in free text (names, descriptions, report notes and locations) it becomes «redacted:name». In scripts, which are kept as written and never run, every moved value is shown as «redacted:name», as in the report’s unconverted statements. For example Authorization: Bearer eyJhbGciOi... becomes Authorization: Bearer {{authorization_token}}, and a description Use key ghp_... becomes Use key «redacted:github_token». Values that are already placeholders are left alone. The printed summary and the --report file are checked once more for secret-like values before they are written.
Variables keep their scope: a folder variable (Insomnia, Bruno) moved under another name (password_2, because the collection’s password holds another value) is renamed only in that folder’s requests and subfolders, not where the collection’s password applies, and not below a subfolder or request that declares password again. A new secret name never takes the name of any variable declared anywhere in the source (collection, folders, requests, environments) other than the variable being moved, nor any name the source references as {{name}} without declaring it (such a reference is meant to come from your own environment): with a plain collection variable token_2, a folder’s moved token becomes token_3, so no placeholder resolves to another variable.
The target environment is --env, else the active one. Without either, secrets go to a new environment named after the collection (environments/billing-api.yaml), and the report says so. A name already used in that environment is reused only when it holds the same value; otherwise the next free name (token_2) is used, so an import never replaces a stored secret.
Secret values are stored in the OS keychain, or .rustman/secrets.yaml when there is none (see Secret storage). The report lists every moved secret by name, environment and source location, never by value, and there is no option to keep secrets inline: the only way to put a literal secret into a file is to edit it by hand. As a last guard, the writer refuses any file whose secret fields still hold a literal value. Values that look like secrets (24 characters or more, letters and digits, no spaces) but are kept as plain variables are listed as review notes, by name only.
Known limits: outside the named fields above, only well-known token formats and repeats of moved values are found, so some secrets are written as they are. Review these by hand after an import:
- XML bodies and other raw text that is neither
"key": "value"norkey=value(<password>p4ss</password>), and literals inside a GraphQL query document (login(password: "p4ss"); GraphQL variables are scanned); - descriptions and docs, beyond well-known tokens and repeats of moved values;
- bare base64: a secret that appears base64-encoded without an auth scheme (
X-B64: UzNjcjN0LVBhc3Mh, a token inside a base64 blob) is not found and is written as it is. ABasic <base64>value is found by its scheme; - repeats in encodings other than percent-encoding, JSON escaping and HTML escaping;
- repeats of values that are not secret-like (
password,123456), which are only reported; - string literals in scripts that are not given to a secret-named variable, header or key,
btoaoratob, and are not a well-known token: the script is kept as written and only areviewnote points at it; - expected values in assertions suggested from scripts (
pm.expect(body.token).to.eql("...")), which are written as checks.
Scripts
Pre-request and test scripts are never executed. Each is kept verbatim (any moved secret value redacted) in an # imported-script comment block at the top of the request file, or of _collection.yaml for collection and folder scripts, and the report lists it as script not executed.
Statements in the mapping table below are also written as declarative entries (Bruno assert blocks are mapped as described in Bruno collections). Statements are found without running anything: the script is split at ;, line breaks and block braces (the callback of pm.test("...", () => ...) or function () { ... } counts as its inner statements), whitespace outside strings is ignored, and 'single' and "double" quotes are the same.
| Script statement | Written as |
|---|---|
pm.response.to.have.status(201), pm.expect(pm.response.code).to.eql(201) (or .equal) | status: 201 |
pm.response.to.be.ok | status: "2xx" |
pm.response.to.have.header("ETag") | header: {name: ETag, exists: true} |
pm.response.to.have.header("Content-Type", "application/json") | header: {name: Content-Type, equals: application/json} |
pm.expect(pm.response.responseTime).to.be.below(300) | latency: {total_lt: 300} |
pm.expect(pm.response.text()).to.include("done") | body: {contains: done} |
const body = pm.response.json() (or let, var) | Tracked: body.a.b then means $.a.b |
pm.expect(body.user.id).to.eql(42) (or .equal, .deep.equal) | json: {path: "$.user.id", equals: 42} |
pm.expect(body.user.id).to.not.eql(0) | json: {path: "$.user.id", not_equals: 0} |
pm.expect(body.user).to.exist | json: {path: "$.user", exists: true} |
pm.expect(d.items[0].tags).to.have.lengthOf(2), pm.expect(d.items.length).to.eql(2) | json: {path: "$.items[0].tags", length: 2} |
pm.expect(body.name).to.be.a("string") (or .an) | json: {path: "$.name", type: string} |
pm.expect(body.total).to.be.above(0) / .below(9) | json: {path: "$.total", gt: 0} / lt: 9 |
pm.expect(body.roles).to.include("admin") | json: {path: "$.roles", contains: admin} |
pm.environment.set("v", <source>), pm.globals.set(...) | A capture with persist: true |
pm.collectionVariables.set("v", <source>), pm.variables.set(...) | A capture without persist |
A setter’s <source> maps when it is pm.response.json().a.b or a tracked alias path (from: json, path: $.a.b), pm.response.headers.get("ETag") (from: header, name: ETag) or pm.cookies.get("sid") (from: cookie, name: sid). pm.response.json() may also be used directly in place of an alias, and paths may use [0] and ["key"] segments.
Everything else stays comment-only. The summary counts the statements:
scripts: 31/40 statements converted (77%)
The percentage is rounded down. The JSON report has the same counts under migration (found, mapped, unconverted, percent), and per request its file path, counts and unconverted statements (any moved secret value redacted).
Script migration report
--migration-report <file.md> writes a Markdown report with one section per request that has unconverted statements. Each row shows the statement, the request file and a suggestion:
| Statement | Suggestion |
|---|---|
pm.expect(pm.response.json().items.every(i => i.price > 0)).to.be.true | A schema assertion with items.price constrained by exclusiveMinimum: 0, with the inline schema to paste (>=, < and <= give minimum, exclusiveMaximum and maximum) |
postman.setNextRequest("checkout") | no declarative equivalent; consider a plugin, plus a pointer to order: in _collection.yaml for run order |
| anything else | no declarative equivalent; consider a plugin |
Moved secret values are redacted in the report, as everywhere else.
File names
Files are named after the slug of the item name (lowercase ASCII letters and digits, - between words, at most 64 characters) plus .rman.yaml. Items with the same slug in one folder get -2, -3 suffixes in source order (Get User and get user! become get-user.rman.yaml and get-user-2.rman.yaml). Every generated path, relative to the workspace root and including the collection folder (--into), is at most 180 characters and 20 levels deep, so that it stays under Windows’ 260-character MAX_PATH with up to 80 characters left for the workspace root. A source whose names or nesting go beyond that fails before anything is written (exit code 2) with generated path too long (<n> characters, limit 180): <path>, the path shortened to its first 40 and last 30 characters; shorten the names, flatten the folders or pass a shorter --into. Paths are never silently truncated. Everything is written with the workspace’s deterministic emitter, so importing the same source into two empty workspaces gives byte-identical trees.
Re-importing
When a target file already exists, --on-conflict decides:
| Policy | Request files | _collection.yaml | Environment variables |
|---|---|---|---|
skip (default) | kept, reported skipped (exists) | kept | kept |
overwrite | replaced, reported overwritten | replaced | replaced |
rename | written next to it with the next free suffix, reported renamed to <path> | kept; renamed requests are appended to its order: (reported order extended with ...) | kept |
Imports into one workspace run one at a time: an import holds .rustman/import.lock from reading the workspace to writing the last file, and a second import waits for it, so neither loses the other’s changes to environments/<name>.yaml. A file whose content would not change is never rewritten or duplicated, under every policy: it is listed with the action unchanged, counted in skipped, summarized as unchanged: <n> files already up to date, and never reported as a conflict.
An import is all or nothing: every file is first written next to its target as a temporary .rmtmp file, then the secrets are stored, then the files are moved into place. If a write or the secret store fails, the temporary files and any folder made for them are removed and nothing is stored.
The report
Every import prints a summary:
imported Billing API (postman) into billing-api/
written: 11 requests, 4 collections, 1 environments; skipped: 0; dropped: 4; secrets moved: 9; unsupported: 1; unmapped: 1
3 scripts preserved as comments, not executed
scripts: 5/5 statements converted (100%)
secret: authorization_token -> environment 'local' (billing.json > Invoices / List invoices)
dropped: disabled header X-Debug dropped (billing.json > Users / List)
unsupported: hawk auth unsupported (billing.json > Invoices / Legacy export)
unmapped: unmapped dynamic variable $randomCity (billing.json > Users / Create)
script not executed: test (billing.json > Auth / Login)
--report <file> writes the same data as JSON, following schemas/import-report.schema.json: schema (rustman.import-report/v1), source, destination, dry_run, summary (the counts above), files (each planned file and its action), conflicts, secrets (name, environment, location), notes (kind, message and location: the source file plus the item path or line) and migration (the script statement counts).
Exit codes
| Code | Meaning |
|---|---|
| 0 | The import completed. Unsupported, dropped or unmapped features are reported but are not an error. |
| 1 | --fail-on-unsupported and some feature was unsupported, dropped or unmapped. |
| 2 | Unreadable, invalid, oversized (import: source exceeds 100 MiB (use --max-size)) or undetectable source; no workspace; --into outside the workspace. |
Exporting
rustman export writes a collection folder or a single request file back out for other tools:
rustman export postman <path> [-o <file>] # a Postman Collection v2.1 JSON
rustman export http <path> [-o <file>] # a .http file
<path> is a collection folder (the workspace root too) or a request file inside the workspace. Without -o the result is printed on standard output; with -o it is written to the file (parent folders are created) and wrote <file> goes to standard error.
Secrets are exported as the {{name}} placeholders the request files hold, never as values: rustman export http api writes Authorization: Bearer {{token}} for a request whose bearer token is the secret token. As a further guard, any secret value of the active environment (--env) that appears in the output, for example pasted into a description, is printed as «redacted:<name>».
Features the target cannot hold are listed as warnings on standard error, such as warning: export: api/me.rman.yaml: 1 assertions not exported (no equivalent):
| Feature | Postman v2.1 | .http |
|---|---|---|
| Folders, order, names, descriptions | Kept | Flattened into ### blocks in run order; descriptions dropped |
| Collection and folder auth | Kept on the folder | Written into each request that inherits it |
| Collection and folder headers | Warning | Written into each request |
| Variables | Collection and folder variable lists (Postman ignores folder lists when it runs a request); request variables as URL variables ({{id}} path segments become :id) | @name = value lines at the top (one value per name; a different later value is a warning) |
| Basic, bearer, API key auth | Kept | Authorization: Basic <user> <password>, Authorization: Bearer <token>, the key header or query parameter |
| OAuth2 auth | Kept | Warning |
| Bodies | raw (JSON or text), urlencoded, formdata, file, graphql | As text, form fields joined with &, multipart with < path file parts, < path for a file body, GraphQL as a JSON POST; a Content-Type is added when missing |
# imported-script blocks | Back to prerequest and test events (other sources’ scripts are a warning) | Warning |
| Assertions, captures, settings, tags | Warning | Warning |
{{$uuid}} | Written as Postman’s {{$guid}} | Kept |
Importing an exported Postman collection into an empty workspace gives byte-identical request files when the collection used no feature from the warnings above, so a Postman collection survives import → export → import unchanged.
The export goes through the same neutral IR as imports (rustman_import::export::collect reads the workspace into it, rustman_import::export::export writes the target).
Using the importer as a library
The pipeline lives in the rustman-import crate, so other front-ends and producers share it: a source parser builds the neutral IR (ImportedCollection: folders, requests, environments, notes with source locations), rustman_import::plan translates variables, extracts secrets, suggests assertions and lays out the files without writing anything, and rustman_import::apply stores the secrets and writes the files.
rustman_import::session::run runs a whole import the way a front-end without a command line needs it (detect, plan, and apply under the import lock unless it is a dry run) and returns the redacted summary; the TUI’s Import… palette action uses it (see Terminal UI).
OpenAPI import
rustman import openapi turns an OpenAPI document into a collection of request files: one folder per tag and one kind: http request per operation.
rustman import openapi petstore.yaml
rustman import openapi https://api.example.com/openapi.json --into apis/shop
It prints imported <n> operations into <dir> and one created environment '<name>' line per new environment on stdout, and every warning on stderr. --sync updates a collection imported earlier (see Sync). The behavior is specified in openspec/specs/openapi-import.
Supported documents
- OpenAPI 3.0.x and 3.1.x, in JSON or YAML. The format is detected from the content, not the file extension: a document whose first character is
{or[is JSON, anything else is YAML. - Swagger 2.0 is rejected with exit code 2 and
Swagger 2.0 is not supported; convert it to OpenAPI 3 first (e.g. with swagger2openapi). Nothing is written. - Any other
openapiversion, or a document without anopenapifield, exits with 2.
OpenAPI 3.0 schemas are rewritten to their 3.1 (JSON Schema 2020-12) form when they are read: nullable: true becomes a "null" type (or an anyOf with {"type": "null"} when the schema has no type), and boolean exclusiveMinimum / exclusiveMaximum become numbers. A 3.0 document and its 3.1 equivalent import to the same result.
Sources
The source is a local path or an http(s) URL. A URL is fetched with the same HTTP engine as rustman send, with TLS verification on, a 30-second timeout and redirects followed. A document (or a referenced file) larger than 20 MiB is refused with exit code 2:
error: https://api.example.com/huge.json is larger than the 20 MiB limit
A URL that cannot be reached (DNS, connection refused, timeout, TLS) exits with 3, like other requests that could not complete.
References
-
Local references (
#/components/schemas/Pet) are resolved. -
References to files beside a local document (
common/pet.yaml#/Pet,schemas/shared.json) are read and resolved, including the references inside them. They must stay in the root document’s directory or below: an absolute path, or one that climbs out of it with..(or through a symlink), is refused with exit code 2 (reference '../shared.json' at ... leaves the document's directory), so an untrusted document cannot read other files. -
References to other
http(s)documents, and relative references in a document read from a URL, are refused with exit code 2 unless--allow-remote-refsis given:error: remote reference 'https://schemas.example.com/user.json' at /paths/~1users/get/responses/200/content/application~1json/schema is not resolved; pass --allow-remote-refs to fetch it -
Circular references (a
NodewhosechildrenareNodes) are kept as references and never expanded.
Referenced files are copied into the imported model under components/x-rustman-external; at most 64 documents are read per import.
Diagnostics
The document is validated before anything is written. Each diagnostic names a JSON pointer:
warning: /paths/~1users/get: operation has no operationId; its request file is named from the method and path
error: /info/title: required string 'title' is missing
Errors stop the import with exit code 2, and nothing is written. They are: a missing info, info.title or info.version; a paths that is not an object (or is missing in 3.0); a path that does not start with /; an operation or path item that is not an object; a parameter without name or a valid in; and a $ref that points at nothing.
Warnings are printed and the import continues: a missing or duplicate operationId, an operation without responses, a path parameter that is not required or does not match the path template, and an example (or examples.*.value) that does not match its schema (the first violation is quoted).
The generated collection
The collection is a folder in the workspace root named after info.title in kebab-case, or the folder given with --into. That folder must not exist or must be empty; an existing collection is never overwritten. Files are written to a temporary folder first and moved into place, so a failed import leaves nothing behind.
swagger-petstore/
_collection.yaml # name, order of the tag folders, auth, source and its hash
pets/
_collection.yaml # name and description of the tag, order of the requests
list-pets.rman.yaml
create-pet.rman.yaml
show-pet-by-id.rman.yaml
store/
_collection.yaml
get-inventory.rman.yaml
untagged/ # operations without tags
get-users.rman.yaml
environments/
production.yaml # one environment per server
.rustman/openapi/
swagger-petstore.json # the import snapshot (git-ignored)
- Each operation goes to the folder of its first tag, or
untagged. - A request file is named from the
operationIdin kebab-case (getPetByID→get-pet-by-id.rman.yaml), otherwise from the method and path (GET /users/{id}/posts→get-users-id-posts.rman.yaml). When two operations in a folder get the same name, the second is suffixed-2(then-3, …) and a warning is printed. - The request’s
nameis theoperationId(orMETHOD /path), and itsdescriptionis the operation’s summary and description. - The URL is
{{baseUrl}}followed by the path, with every path parameter as a variable:/pets/{petId}becomes{{baseUrl}}/pets/{{petId}}. - Query and header parameters become
queryandheadersrows whose value is a{{variable}}named after the parameter. Optional parameters are written disabled (enabled: false), so they are kept in the file but not sent.Accept,Content-TypeandAuthorizationheader parameters are ignored, as OpenAPI specifies. - Two tags record where the request came from:
openapi:operationId=<id>andopenapi:path=<template>. They let a later re-import match request files to operations.
version: 1
kind: http
name: showPetById
description: Info for a specific pet
tags:
- openapi:operationId=showPetById
- openapi:path=/pets/{petId}
method: GET
url: '{{baseUrl}}/pets/{{petId}}'
Variables such as baseUrl and petId come from environments, --var or captures, as for any request (see Environments).
Example bodies
An operation with a request body gets a body from the first JSON media type (application/json or any +json type), or the first media type when none is JSON. The value is, in order:
- the media type’s
example; - the value of its first
examplesentry; - the schema’s own example (
examples[0]orexample) ordefault; - a value synthesized from the schema.
The synthesizer follows $refs and builds a value that validates against the schema:
- objects get their
requiredproperties (every property that is notreadOnlywhen nothing is required);allOfmembers are merged, andoneOf/anyOftake the first branch that is notnull; const, then the first non-nullenumvalue, then a nestedexample/defaultwin over anything synthesized;- strings follow their
format(date-time→2024-01-01T00:00:00Z,email→user@example.com,uuid,uri,ipv4, …; otherwisestring), padded withxtominLength(at most 4096 characters) and cut tomaxLength; - integers and numbers start at 0 and move inside
minimum/maximum,exclusiveMinimum/exclusiveMaximumand ontomultipleOf; booleans aretrue; - arrays get one item (raised to
minItems, lowered tomaxItems); - objects and arrays stop at a nesting depth of 3: deeper ones are empty, so a circular schema (a
NodewhosechildrenareNodes) gives{children: [{children: []}]}.
JSON bodies are written as type: json, application/x-www-form-urlencoded as type: form and a string example of a text/* or XML type as type: text. When the media type is not the default of the body type (for example application/vnd.api+json), a Content-Type header is added. Other media types (such as multipart/form-data) get no body and a warning.
Environments
Each entry of servers becomes environments/<name>.yaml, named from its description in kebab-case (server-1, server-2, … without one). It defines baseUrl (the URL with each server variable replaced by its default, without a trailing /) and every server variable, and declares the auth secrets without values. A relative server URL is resolved against the document’s URL; in a local file it is kept as is, with a warning.
An environment file that already exists is never overwritten by an import: a warning says so, and --sync merges it instead.
Auth
components.securitySchemes become auth config. The document-wide security sets the auth of the collection’s _collection.yaml; an operation with its own security gets its own auth (type: none for security: []). The first alternative of a requirement is used.
| Scheme | Auth | Secrets |
|---|---|---|
http, basic | basic | <scheme>_username, <scheme>_password |
http, bearer | bearer | <scheme>_token |
apiKey in header / query | api_key in that location | <scheme>_key |
apiKey in cookie | api_key header Cookie: <name>={{<scheme>_key}} | <scheme>_key |
oauth2 with clientCredentials (else authorizationCode, sent with PKCE) | oauth2 with the flow’s URLs and scopes | <scheme>_client_id, <scheme>_client_secret |
Credentials are always {{variables}} declared as secrets: no credential value is ever written to a file. Set them with rustman secret set. openIdConnect, mutualTLS, other http schemes (such as digest) and oauth2 with only the implicit or password flow are left unconfigured, with a warning:
warning: /components/securitySchemes/oidc: security scheme 'oidc' (openIdConnect) is not configured; set up its auth by hand
Secret references in the document
The document cannot name your secrets. A secret reference ({{secret:...}}) in a path or parameter name, an example body, a server URL or variable default, or a security scheme is written escaped, as \{{secret:...}}: literal text that is sent as written and never reads a provider secret. Each one gets a warning at its JSON pointer, in rustman import openapi (also with --sync) and in the import_openapi agent tool:
warning: /paths/~1leak/post: secret reference {{secret:vault/kv/prod/db#password}} from the document neutralized: it is kept as literal text and never resolved
Import snapshot
Every import stores the bundled, normalized document at .rustman/openapi/<collection>.json (<collection> is the collection folder’s path in kebab-case) and records where it came from in the collection’s _collection.yaml:
source:
format: openapi
location: shop.yaml
sha256: '<the SHA-256 of the document text>'
location is the path relative to the workspace root, or the URL without any user:password@. The snapshot is the base of the next sync. It lives in .rustman/, which is git-ignored: a teammate who syncs a collection imported elsewhere imports it again into an empty folder instead.
Sync
rustman import openapi <src> --sync brings a collection imported earlier up to date with a new version of the document. It is a three-way merge: the snapshot is the base, the request files are local, the new document is remote. For each operation (matched by the openapi:operationId= tag, or method and openapi:path=):
- a field (
name,description,method,url,body,auth) takes the new value only when you have not changed it; when both changed, yours is kept and the operation is listed as a conflict,kept local; query,headersandtagsmerge row by row: rows you added always stay, rows you deleted stay deleted, and new rows from the document are added;settings,variables,assertionsandcapturesare never touched;- new operations are written (new folders get their
_collection.yaml, existing folders get the new requests inorder); - removed operations are moved to
<collection>/_removed/, never deleted. Folders whose name starts with_are not run.
Environments are merged the same way, variable by variable, and the snapshot and source are replaced. A collection without a snapshot is not synced (exit code 2). --sync on a folder that does not exist or is empty is a plain import.
Every sync prints a summary; --json prints it as JSON (added, removed, changed, conflicts, unchanged, environments, dryRun), and --dry-run prints it without writing any file.
Walkthrough
# shop.yaml
openapi: 3.1.0
info:
title: Shop
version: '1'
servers:
- url: https://api.example.com/v1
description: Production
security:
- bearerAuth: []
paths:
/pets:
post:
operationId: createPet
tags: [pets]
requestBody:
content:
application/json:
schema:
type: object
required: [name, age]
properties:
name: {type: string}
age: {type: integer, minimum: 1}
responses:
'201': {description: Created}
/pets/{petId}:
delete:
operationId: deletePet
tags: [pets]
parameters:
- {name: petId, in: path, required: true, schema: {type: string}}
responses:
'204': {description: Deleted}
components:
securitySchemes:
bearerAuth: {type: http, scheme: bearer}
$ rustman import openapi shop.yaml
imported 2 operations into shop
created environment 'production'
The body is synthesized from the schema, and the token is a secret placeholder:
# shop/pets/create-pet.rman.yaml (generated)
version: 1
kind: http
name: createPet
tags:
- openapi:operationId=createPet
- openapi:path=/pets
method: POST
url: '{{baseUrl}}/pets'
body:
type: json
content:
name: string
age: 1
# environments/production.yaml (generated)
variables:
baseUrl: https://api.example.com/v1
secrets:
- bearerAuth_token
You edit the body:
# shop/pets/create-pet.rman.yaml
version: 1
kind: http
name: createPet
tags:
- openapi:operationId=createPet
- openapi:path=/pets
method: POST
url: '{{baseUrl}}/pets'
body:
type: json
content:
name: Rex
age: 3
The next version of the document adds an example, drops deletePet and adds listPets:
# shop-v2.yaml
openapi: 3.1.0
info:
title: Shop
version: '2'
servers:
- url: https://api.example.com/v2
description: Production
security:
- bearerAuth: []
paths:
/pets:
get:
operationId: listPets
tags: [pets]
responses:
'200': {description: OK}
post:
operationId: createPet
tags: [pets]
requestBody:
content:
application/json:
schema:
type: object
required: [name, age]
properties:
name: {type: string}
age: {type: integer, minimum: 1}
example: {name: Fido, age: 2}
responses:
'201': {description: Created}
components:
securitySchemes:
bearerAuth: {type: http, scheme: bearer}
$ rustman import openapi shop-v2.yaml --sync --dry-run
added: listPets (pets/list-pets.rman.yaml)
conflict: createPet body: kept local
removed: deletePet (moved to _removed/delete-pet.rman.yaml)
environment production: updated
1 added, 0 changed, 1 removed, 1 conflict, 0 unchanged (dry run: nothing was written)
$ rustman import openapi shop-v2.yaml --sync
added: listPets (pets/list-pets.rman.yaml)
conflict: createPet body: kept local
removed: deletePet (moved to _removed/delete-pet.rman.yaml)
environment production: updated
1 added, 0 changed, 1 removed, 1 conflict, 0 unchanged
Your body is kept, deletePet is in shop/_removed/, and the environment points at the new server:
# environments/production.yaml (generated)
variables:
baseUrl: https://api.example.com/v2
secrets:
- bearerAuth_token
The commands on this page run in CI: crates/rustman-cli/tests/docs_import_openapi.rs writes each # <file> block, runs each $ rustman ... line and compares its output and every (generated) block with what the import wrote.
GraphQL
Rustman treats GraphQL as more than an HTTP POST: requests are kind: graphql files, and a schema (introspected and cached, or read from a file) drives validation, completion and the explorer. The behavior is specified in openspec/specs/graphql-requests.
Request files
# users/get-user.rman.yaml
version: 1
kind: graphql
name: Get user
endpoint: '{{base_url}}/graphql'
document: |
query GetUser($id: ID!) {
user(id: $id) { name email }
}
operation_name: GetUser
variables:
id: '{{user_id}}'
headers:
- name: X-Client
value: rustman
auth:
type: bearer
token: '{{api_token}}'
| Field | Required | Default | Meaning |
|---|---|---|---|
version, kind, name, description, tags | As for every request file (request-files.md); kind is graphql. | ||
endpoint | yes | The GraphQL endpoint URL. | |
document | one of | The operation document, inline. | |
document_file | one of | A .graphql file, relative to the request file and inside the workspace. | |
operation_name | no | Selects one operation of a document that has several. | |
variables | no | The GraphQL variables, any JSON shape. | |
headers | no | {name, value} pairs, merged over the collection’s headers. | |
auth | no | the collection’s | Any auth helper of HTTP requests. |
transport | no | http | http, ws (WebSocket subscriptions) or sse (subscriptions over Server-Sent Events). |
method | no | POST | GET sends a query as URL parameters; mutations cannot use it. |
apq | no | false | Automatic Persisted Queries. |
schema_file | no | An SDL or introspection JSON file used instead of the schema cache (see Schema file). | |
preset | no | detected | geth (EIP-1767) or subgraph (The Graph): blockchain display and helpers (see Blockchain GraphQL presets). |
ws_protocol | no | auto | auto, graphql-transport-ws or graphql-ws (the legacy subscriptions-transport-ws protocol). |
connection_params | no | The connection_init payload of WebSocket subscriptions. | |
max_events | no | 10 | Headless subscriptions stop after this many events (at least 1). |
duration | no | 30s | Headless subscriptions stop after this long: 500ms, 30s, 2m, or milliseconds. |
Exactly one of document and document_file must be set. A file with neither or both fails to load, naming the file:
api/users.rman.yaml: graphql: exactly one of document or document_file is required
Unknown fields, an empty endpoint, max_events: 0 and values outside the lists above are load errors too. Rustman never rewrites a graphql file: saving it keeps its text as written.
Variables and interpolation
{{name}} placeholders are resolved with the usual precedence in:
endpoint;headers, including headers inherited from_collection.yaml;authfields;- every string value inside
variablesandconnection_params, at any depth. Keys, numbers, booleans andnullare kept as written.
With variables: { id: "{{userId}}" } and userId=42, the payload’s variables is {"id": "42"}.
The document is never interpolated: a literal {{x}} inside a string argument is sent byte for byte, and a document_file is sent exactly as stored (line endings included). Use GraphQL variables to parameterize an operation. An unresolved placeholder fails the send and lists every missing name, as for HTTP requests.
The request’s variables are GraphQL variables, so they are not a layer of Rustman variables. Secrets used anywhere in the request, variables included, are redacted wherever the request is shown or recorded.
Schemas
A schema enables validation before send, deprecation warnings, completion and the explorer. Rustman picks the first of:
- the request’s
schema_file; - the
schema_fileof the request’s[[graphql.endpoints]]entry inrustman.toml; - the cached introspection result for the request’s endpoint.
With none of them, only the document’s syntax is checked. Choosing a schema never sends a request: introspection happens only when you refresh the schema explicitly (rustman graphql introspect, or the refresh action of the TUI GraphQL pane).
Introspection
Refreshing sends the standard introspection query as a POST to the endpoint, through the same HTTP transport as every request (TLS, proxies, auth, cookies, redaction). It asks for descriptions, deprecations (isDeprecated, deprecationReason, including deprecated arguments and input fields), specifiedByURL and isRepeatable. A server that rejects those newer fields (Cannot query field "specifiedByURL" ...) is asked once more with the June 2018 introspection query.
Any other failure (introspection disabled, an error status, a body that is not a GraphQL result) fails with a hint:
graphql: introspection failed: GraphQL introspection is not allowed; set schema_file to validate offline
graphql: introspection failed: HTTP 502: response is not a GraphQL result; set schema_file to validate offline
The result is converted to SDL and parsed. A schema that parses but breaks a validation rule is kept, with warnings: it is what the server executes.
The response is parsed whole, so it is held in memory and may be at most rustman.toml [graphql] max_schema_bytes (64 MiB by default). This limit replaces [http] max_body_bytes and max_download_bytes for introspection: real schemas can come close to the 10 MiB max_body_bytes default, so a schema between the two is kept in memory rather than spilled to disk. A larger response stops downloading as soon as the limit is passed and is refused, without being parsed, spilled to disk, read back or cached (exit code 3):
graphql: introspection failed: the response is larger than the 67108864 byte limit ([graphql] max_schema_bytes); set schema_file to validate offline
# rustman.toml
[workspace]
name = "shop"
version = 1
[graphql]
max_schema_bytes = 134217728 # allow schemas up to 128 MiB
Schema cache
Introspection results are cached in .rustman/graphql/schemas/<hash>.json, under the workspace root (rustman init adds .rustman/ to .gitignore). <hash> is the SHA-256 of the normalized endpoint: scheme, host, port and path, with user info, query and fragment removed. Endpoints that differ only in their query share a cache entry; each environment’s host gets its own.
A cache file holds:
| Key | Meaning |
|---|---|
format | 1. |
endpoint | The normalized endpoint, with any secret in it redacted. |
fetched_at | When it was fetched, RFC 3339 UTC. |
sdl_sha256 | The SHA-256 of the schema as SDL, for cheap comparisons. |
type_count | Named types defined by the schema (built-in types excluded). |
introspection | The raw {"__schema": ...} result, lossless. |
A cached schema is used until it is refreshed; sending or validating a request never refreshes it. Secret values used by the request are never written to the cache file.
Schema file
When introspection is disabled, point schema_file at a schema checked into the workspace. It may be SDL (.graphql, .graphqls) or an introspection result in JSON (.json, or any file starting with {; a whole response, its data, or the __schema object). When a schema_file applies, the cache is not read at all.
In a request file the path is relative to the request file. In rustman.toml, an endpoint entry applies to every request whose endpoint is written the same way, or resolves to the same normalized URL; its path is relative to the workspace root:
# rustman.toml
[workspace]
name = "shop"
version = 1
[[graphql.endpoints]]
url = "https://api.example.com/graphql"
schema_file = "schemas/api.graphql"
Both paths must stay inside the workspace.
Validation before send
Before a request is sent, its document is checked:
-
With a schema, against every validation rule of the GraphQL specification. Each error is reported with its
line:columnin the document, using the messages of the reference implementation:1:17: Cannot query field "emial" on type "User".The request’s
variablesare then checked against the variable definitions of the selected operation. A missing required variable (non-null, no default), anullfor a non-null type, or a value of the wrong shape (scalar, enum value, input object field, list item) blocks the send, naming the variable’s path. The messages never show the value itself, which may be a secret:variable $id of type ID! is required variable $input.role: expected Role, got stringCustom scalars (such as
Upload) accept any value: only the server knows their rules. -
Without a schema, only the syntax is checked; a syntax error still blocks the send:
1:23: syntax error: expected R_CURLY, got EOF
Validation errors block the send unless you pass --no-validate (CLI) or confirm in the TUI.
Fields and enum values the schema marks @deprecated produce a warning with the reason (No longer supported when the schema gives none). Warnings never block the send:
1:17: User.username is deprecated: Use handle
Choosing the operation
A document with one operation (named or anonymous) is sent as is. A document with several needs operation_name; without it the send fails before anything leaves the machine:
graphql: document has 2 operations; set operation_name
operationName is sent only when the request sets operation_name.
Sending over HTTP
With transport: http (the default), queries and mutations go through the same HTTP transport as every request: TLS, proxies, cookies, auth helpers, timings and redaction all apply.
-
POST (the default) sends a JSON body
{"query", "operationName", "variables"}withContent-Type: application/json. Members that are not set (nooperation_name, novariables) are left out. -
method: GETsendsquery,operationNameand the JSON-encodedvariablesas URL parameters, for servers and CDNs that cache GET queries. Mutations and uploads cannot use GET:graphql: mutations cannot use GET -
Subscriptions need
transport: wsortransport: sse.
Every request sends Accept: application/graphql-response+json, application/json unless the request sets its own Accept header.
Results
A response body is parsed into data, errors (message, locations, path, extensions) and extensions, kept apart, with an overall status:
| Status | Meaning |
|---|---|
ok | No errors. |
partial | Both data and errors: the data is shown next to the errors. |
errors | Errors and no data. |
Error paths are shown joined with dots: ["user", "email"] is user.email, ["users", 0, "name"] is users.0.name. The HTTP status and timings are shown too. A body that is not a GraphQL result (an HTML error page from a proxy, say) is shown raw with:
graphql: response is not a GraphQL result
A result is parsed whole, so its body may be at most rustman.toml [http] max_body_bytes (10 MiB by default, see HTTP), not the max_download_bytes limit of plain HTTP requests. A larger body is refused as soon as the limit is passed, without being parsed, spilled to disk or stored:
HTTP: the response body is larger than the <n> byte limit (max_body_bytes)
The request is errored (exit code 3) and is not sent again (with apq: true, the full document is not sent after an oversized first answer). History records the error but none of the body.
File uploads
A variable value { "$file": "path" } uploads that file, following the GraphQL multipart request specification. The path is relative to the request file and must stay inside the workspace:
# media/upload-avatar.rman.yaml
version: 1
kind: graphql
name: Upload avatar
endpoint: '{{base_url}}/graphql'
document: |
mutation Upload($file: Upload!) {
upload(file: $file)
}
variables:
file:
$file: ./avatar.png
The request becomes multipart/form-data with an operations part (the payload, each file replaced by null), a map part ({"0": ["variables.file"]}) and one part per file, named 0, 1, …, whose Content-Type is guessed from the file extension (application/octet-stream when unknown). Markers may appear at any depth, including inside lists. A file that does not exist fails before anything is sent:
graphql: upload file not found: ./avatar.png
The files are read when the request is sent and held in memory while it is sent, as for kind: http multipart bodies; very large uploads are better sent another way for now.
Automatic Persisted Queries
With apq: true, Rustman first sends only the SHA-256 hash of the document (extensions.persistedQuery with version: 1 and sha256Hash), without query. If the server answers PersistedQueryNotFound (by message or by extensions.code), it sends the full document with the hash once more, which registers it. The result shows which happened: APQ hit, or APQ miss (registered) after two requests. When the second answer is PersistedQueryNotFound again or not a GraphQL result, it shows APQ miss (not registered). A server that answers PersistedQueryNotSupported also gets the full document once, shown as APQ miss (not registered). When the first answer is not a GraphQL result (an HTML error page, say), neither is shown: the server did not say whether it knew the hash.
Explorer and completion
With a schema, the engine exposes explorer data for the TUI explorer and the agent interface: the root operation types, every named type with its kind and description, fields with arguments, argument types and defaults, enum values, input fields, interfaces and possible types, the @specifiedBy URL of custom scalars, directives, and the deprecation status of each field, argument, input field and enum value.
Completion works on documents that are still being typed. At the cursor it offers the fields of the enclosing type (with __typename), the arguments of the enclosing field or directive, the values of an enum-typed argument, the variables the operation declares (after $), directive names (after @) and fragment names (after ...), each with its type signature, such as user(id: ID!): User.
In the TUI
The TUI GraphQL editor uses the same data: the document is checked as you type, with problems underlined and the one at the cursor shown on the editor’s last line; Ctrl+Space opens the completion popup; the Schema tab browses types and fields. Ctrl+G refreshes the schema by introspection. Results show in the Data, Errors, Extensions and Events tabs of the response viewer, redacted like history.
Subscriptions
Subscriptions need transport: ws or transport: sse. Each result the server pushes is recorded as a timestamped event, in order.
# live/on-message.rman.yaml
version: 1
kind: graphql
name: On message
endpoint: '{{base_url}}/graphql'
transport: ws
document: |
subscription OnMessage($room: String!) {
onMessage(room: $room) { id text }
}
variables:
room: lobby
connection_params:
authToken: '{{api_token}}'
max_events: 5
duration: 10s
assertions:
- no_errors: true
- data: {path: '$[0].onMessage.text', exists: true}
WebSocket
With transport: ws, an http:// or https:// endpoint is reached as ws:// or wss:// (a ws(s):// endpoint is used as is). The handshake carries the request’s headers, auth helper and cookies, and uses its TLS settings (ca_bundle, client certificates, verify_tls, --insecure) and proxies (an HTTP proxy always tunnels with CONNECT); the WebSocket stack is shared with JSON-RPC.
Rustman speaks graphql-transport-ws: it sends connection_init with connection_params as its payload, waits for connection_ack, sends subscribe, records each next, answers ping with pong, and sends complete when it stops the subscription. A server that does not acknowledge the connection within 10 seconds (or, headless, within what is left of duration; the handshake is bounded the same way) stops the subscription with:
graphql: connection_ack timeout
ws_protocol picks the subprotocol:
ws_protocol | Behavior |
|---|---|
auto (default) | Offers graphql-transport-ws and graphql-ws. A server that only accepts the legacy graphql-ws (subscriptions-transport-ws) gets that protocol (start, data, stop, connection_terminate), and the result shows legacy subscriptions-transport-ws. |
graphql-transport-ws | Only the modern protocol. |
graphql-ws | Only the legacy protocol. |
An error message from the server ends the subscription; its errors become the last event. A server that closes the connection without complete fails the subscription, with the close code and reason graphql-transport-ws uses for errors (for example 4401 Unauthorized or 4403 Forbidden):
the server closed the connection without complete (4403 Forbidden)
Events are held in memory, so one WebSocket message (and one frame) may not be larger than rustman.toml [http] max_body_bytes (10 MiB by default); a larger one ends the subscription with error and WebSocket: a message is larger than the <n> byte limit (max_body_bytes). The events received before it are kept.
When Rustman stops a subscription, it gives the server 2 seconds to take the complete (or stop) message and the close; a server that does not read them is left behind.
Server-Sent Events
With transport: sse, Rustman follows the GraphQL over SSE distinct connections mode: it POSTs the operation (as for queries) with Accept: text/event-stream, through the same HTTP transport as every request, records each next event and stops on complete. Stopping early closes the connection. A stream that ends without a complete event fails the subscription with SSE: the stream ended without a complete event. Events are held in memory, so one event (with the line being read) may not be larger than rustman.toml [http] max_body_bytes (10 MiB by default, see HTTP); a larger one ends the subscription with error and SSE: an event is larger than the <n> byte limit (max_body_bytes). A response that is not a successful event stream fails with graphql: subscription: SSE: HTTP <status> .... The response must start within the request timeout (headless, within what is left of duration), or the subscription fails with SSE: the stream did not open within <n> ms; stopping before then fails it with SSE: stopped before the stream opened.
When a subscription stops
Headless subscriptions (rustman run, rustman graphql query) stop after max_events events (default 10) or duration (default 30s), whichever comes first; --max-events and --duration replace both for every request of the command. A subscription also stops when the server completes it, closes the connection or sends an error, and on Ctrl+C: it then tells the server it stopped and keeps the events collected so far, which are printed, checked and recorded with stopped (it has 5 seconds for this; the command exits 130). Interactive subscriptions in the TUI run until the server completes them or you stop them (Alt+X); the first 1000 events are kept for the result and its assertions, later ones are counted, and history records the first 100.
The reason is recorded as complete, max_events, duration, stopped, closed or error. A subscription that failed (closed without complete, or an SSE event over the size limit) also records why as failure, which is an error of its result: no_errors fails and rustman graphql query exits 1.
Assertions and captures
GraphQL requests take assertions and captures like HTTP requests (see Assertions and captures), plus checks of the GraphQL result:
| Assertion | Passes when |
|---|---|
no_errors: true | The result has no errors (no_errors: false: it has some). A failure lists each error’s message and path. |
errors_count: <n> | There are exactly n errors; errors_count: {gt|gte|lt|lte|equals: <n>} compares instead. |
error_message_contains: <text> | Some error’s message contains text. |
error_code: <code> | Some error’s extensions.code is code. |
data: {path, <op>: value} | A JSONPath check rooted at data: $.user.name reads data.user.name. The operators are those of json. |
# auth/login.rman.yaml
version: 1
kind: graphql
name: Login
endpoint: '{{base_url}}/graphql'
document: |
mutation Login($password: String!) {
login(user: "ada", password: $password) { token }
}
variables:
password: '{{password}}'
assertions:
- no_errors: true
- data: {path: $.login.token, type: string}
captures:
- {var: token, from: json, path: $.data.login.token}
Captures read the whole response body, so a value under data is at $.data...; the captured token is set for the later requests of the run. A failed no_errors reads, for instance:
no_errors: expected no errors, got 1 error: "email is private" at user.email
For a subscription, the checks read the collected events as one result: data is the list of every event’s data ($[0].onMessage, $ with length) and errors holds every event’s errors. Status, header and latency assertions read the handshake (101) or the SSE response.
In rustman run
rustman run executes graphql request files alongside HTTP ones, in collection order: values captured by either kind are available to the next requests. Each graphql request is validated and sent as described above; a validation error, an ambiguous document or a transport failure makes the request errored (exit code 3), and failed assertions make it failed (exit code 1). Reports list GraphQL assertions with their own kinds (no_errors, errors_count, error_message_contains, error_code, data), and a response that is not a GraphQL result adds the warning graphql: response is not a GraphQL result.
History
Every executed GraphQL operation is recorded in history like any request, and its entry’s record.graphql adds:
| Key | Meaning |
|---|---|
operation_name, operation_type | The selected operation and whether it is a query, mutation or subscription. |
transport, protocol | http, ws or sse, and for subscriptions the protocol used (graphql-transport-ws, legacy subscriptions-transport-ws or sse). |
variables | The variables sent, uploads as null, with secrets redacted as «redacted:<name>». |
result | ok, partial or errors; null when the response was not a GraphQL result. |
apq | APQ hit, APQ miss (registered) or APQ miss (not registered), with apq: true; null when the first answer is not a GraphQL result. |
subscription | event_count, the first 100 events (ts, elapsed_ms, payload, redacted), why it ended and, when it failed, the failure (redacted). |
Subscriptions cannot be replayed with rustman history replay; queries and mutations over HTTP can.
CLI commands
rustman graphql introspect
rustman graphql introspect <endpoint | request> [--out <file>] [--env <name>] [--var k=v]... [--timeout <duration>] [--insecure]
Fetches the schema of an endpoint URL, or of a graphql request’s endpoint resolved in the active environment (with its headers and auth), and stores it in the schema cache. Outside a workspace a URL can still be introspected, but nothing is cached. --out <file> also writes the schema as SDL.
$ rustman graphql introspect https://api.example.com/graphql --out schema.graphql
introspected https://api.example.com:443/graphql: 42 types, fetched at 2026-11-18T09:30:00.123Z
cached in .rustman/graphql/schemas/5f2b...e1.json
wrote schema.graphql
It exits 0 on success, 3 when the server cannot be reached or refuses introspection (with the set schema_file hint), and 2 for a bad argument.
rustman graphql query
rustman graphql query <request | --endpoint <url> --query <text>> [--env <name>] [--var k=v]...
[--no-validate] [--json] [--max-events <n>] [--duration <duration>]
[--timeout <duration>] [--insecure] [--no-history]
[-u | --update-snapshots] [--ci]
Validates the operation, sends it and prints the result. The request is a graphql request file, its id or its name; --endpoint with --query sends an ad-hoc operation without a workspace (a ws:// or wss:// endpoint subscribes over WebSocket). --no-validate sends even when validation fails. The request’s assertions are checked and the exchange is recorded in history, as in rustman run; snapshots honor --update-snapshots, --ci and the CI variable the same way.
The output starts with the HTTP status, the result status and the time, then data, errors and extensions apart; a subscription prints its protocol, event count and why it ended, the failure when there is one (failed: ...), then each event. Everything is redacted. --json prints one JSON object instead (status, result, data, errors, extensions, apq, or for a subscription protocol, ended, event_count, failure and events).
$ rustman graphql query users/get-user.rman.yaml --env dev
HTTP 200 · partial · 41 ms
data:
{
"user": {
"name": "Ada",
"email": null
}
}
errors:
- email is private (path user.email, at 1:22, code FORBIDDEN)
| Exit code | Meaning |
|---|---|
| 0 | No errors (and the request’s assertions passed). |
| 1 | errors is not empty, the response is not a GraphQL result, or an assertion failed. |
| 2 | Usage or configuration error (no workspace, unknown request, not a graphql request). |
| 3 | No response (network, TLS, timeout, unresolved variable, connection_ack timeout, a body over max_body_bytes) or the document failed validation. |
| 130 | Interrupted by Ctrl+C. |
Agent tools
The agent MCP server registers two GraphQL tools when it is built with GraphQL support (the default graphql feature of rustman-mcp; a build without it lists neither):
| Tool | What it does |
|---|---|
graphql_introspect | The schema of an endpoint or saved graphql request (path): the root types and every named type, or one type in full with type_name. It reads the schema_file or the schema cache, and introspects the endpoint (caching the result) only when there is neither, or with refresh: true. |
graphql_query | Validates and sends a saved graphql request, or an ad-hoc operation (endpoint, query, operation_name, variables, headers), over HTTP, and returns the redacted data, errors and extensions with the assertions. |
Both send through the session’s allowlist, production check and rate limit. A query is a read; a mutation needs [agent] allow_mutations = true and the human’s confirmation, as an HTTP POST does; subscriptions (and requests with transport: ws or sse) are refused with code: "blocked", as are an endpoint URL with query, operationName or extensions parameters and file uploads ($file) in ad-hoc variables. An operation that fails validation comes back errored and is not sent. Operations are recorded in history like every request. See Agent interface.
JSON-RPC
Rustman sends JSON-RPC 2.0 calls, batches, notifications and subscriptions over HTTP and WebSocket to any JSON-RPC service: EVM nodes, Bitcoin Core, Solana, Starknet and LSP-style services. It is chain-agnostic: method names are never interpreted and values are never decoded, so "0x10" stays 0x10. The request file format is in request-files.md; the behavior is specified in openspec/specs/jsonrpc-requests.
Envelopes and ids
Each call becomes {"jsonrpc":"2.0","method":…,"params":…,"id":…}, members in that order, sent with Content-Type: application/json. params is left out when the file has none. The minimal file
version: 1
kind: jsonrpc
name: Block number
endpoint: '{{rpc_url}}'
method: eth_blockNumber
sends exactly {"jsonrpc":"2.0","method":"eth_blockNumber","id":1}.
- Without
id, ids are sequential integers from 1 per connection. Over HTTP every request is its own connection, so a batch carries ids 1, 2, …; over a reused WebSocket the numbering continues. - An explicit
id(string or integer) is sent unchanged and takes no sequence number. Sequential ids skip the explicit ids of the same request, so in a batch of{method: a, id: 1}and{method: b}the second call gets id 2. - Two calls of a batch with the same explicit id are a load error,
<path>:<line>: duplicate id 1 in batch: their answers could not be told apart. - A notification (
notification: true) carries noid. Over HTTP the exchange completes when the HTTP response arrives (204 No Contentpasses); any body is recorded but not parsed.
Responses
| Response | Outcome |
|---|---|
result | The call succeeded. |
error object | The call failed with rpc error <code>: <message>; code, message and data are kept. |
both or neither member, or jsonrpc other than "2.0" | Exchange error invalid JSON-RPC response: <reason>. |
another id (single call over HTTP) | Exchange error response id <x> does not match request id <y>. |
| non-2xx status with a JSON-RPC error body | That error object. |
| non-2xx status with any other body (an HTML gateway page) | Exchange error HTTP <status> (exit-code class 3). |
A failed call fails the request. An exchange error means no usable answer came back.
An answer may be at most [http] max_body_bytes (default 10 MiB): the HTTP response body, or each WebSocket message. A larger one is refused as soon as the limit is passed, without being parsed or stored: the exchange error HTTP: the response body is larger than the <n> byte limit (max_body_bytes), or WebSocket: a message is larger than the <n> byte limit (max_body_bytes) (exit-code class 3). It is not retried, and history records the error but none of the body, so a recorded response is never larger than the limit.
Batches
A batch of 1 to 100 calls goes out as one JSON array (one HTTP request, or one WebSocket frame). Responses are matched to calls by id, in any order, and each call keeps its own assertions and captures. A call without a response fails with no response for id <x>. A server that answers a batch with a single error object (many public nodes disable batches) fails every call with that error, reported once with the note server rejected the batch. The request passes only when every call that expects an answer passes.
Timeouts and retries
Calls use the kind: http timeouts: settings.timeout_ms (default 30000) for the response and settings.connect_timeout_ms (default 10000) for connecting, per HTTP request and per WebSocket call. A timeout is reported as timeout after <n> ms (<phase>).
JSON-RPC is POST-only, so HTTP semantics cannot tell reads from writes. Retries therefore only apply to files marked idempotent: true:
idempotent: true
settings:
retry: {attempts: 2, backoff_ms: 500}
attempts (default 0) counts the tries after the first. A try is repeated after a connection error, a timeout, HTTP 429, 502, 503 or 504, or error code -32005 (limit exceeded). The wait starts at backoff_ms (default 500) and doubles each time; a Retry-After header (seconds or an HTTP date, at most 60 seconds) replaces it. Every attempt is recorded with its status, error and wait. Without idempotent: true, nothing is retried.
WebSocket
For ws:// and wss:// endpoints the call goes out as a text frame on a WebSocket opened with the same stack as GraphQL subscriptions: the request’s headers, auth and cookies in the handshake, [http] proxies (HTTP CONNECT, HTTPS, SOCKS5) and TLS settings (ca_bundle, client certificates, verify_tls). The answer is the frame whose id matches; unrelated frames, such as subscription notifications, are skipped. Outside rustman run (rustman rpc call, rpc batch and the TUI), the connection closes when the exchange ends. Within one rustman run, files with the same endpoint, handshake headers, TLS settings and proxy share one connection. Status and header assertions are not available over WebSocket.
Subscriptions
JSON-RPC has no standard subscription shape, so a subscription names three methods:
version: 1
kind: jsonrpc
name: New heads
endpoint: wss://{{node_host}}/ws
params: [newHeads]
subscription:
subscribe: eth_subscribe
unsubscribe: eth_unsubscribe
notification: eth_subscription
max_events: 3
assertions:
- json: {path: $.events, length: 3}
Rustman calls subscribe with params, takes its result as the subscription id, and records every notification message whose id (at notification_id_path, default $.params.subscription) equals it as an event. Headless (rustman run, rustman rpc call), the subscription ends after max_events events (default 10) or max_duration_ms (default 30000), whichever comes first; then unsubscribe is called with the id. Events are assertable as a list at $.events, next to the subscribe call’s $.result. The same triple covers Solana (accountSubscribe / accountNotification / accountUnsubscribe, with notification_id_path: $.params.subscription) and Starknet.
A subscription over an http:// or https:// endpoint fails to load with subscriptions require a ws:// or wss:// endpoint.
Assertions and captures
Assertions and captures evaluate against the whole response envelope (not just result), so $.result addresses the result and $.error the error object, exactly as --raw prints them. In a batch, each call’s assertions and captures read that call’s own envelope, and failures name the call (call 2 (eth_blockNumber): …). Status and header assertions read the HTTP response; over WebSocket they are rejected at load time. Values are kept as received: capturing $.result of eth_blockNumber gives 0x12a05f2, not a number.
assertions:
- json: {path: $.result, type: string}
- rpc_error: none
captures:
- {var: head, from: json, path: $.result}
rpc_error checks how the call ended:
| Assertion | Passes when |
|---|---|
rpc_error: {code: -32602} | the call failed with error code -32602 |
rpc_error: {code: -32602, message_contains: invalid} | … and its message contains invalid (interpolated) |
rpc_error: none | the call returned a result |
Its failures read rpc_error: expected code -32602, got result and rpc_error: expected code -32602, got code -32601. A call that fails with an error object fails the request unless it has an rpc_error: {code: …} assertion; with one, the assertion decides.
Snapshots
A snapshot assertion records how a call answered and compares later runs against it. The snapshot body is the call’s response envelope, the same document other assertions read: jsonrpc, id and either result or the error object. Over HTTP, the status is compared too. For a subscription, the body is the list of events collected instead. In a batch, each call’s snapshot holds that call’s own envelope, matched by id. Each snapshot is a file named after the request file and the snapshot name, so names must be unique across all calls of a batch. A repeated name fails to load with duplicate snapshot name 'default' (give each call's snapshot its own name).
# chain/head-block.rman.yaml
version: 1
kind: jsonrpc
name: Head block
endpoint: '{{rpc_url}}'
batch:
- method: eth_chainId
assertions:
- snapshot: {name: chain}
- method: eth_getBlockByNumber
params: ['0x1', false]
assertions:
- snapshot: {name: block, ignore: [$.result.timestamp]}
rustman run, rustman rpc call and rustman rpc batch record, compare and update these snapshots like any other: --update-snapshots (-u) rewrites one that differs, and --ci (or CI=true) never writes one. Agents compare in CI mode. rustman snapshot list and prune include them.
History
Every call, batch and subscription is recorded in history as one exchange. Next to the usual exchange (the HTTP request and response, for HTTP endpoints), the record’s jsonrpc part holds the transport, each call’s envelope sent and received with its outcome (result, error, notification, failed), every retry attempt (status, error, wait), a subscription’s id, event count and first 1000 events, and the note server rejected the batch when it applies. Secrets are redacted everywhere, including inside params: a param {{api_key}} is stored as «redacted:api_key». HTTP exchanges can be replayed; WebSocket ones cannot.
OpenRPC catalogs
An endpoint can have an OpenRPC document listing its methods, param names and schemas, and result schemas. Link a file in rustman.toml (JSON, or YAML for .yaml / .yml), keyed by the endpoint as request files write it or as it resolves:
[jsonrpc.catalogs]
"{{rpc_url}}" = "openrpc/node.json"
or fetch it from a node that implements rpc.discover:
$ rustman rpc discover {{rpc_url}} --env dev
42 methods cached in .rustman/cache/openrpc/3f1c….json
The cache file is named by the SHA-256 of the resolved endpoint (scheme, host, port, path and query, so ?network=main and ?network=test get catalogs of their own), so an API key in the URL never appears in a file name, and the document is stored with secrets redacted. A node answering rpc.discover with -32601 makes the command exit 1 with endpoint does not support rpc.discover; provide an OpenRPC file.
With a catalog, every call is checked before anything is sent, and each violation is printed with its param path:
unknown method 'eth_blockNumbr' (did you mean eth_blockNumber?)params[0]: expected string, got integer(positional params; named params readparams.<name>)params.address: missing required param 'address'- any other schema violation, as
params[1]: <reason>
A refused send exits 2. settings.validate: false in a request file, or --no-validate, skips the check. Without a catalog, nothing is validated.
rustman rpc call
rustman rpc call <endpoint|request> [method] [params-json] sends one call and prints its result, or its error object, as pretty JSON. The target is an endpoint (http, https, ws, wss, or a {{variable}} holding one) with a method and optional params (a JSON array or object), or a kind: jsonrpc request file, id or name (whose assertions are checked).
$ rustman rpc call http://127.0.0.1:8332 getblockcount --header "Authorization: Basic {{btc_auth}}" --env dev
800000
$ rustman rpc call {{rpc_url}} eth_getBalance '["0x00000000000000000000000000000000000000aa", "latest"]'
0 ETH
$ rustman rpc call wss://node.example/ws eth_subscribe '["newHeads"]' \
--subscribe eth_subscription --unsubscribe eth_unsubscribe --max-events 3
| Flag | Meaning |
|---|---|
--header, -H "Name: value" | Add a header (repeatable, interpolated) |
--id <id> | Send this id (an integer, or else a string) |
--notify | Send a notification: no id, nothing printed |
--subscribe <notification> --unsubscribe <method> | Subscribe with the method, print the subscription id and then each event (one per line) |
--max-events <n>, --duration <d> | Bound a subscription (defaults: the request’s, else 10 events and 30 s) |
--raw | Print the response envelopes (and event messages) as received |
--json | Print the whole exchange (status, calls, attempts, events, assertions) as one JSON object |
--no-validate | Skip the OpenRPC check |
--param name=value | A typed param of a built-in eth_*, net_* or web3_* method (repeatable), instead of the params JSON; see Typed JSON-RPC methods |
--env, --workspace, --var, --timeout, --insecure, --no-history | As for rustman send |
A native amount (eth_getBalance, eth_gasPrice) prints as 1 ETH, its wei, gwei and hex forms on stderr; --raw and --json keep the hex. Outside a workspace, endpoint calls still work (history goes to the platform data folder). Every output comes from the redacted record, so no secret is ever printed.
rustman rpc batch
rustman rpc batch <endpoint> <file> reads calls from a JSON array, a YAML list, or JSON lines (one {"method": …, "params": …} per line); - reads stdin. The calls are sent as one batch (more than 100 are split into consecutive batches of 100) and one line is printed per call, in input order: the result, or {"error": {…}}. --json prints them as one array; --header and --no-validate work as for rpc call.
$ printf '{"method":"eth_chainId"}\n{"method":"eth_blockNumber"}\n' | rustman rpc batch {{rpc_url}} -
"0x1"
"0x12a05f2"
Exit codes
| Code | rpc call / rpc batch | rpc discover |
|---|---|---|
| 0 | Every call returned a result (and every assertion passed) | The catalog was cached |
| 1 | A call returned a JSON-RPC error, or an assertion failed | The node answered with an error (-32601: no rpc.discover) or not with an OpenRPC document |
| 2 | Bad flags or input, or the OpenRPC catalog refused a call | Bad flags, no workspace |
| 3 | No usable answer: network, TLS, timeout, HTTP <status>, an invalid response | Same |
| 4 | A method guard refused a call (nothing was sent) | |
| 130 | Ctrl+C | Ctrl+C |
In rustman run
rustman run sends kind: jsonrpc files like any other request, in collection order, with captures shared across files and one WebSocket connection per endpoint and handshake headers for the whole run. Subscriptions are headless: they stop at max_events / max_duration_ms, which --max-events and --duration replace for every subscription of the run. The JSON report (--reporter json, rustman.report/v1) gives every JSON-RPC request a jsonrpc member next to exchange: the transport (http or ws), whether it was a batch, every call with the envelope sent, the envelope that answered it, its outcome (result, error, notification or failed) and failure, every HTTP attempt, a subscription’s id, events (the first 1000), event count, why it ended and whether it unsubscribed, and a refusal (validation or guard) when nothing was sent. Every value in it is redacted. For a WebSocket exchange exchange is null: the jsonrpc member is the record. A run exits 3 when a request errored and 4 when the errors include a call a method guard refused.
"jsonrpc": {
"transport": "http",
"batch": false,
"calls": [{
"method": "eth_blockNumber", "id": 1,
"request": {"jsonrpc": "2.0", "method": "eth_blockNumber", "id": 1},
"response": {"jsonrpc": "2.0", "id": 1, "result": "0x12a05f2"},
"outcome": "result"
}],
"attempts": [{"status": 200, "error": null, "elapsed_ms": 1.4}],
"elapsed_ms": 1.45
}
CI runs a fixture collection (a call, a batch, a subscription and an error assertion) against in-process stubs on every OS, and against a local Anvil node (--block-time 1) in the jsonrpc-anvil job: set RUSTMAN_ANVIL_URL=http://127.0.0.1:8545 to run that part locally (cargo test -p rustman-cli --test rpc_run).
In the TUI
A kind: jsonrpc request opens in its own editor (see Terminal UI): the endpoint on the URL row (RPC, or SUB for a subscription), and the tabs Call (the method, completed from the endpoint’s OpenRPC catalog with each method’s param names, and the params as JSON), Batch, Headers, Auth and Assertions (each that part of the file as YAML). The response viewer adds the tabs Result, Error (code, message and data of each failed call) and Events. A subscription runs until you stop it: events are listed live with a counter, and Esc sends unsubscribe and stops it, keeping the events.
Method guards
Capabilities built on this one (such as the EVM toolkit) can register method guards, checked before any jsonrpc request is sent from any face: rustman rpc, rustman run, the TUI and the agent tool. For a subscription, guards are also asked about its subscribe and unsubscribe methods before anything is sent. A guard that refuses a method stops the whole request with its own message, sends nothing, and exits 4; the history and report record show refusal: guard. Guards win over the request file, over --no-validate, and over agent_read_only_methods.
Agent tool
The agent MCP server registers the rpc_call tool. It takes either path (a saved kind: jsonrpc request) or endpoint with method and optional params (a JSON array or object), plus vars and timeout_ms, and returns each call’s result or error object, redacted, with the request’s assertions. Because JSON-RPC methods are not classified as reads or writes, an agent may only call methods matching a glob of [jsonrpc] agent_read_only_methods; the list is empty by default, so nothing is allowed until you add globs:
[jsonrpc]
agent_read_only_methods = ["eth_get*", "eth_blockNumber", "eth_chainId", "@evm-read"]
Entries starting with @ are presets other capabilities register (for example @evm-read); an unknown one stops the agent server at start with unknown method preset '@solana-read' (registered: …) and exit code 2. Each call is checked in this order, and nothing is sent unless all pass: the method guards (their own message), the safety policy (the endpoint’s host must be in [agent] allowed_hosts), subscriptions (refused: subscriptions are not available to agents), then the allowlist (method not marked read-only for agents). A refusal is a tool error with code: "blocked" and that message; an unknown preset is code: "invalid_input". Allowed calls go through the session’s governed sender: every POST and redirect hop is checked against the agent allowlist and the production rule, and paced by [safety].rate and [safety].concurrency, which rpc_call shares with the other requests of the session. A call to a ws:// or wss:// endpoint is admitted and paced by the same limiter before it is sent. The HTTP method rule of [agent] doesn’t apply: every JSON-RPC call is a POST, and agent_read_only_methods takes its place. Calls are recorded in history like any other.
gRPC
Rustman calls gRPC services from kind: grpc request files, with no generated code: message types come from the server (reflection), from local .proto files compiled in-process, or from a binary descriptor set. No protoc is needed.
This page covers the request file, where schemas come from, the descriptor cache, the method browser with its message templates, how calls are sent (message encoding, call types and the message timeline, stream bounds, deadlines, metadata, TLS and gRPC-Web, and status details), assertions and captures, kind: grpc in rustman run and history, and the rustman grpc commands. The behavior is specified in openspec/specs/grpc-requests.
Request files
version: 1
kind: grpc
name: Get product
target: "{{grpc_host}}" # host:port, grpc://host:port or grpcs://host:port
method: shop.v1.Catalog/GetProduct # package.Service/Method
message:
id: "p-1"
metadata:
- name: authorization
value: "Bearer {{token}}"
deadline_ms: 5000
| Field | Required | Meaning |
|---|---|---|
target | yes | host:port, grpc://host:port (plaintext HTTP/2) or grpcs://host:port (TLS). A bare host:port uses TLS on port 443 only. The host is a DNS name, an IPv4 address or a bracketed IPv6 address ([::1]:50051). {{variables}} work. |
method | yes | The fully qualified method, package.Service/Method. |
message | one of | The request message (unary and server streaming), as YAML or JSON in the proto3 JSON mapping. |
messages | one of | A list of request messages, sent in order (client and bidi streaming). Exactly one of message or messages is allowed. |
metadata | no | An ordered list of {name, value} pairs sent as request headers. Names ending in -bin take base64 values. enabled: false keeps a row without sending it. |
deadline_ms | no | The call deadline, sent as grpc-timeout. |
tls | no | enabled, insecure, ca_bundle, client_cert, client_key, client_pkcs12, client_pkcs12_password: the same options as for HTTP requests. enabled overrides the choice made from the target. |
transport | no | grpc (default) or grpc-web. |
schema | no | protos and import_paths, or descriptor_set (see below). Without it, reflection is used. |
stream | no | max_messages (default 100) and duration_ms (default 30000): the bounds of a headless stream. |
variables, assertions, captures, description, tags | no | As for other kinds. |
Load errors name the line, for example grpc: exactly one of message or messages is allowed, grpc: method must be fully qualified as package.Service/Method or grpc: target must be host:port or a grpc:// or grpcs:// URL.
Interpolation and redaction
{{variables}} are resolved in the target, metadata names and values, TLS settings, schema paths and the string values of messages (keys stay as written). Every missing variable is reported at once.
Secrets keep their placeholder wherever the call is recorded: metadata authorization: "Bearer {{token}}" reaches the server with the real token, and history stores Bearer «redacted:token». Literal credentials in authorization metadata are redacted the same way as the HTTP Authorization header.
Redaction matches secret values as text. Binary (-bin) metadata and bytes message fields are recorded in base64, so a secret the server returns inside binary data is not recognized there; keep secrets out of binary fields or treat those records as sensitive.
Schema sources
Server reflection
With no schema, Rustman asks the server through grpc.reflection.v1.ServerReflection, and falls back to grpc.reflection.v1alpha when v1 answers UNIMPLEMENTED. It lists the services, fetches the file declaring each one, and follows imports transitively. Well-known types (google/protobuf/*.proto) a server does not serve come from Rustman’s bundled copies. A listed service whose descriptors the server cannot return (such as a health service registered apart from reflection) is left out. Reflection, connecting included, must finish within the run’s timeout (--timeout, else [defaults] timeout_ms, else 30 s), or it fails with grpc: reflection at <target> failed: no answer within <ms> ms (exit code 3). A schema of more than 4096 files or 64 MiB of descriptors is refused as too large.
When neither version is implemented, the call fails with exit code 2:
grpc: server reflection unavailable at grpc://localhost:50051; set schema.protos or schema.descriptor_set
Local .proto files
schema:
protos: [protos/shop/v1/catalog.proto]
import_paths: [protos]
The files are compiled in-process with protox. Imports are looked up in import_paths (each proto’s own folder when there are none); google/protobuf/*.proto imports always resolve. Compile errors read <file>:<line>:<col>: <message>, with the file named as imported:
catalog.proto:7:18: expected ';' or '[', but found '}'
A missing token is reported right after the token before it.
Descriptor sets
schema:
descriptor_set: shop.binpb
A binary FileDescriptorSet, as written by protoc --descriptor_set_out --include_imports or buf build -o. A descriptor set larger than 64 MiB is refused.
Paths
Schema paths are relative to the request file’s folder and may not leave the workspace: ../ escapes (written or produced by a variable) fail with file path escapes workspace: <path>. Imports are read only from inside their import path: an import reached through a symlink pointing out of it fails with import '<name>' resolves outside its import path.
Descriptor cache
Descriptors obtained by reflection are cached in .rustman/grpc/descriptors/<sha256(target)>.bin, with a .json sidecar recording the target (secrets redacted) and when it was fetched. The key is the canonical target (grpc://host:port or grpcs://host:port), hashed so no host name or secret appears in file names.
A cached schema is reused until it is refreshed. When the cache answers, Rustman shows a notice that the data may be stale:
schema from the descriptor cache (fetched 2026-11-19T10:00:00Z); it may be stale, refresh with `rustman grpc list --refresh`
A refresh asks the server again and rewrites the cache. When the server cannot be reached, the cached schema stands in, with the same notice, so services, methods and templates can be browsed offline. .rustman/ is local state; keep it out of Git.
Method browser and templates
Services are listed by name with their methods and call types: unary, server streaming, client streaming or bidi. A description of a method shows its call type, request and response types and a request template:
shop.v1.Catalog/ListProducts
call type: server streaming
request: shop.v1.ListProductsRequest
response: shop.v1.Product
request template:
{
"pageSize": 0,
"category": "CATEGORY_UNSPECIFIED"
}
Templates use the proto3 JSON mapping (lowerCamelCase names) with every field at its default:
- nested messages are expanded three levels deep; deeper ones are
{} - repeated fields hold one element, maps one entry (
{"": 0}) - enums take their first value name
- only the first field of a
oneofis included - 64-bit integers are strings (
"0"), floating-point numbers0.0, bytes"" - well-known types take their canonical JSON form:
Timestamp"1970-01-01T00:00:00Z",Duration"0s", wrappers their inner default,Struct{},Valuenull
Calls
Message encoding
Messages are written in YAML or JSON and encoded with the proto3 JSON mapping: field names in lowerCamelCase or as written in the .proto (pageSize or page_size), enums by name or number, 64-bit integers as strings or numbers, and well-known types in their canonical JSON forms (Timestamp "2026-11-17T10:00:00Z", Duration "1.5s", …).
Everything that can fail without the network is checked before anything is sent: the method must exist in the schema, every field must exist in its message type (nested, repeated and map messages included), unary and server-streaming methods take exactly one message, and metadata must be valid. An unknown field names the field and its type, with exit code 2:
grpc: unknown field 'idd' in shop.v1.GetProductRequest
Responses are shown in the canonical proto3 JSON form: lowerCamelCase names, default values left out, 64-bit integers as strings.
Call types and the exchange
Every call type is supported. A unary call sends one message and gets one response; server streaming collects every response in order; client streaming sends each entry of messages in order, then half-closes, and gets one response; bidi streaming sends messages in order while receiving concurrently, then half-closes.
The exchange of a call holds:
status: code, name and message, shown asOK (0)orNOT_FOUND (5): product missing not found, plus decodeddetails(below)headersandtrailers: the response metadata, recorded separately; binary (-bin) values in base64messages: every received message as JSON; a unary or client-streaming response is the first onetimeline(streaming calls only): one entry per message withdirection(sentorreceived),at_mssince the call started,size_bytes(encoded size) andmessagetimings:connect_ms,tls_ms,first_byte_ms(response headers) andtotal_ms
JSONPath assertions see the response message of a unary or client-streaming call at $, and the received messages of a server-streaming or bidi call at $.messages.
Headless stream bounds
Under rustman run, receiving stops after stream.max_messages messages (default 100) or stream.duration_ms (default 30000), whichever comes first. The call is then cancelled (the server sees the cancellation), the exchange is marked stopped and ends with CANCELLED (1): stopped by rustman after 100 messages (stream.max_messages), and assertions evaluate over the messages collected so far. Interactive streams run until they are stopped or their deadline expires.
Deadlines
Every call carries a deadline: deadline_ms, else rustman.toml [defaults] timeout_ms (which --timeout of rustman run and rustman grpc call replaces), else 30000 ms. It is sent as grpc-timeout (in milliseconds, or whole seconds when that would need more than eight digits) and also enforced on the client for the whole call, streams included. An expired deadline ends the call with DEADLINE_EXCEEDED (4), which counts as a request error (exit code 3).
Metadata
metadata entries are sent in order as request headers; names are lowercased. Names ending in -bin take base64 (padded or not) and are sent as binary metadata: {name: trace-bin, value: "AQID"} reaches the server as the bytes 01 02 03. Invalid base64, invalid names and values that are not printable ASCII fail before sending with grpc: invalid metadata '<name>': <reason>; the value is never shown.
Transport security
grpcs:// targets, and targets with tls.enabled: true (the default for a bare host:port on port 443), use TLS with HTTP/2 negotiated by ALPN. Verification is on, and tls takes the same options as HTTP requests, through the same TLS builder: ca_bundle (added to the platform roots, plus the workspace [http] ca_bundle), client_cert/client_key or client_pkcs12 for mutual TLS, and insecure: true to skip verification. grpc:// targets and tls.enabled: false use plaintext HTTP/2 (h2c).
A certificate that cannot be verified fails the call with exit code 3, naming the target:
grpc: TLS error at grpcs://localhost:8443: invalid peer certificate: UnknownIssuer
An unreachable server fails with grpc: cannot connect to <target>: <reason>, also exit code 3.
gRPC-Web
transport: grpc-web sends the call with the gRPC-Web protocol (application/grpc-web+proto) through Rustman’s HTTP client, over HTTP/1.1 or HTTP/2, so HTTP settings such as proxies and TLS apply. The call is a POST to http(s)://<host:port>/<package.Service>/<Method>; the trailers arrive at the end of the body. Binary metadata is sent in base64. A response frame longer than [http] max_body_bytes (10 MiB by default) is refused as soon as its length arrives, ending the call with RESOURCE_EXHAUSTED (8); trailer lines may end with \r\n or \n. No compression is negotiated, so a compressed response frame ends the call with UNIMPLEMENTED (12). Only unary and server-streaming calls fit the protocol; client streaming and bidi fail before sending:
grpc: grpc-web supports only unary and server-streaming calls
Status details
When a call fails with a grpc-status-details-bin trailer, it is decoded as google.rpc.Status using a descriptor set of the standard google/rpc protos bundled with Rustman, and each detail is rendered by type:
INVALID_ARGUMENT (3): invalid product id
field violation: id: must start with p-
| Detail type | Rendered as |
|---|---|
BadRequest | field violation: <field>: <description>, one line per violation |
ErrorInfo | error info: reason <reason>, domain <domain>, then key=value metadata |
RetryInfo | retry after <delay> |
QuotaFailure | quota violation: <subject>: <description> |
PreconditionFailure | precondition violation: <type> <subject>: <description> |
ResourceInfo | resource: <type> <name> (owner <owner>): <description> |
Help | help: <description> <url> |
LocalizedMessage | localized message (<locale>): <message> |
DebugInfo | debug info: <detail> [<stack entries>] |
RequestInfo | request info: <request id> <serving data> |
A detail of any other type is shown as its type URL plus the encoded value in base64, such as type.example.com/acme.Mystery: AQID.
Assertions and captures
gRPC requests take the assertions list, with two gRPC checks:
assertions:
- grpc_status: OK # a code name (any case) or number 0-16
- metadata: {name: x-served-by, equals: catalog}
- json: {path: $.id, equals: p-1}
- latency: {total_lt: 500}
captures:
- {var: product_id, from: json, path: $.id}
- {var: served_by, from: metadata, name: x-served-by}
grpc_statuspasses when the call ended with that code. A request with no assertions at all expectsgrpc_status: OK, except a stream the client stopped at its headless bounds, which endsCANCELLEDby the client’s own choice and passes. A failure readsgrpc_status: expected OK, got NOT_FOUND (5).metadatatakes the operators ofheader(equals,contains,matches,exists) and looks at the response headers, then the trailers; names match case-insensitively.jsonassertions read the response message of a unary or client-streaming call at$, and the received messages of a server-streaming or bidi call at$.messages:- json: {path: "$.messages", length: 3}passes when 3 messages arrived (after a headless stream bound, over the messages collected).latencyreadsfirst_byte_ms(ttfb_lt) andtotal_ms(total_lt).- Captures take
from: json(same document asjsonassertions) andfrom: metadata(name: the first value among headers, then trailers).
status, header, body and schema assertions are evaluated as for HTTP against a response with no HTTP status (0); prefer the gRPC checks.
In rustman run
rustman run executes kind: grpc files in collection order with the other kinds, sharing variables and captures: an HTTP login can capture a token that a later gRPC request sends as metadata. Without assertions a call passes on OK (or when stopped at its stream bounds) and fails on any other status (exit code 1). An expired deadline (DEADLINE_EXCEEDED (4)) and a call that ends without a status (unreachable server, TLS error, no schema, unknown field) make the request errored (exit code 3). Server-streaming and bidi calls stop at their headless bounds.
Each call is recorded in history with the request as GRPC <target>/<package.Service/Method>, its metadata with secrets replaced by their placeholders (Bearer «redacted:token»), and the messages sent. The record and the JSON report hold a grpc object with the exchange (protocol: grpc, call_type, transport, status, headers, trailers, messages, timeline, timings), redacted like every other output; a call that ended without a status records error: {kind, message} instead, with kind config (the request cannot be sent as written) or request. gRPC calls are not replayed by rustman history replay.
In the TUI
The TUI opens kind: grpc requests in the gRPC editor: a method browser over the target’s schema (with the descriptor cache for offline browsing and Ctrl+G to refresh it), a message editor seeded from the picked method’s template, the metadata and assertions as YAML, and a response viewer with the messages, the status with its decoded details, headers and trailers, and the message timeline filtered by direction (d) and text (f). During a bidi call, Ctrl+R sends the Message tab on the open stream and Alt+X half-closes it. Interactive streams are not bounded by stream; they run until the server ends them, the deadline expires, or you cancel them with Esc.
Agent tools
The agent MCP server registers three gRPC tools when it is built with gRPC support (the default grpc feature of rustman-mcp; a build without it lists none of them):
| Tool | Arguments | What it does |
|---|---|---|
grpc_list | target or path, refresh, vars | The services and methods of a target or saved kind: grpc request, with their call types |
grpc_describe | target or path, symbol, refresh, vars | One service, method (with a request template) or message |
grpc_call | path, or target with method, message, metadata and deadline_ms; vars | One unary or server-streaming call, through the runner: assertions, captures and history apply |
Every tool checks the target against the session’s allowlist before any traffic, reflection included: a target is checked as the http or https origin it is reached over (grpc://127.0.0.1:50051 as http://127.0.0.1:50051, grpcs:// as https://, a bare host:port by its TLS setting). List those origins in [agent].allowed_hosts, or let the active environment’s grpc:// and grpcs:// values count, as its http(s) values do. A target outside the allowlist is refused with code: "blocked" and host not allowed, and the refusal is in the audit log. Production hosts are refused as for every agent request. Each reach is admitted and paced by the session’s [safety].rate and [safety].concurrency, shared with the other requests of the session.
grpc_call follows the read-only default of agents. gRPC has no read verbs (every call is an HTTP/2 POST), so the proto decides: a method marked free of side effects is a read, and agents may call it freely:
rpc GetProduct(GetProductRequest) returns (Product) {
option idempotency_level = NO_SIDE_EFFECTS;
}
Any other method is a mutation. It is refused with code: "blocked" and mutations not allowed for agents unless [agent] allow_mutations = true, and then the human must confirm it (MCP elicitation; [agent] require_confirmation = false accepts it unattended), as for an HTTP POST. grpc_list shows read_only: true on the methods agents may call without that. Nothing is sent before these checks pass.
grpc_call refuses client-streaming and bidi methods before sending anything (code: "blocked", only unary and server-streaming methods are available to agents (shop.v1.Catalog/Chat is bidi)). Server streams stop at the request’s headless bounds (100 messages or 30 s by default). Results carry the status (with decoded details), the response headers and trailers, the received messages and the assertions, redacted with the session’s secrets and capped by [agent].max_output_bytes like every agent result: a server echoing a secret shows «redacted:token».
CLI commands
A target is host:port, grpc://host:port, grpcs://host:port or a {{variable}} holding one (resolved in the active environment). Commands that take <target|request> also accept a kind: grpc request file, id or name, whose target, TLS options and schema apply. --var k=v, --env, --workspace and --insecure work as for other commands.
rustman grpc list
rustman grpc list <target|request> lists every service with its methods, call types and message types; --json prints one JSON object per service. Inside a workspace, reflection results are cached; --refresh asks the server again. A cached answer prints the stale-data notice on stderr.
$ rustman grpc list grpc://localhost:50051
service shop.v1.Catalog
GetProduct (unary): shop.v1.GetProductRequest -> shop.v1.Product
ListProducts (server streaming): shop.v1.ListProductsRequest -> shop.v1.Product
UploadProducts (client streaming): shop.v1.Product -> shop.v1.UploadSummary
Chat (bidi): shop.v1.ChatMessage -> shop.v1.ChatMessage
rustman grpc describe
rustman grpc describe <target|request> <symbol> describes a service, a method (package.Service/Method: its call type, request and response types and a request template) or a message (its fields and template); --json prints the description as JSON.
rustman grpc call
rustman grpc call <request> sends a kind: grpc request; rustman grpc call --target <t> --method <m> --data <json> sends an ad-hoc one (--data defaults to {}; a JSON array sends each entry, for client and bidi streaming). --metadata "name: value" (repeatable) and --deadline-ms complete an ad-hoc call. Calls go through the runner: variables, captures, assertions, history and redaction apply as in rustman run.
The response messages are printed on stdout as indented JSON, and the status (with its decoded details) on stderr. With --json, each received message is one JSON line, followed by a final status line:
$ rustman grpc call --target grpc://localhost:50051 --method shop.v1.Catalog/ListProducts --data '{}' --json
{"id":"p-1","name":"Product p-1"}
{"id":"p-2","name":"Product p-2"}
{"id":"p-3","name":"Product p-3"}
{"status":{"code":0,"name":"OK","message":"","details":[]},"headers":[...],"trailers":[...]}
rustman grpc health
rustman grpc health <target> [--service <name>] calls grpc.health.v1.Health/Check (the whole server without --service) and prints the serving status: SERVING, NOT_SERVING, SERVICE_UNKNOWN or UNKNOWN. --json prints {"status": "<status>"}; --timeout bounds the check (default: [defaults] timeout_ms).
Exit codes
| Command | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
rustman grpc call | the call passed (OK without assertions) | another status, or a failed assertion | the call cannot be sent as written: no schema (server reflection unavailable), unknown method or field, invalid metadata | no status came back (connect, TLS) or the deadline expired |
rustman grpc health | SERVING | NOT_SERVING, SERVICE_UNKNOWN, UNKNOWN | invalid target | the check failed, UNIMPLEMENTED included |
rustman grpc list / describe | listed | no schema, unknown symbol | unreachable server with nothing cached |
Ctrl+C stops a call and exits with 130.
WebSocket and Server-Sent Events
Rustman opens WebSocket sessions and listens to Server-Sent Events (SSE) streams from saved request files: chat and trading feeds, notifications, dashboards and LLM token streams. Each session records a message timeline, ends on its own under rustman run, and takes assertions and captures over the messages it received. The file format is in request-files.md; the behavior is specified in openspec/specs/realtime-sessions. GraphQL subscriptions are covered by GraphQL and JSON-RPC subscriptions by JSON-RPC.
WebSocket sessions
A kind: ws session opens with the RFC 6455 handshake through the same stack as HTTP requests: the file’s headers, auth helpers and the cookie jar go into the upgrade request, [http] proxies are tunnelled (HTTP CONNECT, HTTPS, SOCKS5), and wss:// uses TLS with verification on and the file’s tls settings (ca_bundle, client certificates, verify: false for insecure). A certificate that does not verify fails with a TLS error naming the host. subprotocols are offered in order in Sec-WebSocket-Protocol; the handshake response status, headers and the subprotocol the server chose are recorded. No WebSocket extension is offered: permessage-deflate is not negotiated.
A server that answers the upgrade with another status than 101 fails the session with ws: handshake failed: <status> <reason>, such as ws: handshake failed: 401 Unauthorized (exit code 3 under rustman run); its headers and body (up to 64 KiB) are recorded.
Once open, the session runs its steps in order:
version: 1
kind: ws
name: Orders
url: wss://{{host}}/orders
steps:
- send: {json: {id: 1, op: subscribe, channel: orders}}
- wait_for: {json: {path: $.id, equals: 1}, timeout_ms: 2000}
- send: {ping: aGk=}
- sleep: 500
- close: {code: 1000, reason: done}
sendsends a text frame, a JSON value (serialized compactly as a text frame), a binary frame from base64 or from{file: <path>}(a file larger thanlimits.max_message_bytesis refused before it is read), or a ping (at most 125 bytes of data). Sending on a closed socket fails withws: not connected.wait_forwaits for a message that arrives after the step starts and matches its JSONPath check (equals,matchesorexists, with the same evaluator asjsonassertions) or its regular expression. A message that is not JSON never matches a JSONPath check. Aftertimeout_ms(default 5000) the session fails withws: wait_for timed out after <n> ms (<matcher>), such asws: wait_for timed out after 300 ms (regex pong).sleepwaits, recording what arrives.closesends a close frame (code default 1000; a reason of at most 123 bytes, as a control frame allows), waits up to 2000 ms for the server’s close, then drops the connection.
Messages that arrive while no wait_for is active are still recorded. Server pings are answered automatically; the pong to one of our pings is recorded with its round-trip time (rtt_ms). A close from the server ends the session and is recorded with its code and reason, such as closed by server: 1008 policy.
SSE sessions
A kind: sse session sends its request (GET by default, or any method with a body, such as the POST of an LLM API) through the HTTP engine, with the same auth helpers, signing, cookies, TLS and proxies as kind: http, Accept: text/event-stream unless the file sets Accept, and Accept-Encoding: identity so the stream arrives as it is written. The response must be a success with Content-Type: text/event-stream; otherwise the session fails with sse: unexpected content type <type> (for example sse: unexpected content type application/json) or sse: unexpected status <status> <reason>.
The stream is parsed per the WHATWG HTML specification, by the same parser GraphQL over SSE uses:
- lines end with CRLF, LF or CR, and a leading byte order mark is skipped;
- lines starting with
:are comments; eventsets the event type (defaultmessage),datalines are joined with\n,idsets the event’s id (kept for the following events; anidholding NUL is ignored), andretry(digits only) sets the reconnection delay;- an
eventoridvalue longer than 4 KiB is ignored, as if the line were absent: both are copied into every event they apply to, so they stay small; - a blank line dispatches the event, when it has data, and only then does its
idbecome the last event id: an event the connection cut before its blank line never movesLast-Event-ID.
The stream event: update\ndata: line1\ndata: line2\nid: 7\n\n records one event of type update, id 7 and data line1\nline2.
Reconnect and resume
When the stream ends or the connection drops, the session reconnects after the last retry value (default 3000 ms; a larger value than 60000 ms is capped at 60000 ms, with an error note in the timeline), sending Last-Event-ID with the last event id received, up to reconnect.max_attempts times (default 5; 0 disables reconnecting). last_event_id in the file sets the header of the first connection. A reconnection answered with 204 No Content stops reconnecting and ends the session normally. Each reconnection is a system entry of the timeline, such as reconnected (attempt 1, Last-Event-ID: 42).
The timeline
Every frame, event and connection change is a timeline entry:
| Field | Meaning |
|---|---|
dir | sent, received, or system (connect, reconnect, close, errors). |
t_ms | Milliseconds since the session started. |
size | The payload size in bytes. |
type | text, json, binary, ping, pong, close, a system note (connect, reconnect, error) or the SSE event type. |
payload | The text; binary data in base64. |
id | The SSE event id. |
rtt_ms | The round-trip time of a pong answering one of our pings. |
The timeline keeps at most limits.max_timeline entries (default 10000) and at most 256 MiB of payloads, types and ids, so memory stays bounded however large the messages are: the oldest entries are dropped and counted in dropped_entries (the newest entry is always kept). The TUI’s live view keeps the same bounds.
Entries reach the terminal (rustman ws connect, rustman sse listen) and the TUI’s live view through a bounded feed. At most 1024 entries, holding at most 64 MiB, wait for the display; a single larger entry is still shown when nothing else waits. A display slower than the messages never slows the session down. Entries that do not fit are not shown, and a note says how many were skipped, in place: on stderr, warning: output fell behind: <n> timeline entries not shown (the session's timeline and history keep them), and in the TUI a system entry, <n> entries not shown: the display fell behind. Skipped entries are still recorded in the timeline, so assertions, history and reports see every one of them.
Bounds and limits
Under rustman run a session runs its steps, then listens until limits.max_messages received messages (default 50) or limits.duration_ms since it started (default 30000), whichever comes first, and closes with code 1000. The end is recorded as max_messages reached (50) or duration reached (30000 ms). A server that streams forever is therefore always bounded. Ctrl+C closes the session.
A WebSocket message larger than limits.max_message_bytes (default 16 MiB) closes the session with code 1009 (the rest of what the server sends is read and discarded until it closes the connection, for at most 2000 ms, so the close frame reaches it), and an SSE event larger than it aborts the stream; the timeline records message too large: <n> bytes and the session fails. This limit is the only one for realtime sessions: [http] max_body_bytes does not apply to them.
The bound names limits.max_messages and limits.duration_ms differ from the top-level max_events and max_duration_ms of GraphQL and JSON-RPC subscriptions.
Assertions and captures
Realtime requests take the assertions and captures of assertions.md, evaluated after the session ends, over a document whose messages member lists every message received, in order: its payload parsed as JSON, or its text when it is not JSON. Control frames (ping, pong, close) and system entries are not messages.
| Assertion | Meaning |
|---|---|
json: {path: '$.messages[0].type', equals: snapshot} | A JSONPath check over the messages. |
body: {contains: trade} | A text check over the messages document. |
messages: {count_gte: 3} | How many messages were received (count_gte, count_lte or count_eq), dropped entries included. |
close_code: 1000 | The close code either side sent. A failure reads close_code: expected 1000, got 1011. |
latency: {ttfb_lt: 500} | ttfb_lt bounds the time to the first message; total_lt the whole session. |
status, header | The handshake response (WebSocket) or the stream’s response head (SSE). |
version: 1
kind: sse
name: Prices
url: https://{{host}}/prices
limits: {max_messages: 5}
assertions:
- messages: {count_eq: 5}
- json: {path: '$.messages[0].symbol', exists: true}
captures:
- {var: first_symbol, from: json, path: '$.messages[0].symbol'}
A session that fails (a refused handshake, a wait_for timeout, an oversized message) errors the request instead, and its assertions are not evaluated.
History and reports
Each session is one history entry and one report request, with the opening request under sent and a realtime record:
{
"protocol": "ws",
"handshake": {"status": 101, "headers": [], "subprotocol": "v1.feed"},
"timeline": [
{"dir": "system", "t_ms": 3, "size": 0, "type": "connect", "payload": "connected (subprotocol v1.feed)"},
{"dir": "sent", "t_ms": 4, "size": 26, "type": "json", "payload": "{\"op\":\"subscribe\",\"n\":1}"}
],
"dropped_entries": 0,
"received": 0,
"end": {"reason": "closed by client: 1000", "close_code": 1000},
"elapsed_ms": 12.5
}
Payloads larger than 64 KiB are kept as a preview with truncated: true; size keeps the full size. Types and ids (SSE event names and ids) are cut to 1 KiB the same way, also marking the entry truncated: true. Each payload (and a refused upgrade’s body) is redacted whole before it is cut, so a secret that crosses the 64 KiB mark never leaves a part of itself in the preview. Everything is redacted like any other record: secrets in the URL, headers, payloads, types (SSE event names), ids and close reasons appear as «redacted:<name>», and so do the credentials the opening request carried on the wire (auth helpers, cookies from the jar) or the response set, so a URL with ?token={{api_token}} is stored as ?token=«redacted:api_token», and sensitive handshake headers (such as Set-Cookie) are hidden. Sessions cannot be replayed with rustman history replay. The realtime member is part of the report schema.
rustman ws connect and rustman sse listen
rustman ws connect <url|request> opens a WebSocket session and prints each message the server sends; rustman sse listen <url|request> prints each event of a stream. The target is a URL (or a {{variable}} holding one), or a saved kind: ws / kind: sse request by file, id or name, which runs with its steps, assertions and captures:
rustman ws connect wss://echo.example.com --json --max-messages 2 < frames.txt
rustman ws connect {{feed_url}} --header "Authorization: Bearer {{token}}" --subprotocol v2.feed
rustman sse listen https://api.example.com/events --json --max-messages 3 | jq .data
rustman sse listen streams/completions.rman.yaml --env prod
- When stdin is not a terminal,
ws connectsends each line of it as a text frame (without its line ending, and without interpolation), while the session runs. At most 64 lines wait to be sent: a faster stdin (a large file) is read only as the session sends. - Messages are printed as they arrive, each followed by a newline: the payload as received (binary data in base64), so a payload that holds newlines (multi-line SSE
data, pretty-printed JSON) spans several lines. With--json, each message is one JSON object on one line (newlines in the payload are escaped), ready forjq:{"t_ms": 12, "dir": "received", "type": "tick", "size": 7, "id": "1", "data": "{\"n\":1}"}.typeis the frame type (text,json,binary) or the SSE event type, andidis the SSE event id (nullwithout one). Sent frames, pings, pongs and system notes are not printed; they are in the session’s history record. - Sessions are bounded as under
rustman run:--max-messages <n>and--duration <duration>replace the request’slimits.max_messagesandlimits.duration_ms(defaults 50 messages and 30 s), and the session then closes with code 1000. Ctrl+C closes it at once. --header "Name: value"(repeatable) adds handshake or request headers to a URL;--subprotocol <name>(repeatable) offers WebSocket subprotocols in order. A saved request already defines both, so these flags are refused with one.--env,--workspace,--var,--insecure,--no-historyand--trace(send trace context on the handshake or stream request) work as forrustman send.- Everything printed comes from the session’s redacted feed: a secret the server echoes appears as
«redacted:<name>». The session is recorded in history like any request (outside a workspace, nothing is recorded).
Exit codes: 0 when the session ended normally (its steps done, a bound reached, or closed by the server), 1 when an assertion of the request failed, 2 for a usage error (such as a request of another kind), 3 when the session failed (ws: handshake failed: 401 Unauthorized, a transport error, a wait_for timeout, an oversized message), and 130 on Ctrl+C.
In the TUI
kind: ws and kind: sse requests open in the realtime editor of the terminal UI: Ctrl+R connects and the Timeline tab lists the entries as they arrive, with filters by direction, type and text and the selected payload pretty-printed; the Compose tab sends text, JSON or binary frames while the session is open, and Esc closes it. Interactive sessions have no headless bounds: they stay open until you close them or the server does.
Agent tool
The agent MCP server registers the realtime_listen tool. It takes either path (a saved kind: ws or kind: sse request) or url (ws:// / wss:// for a WebSocket, http:// / https:// for an SSE stream; a URL that starts with a {{variable}} opens an SSE stream unless frames are given) with optional frames (a string is a text frame, any other value is sent as JSON), plus max_messages, duration_ms and vars. It returns the received messages (t_ms, type, id, data), how the session ended and the request’s assertions, all redacted.
- A session stops after at most 100 messages or 60 s, whatever
max_messages,duration_msor the file’slimitsask for. - The tool follows no live feed: it reads the session’s timeline once the session ends, so it has the same bounds as the timeline.
- The URL must pass the agent allowlist (
[agent] allowed_hosts, or the hosts of the active environment); aws://URL is checked as itshttp://origin andwss://ashttps://, and the environment’sws(s)://values count as those origins. Otherwise the call is refused withblocked: host not allowedand nothing is opened. - Sending frames is a mutation, whether they come from
framesor from thesendsteps of a saved request: with[agent] allow_mutations = false(the default) the call is refused withblocked: sending frames requires allow_mutations, and otherwise the human confirms it as for any mutating request. An SSEPOSTstream is a mutation too. - Sessions are recorded in history like any request.
Messaging: Kafka, MQTT and AMQP
Rustman produces and consumes broker messages from request files of kind kafka, mqtt and amqp. Each file is one operation: produce (publish) or consume (subscribe). The behavior is specified in openspec/specs/messaging-requests. All clients are pure Rust over rustls; the build needs no librdkafka, OpenSSL or CMake.
This page covers the request file format, the Kafka, MQTT and AMQP clients, AsyncAPI import, payload validation, running messaging requests in collections (assertions, captures, start: before_next, history), the safety rules for agents, the CLI commands and the TUI pane.
Request files
version: 1
kind: kafka
name: Create order
operation: produce
brokers: ['{{kafka_host}}:9092']
topic: orders
partition: 0
messages:
- key: order-1
value: {id: 1, total: 9.5}
headers:
- {name: source, value: rustman}
Common fields:
| Field | Meaning |
|---|---|
operation | produce or consume. A missing or other value fails to load with messaging: operation must be produce or consume. |
brokers | Kafka bootstrap brokers: a list of host:port, or one comma-separated string. Required for kind: kafka. |
broker | The MQTT or AMQP broker URL. Required for kind: mqtt and kind: amqp. |
topic | The Kafka topic, or the MQTT topic (a filter with + and # for subscribe). |
exchange, routing_key, binding_key, queue | The AMQP destination. |
messages | Produce only: the messages to send, in order (see below). At least one is required. |
limits | max_messages (default 10) and duration_ms (default 30000) bound a headless consume; max_message_bytes (default 1048576, 1 MiB) is the most of a value kept per message. Zero is refused. |
start | immediately (default) or before_next: within a run, the consume subscribes, the next step runs, then the consume ends. |
tls | verify, ca_bundle, client_cert, client_key, client_pkcs12 and client_pkcs12_password, as for kind: ws. |
auth | MQTT and AMQP credentials: username and password. Kafka uses security instead. |
schema_registry | A Confluent-compatible Schema Registry (see below). |
asyncapi | {document, message}: validate payloads against an AsyncAPI message’s payload schema (see Payload validation). |
variables, assertions, captures | As for other kinds. |
A field that does not apply to the kind or operation fails to load, for example kafka: 'partition' does not apply to consume requests. {{variables}} and {{secret:...}} references resolve in every string field, including keys, values and headers.
Message payloads
Each entry of messages has a value, an optional key and optional headers (ordered name/value pairs). A key or value is:
- a string, sent as UTF-8 text;
- any other YAML/JSON value, sent as compact JSON (
{id: 1, total: 9.5}is sent as{"id":1,"total":9.5}); {base64: AAE=}, sent as the decoded bytes;{file: fixtures/blob.bin}, the bytes of a file relative to the request file. A path that leaves the workspace fails withfile path escapes workspace.
A missing or null value sends no value (a Kafka tombstone).
Kafka
Produce
operation: produce
brokers: localhost:9092
topic: orders
partition: 0 # optional
acks: all # all (default), leader or none
Each message goes to partition when set, else to the partition the Java client’s default partitioner picks for its key (murmur2), so keyed messages land where standard producers put them. Keyless messages go round robin. The exchange records the partition and offset of every message. An unknown topic fails with kafka: unknown topic '<name>', an unknown partition with kafka: topic '<name>' has no partition <n>.
Limitations of the client (rskafka):
- Produce always waits for every in-sync replica.
acks: leaderandacks: noneare accepted and sent asacks: all, with a warning. - A header name holds one value; a repeated name keeps the last value, with a warning. Headers are sent in name order.
- Messages are sent uncompressed. Consumed batches compressed with gzip or snappy are read; lz4 and zstd batches are not supported.
- No idempotent producer, transactions or OAUTHBEARER.
Consume
operation: consume
brokers: localhost:9092
topic: orders
partitions: [0, 1] # default: all
offset: earliest # earliest, latest (default), 42 or {timestamp: ...}
limits: {max_messages: 5, duration_ms: 10000}
A consume reads each partition from its start offset without joining a consumer group and without committing offsets, so it never changes what other consumers see. An absolute offset is kept within the partition’s current range. With {timestamp: "2026-11-17T09:00:00Z"} (RFC 3339), only messages with timestamps at or after that time are returned.
Each message is recorded with its partition, offset, timestamp, key, headers and value. Values are shown as JSON when they parse as JSON, as text when they are UTF-8, else as {"base64": "..."}. A value larger than limits.max_message_bytes is cut to that size and marked truncated, with its full size. Under rustman run a consume stops at max_messages or duration_ms, whichever comes first.
Memory is bounded against a hostile broker: a response frame larger than the 4 MiB fetch size or limits.max_message_bytes (whichever is larger) plus 1 MiB fails the consume (with the default limit, 5 MiB), and the fetched records waiting to be recorded take at most 64 MiB (each partition reader also holds the one response it is reading). To read records larger than that, raise limits.max_message_bytes.
Security
security:
protocol: SASL_SSL # PLAINTEXT (default), SSL, SASL_PLAINTEXT, SASL_SSL
mechanism: SCRAM-SHA-512 # PLAIN, SCRAM-SHA-256, SCRAM-SHA-512
username: app
password: '{{kafka_pw}}'
tls:
ca_bundle: certs/ca.pem
SSL and SASL_SSL (or any tls block) connect with rustls through the same TLS settings as HTTP requests: verification on, the OS trust store plus ca_bundle, and client certificates for mutual TLS. SASL_* protocols require mechanism, username and password. Keep the password in an environment secret or a {{secret:...}} reference: it is redacted everywhere, so the exchange record shows «redacted:kafka_pw». A rejected login fails with kafka: authentication failed (<mechanism>). A broker that cannot be reached fails after the connect timeout (10 s).
Schema Registry
schema_registry:
url: 'http://{{registry_host}}:8081'
subject: orders-value # produce: encode values with this subject
schema_version: latest # or a version number
auth: {type: basic, username: sr, password: '{{sr_pw}}'}
Consumed keys and values in the Confluent wire format (magic byte 0 and a 4-byte schema id) are decoded by fetching the schema by id and shown as JSON, with schema_id noted. Avro, Protobuf (the registry’s .proto text, compiled in-process; imports other than the Google well-known types are not resolved) and JSON Schema payloads are supported. Schemas are fetched once per run. When a schema cannot be fetched or does not match, the raw bytes are shown and the exchange carries a warning such as schema registry: schema id 42: the registry answered HTTP 404; showing the raw bytes; the consume does not fail.
With subject, produce encodes each JSON value with that subject’s schema (schema_version, default latest) and sends it in the wire format.
Registry requests follow redirects as HTTP requests do, except in agent runs (see Safety): there a redirect is not followed and its schema fetch fails with the registry answered HTTP 302 (a warning on consume).
MQTT
version: 1
kind: mqtt
name: Room temperature
operation: produce
broker: 'mqtts://{{mqtt_host}}'
topic: sensors/room1/temp
protocol_version: 5 # 5 (default) or "3.1.1"
qos: 2 # 0, 1 (default) or 2
retain: false
properties: # MQTT 5 only
content_type: application/json
response_topic: replies/room1
message_expiry: 60 # seconds
correlation_id: c-1
auth: {username: app, password: '{{mqtt_pw}}'}
messages:
- value: {celsius: 21.5}
headers: [{name: unit, value: C}] # MQTT 5 user properties
The broker URL picks the transport: mqtt:// (TCP, port 1883), mqtts:// (TLS, port 8883), ws:// and wss:// (WebSocket with the mqtt subprotocol; the path is part of the URL). TLS uses the same settings as HTTP requests, so tls.ca_bundle and tls.client_cert/client_key (or client_pkcs12) work for mutual TLS. MQTT messages have no key; message headers are sent as MQTT 5 user properties, so headers and properties need protocol version 5.
A publish waits for each message’s acknowledgement and records it: PUBACK for QoS 1, PUBREC/PUBREL/PUBCOMP for QoS 2 (nothing for QoS 0). A refused publish fails with mqtt: publish to '<topic>' refused (<reason>).
operation: consume
broker: mqtt://localhost
topic: 'sensors/+/temp' # + and # wildcards
qos: 1
client_id: probe-1 # default: rustman-<8 random hex digits>
clean_session: false # default true; false needs a fixed client_id
limits: {max_messages: 5, duration_ms: 10000}
A subscribe connects with a clean session (3.1.1) or clean start (5) and a generated client id, so it leaves no state on the broker. Each message is recorded with its exact topic, QoS, retain flag, user properties (as headers), MQTT 5 properties and payload. With clean_session: false the broker hands over messages it queued for that client id, which removes them from the broker (agents need allow_destructive for it, see Safety); the exchange warns: mqtt: clean_session is false: queued messages for client id 'probe-1' will be consumed from the broker. A rejected login fails with mqtt: authentication failed (username/password).
The client uses rumqttc’s MQTT 3.1.1 and 5 packet codecs over Rustman’s own TCP, rustls and WebSocket connection.
AMQP
version: 1
kind: amqp
name: Order created
operation: produce
broker: 'amqps://{{rabbit_host}}/%2f'
exchange: orders # "" for the default exchange
routing_key: order.created
mandatory: true # fail when no queue is bound
properties:
content_type: application/json
correlation_id: c-1
reply_to: replies
delivery_mode: 2 # 1 transient, 2 persistent
expiration: 60000 # per-message TTL in ms
auth: {username: app, password: '{{rabbit_pw}}'}
messages:
- value: {id: 1}
headers: [{name: source, value: rustman}] # the AMQP headers table
Publishes use publisher confirms and record confirm per message. A negative confirm fails with amqp: message not confirmed; a mandatory message that no queue receives fails with amqp: unroutable (a request failure, exit code 3 in a run). auth overrides credentials in the URL. amqps:// uses the shared TLS settings.
operation: consume
broker: amqp://localhost
exchange: orders
binding_key: 'order.*' # default '#'
By default a consume declares a server-named, exclusive, auto-delete queue, binds it to exchange with binding_key, reads it, and deletes it when the consume ends, so existing queues are untouched. Each message is recorded with its exchange, routing key, redelivered flag, headers, properties and payload.
Reading an existing queue removes its messages, so queue needs an opt-in, or the file fails to load with amqp: consuming from an existing queue removes messages; set destructive: true or use requeue:
operation: consume
broker: amqp://localhost
queue: payments
requeue: true # inspect without removing
# or: destructive: true, with ack: auto (default) or manual
Every consume sets the prefetch to limits.max_messages (at most 100 when each delivery is acknowledged as it is recorded; with requeue: true it is limits.max_messages, since every delivery stays unacknowledged), so the broker never delivers more messages than are recorded and the client holds at most that many. limits.max_message_bytes trims what is recorded; the AMQP client still receives each message body whole (it cannot refuse a delivery by its announced size), so the memory in flight is at most the prefetch times the broker’s largest message: consume only from brokers you trust. The client asks for a frame size of at most 128 KiB (a frame_max in the broker URL can lower it, and frame_max=0 means the cap), and keeps the smaller of that and the broker’s, so a broker announcing a huge or unlimited frame_max cannot make it allocate large buffers. With requeue: true deliveries stay unacknowledged and are all handed back to the queue when the consume ends. With destructive: true each message is acknowledged (and so removed) right after it is recorded, whether ack is auto or manual; messages beyond max_messages stay in the queue.
AsyncAPI import
rustman import asyncapi asyncapi.yaml # or an http(s) URL
rustman import asyncapi asyncapi.yaml --into events
AsyncAPI 2.6 and 3.0 documents (JSON or YAML) are read with the same reference resolver as OpenAPI import: local $refs and files next to the document; remote references only with --allow-remote-refs. Other versions fail with asyncapi: unsupported version 2.0 (supported: 2.6, 3.0) and exit code 2.
- Each server with a Kafka, MQTT or AMQP protocol becomes
environments/<server>.yamlwith abrokers(Kafka) orbroker(MQTT, AMQP) variable; server variables take their defaults. Servers of other protocols are skipped with a warning. - Each operation becomes
<collection>/<channel>/<operation>.rman.yaml(kebab-case names):produceforpublish(2.6) andsend(3.0),consumeforsubscribeandreceive. A produce gets one message per documented message, with the first example payload, else one synthesized from the payload schema (and a Kafka key from thekafkabinding’s key schema). - The document is treated as untrusted: a
{{in an example or schema default string, a channel address, an exchange or a queue is written as\{{, so an imported request never resolves a variable or a{{secret:...}}reference the document planted (object keys are never interpolated). - Channel parameters (
orders/{id}) become{{id}}variables, or+in an MQTT subscription. MQTTqos/retainand AMQP exchange and queue bindings are used; other bindings are ignored with a warning. An AMQP consume without an exchange binding reads its queue withrequeue: true. - The bundled document is written as
<collection>/asyncapi.json, and requests whose message has a payload schema reference it withasyncapi, so payloads are validated.
The collection folder defaults to the document title in kebab-case; files that already exist are kept and reported.
Payload validation
asyncapi:
document: ../asyncapi.json # relative to the request file, inside the workspace
message: OrderCreated # the message's name or its key
Before a produce, every value is validated against the message’s payload schema (references into the document’s components resolve). If one does not match, nothing is sent and the error lists up to 10 violations with their instance paths, such as asyncapi: message 1 does not match 'OrderCreated', nothing was sent: /: missing required property 'id'. After a consume, each message records its schema_violations, and the implicit asyncapi_schema assertion fails when any message breaks the schema. Values cut at limits.max_message_bytes are not checked.
Runs, assertions and history
rustman run runs messaging requests in collection order with the other kinds, sharing variables and captures. A produce passes when every message was sent and acknowledged; a consume passes when it ends at its bounds, even with no message. A failure to connect, authenticate or send makes the request errored (exit code 3), and a failed assertion makes it failed (exit code 1).
Headless bounds
Under rustman run a consume stops after limits.max_messages messages (default 10) or limits.duration_ms (default 30000), whichever comes first, then disconnects cleanly. A consume of a quiet topic with limits: {duration_ms: 2000} ends after 2 s with zero messages. rustman kafka|mqtt|amqp consume takes the same bounds, which --max-messages and --duration replace; the TUI consumes until you stop it.
Assertions and captures
Assertions and captures read the exchange as a JSON document: $.messages[*] for a consume (each with partition, offset, timestamp, topic, routing_key, key, headers, value and size, as the broker gives them) and $.produced[*] for a produce (with partition and offset, or the broker’s ack). Values that are JSON are matched as JSON. messages: {count_gte | count_lte | count_eq} counts the consumed messages, and header assertions read the headers of every consumed message.
version: 1
kind: kafka
name: Order events
operation: consume
brokers: '{{kafka_brokers}}'
topic: orders
start: before_next
limits: {max_messages: 1, duration_ms: 10000}
assertions:
- messages: {count_eq: 1}
- json: {path: '$.messages[0].value.type', equals: OrderCreated}
- header: {name: source, equals: shop}
captures:
- var: order_id
from: json
path: $.messages[0].value.id
A consume validated against an AsyncAPI message also gets the implicit asyncapi_schema assertion (see Payload validation).
Produce then consume: start: before_next
A consume with start: before_next subscribes first, then the next request of its folder runs while it collects, and its assertions are evaluated once both are done. The subscription is ready when Kafka offsets are resolved, the MQTT SUBACK arrived, or the AMQP queue is bound and consuming, so an event the next request causes cannot be missed. With the consume above saved as orders/1-events.rman.yaml, this request runs while it listens:
version: 1
kind: http
name: Create order
method: POST
url: '{{base_url}}/orders'
body:
type: json
content: {item: book}
assertions:
- status: 201
Set limits.max_messages to the number of events you expect, so the consume ends as soon as they arrived instead of at duration_ms. Without a next request in the folder, before_next runs the consume on its own.
History
Each produce or consume is one history entry with protocol kafka, mqtt or amqp under record.messaging: the brokers, the destination, each message’s metadata, and its key and value. An unbounded consume (the TUI) keeps only its newest 10000 messages and 64 MiB (of messages as JSON) in the exchange, so memory and the history entry stay bounded; the oldest beyond that are dropped and counted in dropped. Keys and values larger than 64 KiB are kept as a 64 KiB text preview with truncated: true and their full size (a 200 KiB value is stored as a 64 KiB preview and size: 204800). Secrets are replaced by «redacted:name» before anything is stored or printed, including credentials written as literals (security.password, auth.password and the password of a broker URL, shown as «redacted:password»; a URL that does not parse, such as amqp://guest:pa/ss@rabbit/ with an unencoded /, has its userinfo read up to the last @, so such a password is redacted too) and secrets that appear in payloads or headers. Messaging entries are not replayed by rustman history replay.
Safety
Producing (Kafka produce, MQTT publish, AMQP publish) is a mutation, and consuming from a named AMQP queue without requeue, or through a persistent MQTT session (clean_session: false), is destructive; every other consume is a read. A human running rustman run, the CLI commands or the TUI is not gated, as for HTTP requests.
Agents run messaging request files through send_request and run_collection of rustman mcp serve. Before anything connects:
- a produce needs
[agent] allow_mutations = true, else it is refused withblocked: produce requires allow_mutations; a named-queue consume needs[agent] allow_destructive = true(blocked: consuming from an existing queue requires allow_destructive), and so does an MQTT consume withclean_session: false(blocked: consuming through a persistent session (clean_session: false) requires allow_destructive); - every broker must pass the agent allowlist, checked as an origin: a Kafka
host:portashttp://host:port(port 9092 when none is given),mqtt://,tcp://andamqp://ashttp://,mqtts://,ssl://andamqps://ashttps://, andws:///wss://as their HTTP origin, with the protocol’s default port when the URL has none (1883, 8883, 5672, 5671, 80, 443). The host and port checked are the ones the client connects to: one parse serves both, hosts are lowercased and lose a trailing dot, and a broker containing a backslash, a control character or whitespace, or whose host is neither an IP address nor a DNS name, is refused as invalid input (as is a Kafka broker with credentials or a path). A host whose last label is numeric (127.1,0177.0.0.1,0x7f.1,2130706433,1.2.3.0x) must be a dotted-decimal IPv4 address without leading zeros, since URL parsers and resolvers read the other forms differently. An invalid-broker error never repeats the broker: it shows<scheme>://«invalid broker». Audit entries name the checked origins, never the broker’s credentials. Broker URL values of the active environment count for the allowlist; Kafka brokers, which are not URLs, need[agent] allowed_hosts, such as["http://localhost:9092"]; - a Kafka request’s
schema_registry.urlmust pass the allowlist too, as a read, and registry redirects are not followed, since only that URL was checked; - only the Kafka bootstrap brokers are checked: the client then connects to the brokers the cluster advertises in its metadata, so allow only bootstrap brokers you trust;
- a produce or a destructive consume is confirmed by the human, as for an HTTP
POST.
list_requests shows messaging brokers without their userinfo, and get_request returns the file with its literal broker credentials (security.password, auth.password, broker and Schema Registry URL passwords, as written and percent-decoded, and the registry’s auth) replaced by «redacted:password»; as for HTTP literals, values shorter than 6 characters are not redacted, so keep credentials in secrets.
A refusal is the tool’s blocked error and gets an audit log entry. Agent consumes stop after at most 100 messages or 60 s. In a run, a refused operation is an error, and the run exits 4 instead of 3.
rustman kafka|mqtt|amqp produce and consume
Each command runs one operation: a request file (its path, id or name), or one described with flags. Without a workspace only flags work.
rustman kafka consume --brokers localhost:9092 --topic orders --offset earliest --max-messages 5 --json
rustman kafka produce --brokers localhost:9092 --topic orders --key order-1 --value '{"id":1}'
printf '21.5\n22.0\n' | rustman mqtt produce --broker mqtt://localhost --topic t/1
rustman mqtt consume --broker mqtt://localhost --topic 'sensors/+/temp'
rustman amqp produce --broker amqp://localhost --exchange orders --routing-key order.created --mandatory --value hi
rustman amqp consume --broker amqp://localhost --exchange orders --binding-key 'order.*' --json
rustman kafka consume events/orders.rman.yaml --duration 10s
- Produce sends one message per
--value; without--value, each line of a piped stdin is one message (a line’s text is sent as is, so a JSON line stays JSON).--key(Kafka) and--header "name: value"apply to every message. It prints where each message landed:produced partition 0 offset 41, or the acknowledgement (produced (PUBACK)). - Consume prints each message as it arrives: where it came from (
p0@41, the MQTT topic, the AMQP routing key) and its value. With--jsonit prints one JSON object per message withpartition,offset,timestamp,key,headersandvalue(Kafka), ortopic,qosandretain(MQTT), orexchange,routing_keyandproperties(AMQP). - Flags:
--brokers,--topic,--partition(repeatable for consume) and--offset(earliest,latest, a number or an RFC 3339 timestamp) for Kafka;--broker,--topic,--qosand--retainfor MQTT;--broker,--exchange,--routing-key,--mandatory,--binding-key,--queue,--destructiveand--requeuefor AMQP. A request file defines its operation, so these flags cannot be combined with one.--var,--env,--workspace,--no-historyand--jsonwork for both.
The exit code is 0 when the operation passed, 1 when an assertion of the request failed, 3 when it failed (unreachable broker, unknown topic, unroutable message, failed login), 4 when the safety policy refused it, and 130 on Ctrl+C. Printed messages, errors and warnings are redacted like history.
TUI
Messaging requests open in the messaging pane. The URL row shows the operation (PRODUCE or CONSUME) and the broker address, and the tabs are:
- Messages: the live consumer list. Each row shows where the message came from, its key and its value; the selected message’s value is shown below, pretty-printed when it is JSON, noted as
decoded from Schema Registry id 7when the Schema Registry decoded it, as text, or as a hex dump when it is binary.j/kmove the selection,g/Gjump to the first or newest message, andp(or Space) pauses the list, which then shows how many messages arrived since. The pane keeps at most 10000 messages: when the buffer is full the consumer stops, so it fetches nothing more, and what it collected is kept. It also keeps at most 64 MiB of messages: beyond that the oldest are dropped, and the status line says how many (3 oldest dropped (over 64 MiB)). - Compose: the messages a produce sends, as YAML.
- Broker: the destination and connection settings (topic, partitions and offset, exchange, keys and queue, QoS, security, auth, TLS, Schema Registry, limits) as YAML.
- Assertions: the request’s assertions, as YAML.
Ctrl+R runs the operation. A consume runs until Esc stops it (the exchange is then shown and recorded) or its buffer is full. Messages reach the pane redacted.
Testing against real brokers
Unit and integration tests use in-process fakes: a fake Schema Registry and an MQTT broker (3.1.1 and 5 over TCP, mutual TLS and WebSocket) on loopback. The runner, CLI and TUI tests use that MQTT broker; their Kafka variants (crates/rustman-messaging/tests/runner.rs and crates/rustman-cli/tests/messaging.rs) run in the CI messaging-kafka job. The MQTT and AMQP tests in tests/mosquitto.rs and tests/rabbitmq.rs run only in the CI messaging-mqtt-amqp job against Mosquitto (with a mutual-TLS listener) and RabbitMQ, and return early elsewhere (RUSTMAN_MQTT_BROKER, RUSTMAN_MQTTS_BROKER with RUSTMAN_MQTT_TLS_DIR, RUSTMAN_AMQP_BROKER). The Kafka broker tests in crates/rustman-messaging/tests/kafka_broker.rs run only in the CI messaging-kafka job, which starts Redpanda (PLAINTEXT and SCRAM-SHA-512) and checks that no consumer group exists after consuming. To run them locally:
docker run -d --name redpanda -p 9092:9092 redpandadata/redpanda:v24.2.27 redpanda start \
--mode dev-container --smp 1 \
--kafka-addr PLAINTEXT://0.0.0.0:9092 --advertise-kafka-addr PLAINTEXT://127.0.0.1:9092
RUSTMAN_KAFKA_BROKERS=127.0.0.1:9092 cargo test -p rustman-messaging --test kafka_broker
docker run -d --name rabbitmq -p 5672:5672 rabbitmq:4.1.4-alpine
RUSTMAN_AMQP_BROKER=amqp://guest:guest@127.0.0.1:5672/%2f cargo test -p rustman-messaging --test rabbitmq
Assertions and captures
Assertions are declarative checks on a response: its status, headers, JSON fields, schema, body text and timing. Captures extract values from a response into variables that later requests use, such as a login token. Together they turn a collection into a repeatable test, without a scripting language.
The examples on this page are checked by an integration test (crates/rustman-http/tests/docs_assertions.rs): the files below make up one workspace, every request in it is sent to an in-process test server that answers as described, and every assertion and required capture must pass. The failure messages quoted on this page are the exact texts Rustman prints, checked by unit tests in crates/rustman-core/src/assertions/tests.rs.
How assertions are evaluated
assertions is an ordered list in a request file. Each item has one key naming its type: status, header, json, schema, body or latency, or one of the GraphQL checks (no_errors, errors_count, error_message_contains, error_code, data) described in GraphQL, or rpc_error for JSON-RPC calls, described in JSON-RPC, or one of the MCP checks (is_error, content_text_contains, structured, output_schema, tool_exists) described in MCP client, or grpc_status and metadata for gRPC calls, described in gRPC, or one of the realtime checks (messages, close_code) described in WebSocket and SSE, or evm for evm-call files, described in EVM toolkit, or subgraph (max_lag_blocks) for GraphQL requests with the subgraph preset, described in Blockchain GraphQL presets.
- Every assertion is evaluated, even after one fails, so a report shows all of them.
- Each one ends as
pass,fail(with the expected and actual values) orerror(it could not be evaluated, for example a JSONPath on a body that is not JSON). - A request passes only when all its assertions pass. A request with no assertions passes on any completed response, whatever its status (a
500included); the reporter still shows the status.
# users/get-user.rman.yaml
version: 1
kind: http
name: Get user
url: '{{base_url}}/users/42'
assertions:
- status: 200
- header:
name: x-request-id
exists: true
- header:
name: Content-Type
contains: json
- json:
path: $.user_missing
exists: false
- json:
path: $.id
equals: 42
- json:
path: $.name
matches: '^[A-Z][a-z]+$'
- json:
path: $.roles
length: 2
- json:
path: $.roles
contains: admin
- json:
path: $.roles[*]
equals: [admin, dev]
- json:
path: $.address.city
type: string
- json:
path: $.id
gte: 1
- body:
contains: '"email"'
- body:
not_contains: password
- latency:
total_lt: 5000
Status
| Form | Passes when |
|---|---|
status: 200 | the status is 200 |
status: [200, 201] | the status is one of the list |
status: "2xx" | the status is in that class (1xx to 5xx) |
A mismatch reads status: expected 200, got 404, status: expected one of [200, 204], got 201 or status: expected 2xx, got 500.
Headers
header: {name, <op>} with exactly one operator:
| Operator | Passes when a value of the header… |
|---|---|
equals: <text> | is exactly the text |
contains: <text> | contains the text |
matches: <regex> | matches the regular expression |
exists: true / exists: false | is present / is absent |
Header names match case-insensitively. When a header repeats (several Vary or Set-Cookie lines), the assertion passes if any value satisfies it. Failures read header x-trace: expected to exist, got nothing or header vary: expected "Cookie", got "Accept", "Origin". Values of Authorization, Proxy-Authorization, Cookie and Set-Cookie are shown as «redacted:<Header>».
JSON fields
json: {path, <op>: value} selects nodes of a JSON body with an RFC 9535 JSONPath and compares them with exactly one operator:
| Operator | Passes when the selection… |
|---|---|
equals: <value> | equals the value (numbers compare by value, so 1 equals 1.0) |
not_equals: <value> | does not equal the value |
contains: <value> | is a string containing the text, an array with an equal element, or an object with that key |
matches: <regex> | is a string (or a number or boolean, in its JSON form) matching the regular expression |
gt, gte, lt, lte: <number> | is a number >, >=, <, <= the bound |
exists: true / exists: false | matches at least one node / matches nothing |
length: <n> | is an array, object or string (in characters) of that length |
type: <name> | is a string, number, integer, boolean, array, object or null |
- A path matching one node compares against that node. A path matching several nodes (
$.roles[*],$..id, a filter) compares against the list of nodes, soequals: [admin, dev]andlength: 2apply to the list. - A path that matches nothing fails, it does not error:
json $.nope: expected to exist, got nothing, orjson $.nope: expected 1, got nothingfor other operators. Onlyexists: falsepasses. - A body that is not JSON yields
error: response body is not JSON. An invalid JSONPath, an invalid regular expression or an unknowntypename is also an error. - Failures quote compact JSON:
json $.user.id: expected 41, got 42,json $.items: expected length 3, got 2,json $.price: expected > 10, got 9.5,json $.name: expected type number, got string.
JSON Schema
schema: {file: <path>} validates the JSON body against a schema file, and schema: {inline: {...}} against a schema written in the request file. The file path is relative to the request file’s folder and must stay inside the workspace; schema files are JSON.
The default dialect is JSON Schema draft 2020-12. A schema whose $schema names draft-07 (http://json-schema.org/draft-07/schema#) is validated as draft-07. Remote $refs are not fetched.
File schemas/user.json:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": ["id", "email"],
"properties": {
"id": {"type": "integer"},
"email": {"type": "string"},
"roles": {"type": "array", "items": {"type": "string"}}
}
}
# users/user-schema.rman.yaml
version: 1
kind: http
name: User matches its schema
url: '{{base_url}}/users/42'
assertions:
- schema:
file: ../schemas/user.json
- schema:
inline:
$schema: http://json-schema.org/draft-07/schema#
type: object
properties:
address:
type: object
required: [city]
On failure the message lists up to 10 violations, each with its instance path (a JSON Pointer, / for the root) and message, and then how many more there are:
schema: expected a valid document, got 2 violations: /: "id" is a required property; /email: 5 is not of type "string"
A schema that is itself invalid, an unreadable file or a body that is not JSON is an error.
Body text
body: {<op>: <text>} checks the decoded body text with one of contains, not_contains, matches (a regular expression) or equals. A binary body (not valid UTF-8) yields error: body is binary. Failures quote at most 200 characters of the body: body: expected not to contain "order", got "created order-123456".
Regular expressions everywhere (headers, JSON, body, captures) use the Rust regex syntax: matching takes linear time, and look-around and back-references are not supported. A pattern matches anywhere in the text unless anchored with ^ and $.
Latency
latency: {total_lt: <ms>} and latency: {ttfb_lt: <ms>} (both may be given) compare the exchange timings: the total time and the time to first byte (see timings). A slow response fails with latency total: expected < 200 ms, got 350 ms.
Variables in expected values
Expected values may use {{variable}}, resolved like the request itself: overrides, captures from earlier requests, request and collection variables, persisted captures, the environment and rustman.toml (see precedence). An unresolved name is an error that lists every missing name: error: json $.id: unresolved variable(s): user_id.
A variable always resolves to text. When an expected value is exactly a placeholder string, such as equals: '{{user_id}}', a number or boolean in the response compares through its text form, so a captured 42 equals the JSON number 42. A literal string does not: equals: 'true' does not match the boolean true.
A secret used in an expected value is redacted from every message, like everywhere else.
Captures
captures is a list evaluated after the assertions. Each capture sets one variable for every later request of the same run:
from | Fields | Captures |
|---|---|---|
json | path | the selected node: a string as is, any other value as compact JSON (42, {"a":1}); several nodes as a JSON array |
header | name | the header’s first value (case-insensitive name) |
status | none | the status code, such as 201 |
body_regex | pattern, optional group | a group of the first match in the body text: group 1 by default, or the whole match when the pattern has no groups |
cookie | name | the value of that cookie set by this response (Set-Cookie) |
metadata | name | gRPC only: the first value of that metadata entry among the response headers, then the trailers (see gRPC) |
evm_output, evm_event, evm_receipt | output; event and field; field | EVM only: a decoded output, an event field or a receipt field, quantities as decimal strings and addresses checksummed (see EVM toolkit) |
Every capture also takes required and persist (both default false).
- A capture that matches nothing leaves the variable unset and records a warning, such as
capture 'id': no match for $.id. Withrequired: trueit fails the request with that message instead. - A capture of a later request replaces the value of an earlier one with the same name. Captured values outrank request, collection and environment variables, and only
--varoverrides them.
# orders/create-order.rman.yaml
version: 1
kind: http
name: Create order
method: POST
url: '{{base_url}}/orders'
body:
type: text
content: one coffee
assertions:
- status: [201, 202]
- body:
matches: order-[0-9]{6}
captures:
- var: order_url
from: header
name: Location
required: true
- var: order_id
from: body_regex
pattern: order-([0-9]+)
- var: created_status
from: status
- var: cart
from: cookie
name: cart
Token chaining
A login request captures a token, and every later request sends it:
# auth/1-login.rman.yaml
version: 1
kind: http
name: Log in
method: POST
url: '{{base_url}}/token'
assertions:
- status: 200
captures:
- var: token
from: json
path: $.access_token
required: true
- var: user_id
from: json
path: $.user.id
persist: true
# auth/2-me.rman.yaml
version: 1
kind: http
name: Who am I
url: '{{base_url}}/me'
auth:
type: bearer
token: '{{token}}'
assertions:
- status: 200
- json:
path: $.id
equals: '{{user_id}}'
Where captured values live
Captures live only for the current run by default.
persist: truealso writes the value to the active environment’s runtime state file,.rustman/state/<env>.yaml(.rustman/state/@none.yamlwithout an active environment). A later, separaterustman runresolves{{user_id}}from it, below request and collection variables but above the environment. The state file is per-user, git-ignored state, written atomically and readable by the current user only. Files underenvironments/are never modified. A value that contains a secret seen in the run (a server echoing it back) is not written; the run warnscapture 'user_id': not persisted: the value contains a secretand the value is still available to later requests of the same run.- A captured variable listed under the active environment’s
secretsis a secret: its value is stored in the secret store (the OS keychain, or.rustman/secrets.yaml), never in a state file, whether or notpersistis set, and it is redacted from reports, history, logs and errors like any other secret. With the environment below, the login above refreshes the storedtokenon every run. - A captured value that contains a secret seen earlier in the run (a server echoing a token back, say), or any piece of one at least 4 characters long, becomes a secret itself for the rest of the run: every later request that uses it redacts it as
«redacted:<var>»in reports, history, logs and errors, and its capture result shows"secret": true. It is not stored anywhere, so an exchange that used it cannot be replayed from history.
# environments/local.yaml
variables:
base_url: http://localhost:8080
secrets:
- token
To forget persisted captures, delete .rustman/state/<env>.yaml; to forget a captured secret, run rustman secret rm <name> --env <env>.
Snapshot testing
A snapshot records a known-good response once and fails later runs when the response changes, with a readable diff. Normalization keeps timestamps, ids and other noise out of the comparison, and secrets are redacted before anything is stored. Snapshot files are plain YAML next to the request, so a response change shows up in code review.
The examples on this page are checked by an integration test (crates/rustman-core/tests/docs_snapshots.rs): every request file loads, every snapshot file is read back and written again byte for byte, and each response shown is normalized into exactly the snapshot shown after it.
The snapshot assertion
Add snapshot to a request file’s assertions list. The shorthand compares the status and the body with the default rules:
# users/get-user.rman.yaml
version: 1
kind: http
name: Get user
url: '{{base_url}}/users/42'
assertions:
- status: 200
- snapshot
The full form takes any of name, compare, ignore, headers, replace, sort and presets, all optional:
# users/list-users.rman.yaml
version: 1
kind: http
name: List users
url: '{{base_url}}/users'
assertions:
- snapshot:
name: listing
compare: [status, headers, body]
ignore: ['$.request_id']
headers:
include: [content-type, x-api-version]
replace:
- pattern: 'ORD-\d+'
with: 'ORD-«n»'
sort:
- path: $.users
by: id
presets: [timestamps, uuids, etags]
- A request file may hold several snapshot assertions; each needs its own
name(the default name isdefault). Two with the same name fail to load with<path>:<line>: duplicate snapshot name 'default'. - Names may use letters, digits,
-and_, since they become part of a file name. - Snapshots work for every request kind that produces a response:
http,graphql,jsonrpcandmcp. Forjsonrpc, each call’s snapshot holds that call’s response envelope (resultorerror); in a batch, names are unique across all the calls (see JSON-RPC snapshots). - With
--iterationsabove 1, every iteration compares against the same snapshot.
Where snapshots are stored
Each snapshot is a file in a __snapshots__/ folder next to the request file, named <request-file-stem>.<name>.snap.yaml. users/get-user.rman.yaml with a default snapshot is stored in users/__snapshots__/get-user.default.snap.yaml.
Snapshot files belong in Git: rustman init never adds __snapshots__/ to .gitignore.
The snapshot file
# users/__snapshots__/get-user.default.snap.yaml
version: 1
request: users/get-user.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 200
body:
json:
id: 42
name: Ada
roles:
- admin
updated: «timestamp»
versionis1.requestis the request file’s path from the workspace root, always with/.name,kindandcomparesay which assertion wrote it.status,headersandbodyare present when compared.- The body is one of:
json: the JSON body as a YAML structure, every object’s keys sorted;text: any other text, as a literal block;binary:{sha256, size}for bodies that are not valid UTF-8 or whose content type is not textual (images, archives…), and for bodies larger than 1 MiB after normalization (with a warning suggestingignorerules);events: the event list of a subscription (see Subscriptions).
- Files use 2-space indentation and end with a newline. Two runs producing the same normalized response produce byte-identical files, whatever the order of the keys in the response.
What is compared
compare lists the parts of the response that are stored and compared: status, headers and body. The default is [status, body].
When headers are compared, only the headers listed in headers.include are stored (default: content-type), with lower-case names, sorted. Repeated headers are joined with , . A header that changes on every response, such as Date, therefore never fails a snapshot unless it is included. Included headers listed in headers.redact are stored as «redacted», which checks that the header is present without storing its value.
# catalog/get-item.rman.yaml
version: 1
kind: http
name: Get item
url: '{{base_url}}/items/7'
assertions:
- snapshot:
compare: [status, headers, body]
headers:
include: [content-type, x-request-id]
redact: [x-request-id]
// response: 200
// Content-Type: application/json
// Date: Tue, 17 Nov 2026 10:00:00 GMT
// X-Request-Id: 7d2f9c
{"id": 7, "title": "Lamp"}
# catalog/__snapshots__/get-item.default.snap.yaml
version: 1
request: catalog/get-item.rman.yaml
name: default
kind: http
compare:
- status
- headers
- body
status: 200
headers:
content-type: application/json
x-request-id: «redacted»
body:
json:
id: 7
title: Lamp
If content-type later changes from application/json to text/html, the snapshot fails with:
changed headers.content-type: "application/json" → "text/html"
Normalization
Before a response is stored or compared, it is normalized in a fixed order:
- secret redaction;
ignore;presets;replace;sort;- the canonical form (object keys sorted).
The same normalized form is used for storing and for comparing, and normalizing a response twice gives identical output.
Secret redaction
Secret values and the sensitive headers (Authorization, Proxy-Authorization, Cookie, Set-Cookie) are replaced with «redacted:<name>» first, with the same redaction every other output uses (see Environments). This includes secrets a server echoes back inside a body, in the encoded forms listed under Redaction. A snapshot file never contains a resolved secret value, even with --update-snapshots; if a replace rule would put one back, the snapshot is not written and the assertion reports an error.
Snapshot files are meant to be committed, so know the limits of that redaction before you commit one:
- A secret the server transforms before echoing it (base64-encodes it, hashes it, changes its case, splits it) is not recognized and is stored as the server sent it. Add an
ignoreorreplacerule for such a field. - Only the secrets the requests of the command reference are known (see Redaction). An environment secret no request of the command uses is not read from the store, so a server that returns it anyway gets it stored in plain text, and the check before writing cannot catch it either.
Review a new snapshot file before committing it, as you would any other file.
# auth/whoami.rman.yaml
version: 1
kind: http
name: Who am I
url: '{{base_url}}/whoami'
headers:
- name: X-Token
value: '{{token}}'
assertions:
- snapshot
With the secret token set to abc123, and a server echoing it:
// response: 200
// Content-Type: application/json
{"user": "ada", "token": "abc123"}
# auth/__snapshots__/whoami.default.snap.yaml
version: 1
request: auth/whoami.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 200
body:
json:
token: «redacted:token»
user: ada
Ignored paths
ignore is a list of JSONPath expressions. Every value they match is stored as «ignored», so it can change freely while the field itself must still be there. A path that matches nothing is not an error. For an event list, the paths are applied to each event.
# orders/create-order.rman.yaml
version: 1
kind: http
name: Create order
method: POST
url: '{{base_url}}/orders'
assertions:
- snapshot:
ignore: ['$.id', '$.items[*].created_at']
// response: 201
// Content-Type: application/json
{"id": 981, "items": [{"sku": "A1", "created_at": "yesterday"}]}
# orders/__snapshots__/create-order.default.snap.yaml
version: 1
request: orders/create-order.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 201
body:
json:
id: «ignored»
items:
- created_at: «ignored»
sku: A1
Presets
presets replace common kinds of changing values with a typed placeholder:
| Preset | Matches | Placeholder |
|---|---|---|
timestamps | RFC 3339 and ISO 8601 date-times such as 2026-11-17T10:00:00Z or 2026-11-17 10:00 | «timestamp» |
dates | calendar dates such as 2026-11-17, and HTTP dates such as Tue, 17 Nov 2026 10:00:00 GMT | «date» |
uuids | UUIDs in any case | «uuid» |
etags | a whole value that is an entity tag, "33a64df5" or W/"33a64df5" | «etag» |
epoch_ms | 13-digit integers (or strings of 13 digits) in fields named *_at, *time* or timestamp | «epoch_ms» |
jwt | JSON Web Tokens (eyJ...) | «jwt» |
The default is [timestamps, uuids]. presets: [] turns every preset off, and a list replaces the defaults (list timestamps again to keep it). Presets apply to every string of a JSON body, to the whole of a text body, and to stored header values. They run in the order of the table whatever order they are listed in, so a timestamp is never half-replaced as a date.
# sessions/start.rman.yaml
version: 1
kind: http
name: Start session
method: POST
url: '{{base_url}}/sessions'
assertions:
- snapshot:
presets: [timestamps, dates, uuids, epoch_ms, jwt]
// response: 200
// Content-Type: application/json
{"id": "3f2504e0-4f89-11d3-9a0c-0305e82c3301", "started": "2026-11-17T10:00:00Z", "day": "2026-11-17", "expires_at": 1763373600000, "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.c2ln"}
# sessions/__snapshots__/start.default.snap.yaml
version: 1
request: sessions/start.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 200
body:
json:
day: «date»
expires_at: «epoch_ms»
id: «uuid»
started: «timestamp»
token: «jwt»
With presets: [], "updated":"2026-11-17T10:00:00Z" is stored verbatim.
Regex replacements
replace is a list of {pattern, with} rules, applied in order after ignore and the presets: to every string value of a JSON body, or to the whole text of any other body. with may use $1 or ${name} for capture groups. An invalid regular expression fails when the file loads, with <path>:<line>: invalid regex '(': <reason>.
# orders/get-order.rman.yaml
version: 1
kind: http
name: Get order
url: '{{base_url}}/orders/latest'
assertions:
- snapshot:
replace:
- pattern: 'ORD-\d+'
with: 'ORD-«n»'
// response: 200
// Content-Type: text/plain
Order ORD-123 shipped.
# orders/__snapshots__/get-order.default.snap.yaml
version: 1
request: orders/get-order.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 200
body:
text: Order ORD-«n» shipped.
ORD-987 normalizes to the same value, so the snapshot keeps matching.
Array ordering
Array order is significant by default. sort is a list of {path, by} rules: the array at the JSONPath path is sorted by the value at by, a key path relative to each item (id, owner.id), or by the whole item when by is omitted. Numbers sort numerically and strings by their characters.
# users/list-team.rman.yaml
version: 1
kind: http
name: List team
url: '{{base_url}}/team'
assertions:
- snapshot:
sort:
- path: $.users
by: id
- path: $.tags
// response: 200
// Content-Type: application/json
{"users": [{"id": 10, "name": "Lin"}, {"id": 2, "name": "Ada"}], "tags": ["ops", "dev"]}
# users/__snapshots__/list-team.default.snap.yaml
version: 1
request: users/list-team.rman.yaml
name: default
kind: http
compare:
- status
- body
status: 200
body:
json:
tags:
- dev
- ops
users:
- id: 2
name: Ada
- id: 10
name: Lin
Diffs
When a response no longer matches, the failure shows what changed:
-
JSON bodies: one line per change, with its JSONPath, its kind (
added,removedorchanged) and the old and new values. At most 50 changes are shown, followed by… and 30 more changes(for 80). Arrays compare by index, after anysortrule.changed $.user.role: "admin" → "viewer" added $.user.email: "ada@example.com" removed $.legacy: true -
Status and headers: the same lines, with
statusandheaders.<name>as the path. -
Text bodies: a unified line diff with 3 lines of context, from the stored snapshot (
---) to the received response (+++). -
Binary bodies: the old and new size and hash:
binary body changed: 10240 B sha256:ab12… → 10301 B sha256:9f0c… -
A body that changed form (JSON to text, for example):
body type changed: json → text.
Subscriptions and event lists
For exchanges with a bounded event list (GraphQL subscriptions, JSON-RPC subscriptions), the snapshot body is the list of events, each normalized on its own. When a run collects a different number of events than the snapshot holds, the failure starts with event count changed: 3 → 2, followed by the diff of the events.
# live/__snapshots__/on-price.default.snap.yaml
version: 1
request: live/on-price.rman.yaml
name: default
kind: graphql
compare:
- status
- body
body:
events:
- data:
price: 10
- data:
price: 11
Recording, updating and CI
- First run: when a snapshot file does not exist, it is written and the assertion is reported
recorded(it counts as passed). - Later runs compare against the stored file:
matchedorfailed. - Update mode (
--update-snapshots) overwrites differing snapshots and reports themupdated. Matching snapshots are never rewritten, so their bytes and modification times stay the same. - CI mode (
--ci, or the environment variableCIset totrueor1) never writes snapshot files. A missing snapshot fails withsnapshot missing: <path> (run without --ci to record). --ci(orCI=true) together with--update-snapshotsis a usage error:rustman runexits with code 2 anderror: --update-snapshots cannot be used in CI mode, before anything is sent.rustman sendandrustman graphql querytake the same--update-snapshots(-u) and--ciflags and honorCIthe same way; they note each recorded or updated snapshot on stderr, as insnapshot default recorded: users/__snapshots__/get-user.default.snap.yaml.- Agents (
rustman mcp serve) always compare in CI mode and never write snapshot files.
rustman run users/ # records new snapshots, compares the others
rustman run users/ --update-snapshots # accepts intended changes (-u for short)
rustman run . --ci # in a pipeline: never writes, a missing snapshot fails
A failed or missing snapshot fails its request like any other assertion (exit code 1). Recorded and updated snapshots count as passed, so an update run exits 0 when nothing else failed.
Snapshot files are written through a temporary file that is renamed into place, under a per-file lock, so a run and an approval in the TUI never leave half a file. A write only replaces the file it compared against: when another run or an approval changed the snapshot in the meantime, the write is skipped with <path>: the snapshot file changed on disk since it was compared; it was not written (run again). A temporary file (.<name>.snap.yaml.<pid>-<n>.tmp) left by an interrupted write is removed by the next write of that snapshot, and is safe to delete. Snapshot files checked out with Windows line endings still match.
Reviewing in the TUI
Sending a request with a snapshot from the TUI records, compares and stores snapshots the same way as rustman run (in CI mode when CI is true or 1). When a snapshot failed, is missing or was just recorded, the response viewer gets a Snapshot tab after Assertions with each snapshot’s state, its file and the diff (a recorded or missing snapshot shows the received snapshot instead):
snapshot default failed · users/__snapshots__/get-user.default.snap.yaml
changed $.name: "Bob" → "Ana"
added $.role: "admin"
a approve · r reject · Alt+A review all
aapproves the next open snapshot: the received snapshot is written over the stored file (atomically, under its lock) and the tab showsapproved.rrejects it: the file is left unchanged, the assertion stays failed and the tab showsrejected.- After sending several requests,
Alt+Aopens a review queue that steps through every failing snapshot still open in any tab:aapproves andrrejects the current one and moves to the next,n/p(or the arrow keys) step without deciding, andEsccloses it. The queue closes by itself after the last decision. - In CI mode approving is disabled: the tab says
Approval is disabled in CI mode.andaonly shows a warning.
Ctrl+Shift+<letter> is not used because most terminals cannot tell it from Ctrl+<letter>. Everything the tab and the queue show is redacted, like the snapshot files themselves.
In reports
Every reporter shows the snapshot outcomes: matched, recorded, updated, failed or missing. The pretty report lists the files a run recorded or updated under their request, the diff under a failed one, and a summary line with the counts:
PASS users/get-user GET 200 12 ms
snapshot default recorded: users/__snapshots__/get-user.default.snap.yaml
FAIL users/list-users GET 200 9 ms
snapshot mismatch: users/__snapshots__/list-users.listing.snap.yaml
changed $.users[0].role: "admin" → "viewer"
2 requests: 1 passed, 1 failed, 0 errored, 0 skipped (21 ms)
1 snapshot recorded, 1 snapshot failed
- JSON (
rustman.report/v1, additive fields): each snapshot assertion ("kind": "snapshot") has asnapshotobject withname,state,path(the snapshot file, relative to the workspace, with/) and, when it failed or was updated, the structureddiff(changeswithpath,kind,oldandnew;more; andtext,binary,event_countorbody_typewhen they apply).summary.snapshotscounts the states; both are absent from runs without snapshots. See the report schema. - JUnit: a failed snapshot’s
<failure>message holds the diff text; recorded and updated snapshots are listed in the test case’s<system-out>, and the counts are the suite propertysnapshots. - TAP: the diff is a reason in the failed test point’s YAML block; recorded and updated snapshots and the counts are
#comments.
Every diff is redacted like the rest of the report.
Listing and pruning
rustman snapshot list [path] lists every snapshot file under a folder or request file (default: the whole workspace) with its state, without sending anything:
ok users/__snapshots__/get-user.default.snap.yaml users/get-user.rman.yaml default
unreferenced name users/__snapshots__/get-user.v1.snap.yaml users/get-user.rman.yaml v1
orphaned users/__snapshots__/old.default.snap.yaml users/old.rman.yaml default
ok: the request file declares a snapshot with that name (or is a kind this version cannot read, which is never pruned).orphaned: the request file no longer exists.unreferenced name: the request file no longer declares that snapshot name.
--json prints an array of {path, request, name, state} objects, with the states ok, orphaned and unreferenced_name.
rustman snapshot prune [path] finds the orphaned and unreferenced snapshot files and lists them as obsolete <path> (<state>). Deleting tracked files is opt-in:
--yes(-y) deletes them and lists each asdeleted <path> (<state>); a__snapshots__/folder left empty is removed too.- On a terminal without
--yes, it asksdelete 2 snapshot files? [y/N]. - Without a terminal and without
--yes, it only lists them and printspass --yes to delete themon stderr. --dry-runonly lists them, even with--yes.
A file that another writer (a run with -u, or an approval in the TUI) changed after it was listed is kept, not deleted.
Both commands exit 0, or 2 when the workspace or a file cannot be read or deleted.
Data-driven runs
rustman run --data <file> runs the selected requests once per row of a CSV or JSON file, like newman run -d. Each row’s columns are variables during its iteration, so one folder of requests can cover many users, tenants or test cases.
rustman run api/users --env ci --data users.csv
rustman run api/users --env ci --data users.csv --data-label email --reporter junit:out/junit.xml
With users.csv:
email,role
ana@example.com,admin
bo@example.com,user
cy@example.com,user
and a folder of 2 requests using {{email}}, the run sends 6 requests: both requests for row 1, then both for row 2, then both for row 3. Every request in iteration 2 resolves {{email}} to bo@example.com.
Data files
The file’s extension picks the format: .csv or .json (in any case). Both are read by the shared data-row reader (rustman_core::data_rows), which load testing’s --data uses too.
- CSV follows RFC 4180. The first row is the header and names the columns. A UTF-8 BOM is stripped, fields may be quoted (
"Doe, Jane", with""for a quote), line endings may be\nor\r\n, and every value is a string (007stays007). Every row must have as many fields as the header. An empty cell defines its variable as empty text, so it overrides a value from the environment or the collection; leave the column out of the file to fall back to those. - JSON must be an array of objects. Scalars become strings (
1becomes1,truebecomestrue,nullbecomes empty text); numbers keep their text exactly as written (1.10stays1.10,1e2stays1e2, big integers keep every digit). Nested values become compact JSON text, their numbers kept as written too:{"id": 1, "tags": ["a"]}gives{{id}}=1and{{tags}}=["a"]. A key missing from a row is not defined in that iteration.
Rows are numbered from 1 without the header, as in iteration labels. A bad file is a usage error (exit code 2), reported before any request is sent:
| Problem | Message |
|---|---|
| No data rows (or an empty file) | --data users.csv: no rows |
| A quoted field that is never closed | --data users.csv: invalid CSV: unterminated quoted field in row 1 |
Text after the closing quote of a quoted field ("a"b) | --data users.csv: invalid CSV: text after the closing quote of a quoted field in row 2 |
| A row with the wrong number of fields | --data users.csv: row 4 has 3 fields, expected 2 |
| JSON that is not an array of objects | --data cases.json: expected an array of objects |
| A repeated or empty header name | --data users.csv: duplicate column 'email' |
| Another extension | --data users.txt: unsupported data file (use .csv or .json) |
A collection’s default data file
A _collection.yaml may name the data file its folder runs with, relative to the _collection.yaml and inside the workspace:
# api/tenants/_collection.yaml
data: tenants.csv
secret_columns: [admin_pin]
rustman run api/tenants (or a request inside it) then runs once per row of api/tenants/tenants.csv. The nearest folder at or above each run path that sets data applies; two run paths naming different files is a usage error. --data <file> replaces the default and --no-data runs the folder once without row variables. A data path that leaves the workspace fails with api/tenants/_collection.yaml: data: file path escapes workspace: ../x.csv.
Iterations and variables
The row sits in the variable precedence directly below in-run captures: --var overrides > captures of the iteration > data row > request variables > collection variables > persisted captures > environment > rustman.toml.
- A row value beats the request’s and the collection’s
variables, which act as defaults the data file varies, and the environment, so a row can change{{base_url}}per tenant. - A capture made during the iteration beats the row, so a login request can replace a row’s placeholder
token. - Iterations are independent: captures made without
persist: trueare cleared at the start of each iteration, so a request using{{order_id}}before it is captured again fails withunresolved variable(s): order_idin every iteration. Persisted captures stay available.
With --data, the number of iterations is the number of rows. --data with --iterations is a usage error: --data and --iterations cannot be combined (iterations = row count). With a collection’s default data file, pass --no-data to use --iterations instead.
Bail
--bail stops the whole run after the first failed or errored request in any iteration: every request not started yet, in this iteration and the next ones, is reported as skipped (bail). --bail=iteration skips only the rest of the failing iteration and goes on with the next row:
iteration 2/3 · row 2
FAIL rows/1-check GET 500 2 ms
status: expected 200, got 500
SKIP rows/2-after skipped (bail)
iteration 3/3 · row 3
PASS rows/1-check GET 200 1 ms
PASS rows/2-after GET 200 2 ms
Iteration labels
Each iteration has a label: the value of the --data-label <column> column, else row <index> (also when the row’s value is empty). The column must exist and must not be secret (a secret label column is a usage error, exit code 2).
prettygroups the requests under oneiteration <index>/<total> · <label>line per iteration.junittest case names end with[<label>]:get-profile [ana@example.com].tapdescriptions end with[<label>].jsonkeeps the integeriterationevery request has (1-based; with--data, the row number) and adds adata_rowobject:
"iteration": 2,
"data_row": { "index": 2, "total": 3, "label": "bo@example.com" }
A JSON report from a run without --data has no data_row, --iterations above 1 included, and is unchanged from v0.1. Under --iterations, pretty, JUnit and TAP still label each iteration by its index ([2] in JUnit and TAP names).
Compatibility: data_row is an optional field added to rustman.report/v1 in v0.2; iteration keeps its v0.1 type and meaning, so v1 consumers keep working.
Secret columns
These columns are secret:
- columns named in
--secret-columns <a,b>; - columns listed in
secret_columnsof a_collection.yamlabove any request of the run; - columns whose name contains
password,token,secretorapi_key(ignoring case, with-read as_):password,access_token,API-KEY.
Their values are redacted as «redacted:<column>» in every output, the same way as environment secrets (see redaction): reports, history, logs, error messages and the pretty output. A request body password={{password}} is recorded as password=«redacted:password», and a server echoing the value back is redacted too. Values are known to the redactor before the first request is sent.
Reports
rustman run and rustman explore run describe what they did in one canonical, versioned report: a JSON document under the schema rustman.report/v1. Every other format is rendered from that document, for every audience: machines (JSON), CI test tabs (JUnit XML), code-scanning dashboards (SARIF 2.1.0) and people (Markdown and a self-contained HTML page). No format ever shows a secret.
The canonical report
A report has a top-level schema (rustman.report/v1) and a kind:
| Kind | Written by | Content |
|---|---|---|
run | rustman run --reporter json, rustman send | Every request with its file, redacted exchange, timings, assertion results and captures; see the CLI reference |
exploration | rustman explore run (always, as .rustman/explorations/<id>/report.json) | The seed, safety settings, probe totals by outcome, the coverage matrix, the findings with evidence and reproduction, and the resources left behind; see Exploration. rustman evm probe writes one with subject: evm-rpc: its coverage matrix is methods × providers, and an evm section holds each provider’s support, archive state, latency, subscriptions, rate limit, drift, blocks and trace; see Probing EVM providers |
contract | rustman contract diff --report json | What a contract command checked, as one list of items, with a mode (diff, pact-verify or conformance); see Contract reports |
bench | rustman bench --report json=<file> | The load profile, the target, latency and error statistics per request file and overall, a per-second time series, the threshold results and error samples; see Bench reports |
rustman report schema prints the JSON Schema (draft 2020-12) that every kind validates against. The same file is published at schemas/report.schema.json. Its kind: run part is the contract the first reporters published, kept as is; its kind: exploration, kind: contract, kind: bench and kind: stress parts are generated from the Rust types with schemars, and a test fails if the published file drifts from them.
A reader built before a kind existed refuses it instead of misreading it: rustman report render exits 2 with unknown report kind '<kind>'.
rustman report schema > report.schema.json
Versioning
Additive changes (a new optional field, a new kind) keep rustman.report/v1; reports written by older versions stay valid. A breaking change bumps the major version. rustman report render and report diff read every supported version (rustman.report/v1 and v1.<minor>) and refuse any other major version with exit code 2:
$ rustman report render old.json --format html
error: old.json: unsupported report schema 'rustman.report/v9' (this version reads rustman.report/v1)
Rendering
rustman report render <REPORT> --format <json|junit|markdown|html|sarif> [-o <FILE>] [--fail-on <severity>]
renders any canonical report, of either kind, to stdout or to -o <FILE>. run and explore run render while they finish, with --report <format>[=<path>] (repeatable): every rendering comes from the same report data.
rustman explore run --spec api.yaml --target http://localhost:8080 \
--report html=out/r.html --report sarif=out/r.sarif --report junit=out/junit.xml
rustman run api --env ci --report markdown=out/run.md --report junit=out/junit.xml
rustman report render .rustman/explorations/exp-20261118-3fa9c1/report.json --format markdown -o out/r.md
A --report without a path writes to stdout; at most one report (or --reporter) may. Files are replaced atomically and their folders are created. When a --report writes to stdout, explore run prints its summary on stderr and run does not print the pretty report, so stdout holds one document.
SARIF locations are relative to the current directory when the OpenAPI document is under it, and rendering reads the document (when it is still there) to point each result at the operation’s line.
Formats
JSON
The canonical report itself, pretty-printed. report render --format json gives back the report it read.
JUnit XML
For a run, one <testcase> per request (classname is the request file) with <failure> for a failed request, <error> for an errored one and <skipped> for a skipped one.
For an exploration, one <testsuite> per tag (the operation’s first tag; untagged without one, undocumented for methods the document does not list) and one <testcase> per operation. Findings at or above --fail-on (default: the exploration’s own --fail-on, high) become a <failure> whose type is the rule id; an operation whose probes were all blocked, skipped or not run is <skipped>; findings below the threshold are listed in <system-out>.
<testsuite name="users" tests="5" skipped="1" errors="0" failures="1">
<testcase name="POST /users" classname="users" assertions="15">
<failure message="f002 [high] server-error-on-invalid-input: invalid input got status 500 instead of 4xx" type="server-error-on-invalid-input">f002 [high] server-error-on-invalid-input: invalid input got status 500 instead of 4xx</failure>
<system-out>f005 [medium] error-leakage: Java stack trace: at com.example.UserService.create(UserService.java:42)</system-out>
</testcase>
<testcase name="DELETE /users/{id}" classname="users" assertions="2">
<skipped message="2 probes blocked: DELETE needs --allow-destructive"/>
</testcase>
</testsuite>
SARIF 2.1.0
Each rule a finding broke is a reportingDescriptor (its description, its remediation as help, and a security-severity score for GitHub). Each finding is a result:
| Finding severity | SARIF level | security-severity |
|---|---|---|
critical | error | 9.5 |
high | error | 8.0 |
medium | warning | 5.5 |
low | note | 3.0 |
info | note | 0.0 |
The location is the OpenAPI document and the JSON pointer of the operation (the path item for an undocumented method), with the operation’s line when the document can be read:
{
"ruleId": "response-schema-violation",
"level": "warning",
"message": { "text": "GET /users/{id}: at '': \"email\" is a required property" },
"locations": [
{
"physicalLocation": {
"artifactLocation": { "uri": "api.yaml" },
"region": { "startLine": 52 }
},
"logicalLocations": [
{ "name": "GET /users/{id}", "fullyQualifiedName": "/paths/~1users~1{id}/get", "kind": "object" }
]
}
],
"partialFingerprints": { "rustmanFinding/v1": "response-schema-violation|GET /users/{id}" }
}
partialFingerprints keeps a finding the same alert across runs. A run report renders as SARIF too: each failed request is an assertion-failed result and each errored one a request-errored result, located in its request file.
Markdown
A summary (target, document, seed, safety settings, probe totals and findings by severity), the findings table sorted by severity, each finding with its description, remediation, redacted evidence and curl reproduction, the coverage summary and matrix, and the resources left behind. A run renders as a summary, the requests table and the reasons of each failure. It suits pull-request comments and job summaries:
| ID | Severity | Rule | Operation | Occurrences | Message |
|---|---|---|---|---:|---|
| f001 | critical | `auth-not-enforced` | `GET /admin/users` | 2 | a request without valid credentials got status 200 |
| f002 | high | `server-error-on-invalid-input` | `POST /users` | 1 | invalid input got status 500 instead of 4xx |
What comes from the target or the document is escaped: messages (which can quote a response) have every Markdown and HTML character backslash-escaped, so a response cannot inject markup or raw HTML into a viewer, and URLs and operations sit in code spans that their content cannot close. Evidence bodies sit in fences longer than any run of ~ in them.
HTML
One self-contained file: its stylesheet and script are inlined, and it references nothing on the network (no http:// or https:// script, style, font or image). Findings are expandable <details> with the evidence and reproduction, which works with JavaScript disabled; the severity and operation filters are the only part that needs it, and they stay hidden without it. The page follows the system’s light or dark theme.
Contract reports
A kind: contract report has a mode: diff for rustman contract diff, pact-verify for rustman contract pact verify and conformance for rustman contract verify. It has its sources (for a diff, old and new, where a --base document is named <ref>:<path>; for a Pact verification, each pact file; for conformance, the spec and the exchanges source), the rule catalog_version (diffs only), a summary (the count per status in the mode’s order, how many items an allowlist accepted, how many fail the command, and passed), the items and the warnings (expired and unused allowlist entries, failed provider-state teardowns). Each item has the rule id and its description, a status, the allowlist allowed justification when one accepted it, failing, the subject, a message, and locations: the primary one first, each with a JSON pointer.
| Mode | Statuses, in order | One item per | Subject | Primary location |
|---|---|---|---|---|
diff | breaking, non-breaking, unknown | difference (rule id from the catalog) | the operation | the new document, at the changed element |
pact-verify | passed, failed, blocked | interaction (rule pact-interaction) | the interaction’s description and consumer | the Pact file, at /interactions/<n> |
conformance | violation, undocumented, conforms | exchange (rules conformance-violation, undocumented-exchange, conforms) | the matched operation, or the exchange’s method and path | the document, at the operation |
A conformance report also has a coverage: how many documented operations the exchanges observed out of the total, and every operation with its number of exchanges and of exchanges with violations.
- Markdown and HTML: the sources and catalog version, a summary line with the counts per status (
2 breaking, 1 non-breaking, 0 unknown, 1 allowed), then one table per status in that order, breaking first and failing items first within a table, each row with the rule id, operation, message and pointer; then the allowlist justifications, the coverage of a conformance check (1/2 operations observedafter the summary, and a table of operations) and the warnings. - JUnit XML: one
<testsuite>named after the mode (contract diff,contract pact-verify,contract conformance) and one<testcase>per item; an item that fails the command is a<failure>whosetypeis the rule id. - SARIF: one
reportingDescriptorper rule id and one result per item, located in the primary document (artifactLocation) at the JSON pointer of the changed element (logicalLocations[].fullyQualifiedName). An item that fails the command is at levelerror, an unacceptedunknownone atwarning, the others atnote; an allowlisted item carries its justification as anexternalsuppression.
report diff does not compare contract reports (exit 2).
Bench reports
A kind: bench report (rustman bench) has the target, the environment, the profile (the executor and its flags), aborted when the run stopped early (threshold or interrupted; absent otherwise), the totals (the latency kind service or corrected, duration, iterations completed and interrupted, scheduled and dropped iterations, requests per second and the generator’s p99 lag), the overall statistics and those of each request file in files (requests, errors by class, error_rate, latency min/avg/p50/p90/p95/p99/max in milliseconds, assertion checks passed and failed, average phases, bytes_sent and bytes_received), the per-second series (requests, errors, rps, p50/p95/p99 and active VUs), the thresholds (each expression, passed, the actual value and whether it is an abort one), up to 20 error_samples per error class (class, file, redacted message and time since the start) and the warnings.
- Markdown and HTML: the target, executor and duration, a summary line (passed or failed, iterations, requests and rate), the thresholds as
✓ p95<300ms (212ms)or✗ p95<300ms (412ms), a latency table per file plus anoverallrow, the error samples and the warnings. The HTML page adds two inline SVG charts, latency over time (p50, p95, p99) and requests per second; it needs no script and works offline. - JUnit XML: one
<testsuite>namedbenchwith one<testcase>per threshold, a breached one being a<failure>of typethreshold, plus an<error>test case when the run was aborted. - SARIF: one
errorresult per breached threshold (rulebench-threshold), without a location.
report diff does not compare bench reports (exit 2).
Stress reports
A kind: stress report (rustman stress) has its id, the target, the environment, the mode, the profile (the mode’s settings, fuzz_ratio, malformed and wire families and the health request), the seed, the slos, the overall and per-file statistics of valid traffic, the fuzzed statistics apart, the per-second series, the steps (offered and achieved rate, p50/p95/p99, error rate and classes, verdict and failure mode), breakpoint (max_sustainable_rps, breaking_rps, failure_mode, first_failing_endpoint, why the search stopped and max_rps), rate_limited_at, killed, recovery (status, the time to recover, the baseline, the last answer and the timeline of health requests), the spike, soak and wire results, and the findings in the exploration format, each with its family and, for a crash-like finding, its minimized input (redacted) or load_dependent. A finding’s evidence is the exchange as it happened: request_body is the body sent (not the minimized one), status and body the response’s status and the start of its body; without a response, status is 0 and body says what happened instead.
- Markdown and HTML: the run, the breakpoint, the recovery, the step table, latency per file and the findings with their minimized inputs. The HTML page adds inline SVG charts of latency and errors against offered load, with the breakpoint marked, and the recovery timeline; it works offline.
- JUnit XML: one
<testsuite>namedstresswith one<testcase>per finding, a<failure>(of the rule’s type) at or abovehigh. - SARIF: one result per finding, located in its request file.
report diff compares two stress reports like explorations: findings match by rule and operation (the request file), so a no-recovery only in the later report is new and exits 1. A reader from before kind: stress refuses such a report with unknown report kind 'stress' (exit 2) without crashing.
Comparing reports
rustman report diff <OLD> <NEW> [--fail-on <severity>] [--format markdown|json]
compares two reports of the same kind:
- Findings match by rule id and operation, and are listed as
new(only in the new report),fixed(only in the old one) orunchanged. - For explorations, the coverage of operations and of documented statuses, old and new, with the change in percentage points.
- For runs, every assertion whose outcome changed (
pass,fail,error, orabsentwhen only one run has it), per request.
It exits 1 when a new finding is at or above --fail-on (default high), and 0 otherwise; two reports of different kinds, or an unknown schema version, exit 2.
$ rustman report diff main.json branch.json
# Report diff (exploration)
1 new, 1 fixed, 2 unchanged findings.
## New
| Severity | Rule | Operation | ID |
|---|---|---|---|
| critical | `broken-object-level-authorization` | `GET /orders/{id}` | f009 |
...
Redaction
No format contains the value of a secret, of a header named Authorization, Proxy-Authorization, Cookie, Set-Cookie or X-Api-Key, or of an auth scheme’s credential: they appear as «redacted:<name>», as in Authorization: Bearer «redacted:bearerAuth_token». Redaction happens when the report is built, from exchanges the engine already redacted, so re-rendering a report can never recover a value. Curl reproductions keep secrets as {{name}} references.
CI recipes
GitHub code scanning
Upload the SARIF rendering so findings show up as code-scanning alerts on the OpenAPI document:
jobs:
explore:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@v4
- name: Explore the staging API
run: |
rustman explore run --spec api.yaml --target "$STAGING_URL" --env staging \
--report sarif=out/explore.sarif --report junit=out/explore.xml --report markdown=out/explore.md
continue-on-error: true
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: out/explore.sarif
category: rustman-explore
- name: Job summary
run: cat out/explore.md >> "$GITHUB_STEP_SUMMARY"
Run the exploration from the repository root so the SARIF location is the document’s path in the repository.
Test results
Any CI that reads JUnit XML (GitHub test reporters, GitLab artifacts:reports:junit, Jenkins, Azure Pipelines) shows one test case per request of a run, or per operation of an exploration:
test:
script:
- rustman run api --env ci --reporter pretty --report junit=out/junit.xml
artifacts:
when: always
reports:
junit: out/junit.xml
Failing only on regressions
Keep the report of the main branch and fail a pull request only on the findings it introduces:
rustman explore run --spec api.yaml --target "$PREVIEW_URL" --report json=out/branch.json || true
rustman report diff baseline/main.json out/branch.json --fail-on high --format markdown
For developers
rustman-report holds the canonical Report (run or exploration), the only input of every renderer:
explorationandrunare the report data types;rustman-explorebuilds anExplorationReport, andRunReport::newconverts a run’s records.Report::parsereads any supported version;report_schemacomposes the published JSON Schema.render::renderrenders oneRenderFormat, andReportTargetis one--reportvalue. JUnit usesquick-junit, SARIF is a small typedserdemodel, and Markdown and HTML areminijinjatemplates with the stylesheet and script built in viainclude_str!.diff::diffcompares two reports.
Regenerate the published schema after changing the exploration types with RUSTMAN_UPDATE_SCHEMA=1 cargo test -p rustman-report --test render, and review format snapshots with cargo insta review.
OpenAPI exploration
Given an OpenAPI 3.0 or 3.1 document and a target, Rustman investigates the backend on its own: it discovers which operations produce the values other operations need, plans probes for conformance, robustness and security, sends them under the safety policy, and reports what it finds.
An exploration runs four phases in order: discover (the resource graph), plan (the probes), execute (sending them) and report. rustman explore plan stops after planning and sends nothing; rustman explore run goes all the way. This page covers both, dependency discovery, the probe families, the finding rules and their severities, reproducing findings, interrupting and resuming, and the [explore] table. The report formats (JSON, JUnit, SARIF, Markdown, HTML), rustman report render and report diff are described in Reports.
Planning: rustman explore plan
rustman explore plan discovers the resource graph and plans every probe, and sends nothing to the target. It prints each planned probe with its family, operation, method, expected outcome, and whether it is allowed, blocked by the safety policy (and why) or skipped (and why):
$ rustman explore plan --spec api.yaml --target https://staging.example.com --seed 1234 \
--probes conformance,auth,lifecycle --operations '*User*'
plan: 6 probes (2 allowed, 4 blocked, 0 skipped), seed 1234
ID FAMILY OPERATION METHOD EXPECTED STATUS
p0001 conformance GET /users GET documented status and schema allowed
p0002 conformance POST /users POST documented status and schema blocked: mutations not allowed
p0003 conformance GET /users/{id} GET documented status and schema allowed
p0004 conformance PUT /users/{id} PUT documented status and schema blocked: mutations not allowed
p0005 conformance DELETE /users/{id} DELETE documented status and schema blocked: destructive not allowed
p0006 lifecycle GET /users/{id} GET update reflected, 404 or 410 after delete blocked: mutations not allowed
| Flag | Meaning |
|---|---|
--spec <file|url> | The OpenAPI document (read like rustman import openapi reads it; --allow-remote-refs too) |
--target <url> | The base URL probes are sent to; its origin is the only one allowed |
--probes <list> | Comma-separated families (default: all but bola) |
--operations <glob> | Only operations whose operationId, path or METHOD /path matches (* and ?; repeatable) |
--seed <u64> | The seed of the fuzz cases; random when left out, and always printed |
--fuzz-cases <n> | At most this many fuzz cases per operation (default 50) |
--allow-mutations, --allow-destructive, --allow-host, --production | The safety flags |
--identity-b <env> | The environment of a second identity, for bola probes |
--env, --workspace | The active environment and the workspace (a workspace is optional for plan) |
--graph | Also print the resource graph |
--json | Print the plan as JSON: seed, probes (each with its steps) and scans, plus graph with --graph |
The plan is a pure function of the document, the graph, the seed and the settings: the same seed gives the identical plan. Probes refused by the safety policy are listed as blocked: <reason>, never dropped. A plan against a production target is refused with exit code 4 unless --production repeats its host, as for any governed sender.
Probe requests are templates: a path parameter whose value is in the active environment is sent as {{name}}, and values captured from earlier steps the same way. Plans never contain variable values, so secrets can’t leak into them.
Running: rustman explore run
rustman explore run takes every flag of explore plan (but --graph and --json), plus the budgets and the failure threshold:
| Flag | Meaning |
|---|---|
--rate <n> | Requests per second at the start (default: [safety].rate, 10); halved on 429 |
--concurrency <n> | Probes in flight at once (default: [safety].concurrency, 4) |
--max-probes <n> | Probe budget: at most this many requests (default 2000) |
--max-duration <duration> | Time budget: 90s, 15m, or milliseconds (default 15m) |
--fail-on <severity> | Exit 1 when a finding is at or above it: critical, high (default), medium, low or info |
--viz | Show the exploration live in the viz companion: probes, findings and coverage as they come. Without one it continues without visuals, with the same exit code. Also on explore resume. |
$ rustman explore run --spec api.yaml --target https://staging.example.com --env staging --allow-mutations
discover: 9 operations, 7 producer edges, 1 unresolved parameters
plan: 112 probes (104 allowed, 6 blocked, 2 skipped), seed 8327461120938471
exploration exp-20261118-3fa9c1 started (41 ms to discover and plan)
execute: 37/112 probes, 4 findings, 1.0s
execute: 112/112 probes, 9 findings, 3.2s
exploration exp-20261118-3fa9c1 completed (seed 8327461120938471)
probes: 112 (71 passed, 31 finding, 6 blocked, 2 skipped, 0 not run, 2 failed)
findings: 1 critical, 2 high, 4 medium, 1 low, 1 info
f001 critical auth-not-enforced GET /admin/users (1x)
f002 high server-error-on-invalid-input POST /users (12x)
...
coverage: operations 8/9 (88.9%), statuses 11/17 (64.7%)
left behind: 3 resources
https://staging.example.com/users/41
https://staging.example.com/users/42
https://staging.example.com/users/43
report: .rustman/explorations/exp-20261118-3fa9c1/report.json
Phases and progress go to stderr (at most one progress line a second); the summary goes to stdout, or to stderr when a --report writes to stdout. --report <format>[=<path>] (repeatable) also renders the finished report as json, junit, markdown, html or sarif, as in --report html=out/r.html --report sarif=out/r.sarif; see Reports.
Probes run under the safety policy: read-only by default, --allow-mutations for POST, PUT and PATCH, --allow-destructive for DELETE, the target’s origin only (plus --allow-host and [safety].allowed_hosts), and the production guard: against a production target the run is refused with exit code 4 unless --production <host> repeats the target host, and --allow-destructive is never allowed there. Probes the policy refuses are reported as blocked: <reason>, and probes left when a budget runs out as not run: budget.
The exploration directory
Each exploration gets an id, exp-<YYYYMMDD>-<6 hex digits>, and a directory in the workspace (or, outside one, in the current directory):
.rustman/explorations/exp-20261118-3fa9c1/
state.json the phase, progress, settings, document hash and resource graph
plan.json the planned probes
journal.ndjson one line per finished probe and per cleanup, synced as written
report.json the report, once every probe has run
.rustman/ is ignored by Git (rustman init adds it to .gitignore). Every value in these files is redacted as it is written.
Cleanup and resources left behind
A step that creates a resource (a POST answering 2xx) is identified by the id in its response: the field the resource graph gives for the path parameter of <path>/{param} (/users/{id} for POST /users). Each one is recorded in the journal with its URL. A lifecycle chain’s own DELETE removes it from the list.
When the probes are done, or after an interrupt, the resources still there are deleted newest first with their documented DELETE operation, if --allow-destructive was given. These deletes go through the safety policy and the rate limit like probes, but the probe and time budgets neither count nor stop them, so the cleanup still runs when a budget ran out. Otherwise (and when a delete fails) they are listed in the report under left_behind and in the summary as left behind.
Status
rustman explore status [<id>] shows an exploration, the most recent one by default, while it runs or after it ended:
$ rustman explore status exp-20261118-3fa9c1
exploration exp-20261118-3fa9c1 (running)
phase: execute
probes: 37/112 done
findings: 1 critical, 1 high, 2 medium, 0 low, 0 info
elapsed: 1.4s
target: https://staging.example.com
started: 2026-11-18T10:02:11.482Z
The state is running, interrupted or completed. --json prints the same fields as JSON (id, state, phase, done, total, findings, elapsed_ms, target, started_at, updated_at and, once written, report).
Interrupting and resuming
On Ctrl+C, explore run stops dispatching probes, waits up to 10 seconds for the probes in flight, runs the cleanup (as above), saves its state and exits with code 130. A second Ctrl+C quits at once. A probe still in flight after the 10 seconds is reported as not run: interrupted and runs again on resume; the resources it had already created are journaled, so the cleanup deletes them (or lists them as left behind).
rustman explore resume <id> continues it: it re-reads the document and refuses (exit code 2) if its SHA-256 changed since the exploration started, then runs only the probes the journal does not hold, with the same plan, seed, safety flags and budgets (minus what earlier runs used), and writes the report over all of them. A lifecycle chain is one probe, so a chain cut short runs again from its start. The environment is the one the exploration started with.
Findings and the report
Findings on the same rule and operation are reported once, with the number of occurrences, the probes they came from, and the first occurrence’s message and redacted evidence (the request, the response status and headers, and the first 4 KiB of the body). They are numbered f001, f002, … from the most severe.
report.json is a rustman.report/v1 document with "kind": "exploration". Besides id, started_at, finished_at, environment, target, spec, document_sha256 and the seed, it holds:
| Field | Content |
|---|---|
settings | The probe selection, the safety flags and the budgets |
summary.probes | Probe totals by outcome: passed, finding, blocked, skipped, not_run, failed (a request error or a chain that stopped early), and total |
summary.findings | Distinct findings by severity |
coverage | operations exercised and documented statuses observed (covered, total, percent), and the matrix: each operation’s documented statuses marked observed, not-observed or blocked (nothing was sent for the operation because its probes were blocked); an evm probe cell also has a class (supported, unsupported, restricted, error or skipped (budget)) |
findings | The findings, as above, each with its remediation and reproduction |
probes | Every probe with its outcome and, unless it passed, the reason (blocked: ..., skipped: no producer, not run: budget, not run: interrupted, or why it failed) |
left_behind | Created resources that were not deleted |
cleanup | Each delete of a created resource and the status it got |
operations | The documented operations in document order, with their operation_id and tags (JUnit groups by the first tag) |
dependencies | The data dependencies discovery found: each producer operation whose response provides a parameter of a consumer operation, and the JSON pointer it is read from (the API graph draws them). Absent when there are none. |
Reproducing findings
Every finding carries a reproduction: its evidence request as a curl command, with secrets left as {{name}} references, and a request file that sends it to {{baseUrl}} and asserts what a correct API answers. rustman explore export <id> --findings <ids|all> --into <dir> writes those request files, one per finding (f001-auth-not-enforced-get-admin-users.rman.yaml):
version: 1
kind: http
name: 'auth-not-enforced: GET /admin/users'
method: GET
url: '{{baseUrl}}/admin/users'
auth:
type: none
assertions:
- status:
- 401
- 403
Run them as a regression suite with the environment of an imported collection, or --var baseUrl=<url>: rustman run regressions/ --env staging. They fail while the bug is there and pass once it is fixed. The assertion per rule:
| Rule | Assertion |
|---|---|
auth-not-enforced, unexpected-auth-status | status: [401, 403] |
broken-object-level-authorization | status: [401, 403, 404] |
server-error-on-invalid-input, invalid-input-accepted | status: 4xx |
undocumented-method-allowed | status: [404, 405] |
resource-survives-delete | status: [404, 410] |
server-error, undocumented-status | the documented status codes |
response-schema-violation | the status, and the body against the documented schema |
update-not-reflected | each updated field equals its new value |
error-leakage | the body no longer contains the leaked excerpt |
missing-hsts | Strict-Transport-Security is present |
missing-content-type-options | X-Content-Type-Options equals nosniff |
permissive-cors | Access-Control-Allow-Credentials is absent |
A finding from a chain (lifecycle, BOLA) exports its last request with the ids it captured, so it only reproduces while those resources exist.
Exit codes
explore run and explore resume exit with:
| Code | Meaning |
|---|---|
| 0 | No finding at or above --fail-on |
| 1 | At least one finding at or above --fail-on (default high) |
| 2 | Invalid input or configuration: a bad flag, an unreadable or invalid document, an unknown exploration, a changed document on resume |
| 4 | Refused by the safety policy (the production guard) before anything was sent |
| 130 | Interrupted by Ctrl+C |
Dependency discovery
Many operations need a real id: GET /users/{id} is only meaningful with the id of a user that exists. Discovery finds, for each path parameter, the operations that produce its value, best first:
- Overrides from
[explore.producers]inrustman.toml. - OpenAPI links: a success response’s
linksnaming the operation (byoperationIdoroperationRef) with a$response.body#/<pointer>value for the parameter. - The heuristic: an operation under a prefix of the consumer’s path whose success response has a field named like the parameter, or
idwhen the parameter isidor<resource>Id(orderIdfor/orders). POSTs come first, then the longest prefix. A list response (an array of objects) produces its first item’s field.
--graph prints one line per edge, consumer: parameter <- producer pointer (source), then the parameters nothing produces:
GET /users/{id}: id <- POST /users /id (heuristic)
GET /users/{id}: id <- GET /users /0/id (heuristic)
GET /orders/{orderId}: orderId <- POST /orders /id (heuristic)
GET /reports/{reportId}: reportId <- no producer
A probe that needs a real value runs its producer first, as a setup step, and passes the captured value on. The first producer the safety policy allows is used, so a read-only plan reads ids from a list operation when there is one. Probes that need a parameter with no producer and no value in the active environment are planned as skipped: no producer.
When the heuristic gets it wrong, pin the producer per parameter name, as an operationId or METHOD /path, optionally with a JSON pointer into its response body after #:
[explore.producers]
orderId = "createOrder#/id"
slug = "POST /teams#/handle"
Probe families
| Family | What it sends | Expected |
|---|---|---|
conformance | One valid request per operation | A documented status, and a body that matches its schema |
auth | For operations that require credentials: no credentials, then a well-formed invalid one | 401 or 403 |
negative-input | Requests that omit required fields or parameters, use wrong types, or break bounds, length, pattern, enum or item counts (each variant is checked to be invalid against its schema; at most 20 per operation) | 4xx |
method-not-allowed | One undocumented method per documented path (from GET/HEAD/OPTIONS when read-only) | 405 or 404 |
lifecycle | create, read, update, read, delete, read along the graph, passing the created id; steps the policy refuses after the create are left out | The update is reflected; 404 or 410 after the delete |
bola | Off by default. Identity A reads a resource, then identity B (--identity-b) reads it by id; skipped without a second identity | B is refused |
fuzz | Seeded cases per operation with a JSON body or query parameters, alternating schema-shaped values and values on the bounds (minimum/maximum, shortest/longest) | No 5xx; a documented status and schema |
undocumented-status | Nothing of its own: checks every response | A documented status |
error-leakage | Nothing of its own: scans every response body (first 64 KiB) | No stack traces, SQL errors, debug pages or internal paths |
security-headers | Nothing of its own: checks every response | X-Content-Type-Options: nosniff; HSTS over HTTPS; no * CORS with credentials |
Fuzz values come from proptest strategies built from each schema (types, formats, bounds, pattern, enum, required properties) and a ChaCha generator seeded from --seed and the operation, so a seed reproduces every case.
Finding rules
Every finding has a stable rule id and a default severity:
| Rule | Severity | Raised when |
|---|---|---|
auth-not-enforced | critical | A request without valid credentials got 2xx |
broken-object-level-authorization | critical | Identity B read identity A’s resource |
server-error-on-invalid-input | high | Invalid input got 5xx |
server-error | high | A valid request got an undocumented 5xx |
response-schema-violation | medium | A body breaks the schema of its status and media type (the first violation, with its instance and schema pointers) |
invalid-input-accepted | medium | Invalid input got 2xx |
undocumented-method-allowed | medium | An undocumented method got 2xx |
error-leakage | medium | A body reveals internals (with the matched excerpt) |
update-not-reflected | medium | A read after an update shows other values |
resource-survives-delete | medium | A read after a delete did not get 404 or 410 |
unexpected-auth-status | low | A request without valid credentials was refused with neither 401 nor 403 |
missing-hsts | low | An HTTPS response has no Strict-Transport-Security |
missing-content-type-options | low | A response has no X-Content-Type-Options: nosniff |
permissive-cors | low | Access-Control-Allow-Origin: * with Access-Control-Allow-Credentials: true |
undocumented-status | info | A status is not documented for its operation |
Findings carry the redacted evidence exchange: the request (URL, headers, body), the response status and headers, and the first 4 KiB of the body. Secret values and sensitive headers are replaced as everywhere else (see Environments). Every secret of both identities (--env and --identity-b) is redacted from all evidence, including responses to requests that did not send it, such as a no-credentials auth probe. A credential kept in a plain environment variable instead of a secret (a bearerAuth_token under variables:) is redacted the same way, the request headers of the evidence include those the auth adds (Authorization: Bearer «redacted:bearerAuth_token»), and the curl reproduction keeps every credential as its {{name}} reference, whatever its source. X-Api-Key and the header of an apiKey scheme are treated like Authorization. A finding is filed under the operation of the step whose response it is about: what a setup step (such as the GET /users that finds an id for GET /users/{id}) answered counts for that step’s operation.
Rules can be turned off per workspace:
[explore]
disabled_rules = ["missing-content-type-options"]
For developers
Exploration lives in rustman-explore (rustman_explore::explore), a library the CLI only wires up, and that other automated senders (the mock server, stress tests) build on:
graph::Graph::build(&model, &producers)discovers the graph.plan::plan(&model, &graph, &PlanOptions)returns thePlan, aVec<Probe>of steps.exec::Executorruns one probe at a time through arustman_http::GovernedSender, the only sender it can hold, and returns itsOutcome: what was sent, the findings (with their reproduction) and the resources created or deleted.runner::executeruns the probes a journal does not hold,concurrencyat a time, journals each outcome (journal::Journal), stops on aCancellationTokenafter draining, and cleans up.session::Sessionis the exploration directory andstate.json;drive::driveruns the execute and report phases on it, andreport::buildturns a plan and a journal into theExplorationReport.detectholds the detectors,rules::RULESthe registry,reprothe reproductions andexportthe regression files.
The bad-api server in rustman-test-support (rustman_test_support::bad_api) is a deliberately broken API with its document, used by the exploration tests; BadApi::start_fixed() serves it with every bug fixed.
Safety policy
Rustman can send requests on its own: OpenAPI exploration sends probes, and later the agent interface, load tests, monitors and plugins send requests nobody typed. Every such request goes through one safety policy first. It decides, for each request and for every redirect hop, whether the request may leave the machine. The policy is safe by default: read-only, the target’s origin only, and never destructive against production.
Requests you send yourself with rustman send and rustman run are not governed by this policy.
The policy, the rate limit and the budgets are defined in rustman-core (rustman_core::safety); the sender that enforces them over HTTP is rustman_http::GovernedSender (see For developers). The [safety] example below is checked by a test (crates/rustman-core/tests/docs_safety.rs). The command-line flags named on this page belong to the commands that use the policy: rustman explore plan, explore run and explore resume.
Methods
| Method | Allowed with |
|---|---|
GET, HEAD, OPTIONS | always |
POST, PUT, PATCH | --allow-mutations |
DELETE | --allow-destructive (which implies --allow-mutations) |
| any other method | --allow-destructive |
Methods are case-sensitive, as in HTTP. A method Rustman can’t classify, such as TRACE, PURGE or a lowercase get, is treated as destructive, because what it does can’t be assumed.
A request that isn’t sent is recorded, never silently dropped, with one of these reasons:
| Reason | Meaning |
|---|---|
blocked: mutations not allowed | POST, PUT or PATCH without --allow-mutations |
blocked: destructive not allowed | DELETE (or an unclassified method) without --allow-destructive |
blocked: host not allowed | the URL’s origin isn’t allowed, or it isn’t an http/https URL |
blocked: production host not confirmed | an allowed origin whose host is listed in production_hosts, but --production didn’t name it |
Origins
An origin is a scheme, host and port: https://api.example.com is https://api.example.com:443, and differs from http://api.example.com and from https://api.example.com:8443. Hosts compare ignoring case and a trailing dot: https://api.example.com./ has the same origin as https://api.example.com/, so the fully qualified spelling of a host gets past neither the allowlist nor the production guard.
The target’s origin is always allowed. Every other origin is refused with blocked: host not allowed, including redirect targets and URLs built from response data, unless it is listed in [safety].allowed_hosts or given with --allow-host <origin>. Redirects are followed by hand so that each hop is checked before it is requested.
Allowed origins are written as scheme://host[:port]. A bare host, a path, a query or credentials are rejected so an entry can’t look narrower than it is:
rustman.toml:6: invalid origin 'auth.example.com': expected scheme://host[:port], such as https://api.example.com
Production guard
A target is production when any of these holds:
- its environment file sets
production: true(see Environments); - its environment is named
prodorproduction(ignoring case); - its host matches an entry of
[safety].production_hosts.
Against production, the command is refused (exit code 4) and nothing is sent, unless --production <host> repeats the exact target host:
error: refusing to send requests to production host 'api.example.com' (environment 'production' is a production name); repeat the host with --production api.example.com to allow non-destructive requests
With --production api.example.com, read-only requests (and mutations, with --allow-mutations) are sent. --allow-destructive is always refused against production, with no override:
error: refusing --allow-destructive against production host 'api.example.com' (environment 'production' is a production name): destructive requests are never sent to production
--production naming any other host is refused too (--production 'example.com' does not match the target host 'api.example.com'). Repeating the host, rather than passing a yes/no flag, is deliberate: the confirmation doesn’t carry over to another target when a command is copied from shell history or a script. An IPv6 host may be given with or without brackets.
An allowed origin whose host matches production_hosts is refused per request (blocked: production host not confirmed) unless it is the confirmed target host, so an allowlist entry can’t open a path to production.
Rate, concurrency and budgets
Governed requests are paced and capped:
| Limit | Default | Flag | Meaning |
|---|---|---|---|
| Rate | 10 requests/second | --rate | Requests are spaced evenly (100 ms apart at 10/s), with no bursts. Every redirect hop counts as a request. |
| Concurrency | 4 | --concurrency | Probes in flight at once. A probe holds one slot across its redirect hops. |
| Probe budget | 2000 probes | --max-probes | A probe is one request and the redirects it follows. |
| Time budget | 15 minutes | --max-duration | Counted from the start of execution (after discovery and planning). A request’s timeout is cut to the time left. |
rate and concurrency can also be set in [safety]. When a budget is reached, nothing more is sent, and every probe left is recorded as not run: budget. A blocked probe isn’t sent, so it doesn’t count against the probe budget.
Backing off on 429
A 429 Too Many Requests response halves the rate, down to at least 1 request per second, for the rest of the session, and nothing is sent until its Retry-After has passed. Retry-After may be a number of seconds or an HTTP date. With the default rate, 429 with Retry-After: 5 means no request for 5 seconds, then 5 requests per second. Several 429s for requests sent at the same rate (for example, the 4 requests in flight at once) halve it only once. A Retry-After that ends after the time budget (however large the value) stops execution at once, and the probes left are recorded as not run: budget.
For developers
Front-ends and features that send requests on their own hold only a GovernedSender and never an HttpEngine, so there is no path around the policy:
#![allow(unused)]
fn main() {
let policy = SafetyPolicy::new(&settings.safety, options)?; // refusals exit with code 4
let governor = Governor::new(Limits::from_settings(&settings.safety));
let sender = GovernedSender::new(policy, governor);
match sender.send(&request, &send_options).await {
Ok(exchange) => { /* record the exchange */ }
Err(GovernedError::Blocked { reason, url }) => { /* "blocked: host not allowed" */ }
Err(GovernedError::NotRun(_)) => { /* "not run: budget": stop dispatching */ }
Err(GovernedError::Request(error)) => { /* network error, timeout, ... */ }
}
}
GovernedSender::send checks the request against the policy, admits it against the budgets and the concurrency limit, waits for the rate limit, and sends it. Each redirect hop is checked and paced again before it is sent; a blocked hop ends the probe with GovernedError::Blocked and is never requested. Errors are redacted like the engine’s. Create the Governor when execution starts, after discovery and planning: the time budget counts from its creation. Requests with auth: {type: oauth2} aren’t supported yet: the sender acquires no token, so they fail with oauth2: no access token was acquired before anything is sent or counted. Waiting for a concurrency slot is unbounded, so an executor should bound the probes it dispatches at once rather than spawn a task per probe for a whole plan.
The rate limit and budgets (Governor) live in rustman-core and do no I/O, so other governed senders (load tests, monitors, agents) can reuse them for non-HTTP transports.
rustman bench uses this policy with the allowlist pinned to its --target origin ([safety].allowed_hosts is ignored), and a Governor built from the [bench] caps instead of [safety] rate and concurrency.
[safety] in rustman.toml
Every key is optional:
# rustman.toml
[workspace]
name = "shop"
version = 1
[safety]
allowed_hosts = ["https://auth.example.com", "http://127.0.0.1:9000"]
production_hosts = ["api.example.com", "*.prod.example.com"]
rate = 10 # requests per second
concurrency = 4 # probes in flight at once
| Key | Default | Meaning |
|---|---|---|
allowed_hosts | [] | Origins allowed in addition to the target’s own; --allow-host adds more. |
production_hosts | [] | Hosts always treated as production. api.example.com matches that host exactly; *.example.com matches every subdomain of example.com, but not example.com itself. Ports and schemes aren’t part of an entry. Entries and hosts compare the way URLs normalize them: ignoring case and a trailing dot (api.example.com. is api.example.com), with internationalized names as punycode (bücher.example is xn--bcher-kva.example). An IP address is an exact entry; an IPv6 address may be written with or without brackets. Matching is by name only, without DNS: api.example.com doesn’t match the same server reached by its IP address or through a CNAME alias, so list those too, or mark the environment production: true. |
rate | 10 | Requests per second for governed senders; at least 1. --rate overrides it. |
concurrency | 4 | Probes in flight at once (a probe and its redirect hops hold one slot); at least 1. --concurrency overrides it. |
Unlike other tables, an unknown key in [safety] is an error rather than a warning, so a misspelling such as production_host can’t silently turn the production guard off. Invalid values fail with their line, for example rustman.toml:8: invalid value: integer `0`, expected a nonzero u32 for rate = 0 in the example above.
Contract testing
rustman contract checks that an API keeps its promises to its clients, in three ways:
rustman contract diffcompares two versions of an OpenAPI document, decides which differences fail the build, accepts known ones in an allowlist and reads the old version from Git. The rules it classifies with are listed in the contract rule catalog.rustman contract pact generateandrustman contract pact verifywrite Pact contracts from a collection (the consumer side) and replay them against a provider (the provider side).rustman contract verifychecks recorded traffic (history or a run report) against an OpenAPI document, without sending any request.
Every command writes the same kind of report (kind: contract), and every output goes through the active environment’s redaction.
Comparing two documents
rustman contract diff <OLD> <NEW> [--fail-on-unknown] [--fail-on <breaking|unknown|non-breaking>]
[--allowlist <FILE>] [--report <FORMAT>[=<PATH>]]... [--env <NAME>] [--workspace <DIR>]
rustman contract diff --base <GIT-REF> <PATH> [same options]
OLD and NEW are files or http(s) URLs, loaded and validated as OpenAPI import does. An invalid document prints the import diagnostics and exits 2. Every difference is printed with its classification, rule id, operation, a message and a JSON pointer into each document, followed by the counts:
breaking operation-removed DELETE /users/{id}: operation removed
old: /paths/~1users~1{id}/delete
new: /paths
non-breaking operation-added GET /health: operation added
old: /paths
new: /paths/~1health/get
1 breaking, 1 non-breaking, 0 unknown (rule catalog version 2)
Exit codes and strictness
| Exit code | When |
|---|---|
0 | No difference fails the diff |
1 | At least one difference fails it: by default, any breaking difference the allowlist does not accept |
2 | An invalid document or allowlist, an unknown flag value, or a --base ref or path that cannot be read |
unknown differences (such as composition-changed) do not fail the diff unless --fail-on-unknown (or --fail-on unknown) is given. --fail-on non-breaking makes every difference fail, for frozen APIs. Allowlisted differences never fail.
The allowlist
contracts/allowlist.yaml, in the workspace (or in the current folder outside a workspace), lists the differences a team has accepted; --allowlist <FILE> reads another file instead. Like Pact files and run reports, an allowlist larger than 20 MiB is refused (exit 2). Each entry names a rule and an operation (METHOD /path, as the diff prints it), optionally a pointer (into either document) to accept one element only, and needs a non-empty justification. expires (YYYY-MM-DD) ends the acceptance after that day.
- rule: operation-removed
operation: "DELETE /users/{id}"
justification: Deprecated since 2026-06, no traffic
expires: 2026-12-31
- rule: response-enum-widened
operation: GET /pets
pointer: /components/schemas/Pet/properties/status
justification: Every client maps unknown statuses to "other"
An accepted difference is still reported, as breaking (allowed), with its justification. The file is checked before the documents are compared; every invalid entry is reported with its line and exits 2:
error: contracts/allowlist.yaml:4: justification is required
Unknown rule ids, a missing operation, an expires that is not a date and unknown keys are errors too. Two situations only warn, on stderr, and leave the exit code alone:
warning: contracts/allowlist.yaml:1: allowlist entry expired on 2026-01-01: the entry allows nothing, so the difference it matched fails again.warning: contracts/allowlist.yaml:5: unused allowlist entry (operation-removed DELETE /users/{id}): nothing matched it, and it can be removed.
Comparing with a Git ref
rustman contract diff --base origin/main openapi.yaml
reads the old document from origin/main:openapi.yaml in the repository that contains the current folder, and the new one from the working tree. Relative $ref files are read at the same ref, so a schema moved to another file is compared as it was. Paths are relative to the current folder. Rustman runs git show <ref>:<path>, so git must be on the PATH.
A path that does not exist at the ref exits 2 with openapi.yaml not found at origin/main (a document added on the branch has nothing to compare with). A ref that does not exist exits 2 too; in a shallow CI clone, fetch it first:
git fetch origin main --depth=1
rustman contract diff --base origin/main openapi.yaml --report markdown=out/contract.md
Reports
--report <format>[=<path>] (repeatable) writes the diff as a rustman.report/v1 report with kind: contract and mode: diff (see Reports), as json, markdown, junit, sarif or html. A report without a path goes to stdout, and the human summary then goes to stderr. The Markdown report suits a pull request comment: a summary line with the counts per classification, then a table per classification, breaking differences first, each with its rule id, operation, message and pointer.
In a GitHub Actions pull request workflow
The diff needs the base branch in the clone: check out with fetch-depth: 0 (or fetch the base branch), then compare the document with the base. The Markdown report suits a pull request comment, and the SARIF report shows each difference on the changed line of the pull request.
# .github/workflows/contract.yml
name: API contract
on: pull_request
permissions:
contents: read
security-events: write
jobs:
contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install rustman
run: cargo install --git https://github.com/CyberdyneCorp/rustman rustman-cli --locked
- name: Breaking changes
run: rustman contract diff --base origin/${{ github.base_ref }} openapi.yaml --report markdown=out/contract.md --report sarif=out/contract.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: out/contract.sarif
The step fails (exit 1) on a breaking difference that contracts/allowlist.yaml does not accept; out/contract.md can be posted as a comment by a later step.
Pact contracts
Generating a Pact file (consumer side)
rustman contract pact generate [<COLLECTION>...] --consumer <NAME> --provider <NAME>
[--pact-version <3|4>] [--output <FILE>] [--env <NAME>] [--workspace <DIR>]
writes one Pact file for the consumer and provider pair, by default contracts/pacts/<consumer>-<provider>.json in the workspace (meant to be committed, or published with the pact-broker CLI). COLLECTION names folders or request files (the whole workspace by default); every http request in them becomes one interaction, named after the request. Requests of other kinds are skipped with a warning.
The request comes from the request file with its variables resolved in the active environment (an unresolved variable stops generation with exit 2). A secret is never written: its place holds «redacted:<name>», and the value gets a regex matcher, so Authorization: Bearer {{token}} becomes the example Bearer «redacted:token» with the matcher ^Bearer .+$. Dynamic values ({{$uuid}}, {{$timestamp}}, …) are written as «dynamic:$uuid» with a matcher the same way, so a file generated twice is the same file.
The expected response comes from the assertions:
| Assertion | Pact |
|---|---|
status: 200 | response status 200 |
status: 2xx | v4: a statusCode matcher (success); v3: the status last recorded in history for the request, else 200 with a warning |
status: [200, 201] | v4: a statusCode matcher with the codes; v3: the first code |
header: {name, equals} / {matches} / {contains} | the header with an equality / regex / include matcher |
json: {path, equals} | the value at the path, with an equality matcher |
json: {path, type} | an example of the type, with a type matcher (integer for integers) |
json: {path, matches} / {contains} | a regex / include matcher |
json: {path, length} | an empty example array, with a type matcher whose min and max are the length (see Interop) |
A Pact regex matcher must match the whole value, while a Rustman matches finds the pattern anywhere, so a pattern that is not anchored at both ends is written as [\s\S]*(?:<pattern>)[\s\S]* (matches: "^A" becomes [\s\S]*(?:^A)[\s\S]*); ^\d+$ is kept as it is.
Other assertions (latency, schema, body, the json comparisons, filter or recursive JSON paths) have no faithful Pact equivalent; each is left out with a warning that names it and the request file, and the interaction is still written:
warning: latency assertion has no Pact equivalent (users/get-user.rman.yaml)
Files follow the Pact Specification v4 by default (metadata.pactSpecification.version is 4.0); --pact-version 3 writes v3 (3.0.0).
Verifying a provider
rustman contract pact verify <PACT_FILE>... --provider-url <URL> [--provider-states-url <URL>]
[--allow-mutations] [--allow-destructive] [--production <HOST>]
[--report <FORMAT>[=<PATH>]]... [--env <NAME>] [--workspace <DIR>]
replays every interaction against the provider and compares the status, the expected headers and the body under the interaction’s matching rules (type, regex, equality, include, integer, decimal, number, min/max, eachLike, statusCode). A regex must match the whole value, as in Pact ([a-z]+ does not match ab-1). An interaction whose request path does not start with / (such as @other-host/x, which would change the host once appended to the provider URL) fails with request path '...' does not start with '/' and nothing is sent for it. Every mismatch names the interaction and where it is, as a JSON path for the body:
failed get user (contracts/pacts/web-users.json)
$.id: expected number 42, got string "42"
0 passed, 1 failed, 0 blocked
An interaction with provider states needs --provider-states-url: before the interaction, each state is POSTed to it as {"consumer", "state", "params", "action": "setup"}, and after it with "action": "teardown". A non-2xx setup fails the interaction. Stateful interactions without the URL stop verification before anything is sent (provider states declared but --provider-states-url not set, exit 2).
Every request goes through the safety policy: only the provider URL’s and the state URL’s origins may be reached, and [safety] paces them. Interactions that send POST, PUT or PATCH need --allow-mutations, and DELETE needs --allow-destructive; without them the interaction is reported as blocked: mutations not allowed (or blocked: destructive not allowed) and nothing is sent. State calls are POSTs to the endpoint named for them, so they need no flag. A provider whose host is in [safety].production_hosts is refused (exit 4) unless --production <HOST> repeats that host. Requests are sent as the Pact file holds them: a secret header holds its «redacted:...» example, so a provider that checks credentials needs a provider state (or a verification environment) that accepts it.
A typical flow, with the provider running locally:
rustman contract pact generate users --consumer web --provider users --env dev
rustman contract pact verify contracts/pacts/web-users.json --provider-url http://localhost:8080 --provider-states-url http://localhost:8080/_pact/state
| Exit code | When |
|---|---|
0 | Every interaction passed |
1 | At least one interaction failed |
2 | An unreadable Pact file (or one over 20 MiB, the limit OpenAPI documents have too), stateful interactions without --provider-states-url, or an invalid URL |
4 | At least one interaction was blocked by the safety policy, or the provider is a production host (see Safety) |
The Pact files Rustman writes validate against the published Pact JSON schemas, and a CI job verifies them with the official verifier (pact_verifier_cli) too, expecting the same verdicts.
Interop with the official verifier
The pact-interop CI job generates a v3 and a v4 Pact file, verifies both with Rustman and with pact_verifier_cli 1.4.0 against the same fixture provider, and requires the same verdict for every interaction but one, which the implementations disagree on:
lengthon an array.json: {path: "$.tags", length: 2}is written as the example"tags": []with{"match": "type", "min": 2, "max": 2}. The example is empty because the assertion says nothing about the items, and any example item would constrain their type: thetypematcher cascades to the items. The specification’s matcher tables (v3 and v4,MinType/MaxType/MinMaxType) say that for a collection “the length of the actual value is compared against the minimum” and maximum, and Rustman does that, so"tags": []fails.pact_matching, whichpact_verifier_cliuses, applies no matcher to a list whose example is empty (compare_lists_with_matchingruleinpact_matching/src/matchingrules.rs), so it passes any array there, of any length. The same holds in v3 and v4. A provider verified with the official tools is therefore not held to alengthassertion; one verified with Rustman is.
Passive conformance
rustman contract verify --spec <OPENAPI> [--from <history|RUN_REPORT>] [--since <AGE>] [--grep <TEXT>] [--limit <N>]
[--fail-on-undocumented] [--report <FORMAT>[=<PATH>]]... [--env <NAME>] [--workspace <DIR>]
checks recorded exchanges against a document and opens no network connection. The document must be a local file: a URL is refused before anything is sent (download it first), and so are $refs to remote documents. The exchanges come from the workspace history (the ad-hoc history outside a workspace), filtered with --since, --grep and --limit as rustman history list does, or from a run report written by rustman run --report json=<path> (--from <path>). Each exchange is matched to an operation by method and path template, its request is checked against the operation’s parameters and body schema, and its response against the documented status and the JSON schema of its body:
violation GET /users/{id}: exchange 01JD3W6Q0Z5RKM8V9S4T2B7XNC (GET http://localhost:8080/users/7)
$.email: required property missing
undocumented GET /internal/debug: exchange 01JD3W6Q1C8D2F4G6H8J0K2M4P (GET http://localhost:8080/internal/debug)
observed operations:
GET /users/{id} 3 exchanges, 1 with violations
GET /users 2 exchanges, 0 with violations
2/12 operations observed; 1 violation, 1 undocumented, 4 conforms
An exchange that matches no operation is undocumented. The summary lists the documented operations the traffic exercised with their number of exchanges, and the coverage (5/12 operations observed); the report carries the same coverage, with violations per operation.
rustman run users --env dev --report json=out/run.json
rustman contract verify --spec openapi.yaml --since 7d --report markdown=out/conformance.md
rustman contract verify --spec openapi.yaml --from out/run.json --fail-on-undocumented
| Exit code | When |
|---|---|
0 | No violation (and, with --fail-on-undocumented, no undocumented exchange) |
1 | At least one violation, or an undocumented exchange with --fail-on-undocumented |
2 | An invalid document, an unreadable run report or a report of another kind |
Secrets
Documents can hold anything, such as an example with a real token, and a provider or a recorded response can echo a secret back. With a workspace and an active environment (--env, RUSTMAN_ENV or default_environment), every secret value of that environment is replaced with «redacted:<name>» in everything a contract command prints or writes: the diff, Pact files, verification mismatches, conformance evidence, the warnings and every report. Secrets used by a request are never written to a Pact file, whatever the environment (see Generating a Pact file).
Contract rule catalog
rustman contract diff compares two OpenAPI 3.0/3.1 documents and reports every difference with one of the rules below. rustman contract rules prints the same list (--json for a JSON array).
Catalog version: 2. The version is recorded in every diff and changes whenever a rule is added, removed or reclassified.
How differences are classified
Documents are compared after loading them as OpenAPI import does: references bundled, OpenAPI 3.0 schemas rewritten to 3.1 (nullable: true is the same as a null type) and path-item parameters merged into each operation. Operations are matched by method and path template, ignoring parameter names (/users/{id} and /users/{userId} are the same operation, reported as path-parameter-renamed). Path parameters are matched by position, other parameters by name and location (header names ignore case).
Schemas are compared with a direction:
- Request schemas (parameters and request bodies) break clients when they get stricter: a new required field, a narrowed enum, a tighter constraint, a type that rejects old values.
- Response schemas break clients when they lose guarantees: a removed field, a field that is no longer required, a type that accepts new kinds of values, a narrowed enum. A widened response enum or a looser response constraint may surprise clients and is
unknown.
$refs are followed (each difference points to where the change is, such as /components/schemas/User/properties/email), and recursive schemas are compared once per level. The members of an allOf add up to one object: their properties, required lists and types are compared like those of any object, so moving a field between members, or wrapping a schema in an allOf, is not a change, and a field that disappears with a removed member is. What else an allOf member says (constraints, enums, nested oneOf), and any change inside oneOf, anyOf and not, is not proven equivalent or compatible: it is reported as composition-changed (unknown).
Response headers are compared like parameters, by name (ignoring case), and their schemas in the response direction.
items and additionalProperties are constraints too. Absent, true and an empty schema accept anything, false accepts nothing, and a schema is in between: a move towards false (additionalProperties absent -> {type: integer} -> false, or items appearing) is stricter, a move the other way looser, and two schemas are compared member by member. additionalProperties: false in an allOf member closes the whole object. multipleOf is compared by exact decimal divisibility: 10 -> 5 is looser (every multiple of 10 is a multiple of 5), 5 -> 10 stricter, and 4 -> 6 both, so it is breaking in a request and unknown in a response. Values too large or too precise to compare exactly are constraint-changed.
A removed response status that the new document still covers is not response-status-removed: OpenAPI lets a range (1XX to 5XX) stand for every code of its class that is not declared, and default for every status that is not declared otherwise. So when 200 gives way to 2XX (or, without 2XX, to default), and when a range gives way to default, the old response is compared with the one that now covers it, as response 200 (now 2XX).
Each difference carries a JSON pointer into each document. When an element exists in one document only, the pointer into the other is the closest enclosing element (for a removed operation, its path item or /paths).
Breaking
| Rule | Description | Example |
|---|---|---|
operation-removed | An operation is removed. | DELETE /users/{id} is in the old document only |
response-status-removed | A response status is removed from an operation. | GET /users/{id} no longer declares 404 |
response-media-type-removed | A response media type is removed. | the 200 response drops application/xml |
response-field-removed | A response field is removed or renamed. | $.email disappears from the 200 body |
response-field-became-optional | A response field is no longer required. | email leaves the required list of the 200 body |
response-field-type-changed | A response field’s type changes or accepts more types. | $.id goes from integer to string |
response-header-removed | A response header is removed. | the 200 response no longer declares X-Rate-Limit |
response-header-became-optional | A response header is no longer required. | X-Rate-Limit changes to required: false in the 200 response |
response-enum-narrowed | Values are removed from a response enum. | $.status goes from [active, suspended, deleted] to [active, suspended] |
request-required-field-added | A request body field becomes required, or a new required field appears. | email is added to the required list of the POST /users body |
request-field-removed-from-closed-schema | A request body field is removed from a schema with additionalProperties: false; clients that still send it are rejected. | POST /users no longer declares nickname and allows no other properties |
request-required-parameter-added | A new required parameter appears. | GET /users gains a required query parameter tenant |
parameter-became-required | An optional parameter becomes required. | query parameter limit changes to required: true |
request-body-became-required | A request body becomes required, or a new required body appears. | PATCH /users/{id} changes its body to required: true |
request-media-type-removed | A request body media type is removed. | POST /users no longer accepts application/x-www-form-urlencoded |
request-type-changed | A request field’s type changes to one that rejects old values. | $.age goes from [integer, string] to integer |
request-enum-narrowed | Values are removed from a request enum. | query parameter sort goes from [asc, desc] to [asc] |
request-constraint-tightened | A request constraint gets stricter (maxLength, maximum, pattern, minItems, additionalProperties, items, …). | $.name goes from maxLength: 100 to maxLength: 50 |
parameter-location-changed | A parameter (or an API key) moves to another location. | api_key moves from a query parameter to a header |
security-requirement-removed | Every security alternative an operation accepted is removed. | GET /users accepted basicAuth and now accepts only bearerAuth |
Non-breaking
| Rule | Description | Example |
|---|---|---|
operation-added | An operation is added. | GET /health is in the new document only |
operation-deprecated | An operation is marked deprecated. | GET /users/{id} gains deprecated: true |
path-parameter-renamed | A path parameter is renamed; the path template is the same. | /users/{id} becomes /users/{userId} |
response-status-added | A response status is added to an operation. | GET /users/{id} declares a new 429 |
response-media-type-added | A response media type is added. | the 200 response adds application/xml |
response-field-added | A response field is added to a schema that allows other properties. | $.nickname appears in the 200 body |
response-field-became-required | A response field becomes required. | nickname joins the required list of the 200 body |
response-header-added | A response header is added. | the 200 response declares a new X-Request-Id |
response-header-became-required | A response header becomes required. | X-Request-Id changes to required: true in the 200 response |
response-type-narrowed | A response field accepts fewer types. | $.nickname goes from [string, null] to string |
response-constraint-tightened | A response constraint gets stricter. | $.name goes from maxLength: 100 to maxLength: 50 |
request-optional-field-added | An optional request body field is added. | POST /users accepts an optional nickname |
request-optional-parameter-added | An optional parameter is added. | GET /users gains an optional query parameter page |
request-field-became-optional | A request body field is no longer required. | email leaves the required list of the POST /users body |
parameter-became-optional | A required parameter becomes optional. | header X-Tenant changes to required: false |
request-body-added | An optional request body is added. | DELETE /users/{id} accepts an optional JSON body |
request-body-became-optional | A required request body becomes optional. | PATCH /users/{id} changes its body to required: false |
request-media-type-added | A request body media type is added. | POST /users also accepts application/x-www-form-urlencoded |
request-type-widened | A request field accepts more types. | $.age goes from integer to [integer, string] |
request-enum-widened | Values are added to a request enum. | query parameter sort goes from [asc] to [asc, desc] |
request-constraint-loosened | A request constraint gets looser. | $.name goes from maxLength: 50 to maxLength: 100 |
security-alternative-added | A security alternative is added to an operation. | GET /users also accepts apiKey |
docs-changed | Only documentation changes (summary, description, title, examples). | the GET /users description is reworded |
Unknown
| Rule | Description | Example |
|---|---|---|
response-enum-widened | Values are added to a response enum; clients may not handle them. | $.status goes from [active] to [active, archived] |
response-constraint-loosened | A response constraint gets looser; clients may not handle the new values. | $.name goes from maxLength: 50 to maxLength: 100 |
constraint-changed | A constraint changes in a way that cannot be ordered exactly as stricter or looser. | $.amount goes from multipleOf: 3 to multipleOf: 1e300 |
response-field-added-to-closed-schema | A response field is added to a schema with additionalProperties: false. | $.nickname appears in a 200 body that allowed no other properties |
request-field-removed | A request body field is removed; clients may still send it. | POST /users no longer declares nickname |
parameter-removed | A parameter is removed; clients may still send it. | GET /users no longer declares the query parameter page |
request-body-removed | A request body is removed; clients may still send one. | DELETE /users/{id} no longer declares a body |
security-alternative-removed | Some, but not all, security alternatives of an operation are removed. | GET /users accepted basicAuth or bearerAuth and now only bearerAuth |
composition-changed | A oneOf, anyOf, allOf or not composition changes. | a 200 body goes from oneOf: [A, B] to oneOf: [A, B, C] |
vendor-extension-changed | An x- vendor extension changes. | x-rate-limit goes from 100 to 50 |
Load testing
rustman bench runs the request files and collections you already have as load: many virtual users (VUs) repeat them, with the same environments, variables, captures and assertions as rustman run. It is meant for quick, safe checks of how an endpoint behaves under load, not for distributed or scripted load generation.
rustman bench checkout/ --target https://staging.example.com --env staging --vus 5 --duration 30s
The behavior is specified in openspec/specs/load-testing. On a terminal a bench draws a live dashboard (see Live progress), prints a summary at the end and can write JSON and HTML reports. With --viz the viz companion shows it as a live dashboard.
Iterations and virtual users
An iteration runs every selected request once, in collection order (file-name order, or the folder’s _collection.yaml order:). For checkout/ with login, add-item and pay, each iteration sends login, then add-item, then pay.
Each VU is an independent client, like a separate user of the API:
- its own variables and captures: a value one VU captures (a token, an order id) is never seen by another;
- its own cookie jar, which starts empty and is not saved;
- its own connection pool, so keep-alive behaves as it would for real clients.
Captures carry over from one iteration of a VU to the next. Unlike rustman run, a bench never writes to the workspace: captures are not persisted (and persisted captures are not read), nothing is recorded in history, and snapshot assertions compare only (a missing snapshot fails, as in CI mode).
A bench runs kind: http requests only; any other kind is refused before it starts. Requests are sent through the safety policy, so OAuth2 tokens are not acquired and Digest auth is refused (as for agents); use a token from a variable or a capture instead.
Executors
--executor picks how iterations are scheduled.
| Executor | Model | Flags |
|---|---|---|
constant-vus (default) | closed | --vus <n> (default 1), --duration <d> (default 30s) or --iterations <n>, --think-time |
ramping-vus | closed | --stage <duration>:<vus> (repeatable) or [[bench.stages]], --think-time |
constant-arrival-rate | open | --rate <n> (required), --duration <d> (default 30s), --max-vus <n> (default 50) |
A flag of another executor is a usage error (exit code 2), such as error: bench: --vus does not apply to the ramping-vus executor.
constant-vus
--vus N VUs each run iterations back to back until --duration is over, or until --iterations iterations (in total, across every VU) have started. --think-time pauses each VU between two of its iterations: a fixed duration (500ms) or a uniform random one in a range (1s..3s); the default is 0.
rustman bench api/ --target http://localhost:8080 --vus 2 --think-time 1s..3s --duration 1m
rustman bench api/ --target http://localhost:8080 --vus 4 --iterations 200
ramping-vus
The VU count follows the stages, starting from 0: during each --stage <duration>:<vus> it moves linearly from the previous stage’s target to its own, and the target is adjusted every 100 ms.
rustman bench api/ --target http://localhost:8080 --executor ramping-vus \
--stage 30s:20 --stage 1m:20 --stage 30s:0
This grows from 0 to 20 VUs over 30 seconds, holds 20 for a minute, and drops to 0 over 30 seconds.
Without --stage, the stages come from [[bench.stages]] in rustman.toml, so a reviewed ramp can live with the workspace; any --stage replaces them all:
[[bench.stages]]
duration = "30s"
target = 20
[[bench.stages]]
duration = "1m"
target = 20
[[bench.stages]]
duration = "30s"
target = 0
A VU removed by a ramp-down finishes its current iteration first (graceful stop); an iteration still running 30 seconds after its VU was removed is cancelled and counted as interrupted.
constant-arrival-rate
--rate R starts R iterations per second whatever the response times, each on a free VU of a pool of --max-vus. When every VU of the pool is busy, the iteration is not started: it is counted as dropped. With --rate 100 --max-vus 10 and responses taking one second, about 90 iterations per second are dropped.
rustman bench api/ --target http://localhost:8080 --executor constant-arrival-rate --rate 50 --max-vus 20 --duration 1m
When the duration is over (for every executor), no new iteration starts and those in flight get 30 seconds to finish before they are cancelled.
Request options
--timeout <duration> replaces every request’s total timeout (settings.timeout_ms); a request that takes longer counts as a timeout error. -k/--insecure skips TLS certificate verification for every request, as for rustman run.
Open and closed models
In a closed model (constant-vus, ramping-vus), a VU starts its next iteration only when the previous one is done. When the server slows down, the VUs send less: load adapts to the server, as a fixed group of users waiting for their pages would. The latency reported is service latency, the time each request took.
In the open model (constant-arrival-rate), iterations arrive at a fixed rate whatever happens, as independent users would. A slow server does not slow the arrivals, so queuing shows up in the latency.
Closed-model latencies hide queuing: during a two-second stall, a VU waits for one slow response and simply sends nothing else, so most of the stall never appears in the percentiles (coordinated omission). In the open model, latency is measured from each iteration’s scheduled start instead of its actual start, so every iteration scheduled during a stall reports the time it waited. These percentiles are labeled corrected. For “what latency do users see at this traffic level”, use the open model; for “how fast is one request”, either works.
Data feeding
--data <file> feeds each iteration a row of a CSV or JSON file, with its columns (or keys) as variables, read exactly as in data-driven runs. --data-mode chooses the row:
| Mode | Row of each iteration |
|---|---|
sequential (default) | The next row of one cursor shared by every VU: each row is used once per pass. |
per-vu | VU 1 always uses row 1, VU 2 row 2, and so on. |
random | A uniformly random row. |
--data-exhaust says what happens at the end of the rows: recycle (default) starts over; stop ends the VU (sequential) or leaves VUs without a row of their own idle (per-vu). random never runs out.
# users.csv: email,password with 3 rows
rustman bench login/ --target http://localhost:8080 --data users.csv --data-mode per-vu --vus 3
Here VU 1 uses row 1, VU 2 row 2 and VU 3 row 3 for {{email}} and {{password}}.
Values of secret columns are redacted from every output: columns listed with --secret-columns a,b or in a _collection.yaml secret_columns, and columns named like password, token, secret or api_key, which are marked automatically.
Safety
A bench always runs under the safety policy:
--targetis required (error: bench: --target is required, exit code 2), and its origin is the only one requests may go to.[safety].allowed_hostsis ignored and there is no--allow-host. The target is shown in the report and the dashboards, so it must be a bare origin (scheme://host[:port], an optional trailing/): a target holding credentials (http://user:pass@host) or with a path, query or fragment (http://host/v1,http://host/?token=...) is refused with exit code 2, and the message does not repeat it. Put credentials in the request’sauthand paths in the request files.- Proxies: a proxy is where the load actually goes, so a request whose proxy (its
settings.proxy,[http] proxy, orHTTP_PROXY/HTTPS_PROXY/ALL_PROXY) is not the target origin is refused like a foreign host (blocked: proxy not allowed (<proxy host>)): before any load when it is known statically, else as ablockederror when it is sent. Set the request’sproxy: none(orNO_PROXY) to bypass it, or bench the proxy itself as the target. - Before any load, every request is resolved with the environment,
--varand the first data row. A request whose origin is not the target’s stops the bench with exit code 4 and, for example,error: api/report.rman.yaml: blocked: host not allowed (other.example.com), before anything is sent. The refusal names the bare host, with the port only when it is not the scheme’s default (127.0.0.1:8081). A URL that depends on a capture is checked when it is sent; a request (or redirect hop) to another origin is then not sent and counts as ablockederror. - Method gating: GET, HEAD and OPTIONS run by default; POST, PUT and PATCH need
--allow-mutations, DELETE--allow-destructive. A blocked method stops the bench before any load, with exit code 4. - Production guard: benching a production target (as the production guard defines it) needs
--production <host>repeating the exact target host, and--allow-destructiveis always refused against production. - Agents can’t start a bench: the MCP server has no tool that generates load.
Load caps
A bench is capped at 50 VUs, 5 minutes and 200 requests per second by default. Flags asking for more fail with exit code 2 and name the cap:
error: bench: 100 VUs exceeds max_vus = 50 (raise it in rustman.toml [bench])
Only rustman.toml raises a cap, so that more load is a reviewed change rather than a flag:
[bench]
max_vus = 200 # VUs at once (--vus, the largest --stage, --max-vus)
max_duration = "10m" # --duration, or the sum of the stages; also bounds --iterations runs
max_rps = 500 # --rate × requests per iteration, and a hard limit on requests per second
An arrival rate asks for --rate iterations per second, each sending every request of the collection, so --rate 150 over a 2-request collection asks for 300 requests per second and is refused under max_rps = 200.
max_rps is enforced across every executor by one rate limiter shared by all VUs, with evenly spaced requests and no bursts, so a closed model with fast responses never exceeds it either. When the target answers 429 Too Many Requests, the limiter halves its rate (and honors Retry-After), as for exploration; the summary warns when that happened, since it lowers the offered load. 429 responses also count as 4xx errors. Requests wait for the limiter in arrival order, so no VU is starved. The wait is in no latency of a closed model, so the summary also warns when the limit, not the target, set the throughput (over one request in ten waited at least half a request interval for it, at a rate near max_rps): raise max_rps to go beyond. The limiter spaces requests evenly and keeps no credit, so a sender that wakes up late for its slot loses that time: a fast sender stays below max_rps, never above it (on macOS the timer wakes a waiting sender about 2 ms late, so a single fast VU under the default 200 rps gets about 150 rps). In the open model the wait counts in the corrected latency, from the scheduled start.
Summary and errors
At the end, the bench prints a summary on stdout: iterations (completed and interrupted) and how long completed ones took (avg, p95, max; think time excluded), scheduled and dropped iterations (open model), requests per second, the error rate with errors by class, and latency percentiles (min, avg, p50, p90, p95, p99, max) per request file and overall, then the thresholds and, when the run stopped early, aborted: threshold or aborted: interrupted. Latency is the transport time of each request, from HDR histograms with 3 significant digits.
iterations: 120 completed, 0 interrupted
iteration duration (ms): avg 38.40, p95 71.20, max 130.10
requests: 240 (7.9/s), errors 1.25% (5xx 3)
latency (service, ms):
min avg p50 p90 p95 p99 max requests errors
checkout/login.rman.yaml 3.10 12.48 11.20 18.90 22.40 35.10 41.70 120 0.00%
checkout/pay.rman.yaml 5.02 25.91 21.30 44.80 52.10 88.60 102.40 120 2.50% (5xx 3)
overall 3.10 19.20 15.90 38.20 46.70 80.30 102.40 240 1.25% (5xx 3)
Error classes: 4xx and 5xx (by response status, even when the request’s assertions pass), timeout, connect (refused or unreachable connections, DNS, proxy and other network failures), tls, blocked (refused by the safety policy at runtime), assertion (a failed assertion or required capture) and other (a request that could not be built, such as an unresolved variable).
Metrics
Besides the summary, a bench measures, per request file and overall: assertion checks passed and failed, the average time of each phase (dns, connect, tls, ttfb, download, over the requests that went through it), bytes sent (estimated from the request line, headers and text body) and received (response bodies). Each second also becomes a point of a time series: requests, errors, requests per second, p50/p95/p99 and active VUs (closed model: VUs running or thinking; open model: VUs of the pool busy with an iteration). Requests per second count from the start of the load to its end, over at least one second, so a run shorter than a second shows its request count. The report holds all of it.
Memory stays bounded whatever the number of requests: latencies and iteration durations go into fixed-size histograms, one per second merged into the totals, and no individual request is kept. Each VU still reads each response body as rustman run does, up to [http] max_body_bytes (10 MiB by default) in memory before spilling to disk, so very large responses with many VUs need up to VUs × that limit; lower max_body_bytes for such benches. Secret values a VU resolves or captures (a token from a login request, say) are kept for one iteration only, and the process-wide set that log lines are redacted with keeps at most about 32,000 of the most recent values, so a long bench that logs in on every iteration does not grow either.
Thresholds
A threshold makes a bench a pass/fail check for CI. --threshold "<metric><op><value>" (repeatable) is checked when the bench ends; if any is breached, the bench still writes its reports, then exits with code 1.
rustman bench api/ --target http://localhost:8080 --vus 10 --duration 1m \
--threshold "p95<300ms" --threshold "error_rate<1%" --threshold "checks>99%"
| Metric | Value | Example |
|---|---|---|
p50, p90, p95, p99, max, avg | latency, with us, ms, s or m (milliseconds when bare) | p95<300ms, p99<=1.5s |
error_rate | errors over requests, as a percentage or a fraction | error_rate<1% |
checks | assertions passed over assertions run | checks>99% |
rps | requests per second over the run | rps>=50 |
Operators are <, <=, > and >=. file:<name>: scopes a threshold to one request file, named by its path, its path without .rman.yaml or its file name: file:checkout/login:p95<200ms. A scope that names no file of the bench is a usage error (exit 2). checks without any assertion is n/a and passes, with a warning in the summary.
The summary shows each threshold with what was measured:
thresholds:
✗ p95<300ms (412ms)
✓ error_rate<1% (0.20%)
Thresholds every bench of the workspace must keep go in rustman.toml, each metric with its condition; they are checked before those of --threshold:
[bench.thresholds]
p95 = "<300ms"
error_rate = "<5%!"
"file:checkout/pay:p99" = "<1s"
Abort on fail
A threshold ending in ! (error_rate<5%!) also stops the bench as soon as it is breached: after a 10-second warm-up it is checked every second against everything measured so far, and when it fails, no new iteration starts, those in flight get one second to finish, and the bench writes a partial report marked aborted: threshold and exits with code 1. Load stops within 2 seconds of the check.
Stopping with Ctrl+C
The first Ctrl+C stops starting iterations and waits up to 10 seconds for those in flight (the dashboard says so in its title; without it, a line on stderr does); the second cancels them at once. Either way the bench then prints its summary (ending in aborted: interrupted), writes its reports, which cover what ran, and exits with code 130.
Generator lag
If the machine running the bench is the bottleneck, every latency it measures is inflated. A bench measures its own scheduling lag (how late its tasks run) and, when the 99th percentile is above 10 ms, warns:
warning: the load generator lagged 23.4 ms at p99 (over 10 ms): results may be generator-bound
Fewer VUs, a lower rate or a faster machine then give truer numbers. The report keeps the lag as generator_lag_p99_ms.
Live progress
While a bench runs, stdout shows how it goes:
- On a terminal, a live dashboard fills the screen: elapsed and remaining time (remaining only for a bench with a fixed duration), active VUs, requests per second, p50/p95/p99 latency (labelled
serviceorcorrected), the error rate, sparklines of p95 and requests per second over the last two minutes, each threshold as it stands so far, and a table per request file with anoverallrow. It redraws at most 4 times a second from a thread of its own, so drawing never slows the load. Ctrl+C works as below; when the bench ends the screen is restored and the summary printed. - Otherwise (stdout piped, redirected or in CI), no dashboard is drawn: one progress line is printed every 10 seconds, and a bench shorter than that prints none.
bench 20s/1m00s: 10 VUs, 412.0 req/s, 8240 requests, p50 18.20ms, p95 61.00ms, p99 120.40ms, errors 0.12%, thresholds 2/2 passing
A report written to stdout (--report json) never gets the dashboard; the progress lines and the summary then go to stderr.
Viz companion
--viz also streams the bench to the viz companion (rustman-viz, found as RUSTMAN_VIZ, then on PATH, then next to rustman) over the viz protocol: it opens the bench view, sends a bench_tick per second and a final bench_finished with the totals and thresholds. The companion draws them as the bench dashboard, and rustman viz <report.json> opens a saved bench report in the same view. These events hold counts, timings and threshold expressions only, never request or response content.
Viz never changes a bench: a companion that is missing, refuses the handshake or stops reading gets one warning (warning: --viz: Viz companion not found: ...), and the bench runs, reports and exits as without --viz. A companion built before the bench view gets:
warning: viz companion has no bench view
A slow companion misses ticks rather than slowing the bench; bench_finished waits for it at most 5 seconds.
Reports
--report <format>=<path> (repeatable) writes a rustman.report/v1 report with kind: bench (Bench reports): the profile and target, metrics per file and overall, the per-second series, the threshold results and up to 20 error samples per error class.
rustman bench api/ --target http://localhost:8080 --duration 1m \
--report json=out/bench.json --report html=out/bench.html
| Format | Content |
|---|---|
json | The canonical report; validate it with rustman report schema, render it later with rustman report render |
html | A self-contained page with latency-over-time (p50, p95, p99) and requests-per-second charts, the thresholds, the latency table and the error samples; it loads nothing from the network |
markdown | The same, as tables, for a pull request comment |
junit | One test case per threshold, for CI test tabs |
sarif | One result per breached threshold |
A format without a path goes to stdout, and the summary then goes to stderr. Agents can read a bench report through the get_report tool by its path (out/bench.json); they cannot start a bench.
Redaction
Every output of a bench applies the environment’s redaction: the summary, the warnings, the progress lines and dashboard, the viz events, the error samples and every report format. Values of secret variables (captures of a secret variable included), of the request’s auth, and of secret data columns (--secret-columns, a collection’s secret_columns, and columns named like password, token, secret or api_key) appear as «redacted:<name>». An assertion that fails on a password shows «redacted:password», never the password. An error sample that shows the request (GET <url> -> 500) also replaces the value of every query parameter named like a secret (?password=...), even one set with a plain --var.
Exit codes
| Code | Meaning |
|---|---|
| 0 | The bench ran and every threshold passed. |
| 1 | A threshold failed, or an abort-on-fail threshold stopped the bench (aborted: threshold). |
| 2 | Usage error: a missing --target, a cap exceeded, a flag of another executor, a request kind other than http, an unreadable data file. |
| 4 | Refused by the safety policy before any load: a host outside the target, a method not allowed, an unconfirmed production target. |
| 130 | Interrupted by Ctrl+C: the summary and reports cover what ran, marked aborted: interrupted. |
See also executor internals and overhead.
Stress testing
Only stress systems you own or are explicitly authorized to test. A stress run pushes a backend until it fails, on purpose. Rustman only sends load to targets listed in
rustman.toml, refuses production unless you opt in twice, and stops at its caps, but the consent is yours.
rustman stress answers the question load testing does not: where does this backend break, how does it break, and does it recover? It runs the same request files and collections as rustman run and rustman bench, with the same environments, variables, captures and assertions, over the open-model (constant-arrival-rate) executor of rustman bench.
rustman stress breakpoint api/catalog --target https://staging.example.com --slo "p95<300ms" --slo "error_rate<1%"
Modes
| Mode | What it does | Flags |
|---|---|---|
breakpoint | Steps the arrival rate up until an SLO breaks, then narrows down the last sustainable rate | --start-rps (10), --step-factor (1.5), --step-duration (30s), --refine (3), --require-rps |
spike | A baseline rate, a sudden multiple of it, then the baseline again; reports the errors during the spike and the recovery time | --baseline-rps (10), --baseline (30s), --spike-factor (10), --spike-duration (30s) |
soak | A steady rate for a long time; fits a trend to latency and errors to spot leaks | --rps, --duration, --drift-threshold (5%) |
fuzz | A steady rate with a share of mutated requests | --rps, --duration (1m), --fuzz-ratio (0.2) |
Rates count iterations per second; an iteration sends every request of the plan, so with three request files --start-rps 10 offers 30 requests per second. Results (max_sustainable_rps, breaking_rps, step rates) are in requests per second.
An unknown mode exits 2 and lists the valid ones. Every mode can mix in fuzzed requests and malformed payloads, and send wire faults after its load; all three are checked by the stress gate first.
Configuration
Everything that grants consent lives in rustman.toml, where reviewers see it:
[stress]
targets = ["https://staging.example.com"] # the only origins a stress run may target
allow_production = [] # production hosts, also confirmed with --production
families = [] # costly families: compression-bomb, large-body
max_rps = 500 # requests per second
max_duration = "10m" # breakpoint, spike and fuzz runs
max_soak_duration = "2h" # soak runs
max_body = "10MiB" # malformed payloads
max_bomb_ratio = 100 # compression bombs expand to at most max_bomb_ratio × max_body
max_wire_connections = 20 # wire faults
max_vus = 1000 # VUs at once (--max-vus asks for fewer)
expected_max_body = "1MiB" # a 2xx to a larger body is a finding
[stress.slo] # SLOs of every stress run of the workspace
p95 = "<300ms"
error_rate = "<1%"
Durations take ms, s, m and h; sizes take bytes or KiB, MiB and GiB. Unlike the rest of rustman.toml, an unknown key in [stress] (such as a misspelt max_rsp) is an error, not a warning: a typo must not silently fall back to a default in the table that holds consent.
Safety
The safety policy of rustman explore and rustman bench applies first, pinned to --target as for rustman bench: no host besides the target, method gating (--allow-mutations, --allow-destructive), and the production guard (--production <host>). Every request is checked before any load. Then the stress gate adds its own refusals, all exiting 4 before anything is sent:
| Refusal | Message |
|---|---|
The target is not in [stress] targets (no flag adds one) | stress: target not listed in rustman.toml [stress].targets |
A production target whose host is not in [stress] allow_production | stress: production host <host> is not listed in rustman.toml [stress].allow_production |
| Fuzzing, malformed payloads or wire faults against production, whatever the opt-ins | stress: fuzzing and malformed input are never sent to production |
--malformed compression-bomb without it in [stress] families | names rustman.toml [stress].families |
--wire without --allow-wire-faults | stress: --wire sends raw, invalid HTTP and needs --allow-wire-faults |
| Requests or wire faults through a proxy the safety policy does not allow | names the proxy: proxy not allowed (<host>) |
The caps are checked next and exit 2 naming the key, such as stress: a duration of 4h exceeds max_soak_duration = 2h (raise it in rustman.toml [stress]). A breakpoint --step-duration longer than max_duration is refused the same way, since the run would end inside its first step. Flags only ask for less.
Every request goes through the same governed sender as exploration and rustman bench, with a governor built from the [stress] caps (max_rps as its rate, the VU pool as its concurrency). The governor lets a tenth of a second of max_rps (at least 2 requests) go out back to back, so a step offered at exactly the cap is not queued client-side by scheduler jitter; the average never exceeds max_rps. Unlike exploration, it never slows down on 429 Too Many Requests: throttling is what a stress run measures. Agents cannot start a stress run: the MCP server has no stress tool.
SLOs and windows
SLOs use the metrics of rustman bench thresholds: p50, p90, p95, p99, max, avg, error_rate, rps and checks. Give them with --slo (repeatable) or [stress.slo]; scope one to a request file with file:<name> <expr>, such as --slo "file:checkout p99<800ms". Without any SLO, breakpoint and spike use p95<1s and error_rate<5%.
SLOs are judged over 5-second windows. Latency counts from each iteration’s scheduled start (coordinated-omission correction), so queuing in the target shows up in the percentiles.
Breakpoint
Steps start at --start-rps and multiply by --step-factor: with the defaults, 10, 15, 22.5, 33.75, 50.6, 75.9 req/s and so on, 30 s each. The first window of a step is a warm-up and is not judged. A step breaks when SLOs fail in 2 consecutive windows (one bad window is not a break), and ends there. After the first broken step, --refine bisection steps run between the last good and the first broken rate, which brings the two within about 10%:
step offered achieved p95 errors verdict
1 10 10 14ms 0.00% ok
...
5 50.62 50.6 182ms 0.00% ok
6 75.94 68.2 1420ms 0.00% broken
7 63.28 61.9 1105ms 0.00% broken
8 56.95 56.9 260ms 0.00% ok
9 60.12 59.8 1012ms 0.00% broken
max_sustainable_rps: 56.95
breaking_rps: 60.12 (latency; first failing endpoint: search, p95 1890ms, errors 0.00%)
- Failure mode: each broken window is classified by its dominant symptom:
server-errors(5xx),timeouts,connection(refused, reset, TLS),throttled(429, or 503 withRetry-After) when an error SLO failed; otherwisesaturation(achieved below 90% of offered while latency is up) orlatency. - Rate limiting is not a break: throttled responses are not errors for the SLOs, and the run reports
rate limited at <rps> req/sand climbs on, unless--treat-throttling-as-failuremakes them errors. - First failing endpoint: for a broken step, the request file whose latency or error rate crossed its SLO first, from the per-file windows, with its p95 and error rate.
- Cool-down: after a broken step, nothing is offered until a window closes with no request in flight (at most 6 windows), so the late answers of the broken step are not measured in the next step. Those windows show in the series at 0 req/s and belong to no step.
- The cap: the rate never exceeds
max_rps. A step at the cap that holds ends the search withno break found up to max_rps = 500andmax_sustainable_rpsat the cap. The whole run also stops atmax_duration.
A broken breakpoint is a result, not a failure: the run exits 0 unless --require-rps is given and max_sustainable_rps falls short of it, or a finding reaches --fail-on.
Spike
The baseline rate runs for --baseline, then --spike-factor times it for --spike-duration, then the baseline again for another --baseline. The summary gives the baseline p95, the requests and errors during the spike, the peak p95 and the recovery time: how long after the spike the per-second p95 came back within 20% of the baseline p95 (or within 10 ms of it, for very fast targets) and stayed there for 3 seconds, without errors.
baseline p95 31ms; during the spike 6000 requests, 42 errors; peak p95 2210ms
recovered in 14s
Soak
--rps is held for --duration (up to max_soak_duration). A linear trend is fitted to the p95 and error rate of each minute. A p95 slope above --drift-threshold (default 5% of the median p95 of the first 10 minutes, per hour) is the medium finding latency-drift, with the slope in ms per hour; an error rate rising by more than one point per hour is the medium finding error-drift. Both hint at leaks: memory, connections, queues. With fewer than three minutes of data, no trend is fitted: the summary says p95 trend not available: too little data instead of a slope.
Fuzz mixing
--fuzz-ratio r (0 < r <= 1; the fuzz mode defaults it to 0.2) replaces each request with a mutated variant with probability r. Requests are replaced, not added: offered load stays the same, so valid traffic can be compared with and without fuzzing. Fuzzed exchanges are measured apart: the step table, the SLO windows and the bench metrics count valid traffic only, and the summary shows fuzzed traffic on a line of its own.
rustman stress fuzz api/orders --target https://staging.example.com --rps 20 --duration 5m --allow-mutations --seed 42
- Where variants come from. Without
--spec, one mutation of the saved JSON body per variant: a type flipped (2becomes"2"), a value nulled, a key removed, a number at the 64-bit boundary (9223372036854775808), a 10 000-character string, unicode edge cases (NUL, a byte order mark, a right-to-left override), a value wrapped in an array, or a key duplicated. With--spec openapi.yaml, a request whose method and path match an operation gets variants that break exactly one constraint of its body schema (a required field missing, a wrong type, a bound, a length, a pattern, an enum), drawn with the seeded generators ofrustman explore. A request without a JSON body is sent as is. When no request was fuzzed (a plan without a JSON body to mutate, such asGETs only), the summary printsfuzz: warning: no request was fuzzedinstead of the share replaced, andfuzz-degrades-valid-trafficis not judged: a drift then is not fuzzing’s doing. - Reproducible. Every run has a seed, printed at start (
stress: seed 42) and in the summary;--seedreplays it. A slot is one request of one iteration of the fuzz phase, and the same seed and plan fuzz the same slots with the same variants. Outcomes may still differ: servers are not deterministic. - Baseline. A run with fuzzing first runs a clean phase at the mode’s first rate for
--baseline(default 30s, rounded up to whole windows; it counts towardmax_duration). If valid traffic at that rate is then more than 50% slower at p95 (and more than 10 ms slower, so a fast target’s jitter does not count), or its error rate more than 1 point higher, and at least one request was fuzzed, the run reports thehighfindingfuzz-degrades-valid-trafficwith both values: bad clients hurt good ones. - Findings. A 5xx answer to a variant is the
highfindingserver-error-on-malformed-input, and no answer in time istimeout-on-malformed-input. A 2xx answer to a variant that breaks the schema isaccepted-malformed-input, and to one over a documentedmaxLengthormaxItems(or over[stress] expected_max_body) isoversized-input-accepted. Each finding names its source (mutation,schemaor the malformed family) and keeps the first exchange as evidence, redacted: the request with theContent-Typethe variant was sent with, the body sent, the status and the start of the response body (at most 4 KiB). Without a response, the evidence body says what happened instead (such as a timeout).
Malformed payloads
--malformed <families> adds raw-byte payloads to the fuzz pool (with --fuzz-ratio 0.2 unless given). They replace the request’s body on the normal send path, so the request’s headers, auth, cookies and timing apply as usual.
| Family | Payload | Bounded by |
|---|---|---|
json-syntax | the body cut in half, a trailing comma, unquoted keys, single quotes, an unterminated string, NaN | |
deep-nesting | arrays nested 16, 128, 1024, 5000 or 10 000 deep | depth 10 000, max_body |
large-body | a JSON string of 64 KiB up to max_body | 1 MiB unless large-body is in [stress] families |
wide | an object of 1000, 10 000 or 100 000 keys | 100 000 keys, max_body |
encoding | invalid UTF-8, a raw NUL, an overlong encoding, a lone surrogate | |
content-type-mismatch | JSON sent as XML, XML or a form sent as JSON | |
duplicate-keys | the body’s first key repeated with another value | |
numbers | 1e400, a 40-digit integer, -0, 1e-400 | |
compression-bomb | gzip with Content-Encoding: gzip | expands to at most max_bomb_ratio × max_body (64 MiB at most); needs [stress] families |
A 5xx answer names the family and, for families that grow, the smallest input that failed, such as smallest failing depth: 5000. A 2xx answer to json-syntax, encoding, content-type-mismatch, duplicate-keys or numbers is accepted-malformed-input; the well-formed families (deep-nesting, large-body, wide, compression-bomb) are judged by size only, against expected_max_body.
Wire faults
--wire <families> --allow-wire-faults sends raw HTTP/1.1 that a correct client never sends, after the load phase (not after Ctrl+C). It opens its connections with the engine’s connector (DNS, connect timeout, ca_bundle, client certificates, TLS with ALPN http/1.1); proxies are always tunnelled, never asked to forward, and a proxy outside the safety policy is refused (exit 4). At most max_wire_connections (default 20) sockets are open at once, whatever the mode. Only the status line and the connection state of an answer are read, within 10 s.
| Family | Sent | Finding |
|---|---|---|
oversized-headers | a 70 KiB header | connection-dropped-without-response (low) when the server closes without answering; 431 expected |
many-headers | 1000 headers | the same |
cl-te-conflict | Content-Length and Transfer-Encoding: chunked, with a body that is complete only by Content-Length | ambiguous-framing-accepted (high) on a 2xx: the server framed the body by Content-Length (a request-smuggling desync); 400 expected |
invalid-chunked | a chunk size that is not hexadecimal | ambiguous-framing-accepted on a 2xx |
invalid-request-line | a garbage request line | ambiguous-framing-accepted on a 2xx |
slow-body | max_wire_connections connections sending a body at 1 byte per second, for 60 s at most | no-slow-client-timeout (low) when the server keeps every one open for the whole 60 s |
Each family except slow-body sends 3 requests. A server that times slow clients out (with a 408 or a close) before the 60 s are up gets no finding. Wire faults are never sent to production, and agents cannot send them.
The client as the bottleneck
- Before load starts, the open-file limit is read (on Unix) and a warning is printed when it is below
max_rps × 2: every connection is a file descriptor. - During the run, the scheduler measures how late it dispatches each iteration. When it lags more than 100 ms behind schedule for 3 consecutive seconds, the windows holding those seconds are marked
client-saturated: they never count as server breaks, a breakpoint step made of them never setsbreaking_rps, and the search stops there. - Each VU is a task of its own on a pool of worker threads (one per core, 2 to 16), so load does not share one thread. The VU pool grows on demand up to
--max-vus(default:max_rps; never above themax_vuscap, default 1000, so in-flight memory stays bounded); a scheduled iteration with no VU free is dropped, which shows as achieved below offered.
Kill switch and recovery
While load runs, the health request goes out once per second: --health <file>, or by default the first GET request of the plan. The target is declared down, and load stops at once (requests in flight are cancelled), when for 5 s connection errors (refused, reset, TLS) exceed half of the attempts, or timeouts do, or when the health request gets no answer 3 times in a row. The summary then says killed: target down at <rps> req/s (<reason>); a breakpoint run’s step breaks there with the failure mode connection (or timeouts).
After every mode, and after a kill, the recovery check sends the health request once per second. The target has recovered after 10 consecutive 2xx or 3xx answers whose latency is within 20% of the pre-stress baseline (the median of 3 health requests sent just before load; a 20 ms floor keeps a fast local target’s jitter from counting against it). Without recovery within --recovery-timeout (default 2m), the run reports the high finding no-recovery, with the last status and latency:
recovery: not recovered (no-recovery)
findings:
high no-recovery: api/health.rman.yaml had not recovered 2m after load stopped: the last health request answered 503 in 12ms
The check is skipped (recovery: not checked (...)) when the plan has no GET and no --health is given, or when the health request already failed before load: recovery cannot be judged against a target that was never healthy. The health request goes through the same safety policy, with a governor of its own built from the [stress] caps.
Minimization
Once load has stopped and the target has recovered (or recovery was not checked), the input behind each crash-like finding (a 5xx or a timeout caused by a variant) is replayed alone, at 2 requests per second and at most 50 replays per finding, and reduced by delta debugging while the failure still reproduces: keys and items are removed, nesting is unwrapped and strings are halved. The smallest input is shown under the finding and kept in the report:
high server-error-on-malformed-input: mutation input on api/orders.rman.yaml answered 500 (12 times)
minimized (6 replays): {"qty":"2"}
A finding whose input does not fail when replayed alone is marked load-dependent: it only fails under load, which is itself a useful signal. Inputs that are not JSON (or larger than 64 KiB) are replayed once, not reduced. Minimized inputs are redacted like every other output. Ctrl+C stops minimization: after a first Ctrl+C (during load or during the recovery check) no replay is sent, and a minimization it interrupts is dropped rather than reported half done.
Reports and the live view
- On a terminal the run shows a dashboard, redrawn at most 4 times a second: the mode, phase and step; offered and achieved rate; p50, p95 and p99 of valid and fuzzed traffic apart; error classes and the SLO status of the last windows; the kill-switch state and findings as they arrive. Drawing never holds up load generation.
- Off a terminal (CI) it prints one line per step instead:
step 3: offered 22.5 req/s, achieved 22.4 req/s, p95 31ms, errors 0.00%: ok. A step is a breakpoint step; in the other modes it is a stretch at one rate (a spike’s phases), at most a minute long. - The report (
rustman.report/v1,kind: stress) is always kept as.rustman/stress/<id>/report.json(the run prints its id), and--report <format>[=<path>]also writes it asjson,html,markdown,junitorsarif. It holds the mode, profile, seed, target and SLOs, the per-second series, the step table,breakpoint(max_sustainable_rps,breaking_rps,failure_mode,first_failing_endpoint),rate_limited_at,killed,recoveryand the findings in the exploration finding format, sorustman report render, SARIF upload andrustman report difftreat them like exploration findings (a newno-recoveryin the later report exits 1). The HTML page is self-contained and offline: latency and errors against offered load with the breakpoint marked, and the recovery timeline. --vizstreams per-second points to the viz companion’sstressview; a companion without it is a warning (viz companion has no stress view), shown once, and never changes the result.- Agents read stress reports through the report tools (
get_reportwith a report file), but no MCP tool starts a stress run or sends malformed or wire-fault traffic.
Regression export
rustman stress export <id> --findings <ids|all> --into <dir> writes one file per finding from the kept report:
rustman stress export str-20261120-3fa9c1 --findings all --into regressions/stress
A finding with an input becomes a request file: the finding’s own request file (its URL, headers and auth, as templates) with the minimized input as its body and the assertion a correct API passes, status: "4xx". Secret placeholders in an input become {{name}} references again, so no export holds a secret. rustman run regressions/stress then fails while the bug is there and passes once it is fixed. Wire faults cannot be written as request files: they are exported as .wire.txt files of comments with the request line and the expected status (431 for oversized headers, 400 for ambiguous framing). Findings without an input (no-recovery, drift, fuzz-degrades-valid-traffic) are skipped by all and refused by id.
CI recipe
A capacity gate for a staging deployment: fail the job when the API no longer sustains 100 requests per second within its SLOs, or when a high finding appears, and keep the reports.
- name: Capacity gate
run: rustman stress breakpoint api/catalog --target https://staging.example.com --env staging --slo "p95<300ms" --slo "error_rate<1%" --require-rps 100 --report html=out/stress.html --report sarif=out/stress.sarif
- uses: actions/upload-artifact@v4
if: always()
with:
name: stress-report
path: out/
The output is one line per step, and the exit code is 1 when max_sustainable_rps is below 100. Compare two runs with rustman report diff old.json new.json (--report json=out/stress.json).
Exit codes
| Code | Meaning |
|---|---|
| 0 | The run completed with no finding at or above --fail-on (default high), and max_sustainable_rps reached --require-rps when given. |
| 1 | A finding at or above --fail-on, or max_sustainable_rps below --require-rps. |
| 2 | A usage error or a cap. |
| 4 | A refusal of the safety policy or the stress gate; nothing was sent. |
| 130 | Ctrl+C: load stops at once and the recovery check still runs (a second Ctrl+C cancels requests in flight and the check). |
Trace propagation
Rustman can send standard trace context with every request, so the exchange shows up in the backend’s distributed traces (Jaeger, Grafana Tempo, Honeycomb, Datadog, or any OpenTelemetry-compatible system). It is off by default: with no configuration, no tracing header is ever added, and nothing is sent anywhere but the request’s own target.
Turning it on
Propagation is enabled by one of:
- a
trace:block in an environment file (environments/<name>.yaml), [trace]inrustman.toml,- the
--traceflag ofrustman send,rustman run,rustman graphql query,rustman rpc call/batch/discoverandrustman grpc call, which turns it on even when no block enables it (enabled: falseincluded).
# environments/staging.yaml
variables:
base_url: https://staging.example.com
tenant_id: acme
trace:
enabled: true
# rustman.toml
[workspace]
name = "shop"
version = 1
[trace]
enabled = true
sampled = true
formats = ["w3c", "b3multi"]
[trace.baggage]
tenant = "{{tenant_id}}"
The active environment’s block applies over [trace] key by key: a key the environment sets wins, the others come from rustman.toml. So rustman.toml can hold the shared formats and link while each environment only says enabled: true. A preset link may take its link_base from the other file; the merged result is checked for every environment when the workspace loads. export is a single key: an environment’s export: table replaces [trace.export] as a whole, so each table that enables export names its own endpoint.
Settings
| Key | Default | Meaning |
|---|---|---|
enabled | false | Add trace headers to every request. |
sampled | true | The sampled flag sent: traceparent flags 01, or 00 when false; 1/0 in B3. |
scope | exchange | exchange: each request starts its own trace. run: every request of one rustman run (or one exploration) shares one trace id, each with its own span id, so a whole flow appears as one trace. |
formats | [w3c] | Any of w3c (traceparent), b3 (the single b3 header) and b3multi (X-B3-TraceId, X-B3-SpanId, X-B3-Sampled). Every format carries the same ids. |
tracestate | none | A map of tracestate members. Values may use {{variables}}. |
baggage | none | A map of baggage members. Values may use {{variables}}; they are percent-encoded on the wire. |
link | none | A trace link template, or a preset name (see below). |
link_base | none | The base URL of a preset link, such as http://localhost:16686. |
Every key is checked when the workspace loads; an unknown key or format is an error, and so is an invalid tracestate or baggage key. In rustman.toml, the [trace] keys above are known and never warn as unknown key.
Variables in tracestate and baggage
Values are resolved once per run from --var overrides, the active environment (secrets included) and rustman.toml [variables]. Request variables and captures are not available there. An unresolved name stops the run before anything is sent, with trace: unresolved variable(s): <name>, and a resolved tracestate value that is not valid there (a comma, =, or a character outside printable ASCII) fails with trace.tracestate: invalid tracestate value for '<key>'.
trace:
enabled: true
baggage:
tenant: "{{tenant_id}}"
With tenant_id=acme, every request carries baggage: tenant=acme. A baggage header over the W3C limits (64 members or 8192 bytes) is still sent, with a warning, since servers may drop or reject it.
A secret used in a tracestate or baggage value is sent to the server as written (that is the point of baggage), and is redacted like any other secret in every output Rustman writes, in its percent-encoded baggage form too. Its headers are dropped on a cross-origin redirect, like any other header carrying a secret.
What is sent
With trace: {enabled: true}, each request carries a new traceparent:
traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01
Trace and span ids are random (from the operating system’s CSPRNG through rand) and never all zeros.
Headers you set yourself win
If a request file, a collection’s default headers or --header already sets traceparent, b3 or the X-B3-* headers, Rustman sends them unchanged and uses their ids instead of generating new ones. Formats the request does not set are added with those same ids. A tracestate or baggage header you set is never replaced either. A traceparent, b3 or X-B3-TraceId/X-B3-SpanId header you set that is not valid (uppercase hex, version ff, or not a trace context at all) is also sent unchanged, but Rustman then adds no trace header, records no trace id or link, and prints a warning, so the request never carries two conflicting traces. A B3 sampling decision without ids (b3: 0, b3: 1, b3: d, or X-B3-Sampled/X-B3-Flags without X-B3-TraceId and X-B3-SpanId) is valid B3: it is sent unchanged with no warning, and Rustman adds no trace header, so a deny decision is never overridden.
headers:
- name: traceparent
value: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
Signed requests
The headers are added before auth helpers sign the request, so an AWS SigV4 signature covers traceparent and the other trace headers.
CORS
Trace headers are custom request headers: a browser-facing API with a strict CORS policy may reject them in a preflight. That only matters when you replay Rustman’s requests from a browser; Rustman itself sends no preflight.
Request kinds
| Kind | Where the context goes |
|---|---|
http | The request’s headers, on every redirect hop. |
graphql | The HTTP POST or GET, the SSE subscription request, and the WebSocket upgrade request. |
jsonrpc | The HTTP request, or the WebSocket upgrade. A WebSocket connection is reused for the run (trace headers are not part of what decides the reuse), so calls sharing it share the handshake’s context. |
grpc | Request metadata (traceparent, b3, x-b3-*) on native gRPC; HTTP headers on gRPC-Web. |
ws | The WebSocket upgrade request. Frames carry no trace context, so the whole session shares the handshake’s. |
sse | The stream request, sent again on each reconnect. |
mcp | Every HTTP request of a Streamable HTTP or legacy HTTP+SSE server’s session. A stdio server has no HTTP layer and gets nothing. |
What is recorded
Every exchange that carried trace context (propagation on, or a traceparent/B3 header the request set itself, even with propagation off) records a trace object in history and in each request of a --reporter json run report (requests[].trace), and exploration findings record the ids of their evidence exchange (evidence.trace). Kinds without an HTTP exchange record the context of the request that opened them: a ws session and a graphql subscription over WebSocket the upgrade’s, an sse session and a graphql subscription over SSE the first stream request’s (a reconnect sends the context again but the record keeps the first), a jsonrpc call over WebSocket the handshake of the connection it shares, and a grpc call the metadata it sent (native) or its request’s headers (gRPC-Web); the traceresponse of the handshake or response headers is read as for HTTP. MCP requests carry the context on every HTTP request of a session but do not record it yet:
"trace": {
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "00f067aa0ba902b7",
"sampled": true,
"backend_trace_id": "0af7651916cd43dd8448eb211c80319c",
"baggage": "tenant=acme,api_key=«redacted:api_key»",
"start_ms": 1763372400000,
"end_ms": 1763372400084,
"link": "http://localhost:16686/trace/0af7651916cd43dd8448eb211c80319c"
}
Every field is optional in the schema except the ids and sampled, so reports and history written before tracing existed stay valid (rustman.report/v1 and rustman.history/v1 are unchanged). Trace and span ids are not secrets and are never redacted; tracestate, baggage and the link are redacted like any other output, so a secret baggage value shows as api_key=«redacted:api_key».
traceresponse and Server-Timing
A response’s W3C traceresponse header names the trace the server recorded. When its trace id differs from the one sent (the backend ignored the incoming context and started its own trace), it is recorded as backend_trace_id, both ids are kept, and links use the backend’s id. A malformed traceresponse is ignored.
The response’s Server-Timing metrics (db;dur=53.2;desc="query", app;dur=12) are parsed whether or not tracing is on and recorded per exchange as exchange.server_timings ([{"name": "db", "dur_ms": 53.2, "desc": "query"}]). The parser is lenient: it keeps each metric’s first dur and desc, and skips a malformed metric (logged at -vvv) while keeping the others. The TUI’s Timing tab draws them as sub-bars under the waiting phase.
Links
link names where a trace can be opened. A preset expands to a template that starts with link_base (required with a preset, in the same file or the other one; loading fails with trace.link: preset 'jaeger' needs trace.link_base when neither sets it):
| Preset | Template |
|---|---|
jaeger | {base}/trace/{trace_id} |
tempo | {base}/explore?left=… (Grafana Explore with a TraceQL query for {trace_id}) |
honeycomb | {base}/trace?trace_id={trace_id} |
datadog | {base}/apm/trace/{trace_id} |
A custom template may use {trace_id}, {span_id}, {start_ms}, {end_ms} (Unix milliseconds of the exchange), {trace_id_dd} (the lower 64 bits of the trace id in decimal, for Datadog setups that show 64-bit ids, such as https://app.datadoghq.com/apm/trace/{trace_id_dd}) and {{variables}}, resolved like baggage values. Any other {name} is reported when the workspace loads:
environments/staging.yaml:3: trace.link: unknown placeholder {traceid}
A link is opened in the system browser, so it must be an absolute http:// or https:// URL: a template that does not start with one fails when the workspace loads with trace.link: expected an http:// or https:// URL, got '<link>', and one that starts with a {{variable}} (or a preset whose link_base is not such a URL) is checked once resolved. A link whose variable cannot be resolved, or that does not resolve to an http(s) URL, only loses the links (a warning is logged); requests are still sent. The browser opener itself also refuses anything but an http(s) URL.
Opening a trace
-
CLI:
rustman sendprints the ids and the link on stderr, after the response:trace: 4bf92f3577b34da6a3ce929d0e0e4736 trace: http://localhost:16686/trace/4bf92f3577b34da6a3ce929d0e0e4736A
trace: backend <id>line appears when the server’straceresponsenamed another trace. -
rustman trace open <exchange-id>opens the link of a history exchange (its id or a unique prefix, asrustman history showtakes) in the system browser and prints it on stdout;--no-browseronly prints it. The link is built from the exchange’s ids and the link template configured now for the exchange’s environment. Without a template it exits with code 2 andtrace: no link template configured ([trace].link); an exchange that carried no trace context also exits with 2. -
TUI: the Timing tab shows the trace id, the backend’s id and the link, and
Ctrl+O(actiontrace.open) opens the link in the system browser.
The browser is opened with open (macOS), rundll32 url.dll,FileProtocolHandler (Windows) or xdg-open (Linux and the BSDs). The TUI shows the recorded (redacted) link; when it hides a secret variable, Ctrl+O rebuilds the real link from the template configured now and the active environment’s secrets, as rustman trace open does, and hands only that to the browser.
Exporting client spans (OTLP)
Rustman can also send its own side of each exchange to an OpenTelemetry collector, so a trace shows the client span next to the backend’s server spans. Export is a build feature and an explicit setting:
- Build: release binaries include the exporter. A plain source build has no exporter and no OpenTelemetry crate; build with
cargo install --path crates/rustman-cli --features otlp(orcargo build -p rustman-cli --features otlp). A build without it that finds export enabled printswarning: trace.export: this build cannot export spans (build rustman with theotlpfeature)and sends requests as usual. - Setting:
[trace.export]inrustman.toml(orexport:in an environment’strace:block, which replaces the whole table):
[trace.export]
enabled = true
endpoint = "http://localhost:4317"
protocol = "grpc" # or "http/protobuf"
service_name = "api-tests" # the spans' service.name; "rustman" by default
use_env = false
There is no default endpoint: enabled = true without one fails when the workspace loads with trace.export.endpoint is required when export is enabled. Enabling export also turns trace propagation on (exported spans need the ids the requests carried), as enabled = true in [trace] would.
| Key | Meaning |
|---|---|
enabled | Export spans. Off by default. |
endpoint | http:// or https:// collector address. With grpc, spans go to the opentelemetry.proto.collector.trace.v1.TraceService/Export method (HTTP/2, h2c for http://); with http/protobuf, to <endpoint>/v1/traces, or to the endpoint as written when it has a path of its own. |
protocol | grpc (default) or http/protobuf. |
service_name | The service.name resource attribute. |
use_env | Read the standard variables OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_(TRACES_)PROTOCOL and OTEL_EXPORTER_OTLP_(TRACES_)HEADERS (key=value,key2=value2, for an API key); they take precedence over the file. Off by default: an OTEL_EXPORTER_OTLP_* variable set in your shell is never read otherwise, so a shared collector configured for other tools never receives Rustman’s spans by accident. |
The exporter uses Rustman’s own HTTP stack (rustls with the platform’s trust store; no proxy), so it needs no system library.
What a span holds
One span of kind CLIENT per exchange that got a response and carried a sampled trace context, with the exchange’s trace and span ids (so the backend’s server span is its child) and its tracestate (redacted). Its name is the HTTP method, and it has the OpenTelemetry HTTP semantic-convention attributes:
| Attribute | Example |
|---|---|
http.request.method | GET |
url.full | https://api.example.com/users?token=«redacted:token» |
url.scheme, server.address, server.port | https, api.example.com, 443 |
http.response.status_code | 200 |
network.protocol.version | 1.1 |
error.type | the status code, for 4xx and 5xx (the span status is then ERROR) |
rustman.request.id | the request’s id in the workspace; for an exploration probe, <probe id>/<step> (cleanup for a cleanup delete) |
Every query value in url.full is replaced by «redacted:<key>» and every query component without = by «redacted», credentials in the URL become REDACTED:REDACTED and the fragment is dropped. Header values are never exported, so Authorization and cookies cannot leak this way. The phases (dns, connect, tls, waiting, download) are span events at the end of each phase, with rustman.phase.duration_ms. Request and response bodies are not exported.
Delivery and failures
Spans are built after an exchange completes and queued; a worker thread sends them in batches every 5 seconds (or as soon as 512 are waiting), so export never sits on a request’s path. The queue holds 2048 spans and drops the oldest when full. rustman send, rustman run and the other commands that send requests wait up to 5 seconds for the last batch before exiting; the TUI does the same when it quits, and prints the last export warnings once the terminal is restored.
Explorations export too: rustman explore run (and explore resume) and the agent’s explore tools send one client span per probe exchange (each step of a probe, and each cleanup delete) through the same exporter, with the [trace.export] of the exploration’s environment. Under scope: run every probe of an exploration shares one trace. rustman explore run waits up to 5 seconds for the last batch before exiting and prints export warnings like rustman run; the agent server, which outlives the exploration, lets the worker send them on its schedule.
A collector that is down, slow or refusing never changes a result: exchanges, assertions, reports and exit codes are the same as without export. Failures are shown as a warning at most once a minute, such as:
warning: trace export to localhost:4317 failed: cannot connect to localhost:4317: Connection refused (os error 111) (3 span(s) dropped; requests are unaffected)
The TUI shows OTLP →<host:port> in the status bar while the active environment exports spans. Export failures appear there as warning toasts, after the next send.
Library use
Front-ends and other transports use the same primitives from rustman-core’s trace module: TraceConfig (the settings block), TracePropagation (the settings resolved for a run, set on SendOptions::trace for rustman-http), and TraceContextInjector, the trait a transport implements to receive the headers or metadata when it does not go through rustman-http’s request builder, as native gRPC does. ClientSpan::from_record builds the exported span of a recorded exchange, and ExportTarget resolves [trace.export]; the exporter itself is rustman-http’s otlp feature, used through the runner, or through runner::SpanExport (record_exchange, flush, take_warnings) by senders that do not go through a runner, as explorations do.
Agents (MCP server)
rustman mcp serve runs Rustman as a Model Context Protocol server, so an AI agent (Claude Code, Claude Desktop, IDE agents, any MCP client) can use your workspace: its saved requests, environments, explorations and reports. The agent goes through the same engine and the same safety policy as you. It can’t read secret values, it is read-only unless rustman.toml says otherwise, and every call it makes is written to an audit log.
The server is built on the official Rust SDK, rmcp 3.10. It negotiates MCP protocol revisions up to 2025-11-25 through initialize.
Setup
Claude Code
From the workspace folder (or any folder below it):
claude mcp add rustman -- rustman mcp serve
Claude Desktop and other clients
Configure a stdio server whose command is rustman with the arguments mcp serve --workspace /path/to/workspace:
{
"mcpServers": {
"rustman": {
"command": "rustman",
"args": ["mcp", "serve", "--workspace", "/path/to/workspace"]
}
}
}
rustman mcp serve finds the workspace like every other command: --workspace <dir>, else the folder holding rustman.toml at or above the current one. Without a workspace it exits with code 2 before the handshake. The session starts in the active environment (--env, else RUSTMAN_ENV, else default_environment); an agent can switch environments for its own session only.
Over stdio, stdout carries only MCP messages. Warnings, errors and logs (-v, RUST_LOG) go to stderr, redacted.
HTTP mode
For clients that can’t spawn a process, --http serves the Streamable HTTP transport at /mcp:
rustman mcp serve --http # http://127.0.0.1:8765/mcp
rustman mcp serve --http 127.0.0.1:9000 --token-file ~/.config/rustman/mcp-token
HTTP mode is a convenience for local tools, not a hosted service. Three locks protect it:
- Loopback bind. The default address is
127.0.0.1:8765. A non-loopback address such as0.0.0.0:8765is refused with exit code 2 unless--allow-remoteis also given, and then a warning is printed. Requests whoseHostis not a loopback name are rejected. When--allow-remoteserves a non-loopback address thisHostcheck is off (on a loopback address it stays on), because remote clients reach the server under names it cannot know: the bearer token and the Origin check below are then the only locks, so keep the token secret and serve remote mode only on a trusted network. - Bearer token. Every request needs
Authorization: Bearer <token>. The token is read from--token-file(surrounding whitespace is ignored, and an empty file is an error) or generated at startup (32 random bytes, base64url) and printed once on stderr. A missing or wrong token gets401and never reaches MCP. Tokens are compared in constant time. - Origin check. A request carrying an
Originheader gets403unless the origin is a loopback origin (localhost,127.0.0.0/8,[::1]) or listed in[agent].allowed_origins. This stops a web page from driving the server through DNS rebinding.
There is no TLS and no OAuth: keep HTTP mode on the loopback interface.
Permissions: the [agent] table
Agent permissions come only from rustman.toml. No command-line flag raises them, so an agent that can run shell commands can’t relaunch the server with more rights, and a change to them shows up in git diff and code review.
Without an [agent] table, these defaults apply:
[agent]
allow_mutations = false # POST, PUT and PATCH
allow_destructive = false # DELETE and unknown methods (implies allow_mutations)
require_confirmation = true # mutations need a client that can ask the human
allowed_hosts = [] # empty: the hosts of the session's active environment
allowed_origins = [] # browser origins accepted in HTTP mode, besides loopback
max_output_bytes = 262144 # cap on one serialized tool result (256 KiB)
max_jobs = 2 # background jobs at once
plugin_kinds = [] # plugin request kinds agents may run (each counts as a mutation)
allowed_hosts and allowed_origins take origins written as scheme://host[:port], as [safety].allowed_hosts does. Unknown keys and invalid values are errors, so a misspelled permission is never ignored.
What an agent may send
Every request an agent triggers, saved or ad hoc, passes these checks before anything is sent:
- Method. By default only GET, HEAD and OPTIONS.
allow_mutations = trueadds POST, PUT and PATCH;allow_destructive = trueadds DELETE and every other method. A refused method getscode: "blocked"with the reasonmutations not allowed for agentsordestructive not allowed for agents. - Allowlist. The origin must be in
[agent].allowed_hosts, or, when that is empty, among thehttp(s)origins of the session’s active environment variables (base_url: http://127.0.0.1:8080/apiallowshttp://127.0.0.1:8080).[safety].allowed_hostsdoesn’t apply to agents. Anything else getscode: "blocked"with the reasonhost not allowed, and so does every redirect hop that leaves the allowlist. - Production. An environment marked
production: true, or a host in[safety].production_hosts, is refused: agents can’t confirm production hosts. - Confirmation. See below.
A request of a plugin kind is run by its plugin, under the plugin’s own grants, not sent by the agent gate. It runs only when plugin_kinds lists its kind, counts as a mutation (it needs allow_mutations and the human’s confirmation), and is audited with the kind as its method and <kind>:<request id> as its URL. An unlisted kind gets code: "blocked" with plugin kind '<kind>' not allowed for agents (list it in [agent] plugin_kinds). The network requests the workspace’s plugins send in an agent session must also reach an origin of the allowlist above, and each one gets an audit line (see Plugins).
All the requests of a session share one rate limit and one concurrency limit, from [safety].rate and [safety].concurrency, rpc_call calls included (over HTTP or WebSocket).
rpc_call sends JSON-RPC calls, which are all POSTs: instead of the method rule it only sends methods matching [jsonrpc] agent_read_only_methods, and refuses subscriptions; the allowlist and production checks apply as above. See JSON-RPC.
grpc_list, grpc_describe and grpc_call check a gRPC target as the http or https origin it is reached over (grpc://h:1 as http://h:1); grpc:// and grpcs:// values of the active environment count for the allowlist like http(s) ones. grpc_call calls unary and server-streaming methods only. Every gRPC call is a POST, so the method rule reads the proto instead: a method marked option idempotency_level = NO_SIDE_EFFECTS; is a read, and any other method is a mutation, which needs allow_mutations and the human’s confirmation like an HTTP POST. See gRPC.
graphql_introspect and graphql_query reach the endpoint through the same sender as rpc_call (allowlist, production check and rate limit, on every request and redirect hop). Every GraphQL operation over HTTP is a POST, so the method rule reads the operation instead: a query is a read, and a mutation needs allow_mutations and the human’s confirmation like an HTTP POST (refused with blocked: mutations not allowed for agents otherwise). Subscriptions, and saved requests with transport: ws or sse, are refused with code: "blocked". So are an endpoint URL that carries query, operationName or extensions parameters (some servers run those in place of the POSTed body, so the operation the human confirmed might not be the one that runs) and $file upload markers in the variables of an ad-hoc graphql_query operation (an agent can’t attach a workspace file; a saved request you wrote may still upload one). graphql_query validates the document against the request’s active schema before sending, as rustman graphql query does without --no-validate; an invalid document comes back with outcome: "errored" and nothing is sent. graphql_introspect reads the schema_file or the cached schema and introspects the endpoint only when there is neither, or with refresh: true; the result is cached in .rustman/graphql/schemas/ like rustman graphql introspect’s.
send_request and run_collection also run saved kind: kafka, kind: mqtt and kind: amqp request files. A produce is a mutation (refused with blocked: produce requires allow_mutations unless [agent] allow_mutations, then confirmed by the human), a consume from a named AMQP queue without requeue or through a persistent MQTT session (clean_session: false) is destructive, and every broker (and a Kafka schema_registry.url) must pass the allowlist as its http(s) origin (mqtt:// and amqp:// URLs of the active environment count; Kafka host:port brokers need [agent] allowed_hosts). Agent consumes stop after at most 100 messages or 60 s. See Messaging.
The EVM tools (evm_call, evm_decode, evm_tx, evm_block, evm_logs_query, evm_ens) are read-only: they reach nodes through the same sender as rpc_call (allowlist and rate limit), pass the JSON-RPC method guards, never take or send a signed transaction, and evm_logs_query spans at most 10,000 blocks. See EVM toolkit.
realtime_listen opens a WebSocket or SSE session and returns the messages it received, after at most 100 messages or 60 s. Its URL must pass the allowlist (a ws:// URL is checked as its http:// origin, wss:// as https://), and sending frames is a mutation: refused with blocked: sending frames requires allow_mutations unless [agent] allow_mutations, and confirmed by the human otherwise. See WebSocket and SSE.
send_request and run_collection compare snapshots in CI mode: an agent never writes or updates a snapshot file, and a missing snapshot fails the assertion.
Human confirmation
When mutations are allowed, each mutating request first asks the human, through MCP elicitation, with the method, the redacted URL and the environment:
An agent wants to send DELETE http://127.0.0.1:8080/users/7 (environment 'local'). Allow it?
Only an explicit yes sends the request. Declining or dismissing the question gets code: "declined". A client that doesn’t support elicitation gets code: "confirmation_unavailable", unless require_confirmation = false: that setting accepts unattended mutations and should be used only when you trust the agent’s every call. A client that supports elicitation is always asked, whatever the setting. If asking fails, the call fails with confirmation_unavailable.
Clients that speak the stateless 2026-07-28 revision can’t receive elicitation requests from the server, so for them mutations fail closed with confirmation_unavailable (or need require_confirmation = false).
Tools
Every tool declares an input and an output JSON Schema, and returns structuredContent that conforms to its output schema, plus a one-line summary as text. Tools are thin adapters over the same engine calls the CLI makes.
The reference below is generated from the tool schemas that tools/list returns; a test keeps it in sync.
| Tool | Arguments (required) | Read-only | Description |
|---|---|---|---|
list_requests | collection, kind, text, cursor, limit | yes | List the workspace’s saved requests, filtered by collection folder, kind or text, 50 per page. |
get_request | path | yes | Read one saved request file by its id or path. Secrets appear as {{name}} references, never as values. |
list_environments | none | yes | List the environments: names, which is active in this session, and variable and secret names. |
select_environment | name | yes | Make an environment active for this session only; nothing is written to disk. |
send_request | path, vars, method, url, headers, body, timeout_ms | no | Send a saved request (path, optional vars) or an ad-hoc one (method, url, headers, body) through the safety policy. Returns the redacted exchange. |
run_collection | path, filter, vars, bail | no | Run the requests under a folder or file like rustman run, in the background. Returns a job_id; get_report with it gives the run report. |
import_openapi | spec, into, dry_run | no | Import an OpenAPI document (a workspace file or an allowed URL) as a request collection. dry_run (the default) only reports what would change. |
explore_plan | spec, target, probes, operations, seed, fuzz_cases, allow_mutations, allow_destructive, cursor, limit | yes | Plan the probes of an exploration against a target without sending anything. Review it before explore_run. |
explore_run | spec, target, probes, operations, seed, fuzz_cases, allow_mutations, allow_destructive, cursor, limit, max_probes, max_duration_ms, fail_on | no | Start an exploration in the background (read-only unless rustman.toml allows more). Returns a job_id and exploration_id. |
explore_status | id | yes | The phase, progress and findings by severity of an exploration, by job_id or exploration_id (default: the latest). |
explore_cancel | job_id | no | Stop a running exploration job. It stays resumable with rustman explore resume <id>. |
get_report | id, format | yes | A report by exploration id, run job id or JSON report file of the workspace (such as out/report.json): a summary (default), or rendered as json, markdown, junit, sarif or html. |
list_findings | exploration_id, severity, operation, cursor, limit | yes | The findings of an exploration (default: the latest), filtered by minimum severity and operation, 50 per page. |
search_history | url, method, status, since, until, cursor, limit | yes | Search recorded exchanges by URL text, method, status range (500-599, 5xx, 404) and time range, newest first, 50 per page. |
rpc_call | path, endpoint, method, params, vars, timeout_ms | no | Send one JSON-RPC call (endpoint, method, params) or a saved jsonrpc request through the safety policy. Only methods matching [jsonrpc] agent_read_only_methods are sent; subscriptions are refused. |
realtime_listen | path, url, frames, max_messages, duration_ms, vars | no | Open a WebSocket (ws:// or wss:// url) or SSE (http(s):// url) session, or a saved ws or sse request, through the safety policy, optionally send initial frames (a mutation: needs [agent] allow_mutations), and return the redacted messages received, after at most 100 messages or 60 s. |
graphql_introspect | endpoint, path, type_name, refresh, vars | yes | The schema of a GraphQL endpoint or saved graphql request: its schema_file or cached schema, else (or with refresh) introspected through the safety policy and cached. Lists the root and named types, or describes type_name. |
graphql_query | path, endpoint, query, operation_name, variables, headers, vars, timeout_ms | no | Validate and send a GraphQL query or mutation (endpoint, query, operation_name, variables, headers) or a saved graphql request over HTTP through the safety policy. A mutation needs [agent] allow_mutations and the human’s confirmation; subscriptions are refused. Returns the redacted data and errors. |
list_webhook_captures | path, method, verdict, since, cursor, limit | yes | List the webhook captures saved to request history from the webhook inspector, newest first, filtered by path text, method, signature verdict and time, 50 per page. Redacted; nothing is replayed. |
grpc_list | target, path, refresh, vars | yes | List the services and methods (with call types) of a gRPC target or saved grpc request, by reflection or its schema, through the safety policy’s allowlist. |
grpc_describe | symbol, target, path, refresh, vars | yes | Describe a gRPC service, method (with a request message template) or message of a target or saved grpc request. |
grpc_call | path, target, method, message, metadata, deadline_ms, vars | no | Call a unary or server-streaming gRPC method (target, method, message, metadata) or a saved grpc request through the safety policy. Returns the redacted status, metadata and messages; streams stop at 100 messages or 30 s. |
evm_call | path, rpc, to, abi, function, args, block, from, estimate, vars | yes | Run a read-only eth_call (a saved evm-call request, or rpc, to, abi, function, args, block) through the safety policy and return the decoded outputs or revert, with the node’s chain and client. Never signs or sends a transaction. |
evm_decode | abi, data, topics | yes | Decode call data, revert data or (with topics) a log with an ABI (erc20, erc721, erc1155 or a workspace ABI file), offline. |
evm_tx | hash, rpc, vars | yes | Read a transaction and its receipt by hash, with input data and logs decoded (token amounts in token units). |
evm_block | block, rpc, vars | yes | Read a block by number, tag or hash: number, hash, timestamp, gas and transaction count. |
evm_logs_query | from_block, to_block, addresses, event, topics, rpc, vars | yes | Query logs by address, event signature and topics over a block range of at most 10000 blocks, decoded. |
evm_ens | target, rpc, vars | yes | Resolve an ENS name to an address, or an address to its primary name verified by a forward lookup (needs a mainnet endpoint or [evm] ens_rpc). |
Some tools belong to an optional capability and are registered only when rustman-mcp is built with its cargo feature: graphql_introspect and graphql_query with graphql, list_webhook_captures with webhook, and grpc_list, grpc_describe and grpc_call with grpc. All three features are on by default, so the rustman binary has every tool. A build without a feature (for example --no-default-features --features grpc) doesn’t list its tools in tools/list, and calling one gets a protocol error, like any unknown tool.
list_webhook_captures reads the captures you saved to request history from the webhook inspector (save to history, request webhook). The agent server runs no listener, so a capture that was never saved isn’t visible to agents. The captures were redacted when saved and are redacted again on the way out; bodies longer than the inline limit come with a body_ref like send_request’s.
Notes:
- Saved and ad-hoc requests go through the runner like
rustman send: variables, auth, assertions, captures and history all apply. Requests with OAuth2 auth can’t be sent by agents, because the token flow may need a browser; runrustman auth loginand send them yourself. Requests with Digest auth are refused with an error rather than sent without credentials, because the agent path does not answer the challenge; send them withrustman send. explore_planandexplore_runread the document from a workspace file or from anhttp(s)URL on a host agents may reach. The target must be such a host too. The seed defaults to0, so a plan stays the same between its pages and theexplore_runthat follows; passseedto vary the fuzz cases. Probes are read-only unless the agent asks forallow_mutations(orallow_destructive) and[agent]allows it; a mutating exploration asks the human first.import_openapiwithdry_run: falsewrites workspace files, so it asks the human first, like a mutation (and fails withconfirmation_unavailablewhen the client can’t ask, unlessrequire_confirmation = false). The running session keeps the request list it started with; reconnect to see the new files.run_collectionandexplore_runstart background jobs; see below.
Background jobs
explore_run and run_collection answer within 2 seconds with a job_id and keep working in the background, so an agent never waits on a long call. At most max_jobs jobs (2 by default) run at a time across every session of the server; a further job-starting call, from any session, gets code: "busy" until one ends. A cancelled job keeps its slot until its work has really stopped.
- Status.
explore_statusreports an exploration’s state (running,completed,cancelled,interruptedorfailed), phase, probes done out of the total, and findings by severity.get_reportwith a run’sjob_idreturns the run report once the run ends; while it runs, the error message says how far it got (job-1 is still running (2/5 requests)). A report file is read only inside the workspace (a symlink leading out of it is refused) and up to 32 MiB; a file that is not a report is refused without quoting it. - Progress. When the
tools/callthat started a job carried a progress token (_meta.progressToken), the server sendsnotifications/progressfor that token every 2 seconds while the job runs, and once more when it ends.progresscounts probes or requests done,totalis the job’s size, andmessagereads likejob-1 running: 12/51 probes. Messages are redacted like every other output. Thetools/callitself has already answered with thejob_id, so these notifications arrive after its response; this is how the server keeps a long job visible without making the agent wait. The MCP specification expects progress to stop when its request completes, so a strict client may drop them or log them under an unknown token. Pollexplore_statusorget_reportwhen yours does. - Cancellation.
explore_cancelwith thejob_id(or exploration id) stops an exploration; an MCPnotifications/cancelledfor thetools/callthat started an exploration or a run does the same, if the client still sends one after that call answered (many clients only cancel requests still pending, so preferexplore_cancel). Cancelling stops dispatching new probes or requests, lets those in flight finish for up to 10 seconds, and still cleans up what the probes created, exactly like Ctrl+C onrustman explore run. The job’s status becomescancelled. - Resuming. An exploration is journaled under
.rustman/explorations/<id>/like one started from the terminal, so a cancelled exploration stays resumable:rustman explore resume <exploration_id>runs the probes that did not finish, and never sends one twice. A run’s report stays available for the session; an exploration’s report is written next to its journal.
Resources
| URI | Content |
|---|---|
rustman://requests/<path> | A request file of the workspace, by its path (users/get-user.rman.yaml) |
rustman://reports/<id> | A rustman.report/v1 report: an exploration id, or the job id of a finished run |
rustman://schemas/<name> | report (the report JSON Schema) or an imported OpenAPI snapshot from .rustman/openapi/ |
rustman://bodies/<id> | The whole redacted body of a truncated response (body_ref) |
Every content is redacted. A path with .., a root, a drive or a backslash is refused before anything is read, and only files the workspace loaded as requests are readable under rustman://requests/.
Prompts
explore-api(argumentsspec,target) guides an agent throughexplore_plan, reviewing the plan with the human,explore_run, pollingexplore_status, thenget_reportandlist_findings.triage-findings(argumentexploration_id) guides an agent through grouping an exploration’s findings by root cause, with reproduction steps and a proposed fix per cause.
Secrets and redaction
An agent can refer to secrets by name but never read their values, in any form. Engine output is already redacted; the server then runs a second pass over the final JSON of every tool result, resource, log and progress message, which replaces:
- every value of the session environment’s secrets, and of the secrets and credentials of every request sent in the session, in the forms the redactor matches (JSON, URL and HTML encodings) plus their base64 forms (standard and URL-safe, padded or not), with
«redacted:<name>»; - the values of the
Authorization,Proxy-Authorization,Cookie,Set-CookieandX-Api-Keyheaders wherever a header appears, with«redacted:<Header-Name>»; - literal credentials pasted into tracked request and collection files: those headers’ values and the credentials of
authblocks (a Basic password, a Bearer token, an API key value). They are redacted in every output, including the file textget_requestandrustman://requests/return. Literals shorter than 6 characters are too common to replace everywhere and stay visible in file text; use a{{secret}}reference for any credential.
A backend that echoes Authorization: Bearer <api_token> into its body is shown as Bearer «redacted:api_token». Other transforms of a secret (hashing, encryption, custom encodings) are not recognized.
Output limits
- A tool result whose JSON exceeds
max_output_bytes(256 KiB by default) is refused withcode: "invalid_input": narrow the request or page through it. - A response body over 32 KiB is cut to its first 32 KiB with
truncated: true, its fullsizein bytes, and abody_refsuch asrustman://bodies/b3. The whole redacted body stays readable throughresources/readwhile the session keeps it: each session keeps up to 64 MiB of bodies, dropping the least recently used first. - Lists return 50 items by default with a
next_cursorwhen more exist. Pass it back to get the next page; the last page has none. A cursor from a list that has changed since is refused.
Audit log
Every tool call appends one JSON line to .rustman/audit/<YYYY-MM-DD>.ndjson (UTC date) with the timestamp, session id, client name, tool, redacted arguments, outcome (ok, error, blocked or declined), the reason of a failed call and, for outbound requests, the method and redacted URL:
{"timestamp":"2026-11-18T10:04:12.311Z","session":"9f1c…","client":"claude-code","tool":"send_request","arguments":{"method":"POST","url":"http://127.0.0.1:8080/users"},"outcome":"blocked","reason":"mutations not allowed for agents","method":"POST","url":"http://127.0.0.1:8080/users"}
Plugin network requests in agent sessions get a line each too, with session plugins, client plugin and tool plugin:<name>.
Lines are appended with one write each; the server never rewrites or deletes them. Retention is up to you (the files are small). The audit log fails closed: if it can’t be written, the call is refused before it runs, or fails if the line can’t be appended afterwards. A background job checks it before each request it sends, so once the log can’t be written the job sends nothing more. .rustman/ is git-ignored by rustman init.
Error codes
Tool errors are tool results with isError: true and structuredContent {"code": "...", "message": "..."}, not protocol errors:
| Code | Meaning |
|---|---|
not_found | The request, environment, report or resource does not exist |
invalid_input | Malformed arguments, a stale cursor, or a result over max_output_bytes |
blocked | Refused by the agent permissions or the safety policy; the message is the reason |
declined | The human declined or dismissed the confirmation |
confirmation_unavailable | A mutating call needs confirmation and the client can’t ask |
busy | Too many background jobs are running (max_jobs) |
internal | Anything else, such as a network error or an audit log that can’t be written |
MCP client
Rustman can connect to other MCP (Model Context Protocol) servers as a client, to explore and test them like any other API. This page covers server definitions, workspace trust, the transports and the session lifecycle, tools, resources, prompts and completion, notifications, progress and cancellation, server-initiated requests, OAuth, kind: mcp request files with their assertions, captures, runs and history, rustman mcp-client, and the TUI MCP inspector. Rustman as an MCP server for agents is a separate feature, described in Agents (MCP server).
Server definitions
MCP servers are defined by name, either in rustman.toml:
[mcp_servers.files]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "."]
env = { LOG_LEVEL = "info", API_TOKEN = "{{api_token}}" }
cwd = "fixtures" # optional; default: the workspace root
[mcp_servers.remote]
url = "{{mcp_base}}/mcp"
headers = { X-Team = "core" }
auth = { type = "bearer", token = "{{mcp_token}}" }
timeout_ms = 30000 # optional
or one per file in mcp/servers/<name>.yaml (the file name is the server name):
url: "{{mcp_base}}/mcp"
headers:
X-Team: core
auth:
type: bearer
token: "{{mcp_token}}"
| Key | Applies to | Meaning |
|---|---|---|
command | stdio | The program to spawn. |
args | stdio | Its arguments. |
env | stdio | Variables set for the process. The process inherits only a few of Rustman’s own variables (see Transports); everything else it needs goes here. |
cwd | stdio | Its working directory, relative to the workspace root (default: the root). |
url | HTTP | The server’s MCP endpoint. |
headers | HTTP | Headers sent with every request. |
auth | HTTP | Any auth helper (bearer, basic, api_key, …). |
oauth | HTTP | A pre-registered OAuth client: client_id, client_secret, scopes (see OAuth). |
roots | both | The roots answered to the server’s roots/list (default ["{{workspace}}"]). |
timeout_ms | both | The request timeout of this server (default 60 000). |
A server has either command (a stdio server) or url (an HTTP server). A definition with both fails to load with mcp: server <name> must define either command or url, not both; one with neither, or with keys of the other transport, fails too. Server names use letters, digits, -, _ and ., and a name may be defined only once across rustman.toml and mcp/servers/. Unknown keys are errors.
Every string value supports {{variable}} interpolation from the active environment, its secrets and [variables], resolved when a session is opened. Secret values are redacted from everything a session shows: its stderr log, errors and history.
Workspace trust
Spawning a stdio server runs a command the workspace chose, so Rustman asks first. Before a stdio server is spawned for the first time, or after its command, args, cwd, env keys or literal env values change, the full command line is shown and nothing is spawned until you confirm. Headless commands refuse an untrusted server with:
mcp: server files is not trusted; review it or pass --trust
--trust approves the server as it is defined now.
Approvals are kept per machine in .rustman/trust.yaml (git-ignored, readable by you only; trust is never shared through Git). An approval covers a SHA-256 fingerprint of the command, args, env (sorted by key) and cwd. A secret substituted into any field counts only by its name, so rotating a secret never asks again, while adding an env variable, changing a literal env value (such as PATH or NODE_OPTIONS, which decide what code runs) or changing an argument does. HTTP servers run nothing locally and need no approval.
Each entry is sealed with an HMAC-SHA256 under a key that never leaves this machine: 32 random bytes in trust.key in your data directory ($RUSTMAN_DATA_DIR, else ~/Library/Application Support/rustman on macOS, $XDG_DATA_HOME/rustman or ~/.local/share/rustman on Linux, %APPDATA%\rustman on Windows), created with the first approval and readable by you only. The seal also covers the workspace’s location. A trust file that came with a workspace (committed, or inside a downloaded archive with no Git at all), copied from another machine or from another workspace therefore approves nothing, and the server is asked about (or refused headless) as if it were new. Moving a workspace folder, or deleting trust.key, asks again.
As a second guard, a trust file that Git tracks or does not ignore, or that is a symbolic link, is refused rather than read:
refusing .rustman/trust.yaml: Git tracks it or does not ignore it; delete it and approve the servers again
.rustman/trust.yaml is a small library store other features can reuse: each entry maps a subject (here mcp/<name>) to the seal of the approved fingerprint.
Transports
stdio. The server is spawned with its args and cwd, and speaks newline-delimited JSON-RPC over stdin and stdout. Its environment is not Rustman’s: it gets only PATH, HOME, USER, LOGNAME, SHELL, TERM, LANG, LC_ALL, LC_CTYPE, TMPDIR, TEMP and TMP (on Windows also SystemRoot, SystemDrive, windir, ComSpec, PATHEXT, USERPROFILE, APPDATA, LOCALAPPDATA, ProgramData, ProgramFiles, ProgramFiles(x86), HOMEDRIVE, HOMEPATH, NUMBER_OF_PROCESSORS and PROCESSOR_ARCHITECTURE) when they are set, plus the definition’s env over them. Tokens and credentials in your shell (GITHUB_TOKEN, AWS_*…) never reach a server unless its definition passes them, for example env = { GITHUB_TOKEN = "{{github_token}}" }. Everything it writes to stderr goes to the session’s stderr log (secrets redacted), never into the protocol stream. If the process exits on its own, the session is marked disconnected with the exit code and the last 50 stderr lines. Disconnecting closes stdin, waits 5 seconds for the process to exit, then kills it together with every process it started, so a server behind a launcher such as npx, uvx or sh -c is not left running (on Unix the server runs in a process group of its own; on Windows its process tree is killed with taskkill). On Windows a bare command such as npx is looked up with PATHEXT, so npx.cmd and .bat launchers are found. A server that does not answer initialize within its timeout (--timeout of rustman mcp-client, else timeout_ms, default 60 s) fails with mcp: request timed out after 60s. Each stderr line keeps at most 4 KiB (the rest is replaced by [truncated]), and a message larger than 16 MiB (a stdio line, or an HTTP server’s event) ends the session, so a misbehaving server cannot exhaust memory; the requests in flight fail with mcp: server <name>: the server sent a message larger than 16 MiB; the session was closed.
Streamable HTTP. Requests go through Rustman’s HTTP engine, so the workspace TLS settings and proxies apply, plus the definition’s headers and auth. The Mcp-Session-Id the server assigns is sent on every following request, responses may be JSON or SSE streams, and the session is deleted on disconnect.
Legacy HTTP+SSE. If the server answers the initialize POST with a 4xx status other than 401, Rustman retries with the pre-2025 transport: it GETs the same URL as an event stream, waits for the endpoint event, and POSTs messages there. Such sessions are labelled legacy SSE.
Initialization
Rustman sends initialize with protocol version 2025-11-25, client info rustman/<version> and the roots, sampling and elicitation capabilities, then notifications/initialized. A server answering with an older supported version (2024-11-05, 2025-03-26, 2025-06-18) gets a session in that version; any other version closes the session with mcp: unsupported protocol version <v>.
After initialization the session shows the server name, version and title, the negotiated protocol version, the server’s instructions, and its declared capabilities (tools, resources with subscribe and listChanged, prompts, logging, completions). Operations of capabilities the server does not declare are disabled with a reason such as server does not declare prompts.
Tools
tools/list follows nextCursor until the list is complete (at most 100 pages; more fails with mcp: tools/list returned more than 100 pages) and shows each tool’s name, title, description, annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), input schema and output schema. When the server sends notifications/tools/list_changed, a listed toolset is fetched again.
Argument forms. A tool’s inputSchema becomes a form: typed inputs for strings, numbers, integers and booleans, a picker for enum (and const), nested objects, arrays whose items are added and removed, a variant picker for oneOf/anyOf, required markers, defaults and descriptions. A subtree using any other keyword (patternProperties, $ref, …) is edited as raw JSON, and the raw JSON editor is always available for the whole arguments object.
Validation. Arguments are validated against inputSchema before tools/call is sent (with the same jsonschema engine as the schema assertion), and violations block the call, each named by its JSON pointer:
mcp: invalid arguments: /path: required property missing
--no-validate (CLI) or an explicit confirm (TUI) sends the call anyway; the overridden violations are kept with the result for history.
Results. Each content item is shown by type: text, image and audio (type and size), resource links, and embedded resources (their text, or the size of their blob). structuredContent is shown as JSON. A result with isError: true is labelled tool error; a JSON-RPC error is labelled protocol error <code> (for example protocol error -32602). When the tool declares an outputSchema, structuredContent is validated against it, and each violation (such as /count: expected integer, or /: structuredContent missing) is reported as a warning (and, in rustman run, a failure of the implicit output_schema assertion).
Resources
resources/list and resources/templates/list follow every page. resources/read shows each content item’s URI, MIME type and text, or its base64 blob. Templates are expanded from the parameters you enter (RFC 6570 {var}, {+var} for reserved characters such as /, and {a,b} lists); template file:///{path} with path=README.md reads file:///README.md. When the server declares resources.subscribe, you can subscribe to a resource: its notifications/resources/updated appear in the notifications stream with an offer to read it again.
Prompts and completion
prompts/list follows every page and shows each prompt’s arguments with required markers; prompts/get checks required arguments first (mcp: invalid arguments: /code: required property missing) and shows the returned messages with their roles and content types. When the server declares completions, the forms of prompt arguments and resource-template parameters ask completion/complete as you type, 250 ms after the last keystroke, and offer the returned values.
Notifications, progress and cancellation
Every server notification of a session (log messages with level and logger, progress, list changes, resource updates, cancellations) is kept in a timestamped stream, with secrets redacted. When the server declares logging, you can set its log level (logging/setLevel); messages below the level are no longer sent.
Every request carries a progressToken, and progress notifications update the request’s progress indicator. The notifications received while a request runs are kept with its result (at most 200). A request times out after 60 seconds by default; timeout_ms on the server definition, or on a request file, changes that. On timeout Rustman sends notifications/cancelled and the request fails with mcp: request timed out after 60s; cancelling it yourself sends the same notification and ends it with cancelled by user.
Server-initiated requests
A server may ask the client to sample an LLM (sampling/createMessage) or to ask you something (elicitation/create). Rustman never answers either on your behalf:
- Sampling. The TUI shows the full messages, system prompt, model preferences and max tokens, and nothing is returned until you reject the request or type (or edit) the response. A pending request shows a badge until it is handled. Headless commands reject it with JSON-RPC error
-1User rejected sampling requestand print a warning naming the request, unless--sampling-response <file>gives a canned answer: a JSONCreateMessageResultsuch as{"role": "assistant", "content": {"type": "text", "text": "..."}, "model": "human"}. - Elicitation. The TUI shows the server’s message and a form generated from
requestedSchema; you chooseaccept(with content that passes the schema, formats such asemailincluded),declineorcancel. Headless commands decline and print a warning.
There is no setting that approves these requests automatically.
Roots. Rustman declares the roots capability and answers roots/list with the definition’s roots as file:// URIs: {{workspace}} is the workspace root, relative paths are taken from it, and file:// URIs are kept. Without roots, the answer is exactly the workspace root. Changing the roots during a session sends notifications/roots/list_changed.
OAuth
When an HTTP server without auth answers 401, Rustman logs in with OAuth 2.1:
- It reads the protected resource metadata (RFC 9728) named by the
resource_metadataparameter of theWWW-Authenticatechallenge (or at/.well-known/oauth-protected-resource), then the metadata of its authorization server (RFC 8414, with the OpenID Connect discovery URL as fallback). The advertisedresourcemust be the server URL or a parent of it on the same origin, and the authorization server’sissuerthe URL it was looked up for; otherwise the login stops before the browser opens (mcp: oauth: the protected resource <resource> does not match the server URL <url>), so a server cannot obtain a token meant for another API. The issuer and the authorization, token and registration endpoints must usehttps(httponly on a loopback host such as127.0.0.1orlocalhost); any other URL stops the login before anything is opened or sent (mcp: oauth: refusing OAuth URL <url>: it must use https (http only on a loopback host)), so a server cannot have your browser handler open afile:or custom-scheme URL, or have a code or client secret sent in plain text. - It registers itself as a public client when the authorization server offers dynamic client registration (RFC 7591); otherwise it uses the definition’s
oauth.client_id. With neither, the connection fails withmcp: oauth requires client_id for <server>. - It opens the authorization URL in your browser (and prints it) with PKCE (
code_challenge_method=S256), theresourceparameter naming the MCP server (RFC 8707) and the scopes (oauth.scopes, else the ones the resource advertises), and waits for the redirect on a loopback listener (http://127.0.0.1:<port>/callback). When the browser cannot reach it (over SSH, say), paste the URL the browser was redirected to. - It exchanges the code for tokens and retries the connection.
[mcp_servers.remote]
url = "https://mcp.example.com/mcp"
oauth = { client_id = "rustman-cli", scopes = ["mcp:read"] }
Tokens are stored only in the OS keychain (or, without one, in the git-ignored .rustman/secrets.yaml), under mcp/<hash of the server name and URL>, together with the token endpoint and client, so an expired access token is refreshed with its refresh token without opening the browser. A failed refresh drops the tokens and the next 401 starts a new login. Token values (and a client secret) are redacted from everything the session shows, and the Authorization header is always shown as «redacted:Authorization». rustman mcp-client logout <server> deletes them. Headless commands cannot log in: a server that needs a login fails until you connect once from a terminal.
Request files
A request file with kind: mcp saves an MCP call so it can be replayed and asserted on in CI:
version: 1
kind: mcp
name: Search for rust
server: files # a server of the workspace
operation: tools/call
params:
name: search
arguments:
q: rust
token: "{{api_token}}" # string values are interpolated
timeout: 30s # optional: replaces the server's timeout
validate: false # optional: send arguments that break inputSchema
assertions:
- is_error: false
- content_text_contains: found
- structured: {path: $.count, gt: 0}
captures:
- {var: count, from: json, path: $.count}
| Field | Meaning |
|---|---|
server | The name of a server the workspace defines. |
operation | tools/list, tools/call, resources/list, resources/read, prompts/list or prompts/get. |
params | name and arguments for tools/call and prompts/get, uri for resources/read. String values support {{variable}} interpolation; keys and other values are kept as written. A missing name or uri fails to load with mcp: tools/call requires params.name (a string). |
timeout | The request timeout (500ms, 30s, 2m), above the server’s timeout_ms. |
validate | false sends tool arguments that break inputSchema (recorded in history). |
variables | Variables of this request, as in kind: http. |
assertions, captures | See below. |
The TUI saves the current call as such a file (see the inspector); a saved call is written field by field, and a loaded file keeps its own text.
Assertions and captures
Besides latency and the generic json, body and schema checks (which read the MCP result as JSON), mcp requests have their own assertions:
| Assertion | Passes when |
|---|---|
is_error: true / false | The tool result has (or has not) isError: true. |
content_text_contains: <text> | Some text content item (or embedded text resource) contains the text. |
structured: {path, <op>: value} | A JSONPath check rooted at structuredContent: $.count is structuredContent.count. |
output_schema: true | structuredContent matches the tool’s outputSchema. Implicit for every tool that declares one; write output_schema: false to expect a violation. |
tool_exists: <name> | A tools/list result has the tool. A failure lists the available tools: tool_exists: expected a tool named "search", got available tools: read, write. |
A snapshot assertion compares the MCP result (the JSON the server answered, with no status or headers) with a stored snapshot, recorded under __snapshots__/ like those of HTTP requests.
Expected values support {{variable}} interpolation. Captures read structuredContent when the result has it, else the text content: from: json with $.count reads structuredContent.count (or the text, when it is JSON), and from: body_regex reads the text. For resources/read they read the text contents; for the list operations, the result JSON.
In rustman run
rustman run executes kind: mcp files in collection order with the other kinds. All mcp requests of a run that target the same server share one session: it is initialized once (a stdio server is spawned once) and shut down at the end of the run. Runs are headless: an untrusted stdio server makes its requests error with mcp: server <name> is not trusted; review it or pass --trust unless rustman run --trust is given, sampling is rejected and elicitation declined (each with a warning on the request), and an OAuth login is only possible from a terminal.
A connection, protocol, validation or timeout error marks the request errored; failed assertions mark it failed, as for HTTP requests.
Sending a kind: mcp file from the TUI workbench (Ctrl+Enter on an open file) runs it the same way, with one session for that send: a stdio server must have been approved first (in the inspector, or with --trust), and OAuth uses the tokens already stored. The agent MCP server’s execution tools (send_request, run_collection; see Agents) do not connect to other MCP servers: they skip kind: mcp requests as an unsupported kind, so an agent cannot spawn workspace commands through them.
History
Every MCP operation of a run is recorded in request history. The entry’s request is the method (such as tools/call), the server’s URL (or stdio:<command line>), its headers (credentials such as Authorization stored as «redacted:Authorization») and the params; its record adds an mcp object:
{
"server": "files",
"transport": "stdio",
"protocol_version": "2025-11-25",
"method": "tools/call",
"params": {"name": "search", "arguments": {"q": "rust", "token": "«redacted:api_token»"}},
"result": {"content": [{"type": "text", "text": "found 3 files"}], "isError": false},
"outcome": "ok",
"duration_ms": 12.5,
"notification_count": 5,
"notifications": [{"at": 1763460000000, "type": "progress", "token": "1", "progress": 20.0, "total": null, "message": null}]
}
outcome is ok, tool error, protocol error <code>, cancelled or error; error holds the message when there is no result. At most 200 notifications are kept (notification_count counts them all), and validation_override lists input violations sent anyway. Params, results, notifications and errors are redacted with every secret of the run and the session’s OAuth tokens. MCP entries cannot be replayed with rustman history replay.
rustman mcp-client
rustman mcp-client tools <server> [--json]
rustman mcp-client call <server> <tool> [--args <json> | --arg k=v | --arg k:=<json>]... [--no-validate]
[--sampling-response <file>] [--json]
rustman mcp-client resources <server> [--read <uri>] [--json]
rustman mcp-client prompts <server> [--get <name> [--arg k=v]...] [--json]
rustman mcp-client logout <server>
<server> is a server of the workspace, stdio:<command line> (split like a shell: stdio:npx -y @modelcontextprotocol/server-everything), or an http:// / https:// URL. A command line typed after stdio: is your own, so it runs without a trust prompt and nothing is recorded; a workspace server needs this machine’s trust or --trust. Ad-hoc servers work outside a workspace too.
| Flag | Effect |
|---|---|
--json | Print the MCP result as JSON instead of text. |
--trust | Approve (and record) an untrusted stdio server of the workspace. |
--timeout <duration> | The request timeout, initialize included (default: the server’s timeout_ms, else 60s). |
--env <name> | The environment whose variables and secrets fill the server definition. |
--args <json> | call: the arguments as one JSON object. |
--arg k=v | call: a string argument; --arg k:=<json> gives any JSON value (--arg limit:=10). prompts --get: a prompt argument. |
--no-validate | call: send arguments that break the tool’s inputSchema. |
--sampling-response <file> | call: answer sampling requests with this CreateMessageResult instead of rejecting them. |
The text output lists one tool per line with its annotations (search [read-only]) and description, one resource per line (file:///notes.md notes text/markdown), prompts with their arguments (review (code*), * marks required ones), a tool result’s content items and structuredContent (with tool error first for an isError result and warning: outputSchema: ... lines for violations), and a prompt’s messages as role: content.
| Exit code | When |
|---|---|
| 0 | The operation succeeded. |
| 1 | The tool returned isError: true (its content is printed), or the server answered with a JSON-RPC error (error: mcp: protocol error -32602: ...). |
| 2 | A usage, definition or trust problem: an unknown server, invalid arguments, a server that is not trusted. |
| 3 | The server could not be started or reached, failed, or did not answer in time. |
| 130 | Interrupted with Ctrl+C (on Unix also SIGTERM or SIGHUP): the request in flight is cancelled (notifications/cancelled) and the server is stopped with every process it started, after its 5-second grace period. A second Ctrl+C quits at once, still killing the server’s processes first. |
rustman mcp-client tools https://mcp.example.com/mcp --json
rustman mcp-client call files read --arg path=missing # prints the content, exits 1
rustman mcp-client resources files --read file:///README.md
rustman mcp-client prompts files --get review --arg code='fn main() {}'
The TUI MCP inspector
Alt+I (or MCP inspector in the command palette) opens the inspector in place of the request and response panes; Esc or Alt+I hides it, and the session keeps running.
- Servers. The left column lists the workspace’s servers with their transport and status (
○idle,…connecting,●connected,✗failed).Enterconnects;ddisconnects. A stdio server that is not trusted yet shows its full command line, working directory and env variables (KEY=value, the values of secrets and of variables named like one, such asAPI_TOKEN, redacted) first, and nothing runs until you pressy(which records the approval in.rustman/trust.yaml);ncancels. An HTTP server that asks for OAuth opens the authorization URL in your browser and shows it in a toast; the session connects once the browser reaches the loopback redirect, and the tokens are kept in the workspace’s secret store as forrustman mcp-client. - Session. The title shows the server name and version, the transport and the negotiated protocol version; the first line lists the declared capabilities. Tabs
1-5switch betweenTools,Resources,Prompts,NotificationsandStderr; a tab whose capability is not declared shows the reason, such asserver does not declare prompts.Tabmoves the focus between the servers, the list and the form. - Forms.
Enteron a tool opens the form generated from itsinputSchema: one row per property with its type, a*for required ones and the description below. Type into text, number and JSON rows, toggle booleans withSpace, and pickenumvalues with←/→(exactly the values the schema lists).Ctrl+Jswaps the rows for the raw JSON editor and back.Entersends the call; arguments that break the schema are refused with each violation, andCtrl+Osends them anyway (the override is recorded). Prompts open a form of their arguments;Enteron a resource reads it, and on a template opens a form of its variables. - Results. The result view shows the call, its label (
ok,tool error,protocol error <code>,cancelled), each content item,structuredContentandoutputSchemawarnings. A call in flight shows its progress in the top line;Ctrl+Ccancels it (notifications/cancelled).Ctrl+Ssaves the last call as akind: mcprequest file in the workspace. - Notifications and stderr. The
Notificationstab is the timestamped stream;lcycles the server log level (debug,info,warning,error),son a resource subscribes to it, andrreads again the resource anotifications/resources/updatedoffered.Stderrshows the stdio server’s stderr log. - Approvals. A sampling request opens a dialog with its messages, system prompt, model preferences and max tokens: type the response and press
Ctrl+Sto send it, orCtrl+R/Escto reject. An elicitation shows the server’s message and a form from its requested schema:Ctrl+Saccepts (only with content that passes the schema),Ctrl+Ddeclines andEsccancels. Until a request is handled, the status bar showsMCP APPROVAL (<n>)on every screen.
The reference-server contract test (crates/rustman-mcp/tests/client_everything.rs) runs the client against @modelcontextprotocol/server-everything; it is ignored by default and runs with cargo test -p rustman-mcp --test client_everything -- --ignored when RUSTMAN_MCP_EVERYTHING points at its dist/index.js. CI installs the package in the mcp-reference-server job.
Mock server
rustman mock serve serves an OpenAPI 3.0 or 3.1 document as a local HTTP mock. Each operation becomes a route, and responses come from the document’s examples or from data synthesized from its schemas. You can build a client before the backend exists, or ask for the error responses that are hard to get from a real one.
The mock is a development tool, not a security boundary. It binds to loopback by default.
The TUI runs the same server in its mock server pane (Alt+O).
The behavior is specified in openspec/specs/mock-server.
Starting the mock
$ rustman mock serve petstore.yaml
mock: serving 19 operations on http://127.0.0.1:4010
The mock speaks HTTP/1.1 (with keep-alive) and h2c (HTTP/2 without TLS) on the same port. It runs until Ctrl+C. Then it stops accepting connections, gives the requests in flight up to 5 seconds to finish, and exits with code 130.
| Flag | Effect |
|---|---|
<OPENAPI> | The document: a file or an http(s) URL. |
--host <HOST> | Address to bind: an IP address or localhost (default: [mock] host in rustman.toml, else 127.0.0.1). |
--port <PORT> | Port to bind (default: [mock] port, else 4010). 0 picks a free port, and the banner shows it. |
--allow-remote | Required to bind an address reachable from the network, such as 0.0.0.0 or a LAN IP. |
--allow-remote-refs | Fetch $refs that point at other http(s) documents. Without it they are refused, as in rustman import openapi. |
--seed <N> | Seed of synthesized bodies (default: [mock] seed, else 0). See Synthesized data. |
--no-prefer | Ignore the Prefer request header. |
--no-validate | Skip request validation. |
--enforce-security | Answer 401 to requests without the credentials their operation declares. See Security. |
--stateful | Back resources with an in-memory store. See Stateful mode. |
--env <NAME> | The environment whose secrets hold the [mock.security] expected values, and that receives the secrets --record moves out of recorded requests (default: RUSTMAN_ENV, else the workspace default). |
--workspace <DIR> | The workspace whose rustman.toml holds [mock]. Without it the workspace is searched from the current directory upwards. Outside a workspace the defaults apply. |
--cors, --no-cors | Turn CORS on or off (default: on for a loopback bind, off otherwise). |
--jsonl | Write the request log as JSON lines on stdout; the banner goes to stderr. |
--history | Also record each exchange in history, tagged mock. |
--proxy-unmatched <URL> | Forward requests that nothing matches to this upstream. See Proxy and record. |
--record <DIR> | Save each proxied exchange as a request file in DIR (needs --proxy-unmatched and a workspace). |
Settings can live in the workspace. The flags win over these:
[mock]
host = "127.0.0.1"
port = 4011
seed = 7
max_body_bytes = 10485760 # 413 past it
max_headers = 100 # 431 past it
max_header_bytes = 65536 # 431 past it
dir = "mocks" # the hand-written overrides
delay_ms = 0 # delay of every response without an override delay
jitter_ms = 0 # uniform ± range around delay_ms
max_items = 10000 # stateful items per resource (507 past it)
max_store_bytes = 67108864 # stateful JSON in all resources together (507 past it)
[mock.security]
bearerAuth = "{{api_token}}" # expected value of a security scheme, from an environment secret
Start-up errors
Every start-up failure exits with code 2 before anything is served.
A port that cannot be bound:
$ rustman mock serve petstore.yaml
error: mock: cannot bind 127.0.0.1:4010: address in use
An address reachable from the network, without --allow-remote:
$ rustman mock serve petstore.yaml --host 0.0.0.0
error: mock: binding 0.0.0.0 exposes the mock to the network; pass --allow-remote
With --allow-remote, the mock starts and prints a warning on stderr.
A document that is not valid. The document is read by the same parser as rustman import openapi, with the same versions, $ref rules and diagnostics. Each error names the JSON pointer of the problem:
$ rustman mock serve api.yaml
error: /paths/~1a/get/responses/200/content/application~1json/schema/$ref: unresolved reference '#/components/schemas/Nope'
Routing
Each path and method of the document is a route.
- Path parameters. A template such as
/users/{id}matches one segment per parameter. Literal text around a parameter, as in/files/{name}.json, must match too. Parameter values are percent-decoded. - Literal segments win. When several paths match, the one with more literal segments wins, then the one earlier in the document.
GET /users/megoes to/users/me, not/users/{id}, in whatever order the document lists them. - Base paths. The path of each
serversURL (with its variables at their defaults) is stripped from the request first. Withservers: [{url: https://api.example.com/v1}], both/v1/petsand/petsreach/pets. - 404. A path that matches nothing gets
404. - 405. A path that exists without the request’s method gets
405with anAllowheader listing the declared methods, such asAllow: GET, POST.
Errors
Every error the mock generates itself is application/problem+json (RFC 9457) with type, title, status and detail:
{
"type": "urn:rustman:mock:no-matching-operation",
"title": "No matching operation",
"status": 404,
"detail": "GET /nope matches no operation of the document"
}
| Status | type (after urn:rustman:mock:) | When |
|---|---|---|
| 400 | undocumented-code, unknown-example | Prefer asks for a status or example the operation does not document. The detail lists the documented ones. |
| 400 | malformed-request | The body could not be read. |
| 400 | invalid-parameters | A path, query, header or cookie parameter is missing or invalid. |
| 401 | unauthorized | With --enforce-security, the credentials are missing or do not match. |
| 404 | no-matching-operation | No path matches. |
| 404 | unknown-id | Stateful mode: no item has that id. |
| 404 | reserved-path | A path under /__rustman/ other than POST /__rustman/reset. |
| 405 | method-not-allowed | The path does not declare the method. |
| 406 | not-acceptable | Accept matches none of the documented media types. |
| 408 | request-timeout | The body did not arrive within 30 seconds. |
| 413 | body-too-large | The body is over the limit. |
| 415 | unsupported-media-type | The body’s Content-Type is not documented for the operation. |
| 422 | invalid-body | The body is not valid JSON or does not match its schema. |
| 431 | header-fields-too-large | Too many header fields, or too many header bytes. |
| 507 | store-full | Stateful mode: the resource already holds max_items items. |
| any | injected-fault | An override’s fault.error_rate picked this request. |
Validation errors add an errors array, with one entry per violation (up to 20):
{
"type": "urn:rustman:mock:invalid-parameters",
"title": "Invalid request parameters",
"status": 400,
"detail": "1 violation of the operation's schema",
"errors": [{"location": "query", "pointer": "/q", "message": "required"}]
}
Choosing the response
A request first passes security (with --enforce-security) and validation. Then the response is chosen in this order:
- A matching override. Overrides also answer paths the document does not have.
- The stateful store, with
--stateful, for operations on a resource.Preferdoes not apply to these operations. - The
Preferheader, when the request sends one (see below). - The lowest documented
2xx. A2XXrange counts as200. Without any2xx,defaultis used and sent as200. An operation that documents only errors gets its lowest one.
The response’s media type is then negotiated from Accept, and the body is taken, in order, from:
- the first named example (
examples) of that media type; - the media type’s
example; - the schema’s
examplesorexample; - data synthesized from the schema.
A response without content is sent with an empty body and no Content-Type. A JSON media type is sent as compact JSON. A string example of another media type, such as text/plain, is sent as is.
The Prefer header
The Prefer header is compatible with Prism:
| Preference | Effect |
|---|---|
code=<status> | Answer with that status. It must be documented exactly, by its range (4XX) or by default. Otherwise the answer is 400, listing the documented codes. |
example=<name> | Use that named example of the chosen response. An unknown name gets 400, listing the documented names. |
dynamic=true | Synthesize the body from the schema, even when examples exist. |
Preferences are separated by commas or semicolons, and can be combined:
$ curl -i http://127.0.0.1:4010/pets/1 -H 'Prefer: code=404, example=notFound'
HTTP/1.1 404 Not Found
content-type: application/json
{"error":"no such pet"}
--no-prefer makes the mock ignore the header.
Content negotiation
Without an Accept header, or with only */*, the first JSON media type of the response is used (application/json or any +json type), else the first one. Otherwise the documented media type that the highest-quality Accept range covers wins. Ranges such as application/* work in both directions. When nothing is acceptable, the answer is 406.
Synthesized data
When there is no example, the body is synthesized from the schema by the same synthesizer as rustman import openapi. It fills the required properties (all properties when none is required) and honors type, format, pattern, enum, const, length, item-count and numeric bounds. A string with a pattern its plain sample does not match is generated from the regular expression (\d, \w, \s and . with their ASCII meaning). Past three levels of nesting only required properties and minItems items are filled, so circular schemas stay small; a schema whose required properties recurse without end has no finite instance and is cut at ten levels.
Synthesis is seeded. The seed combines --seed (default 0), the operation and the request path. So the same request always gets the same body, whatever the order of calls, and another seed gives other data:
- free-form strings get a suffix, such as
string-3fa2c1; - numbers move up inside their bounds and stay on
multipleOf; - booleans flip.
Strings with a format, and values the schema documents (const, enum, default, examples), stay as they are; strings with a pattern are generated from the seed. A synthesized body validates against its schema, except where the schema cannot be satisfied (endless required recursion, contradictory bounds) or uses a regular expression the generator does not support (look-around, back-references), where the plain sample is kept.
Request validation
By default every request is checked against its operation before a response is chosen:
- Parameters →
400. Required path, query, header and cookie parameters must be present. Their text is read as the schema’s type (integer,number,boolean, or anarraywritten asa,bor as repeated query parameters) and validated against the schema. - Media type →
415. A body must have aContent-Typethat the operation documents (ranges such asapplication/*count). - Body →
422. A JSON body must parse and match its schema. A required body must not be empty.
The schemas are those of rustman import openapi: OpenAPI 3.0 schemas are converted to JSON Schema 2020-12 (nullable, boolean exclusiveMinimum) and validated by the same engine as schema: assertions. Every violation is listed, up to 20: missing required properties, then the first violation of each property, then the first of the body as a whole. Bodies of non-JSON media types are only checked for their media type.
--no-validate turns validation off.
Security
Credentials are not checked by default. With --enforce-security, a request must carry the credentials of one alternative of its operation’s security requirement (the operation’s own security, else the document’s). Otherwise the answer is 401 with a WWW-Authenticate header for each scheme involved:
| Scheme | Credential | WWW-Authenticate |
|---|---|---|
http bearer, oauth2, openIdConnect | Authorization: Bearer <token> | Bearer |
http basic | Authorization: Basic <base64 of user:password> | Basic realm="rustman-mock" |
apiKey | the named header, query parameter or cookie | ApiKey name="...", in="..." |
$ curl -i http://127.0.0.1:4010/users
HTTP/1.1 401 Unauthorized
www-authenticate: Bearer
content-type: application/problem+json
Any value is accepted unless [mock.security] names an expected one for the scheme. Each expected value is a {{variable}} read from the active environment’s secrets (never a literal in rustman.toml); for basic it is user:password. Values are compared in constant time and never appear in responses.
Overrides
Hand-written overrides live in *.rman-mock.yaml files in the mocks/ directory of the workspace (or of the current directory outside a workspace; [mock] dir changes it). Files are read in name order and overrides in declaration order. The first override that matches answers, even for paths the document does not have:
overrides:
- name: big payment # optional
match:
method: POST # default: any method
path: /payments # exact, a template (/users/{id}) or a glob (* within a segment, ** across)
query: {currency: EUR} # each pair must be present
headers: {X-Tenant: acme} # names in any case
body: # JSONPath conditions on a JSON body, all must hold
$.amount: {gt: 10000}
respond:
status: 402 # default 200
headers: {X-Mock: "1"}
body: {error: "over the limit"}
- match: {method: GET, path: /health}
respond: {body: '{"ok":true}'}
| Condition | Holds when the first node the JSONPath selects |
|---|---|
a bare value, or eq: <value> | equals the value |
ne: <value> | differs from it (or is absent) |
gt, gte, lt, lte | is a number past the bound |
contains: <text> | is a string containing the text, or an array holding it |
exists: true / false | is present / absent |
respond.body can be a structure (sent as JSON), a string (sent as JSON when it parses, else as text), or body_file: <path> relative to the mock file, inside its directory and at most 10 MiB. Content-Type follows from the body unless respond.headers sets it. Framing and hop-by-hop headers (Content-Length, Transfer-Encoding, Connection…) cannot be set.
Requests to documented operations are checked for security and validated before overrides are tried. An invalid mock file stops start-up with exit code 2 and its file name, line and override number.
Response templates
Override bodies (including body_file text) and header values can use request data:
| Template | Value |
|---|---|
{{request.path.<name>}} | a path parameter of the override’s template, or of the matched operation |
{{request.query.<name>}} | the first value of a query parameter |
{{request.header.<name>}} | a header (any case) |
{{request.body.<JSONPath>}} | the first node of the JSON body, such as {{request.body.$.user.name}} |
{{$uuid}}, {{$timestamp}}, {{$randomInt}}… | the dynamic variables of environments, except {{$env}} |
overrides:
- match: {method: GET, path: '/users/{id}'}
respond:
body: {id: "{{request.path.id}}"} # GET /users/42 → {"id":"42"}
A reference that does not resolve renders as an empty string and is logged as a warning on stderr. Templates only substitute; there is no logic.
Latency and faults
overrides:
- match: {path: /slow}
delay_ms: 2000 # before the response headers
jitter_ms: 500 # uniform ± range; both at most 60000
- match: {path: /flaky}
fault: {error_rate: 0.2, status: 503} # 20% of requests get a 503 problem+json (default status 500)
- match: {path: /gone}
fault: {drop_connection: true} # close the connection without a response
- match: {path: /trickle}
fault: {slow_body_bps: 100} # stream the body at 100 bytes per second
[mock] delay_ms and jitter_ms delay every response that has no override delay.
Delays and faults are random but reproducible: each route (an override’s name, else its file and position) has its own sequence, seeded by --seed and advanced per request. The same seed and the same requests to a route give the same delays and faults, whatever other routes receive meanwhile.
Stateful mode
With --stateful, resources are backed by an in-memory store. Resources are found like the explorer’s dependency discovery: a POST collection (/users) whose response holds the id that the item path’s parameter (/users/{id}) takes.
| Request | Effect |
|---|---|
POST /users | Stores the body with a new id and answers with it and the documented creation status. |
GET /users | Lists the stored items, when the documented response is an array. |
GET /users/{id} | The stored item, else 404. |
PUT /users/{id} | Replaces the item (keeping its id), else 404. |
PATCH /users/{id} | Merges the body into the item (JSON merge patch), else 404. |
DELETE /users/{id} | Removes the item, else 404. |
New ids follow the id’s schema: format: uuid gives a UUIDv4 drawn from the seed, integer counts from 1, anything else counts as text ("1"). Each resource holds at most 10000 items ([mock] max_items), and all resources together at most 64 MiB of JSON ([mock] max_store_bytes); a create, replace or patch past either limit gets 507.
POST /__rustman/reset clears the store and answers 204. Every path under /__rustman/ is reserved for the mock and never routed to the document. The store lives in memory only and is lost when the mock stops.
Request limits
The mock enforces the same defaults as the webhook inspector. Each limit can be changed under [mock].
| Limit | Default | Over it |
|---|---|---|
Request body (max_body_bytes) | 10 MiB | 413. A declared Content-Length past the limit is refused before the body is read. |
Header fields (max_headers) | 100 | 431 |
Header bytes (max_header_bytes) | 64 KiB | 431 |
Requests far past the header limits (more than twice the limit) are refused by the HTTP layer itself with a plain 431. Malformed requests get 400. On HTTP/1.1, a refused request also closes the connection.
CORS
CORS is on by default when the mock is bound to loopback, so a browser app on another local port (a Vite dev server on http://localhost:5173, say) can call it. It is off for any other bind. --cors and --no-cors override the default.
When CORS is on:
- A preflight (
OPTIONSwithOriginandAccess-Control-Request-Method) is answered204before routing, security and validation run.Access-Control-Allow-Originechoes the request’sOrigin,Access-Control-Allow-Methodslists the methods the document declares for the path (the requested method for a path it lacks), andAccess-Control-Allow-HeadersechoesAccess-Control-Request-Headers. - Every other response to a request with an
Originechoes it inAccess-Control-Allow-Origin, withAccess-Control-Expose-Headers: *andVary: Origin. Credentials are never allowed (noAccess-Control-Allow-Credentials), and responses forwarded by--proxy-unmatchedget no CORS headers, so a web page cannot read the upstream through the mock.
With --no-cors, an OPTIONS request is routed like any other (usually 405, unless the document declares options).
Request log
Every request is logged once its response is sent, with:
| Field | Meaning |
|---|---|
time | When it arrived, RFC 3339 UTC. |
method, path | The request line; the path keeps its query. |
operation | The matched operation’s operationId (else METHOD /template). |
override | The name of the override that answered, if one did. |
status | The response status; null when a fault dropped the connection. |
source | Where the response came from: override, prefer, example, synthesized, stateful, proxy, cors (a preflight) or error (an error the mock made itself, including injected faults). |
errors | The validation errors (location pointer: message), the detail of other errors, and unresolved template references. |
duration_ms | Time from the request head to the response head. |
headers | The request headers. |
By default each entry is one line on stderr:
2026-11-18T10:15:30.125Z GET /pets/1 -> 200 example (getPet) 0.4 ms
2026-11-18T10:15:31.002Z POST /pets -> 422 error (createPet) 0.3 ms [body /name: 5 is not of type "string"]
With --jsonl, each entry is one JSON object on stdout (and the banner moves to stderr, so stdout holds only entries):
{"time":"2026-11-18T10:15:30.125Z","method":"GET","path":"/pets/1","operation":"getPet","status":200,"source":"example","duration_ms":0.4,"headers":[{"name":"authorization","value":"«redacted:Authorization»"}]}
Entries are redacted before they are written: credential headers (Authorization, Cookie, the headers the document’s apiKey schemes name, and names like X-Api-Key, X-Auth-Token or Client-Secret) always show as «redacted:<header>»; credential query parameters (the apiKey ones, and names like api_key, token or key) show as api_key=«redacted:api_key»; and the values of both, and the expected values of [mock.security], are replaced wherever else they appear. Entries are written on their own thread, so a slow reader of the output never holds up the server; when it falls more than 1024 entries behind, the skipped count is reported on stderr.
History
With --history, each exchange is also recorded in history, after the same redaction. In a workspace it goes to the workspace’s history, otherwise to the ad-hoc one, subject to the usual retention limits. The entries carry "request": "mock" (rustman history list --json shows it), the request as received, the status and the duration, and record.mock holds the source, the operation, the override and the errors. They cannot be replayed with rustman history replay.
Hot reload
The mock watches the document (when it is a file) and the mocks directory. About 200 ms after the last change it reads both again and serves the new version from the next request on:
mock: reloaded: 20 operations, 3 overrides
Requests in flight finish with the version they started with, and the stateful store is kept. If the new version does not load (invalid YAML, a dangling $ref, an invalid mock file), the previous one keeps being served and the error is logged with its file and location:
mock: reload failed, still serving the previous version: api.yaml: invalid YAML at line 4: unclosed bracket '['
Proxy and record
--proxy-unmatched <URL> forwards every request that matches no operation and no override (instead of answering 404 or 405) to that upstream, through the HTTP engine. The request path and query are appended to the URL (--proxy-unmatched https://staging.example.com sends GET /legacy/report to https://staging.example.com/legacy/report). The URL may carry a base path but no query.
The request is sent with the header hygiene of webhook replay: hop-by-hop headers, the headers Connection names, Host, Content-Length and Transfer-Encoding are dropped, as is Proxy-Authorization (it is meant for the mock, never forwarded or recorded), and the engine sets the framing for the upstream. The upstream’s response is returned as it came (status, headers, body; compressed bodies stay compressed), without its own hop-by-hop and framing headers. Redirects are returned to the client, never followed, so the upstream’s origin is the only one contacted. An upstream that cannot be reached gets 502 problem+json. The request log marks forwarded requests proxy.
--record <DIR> saves each proxied exchange as a kind: http request file in DIR, which must be inside the workspace. The exchange goes through the same pipeline as a HAR import: the file is named after the method and path (recorded/get-legacy-report.rman.yaml), a different request with the same name gets the next free suffix (get-legacy-report-2.rman.yaml), the same request is recorded once, and credentials (an Authorization token, an API key header) are moved to secrets of the active environment (--env, else RUSTMAN_ENV, else the workspace default; a new environments/recorded.yaml without one), leaving a {{placeholder}} in the file:
kind: http
name: GET /legacy/report
method: GET
url: https://staging.example.com/legacy/report
headers:
- name: authorization
value: Bearer {{authorization_token}}
Each saved file is reported on stderr (mock: recorded recorded/get-legacy-report.rman.yaml).
Self-check against the explorer
A mock of a valid document is a consistent exploration target: the explorer’s conformance probes find nothing against it. CI checks this for fixtures/petstore.yaml:
rustman mock serve fixtures/petstore.yaml --port 4010 &
rustman explore run --spec fixtures/petstore.yaml --target http://127.0.0.1:4010 \
--probes conformance --fail-on info --env ci --allow-destructive
The ci environment gives the security schemes’ variables (bearerAuth_token, apiKey_key) any value, since the mock does not check credentials by default. The exploration reports zero findings and exits with code 0.
Webhook inspector
rustman webhook listen runs a local HTTP listener that captures every inbound request (any method, any path), answers it with a default acknowledgement or a mock you configure, and prints an event log. It is meant for testing webhook producers (GitHub, Stripe, your own services) without a third-party service; pair it with your own tunnel if the producer is on the internet.
The behavior is specified in openspec/specs/webhook-inspector.
Starting the listener
$ rustman webhook listen
Listening on http://127.0.0.1:9090
#1 POST /hooks/github from 127.0.0.1:53114 (1832 B) -> 200
| Flag | Effect |
|---|---|
--host <HOST> | Address to bind: an IP address or localhost (default: [webhook] host in rustman.toml, else 127.0.0.1). |
--port <PORT> | Port to bind (default: [webhook] port, else 9090); 0 picks a free port and the banner shows it. |
--allow-remote | Required to bind an address reachable from the network, such as 0.0.0.0 or a LAN IP. |
--max-body <BYTES> | Largest accepted body (default 10485760, 10 MiB); larger bodies get 413. |
--max-captures <N> | Exit with code 0 once N requests were captured. Events already queued for the last capture (its mock match) are still printed, and the replies in flight are still sent (for up to 65 s) before the process exits. |
--jsonl | Print one JSON object per line per event, flushed at once; the banner and warnings go to stderr, so stdout holds only events. |
--workspace <DIR> | The workspace whose webhook/mocks.yaml answers requests. Without it the workspace is searched from the current directory upwards; outside a workspace every request gets the default reply. |
--env <NAME> | The environment whose secrets the signature verifiers use (default: RUSTMAN_ENV, then [defaults] default_environment). |
The bind address can live in the workspace:
[webhook]
host = "127.0.0.1" # the flags win over these
port = 9191
A port that cannot be bound stops the command with exit code 2:
$ rustman webhook listen
error: webhook: cannot bind 127.0.0.1:9090: address in use
Binding a non-loopback address without --allow-remote is refused, and with it a warning stays on stderr:
$ rustman webhook listen --host 0.0.0.0
error: webhook: binding 0.0.0.0 exposes the listener to the network; pass --allow-remote
$ rustman webhook listen --host 0.0.0.0 --allow-remote
Listening on http://0.0.0.0:9090
warning: the webhook listener on 0.0.0.0:9090 is reachable from the network
Ctrl+C stops the listener (exit code 130), even while nothing reads the output. When the output is closed (a pipe whose reader exited), the listener stops as soon as the next event cannot be printed, without waiting for replies in flight, and exits with code 0. Captures live in memory only; they are gone when the listener stops.
Printing never holds up the listener: when the output is read slower than events arrive (a paused | less, a slow | jq), requests are still answered, at most 256 events (32 MiB of bodies) wait to be printed, and the rest are dropped with warning: N events not shown (output too slow) on stderr once the output moves again. rustman webhook listen keeps no capture buffer of its own: it only prints events.
HTTP handling and limits
The listener speaks HTTP/1.1 (including chunked bodies) and HTTP/2 over cleartext with prior knowledge, through hyper; nothing is parsed by hand. Each HTTP/1 connection carries one request: the response closes it, as most webhook senders expect.
Requests that break a rule are answered with an error, are not captured, and appear on the event log with the client address, the status and the reason:
| Rule | Default | Response |
|---|---|---|
Malformed request line or head, conflicting Content-Length values, or Transfer-Encoding together with Content-Length | 400 | |
| Header fields per request | 100 | 431 (too many header fields) |
| Bytes of header fields per request | 64 KiB | 431 (header fields too large) |
Body size, declared (Content-Length) or streamed | 10 MiB | 413, before the body is read or as soon as the limit is passed; the connection is closed |
| Time to receive the request head, counted from the connection | 10 s | 408 when part of a head arrived; a connection that sent nothing (or speaks HTTP/2) is closed without a reply or a log line |
| Time to receive the body | 30 s | 408 |
| Idle connection (no request in flight, no traffic) | 60 s | the connection is closed |
| Connections served at once | 256 | more wait to be accepted (see the note below) |
| Requests in flight on one HTTP/2 connection | 16 | the sender waits (HTTP/2 flow control) |
127.0.0.1:53120 rejected 431 too many header fields
Over HTTP/2 the protocol layer itself answers 431, without a log line, to a header list over twice the header-byte limit plus 32 bytes per allowed field (about 131 KiB by default); smaller lists over the limits are refused and logged as above.
Bodies are held in memory while they are received, before the size check can drop them, so the requests in flight bound that memory: up to the body limit per request, which with the defaults is 2.5 GiB over HTTP/1 (256 connections) and in theory 40 GiB over HTTP/2 (16 streams on each). No overall budget caps it; lower --max-body on a machine where that matters.
The listener is a development tool, not a hardened server: a client that opens connections and sends nothing, or a head byte by byte, holds a connection slot until the 10 s head timeout. 256 such connections stall other deliveries for that long, since further connections wait in the operating system’s backlog. Keep the listener on loopback, and use --allow-remote only on networks you trust.
Error responses are JSON, such as {"error":"body larger than 10485760 bytes","status":413}.
Captures
Each capture keeps a sequence id, the receive time (RFC 3339 with the local offset), the client address, the HTTP version, the method, the path and the query string separately, every header field in arrival order with duplicates (names in the sender’s case on HTTP/1; HTTP/2 names are lowercase by protocol), and the body as raw bytes. Nothing is decoded or replaced: a body that is not UTF-8 is kept byte for byte and shown as a hex dump; JSON bodies are shown pretty-printed and form bodies as fields.
Captures are kept in a ring buffer of at most 500 captures and 256 MiB of body bytes: when either bound would be passed, the oldest captures are dropped until both hold (the newest capture is always kept). The buffer’s memory is therefore bounded by the byte budget plus one maximum body. Events (a capture included) are also queued for each front-end, up to 1024 of them: a front-end that falls that far behind can briefly keep evicted captures alive until it catches up, and then misses the oldest events. The TUI and the CLI read events as they arrive, so in practice the queue stays short.
Responses and mocks
Without a matching mock the reply is:
HTTP/1.1 200 OK
content-type: application/json
content-length: 34
{"status":"ok","source":"rustman"}
Mocks live in webhook/mocks.yaml in the workspace. The first mock whose method and path match answers; the request is captured either way.
mocks:
- method: POST # or "*" for any method (the default)
path: /hooks/github # exact, or a glob: * within one path segment, ** across segments
status: 500 # default 200
headers: { X-Mock: "1" }
body: '{"error":"boom"}' # or body_file: github-error.json, inside mocks.yaml's directory (at most 10 MiB)
delay_ms: 2000 # wait before answering; at most 60000
- path: /hooks/**
status: 202
The path is matched without the query string. A mock’s reply always carries a correct Content-Length: a mock may not set Content-Length, Transfer-Encoding, Host or a hop-by-hop header (Connection, Keep-Alive, Proxy-Connection, TE, Trailer, Upgrade), and such a mocks file is refused. A body_file must be a relative path that stays inside the directory of mocks.yaml (symlinks included) and be at most 10 MiB.
Changes to any file under webhook/ reload the mocks while the listener runs (after 200 ms of quiet); the next request uses them. A file that does not parse leaves the previous mocks active, and both outcomes are on the event log:
mocks reloaded: 2 active
mocks not reloaded (previous mocks kept): /home/me/api/webhook/mocks.yaml: mock 1: delay_ms 90000 exceeds 60000
Event log
One line per event:
| Event | Line |
|---|---|
| Capture | #1 POST /hooks/stripe?debug=1 from 127.0.0.1:53114 (2 B) -> 200 (the last number is the status answered), followed by signature: valid (or invalid, missing, expired) when a verifier covers the path |
| Mock match | #1 matched mock POST /hooks/github -> 500 after 2000 ms |
| Rejection | 127.0.0.1:53120 rejected 413 body larger than 10485760 bytes |
| Mock reload | mocks reloaded: 2 active or mocks not reloaded (previous mocks kept): <error> |
Printed lines are redacted with the verifier secrets: a sender that echoes a key back (in a path or query) shows «redacted:<name>» instead.
JSON-lines output
With --jsonl every event is one JSON object on its own line, written and flushed as it happens, so a pipe sees it at once:
$ rustman webhook listen --jsonl | jq -c '{path, signature}'
{"path":"/hooks/github","signature":"valid"}
Every object has a type:
type | Fields |
|---|---|
capture | id, ts (RFC 3339 with the local offset), remote, version, method, path, query (or null), status (the status answered), mock (the matching mock’s path pattern, or null), signature (valid, invalid, missing, expired, or null without a verifier), headers ([{"name": ..., "value": ...}] in arrival order, duplicates included), body_size, and body when the body is UTF-8 text or body_base64 when it is not |
rejection | remote, status (400, 408, 413, 431), reason |
mock | id (the capture), method, pattern, status, delay_ms |
mocks_reloaded | count |
mocks_invalid | message |
{"type":"capture","id":1,"ts":"2026-11-18T10:15:30.125+01:00","remote":"127.0.0.1:53114","version":"HTTP/1.1","method":"POST","path":"/x","query":null,"status":200,"mock":null,"signature":null,"headers":[{"name":"Host","value":"127.0.0.1:9090"},{"name":"Content-Length","value":"2"}],"body_size":2,"body":"{}"}
Values are redacted like the human-readable lines: verifier secrets become «redacted:<name>», and credential headers (Authorization, Cookie, …) show a placeholder instead of their value.
Signature verification
Verifiers in rustman.toml check the signature of every request to a path; the first verifier whose path matches (exact, or a glob with * within a segment and ** across segments) decides. The check runs on the raw body bytes before anything is decoded, and MACs are compared in constant time. The verdict is part of the capture: valid, invalid, missing (no signature header) or, for Stripe, expired.
[[webhook.verifiers]]
path = "/hooks/github"
type = "github" # X-Hub-Signature-256: sha256=<hex HMAC-SHA256 of the body>
secret = "{{gh_hook}}"
[[webhook.verifiers]]
path = "/hooks/stripe"
type = "stripe" # Stripe-Signature: t=<unix time>,v1=<hex>[,v1=...]
secret = "{{stripe_whsec}}"
tolerance_s = 300 # optional; timestamps further off are "expired"
[[webhook.verifiers]]
path = "/hooks/shop/**"
type = "hmac"
header = "X-Signature"
algorithm = "sha256" # sha256 (default), sha1 or sha512
encoding = "base64" # hex (default) or base64
prefix = "" # text before the encoded MAC, e.g. "sha1="
secret = "{{shop_secret}}"
| Type | Signed content | Header |
|---|---|---|
github | the raw body, HMAC-SHA256 | X-Hub-Signature-256: sha256=<hex> |
stripe | <t>.<raw body>, HMAC-SHA256; any v1 may match (key rotation); v0 is ignored | Stripe-Signature: t=...,v1=... |
hmac | the raw body, with algorithm | header: prefix + the MAC in encoding |
A Stripe event whose signature matches but whose t is more than tolerance_s seconds old (300 by default), or more than that far in the future, is expired; a signature that does not match is invalid whatever its age.
secret must be a {{variable}} reference: keys stay out of rustman.toml, which is meant for Git. The variable is read from the active environment (--env, else RUSTMAN_ENV, else the workspace default; in the TUI, the environment shown in the status bar), normally as a secret (secrets: [gh_hook] in environments/local.yaml and rustman secret set gh_hook --env local), or as a plain variable of that environment; never from [variables] in rustman.toml. A secret that is not set stops the listener before it binds:
error: rustman.toml: webhook verifier 1 (/hooks/github): gh_hook: secret not set; run 'rustman secret set gh_hook --env local'
Secret values never enter a capture, the event log, saved files or history.
Replay and save
A capture can be replayed to any URL, saved as a request file or a history entry, or copied as a curl command. rustman_webhook::replay, rustman_webhook::save and rustman_webhook::curl provide these to every front-end; the TUI webhook pane exposes them as actions (r, w, h, y).
Both replay and request files use one header filter, so a capture whose body was edited still replays with correct framing (the Ghostman B1 bug). It removes:
Host,Content-LengthandTransfer-Encoding, whichrustmancomputes for the new target and body;- the hop-by-hop headers
Connection,Keep-Alive,Proxy-Connection,TE,TrailerandUpgrade; - every header named in a
Connectionheader (Connection: close, X-TracedropsX-Trace).
Every other header is sent in its captured order, duplicates included.
Replay sends the original method, the body bytes (binary bodies byte for byte) and the filtered headers through the same HTTP engine as rustman send, so Host becomes the target’s (https://staging.example.com/hook is sent with Host: staging.example.com). A capture without Content-Type gets text/plain; charset=utf-8 for a text body or application/octet-stream for a binary one. A header value that is not text cannot be replayed and is reported.
Save as request file writes a kind: http file targeting the URL you choose (which may use variables, such as {{api}}/hooks/stripe):
version: 1
kind: http
name: POST /hooks/stripe
description: 'Saved from webhook capture #4 (POST /hooks/stripe?debug=1)'
method: POST
url: '{{api}}/hooks/stripe'
headers:
- name: Content-Type
value: application/json
- name: Stripe-Signature
value: t=1700000000,v1=5257a869...
body:
type: json
content: '{"id":"evt_1","type":"invoice.paid"}'
JSON bodies are kept as JSON text, other text bodies as type: text, and a body that is not UTF-8 is written byte for byte to a file next to the request (stripe.body.bin) that the request sends with type: file. Any {{ in captured text is escaped (\{{) so it is sent literally. Credentials (Authorization, Proxy-Authorization, Cookie, Set-Cookie) are left out and reported, since request files are meant for Git, and a capture holding a verifier secret is refused. Existing files are never replaced.
Save to history records the capture as an inbound entry in .rustman/history/ (request webhook): the method, the path and query, the headers and the text body as received, redacted like every history entry, the status answered, and under record.inbound the capture id, receive time, client address, HTTP version, mock, signature verdict and, for a binary body, body_base64. rustman history list and show display these entries; they are not replayable from history (replay the capture instead).
Agent tool
The agent MCP server registers list_webhook_captures when it is built with webhook inspector support (the default webhook feature of rustman-mcp; a build without it doesn’t list it). It lists the captures saved with save to history, newest first: the history entry id, the capture id, receive time, method, path and query, status answered, client address, HTTP version, mock, signature verdict, headers and body (base64 for a binary body, with a body_ref past the inline limit). Filter with path (text in the path and query, any case), method, verdict (the signature verdict: valid, invalid, missing or expired) and since (an age such as 1h, or an RFC 3339 time), and page with cursor and limit (50 by default).
The agent server runs no listener, and the tool never replays or sends anything: captures still in a listener’s buffer are not visible until saved. Entries were redacted when saved and are redacted again with the session’s secrets on the way out.
Traffic recorder
rustman record runs a local recording proxy. Point an app or a CLI at it and every request it sends is relayed to the real server and recorded, so you can see what the app actually sends. HTTPS stays opaque unless you explicitly include its host and trust a local certificate authority (CA) that Rustman creates for the workspace.
The behavior is specified in openspec/specs/traffic-recorder.
Starting the proxy
$ rustman record
Recording proxy on http://127.0.0.1:8888
export HTTP_PROXY=http://127.0.0.1:8888
export HTTPS_PROXY=http://127.0.0.1:8888
GET http://api.example.test/v1/items 200 14 ms 512 B
TUNNEL www.google.com:443 1834 B up, 5120 B down
Run the printed export lines in another shell (or set the proxy in the app’s settings) to route traffic through the proxy. They are POSIX shell syntax; on Windows use $env:HTTP_PROXY = "http://127.0.0.1:8888" and $env:HTTPS_PROXY = "http://127.0.0.1:8888" in PowerShell, or set HTTP_PROXY=http://127.0.0.1:8888 and set HTTPS_PROXY=http://127.0.0.1:8888 in cmd. Rustman never changes system or browser proxy settings itself. Press Ctrl+C to stop recording; the command then exits with code 0.
| Flag | Effect |
|---|---|
--host <HOST> | Address to bind: an IP address or localhost (default: [record] host in rustman.toml, else 127.0.0.1). |
--port <PORT> | Port to bind (default: [record] port, else 8888); 0 picks a free port and the banner shows it. |
--allow-remote | Required to bind an address reachable from the network, such as 0.0.0.0. A warning is printed: anyone who can reach the port can use the proxy and see intercepted traffic. |
--intercept <GLOB> | Decrypt HTTPS to hosts matching the glob (repeatable, case-insensitive, *.example.com). Needs the workspace’s local CA. Other hosts stay opaque tunnels. |
--workspace <DIR> | The workspace whose [record] settings and local CA are used. Without it the workspace is searched from the current directory upwards; recording without interception works outside a workspace. |
--include-host, --exclude-host, --method, --content-type, --keep-static | Choose what is recorded; see Filters and limits. Everything is still proxied. |
--json | Print one redacted JSON object per capture; see JSON lines. |
--upstream <URL>, --insecure | Reverse-proxy mode for clients that cannot use a proxy. |
--save, --into <DIR>, --env <NAME>, --store-secrets | Save the captures as request files when recording stops; see Saving captures as request files. |
The defaults can live in the workspace:
[record]
host = "127.0.0.1" # the flags win over these
port = 8888
intercept = ["*.example.com"]
max_body = 10485760 # bytes of each body kept in a capture (10 MiB)
max_captures = 2000 # captures kept, oldest evicted first
max_buffer_bytes = 536870912 # bytes all kept bodies may take (512 MiB)
A port that cannot be bound, or a network address without --allow-remote, stops the command with exit code 2:
$ rustman record
error: record: cannot bind 127.0.0.1:8888: address in use
$ rustman record --host 0.0.0.0
error: record: binding a non-loopback address requires --allow-remote
What is printed
One line per capture, as it completes, with the method, absolute URL, status, duration and response size (truncated when only part of a body was kept). Lines are redacted: the credentials carried by Authorization, Proxy-Authorization, Cookie and Set-Cookie, and every value that saving would turn into a placeholder (the values of X-Api-Key-style headers and of query and body fields named like token, password, secret or api_key, values starting with an auth scheme such as Bearer … in any header or field, known token formats such as ghp_… or AKIA… wherever they appear, under any name, URL path segments saved as secrets, and the neutral fields of credential objects in JSON bodies) are replaced by «redacted:<name>» wherever they reappear, URLs included. A request the upstream could not answer shows --- and the error, and the client gets 502 Bad Gateway (504 Gateway Timeout when no response head arrived in time, see Timeouts). Lines are printed by a thread of their own, so a slow terminal or pipe never slows the proxy down: when more than 1024 lines wait, the newest are dropped and stderr shows warning: <n> captures not shown (output too slow) (they are still captured, saved and exported). When recording stops, the lines still waiting are printed (for up to 2 seconds) before the --har and --save output.
What the proxy accepts
- Plain HTTP proxy requests (
GET http://host/path HTTP/1.1): forwarded to the origin, the response streamed back byte for byte (bodies are not decoded), and the exchange recorded. CONNECT host:porttunnels: see below.- Anything else (an origin-form request such as
GET /v1/users) gets400: the proxy is not a web server. Use reverse-proxy mode for clients that send those. - A URL with credentials in it (
http://user:password@host/) gets400and is not recorded: the password would otherwise reach the upstreamHostheader and the captures. Send credentials in anAuthorizationheader.
The upstream leg uses the same connector as rustman send: DNS, a 10-second connect timeout and TLS verification with the OS trust store plus the workspace’s [http] ca_bundle (see Upstream TLS). Hop-by-hop headers (Connection, Proxy-Connection, Proxy-Authorization, Keep-Alive, TE, Trailer, Transfer-Encoding, Upgrade) are not forwarded. Each stored body keeps at most its first 10 MiB; the client always receives the whole body.
Filters and limits
Filters decide what is recorded; every request is still proxied, so the app keeps working.
| Flag | Records only |
|---|---|
--include-host <GLOB> | Hosts matching the glob (repeatable, case-insensitive, *.example.com; no port). |
--exclude-host <GLOB> | Hosts not matching the glob (repeatable); wins over --include-host. |
--method <METHOD> | This method (repeatable, case-insensitive). |
--content-type <PREFIX> | Exchanges whose request or response Content-Type starts with the prefix (repeatable, application/json). |
Host filters also apply to tunnel and TLS REJECTED entries. Static assets are dropped by default: responses whose type is an image, font, audio, video, CSS or JavaScript, and URLs ending in an image, font, media, .css, .js, .mjs or .map extension. --keep-static records them too.
Memory stays bounded: each body keeps its first max_body bytes (10 MiB by default) and the capture is marked truncated, while the client still receives the whole body. The capture list keeps at most max_captures captures (2000) whose bodies take at most max_buffer_bytes (512 MiB) together, evicting the oldest first. The copies of the bodies still being received (many connections, HTTP/2 streams) share a budget of the same max_buffer_bytes: once it is used up, a body being copied stops growing and its capture is marked truncated, while the traffic still flows in full. All three can be set in [record].
Timeouts
| What | Default | [record] key |
|---|---|---|
| Upstream connection (DNS, TCP and TLS) | 10 s | |
| A client’s request head, and the TLS handshake of an intercepted tunnel | 30 s | |
| The upstream’s response head, counted once the request body is sent (a long upload is not cut short) | 60 s | response_timeout_ms |
| A client connection (plain HTTP, an opaque tunnel, or an intercepted HTTP/1.1 or HTTP/2 connection) without a byte either way, a request body that stalls included | 5 min | idle_timeout_ms |
A response head that does not arrive in time gets 504 Gateway Timeout and is recorded with the error no response within 60 s. An idle tunnel is closed and recorded with idle timeout: no traffic for 300 s; an idle plain or intercepted connection is closed (clients open a new one), so a client that announces a body (Content-Length or chunked) and stops sending it frees its connection slot. Set a key to a number of milliseconds (idle_timeout_ms = 900000 for long-polling apps); 0 keeps the default.
rustman.toml is committed, so a cloned workspace can carry [record] settings you did not choose. rustman record prints a warning on stderr when [record] intercept decides which hosts are decrypted (no --intercept flag was given), and when max_body, max_captures or max_buffer_bytes is above its default. The TUI recorder pane shows the interception scope in its header.
JSON lines
rustman record --json prints one JSON object per capture on stdout, and the banner, the --har line and the --save summary on stderr, so stdout can be piped into jq:
{"type":"exchange","method":"GET","url":"http://api.example.test/v1/me","version":"HTTP/1.1","status":200,"duration_ms":12,"intercepted":false,"request_headers":[{"name":"authorization","value":"«redacted:Authorization»"}],"response_headers":[{"name":"content-type","value":"application/json"}],"request_size":0,"response_size":512,"truncated":false,"error":null,"id":1,"ts_ms":1700000000123}
Tunnels have "type":"tunnel" with host, port, bytes_up, bytes_down and duration_ms; rejected handshakes have "type":"tls_rejected" with host, port and hint. Objects are redacted like the summary lines: Authorization, Proxy-Authorization, Cookie and Set-Cookie values are replaced whole, and their credentials, like the values of secret-named headers, query parameters and body fields, are redacted wherever else they appear. Bodies are not printed; their sizes are.
Tunnels and interception
For every CONNECT, the host is matched against the --intercept globs before any TLS handshake. A CONNECT host that is neither a DNS name nor an IP address (such as *.example.com) gets 400 Bad Request, so no certificate is ever minted for a wildcard:
- Not included (the default for every host): the tunnel is relayed byte for byte, nothing is decrypted, and the capture list shows only
TUNNEL host:portwith the bytes sent each way. Banking or personal traffic in the same browser stays opaque while you record. - Included: the proxy completes the TLS handshake itself with a certificate for that host signed by the local CA, decrypts HTTP/1.1 or HTTP/2 (negotiated by ALPN), forwards each request to that same host over a new verified TLS connection, and records the full exchange. Requests always go to the
CONNECThost, whatever theirHostheader says.
A client that does not trust the local CA, or pins its certificates, aborts the handshake. The capture list then shows:
TLS REJECTED api.example.com: client rejected the Rustman CA (not installed or pinned); exclude the host or install the CA
Remove the host from --intercept to let such an app work again (its traffic then becomes a tunnel), or install the CA.
Reverse-proxy mode
Some clients cannot be pointed at a proxy. --upstream <URL> turns the recorder into a reverse proxy: it accepts plain requests on the listen address and forwards each one to that origin, with Host rewritten to it.
$ rustman record --upstream https://api.example.com --port 9000
Recording reverse proxy on http://127.0.0.1:9000 -> https://api.example.com
GET https://api.example.com/v1/users 200 85 ms 2048 B
Point the client at http://127.0.0.1:9000 instead of https://api.example.com: GET http://127.0.0.1:9000/v1/users goes to https://api.example.com/v1/users and is recorded exactly like forward mode (filters, limits, --json, --save). Every request goes to the upstream, whatever its Host or absolute URL says; CONNECT gets 405. The URL must be an origin (http or https, a host and an optional port, no path or user info).
HTTPS upstreams are verified like intercepted hosts (see Upstream TLS), so a self-signed upstream fails with 502 Bad Gateway. --insecure (allowed only with --upstream, for that one host) turns verification off and prints a warning.
--upstream cannot be the proxy’s own address (--port 9000 --upstream http://127.0.0.1:9000, or any other loopback spelling of it: 127.0.0.0/8, ::1, ::ffff:127.0.0.1, localhost, *.localhost): every request would be forwarded back to the proxy, so the command exits with code 2: record: --upstream "http://127.0.0.1:9000" is this proxy's own address; requests would loop.
Upstream TLS
Upstream servers, intercepted or --upstream, are verified with the OS trust store plus the CAs of [http] ca_bundle in rustman.toml (a PEM file, relative to the workspace root), the same rules as rustman send. Point ca_bundle at the private CA of a local or staging API to record it:
[http]
ca_bundle = "certs/dev-ca.pem"
A ca_bundle that cannot be read or holds no certificate stops the command with exit code 2. [defaults] verify_tls = false is deliberately not applied to the recorder: it would turn verification off for every intercepted host. Only --insecure turns it off, and only for the one --upstream host. Client certificates ([http] client_cert) are not presented to upstreams.
The local CA
Interception needs a certificate authority that the client trusts. Rustman creates one per workspace, only when you ask:
$ rustman record ca init
Created the local CA of this workspace
subject: CN=Rustman Local CA (0b5c0b9e), O=Rustman
SHA-256: 3F:9A:...:C2
expires: 2027-11-21
key: OS keychain (rustman / record-ca/0b5c0b9e-58c4-4c1e-9f0e-6f1f4b7f2a10)
cert: /home/me/.config/rustman/record-ca/0b5c0b9e-58c4-4c1e-9f0e-6f1f4b7f2a10.pem
It is not trusted yet: run 'rustman record ca install' to trust it on this machine.
rustman record --intercept ... without a CA asks to create one when run in a terminal (type yes), and otherwise exits with code 2.
| Command | Effect |
|---|---|
rustman record ca init | Create the CA. Refused (exit 2) when the workspace already has one. |
rustman record ca export [--out FILE] | Print the certificate in PEM (or write it to FILE) and its SHA-256 fingerprint. Never the key. |
rustman record ca install [--yes] | Trust the CA in this machine’s trust store after printing what will be trusted and asking you to type yes. Answering anything else changes nothing and exits with code 1. |
rustman record ca uninstall | Remove the CA from every trust store Rustman installed it in. |
rustman record ca rotate [--yes] | Uninstall the old CA, delete its key and certificate, create a new one and print both fingerprints. The new CA is not installed. |
rustman record ca remove [--yes] | Delete the CA when you are done with interception: remove it from the trust stores Rustman installed it in (the commands are printed), then delete its key from the keychain and its certificate, after you type yes. Answering anything else changes nothing and exits with code 1. A failed uninstall command keeps the CA, so it can be retried. |
Every CA command takes --workspace <DIR>.
Security model
A trusted CA is a long-lived interception capability: whoever holds its private key can impersonate any website to this machine. Rustman limits that risk as follows.
- Created only on request.
rustman record ca init, or the explicit prompt of--intercept. Nothing else creates a CA. - Key in the OS keychain only. The private key is stored in the macOS Keychain, the Windows Credential Manager or the Linux Secret Service (service
rustman, accountrecord-ca/<workspace-id>). It is never written to a file, inside the workspace or anywhere else. Without a keychain (or withRUSTMAN_SECRET_STORE=file) there is no CA, andca initfails with exit code 2:record: a keychain is required to store the CA private key. (Rustman’s own integration tests use a stand-in keychain directory; that hook exists only in test builds, compiled in by therecord-test-hooksfeature, socargo build,cargo runandcargo install, debug or release, have no such fallback.) - Outside the workspace. The public certificate lives in the user config directory (
$XDG_CONFIG_HOME/rustman/record-ca/or~/.config/rustman/record-ca/,%APPDATA%\rustman\record-ca\on Windows), so it cannot be committed by accident. The only workspace file involved is the per-clone id.rustman/workspace-id(git-ignored), created on first use like for secrets. - Narrow certificate. ECDSA P-256,
CA:truewithpathlen:0(it can sign only end-entity certificates), key usagekeyCertSign, extended key usageserverAuth(TLS server authentication only), valid for one year. Name constraints are not set: clients handle them inconsistently, and the intercept globs change between sessions. An installed CA can therefore vouch for any host while its key exists, and the recorder holds the key in memory while it runs: keep--interceptto the hosts you need (never'*'on a machine you browse with), and uninstall or rotate the CA when you are done. - Short-lived leaves, in memory. Certificates for intercepted hosts are minted on demand, only for a DNS name or an IP address (never a wildcard), valid for 7 days, cached in memory for the session (up to 1000 hosts) and never written to disk. A rotated CA’s leaves are gone with the session that minted them.
- Never trusted automatically. Only
rustman record ca installchanges a trust store, after showing the subject, SHA-256 fingerprint and expiry and asking you to typeyes(or--yes). The exact commands are printed before they run. - Undo is one command. Rustman records which stores it touched in
<config dir>/rustman/record-ca/<workspace-id>.installed, souninstallandrotateundo exactly that. - Scope first. Only hosts you list with
--interceptare decrypted; see Tunnels and interception. - Loopback only by default. Binding another address needs
--allow-remoteand prints a warning. Clients that are not on loopback can then reach only globally routable addresses through the proxy: everything else is refused by default, namelylocalhost, loopback (127.0.0.0/8,::1), unspecified, private (RFC 191810/8,172.16/12,192.168/16), shared CGNAT100.64.0.0/10(with the metadata service100.100.100.200), link-local (169.254.0.0/16with cloud metadata,fe80::/10), unique localfc00::/7(withfd00:ec2::254),192.0.0.0/24, benchmarking198.18.0.0/15, documentation ranges, multicast,240.0.0.0/4, broadcast, every IPv6 address outside global unicast2000::/3and, inside it,2001::/23(Teredo and IETF assignments),2001:db8::/32and3fff::/20, and IPv6 addresses wrapping such an IPv4 address (IPv4-mapped and IPv4-compatible, NAT6464:ff9b::/96, 6to42002::/16). These are the same rules as the plugin network (one classifier,rustman_http::address::is_public_ip). Literal addresses get403at once; names and other spellings (127.1,2130706433, a DNS name pointing at10.0.0.5or169.254.169.254) are checked after DNS, for tunnels, forwarded plain requests and requests inside intercepted tunnels alike, and refused with502. The check is made on the resolved addresses that are then connected to, so a name cannot resolve to a public address for the check and to a private one for the connection (DNS rebinding). Clients on loopback (this machine) may record local and private targets as before, and reverse-proxy mode is not checked: its upstream is your own choice. - Bounded connections. At most 512 client connections are served at once (an open tunnel counts until it closes; more wait), and a client has 30 seconds to send each request head (inside intercepted tunnels too) or to finish the TLS handshake of an intercepted tunnel. An intercepted HTTP/2 connection carries at most 100 requests at once, the copies of bodies in flight share the
max_buffer_bytesbudget, and idle tunnels and connections, plain ones with a stalled request body included, are closed after 5 minutes (see Timeouts), so memory and connection slots stay bounded. - Upstream TLS is verified. The proxy checks upstream certificates with the same rules as
rustman send(see Upstream TLS); turning verification off is possible only for one--upstreamhost.
Run rustman record ca uninstall when you are done recording (or rustman record ca remove to delete the CA as well), and rustman record ca rotate if you suspect the key was exposed.
Trusting the CA
rustman record ca install uses the platform tool:
| System | Install | Uninstall |
|---|---|---|
| macOS | security add-trusted-cert -r trustRoot -p ssl <cert> (your keychain; macOS may ask for your password) | security remove-trusted-cert <cert>, then security delete-certificate -Z <SHA-1> |
| Windows | certutil -user -addstore Root <cert> (current user, no administrator rights) | certutil -user -delstore Root <SHA-1> |
Linux with update-ca-certificates (Debian, Ubuntu, Alpine) | sudo install -m 644 <cert> /usr/local/share/ca-certificates/rustman-record-<id>.crt, then sudo update-ca-certificates | sudo rm -f /usr/local/share/ca-certificates/rustman-record-<id>.crt, then sudo update-ca-certificates --fresh |
| Linux with p11-kit (Fedora, Arch) | sudo trust anchor --store <cert> | sudo trust anchor --remove <cert> |
On other systems ca install exits with code 2 and names the certificate file to trust by hand.
Some clients keep their own trust store:
- Firefox (its NSS store is not managed by Rustman): open Settings, Privacy & Security, Certificates, View Certificates, Authorities, Import, select the file written by
rustman record ca export --out rustman-ca.pem, and tick “Trust this CA to identify websites”. Remove it from the same dialog when you are done. Alternatively setsecurity.enterprise_roots.enabledtotrueinabout:configto use the OS store. - Node.js:
export NODE_EXTRA_CA_CERTS=rustman-ca.pem. - Python requests:
export REQUESTS_CA_BUNDLE=rustman-ca.pem(this replaces the default bundle for that shell). - curl:
curl --cacert rustman-ca.pem ....
Saving captures as request files
--save writes the captures as request files when you stop recording with Ctrl+C. It needs a workspace, and the flags are checked before the proxy starts.
$ rustman record --save --env staging
Recording proxy on http://127.0.0.1:8888
...
GET https://api.example.com/users/17 200 31 ms 120 B
GET https://api.example.com/users/42 200 28 ms 118 B
^C
Saved 1 request file (0 unchanged), environment 'staging'
Secrets parameterized (values not stored; use --store-secrets or 'rustman secret set <name> --env staging'): auth_token
A session that recorded no request (nothing at all, or only tunnels and rejected handshakes) writes nothing, not even the environment, and prints No requests recorded; nothing saved instead of a summary. The TUI’s w says the same for marked captures without a request.
Saving goes through the same pipeline as rustman import:
- Paths are templatized. Segments that look like identifiers (integers, UUIDs, 24-hex ObjectIds, ULIDs) become variables named after the previous segment in singular form:
/users/42becomes/users/{{user_id}},/orders/9b2c…/itemsbecomes/orders/{{order_id}}/items. Without a usable previous segment the name isid_1,id_2… The first value seen is the variable’s default in the environment. Since UUIDs and ULIDs cannot be guessed, a save that keeps one as a plain default says so with a warning naming the variables, so you can review the environment file before committing it. Segments that look like secrets become secret variables instead, declared undersecrets:like the other placeholders and kept out of the URL, the file name and the committed defaults:- a segment holding a known token format (
ghp_…), or a compact random token: 20 characters or more of letters, digits,-and_, mixing uppercase, lowercase and digits, less than half of it words. The last segment of a Slack webhook/services/T0…/B0…/<secret>becomes{{path_secret}}({{<word>_secret}}after a plain word such as/hooks/), and the file name showssecretin its place. camelCase names (listOrganizationMembersV2), lowercase slugs and hex hashes stay as they are; - a UUID or ULID after a segment that names a credential or a one-time link (
reset,verify,confirm,activate,invite,magic-link,recover,unsubscribe, or a secret name such astokensorsessions):/password/reset/<uuid>becomes/password/reset/{{reset_id}}, withreset_ida secret. After such a segment, a token in any case (16 characters or more, with letters and digits, mostly not words) is a secret too, so a hex reset token/password/reset/5f4dcc3b…becomes/password/reset/{{reset_secret}}. Integer ids stay plain variables. - whichever rule applies, a secret path variable holds the value of the capture its file saves; when another request (or a plain default) already gives the name another value, the new value gets a suffixed name (
reset_id_2), so every secret a saved file carries is declared and scrubbed wherever it repeats (aRefererheader, say).
- a segment holding a known token format (
- Captures are deduplicated. One file per method and templated path, named after them (
GET /users/17andGET /users/42giveget-users-id.rman.yaml), with the most recent capture as the example (headers, query, body). Transport andProxy-*headers are left out; a truncated or binary request body is not saved, with a warning. A request that got no response (the upstream could not be reached) is still saved, as a starting point, with a warning naming it. - The base URL goes to the environment.
--env <NAME>(defaultrecorded) getsbase_url(scheme, host and port), so URLs read{{base_url}}/users/{{user_id}}. Another origin in the same save getsbase_url_2,base_url_3… and a warning. An origin the environment already holds under one of these names keeps it, and a new origin never takes a name the environment uses for another value, so a later session over part of the same traffic writes the same URLs. - Secrets become placeholders.
Authorization: Bearer eyJ…is saved asAuthorization: Bearer {{auth_token}},Cookieas{{cookie}}, andX-Api-Key-style headers, query and body fields named liketoken,password,secretorapi_key, values starting with an auth scheme (Bearer …) in any header or body field, and known token formats (ghp_…,AKIA…, JWTs…) under any name get placeholders named after them. A barerefreshfield (as in{"access": …, "refresh": …}) counts as a secret name. Inside a JSON object or array named like a credential (credentials,auth,authentication,authorization,oauth,token,secret…), at any depth, a field whose name only holds a value (value,data,raw,current,new,old,access…) or whose value looks random gets a placeholder named after both:{"credentials": {"type": "password", "value": "…"}}is saved as{"credentials": {"type": "password", "value": "{{credentials_value}}"}}. Descriptive fields such astypeoruserare kept, and the rest of the body keeps its layout. A body that holds JSON is judged as JSON whatever itsContent-Type(browsers send a string body fromfetchastext/plain). A placeholder never takes a name a path variable or base URL of the save already uses for another value ({{token_id_2}}). Each name is declared undersecrets:in the environment. A name the environment already declares as a secret is reused for the same field in a later session (the value is not compared, since it may be stored nowhere; with--store-secretsthe recorded value replaces the stored one); a plain variable of the same name is left alone and the secret gets a suffixed name (api_key_2). The raw values are written nowhere: with--store-secretsthey are stored in the secret store (the OS keychain), otherwise set them withrustman secret set <name> --env <NAME>. Long random-looking header, query, JSON body values and URL path segments that none of these rules catch are kept but reported with a warning (a body field by its dotted path,nested.blob, a path segment by its position; the value is never printed, and control characters in names are shown escaped); a value that did become a placeholder is never reported as kept. - Files are written deterministically. Files go to
--into <DIR>(inside the workspace), or by default torecorded/<host>/with the host written as a file name (api.example.combecomesrecorded/api-example-com/,localhost:8080becomesrecorded/localhost-8080/). Saving the same captures again, in the same or a later session, changes nothing; a file that differs is overwritten with the recorded version, with a warning, so review the diff before committing. A_collection.yamlkeeps theorder:entries of earlier saves whose files are still there, ahead of the new ones, so saving part of the traffic again drops nothing.
Saving never writes a raw secret, but review the saved files before committing them: secret detection works on names and known formats, and the warnings point at values it was unsure about.
HAR export
--har <FILE> writes every capture still in the buffer to FILE as HAR 1.2 when you stop recording with Ctrl+C, before --save runs. The path is relative to the current directory, and missing folders are created. The file is readable and writable by you only, redacted or not: mode 0600 on Unix (an existing file included), an access list for your user alone on Windows.
$ rustman record --intercept "*.example.com" --har session.har
Recording proxy on http://127.0.0.1:8888
...
^C
Wrote 3 captures to /home/me/app/session.har
What the file holds:
- One entry per capture, oldest first: the request (method, URL, HTTP version, headers, query, body) and the response (status, headers, body), the start time and the duration as
wait. Bodies are the stored part only; text bodies are written as text, others base64-encoded ("encoding": "base64"incontent, a comment inpostData).cookiesarrays are empty: theCookieandSet-Cookieheaders carry them. - Secrets redacted.
Authorization,Proxy-Authorization,CookieandSet-Cookievalues become«redacted:<Header>», and the credentials they carry are redacted wherever they reappear (an echoing server, the URL). Every value that saving would turn into a placeholder (see Secrets become placeholders: secret-named headers and fields, auth scheme values such asBearer …, known token formats under any name, secret path segments, neutral fields of credential objects) is redacted the same way, in the HAR, the--jsonlines and the TUI alike. In the URL, the placeholder is percent-encoded so it stays a valid URI.--show-secretswrites the values as they are; keep such a file out of Git. - Comments for what a viewer would misread. A tunnel that was not decrypted is a
CONNECT https://host:port/entry with status 0 and the commenttunnel: not decrypted; <up> B up, <down> B down. A rejected handshake is aCONNECTentry withTLS REJECTED: <hint>. A truncated body saystruncated: response body stored <n> of <total> bytes(orrequest), a decrypted exchange saysdecrypted by the Rustman local CA, and a failed exchange carries its error.
The TUI recorder pane
Alt+P (or Traffic recorder in the palette) shows the recorder pane in place of the request and response panes; Esc or Alt+P hides it, and the proxy keeps running while it is hidden. The pane shows the proxy’s state and address, the intercepted host globs, the number of captures and how many are marked; the capture list newest first (time in UTC, method, host, path, status, duration and size; TUNNEL host:port with byte counts; TLS REJECTED host), and the selected capture: the request line, the HTTP version, status and duration, then the request and response headers and bodies. Everything is redacted as in the HAR export: a captured Cookie: sid=abc shows as Cookie: «redacted:Cookie».
| Key | What it does |
|---|---|
s | Start or stop the proxy. It binds [record] host and port from rustman.toml (default 127.0.0.1:8888) and decrypts [record] intercept hosts with the workspace’s local CA (it must exist: run rustman record ca init). An address reachable from the network asks for confirmation first (Cancel is preselected); while such a proxy runs, the pane shows REACHABLE FROM THE NETWORK and the status bar a red RECORDER ON NETWORK badge. |
Up/Down, j/k, g/G | Select a capture. The top row follows new captures; another selected capture stays selected as captures arrive. |
PageUp/PageDown | Scroll the selected capture. |
Space | Mark or unmark the selected capture (* in the list). |
a | Mark every shown capture, or unmark them all when they all are. |
/ | Filter the list: type text the rows must contain (case-insensitive); Enter keeps the filter, Esc clears it. |
w | Save the marked captures (or the selected one) as request files, exactly like --save with the default folder and the recorded environment. Secrets become placeholders; their values are never stored from the TUI (set them with rustman secret set). |
e | Export the marked captures (or the selected one) as HAR, redacted: asks for the file name (recording.har first), relative to the workspace root. |
The status bar shows record <addr> while the proxy runs, and a CA TRUSTED badge in the warning colour while Rustman has this workspace’s CA installed in a trust store (read when the pane is opened and when the proxy starts), as a reminder to run rustman record ca uninstall when you are done.
Monitors
A monitor runs some of a workspace’s requests on a schedule and keeps the results locally, so “is this still working right now?” has an answer without a SaaS. Monitors are plain files in the workspace; their results stay on the machine in .rustman/monitors/, which Git must ignore.
The behavior is specified in openspec/specs/monitors. This page covers monitor files, schedules, one-shot runs and their safety policy, alerts and notification channels, the daemon and external scheduler recipes, the status and history views (CLI and TUI), and the result store with its retention.
Monitor files
Each file monitors/<name>.rman-monitor.yaml defines one monitor:
# monitors/api-health.rman-monitor.yaml
version: 1
name: api-health
targets: [health/]
environment: prod
schedule: {every: 5m}
timeout: 60s
| Field | Meaning |
|---|---|
version | Always 1. |
name | The monitor’s name: letters, digits, - and _, the same as the file name without .rman-monitor.yaml. The result store is named after it. |
targets | Request files or collection folders, relative to the workspace root, run in workspace order (like rustman run). At least one. |
environment | The environment the requests resolve with. |
schedule | Exactly one of cron or every; see Schedules. |
timeout | The deadline of a whole run (default 60s); every request’s own timeout still applies. |
allow_mutations | true lets POST, PUT and PATCH requests be sent; see Read-only by default. |
alerts | Alert rules and notification channels; see Alerts. |
Durations are a whole number followed by ms, s, m, h or d: 500ms, 30s, 5m, 1h, 30d.
An invalid file stops every monitor command with exit code 2 and the file, line and reason:
error: monitors/api-health.rman-monitor.yaml:5: schedule must set exactly one of cron or every
rustman monitor list lists the monitors (--json for a JSON array):
NAME SCHEDULE ENVIRONMENT TARGETS
api-health every 5m prod health/
Schedules
schedule: {every: 5m}
every takes an interval from 30s to 24h; every: 5s fails with every must be at least 30s.
schedule:
cron: "*/15 * * * *"
tz: Europe/Lisbon
cron takes a standard 5-field expression (minute, hour, day of month, month, day of week) or @hourly, @daily or @weekly. It is evaluated in tz, an IANA timezone name, and in the machine’s local timezone without one. tz applies to cron only.
Daylight saving time follows the usual cron rules:
- On the spring-forward day, a fixed time inside the skipped hour (
30 2 * * *in New York) runs right after the gap, at 03:00, once. - On the fall-back day, a fixed time inside the repeated hour runs once, on the first pass.
- Wildcard and step fields (
0 * * * *,*/15 * * * *) run in real time: an hourly monitor runs every 60 minutes through both transitions, so it skips the missing hour and runs twice in the repeated one.
One-shot runs
rustman monitor run <name> runs a monitor once; --all runs every monitor of the workspace, one after the other. It is the command external schedulers call:
*/5 * * * * cd /srv/ws && rustman monitor run api-health
A run uses the same engine as rustman run: the same request loading, variable resolution, assertions and captures. Monitor runs do not write history. Each run prints one line, then one line per failure:
api-health: fail in 123 ms
health/status: status: expected 200, got 503
| Exit code | Outcome stored | When |
|---|---|---|
| 0 | pass | Every request passed. |
| 1 | fail | An assertion failed and no request errored. |
| 2 | (none) | An invalid monitor file, an unknown monitor, a missing target or environment, or a target that is not an HTTP request. |
| 3 | error | A request errored (network, TLS, timeout, unresolved variable) or the run passed its timeout. |
| 4 | error | A request was blocked by the monitor policy. |
| 130 | skipped | Interrupted by Ctrl+C (message interrupted). |
With --all the exit code is the most severe one: 130, then 4, 3, 1 and 0.
The timeout is a deadline for the whole run: when it passes, the requests in flight are cancelled, the rest are skipped, and the result is error with the message run exceeded its timeout of 60s.
Monitors run HTTP requests (kind: http). A target that holds another kind fails with exit code 2.
Read-only by default
Every monitor request goes through the safety policy with a GovernedSender:
- Allowlist. Requests may go only to the hosts of the monitor’s environment: the origins of its URL-valued variables (such as
base_url) and of the monitor’s requests as they resolve with it. A redirect to another host, or a URL built from a capture that points elsewhere, is not sent:blocked: host not allowed (https://other.example.com:443).[safety].allowed_hostsdoes not widen it. Because the origins of the requests count, a target request file with a hard-coded URL (not built from an environment variable) allows that URL’s host: review the request files a monitor targets as part of its boundary. - Methods. GET, HEAD and OPTIONS are allowed. POST, PUT and PATCH need
allow_mutations: truein the monitor file:blocked: method POST requires allow_mutations. DELETE is never sent, whatever the file says:blocked: method DELETE is never allowed for monitors. Other methods are refused too. A request of a plugin kind is never run either (its plugin would send its own requests outside these rules):blocked: plugin request kinds are not allowed for monitors. - Rate.
[safety].rateandconcurrencyapply.
A blocked request makes the run an error and the exit code 4. The production guard does not ask for --production: the environment named in the monitor file is the confirmation, and the method rules hold on every host.
Alerts
alerts:
cooldown: 1h
rules:
- consecutive_failures: 3
- failures_in_window: {count: 5, window: 1h}
- latency_p95_gt: 800
window: 15m
- assertion_failed: health/status
- status_not: 2xx
notify:
- desktop: true
- webhook: {url: "{{slack_hook}}", template: slack}
- email: {host: smtp.example.com, port: 587, from: monitor@example.com, to: [ops@example.com], username: "{{smtp_user}}", password: "{{smtp_password}}", tls: starttls}
Each rule sets exactly one of consecutive_failures (default rule: consecutive_failures: 2), failures_in_window, latency_p95_gt (with an optional window, default 15m), assertion_failed (a request id) or status_not (a code such as 200 or a class such as 2xx). cooldown defaults to 1h.
Notifier credentials never live in monitor files: a webhook url and an email password must be exactly one {{name}} reference to an environment variable or secret, and a literal value is refused when the file loads (without echoing it). Declare them as secrets of the environment (rustman secret set slack_hook --env prod), so they stay in the keychain or .rustman/secrets.yaml.
Rules
Rules are evaluated after every run, one-shot or daemon, against the stored results. Skipped runs are ignored.
| Rule | Fires when |
|---|---|
consecutive_failures: N | The last N executed runs failed or errored. With N: 3, it fires after the third failing run and not before. |
failures_in_window: {count, window} | At least count runs failed or errored within window before the latest run. |
latency_p95_gt: <ms> | The p95 latency of the runs within window (default 15m) is above the threshold. |
assertion_failed: <request> | The assertions of that request (its id, such as health/status) failed in the latest run. |
status_not: <code or class> | A response of the latest run has another status (200, or a class such as 2xx). |
A rule fires when its condition holds after a run and resolves when it no longer does:
- Deduplication. A firing rule notifies once, not after every failing run.
- Cooldown. While it keeps firing, it sends a reminder (
[STILL FIRING]) oncecooldown(default1h) has passed since its last notification. - Recovery. When it resolves, a
[RESOLVED]notice says how long the outage lasted: a rule firing since 10:00 and resolved by a passing run at 10:42 reportsthe outage lasted 42 minutes.
The alert state lives in state.json, under the same lock the daemon and one-shot runs share, so a rule fires once whichever of them runs the monitor, and restarts do not resend it.
Notification channels
Every alert goes to every channel of notify, all at once. Each channel gets 10 seconds per attempt and one retry; a channel that fails is reported (on stdout after rustman monitor run, in the daemon’s log) and never stops the others or later runs.
desktopshows an OS notification with the system’s own tool:osascripton macOS,notify-sendon Linux and the BSDs, and the Windows toast API through PowerShell (under Windows PowerShell’s registered app id). Nothing is linked or installed. A tool that hangs is killed after 10 seconds.webhookPOSTs JSON through the same HTTP engine as requests (proxies and[http] ca_bundleapply). A response outside 2xx is a failure, and redirects are not followed. The URL must behttps://; plainhttp://is accepted only tolocalhostor a loopback address. Theslacktemplate sendstextplus an attachment naming the monitor, the environment, the rule and the latest failure;discordsends an embed with the same fields;genericsends a flat object.emailsends a plain-text mail over SMTP withlettreon rustls: STARTTLS (tls: starttls, port 587) or TLS from the first byte (tls: tls, port 465). Plain-text SMTP is never used: a server that does not offer STARTTLS fails the delivery before any credential is sent. Certificates are checked against the OS roots plus[http] ca_bundle. Email needs a build with thesmtpfeature, which release binaries have (from source:cargo install --path crates/rustman-cli --features smtp); without it the channel fails withemail notifications need rustman built with the smtp feature.
Notifications are titled [FIRING] api-health: consecutive_failures: 3, [STILL FIRING] …, [RESOLVED] … or [TEST] api-health.
A workspace can replace a built-in webhook template with monitors/templates/<slack|discord|generic>.json.j2, a minijinja template that must render JSON. It sees monitor, environment, status (firing, reminder, resolved or test), rule, title, text, failure, at (RFC 3339), timestamp (Unix seconds), duration_seconds, color (#rrggbb) and color_int, and a tojson filter:
{"summary": {{ title | tojson }}, "env": {{ environment | tojson }}, "details": {{ text | tojson }}}
Redaction
Payloads, emails, desktop notifications, stored results, logs and status output go through the same redaction as every other output: the values of the environment’s secrets and of the channel’s credentials are replaced with «redacted:name», even when a server echoed one into an assertion message. A webhook URL is never printed: channels are named webhook (slack) or email (smtp.example.com), and an error such as an unreachable host shows the URL redacted.
Testing the channels
rustman monitor test-alert <name> sends [TEST] <name> through every channel and prints each outcome:
webhook (slack): ok
email (smtp.example.com): error: smtp: permanent error (535): authentication failed
It exits 0 only when every channel succeeded, 3 otherwise, and 2 when the monitor has no channels.
The result store
Each run appends one JSON line to .rustman/monitors/<name>/:
.rustman/monitors/api-health/
raw/2026-03-01.jsonl one result per line, one file per UTC day
hourly.jsonl hourly aggregates of compacted days
state.json the last run, the last compaction and the alert state
A result holds the time, the outcome (pass, fail, error or skipped), the total latency, the run’s counts (the summary fields of a run report), each request’s id, status, response code and latency, and the failure messages, redacted like every other output: a secret in an assertion message is stored as «redacted:name».
{"at":"2026-03-01T10:00:00Z","outcome":"fail","duration_ms":123.4,"summary":{"total":1,"passed":0,"failed":1,"errored":0,"skipped":0},"requests":[{"id":"health/status","status":"failed","code":503,"duration_ms":123.1}],"failures":["health/status: status: expected 200, got 503"]}
Writes are safe with concurrent writers, such as the daemon and a one-shot run under cron: an append holds an exclusive lock on the day file and writes its line in one write, and state.json and hourly.jsonl are replaced atomically (a temporary file renamed over them) under a lock file. A line that does not parse is skipped when reading.
The store must not be committed. When .rustman/ is not git-ignored (Git decides inside a repository; otherwise the workspace’s .gitignore must list it), storing a result prints:
warning: .rustman/ is not git-ignored
rustman init adds .rustman/ to .gitignore.
Retention and compaction
Raw results are kept for 7 days. After that, compaction replaces each whole UTC day older than 7 days with hourly aggregates: the number of runs, passes, failures, errors and skipped runs, and the p50, p95 and maximum latency of the runs that executed. The counts stay the same. Aggregates are kept for [monitors].retention, 30 days by default, and deleted after that:
[monitors]
retention = "90d" # at least 7d
Compaction runs when the daemon starts, then after runs (one-shot or daemon) when the last one was a day ago or more. A compaction cut short is safe to run again: the aggregates of a day replace any earlier ones for the same hours.
The daemon
rustman monitor daemon runs every monitor of the workspace on its schedule until it is stopped. It logs one line per run, skip and reload to stderr:
2026-03-01T10:00:00Z monitor daemon started: 2 monitor(s), no listening port
2026-03-01T10:00:00Z api-health: pass in 87 ms
2026-03-01T10:00:30Z api-health: skipped: previous run still in progress
2026-03-01T10:01:00Z api-health: fail in 120 ms (health/status: status: expected 200, got 503)
2026-03-01T10:01:00Z api-health: alert: [FIRING] api-health: consecutive_failures: 2
2026-03-01T10:01:00Z api-health: webhook (slack): ok
- Schedule. An
everymonitor runs at start, then every interval; acronmonitor at its next occurrence. A daemon that wakes up late (the laptop slept) runs once and carries on from now: missed runs leave a gap, not a burst, andstatusshows it as coverage. - No overlap. A run that comes due while the monitor’s previous run is still going is skipped and stored as
skipped; the next run starts on its own due time. - Reload. Monitor files are re-read every 2 seconds. A changed schedule applies at once without a restart (
every: 5mtoevery: 1mruns a minute later), new monitors start, removed ones stop. An edit that does not load is logged and the previous monitors keep running. - One per workspace. The daemon holds
.rustman/monitors/daemon.lock(its pid is indaemon.pid). A second one fails withmonitor daemon already running (pid <n>)and exit code 2. - Stopping. Ctrl+C or SIGTERM starts no new run and gives the runs in flight up to 10 seconds to finish; then they are cancelled and stored as
skipped(interrupted), so a restart counts toward neither uptime nor the alert rules and sends no notice. A second Ctrl+C cancels them at once. The daemon exits 0. - No port. The daemon opens no listening socket; it only sends.
External schedulers
The daemon is optional: rustman monitor run <name> does the same work once, so cron, systemd timers, launchd or CI schedules can drive monitors, sharing the store and the alert state. rustman monitor schedule-recipe <name> --for cron|systemd|launchd|github-actions prints a ready-to-use configuration on the monitor’s schedule; it writes nothing unless --write <path> is given, and never installs anything. There is no Windows Task Scheduler recipe: on Windows, use rustman monitor daemon, github-actions, or a scheduled task that runs rustman monitor run <name> in the workspace folder.
| Scheduler | every | cron |
|---|---|---|
cron | Mapped to cron when the interval divides an hour or a day (5m is */5 * * * *, 6h is 0 */6 * * *) | As written, with CRON_TZ for tz |
systemd | OnUnitActiveSec | OnCalendar, with tz |
launchd | StartInterval | StartCalendarInterval (the Mac’s timezone) |
github-actions | Mapped to cron as above | As written, macros expanded (GitHub uses UTC) |
An interval with no cron equivalent (every: 45s), or a cron expression a calendar cannot express (a day of month and a day of week together, a stepped range), is refused with a hint. For monitors/api-health.rman-monitor.yaml with schedule: {cron: "*/15 * * * *", tz: UTC}, --for github-actions prints:
# .github/workflows/monitor-api-health.yml: runs the api-health monitor (cron */15 * * * * (UTC)).
# GitHub runs scheduled workflows at most every 5 minutes, sometimes late.
name: monitor api-health
on:
schedule:
- cron: "*/15 * * * *"
workflow_dispatch: {}
jobs:
monitor:
runs-on: ubuntu-latest
timeout-minutes: 16
env:
# Secrets come from .rustman/secrets.yaml: add a step that runs
# printf '%s' "${{ secrets.NAME }}" | rustman secret set NAME --env prod
RUSTMAN_SECRET_STORE: file
steps:
- uses: actions/checkout@v4
- name: Install rustman
run: cargo install --git https://github.com/CyberdyneCorp/rustman rustman-cli --locked
- name: Run the monitor
run: rustman monitor run api-health
Runs from a scheduled workflow keep their store in the job’s checkout, so alert deduplication only holds across runs that share .rustman/ (a self-hosted runner, or a cache step).
Status and history
rustman monitor status reads the store only (no network) and shows, for every monitor, its last outcome, uptime over 24 hours, 7 days and 30 days, the p95 latency of the last 24 hours with a sparkline of the 24 hourly p95 values, coverage, and the firing rules:
api-health (prod, every 5m)
last fail 3 minutes ago (2026-03-01T10:00:00Z)
uptime 98.95% 24h · 99.71% 7d · 99.90% 30d
p95 24h 123 ms ▁▂▂▃▃▂▁▁▂▃▅▇█▆▄▃▂▂▁▁▂▂▃▃
coverage 99.65%
firing consecutive_failures: 2 (since 2026-03-01T09:55:00Z)
- Uptime is passes over executed runs: skipped runs do not count. 288 runs in a day with 3 failures and 1 skipped is
98.95%(284/287). Older periods count the hourly aggregates of compacted days. - Coverage is executed runs over the runs the schedule expected in the last 24 hours (or since the first run): gaps from a sleeping laptop or a stopped daemon lower it, not the uptime.
--jsonprints the same data:{"monitors": [{"name", "environment", "schedule", "last", "uptime": {"24h", "7d", "30d"}, "p95_24h_ms", "hourly_p95_ms", "sparkline", "firing", "coverage_24h"}]}.--vizalso opens the trend view in the viz companion: uptime gauges, the hourly p95 latency over the last 30 days, and a heatmap of outcomes by UTC hour of day (themonitor_trendmessage of the viz protocol), and printsmonitor trends opened in <companion>on stderr. Without a companion, or with one that has nomonitor_trendview (the currentrustman-vizdoes not draw it yet), it printsnote: the viz companion is unavailable for monitor trends (<why>); showing the text statuson stderr. The text status is printed either way, and the exit code is 0.
rustman monitor history <name> lists the stored results, newest first, with their outcome, latency and failure messages. --since 24h keeps recent ones, --outcome pass|fail|error|skipped one outcome, and --json prints JSON lines ("kind": "run" or "hour"). Compacted days show as hourly aggregates:
2026-03-01T10:00:00Z fail 123 ms
health/status: status: expected 200, got 503
2026-02-20T10:00:00Z hourly 12 runs: 11 pass, 1 fail, 0 error, 0 skipped; p95 120 ms
The TUI Monitors view
In the TUI, Monitors in the command palette (monitors.open) lists each monitor with its last outcome, 24-hour uptime, latency sparkline and whether a rule is firing, with the selected monitor’s firing rules and latest results below. j/k select, r runs the selected monitor now, and Esc closes. The run goes through the same cycle as rustman monitor run (the monitor policy, the store, alerts and notifications) in the background: the UI keeps responding, the row shows running, and the list refreshes when it finishes. v opens the same trend view as rustman monitor status --viz in the background, or says why the companion cannot show it.
API docs
rustman docs build turns a workspace into a static documentation site: collections become sections, requests become endpoint pages. The site is plain HTML, CSS and a small script, works offline and over file://, and is deterministic, so it can be committed and reviewed in Git. --format markdown writes the same content as GitHub-flavored Markdown instead, and --format both writes both side by side.
$ rustman docs build
wrote 12 files to site/
The behavior is specified in openspec/specs/api-docs-generation.
The generated site
index.htmllists every section (a collection, or a nested folder as a subsection) in workspace order, with its description and its endpoints. Requests at the workspace root form a section named after the workspace.endpoints/<slug>.htmlis one page per request. The slug comes from the request’s path (users/create.rman.yaml→users-create), with-2,-3… on collisions, assigned in workspace order.assets/app.<hash>.css,assets/app.<hash>.jsandassets/search-index.<hash>.jsare named after their content, so browsers never keep a stale copy.search-index.jsonis the search index (endpoint names, methods, paths, descriptions and parameter names).reference/<slug>.htmlholds the GraphQL schema and JSON-RPC method pages (see Protocol references)..rustman-docs-manifestlists the files the build wrote.
An http endpoint page shows:
| Part | Content |
|---|---|
| Request line | The method and URL template, with variables kept as {{name}} |
| Description | The request’s description, then its docs.description, rendered as CommonMark |
| Auth | The scheme name (basic, bearer, api_key, oauth2, digest, aws_sigv4, jwt), never credentials |
| Query parameters, Headers | Tables with the enabled rows; headers include the ones inherited from collections |
| Body | The body type, then one row per field (top-level JSON keys, form fields, multipart parts) or the raw text |
| Expected behavior | One Expected: ... line per assertion, such as Expected: status 201 |
| Produces | One Produces: {{var}} from ... line per capture |
| Example response | Only for requests that opted in (see Examples) |
| Code samples | One tab per language (see Code samples) |
Requests of other kinds (graphql, jsonrpc, grpc, mcp, ws, sse, and kinds this build does not know, which are read as opaque requests instead of failing the build) get a page listing their request-file fields as a table, with the same redaction: header and metadata values of Authorization, Cookie, Set-Cookie, Proxy-Authorization and X-Api-Key are masked, and auth shows its type only.
Navigation and content are plain HTML and readable with JavaScript disabled; only the search box and the theme toggle need JavaScript. Raw HTML in descriptions is shown as text, links other than http(s), mailto, fragments and relative paths become #, and Markdown images become links, so a page never loads anything from the network.
Search
The search box filters the prebuilt index in the browser: every word typed must match a name, method, path, kind, description or parameter name, as a word prefix, a substring, or (three letters or more) the letters of one word in order (lgn finds login). Redaction placeholders are never indexed. A page opened with ?q=users starts with that search.
Themes
The site follows the browser’s prefers-color-scheme. The toggle in the header stores the choice in local storage; when storage is unavailable (private windows, file:// restrictions), the system preference is used. Both themes meet WCAG AA contrast for text, checked by a test over the CSS tokens.
OpenAPI enrichment
For a collection imported with rustman import openapi, the import snapshot under .rustman/openapi/ adds to each request generated from an operation (matched by its openapi:operationId= or openapi:path= tag): the operation’s summary, its description (only when the request file has none: the request file wins), parameter descriptions in the query and header tables, request and response schemas, and a deprecated badge on the page and in the navigation.
The [docs] table
All keys are optional:
[docs]
title = "Shop API" # default: the workspace name
logo = "brand/logo.png" # a PNG/JPEG/GIF/WebP/ICO file inside the workspace, copied into assets/
examples = ["users/list", "Get user"] # requests (ids or names) that publish an example
example_redact_paths = ["$.users[*].email"]
publish_variables = ["base_url"]
samples = ["curl", "httpie", "fetch", "python", "rust"]
template_dirs = ["docs-templates"]
samples and template_dirs are described in Code samples.
Request file docs key
version: 1
kind: http
name: List users
docs:
example: true # publish the latest recorded exchange
hidden: true # leave the request out: no page, navigation or search entry
description: |
Extra **Markdown** shown after the request's description.
url: "{{base_url}}/users"
Examples
A request shows a recorded response only when it opts in, with docs: {example: true} or by being listed in [docs].examples; other requests show none. The example is the latest exchange with a 2xx status from request history, labeled with its recording date, or with --examples snapshot the request’s stored default snapshot. It shows the status, the response headers (without Date, Server, Connection, Keep-Alive, Transfer-Encoding and Content-Length) and the body, pretty-printed when it is JSON. Bodies longer than 64 KB are cut with a note. The build prints published example: <id> for each one on stderr.
Personal data that is not a declared secret can be masked with example_redact_paths: every value a JSONPath selects becomes «redacted:<path>».
Redaction
Every value written to the site passes the environments redaction step: the secret values of every environment, read from the secret store, appear as «redacted:<name>», and so do literal credentials written in request and collection files. Authorization, Cookie, Set-Cookie, Proxy-Authorization and X-Api-Key values are always masked in examples, and so are the values of headers whose name has a credential word (token, secret, password, passwd, apikey, auth, credential, or api followed by key, split on - and _: X-Auth-Token, X-Client-Secret); on endpoint pages they are shown only when they are a variable reference such as Bearer {{token}}. A literal value of such a header, or of api_key auth, is masked in every code sample as «redacted:<Header-Name>». Literal credentials elsewhere in a request file are masked the same way in pages, code samples, examples and the search index: the user:password part of a URL (as «redacted:userinfo», and the password alone as «redacted:password»), and the values of query parameters and body fields (JSON at any depth, form and multipart fields, GraphQL variables, JSON-RPC, MCP and gRPC params) whose name reads like a credential: one containing password, token, secret or api_key, or one of the header credential words above (?api_key=… becomes ?api_key=«redacted:api_key»). Values that are {{variable}} references, and values shorter than 6 characters, are left as written.
After rendering, a leak scan looks for every known secret value in every output file, as is and in its JSON-escaped, HTML-escaped, URL-encoded, base64 and hex forms. A file with a hit is not written (a previous copy is deleted) and the build fails:
error: secret value found in site/endpoints/users-list.html
Variables
Variables appear by name only: {{base_url}}/users. A value is published only when the variable is listed in [docs].publish_variables and --env <name> selects the environment to take it from; the index page then has a Variables table. A secret cannot be published:
error: token is a secret and cannot be published
Code samples
Each http page, and each graphql and jsonrpc (over HTTP) page, which are sent as a POST, shows code samples made by the same snippet engine as rustman export snippet --placeholders, so with no environment selected the two print the same code, byte for byte, for requests without secret or dynamic variables (the differences are listed below). The default tabs are curl, httpie, fetch (JavaScript), python (Requests) and rust (reqwest), in that order; the tabs work without JavaScript. JSON, form, multipart and file bodies use each language’s own API.
Samples never read an environment or the secret store:
- Variables stay as
{{name}}in curl and HTTPie, and become constants declared at the top of code (BASE_URL = "{{base_url}}"). Values fromrustman.toml [variables], collection and requestvariablesare workspace content and fill those constants. - A variable declared as a secret in any environment is
«redacted:name». - Dynamic values (
{{$uuid}},{{$timestamp}},{{$env NAME}}) are kept as written, so builds are reproducible and nothing is read from the machine that builds.
[docs].samples selects and orders the languages, with any id rustman export snippet --list prints or the aliases fetch, python and rust:
[docs]
samples = ["curl", "go"]
template_dirs = ["templates"]
An unknown id fails the build with exit code 2.
Custom sample templates
A file <id>.tmpl in a [docs].template_dirs folder (the first folder that has one wins) replaces the built-in template of that language, for docs only: rustman export snippet keeps the built-in templates. The template is minijinja and sees the same redacted view and filters as the built-in ones (method, url, headers, body, constants, the q, qp, lit and hv quoting filters, and comment). Its first line declares the context version it was written for:
{# docs_context_version = 1 #}
{{ comment }} {{ method }} {{ url }}
http.NewRequest({{ method|q }}, {{ url|q }}, nil)
A template that declares another version, or none, is skipped with a warning and the built-in template is used:
warning: docs: template templates/go.tmpl targets docs_context_version 0, this rustman provides 1; using the built-in go template
A template that fails to render stops the build with exit code 2. Its output passes the redaction step and the leak scan like every other page.
Markdown output
--format markdown writes README.md (the index: published variables, then a link to every section file in workspace order, nested sections indented, then the protocol references), sections/<slug>.md, endpoints/<slug>.md and reference/<slug>.md. Tables are GitHub-flavored, code samples are fenced code blocks under one ### heading per language, and bodies, schemas and examples longer than 20 lines are folded in a <details> block so the tables stay readable on GitHub. User text is escaped (Markdown punctuation with backslashes, <, > and & as entities), and descriptions are the same sanitized HTML as the site’s, written as one HTML block with no blank line (raw HTML in a description becomes a paragraph of text), so no Markdown renderer parses links or images out of them. Redaction, the leak scan, ordering and determinism are the same as for HTML.
$ rustman docs build --format markdown --out docs/api
wrote 14 files to docs/api/
Protocol references
When the workspace has visible graphql requests and a schema for their endpoint, the site gets a GraphQL schema section: one page per type (objects, interfaces, unions, enums, input objects and custom scalars, sorted by name), listing fields with their types, arguments and defaults, deprecation reasons and descriptions. The schema is the one rustman validates the request against: its schema_file, the schema_file of its [[graphql.endpoints]] entry, or the cached introspection result under .rustman/graphql/schemas/ (filled by rustman graphql introspect).
When it has visible jsonrpc requests with an OpenRPC document, from [jsonrpc.catalogs] or the rustman rpc discover cache under .rustman/cache/openrpc/, the site gets a JSON-RPC methods section: one page per method with its summary and description, params (name, required, schema), result schema, documented errors and a deprecation badge.
To find a cached schema or document, the request’s endpoint is resolved with no environment and then with each environment in turn, without the secret store or the process environment; the resolved URL is only a lookup key and is never written, the pages show the endpoint as the request file writes it. Without such requests, or without a schema or document, no section is generated. Each distinct schema or document gets one section.
Layout templates
The pages are rendered with minijinja templates: layout.html, index.html, endpoint.html and reference.html. A file with one of these names in a [docs].template_dirs folder replaces the built-in one. Templates see the page model only (site, endpoint, reference and its set, assets, root, version), whose values are already redacted and are HTML-escaped when printed; descriptions are HTML made from Markdown and are printed with |safe. Templates are rendered with trim_blocks and lstrip_blocks: a block tag ({% if %}, {% for %}) on a line of its own writes nothing, not even the line break. The leak scan also checks the output of custom templates.
The output folder
--out defaults to site/. A build replaces only the files listed in the folder’s .rustman-docs-manifest and removes the ones it no longer produces, so files you add (a CNAME, say) stay. A non-empty folder without a manifest is refused:
error: site/ is not empty and was not generated by rustman docs; use --force
Two builds of the same workspace, history and options are byte-identical, in both formats: files and navigation are sorted (workspace order, then byte-wise), GraphQL types and JSON-RPC methods are sorted by name, there are no build timestamps (the version is in the footer; example dates come from the recorded exchange), files are UTF-8 without a BOM with \n line endings on every platform, anchors are stable slugs, and assets are named after their content hash. A golden test checks the hash of every file on Linux, macOS and Windows.
Publishing to GitHub Pages
The site needs no server: publish the folder as is. A workflow that builds the docs on every push to main and deploys them with GitHub’s Pages actions (set Settings → Pages → Source to GitHub Actions):
name: docs
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Install rustman
run: cargo install --git https://github.com/CyberdyneCorp/rustman rustman-cli --locked
- run: rustman docs build --out site
- uses: actions/upload-pages-artifact@v3
with:
path: site
- id: deployment
uses: actions/deploy-pages@v4
The runner has no secret store, so secret values are unknown there: requests show {{token}} references as usual, and a literal credential written in a request file is still redacted. Builds that publish examples need the history, which lives in .rustman/ and is not committed; build those locally instead. Because the output is deterministic, committing site/ and reviewing git diff site/ also works, and --format markdown --out docs/api gives pages GitHub renders directly.
Preview
rustman docs serve builds the HTML site into a temporary folder and serves it on 127.0.0.1 only (never on other interfaces; a request whose Host is not localhost, 127.0.0.1 or [::1] gets 421, so a DNS-rebinding page cannot read it), on --port (default 4000; 0 picks a free port). It takes --env and --examples like docs build, writes nothing into the workspace, and runs until Ctrl+C:
$ rustman docs serve
docs: built 12 files
docs: serving on http://127.0.0.1:4000
Every change under the workspace folder (except .git/) rebuilds the site once changes stop for 200 ms, into a fresh folder that replaces the served one at once, and open pages reload, typically within half a second of saving. Pages get a small inline reload script that listens on /__rustman/reload (server-sent events); it is added as pages are served and is never part of docs build output.
Every response carries X-Content-Type-Options: nosniff, and files other than pages (stylesheets, scripts, the logo) are also served with Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox, so a file opened on its own runs no script. The logo is a raster image only (PNG, JPEG, GIF, WebP or ICO): an SVG logo is refused with exit code 2, because a static host would serve it without such a policy and its scripts would run on the docs origin.
When a build fails, the error is printed on stderr and shown in an overlay at the bottom of every page, over the last good build, and the server keeps running; the next successful build removes it. Build messages pass the same redaction as the site. A port that is already taken exits 2:
$ rustman docs serve --port 4000
error: docs: cannot bind 127.0.0.1:4000: address in use
Exit codes
| Code | Meaning |
|---|---|
| 0 | The site was written. |
| 1 | The leak scan found a secret value in an output file; that file was not written. |
| 2 | Usage or configuration error: a non-empty --out without a manifest (without --force), a secret in publish_variables, an unknown --env, an invalid example_redact_paths JSONPath or template, an unknown samples language, a custom sample template that fails to render, a logo outside the workspace or not a PNG, JPEG, GIF, WebP or ICO image; for docs serve, a port that cannot be bound. |
docs serve exits 0 when stopped with Ctrl+C; build errors while it runs do not stop it.
Viz companion (rustman-viz)
rustman-viz is an optional graphical companion that shows runs, explorations, load tests and large responses as native dashboards. It is a separate program built on the Raven GUI library (Apache-2.0). rustman works the same without it: nothing in rustman links Raven or needs a GPU, and when the companion is missing every command still runs. How rustman finds and starts it is described in Viz companion, and the messages they exchange in the viz protocol.
The companion is read-only. It sends no request, runs no request file and writes no workspace file. What it shows was redacted by rustman before it was sent: secrets appear as «redacted:name», and the companion has no way to reveal them.
Opening it
rustman run api/ --viz # live run dashboard while the run executes
rustman explore run --spec api.yaml --target https://staging.example.com --viz
rustman viz out/run.json # a saved run report
rustman viz .rustman/explorations/<id>/report.json # exploration dashboard
rustman viz .rustman/explorations/<id>/report.json --view graph # API graph
rustman bench checkout/ --target https://staging.example.com --viz # live bench dashboard
rustman viz out/bench.json # a saved bench report (--report json=out/bench.json)
In the TUI, v in the response viewer opens the current response in the inspector.
Views
Run dashboard
- KPI tiles: requests, assertion pass rate, p50 and p95 latency, and errors (requests that got no response). Each tile has a sparkline of its history. While a run is in progress the requests tile reads
done / planned. - Outcomes: a donut of 2xx, 3xx, 4xx, 5xx, transport errors and cancelled requests.
- Latency over time and a latency histogram with a logarithmic axis. Each histogram bucket is labelled by its upper bound in milliseconds.
- Requests: one row per request file, with its count, pass rate, p50, p95 and latency trend.
The state badge reads Running, Completed, Aborted or, if rustman went away before the end, Producer disconnected. The dashboard keeps the last state it received. Live dashboards are redrawn at most 10 times a second. When updates arrive faster than that, progress updates are merged, but findings and final summaries are always kept.
Exploration dashboard
- Heatmap: one row per operation and one column per status class (2xx, 3xx, 4xx, 5xx, no response). During a live exploration each cell counts probes. For a saved report it counts the documented statuses that were observed, because a report keeps no status for each probe.
- Gauges: operation coverage (operations that answered at least once) and documented-status coverage.
- Findings: sorted by severity, then by operation. Click a heatmap row to show only that operation’s findings, and click it again to show them all.
API graph
There is one node per operation and one link per data dependency, meaning a value from one operation’s response used as a parameter of another (for example, the id that POST /users returns feeds GET /users/{id}). Producers sit on the left. Each node is coloured by its worst finding: red for critical, orange for high, yellow for medium, blue for low, and grey for none. Select a node to list its findings. The links come from the dependencies field of exploration reports, which rustman explore run writes from version 0.1.
Bench dashboard
rustman bench --viz opens it and sends one update per second; rustman viz <report.json> opens a saved bench report in it.
- KPI tiles: requests, requests per second, p95 latency, error rate and active VUs, each with a sparkline of its last 120 seconds. While the bench runs, requests per second and p95 are those of the last second; once it ends, those of the whole bench.
- Throughput per second (requests per second and errors), latency percentiles per second (p50, p95 and p99) and active VUs, one point per second.
- Totals: duration, iterations, requests, errors, requests per second and the p50, p95 and p99 latency of the whole bench. While it runs, the duration, requests and errors so far.
- Thresholds: each threshold as written, whether it passed, and the measured value. They are known when the bench ends.
The subtitle shows the target, environment and load profile (for a saved report), the time elapsed and, while a bench with a fixed duration runs, the time left. The state badge reads Running, Completed, Aborted (threshold) or Aborted (interrupted), or Producer disconnected when rustman went away before the end. A slow companion misses some seconds rather than slowing the bench, so a live plot may have gaps; the totals come from the end of the bench and are exact.
Response inspector
A JSON array becomes a table. The array is either the top level of the body or the one a JSONPath selector picks. The columns are the union of the keys of the first 1,000 elements, and a missing key leaves an empty cell. Rows are read on demand, so arrays of millions of rows scroll smoothly. Click a column header to sort: numbers sort by value and missing values sort last. The JSON tab shows the body as read-only, highlighted text, limited to its first MiB. A body without an array shows only the JSON view.
Bodies larger than 16 MiB arrive as a temporary file (blob_ref) that rustman deletes once the companion exits. The whole body is parsed into memory: a 200 MiB array takes a few seconds and a few GiB of memory.
Installing
Prebuilt rustman-viz packages are not published yet. Until they are, build the companion from source with the Raven library:
-
Download the Raven 0.3.0 package for your platform from the releases, for example
raven-macos-universal-static.tar.gz,raven-linux-x64-static.tar.gzorraven-windows-msvc-x64-static.zip. Check it againstSHA256SUMS.txt, then extract it. -
Build the companion and put it next to
rustmanor onPATH:cd crates/rustman-viz RAVEN_LIB_DIR=/path/to/raven/lib RAVEN_STATIC=1 cargo build --release --features raven cp target/release/rustman-viz ~/.local/bin/ # or anywhere on PATHWithout
RAVEN_LIB_DIR, the build stops and says where to get the library. Without--features raven, norustman-vizbinary is built. -
Check it:
rustman-viz --protocol-checkprintsrustman-viz/1.
Graphics by platform:
| Platform | Backend | Needs |
|---|---|---|
| macOS | Metal | nothing (MoltenVK is not needed with Raven 0.3) |
| Linux | Vulkan | a Vulkan driver and loader (libvulkan1), X11 or Wayland |
| Windows | Vulkan | a GPU driver with Vulkan (current NVIDIA, AMD and Intel drivers include it) |
The companion lives in crates/rustman-viz, in a workspace of its own. Building rustman never fetches or builds Raven.
Troubleshooting
| What you see | Why | What to do |
|---|---|---|
Viz companion not found | No rustman-viz on PATH, next to rustman, or in RUSTMAN_VIZ | Install it (above), or set RUSTMAN_VIZ=/path/to/rustman-viz |
RUSTMAN_VIZ=… is not an executable file | The override points at nothing usable | Fix or unset RUSTMAN_VIZ |
Viz companion speaks rustman-viz/2, rustman needs rustman-viz/1 | The companion and rustman come from different releases | Upgrade the older one |
Graphics unavailable (Vulkan) | The companion exited with code 3: no GPU backend could start (no Vulkan driver, a remote session or a VM) | Install the GPU driver, or use rustman report render <report> --format html |
Viz companion exited | The window was closed, or the companion crashed | The run goes on. The companion’s stderr is in .rustman/viz.log |
Viz companion stopped reading for 5 s; detached from it | The companion froze | The run goes on without visuals |
Exit codes of rustman-viz: 0 when its windows are closed or --protocol-check succeeds, 2 for bad arguments, 3 when graphics cannot start (after an error line vulkan_unavailable), and anything else for a crash.
Development
RUSTMAN_VIZ_DEV_LAYOUTS=<dir>makes the companion read the window layouts from<dir>instead of the copies built into the binary. The originals are incrates/rustman-viz/layouts/.RUSTMAN_VIZ_HEADLESS=1runs it with no window system and no GPU (Raven’s null backend). The integration tests use it.scripts/check_viz_e2e.py <rustman> <rustman-viz>checksrustman run --vizend to end with the real companion drawing a real window: it runs the demo collection (examples/demo) against the demo API, records what crosses the pipe, and asserts the handshake, the full event stream (with the API token never sent) and the companion’s clean exit after it captured the run dashboard. CI runs it on Linux under Xvfb with Mesa’s software Vulkan driver (lavapipe), in theviz-e2ejob.rustman-viz --capture <dir>waits for its input to end, then saves every window as a PNG and exits. The screenshots on this page were made with--capturefromcrates/rustman-viz/tests/fixtures, which hold sample data rather than a real API.- All
unsafecode is insrc/raven_adapter/. The rest of the crate deniesunsafe_code, and the view models insrc/model/are tested without Raven.
EVM toolkit
Rustman’s EVM layer sits on top of the JSON-RPC client: every node call goes through it, so its transport settings, method guards and redaction apply. The rustman-evm crate knows chains, units and ABIs; it never signs or sends a transaction.
This page covers what is available today: the [evm] table, chain pinning with chain_id in environments, the known-chain registry, node client detection, quantities and units, the evm-call and evm-tx request files and their load-time checks, ABI sources (built-in token standards, JSON ABIs, Foundry and Hardhat artifacts, opt-in explorer fetch), decoding of calls, outputs, reverts, transactions, receipts and logs, running calls (with state overrides, gas estimates and traces), evm assertions and captures, head and log streams, ENS names, local Anvil forks, the send-method guard, the rustman evm commands, the TUI pane and the read-only agent tools. Signing and sending evm-tx requests with rustman evm send is covered in EVM signing.
[evm] in rustman.toml
Every key is optional. Workspaces without [evm] keep working.
[workspace]
name = "defi"
version = 1
[evm]
# Verified ABIs from a block explorer: off unless set.
allow_explorer_fetch = true
# A mainnet endpoint for ENS names (a URL or a {{variable}}).
ens_rpc = "{{mainnet_rpc}}"
# Add a chain, or change a built-in one.
[evm.chains.999]
name = "My L2"
symbol = "MYL"
decimals = 18
explorer = "https://explorer.myl2.example"
# An Etherscan-compatible API per chain id. The key is a secret.
[evm.explorers.1]
api_url = "https://api.etherscan.io/v2/api"
api_key = "{{etherscan_key}}"
| Key | Default | Meaning |
|---|---|---|
allow_explorer_fetch | false | Allow abi: {explorer: true} to fetch verified ABIs. |
ens_rpc | unset | The mainnet endpoint used for ENS names. |
[evm.chains.<id>] | none | name, symbol, decimals and explorer for a chain id; absent fields keep the built-in values. |
[evm.explorers.<id>] | none | api_url and api_key of an Etherscan-compatible API (the V2 multichain shape, with a chainid parameter). |
allow_raw_send_local | false | Reserved: would let jsonrpc files send raw transactions to chain 31337. Not honored in this build; see Send methods. |
allow_signing, signers | unset | Read by the signing gate: see EVM signing. |
protected_chains, headless_signing_chains, max_cost | unset | Read by the signing confirmation: see EVM signing. |
A key Rustman does not know under [evm] is a warning when the workspace loads (rustman.toml: unknown key 'evm.<key>' ignored); rustman-evm rejects misspelled keys inside [evm.chains.*] and [evm.explorers.*], and table keys that are not integer chain ids.
Chain pinning
An environment may pin the chain its endpoints must be on:
chain_id: 11155111
variables:
rpc: https://sepolia.example/rpc
secrets: [etherscan_key]
Before the first EVM request to an endpoint in a session, Rustman calls eth_chainId. When the environment sets chain_id and the endpoint reports another chain, the request stops there, with exit code 4 and nothing else sent:
chain mismatch: environment 'sepolia' expects 11155111 (Sepolia), endpoint reports 1 (Ethereum Mainnet)
Without chain_id, the detected chain is shown and used. The chain and the node client are asked once per endpoint per session.
Node client detection
After the chain check, Rustman reads web3_clientVersion and classifies the node as geth, reth, erigon, nethermind, besu, anvil, hardhat or unknown, with its version: Geth/v1.14.11-stable/linux-amd64/go1.23.2 is shown as geth 1.14.11. A node without web3_clientVersion (JSON-RPC error -32601) is unknown, with no error; Rustman then asks net_version for the network id. EVM command JSON output carries chain_id, chain, client, client_version and network.
Known chains
| Id | Name | Native currency | Explorer |
|---|---|---|---|
| 1 | Ethereum Mainnet | ETH | https://etherscan.io |
| 10 | OP Mainnet | ETH | https://optimistic.etherscan.io |
| 137 | Polygon PoS | POL | https://polygonscan.com |
| 8453 | Base | ETH | https://basescan.org |
| 17000 | Holesky | ETH | https://holesky.etherscan.io |
| 31337 | Anvil/Hardhat local | ETH | none |
| 42161 | Arbitrum One | ETH | https://arbiscan.io |
| 11155111 | Sepolia | ETH | https://sepolia.etherscan.io |
Every native currency has 18 decimals. Chains are shown as Name (id), such as Base (8453). An id neither built in nor configured is shown as chain <id> with symbol ETH. With [evm.chains.999] name = "My L2" and symbol = "MYL", chain 999 is shown as My L2 (999) and native values in MYL. Chains can also be named by alias: mainnet, optimism, arbitrum, polygon, anvil.
Quantities and units
Every quantity is a 256-bit integer; parsing and display use integer arithmetic only, so conversions are exact.
| Input | Meaning |
|---|---|
0x0de0b6b3a7640000 | Hex. |
1000000000000000000 | A decimal integer, in wei. |
1.5 ether, 2 eth, 2 ETH | Ether (18 decimals). |
30 gwei | Gwei (9 decimals). |
5 wei | Wei. |
2 MYL | The chain’s native symbol, with its decimals. |
0.000000000000000001 ether is 0x1. An amount with more decimals than its unit (1.5 wei) and an unknown unit (1 finney) are errors naming the value. Nodes receive the minimal hex form (0x1).
Native values (value, balance, gas prices and fees) are shown in the native currency first, with toggles for wei, gwei and hex: a balance of 0x0de0b6b3a7640000 is 1 ETH, 1000000000000000000 wei, 1000000000 gwei or 0x0de0b6b3a7640000 (the hex the node sent). Other quantities (block numbers, nonces) toggle between decimal and hex. ERC-20 amounts are shown with the token’s decimals and symbol, with at least two decimals: 250.00 USDC.
Request files
kind: evm-call
A read-only eth_call. It never produces a signed transaction.
version: 1
kind: evm-call
name: USDC balance
rpc: "{{rpc}}"
to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
abi: erc20
function: balanceOf
args: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]
block: latest
| Field | Required | Meaning |
|---|---|---|
rpc | yes | The node URL or a {{variable}}. |
to | yes | A contract address or an ENS name. |
abi | yes | A built-in name, a path, or {explorer: true} (see ABI sources). |
function | yes | A function name, or a full signature such as transfer(address,uint256) for overloaded functions. |
args | no | The arguments, in order: strings, numbers, booleans, and lists for arrays and tuples. Integers accept unit forms ("1.5 ether"). Mixed-case addresses must have a valid EIP-55 checksum. |
from, value | no | The caller and the value sent with the call. |
block | no | latest (default), earliest, pending, safe, finalized, a number, or a block hash. |
state_overrides | no | Per address: balance, nonce, code and storage (slot to value). |
variables, assertions, captures, tags, description, docs | no | As for other kinds. |
A simulation at a historical block with an override:
version: 1
kind: evm-call
name: Vault balance at a block
rpc: "{{rpc}}"
to: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
abi: ../out/Vault.sol/Vault.json
function: balance
block: 19000000
state_overrides:
"0x5FbDB2315678afecb367f032d93F642f64180aa3":
balance: 100 ether
storage:
"0x0": "0x1"
kind: evm-tx
A transaction to sign and send, only through the signing gate (EVM signing): rustman evm send --sign or rustman run --sign. A plain rustman run reports it as skipped (signing not requested) without counting it as a failure, and rustman send refuses it with evm-tx: sign and send it with `rustman evm send --sign` or `rustman run --sign`; nothing was signed or sent (exit code 4, like every signing refusal). Loading never calls a node or touches a signer.
rustman evm send checks an evm-tx request against the signing gate (workspace opt-in, approved signers, --sign, the chain_id pin, simulation); see EVM signing.
version: 1
kind: evm-tx
name: Pay Bob
rpc: "{{rpc}}"
to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
abi: erc20
function: transfer
args: ["0x5e3D81ECeb0c7D9bA1E6cfDAcE631B165a149d3F", "10"]
gas: 100000
max_fee: 30 gwei
max_priority_fee: 1 gwei
type: eip1559
signer: deployer
to is required: a file without it fails to load with contract deployment is out of scope; use Foundry or Hardhat. The other fields are value, gas, max_fee, max_priority_fee, gas_price (legacy), nonce, type (eip1559 or legacy) and signer.
Load-time checks
When a workspace loads, each EVM file is checked against its schema: unknown fields (such as gas in an evm-call), a missing to, abi or function, a bad abi value, negative numbers. Its local ABI (a built-in name or a file) is read and the function is looked up too, still without calling a node; a problem fails the load (exit code 2), so nothing is sent:
requests/transfer.rman.yaml:7: function 'transfer' is overloaded; use a full signature such as 'transfer(address,uint256)'
The argument count, literal quantities (value, the fee fields), block and state_overrides are checked as well. Values that come from {{variables}} are checked when the request runs.
ABI sources
abi: | Source |
|---|---|
erc20, erc721, erc1155 | The built-in token standards. |
../abi/Token.json | A JSON ABI (an array). |
../out/Vault.sol/Vault.json | A Foundry artifact: its abi array is used. |
../artifacts/contracts/Vault.sol/Vault.json | A Hardhat artifact: its abi array is used. |
{explorer: true} | The verified ABI from the chain’s explorer (opt-in). |
Paths are relative to the request file and must stay inside the workspace: abi path '../../outside.json' resolves outside the workspace. Parsed ABIs are cached for the session by the SHA-256 of their bytes, so the same file used by many requests is parsed once.
Explorer fetch
abi: {explorer: true} fetches the verified ABI from the API in [evm.explorers.<chain id>], only when [evm] allow_explorer_fetch = true. Otherwise the request fails, before any network access, with:
explorer ABI fetch is disabled; set [evm] allow_explorer_fetch = true
Rustman first reads the EIP-1967 implementation slot (eth_getStorageAt at 0x3608…2bbc). For a proxy, the implementation’s ABI is used and Rustman says so: proxy → implementation 0x…. Fetched ABIs are kept in .rustman/abi-cache/<chain id>/<address>.json (git-ignored with the rest of .rustman/) and read from there next time. The API key is a secret: it is redacted from every message, even when the explorer echoes it back.
Decoding
- Calls and outputs: arguments are encoded with the ABI; return values are decoded with their names. Addresses are shown checksummed, integers in decimal, bytes as hex, strings quoted; JSON output keeps integers as decimal strings.
- Reverts:
Error(string)is shown asreverted: <reason>;Panic(uint256)with its Solidity meaning, such asreverted: Panic(0x12) division or modulo by zeroorreverted: Panic(0x11) arithmetic overflow; custom errors of the loaded ABI asreverted: InsufficientBalance(available=5, required=10). Other revert data is shown as hex with its 4-byte selector. - Transactions and receipts: from, to, value, nonce, block, status, gas used, effective gas price and the fee paid, with the input decoded by the ABI known for the target (else the built-in token standards).
- Logs: decoded with the ABI known for their address, else the built-in token standards (ERC-20 and ERC-721
Transferare told apart by their indexed fields). A USDC transfer readsTransfer(from=0x…, to=0x…, value=250.00 USDC). Undecodable logs show their topics and data as hex. - Token metadata:
decimals()andsymbol()are asked once per token per session. Whendecimals()fails, the raw amount is shown with the warningdecimals() unavailable; showing raw amount. An unknown transaction istransaction not found(exit code 1).
Running calls
An evm-call runs as one eth_call through the JSON-RPC client, at block (a tag, a number sent as hex, or a block hash sent as {"blockHash": ...}), with state_overrides as the call’s third parameter:
{"method": "eth_call", "params": [{"to": "0x…", "data": "0x70a08231…"}, "0x121eac0",
{"0x5FbDB2315678afecb367f032d93F642f64180aa3": {"balance": "0x56bc75e2d63100000", "stateDiff": {"0x00…00": "0x00…01"}}}]}
Override quantities accept unit forms (100 ether); storage slots and values are padded to 32-byte words. A node that rejects the third parameter fails the request with node does not support state overrides (exit code 3).
ENS names are accepted for to, from and every address argument; they are resolved first (see ENS names). The decoded outputs are shown one per line, by name (or index when unnamed). The amounts of ERC-20 balanceOf, totalSupply and allowance are shown in token units, with the raw integer:
balance = 250.00 USDC (250000000)
A revert is shown decoded (see Decoding) and is not an RPC error. With --estimate, Rustman also sends eth_estimateGas for the same call (same block and overrides) and adds gas estimate: 21000; an estimate that fails is reported on that line, without failing the call.
Assertions
evm-call files take evm assertions besides the generic ones (latency, and json over the result document below). Each - evm: item has exactly one of output, emits, reverts, reverts_with or gas_lt:
| Assertion | Passes when |
|---|---|
{output: <name or index>, equals: v} | The decoded output equals v. Integers compare as 256-bit values and accept every quantity form (0x1, "1 ether", "30 gwei", and the token’s symbol for ERC-20 amounts: "250 USDC"); addresses compare case-insensitively; booleans, strings and bytes (hex) as written. |
{output: ..., gt | gte | lt | lte: v} | The integer output compares so with v (signed integers too). |
{output: ..., contains: v} | A string or bytes output contains v, or an array output has an item equal to v. |
{emits: "<Event(sig)>", where: {field: value}} | An event with that signature was decoded, with those fields (where is optional). eth_call returns no logs, so a file with emits (or an evm_event capture) simulates the call once more with debug_traceCall (callTracer with withLog) and decodes the logs it would emit; logs of reverted sub-calls are dropped. A node without debug_traceCall gives a warning and no events. |
{reverts: true} / {reverts: false} | The call reverted, or did not. |
{reverts_with: "<reason or ErrorName>"} | The revert’s Error(string) reason, custom error name or Panic matches; "Panic(0x12)" matches a panic code too. |
{gas_lt: n} | The gas estimate is below n. A gas_lt assertion asks eth_estimateGas even without --estimate. |
version: 1
kind: evm-call
name: Treasury balance
rpc: "{{rpc}}"
to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
abi: erc20
function: balanceOf
args: ["{{treasury}}"]
assertions:
- evm: {output: balance, gte: "250 USDC"}
- evm: {reverts: false}
- evm: {gas_lt: 60000}
captures:
- {var: treasury_balance, from: evm_output, output: balance}
Failures name the output and, when the expected value has a unit, show both sides in the output’s own units: the token’s for an ERC-20 amount (expected >= 1000000000000 USDC, got 250 USDC for gte: "1 ether"; the raw integers, with the unit as written, when the token’s decimals are unknown), else the native currency’s. A value without a unit is compared and shown as a plain integer:
evm output 'balance': expected >= 1 ETH, got 0.5 ETH
evm reverts_with: expected InsufficientBalance, got reverted: Panic(0x12) division or modulo by zero
evm gas_lt: expected < 21000, got 21000
An output assertion on a call that reverted is an error that quotes the revert (evm output 'balance': the call reverted: Panic(0x12) division or modulo by zero). A revert without an assertion about it does not fail the request: the result shows it. Expected values are taken as written; {{variables}} are not interpolated in them yet.
Captures
| Capture | Value |
|---|---|
{var, from: evm_output, output: <name or index>} | A decoded output. |
{var, from: evm_event, event: "<sig>", field: <name>} | A field of the first decoded event with that signature (reorged logs are skipped). |
{var, from: evm_receipt, field: contractAddress | blockNumber | status | gasUsed} | A receipt field. |
Quantities are stored as decimal strings and addresses as EIP-55 checksummed strings, so {{owner}} can be passed to the next call as is:
version: 1
kind: evm-call
name: Owner
rpc: "{{rpc}}"
to: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
abi: ../out/Vault.sol/Vault.json
function: owner
captures:
- {var: owner, from: evm_output, output: 0}
Captures follow the usual rules: available to every later request of the run, persist: true to keep them in .rustman/state/, and a capture named in the environment’s secrets is a secret. evm_event reads the events of the simulated call (see emits above). evm_receipt has nothing to read in a read-only call (there is no receipt); it reports no receipt field ... there, and reads the receipt of an evm-tx sent with rustman evm send (see EVM signing).
In rustman run
rustman run sends evm-call requests like any other: variables (including {{rpc}} and secrets) are resolved, the environment’s chain_id is checked before the first call to each endpoint, evm and generic assertions are evaluated, and captures feed later requests. The JSON report has an evm object per request:
{"endpoint": {"chain_id": 1, "chain": "Ethereum Mainnet", "client": "geth", "client_version": "1.14.11", "network": null},
"status": "Ethereum Mainnet (1) · geth 1.14.11", "to": "0xA0b8…eB48", "block": "latest",
"result": {"function": "balanceOf(address)", "outputs": {"balance": "250000000"}, "reverted": null,
"gas_estimate": null, "token": {"decimals": 6, "symbol": "USDC"}}}
A request that could not run has {"error": {"kind": "config" | "rpc" | "refused" | "not_found", "message": ...}}; a run with a refused request (a chain mismatch) exits with code 4, like rustman evm call. An evm-tx request is skipped as signing not requested and does not fail the run. Like every report, the evm object is redacted: an endpoint URL kept in a secret never appears.
Call traces
With --trace, Rustman asks debug_traceCall with the callTracer; when the node does not have it, trace_call with ["trace"] (Erigon and Nethermind style). Both become one call tree, one frame per line, indented by depth, with each frame’s type, from and to, decoded function, value, gas and revert reason:
CALL 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -> 0x5FbDB2315678afecb367f032d93F642f64180aa3 balanceViaSelf(who=0xf39F…2266) gas=… used=…
STATICCALL 0x5FbDB2315678afecb367f032d93F642f64180aa3 -> 0x5FbDB2315678afecb367f032d93F642f64180aa3 balanceOf(0xf39F…2266) gas=… used=…
The tree keeps 256 levels of nesting; frames below that are counted, not kept, and shown as one … N deeper frames omitted line under the deepest frame kept, so a broken or hostile node cannot exhaust memory or the stack.
When the node has neither method, the call result is still printed, followed by tracing not supported by geth (with the detected client), and the exit code is unaffected. Which method works is remembered per endpoint for the session.
Head and log streams
A stream follows new block headers or logs. Logs are filtered by one or more addresses and by topics; an event signature such as Transfer(address,address,uint256) stands for its topic hash, and * matches any value at that position.
- Over a
ws://orwss://endpoint, Rustman subscribes witheth_subscribe(newHeads, orlogswith the filter) and unsubscribes when the stream ends. - Over HTTP it creates a filter (
eth_newFilter, oreth_newBlockFilterfor heads), pollseth_getFilterChangesevery 2 seconds (configurable), and says so:polling every 2s (no WebSocket). A node that forgets the filter (filter not found) gets a new one; the filter is removed witheth_uninstallFilterat the end.
Each log is decoded like a receipt log, one per line. A log the node sends again with removed: true (a reorg) is shown as REORGED and is not counted as a new event:
REORGED [7] 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 Transfer(from=0x…, to=0x…, value=250.00 USDC)
A stream stops at its event or time bound, when it is stopped, or when the node closes the connection. At most 256 items wait for the printer: when it falls behind, the stream stops reading the node until it catches up, so memory stays bounded.
ENS names
Names are resolved through Ethereum Mainnet’s ENS registry (0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e): the name’s resolver, then its address, shown checksummed (vitalik.eth is 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045). Reverse lookups read the <address>.addr.reverse record and are shown only when the name resolves back to the same address.
The registry is read from [evm] ens_rpc when set, else from the current endpoint when it is chain 1. The ens_rpc endpoint’s eth_chainId is checked before its first read: the registry has the same address on every chain, so an ens_rpc on another chain is refused (exit code 4) with [evm] ens_rpc reports chain <id>, not Ethereum Mainnet (1); ENS is read on mainnet only. On any other chain, without ens_rpc, a name fails with ENS needs a mainnet RPC; set [evm] ens_rpc. A name without a resolver or an address is not found (exit code 1). Names are lowercased; full ENSIP-15 normalization of non-ASCII names is not done.
Local forks with Anvil
Rustman runs Foundry’s anvil (found on PATH) to fork a chain: anvil --host 127.0.0.1 --port 8545 --fork-url <rpc> --fork-block-number <N>. With --chain, the upstream endpoint is the rpc variable of the environment of that name (--chain local), else of the first environment pinned to the chain it names (mainnet, 8453); --env or --rpc name the endpoint directly. Rustman waits for Anvil’s own Listening on line, so another process on the port is never taken for the fork. The rest of the fork’s output is discarded: its banner lists development keys, and its errors could quote the upstream URL.
Anvil takes the upstream URL on its command line only (it has no environment variable or file for it), so while the fork runs, other users of the same machine can see that URL, API key included, in the process list (ps). rustman evm fork prints a note saying so when it starts. On a shared machine, fork from an endpoint without a key in its URL, such as a local node or a local proxy that adds the key.
While the fork runs, a temporary environment fork-<chain> (such as fork-mainnet) points at it, with chain_id set to the id the fork reports:
# Temporary: written by `rustman evm fork`, removed when it exits.
# anvil pid: 48213
chain_id: 1
variables:
rpc: http://127.0.0.1:8545
--port 0 lets Anvil pick a free port, read back from its Listening on line. The file is removed and Anvil stopped when the command exits, on Ctrl+C or when Anvil exits on its own (then with exit code 3 and anvil exited (...); the fork and environment '<name>' are gone); an existing environment of that name that Rustman did not write is never replaced. Cleanup runs on Ctrl+C, SIGTERM and SIGHUP (a second one while stopping still kills Anvil); a rustman killed outright (SIGKILL) can leave Anvil running, with the upstream URL in its arguments, and the file behind. Stop such a node by its pid, recorded in the file. On Unix, the next rustman evm fork removes temporary environments whose recorded Anvil no longer runs and says so. Without anvil on PATH, the command fails with exit code 2 and anvil not found; install Foundry (https://getfoundry.sh).
The toolkit’s tests against a real Anvil are opt-in, so a plain cargo test never starts one: run them with RUSTMAN_ANVIL=1 cargo test -p rustman-evm --test anvil (Foundry on PATH). The jsonrpc-anvil CI job sets RUSTMAN_REQUIRE_ANVIL=1, which also turns a missing anvil into a failure.
Send methods
Signing and sending belong to the signing gate (evm-tx), which is not available in this build. Methods are refused by family, not by exact name, so new sending methods stay out. Every jsonrpc request, evm-call and agent call, and every kind: http request whose body is a JSON-RPC call or batch (an object with a method, or an array of them; rustman send, rustman run and the agent’s send_request), is refused before anything is sent, with exit code 4, when its method (in any case):
- is in the
personal_*,wallet_*(EIP-5792 and wallet RPCs),account_*(Clef) orsigner_*namespace; - or has a name that, after its namespace, starts with
send,sign,submitTransactionorpostTransaction:eth_sendRawTransaction,eth_sendTransaction,eth_sendTransactionSyncandeth_sendRawTransactionSync(EIP-7966),eth_sendRawTransactionConditional,eth_sendBundle,eth_sendPrivateTransaction,flashbots_sendBundle,eth_sign,eth_signTransaction,eth_signTypedData*.
The refusal reads:
signing and sending go through 'evm-tx' (signing gate)
The guard applies to rustman rpc, rustman run, the TUI and the MCP server. [evm] allow_raw_send_local is not honored in this build: a transaction can only be signed and sent through the signing gate (an evm-tx request with rustman evm send --sign or rustman run --sign, see EVM signing), so raw sends with these methods are refused on every chain, including 31337.
Typed JSON-RPC methods
Rustman knows the standard eth_*, net_* and web3_* read methods and the type of each param: address, quantity, data, block tag, hash, filter object, transaction object, bool. rustman rpc call builds the params from --param name=value, in the method’s order:
$ rustman rpc call {{rpc}} eth_getBalance --param address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --param block=latest
1 ETH
= 1000000000000000000 wei = 1000000000 gwei = 0x0de0b6b3a7640000
sends {"method":"eth_getBalance","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","latest"]}. Quantities take the unit forms above (--param position=10, 30 gwei), a block takes a decimal number, objects and lists are JSON, and an omitted block is latest. A native amount (eth_getBalance, eth_gasPrice, eth_maxPriorityFeePerGas, eth_blobBaseFee) is shown in the native currency of the environment’s pinned chain or, when it pins none, of the chain the node reports (rustman rpc call with an endpoint then sends eth_chainId, kept out of history), its other forms on stderr; --raw and --json keep the hex.
The params of a catalog method are checked before they are sent, however they were written (--param, PARAMS_JSON, a jsonrpc file, the TUI, an agent): a mixed-case address with a wrong EIP-55 checksum, non-hex data and an unknown block tag are refused, naming the param:
param 'address': invalid EIP-55 checksum
rustman rpc call with an endpoint exits 2, whether the params came from --param or PARAMS_JSON; elsewhere (a jsonrpc file, the TUI, an agent) the check is a method guard, with exit code 4 like the send methods. All-lowercase addresses carry no checksum and pass. Params given by name (an object) and methods outside the catalog are not checked. The TUI’s JSON-RPC pane shows a catalog method’s typed params next to its params, and the same check under them.
The @evm-read preset can be used in [jsonrpc] agent_read_only_methods to let agents call the read-only methods: eth_chainId, eth_blockNumber, eth_call, eth_estimateGas, eth_getBalance, eth_getCode, eth_getStorageAt, eth_getBlockBy*, eth_getTransaction*, eth_getLogs, eth_feeHistory, eth_gasPrice, net_version and web3_clientVersion.
Commands
Every command that calls a node takes --rpc <url or {{variable}}> (default: the environment’s {{rpc}}), --env, --var k=v, --timeout, --insecure and --json. The endpoint is identified first (eth_chainId, then web3_clientVersion): a pinned environment on the wrong chain is refused with exit code 4, and the JSON output carries an endpoint object with the chain and the node client. Output and errors are redacted.
rustman evm call
rustman evm call requests/token/balance.rman.yaml --env mainnet
rustman evm call --to 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 --abi erc20 --function balanceOf vitalik.eth
rustman evm call --to 0x5FbDB2315678afecb367f032d93F642f64180aa3 --abi out/Vault.sol/Vault.json --function balance --block 19000000 --estimate --trace
A request file (path, id or name) runs with its assertions and captures; an ad-hoc call takes --to, --abi (a built-in name or a path from the workspace root), --function and the arguments as positional values (JSON lists and booleans as JSON, anything else as text), with --block, --from and --value. The node status line goes to stderr; the outputs, the gas estimate and the trace (or tracing not supported by geth) to stdout:
balance = 250.00 USDC (250000000)
gas estimate: 21000
tracing not supported by geth
Exit codes: 0 when every assertion passed, 1 when one failed, 2, 3 or 4 when the call could not run (see Exit codes). --json prints the evm record with passed, assertions and captures.
rustman evm decode
Offline: no node, no workspace needed.
$ rustman evm decode --abi erc20 0xa9059cbb000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045000000000000000000000000000000000000000000000000000000000000000a
transfer(to=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045, amount=10)
$ rustman evm decode --abi erc20 0x4e487b710000000000000000000000000000000000000000000000000000000000000012
reverted: Panic(0x12) division or modulo by zero
$ rustman evm decode --abi erc20 --topic "Transfer(address,address,uint256)" --topic 0x…from --topic 0x…to 0x…amount
Transfer(from=0x…, to=0x…, value=7)
Call data is decoded when its selector names a function of the ABI, else as revert data; with --topic (topic 0 first) the data is a log. Data no function or error of the ABI decodes is an error with exit code 2.
rustman evm logs
rustman evm logs --address 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 --event "Transfer(address,address,uint256)" --max-events 5
rustman evm logs --heads --duration 1m
rustman evm logs --address 0xA0b8… --event "Transfer(address,address,uint256)" --from-block 20000000 --to-block 20000100
Without --from-block the command streams (see Head and log streams) until --max-events, --duration or Ctrl+C, then prints <n> event(s), <m> reorged on stderr; --poll-interval changes the 2 s HTTP polling. With --from-block (and --to-block, default latest) it runs one eth_getLogs over that range (a range that ends before it starts is exit code 2). The range is not capped here, as you chose it; the node may still refuse a range it finds too wide. Agents are capped at 10,000 blocks (evm_logs_query). --json prints one JSON object per log.
rustman evm tx
rustman evm tx 0xdeed52ec1e92d0ca8834284f39ed5e37ff6106b6bb09a9dc37fb6d1c01b0a8f6 --env mainnet
The transaction and its receipt (see Decoding); transaction not found with exit code 1 for an unknown or pending hash.
rustman evm block
rustman evm block # latest
rustman evm block finalized --json
rustman evm block 20000000
Number, hash, parent, timestamp, miner, gas used and limit, base fee and transaction count. An unknown block is block not found (exit code 1); an unknown tag is a usage error (exit code 2).
rustman evm ens
$ rustman evm ens vitalik.eth --env mainnet
0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
$ rustman evm ens 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --env mainnet
vitalik.eth
A reverse name is printed only when it resolves back to the address; otherwise <address> has no verified primary ENS name.
rustman evm fork
rustman evm fork --chain mainnet --block 20000000
rustman evm fork --chain 8453 --port 8546
rustman evm fork --env staging --json
--chain takes an environment name, a chain name or a chain id; --env and --rpc choose the endpoint as for the other commands. Prints the local URL (with --json, one object with url, ws_url, environment, chain_id and fork_block), writes the temporary fork-<chain> environment (see Local forks with Anvil) and waits for Ctrl+C, then stops Anvil and removes the environment. The upstream endpoint is never printed.
TUI
evm-call and evm-tx files open in an EVM pane with the tabs Function, Args, Block, Result, Trace and Events:
- Function: a picker of the ABI’s functions (a built-in ABI, or a file ABI read from the workspace). Only
viewandpurefunctions are listed;a(or the mode key) shows every function, as read-onlyeth_callsimulations.Enterchooses one: its name, or its full signature when the name is overloaded. - Args: one field per input, labelled with its name and Solidity type. Values may use
{{variables}}. - Block:
←/→cyclelatest,finalized,safe,pendingandearliest; a number or hash can be typed in the file. - Result: the status line (
Ethereum Mainnet (1) · geth 1.14.11), the decoded outputs, the revert, and the gas estimate.ucycles the unit form of quantities: native units, wei, gwei and hex for balance-like outputs, token units for ERC-20 amounts, decimal and hex otherwise. - Trace: the call tree, or why there is none. Events: the decoded event timeline (the events each send’s simulated call emits, when the file reads events; the latest 1,000 lines), reorged logs marked
REORGED.
Edits change only the top-level function, args and block lines of the file; comments and the other fields are kept. An evm-tx opens read-only with evm-tx: sign and send it with `rustman evm send --sign` or `rustman run --sign`; nothing was signed or sent. After a send, the status bar shows the chain and the node client of the endpoint, such as Base (8453) · geth 1.14.11.
Blockchain GraphQL presets
GraphQL endpoints that serve chain data get presets on top of the GraphQL client. A preset never changes what is sent: it formats what is shown, pages through subgraph lists, measures a subgraph’s freshness and links results into the toolkit.
| Preset | For | Detected when the schema has |
|---|---|---|
geth | geth’s EIP-1767 endpoint, usually <rpc>/graphql | Query.block and Query.logs, and the Long and Bytes32 scalars |
subgraph | The Graph and compatible indexers | Query._meta |
The preset is detected from the active schema (schema_file or the schema cache) and shown in the TUI’s schema line (preset subgraph) and in rustman graphql query’s status line. A request file can name it with preset:; an explicit preset wins, and on a schema without its markers a warning is shown: schema does not look like geth EIP-1767 (or schema does not look like a subgraph).
version: 1
kind: graphql
name: Latest block
endpoint: '{{rpc}}/graphql'
preset: geth
schema_file: geth.graphql
document: '{ block { number hash gasUsed baseFeePerGas miner { address balance } } }'
Scalar display
With a preset active, BigInt, BigDecimal and Long values are shown as exact decimals (geth’s hex BigInt and Long included), Bytes and Bytes32 as 0x hex, and addresses in EIP-55 checksummed form: fields typed Address, and any other 20-byte 0x value, whatever its field name or type (Bytes, ID or String; a subgraph’s usual account { id }), as the TUI’s result links take them. A BigInt in an object that also has a decimals field can be shown in token units: "1000000000000000000000" with decimals: 18 is 1000 (18 decimals).
This is display only. Assertions, captures, history and --json output read the raw JSON as the server sent it, so a data assertion compares the lowercase address the subgraph returned:
assertions:
- data: {path: $.token.owner, equals: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045'}
rustman graphql query prints formatted values; --raw prints them as received and --units adds the token-unit form. In the TUI, u in the response cycles formatted, units and raw, named at the end of the summary line. A formatted value is redacted again before it is shown, so a checksummed address that is a secret never appears.
Pagination
For subgraph lists, rustman graphql query <request> --paginate (and Alt+G in the TUI) sends the operation again and again, concatenating the pages into one array per paginated field. A paginated field is a top-level field with a first argument:
id_gt(the default) followswhere: {id_gt: $var}: the variable starts at""(unless the request sets it) and is set to the last item’sid;--paginate skipfollowsskip: $var, starting at 0 and moved on byfirst.
query Transfers($last: ID) {
transfers(first: 1000, where: {id_gt: $last}) { id from to value transactionHash }
}
Paging stops when a page returns fewer than first items, after --max-pages pages (default 20, at most 1000) with the warning stopped at --max-pages 20, or once the page bodies read reach 64 MiB in all, with the warning stopped after N pages: they reached the 64 MiB pagination limit. A later page that fails (a transport error, a result with errors, or a body that is not a GraphQL result) ends paging: the pages read before it are kept as the result, followed by the failing page’s own errors and the error --paginate: page N failed (<why>); keeping the N-1 pages read before it, and the exit code is non-zero. A failing first page is the result as it is. An operation without a field taking first, or without the cursor variable, fails before anything is sent, with an error starting graphql: --paginate: and exit code 3. Pagination applies to HTTP operations, not subscriptions.
Subgraph freshness
For the subgraph preset, Rustman sends { _meta { block { number } hasIndexingErrors } } to the subgraph and reads the chain head (eth_blockNumber) from the environment’s EVM node, the rpc variable. The node gets none of the GraphQL request’s headers or auth: a subgraph API key never reaches it. The lag is shown in the TUI and on rustman graphql query’s status line as lag 12 blocks; without an rpc variable it is unknown (no rpc). rustman run reads freshness only for requests with a subgraph assertion:
version: 1
kind: graphql
name: Indexer is fresh
endpoint: '{{subgraph}}'
schema_file: subgraph.graphql
document: '{ tokens(first: 1) { id totalSupply decimals } }'
assertions:
- subgraph: {max_lag_blocks: 50}
The assertion fails when the lag exceeds the bound (subgraph lag 120 blocks exceeds 50), when hasIndexingErrors is true (subgraph has indexing errors), and without an rpc variable (cannot compute lag: no rpc configured). On a request without the subgraph preset it is an error.
Links into the toolkit
In the TUI, L in the response lists the addresses (20-byte values) and transaction hashes (32-byte values in fields named hash, transactionHash, txHash, …) of a result with a preset. Choosing one offers:
- Decode transaction: the transaction and its receipt decoded, as
rustman evm txshows them; - Show balance: the address’s balance in the native currency;
- Call contract: a new
evm-calltab to the address (ERC-20 ABI,totalSupply) to edit; - Open in explorer: the explorer page from the known-chain registry, when the environment pins
chain_id.
Lookups read the environment’s rpc, check its chain_id pin first, use read-only methods only and are redacted. Links whose value is a secret are left out.
Agent tools
rustman mcp serve registers six read-only tools (see the tool reference):
| Tool | Does |
|---|---|
evm_call | A saved evm-call request (path) or an ad-hoc call (rpc, to, abi, function, args, block, from, estimate), with its assertions. |
evm_decode | Offline decoding of call data, revert data or a log. |
evm_tx | A transaction and its receipt, decoded. |
evm_block | A block by number, tag or hash. |
evm_logs_query | Logs over a block range of at most 10,000 blocks: wider is range too large (max 10000 blocks), before anything is sent. |
evm_ens | Forward and verified reverse ENS resolution. |
Every node call goes through the session’s rpc_call sender, so the safety policy’s host allowlist and rate limit apply (a host outside it is blocked), and through the JSON-RPC method guards. Results are redacted. No tool accepts a signed transaction, and none can call eth_sendRawTransaction, eth_sendTransaction or a signing method.
Exit codes
| Code | When |
|---|---|
| 1 | An evm assertion (or another assertion) failed; not found (an unknown transaction or block, an ENS name without an address). |
| 2 | A bad file, setting, argument or ABI; explorer fetch disabled; an agent log range over 10,000 blocks; anvil not found. |
| 3 | The node or the explorer could not be reached, or answered with an error; a node without state overrides. |
| 4 | Refused: a chain mismatch, an evm-tx given to rustman send (only the signing gate sends one), an ens_rpc that is not mainnet, a call a method guard refuses (a send method, or catalog params of the wrong type), or a host the safety policy blocks. |
EVM signing
kind: evm-tx requests are the only way Rustman signs or sends a transaction. Every one goes through the signing gate of the rustman-evm-signing crate; the agent interface (rustman-mcp) does not depend on that crate, so agents can never reach a signer.
This page covers signer configuration (keystore and OS keychain; hardware wallets are not available yet), the refusal of raw private keys, the gate preconditions, fees, gas and nonces, the confirmation prompt, sending, the receipt wait and the audit record that rustman evm send produces, and signing in rustman run --sign. A plain rustman run skips evm-tx files as skipped (signing not requested), which is not a failure.
Signing happens on the command line only (--sign). The TUI does not sign in this release: an evm-tx file opens read-only there, with a notice pointing to rustman evm send --sign and rustman run --sign. TUI signing is tracked in #112.
Opting in
Signing is off by default. A workspace opts in in rustman.toml:
[evm]
allow_signing = true
Without it, rustman evm send refuses before reading anything else:
error: signing is disabled for this workspace; set [evm] allow_signing = true
Signers
Signers are configured in [evm.signers.<id>]. Each is exactly one of:
[evm.signers.deployer]
keystore = "~/.foundry/keystores/deployer" # Web3 Secret Storage JSON (Foundry, geth, MetaMask exports)
password = "{{secret:deployer_pw}}" # optional; prompted (no echo) on a terminal otherwise
[evm.signers.ci]
keychain = true # stored by `rustman evm signer import ci`
A signer id is 1 to 64 letters, digits, - and _, and not hex-like (no 0x prefix, not 32 or more hex digits). A request picks its signer with signer: <id>; --signer <id> (or the RUSTMAN_EVM_SIGNER environment variable) overrides it. An unknown id is a configuration error (exit code 2) listing the configured ones, and an invalid one is refused the same way; neither error repeats the value given, since a mistyped key could be in it:
error: unknown signer (configured: ci, deployer)
Keystore signers
The keystore is decrypted in memory only when the gate needs the signer, after the chain check. The file is read once (at most 64 KiB) and its key derivation is checked before it runs: kdf must be scrypt (n <= 2^18, r <= 8, p <= 4, n × r × p <= 2^21: geth’s standard n = 2^18, r = 8, p = 1 is the ceiling) or pbkdf2 (c <= 10 000 000) with matching parameters and dklen 32, so a hostile keystore cannot hang the process; standard Foundry, geth and MetaMask keystores are well inside. Anything else is refused as a configuration error (exit code 2). The cipher is checked the same way: cipher must be aes-128-ctr, cipherparams.iv exactly 32 hex digits, ciphertext 64 and mac 64, every field valid hex (malformed keystore otherwise, exit code 2); after decryption, a keystore with an address must decrypt to that address. ~/ is the home directory; a relative path starts at the workspace root. The password is resolved like any variable, so keep it in a secret (a {{secret:provider/path}} reference or a variable listed in the environment’s secrets); its value is redacted from every output. Without password, the password is asked on the terminal with no echo (a terminal that cannot be read is reported with its I/O error, exit code 2); without a terminal, the gate refuses:
error: signer 'deployer': the keystore password is needed; set password = "{{secret:...}}" in [evm.signers.deployer] or run in a terminal
A wrong password is refused with signer '<id>': wrong keystore password (exit code 4).
Keychain signers
rustman evm signer import ci # no-echo prompt
rustman evm signer import ci < ci.key # or the first line of stdin
The key (64 hex digits, 0x optional) is stored in the OS keychain (macOS Keychain, Windows Credential Manager, the Secret Service on Linux) under the rustman service as evm-signer/<id>, and the command prints the address and the [evm.signers.<id>] keychain = true lines to add. The key is never printed or written to a file: with RUSTMAN_SECRET_STORE=file, or where there is no keychain, the import fails with no OS keychain is available; signer keys are never stored in files.
Hardware wallets
Hardware-wallet signers (Ledger, Trezor) are not available yet. A ledger = "m/44'/60'/0'/0/0" or trezor = "..." signer is read from rustman.toml but refused when used, in every build (the hw-wallet cargo feature is reserved for the drivers and links none yet), with a configuration error (exit code 2) and nothing signed or sent:
error: signer 'cold': Ledger signing is not available yet; use a keystore or keychain signer
Hardware-wallet support is tracked in #111.
Raw private keys are refused
Anything that looks like key material is refused wherever a signer value can come from: a run of 60 or more hex digits (with or without 0x, so a key with a digit missing or extra padding too) and a seed phrase (12, 15, 18, 21 or 24 lowercase words). The places checked are the request’s signer, an environment variable, a --var, --signer, RUSTMAN_EVM_SIGNER, any value in [evm.signers] (and any private_key, key, secret_key, mnemonic or seed field there), and the id given to rustman evm signer import. The refusal never echoes the key:
error: raw private keys are not accepted; import the key with 'rustman evm signer import'
Key material only lives in memory inside Secret holders and is zeroized when dropped: decrypted keystore bytes, keychain entries, passwords and the signing key itself.
The gate
rustman evm send <request> (and rustman run --sign for each evm-tx file) checks, in this order, and stops at the first refusal (exit code 4 unless noted):
-
[evm] allow_signing = true. -
No key material as the request’s
signer,--signerorRUSTMAN_EVM_SIGNER. -
--sign. Without it, the decoded preview is printed and the command refuses withadd --sign to sign and send, before any signer is looked up. The preview names the signer only when it is a configured id ((not a configured signer)otherwise), and every value stays on its line (newlines and control characters show as\u{…}):evm-tx transfer to 0x5FbDB2315678afecb367f032d93F642f64180aa3 call transfer(0x70997970C51812dc3A010C7d01b50e0d17dc79C8, 10) value 0 signer deployer error: add --sign to sign and send -
No transaction field (
to,args,value,gas, the fees,nonce) comes from a secret: the confirmation must show what is signed, soevm-tx: 'args' comes from a secret; a transaction field must be shown in the confirmation, so it cannot hold a secret; nothing was signed or sent. -
A valid signer id configured in
[evm.signers](exit code 2 when missing, invalid or unknown). -
The environment pins
chain_id:signing requires 'chain_id' in environment '<env>'otherwise (orsigning requires an environment with 'chain_id'; select one with --envwithout an environment). -
The node’s
eth_chainId, asked again right before signing, equals the pin:chain mismatch: environment 'dev' expects 31337 (Anvil/Hardhat local), endpoint reports 11155111 (Sepolia)otherwise. -
The transaction can be confirmed: a terminal, or
--yes-localon a local chain (see Confirmation). Without one the gate refuses here, before the key is unlocked or anything simulated. -
The signer unlocks.
-
The simulation,
eth_callfrom the signer atpendingandeth_estimateGas, succeeds. A revert is shown decoded and refused:
error: simulation reverted: InsufficientBalance(available=5, required=10); nothing was signed or sent (add --force-revert to sign anyway)
With --force-revert the gate goes on, prints warning: SIMULATION REVERTED: ..., and the confirmation starts with the same warning. A reverting call has no gas estimate, so a forced transaction needs gas in the request.
- The confirmation (see below).
eth_chainIdonce more, immediately before signing.
Nothing is signed or sent by a refusal, and loading a workspace with evm-tx files never calls a node or touches a signer. Ctrl+C at any prompt, or anywhere before the transaction is signed, stops with interrupted; nothing was signed or sent and exit code 130; the gate checks once more right after the confirmation and right before signing. Once the transaction is signed, Ctrl+C no longer drops it: the send is awaited, and Ctrl+C during the receipt wait ends it with the audit record ("status": "pending", or broadcast-unknown when the send failed), error: interrupted; transaction 0x… was sent and its receipt was not awaited; check the explorer for 0x…, the explorer link, and exit code 3.
Fees, gas and nonces
Values set in the request win; the rest are suggested by the node and labelled (suggested) in the confirmation. Fees take every quantity form (30 gwei, 0x6fc23ac00, wei as a decimal integer).
- EIP-1559 (the default,
type: eip1559):eth_feeHistory(10, "latest", [50]).max_priority_feeis the median of the 50th-percentile rewards of those blocks;max_feeis 2 × the latest base fee + the priority fee. A node that reports no base fee is an error asking fortype: legacy.gas_priceis refused on an EIP-1559 transaction, and amax_priority_feeabovemax_feeis refused. - Legacy (
type: legacy):gas_price, by defaulteth_gasPrice; EIP-155 replay protection embeds the chain id.max_feeandmax_priority_feeare refused. - Gas limit:
gas, by default the simulation’seth_estimateGas× 1.2, rounded up. - Ceilings: a node cannot inflate what is signed. A suggested
max_fee,max_priority_feeorgas_priceabove 10 000 gwei, or a gas limit from the estimate above 30 000 000, is refused (exit code 4) with a message asking to set the value in the request; values set in the request are not capped. - Max cost:
--yes-localnever signs a transaction whose max cost (gas limit × max fee, plus the value) is above[evm] max_cost, a decimal amount of the chain’s native unit (default"1", 1 ETH):max cost 300 ETH is above [evm] max_cost (1 ETH); --yes-local does not sign above it (confirm on a terminal, or raise [evm] max_cost); nothing was signed or sent(exit code 4). On a terminal the summary starts withWARNING: max cost … is above [evm] max_cost (…)and the user decides. - Nonce:
nonce, by defaulteth_getTransactionCount(signer, "pending"). Within one process (onerustman evm send, or a wholerustman run --sign), later transactions of the same signer on the same chain count up from the last one sent instead of asking again; a transaction whose send failed counts too, since it may be out. Anonce too loworreplacement underpricedanswer is reported as the node sent it (exit code 3, see unknown broadcast) and nothing is retried.
Confirmation
Before signing, the decoded summary is printed:
chain Sepolia (11155111)
signer 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (deployer)
to 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 (usdc.eth)
call transfer(to=0x70997970C51812dc3A010C7d01b50e0d17dc79C8, amount=10.00 USDC (10000000))
value 0 ETH
gas 55317
max fee 16.5 gwei (suggested)
priority fee 1.5 gwei (suggested)
nonce 4
max cost 0.0009127305 ETH
sign and send this transaction? [y/N]
The amount of an ERC-20 transfer, approve or transferFrom is shown in token units with the token’s decimals() and symbol() when the token answers them, and the raw integer stays in parentheses (the decimals come from the node). max cost is the value plus the gas limit at the max fee (or gas price). Only y or yes goes on; anything else cancels with cancelled; nothing was signed or sent (exit code 4). Input typed before a question is discarded when it is asked, so an answer typed ahead never confirms a summary not yet shown (on Unix; on Windows the console’s pending input is not discarded).
-
Chain 1 and
[evm] protected_chains: aftery, the chain name must be typed exactly (type the chain name (Ethereum Mainnet) to confirm:). Anything else cancels withthe chain name did not match 'Ethereum Mainnet'; cancelled; nothing was signed or sent. Chain 1 and the other built-in chains always use their built-in name; a protected chain configured in[evm.chains.<id>]without a name is never confirmed (protected chain <id> has no name to type; set [evm.chains.<id>] name). -
No terminal (CI, a pipe): signing is allowed only on chain 31337 and the chain ids of
[evm] headless_signing_chains(test and private chains only: a built-in mainnet such as Base, OP Mainnet, Arbitrum One or Polygon PoS there is a configuration error), and only with--yes-local, which confirms without a prompt (confirmed by --yes-local on Anvil/Hardhat local (31337)). Elsewhere:error: signing on Sepolia (11155111) needs an interactive confirmation; without a terminal only chain 31337 and [evm] headless_signing_chains can be signed on, with --yes-localOn a local chain without
--yes-local:no terminal to confirm on; add --yes-local to sign on Anvil/Hardhat local (31337) without a prompt. -
--yes-localnever skips the prompt of another chain: on a terminal it prints a note and asks as usual.
[evm]
allow_signing = true
protected_chains = [8453] # Base: type its name too
headless_signing_chains = [1337] # another local devnet CI may sign on
max_cost = "0.5" # --yes-local signs up to 0.5 of the native unit (default 1)
Every value of the summary, and the chain name in the typed-name question, is kept on one line: newlines, tabs, control, bidi and zero-width characters show as \u{…}. The summary is never passed through secret redaction (a short secret would hide part of an address); it holds no secret: no password, and no transaction field from a secret (refused at step 4).
Sending and the receipt
The signed transaction is sent with eth_sendRawTransaction, the one place that method is allowed (every jsonrpc request, evm-call, agent call, and kind: http request whose body is a JSON-RPC call or batch is refused it, and every other sending method). The hash is printed (sent 0x…), then the receipt is awaited:
--confirmations N(default 1, the block that includes it) blocks must be on top of the head;--receipt-timeout(default120s): when it passes, the command printserror: transaction 0x… was sent but not mined within 120sand the explorer link (when the chain has an explorer), and exits with code 3. The transaction may still be mined later: check it withrustman evm tx <hash>.- A receipt poll that fails (the node is down, rate-limited, …) is tried again, waiting twice as long after each failure in a row (up to 5 s), until the receipt timeout. When the last poll still failed, the command prints
error: transaction 0x… was sent but its receipt could not be read within 120s: <the node's error>and the explorer link, and exits with code 3; the same happens when the mined transaction cannot be decoded. The audit record is written either way, with"status": "receipt-unknown".
Unknown broadcast
When eth_sendRawTransaction itself fails (the connection drops or times out, the node answers a 5xx or an RPC error such as nonce too low, or it answers something other than the transaction’s hash), the transaction may have been broadcast all the same. The hash is computed locally from the signed bytes (keccak-256 of the EIP-2718 encoding), the failure is printed as a warning (warning: eth_sendRawTransaction: …; transaction 0x… may have been sent; waiting for its receipt; a mismatch names both hashes: the node answered hash 0x…, expected 0x…), and the receipt of the local hash is awaited as usual. If it comes, the transaction is checked like any other, with the failure kept as a warning. If it does not, the command prints error: transaction 0x… may have been sent (<the failure>) but no receipt came within 120s; check the explorer for 0x… before sending it again, the explorer link (when the chain has one), and exits with code 3; the audit record keeps the local hash with "status": "broadcast-unknown". Check the hash (explorer or rustman evm tx <hash>) before signing the transaction again.
The mined transaction is printed decoded, as rustman evm tx shows it, with explorer: https://…/tx/0x…. A transaction that reverted on chain exits with code 1.
Receipt assertions and captures
The request’s assertions and captures run on the receipt:
assertions:
- evm: {emits: "Transfer(address,address,uint256)", where: {to: "{{bob}}"}}
- evm: {gas_lt: 80000}
- json: {path: $.receipt.status, equals: success}
captures:
- {var: mined_in, from: evm_receipt, field: blockNumber}
- {var: moved, from: evm_event, event: "Transfer(address,address,uint256)", field: value}
emits and evm_event read the receipt’s logs decoded with the request’s ABI; gas_lt reads the gas used; evm_receipt reads contractAddress, blockNumber, status (success or reverted) and gasUsed. A failed assertion prints fail: ... and exits with code 1.
Audit record
Every sent transaction is recorded in request-history (unless --no-history or [history] enabled = false), also when the receipt timed out ("status": "pending"), could not be read ("status": "receipt-unknown"), or the send itself failed ("status": "broadcast-unknown", with the locally computed hash). The entry’s record.evm holds:
{
"kind": "evm-tx", "chain_id": 31337, "chain": "Anvil/Hardhat local",
"signer": {"id": "deployer", "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"},
"hash": "0x…", "to": "0x…", "to_name": null, "call": "add(amount=2)",
"value": "0", "nonce": 0, "gas_limit": "55317",
"fees": {"type": "eip1559", "max_fee": "…", "max_priority_fee": "…", "suggested": true},
"forced_revert": false, "status": "success", "block": 1,
"gas_used": "…", "effective_gas_price": "…", "fee": "…", "explorer": null
}
The signed bytes, the signature, the password and the key are never stored or shown, and the entry cannot be replayed (rustman history replay would not sign again).
| Exit code | Meaning |
|---|---|
| 0 | Sent, mined, and every assertion passed. |
| 1 | Mined, but it reverted on chain or an assertion failed. |
| 2 | A configuration error: an unknown or invalid signer, a missing keystore, a keystore above the key-derivation limits or malformed, a mainnet in [evm] headless_signing_chains, an invalid [evm] max_cost, an unreadable password prompt, no keychain, a hardware-wallet signer. |
| 3 | The node could not be reached, or the transaction’s send failed and no receipt came for its local hash (broadcast-unknown: it may have been sent), or the transaction was sent but its receipt did not come within --receipt-timeout or could not be read. |
| 4 | A gate refusal: signing disabled, key material as a signer, no --sign, no chain_id pin, a chain mismatch, no way to confirm (no terminal on a non-local chain), a wrong or missing keystore password, a transaction field from a secret, a max cost above [evm] max_cost under --yes-local, a reverting simulation, a declined confirmation or a wrong chain name. |
| 130 | Ctrl+C before the transaction was signed; nothing was signed or sent. Ctrl+C after it exits with code 3, its audit record kept. |
In rustman run
rustman run skips evm-tx files unless --sign is passed; they are reported as skipped (signing not requested) and are not failures. With --sign, each evm-tx file of the run goes through the same gate as rustman evm send, one at a time and in run order:
rustman run . --env anvil --sign --yes-local
- The signer is the request’s
signer, orRUSTMAN_EVM_SIGNER. - The preview, the summary and the receipt go to stderr; stdout is the run’s report.
--yes-local(which requires--sign) confirms without a prompt on chain 31337 and[evm] headless_signing_chainsonly. Without a terminal, everyevm-txfile on another chain is refused, and the run exits with code 4. On a terminal, each transaction is confirmed as withrustman evm send.- Nonces count up across the run: two transactions of one signer use the pending count, then that count + 1, without asking the node again.
- A refusal is the request’s error and makes the run exit with code 4; a receipt timeout, an unreadable receipt or an unknown broadcast is an error (exit code 3), with the audit record kept; Ctrl+C before a transaction is signed skips it as interrupted (exit code 130), and Ctrl+C during its receipt wait keeps its audit record (
pending) and makes the interrupted run exit with code 3; a failed receipt assertion or a transaction that reverted on chain fails the request (exit code 1). The receipt timeout is 120 s and one confirmation is awaited.
Agents can never sign
The agent interface (rustman mcp serve) has no tool that signs, sends a transaction, imports a key or changes signing configuration, and rustman-mcp does not link the rustman-evm-signing crate at all: a test walks Cargo.lock and fails if anything the agent crate depends on reaches it. An agent that names a saved evm-tx file in send_request is refused before anything is resolved or sent:
evm-tx requests cannot be sent through the agent interface
run_collection skips evm-tx files like rustman run does, and rpc_call refuses eth_sendRawTransaction and the other sending methods (see send methods).
CI on Anvil
A pipeline can sign on a local Anvil chain without a terminal: chain 31337 with --yes-local, a keystore of one of Anvil’s dev accounts, and its password from the CI’s secrets through the env provider (secret providers). The files below are the ones Rustman’s own CI runs (crates/rustman-cli/tests/docs_evm_signing.rs, in the jsonrpc-anvil job).
# rustman.toml
[workspace]
name = "counter"
version = 1
[secret_providers.ci]
type = "env"
[evm]
allow_signing = true
[evm.signers.deployer]
keystore = "keys/anvil0.json"
password = "{{secret:ci/DEPLOYER_PW}}"
# environments/anvil.yaml
chain_id: 31337
variables:
rpc: http://127.0.0.1:8545
# add.rman.yaml
version: 1
kind: evm-tx
name: add
rpc: "{{rpc}}"
to: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
abi: Counter.abi.json
function: add
args: ["2"]
signer: deployer
assertions:
- evm: {emits: "Added(address,uint256,uint256)", where: {amount: "2"}}
- evm: {gas_lt: 100000}
captures:
- {var: mined_in, from: evm_receipt, field: blockNumber}
keys/anvil0.json is Anvil’s first dev account (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) encrypted with the password in DEPLOYER_PW, made once with cast wallet import anvil0 --interactive (it lands in ~/.foundry/keystores/anvil0). That key is public: use it on a local chain only, and never a real key in CI. Counter.abi.json is the ABI of a contract with add(uint256) that emits Added(address indexed by, uint256 amount, uint256 number); 0x5FbDB2315678afecb367f032d93F642f64180aa3 is where the first deployment of that account lands on a fresh Anvil. Deploy with Foundry or Hardhat (deployment is out of Rustman’s scope); Rustman’s own test installs the contract’s runtime code there with anvil_setCode instead.
The CI steps, with DEPLOYER_PW from the CI’s secrets:
anvil --port 8545 &
rustman evm send add --env anvil
rustman evm send add --env anvil --sign --yes-local
rustman evm send add --env anvil --sign --yes-local --confirmations 1
rustman run . --env anvil --sign --yes-local
The first send prints the decoded preview and exits with code 4 (no --sign); the next two sign without a prompt (confirmed by --yes-local on Anvil/Hardhat local (31337)), with nonces 0 and 1, wait for the receipt, check the Added event and the gas, and exit with code 0. The run signs the workspace’s evm-tx files the same way (nonce 2) and exits with code 0. Each sent transaction is in the history’s audit record; the password, the key and the signed bytes are in none of the output or files. The same files with an environment whose chain_id is not 31337 (or in [evm] headless_signing_chains) are refused without a terminal, so a CI job cannot sign on a real network by accident.
Probing EVM providers
rustman evm probe checks one or more EVM JSON-RPC providers and compares them: which methods each one supports, whether it keeps historical state (archive), how fast each method answers, whether WebSocket subscriptions work, where its rate limit is, and whether the providers agree with each other. The result is a standard exploration report (rustman.report/v1, kind: exploration, subject: evm-rpc), so every report format, rustman report diff and --fail-on work as for rustman explore run.
A probe only reads. It sends methods from a fixed read-only catalog; eth_sendRawTransaction, eth_sendTransaction and every signing method are refused before anything is sent (exit code 4), and the send-method guard applies on top.
rustman evm probe https://rpc-a.example https://rpc-b.example
Providers
Each argument is a provider:
- a URL:
https://,http://,wss://orws://; - a
{{variable}}, resolved with the active environment (--env), such as{{rpc}}; - the name of an environment of the workspace: its
{{rpc}}variable is probed, with that environment’s secrets andchain_idpin.
rustman evm probe mainnet-a mainnet-b --methods all --report html=probe.html
API keys in URLs are secrets: keep them in environment secrets (https://eth-mainnet.example/v2/{{alchemy_key}}). Output, reports and viz events show «redacted:alchemy_key». Credentials typed into a literal URL are hidden too, as «redacted:url-key», in errors, output and the report’s endpoints: the userinfo (user:password@), the values of key-like query parameters (apikey, api_key, key, token, access_token, auth, secret, or any name containing one of those words), and path segments of 20 or more letters, digits, - and _ that mix letters and digits (not 0x hex values such as block hashes and addresses). The probe then warns once that the URL holds what looks like an API key and suggests storing it as a secret, written {{NAME}} or {{secret:<provider>/<path>}}.
All providers must be on one chain. When they are not, the probe stops before any other request, with exit code 2:
error: providers report different chains (1, 11155111)
An environment that pins chain_id must match its provider, as for every EVM command (exit code 4 otherwise).
Checks
| Check | What it does |
|---|---|
| Method matrix | Calls each --methods method with valid minimal parameters (built from the provider’s head block) and classifies it supported, unsupported (-32601 or “method not found”), restricted (an auth or plan error, HTTP 401/403) or error. |
| Archive | eth_getBalance of --address at block 1,000,000 (or --block), never closer than 10,000 blocks to the head: archive when it answers, full on a pruned-state error (missing trie node), unknown otherwise. |
| Latency | p50, p95 and max per method per provider, over every request of the probe. HTTP latency is the time on the wire (request sent to last response byte), so the wait for --rate pacing is never counted; WebSocket latency is timed from the paced send. |
| Blocks | The last 8 blocks: block times and gas used, for the viz plots. |
| Subscriptions | For ws:// and wss:// providers: eth_subscribe to newHeads (supported once a head arrives within 30 s, timeout when none does) and to logs (supported once the subscription is accepted, since matching logs can be rare: when none arrives within the timeout the detail says subscribed; no log arrived before the timeout instead of reporting timeout); unsupported when the subscription is refused. |
| Trace | With --call <address>:<calldata>, the call is traced (debug_traceCall, then trace_call) for the call-trace graph. |
| Consistency | With two or more providers, see below. |
| Rate limit | Only with --rate-discovery, see below. |
--methods takes standard (the default), all, or a list:
rustman evm probe https://rpc-a.example --methods eth_call,eth_getBalance,debug_traceCall
standard holds eth_chainId, web3_clientVersion, net_version, eth_blockNumber, eth_getBlockByNumber, eth_getBlockByHash, eth_syncing, eth_gasPrice, eth_maxPriorityFeePerGas, eth_feeHistory, eth_getBalance, eth_getCode, eth_getTransactionCount, eth_getStorageAt, eth_call, eth_estimateGas, eth_getLogs, eth_getTransactionByHash, eth_getTransactionReceipt, debug_traceCall and trace_call. all adds eth_getBlockReceipts, eth_getBlockTransactionCountByNumber, eth_getUncleCountByBlockNumber, eth_createAccessList, eth_getProof, eth_simulateV1, eth_blobBaseFee, debug_traceTransaction, trace_transaction, trace_block, txpool_status, net_listening and net_peerCount.
Consistency between providers
With two or more providers, the probe compares:
- the head:
eth_blockNumberon every provider, 5 samples over 10 s (--drift-intervalsets the time between samples). A provider behind the highest head by more than--max-driftblocks (default 3) on every sample is amediumfinding,head drift 8 blocks; - at one fixed block, 10 below the lowest head (so reorgs near the head cannot cause false alarms): the block hash (
eth_getBlockByNumber), the balance of--address(eth_getBalance) and, with--call, theeth_callresult. A provider that disagrees with the first one is ahighfinding whose evidence holds both answers.
rustman evm probe https://rpc-a.example https://rpc-b.example --call 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48:0x18160ddd
Rate-limit discovery
--rate-discovery sends eth_blockNumber at 5, 10, 20 and 40 req/s, one second per step, never above --max-rate (default 40). It stops at the first HTTP 429 or JSON-RPC rate-limit error (-32005), waits out its Retry-After, and reports the last rate that passed: rate limit ≈ 20 req/s (an info finding). Without the flag no rate discovery runs.
rustman evm probe https://rpc-a.example --rate-discovery --max-rate 20
Safety and budgets
Every request passes the safety policy: each provider’s host only, 10 req/s and 4 requests in flight per provider (--rate, --concurrency, or [safety] in rustman.toml), and a budget of 500 requests per provider (--budget, at least 1). A provider that reaches its budget is not probed further: its remaining checks are skipped (budget), and the report says so with an info finding. A host listed in [safety].production_hosts, or an environment marked production: true, needs --production <host>.
Reports and exit codes
The probe prints a summary per provider (archive state, subscriptions, rate limit, and each method with its support and latency). --report <format>=<path> (repeatable) writes the report as json, junit, markdown, html or sarif; the method matrix is the report’s coverage section (methods × providers; each cell’s class is supported, unsupported, restricted, error or skipped (budget)), and the EVM details are in its evm section. Provider error messages are cut to 2 KiB in the report, and finding evidence to 16 KiB; the call-trace graph keeps at most 1000 frames (a final … N more frames omitted node counts the rest), and a frame’s error text is cut to 256 bytes.
rustman evm probe https://rpc-a.example https://rpc-b.example --report json=probe.json --report sarif=probe.sarif
| Code | Meaning |
|---|---|
| 0 | No finding at or above --fail-on (default high). |
| 1 | A finding at or above --fail-on, such as providers disagreeing on state. |
| 2 | Bad flags, or providers on different chains. |
| 3 | A provider could not be reached. |
| 4 | A refusal: a write method in --methods, a chain pin mismatch, an unconfirmed production host. |
| 130 | Interrupted (Ctrl+C). |
Dashboards
--viz sends the results as viz protocol chain_probe events when the probe finishes (they are not streamed while it runs): the data of a provider × method latency heatmap, block-time and gas plots, and a call-trace graph for --call. The bundled viz companion has no chain_probe view yet, so today it does not draw them: the probe completes normally, warns that the companion has no such view and suggests --report html=… instead. A companion that advertises the chain_probe view receives the events.
Plugins
Plugins extend Rustman with WebAssembly components: in-house auth schemes, domain-specific assertions, value generators, body transformers, importers, request kinds and report formats. Workspaces travel through Git, so a plugin is treated as untrusted code. It runs in a sandbox, gets nothing the workspace does not grant it in rustman.toml, and is pinned by the sha256 of its bytes.
The behavior is specified in openspec/specs/plugins. This page covers the plugin package and manifest, the rustman plugin commands, declaring and pinning plugins, URL sources, the grant vocabulary, the sandbox and its limits, trust, the extension points wired so far, the plugin API, and writing and testing plugins with the SDK, its templates and the test harness.
Plugin support is the default cargo feature plugins of rustman-cli; cargo build --no-default-features builds Rustman without wasmtime.
The plugin package
A plugin is a WebAssembly component (.wasm) built against the rustman:plugin@1.0.0 WIT package, plus a manifest, rustman-plugin.toml:
# plugins/hmac/rustman-plugin.toml
name = "hmac"
version = "0.2.0"
api = 1
extension_points = ["auth"]
capabilities = ["clock", "secrets:read", "net:auth.example.com"]
description = "HMAC request signing for the Acme API"
component = "hmac.wasm"
| Field | Required | Meaning |
|---|---|---|
name | yes | kebab-case (aws-sigv4, faker) |
version | yes | semver (0.3.1) |
api | yes | the plugin API major the component was built against |
extension_points | yes | one or more of auth, assertion, generator, transformer, importer, kind, report |
capabilities | yes (may be empty) | what the plugin may be granted: a class (clock, random, env, fs:read, net, secrets:read) or one exact grant (env:HOME, net:auth.example.com) |
description | no | shown with the plugin |
component | no | for a folder source: the component, relative to the manifest (default plugin.wasm) |
A missing field fails with an error naming it, for example plugin hmac: rustman-plugin.toml: missing field 'version'. An unknown extension point fails with plugin hmac: unknown extension point 'telemetry'.
The manifest can also be embedded in the component, as a custom section named rustman-plugin.toml. A URL source must embed it, since only the .wasm file is downloaded; embedded, the manifest is covered by the sha256 pin. For a .wasm file source, an embedded manifest is used over a rustman-plugin.toml next to the file; a folder source always uses the folder’s manifest.
Plugin files are read before the set is trusted (by plugin list, the trust prompt and the pin check of every headless command), so they are read defensively: a component, a rustman-plugin.toml, a cached download or rustman.lock must be a regular file, and a symbolic link is followed only when it resolves to a regular file inside the workspace. A FIFO, a device (such as a committed plugins/evil.wasm -> /dev/zero), a socket or a link out of the workspace is refused at once with exit code 2, for example plugin evil: <path>: resolves outside the workspace or plugin evil: <path>: not a regular file. A component or cached download may be at most 20 MiB and a rustman-plugin.toml at most 256 KiB (plugin <name>: <path>: larger than 262144 bytes); rustman.lock at most 1 MiB.
Each extension point is a world of the WIT package (auth, assertion, generator, transformer, importer, kind, report), and the component must export the interface of every extension point its manifest declares (rustman:plugin/auth-scheme for auth, and so on). The WIT source ships with the rustman-plugin-sdk crate in crates/rustman-plugin-sdk/wit/plugin.wit.
Declaring plugins in rustman.toml
Only plugins declared in rustman.toml are loaded. A plugin’s files sitting in the workspace (say plugins/hmac/) do nothing until a [plugins.hmac] table names them.
# rustman.toml
[workspace]
name = "shop"
version = 1
[plugins.hmac]
source = "plugins/hmac"
sha256 = "4f9c1b0e7a3d5c2e8b6a9f0d1c3e5a7b9d2f4a6c8e0b1d3f5a7c9e1b3d5f7a90"
grants = ["clock", "secrets:read:hmac_key"]
limits = { cpu_ms = 200 }
[plugins.faker]
source = "https://plugins.example.com/faker-1.4.0.wasm"
sha256 = "0a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f9"
grants = ["random"]
| Key | Meaning |
|---|---|
source | a workspace-relative path (a .wasm file with rustman-plugin.toml next to it, or a folder holding the manifest), or an https URL |
sha256 | the sha256 of the .wasm file, 64 hex digits |
grants | what the plugin may do (see Grants); default [] |
limits | { cpu_ms, memory_mib }, per call (cpu_ms is execution time: wall time minus host calls); defaults 100 ms and 64 MiB, at most 10000 ms and 1024 MiB |
The table name is the workspace’s name for the plugin and must be kebab-case. A path source must stay inside the workspace. Keys other than these are refused.
Managing plugins
rustman plugin add ./plugins/hmac # a folder or .wasm file inside the workspace
rustman plugin add https://plugins.example.com/hmac-0.2.0.wasm --name hmac
rustman plugin list
rustman plugin verify # in CI: exit 0, or 2 on a mismatch
rustman plugin remove hmac
rustman plugin add <path|url> reads the plugin (a URL source is downloaded and cached), checks its manifest and compiles its component (it must import only the host interfaces and export its extension points; no plugin code runs), and prints the manifest and the capabilities it requests:
plugin hmac 0.2.0 (API 1)
HMAC request signing for the Acme API
extension points: auth
requested capabilities: clock, secrets:read
sha256: 4f9c1b0e7a3d5c2e8b6a9f0d1c3e5a7b9d2f4a6c8e0b1d3f5a7c9e1b3d5f7a90
added [plugins.hmac] to rustman.toml with grants = [] and updated rustman.lock
It then appends a [plugins.<name>] table with source, sha256 and grants = [] to rustman.toml (the rest of the file is kept as written) and records the plugin in rustman.lock. The name is the manifest’s, or --name. A path source is stored relative to the workspace root, whatever the current directory; a path outside the workspace is refused. A name or source the workspace already declares is refused before anything is downloaded: plugins are never upgraded in place, so changing one is plugin remove then plugin add, and its grants are written again by hand. plugin add never grants anything; grants are edited in rustman.toml, where they show up in code review, and the changed set must be trusted again.
rustman plugin list shows each declared plugin with its version and API major (from its manifest on disk, else from rustman.lock), source and grants, and whether this machine trusts the set (trusted, not trusted, changed since trusted). It reads files only.
rustman plugin verify re-hashes every plugin against its pin, downloads the URL sources that are not cached yet (verified against the pin before they are kept), checks every manifest and grant, and brings rustman.lock in line with rustman.toml. It exits with 0 when everything matches and 2 otherwise, which makes it the CI check of a workspace’s plugins.
rustman plugin remove <name> removes the table (and its sub-tables such as [plugins.<name>.limits]) from rustman.toml and the entry from rustman.lock. A plugin declared in another form, such as an inline table under [plugins], is left for the user to edit.
No rustman plugin command trusts a plugin set, and the agent interface has none of them.
Pinning and rustman.lock
Every plugin is pinned by the sha256 of its .wasm file. A file whose hash does not match is refused with
plugin hmac: sha256 mismatch (expected 4f9c…, got 9e1d…)
and rustman run exits with code 2 before any request is sent. Plugins never update on their own: changing a plugin means changing its pin.
rustman.lock (tracked in Git, written by Rustman when plugins are added or verified) records the version, source, sha256 and API major each pin resolved to, so a review shows them next to a changed hash:
# rustman.lock
# Written by rustman (plugin add, plugin verify). Do not edit by hand.
version = 1
[[plugin]]
name = "faker"
version = "1.4.0"
source = "https://plugins.example.com/faker-1.4.0.wasm"
sha256 = "0a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f9"
api = 1
[[plugin]]
name = "hmac"
version = "0.2.0"
source = "plugins/hmac"
sha256 = "4f9c1b0e7a3d5c2e8b6a9f0d1c3e5a7b9d2f4a6c8e0b1d3f5a7c9e1b3d5f7a90"
api = 1
URL sources
A URL source is downloaded over https only, with TLS verification always on (a workspace ca_bundle can add trusted CAs, but verification cannot be turned off), at most 20 MiB, through the http-requests engine (without a proxy). It runs before the plugin set is trusted, so a URL committed to a repository cannot reach this machine or a private network: a host name that resolves to an address that is not public (see the network rules under The sandbox) is refused when the connection opens, with <host> resolves to the non-public address <ip> (download from the address itself to reach it), unless the URL names that address or localhost itself. Redirects are followed only while they stay on https and on the same host and port; a redirect elsewhere fails with redirect to another host refused. An http:// source fails with plugin sources must use https (exit code 2).
The download is verified against the pin and cached as .rustman/plugins/<sha256>.wasm (git-ignored with the rest of .rustman/). Later loads use the cache and never download again, even if the URL now serves a newer build. When the cache is missing, the pinned URL is downloaded again and verified before use; a different build is refused with the mismatch error. A cached file that no longer matches its pin is refused the same way.
Grants
A plugin starts with no access to the filesystem, network, environment variables, clock, randomness or secrets. Each access needs a grant in grants, which the manifest must also request:
| Grant | Allows |
|---|---|
clock | the wall clock |
random | random bytes (at most 64 KiB per call) |
env:<NAME> | one environment variable |
fs:read:<dir> | reading files under a workspace-relative folder (fs:read:. is the whole workspace) |
net:<host>[:port] | HTTP requests to one host; without a port, only ports 80 and 443 |
secrets:read:<name> | the value of one secret: a secret name, or a provider reference <provider>/<path>[#field] |
Wildcards are refused for every grant (plugin hmac: wildcard grants are not allowed). An fs:read folder may not leave the workspace (plugin hmac: grant 'fs:read:../' escapes the workspace) or point into .rustman/. A grant the manifest does not request is refused: plugin hmac: grant 'env:HOME' not requested by the plugin.
The sandbox
Plugins run in wasmtime with the component model and Cranelift. The host links only the rustman:plugin host interfaces, http, clock, random, env, fs-read, secrets and log; no WASI interface is linked, so a component that imports one (filesystem, sockets, environment, clocks) fails to load. Each host function checks the grant when it is called and returns capability-denied without doing anything otherwise. The refusal reads capability_denied: <what>, for example capability_denied: fs or capability_denied: net evil.example.net.
- Files.
fs-readresolves the path against the workspace root, then canonically: neither..nor a symbolic link can reach outside the granted folder, outside the workspace, or into.rustman/. Listings never show.rustman. Only regular files are read (a FIFO or device fails withnot a regular fileinstead of blocking), opened without following a symbolic link, and the opened file must still be the file at the checked path (same device and inode on Unix): a path swapped for a symbolic link between the check and the read fails withthe path changed while it was read. - Network.
http.fetchsends through thehttp-requestsengine and the session’s safety policy (GovernedSender). Inrustman run,send,importandreport renderthe policy allows the hosts of the set’snet:grants (https or http, on the granted port or else 443 and 80) and[safety].allowed_hosts, under the workspace’s[safety]settings: a host of[safety].production_hostsis refused, and so are destructive methods (DELETE). A host the plugin holds nonet:grant for fails withcapability-denied; a request the policy refuses fails withpolicy-denied(for examplehost not allowed). Redirects are not followed: the plugin sees the redirect response, and a new request is checked again. Every exchange is recorded in history, redacted, as requestplugin:<name>. Plugins have no raw sockets. Anet:grant matches the host name the plugin asks for, and when the connection is opened every address that name resolves to is checked: a granted name that resolves to an address that is not public fails withpolicy_denied: <host> resolves to the private address <ip> (grant the address itself to reach it). To reach such a host, grant it literally:net:localhost(or a.localhostname) or the IP address, such asnet:10.0.0.5:8080. The check runs on the addresses actually connected to, so re-pointing DNS after the check does not get around it; behind an HTTP proxy the proxy resolves the name, and it is not checked. The trust prompt marks grants naming this machine or a private network, such asnet:localhostornet:169.254.169.254. “Not public” is deny-by-default: any address that is not globally routable unicast. For IPv4 that is0.0.0.0/8, private10.0.0.0/8,172.16.0.0/12and192.168.0.0/16, shared (CGNAT)100.64.0.0/10, loopback127.0.0.0/8, link-local169.254.0.0/16(cloud metadata),192.0.0.0/24, documentation192.0.2.0/24,198.51.100.0/24and203.0.113.0/24,192.88.99.0/24, benchmarking198.18.0.0/15, multicast224.0.0.0/4, reserved240.0.0.0/4and broadcast. For IPv6, everything outside global unicast2000::/3(loopback, unspecified, unique-localfc00::/7, link-localfe80::/10, site-localfec0::/10, multicast, discard), plus2001::/23(Teredo and IETF assignments) and documentation2001:db8::/32and3fff::/20. An IPv6 address wrapping an IPv4 one is judged as that IPv4 address: IPv4-mapped::ffff:a.b.c.d, IPv4-compatible::a.b.c.d, NAT6464:ff9b::/96and 6to42002::/16. - Host-call sizes. One host call can copy at most about the plugin’s memory limit out of the guest (wasmtime’s hostcall fuel, at least 1 MiB), however its strings and lists alias each other; beyond that the call traps.
http.fetchalso takes at most 100 request headers, 64 KiB of header names and values, and a URL of 16 KiB (at most 100 request headers, and so on). - Secrets.
secrets.lookup(name)returns a handle;reveal()returns the value only withsecrets:read:<name>. Without that grant,lookupreturns a handle for any name, set or not, so a plugin cannot learn which secrets the session has. Values handed to a plugin without the grant carry the placeholder«redacted:<name>»; this holds for values a send resolves after the plugins load too (provider values, captured secrets, secret data columns), named by their variable or, for a direct{{secret:...}}reference, by the reference text. Everything a plugin logs, and every error it returns, is redacted of all the session’s secrets, granted or not. - Logs.
log.writelines are redacted, kept (at most 1000 per instance, 8 KiB each) and logged at debug level (-v).
Limits and faults
Every call has an execution time budget, cpu_ms (default 100 ms, enforced by wasmtime epoch interruption on a 10 ms tick). It is wall-clock time spent running the plugin, minus the time the host spends on its network or file requests; it is not CPU time measured by the OS, so a busy machine can make a call use its budget sooner and a memory limit (default 64 MiB, across all of the plugin’s memories). Raise them per plugin with limits = { cpu_ms, memory_mib }, up to 10000 ms and 1024 MiB; a higher value fails with plugin <name>: memory limit exceeds maximum (1024 MiB) (or execution time limit exceeds maximum (10000 ms)).
Exceeding a limit aborts the call with plugin <name>: execution time limit exceeded or plugin <name>: memory limit exceeded. Time spent in host calls (network, files) does not count against the execution time limit, but a call may take at most that limit plus 60 seconds of wall time, host calls included; past that it stops with plugin <name>: time limit exceeded when the plugin runs again (a host call in progress is not interrupted); a trap fails it with plugin <name> trapped: <message>. Only that call fails: Rustman does not crash or hang, and the plugin’s instance is recreated before its next call. Calls into one plugin are serialized.
Trust
A plugin is code that came with the workspace, so a machine runs a workspace’s plugin set only once it has been trusted there. The set is identified by a hash over the sorted (name, sha256, grants, limits) of every [plugins.<name>] table, plus the hash of a path source’s rustman-plugin.toml when it sits next to the component rather than inside it (the sha256 pin covers only the .wasm file): adding a plugin, repinning one, changing any grant or limit, or editing such a manifest makes it a new set. The approval is kept in .rustman/trust.yaml (git-ignored) under the subject plugins, sealed with this machine’s key like the MCP client’s stdio approvals, so an approval copied from another machine or committed to the repository matches nothing. Checking trust reads files only: no plugin code runs, and nothing is downloaded, before the answer. The fingerprint is computed again from the files a load actually reads (the declarations and the manifest file bytes, with every component checked against its pin), and a load whose fingerprint is not the approved one is refused with the workspace plugins changed while they were loading; review them again, so a file changed between the trust check and the load never runs unapproved.
- TUI. When
rustman tuiopens a workspace whose set is not trusted, a dialog lists each plugin with its version, source and grants in plain language (may read the secret hmac_key,may send HTTP requests to api.example.com).ytrusts the set;norEscleaves every plugin unloaded. The dialog says when a trusted set changed. Once trusted, a request sent from the TUI uses the plugins like a headless command does (auth schemes, generators, transformers, assertions and request kinds, with the environment’s secrets and the network of their grants; a URL source must already be cached, seerustman plugin verify); while the set is untrusted, a request that needs a plugin fails with a message such asplugin faker is not loadedorauth scheme hmac/v1: workspace plugins are not loaded. - Headless commands.
rustman run,send,bench,history replay,import <format>andreport renderrefuse an untrusted set withworkspace plugins are not trusted (run interactively or pass --trust-plugins)and exit code 2, before any request is sent.--trust-pluginsrecords the approval and loads the plugins with exactly their grants, which is what a CI job passes. A plugin whose bytes do not match their pin is refused first (exit code 2), with or without the flag. - Agents.
rustman mcp serveloads the plugins only when their set is already trusted on this machine; otherwise it starts without them and logsplugins not loaded: workspace not trusted. The agent interface has no tool to add, remove, trust or grant plugins; plugins reach agents only through the requests their tools send. In an agent session a plugin’s network is read-only: an agent’s mutations need the human’s confirmation, which a plugin call cannot ask for, so a plugin’sPOST,PUT,PATCHorDELETEis refused withpolicy-denied. On top of itsnet:grants, every request a plugin sends in an agent session (from an auth scheme, a generator, an assertion or a request kind) must reach an origin the agent may reach ([agent] allowed_hosts, or the hosts of the server’s environment) and is refused withpolicy-denied(host not allowed) otherwise; each request, sent or refused, gets an audit line with toolplugin:<name>, sessionplugins, its method and its redacted URL, and a request whose line cannot be written is not sent. A request of a plugin kind (send_request,run_collection) passes the agent gate like an HTTP request: it runs only when[agent] plugin_kindslists its kind, it counts as a mutation (allow_mutationsand the human’s confirmation), and it is audited with the kind as its method and<kind>:<request id>as its URL (in a background job, as a line of its own). Otherwise it fails withplugin kind '<kind>' not allowed for agents (list it in [agent] plugin_kinds)before the plugin runs.
Extension points
A plugin implements the extension points its manifest lists in extension_points. Each is used by its workspace name and the item’s name, <plugin>/<name> (request kinds and import formats by their own name). A fault in a plugin (a trap, a limit, an invalid result) fails only the operation that called it: an auth scheme’s, a transformer’s or a request kind’s fault is a request error (exit code 3) and the request is not sent (or its response not checked); an assertion function’s fault is an assertion error; an importer’s fault writes nothing (exit code 2).
Whatever a plugin returns may hold a secret it was granted, so every sink of a run (history, reports, logs, stdout) redacts every secret of the plugin session, whether or not a request references it. Each extension point has a working example: the project rustman plugin new <name> --kind <extension point> scaffolds (see Writing plugins), which CI builds, tests and adds for every extension point.
Auth schemes
auth: {type: plugin, scheme: hmac/v1, key_var: hmac_key}
Every key besides type and scheme is a parameter for the plugin, with {{variables}} resolved. The plugin signs the request as it is sent: method, full URL, headers and body. It returns headers to set (replacing those of the same name), query parameters to add, and optionally a new URL whose path or query differ. A result that moves the request to another host, or that sets a header choosing the host or framing the body (Host, Content-Length, Transfer-Encoding, Content-Encoding, Connection, Upgrade, TE, Trailer, Expect), fails with plugin <name>: auth plugins may not change method, host or body. With grants = ["secrets:read:hmac_key", "clock"] the plugin above reads the secret named by key_var and the clock, and sets X-Signature and X-Timestamp; like the headers of built-in auth, the headers it sets are not recorded in history or reports, and a secret value that shows up anywhere else (for example echoed in a response) is redacted, whatever the header’s name.
Assertion functions
assertions:
- plugin: {fn: shop/price-consistent, tolerance: 0}
The function receives the exchange (method, URL and headers of the request; status, headers, body and duration of the response), redacted of the secrets the plugin may not read, and the other keys as a JSON object. It returns pass, fail or error with a message, reported like a built-in assertion: fail: shop/price-consistent: total 99.0 != sum 98.5. A plugin that loops or traps reports error: plugin shop: execution time limit exceeded (or trapped: <message>), and the run continues.
Value generators
body: {type: text, content: "{{$faker.email}} {{$faker.name en}}"}
{{$<plugin>.<name> args...}} calls the plugin’s generator with the words after the name, once for each occurrence, like the built-in dynamic variables. It returns a string. A generator that fails leaves the variable unresolved, and nothing is sent: unresolved variable(s): $faker.email (plugin faker: random). A generator without the random or clock grant has no source of randomness or time: what it returns depends only on its arguments (and on what it kept from earlier calls).
Report renderers
rustman run . --env ci --trust-plugins --reporter acme/xlsx:out/report.xlsx
rustman report render out/report.json --format acme/xlsx -o report.xlsx
The plugin receives the redacted rustman.report/v1 JSON document and returns the bytes to write; the host writes them to the file as they are. A plugin format always writes a file (-o, or :<path> after --reporter).
Transformers
transform:
request: [acme/encrypt]
response: [acme/decrypt]
A transformer plugin registers request transformers and response transformers, applied in the listed order. A request transformer runs after interpolation and before auth (an auth plugin signs what it returns): it gets the URL, the headers and the body as sent, and returns the headers and body to send. It cannot pick the host or the framing: Host stays the request’s and Content-Length is set from the new body. A response transformer runs before assertions and captures, which see what it returns, headers and body; it needs the whole body in memory (a spilled body fails the request). History and the JSON report keep both: the exchange holds the transformed response and transform.original_body the body as received.
A transformer without secrets:read:<name> sees «redacted:<name>» in place of the secret, in the URL, the headers and the body, and what it returns is sent as is: grant the secret to a request transformer that must keep it in the request. A transformer that fails, or that names a plugin that is not loaded, fails the request (exit code 3). The transformer template is a stamp request transformer (adds a header) and a strip-xssi response transformer (drops a )]}', prefix).
Importers
rustman import soapui specs/project.xml --into soap --trust-plugins
An importer plugin registers formats for rustman import <format> <src> (a built-in subcommand such as postman wins over a plugin format of the same name). The source must be inside the workspace, and the plugin reads it only through its fs:read grants: without one covering it, the import fails with plugin <name>: capability_denied: fs <src>. The plugin returns request files and environments as text; it writes nothing. The host checks every one before writing any: a request file must load (a built-in kind, or a plugin kind whose schema it matches), an environment must parse, and paths stay relative (*.rman.yaml files under --into, environments under environments/). The first invalid file stops the import with nothing written, naming the plugin and the file: plugin soapui: two.rman.yaml: unknown request kind 'soap' (expected one of: ...). --dry-run lists the files, and --on-conflict skip|overwrite|rename decides about files that exist. What the plugin returns is redacted of the session’s secrets before it is written. A source cannot name your secrets: a live secret reference ({{secret:...}}) in a returned file is written escaped, as \{{secret:...}} (literal text that never resolves), and printed as review: <file>: secret reference {{secret:...}} from the source neutralized: ..., as for the built-in importers. A file where the escape cannot be made in the YAML text (a double-quoted value, or a reference spelled with YAML escapes) stops the import with nothing written: plugin soapui: two.rman.yaml: holds a secret reference ({{secret:...}}) that cannot be neutralized; .... The importer template converts METHOD URL lines.
Request kinds
# orders/get-order.rman.yaml
version: 1
kind: soap
name: get-order
endpoint: '{{base_url}}/soap'
action: GetOrder
A kind plugin registers request kinds, each with a JSON Schema for its fields and a declarative TUI pane. A kind cannot take a built-in name: plugin <name>: kind 'http' is reserved. In a workspace that declares plugins, request files of other kinds load as opaque requests; once the set is loaded, rustman run and send check each one before anything is sent (exit code 2): its kind must be one a plugin registers (unknown request kind 'soapp' (expected one of: http, ..., soap)), and its fields (without version, kind, name, description, tags and variables) must match the kind’s schema (plugin soapy: kind 'soap': /: "action" is a required property). To run one, the host substitutes the {{variables}} of every field and hands the request to the plugin as JSON (redacted of the secrets it holds no grant for); the plugin executes it through its granted host functions (http.fetch for a network protocol) and returns what it sent and received. The JSON report and history record it as plugin_kind (kind, summary, status, headers, body); it is never replayed.
The pane lists fields, each with an editor (text, code with a language, key-value, or select with options), and response views (raw, json-tree, table). The TUI loads a trusted set’s kinds when it opens the workspace and draws a request of a plugin kind with that pane (each field with its editor and value, then the response views); plugins never draw. The fields are edited in the request file. Agents see plugin kinds only through the requests their tools run. The kind template is an echo kind.
Secret providers
Secret providers have no extension point in API 1. They are planned as an additive interface within major 1 once the built-in providers land; the SDK would then gain a matching world feature.
Plugin API versions
The plugin API major is the version of the WIT package, rustman:plugin@1.x; this build supports API 1. A plugin whose api is another major does not load (plugin next targets plugin API 2; this rustman supports 1), and the rest of the workspace still runs. Within a major the package only grows: new functions, types, interfaces and worlds may be added, and nothing that exists changes, so components built against an older minor keep working. A test compares the package with its frozen surface (crates/rustman-plugin-sdk/wit/frozen/1.0.0.txt) and fails on any non-additive edit. rustman plugin api prints the package version and the supported majors:
rustman:plugin@1.0.0
supported plugin API majors: 1
Writing plugins
rustman-plugin-sdk is the guest SDK: the WIT package, its version, and Rust bindings generated with wit-bindgen for each extension point. Each world is a cargo feature (auth, assertion, generator, transformer, importer, kind, report) that adds a module of the same name with the Guest trait to implement and an export! macro; the host imports are rustman_plugin_sdk::{http, clock, random, env, fs_read, secrets, log}, and rustman_plugin_sdk::describe words a host error like the host does (capability_denied: clock). The runtime feature gives a no_std plugin its allocator, cabi_realloc and panic handler, so the component imports nothing but the Rustman host interfaces: the host links no WASI at all, and a component that imports a WASI interface does not load.
Until
rustman-plugin-sdkis published on crates.io, scaffold with--sdk <path>. The default dependency is a git dependency on the Rustman repository, which only builds once the SDK is available from there at a matching version; point--sdkat thecrates/rustman-plugin-sdkfolder of a Rustman checkout instead, as below, and commit theCargo.lockof the first build.
git clone https://github.com/CyberdyneCorp/rustman
rustman plugin new my-auth --kind auth --sdk rustman/crates/rustman-plugin-sdk
cd my-auth
rustup target add wasm32-wasip2
cargo build --target wasm32-wasip2 --release
rustman plugin test .
rustman plugin new <name> --kind <extension point> writes a project into ./<name> (or --dir):
| File | What it holds |
|---|---|
Cargo.toml | a cdylib depending on rustman-plugin-sdk with the world’s feature and runtime, its own [workspace], panic = "abort" and a size-optimized release profile. Until the SDK is published on crates.io it comes from the Rustman repository (git = "https://github.com/CyberdyneCorp/rustman", version = "1", which keeps it on API major 1; the first build pins the commit in Cargo.lock, which the README says to commit and build --locked); --sdk <path> uses a local copy instead, such as crates/rustman-plugin-sdk of a checkout |
rustman-plugin.toml | the manifest, with component = "target/wasm32-wasip2/release/<crate>.wasm" |
src/lib.rs | a no_std sample implementation |
rustman-plugin-tests.toml | test cases for rustman plugin test |
README.md | the build, test and use recipe |
The samples are an HMAC-SHA256 auth scheme (v1, needs clock and secrets:read:<key_var>), a status-2xx assertion function, a slug generator, a stamp request transformer and a strip-xssi response transformer, a lines importer, an echo request kind with its pane, and a text report renderer. CI scaffolds, builds (--locked, against the committed lockfiles in scripts/plugin-template-locks/, regenerated with --update-locks after a template’s dependencies change), tests and adds every one of them (scripts/check_plugin_templates.py), so each template is also a working example of its extension point. The built project is a folder source: from the workspace root, rustman plugin add ./my-auth pins it.
Test plugins in this repository’s own test suite are written in WebAssembly text against the canonical ABI and wrapped into components in-process (the test-fixtures feature of rustman-plugin), so the main test suite needs no wasm32-wasip2 toolchain.
Testing plugins
rustman plugin test [path] runs a plugin’s test cases with the host test harness: the real sandbox, with exactly the grants each case lists, against a fake clock, fake randomness, a fake environment, a fake network and fake secrets. Nothing real is reachable, so the same cases give byte-identical output on every run and platform. path is a plugin folder (default .) or a .wasm file; the cases are rustman-plugin-tests.toml next to the manifest, or --cases <file>.
# my-auth/rustman-plugin-tests.toml
[fakes]
clock = 2026-01-01T00:00:00Z
random_seed = 7
env = { REGION = "eu-west-1" }
secrets = { hmac_key = "test-secret" }
[[fakes.http]]
method = "POST"
url = "https://auth.example.com/token"
status = 200
headers = { "content-type" = "application/json" }
body = '{"token":"t"}'
[[case]]
name = "signs with the fixed clock and the fake secret"
grants = ["clock", "secrets:read:hmac_key"]
sign = { scheme = "v1", method = "POST", url = "https://api.example.com/orders", params = { key_var = "hmac_key" } }
expect = { "header.X-Timestamp" = "1767225600", "header.X-Signature" = "0278871e60295553e9588cd1ee773721a033c7ea9e7114d87148c9897f1abf71" }
[[case]]
name = "cannot read the secret without its grant"
grants = ["clock"]
sign = { scheme = "v1", url = "https://api.example.com/orders", params = { key_var = "hmac_key" } }
expect_error = "secrets hmac_key"
[fakes] holds what every case runs against, and a case’s own fakes table adds to it (its clock and seed win, its maps add and replace entries, its responses are matched first):
| Fake | Meaning |
|---|---|
clock | the time clock.now returns: a UTC datetime (2026-01-01T00:00:00Z, as a TOML datetime or a string) or Unix seconds; 1970-01-01T00:00:00Z when unset |
random_seed | the seed of the bytes random.bytes returns (SplitMix64); 0 when unset |
env | the variables env.get sees; the process environment is never read |
secrets | the session’s secrets: revealed only with secrets:read:<name>, and redacted from everything shown |
http | canned responses (method, default GET; url, matched exactly; status, default 200; headers; body). A granted request without one fails with no fake response for <method> <url> |
Each [[case]] has a name, its grants (default none; checked against the manifest like a workspace’s), optional limits, and exactly one call:
| Call | Fields | Output lines |
|---|---|---|
sign | scheme, method (GET), url, headers, body, params | header.<name>, query.<name>, url |
check | function, method, url, request_headers, request_body, status (200), headers, body, duration_ms, args (a JSON object) | verdict (pass, fail, error), message |
generate | name, args | value |
transform_request | name, url, headers, body | header.<name>, body |
transform_response | name, status (200), headers, body | header.<name>, body |
convert | format, source_path, source | request.<path>, environment.<path> |
execute | kind, request (JSON) | summary, status, header.<name>, body |
render | format, report (JSON) | output |
expect maps output lines to the exact values they must have; expect_error instead requires the call to fail with a message containing its text. A case without either passes when the call succeeds. The command prints every case with its output lines, the plugin’s log lines and the host calls it was refused, then a count:
plugin my-auth 0.1.0
ok signs with the fixed clock and the fake secret
header.X-Signature: 0278871e60295553e9588cd1ee773721a033c7ea9e7114d87148c9897f1abf71
header.X-Timestamp: 1767225600
ok cannot read the secret without its grant
capability_denied: secrets hmac_key
2 passed, 0 failed
It exits with 0 when every case passes, 1 when one fails (with a ! line saying what differed), and 2 when the plugin or its cases cannot be read. Everything shown is redacted of the fake secrets, like plugin output in a real session (value: «redacted:api_token»); expectations are compared with the real values. The fake services only replace what a granted call reaches: a call without its grant is refused by the sandbox first, exactly as in a run.
Stability and compatibility
From v1.0, Rustman keeps a small set of public contracts stable: the file formats you commit, the documents and protocols other tools read, and the exit codes scripts branch on. This page lists them, says what “stable” means for each, and names the test that fails CI when one of them changes by accident.
The promise
- Within a major version, changes are additive only. A frozen contract can gain new optional fields, new message types, new report kinds, new enum values, new functions on imported interfaces and new commands. Nothing that exists is renamed, removed, retyped or given a new meaning, and no new field becomes required where older writers would not send it.
- Readers ignore what they don’t know. Readers of the report and the viz protocol must accept unknown fields, kinds and enum values; Rustman’s own readers do. Files written by an older 1.x release stay valid in every later 1.x release.
- Breaking changes bump the contract’s major version (
version: 2,rustman.report/v2,rustman-viz/2,rustman:plugin@2.0.0) and ship in a new major Rustman release. Rustman refuses a major version it does not support with a clear error, instead of guessing. - Deprecation before removal. A field, flag, value or command that is going away is first marked deprecated in its documentation and in the release notes, keeps working for the rest of the major version, and, where there is human-readable output, makes Rustman print a warning when it is used. It is removed only in the next major version.
Frozen contracts
| Contract | Where it is defined | What is frozen | Guard tests |
|---|---|---|---|
Request files, version: 1 | Request files, the *.rman.yaml kinds in each protocol’s page, openspec/specs/workspace | The version: 1 header and every documented field of every built-in kind. Any other version, or none, is refused with exit code 2 before the kind’s fields are read. | request_file_version_1_is_frozen_for_every_kind, future_version_is_rejected and a_quoted_version_is_rejected in crates/rustman-core/tests/request_files.rs |
Workspace settings, rustman.toml version = 1 | Request files | The [workspace] version = 1 key and the documented tables. A newer version is refused. | newer_settings_version_fails_to_load in crates/rustman-core/tests/workspace.rs |
Reports, rustman.report/v1 | Reports, JSON Schema docs/schemas/report.schema.json (also printed by rustman report schema) | Every property, required field, type and enum value of each report kind (run, exploration, contract, bench, stress). | The checked-in schema must equal the one generated from the report types (report_schema_prints_the_published_schema in crates/rustman-cli/tests/report.rs); its surface must contain every line of crates/rustman-report/tests/frozen/report-v1.txt (crates/rustman-report/tests/frozen.rs); v0.1 run reports still validate (reports_without_data_keep_the_v0_1_shape); other majors are refused (an_unknown_major_version_exits_2_naming_it) |
Viz protocol, rustman-viz/1 | Viz protocol, JSON Schema crates/rustman-viz-protocol/schema/rustman-viz-1.schema.json | The protocol name, the line limit, every message type with its fields, types and required fields, and the views, report kinds, outcomes, severities and run states. | crates/rustman-viz-protocol/tests/frozen.rs against crates/rustman-viz-protocol/schema/frozen/rustman-viz-1.txt; every message type decodes from its example in the protocol doc; crates/rustman-viz-protocol/tests/messages.rs (round trips, schema, unknown fields and types) |
Plugin API, rustman:plugin@1 | Plugins, WIT package crates/rustman-plugin-sdk/wit/plugin.wit | Every type, function, world import and world export of the package. Exported interfaces get no new functions (existing plugins would lack them). | crates/rustman-plugin/tests/wit_api.rs against crates/rustman-plugin-sdk/wit/frozen/1.0.0.txt |
| CLI exit codes | CLI reference, crates/rustman-cli/src/exit.rs (CODES) | The codes below and their meanings. A code is never reused for another meaning. Command-specific uses documented on each command’s page (for example rustman import) are frozen too. | the_exit_codes_are_frozen_and_documented in crates/rustman-cli/src/exit.rs, which also checks this table and the one in the CLI reference |
CLI exit codes
| Code | Meaning |
|---|---|
| 0 | Success: every executed request passed. |
| 1 | At least one assertion (or threshold, or finding at the --fail-on level) failed, and nothing errored. |
| 2 | Usage or configuration error: a bad flag, no workspace, an invalid or unsupported file. |
| 3 | At least one request errored (network, TLS, timeout, auth, unresolved variable). It wins over 1. |
| 4 | Refused by the safety policy, the stress gate or the monitor policy. |
| 130 | Interrupted by Ctrl+C (SIGINT), or on Unix by SIGTERM or SIGHUP. |
Changing a frozen contract
An additive change updates the contract’s definition and its documentation, then refreshes the frozen surface file in the same pull request, so the review shows exactly what was added:
RUSTMAN_FREEZE_REPORT=1 cargo test -p rustman-report --test frozen
RUSTMAN_FREEZE_VIZ=1 cargo test -p rustman-viz-protocol --test frozen
RUSTMAN_FREEZE_WIT=1 cargo test -p rustman-plugin --test wit_api
A refresh only ever adds lines. A diff that removes a line from a frozen file is a breaking change: it needs a new major version of that contract, not a refresh. A new exit code is added to CODES, to the table above and to the CLI reference.
Not covered
These can change in any release, including minor ones:
- The terminal UI: layout, colours, panes, toasts and the default key bindings.
- Human-readable output: the
prettyreporter, progress lines, dashboards, warnings and error messages. Scripts should read reports,--jsonoutput and exit codes instead. - The
--jsonoutput of individual commands other than reports (for examplerustman kafka consume --json): it is documented with each command and changes additively in practice, but it is not frozen yet. - The agent (MCP server) tool set and the HTML, Markdown and SARIF renderings of reports. SARIF follows the SARIF 2.1.0 schema; its rule ids and messages may change.
- The Rust APIs of the workspace’s crates (
rustman-core,rustman-http,rustman-reportand the others). They are internal and unpublished; only the plugin SDK’s WIT package is a public API. - Files under
.rustman/(history, caches, journals, monitor results): their format belongs to Rustman, not to you. - Behaviour that is a bug: fixing it is not a breaking change, even if something relied on it. Security fixes may tighten defaults (for example refusing a request that was allowed) within a major version; the release notes say so.
JSON schemas
Machine-readable outputs carry a schema field naming their format and major version, and are described by JSON Schemas kept in this repository:
| Schema | Describes | Produced by |
|---|---|---|
rustman.report/v1 | The canonical report of runs, explorations, contract checks, load and stress tests (kind: run, exploration, contract, bench, stress) | rustman run --reporter json, --report json, rustman explore run; rustman report schema prints the schema; see Reports |
rustman.import-report/v1 | The report of an import: files, conflicts, moved secrets, notes and script migration counts | rustman import --report <file>; see Importing collections |
rustman-viz/1 | The JSON-lines protocol between rustman and the viz companion | rustman run --viz, rustman viz; see Viz protocol |
Exit codes are listed in the CLI reference, with the import-specific ones in Importing collections.
Viz protocol (rustman-viz/1)
The viz protocol connects rustman (the producer: the CLI or the TUI) to the optional graphical companion rustman-viz. It is specified by the visual-dashboards capability. The message types live in the rustman-viz-protocol crate (serde types only, no I/O), and the JSON Schema of every message is crates/rustman-viz-protocol/schema/rustman-viz-1.schema.json.
Transport
- The producer spawns the companion and writes to its stdin: UTF-8 JSON, one message per line, each an object with a
typefield. - A line is at most 16 MiB (16,777,216 bytes, newline excluded). A body that does not fit is written to a temp file and sent as a
blob_refinstead of inline text. The producer owns that file: it keeps it while the companion runs and removes it once the companion has exited, so the companion must not delete it. (A producer that exits first leaves the file to the companion.) - The companion’s stdout carries only the handshake reply and
errorlines. Its stderr goes to a log file in the Rustman state directory. - End of stdin means the producer is gone. Open windows stay usable and show
Producer disconnected.
Versioning
- The protocol is named
rustman-viz/<major>. The major version changes only on breaking changes. - Minor additions are new optional fields and new message types. Readers ignore unknown fields and unknown message types (the crate decodes an unknown
typeasMessage::Unknown), and unknown values of open enumerations (views, outcomes, severities, states) decode asunknown. - Writers never send a field or type the peer has not agreed to by version.
Handshake
The producer opens every session with hello. The companion answers with hello_ack (and its views) or hello_reject (and the versions it speaks). After a rejection the producer sends nothing more and reports both versions, e.g. Viz companion speaks rustman-viz/1, rustman needs rustman-viz/2.
{"type":"hello","protocol":"rustman-viz/1","producer":"rustman 0.2.0"}
{"type":"hello_ack","protocol":"rustman-viz/1","viewer":"rustman-viz 0.2.0","views":["run_dashboard","exploration_dashboard","api_graph","response_inspector"]}
{"type":"hello_reject","supported":["rustman-viz/1"]}
Messages
Opening a view, and loading a saved report (kind is run, exploration, bench or stress; view is optional, e.g. api_graph for --view graph):
{"type":"open_view","view":"run_dashboard","title":"smoke/"}
{"type":"load_report","path":"reports/run-2026-11-17.json","kind":"run"}
A run as it happens. outcome is passed, failed, errored (no response: error says why, redacted, and there is no status), cancelled or skipped. A run ends completed or aborted:
{"type":"run_started","started_at":"2026-11-17T10:00:00Z","environment":"staging","total":200}
{"type":"exchange_completed","request":"users/get-user","method":"GET","url":"https://api.test/users/42","outcome":"passed","status":200,"duration_ms":84,"assertions":{"passed":3,"failed":0},"iteration":1}
{"type":"exchange_completed","request":"users/get-user","method":"GET","url":"https://nope.invalid/users/42","outcome":"errored","duration_ms":3,"assertions":{"passed":0,"failed":0},"error":"dns"}
{"type":"run_finished","state":"completed","summary":{"total":200,"passed":180,"failed":15,"errored":5,"skipped":0,"duration_ms":9000}}
An exploration. Severities are critical, high, medium, low and info:
{"type":"exploration_started","started_at":"2026-11-17T10:00:00Z","operations":24,"base_url":"https://api.test"}
{"type":"probe_completed","operation":"POST /users","outcome":"passed","status":201,"duration_ms":12}
{"type":"finding","severity":"high","operation":"POST /users","title":"500 on empty body","detail":"POST /users with {} returned 500"}
{"type":"exploration_finished","state":"completed","operations_total":24,"operations_exercised":18,"status_codes_documented":40,"status_codes_seen":31}
A bench (rustman bench --viz, see Load testing) opens the bench view, then sends one bench_tick per second with that second’s requests, errors, rate, latency percentiles (milliseconds) and active VUs, and a final bench_finished with the totals and thresholds. remaining_ms is left out when the bench has no fixed duration, and aborted (threshold or interrupted) when it ran to its end. Bench events hold counts, timings and threshold expressions only, never request or response content:
{"type":"open_view","view":"bench","title":"rustman bench https://staging.example.com"}
{"type":"bench_tick","second":3,"elapsed_ms":3000,"remaining_ms":27000,"active_vus":10,"requests":412,"errors":2,"rps":412.0,"p50_ms":18.2,"p95_ms":61.0,"p99_ms":120.4}
{"type":"bench_finished","state":"completed","duration_ms":30000,"iterations":4100,"requests":12300,"errors":41,"rps":410.0,"p50_ms":18.0,"p95_ms":64.3,"p99_ms":130.1,"thresholds":[{"expression":"p95<300ms","passed":true,"actual":"64.3ms"}]}
A stress run (rustman stress --viz, see Stress testing) opens the stress view and streams the same bench_tick per second for valid traffic, then close. A companion whose hello_ack lacks stress gets no stream, and the run warns viz companion has no stress view once.
Monitor trends (rustman monitor status --viz and v in the TUI’s Monitors view, see Monitors) open the monitor_trend view and send one monitor_trend per monitor, then close: the uptime gauges (24 hours, 7 and 30 days, left out without runs), the p95 latency of each hour with runs, oldest first, and the outcomes by UTC hour of day for the heatmap. They hold counts, timings and outcomes only, never request or response content. A companion whose hello_ack lacks monitor_trend gets nothing, and Rustman shows the text status with a note:
{"type":"open_view","view":"monitor_trend","title":"rustman monitor status"}
{"type":"monitor_trend","monitor":"api-health","environment":"prod","schedule":"every 5m","uptime_24h":98.95,"uptime_7d":99.5,"uptime_30d":99.9,"latency":[{"hour":"2026-11-17T09:00:00Z","p95_ms":123.0}],"hour_of_day":[{"hour":9,"passed":11,"failed":1,"errored":0,"skipped":0}]}
Chain probes (rustman evm probe --viz, see Probing EVM providers) open the chain_probe view and send exploration_started, then per provider one probe_latency per method (the provider × method latency heatmap), one chain_block per recent block (block-time and gas plots) and, for a traced --call, one call_trace node graph; then the findings, exploration_finished and close. Endpoints are redacted. A companion whose hello_ack lacks chain_probe gets nothing, and the probe warns and suggests --report html=…:
{"type":"open_view","view":"chain_probe","title":"rustman evm probe"}
{"type":"probe_latency","provider":"https://rpc-a.example/","method":"eth_call","samples":3,"p50_ms":12.5,"p95_ms":30.0,"max_ms":31.2}
{"type":"chain_block","provider":"https://rpc-a.example/","number":20000000,"timestamp":1717000000,"gas_used":15000000,"gas_limit":30000000}
{"type":"call_trace","provider":"https://rpc-a.example/","nodes":[{"id":0,"kind":"CALL","to":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","gas_used":30000},{"id":1,"parent":0,"kind":"DELEGATECALL","error":"execution reverted"}]}
A response for the inspector, inline or by reference. Header values and bodies are redacted by the producer before they are written (secrets appear as «redacted:name»); the companion has no reveal function:
{"type":"inspect_response","request":"users/list","status":200,"content_type":"application/json","headers":[{"name":"Authorization","value":"Bearer «redacted:token»"}],"selector":"$.items","body":{"type":"inline","text":"{\"items\":[{\"id\":1,\"name\":\"a\"},{\"id\":2,\"email\":\"b@x\"}]}"}}
{"type":"inspect_response","request":"exports/all","status":200,"body":{"type":"blob_ref","path":"/tmp/rustman-viz/body-01.json","bytes":209715200,"media_type":"application/json"}}
{"type":"blob_ref","path":"/tmp/rustman-viz/report-01.json","bytes":20971520,"media_type":"application/json"}
Errors and the end of a session:
{"type":"error","code":"vulkan_unavailable","message":"Graphics unavailable (Vulkan)"}
{"type":"close"}
Priorities
A companion whose queue is full may coalesce progress messages (exchange_completed, probe_completed), but never drops finding, run_finished, exploration_finished or bench_finished. Producers apply the same rule to their own queue: rustman bench --viz drops a bench_tick rather than wait for a slow companion, never the bench_finished.
Exit codes of the companion
| Code | Meaning |
|---|---|
| 0 | The user closed the windows (or --protocol-check succeeded) |
| 2 | Bad arguments, or a report file that is not a Rustman report |
| 3 | Graphics unavailable: an error line vulkan_unavailable is written first |
| other | A crash; the producer shows Viz companion exited and keeps running |
rustman-viz --protocol-check prints the protocol names it speaks, one per line, and exits 0.
Load testing internals
How rustman bench (Load testing) is built on the rest of Rustman, for contributors and for the changes that extend it (stress testing, thresholds, reports, live dashboards).
One execution path
A VU is a rustman_http::runner::Runner of its own and sends every request through Runner::send, the executor of rustman run: the same resolution, auth helpers, assertions, captures and redaction. A runner per VU gives each VU its own capture scope, cookie jar and connection pool. Runners are built with in_workspace: false, so VUs never write to the workspace, and with SnapshotMode::Ci.
Every request goes through RunOptions::gate: each VU has a BenchGate wrapping a GovernedSender (its own connection pool) created with GovernedSender::with_policy, so all VUs share one Governor built from the [bench] caps (max_rps as the rate, the VU pool as the concurrency, no probe budget) rather than from [safety].
The crate rustman-bench holds everything but the flags and the printing:
| Module | Role |
|---|---|
profile | Profile (one variant per executor), ProfileSpec (flags to a profile), stages and think time |
caps | the [bench] caps check and the run time |
safety | the pinned policy, the static preflight check, BenchGate |
data | Feeder: the row of each iteration per --data-mode and --data-exhaust |
metrics | Metrics: per-second windows of HDR histograms and counters, the time series, error samples, BenchSummary |
threshold | Threshold: parsing <metric><op><value>[!] and evaluating it against a BenchSummary |
lag | LagProbe: the generator’s scheduling lag and the generator-bound warning |
report | bench_report: the kind: bench report of a BenchOutcome |
summary | the plain-text end-of-run summary |
closed, open | the schedulers of the closed models and the open model |
bench | Bench::prepare (checks, nothing sent) and Bench::run: the executor, the run controller, the monitor and the lag probe |
A new executor (such as a stress profile) is a new Profile variant, its flags in ProfileSpec, and a scheduler beside closed and open that runs Vu::iteration.
Metrics
Each finished request becomes a Sample (latency, error class, assertion checks, phase timings, bytes) recorded into the current one-second window: an hdrhistogram latency histogram in microseconds (1 µs to 10 minutes, 3 significant digits) per request file plus one overall, with counters and phase sums beside it. Once a second, Metrics::tick turns the window into a BenchSecond of the time series, adds it into the totals (histograms merge exactly) and resets it, keeping its memory. The summary is the totals plus the current window, so percentiles are within 0.1 % of the exact ones whatever the request count (a unit test checks this on uniform, exponential and bimodal distributions).
Memory is bounded: two histograms (window and totals, about 170 KB each) per request file plus two overall, a time series of one small point per second (capped at 24 hours), and at most 20 error samples per class. No latency sample is kept.
The latency of a request is its transport time (timings.total), which excludes the time spent waiting for the rate limiter. In the open model it also includes the wait between the iteration’s scheduled start and the start of its first request (coordinated-omission correction). Bytes sent are estimated from the recorded request (request line, headers and text body); bytes received are the response body.
Error samples are described from the request’s record (its error, else its first failed assertion, else METHOD url -> status), all of which the runner already redacted, and redacted once more with the exchange’s own Redactor before they are kept. In METHOD url -> status the values of query parameters named like a secret (password, token, secret, api_key, the names that make a data column secret, rustman_core::data_rows::secret_by_name) are also replaced with «redacted:<name>», since a plain --var there is not a known secret.
Run control
Bench::run races four futures: the executor, the controller, the monitor and the lag probe. The controller stops new iterations (the stop token) at the end of the profile, on a first Ctrl+C (BenchInput::interrupt) or on an abort-on-fail breach, then waits a drain period (the graceful stop of 30 s, 10 s after Ctrl+C, 1 s after a breach) before it cancels the iterations still in flight (the hard token, also cancelled at once by BenchInput::cancel, the second Ctrl+C). The monitor ticks the metrics every second and, after the warm-up (10 s, Bench::with_abort_warmup in tests), evaluates the abort-on-fail thresholds against the summary so far. The lag probe yields to the runtime every 20 ms and records how long it waits to be polled again, which does not depend on the timer resolution of the operating system.
The outcome carries the summary, the series, the threshold results, the error samples, aborted (threshold or interrupted) and the warnings; rustman_bench::report::bench_report turns it into the report, and the CLI maps it to its exit code.
Live view
Bench::live (taken before Bench::run) returns a rustman_bench::Live: the shared Metrics, the thresholds and the planned duration. Live::snapshot copies the totals and the current second under the metrics lock and merges them, computes percentiles and evaluates the thresholds after releasing it, so a VU recording a request waits at most for that copy (a few hundred KB per request file); iteration durations have a lock of their own. One lock for every VU is ample under the default max_rps caps; a change raising them by orders of magnitude (add-stress-testing) should shard the current window per VU. The front ends live in rustman-tui:
bench_view::renderdraws aSnapshotwith ratatui (pure; snapshot-tested on aTestBackend);bench_live::spawnruns a thread that, untilLiveHandle::finish, draws the dashboard every 250 ms on the alternate screen (no raw mode, so SIGINT still reaches the bench) or printslive::progress_lineevery 10 s, and forwards each newly closed second to the viz stream;bench_vizopens the stream after the shared companion handshake (companion::connect, also used by the TUI’s response hand-off), and writes through a bounded queue on a writer thread: ticks are dropped when it is full,bench_finishedandclosewait at most 5 s, then the companion is killed.
A stress executor gets all of this for free as long as it records into the same Metrics.
Threading
Every VU runs on the thread that calls Bench::run. The executor is one future: Closed::run drives all VUs with join_all, and Open::run keeps the in-flight iterations in a FuturesUnordered polled from its own select! loop; both are raced against the controller, the monitor and the lag probe in one tokio::select!, which the CLI drives with Runtime::block_on. Nothing is tokio::spawned, so request resolution, assertions and metrics recording for every VU share that thread, and the multi-thread runtime’s workers only run the I/O the engine hands them. This is ample under the default caps (50 VUs, 200 rps), and the lag probe warns when the generator falls behind. It is the main scaling limit, though: add-stress-testing should spawn each VU (or each open-model iteration) as its own task, with Arc-shared Shared state instead of borrows, before sharding the metrics lock.
Executor overhead
cargo bench -p rustman-bench --bench executor measures what the VU path adds per request: one GET to a local hyper server sent by the bare HttpEngine, against the same request sent as a VU sends it (Runner::send through a BenchGate and its governor, then classified and recorded in the metrics). It reports both with criterion, then times 3000 interleaved samples of each and fails when the VU path’s p50 exceeds the engine’s by more than 50 µs (design D1: optimize only beyond that). The failure message names the measured overhead and both p50s. CI runs it in the bench-overhead job, so a regression fails the build.
Last recorded result (release build, macOS on Apple silicon, loopback):
| Path | criterion mean | p50 |
|---|---|---|
HttpEngine::send | 55.6 µs | 39 µs |
VU (Runner::send + gate + metrics) | 56.6 µs | 48 µs |
| Overhead | 9 µs (limit 50 µs) |