Skip to main content
Glama

Compile a policy into a ruleset

dsail_compile
Idempotent

Turn a written policy into rules a program can check.

Use when two reviewers apply the same written criteria differently, or a handbook's decided rules need repeatable application. The person has already decided the policy; DSAIL formalises decisions, it does not draft policy, resolve conflicting policies or interpret an ambiguous regulation.

Compiles DSAIL ruleset source. Returns the content hash that addresses this exact ruleset, the claim manifest (every claim with its question, type and vocabulary), the claim JSON schema, and the validation contract a check will enforce — so what will be rejected is known before anything is submitted.

Also returns review: a plain-text rendering of every question this ruleset asks and every decision it makes. It is what a person signs when they approve the hash, so it is worth showing them before an approval is recorded.

Renders nothing on its own, so iterating on it costs nothing. On failure the result carries diagnostics naming the offending line, plus the grammar below as hint. On success the hash is what the review widget, a check and an approval all address.

parent_hash (optional) links this revision to the one it edits, so the review can show a diff; source relayed from the widget's own edit control arrives with the parent it names. label (optional, inert): {domain: , topic: , confidence: high|medium|low}, the caller's reading of what domain the policy belongs to, stored as vocabulary ids only; or {declined: true}.

DSAIL ruleset grammar (v1.3), the subset this service compiles to SMT:

version 1.3; -- optional; 1.2 and 1.3 are accepted

declare as boolean; -- a yes/no claim declare as numeric; -- a number; units go on literals (below) declare as enum ["a","b"]; -- ORDERED vocabulary (comparable with < >) declare as enum {"a","b"}; -- UNORDERED vocabulary (== and != only) declare local as boolean; -- rule-local; NOT a claim, never extracted

assert { }; -- the rule. Holds => compliant. assert [pessimistic] { ... }; -- unknown-resolution policy: -- optimistic | pessimistic | neutral

Enum members are double-quoted strings. Every statement ends with a semicolon. You do not write let bindings for claim values — this service injects them from the claim dictionary you submit to check.

Literals: numbers 42 3.5 0.05 with a unit 3000 "mi" 25000 "USD" 0 "USD" -- a number followed by the unit as a QUOTED string. A bare -- unit word is a syntax error: 3000 mi fails to parse. booleans True False -- capitalised. Lowercase true and false are read as -- identifiers and fail as undefined variables. enum members "low" "high" -- double-quoted strings

Expressions: comparison == != < <= > >= (thresholds are STRICT: > means strictly greater, NOT at-or-above. Write >= if you mean at-or-above. Equality is ==, not =.) arithmetic + - * / % LOGIC IS FUNCTION-STYLE, NOT INFIX. There is no and/or/not keyword: And(a, b, ...) Or(a, b, ...) Not(a) Xor(a, b) Implies(a, b) If(cond, a, b) conditional IF THEN [ELSE ] END CASE OF "x": , "y": , DEFAULT: END quantifiers ForAll(x in s, p) Exists(x in s, p) AtLeast(n, x in s, p) AtMost(n, x in s, p) ExactlyOne(x in s, p) CountWhere(x in s, p) sets IsMember(v, s) IsSubset(a, b) Union(a, b) Intersect(a, b) Difference(a, b)

What a check answers. Every assertion gets its own result, and that is the whole answer:

TRUE the assertion holds FALSE the assertion is violated UNKNOWN a claim it needs was submitted as unknown, or is unconstrained AMBIGUOUS reserved. It means an assertion's evidence contradicted itself, which needs several answers for one claim. A claim dictionary holds exactly one value per claim, so no check submitted to this service produces it. Handle the word if you switch on results; there is no input that triggers it.

There is no combined verdict, no severity and no ranking. What a violated assertion should cost — a refusal, a human review, a note in a file — is a decision for the system reading the result, and this service does not make it.

Host annotations. These are ordinary DSAIL comments, invisible to the compiler, read by this service. Every one of them describes a CLAIM — what to ask for it and what a valid answer looks like. None of them decides an outcome:

// @ask What is ...? -- the question shown to an extractor // @context -- extra context for the extractor // @range 0..100 -- numeric bounds, enforced at check time // @unit USD -- expected unit for a numeric claim

@effect, @effect-default and @consistency are NOT recognised. A ruleset carrying one does not compile.

Rule descriptions. Directly above every assert, with no blank line between, write what the rule requires in plain words as an ordinary comment block (no @ tag). The review widget shows it as the rule's description and a person edits it there, so it must say what the assert beneath it actually checks. dsail_compile over MCP refuses an assert that has none, naming its line.

Worked example:

version 1.3; // @ask loanAmount What is the loan principal, in USD? // @unit loanAmount USD // @range loanAmount 0..100000000 declare loanAmount as numeric; // @ask hasAppraisal Does the file contain a completed appraisal? declare hasAppraisal as boolean; declare riskTier as enum ["low","medium","high"];

