Files
holocron/plugins/kyberforge/skills/apm-workflow/references/compile.md
Defame1297 1e4aab53a7 refactor(kyberforge): retrofit apm-workflow to the ADR-0020 contract
Description 817 -> 324 chars, body 421 -> 237 words, Gotchas 6 -> 2.

The five capability clauses, the second trigger register and the prose
boundary form go; one trigger clause, the indirect trigger and one
boundary clause remain. Four of six Gotchas move into the flow file that
every branch needing them already loads.

Two stay in the always-loaded body because a dispatch body must carry the
gates common to every branch, not just the dispatch table: the MCP secret
indirection rule, and the `apm experimental enable registries`
precondition. The first pass moved registries into references/configure.md
alone, which stranded it -- references/compile.md documents publishing to a
registry and references/install.md resolves dependencies through one, and
neither points at configure.md. Declaring a registry without the
precondition is a silent no-op, so the failure had no signal.

Also drops an unsourced claim the compression pass introduced (that apm
checks `type:` going forward -- no source supports it), corrects the MCP
rationale to install *or* runtime per configuration.md:98, and repoints
two apm-orchestrate back-references that pointed at body Gotchas which had
moved.

Refs #99

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MWb5RQgCL1ye7cGp2RPb2u
2026-08-30 16:31:11 +00:00

4.4 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.

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.

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.