apm init
Synopsis
Section titled “Synopsis”apm init [PROJECT_NAME] [OPTIONS]apm init --discover [OPTIONS]Description
Section titled “Description”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.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
PROJECT_NAME | Optional. 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 ... |
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
-y, --yes | off | Skip 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. |
--discover | off | Report admissible existing skill and package directories without changing files. Unsupported loose native rules, hooks, MCP configuration, and similar files are reported but not translated. Discovery checks root files and known target directories (for example .claude/, including their subdirectories); it does not search the rest of the project tree, so a file such as sub/CLAUDE.md is not listed. |
--format text|json|yaml | text | Select discovery report format. Used with --discover. |
--apply, --write | off | Run 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, --global | off | Discover 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. |
--name | directory name | Project name written to apm.yml for in-place init. Same rules as PROJECT_NAME. Ignored, with a warning, when PROJECT_NAME is given. |
--description | auto-detected | Project description written to apm.yml. |
--version | 1.0.0 | Project version written to apm.yml. Must not be empty. |
--author | git config user.name | Project author written to apm.yml. |
-v, --verbose | off | Show 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.
Examples
Section titled “Examples”Non-interactive scaffold of a new directory:
$ apm init my-app --yes[*] Created project directory: my-app[+] APM project initialized successfully!Created Files * apm.yml Project configurationScripted init with explicit metadata, in the current directory:
$ 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 configurationPin targets up front, skip the prompt:
$ apm init --yes --target copilot,claude,cursorDeclare an existing skill as a local package, then use the normal installer:
.claude/skills/review/|-- SKILL.md`-- references.mdapm init --discoverapm init --discover --applyapm install --target copilotThe merge adds the missing local reference without moving the source:
dependencies: apm: - path: ./.claude/skills/reviewThe 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.
Behavior
Section titled “Behavior”- Plain init files created:
apm.ymlonly. - Auto-detected fields:
name— fromPROJECT_NAMEor the current directory name. Falls back tomy-projectif the derived name is invalid (filesystem roots and other edge cases).author— fromgit config user.name, fallbackDeveloper.description— generated from project name.version—1.0.0.
- Plain init with existing
apm.yml: prints[!] apm.yml already existsand 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.
unsupportedmeans the file is not adopted as an APM package, not that it is invalid for its tool: a rootCLAUDE.md,AGENTS.md, orGEMINI.mdstays in place untouched. Discovery checks root files and known target directories (for example.claude/, including their subdirectories); it does not search the rest of the project tree, so a file such assub/CLAUDE.mdis not listed. - Structured reports: JSON and YAML reports include
scope,root,manifest,findings,additions, andapplied. Each finding includes its path, kind, status, reason, and proposed dependency when applicable. Status values aresupported,already-declared,managed,unsupported, andunsafe. - Discovery apply: creates or merges the consumer
apm.yml, adding only missingdependencies.apmlocal 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.ymlexists, the prompt pre-checks targets read from its existingtargets:list, or from the legacytarget:field rewritten to an equivalenttargets:list (for example,agentsbecomescopilotandagybecomesantigravity). A legacy target with notargets:equivalent (such asintellij) is not carried over:--yesand non-interactive runs exit1before writing; pass--targetto choose targets explicitly. The rewritten manifest is parsed back before it is written. - Codex hint: if
.codex/is present, suggests--target agent-skillsto also deploy skills to.agents/skills/. - Existing plugin sources: when plugin-native directories such as
skills/,agents/, orcommands/exist at the project root and.apm/does not, warns that they remain packable.apm initdoes not create.apm/automatically. - agentrc suggestion: when
agentrcis in PATH and no agent instruction files are found (.github/copilot-instructions.md,AGENTS.md,.github/instructions/), the Next Steps panel addsGenerate agent instructions: agentrc initafter the install step. Otherwise there is no mention. - Exit codes:
0on success or a declined plain-init prompt;1on invalid project name, empty--version, refused discovery apply, declined discovery consent, an existing legacy target with notargets:equivalent on a non-interactive re-init, or unhandled error. Discovery consent refusal leaves files unchanged. Invalid option combinations, including--discover --targetand--discoverwith a metadata flag, exit2.
Removed flags
Section titled “Removed flags”apm init --plugin and apm init --marketplace were removed in 0.37.
Both exit 2 without writing anything and name the replacement:
apm plugin initreplacesapm init --plugin, including--version,--authorand--description.--namehas no equivalent: pass the project name asPROJECT_NAME.apm marketplace initreplacesapm init --marketplace. Run it inside the project directory.
The refusal prints the full replacement command, keeping your project name,
--yes, --target and metadata flags.
Related
Section titled “Related”apm plugin init— scaffold a publishable plugin.apm marketplace init— scaffold a marketplace authoring block.apm install— next step: install dependencies and deploy to targets.- Quickstart — guided first project.
- Concepts: package anatomy —
what goes in
apm.yml.
Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.