// No loan may exceed one million dollars. assert within_cap { loanAmount <= 1000000 "USD" }; // A loan over 500,000 USD needs an appraisal on file. assert large_but_documented { Or(loanAmount <= 500000 "USD", hasAppraisal) }; // A loan over 250,000 USD needs an appraisal on file. assert appraisal_when_large { IF loanAmount > 250000 "USD" THEN hasAppraisal ELSE True END }; // High-risk applicants are not permitted. assert tier_permitted { riskTier != "high" };

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelNoOptional application-domain label: `{"topic": "<a few words on what the policy governs>"}`, or `{"declined": true}`. Matched against the published vocabulary and then discarded; never stored on the ruleset. Omitting it leaves the ruleset unlabeled, which is normal.
sourceYesThe DSAIL source text to compile: `declare` lines for each claim with their `// @ask`, `// @unit` and `// @range` annotations, then `assert` rules. Written only after the user has confirmed the English summary.
parent_hashNoThe hash of the revision this one supersedes, when editing a saved ruleset. Links the two so the review can show a diff; omit for a new ruleset.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / oneOf
      Previous value: -[
      -  {
      -    "properties": {
      -      "claim_schema": {
      -        "description": "JSON Schema for the claim dictionary.",
      -        "type": "object"
      -      },
      -      "diagnostics": {
      -        "items": {
      -          "properties": {
      -            "line": {
      -              "type": [
      -                "integer",
      -                "null"
      -              ]
      -            },
      -            "message": {
      -              "type": "string"
      -            },
      -            "severity": {
      -              "enum": [
      -                "error",
      -                "warning"
      -              ],
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "severity",
      -            "message"
      -          ],
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "label": {
      -        "description": "The ruleset's stored application-domain label (TJP-642), as ids under `vocabulary_version`. Null when the ruleset carries none, or when this account has labeling disabled. A label never alters a result; the level-two proposal text a caller sent is matched and dropped, never stored or returned.",
      -        "properties": {
      -          "confidence": {
      -            "enum": [
      -              "high",
      -              "medium",
      -              "low",
      -              null
      -            ],
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "declined": {
      -            "type": "boolean"
      -          },
      -          "level_one": {
      -            "description": "Level-one domain id. Null only when declined.",
      -            "enum": [
      -              "finance",
      -              "consumer_finance",
      -              "capital_markets",
      -              "insurance",
      -              "regulatory_compliance",
      -              "hr_workforce",
      -              "security_access",
      -              "security_classification",
      -              "healthcare",
      -              "legal_contracts",
      -              "procurement",
      -              "engineering_release",
      -              "content_safety",
      -              "other",
      -              null
      -            ],
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "level_two": {
      -            "description": "Level-two term id, from GET /v1/vocabulary. Null when the proposal matched no published term (the proposal was counted toward promotion instead) or none was offered.",
      -            "pattern": "^l2-[0-9]{4,}$",
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "updated_at": {
      -            "description": "UTC, ISO 8601.",
      -            "type": "string"
      -          },
      -          "vocabulary_version": {
      -            "example": "v1",
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "vocabulary_version",
      -          "level_one",
      -          "level_two",
      -          "confidence",
      -          "declined",
      -          "updated_at"
      -        ],
      -        "type": [
      -          "object",
      -          "null"
      -        ]
      -      },
      -      "manifest": {
      -        "properties": {
      -          "claims": {
      -            "items": {
      -              "properties": {
      -                "boolean_subtype": {
      -                  "type": "string"
      -                },
      -                "claim": {
      -                  "type": "string"
      -                },
      -                "context": {
      -                  "type": "string"
      -                },
      -                "data_type": {
      -                  "enum": [
      -                    "boolean",
      -                    "numeric",
      -                    "enum"
      -                  ],
      -                  "type": "string"
      -                },
      -                "ordered": {
      -                  "type": "boolean"
      -                },
      -                "question": {
      -                  "description": "Shown to the extracting model.",
      -                  "type": "string"
      -                },
      -                "range": {
      -                  "properties": {
      -                    "max": {
      -                      "type": "number"
      -                    },
      -                    "min": {
      -                      "type": "number"
      -                    }
      -                  },
      -                  "type": "object"
      -                },
      -                "required": {
      -                  "type": "boolean"
      -                },
      -                "unit": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "unknown_allowed": {
      -                  "const": true,
      -                  "type": "boolean"
      -                },
      -                "unknown_sentinel": {
      -                  "description": "Present only when this claim's own vocabulary contains a member spelled like the sentinel. Then the string means that member and this names the value that means undetermined (null).",
      -                  "type": "string"
      -                },
      -                "vocabulary": {
      -                  "items": {
      -                    "type": "string"
      -                  },
      -                  "type": "array"
      -                }
      -              },
      -              "required": [
      -                "claim",
      -                "data_type",
      -                "question",
      -                "required",
      -                "unknown_allowed"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "rules": {
      -            "items": {
      -              "description": "One rule, with the assertions it states. A rule is the unit a policy is written in; an assertion is the unit the engine answers, and one rule may state several. A ruleset compiled here is a single DSAIL source and the grammar has no grouping construct, so today every rule holds exactly one assertion and carries its name — read results through this level anyway and a rule that states more costs you nothing.",
      -              "properties": {
      -                "assertions": {
      -                  "items": {
      -                    "description": "One assertion a rule states. The engine answers per assertion, so this is the unit a check reports on.",
      -                    "properties": {
      -                      "line": {
      -                        "type": [
      -                          "integer",
      -                          "null"
      -                        ]
      -                      },
      -                      "name": {
      -                        "type": "string"
      -                      },
      -                      "source": {
      -                        "type": [
      -                          "string",
      -                          "null"
      -                        ]
      -                      },
      -                      "unknown_policy": {
      -                        "enum": [
      -                          "optimistic",
      -                          "pessimistic",
      -                          "neutral"
      -                        ],
      -                        "type": "string"
      -                      }
      -                    },
      -                    "required": [
      -                      "name",
      -                      "unknown_policy"
      -                    ],
      -                    "type": "object"
      -                  },
      -                  "type": "array"
      -                },
      -                "rule": {
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "rule",
      -                "assertions"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "ruleset_hash": {
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "ruleset_hash",
      -          "claims",
      -          "rules"
      -        ],
      -        "type": "object"
      -      },
      -      "ok": {
      -        "const": true,
      -        "type": "boolean"
      -      },
      -      "review": {
      -        "description": "A plain-text rendering of what this ruleset asks and decides, for a person about to approve it. Derived from the manifest on every compile, never stored, so it cannot drift from the contract a caller was handed.",
      -        "type": "string"
      -      },
      -      "ruleset_hash": {
      -        "description": "sha256 of the normalised source. This is the object key.",
      -        "type": "string"
      -      },
      -      "source": {
      -        "description": "The normalised DSAIL source that hashed to `ruleset_hash`, so a caller that only ever compiles has something to show or diff without a separate load-by-name call.",
      -        "type": "string"
      -      },
      -      "stored": {
      -        "properties": {
      -          "parent_hash": {
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "revision_depth": {
      -            "type": "integer"
      -          }
      -        },
      -        "type": "object"
      -      },
      -      "summary": {
      -        "description": "The same thing in one sentence, for a row in a list rather than a page a person reads.",
      -        "type": "string"
      -      },
      -      "unbridged_units": {
      -        "description": "Unit pairs this ruleset compares that no loaded converter bridges, attributed by the engine to the rule that cannot be lowered. Each one answers UNKNOWN for every claim dictionary until a converter is added.",
      -        "items": {
      -          "properties": {
      -            "cause": {
      -              "enum": [
      -                "missing",
      -                "ambiguous"
      -              ],
      -              "type": "string"
      -            },
      -            "from": {
      -              "type": "string"
      -            },
      -            "rule": {
      -              "type": "string"
      -            },
      -            "to": {
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "rule",
      -            "from",
      -            "to",
      -            "cause"
      -          ],
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "unit_library_hash": {
      -        "description": "The project unit library this compile read. Half of a result's provenance; null selects the six built-in standards.",
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "validation_contract": {
      -        "description": "Exactly what check will reject, known before submitting.",
      -        "type": "object"
      -      },
      -      "versions": {
      -        "description": "Which engine and which wire contract produced this response.",
      -        "properties": {
      -          "engine": {
      -            "example": "dsail-core",
      -            "type": "string"
      -          },
      -          "engine_version": {
      -            "type": "string"
      -          },
      -          "language_version": {
      -            "description": "DSAIL language version.",
      -            "type": "string"
      -          },
      -          "service_version": {
      -            "type": "string"
      -          },
      -          "supported_language_versions": {
      -            "items": {
      -              "type": "string"
      -            },
      -            "type": "array"
      -          },
      -          "wire_version": {
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "engine",
      -          "engine_version",
      -          "language_version",
      -          "service_version",
      -          "wire_version"
      -        ],
      -        "type": "object"
      -      }
      -    },
      -    "required": [
      -      "ok",
      -      "ruleset_hash",
      -      "source",
      -      "manifest",
      -      "review",
      -      "summary",
      -      "claim_schema",
      -      "validation_contract",
      -      "diagnostics",
      -      "versions"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "error": {
      -        "properties": {
      -          "actual": {
      -            "type": "integer"
      -          },
      -          "budget": {
      -            "type": "string"
      -          },
      -          "code": {
      -            "enum": [
      -              "VALIDATION_REJECTED",
      -              "COMPILE_FAILED",
      -              "BUDGET_EXCEEDED",
      -              "RULESET_NOT_FOUND",
      -              "ENGINE_ERROR",
      -              "BAD_REQUEST",
      -              "CREDENTIAL_REQUIRED",
      -              "CREDENTIAL_INVALID",
      -              "CREDENTIAL_SCOPE",
      -              "EVALUATION_LIMIT",
      -              "ENTITLEMENT_EXCEEDED",
      -              "TIER_UNAVAILABLE"
      -            ],
      -            "type": "string"
      -          },
      -          "diagnostics": {
      -            "items": {
      -              "properties": {
      -                "line": {
      -                  "type": [
      -                    "integer",
      -                    "null"
      -                  ]
      -                },
      -                "message": {
      -                  "type": "string"
      -                },
      -                "severity": {
      -                  "enum": [
      -                    "error",
      -                    "warning"
      -                  ],
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "severity",
      -                "message"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "docs": {
      -            "description": "The docs-site page that resolves this code (markdown). Fetch it before retrying blind.",
      -            "format": "uri",
      -            "type": "string"
      -          },
      -          "failure_count": {
      -            "description": "How many fields failed in total. Equal to the length of `failures` unless a very large rejection was truncated, which the message says.",
      -            "type": "integer"
      -          },
      -          "failures": {
      -            "description": "EVERY failing field, not the first one.",
      -            "items": {
      -              "properties": {
      -                "expected": {
      -                  "type": "string"
      -                },
      -                "field": {
      -                  "type": "string"
      -                },
      -                "received": {
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "field",
      -                "expected",
      -                "received"
      -              ],
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "hint": {
      -            "description": "The grammar guide, carried on compile failures so the next call can succeed without a human.",
      -            "type": "string"
      -          },
      -          "limit": {
      -            "type": "integer"
      -          },
      -          "message": {
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "code",
      -          "message"
      -        ],
      -        "type": "object"
      -      },
      -      "ok": {
      -        "const": false,
      -        "type": "boolean"
      -      },
      -      "versions": {
      -        "description": "Which engine and which wire contract produced this response.",
      -        "properties": {
      -          "engine": {
      -            "example": "dsail-core",
      -            "type": "string"
      -          },
      -          "engine_version": {
      -            "type": "string"
      -          },
      -          "language_version": {
      -            "description": "DSAIL language version.",
      -            "type": "string"
      -          },
      -          "service_version": {
      -            "type": "string"
      -          },
      -          "supported_language_versions": {
      -            "items": {
      -              "type": "string"
      -            },
      -            "type": "array"
      -          },
      -          "wire_version": {
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "engine",
      -          "engine_version",
      -          "language_version",
      -          "service_version",
      -          "wire_version"
      -        ],
      -        "type": "object"
      -      }
      -    },
      -    "required": [
      -      "ok",
      -      "error",
      -      "versions"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "properties": {
      +      "claim_schema": {
      +        "description": "JSON Schema for the claim dictionary.",
      +        "type": "object"
      +      },
      +      "diagnostics": {
      +        "items": {
      +          "properties": {
      +            "line": {
      +              "type": [
      +                "integer",
      +                "null"
      +              ]
      +            },
      +            "message": {
      +              "type": "string"
      +            },
      +            "severity": {
      +              "enum": [
      +                "error",
      +                "warning"
      +              ],
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "severity",
      +            "message"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "label": {
      +        "description": "The ruleset's stored application-domain label (TJP-642), as ids under `vocabulary_version`. Null when the ruleset carries none, or when this account has labeling disabled. A label never alters a result; the level-two proposal text a caller sent is matched and dropped, never stored or returned.",
      +        "properties": {
      +          "confidence": {
      +            "enum": [
      +              "high",
      +              "medium",
      +              "low",
      +              null
      +            ],
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "declined": {
      +            "type": "boolean"
      +          },
      +          "level_one": {
      +            "description": "Level-one domain id. Null only when declined.",
      +            "enum": [
      +              "finance",
      +              "consumer_finance",
      +              "capital_markets",
      +              "insurance",
      +              "regulatory_compliance",
      +              "hr_workforce",
      +              "security_access",
      +              "security_classification",
      +              "healthcare",
      +              "legal_contracts",
      +              "procurement",
      +              "engineering_release",
      +              "content_safety",
      +              "other",
      +              null
      +            ],
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "level_two": {
      +            "description": "Level-two term id, from GET /v1/vocabulary. Null when the proposal matched no published term (the proposal was counted toward promotion instead) or none was offered.",
      +            "pattern": "^l2-[0-9]{4,}$",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "updated_at": {
      +            "description": "UTC, ISO 8601.",
      +            "type": "string"
      +          },
      +          "vocabulary_version": {
      +            "example": "v1",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "vocabulary_version",
      +          "level_one",
      +          "level_two",
      +          "confidence",
      +          "declined",
      +          "updated_at"
      +        ],
      +        "type": [
      +          "object",
      +          "null"
      +        ]
      +      },
      +      "manifest": {
      +        "properties": {
      +          "claims": {
      +            "items": {
      +              "properties": {
      +                "boolean_subtype": {
      +                  "type": "string"
      +                },
      +                "claim": {
      +                  "type": "string"
      +                },
      +                "context": {
      +                  "type": "string"
      +                },
      +                "data_type": {
      +                  "enum": [
      +                    "boolean",
      +                    "numeric",
      +                    "enum"
      +                  ],
      +                  "type": "string"
      +                },
      +                "ordered": {
      +                  "type": "boolean"
      +                },
      +                "question": {
      +                  "description": "Shown to the extracting model.",
      +                  "type": "string"
      +                },
      +                "range": {
      +                  "properties": {
      +                    "max": {
      +                      "type": "number"
      +                    },
      +                    "min": {
      +                      "type": "number"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "required": {
      +                  "type": "boolean"
      +                },
      +                "unit": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "unknown_allowed": {
      +                  "const": true,
      +                  "type": "boolean"
      +                },
      +                "unknown_sentinel": {
      +                  "description": "Present only when this claim's own vocabulary contains a member spelled like the sentinel. Then the string means that member and this names the value that means undetermined (null).",
      +                  "type": "string"
      +                },
      +                "vocabulary": {
      +                  "items": {
      +                    "type": "string"
      +                  },
      +                  "type": "array"
      +                }
      +              },
      +              "required": [
      +                "claim",
      +                "data_type",
      +                "question",
      +                "required",
      +                "unknown_allowed"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "rules": {
      +            "items": {
      +              "description": "One rule, with the assertions it states. A rule is the unit a policy is written in; an assertion is the unit the engine answers, and one rule may state several. A ruleset compiled here is a single DSAIL source and the grammar has no grouping construct, so today every rule holds exactly one assertion and carries its name — read results through this level anyway and a rule that states more costs you nothing.",
      +              "properties": {
      +                "assertions": {
      +                  "items": {
      +                    "description": "One assertion a rule states. The engine answers per assertion, so this is the unit a check reports on.",
      +                    "properties": {
      +                      "line": {
      +                        "type": [
      +                          "integer",
      +                          "null"
      +                        ]
      +                      },
      +                      "name": {
      +                        "type": "string"
      +                      },
      +                      "source": {
      +                        "type": [
      +                          "string",
      +                          "null"
      +                        ]
      +                      },
      +                      "unknown_policy": {
      +                        "enum": [
      +                          "optimistic",
      +                          "pessimistic",
      +                          "neutral"
      +                        ],
      +                        "type": "string"
      +                      }
      +                    },
      +                    "required": [
      +                      "name",
      +                      "unknown_policy"
      +                    ],
      +                    "type": "object"
      +                  },
      +                  "type": "array"
      +                },
      +                "rule": {
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "rule",
      +                "assertions"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "ruleset_hash": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "ruleset_hash",
      +          "claims",
      +          "rules"
      +        ],
      +        "type": "object"
      +      },
      +      "ok": {
      +        "const": true,
      +        "type": "boolean"
      +      },
      +      "review": {
      +        "description": "A plain-text rendering of what this ruleset asks and decides, for a person about to approve it. Derived from the manifest on every compile, never stored, so it cannot drift from the contract a caller was handed.",
      +        "type": "string"
      +      },
      +      "ruleset_hash": {
      +        "description": "sha256 of the normalised source. This is the object key.",
      +        "type": "string"
      +      },
      +      "source": {
      +        "description": "The normalised DSAIL source that hashed to `ruleset_hash`, so a caller that only ever compiles has something to show or diff without a separate load-by-name call.",
      +        "type": "string"
      +      },
      +      "stored": {
      +        "properties": {
      +          "parent_hash": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "revision_depth": {
      +            "type": "integer"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "summary": {
      +        "description": "The same thing in one sentence, for a row in a list rather than a page a person reads.",
      +        "type": "string"
      +      },
      +      "unbridged_units": {
      +        "description": "Unit pairs this ruleset compares that no loaded converter bridges, attributed by the engine to the rule that cannot be lowered. Each one answers UNKNOWN for every claim dictionary until a converter is added.",
      +        "items": {
      +          "properties": {
      +            "cause": {
      +              "enum": [
      +                "missing",
      +                "ambiguous"
      +              ],
      +              "type": "string"
      +            },
      +            "from": {
      +              "type": "string"
      +            },
      +            "rule": {
      +              "type": "string"
      +            },
      +            "to": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "rule",
      +            "from",
      +            "to",
      +            "cause"
      +          ],
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "unit_library_hash": {
      +        "description": "The project unit library this compile read. Half of a result's provenance; null selects the six built-in standards.",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "validation_contract": {
      +        "description": "Exactly what check will reject, known before submitting.",
      +        "type": "object"
      +      },
      +      "versions": {
      +        "description": "Which engine and which wire contract produced this response.",
      +        "properties": {
      +          "engine": {
      +            "example": "dsail-core",
      +            "type": "string"
      +          },
      +          "engine_version": {
      +            "type": "string"
      +          },
      +          "language_version": {
      +            "description": "DSAIL language version.",
      +            "type": "string"
      +          },
      +          "service_version": {
      +            "type": "string"
      +          },
      +          "supported_language_versions": {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          "wire_version": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "engine",
      +          "engine_version",
      +          "language_version",
      +          "service_version",
      +          "wire_version"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "required": [
      +      "ok",
      +      "ruleset_hash",
      +      "source",
      +      "manifest",
      +      "review",
      +      "summary",
      +      "claim_schema",
      +      "validation_contract",
      +      "diagnostics",
      +      "versions"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "error": {
      +        "properties": {
      +          "actual": {
      +            "description": "How much the request used, where that is known. Absent for solver_memory_mb: the solver stops at the limit.",
      +            "type": "integer"
      +          },
      +          "budget": {
      +            "type": "string"
      +          },
      +          "code": {
      +            "enum": [
      +              "VALIDATION_REJECTED",
      +              "COMPILE_FAILED",
      +              "BUDGET_EXCEEDED",
      +              "RULESET_NOT_FOUND",
      +              "ENGINE_ERROR",
      +              "ENGINE_BUSY",
      +              "BAD_REQUEST",
      +              "CREDENTIAL_REQUIRED",
      +              "CREDENTIAL_INVALID",
      +              "CREDENTIAL_SCOPE",
      +              "EVALUATION_LIMIT",
      +              "ENTITLEMENT_EXCEEDED",
      +              "TIER_UNAVAILABLE"
      +            ],
      +            "type": "string"
      +          },
      +          "diagnostics": {
      +            "items": {
      +              "properties": {
      +                "line": {
      +                  "type": [
      +                    "integer",
      +                    "null"
      +                  ]
      +                },
      +                "message": {
      +                  "type": "string"
      +                },
      +                "severity": {
      +                  "enum": [
      +                    "error",
      +                    "warning"
      +                  ],
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "severity",
      +                "message"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "docs": {
      +            "description": "The docs-site page that resolves this code (markdown). Fetch it before retrying blind.",
      +            "format": "uri",
      +            "type": "string"
      +          },
      +          "failure_count": {
      +            "description": "How many fields failed in total. Equal to the length of `failures` unless a very large rejection was truncated, which the message says.",
      +            "type": "integer"
      +          },
      +          "failures": {
      +            "description": "EVERY failing field, not the first one.",
      +            "items": {
      +              "properties": {
      +                "expected": {
      +                  "type": "string"
      +                },
      +                "field": {
      +                  "type": "string"
      +                },
      +                "received": {
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "field",
      +                "expected",
      +                "received"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "hint": {
      +            "description": "The grammar guide, carried on compile failures so the next call can succeed without a human.",
      +            "type": "string"
      +          },
      +          "limit": {
      +            "type": "integer"
      +          },
      +          "message": {
      +            "type": "string"
      +          },
      +          "retry_after_ms": {
      +            "description": "ENGINE_BUSY only: when to retry. The REST door also sends it, in seconds, as Retry-After.",
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "code",
      +          "message"
      +        ],
      +        "type": "object"
      +      },
      +      "ok": {
      +        "const": false,
      +        "type": "boolean"
      +      },
      +      "versions": {
      +        "description": "Which engine and which wire contract produced this response.",
      +        "properties": {
      +          "engine": {
      +            "example": "dsail-core",
      +            "type": "string"
      +          },
      +          "engine_version": {
      +            "type": "string"
      +          },
      +          "language_version": {
      +            "description": "DSAIL language version.",
      +            "type": "string"
      +          },
      +          "service_version": {
      +            "type": "string"
      +          },
      +          "supported_language_versions": {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          "wire_version": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "engine",
      +          "engine_version",
      +          "language_version",
      +          "service_version",
      +          "wire_version"
      +        ],
      +        "type": "object"
      +      }
      +    },
      +    "required": [
      +      "ok",
      +      "error",
      +      "versions"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. Changed4 schema fields changed
    • addedInput schema / properties / label / description
      Added value: +"Optional application-domain label: `{\"topic\": \"<a few words on what the policy governs>\"}`, or `{\"declined\": true}`. Matched against the published vocabulary and then discarded; never stored on the ruleset. Omitting it leaves the ruleset unlabeled, which is normal."
    • addedInput schema / properties / parent_hash / description
      Added value: +"The hash of the revision this one supersedes, when editing a saved ruleset. Links the two so the review can show a diff; omit for a new ruleset."
    • addedInput schema / properties / source / description
      Added value: +"The DSAIL source text to compile: `declare` lines for each claim with their `// @ask`, `// @unit` and `// @range` annotations, then `assert` rules. Written only after the user has confirmed the English summary."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "The compiled ruleset: its content hash, the claim manifest, review text and diagnostics. On failure `ok` is false and `error` carries `code`, `message` and `docs`, the URL of the page that resolves it.",
      +  "oneOf": [
      +    {
      +      "properties": {
      +        "claim_schema": {
      +          "description": "JSON Schema for the claim dictionary.",
      +          "type": "object"
      +        },
      +        "diagnostics": {
      +          "items": {
      +            "properties": {
      +              "line": {
      +                "type": [
      +                  "integer",
      +                  "null"
      +                ]
      +              },
      +              "message": {
      +                "type": "string"
      +              },
      +              "severity": {
      +                "enum": [
      +                  "error",
      +                  "warning"
      +                ],
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "severity",
      +              "message"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "label": {
      +          "description": "The ruleset's stored application-domain label (TJP-642), as ids under `vocabulary_version`. Null when the ruleset carries none, or when this account has labeling disabled. A label never alters a result; the level-two proposal text a caller sent is matched and dropped, never stored or returned.",
      +          "properties": {
      +            "confidence": {
      +              "enum": [
      +                "high",
      +                "medium",
      +                "low",
      +                null
      +              ],
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "declined": {
      +              "type": "boolean"
      +            },
      +            "level_one": {
      +              "description": "Level-one domain id. Null only when declined.",
      +              "enum": [
      +                "finance",
      +                "consumer_finance",
      +                "capital_markets",
      +                "insurance",
      +                "regulatory_compliance",
      +                "hr_workforce",
      +                "security_access",
      +                "security_classification",
      +                "healthcare",
      +                "legal_contracts",
      +                "procurement",
      +                "engineering_release",
      +                "content_safety",
      +                "other",
      +                null
      +              ],
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "level_two": {
      +              "description": "Level-two term id, from GET /v1/vocabulary. Null when the proposal matched no published term (the proposal was counted toward promotion instead) or none was offered.",
      +              "pattern": "^l2-[0-9]{4,}$",
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "updated_at": {
      +              "description": "UTC, ISO 8601.",
      +              "type": "string"
      +            },
      +            "vocabulary_version": {
      +              "example": "v1",
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "vocabulary_version",
      +            "level_one",
      +            "level_two",
      +            "confidence",
      +            "declined",
      +            "updated_at"
      +          ],
      +          "type": [
      +            "object",
      +            "null"
      +          ]
      +        },
      +        "manifest": {
      +          "properties": {
      +            "claims": {
      +              "items": {
      +                "properties": {
      +                  "boolean_subtype": {
      +                    "type": "string"
      +                  },
      +                  "claim": {
      +                    "type": "string"
      +                  },
      +                  "context": {
      +                    "type": "string"
      +                  },
      +                  "data_type": {
      +                    "enum": [
      +                      "boolean",
      +                      "numeric",
      +                      "enum"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "ordered": {
      +                    "type": "boolean"
      +                  },
      +                  "question": {
      +                    "description": "Shown to the extracting model.",
      +                    "type": "string"
      +                  },
      +                  "range": {
      +                    "properties": {
      +                      "max": {
      +                        "type": "number"
      +                      },
      +                      "min": {
      +                        "type": "number"
      +                      }
      +                    },
      +                    "type": "object"
      +                  },
      +                  "required": {
      +                    "type": "boolean"
      +                  },
      +                  "unit": {
      +                    "type": [
      +                      "string",
      +                      "null"
      +                    ]
      +                  },
      +                  "unknown_allowed": {
      +                    "const": true,
      +                    "type": "boolean"
      +                  },
      +                  "unknown_sentinel": {
      +                    "description": "Present only when this claim's own vocabulary contains a member spelled like the sentinel. Then the string means that member and this names the value that means undetermined (null).",
      +                    "type": "string"
      +                  },
      +                  "vocabulary": {
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  }
      +                },
      +                "required": [
      +                  "claim",
      +                  "data_type",
      +                  "question",
      +                  "required",
      +                  "unknown_allowed"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "rules": {
      +              "items": {
      +                "description": "One rule, with the assertions it states. A rule is the unit a policy is written in; an assertion is the unit the engine answers, and one rule may state several. A ruleset compiled here is a single DSAIL source and the grammar has no grouping construct, so today every rule holds exactly one assertion and carries its name — read results through this level anyway and a rule that states more costs you nothing.",
      +                "properties": {
      +                  "assertions": {
      +                    "items": {
      +                      "description": "One assertion a rule states. The engine answers per assertion, so this is the unit a check reports on.",
      +                      "properties": {
      +                        "line": {
      +                          "type": [
      +                            "integer",
      +                            "null"
      +                          ]
      +                        },
      +                        "name": {
      +                          "type": "string"
      +                        },
      +                        "source": {
      +                          "type": [
      +                            "string",
      +                            "null"
      +                          ]
      +                        },
      +                        "unknown_policy": {
      +                          "enum": [
      +                            "optimistic",
      +                            "pessimistic",
      +                            "neutral"
      +                          ],
      +                          "type": "string"
      +                        }
      +                      },
      +                      "required": [
      +                        "name",
      +                        "unknown_policy"
      +                      ],
      +                      "type": "object"
      +                    },
      +                    "type": "array"
      +                  },
      +                  "rule": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "rule",
      +                  "assertions"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "ruleset_hash": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "ruleset_hash",
      +            "claims",
      +            "rules"
      +          ],
      +          "type": "object"
      +        },
      +        "ok": {
      +          "const": true,
      +          "type": "boolean"
      +        },
      +        "review": {
      +          "description": "A plain-text rendering of what this ruleset asks and decides, for a person about to approve it. Derived from the manifest on every compile, never stored, so it cannot drift from the contract a caller was handed.",
      +          "type": "string"
      +        },
      +        "ruleset_hash": {
      +          "description": "sha256 of the normalised source. This is the object key.",
      +          "type": "string"
      +        },
      +        "source": {
      +          "description": "The normalised DSAIL source that hashed to `ruleset_hash`, so a caller that only ever compiles has something to show or diff without a separate load-by-name call.",
      +          "type": "string"
      +        },
      +        "stored": {
      +          "properties": {
      +            "parent_hash": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "revision_depth": {
      +              "type": "integer"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "summary": {
      +          "description": "The same thing in one sentence, for a row in a list rather than a page a person reads.",
      +          "type": "string"
      +        },
      +        "unbridged_units": {
      +          "description": "Unit pairs this ruleset compares that no loaded converter bridges, attributed by the engine to the rule that cannot be lowered. Each one answers UNKNOWN for every claim dictionary until a converter is added.",
      +          "items": {
      +            "properties": {
      +              "cause": {
      +                "enum": [
      +                  "missing",
      +                  "ambiguous"
      +                ],
      +                "type": "string"
      +              },
      +              "from": {
      +                "type": "string"
      +              },
      +              "rule": {
      +                "type": "string"
      +              },
      +              "to": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "rule",
      +              "from",
      +              "to",
      +              "cause"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "unit_library_hash": {
      +          "description": "The project unit library this compile read. Half of a result's provenance; null selects the six built-in standards.",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "validation_contract": {
      +          "description": "Exactly what check will reject, known before submitting.",
      +          "type": "object"
      +        },
      +        "versions": {
      +          "description": "Which engine and which wire contract produced this response.",
      +          "properties": {
      +            "engine": {
      +              "example": "dsail-core",
      +              "type": "string"
      +            },
      +            "engine_version": {
      +              "type": "string"
      +            },
      +            "language_version": {
      +              "description": "DSAIL language version.",
      +              "type": "string"
      +            },
      +            "service_version": {
      +              "type": "string"
      +            },
      +            "supported_language_versions": {
      +              "items": {
      +                "type": "string"
      +              },
      +              "type": "array"
      +            },
      +            "wire_version": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "engine",
      +            "engine_version",
      +            "language_version",
      +            "service_version",
      +            "wire_version"
      +          ],
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "ok",
      +        "ruleset_hash",
      +        "source",
      +        "manifest",
      +        "review",
      +        "summary",
      +        "claim_schema",
      +        "validation_contract",
      +        "diagnostics",
      +        "versions"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "properties": {
      +        "error": {
      +          "properties": {
      +            "actual": {
      +              "type": "integer"
      +            },
      +            "budget": {
      +              "type": "string"
      +            },
      +            "code": {
      +              "enum": [
      +                "VALIDATION_REJECTED",
      +                "COMPILE_FAILED",
      +                "BUDGET_EXCEEDED",
      +                "RULESET_NOT_FOUND",
      +                "ENGINE_ERROR",
      +                "BAD_REQUEST",
      +                "CREDENTIAL_REQUIRED",
      +                "CREDENTIAL_INVALID",
      +                "CREDENTIAL_SCOPE",
      +                "EVALUATION_LIMIT",
      +                "ENTITLEMENT_EXCEEDED",
      +                "TIER_UNAVAILABLE"
      +              ],
      +              "type": "string"
      +            },
      +            "diagnostics": {
      +              "items": {
      +                "properties": {
      +                  "line": {
      +                    "type": [
      +                      "integer",
      +                      "null"
      +                    ]
      +                  },
      +                  "message": {
      +                    "type": "string"
      +                  },
      +                  "severity": {
      +                    "enum": [
      +                      "error",
      +                      "warning"
      +                    ],
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "severity",
      +                  "message"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "docs": {
      +              "description": "The docs-site page that resolves this code (markdown). Fetch it before retrying blind.",
      +              "format": "uri",
      +              "type": "string"
      +            },
      +            "failure_count": {
      +              "description": "How many fields failed in total. Equal to the length of `failures` unless a very large rejection was truncated, which the message says.",
      +              "type": "integer"
      +            },
      +            "failures": {
      +              "description": "EVERY failing field, not the first one.",
      +              "items": {
      +                "properties": {
      +                  "expected": {
      +                    "type": "string"
      +                  },
      +                  "field": {
      +                    "type": "string"
      +                  },
      +                  "received": {
      +                    "type": "string"
      +                  }
      +                },
      +                "required": [
      +                  "field",
      +                  "expected",
      +                  "received"
      +                ],
      +                "type": "object"
      +              },
      +              "type": "array"
      +            },
      +            "hint": {
      +              "description": "The grammar guide, carried on compile failures so the next call can succeed without a human.",
      +              "type": "string"
      +            },
      +            "limit": {
      +              "type": "integer"
      +            },
      +            "message": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "code",
      +            "message"
      +          ],
      +          "type": "object"
      +        },
      +        "ok": {
      +          "const": false,
      +          "type": "boolean"
      +        },
      +        "versions": {
      +          "description": "Which engine and which wire contract produced this response.",
      +          "properties": {
      +            "engine": {
      +              "example": "dsail-core",
      +              "type": "string"
      +            },
      +            "engine_version": {
      +              "type": "string"
      +            },
      +            "language_version": {
      +              "description": "DSAIL language version.",
      +              "type": "string"
      +            },
      +            "service_version": {
      +              "type": "string"
      +            },
      +            "supported_language_versions": {
      +              "items": {
      +                "type": "string"
      +              },
      +              "type": "array"
      +            },
      +            "wire_version": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "engine",
      +            "engine_version",
      +            "language_version",
      +            "service_version",
      +            "wire_version"
      +          ],
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "ok",
      +        "error",
      +        "versions"
      +      ],
      +      "type": "object"
      +    }
      +  ],
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only supply the safety profile (non-destructive, idempotent, non-read-only). The description adds substantive behavior the annotations cannot: it renders nothing on its own so iteration is free, failures return line-naming diagnostics plus the grammar as `hint`, success returns a hash that the review widget, a check and an approval all address, and it refuses any assert lacking a plain-word description. That is strong, non-redundant behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and usage are front-loaded correctly, and most of the grammar reference genuinely earns its place because the agent must author valid DSAIL source that the compiler will accept. However, the section on check results (TRUE/FALSE/UNKNOWN/AMBIGUOUS) belongs to dsail_check, and the AMBIGUOUS paragraph explicitly concedes 'there is no input that triggers it' — dead weight that inflates an already very long definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation, yet the description still explains the hash/manifest/review contract and the failure mode. Combined with the full grammar, literal/expression rules, host-annotation list, worked example and the rule-description requirement, an agent has everything needed to produce source this service will compile.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it explains that `parent_hash` links a revision so the review can show a diff and that source relayed from the edit widget arrives pre-populated with its parent, and it describes `label` as inert and stored only as vocabulary ids (including the `confidence` field the schema does not mention). Minor mismatch in how `label` is described versus the open object in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a concrete verb and resource ('Turn a written policy into rules a program can check') and immediately delimits the tool against its siblings by stating it formalises decisions rather than drafting, resolving or interpreting policy. Its scope — compile DSAIL source into a hash-addressed ruleset plus review text — is unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It names the trigger conditions ('two reviewers apply the same written criteria differently', 'a handbook's decided rules need repeatable application') and explicit exclusions ('does not draft policy, resolve conflicting policies or interpret an ambiguous regulation'). It also places the tool in the surrounding workflow (dsail_check, dsail_review, approval) so the agent knows where it sits.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.