SwapGate

CLI reference

capture

swapgate capture --from litellm|otel|secmcp --in traces.jsonl --out events.jsonl [--redact profile]

Ingests raw traces into canonical events. --redact takes default, bharat, or dpdp-strict. Corrupt lines are counted and skipped, never fatal.

build-evals

swapgate build-evals --in events.jsonl --out suite.json [--name NAME] [--clusters K] [--bharat-pack]
swapgate build-evals --out suite.json --approve

First run writes suite.pending.json for human review; --approve finalises it. --bharat-pack tags every case and attaches the DPDP note.

compare

swapgate compare --suite suite.json --baseline SPEC --candidate SPEC
  [--judge deterministic|typed|llm] [--judge-fixtures FILE]
  [--fail-under F] [--max-regression G] [--out receipt.json] [--report report.md]
  [--key KEYFILE | --sign]

Replays the suite on both providers and gates on the regression rule. Exit 0 passes, 2 fails, 1 is a usage error. --key signs with a key file (created if missing); --sign uses the default key. --report writes Markdown (.md) or HTML.

report · verify · serve-mcp

swapgate report --receipt receipt.json --format md|html [--out report.ext]
swapgate verify --receipt receipt.json --key KEYFILE
swapgate serve-mcp   # stdio MCP server: compare_models, list_evals

Provider specs

SpecMeaning
mock:parityDeterministic answers from prompt keywords. Offline.
mock:regressShort refusal. Offline; fails content rubrics by design.
mock:seed-NDeterministic paraphrase variant N. Offline.
openai-compat:<base-url>|<model>Any /chat/completions endpoint. Key from SWAPGATE_API_KEY.

Exit codes

CodeMeaning
0Success / gate passed.
2Gate failed: regression, floor breach, or invalid receipt.
1Usage error: missing file, bad flag, unapproved suite.