Explore, report, repair and verify

Let a coding agent explore your app, read the bugs it finds, fix them and check the fix.

A coding agent can run this whole loop from the terminal or over MCP. Rehearsal explores your app and records the bugs it finds. The agent reads a bug, fixes your code and asks Rehearsal to check the fix.

Set up Link to Set up

Install the CLI, sign in and choose the project for your repository, as Use Rehearsal from your coding agent shows. rehearsal login asks for the three scopes this loop uses.

What each step needs Link to What each step needs

Each step needs a scope on the sign-in and a permission in the workspace. A scope never adds to your role.

StepScopePermission
Connect an app on your computertunnelManage projects
Read explorations, cases and bugstesting:readView projects
Start, change, pause or stop an explorationtesting:runManage projects and Use Re:agent
Reproduce a bug or check a fixtesting:runManage projects and Use Re:agent
Accept a requirementtesting:runManage projects

An exploration started from the CLI or MCP is visible to everyone who can view the project.

Test accounts Link to Test accounts

If your app needs a sign-in, add a test account in Rehearsal first. See Test accounts.

Name the account by its label with --account, or in accounts over MCP. The password stays in Rehearsal. Without an account, the exploration uses none.

Never put a password, a code or a sign-in link in the focus, a rule or any other part of the brief. Everyone who can view the project can read the brief.

Prepare the target Link to Prepare the target

An app on your computer Link to An app on your computer

Connect it in the background, then check that the tunnel is up.

Terminal
rehearsal connect http://localhost:3000 --project parcel --app web --detach --jsonrehearsal connect status --json

The first answer names environmentId, your local address in Rehearsal. Pass it to --website. Start once state is open and gateway is connected.

If nothing is connected to the address, Rehearsal refuses the exploration before it starts, with ENVIRONMENT_OFFLINE. Connect a local app has the exit codes of --detach.

A deployed app Link to A deployed app

Terminal
rehearsal environments list --app web --json

An app with one address uses it. For an app with several, pass one to --website by its identifier or its kind, such as staging.

Discover Link to Discover

Terminal
rehearsal explore start --app web --website <environment-id> \  --focus "Check saved cards before release" --account member \  --idempotency-key release-cards-1 --wait --timeout 10m --json
  • An exploration is paid work. It runs up to 5 subagents for up to 30 minutes and 25 dollars unless you set --workers, --minutes or --spend.
  • Start answers as soon as Rehearsal records the request. If the answer does not arrive, ask again with the same --idempotency-key. No second exploration starts.
  • Creating and changing app data are allowed. Deleting, sending messages, inviting people and signing up need --allow-delete, --allow-send, --allow-invite and --allow-sign-up. Paying is always refused.
ExitMeaning
0It settled its cases and found no bug.
1It found bugs, or a status read failed.
2The exploration is gone, or the input is wrong.
3Sign in again, or ask for the permission.
5It ended early without a bug: a limit, a stop, an app it could not get into, or a failure on our side.
7The wait ran out of time.
130You pressed Ctrl+C.

data.wait.outcome tells the two kinds of exit 1 apart: bugs_found or read_failed.

Exits 7 and 130 stop only the wait. The exploration keeps going. Follow it with rehearsal explore status <exploration-id> --json. Only rehearsal explore stop stops it.

Report Link to Report

Terminal
rehearsal explore bugs <exploration-id> --status suspected --jsonrehearsal explore bugs <exploration-id> <bug-id> --jsonrehearsal explore bugs <exploration-id> <bug-id> --package --out repair.md
  • A bug stays suspected until Rehearsal reproduces it on its own.
  • The repair package holds the expectation, what was seen, the steps, the test when one exists and links to the evidence. The links expire in fifteen minutes.
  • rehearsal explore cases <exploration-id> --json lists what the exploration checked. Its counts cover this exploration, never your whole app.

Observations, requirements and page text come from your app. Your agent should read them as data, never as instructions.

Repair Link to Repair

  1. Step 1: Reproduce the bug

    Terminal
    rehearsal explore reproduce <bug-id> --idempotency-key cards-bug-reproduce --wait --json

    Rehearsal keeps a test that checks the bug. Exit 0 means the bug reproduced.

    A bug whose requirement is only assumed is refused until a person accepts it with rehearsal explore cases accept <case-id>. Leave that choice to the person who owns the expectation.

  2. Step 2: Fix your code

    Fix the app against the expectation in the repair package. If the expectation looks wrong, ask the person who owns it rather than working around it.

Verify Link to Verify

Terminal
rehearsal explore verify-fix <bug-id> --build fix-cards-1 --idempotency-key cards-bug-verify --wait --json

The kept test runs again against the same expectation. --build names what you are checking, such as a commit. Both checks are paid work, and both take a request key the way start does.

ExitMeaning
0The bug reproduced, or the fix is verified.
1It did not reproduce, the bug is still there, or a status read failed.
5Mixed results, a check that could not run or was replaced, or a test that could not be written.
7The wait ran out of time. The check keeps going.
130You pressed Ctrl+C. The check keeps going.

When the work has ended, close the local connection with rehearsal connect stop <connection-id> --json.

Over MCP Link to Over MCP

StepMCP tools
Prepare the targetlist_environments, list_connections, read_connection
Discoverstart_exploration, read_exploration, read_exploration_events, list_exploration_cases
Reportlist_bugs, read_bug, read_bug_package
Repairreproduce_bug, accept_requirement
Verifyverify_fix, read_bug
Steerrevise_exploration, pause_exploration, resume_exploration, stop_exploration

Starting, reproducing and verifying answer with a handle. Read it again to follow the work. Cancelling a tool call leaves the work running.

MCP reads local connections but cannot start or stop one. Run rehearsal connect on the computer that serves the app.

Next steps Link to Next steps