momentic ai explore diffs a
commit range, identifies the user journeys that changed, and by default authors
or edits Momentic tests to cover them, opening the new tests as a pull request
so coverage stays current with the product. See the explore agent
overview for the concept.
Run it on pushes to main - the same way Momentic runs explore on its own
repository. Each merge to main is explored once, against the change that just
landed, so coverage is authored for work that has already merged rather than
re-running on every commit of every open branch.
Add the workflow
Add a workflow that runs explore whenever changes land onmain:
.github/workflows/momentic-explore.yml
fetch-depth: 0 gives the agent the history it needs to diff the pushed range.
Outside a pull request, momentic ai explore diff diffs the commit that just
landed (HEAD~1..HEAD), so a squash-merged PR is explored as a single change
without passing an explicit commit range.
MOMENTIC_API_KEY authenticates the run.
Create one here and add it as a
repository secret. The contents: write and pull-requests: write permissions
let the Momentic GitHub App open the pull request, which
uses your repository’s
pull request template.
Pass --dry-run to have the agent only discover and log the changed journeys
without authoring tests - useful while you are evaluating what it would do.
Choose what a build produces
Set On successful explore in Settings > Explore to control what happens to the tests the agent authors:pull-request: open a PR with the new and edited tests. Best when you want generated coverage reviewed and merged like any other change.draft-pull-request: open the PR as a draft so a human marks it ready.direct-commit-except-main: commit and push to the checked-out branch. Onmainor a GitHub-protected branch, open a draft PR instead.patch: print agit apply-ready diff instead of opening a PR. Needs no GitHub App orpull-requests: write, so it is the option for forked-PR runs.nothing(default): leave the changes on disk.
momentic-explore/ branch, so generated coverage
lands in the same review flow as any other change.
Steer the agent
Append project-specific instructions by committing a prompt file to the repo and passing--prompt-file, so the guidance is version-controlled and reviewed
alongside your code:
--prompt for a quick inline override:
--granularity when the default coverage depth is too broad or too
specific:
low covers the happy path of the main flows plus important failure states
(e.g. a failed login), medium covers the happy path of every interaction plus
important failure states, and high covers every flow in depth including the
happy path and its different failure modes. The flag overrides the project
setting for that run. To cap the number of tests instead, pass
--budget <tests>.
For full-app seeding, run momentic ai explore latest instead of a diff. Seed
runs default to a 60 minute timeout because they map the whole product; diff
runs default to 15 minutes. Pass --timeout <minutes> to override either
default.
Variations
For large repositories, run explore on a schedule or on demand instead of on every push tomain by swapping the trigger. Pass an explicit commit range
(base...head) when the window is not the last commit:
momentic ai explore
reference for every flag. The same pattern works on
GitLab CI,
CircleCI, Jenkins,
and custom setups.