Skip to main content

Checks and the spec

A check is one thing Zyonix tests every document for: a required field, a value range, an error message your application writes. Zyonix runs its automatic checks on every document; the reliability spec (a YAML file describing your output format and rules) adds checks of values. Your own checks, added with zyonix checks add, become rules in a new spec version.

Checks and the spec apply to new documents. Documents already processed are re-checked only when an administrator runs zyonix spec redetect.

zyonix checks list​

Everything Zyonix checks each document for, with what each check found in the last 14 days. zyonix checks on its own is the same command.

zyonix checks
zyonix checks list --json

Who may run it: any reader.

How to read it: the spec version and schema, then these sections, each with FAILED (documents it failed), TO REVIEW (questions waiting for a person), PROBLEMS (open problem numbers) and COUNTS (how it counts: as Zyonix decides, a person reviews it, or off):

  • Your checks: the ones added with zyonix checks add, with their ID.
  • Checks your agent reports: what your code reports with zyonix.check(...) / zyonix.flag(...).
  • Checked automatically: Zyonix's built-in checks.
  • From your spec: the spec's rules, and check families (shown with *).
  • Fields a check can read: every output field and its type. Use these names in --field.
  • Causes: the root-cause labels you can give a check with --cause.

Without an active spec, value checks are not available; error-text checks and automatic checks still work.

zyonix checks test​

What a check would have found on past documents. Nothing is stored or changed.

zyonix checks test --title "Invoice number missing" --field invoice_no --kind filled
zyonix checks test --title "Total too large" --field total --kind at_most --value 500000

It takes exactly the same options as zyonix checks add (below).

Who may run it: administrator.

Output: It watches: <the rule in words>, then N of M past documents would have failed it; K did not have the value., and example run ids with their document names.

zyonix checks add​

Watch every new document for this. The check is added to a new spec version and applies from the next document on.

zyonix checks add --title "Invoice number missing" --field invoice_no --kind filled --severity high
zyonix checks add --title "Total too large" --field total --kind at_most --value 500000 --review
zyonix checks add --title "Tax above total" --field tax_amount --kind at_most_field --other total
zyonix checks add --title "Currency not supported" --field currency --kind one_of --value "EUR,USD,INR"
zyonix checks add --title "Every line has an amount" --field "items[].amount" --kind filled
zyonix checks add --title "Totals add up" --kind expression --expression "abs(subtotal + tax_amount - total) <= 1"
zyonix checks add --title "Provider quota" --kind error_text --value "quota exceeded" --cause INFRA_PROVIDER
zyonix checks add --title "GST number format" --field gstin --kind length --value 15 \
--when-field country --when-value IN --fix "Ask the model to copy the GSTIN exactly"
OptionWhat it does
--title TEXTwhat to call this problem (required)
--kind KINDthe condition (required; see the table below)
--field FIELDthe output field to check (from Fields a check can read). items[].amount checks every item of a list
--value VALUEthe value to compare with, or the error text
--other FIELDthe second field, for the *_field kinds (top-level fields only)
--expression RULEa rule in the spec's rule language, for --kind expression
--when-field FIELDcheck only documents where this field ...
--when-value VALUE... has this value (left empty: is filled in)
--severitylow, medium (default) or high
--reviewask a person to review it instead of failing the document
--cause LABELthe root cause to report (a label from Causes in zyonix checks)
--fix TEXTwhat someone should do when this happens
--kindThe field ...--value
filledmust be filled innone
at_leastmust be at least the value (numbers and dates)a number, or a date as YYYY-MM-DD
at_mostmust be at most the value (numbers and dates)a number, or a date as YYYY-MM-DD
equalsmust be the valuethe value
not_equalsmust not be the valuethe value
one_ofmust be one of the valuesvalues separated by commas
containsmust contain the text (text fields)the text
not_containsmust not contain the text (text fields)the text
starts_withmust start with the text (text fields)the text
lengthmust be exactly this many characters long (text fields)a whole number
at_most_fieldmust not be more than --othernone
at_least_fieldmust not be less than --othernone
same_as_fieldmust be the same as --othernone
expression(no field) the rule in --expression must holdnone
error_text(no field) your application wrote an error containing this textthe error text

contains, not_contains and starts_with ignore case. A value check needs an active spec; an error_text check also works without one.

Who may run it: administrator.

Output: Check <id> added (spec version N): <the rule in words> and It applies to new documents.

tip

Run zyonix checks test with the same options first: it shows what the check would have caught without changing anything.

zyonix checks remove​

Stop checking for one of your checks. This makes a new spec version without it.

zyonix checks remove custom_invoice_number_missing
OptionWhat it does
IDthe check id from Your checks in zyonix checks

Who may run it: administrator.

zyonix checks mode​

How a check counts on new documents: as Zyonix decides, a person reviews what it finds, or off. This works for any check, including the automatic ones and the ones your code reports.

zyonix checks mode check:saved review
zyonix checks mode exec:llm_error off
zyonix checks mode grounding: review
zyonix checks mode grounding: default
OptionWhat it does
CHECKa check key (for example check:saved, exec:llm_error, a rule id), or a whole family ending in : (for example grounding:)
MODEdefault (as Zyonix decides), review (what it finds goes to the review queue instead of the problem list) or off (ignored)

Who may run it: administrator.

Output: check:saved: a person reviews it. It applies to new documents.

Use review for a check that is right most of the time but not always, and off for a check that does not fit your documents.

zyonix spec show​

The active spec: its version and hash, then the YAML. zyonix spec on its own is the same command.

zyonix spec
zyonix spec show > reliability_spec.yaml

Who may run it: any reader.

zyonix spec versions​

Every spec version: VERSION, ACTIVE, ACTIVATED (when), BY (who) and HASH.

zyonix spec versions

Who may run it: any reader.

zyonix spec push​

Validate a spec file and make it the active version. It applies to new runs.

zyonix spec push reliability_spec.yaml
OptionWhat it does
FILEthe spec YAML file

Who may run it: administrator.

Output: spec version N is active; it applies to new runs, then a pointer to zyonix spec redetect. An invalid file is refused with the reason and nothing changes.

warning

zyonix spec push replaces the whole spec, including checks added with zyonix checks add. Start from zyonix spec show so you keep them.

zyonix spec redetect​

Re-run detection with the active spec on documents that were checked under another version.

zyonix spec redetect
zyonix spec redetect --all
OptionWhat it does
--allevery complete run, not only runs detected under another version

Who may run it: administrator.

Output: N run(s) queued for re-detection. The work runs in the background; watch it with zyonix jobs and the results with zyonix status. Only documents still within the retention period have content to re-check.