Skip to content

AI review and investigation in CI

When a pull request reads Worse or Slightly worse at a place, KeepSnappy raises an alarm, and an AI can say in CI whether the code change explains it. Its answer shows next to the result. It answers the open alarms: not those a person marked, those it already answered, or those of a session whose code didn’t change (details). act can also look for the cause.

Two commands do this. Both are opt-in, and both run in your CI with your own AI key. KeepSnappy makes no AI call and holds no AI key of yours.

The two commands

keepsnappy review asks Claude or Codex whether the code change can explain the alarms it reviews. AI review in CI has its step, where its answer shows, and when it skips the AI because the app did not change.

keepsnappy act works with Claude only. It runs the same review, then Claude looks for the cause of the alarms your policy names. It can also propose a fix. AI investigation and fixes in CI has its step, the policy, what act investigates, fix mode and what act posts on a pull request.

What review and act share

Each command’s page has its step: review, and act, which also needs a read key and a GitHub token.

In CI, review and act don’t take three things from the pull request’s keepsnappy.yml: the AI program to run, its login folder, and any looser limits (number of AI turns, time, files, lines). These come from a flag or your own ~/.config/keepsnappy/config.yml. The log names each setting it left out.

Both commands also run on your Mac, in your app’s checkout. Run keepsnappy review --run-set ID --dry-run, or the same with act, to preview the results. The ID is the session’s run set ID, from keepsnappy-result.json or the dashboard link. Dry-run skips posting and storing answers and publishing fixes. It still reads the session using your KeepSnappy key and can send the diff or other code from your checkout to the configured AI provider.

Models and cost

Each step ends with one line per model: calls, tokens, and their price on an API key. At the defaults, act makes at most 5 investigation and fix runs a day, and each investigation stops at $1. The review isn’t counted.

The models each command asks are on AI review in CI and AI investigation and fixes in CI.

What leaves your CI

Your AI provider receives the diff and the measured facts, with your key. KeepSnappy receives no diff.

Before the AI sees the diff, files that hold secrets are dropped, such as .env*, keys, certificates and google-services.json. Token shapes in the rest are redacted. The review’s AI runs with no tools, in an empty folder, without your KeepSnappy key.

KeepSnappy receives:

  • From the review, for each alarm: false_alarm or real, the confidence, a reason of at most 25 words, the model, the token usage and a hash of the diff.
  • From act, each hypothesis (likely cause) as text: the claim, the file paths and lines, the evidence, the expected change and the risks.
  • On GitHub Actions, the address of the workflow run, for a link on the dashboard.

That text is redacted first. Code blocks in the AI’s text, and any diff line it quotes, become [code]. Keys, tokens and secret shapes are removed. A name or a short piece of code the AI writes in its own words can remain.

Exit codes

CodeMeaning
0The step finished. This includes a failed AI call, post or push: a warning line says so. A provider outage never fails your build.
1Something you must fix (see below).
2The command line or the policy is wrong, or there is no session: no --run-set, and no keepsnappy-result.json from keepsnappy run --wait.
130The step was interrupted.

For exit code 1, check for:

  • No AI key and no login.
  • Claude Code missing or too old, or Codex for the review.
  • A commit missing from the clone (set fetch-depth: 0).
  • A folder that is not a git repository.
  • A refused key.
  • Investigation on without a read key.

Every flag is in the CLI reference, under review and act.

Next: add the review with AI review in CI, or the investigation and fixes with AI investigation and fixes in CI.