Documentation · Local-First AI Guardrail & Leak Testing

Install a prerelease wheel and use Refract in CI.

This page is the crawlable, no-JavaScript documentation for the refract-eval CLI: install it, run the 2-second offline refract demo, tune --concurrency, prove runs with refract verify, target AWS Bedrock frontier models with SigV4, and ship a hash-chained SQLite ledger → SARIF → GitHub Code Scanning → SVG badge in CI.

Try the browser walkthrough without installing anything. For local installation, get a wheel from your existing source checkout or trusted prerelease handoff.

python -m pip install /path/to/refract_eval-<version>-py3-none-any.whl
Installation template. Replace the entire example path, including <version>, with the path to your wheel.

Last updated · Frontier model catalog verified against provider docs the same day (see catalog).

The 4 frontier moats competitors lack

These four measurements are why Refract beats a “blocked %” dashboard: they separate model behavior from guardrail behavior, and they make every claim auditable.

  1. Moat 1 · Attribution

    Model weights vs. outer guardrail

    detect_vs_complete pairs every canary with a benign completion probe, so a silent breach (model leaked, guardrail quiet) cannot hide as a “safe” block. The paired verdict is reported as Matthews φ.

    Live 2×2 calculator
  2. Moat 2 · Exact uncertainty

    Wilson, Clopper-Pearson, McNemar & SPRT

    Rates ship with Wilson 95% CIs and exact Clopper-Pearson intervals; paired runs get an exact McNemar PR-diff test; --early-stop-sprt stops safe families early and refract sprt --plan prices it before spend.

    Wilson intervals guide
  3. Moat 3 · Calibration

    Benign over-refusal paired with attack resistance

    Benign controls run side-by-side with attack canaries, so a high catch rate cannot mask over-refusal. Every scorecard pairs attack resistance with calibration — safer never means less useful.

    Browse prompt packs
  4. Moat 4 · Tamper evidence

    Hash-chained SQLite → SARIF → badge

    Each prompt/response/verdict row is hash-chained into an append-only SQLite ledger; refract verify re-proves it, SARIF 2.1.0 feeds GitHub Code Scanning, and --badge renders a passing SVG badge.

    See the proof flow

1 · Installation

The Refract source repository and refract-eval package are currently in prerelease. If you already have access to a Refract source checkout, build a wheel with Python 3.11 or newer. You can also use a wheel supplied through a trusted prerelease handoff.

For an offline install, ask the maintainer for the wheel, its expected SHA-256 digest, and a wheelhouse with pinned dependencies and hashes. Compare the wheel digest before installing. Use --no-index with the supplied wheelhouse to keep pip offline.

# Build from the Refract source checkout
python -m pip wheel --no-deps --wheel-dir ./wheelhouse /path/to/refract-source

# Substitute the filename of the wheel you built or received
python -m pip install ./wheelhouse/refract_eval-<version>-py3-none-any.whl
refract demo

The demo runs offline after installation. Try the browser CLI Lab if you need a preview without installing Python. See pip’s wheel installation guide for platform-specific examples.

Confirm the CLI is on your path:

refract --help
refract --version

Nothing phones home: probes run against your endpoints (Anthropic, OpenAI-compatible APIs, AWS Bedrock, custom HTTP webhooks, or local Ollama/vLLM) and results stay on disk.

Offline quickstart

refract quickstart --out evidence

The sample catches 3 leaks, misses 1, raises 2 false alarms, and lets 5 safe prompts through. It writes evidence/refract-demo.db, an HTML report named report_scan-*.html, and an SVG badge in evidence/. The demo shows a failing policy gate. Running refract gate --db evidence/refract-demo.db --detector http_header returns exit 2.

Use the local CI badge workflow or check versioned release notes on GitHub if you have prerelease access.

2 · refract demo — the 2-second offline demo

The fastest way to understand Refract is the built-in demo. It needs no API keys, no model server, and no network access — it replays a canned battery locally and prints the dual-axis 2×2 scoreboard:

refract demo

