Documentation Index
Fetch the complete documentation index at: https://mnemomllc-feat-aip-output-analysis-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Policy Engine
The Policy Engine is Phase 1 of CLPI (Card Lifecycle & Policy Intelligence) — the governance layer that transforms alignment cards into lifecycle-managed artifacts with policy enforcement, trust recovery, risk intelligence, and on-chain anchoring.
web_fetch. The policy says that web_fetch means the agent can call mcp__browser__navigate and mcp__browser__click, but not mcp__filesystem__delete. The card declares intent. The policy enforces it.
Policies are defined in a YAML-based DSL with five top-level sections: capability_mappings, forbidden, defaults, and optionally escalation_triggers and meta. They are evaluated in three contexts — CI/CD pipelines, live gateway requests, and post-action observation — giving operators governance coverage across the full agent lifecycle.
The policy engine is a parallel enforcement layer to alignment enforcement (observe/nudge/enforce). Alignment enforcement checks agent behavior against card values. Policy enforcement checks tool usage against policy rules. Both run independently and produce separate verdicts.
Policy DSL Overview
A policy file is a YAML document that declares how abstract card capabilities map to concrete tools, which tools are always forbidden, and what happens when a tool falls outside any mapping.| Section | Purpose |
|---|---|
capability_mappings | Bridge card-level categories to concrete tool patterns |
forbidden | Tools that are always blocked, regardless of mappings |
defaults | Fallback behavior for tools that match no mapping |
| Section | Purpose |
|---|---|
escalation_triggers | Conditions that trigger escalation regardless of individual tool verdicts |
meta | Human-readable metadata: name, version, description |
Three Evaluation Contexts
Policies are not evaluated once. They are evaluated at three stages, each with different inputs and different consequences.- CI/CD (Static)
- Gateway (Live)
- Observer (Post)
CI/CD Evaluation
Static evaluation runs in pipelines before deployment. It validates policy syntax and evaluates policy rules against historical trace data.Commands:- Policy YAML conforms to the DSL schema
- All glob patterns are syntactically valid
- Capability mappings reference card actions that exist in the agent’s alignment card
- Historical traces would pass/fail under the proposed policy
- Coverage report identifies unmapped card actions
smoltbot policy validate and smoltbot policy evaluate before merging policy changes. If evaluation shows violations in recent traces, the merge is blocked.Capability Mapping
Capability mappings are the core of the policy DSL. They bridge the gap between what an alignment card declares (abstract semantic actions likeweb_fetch) and what agents actually invoke (concrete tool names like mcp__browser__navigate).
Structure
Each capability mapping 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:| Pattern | Matches |
|---|---|
mcp__browser__* | All browser tools (navigate, click, screenshot, etc.) |
mcp__filesystem__read* | read_file, read_directory, read_metadata |
mcp__*__list* | Any MCP server’s list operations |
custom_tool_v? | custom_tool_v1, custom_tool_v2, etc. |
How Matching Works
When the policy engine evaluates a tool, it follows this order:- Forbidden check: Does the tool match any
forbiddenpattern? If yes, the tool is a violation regardless of capability mappings. - Capability match: Does the tool match any
capability_mappingstool pattern? If yes, the tool is allowed and mapped to the corresponding card actions. - Default fallback: If neither forbidden nor mapped, apply
defaults.unmapped_tool_action.
Enforcement Modes
The policy engine has its own enforcement mode, independent of the alignment enforcement mode (observe/nudge/enforce).Warn
Log violations but do not block.
X-Policy-Verdict: warn header returned. This is the default mode.Enforce
Block requests with policy violations.
X-Policy-Verdict: fail header returned. HTTP 403 for non-streaming requests.Off
Skip policy evaluation entirely. No
X-Policy-Verdict header. No performance overhead.Relationship to Alignment Enforcement
| System | What It Checks | Verdict Source |
|---|---|---|
| Alignment enforcement (observe/nudge/enforce) | Agent behavior against card values and autonomy envelope | AIP integrity checkpoints, AAP verification |
| Policy enforcement (warn/enforce/off) | Tool usage against policy rules and capability mappings | Policy engine evaluation |
Forbidden Actions
Forbidden rules define tools that must never be used, regardless of capability mappings. They are always checked first in the evaluation pipeline.| Field | Type | Description |
|---|---|---|
pattern | string (glob) | Tool name pattern to match |
reason | string | Human-readable explanation for auditing |
severity | enum | critical, high, medium, or low |
Policy
forbidden rules complement alignment card 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 mapping or forbidden rule, thedefaults section determines what happens.
Unmapped Tool Actions
| Action | Behavior |
|---|---|
deny | Treat the unmapped tool as a violation. Blocked in enforce mode. |
warn | Log a warning but allow the tool invocation. Default. |
allow | Silently permit the tool. No log entry. |
Choosing the Right Default
- Development
- Staging
- Production
Use
allow during early development when tool sets are still evolving. This avoids noise from constantly changing tool inventories.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 tool is encountered, the engine checks how long ago it was first seen.
- If the tool was first seen within the grace period window, it is treated as
allowregardless ofunmapped_tool_action. - After the grace period expires, the tool falls back to the configured
unmapped_tool_action.
Policy Merge
In organizations with multiple agents, policies exist at two levels: org-level and agent-level. These are merged at evaluation time using rules that prevent agents from weakening organizational policy.Merge Rules
| Section | Merge Strategy | Effect |
|---|---|---|
capability_mappings | Union | Agent can add new mappings but cannot remove org-level mappings |
forbidden | Union | Both org and agent forbidden rules are enforced |
defaults | Org is floor | Agent can strengthen (allow to warn to deny) but cannot weaken |
escalation_triggers | Union | Both org and agent triggers are evaluated |
meta | Agent overrides | Agent metadata replaces org metadata |
Strengthening Defaults
The org default acts as a floor. An agent can only move in the stricter direction:unmapped_tool_action: "warn", an agent can set it to deny (stricter) but not allow (weaker).
Transaction Guardrails
Transaction-scoped policies can further restrict the merged policy via intersection semantics. A transaction guardrail can only narrow what is permitted — never expand it.Coverage Report
Every policy evaluation produces a coverage report that quantifies how well the policy maps to the alignment card. This helps identify gaps between what the card declares and what the policy actually covers.Coverage Metrics
| Metric | Description |
|---|---|
total_card_actions | Number of actions declared in the alignment card’s bounded_actions |
mapped_card_actions | Number of card actions covered by at least one capability mapping |
unmapped_card_actions | Card actions with no corresponding capability mapping |
coverage_pct | mapped_card_actions / total_card_actions * 100 |
Example Output
Using Coverage in CI/CD
Putting It Together
Here is a complete policy 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 5ms for policies with fewer than 100 rules).
- 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 is called.
- Grace periods are tracked per-agent, not per-policy-version. Updating a policy does not reset grace period timers for previously seen tools.
- Coverage reports require a valid alignment card. Agents without a published card receive a coverage report with 0% coverage.
See Also
- Policy DSL Specification — Full normative specification for the policy YAML schema
- Policy CLI Reference — CLI commands for validating, evaluating, and managing policies
- Policy Management Guide — Step-by-step guide to writing and deploying policies
- Card Lifecycle — How alignment cards evolve and interact with policy
- Enforcement Modes — Alignment enforcement modes (observe/nudge/enforce)