Skip to main content
The Policy Engine is the always-on part of CLPI — Mnemom’s governance layer built on top of alignment cards, which also covers violation reclassification/trust recovery and fleet intelligence (most of which are separately-entitled capabilities).
The policy engine translates Alignment Card declarations into enforceable rules over concrete tools. An alignment card says an agent may perform web_fetch. The capabilities section of the same card says web_fetch means mcp__browser__navigate and mcp__browser__click — but not mcp__filesystem__delete. The card declares intent. The enforcement section enforces it.
Policy is part of the alignment card, not a separate artifact. The capabilities, enforcement, and per-capability forbidden rules live as sections of the unified card. There is no standalone policy YAML file, no PUT /v1/agents/:id/policy endpoint, and no mnemom policy CLI group. Use mnemom card evaluate + PUT /v1/alignment/agent/{id} instead. See the policy management guide for the customer workflow.
The policy engine does not have its own on/off/enforce switch. It checks tool usage against the card’s capabilities + enforcement sections, but whether a violation is logged or blocked is decided by the card’s top-level autonomy_mode (the same switch documented in Enforcement Modes) — off skips policy evaluation entirely, observe and nudge both log without blocking, and enforce blocks on critical/high violations. There’s a separate, genuinely independent switch — integrity_mode — for the values/conscience (AIP) pipeline, but there is no third, policy-specific mode field on the card. A legacy enforcement.mode (or default_mode) key is accepted on input for backward compatibility but is dropped during composition and has no effect on a canonical card — autonomy_mode is authoritative.

How the engine reads the card

The policy engine reads three sections of the canonical (composed) alignment card: Two optional card sections extend the model: The full normative schema for these sections is at /specifications/alignment-card-schema.

Example excerpt of a card’s policy sections

Three evaluation contexts

The same capabilities + enforcement sections are evaluated at three stages, each with different inputs and consequences.

CI/CD evaluation

Static evaluation runs in pipelines before deployment. It validates the card against the unified schema and evaluates its policy sections against a declared tool list.Commands:
What it checks:
  • Card YAML conforms to the unified schema (capability glob validity, enforcement-mode enums, forbidden-rule structure).
  • Capability required_actions reference actions that exist in autonomy.bounded_actions.
  • Each tool in the --tools list matches a capability, hits a forbidden rule, or falls through to the allow_unmapped_tools default.
  • Coverage report identifies card actions with no backing capability mapping.
Use case: pre-deploy gates. See the CI/CD policy gates guide for GitHub Actions + GitLab CI templates.

Capability mapping

Capability mappings are the core of the card’s policy sections. They bridge the gap between what the card declares (abstract actions like web_fetch) and what agents actually invoke (concrete tool names like mcp__browser__navigate).

Structure

Each capability has a name, a list of tool glob patterns, and a list of card actions it satisfies:

Glob patterns

Tool patterns support standard glob syntax for flexible matching:
Start with broad globs during initial card development, then tighten them as you understand which specific tools your agent uses. A mapping like mcp__browser__* is fine for week one. By month two, enumerate the specific tools.

How matching works

When the policy engine evaluates a tool, it follows this order:
  1. Forbidden check: does the tool match any enforcement.forbidden_tools[].pattern? If yes, the tool is a violation regardless of capability mappings.
  2. Capability match: does the tool match any capabilities[*].tools glob? If yes, the tool is allowed and mapped to the corresponding card actions.
  3. Default fallback: if neither forbidden nor mapped, apply enforcement.allow_unmapped_tools.
A tool can match multiple capabilities. This isn’t an error — it means the tool satisfies multiple card actions (e.g., a file-read tool satisfying both read_file and read_source_code).

Enforcement modes

Policy evaluation always runs against the card’s capabilities + enforcement sections, but what happens to a violation is governed by the card’s top-level autonomy_mode — there is no separate policy-specific mode field on a canonical card:

autonomy_mode: observe / nudge

Violations are evaluated and logged but never block the request. X-Policy-Verdict: warn header returned. observe and nudge map to the same policy behavior — CLPI does not yet render a distinct nudge annotation for policy violations.

autonomy_mode: enforce

critical/high violations block the request, same-turn on both transports. X-Policy-Verdict: fail header returned. HTTP 403 for non-streaming requests; streaming responses are gated before delivery (which adds latency). Lower-severity violations still only warn.

autonomy_mode: off

Skip policy evaluation entirely. No X-Policy-Verdict header. No performance overhead.
A card that predates this cutover may still carry a legacy enforcement.mode (or default_mode) field. It is read only as a fallback when autonomy_mode is absent from the canonical card, and it is never emitted on a newly composed canonical card — set autonomy_mode instead.

Relationship to the other master switches

There are two genuinely independent card-level master switches — autonomy_mode and integrity_mode — plus the protection card’s own mode. Policy enforcement is not a third independent switch: it shares autonomy_mode with action-policing alignment, so the two always move together. Both autonomy_mode-driven checks and the integrity_mode check are surfaced in the conscience timeline and observability exports. The policy engine polices tool calls — what the agent asks to run. It does not police what a tool hands back. That is the protection card’s job, and it happens in the same request: the front door screens each tool_result the request carries and withholds or decorates it before the body is forwarded, rather than leaving it for a later turn. See When the front door runs.

Forbidden rules

