Decision Gate Authoring Formats

Canonical scenario authoring formats.

Decision Gate accepts RawScenarioSpec authoring input in JSON or RON. JSON is the canonical format used for hashing, schemas, and runpacks. RON exists only as a human-friendly authoring layer and must be normalized to canonical JSON before execution.

Canonical JSON

  • Canonical JSON uses RFC 8785 (JCS) for deterministic ordering.
  • Source hashes identify hostile syntax and are not validated law identities.
  • Canonical JSON is emitted by decision-gate authoring normalize.

Supported Inputs

  • JSON: canonical format for storage, hashing, and validation.
  • RON: authoring-only format normalized to canonical JSON.
  • YAML: not supported by default (add only with explicit requirement).

Normalization Pipeline

  1. Parse JSON or RON into a structured value.
  2. Validate against schemas/scenario.schema.json.
  3. Deserialize closed hostile RawScenarioSpec syntax.
  4. Canonicalize source JSON (RFC 8785).
  5. Compute the source hash; scenario_define performs proof admission.

Limits

  • Max authoring input size: 16777216 bytes.
  • Max nesting depth: 64.

CLI Usage

Validate RON authoring input:

cargo run -p decision-gate-cli -- authoring validate --input Docs/generated/decision-gate/examples/scenario.ron --format ron

Normalize to canonical JSON:

cargo run -p decision-gate-cli -- authoring normalize --input Docs/generated/decision-gate/examples/scenario.ron --format ron \
+  --output /tmp/dg-doc-scenario.json

References

  • Docs/generated/decision-gate/examples/scenario.ron: authoring example in RON.
  • Docs/generated/decision-gate/examples/scenario.json: canonical JSON output.
  • schemas/scenario.schema.json: JSON Schema for RawScenarioSpec.