Files
holocron/plugins/kyberforge/.apm/skills/apm-workflow/references/compile.md
Defame1297 1e8f0571cf fix(kyberforge): route primitive authoring from apm-workflow and agent-author
- reach the MCP ${VAR} secrets rule from the compile flow
- restore the Gotcha remedy for type: coverage
- route .apm/instructions and .apm/prompts to primitive-author
- agent-author: add the primitive-author boundary and the already-bumped
  skip, bump to 1.0.4

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
2026-09-29 08:00:32 +00:00

4.8 KiB

topic, source_keys
topic source_keys
compile
context7-microsoft-apm

Compile

apm compile                     # fails on skill/agent-only packages — see Gotchas
apm compile --clean             # zero-write sanity check; use for skill/agent-only packages
apm compile --clean --dry-run   # pure preview, no writes

Compiles .apm/instructions/ + .apm/agents/*.agent.md primitives into consumer-side context files (AGENTS.md/CLAUDE.md CONTEXT files) for the deployment target, per the compilation: block in apm.yml. This is the consumer/deployment side — it is NOT the producer of plugin.json/marketplace.json; that's apm pack's job (below). Run apm compile after any change to .apm/instructions//.apm/agents/ content or to compilation:/targets: in apm.yml.

Pack

apm pack --dry-run              # resolve and print; do not write
apm pack --offline              # cached refs only
apm pack --include-prerelease   # allow pre-release tags
apm pack -v                     # per-entry resolution detail
apm pack --marketplace=claude --json   # JSON output for CI pipelines

Bundles a producer package into a distributable artifact. Default to --dry-run -v first when packing something for the first time or after a dependency change — resolution errors surface before anything is written.

.mcp.json merge mechanics

apm pack reads a package's root-level .mcp.json directly — no dependencies.mcp entry in apm.yml is needed for simple passthrough. Behavior is content-aware:

  • An empty .mcp.json ({"mcpServers": {}}) is NOT included in the packed output at all.
  • A populated one gets its mcpServers content merged directly into the compiled plugin.json, but only for the claude target.
  • The copilot target's compiled plugin.json OMITS mcpServers entirely — it isn't part of Copilot's plugin manifest schema.

mcpServers headers and env must use ${VAR} indirection — the content is merged verbatim into the published plugin.json, so a literal secret ships with the package.

dependencies.mcp in apm.yml is for a different purpose — declaring a remote MCP-server package as an APM dependency — not local .mcp.json passthrough.

includes: auto and the packed bundle

includes: auto does NOT sweep generic root-level passthrough files (README.md, docs/, sources.md, config files, etc.) into the apm pack distribution bundle (build/<name>-<version>) — only .apm/ primitives, the compiled plugin.json, and the content-aware .mcp.json handling above make it into that bundle. This does not affect Claude Code's own plugin loading, which reads a plugin's working directory directly via its source: path in marketplace.json, not the apm pack bundle — but it matters for anyone relying on the packed bundle for distribution via apm install.

Run apm audit after compile/pack, not before — audit scans deployed/compiled output, not the source apm.yml manifest. Plain apm audit is not the CI-equivalent pass (that is apm audit --ci, which checks strictly more); see references/audit.md.

Publish

apm publish --package acme/my-skill --dry-run -v
apm publish --package acme/my-skill

Publishes a producer package (root containing apm.yml, .apm/, and optionally a registries: block) to a registry. Always dry-run with -v first — publishing is not trivially reversible once a version tag is claimed on a registry.

Publishing to a named registry requires apm experimental enable registries to have already run — see SKILL.md's Gotchas for the precondition and its silent-no-op failure mode.

Run

apm run <script> [--param key=value]

Executes a named script defined under scripts: in apm.yml, with --param substituting values into the script's parameters.

Gotchas

  • Plain apm compile HARD-FAILS with exit 1 and No instruction files found in .apm/ directory on any package that has skills/agents but no .apm/instructions/ content — the common case for a skill-only or skill+agent package. Use apm compile --clean as the zero-write sanity-check substitute: it sets allow_empty=True internally and exits 0 cleanly with zero writes; add --dry-run for a pure preview. compile ≠ pack — see above.
  • claude plugin validate --strict auto-scans every .md file directly under a compiled plugin's agents/ directory and treats it as an agent definition requiring frontmatter, independent of any manifest declaration (an empirically observed Claude Code platform behavior, not an apm mechanic). A non-agent .md file (notes, provenance record, README) that ends up under .apm/agents/ in the source tree will still fail validation once compiled to the claude target. Keep such files outside .apm/agents/ (e.g. at the package root), regardless of what apm.yml declares.