$deep-interview -> $ralplan -> $ultragoal (+ $team if needed) -> $code-review -> $ultraqa
If $code-review or $ultraqa is not clean, Autopilot returns to $ralplan with the findings as the next planning input, then continues again through $ultragoal, $code-review, and $ultraqa until the gates are clean or a hard blocker is reported. Ralph is a legacy/explicit alternate execution loop only; do not advertise Ralph as the default Autopilot path.
Phase
deep-interview— Socratic requirements clarification gate- Run or resume
$deep-interviewto clarify intent, scope, non-goals, constraints, and decision boundaries. - Deep-interview is a structured question chain, not a one-question gate;
max_roundsis a cap, not a target. - After a user answers an
omx question, re-score ambiguity against the active profile threshold. Ask another question only when a readiness gate is still unresolved and the answer would materially change execution; otherwise crystallize the spec and hand off. - Required handoff artifact: a clarified spec or concise requirements summary suitable for
$ralplan, including an explicit interview-complete rationale when leaving deep-interview.
- Run or resume
Phase
ralplan— consensus planning gate- Ground the task with pre-context intake and the deep-interview artifact.
- Current ownership rule: Autopilot records
planning_routingin state before heavy planning. When the Autopilot/main model resolves to a cheap/mini lane (for exampleo4-mini,*-mini,*spark*, or an explicitly cheap/economy/lite model name), the initial planning/decomposition owner is dedicated[planner]; otherwise[main]may keep ownership for backward compatibility. A configuredagentModels.planneris an explicit opt-in that forces dedicated[planner]ownership even when[main]is not cheap/mini. - Run or resume
$ralplanto produce/update PRD and test-spec artifacts. Ifplanning_routing.ownerisplanner, use the dedicated[planner]role for the initial Planner draft/decomposition before the Architect→Critic consensus gates. - PRD/test-spec files alone are not completion evidence. Ralplan may hand off only after durable consensus evidence records a subsequent
Architectapproval first and a subsequentCriticapproval second. - When returning from a non-clean review or QA pass, include
return_to_ralplan_reasonand the findings as first-class planning input. - If either review is missing, blocked, out of order, or non-approving, remain in
ralplanor report an explicit blocker/max-iteration outcome; do not progress to$ultragoal,$team,$ralph, or implementation. - Required handoff artifact: an approved plan/test spec plus
ralplan_consensus_gateevidence suitable for$ultragoal.
Phase
ultragoal— durable implementation + verification loop- Run
$ultragoalfrom the approved ralplan artifacts. - Ultragoal owns durable Codex goal handoffs,
.omx/ultragoalledger checkpoints, implementation, tests, build/lint/typecheck evidence, cleanup, and final review gate discipline. - Use
$teamonly inside an active Ultragoal story when the story clearly benefits from coordinated parallel execution (for example independent file/module lanes, broad test matrix work, or multi-domain implementation). Team remains explicit and leader-owned; Ultragoal keeps the goal/ledger state. - Required handoff artifact: implementation evidence, changed-file summary, verification evidence, and Ultragoal ledger/checkpoint references suitable for
$code-review.
- Run
Phase
code-review— merge-readiness gate- Run
$code-reviewon the diff/artifacts produced by$ultragoal. - A clean review means final recommendation
APPROVEwith architectural statusCLEAR. COMMENT,REQUEST CHANGES, any architecturalWATCH/BLOCK, or any unresolved finding is not clean.- If not clean because the implementation must be repaired, increment the review cycle, persist
review_verdict, setcurrent_phase:"rework", and carry the findings as the sanctioned execution-fix input. Return to Phaseralplanonly when the review shows the plan/requirements are wrong or incomplete.
- Run
Phase
ultraqa— adversarial QA gate- Run
$ultraqaafter a clean code review when user-facing behavior, workflows, CLI/runtime behavior, integration surfaces, or regression risk warrant adversarial QA. - For docs-only or trivially non-runtime changes, record
ultraqaas skipped with an explicit condition and evidence. - If UltraQA finds issues, persist the QA verdict/evidence, set
return_to_ralplan_reason, and transition back to Phaseralplan.
- Run
The only normal terminal state is complete after clean code review and a passed or explicitly skipped UltraQA gate. Cancellation, blocked credentials, unrecoverable repeated failures, or explicit user stop may terminate earlier with preserved state.
Before Phase deep-interview or ralplan starts or resumes:
- Derive a task slug from the request.
- Reuse the latest relevant
.omx/context/{slug}-*.mdsnapshot when available. - If none exists, create
.omx/context/{slug}-{timestamp}.md(UTCYYYYMMDDTHHMMSSZ) with:- activation prompt / task seed
- original task status (
activation-prompt,legacy-unverified, orunavailable) - desired outcome
- known facts/evidence
- constraints
- unknowns/open questions
- likely codebase touchpoints
- a scope note that the seed is the Autopilot activation prompt, not guaranteed prior conversation context
- If brownfield facts are missing, run
explorefirst before or during$deep-interview($deep-interview --quick <task>remains acceptable for bounded low-ambiguity intake); do not skip the clarification gate merely because the task sounds actionable. - Carry the snapshot path in Autopilot state and all handoff artifacts. </Pre-context Intake>
Inside active Autopilot, named child phases such as $ralplan are supervised phases, not peer workflow activations: keep mode:"autopilot" active and update current_phase:"ralplan" rather than starting standalone mode:"ralplan" over Autopilot.
Required fields:
{
"mode": "autopilot",
"active": true,
"current_phase": "deep-interview",
"iteration": 1,
"review_cycle": 0,
"max_iterations": 10,
"phase_cycle": ["deep-interview", "ralplan", "ultragoal", "code-review", "ultraqa"],
"handoff_artifacts": {
"context_snapshot_path": ".omx/context/<slug>-<timestamp>.md",
"deep_interview": null,
"ralplan": null,
"ralplan_consensus_gate": {
"required": true,
"sequence": ["architect-review", "critic-review"],
"planning_artifacts_are_not_consensus": true,
"required_review_roles": ["architect", "critic"],
"ralplan_architect_review": null,
"ralplan_critic_review": null,
"complete": false
},
"ultragoal": null,
"code_review": null,
"ultraqa": null
},
"review_verdict": null,
"qa_verdict": null,
"return_to_ralplan_reason": null
}
- On start:
omx state write --input '{"mode":"autopilot","active":true,"current_phase":"deep-interview","iteration":1,"review_cycle":0,"state":{"phase_cycle":["deep-interview","ralplan","ultragoal","code-review","ultraqa"],"handoff_artifacts":{"context_snapshot_path":"<snapshot-path>","deep_interview":null,"ralplan":null,"ralplan_consensus_gate":{"required":true,"sequence":["architect-review","critic-review"],"planning_artifacts_are_not_consensus":true,"required_review_roles":["architect","critic"],"ralplan_architect_review":null,"ralplan_critic_review":null,"complete":false},"ultragoal":null,"code_review":null,"ultraqa":null},"review_verdict":null,"qa_verdict":null,"return_to_ralplan_reason":null}}' --json - On deep-interview -> ralplan: only after a separate gate proves the interview chain is explicitly complete or the user explicitly authorized a skip. For completion, persist
deep_interview_gate:{"status":"complete","rationale":"<why requirements are complete>","handoff_summary":"<summary>"}(or equivalent non-empty rationale/summary) plus the clarified spec/requirements underhandoff_artifacts.deep_interview; if a finalomx questionwas involved, keep its same-session answered record linked byquestion_id/satisfied_at. For skip, persistdeep_interview_gate:{"status":"skipped","skip_authorized_by_user":true,"skip_reason":"<user-authorized reason>","skipped_at":"<timestamp>","source":"user","session_id":"<session>"}. Do not leave deep-interview merely because the firstomx questionwas answered or cleared.- Optional execution contract foundation: when a downstream handoff explicitly sets
execution_contract_required:true, persist a complete structuredexecution_contractunderhandoff_artifacts.deep_interviewbefore leaving deep-interview. The canonical schema isversion:1,execution_stride:"task"|"deliverable"|"milestone",source:"deep-interview",selected_by:"user"|"default",allow_task_shrink:<boolean>, non-emptycompletion_unit, non-emptystop_condition,acceptance_coverage_scope:"task"|"deliverable"|"milestone", andshrink_policy:"allowed"|"ask_before_shrink"|"deny_unless_blocked". - Stride semantics are binding only when
execution_contract_required:true:taskmeansallow_task_shrink:true,acceptance_coverage_scope:"task",shrink_policy:"allowed";deliverablemeansallow_task_shrink:false,acceptance_coverage_scope:"deliverable",shrink_policy:"ask_before_shrink";milestonemeansallow_task_shrink:false,acceptance_coverage_scope:"milestone",shrink_policy:"deny_unless_blocked". - Preserve legacy behavior when
execution_contract_requiredis absent or false. Do not infer stride from prose, broadness, phase names, snapshots, or task size; this foundation only validates an explicit structured contract and deliberately usesmilestonerather thanphase. New artifacts must write canonical snake_case keys underhandoff_artifacts.deep_interview; the runtime may read legacy camelCase field/marker aliases and direct/nestedexecution_contractlocations only as compatibility input.
- Optional execution contract foundation: when a downstream handoff explicitly sets
- On ralplan -> ultragoal: only after
ralplan_consensus_gate.complete:true, with tracker-backed native-subagentralplan_architect_review.agent_role:"architect"andralplan_architect_review.verdict:"approve"recorded before tracker-backed native-subagentralplan_critic_review.agent_role:"critic"andralplan_critic_review.verdict:"approve";codex_execor artifact-only approvals are trace evidence but not native lane proof. Setcurrent_phase:"ultragoal"and persist the plan/test-spec paths underhandoff_artifacts.ralplan. - On missing ralplan consensus evidence: keep
current_phase:"ralplan", persistralplan_consensus_gate.complete:falsewithblocked_reason, and report an explicit blocker or max-iteration outcome instead of handing off to execution. - On ultragoal -> code-review: set
current_phase:"code-review", persist implementation/test/ledger evidence underhandoff_artifacts.ultragoal. - On code-review -> ultraqa: set
current_phase:"ultraqa"only after a real$code-reviewstage/subagent has produced durable evidence; persist the clean review underhandoff_artifacts.code_reviewwith its source thread/tool/stage reference. Do not authorreview_verdict:{clean:true}from the leader's own summary. - On non-clean code-review requiring implementation repair: increment
review_cycle, setcurrent_phase:"rework", persistreview_verdict, persist the phase handoff underhandoff_artifacts.code_review, and keep the fix scoped to the review findings before returning tocode-review. - On clean review + passed/skipped QA: set
active:false,current_phase:"complete", persistreview_verdict:{recommendation:"APPROVE", architectural_status:"CLEAR", clean:true},qa_verdict:{clean:true, skipped:<boolean>, reason:<string|null>}, andcompleted_atonly when both gates have durable source evidence. Required evidence is either (a) actual$code-review/$ultraqastage or native-subagent/thread/tool records, or (b) for QA only, an explicit persisted skip reason for a documented docs-only/trivially non-runtime condition. If that evidence is missing, keep the active phase atcode-revieworultraqaand record a blocker instead of self-attesting a clean gate. - On non-clean review requiring plan changes or failed QA: increment
iterationandreview_cycle, setcurrent_phase:"ralplan", persistreview_verdictorqa_verdict, persist the phase handoff, and setreturn_to_ralplan_reasonto a concise findings-driven reason. - Legacy Ralph state: if a user explicitly selected the legacy Ralph execution lane, phase names and handoff keys may include
ralph; preserve and resume them rather than rewriting history to Ultragoal. - On cancellation: run
$cancel; preserve progress for resume rather than deleting handoff artifacts.
Do not restart discovery or discard handoff artifacts on continuation.
deep-interview -> ralplan -> ultragoal -> code-review -> ultraqa
Pipeline state should use current_phase values that match the same phase names (deep-interview, ralplan, ultragoal, rework, code-review, ultraqa, complete, failed) and should carry iteration, review_cycle, handoff_artifacts, review_verdict, qa_verdict, and return_to_ralplan_reason alongside stage results. $team is not a default pipeline stage; it is an explicit conditional execution engine inside an Ultragoal story.