Policy Reference
Complete reference for apm-policy.yml — the configuration file that defines organization-wide governance rules for APM packages.
Schema overview
Section titled “Schema overview”name: "Contoso Engineering Policy"version: "1.0.0"extends: org # Optional: inherit from parent policyenforcement: block # warn | block | off
cache: ttl: 3600 # Policy cache TTL in seconds
dependencies: allow: [] # Allowed dependency patterns deny: [] # Denied dependency patterns require: [] # Required packages require_resolution: project-wins # project-wins | policy-wins | block max_depth: 50 # Max transitive dependency depth
mcp: allow: [] # Allowed MCP server patterns deny: [] # Denied MCP server patterns transport: allow: [] # stdio | sse | http | streamable-http self_defined: warn # deny | warn | allow trust_transitive: false # Trust transitive MCP servers
compilation: target: allow: [] # vscode | claude | all enforce: null # Enforce specific target strategy: enforce: null # distributed | single-file source_attribution: false # Require source attribution
manifest: required_fields: [] # Required apm.yml fields scripts: allow # allow | deny content_types: allow: [] # instructions | skill | hybrid | prompts
unmanaged_files: action: ignore # ignore | warn | deny directories: [] # Directories to monitorTop-level fields
Section titled “Top-level fields”Human-readable policy name. Appears in audit output.
version
Section titled “version”Policy version string (e.g., "1.0.0"). Informational — not used for resolution.
enforcement
Section titled “enforcement”Controls how violations are reported:
| Value | Behavior |
|---|---|
off | Policy checks are skipped |
warn | Violations are reported but do not fail the audit |
block | Violations cause apm audit --ci to exit with code 1 |
extends
Section titled “extends”Inherit from a parent policy. See Inheritance.
| Value | Source |
|---|---|
org | Parent org’s .github/apm-policy.yml |
owner/repo | Cross-org policy from a specific repository |
https://... | Direct URL to a policy file |
Time-to-live in seconds for the cached policy file. Default: 3600 (1 hour). The cache is stored in apm_modules/.policy-cache/.
dependencies
Section titled “dependencies”Controls which packages repositories can depend on.
List of allowed dependency patterns. If non-empty, only matching dependencies are permitted.
dependencies: allow: - "contoso/**" # Any repo under contoso org - "contoso-eng/*" # Any repo directly under contoso-eng - "third-party/approved" # Exact matchList of denied dependency patterns. Deny takes precedence over allow.
dependencies: deny: - "untrusted-org/**" - "*/deprecated-*"require
Section titled “require”Packages that must be present in every repository’s apm.yml. Supports optional version pins:
dependencies: require: - "contoso/agent-standards" # Must be a dependency - "contoso/security-rules#v2.0.0" # Must be at specific versionrequire_resolution
Section titled “require_resolution”Controls what happens when a required package’s version conflicts with the repository’s declared version:
| Value | Behavior |
|---|---|
project-wins | Repository’s declared version takes precedence |
policy-wins | Policy’s pinned version overrides the repository |
block | Conflict causes a check failure |
max_depth
Section titled “max_depth”Maximum allowed transitive dependency depth. Default: 50. Set lower to limit supply chain depth:
dependencies: max_depth: 3 # Direct + 2 levels of transitiveControls MCP (Model Context Protocol) server configurations.
allow / deny
Section titled “allow / deny”Pattern lists for MCP server names. Same glob syntax as dependency patterns.
mcp: allow: - "github-*" - "internal-*" deny: - "untrusted-*"transport.allow
Section titled “transport.allow”Restrict which transport protocols MCP servers can use:
mcp: transport: allow: - stdio - streamable-httpValid values: stdio, sse, http, streamable-http.
self_defined
Section titled “self_defined”Controls MCP servers defined directly in a repository (not from packages):
| Value | Behavior |
|---|---|
allow | Self-defined MCP servers are permitted |
warn | Self-defined MCP servers trigger a warning |
deny | Self-defined MCP servers fail the audit |
trust_transitive
Section titled “trust_transitive”Whether to trust MCP servers declared by transitive dependencies. Default: false.
compilation
Section titled “compilation”target.allow / target.enforce
Section titled “target.allow / target.enforce”Control which compilation targets are permitted:
compilation: target: allow: [vscode, claude] # Only these targets allowed enforce: vscode # Must use this specific targetenforce takes precedence over allow. Use one or the other.
strategy.enforce
Section titled “strategy.enforce”Require a specific compilation strategy:
compilation: strategy: enforce: distributed # or: single-filesource_attribution
Section titled “source_attribution”Require source attribution in compiled output:
compilation: source_attribution: truemanifest
Section titled “manifest”required_fields
Section titled “required_fields”Fields that must be present and non-empty in every repository’s apm.yml:
manifest: required_fields: - version - descriptionscripts
Section titled “scripts”Whether the scripts section is allowed in apm.yml:
| Value | Behavior |
|---|---|
allow | Scripts section is permitted |
deny | Scripts section causes a check failure |
content_types.allow
Section titled “content_types.allow”Restrict which content types packages can declare:
manifest: content_types: allow: - instructions - skill - promptsunmanaged_files
Section titled “unmanaged_files”Detect files in governance directories that are not tracked by APM.
action
Section titled “action”| Value | Behavior |
|---|---|
ignore | Unmanaged files are not checked |
warn | Unmanaged files trigger a warning |
deny | Unmanaged files fail the audit |
directories
Section titled “directories”Directories to scan for unmanaged files. Defaults:
unmanaged_files: directories: - .github/agents - .github/instructions - .github/hooks - .cursor/rules - .claude - .opencodePattern matching
Section titled “Pattern matching”Allow and deny lists use glob-style patterns:
| Pattern | Matches |
|---|---|
contoso/* | contoso/repo but not contoso/org/repo |
contoso/** | contoso/repo, contoso/org/repo, any depth |
*/approved | any-org/approved |
exact/match | Only exact/match |
* matches any characters within a single path segment (no /). ** matches across any number of segments.
Deny patterns are evaluated first. If a reference matches any deny pattern, it fails regardless of the allow list. An empty allow list permits everything not denied.
Check reference
Section titled “Check reference”Baseline checks (always run with --ci)
Section titled “Baseline checks (always run with --ci)”| Check | Validates |
|---|---|
lockfile-exists | apm.lock.yaml is present when apm.yml declares dependencies |
ref-consistency | Every dependency’s manifest ref matches the lockfile’s resolved ref |
deployed-files-present | All files listed in lockfile deployed_files exist on disk |
no-orphaned-packages | No lockfile packages are absent from the manifest |
config-consistency | MCP server configs match lockfile baseline |
content-integrity | Deployed files contain no critical hidden Unicode characters |
Policy checks (run with --ci --policy)
Section titled “Policy checks (run with --ci --policy)”Dependencies:
| Check | Validates |
|---|---|
dependency-allowlist | Every dependency matches the allow list |
dependency-denylist | No dependency matches the deny list |
required-packages | Every required package is in the manifest |
required-packages-deployed | Required packages appear in lockfile with deployed files |
required-package-version | Required packages with version pins match per require_resolution |
transitive-depth | No dependency exceeds max_depth |
MCP:
| Check | Validates |
|---|---|
mcp-allowlist | MCP server names match the allow list |
mcp-denylist | No MCP server matches the deny list |
mcp-transport | MCP transport values are in the allowed list |
mcp-self-defined | Self-defined MCP servers comply with policy |
Compilation:
| Check | Validates |
|---|---|
compilation-target | Compilation target matches policy |
compilation-strategy | Compilation strategy matches policy |
source-attribution | Source attribution is enabled if required |
Manifest:
| Check | Validates |
|---|---|
required-manifest-fields | All required fields are present and non-empty |
scripts-policy | Scripts section absent if policy denies it |
Unmanaged files:
| Check | Validates |
|---|---|
unmanaged-files | No untracked files in governance directories |
Inheritance
Section titled “Inheritance”Policies can inherit from a parent using extends. This enables a three-level chain:
Enterprise hub → Org policy → Repo overrideTighten-only merge rules
Section titled “Tighten-only merge rules”A child policy can only tighten constraints — never relax them:
| Field | Merge rule |
|---|---|
enforcement | Escalates: off < warn < block |
cache.ttl | min(parent, child) |
| Allow lists | Intersection — child narrows parent’s allowed set |
| Deny lists | Union — child adds to parent’s denied set |
require | Union — combines required packages |
require_resolution | Escalates: project-wins < policy-wins < block |
max_depth | min(parent, child) |
mcp.self_defined | Escalates: allow < warn < deny |
manifest.scripts | Escalates: allow < deny |
unmanaged_files.action | Escalates: ignore < warn < deny |
source_attribution | parent OR child — either enables it |
trust_transitive | parent AND child — both must allow it |
The inheritance chain is limited to 5 levels. Cycles are detected and rejected.
Example: repo override
Section titled “Example: repo override”# Repo-level apm-policy.ymlname: "Frontend Team Policy"version: "1.0.0"extends: org # Inherits org policy, can only tighten
dependencies: deny: - "legacy-org/**" # Additional deny on top of org policyExamples
Section titled “Examples”Minimal: deny-only policy
Section titled “Minimal: deny-only policy”name: "Block Untrusted Sources"version: "1.0.0"enforcement: block
dependencies: deny: - "untrusted-org/**"Standard org policy
Section titled “Standard org policy”name: "Contoso Engineering"version: "1.0.0"enforcement: block
dependencies: allow: - "contoso/**" - "contoso-oss/**" require: - "contoso/agent-standards" max_depth: 5
mcp: deny: - "untrusted-*" transport: allow: [stdio, streamable-http] self_defined: warn
manifest: required_fields: [version, description]
unmanaged_files: action: warnEnterprise hub with inheritance
Section titled “Enterprise hub with inheritance”name: "Enterprise Baseline"version: "2.0.0"enforcement: block
dependencies: deny: - "banned-org/**" max_depth: 10
mcp: self_defined: deny trust_transitive: false
manifest: scripts: denyname: "Contoso Policy"version: "1.0.0"extends: "enterprise-org/.github" # Inherits enterprise baseline
dependencies: allow: - "contoso/**" require: - "contoso/agent-standards" max_depth: 5 # Tightens from 10 to 5Related
Section titled “Related”- Governance & Compliance — conceptual overview of APM’s governance model
- CI Policy Enforcement — step-by-step CI setup tutorial
- GitHub Rulesets — enforce policy as a required status check