Install packages
To add an APM package to your project, declare it in apm.yml under
dependencies.apm: and run apm install. APM resolves the graph,
scans every primitive, writes apm.lock.yaml, and deploys the result
into each agent harness directory you target.
apm install microsoft/apm-sample-packageThat command edits apm.yml, fetches the package, walks its
transitive deps, runs the security scan, writes the lockfile, and
integrates skills, prompts, instructions, agents, hooks, and commands
into every detected harness. The next contributor runs bare
apm install and gets the same bytes, pinned by commit and content
hash.
This page covers APM packages. For MCP servers, see Install MCP servers. For local bundles, see Deploy a bundle.
Add a dependency
Section titled “Add a dependency”Two ways. They produce the same apm.yml.
With the CLI. Pass the package as a positional argument. APM
resolves it, validates it, and appends it to dependencies.apm: in
apm.yml:
apm install microsoft/apm-sample-package#v1.0.0apm install github/awesome-copilot/skills/review-and-refactorapm install ./packages/my-shared-skills # local pathapm install --dev acme/internal-debug-agents # devDependenciesBy editing apm.yml. Add entries under dependencies.apm: then
run bare apm install:
name: my-projectversion: 0.1.0dependencies: apm: - microsoft/apm-sample-package#v1.0.0 - github/awesome-copilot/skills/review-and-refactor - https://gitlab.com/acme/coding-standards.git - ./packages/my-shared-skillsdevDependencies: apm: - acme/internal-debug-agentsapm installSupported reference forms: owner/repo shorthand (with optional
#ref for a tag, branch, or commit), full HTTPS or SSH git URLs,
virtual subdirectory paths into a monorepo, single-file references,
and local paths starting with ./, ../, or /. For private hosts
and tokens, see Authentication.
What apm install does
Section titled “What apm install does”The pipeline is deterministic. Each phase must pass before the next runs.
- Resolve. Walk
dependencies.apm:anddevDependencies.apm:, follow transitive deps, pick versions. - Policy gate. If
apm-policy.ymlis in scope (locally or via your org), every resolved dependency is checked against the allow-list before anything touches disk. Skip with--no-policyfor a single invocation; this does not bypassapm audit --ci. - Scan. The pre-deploy security scan inspects every primitive
for hidden Unicode (zero-width characters, bidi controls, tag
characters). Critical findings block the install. Override with
--force. - Integrate. Write primitives into each target harness’s native
directory (
.github/,.claude/,.cursor/,.opencode/,.codex/,.gemini/,.windsurf/) and the cross-tool.agents/skills/directory. - Lockfile. Write
apm.lock.yamlwith pinned versions, content hashes, and the resolved dependency set.
For the deeper view of how compile fits in, see Lifecycle.
Where files land
Section titled “Where files land”APM detects which harnesses your project uses and deploys to all of them. Detection priority:
--target <slug>flag (highest).- The
targets:field inapm.yml. - Auto-detect: any harness directory (
.github/,.claude/,.cursor/,.opencode/,.codex/,.gemini/,.windsurf/) that already exists in the workspace. - Fallback: minimal output to
AGENTS.mdonly.
Pin targets explicitly when you want reproducibility across machines:
name: my-projecttargets: - copilot - claude - cursorFor the full reach map of which primitive lands where on each harness, see Primitives and targets.
Transitive dependencies and the lockfile
Section titled “Transitive dependencies and the lockfile”apm install resolves the full dependency graph, not just your
top-level entries. Versions and content hashes are pinned in
apm.lock.yaml so every contributor and CI run installs the exact
same bytes. Commit the lockfile.
Transitive APM packages flow through automatically. Transitive
MCP servers are gated: if a deep dependency declares a new MCP
server, install pauses and asks you to re-declare it in your
top-level apm.yml. Use --trust-transitive-mcp to skip this in
trusted environments. See
Drift and secure-by-default for
the rationale.
Inspect what got installed
Section titled “Inspect what got installed”apm list # list scripts declared in apm.ymlapm view <package> # details for one installed packageapm view reads from apm.lock.yaml and apm_modules/ — use it to
confirm what shipped without re-running install. apm list shows the
runnable scripts your manifest exposes (see
Run scripts).
Useful flags
Section titled “Useful flags”apm install --dry-run # resolve and print the plan; no writesapm install --target claude,cursor # only deploy to these harnessesapm install --exclude gemini # deploy to all targets except geminiapm install --only apm # skip MCP server integration this runapm install --frozen # CI: lockfile-only; fail on driftapm install --refresh # bypass the cache; re-fetch everythingapm install --dev # treat positional args as devDependenciesapm install -g <package> # install to user scope (~/.apm/)apm install -v # verbose: show resolution and integrationFor the full flag reference, run apm install --help or see
CLI commands.
When things go wrong
Section titled “When things go wrong”- Critical security finding. Install aborts with the offending
characters and file path. Patch upstream when you can; use
--forceonly when you can document the exception. - Policy violation. Install aborts before any file is written. Adjust the dependency or update org policy. See Governance on the consumer ramp.
- Auth failure on a private repo. Set
GITHUB_APM_PATor the matching host token. See Authentication and Private and org packages. - Drift between
apm_modules/and the lockfile. Runapm audit --cilocally to reproduce the CI gate; see Update and refresh to recover.
Once your dependencies are installed, scripts run them.
Run scripts shows how to wire apm.yml’s
scripts: block to invoke compiled prompts in any harness.