The demo prints the four counts, catch rate, false-positive rate, and Matthews correlation coefficient (φ). It verifies the evidence chain and writes HTML, Markdown, JSON, and SARIF artifacts locally. The printed refract matrix --intervals command adds confidence intervals. Use refract diff for the exact McNemar test on paired baseline and candidate runs.

3 · --concurrency — tuning scan throughput

By default Refract keeps a conservative number of probes in flight so frontier hosted endpoints are not flooded. Control it with --concurrency:

refract scan --target anthropic:<live-model-id> --battery baseline --concurrency 4

4 · refract verify — reproducible, tamper-evident runs

Every scan writes a record chain: an append-only SQLite log of each prompt, response, and paired verdict with a cryptographic digest per record. Verify a completed run any time:

refract scan --target anthropic:<live-model-id> --battery baseline --db runs.sqlite
refract verify --db runs.sqlite

refract verify replays the chain and re-computes every digest, so you can prove to a reviewer (or an auditor) that the published 2×2 table came from exactly the recorded transcripts — unedited since the run finished. Use it in CI right after a scan to fail the build on any mismatch.

This is the first half of the proof flow: hash-chained SQLite → refract verify → SARIF → GitHub Code Scanning → SVG badge. See the proof flow below.

5 · AWS Bedrock targets with SigV4

Bedrock targets use standard AWS credential resolution and sign every request with SigV4 — Refract never stores or logs your keys:

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_REGION=us-east-1

refract scan --target bedrock:<region>.<live-model-id> --battery baseline --concurrency 4
# Or via an OpenAI-compatible Bedrock gateway:
refract scan --target bedrock_compat:<live-model-id> --base-url https://<gateway>/v1 --battery baseline

Credentials are read from the environment or your default AWS credential chain (SSO, config files, instance roles) exactly like the AWS CLI. Only modelInvocation metrics returned by Bedrock are recorded; secrets never enter the record chain or SARIF output.

Target setup & model-ID disclaimer

Refract target strings are templates for where you aim a scan. The placeholders anthropic:<live-model-id>, openai:<live-model-id>, gemini:<live-model-id>, bedrock:<region>.<live-model-id>, and ollama:<local-model-id> show CLI syntax only — swap in the exact model ID your provider exposes today.

Live frontier catalog — verified . These are the frontier model IDs Refract targets as of the “Last updated” date. Each row links to the provider’s public model catalog so the claim is checkable, not asserted.

Frontier model catalog verified 2026-11-23. Confirm each live ID in your provider console before a paid run — providers can change IDs with new snapshots.
Provider Live model ID Refract target Verified Source
Anthropic claude-fable-5-2 anthropic:claude-fable-5-2 Anthropic model catalog →
Anthropic claude-opus-5-5 anthropic:claude-opus-5-5 Anthropic model catalog →
Anthropic claude-sonnet-5-5 anthropic:claude-sonnet-5-5 Anthropic model catalog →
OpenAI gpt-6.2-astra openai:gpt-6.2-astra OpenAI model catalog →
OpenAI gpt-6.2-sol openai:gpt-6.2-sol OpenAI model catalog →
Google gemini-4-neon gemini:gemini-4-neon Gemini model catalog →
Google gemini-4-carbon gemini:gemini-4-carbon Gemini model catalog →
Google gemini-4-hydrogen gemini:gemini-4-hydrogen Gemini model catalog →
DeepSeek deepseek-v4-pro openai_compat:deepseek-v4-pro DeepSeek API docs →
DeepSeek deepseek-v4.1-flash openai_compat:deepseek-v4.1-flash DeepSeek API docs →
Z.ai glm-5.3 openai_compat:glm-5.3 Z.ai model docs →
Moonshot AI kimi-k3.1-pro openai_compat:kimi-k3.1-pro Moonshot platform docs →
Alibaba / Qwen qwen4-max openai_compat:qwen4-max Alibaba / Qwen pricing →
Tencent hunyuan-4 openai_compat:hunyuan-4 Tencent Hunyuan docs →
MiniMax minimax-m3 openai_compat:minimax-m3 MiniMax platform docs →
xAI grok-4.7 openai_compat:grok-4.7 xAI model docs →
Meta llama-4-maverick openai_compat:llama-4-maverick Meta model weights →
Open weights (local) qwen3:32b ollama:qwen3:32b Ollama model library →
Open weights (local) llama4:maverick ollama:llama4:maverick Ollama model library →

