ai-autopilot is a CLI that turns one explicit task input into a full issue-to-PR workflow.
You give it a source (issue, markdown task, prompt, Trello URL, Slack URL), and it runs a structured pipeline with artifacts at every step.
Pipeline:
research -> plan -> plan-annotations (optional) -> plan-review-loop -> plan-implementation -> implement -> review -> pr-description -> create-pr (optional) -> remove-label (GitHub issue only)
Core capabilities:
- Accepts multiple source types: GitHub issue number/URL, markdown file, direct prompt, Trello URL, Slack URL.
- Writes traceable artifacts under
.auto-pr/<repo-short>/<task-id>/. - Supports runner selection (
claude/opencode) plus per-step model overrides. - Supports lifecycle hooks (
beforeStep,afterStep,onNeedInput) for notifications/automation. - Supports profiles (
--profile) and one-off overrides (--runner,--model,--pr-creation,--until). - Supports resume by source or exact task id (
--resume --id ...) which is helpful for UUID runs. - Auto-detects and reuses the original worktree on
--resume --idwhen task artifacts are in a worktree. - Supports configurable worktree base directory via
worktreeBaseDirinconfig.json.
Artifacts created per run:
initial-ramblings.mdresearch.mdplan.mdplan-review.mdplan-review-summary.mdplan-implementation.mdcompleted-summary.mdreview.mdpr-description.md
Review-round flow also uses:
pr-review-comments.mdreview-round-summary.md
# Prompt input
bun run ai-autopilot --source "update AGENTS.md"
# GitHub issue number
bun run ai-autopilot --source "123" --repo owner/repo
# Markdown task
bun run ai-autopilot --source "md:tasks/new-feature.md"
# Trello card URL (requires sourceCommands.trello)
bun run ai-autopilot --source "https://trello.com/c/abc12345"
# Slack thread URL (requires sourceCommands.slack)
bun run ai-autopilot --source "https://workspace.slack.com/archives/C12345678/p1732456789012345"
# Pause after plan
bun run ai-autopilot --source "md:tasks/new-feature.md" --until plan
# Resume exact UUID run by task id
bun run ai-autopilot --resume --id "prompt-update-agents-md-a1b2c3d4" --repo sample-repo
# Force runner for one run
bun run ai-autopilot --source "md:tasks/new-feature.md" --runner claudeStart the run, resolve the source, prepare a worktree, and create a task id. Next step is Research.
Example artifact: initial-ramblings.md
$ apr --with-uuid --source "update AGENTS.md" --runner claude
βΊ Detected repo: acme/sample-repo
βΊ Config home: /home/you/tools/ai-autopilot
βΊ Runner: claude | Model: sonnet | Step overrides: 9
Create and use git worktree(s) for this run? [y/N] y
βΊ Worktree mode enabled (base: /home/you/.cache/ai-autopilot/worktrees/acme-sample-repo)
β No source type matched β treating as prompt: "update AGENTS.md"
βΊ Reset state at .auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4 (use --resume to keep it)
βΊ Syncing with remote...
βΊ Processing 1 source(s)...
βΊ Using worktree for acme/sample-repo:prompt-update-agents-md-a1b2c3d4: /home/you/.cache/ai-autopilot/worktrees/acme-sample-repo/sample-repo-prompt-update-agents-md-a1b2c3d4
βΊ Pipeline starting for acme/sample-repo:prompt-update-agents-md-a1b2c3d4: update AGENTS.md
βΊ Task ID: prompt-update-agents-md-a1b2c3d4
βΊ Saved initial-ramblings.md
Research gathers context and writes research.md. Next step is Plan.
Example artifact: research.md
β Research Β· task prompt-update-agents-md-a1b2c3d4 ...
βΊ Step research β model: sonnet (step)
βΊ Done β $0.7654 | 13 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
Research complete. Written to `.auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/research.md`.
Key findings:
- The issue is a documentation restore-and-refine task
- Reference implementation exists on a sibling branch
- Scope is docs-only; verification is editorial
- Only `AGENTS.md` needs substantive changes
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Plan decides approach and scope. Next step is Plan-Implementation.
Example artifact: plan.md
β Plan Β· task prompt-update-agents-md-a1b2c3d4 ...
βΊ Step plan β model: opus (step)
βΊ Done β $0.3754 | 8 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
Plan written to `.auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/plan.md`.
Plan summary:
- Single atomic replacement of `AGENTS.md`
- Mandatory-first-step flow diagram and wording refinements
- No changes required in `CLAUDE.md` / `WHOAMI.md`
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Plan-Implementation turns the plan into a checklist. Next step is Implement.
Example artifact: plan-implementation.md
β Plan-Implementation Β· task prompt-update-agents-md-a1b2c3d4 ...
βΊ Step planImplementation β model: opus (step)
βΊ Done β $0.2468 | 6 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
Written `.auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/plan-implementation.md` with two tasks:
1. Replace `AGENTS.md` with all documented refinements.
2. Run three-tier verification (manual checks + diff walkthrough).
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Implement applies changes; checkpoint gives the exact resume command if you answer No. Next step is Review.
Example artifact: completed-summary.md
β Implement Β· task prompt-update-agents-md-a1b2c3d4 ...
Implementation checkpoint
Β· Review .auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/plan-annotations.md before answering
Β· Answer No -> run: bun run ai-autopilot --resume --id "prompt-update-agents-md-a1b2c3d4" --repo "sample-repo"
Β· Start only when plan + checklist look final
Start implementation for acme/sample-repo:prompt-update-agents-md-a1b2c3d4? [y/N] y
βΊ Implementation iteration 1/100
βΊ Step implement β model: sonnet (step)
βΊ Done β $0.9230 | 26 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
All tasks complete:
- Replaced `AGENTS.md` with the full guidance document
- Applied the planned eight refinements
- Completed three-tier verification
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΊ Implementation complete after 1 iteration(s)
Review validates plan compliance and output quality. Next step is PR Description.
Example artifact: review.md
β Review Β· task prompt-update-agents-md-a1b2c3d4 ...
βΊ Step review β model: opus (step)
βΊ Done β $0.3636 | 13 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
Review written to `.auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/review.md`.
Status: PASS β no issues found. Planned refinements are present and no unrelated files changed.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PR Description writes pr-description.md. Next step is optional Create PR.
Example artifact: pr-description.md
β PR Description Β· task prompt-update-agents-md-a1b2c3d4 ...
βΊ Step prDescription β model: opus (step)
βΊ Done β $0.1816 | 4 turns
ββ agent output ββββββββββββββββββββββββββββββββββββββββ
PR description written to `.auto-pr/sample-repo/prompt-update-agents-md-a1b2c3d4/pr-description.md`.
## Summary
### Why this change was made
`AGENTS.md` was stripped to a single heading when skill docs were removed.
### Description
This PR restores `AGENTS.md` and makes skill invocation unconditionally first.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Create PR is optional (ask mode shown). Then the run prints a final summary.
Create PR for acme/sample-repo:prompt-update-agents-md-a1b2c3d4? [y/N] n
βΊ PR creation declined
β Remove Label Β· task prompt-update-agents-md-a1b2c3d4 ... [skip]
βΊ Pipeline complete for acme/sample-repo:prompt-update-agents-md-a1b2c3d4
βΊ Summary for acme/sample-repo:prompt-update-agents-md-a1b2c3d4 β $2.8557 | 70 turns | 6 agent run(s)
Full artifact examples:
bungitgh(for GitHub issue/PR operations)opencodeorclaudeCLI (depends on runner)
bun install
cp ./config.example.json ./config.jsonai-autopilot loads config/templates/sources from AUTO_PR_HOME using this order:
--home <dir>AUTO_PR_HOME=<dir>- Directory next to packaged binary (if it has
prompt-templates/) - Source directory (dev mode)
~/.config/ai-autopilot(falls back to~/.config/auto-prif present)
alias ai-autopilot='bun run /absolute/path/to/ai-autopilot/index.ts'bun run ai-autopilot --source "<task-input>" [--repo owner/repo]--source "123"(GitHub issue number)--source "https://github.com/owner/repo/issues/123"--source "md:tasks/feature.md"or--source "tasks/feature.md"--source "prompt:update onboarding docs"or plain text--source "https://trello.com/c/..."(viasourceCommands.trello)--source "https://workspace.slack.com/archives/..."(viasourceCommands.slack)
Runner selection:
--runner claude--runner opencode
Config example:
{
"agentRunner": "opencode",
"models": {
"opencode": {
"default": "openai/gpt-5.1-codex",
"steps": {
"plan": "openai/gpt-5.3-codex",
"planReview": "openai/gpt-5.1-codex",
"implement": "openai/gpt-5.3-codex-spark"
}
}
}
}The iterative plan review loop runs after plan and before plan-implementation. Configure models.<runner>.steps.planReview to use a different model for the reviewer.
Relative sourceCommands paths resolve from AUTO_PR_HOME.
A source command must print normalized JSON:
{
"id": "source-task-id",
"title": "Task title",
"body": "Full task context",
"repo": "owner/repo",
"scopePath": ".",
"number": 123
}Hook points:
hooks.beforeStep.<step>hooks.afterStep.<step>hooks.onNeedInput
Template variables: {{step}}, {{issue}}
{
"hooks": {
"onNeedInput": "osascript -e 'display notification \"ai-autopilot needs your input\" with title \"ai-autopilot\" sound name \"Glass\"'",
"afterStep": {
"review": "osascript -e 'display notification \"Review complete for {{issue}}\" with title \"ai-autopilot\"'"
}
}
}Hook failures are warnings only; they do not stop the pipeline.
Merge order:
base config -> profile -> CLI flags
Example:
{
"profiles": {
"work": {
"agentRunner": "claude",
"until": "plan",
"promptDir": "prompts/work"
}
}
}worktreeBaseDir controls where task worktrees are created. It accepts absolute paths, ~/..., or paths relative to AUTO_PR_HOME.
{
"askWorktreeStart": true,
"worktreeBaseDir": "~/.cache/auto-pr/worktrees"
}planReviewLoopEnabled toggles iterative review and planReviewMaxRounds sets the cap before failing the run.
{
"planReviewLoopEnabled": true,
"planReviewMaxRounds": 3
}# Rebase stale PR branch for issue
bun run ai-autopilot --refresh --issue 42 --repo owner/repo
# Address PR review feedback
bun run ai-autopilot --review-round --issue 42 --repo owner/repo# Build
bash ./build-standalone.sh
# Optional output directory
bash ./build-standalone.sh ./dist/ai-autopilot
# Run packaged binary
cp ./dist/ai-autopilot/config.example.json ./dist/ai-autopilot/config.json
AUTO_PR_HOME="./dist/ai-autopilot" "./dist/ai-autopilot/ai-autopilot" --helpbun run ./check-integrity.ts
bun run ai-autopilot --helpindex.ts: CLI entrypoint and argument handlingpipeline.ts: pipeline step orchestrationsteps/: pipeline step implementationsprompt-templates/: prompt files for agent-driven stepssources/: source input resolvers and adaptersutils.ts: config loading, runner execution, hooks, helper utilitiescheck-integrity.ts: checks step/template/config consistency
- How I use Claude Code β initial idea
- franciscohermida/auto-pr β initial project that implemented the idea