Skip to content

agentstack apply

Terminal window
agentstack apply --profile-file <path> --to <tool> [--target-root <path>] [--dry-run]

apply is the provider materialization step.

Today it does three things:

  1. writes the native config files returned by the provider adapter
  2. materializes enabled local package skills into the provider skill directory when that provider has one in the current runtime mapping
  3. materializes provider instruction files for claude and gemini when you pass an explicit --target-root

Before overwriting any native config file, AgentStack creates a backup.

FlagTypeRequiredDescription
--profile-file <path>stringYesPath to the canonical agentstack.yaml
--to <tool>codex|claude|opencode|geminiYesTarget provider
--target-root <path>stringNoRoot directory used for explicit repo-root writes such as provider instruction files
--dry-runbooleanNoReturn the translation/materialization plan without writing files
  • codex -> ~/.codex/config.toml
  • claude -> ~/.claude/settings.json
  • opencode -> ~/.config/opencode/opencode.json
  • gemini -> ~/.gemini/settings.json

If your profile contains enabled local skills, apply also writes them to the provider skill dir used by the current runtime:

  • claude -> ~/.claude/skills/<skill-id>/SKILL.md
  • codex -> ~/.agents/skills/<skill-id>/SKILL.md
  • opencode -> ~/.opencode/skills/<skill-id>/SKILL.md
  • gemini -> ~/.gemini/skills/<skill-id>/SKILL.md

When --target-root is provided, apply can also copy provider instruction files from instructions.provider_files into the target repository root:

  • claude -> <target-root>/CLAUDE.md
  • gemini -> <target-root>/GEMINI.md

Current boundary:

  • this slice only supports claude and gemini
  • the source file must be declared in instructions.provider_files
  • without --target-root, AgentStack does not write these repo-root instruction files
Apply to Codex
agentstack apply \
--profile-file ~/.agentstack/profiles/main/agentstack.yaml \
--to codex
Preview apply plan for Claude
agentstack apply \
--profile-file ~/.agentstack/profiles/main/agentstack.yaml \
--to claude \
--dry-run
Apply to OpenCode using a custom root
agentstack apply \
--profile-file ./agentstack.yaml \
--to opencode \
--target-root /workspace
Apply Claude settings and project instruction file
agentstack apply \
--profile-file ~/.agentstack/profiles/main/agentstack.yaml \
--to claude \
--target-root /workspace/my-repo