Skip to content

CLI reference ​

text
decguard [--version] [--help] COMMAND [ARGS]...
CommandPurpose
validatecheck a contract, its backends and dataset, offline
testrun the golden dataset and apply the gates (--all: plus properties)
fuzzcheck the metamorphic properties
replayre-send stored property failures
diffcompare a baseline and a candidate report
reportshow a stored report, optionally re-applying edited gates
checkanalyze collected production records offline
runmake one decision and apply the contract's policy

decguard <command> --help prints the same options. python -m decguard is equivalent to decguard.

Common options ​

OptionCommandsMeaning
--format, -f text|jsonall except validatewhat is printed to stdout; default text
--output, -o FILEtest, fuzz, report, diff, checkalso write the JSON report to FILE
--fail-on-warntest, fuzz, report, diff, checkexit 1 when only warnings are violated
--backend, -b NAMEtest, fuzz, replay, runnamed backend from the contract's backends (default: backend)
--healthcheck / --no-healthchecktest, fuzz, runcheck backend health first; default on

Paths inside a contract (dataset, a paraphrase file) are relative to the contract file, not to the current directory.

decguard validate ​

Check a contract, every backend's settings and the dataset, without calling any backend. Also builds the paraphrase provider when paraphrase is enabled.

text
decguard validate CONTRACT [--dataset FILE]
OptionMeaning
--dataset, -d FILEvalidate this dataset instead of the contract's
bash
decguard validate decguard.yaml
text
OK  decguard.yaml
    decision  refund_request (choice): refund, reject, review
    backends  default=mock
    dataset   cases.jsonl: 6 cases, 6 labeled
    gates     requirements: 2, warnings: 2
    properties none (add 'properties' to fuzz)
    production segments: none; requirements: 0; segment requirements: 0
    policy     none
    hash      sha256:ab7ab0ad031d6130242da713be280ba3ee50dd6ad14e1665cc9a8e785ff03ecd

Exits 0 when valid, 2 otherwise. Credentials are not read (they are read at the first request), so validation works without secrets.

decguard test ​

Run the golden dataset through a backend, compute metrics and apply requirements and warnings. With --all, also check the metamorphic properties into the same report.

text
decguard test CONTRACT [OPTIONS]
OptionMeaning
--dataset, -d FILEgolden dataset; overrides the contract's dataset
--backend, -b NAMEnamed backend
--output, -o FILEwrite the JSON report
--format, -f text|jsonstdout format
--max-concurrency Nparallel backend calls, 1–256 (default: evaluation.max_concurrency)
--fail-on-warnexit 1 on WARN
--healthcheck / --no-healthcheckcheck backend health before running (default on)
--allalso check the contract's properties (mode: all)
--seed Nwith --all: transformation seed (default: fuzz.seed, else 0)
--property, -p NAMEwith --all: run only this property (repeatable)
--minimize / --no-minimizewith --all: shrink failing transformations (default: fuzz.minimize)
bash
decguard test decguard.yaml --output report.json
decguard test decguard.yaml --all --backend candidate --fail-on-warn

See Golden tests and metrics.

decguard fuzz ​

Check the contract's metamorphic properties only (mode: fuzz). Deterministic for a given seed.

text
decguard fuzz CONTRACT [OPTIONS]

Options are those of test without --all: --dataset, --backend, --seed, --property, --minimize/--no-minimize, --output, --format, --max-concurrency, --fail-on-warn, --healthcheck/--no-healthcheck.

bash
decguard fuzz decguard.yaml -p option_order --seed 7 -o fuzz.json

The contract must enable at least one property, and --property must name an enabled one; otherwise the command exits 2. The same applies to test --all. See Metamorphic properties and Fuzzing and replay.

decguard replay ​

Re-send the property failures stored in a fuzz or test --all report and check whether they still fail. Also regenerates each transformation from the seed and confirms it matches the stored one.

