Skip to content
Free
CLI & console

echoproof

Verify behavior of code changes by replaying real traffic

From crates.io Version 0.4.0 Updated Oct 15, 2026 91 downloads

Install

Run this in your project folder.
cargo add echoproof

Echoproof

CI crates.io Release License: MIT OR Apache-2.0

Bahasa Indonesia | English

Behavioral verification for every code change, based on real traffic.

Echoproof records real requests and responses from your service, replays them against the build that contains a code change, and reports what changed, on which endpoint and field, for what share of requests, and whether that change was intended. Use the result as a merge gate in CI, or let a coding agent (Claude Code, Cursor and similar tools) check its own work directly.

Echoproof catching a pricing regression that the change intent does not explain

record  ->  replay against old and new build  ->  semantic diff  ->  judge against intent  ->  gate

Contents

Why Echoproof

When much of the code is written by AI agents, the number of changes grows far faster than people can review them. Passing tests and a tidy-looking diff do not guarantee that the system still behaves correctly: tests are written from assumptions, while bugs often come from real combinations of data that nobody thought of.

Echoproof answers a question that neither unit tests nor code review answer:

Does this change alter how the system behaves on real traffic, and is that the change that was meant?

An example of what Echoproof catches: a pull request meant to "add a currency field to the catalog" accidentally passes one argument in the wrong position. As a result, the price of 3 out of 8 menu items changes while the other 5 stay correct. Unit tests pass and the code diff looks reasonable. Echoproof reports products[*].price: 18000 -> 22000 on every catalog request and flags it as a regression.

Key features

  • Records real traffic. A reverse proxy records every request and response, with sensitive data redacted before anything is written to disk.
  • Semantic diff. JSON is compared field by field, not line by line. Changes are grouped per endpoint and field and classified as breaking, behavior or additive.
  • Resistant to noise. UUIDs, timestamps and random values are recognized automatically. Fields that change on their own between runs are learned by replaying the old build twice.
  • Safe with state. Write requests are not replayed unless allowed per endpoint. The old and new builds are compared on the same data, with a reset command between every pass.
  • Aware of intent. Each group of changes can be judged by Claude against the pull request description or the agent's task. Changes the intent does not explain are flagged as regressions.
  • Built for CI and agents. Exit codes for merge gates, Markdown reports for pull request comments, JSON for automation, and an MCP server for coding agents.

Installation

Homebrew (macOS and Linux)

brew install est57/tap/echoproof

Prebuilt binary (recommended)

Download the archive for your platform from the releases page, or from the terminal:

VERSION=v0.1.0
TARGET=aarch64-apple-darwin   # or x86_64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu
curl -sLO https://github.com/est57/echoproof/releases/download/$VERSION/echoproof-$VERSION-$TARGET.tar.gz
curl -sLO https://github.com/est57/echoproof/releases/download/$VERSION/echoproof-$VERSION-$TARGET.tar.gz.sha256
shasum -a 256 -c echoproof-$VERSION-$TARGET.tar.gz.sha256
tar -xzf echoproof-$VERSION-$TARGET.tar.gz
sudo mv echoproof-$VERSION-$TARGET/echoproof /usr/local/bin/
echoproof --version

With Cargo

If you have Rust 1.85 or later:

cargo install echoproof

From source

Requirements: Rust 1.85 or later. curl is needed to run the demo.

git clone https://github.com/est57/echoproof.git
cd echoproof
cargo install --path crates/echoproof-cli

The echoproof binary is installed in ~/.cargo/bin. Make sure that directory is on your PATH:

echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
echoproof --version

Quick start

These steps check a code change on a service running in your test environment.

1. Create a configuration file (optional; every setting has a default):

echoproof init

2. Record traffic. Run the proxy in front of the service, then point your app, Postman or automated tests at the proxy address:

echoproof record --upstream http://127.0.0.1:8000 --listen 127.0.0.1:8080 --out traffic.jsonl