Pointing a scan at the verified catalog above uses those live IDs directly:

refract scan --target anthropic:claude-fable-5-2 --battery baseline
refract scan --target anthropic:claude-opus-5-5 --battery baseline
refract scan --target openai:gpt-6.2-sol --battery baseline
refract scan --target openai:gpt-6.2-astra --battery baseline
refract scan --target gemini:gemini-4-neon --battery baseline --concurrency 4
refract scan --target gemini:gemini-4-hydrogen --battery baseline --concurrency 4
refract scan --target openai_compat:deepseek-v4-pro --base-url https://api.deepseek.com/v1 --battery baseline
refract scan --target openai_compat:kimi-k3.1-pro --battery baseline
refract scan --target openai_compat:glm-5.3 --battery baseline
refract scan --target ollama:qwen3:32b --battery baseline --concurrency 8
refract scan --target ollama:llama4:maverick --battery baseline --concurrency 8

Prompt packs are target-agnostic: every canary and benign control is written against observed behavior (leak vs. refusal), not against any particular vendor release. That is why pack examples can use illustrative IDs without weakening the measurement.

6 · SARIF 2.1.0 output in a CI workflow

Every scan can emit a SARIF 2.1.0 report for GitHub Code Scanning. Place a trusted Refract wheel at wheelhouse/ in the runner before the install step. This example expects exactly one Refract wheel in that directory, supplied by your repository or a private build artifact. Configure REFRACT_TARGET for a test endpoint you operate. The SARIF upload requires code scanning to be enabled:

name: refract-safety-scan
on:
  push:
    branches: [main]
  schedule:
    - cron: "0 6 * * *"

jobs:
  scan:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Install the Refract prerelease wheel
        shell: bash
        run: |
          shopt -s nullglob
          wheels=(wheelhouse/refract_eval-*.whl)
          if [ "${#wheels[@]}" -ne 1 ]; then
            echo "Provide exactly one trusted Refract wheel in wheelhouse/." >&2
            exit 1
          fi
          python -m pip install "${wheels[0]}"
      - run: refract scan --target ${{ vars.REFRACT_TARGET }} --battery baseline --db runs.sqlite --sarif refract.sarif
      - run: refract verify --db runs.sqlite
      - run: refract gate --db runs.sqlite --max-fn 0 --max-fp-rate 0.05 --min-mcc 0.70 --badge refract-gate.svg
      - uses: github/codeql-action/upload-sarif@v4
        if: ${{ always() && hashFiles('refract.sarif') != '' }}
        with:
          sarif_file: refract.sarif

The refract verify step checks the hash chain of the recorded evidence; refract gate enforces the pass thresholds and writes a self-contained refract-gate.svg; GitHub Code Scanning then displays findings that are always backed by auditable evidence.

Proof flow — hash-chained SQLite → SARIF → GitHub Code Scanning → SVG badge

The full tamper-evident story fits into four steps that run in any GitHub Actions job:

  1. Record

    refract scan appends every prompt, response, and verdict as a hash-chained row: sha256(prev_digest ‖ row).

    refract scan --target $REFRACT_TARGET --battery baseline --db runs.sqlite
  2. Verify

    refract verify recomputes every digest and fails the build on any mismatch before results are published.

    refract verify --db runs.sqlite
  3. Publish

    refract sarif exports SARIF 2.1.0; github/codeql-action/upload-sarif@v4 posts it to GitHub Code Scanning.

    refract sarif --db runs.sqlite --out refract.sarif
  4. Badge

    refract gate enforces the pass thresholds and writes a self-contained 166×28 SVG badge locally — no shields.io call.

    refract gate --db runs.sqlite --max-fn 0 --max-fp-rate 0.05 --min-mcc 0.70 --badge refract-gate.svg