text
decguard replay REPORT [--id ID]... [--contract FILE] [--backend NAME] [--format text|json]
OptionMeaning
--id IDreplay only this transformed case, <property>/<case id>/<sample> (repeatable); default: every failure
--contract, -c FILEcontract to use (default: the one recorded in the report)
--backend, -b NAMEbackend to replay against (default: the one recorded in the report)
--format, -f text|jsonstdout format; json prints a replay report
bash
decguard replay fuzz.json --id option_order/r1/2 --backend candidate

Exits 1 if any failure reproduces, 0 if none does.

decguard diff ​

Compare two stored reports of the same decision, case by case, and apply the contract's regression gates.

text
decguard diff BASELINE CANDIDATE [OPTIONS]
OptionMeaning
--contract, -c FILEapply this contract's regression gates and evaluation settings
--segment-by, -s KEYcase metadata key to segment by (repeatable); overrides regression.segment_by
--output, -o FILEwrite the JSON diff
--format, -f text|jsonstdout format
--fail-on-warnexit 1 on WARN
bash
decguard diff baseline.json candidate.json --contract decguard.yaml --output diff.json

Without --contract, only the implicit max_error_rate_increase: 0 applies. See Regression diffs.

decguard report ​

Show a stored report and exit with its status. With --contract, recompute metrics and re-apply the (possibly edited) gates and property limits to the stored results, without calling the model.

text
decguard report REPORT [--contract FILE] [--output FILE] [--format text|json] [--fail-on-warn]
OptionMeaning
--contract, -c FILEre-evaluate against this contract's gates
--output, -o FILEwrite the (re-evaluated) JSON report
--format, -f text|jsonstdout format
--fail-on-warnexit 1 on WARN
bash
decguard report report.json --contract decguard.yaml

Loading re-verifies the whole report; a tampered or inconsistent report is rejected with exit code 2. See Reports.

decguard check ​

Analyze production records your application collected, offline, and apply the contract's production gates.

text
decguard check CONTRACT --dataset FILE [--baseline FILE] [OPTIONS]
OptionMeaning
--dataset, -d FILEcollected production records, .jsonl or .json (required)
--baseline FILEbaseline production dataset, or a previous decguard check JSON report
--output, -o FILEwrite the production report
--format, -f text|jsonstdout format
--fail-on-warnexit 1 on WARN
bash
decguard check decguard.yaml -d production.jsonl --baseline last-week.json -o production-report.json

No backend is called. See Production checks.

decguard run ​

Make one decision with the contract's backend and apply its policy.

text
decguard run CONTRACT INPUT [--backend NAME] [--input-json] [--id ID] [--format text|json]
OptionMeaning
--backend, -b NAMEbackend that makes the decision
--input-jsonparse INPUT as a JSON object
--id IDcase/correlation id recorded in the result (default runtime)
--format, -f text|jsontext: one line; json: the full decision and route
--healthcheck / --no-healthcheckcheck backend health first (default on)
bash
decguard run decguard.yaml "The parcel never arrived"
text
fallback -> strong_model · selected refund · confidence 0.900 · route 1

Exits 0 for every action, 2 if the contract has no policy or the decision fails. The fallback backend is not invoked. See Policies and Python SDK.

Exit codes ​

CodeMeaning
0PASS; WARN unless --fail-on-warn; replay: no failure reproduced; run: a decision was made; validate: the contract is valid
1a reliability gate failed (test, fuzz, report, diff, check); WARN with --fail-on-warn; replay: a failure still reproduces
2configuration or runtime error: invalid contract, dataset, records or report; unknown backend or provider; missing credential; unhealthy backend; every case failed; invalid command-line usage; internal error

Unexpected exceptions map to 2, never to 1. Error messages go to stderr as error: ...; set DECGUARD_DEBUG=1 to print a traceback for internal errors.

Environment variables ​

VariableMeaning
DECGUARD_DEBUGprint a traceback for internal errors
names in bearer_token_env, headers_from_env, api_key_envbackend and paraphrase-provider credentials; see Credentials

Released under the Apache-2.0 License.