Stop it with Ctrl-C once representative traffic has been collected.

Laravel apps can record without a proxy using echoproof/laravel: run composer require echoproof/laravel, set ECHOPROOF_RECORD=true in .env, and traffic is written to storage/echoproof/traffic.jsonl with the same redaction rules.

3. Run two builds, the version before the change (base) and after it (PR), using the same database.

4. Compare:

echoproof check -s traffic.jsonl --base http://127.0.0.1:8001 -t http://127.0.0.1:8002

5. Read the result. Exit code 0 means no unexpected changes, 1 means a regression was found, and 2 means an error occurred. See Reading the report.

To judge the changes against their intent, add the pull request description and the code diff:

git diff main...HEAD > change.diff
echoproof check -s traffic.jsonl --base http://127.0.0.1:8001 -t http://127.0.0.1:8002 \
  --intent-file pr-description.md --code-diff change.diff --output echoproof-report.md

Demo

The full demo takes about 10 seconds and does not need a service of your own:

./scripts/demo.sh

The demo uses a small POS backend (examples/demo-shop) that has state: product stock goes down with every order. A "pull request from an agent" is meant to add a currency field to products, but it also changes how promo and voucher discounts are combined.

Step What it shows
1. Record 2,000 requests from the production version Recording
2. Replay against the same version, compared with the recording False alarms caused by state: stock was consumed during recording
3. Compare the base and PR builds with --base and --reset, safe mode False alarms disappear. currency is detected. Write requests are reported as unverified
4. Same as step 3, with --allow-writes "POST /orders" The discount bug is caught, only on orders that use a promo and a voucher together
5. Intent judging by Claude (when ANTHROPIC_API_KEY is set) currency is judged intended, the discount change is judged a regression

Concepts

Snapshot

A snapshot is a JSONL file with one request and response pair per line. Headers and sensitive fields are redacted before they are written. The same snapshot can be reused to check many pull requests.

Two comparison modes

Mode Command Suited for
Against the recording echoproof check -s traffic.jsonl -t URL_PR Stateless services, or environments whose data matches the time of recording
Base vs PR echoproof check -s traffic.jsonl --base URL_BASE -t URL_PR Services backed by a database (recommended)

In base vs PR mode, the recorded responses are not used as the reference. Echoproof replays the same traffic against both builds on the same data:

reset  ->  replay against base        ->  reference
reset  ->  replay against base again  ->  fields that differ are recorded as noise
reset  ->  replay against PR          ->  candidate
diff reference and candidate, ignoring noise

Each build's own address (for example http://127.0.0.1:8001 inside image URLs or pagination links) is normalized automatically, so two builds running on different ports remain comparable.

Safe mode

By default only GET, HEAD and OPTIONS requests are replayed. Write requests are skipped and never counted as passing: the report states how many there were and warns that their behavior is unverified.

Allow write requests per endpoint, and only against an environment that may be modified or can be reset:

echoproof check ... --allow-writes "POST /orders" --allow-writes "PUT /cart/*"

Use --reset (or replay.reset) to restore state before every pass, for example by restoring a database dump or calling a reset endpoint in the test environment. Echoproof refuses to replay write requests without a reset while noise is being learned, because state changes between runs would be learned as noise and hide regressions.

Semantic diff

  • JSON is compared field by field. 5 and 5.0 are equal, and key order is ignored.

  • Every change is classified:

    Classification Examples
    breaking Field removed, type changed (including to null), 2xx status turned into an error
    behavior Value changed, array length changed, status changed
    additive New field
  • Paths are normalized: /products/42 becomes GET /products/{id}, and items[3].price becomes $.items[*].price. Each change is counted once per request.

  • UUIDs, ULIDs and date-times of the same shape are treated as noise. Bare dates (such as 2026-10-14) are still compared.

Change intent

There are two ways to tell Echoproof which changes are expected.