enforcement.forbidden_tools defines tools that must never be used, regardless of capability mappings. They’re always checked first in the evaluation pipeline.
Each rule has three fields:
Policy enforcement.forbidden_tools rules complement alignment card autonomy.forbidden_actions. Card forbidden actions declare intent (“this agent must never delete files”). Policy forbidden rules enforce that intent at the tool level (“block all tools matching mcp__filesystem__delete*”). Both are checked — card-level by alignment enforcement, tool-level by policy enforcement.

Unmapped tool handling

When a tool does not match any capability or forbidden rule, enforcement.allow_unmapped_tools determines what happens. It is a boolean, not a three-state field — the card itself can only say “let it through” or “deny it”:
Severity for an unmapped-tool denial is derived, not configured: a denied unmapped tool is always logged at high severity (it’s a hard violation); an allowed one is low (informational only). There’s no card field to change this.

Unmapped tool actions

Choosing the right default

Set allow_unmapped_tools: true while tool sets are still evolving, to avoid noise from a constantly changing tool inventory.

Grace period

New tools appear when agents gain new MCP server connections or when tool providers add capabilities. The grace period prevents these newly discovered tools from immediately becoming violations.
How it works:
  1. The policy engine tracks when each tool is first seen via tool_first_seen records.
  2. When an unmapped or forbidden tool is encountered, the engine checks how long ago it was first seen.
  3. If the tool was first seen within the grace period window, the violation is downgraded to a warning (the verdict drops from fail to warn), and the request proceeds. Under enforce mode, this means the request is not blocked.
  4. After the grace period expires, the tool falls back to the configured allow_unmapped_tools result (or its forbidden severity, for forbidden-pattern matches).
The window is per-(agent, tool): each agent’s first observation of each tool starts its own clock. The clock cannot be back-dated. This gives operators time to amend the card’s capabilities section after adding new tools or MCP servers, without immediately triggering violations in enforce mode.
Security implication. With the default 24h grace, brand-new tools — including ones introduced by an attacker via prompt injection, MCP server compromise, or tool-name overlap — get a 24-hour pass on enforce mode. Mature agents with stable tool inventories aren’t exposed; agents that add tools dynamically, run untrusted MCP servers, or accept tool definitions from user input absolutely are.If your threat model includes adversarial tool introduction, set grace_period_hours: 0 on the alignment card to disable the grace path entirely. There is no API to back-date a tool_first_seen record, so 0 is the only way to make enforce strict from the moment a card is published. See Enforcement § Grace period.

Composition across scopes

In organizations with multiple agents, the capabilities and enforcement sections compose from platform → org → agent scopes per card composition rules. These are merged at storage time, not request time: every gateway read hits the pre-composed canonical card.

Merge rules

Strengthening enforcement

Upstream scopes act as a floor; a downstream scope can only move in the stricter direction:
If the org sets allow_unmapped_tools: true, an agent can override it to false (stricter, i.e. deny) but cannot force a false set upstream back to true.

Transaction guardrails

Transaction-scoped cards can further restrict the composed enforcement via intersection semantics. A transaction guardrail can only narrow what’s permitted — never expand it.

Coverage report

Every mnemom card evaluate run produces a coverage report that quantifies how well the card’s capabilities section maps to its autonomy.bounded_actions. This identifies gaps between what the card declares and what the policy actually covers.

Coverage metrics

Example output

A coverage percentage below 100% means some card actions have no backing capability mapping. Tools implementing those actions will fall through to enforcement.allow_unmapped_tools. Aim for 100% coverage in production cards.

Using coverage in CI/CD

card evaluate always prints the coverage percentage and lists unmapped actions. Coverage gating is binary: without --strict only hard policy violations exit non-zero; with --strict any unmapped action (i.e. coverage below 100%) is treated as a warning that also exits 1. This integrates naturally into pre-deploy gates: a card change that introduces an unmapped action blocks the merge. See CI/CD policy gates for the full pipeline template.

Putting it together

Here’s the full alignment card for a research agent that can browse the web and read files but cannot delete anything or execute shell commands:

Limitations

  • Policy evaluation adds latency to gateway requests (typically under 5 ms for cards with fewer than 100 capability patterns).
  • Glob patterns match tool names only, not tool arguments. A tool can be permitted by policy but still violate alignment constraints based on how it’s called.
  • Grace periods are tracked per-agent, not per-card-version. Updating a card doesn’t reset grace-period timers for previously seen tools.
  • Coverage reports require a valid autonomy.bounded_actions list. Agents with an empty envelope get a coverage report with 0% coverage (no denominator).

Policy engine and AEGIS Managed Rules

The Policy Engine is the always-on layer of CLPI; AEGIS Managed Rules are a separate (but composable) layer. When a Managed Rule promotes, the gateway loads it via a tiered, multi-layer read substrate with independent fallback tiers. The policy engine still enforces card-defined capability mappings; the Managed Rule adds detection thresholds that screen the inputs and outputs the policy engine then allows or denies. Both compose through the same cards composition primitive — the recipe (detection content) and the rule (control-plane state) flow into the cards cascade Platform → Org → Team → Agent under strictest-wins composition.

See also

  • AEGIS Managed Rules — the signed detection rule set that composes with policy
  • Alignment Card Schema — normative schema for the unified alignment card (including capabilities + enforcement sections)
  • Policy Management Guide — step-by-step guide to authoring and deploying the capabilities + enforcement sections
  • CI/CD Policy Gates — mnemom card evaluate in GitHub Actions and GitLab CI
  • Card Lifecycle — how alignment cards evolve and interact with policy
  • Card Composition — how platform / org / agent scopes merge
  • Enforcement Modes — the full autonomy_mode / integrity_mode verdict ladder, including how policy enforcement fits in