Repository navigation
Description
In one sentence: admins keep one vendor-neutral policy file; apm policy compile turns the rules that map exactly into each coding agent's own lockdown settings, and apm install refuses what those settings block instead of reporting false success.
Why
Persona. Amara is a platform admin at a strict enterprise. Her APM policy (apm-policy.yml) lists allowed plugin marketplaces (catalogs of trusted plugins) and MCP servers (tool servers an agent can call). She also hand-writes managed settings for each harness (the coding agent tool APM configures, such as Claude Code, GitHub Copilot or Codex): a file IT deploys to every laptop, which the harness must obey. Same rules, written twice, drifting apart.
Worse, APM never reads the deployed files. On a locked-down laptop, apm install can report success for a plugin the harness then drops.
Why now. Claude Code and GitHub Copilot both ship managed settings with shared keys such as strictKnownMarketplaces and deniedMcpServers, and admins hand-write these files today.
What
Two layers, one policy. APM checks at install time; the harness enforces at run time. APM writes the settings files; IT deploys them (device management, root-owned paths, GitHub server-managed settings).
flowchart TB
P["apm-policy.yml (one policy)"] --> C["apm policy compile"]
C --> F["managed settings files + UNMAPPED.md"]
F --> IT["IT deploys the files"]
subgraph L2["Layer 2: harness, run time"]
MS["Managed settings on the laptop"] --> RT["Harness enforces: loads or drops"]
end
IT --> MS
subgraph L1["Layer 1: APM, install time"]
I["apm install"] --> D{"Allowed by APM policy AND by deployed managed settings?"}
D -->|yes| W["Write files, exit 0"]
D -->|no| X["Refuse, exit 1, nothing written"]
end
P --> D
MS -->|"preflight reads the file"| D
W --> RT
Illustrative, planned for 0.40:
# apm-policy.yml (existing keys only)
enforcement: block
marketplace:
allow: [acme/agent-marketplace]
mcp:
allow: [github, acme-jira]
deny: [shell-exec]$ apm policy compile --vendor claude,copilot -o dist/policy/
[+] dist/policy/claude/managed-settings.json deniedMcpServers (1)
[i] dist/policy/copilot/managed-settings.json no rule proven equal yet (file not written)
[!] not emitted (APM enforces these at install only), see dist/policy/UNMAPPED.md
$ apm install foo@random # laptop with the deployed file
[x] foo@random: marketplace 'random' is not allowed by managed settings (claude). Nothing written.
When the layers disagree
| Situation | What happens |
|---|---|
| APM policy allows it; deployed managed settings block it | Install preflight (a check before writing) refuses, exit 1, nothing written. |
| APM policy blocks it; managed settings allow it or are absent | apm install refuses (enforcement: block). Items added another way still load; apm status flags them (#5745). |
| A rule has no exactly equal vendor key | Listed in UNMAPPED.md, not written. Only APM enforces it, at install. |
| Compiled files are older than the policy | apm policy compile --check fails. |
Until 0.41 adds installs from the org marketplace, APM registers plugins through a local marketplace entry. A strictKnownMarketplaces list that omits it refuses those installs too, and preflight says so.
What it includes
apm policy compile,--checkandUNMAPPED.md: Claude Code and Copilot first, then Codex and Gemini.- Install preflight that reads deployed managed settings files.
- Policy check fixes already filed (see Child issues).
What it does not include
- Deploying files to machines, new policy keys, vendor-only keys.
- Planned for 0.41: forcing plugins on, managed-only hooks, "install = enable from the org marketplace", registering marketplaces, reading device-management or server-pushed settings.
How
One mapping table holds all vendor knowledge. Each row links an APM rule to a harness key, rates how their meanings compare (equal, narrower, wider, approximate) and cites the vendor doc. Only equal rows are written; UNMAPPED.md lists the rest. A row is equal only once a real-harness test shows an allowed item loading and a blocked one refused.
Each emitted key must be documented by two or more harnesses or a published standard. A new vendor adds rows, not code. Preflight reuses the apm status reader (#5745). The vendor is a command-line flag, so the policy file stays vendor-neutral.
Value
- Admins: one policy, compiled, plus a list of what each harness will not enforce.
- Developers: no false "installed"; the error names the blocking setting.
- Package authors: fewer "plugin missing" bug reports.
- Ecosystem: the mapping goes into the OpenAPM spec ([EPIC] OpenAPM specification and conformance: an open standard other tools can implement and test against #3620), so other tools can write identical files.
How it fits APM's principles
- One manifest, one lockfile, one policy: one policy file feeds every harness.
- Standards-first: only keys shared by harnesses or a standard.
- Honest evidence: written only when proven equal; the rest is listed.
- Unbound from harness binaries: preflight reads files only.
- Promises before features: each promise is a failing test first.
- Backward-compatible YAML: no key added or renamed.
Promises you can verify
- Every key
apm policy compilewrites traces to a rule proven equal; every other rule appears inUNMAPPED.md.
How we verify it: a test traces each key to its row; a planted approximate row must not be written. - The same policy always compiles to the same bytes.
How we verify it: compile twice and compare. - With
enforcement: warnoroff, compile writes nothing restrictive.
How we verify it: a test compiles in both modes and inspects the files. - When deployed managed settings block a plugin,
apm installexits 1, writes nothing and never reports success.
How we verify it: a test runs the real Claude Code under strict managed settings and checks exit code 1 and no file changes. - In the real harness, compiled files behave as mapped: allowed items load, denied items are refused.
How we verify it: real-harness tests for allowed, denied, warn and off cases. - Your existing
apm-policy.ymlbehaves exactly as before, and compile never writes a vendor-only key.
How we verify it: a sweep compares every test policy before and after, and checks emitted keys against the shared list.
Child issues
- Red-first: E07 + policy laws (incl. schema.backward_compatible, common_keys_only) #5762: policy promises as failing tests first.
- Vendor mapping table (Claude, Copilot) with evidence and behavior tests #5758: mapping table for Claude Code and Copilot, with evidence and tests.
- apm policy compile + --check + UNMAPPED.md #5759:
apm policy compile,--checkandUNMAPPED.md. - Install preflight against deployed managed files #5760: install preflight against deployed managed settings.
- Codex + Gemini rows (Codex: allowed_sources with restrict_to_allowed_sources=true) #5761: Codex and Gemini rows.
- User-scope (-g) org policy source: govern global installs consistently #3703: govern user-scope (global) installs with org policy.
- [FEATURE] Org policy: require a pinned version for registry MCP servers (mcp.require_pinned_version) #5542: require pinned versions for registry MCP servers.
- Policy inheritance: child layers should only narrow unmanaged_files.exclude #4935: inherited policy layers may only narrow excluded unmanaged files.
- Unmanaged-files gate: count config files for target roots the install creates and for user-scope bundles #5488, install: unmanaged-files gate should count MCP/LSP and hook config files an install creates #4956: count config files an install creates in the unmanaged-files check.
- [FEATURE] Route the install policy gate's root MCP re-declaration set through CurrentMcpConfigView #5644: one view of current MCP configuration for the policy check.
- [FEATURE] Per-package opt-out for hooks (e.g. --no-hooks / hooks: false in apm.yml) #1894: per-package opt-out for hooks.
- [FEATURE] Harness-specific consent for frontmatter hooks (Claude-first) #3227: per-harness consent for frontmatter (file header) hooks.
- Already done: [FEATURE] Support policy enforcement on non-GitHub remotes: add --policy to apm install (and/or auto-discovery for GitLab/ADO/plain git) #1925, [FEATURE] GitLab: support subgroup-scoped policy discovery (team-level apm-policy), not only the top-level group #2753, [BUG] require_pinned_constraint flags git semver ranges as bare branches: checks the resolved tag and rejects {name}-v{version} literal tags #3224, Hook files cannot be limited to a target: Copilot events leak into Claude settings #3226, [FEATURE] : Support multiple marketplaces (catalogs) in one repository #3319, [BUG] Audit reports false drift on freshly installed hooks #3369, [Feature] Support host-qualified dependency allow/deny patterns for multi-host enterprise environments #3509.
For contributors and agents
Waves and sizing (CTO). W1 (Claude + Copilot; M), W2 (Codex + Gemini; S-M). Milestone 0.40. Persona: S3 Amara.
Problem (V). Admins hand-write managed settings per vendor. APM never reads them, so in strict orgs apm install can report success for plugins the harness drops (APM's route uses a derived local directory marketplace, V native_plugins/claude_marketplaces.py:296).
Story S3, full output.
$ apm policy compile --vendor claude,copilot -o dist/policy/
[+] dist/policy/claude/managed-settings.json deniedMcpServers (1)
[i] dist/policy/copilot/managed-settings.json nothing EQUAL yet (file not written)
[!] not emitted (APM enforces at install only), see dist/policy/UNMAPPED.md:
mcp.allow -> allowedMcpServers: APPROX (Claude merges user allowlists; the proprietary
allowManagedMcpServersOnly that would close it is out by the absorb rule)
marketplace.allow: APPROX until a real-harness cell proves it (APM allows catalog origins;
Claude/Copilot allow marketplace sources; APM's own installs register a local directory)
copilot mcp.allow/deny: APPROX (trusted first-party servers exempt)
dependencies.*, security.*, executables.*: no vendor key
$ apm install foo@random # laptop with the deployed file
[x] foo@random: marketplace 'random' is not allowed by managed settings (claude). Nothing written.
IT deploys the files (MDM, root, GitHub server-managed). APM never claims to deploy them.
Scope in. Compile from existing keys only. marketplace.allow -> strictKnownMarketplaces starts APPROX (APM matches catalog-origin globs, not marketplace sources) and is promoted to EQUAL per row only when an F1 cell shows an allowed install loading and a disallowed one refused. mcp.deny -> deniedMcpServers (EQUAL on Claude); mcp.allow -> allowedMcpServers is APPROX (user lists can widen it; the closing key is Claude-proprietary). Copilot MCP rows are APPROX and listed. Emitted keys come only from the F0 common-keys set (absorb rule: >= 2 harnesses or a standard: enabledPlugins, extraKnownMarketplaces, strictKnownMarketplaces, mcpServers, allowedMcpServers, deniedMcpServers); vendor-proprietary keys are never emitted. enforcement: warn|off emits nothing restrictive. --check = artifact drift only. Preflight reads deployed managed files via the P1 reader.
Out (0.41). Force-enable, managed-only hooks, "install = enable from org marketplace", marketplace registration (extraKnownMarketplaces); MDM/server reads.
Architecture (CTO). One owner: policy/vendor_map.py rows (apm_key, target, client, vendor_key, transform, semantics EQUAL | NARROWER | WIDER | APPROX, min version, evidence_url). Emitter policy/vendor_compile.py (<= 250 LOC; JSON, TOML). Unmapped lists are derived. Only EQUAL rows emit. Guards: policy.vendor_keys_owner, policy.unmapped_derived, policy.common_keys_only (a row's vendor key must be in the F0 common-keys set). Each row needs a doc and an effective-behavior test.
YAML (additive, optional). Compile reads today's apm-policy.yml keys (V policy/schema.py; enforcement is off | warn | block); no new keys are required and none are renamed. Vendor selection is a CLI flag (--vendor), defaulting to the project's targets, so the policy file stays vendor-neutral.
Promises first.
| Promise | Oracle | Where |
|---|---|---|
P-LAW policy.compile_equal_only: every emitted key traces to an EQUAL row; the rest is listed |
row trace + seeded APPROX row | E01 known cell |
P-LAW policy.compile_deterministic |
I2 | E01 |
P-LAW policy.warn_off_emit_nothing_restrictive |
FS-DELTA, both modes | E01 |
P-LAW policy.effective_matches_mapping: allowed, denied, warn, off cases behave as mapped in the real harness |
F1 strict cells | expected.json |
P-LAW policy.preflight_never_reports_dropped_success |
O5 exit 1 + O9 empty | E07 + F1 |
P-LAW schema.backward_compatible: every current fixture apm-policy.yml parses to the same effective policy and install outcome |
parse-and-compare over fixture policies | tests/fixtures/ sweep |
P-LAW policy.common_keys_only: no emitted key outside the cited common set |
emitted-key set vs registry | E01 |
| E07 "Compile org policy to vendor managed settings" | O1, O2 | new journey |
Related: P-LAW policy.runtime_drop_is_reported (F1 strict cell: exit 1 + no writes) is green-owned by this epic. Mapping semantics spec: #5769 under #3620.
Children, done-when. Existing: #3703 (already a child), #5542, #4935, #5488, #4956, #5644; also listed: #1894, #3227; closed: #1925, #2753, #3224, #3226, #3319, #3369, #3509. New:
- Vendor mapping table (Claude, Copilot) with evidence and behavior tests #5758 "Vendor mapping table (Claude, Copilot) with evidence and behavior tests" -- done when each EQUAL row has a passing F1 cell and
marketplace.allowhas a promotion cell (red until proven). - apm policy compile + --check + UNMAPPED.md #5759 "apm policy compile + --check + UNMAPPED.md" -- done when E07 passes.
- Install preflight against deployed managed files #5760 "Install preflight against deployed managed files" -- done when the F1 strict cell flips to refused, exit 1.
- Codex + Gemini rows (Codex: allowed_sources with restrict_to_allowed_sources=true) #5761 "Codex + Gemini rows (Codex: allowed_sources with restrict_to_allowed_sources=true)" -- done when W2 rows pass.
- Red-first: E07 + policy laws (incl. schema.backward_compatible, common_keys_only) #5762 "Red-first: E07 + policy laws (incl. schema.backward_compatible, common_keys_only)" -- done when rows land failing.
Deps. F0 PR-A, P1 reader, F1 strict cells, F2 child 1 (journey index admits E07).
Epic codes: F0 = #3616, F1 = #5197, F2 = #5509, P1 = #5745, P2 = #3618, P3 = #3297. Evidence markers: V = verified in code at 20bd83d, I = inferred, D = vendor docs.
This epic is a plan. It is not a scope approval: each child needs its own apm-scope:v1 record (CONTRIBUTING).
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
11 remaining items
[-][EPIC] Policy compile: one APM policy to each vendor's managed settings, plus install preflight[/-][+][EPIC] Policy compile: turn one APM policy into each harness's managed settings, and check them before install[/+]danielmeppiel commentedon Dec 2, 2026
Closing as not planned. APM will not translate its policy into harness managed settings. The live policy work (choosing a policy source, enforcement coverage, user scope) continues in #5792.