Skip to main content
The explore agent is in beta and may change.
momentic ai explore diffs a commit range, identifies the user journeys that changed, and with --build authors or edits Momentic tests to cover them, opening the new tests as a pull request so coverage keeps pace with the product. See the explore agent overview for the concept. Run it on pushes to main — the same way Momentic dogfoods explore internally. Each merge to main is explored once, against the change that just landed, so coverage is authored for work that is already shipping rather than re-running on every commit of every open branch.

Add the workflow

Add a workflow that runs explore whenever changes land on main:
.github/workflows/momentic-explore.yml
name: Momentic explore

on:
  push:
    branches:
      - main

permissions:
  contents: write
  pull-requests: write

env:
  MOMENTIC_API_KEY: ${{ secrets.MOMENTIC_API_KEY }}

jobs:
  explore:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: "npm"

      - run: npm ci
      - run: npx momentic install-browsers chromium

      - name: Explore the changes that landed and build tests
        run: npx momentic ai explore --build
fetch-depth: 0 gives the agent the history it needs to diff the pushed range. Outside a pull request, momentic ai explore diffs the commit that just landed (HEAD~1..HEAD), so a squash-merged PR is explored as a single change without passing --base or --head. 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. Drop --build 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. On main or a GitHub-protected branch, open a draft PR instead.
  • patch: print a git apply-ready diff instead of opening a PR. Needs no GitHub App or pull-requests: write, so it is the option for forked-PR runs.
  • nothing (default): leave the changes on disk.
Pull requests are pushed to a momentic-explore/ branch, so generated coverage lands in the same review flow as any other change.

Steer the agent

Append project-specific instructions with --prompt, or set a default custom prompt in Settings > Explore:
npx momentic ai explore --build --prompt "Focus on the checkout and billing flows."

Variations

For large repositories, run explore on a schedule or on demand instead of on every push to main by swapping the trigger. Pass an explicit --base/--head when the range is not the last commit:
on:
  workflow_dispatch:
  schedule:
    - cron: "0 9 * * 1" # every Monday at 09:00 UTC
See the momentic ai explore reference for every flag. The same pattern works on GitLab CI, CircleCI, Jenkins, and custom setups.