Skip to content

apm init

Terminal window
apm init [PROJECT_NAME] [OPTIONS]
apm init --discover [OPTIONS]

Creates a minimal apm.yml in the current directory or in a new PROJECT_NAME subdirectory. Auto-detects name, author, and description so you can start running apm install immediately. With --yes, --name, --description, --version, and --author set those apm.yml fields without prompts.

With --discover, inventories existing skill and package directories in recognized layouts. It does not copy, translate, or execute their content. Add --apply (or --write) to merge missing local package references into apm.yml; --apply implies --discover.

To scaffold a plugin, use apm plugin init; to add a marketplace authoring block, use apm marketplace init.

ArgumentDescription
PROJECT_NAMEOptional. Name of a new directory to create and cd into. Pass . to initialize in the current directory (same as omitting). Must be non-blank (not empty or whitespace-only), must not contain / or \, and must not be ...
FlagDefaultDescription
-y, --yesoffSkip interactive prompts. Plain apm init --yes keeps its existing behavior and overwrites an existing apm.yml; with --discover --apply, it consents to a merge instead.
--discoveroffReport admissible existing skill and package directories without changing files. Unsupported loose native rules, hooks, MCP configuration, and similar files are reported but not translated.
--format text|json|yamltextSelect discovery report format. Used with --discover.
--apply, --writeoffRun discovery, then create or merge the consumer apm.yml with missing dependencies.apm local path references. Implies --discover. Requires consent unless --yes is set.
-g, --globaloffDiscover user-scope packages. Applied local references use installer-compatible absolute or home-rooted paths, not project-relative paths.
--target(prompt)Comma-separated target list for normal initialization. It cannot be combined with --discover; select deployment targets on the later apm install. Stable manifest targets include copilot, claude, grok-build, cursor, opencode, codex, gemini, antigravity, windsurf, kiro, agent-skills, and the explicit-only hermes and grok-bot; all expands the default stable set.
--namedirectory nameProject name written to apm.yml for in-place init. Same rules as PROJECT_NAME. Ignored, with a warning, when PROJECT_NAME is given.
--descriptionauto-detectedProject description written to apm.yml.
--version1.0.0Project version written to apm.yml. Must not be empty.
--authorgit config user.nameProject author written to apm.yml.
-v, --verboseoffShow detailed output.

Metadata flags set their field directly with --yes. Without --yes (including piped, non-TTY input), they become the prompt defaults, so an empty answer keeps the flag value. Values are trimmed like prompt answers. They cannot be combined with --discover.

Target precedence: --target flag > interactive prompt > auto-detect at compile time (used with --yes or in non-TTY shells).

init writes only manifest-safe stable targets, canonicalizing aliases first. For example, --target agents and --target vscode persist copilot, --target agy persists antigravity, and --target all expands to the default stable set. --target intellij names an IDE, not a target: init exits 1 before writing anything (use copilot for GitHub Copilot in JetBrains IDEs). Experimental selectors such as grok-cloud are accepted by the shared CLI target parser but are not persisted in apm.yml; enable them, then select them with apm install --target grok-cloud.

Non-interactive scaffold of a new directory:

Terminal window
$ apm init my-app --yes
[*] Created project directory: my-app
[+] APM project initialized successfully!
Created Files
* apm.yml Project configuration

Scripted init with explicit metadata, in the current directory:

Terminal window
$ apm init --yes --name my-app --description "Team agent setup" --version 0.1.0 --author "Jane Dev"
[+] APM project initialized successfully!
Created Files
* apm.yml Project configuration

Pin targets up front, skip the prompt:

Terminal window
$ apm init --yes --target copilot,claude,cursor

Declare an existing skill as a local package, then use the normal installer:

.claude/skills/review/
|-- SKILL.md
`-- references.md
Terminal window
apm init --discover
apm init --discover --apply
apm install --target copilot

The merge adds the missing local reference without moving the source:

dependencies:
apm:
- path: ./.claude/skills/review

The ordinary install routes the shared skill to .agents/skills/review/. APM does not convert the skill to another standard; the author and target harness remain responsible for compliance.

  • Plain init files created: apm.yml only.
  • Auto-detected fields:
    • name — from PROJECT_NAME or the current directory name. Falls back to my-project if the derived name is invalid (filesystem roots and other edge cases).
    • author — from git config user.name, fallback Developer.
    • description — generated from project name.
    • version — 1.0.0.
  • Plain init with existing apm.yml: prints [!] apm.yml already exists and prompts to overwrite. With --yes, overwrites without asking.
  • Discovery: reports existing admissible skill or package directories. Loose native rules, hooks, MCP configuration, and other unsupported content remain unsupported; discovery never translates or executes content.
  • Structured reports: JSON and YAML reports include scope, root, manifest, findings, additions, and applied. Each finding includes its path, kind, status, reason, and proposed dependency when applicable. Status values are supported, already-declared, managed, unsupported, and unsafe.
  • Discovery apply: creates or merges the consumer apm.yml, adding only missing dependencies.apm local path references. It leaves source content in place and creates no .apm/ copies. Reruns do not duplicate references or overwrite source files. Noninteractive apply requires --yes. Later installs still use the normal collision policy.
  • Sharing local references: project-relative sources must exist at the same path for teammates who run apm install. Global references use absolute or home-rooted paths accepted by the installer.
  • Target seeding on re-init: when apm.yml exists, the prompt pre-checks targets read from its existing targets: list, or from the legacy target: field rewritten to an equivalent targets: list (for example, agents becomes copilot and agy becomes antigravity). A legacy target with no targets: equivalent (such as intellij) is not carried over: --yes and non-interactive runs exit 1 before writing; pass --target to choose targets explicitly. The rewritten manifest is parsed back before it is written.
  • Codex hint: if .codex/ is present, suggests --target agent-skills to also deploy skills to .agents/skills/.
  • Existing plugin sources: when plugin-native directories such as skills/, agents/, or commands/ exist at the project root and .apm/ does not, warns that they remain packable. apm init does not create .apm/ automatically.
  • agentrc suggestion: when agentrc is in PATH and no agent instruction files are found (.github/copilot-instructions.md, AGENTS.md, .github/instructions/), the Next Steps panel adds Generate agent instructions: agentrc init after the install step. Otherwise there is no mention.
  • Exit codes: 0 on success or a declined plain-init prompt; 1 on invalid project name, empty --version, refused discovery apply, declined discovery consent, an existing legacy target with no targets: equivalent on a non-interactive re-init, or unhandled error. Discovery consent refusal leaves files unchanged. Invalid option combinations, including --discover --target and --discover with a metadata flag, exit 2.

apm init --plugin and apm init --marketplace were removed in 0.37. Both exit 2 without writing anything and name the replacement:

  • apm plugin init replaces apm init --plugin, including --version, --author and --description. --name has no equivalent: pass the project name as PROJECT_NAME.
  • apm marketplace init replaces apm init --marketplace. Run it inside the project directory.

The refusal prints the full replacement command, keeping your project name, --yes, --target and metadata flags.

Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.