Option Granularity When to use it
--expect "GET /products/*" Endpoint Fast, free, no external service
--intent "..." Endpoint, field and value When the intended change and a bug can occur on the same endpoint

--expect lets every change on the listed endpoints through. If a pull request is meant to change the catalog but also breaks prices in the catalog by accident, --expect "GET /catalog" will not catch it.

With --intent, each group of changes is judged by Claude and given a verdict of intended, regression or unclear, with a reason that cites example values. The judge sees the stated intent, the code diff (optional), the share of affected requests, examples of changed requests with their before and after values, and examples of unchanged requests on the same endpoint for contrast. unclear verdicts and groups the judge did not rule on are treated as regressions (fail closed).

Intent judging requires an Anthropic API key. Each run makes one API call, and only when something changed. A typical run costs about USD 0.01 to 0.02 with the default model.

Third-party calls

A service that calls payment gateways, messaging or other APIs must not reach them during a replay. With echoproof/laravel, those calls are recorded with each request, and builds started with ECHOPROOF_REPLAY=true answer them from the recording and block everything else. Both builds therefore receive identical third-party responses, and Echoproof compares what each build sent:

  x POST /checkout  3/3 changed (100.0%)  unexpected
      behavior  value changed   outbound[POST pay.example.com/v2/charges] $.amount  (3 requests)
            outbound[POST pay.example.com/v2/charges] $.amount: 18000 -> 1800000

The checkout response was identical in this example; only the amount sent to the gateway changed. A call that was never recorded is reported as call added with severity breaking. If a build reports calls that Echoproof cannot read, the request fails the check instead of passing unverified.

Any language: the outbound proxy

For services that are not Laravel, or that call third parties through an SDK with its own HTTP client, Echoproof can act as the proxy for the service's outbound calls:

echoproof ca init                                   # per-project CA in .echoproof/, mode 0600 key
echoproof ca env --runtime php                      # or node, python, go: settings for the service
echoproof record --upstream http://127.0.0.1:8000 --listen 127.0.0.1:8080 -o traffic.jsonl \
  --outbound-listen 127.0.0.1:8899                  # records each call with the request in flight
echoproof check -s traffic.jsonl --base http://127.0.0.1:8001 -t http://127.0.0.1:8002 \
  --outbound-proxy 127.0.0.1:8899                   # answers every call from the recording

Set the proxy and CA settings only on the service under test. Echoproof itself ignores proxy environment variables. During replay the proxy has no way to reach the real destination. A client that ignores the proxy settings (Node before 22.21 without NODE_USE_ENV_PROXY=1, or code that sets its own proxy) still calls the real service, but shows up as call removed, never as a pass; run test builds without an outside network route where you can. Secret values that a third party echoes back (an API key in a returned URL, a token in a returned header) are redacted too. Recording attributes calls correctly only while requests arrive one at a time, so record on staging or scripted traffic.

Command reference

Command Purpose
echoproof init Writes echoproof.toml with every setting explained
echoproof record --upstream URL --out FILE Runs a reverse proxy that records traffic
echoproof replay -s FILE -t URL -o FILE Replays a snapshot against a target and saves its responses
echoproof diff BASELINE CANDIDATE Compares two snapshots
echoproof check -s FILE -t URL Replays and diffs in one step, against the recording
echoproof check -s FILE --base URL -t URL Replays and diffs, base vs PR on the same state
echoproof accept CANDIDATE --baseline FILE Makes reviewed responses the new baseline
echoproof mcp Runs the MCP server for coding agents

Common options:

