# CLI contract

The executable package is `cmd/rulesorigin` and the pure command logic lives in `cli`.

## Commands

`--demo` runs a deterministic end-to-end document embedded in the executable. It is the most portable installation smoke test because it has no shell quoting or file-system assumptions.

`--benchmark` executes the built-in evaluator-backed benchmark fixture and prints deterministic status and operation counters. It is a smoke path for the benchmark harness, not a wall-clock performance claim.

`--json <document>` parses exactly one structured document and emits one compact JSON decision. `--jsonl <document>...` evaluates each remaining argument independently and emits one decision per successful input. These two forms are intended for callers that already control argument escaping or call `cli.run` directly.

`--help` prints the command contract. Unknown options and wrong argument counts return exit code 64. A JSON or domain error returns 65. The demo returns 70 only if an internal invariant unexpectedly fails.

## Output contract

Every successful decision has:

```json
{
  "status": "Qualified",
  "missing_fields": [],
  "rule_evaluations": []
}
```

`status` is one of `Qualified`, `NotQualified`, or `InsufficientInformation`. Rule results use `Passed`, `Failed`, or `Missing`; each result includes a stable rule identifier and human-readable reason. The library API additionally exposes evidence references, while the first CLI output keeps the default payload compact.

## Shell note

JSON object quotes are handled differently by Windows and Unix shells. For a portable smoke test use `--demo`; for production integrations prefer a direct `cli.run` call or a process wrapper that passes one opaque argument. The JSON parser and JSONL behavior are covered by cross-target tests.
