Recipe CLI Quick Reference¶
One-page cheat sheet for the amplihack recipe CLI commands.
Core Commands¶
# List recipes
amplihack recipe list # All recipes
amplihack recipe list --long # With details
amplihack recipe list --format json # JSON output
# Run recipe
amplihack recipe run <recipe> --context '{"key": "value"}'
amplihack recipe run <recipe> --context-file context.json
amplihack recipe run <recipe> --dry-run # Preview only
# Validate recipe
amplihack recipe validate <file> # Check syntax/structure
amplihack recipe validate <file> --strict # Warnings as errors
# Show recipe details
amplihack recipe show <recipe> # Full details
amplihack recipe show <recipe> --format json
amplihack recipe show <recipe> --steps-only
Common Recipes¶
| Recipe | Steps | Purpose |
|---|---|---|
default-workflow |
22 | Full development (requirements → merge) |
quick-fix |
4 | Fast bug fixes |
investigation |
6 | Understand existing code |
code-review |
5 | Multi-perspective review |
security-audit |
7 | Security analysis |
verification-workflow |
8 | Post-implementation testing |
Context Variables¶
Pass runtime values using key=value format:
Common variables:
task_description- What to implement (usually required)repo_path- Repository root (default:.)branch_name- Git branch overridepr_number- Pull request numberfocus_area- Directory to analyze
Variable Substitution¶
Use {{var_name}} in recipe YAML to reference context variables. The runner automatically normalises quoting — write {{var}} directly without wrapping in quotes:
# Correct — runner handles quoting automatically
command: echo {{task_description}}
command: git checkout -b {{branch_name}}
# Also accepted — runner strips the extra quotes
command: echo "{{task_description}}" # normalised to: echo {{task_description}}
Quoting auto-normalisation was added in PR #3140.
Run Options¶
--dry-run # Preview without executing
--adapter <name> # Force adapter: claude, copilot, cli
--resume-from <step> # Resume from step ID
--stop-at <step> # Stop after step ID
--output <file> # Save execution log
--interactive # Approve each step
--verbose, -v # Detailed output
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Validation failed or recipe not found |
| 2 | Missing context variable |
| 3 | Step execution failed |
| 4 | Agent not found |
| 5 | Adapter not available |
| 130 | User interrupted (Ctrl+C) |
Environment Variables¶
export AMPLIHACK_RECIPE_PATH="/custom/recipes:/team/recipes"
export AMPLIHACK_AGENT_BINARY=copilot # Agent CLI for agent steps (see below for the default)
AMPLIHACK_AGENT_BINARY¶
Sets the agent binary used for agent steps. It must be one of claude,
copilot, codex or amplifier; anything else, including a path, is
rejected. When it is unset, amplihack uses the session markers of the CLI you
are running in, then a fresh .claude/runtime/launcher_context.json, then the
default, copilot, and amplihack recipe run prints a notice when it had to
infer the answer. amplihack agent-binary prints the current answer and why.
A detached launch (tmux new-session -d) does not see your session markers.
It sees the tmux server's, copied from whatever started the server, which may
be another CLI's. Hand the answer over with $(amplihack agent-binary --shell),
which also removes those markers, as in the dev-orchestrator skill's
reference.md (#1525). Put it inside the double-quoted tmux command: in single
quotes it expands in the new session and reads the server's markers.
This makes amplihack agent-agnostic: amplihack <command> will use the configured binary for all agent subprocess calls (skills, recipes, orchestrator). Added in PR #3174.
Codex agent steps¶
With AMPLIHACK_AGENT_BINARY=codex, each agent step runs as
amplihack codex -- exec …, and amplihack adds these flags
directly after exec:
The reasons:
- Codex agent steps run with the same trust as Claude agent steps, which use
--dangerously-skip-permissions(issue #2317). A step in a linked git worktree can then commit, because the worktree's index and refs under the main checkout's.git/are writable. - The amplihack PreToolUse hooks apply the same deny rules to both harnesses. They check commands; they are not a sandbox.
- Codex skips an untrusted hook without saying so, which would turn off the command-check hook (software-factory #149) for every step.
The rules: the caller's own sandbox choice in the step's arguments wins (no
--sandbox is then added); amplihack adds no network override and never adds
--dangerously-bypass-approvals-and-sandbox or --yolo; interactive
amplihack codex sessions are unchanged. Prompt text must reach Codex on
stdin, never in argv. Agent steps should run only in trusted checkouts with
trusted task text: a step can write .codex/hooks.json, ~/.codex/ and
.git/hooks, and because hook trust is bypassed, a hook it plants runs in
later steps without a prompt. The full rules, the exec resume placement and
the preconditions are in
Sandbox and hook trust for agent steps.
Quick Examples¶
Development Workflow¶
# Full feature implementation
amplihack recipe run default-workflow \
--context task_description="Add JWT auth" \
--context repo_path="."
# Fast bug fix
amplihack recipe run quick-fix \
--context task_description="Fix null pointer in UserService"
# Code investigation
amplihack recipe run investigation \
--context task_description="How does auth work?" \
--context focus_area="src/auth/"
Testing & Validation¶
# Validate before running
amplihack recipe validate my-recipe.yaml
# Preview execution (supports conditional steps and JSON parsing)
amplihack recipe run my-recipe --dry-run \
--context target="src/api"
# Run verification suite
amplihack recipe run verification-workflow \
--context repo_path="."
CI/CD Integration¶
# Check exit code
amplihack recipe run verification-workflow \
--context repo_path="." \
--context branch_name="main"
if [ $? -eq 0 ]; then
echo "Tests passed"
fi
# Save execution log
amplihack recipe run default-workflow \
--context task_description="Deploy to staging" \
--context repo_path="." \
--output execution-log.json
Recipe Discovery¶
Recipes discovered from (in priority order):
amplifier-bundle/recipes/- Bundled recipesamplifier-bundle/recipes/- Package recipes~/.amplihack/.claude/recipes/- User recipes.claude/recipes/- Project recipes$AMPLIHACK_RECIPE_PATH- Custom paths
Later paths override earlier ones.
Adapter Selection¶
Auto-detected based on available CLIs:
- Claude Agent SDK (if
claudeCLI found) - GitHub Copilot SDK (if
copilotCLI found) - CLI subprocess (fallback, always available)
Override with --adapter <name>.
Common Patterns¶
Resume after failure¶
# Initial run fails at step 15
amplihack recipe run default-workflow \
--context task_description="Add feature" \
--context repo_path="."
# Fix issue, resume from step 15
amplihack recipe run default-workflow \
--context task_description="Add feature" \
--context repo_path="." \
--resume-from step-15
Partial execution¶
# Run only first 5 steps
amplihack recipe run default-workflow \
--context task_description="Test first phase" \
--context repo_path="." \
--stop-at step-5
Interactive approval¶
Load context from file¶
# Create context file
cat > context.json <<EOF
{
"task_description": "Add webhooks",
"repo_path": ".",
"branch_name": "feat/webhooks"
}
EOF
# Use it
amplihack recipe run default-workflow --context-file context.json
Override context variables¶
# Base context + overrides
amplihack recipe run default-workflow \
--context-file base-context.json \
--context branch_name="feat/custom-branch"
Troubleshooting¶
Recipe not found¶
# List available recipes
amplihack recipe list
# Check recipe paths
ls ~/.amplihack/.claude/recipes/*.yaml
ls .claude/recipes/*.yaml
Missing context variable¶
# Show required context
amplihack recipe show <recipe>
# Provide all required variables using key=value format
amplihack recipe run <recipe> \
--context required_var="value" \
--context another_var="value2"
Agent not found¶
# List available agents
ls ~/.amplihack/.claude/agents/amplihack/*.md
# Fix recipe to use valid agent name
# amplihack:architect (not amplihack:unknown-agent)
Step fails¶
# Run with verbose output
amplihack recipe --verbose run <recipe> \
--context task_description="Debug this issue"
# Save execution log for debugging
amplihack recipe run <recipe> \
--context task_description="Debug this issue" \
--output debug.json
See also:
- Recipe CLI Commands How-To - Task-oriented usage guide
- Recipe CLI Reference - Complete command documentation
- Recipe CLI Examples - Real-world scenarios
- Recipe Runner Overview - Architecture and YAML format