Option Applies to Description
--config FILE all Configuration file, default echoproof.toml
--expect PATTERN diff, check Endpoint expected to change. Repeatable
--intent TEXT, --intent-file FILE diff, check Change intent to be judged by Claude
--code-diff FILE diff, check Code diff given to the intent judge
--format text|markdown|json diff, check Terminal output format, default text
--output FILE diff, check Saves the report. The format follows the extension (.md, .json)
--max-examples N diff, check Examples per group of changes, default 2
--base URL check Reference build for base vs PR mode
--reset CMD check Shell command that restores state before every pass
--noise-runs N check Extra base replays used to learn noise, default 1
--allow-writes PATTERN replay, check Endpoint whose write requests may be replayed. Repeatable
--concurrency N replay, check Parallel requests, default 1
--save FILE check Saves the candidate snapshot

Endpoint patterns: POST /orders, GET /products/* (* matches one segment), /admin/** (** matches any number of segments), or * for everything.

Exit codes: 0 passed or only expected changes, 1 regression found, 2 error (configuration, network, failed reset, or failed intent judging).

Configuration

Every setting is optional. Run echoproof init to create a file with all settings and their explanations.

[record]
upstream = "http://127.0.0.1:8000"
listen = "127.0.0.1:8080"

[sanitize]
# Applied when recording and when replaying, so redacted values stay comparable.
redact_headers = ["authorization", "cookie", "set-cookie", "x-api-key"]
redact_fields = ["password", "token", "pin", "card_number", "phone", "email"]

[replay]
concurrency = 1                                          # raise only for stateless endpoints
timeout_ms = 10000
headers = { authorization = "Bearer ${STAGING_TOKEN}" }  # replaces redacted headers
safe_methods = ["GET", "HEAD", "OPTIONS"]
allow_writes = ["POST /orders"]                          # empty by default (safe mode)
reset = "./scripts/restore-test-db.sh"
noise_runs = 1

[diff]
ignore = ["updated_at", "$.meta.trace_id", "items[*].etag"]
expect = ["GET /products/*"]
auto_noise = true
compare_headers = ["content-type"]

[judge]
model = "claude-opus-5-5"
effort = "high"                                          # low, medium, high, xhigh, max
fallbacks = true

[mcp]
allowed_hosts = []                                       # hosts besides localhost that agents may use

ignore patterns: a bare name (updated_at) matches at any depth. Patterns that start with $ or contain a dot ($.meta.trace_id, items[*].etag) are anchored at the body root.

Environment variables:

Variable Description
ANTHROPIC_API_KEY API key for intent judging (alternative: ANTHROPIC_AUTH_TOKEN)
ANTHROPIC_WORKSPACE_ID Required when the API key is not scoped to a single workspace
ANTHROPIC_BASE_URL Alternative API endpoint. Must use https, except for localhost
ECHOPROOF_JUDGE_TRACE Saves the judge's request and response to a file (mode 0600) for debugging

Reading the report

Example terminal report:

echoproof: REGRESSION - 83 exchanges, 5 changed, 78 unchanged
  ignored 1 noisy fields that differ between runs of the base build: GET /up body
  intent judged by claude-opus-5-5: The currency field is added as intended. ...

  x GET /catalog                5/5 changed (100.0%)  unexpected
      behavior  value changed   $.result.products[*].price  (5 requests)
          [regression] The diff swaps the third argument of products() ...
          GET /catalog  [00e36fd43ade]
            $.result.products[1].price: 18000 -> 22000
      additive  added           $.result.currency  (5 requests)
          [intended] Adding 'currency' => 'IDR' matches the intent.

  - GET /branches               0/5 changed (0.0%)  unchanged

result: FAIL
Marker Meaning
x The endpoint changed in an unexpected way (regression)
~ The endpoint changed as expected or as intended
- The endpoint did not change, or its requests were not replayed
(N requests) Number of requests with that change
[intended], [regression], [unclear] Intent verdict and its reason

Other formats:

  • --format markdown produces a report ready to post as a pull request comment.
  • --format json produces structured data, including findings: one sentence per problem, ready to hand back to a coding agent.

Once changes have been reviewed and approved, make the result the new baseline:

echoproof replay -s traffic.jsonl -t URL_PR -o candidate.jsonl
echoproof accept candidate.jsonl --baseline traffic.jsonl

CI integration

Use the Echoproof GitHub Action. It installs the release binary, runs echoproof check, writes the report to the job summary and exposes the verdict as an output:

- name: Start base and PR builds
  run: ./scripts/start-builds.sh   # base on :8001, PR on :8002, same test database

- run: git diff origin/${{ github.base_ref }}...HEAD > change.diff

- name: Behavior check
  id: echoproof
  uses: est57/echoproof-action@v1
  with:
    snapshot: traffic/baseline.jsonl
    base: http://127.0.0.1:8001
    target: http://127.0.0.1:8002
    reset: ./scripts/reset-db.sh
    intent: ${{ github.event.pull_request.title }}
    code-diff: change.diff
    anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

- name: Comment on PR
  if: always()
  run: gh pr comment ${{ github.event.number }} --body-file "${{ steps.echoproof.outputs.report }}"
  env:
    GH_TOKEN: ${{ github.token }}

A regression fails the step and blocks the merge. Set fail-on-regression: false to only report. On other CI systems, install the binary and run echoproof check directly; exit code 1 means a regression.

Coding agent integration (MCP)

A coding agent finds and fixes a discount bug it did not write, verified by Echoproof

In this recorded run, Claude Code (Sonnet) was asked to trim the cashier name in the order service. A discount bug had been planted in the same file beforehand. The check failed, the agent traced the regression to the bug it had not written, fixed it, and only reported the task done after the check passed.

echoproof mcp runs a Model Context Protocol server over stdio, so a coding agent can check the changes it made before declaring the work done.

Install in your coding agent

Install the echoproof binary first (brew install est57/tap/echoproof or cargo install echoproof). Every agent below starts echoproof mcp in your project folder, so it can reach your local builds and snapshot files.

Claude Code, as a plugin (recommended). The plugin adds the MCP server and a verify-behavior skill that tells Claude when and how to check its changes, so no extra instructions in CLAUDE.md are needed:

/plugin marketplace add est57/echoproof
/plugin install echoproof@echoproof

From a shell: claude plugin marketplace add est57/echoproof and claude plugin install echoproof@echoproof.

Claude Code, MCP server only:

claude mcp add echoproof -- echoproof mcp

Cursor (.cursor/mcp.json in the project, or ~/.cursor/mcp.json), Claude Desktop (claude_desktop_config.json), and other clients that read an mcpServers map:

{ "mcpServers": { "echoproof": { "command": "echoproof", "args": ["mcp"] } } }

VS Code with Copilot agent mode (.vscode/mcp.json):

{ "servers": { "echoproof": { "type": "stdio", "command": "echoproof", "args": ["mcp"] } } }

Codex CLI: codex mcp add echoproof -- echoproof mcp, or in ~/.codex/config.toml:

[mcp_servers.echoproof]
command = "echoproof"
args = ["mcp"]

Gemini CLI: gemini mcp add echoproof echoproof mcp, which writes .gemini/settings.json in the project.

The Claude Code integration has been tested end to end. The other clients use the same standard MCP over stdio but have not been tested yet; reports are welcome. Web-based assistants such as ChatGPT and Claude.ai cannot use Echoproof, because they run on the provider's servers and cannot reach the builds on your machine.

Echoproof is listed in the official MCP Registry under this name:

mcp-name: io.github.est57/echoproof

Tools

Tool Main inputs Purpose
echoproof_check snapshot, target, base, intent, expect, allow_writes Replays and diffs. Returns a report for the agent, structured JSON and a run_id
echoproof_diff baseline, candidate, intent, expect Compares two existing snapshots
echoproof_exchange run_id, id Full request, reference and candidate responses, and field-level changes

Agent workflow: change the code, start the build, call echoproof_check with the task as intent, and on a regression, open examples with echoproof_exchange, fix the code and check again. The server deliberately offers no accept tool, because approving a new baseline remains a human decision.

Security and privacy

Recorded data

  • Headers and fields listed in [sanitize] are replaced with [REDACTED] before they are written to disk. Add the fields that hold personal data in your domain, such as phone numbers, email addresses or identity numbers.
  • Snapshots contain business data. Keep them out of public repositories or make sure they are in .gitignore.

Data sent to Anthropic when using --intent

The intent text, the code diff (when given), endpoint and field names, the number of affected requests, and example request bodies with before and after values, after redaction. Example bodies over 4,000 characters are truncated. Nothing is sent when --intent is not used.

Built-in safeguards

  • Write requests are never replayed without explicit per-endpoint permission.
  • Paths from a snapshot are validated so that requests, and any injected credentials, cannot be redirected to another host.
  • Responses are capped at 32 MB.
  • The API key is only sent over https, except to localhost.
  • Text from outside (intent, diff, traffic) cannot change the structure of the judge's prompt or break tables in Markdown reports.

Safeguards for coding agents (MCP)

  • target and base must be on localhost unless the host is listed in [mcp] allowed_hosts. Replays carry the headers from replay.headers, so an agent must not be able to send them to another host.
  • File paths (snapshot, save, code_diff_file) must be inside the project directory. Symlinks that lead outside it are rejected.
  • The reset command is only read from echoproof.toml, never from the agent.

Limitations

  • Write requests need a test environment that can be reset. Without one, use safe mode, which only verifies read requests.
  • Third-party calls are answered from the recording through echoproof/laravel (Laravel's Http client) or the outbound proxy (any client that honors proxy settings). Clients that ignore proxy settings and non-HTTP dependencies (SMTP, queues, gRPC over raw sockets) are still called for real; the former show up as call removed.
  • IDs across requests: with sequential replay (concurrency = 1), an ID that the replay creates differently from the recording (order 9812 recorded, order 57 replayed) is carried into later requests for the same entity (/orders/9812, order_id). IDs of data that already existed when the traffic was recorded cannot be mapped; with --base, those requests are reported as not reproduced instead of being counted as unchanged. Turn mapping off with --no-id-mapping or [replay] map_ids = false.
  • Request order is preserved by replaying sequentially (concurrency = 1). Large traffic can be slow, and parallel replay is only safe for stateless endpoints.
  • Changes that should have happened but did not are hard to detect, because Echoproof reports requests that changed.
  • Rare noise can slip past a single learning run. Raise --noise-runs or add an ignore pattern when needed.

Development

Repository layout

crates/echoproof-core     snapshot format, sanitization, diff, reports, intent judging
crates/echoproof-cli      `echoproof` binary: recorder, replay, CLI, MCP server
examples/demo-shop     POS backend for the demo and the eval
eval/judge             intent judge eval: cases, runner and grader
scripts/demo.sh        end-to-end demo

Running the tests

cargo test
cargo clippy --all-targets -- -D warnings

Intent judge eval

eval/judge contains 26 labelled pull request scenarios (54 groups of changes) that measure how accurately the judge separates intended changes from regressions. With the default configuration the judge scored 100% correct gate decisions across 78 runs, with no false alarms. The current scenarios are no longer hard enough to tell better configurations apart, so cases from real systems are being added. The case list is in eval/judge/CASES.md.

eval/judge/prepare.sh                                                         # builds fixtures, no API cost
node eval/judge/run-eval.mjs --flow eval/judge/runs/intent-judge --variant baseline --reps 3
node eval/judge/summarize.mjs eval/judge/runs/intent-judge/baseline

The runner refuses to start until the harness has been approved once with --approve-harness, and asks for approval again whenever the runner, the cases or the judge change.

License

Echoproof is licensed under either of the following, at your option:

Unless you explicitly state otherwise, any contribution you submit for inclusion in this project is dual licensed as above, without any additional terms or conditions.