$ fssg build --deterministic --validate |

Add a Read-Only IOSM CLI Review Gate to CI

IOSM

I do not want the first AI step in CI to edit code. I want it to earn the right to influence a change by producing a bounded, inspectable review.

That makes the smallest useful IOSM CLI integration surprisingly narrow: run one non-interactive, read-only pass; preserve its event stream; convert only explicit findings into a failing gate; and leave repository mutation to a later, separately authorized workflow.

This is not an autonomous repair loop. It is a review boundary.

The boundary: observe, report, decide

IOSM CLI already exposes the pieces needed for this pattern:

  • --print runs a prompt once and exits;
  • --mode json emits a JSON event stream for automation;
  • --tools narrows the available tool set;
  • --no-session avoids carrying conversational state between CI jobs;
  • --offline disables startup network operations;
  • read-oriented tools such as read, rg, git_read, test_run, lint_run, and typecheck_run can inspect the checkout without granting edit, write, git_write, or generic shell access.

The important choice is not the prompt. It is the authority envelope around the prompt.

iosm \
  --mode json \
  --print \
  --no-session \
  --offline \
  --tools read,rg,git_read,test_run,lint_run,typecheck_run \
  "Review the current diff against the repository tests and conventions. Report only findings that name a file, a concrete failure mode, and a verification command."

A model can still be wrong inside this boundary. What it cannot do is silently rewrite the branch, push a commit, call an external service, or turn a speculative observation into a repository mutation. Capability restriction does not make inference deterministic; it makes the possible blast radius explicit.

Keep the raw stream, derive a small receipt

Do not pipe the model's prose directly into exit 1. CI needs two artifacts:

  1. the complete JSON event stream for diagnosis;
  2. a small deterministic receipt used by the gate.

A practical job can capture the stream first:

set -o pipefail
mkdir -p .iosm/ci

iosm \
  --mode json \
  --print \
  --no-session \
  --offline \
  --tools read,rg,git_read,test_run,lint_run,typecheck_run \
  "Review the current diff. End with exactly one marker: IOSM_REVIEW=PASS or IOSM_REVIEW=BLOCK. Use BLOCK only for a reproducible defect and include its verification command." \
  | tee .iosm/ci/review-events.jsonl

Then a deterministic parser—not another model—should validate the terminal marker, reject missing or conflicting markers, and write a receipt such as:

{
  "schema": "iosm-ci-review/v1",
  "result": "BLOCK",
  "commit": "7f4c2ab",
  "review_events": ".iosm/ci/review-events.jsonl",
  "reason": "typecheck fails in src/payments/adapter.ts",
  "verify": "npm run typecheck"
}

The receipt is intentionally smaller than the review. CI does not need to understand every sentence. It needs a closed result vocabulary, the reviewed revision, the evidence location, and a command a human or later job can rerun.

Unknown output must fail closed as REVIEW_ERROR, not masquerade as PASS. A timeout, malformed stream, provider failure, or missing marker says nothing about code quality.

A GitHub Actions shape

The workflow below shows the control structure, not a copy-paste promise for every repository. The installation command and model credentials depend on how the project pins IOSM CLI and its provider.

name: iosm-read-only-review

on:
  pull_request:

permissions:
  contents: read

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

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

      - run: npm ci
      - run: npm run lint --if-present
      - run: npm run typecheck --if-present
      - run: npm test --if-present

      - name: Run bounded IOSM review
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        run: ./scripts/iosm-ci-review.sh

      - name: Upload review evidence
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: iosm-review-${{ github.sha }}
          path: .iosm/ci/

Three details matter.

First, GitHub permissions are read-only. IOSM's tool boundary and the platform's token boundary should agree rather than rely on one another.

Second, deterministic lint, type checks, and tests run independently. The AI review may find a cross-file semantic problem, but it must not replace checks that already have exact pass/fail semantics.

Third, evidence uploads use if: always(). A blocking result is precisely when the trace is needed.

What should block the pull request?

I would begin in advisory mode. Store the receipt, publish a job summary, but do not make the check required. Review false positives, missing evidence, and unstable classifications before giving the gate authority.

Promotion to a required check needs a written policy. For example:

Result CI effect Required evidence
PASS Continue Reviewed commit and complete stream
BLOCK Fail File, failure mode, rerunnable verification command
REVIEW_ERROR Fail or route to manual review Parser/provider/runtime error
ADVISORY Continue with annotation Concern that lacks deterministic reproduction

The key distinction is between a defect and a concern. If the reviewer cannot name a rerunnable check, the output may still help a human, but it should not acquire blocking authority by rhetoric alone.

This also prevents a common inversion: asking an LLM for confidence and treating a high number as evidence. Confidence is not a test result. The evidence is the failing command, invariant, contract, or trace that another actor can inspect.

Where this fits in an IOSM cycle

This gate is narrower than a full first IOSM cycle. It does not create a baseline, execute Improve → Optimize → Shrink → Modularize, or prove a metric delta. It only reviews one candidate revision under a constrained authority envelope.

It also differs from validating IOSM artifacts in CI. Artifact validation checks whether cycle documents and cross-file invariants are structurally coherent. The review gate examines the code change itself and produces evidence tied to a commit.

For larger changes, the result can become one input to the broader IOSM CLI runtime: plan the cycle, perform the work in an authorized environment, then let CI evaluate the resulting revision independently. Execution and verification should not share more authority than they need.

Limits I would keep explicit

A read-only reviewer is not harmless. Source code and diffs may contain secrets, personal data, licensed material, or prompt-injection text. Provider routing and retention therefore remain deployment decisions. --offline prevents startup network operations; it does not eliminate the model-provider connection required by a hosted model.

The review is also not reproducible in the same sense as a compiler. Pin the IOSM CLI version, model identifier where possible, prompt text, parser version, and reviewed commit. Preserve the stream. Even then, classify the result as probabilistic review evidence, not mathematical proof.

Finally, tool restriction must be tested, not assumed. The CI job should assert that mutation tools are absent, repository permissions are read-only, and the working tree remains unchanged after the run:

git diff --exit-code
git status --porcelain=v1

If the review creates only declared evidence under .iosm/ci/, exclude that path from the cleanliness comparison or place it outside the checkout.

Start with less authority

The first IOSM integration should not be an agent that fixes every pull request. It should be a reviewer whose inputs, tools, outputs, and failure states are visible.

That small boundary teaches the team something valuable: whether AI review produces reproducible findings in this codebase. Only then is there evidence for the next decision—expanding the check, keeping it advisory, narrowing it further, or removing it.

Sources

FACET AI CLI Terminal
facet@ai:~$