Skip to content

CI Mode

sarmakska edited this page Jun 4, 2026 · 1 revision

CI mode

slipstream is built for interactive editing, but the same map, observation and savings machinery is useful in CI: as a check that a PR has not silently regressed the scoped-read pattern, or as a way to surface drift between branches. CI mode is a one-flag entry point with a structured stdout format.

The --ci flag

node dist/cli/index.js audit --ci

audit is the umbrella command that runs every check non-interactively: build the map, run the four drift checks, compute the savings snapshot, render the per-skill table. With --ci:

  • exit code is 0 on a clean run, 1 if any drift finding exceeds the configured severity, 2 if the command itself errors.
  • stdout is JSON lines, one event per line.
  • stderr is reserved for fatal errors only.

JSON-line stdout format

Each line is a single JSON object with a type and a payload:

{"type":"map","files":284,"symbols":1912,"bytes":184302}
{"type":"drift","subtype":"map","count":0}
{"type":"drift","subtype":"symbol","count":2,"refs":[{"file":"src/cli/index.ts","symbol":"runAudit"}]}
{"type":"savings","calls":762,"served":7421194,"baseline":32510918,"optPct":77.2}
{"type":"skill","name":"scoped-read","calls":412,"optPct":93.8}
{"type":"skill","name":"symbol-lookup","calls":207,"optPct":94.9}
{"type":"summary","ok":false,"exit":1,"reason":"symbol drift"}

Consumers can stream-parse without loading the whole output, and the summary line is always last.

GitHub Actions snippet

name: slipstream audit
on: [pull_request]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: npm run build
      - name: slipstream audit
        id: audit
        run: node dist/cli/index.js audit --ci | tee slipstream-audit.jsonl
      - name: Upload audit
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: slipstream-audit
          path: slipstream-audit.jsonl

The tee keeps a copy as a workflow artefact while still letting the exit code propagate. A failed run uploads the JSONL so a reviewer can inspect the drift findings without re-running.

What to do with the output

  • Gate merges on summary.ok. Default audit --ci fails the job on any drift at warn severity or above.
  • Trend the savings line. Push savings.optPct to a metrics store and you have a per-PR regression signal for token efficiency.
  • Comment drift on PRs. A small follow-up step can read the drift lines and post a PR comment listing the affected files; the artefact is the source of truth.
  • Inspect locally with replay. slipstream replay slipstream-audit.jsonl --as-audit walks the same data in the dashboard.

SarmaLinux . sarmalinux.com . Repository

Clone this wiki locally