Fail the build when your LLM feature starts sounding surer than it should
Score a fixed set of your feature's answers on every pull request that touches prompts or model settings. If an answer drops below your threshold, the ClearRun CLI exits 1 and the check fails.
Last updated
What goes wrong today?
We changed the prompt and bumped the model version in the same PR. Unit tests passed, because unit tests don't read the answers. Two weeks later support noticed the feature stating things flatly that it used to hedge. I want a check in the pipeline that looks at the answers themselves, runs only when it matters, and doesn't eat the CI budget.
How does the gate work?
Save a sample set
Keep a small, fixed set of your feature's answers as .txt or .md files, generated in an earlier CI step or committed to the repo. Add a clearrun.config.json with the folder and your threshold.
Add one step
Run npx -y @clearrun/cli@1.2.0 score with your CLEARRUN_API_KEY stored as a CI secret. It works in GitHub Actions, GitLab CI or any CI with Node.js 18 or newer.
Report first, then block
Start with the step set to report so it shows scores without failing pull requests. Once you trust your threshold, turn on blocking. Limit the job to changes in your prompts and answers folders.
What do you get?
- A pass or fail per run. Exit code 0 means every answer passed. Exit code 1 means an answer fell below your line or the run failed.
- A threshold you set from 0 to 100. ClearRun doesn't pick one for you.
- JSON output with each answer's score and verdict id, to keep as a build artifact.
- A signed receipt for each hosted score, so you can look back at what a given build was scored on.
- Self-serve start. A verified free account can create one developer key and gets 30 free credits a month. Pro starts at $25/month.
What it does not do: a pass does not mean the answers are true. It means each answer's confidence was backed by its reasoning above your line. The CLI scores the files you give it. It does not call your model for you.
What should you measure?
Use your own numbers. We don't supply any.
- Regressions caught before release. Pull requests the check failed that led to a prompt or model change before merge.
- Rollbacks and hotfixes. Rollbacks or hotfixes on LLM features after release, and the engineering hours each took, before and after the gate.
- Review time on prompt changes. Time reviewers spend on pull requests that touch prompts or model settings.
- Cost per run. Credits used per CI run, which depends on how many files you score.
Where are the details?
- How to use ClearRun in GitHub Actions
- How to use ClearRun in GitLab CI or any other CI
- How to use ClearRun in CI without blocking every pull request
- How to choose a ClearRun score threshold
- How to fail a build when a score is too low
- What do the ClearRun CLI exit codes mean?
- How to get JSON output from the ClearRun CLI
- How to pin ClearRun package versions in CI
- How to keep ClearRun credit use predictable
- How to use ClearRun mock mode in Jest or Vitest tests
- How to get your first ClearRun score in five minutes
Does a passing check mean our answers are correct?
No. ClearRun is not a fact-checker or a hallucination detector. A pass means each answer's confidence was backed by its reasoning above your threshold.
Will it block every pull request?
Only if you set it up that way. Run the job only when prompts or answers change, and start with it set to report before you turn on blocking.
How much does a run cost?
Every file scored on every run uses credits. Each score uses at least 3. Keep the sample set small. A few dozen well-chosen answers usually tell you more than hundreds.
Will scores be identical between runs?
Not always. A later run of the same text can score slightly differently, so leave some room between your typical scores and your threshold. For tests that need fixed values, use the SDK's mock mode, which needs no key.
You can start on your own today. Start free.