new#
Generate a local AgentPM workspace from a workflow template.
Overview#
agentpm new is the template consumer command. It can scaffold from:
- a published template package reference like
@namespace/nameor@namespace/name@version - a local template directory containing
agent.json - a direct local
agent.jsonpath
During scaffolding, AgentPM copies and renders files from the template, installs declared runnable dependencies, writes workspace metadata, and generates a runnable agent.lock.
agentpm new copies and renders files, but it does not execute
template-provided scripts, generated app code, package-manager commands, or
shell hooks during scaffolding.
Command synopsis#
agentpm new <template-ref> [target-dir] [--var <KEY=VALUE>]... [--quiet] [--token <PAT>]Arguments#
template-ref. One of:- a published template package like
@zack/research-template - a pinned published template like
@zack/research-template@0.1.0 - a local template directory like
./my-template - a direct local manifest path like
./my-template/agent.json
- a published template package like
target-dir(optional). Output directory for the generated project.--var <KEY=VALUE>. Generation-time variable override. Repeat as needed.--quiet. Suppress progress output; the created project, next step, and authored entrypoint commands remain on stdout, including in noninteractive scripts.--token <PAT>(env:AGENTPM_TOKEN). Personal Access Token for registry-backed template downloads.
Discover templates#
Workflow templates are first-class package kinds in the registry.
- Browse them in the registry search UI using the template filter.
- Use the landing page’s “Start Fast” section to find trending templates.
- Open a template detail page to inspect its README, execution surfaces, dependencies, and bootstrap command.
Published-template flow#
Generate from a published template:
agentpm new @zack/research-template my-project
cd my-project
# run the generated project's documented entrypointIf you omit the version, AgentPM resolves the latest matching published template version and records the exact source in .agentpm/template.json.
Successful generation reports Created project: my-project, followed by one
Next: line: run agentpm lint from the generated project, then review
my-project/README.md when that file exists, or the generated project otherwise.
Undeclared Template-provided Agent manifests are grouped under a single
Local manifests missing standard notice with their explicit lint commands.
Authored entrypoint commands are printed unchanged.
Displayed paths are relative to your working directory where possible. Registry
connection failures identify template generation as the operation, include recovery
guidance, and exit 1 rather than exposing a low-level endpoint as the main error.
Local-template flow#
Generate from a local template package directory:
agentpm new ./my-template ./my-template-testGenerate from a direct local manifest path:
agentpm new ./my-template/agent.json ./my-template-testThis is useful for template authoring and local verification before publish.
Variables and prompting#
Template variables are generation-time scaffold values, not runtime secrets.
--var key=valuealways wins.- Template defaults are used next.
project_nameis inferred fromtarget-dirwhen practical.- In an interactive terminal session, AgentPM prompts for any remaining required variables.
- In a non-interactive session, AgentPM fails clearly if a required variable still has no value.
Example:
agentpm new @zack/research-template my-project \
--var project_name=my-project \
--var report_topic="Q2 customer support trends"Do not put API keys, tokens, passwords, or other runtime secrets in
template.variables. Use .env.example plus runtime environment variables
instead.
What agentpm new writes#
The generated project includes:
agent.json— the generated root manifestagents/*.agent.json— additional local generated agent manifestsagentpm.workspace.json— committed workspace topologyagent.lock— runnable dependency lockfile for the generated workspace.agentpm/template.json— template origin metadata
agentpm.workspace.json#
agentpm.workspace.json is committed project metadata, not cache state. It describes:
- local manifest roots that belong to the workspace
- registry package roots, such as template-level agent dependencies
agentpm new currently writes this file for generated projects in general. It is especially important for multi-root projects, extra local agents/*.agent.json manifests, and template-level registry agent dependencies.
.agentpm/template.json#
.agentpm/template.json records where the scaffold came from.
- For published templates, it records the resolved package and integrity.
- For local templates, it records
source: "local"plus the source path.
This file is origin metadata. It is not part of agent.lock.
Multi-agent workspaces#
Templates may declare:
- direct tool dependencies in
template.dependencies.tools - direct agent package dependencies in
template.dependencies.agents - direct skill dependencies in
template.dependencies.skills - direct knowledge dependencies in
template.dependencies.knowledge - direct memory dependencies in
template.dependencies.memory - direct profile dependencies in
template.dependencies.profiles - one direct loop dependency in
template.dependencies.loop
They may also scaffold extra local manifests under agents/.
Generated projects handle those separately:
- the root
agent.jsonremains a normal single-agent manifest and can include resolvedtools[],skills[],knowledge[],memory[],profiles[], and singularloop - extra local generated agents live under
agents/ - registry agent package roots are recorded in
agentpm.workspace.json
AgentPM does not add recursive agents[] dependencies to normal kind: "agent" manifests.
Post-generation workflow#
After generation:
- edit the generated manifest files as needed
- run
agentpm install - let AgentPM regenerate
agent.lock
For generated workspace projects:
agentpm installrebuilds the lock from the manifest files and workspace topologyagentpm install <spec>is not supported inside those workspace projects- topology changes are made by editing manifests or
agentpm.workspace.json, then rerunningagentpm install
Upgrading generated local manifests#
agentpm new adds the supported APDS declaration to the root agent.json it
generates. From the generated project directory, run agentpm lint to validate
that root. A passing standalone check does not establish Runner readiness.
Additional agents/*.agent.json files come from the Template's authored content.
The CLI renders their variables but does not add declarations to them. If one
lacks standard, the completion output names the file, shows the declaration to
add and gives its lint command. These older files can still be consumed through
existing compatibility paths, but explicit authoring lint requires a declaration.
Before linting or preparing a generated local manifest for publication:
- For any undeclared file named in the completion notice, optionally run
agentpm lint --legacy agents/reviewer.agent.jsonfor a read-only compatibility preview, using its actual filename. An inferred input reportscompatibility: "legacy-unverified"without an APDS verdict; this is not publish authorization. - Review those local files and manually merge this root field into each existing
JSON object. For workspaces generated with an older CLI, also check the local
root
agent.jsonfor a missing declaration:
{
"standard": { "id": "agentpm", "version": "1.0.0" }
}- Run ordinary lint, using explicit filenames for the additional local manifests:
agentpm lint agent.json
agentpm lint agents/reviewer.agent.jsonUse the actual generated filenames; omit the second command if there are no
additional local manifests. Fix any remaining canonical validation errors before
publishing. --fix only adds a missing editor schema hint to otherwise valid
supported input; it never adds standard.
These edits apply to your generated local workspace. Do not modify installed
dependencies under .agentpm/, the downloaded Template, or historical published
versions. No historical republication is required. See
manifest migration for the full lint compatibility
and declaration rules.
Template authoring notes#
Template authors should maintain two different READMEs:
- root
README.md— for the registry page and template package docs template.files_root/README.md— for the generated project and any render-variable examples
The root generated agent.json is owned by agentpm new, so template authors should not place a root agent.json inside template.files_root.
If the template declares template.dependencies.loop, agentpm new resolves and installs that Loop and writes the exact resolved reference into the synthesized root agent.json → loop.
If a template wants additional local generated agents, place them under:
template/
agents/
reviewer.agent.json
triage.agent.jsonErrors and safety#
- If
target-direxists and is non-empty, generation fails before writing. - If generation fails after starting, AgentPM cleans up the partial target so the command is retryable.
- If a local template path is missing
agent.json, or if that manifest is notkind: "template", generation fails clearly.