$npx -y skills add witt3rd/oh-my-hermes --skill omh-autopilotpipeline: interview→plan→execute→QA→verify (idea→code)
| 1 | # OMH Autopilot — End-to-End Autonomous Pipeline |
| 2 | |
| 3 | ## When to Use |
| 4 | |
| 5 | - End-to-end feature implementation from idea to verified, reviewed code |
| 6 | - The user says: "autopilot", "build me", "handle it all", "e2e this" |
| 7 | |
| 8 | ## When NOT to Use |
| 9 | |
| 10 | - Single-file changes or trivial tasks (just do them) |
| 11 | - You want to stay in one continuous session (autopilot is multi-session) |
| 12 | - You only need planning (omh-ralplan) or execution (omh-ralph) |
| 13 | |
| 14 | ## Prerequisites |
| 15 | |
| 16 | - The `omh` plugin must be installed (`~/.hermes/plugins/omh/`) |
| 17 | |
| 18 | ## Architecture: One Phase Step Per Invocation |
| 19 | |
| 20 | Each autopilot invocation reads state, does ONE unit of work, exits. The caller re-invokes. |
| 21 | This preserves fresh context at every level — including during the ralph loop. |
| 22 | |
| 23 | ``` |
| 24 | Invocation 1: Phase 0 — requirements (or skip) |
| 25 | Invocation 2: Phase 1 — planning (or skip) |
| 26 | Invocations 3-N: Phase 2 — ralph iterations (one per call) |
| 27 | Invocation N+1: Phase 3 — QA cycle [FRESH SESSION] |
| 28 | Invocation M: Phase 4 — validation round [FRESH SESSION] |
| 29 | Final: Phase 5 — cleanup → complete |
| 30 | ``` |
| 31 | |
| 32 | See `references/caller-examples.md` for how to drive the loop. |
| 33 | |
| 34 | ## Procedure |
| 35 | |
| 36 | ### Step 0: Resolve Instance and Acquire Lock |
| 37 | |
| 38 | Autopilot drives a goal through spec → plan → ralph → QA → validation. |
| 39 | Two autopilot sessions on the same goal would race on `autopilot`, |
| 40 | `ralph`, and `ralph-tasks` state simultaneously. Use per-instance state |
| 41 | + advisory lock. |
| 42 | |
| 43 | 1. **Resolve `instance_id`** in this order: |
| 44 | - If a confirmed spec exists at `.omh/specs/{name}-spec.md`, use |
| 45 | `instance_id = "{name}"`. |
| 46 | - Else if a plan exists at `.omh/plans/ralplan-{slug}.md`, use |
| 47 | `instance_id = "{slug}"`. |
| 48 | - Else derive from the goal: `instance_id = kebab(goal)[:60]`. |
| 49 | 2. **Acquire the autopilot lock**: |
| 50 | ``` |
| 51 | lock = omh_state(action="lock", mode="autopilot", |
| 52 | lock_key="{instance_id}", |
| 53 | session_id="{HERMES_SESSION_ID or uuid}", |
| 54 | holder_note="autopilot driving {goal_or_plan}") |
| 55 | ``` |
| 56 | On `acquired=false`, report `held_by`, offer wait/cancel/different |
| 57 | goal. Stale-pid auto-release applies. |
| 58 | 3. **Pass `instance_id` to every `omh_state` call** in this invocation |
| 59 | (autopilot, ralph, ralph-tasks). |
| 60 | 4. **When dispatching to ralph in Phase 2**, pass the same |
| 61 | `instance_id` in the delegation context so the ralph subagent |
| 62 | acquires `mode="ralph"` lock on the same slug. |
| 63 | 5. **Release the autopilot lock at every exit point** (paused, |
| 64 | blocked, complete, exception): |
| 65 | ``` |
| 66 | omh_state(action="unlock", mode="autopilot", |
| 67 | lock_key="{instance_id}", |
| 68 | session_id="{HERMES_SESSION_ID or uuid}") |
| 69 | ``` |
| 70 | |
| 71 | > **Singleton fallback (legacy).** Omitting `instance_id` writes |
| 72 | > `.omh/state/autopilot-state.json` and skips locking. Acceptable only |
| 73 | > when running one autopilot at a time. |
| 74 | |
| 75 | ### On Every Invocation: Dispatch |
| 76 | |
| 77 | ``` |
| 78 | state = omh_state(action="read", mode="autopilot", instance_id="{instance_id}") |
| 79 | ``` |
| 80 | |
| 81 | - **Not found**: Fresh start → Smart Detection (below) |
| 82 | - **Found**: Check `context_checkpoint` flag → if true, clear it and exit (phase boundary) |
| 83 | - Check staleness: `state.stale = true` → warn, offer fresh start |
| 84 | - Check pause: if `pause_after_phase` matches current completed phase → set phase="paused", exit |
| 85 | - Dispatch to current phase handler |
| 86 | |
| 87 | ### Smart Detection (Fresh Start) |
| 88 | |
| 89 | When no autopilot state exists, detect artifacts: |
| 90 | |
| 91 | 1. Confirmed spec in `.omh/specs/*-spec.md` → create state at Phase 1 |
| 92 | 2. Consensus plan in `.omh/plans/ralplan-*.md` → create state at Phase 2 |
| 93 | 3. Ralph complete (`omh_state(action="check", mode="ralph", instance_id="{instance_id}")` → phase="complete") → create state at Phase 3 |
| 94 | 4. Nothing → create state at Phase 0 |
| 95 | |
| 96 | Check for active ralph: `omh_state(action="check", mode="ralph", instance_id="{instance_id}")` → if active, warn about existing session. |
| 97 | |
| 98 | ``` |
| 99 | omh_state(action="write", mode="autopilot", instance_id="{instance_id}", data={ |
| 100 | "phase": "requirements", "goal": "...", "ralph_iteration": 0, |
| 101 | "qa_cycle": 0, "max_qa_cycles": 5, "validation_round": 0, |
| 102 | "max_validation_rounds": 3, "validation_verdicts": {}, |
| 103 | "skip_qa": false, "skip_validation": false, "pause_after_phase": null |
| 104 | }) |
| 105 | ``` |
| 106 | |
| 107 | ### Phase 0: Requirements |
| 108 | |
| 109 | **Goal**: Ensure a confirmed spec exists. |
| 110 | |
| 111 | 1. Check `.omh/specs/*-spec.md` with `status: confirmed` → found? Set `spec_file`, advance to Phase 1, exit |
| 112 | 2. Not found — assess input: |
| 113 | - **Concrete** (file paths, function names, specific tech): generate inline spec, advance |
| 114 | - **Vague**: Load `omh-deep-interview` and follow it. **This phase is interactive.** |
| 115 | 3. Update state: `phase: "planning"`, `spec_file: "<path>"`. Exit. |
| 116 | |
| 117 | **For fully autonomous runs**: run `omh-deep-interview` separately first. |
| 118 | |
| 119 | ### Phase 1: Planning |
| 120 | |
| 121 | **Goal**: |