Run selected tests
Run it from the root of your git repository:--ai-select-base when you need to set it explicitly:
How selection works
Momentic combines three sources of evidence:- The git diff identifies the code and behavior that changed.
- A local code index traces imports and downstream consumers in your repository.
- The app graph connects product journeys and UI states to the tests that exercised them in real runs.
Guide selection with a prompt
Use--prompt to add repository-specific selection guidance that Momentic
cannot infer from the diff, code index, or app graph:
--prompt, the standard
selection prompt is unchanged.
The standalone command accepts the same flag:
Use the code index in GitHub Actions
Check out full git history and install the code-index parsers before running the command:Preview a selection
Use shadow mode to compare a selection with the full test run before using it to gate pull requests. Momentic still runs every in-scope test and records which ones selection would have skipped.momentic ai select:
selectedTests for an explicit handoff and sets
fallbackToRunAll when Momentic cannot produce a safe selection.
Build a dynamic CI matrix
Run standalone selection once in a planning job, convert the selected test paths into your CI system’s matrix format, and pass each shard’s paths tomomentic run. This lets a small selection use one runner while larger
selections create more shards.
Your planner should handle three outcomes:
- Run the paths in
selectedTests. - Run every in-scope test when
fallbackToRunAllistrue. - Skip the execution job for a valid selection with no tests.
momentic run --ai-select when you do not need to customize the handoff; it
performs selection and execution in one command.
When selection chooses zero tests
A selection that picks no tests is a normal outcome for non-behavioral changes. The run group still uploads with the selection plan, and the GitHub pull request comment explains why nothing ran instead of staying silent. When onboarding onto AI selection, set your CI up so zero-test selections reach Momentic:- Always run
momentic results upload. Do not gate the upload step on the runs directory existing or on tests having run; a zero-test run group uploads its metadata, which is what powers the pull request comment. - When you merge sharded results before uploading, pass
--allow-emptytomomentic results mergeso shards without runs keep their selection plans in the merged archive. momentic results checktreats a zero-test results directory as clean, so a check step needs no special casing.
Benchmark
The benchmark uses real code changes across frontend, backend, CLI, shared-library, configuration, and non-behavioral scenarios. The GPT-5.5 Codex baseline receives the same changes and candidate test files as Momentic, but does not use the app graph or its investigation workflow. Cross-functional recall is measured on a harder subset of those cases that span product boundaries.
We can share the raw results and reproduction harness on request.
Notes
- The command needs enough git history to resolve the base ref. Use
fetch-depth: 0withactions/checkout. - The code index currently analyzes TypeScript and JavaScript imports. Runtime app graph evidence can still connect behavior across other boundaries.
- A budget limits selection size, not safety behavior. Selection can fall back to running all tests.