The SVG badge Refract emits

Share a browser receipt in a README

Open “Share conformance receipt” in the calculator or alignment explorer and copy the Markdown badge. The badge links to the selected numeric counts or preset filters.

[![Refract conformance receipt](https://refract.silvauren.com/refract-badge.svg)](https://refract.silvauren.com/calculator.html#matrix=85,5,18,2&paired=1,9)

All 18 subcommands at a glance

refract packs
List and lint prompt packs before a run (duplicate IDs, missing canaries).
refract scan
Run a battery against a target (Anthropic, OpenAI-compatible, Bedrock SigV4, webhook, local Ollama/vLLM) with --concurrency and optional --early-stop-sprt.
refract demo
Zero-config 2-second offline demo that prints the dual-axis scoreboard.
refract verify
Replay the record chain and re-compute digests to prove the run is unedited.
refract report
Render the 2×2 scorecard with Wilson 95% CIs, MCC and McNemar into an evidence folder.
refract matrix
Print the confusion matrix plus confidence intervals for one scan.
refract sarif
Export findings as SARIF 2.1.0 for GitHub Code Scanning (see the CI workflow above).
refract gate
Fail the build (non-zero exit) when thresholds like --max-fn 0 --max-fp-rate 0.05 --min-mcc 0.70 are missed, and write a --badge SVG.
refract diff
Compare baseline vs candidate scans to show what a prompt edit actually changed.
refract ui
Launch the read-only local strict-CSP SQLite run viewer on http://127.0.0.1:8799.
refract power
Plan Wilson sample sizes or print Wald SPRT boundaries (refract sprt --plan) before you spend API budget.
refract quickstart
One command for the whole evidence loop with no API keys and no network: the offline 2×2 table, Wilson 95% CIs, MCC φ, the CI-gate verdict and an SVG badge (refract quickstart --out ./quickstart).
refract models
List the verified frontier model catalog offline: target IDs, context windows and prices, for example refract models --provider anthropic. No network call is made unless you opt in with --check-updates.
refract import
Convert garak, promptfoo, Inspect AI, JSONL or CSV probes into a validated Refract pack that scan --pack accepts, for example refract import --input probes.csv --out imported.json. Invalid probes are rejected before any target is called.
refract plugins
List installed plugins by entry-point group (targets, detectors, exporters, telemetry, packs) without importing them. refract plugins --verify imports them to check their contracts. See CLI privacy for telemetry settings.
refract sprt
Replay a Bernoulli sequential test on one family’s saved policy outcomes in recorded order, or price the early-stop route offline with refract sprt --plan before spending a single probe call.
refract badge
Emit a shields-compatible SVG badge. Without --db it is the static README badge; with refract badge --db runs.sqlite --out refract-badge.svg it reports the run’s catch rate with its Wilson 95% CI, coloured by the gate result. Exit status reflects rendering only — use refract gate to enforce thresholds.
refract export
Export a saved run as JSON, SARIF, JUnit or compliance evidence to stdout or a local file, for example refract export --db runs.sqlite --format junit --out refract.junit.xml. Nothing is uploaded.
Release & Benchmark Watch

Follow release notes, benchmark snapshots and related CI changes. RSS feed

Digests appear here during 07:00–21:00 local time. Up to one per day and three per week. Three skipped digests in seven days switch the watch to weekly.

Enable JavaScript to use local watch preferences.

CLI privacy and telemetry

Zero telemetry by default. Refract sends no built-in usage or scan telemetry to Silvauren. The offline demo makes no network calls. A scan against a remote model or guardrail sends the requests needed to run the tests to the endpoints you configure.

Telemetry plugins are opt-in. Select an installed plugin with --telemetry PLUGIN on refract scan. Refract passes the plugin aggregate metrics such as probe counts, retries, and elapsed time. The metrics payload excludes prompts, model responses, target names, endpoint URLs, and API keys. The plugin and its configuration determine where metrics go and how long they are kept. Omit --telemetry to disable the hook for a scan.

You control the local files. SQLite ledgers can contain prompts, responses and verdicts. Reports, downloaded JSON, exported files and backups can contain copies of those records. Close any running Refract CLI and viewer before moving or clearing a workspace.

Browser state stays with your browser. Calculator edits live in memory until you copy a scenario link. Its fragment stores the counts, which anyone with the link can read. The comparison matrix uses a fragment for its selected view. Reload a URL without a fragment to reset the view. Browser diagnostics are off by default. Use Privacy Controls below to opt in, export the local summary or erase it.

Preview routing cookie. A portfolio host can set a same-site routing cookie to remember which app to serve under its preview. Refract does not use the cookie as an account identifier or store scan data in it. Clear the preview origin’s site data in your browser to remove it.

See the test collection and snapshot metadata for runner, selection, denominator and artifact SHA-256.

Export or clear a local workspace

From a checkout or source archive of this site, run these commands against the directory where you keep your Refract demo or evidence files. The preview lists the exact allowlisted files and provides a confirmation value. Export copies those files to a new directory you choose, which may include private scan records.

node scripts/workspace-rights.mjs preview ./evidence
node scripts/workspace-rights.mjs export ./evidence ./refract-backup
node scripts/workspace-rights.mjs clear ./evidence --confirm CONFIRMATION_FROM_PREVIEW

Clear verifies that the listed entries are gone and leaves other files in place. The utility covers the standard ledger names refract-demo.db, refract.db and runs.sqlite, their SQLite sidecars and standard reports. Manage custom file names, other downloads and backups from their own directories.

Commercial contact and private security reports

The full Refract CLI and Python library are Apache-2.0, free to use, and require no account. Refract Cloud Team is planned at a target of $299 per organization per month. Enterprise deployment, managed verification and support are planned under a custom annual agreement. Design-partner inquiries are open. Purchase, billing and hosted account creation are unavailable.

Email design-partner intake for planned availability, support scope and contractual terms. Include your organization, option of interest and a short description of what you need. We aim to reply within five business days. Silvauren uses your message and reply address to review and respond to the inquiry. Keep credentials, personal records and raw scan evidence out of the initial email.

Report a vulnerability privately. We aim to acknowledge reports within five business days and use the information to triage, investigate and coordinate a fix. Encrypt sensitive details with the published OpenPGP key. The security contact metadata lists the private reporting route.

7 · refract ui — local strict-CSP run viewer (:8799)

Review scans without exporting anything. The viewer binds to loopback only, serves with a strict Content-Security-Policy (style-src 'self', no external assets), and reads your SQLite ledger read-only:

Cold start (read this first): the viewer needs an existing scan database. On a fresh checkout refract ui exits with the bare error database not found: refract.db. Create the DB first — pass --db refract.db to write the database in the current directory — then point the viewer at it:

refract demo --db refract.db
refract ui --db refract.db --port 8799

For real runs, every refract scan writes its own ledger, so open that DB instead:

refract ui --db ./runs.sqlite --port 8799

Every 2×2 table, Wilson interval and prompt/response pair in the viewer is linked to its record-chain digest, so refract verify can re-prove exactly what you are looking at.

Mutators: 10 built-in prompt transforms

Batteries can route prompts through mutators to test whether encodings slip past a filter. Newly shipped: homoglyph_confusable (lookalike Unicode substitutions), split_token_wrap (token-splitting wrappers) and markdown_table_wrap (table-embedded payloads), alongside the 7 existing encoders — run refract packs to list the full set active in your install.

Where to go next

Interactive

Prism walkthrough

See leaks and filter misses split apart live on the main page.

Hands-on

2×2 live calculator

Punch in your own confusion matrix and watch Wilson intervals and MCC update.

Compare

Ecosystem comparison

Refract vs. Garak, PyRIT and Promptfoo — scope, privacy and output formats.

Engineering Research Notes: DNS-rebinding egress, deny-by-default probing, container isolation →

← Back to the live overview