CLI reference
Generated from retake --help by docs/guide/cli-reference.sh; do not edit by hand.
Every option can also be set by the environment variable shown with it.
Record real LLM API exchanges and replay them deterministically
Usage: retake <COMMAND>
Commands:
record Run a command through the proxy, forwarding to the provider and recording every exchange to `_main.take`, or to one take per test when a test-runner plugin is active
replay Run a command through the proxy, answering every request from `_main.take` (or each test's take when a test-runner plugin is active) without contacting the network
clean Remove leftover `.partial` files (takes left behind by a crash, a refused recording or an unfinished end-of-run finalization) under the takes directory, listing each one. Only deletes local files; their server-side resources are first saved to `_resource.take` for `retake reap`
finalize Finish a recording run that crashed while `_session.take` had dependents: rename the `.partial` files it left (completing `_session.take.partial`) if every dependent test was re-recorded, as the run would have at its end; otherwise rename nothing and list the tests that must be included
check Check the takes statically, without running tests or calling any API: every line parses and matches the take schema, the take is complete, the current `retake.toml`'s rules and redaction patterns accept it; also lists leftover `.partial` files, takes from failed or unfinished runs and stale takes. Exits 1 on errors (and on stale takes with `--fail-on-stale`)
ls List every take: its test ID, age, the Retake version that recorded it, the models in its exchanges, its outcome or exit code, and why it is stale, if it is. Takes that cannot be read are listed with the reason and make it exit 1
upgrade Rewrite takes recorded in the previous take format to the current one, keeping their meaning. Every take this Retake reads is in format 1, the only format so far, so there is nothing to rewrite yet
reap Delete the server-side resources (uploaded files, message batches) that recordings created and did not delete, as listed by `resource` records in the committed takes and in `_resource.take`, using your own ANTHROPIC_API_KEY. Lists them and asks first; never deletes anything not named by such a record. Unlike `retake clean`, it acts on the provider account, not on local files. Uses ANTHROPIC_AUTH_TOKEN (as a bearer token) when ANTHROPIC_API_KEY is unset
init Set up a project for Retake: add `*.take.partial` and `_resource.take` to `.gitignore` and mark the takes directory's `_blobs/` files as binary in `.gitattributes`, both in the current directory (creating them if needed). Running it again changes nothing
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
retake record
Run a command through the proxy, forwarding to the provider and recording every exchange to `_main.take`, or to one take per test when a test-runner plugin is active
Usage: retake record [OPTIONS] -- <COMMAND>...
Arguments:
<COMMAND>... The command to run, after `--`
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
--config <FILE> Configuration file. Default: `retake.toml` in the current directory, if there is one [env: RETAKE_CONFIG=]
--inflight-timeout <SECONDS> How long the end of a test waits for that test's requests still in flight before dropping them (test-runner plugins only) [env: RETAKE_INFLIGHT_TIMEOUT=] [default: 120]
--fail-on-late-requests Fail the run when a request arrives for a test that has already ended (late requests are always rejected and listed) [env: RETAKE_FAIL_ON_LATE_REQUESTS=]
-y, --yes Replace an existing `_main.take` without asking (required when not on a TTY). `RETAKE_ASSUME_YES` accepts `1`/`true`/`yes`/`on`; `0`/`false`/`no`/`off` or empty mean no [env: RETAKE_ASSUME_YES=]
--record-anthropic-url <URL> Where `retake record` sends Anthropic requests. Defaults to your ANTHROPIC_BASE_URL, else https://api.anthropic.com. Not used by `retake replay`. [env: RETAKE_RECORD_ANTHROPIC_URL=]
--allow-errors Keep every error response as recorded. By default account errors (401, 402, 403) refuse the recording, and transient errors (429, any 5xx, streams the provider cut off) are dropped when retried successfully and otherwise refuse it [env: RETAKE_ALLOW_ERRORS=]
--keep-failed Keep the takes of failed tests, marked `outcome: failed`, instead of discarding them and keeping the previous take (test-runner plugins only) [env: RETAKE_KEEP_FAILED=]
--allow-unscanned <MEDIA_TYPES> Store content Retake cannot scan as-is when its media type is in this comma-separated list (e.g. `image/*,application/pdf`), instead of withholding it. The take's footer lists every part stored this way [env: RETAKE_ALLOW_UNSCANNED=]
-h, --help Print help
retake replay
Run a command through the proxy, answering every request from `_main.take` (or each test's take when a test-runner plugin is active) without contacting the network
Usage: retake replay [OPTIONS] -- <COMMAND>...
Arguments:
<COMMAND>... The command to run, after `--`
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
--config <FILE> Configuration file. Default: `retake.toml` in the current directory, if there is one [env: RETAKE_CONFIG=]
--inflight-timeout <SECONDS> How long the end of a test waits for that test's requests still in flight before dropping them (test-runner plugins only) [env: RETAKE_INFLIGHT_TIMEOUT=] [default: 120]
--fail-on-late-requests Fail the run when a request arrives for a test that has already ended (late requests are always rejected and listed) [env: RETAKE_FAIL_ON_LATE_REQUESTS=]
--pacing <PACING> How fast recorded streams are served: `instant` (every event at once), `realtime` (at the recorded offsets), or a speed-up factor such as `4` (four times faster than recorded) [env: RETAKE_PACING=] [default: instant]
--allow-failed Replay takes recorded from failed tests (kept with `--keep-failed`) instead of refusing them [env: RETAKE_ALLOW_FAILED=]
--fail-on-stale Fail the run (exit 1) when a replayed take is stale: recorded by an older Retake minor version (major from 1.0), or with a different API version header than the client sends now. Stale takes are only a warning by default [env: RETAKE_FAIL_ON_STALE=]
-v, --verbose Print every difference between a recorded and a sent request that normalization rules hid, as each request is matched [env: RETAKE_VERBOSE=]
-h, --help Print help
retake clean
Remove leftover `.partial` files (takes left behind by a crash, a refused recording or an unfinished end-of-run finalization) under the takes directory, listing each one. Only deletes local files; their server-side resources are first saved to `_resource.take` for `retake reap`
Usage: retake clean [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
-n, --dry-run List the files that would be removed without removing them
-h, --help Print help
retake finalize
Finish a recording run that crashed while `_session.take` had dependents: rename the `.partial` files it left (completing `_session.take.partial`) if every dependent test was re-recorded, as the run would have at its end; otherwise rename nothing and list the tests that must be included
Usage: retake finalize [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
--config <FILE> Configuration file, for the redaction patterns of the final secret scan. Default: `retake.toml` in the current directory, if there is one [env: RETAKE_CONFIG=]
-h, --help Print help
retake check
Check the takes statically, without running tests or calling any API: every line parses and matches the take schema, the take is complete, the current `retake.toml`'s rules and redaction patterns accept it; also lists leftover `.partial` files, takes from failed or unfinished runs and stale takes. Exits 1 on errors (and on stale takes with `--fail-on-stale`)
Usage: retake check [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
--config <FILE> Configuration file whose redaction patterns and matching rules the takes are checked against. Default: `retake.toml` in the current directory, if there is one [env: RETAKE_CONFIG=]
--json Print the findings as JSON (`"version": 1`, see schema/check-v1.schema.json)
--fail-on-stale Exit 1 when a take is stale (recorded by an older Retake minor version before 1.0, major from 1.0). Stale takes are only a warning by default [env: RETAKE_FAIL_ON_STALE=]
-h, --help Print help
retake ls
List every take: its test ID, age, the Retake version that recorded it, the models in its exchanges, its outcome or exit code, and why it is stale, if it is. Takes that cannot be read are listed with the reason and make it exit 1
Usage: retake ls [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
--json Print the list as JSON (`"version": 1`, see schema/ls-v1.schema.json)
-h, --help Print help
retake upgrade
Rewrite takes recorded in the previous take format to the current one, keeping their meaning. Every take this Retake reads is in format 1, the only format so far, so there is nothing to rewrite yet
Usage: retake upgrade [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
-h, --help Print help
retake reap
Delete the server-side resources (uploaded files, message batches) that recordings created and did not delete, as listed by `resource` records in the committed takes and in `_resource.take`, using your own ANTHROPIC_API_KEY. Lists them and asks first; never deletes anything not named by such a record. Unlike `retake clean`, it acts on the provider account, not on local files. Uses ANTHROPIC_AUTH_TOKEN (as a bearer token) when ANTHROPIC_API_KEY is unset
Usage: retake reap [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
-n, --dry-run List the outstanding resources without deleting anything
-y, --yes Delete without asking (required when not on a TTY). `RETAKE_ASSUME_YES` accepts `1`/`true`/`yes`/`on` [env: RETAKE_ASSUME_YES=]
--record-anthropic-url <URL> Where to send Anthropic deletions, as for `retake record`: this flag, else your ANTHROPIC_BASE_URL, else https://api.anthropic.com [env: RETAKE_RECORD_ANTHROPIC_URL=]
-h, --help Print help
retake init
Set up a project for Retake: add `*.take.partial` and `_resource.take` to `.gitignore` and mark the takes directory's `_blobs/` files as binary in `.gitattributes`, both in the current directory (creating them if needed). Running it again changes nothing
Usage: retake init [OPTIONS]
Options:
--takes-dir <DIR> Directory holding take files [env: RETAKE_TAKES_DIR=] [default: tests/takes]
-h, --help Print help