The verify loop
Your coding agent changes the app.
Your coding agent changes the app. HeyBug answers three questions before the change ships: does a saved test cover it, if not can the project's agent plan it, and when a test fails what exactly broke? The CLI and the MCP server connect the two agents, and you review a proposed test before it joins the suite.
Verify after every change: name the behaviour, run the related tests, read the failing step, fix the app or the test, then rerun. The Agent loop page at /p/<project>/agent-loop walks the same three stages.
Verify after every change
Write the code, then run the loop before you call the change done. Each turn ends with a finished run, not a guess. If a test fails, the failing step tells you whether the app or the expectation is wrong.
Check for coverage
From the CLI, one command checks the saved tests and records the loop:
heybug loop check --project "$PROJECT_ID" "An expired coupon shows an error and leaves the cart total unchanged"
heybug loop status --project "$PROJECT_ID"loop status prints the current plan, the newest run and each failure with its step, Expected and Actual. loop run --loop <id> starts the related tests and links them to the loop.
To read the cases yourself, list them and open the one that looks related.
heybug tests list --project "$PROJECT_ID"
heybug tests get TC-001 --project "$PROJECT_ID"Run it against a build that contains the change:
heybug runs start --project "$PROJECT_ID" --waitruns start follows the run to its verdict. Exit code 0 means every case passed; exit code 1 means at least one failed. To run one case, pass its key: heybug runs start --project "$PROJECT_ID" TC-001 --wait. The MCP tools heybug_list_tests and heybug_get_test return the same cases with their steps.
If no saved case names the behaviour, go to the next stage.
Ask for missing coverage
State an observable expectation. Attach a diff or a specification so the agent plans from the change, not from a guess.
heybug plan "An expired coupon shows an error and leaves the cart total unchanged" \
--project "$PROJECT_ID" --steps --file changes.diff--steps prints each proposed case with its numbered steps and expected outcome. Review the actions and assertions against the requirement. If the plan is wrong, reject it with a reason and ask again:
heybug reject --card "$CARD_ID" --feedback "Check the cart total after the error, not before."When the plan is right, apply it and run the new cases:
heybug apply --card "$CARD_ID" --runThe MCP tool heybug_plan starts the same exploration and returns the pending card id. Nothing becomes part of the suite until you apply the card.
Diagnose a failure
Read the exact result, then keep the evidence locally when you need to look closer.
heybug results list --run "$RUN_ID" --status failed
heybug results get "$RESULT_ID" --out ".heybug/results/$RESULT_ID"Compare the expected behaviour with the recorded steps: the failing step number and text, Expected, Actual, the page URL, console errors and screenshots. Fix a product defect in the app and rerun the saved case. If the expectation itself is wrong, reject the change with feedback, then review the correction before applying it.
$ heybug loop status --project "$PROJECT_ID"
Plan version 4: 12 tests.
Latest run run_01J8: failed. 11 passed, 1 failed, 0 errored.
- TC-8 Checkout: expected "Coupon expired", got "No error" at step: An error names the couponThe MCP tools heybug_get_failure, heybug_rerun and heybug_verify_changes cover the same path. heybug_verify_changes is the one-call loop: give it a project and either an expectation, changed files or case keys; it runs the related tests, waits up to 45 seconds and returns each failure with its failing step, Expected and Actual.
When it does not work
- No case matches: plan the behaviour, review the steps, apply the card.
- The run is still going: keep the run id and poll
GET /api/runs/<runId>, or callheybug_verify_changesagain. - The agent cannot reach a local app: give it the diff or requirements to plan from, then run the saved frontend tests through a tunnel.
- A case fails for a reason that is not in the app: reject the plan with the reason and let the agent correct the expectation.
Never weaken an assertion to get green. A run only proves the change when it finished and the step that broke now passes.