check and recommend and produce machine-readable compliance reports for CI/CD pipelines and SIEM tools.
What a policy controls
- Model allow/deny lists — wildcard patterns for approved or blocked model identifiers
- Size and parameter limits — hard caps on model disk size or parameter count
- Quantization allowlists — restrict to specific quantization formats (e.g., Q4_K_M only)
- Runtime requirements — require specific backends (CUDA, Metal) or local-only execution
- License compliance — allowlist approved open-source licenses
- Enforcement mode —
audit(report-only) orenforce(block on violation) - Exceptions — time-limited per-model overrides with approver attribution
- Audit export — JSON, CSV, and SARIF reports for downstream tooling
Policy file structure
A policy is a YAML file, typically namedpolicy.yaml. Generate a fully annotated template with:
Enforcement modes
audit
Policy violations are recorded and reported but the command exits with code
0. Use audit mode to monitor compliance without blocking developer workflows.enforce
Blocking violations cause the command to exit with a non-zero code. Use enforce mode in CI gates to prevent non-compliant models from being pulled or deployed.
Exit code override
By default, a blocked violation exits with code1. Override this with enforcement.exit_code to integrate with shell pipelines or CI systems that check specific exit codes:
1–255.
Policy commands
policy init
Generate a starter policy.yaml in the current directory:
policy validate
Validate a policy file against the v1 schema. Returns non-zero if the file has schema errors:
versionis an integer ≥ 1orgis a non-empty stringmodeisauditorenforcerulesis a well-formed objectenforcement.exit_codeis between 1 and 255reporting.formatscontains onlyjson,csv, orsarif- All array fields contain non-empty strings
Using --policy with check and recommend
Both check and recommend accept a --policy flag that applies the policy rules to the candidate model set:
audit mode, violations are printed and the command exits 0. In enforce mode, any blocking violation causes a non-zero exit.
--policy takes precedence over --calibrated for routing resolution. See the Calibration Guide for flag precedence details.Rules reference
rules.models
Wildcard patterns for allowed model identifiers. Supports
* as a wildcard. If this list is non-empty, any model that does not match at least one pattern fails with MODEL_NOT_ALLOWED.Example: ["qwen2.5-coder:*", "llama3.1:*"]Wildcard patterns for explicitly blocked model identifiers. A model matching any deny pattern fails with
MODEL_DENIED regardless of the allow list.Example: ["*uncensored*"]Maximum disk size in GB. Models exceeding this limit fail with
MODEL_TOO_LARGE.Maximum parameter count in billions. Models exceeding this limit fail with
MODEL_TOO_MANY_PARAMS.Allowlist of quantization formats. Models with a quantization not in this list fail with
QUANTIZATION_NOT_ALLOWED.Example: ["Q4_K_M", "Q5_K_M", "Q8_0"]rules.runtime
List of required runtime backends. The system backend must match one of these values or the model fails with
BACKEND_NOT_ALLOWED.Example: ["metal", "cuda"]Minimum required system RAM in GB. Fails with
INSUFFICIENT_RAM if available memory is below this threshold.When
true, models from non-local sources (cloud, remote, hosted) fail with MODEL_NOT_LOCAL.rules.compliance
Allowlist of approved license identifiers. License values are canonicalized before comparison (for example
MIT License → mit, Apache 2.0 → apache-2.0). Models without an approved license fail with LICENSE_NOT_APPROVED.Example: ["mit", "apache-2.0", "llama"]enforcement
Behavior when a violation is detected in
enforce mode. error blocks and exits non-zero. warn prints the violation but exits 0.Exit code returned when a blocking violation occurs. Must be an integer between
1 and 255.When
true, entries in the exceptions list can suppress violations for specific models. Suppressed violations are recorded in audit reports with status: suppressed.exceptions
Each entry in the exceptions array grants a time-limited override for a specific model:
Model identifier or wildcard pattern to match. Required.
Human-readable justification for the exception. Appears in audit reports.
Name or email of the person who approved the exception.
ISO 8601 date or datetime string. The exception is automatically inactive after this timestamp.
reporting
Default export formats used when
audit export --format all is run. Valid values: json, csv, sarif. If omitted, all three formats are exported.Audit export
Theaudit export command evaluates policy outcomes and writes compliance reports without modifying exit behavior:
--command check|recommend selects the candidate source. In enforce mode with blocking violations, reports are written before non-zero exit.
Export formats
JSON
JSON
Structured compliance report with full model provenance, violation details, hardware summary, and enforcement metadata. Suitable for pipeline post-processing and dashboards.Each finding includes:
model_identifier,model_name,source,registry,version,license,digestviolation_code,rule_path,rule_id,severity,messageexpectedvsactualvaluesrecommendationfor remediationstatus:activeorsuppressed(by exception)
CSV
CSV
Flat tabular format for SIEM ingestion (Splunk, ELK, DataDog). One row per violation finding, with the same fields as JSON.If no violations exist, a single compliant row is written so downstream parsers always receive a valid file.
SARIF
SARIF
Static Analysis Results Interchange Format (SARIF 2.1.0) for security scanning tooling. Compatible with GitHub code scanning, VS Code SARIF viewer, and other SARIF consumers.Violation severity maps to SARIF levels:
high → error, medium → warning, low → note. Suppressed violations are emitted with level note.SIEM integration examples
GitHub Actions policy gate
Copy this workflow to add an LLM policy gate to your pull request checks:if: always() conditions ensure audit reports are written and uploaded even when the policy gate fails, giving reviewers access to the full violation details.
Provenance fields in reports
check, recommend, and audit export outputs include normalized provenance fields for every model:
| Field | Description |
|---|---|
source | Origin of the model (local, ollama, unknown) |
registry | Registry the model was fetched from |
version | Model version or tag |
license | Canonicalized license identifier |
digest | Content digest for reproducibility |
"unknown" instead of omitting the field, keeping downstream parsers deterministic.
