forge.rego.v1.
Rego decides only whether a policy matches. Scope, checkpoints, exceptions,
actions, approvals, transformations, remediation, and precedence remain typed
policy configuration.
Entrypoints
Authors define
match; neither the package nor entrypoint is configurable.
LLM Gateway route and access-profile objects do not use this Rego contract.
Output
match must produce exactly one object. Unknown properties are rejected.
Each evidence object accepts:
Evidence describes the result; Forge does not re-evaluate it to determine
matched. Undefined results, multiple results, and invalid output fail closed.
Input
Inputs useschema_version: "forge.rego.input.v1" and are family-specific,
closed objects. Unknown fields are rejected. Optional facts are omitted when
the control point cannot observe them.
Common roots:
Content adds
request, event, tool, response, classification, mcp,
and llm. Access adds device, product, provider, destination,
process, browser, classification, route, account, control,
source, and local_model.
See Conditions for the complete field catalog. Rego also
receives identity.agent_id and identity.product_id for Content, and
identity.device_id and identity.product_id for Access.
Use defaults for optional facts:
tool.input, tool.result, and response.content can contain opaque JSON.
Check their type and shape before reading nested values. Do not dynamically
read the entire input document; all references must remain inside the
family’s declared schema.
Checkpoints
For Content policies, static field references must be valid at every selectedevaluateOn checkpoint.
The
response checkpoint is available only when the enforcing surface provides
that capability through a supported response adapter.
An incompatible static reference fails compilation with
FORGE_REGO_INPUT_STAGE. Dynamic lookup does not bypass runtime schema
validation.
Language profile
forge.rego.v1 fixes the schemas, entrypoints, capability set, compiler
behavior, limits, and OPA runtime as one compatibility contract.
- OPA runtime:
1.18.2 - source: 1–256 KiB
- input: at most 1 MiB and 64 nested levels
- strings: at most 64 KiB
- string arrays: at most 256 elements
- rules: at most 128
- expressions: at most 256 per rule
- syntax-tree nodes: at most 10,000
- comprehensions: at most 128
- policy-engine evaluation budget: 50 ms
- package and direct validation evaluation budget: up to 100 ms
data references, HTTP calls,
runtime inspection, module parsing, wall-clock time, randomness, UUID
generation, JWT decoding or verification, print, or trace.
CLI
Successful compilation returns
languageVersion, opaVersion, entrypoint,
sourceSha256, compilerFingerprint, and artifactFingerprint.
Packages
A policy-code package containsforge-policy.yaml, one declared .rego
source, optional JSON fixtures, and optional tests.json.
matched value, with an optional reasonCode. Directory and ZIP
loaders reject symlinks, traversal, duplicate paths, more than 256 files, and
more than 4 MiB expanded content.
Package operations validate and canonicalize code; they do not create or
update a policy.
Diagnostics
Every diagnostic includes
code, severity, phase, and message.
severity is currently error. Optional file, row, and column identify
the source location. Integrations should branch on the stable diagnostic code,
not message text.