What it does
Given a base and head ref, the agent:- Diffs the two refs and identifies user-facing changes. These are not always frontend edits: a backend change that surfaces to the user counts, and the agent reasons about which parts of the app are affected and how.
- Maps each change to the user journeys it touches.
- Checks existing tests for coverage. When a test already partially covers a journey, it proposes an edit to that test rather than a brand-new sibling.
- Surfaces potential product bugs it finds while exploring, including severity, ordered reproduction steps, and supporting evidence.
- By default, opens a live browser session and authors or edits the tests,
drawing on your knowledge base for terminology and
flows. Pass
--dry-runto skip this and only discover journeys.
Commands
explore has two subcommands:
momentic ai explore diff [commitRange]— explore a git diff window and cover the journeys that changed.momentic ai explore latest— seed coverage for the whole app instead of a diff.
Build vs. discover
By default, the agent authors or edits tests for each discovered journey:git diff semantics: base...head diffs the
merge-base of the two refs against head, base..head diffs base directly
against head, and a single commit diffs that commit against its parent.
With --dry-run, it only discovers and logs the changed journeys without
writing tests — useful for inspecting what it would do:
momentic ai explore diff with no range. See
Author tests from a diff in CI for a ready-to-use
workflow.
Configure the agent
Custom instructions
Give the agent project-specific guidance through a custom prompt — a freeform text block appended to the agent’s built-in instructions. Use it to describe how to access your app, which flows matter most, and any conventions the generated tests should follow. Keep the custom prompt in a file in your repository and pass it with--prompt-file:
--prompt for a quick
one-off override:
--prompt and --prompt-file multiple times. The combined
instructions are all --prompt-file contents followed by all --prompt values,
each in the order you pass them. So you can, for example, combine a committed
repo-overview file with a bug-bash-specific instructions file:
Write a good prompt file
The prompt is appended to the agent’s built-in instructions, so treat it as the project-specific layer on top: focus on what the agent cannot infer from the code and the running app. A good prompt file is concise, concrete, and stable across runs — a page or two of Markdown that a new teammate could also follow. Cover the things that reliably improve generated tests:- Access and auth. How to reach the app and sign in — which
auth module to call and where (e.g. “start every test
by calling the
log-inmodule in thebeforesection”), which test accounts or roles to use, and any environment or feature-flag setup a flow depends on. - Where to focus. Areas of the product that matter most, and areas to skip entirely (admin-only screens, third-party embeds, destructive actions).
- Domain terminology. Product-specific names for surfaces, states, and actions so the agent describes journeys the way your team does.
- Conventions for generated tests. Naming, folder placement, and any patterns the tests should follow (reuse existing modules, prefer a given assertion style).
- Guardrails. Data or actions the agent must never touch — do not send real emails, do not delete records, do not touch production billing.
Knowledge base
The agent also draws on your knowledge base. Add entries for product terminology, navigation shortcuts, or domain rules that should influence the tests it writes — the agent retrieves relevant items automatically during a run.Seed coverage for the whole app
A diff is the usual starting point, but you can also explore the entire product at once withmomentic ai explore latest. Instead of a commit range, the agent
maps the whole app and self-replicates into child explorers, one per surface, so
a new project can go from zero to a baseline of coverage without a diff to
anchor on. Its output is labeled as discovered user journeys instead of changed
journeys.
Control how deep it goes
--granularity sets how specific the proposed test plans are:
The flag overrides the per-project default; leave it unset to use the project
config (
medium if not configured).
For a hard cap on output, pass --budget <tests> instead: the agent targets at
most that many test plans, prioritising the most important journeys, and stops
discovering flows once the budget is filled. --budget and --granularity
cannot be combined.
--timeout caps the wall-clock budget for a run (default 15 minutes, or 60
minutes for explore latest). On timeout the agent stops and emits whatever
partial results it has rather than running indefinitely, which keeps a stuck
build from consuming a full CI job. Build and edit sub-agents each receive
two-thirds of the overall timeout, so one child agent cannot consume the whole
budget.
Output
The human-readable output lists discovered or changed journeys, proposed test plans, and any potential product bugs the agent found. Potential bugs include a title, severity, summary, reproduction steps, and evidence, so you can decide whether to fix the product or adjust the generated tests. Pass--json to print the same result as a single JSON object and suppress the
streaming UI:
What happens to the tests
When the agent writes tests, the On successful explore behavior in Settings > Explore decides the outcome:
Pull requests are pushed to a
momentic-explore/ branch. Because the output is
a reviewable PR, generated coverage lands in the same review flow as any other
change rather than appearing silently.
Related
- Author tests from a diff in CI for a ready-to-use workflow
momentic ai exploreCLI reference- Post-run heal agent for repairing failing tests
- App graph for tracking coverage of discovered journeys