1---2name: autopilot3description: Use when the user explicitly wants an autonomous, end-to-end software delivery workflow from an idea or brief to verified working code.4---56<Purpose>7Autopilot takes a sufficiently clear software brief and handles the full lifecycle: requirements analysis, technical design, planning, implementation, QA, review, recovery, and evidence-based handoff.8</Purpose>910<Use_When>11- User wants end-to-end autonomous execution from an idea to working code12- User says "autopilot", "auto pilot", "autonomous", "build me", "create me", "make me", "full auto", "handle it all", or "I want a/an..."13- Task requires multiple phases: planning, coding, testing, and validation14- User wants hands-off execution and is willing to let the system run to completion15</Use_When>1617<Do_Not_Use_When>18- User wants to explore options or brainstorm -- use `plan` skill instead19- User says "just explain", "draft only", or "what would you suggest" -- respond conversationally20- User wants a single focused code change -- use `ralph` or delegate to an executor agent21- User wants to review or critique an existing plan -- use `plan --review`22- Task is a quick fix or small bug -- use direct executor delegation23</Do_Not_Use_When>2425<Why_This_Exists>26Most non-trivial software tasks require coordinated phases: understanding requirements, designing a solution, implementing in parallel, testing, and validating quality. Autopilot orchestrates all of these phases automatically so the user can describe what they want and receive working code without managing each step.27</Why_This_Exists>2829<Non_Negotiables>30- User instructions, repository instructions, and existing uncommitted work are binding context. Never overwrite unrelated user changes.31- Do not commit, push, merge, publish, deploy, delete, reset, or modify external systems unless the user explicitly authorizes that exact action.32- Inspect repository entrypoints and compact project memory before making assumptions. Prefer evidence from files and commands over remembered conventions.33- A claim of completion requires fresh evidence. A worker's self-report, a planned command, or code that merely looks right is not verification.34- Use only tools and skills available in the current runtime. If an optional tool is unavailable, use the closest local path and record the limitation.35- Every non-trivial automatic decision must be recorded with its evidence, rejected alternative, and cost if wrong.36</Non_Negotiables>3738<Execution_Policy>39- Each phase must complete before the next begins40- Default to the lightest mode that can finish the task; do not expand into a heavy workflow unless the task truly needs multiple phases41- Parallel execution is used only for independent workstreams with clear ownership (Phase 2 and Phase 4)42- QA cycles repeat up to 5 times; if the same error persists 3 times, stop and report the fundamental issue43- Validation requires approval from all reviewers; rejected items get fixed and re-validated44- Cancel with `/cancel` at any time; progress is preserved for resume45- If a deep-interview spec exists, use it as high-clarity phase input instead of re-expanding from scratch46- If input is too vague for reliable expansion, offer/trigger `$deep-interview` first47- Do not enter expansion/planning/execution-heavy phases until pre-context grounding exists; if fast execution is forced, proceed only with explicit risk notes48- Default to concise, evidence-dense progress and completion reporting unless the user or risk level requires more detail49- Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints50- If correctness depends on additional inspection, retrieval, execution, or verification, keep using the relevant tools until the workflow is grounded51- Continue through clear, low-risk, reversible next steps automatically; ask only when the next step is materially branching, destructive, or preference-dependent52- After compaction or resume, continue from the latest checkpoint and newest user message; do not restart discovery unless the checkpoint is missing or contradicted53- If the same diagnosis appears twice, make the next smallest safe fix or report the exact blocker; do not repeat the same investigation loop54- State MCP tools are helpful but optional; if an OMX MCP call fails, write a local checkpoint and continue instead of blocking55- Before changing code, define boundaries: files/behaviors that must not break, destructive commands that are forbidden, and the rollback point56- Every phase must have a gate: required artifact, owner, next action, and verification command; do not advance on vague outputs57- Prefer task-by-task execution with fresh context from checkpoint artifacts instead of relying on the full conversation history58- Treat autopilot as a bounded state machine: `intake -> expansion -> planning -> execution -> qa -> validation -> handoff`.59- A new user message is a local override. Preserve earlier non-conflicting requirements, invalidate affected downstream artifacts, and resume from the earliest invalid phase.60- Do not claim that unavailable reviewers approved anything. If review tools are missing, perform an adversarial single-agent review and disclose the limitation.61</Execution_Policy>6263## Operating Modes6465- `quick`: one compact plan, one implementation lane, one validation pass. Use for small, well-scoped work.66- `standard`: spec -> plan -> execute -> verify with focused artifacts and limited agents. Default mode.67- `deep`: multiple lanes, explicit boundaries, task graph, review team, and broader validation. Use only for large/risky work or explicit user request.6869Autopilot should choose the smallest mode that can genuinely finish the task. The user can override with `quick`, `standard`, or `deep`.7071## Persistent Artifacts7273For non-trivial work, keep a compact artifact set under `.omx/autopilot/<task-slug>/`:7475- `checkpoint.md`: current phase, root cause/hypothesis, files touched, next action, validation command.76- `boundaries.md`: do-not-break behavior, forbidden operations, secrets/production constraints, rollback point.77- `tasks.md`: task list with dependencies, ownership, parallel markers, and verification commands.78- `validation.md`: commands run, failures, fixes, final evidence.79- `survival-guide.md`: short handoff for compaction/restart with only the information needed to resume.8081Keep artifacts short and update them at phase boundaries and before long repair loops.8283## Phase Gates8485Each phase must pass these gates before advancing:8687- Artifact exists and names the next concrete action.88- Open questions are either answered, explicitly deferred, or converted into a safe assumption.89- Risk boundary is clear for files, data, secrets, billing, production, and destructive commands.90- Verification command is known, or the reason no command exists is written down.91- For parallel work, every lane has disjoint ownership or is sequenced.9293<Steps>940. **Pre-context Intake (required before Phase 0 starts)**:95 - Derive a task slug from the request.96 - Load the latest relevant snapshot from `.omx/context/{slug}-*.md` when available.97 - If this is a resumed or compacted conversation, read the newest local checkpoint before opening new files.98 - If no snapshot exists, create `.omx/context/{slug}-{timestamp}.md` (UTC `YYYYMMDDTHHMMSSZ`) with:99 - Task statement100 - Desired outcome101 - Known facts/evidence102 - Constraints103 - Unknowns/open questions104 - Likely codebase touchpoints105 - Current phase106 - Next concrete action107 - Validation command108 - Read applicable `AGENTS.md` files and, when present, compact `DEV/` files in order: `README`/`INDEX`, `HANDOFF`, `CONTEXT`, active spec. Load only task-relevant detail afterward.109 - Inspect branch/status/diff and record a baseline. Treat pre-existing changes as protected and choose a safe rollback point without destructive commands.110 - Identify stack, package manager, available test/build/lint/typecheck commands, entrypoints, and deployment/data boundaries.111 - Create or update `.omx/autopilot/{slug}/survival-guide.md` with only the context needed after compaction.112 - Create or update `.omx/autopilot/{slug}/boundaries.md` before code edits when the task is broad, risky, or production-facing.113 - If ambiguity remains high, run `explore` first for brownfield facts, then run `$deep-interview --quick <task>` before proceeding.114 - Carry the snapshot path into autopilot artifacts/state so all phases share grounded context.115 - Keep the checkpoint short enough to read quickly in a new session. The gate passes only when the next action, owner, risk boundary, and verification target are explicit.1161171. **Phase 0 - Expansion**: Turn the user's idea into a detailed spec118 - If `.omx/specs/deep-interview-*.md` exists for this task: reuse it and skip redundant expansion work119 - If prompt is highly vague: route to `$deep-interview` for Socratic ambiguity-gated clarification120 - Analyst (THOROUGH tier): Extract requirements121 - Architect (THOROUGH tier): Create technical specification122 - Output: `.omx/plans/autopilot-spec.md`123 - Gate: spec lists acceptance criteria, non-goals, risk boundaries, assumptions, and a concrete evidence target for every criterion (or an explicit human-validation dependency)1241252. **Phase 1 - Planning**: Create an implementation plan from the spec126 - Architect (THOROUGH tier): Create plan (direct mode, no interview)127 - Critic (THOROUGH tier): Validate plan128 - Output: `.omx/plans/autopilot-impl.md`129 - Break work into tasks with:130 - `id`131 - `owner`132 - `files/modules`133 - `dependsOn`134 - `parallelSafe: true|false`135 - `verify`136 - `acceptanceEvidence`137 - Mark independent work with `[P]` and explicit verification work with `[VERIFY]`138 - Before execution, check for contradictory tasks, overlapping ownership, missing dependencies, stale paths, unverifiable criteria, and commands with external side effects; record rulings.139 - Gate: every task has an owner, dependency decision, acceptance evidence, and verification command or evidence target1401413. **Phase 2 - Execution**: Implement the plan with available execution workflows142 - LOW-tier executor/search roles: Simple tasks143 - STANDARD-tier executor roles: Standard tasks144 - THOROUGH-tier executor/architect roles: Complex tasks145 - Run independent tasks in parallel only when write ownership is disjoint, the integration point is clear, and each lane has an independent verification target. Shared interfaces, migrations, configuration, lockfiles, and generated files are sequential by default.146 - The lead agent keeps the critical path moving while side agents work147 - Before each long edit or test loop, update the checkpoint with changed files, current hypothesis, next action, and verification command148 - Execute tasks one-by-one unless `[P]` lanes are proven independent149 - For each task, use a fresh compact context: spec summary, relevant files, task definition, boundary notes, and verify command150 - The lead orchestrator should coordinate outputs and integration; avoid filling lead context with full file dumps that belong to specialist lanes1511524. **Phase 3 - QA**: Verify in layers, then repair153 - Start with existence and relevance checks, then focused behavior checks, then integration/regression checks, and finally boundary checks for secrets, private paths, permissions, destructive operations, and generated output.154 - Build, lint, test, and fix failures when those checks exist; never invent a passing result for an unavailable command.155 - Repeat up to 5 cycles156 - Stop early if the same error repeats 3 times (indicates a fundamental issue)157 - Do not rerun broad tests blindly; after one broad failure, switch to the smallest failing test or command until fixed158 - For every failure, record root cause, changed hypothesis, smallest safe fix, covering check, and result. After one broad failure, switch to the smallest failing check before rerunning the broad gate.159 - Use layered gates:160 - existence: changed files and expected artifacts exist161 - relevance: changes address the requested behavior162 - root cause: failure explanation maps to code changed163 - regression: focused tests plus broad gate when available164 - momentum: next step is smaller than the previous loop165 - A gate may pass with an explicitly classified environmental, pre-existing, or unavailable check only when impact and next action are recorded; unresolved failures cannot be silently waived.1661675. **Phase 4 - Validation**: Evidence-based independent review168 - Architect: Functional completeness169 - Security-reviewer: Vulnerability check170 - Code-reviewer: Quality review171 - Reviewers receive concise artifacts and diffs, not full session history172 - Review findings must include severity, file/path, and required action173 - Review the actual diff and evidence, not only worker reports.174 - Findings must include severity, path/symbol, evidence, and required action. Critical or important findings require a fix and scoped re-review; use one consolidated fix wave when findings share a cause.175 - After the validation cap, adjudicate each residual finding as fixed, deferred, or blocked with a reason. Do not silently convert disagreement into approval.176 - If reviewers or MCP tools are unavailable, perform a single-agent adversarial review and disclose that limitation.1771786. **Phase 5 - Handoff and cleanup**: Clear only state owned by this run179 - `state_clear({mode: "autopilot"})`180 - `state_clear({mode: "ralph"})`181 - `state_clear({mode: "ultrawork"})`182 - `state_clear({mode: "ultraqa"})`183 - Or run `/cancel` for clean exit. Do not delete project artifacts or user changes as cleanup.184</Steps>185186<Tool_Usage>187- Use available local tools, subagents, and MCP tools directly when present; do not block on discovery tooling that is unavailable in the current runtime.188- Give reviewers concise artifacts and the actual diff. Ask for severity, path/symbol, evidence, and required action; never pre-judge findings or ask a reviewer to ignore a risk.189- Agents form their own analysis first. Cross-validation is additive, not a substitute for tests or direct inspection.190- If a requested reviewer or MCP tool is unavailable, perform the closest local review and record the limitation instead of assuming approval.191</Tool_Usage>192193## Token And Compaction Discipline194195- Load router/index files before full catalogs or long references.196- Prefer file paths, symbols, and focused snippets over full file dumps.197- Summarize long command output immediately into the checkpoint instead of replaying it.198- Do not spawn agents to do the same search as the lead agent.199- Treat automatic compaction as a resume event, not a reason to restart the workflow.200- If context is getting large, finish the current fix/verification step before broadening scope.201- Keep a `survival-guide.md` current enough that a new session can continue without reading the raw conversation.202203## Multiagent Discipline204205- Use subagents only when the user explicitly asks or when independent lanes materially reduce time or risk.206- Assign each subagent a non-overlapping file/module/question scope.207- Require each subagent to return changed paths, commands run, findings, blockers, and residual risk.208- Keep integration, conflict resolution, and final validation with the lead agent.209- If agents would edit the same file, sequence the work instead of parallelizing it.210- Use specialist agents with single responsibilities; do not ask multiple agents to solve the same vague problem.211212## Boundary Discipline213214Before broad or risky execution, write boundaries:215216- `NEVER`: destructive git commands, deleting user work, exposing secrets, unsafe production changes.217- `DANGER`: payments, auth, RLS, migrations, billing, customer data, cron jobs, external API side effects.218- `ROLLBACK`: current branch/status, backup path, or command needed to return to the pre-change state.219- `VERIFY`: the commands or manual evidence that prove the boundary was preserved.220221## State Management222223Use `omx_state` MCP tools for autopilot lifecycle state when available. The filesystem checkpoint and task ledger remain the source of truth when state tools are unavailable or fail.224225- **On start**:226 `state_write({mode: "autopilot", active: true, current_phase: "expansion", started_at: "<now>", state: {context_snapshot_path: "<snapshot-path>"}})`227- **On phase transitions**:228 `state_write({mode: "autopilot", current_phase: "planning"})`229 `state_write({mode: "autopilot", current_phase: "execution"})`230 `state_write({mode: "autopilot", current_phase: "qa"})`231 `state_write({mode: "autopilot", current_phase: "validation"})`232- **On completion**:233 `state_write({mode: "autopilot", active: false, current_phase: "complete", completed_at: "<now>"})`234- **On cancellation/cleanup**:235 run `$cancel` (which should call `state_clear(mode="autopilot")`)236237238## Scenario Examples239240**Good:** The user says `continue` after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.241242**Good:** The user changes only the output shape or downstream delivery step (for example `make a PR`). Preserve earlier non-conflicting workflow constraints and apply the update locally.243244**Bad:** The user says `continue`, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.245246<Examples>247<Good>248User: "autopilot A REST API for a bookstore inventory with CRUD operations using TypeScript"249Why good: Specific domain (bookstore), clear features (CRUD), technology constraint (TypeScript). Autopilot has enough context to expand into a full spec.250</Good>251252<Good>253User: "build me a CLI tool that tracks daily habits with streak counting"254Why good: Clear product concept with a specific feature. The "build me" trigger activates autopilot.255</Good>256257<Bad>258User: "fix the bug in the login page"259Why bad: This is a single focused fix, not a multi-phase project. Use direct executor delegation or ralph instead.260</Bad>261262<Bad>263User: "what are some good approaches for adding caching?"264Why bad: This is an exploration/brainstorming request. Respond conversationally or use the plan skill.265</Bad>266</Examples>267268<Escalation_And_Stop_Conditions>269- Stop and report when the same QA error persists across 3 cycles (fundamental issue requiring human input)270- Stop and report when validation keeps failing after 3 re-validation rounds271- Stop when the user says "stop", "cancel", or "abort"272- If requirements were too vague and expansion produces an unclear spec, pause and redirect to `$deep-interview` before proceeding273- Pause before deploy, publish, push, merge, delete, reset, production-data changes, account/auth changes, paid services, or third-party communication unless explicitly authorized.274- If a dependency, credential, service, or platform is unavailable, try a local substitute or static verification and report the limitation; never invent success.275- If the same diagnosis appears twice, change the hypothesis or report the blocker; do not repeat the same investigation loop.276</Escalation_And_Stop_Conditions>277278<Final_Checklist>279- [ ] Request contract and risk boundaries are recorded280- [ ] Plan tasks have owners, dependencies, disjointness decisions, and verification targets281- [ ] Every changed behavior has focused evidence where feasible282- [ ] Required lint/typecheck/tests/build/package checks have fresh results, or limitations are explicit283- [ ] Review covers completeness, safety, and maintainability284- [ ] Residual findings and rulings are visible in the handoff285- [ ] No unauthorized commit, push, merge, publish, deploy, deletion, or external side effect occurred286- [ ] Checkpoint and applicable durable project memory are current287- [ ] User informed of outcome, evidence, limitations, and exact next action if needed288</Final_Checklist>289290<Advanced>291## Configuration292293Optional settings in `~/.codex/config.toml`:294295```toml296[omx.autopilot]297maxIterations = 10298maxQaCycles = 5299maxValidationRounds = 3300pauseAfterExpansion = false301pauseAfterPlanning = false302skipQa = false303skipValidation = false304```305306## Resume307308If autopilot was cancelled or failed, run `/autopilot` again to resume from where it stopped.309310## Recommended Clarity Pipeline311312For ambiguous requests, prefer:313314```315deep-interview -> ralplan -> autopilot316```317318- `deep-interview`: ambiguity-gated Socratic requirements319- `ralplan`: consensus planning (planner/architect/critic)320- `autopilot`: execution + QA + validation321322## Best Practices for Input3233241. Be specific about the domain -- "bookstore" not "store"3252. Mention key features -- "with CRUD", "with authentication"3263. Specify constraints -- "using TypeScript", "with PostgreSQL"3274. Let it run -- avoid interrupting unless truly needed328329## Pipeline Orchestrator (v0.8+)330331Autopilot can be driven by the configurable pipeline orchestrator (`src/pipeline/`), which332sequences stages through a uniform `PipelineStage` interface:333334```335RALPLAN (consensus planning) -> team-exec (Codex CLI workers) -> ralph-verify (architect verification)336```337338Pipeline configuration options:339340```toml341[omx.autopilot.pipeline]342maxRalphIterations = 10 # Ralph verification iteration ceiling343workerCount = 2 # Number of Codex CLI team workers344agentType = "executor" # Agent type for team workers345```346347The pipeline persists state via `pipeline-state.json` and supports resume from the last348incomplete stage. See `src/pipeline/orchestrator.ts` for the full API.349350## Troubleshooting351352**Stuck in a phase?** Check the active task list for blocked tasks, run `state_read({mode: "autopilot"})`, or cancel and resume.353354**QA cycles exhausted?** The same error 3 times indicates a fundamental issue. Review the error pattern; manual intervention may be needed.355356**Validation keeps failing?** Review the specific issues. Requirements may have been too vague -- cancel and provide more detail.357</Advanced>