# `mix rma.capture`
[🔗](https://github.com/cash-mckeeman/req_managed_agents/blob/v0.13.0/req_managed_agents/lib/mix/tasks/rma.capture.ex#L1)

Maintainer task: runs each wired live scenario against a real provider,
redacts the captured request/response bodies, and writes them into
`$RMA_CORPUS_DIR/<surface>/{requests,responses}/<name>.json`, stamping
`$RMA_CORPUS_DIR/<surface>/manifest.json`.

Requires live AWS credentials (`SigV4.from_env/1`'s env vars) and
`RMA_CORPUS_DIR` (the private conformance corpus checkout). No-ops with a
clear instruction when either is missing — it never crashes a maintainer's
shell:

    RMA_CORPUS_DIR=/path/to/corpus mix rma.capture

Not shipped in the hex package (`lib/mix` is excluded from `package.files`)
and not exercised by CI.

Ships two surfaces: AgentCore `ListHarnesses` (a side-effect-free
control-plane read, gated on AWS credentials) and Claude Managed Agents
`create_agent`/`create_environment` (gated on `ANTHROPIC_API_KEY`). The CMA
scenario provisions a throwaway agent + environment, captures both create
bodies, then best-effort archives both so a maintainer's account isn't left
with orphaned resources. Add more `{name, fun}` tuples to `scenarios/1` for
more AgentCore reads as they're needed.

## Relationship to `test/support/conformance/capture.ex`

Redaction is shared: both this task and the test-support harness call the
ReqManagedAgents.Conformance.Redaction module, which lives in `lib/` precisely
so a `:dev` mix task can use it (`test/support` isn't compiled in `:dev`).
Every written body is redacted and then leak-scanned (scan_string/1) before it
touches disk.

The WRITER itself is still separate — the ReqManagedAgents.Conformance.Capture
write_pair/5 (test-support) is the unit-tested reference in
`test/conformance/capture_test.exs`; this task's write_pair!/6 mirrors it
(plus the leak-scan guard). Keep the two writers in sync by hand if either
changes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
