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).
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 samecapabilities + enforcement sections are evaluated at three stages, each with different inputs and consequences.
- CI/CD (Static)
- Gateway (Live)
- Observer (Post)
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:- Card YAML conforms to the unified schema (capability glob validity, enforcement-mode enums, forbidden-rule structure).
- Capability
required_actionsreference actions that exist inautonomy.bounded_actions. - Each tool in the
--toolslist matches a capability, hits a forbidden rule, or falls through to theallow_unmapped_toolsdefault. - Coverage report identifies card actions with no backing capability mapping.
Capability mapping
Capability mappings are the core of the card’s policy sections. They bridge the gap between what the card declares (abstract actions likeweb_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:How matching works
When the policy engine evaluates a tool, it follows this order:- Forbidden check: does the tool match any
enforcement.forbidden_tools[].pattern? If yes, the tool is a violation regardless of capability mappings. - Capability match: does the tool match any
capabilities[*].toolsglob? If yes, the tool is allowed and mapped to the corresponding card actions. - Default fallback: if neither forbidden nor mapped, apply
enforcement.allow_unmapped_tools.
read_file and read_source_code).
Enforcement modes
Policy evaluation always runs against the card’scapabilities + 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.
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”:
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
- Early development
- Mature / production card
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.- The policy engine tracks when each tool is first seen via
tool_first_seenrecords. - When an unmapped or forbidden tool is encountered, the engine checks how long ago it was first seen.
- If the tool was first seen within the grace period window, the violation is downgraded to a warning (the verdict drops from
failtowarn), and the request proceeds. Under enforce mode, this means the request is not blocked. - After the grace period expires, the tool falls back to the configured
allow_unmapped_toolsresult (or its forbidden severity, for forbidden-pattern matches).
capabilities section after adding new tools or MCP servers, without immediately triggering violations in enforce mode.
Composition across scopes
In organizations with multiple agents, thecapabilities 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: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
Everymnemom 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
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_actionslist. 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+enforcementsections - CI/CD Policy Gates —
mnemom card evaluatein 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_modeverdict ladder, including how policy enforcement fits in