Skip to content

The policy enforcement adapter

Policy is a hard gate inside the run: every call, state write, model call, delegation and emission passes a hook in the kernel, and the kernel's policy evaluator decides it against the effective policy the control plane resolved at build time. The node's policy enforcement adapter connects the two. It carries the resolved policy into the sealed run-plan exactly as the control plane signed it, and it carries the kernel's decisions, suspensions and taints back out. The kernel is the only place a rule is evaluated. This page covers what the adapter carries in, what it carries out, and how approvals and scores fit.

Where policy is resolved, enforced and recorded

flowchart TB
  subgraph CP["CONTROL PLANE, once at build"]
    direction LR
    BN[("Signed bundles<br/>seven attachment levels")]
    MR{{"Most-restrictive-wins merge"}}
    EP[("Frozen EffectivePolicy per step,<br/>signed exemptions, scoring policy")]
    BN --> MR --> EP
  end
  subgraph NODE["NODE, policy enforcement adapter"]
    direction LR
    IN["Seal the resolved policy<br/>into the run-plan, unchanged"]
    OUT["Relay PolicyDecision records,<br/>suspensions, score reports"]
    HITL[("Approval substrate")]
  end
  subgraph KRN["PROJECT KERNEL"]
    direction TB
    HK{{"Six hooks<br/>pre_call, pre_state_write, pre_llm,<br/>pre_delegate, post_call, pre_emit"}}
    EV{{"PolicyEvaluator<br/>pure, deterministic"}}
    EF["One of nine effects"]
    PD[("PolicyDecision<br/>with the run fingerprint")]
    HK --> EV --> EF
    EV --> PD
  end
  EP -->|"recipe, digested"| IN
  IN -->|"sealed run-plan"| HK
  PD -->|"return lane"| OUT
  EF -.->|"require_approval"| HITL
  OUT -->|"metadata and references"| CPR["Control plane<br/>audit and evidence"]

The policy a run is governed by is decided before the run exists and cannot change while it runs: the control plane resolves and signs it, the node seals it in, and the kernel enforces it. Every decision the kernel makes comes back as a PolicyDecision record naming the rule, the bundle and the level it was attached at, so the audit trail shows why each call was allowed, changed or stopped.

What the adapter carries in

The recipe carries, for each step of the compiled workflow, a frozen EffectivePolicy: every rule that targets the step, already merged across the tenant, workspace, project, flow, agent, capability and inline levels with the most restrictive value winning on every dimension. Alongside it come the signed exemptions that apply to the run and, for score-backed rules, the scoring policy and the signed cohort snapshots the rules read.

The adapter places all of it in the sealed run-plan unchanged. Merging, version pinning and exemption authority are settled by the control plane at build, and the sealed run-plan is immutable once assembled; the kernel verifies its signature and hashes before step one. A governance change therefore reaches a run only through a new build: runs in flight keep the policy they started with. See Effective policy computation and provenance and The DP bundle.

Every rule is in one canonical shape, so the kernel reads every bundle the same way, whoever wrote it:

- id: <unique within the bundle>
  on: <one of the six hooks>
  applies_to: <capability, data_class, action_class, agent, or *>
  when: <predicate>
  effect: <allow, deny, redact, require_approval, route_to,
           downgrade_model, require_evidence, rate_limit, retry>
  effect_args: <typed arguments for the effect>
  reason: <shown in the decision>
  references: [<source regulation or internal policy>]

The evaluator runs on the data plane with the kernel; whether it runs inside the kernel process or beside it over gRPC is an open design decision, with in-kernel the leading option. See Evaluator placement and The six hooks.

What the adapter carries out

Decisions. Every hook firing produces a PolicyDecision record:

{
  "trace_id": "trc_5b10",
  "run_fingerprint": "sha256:...",
  "hook": "pre_call",
  "target": {"capability": "retention.purge", "step_id": "purge_1"},
  "rule_id": "retention_window_hold",
  "bundle": "org.example.retention-controls",
  "bundle_version": 3,
  "attachment_level": "workspace",
  "input_hash": "sha256:...",
  "effect": "deny",
  "effect_args": {},
  "decided_at": "2026-05-14T14:23:11Z",
  "reason": "records inside the retention window cannot be purged",
  "references": ["Retention policy v4 ยง3"],
  "exemption_ref": null
}

The record references the run fingerprint, which binds the workflow, the block hashes, the policy hash, the bundle versions and any exemptions applied. The node projects each record through its evidence path unchanged: the body goes to your bucket and the control plane receives its metadata, reference and digest. See Kernel evidence projection and The policy decision record.

Taints. A value written by a block carries the data classes its manifest declares, and the label travels with the value across the boundary between the node and the kernel, so a rule written against a data class applies wherever the value goes. Whether taints are tracked per field or per object is an open design decision.

Approvals

require_approval, and the workflow's own await, suspend the run. The kernel freezes the run state with its taints, emits run.suspended and the decision, and issues a resume token; the suspension survives a restart of the node, and replaying a resume is a no-op. The approval is routed by metadata the control plane owns, to an approval substrate the node hosts or bridges to your own systems. Whether approval queues are owned by the control plane or pluggable per tenant is an open design decision. See Require approval.

Scores

Score-backed rules are ordinary rules whose predicates read score.* facts, enforced at the same hooks. The kernel computes the scores from its own telemetry; the node supplies the scoring policy and cohort snapshots in the sealed run-plan and exports score reports through the same metadata-only path as other evidence. A missing score resolves as the effective policy declares: unknown, a conservative default, or a policy error. Enforcement of a score-backed rule belongs to the kernel alone. See Score facts as evaluator input.