/orbit — Complete Orbit
CRITICAL: Run HARNESS_DIR=$(epic path) first. NEVER use .harness/ in the project directory.
You are entering Orbit mode — the full autonomous pipeline from spec to PR in one shot.
Phase Recovery Protocol
At the start of every response during an active orbit:
- Run
ls $HARNESS_DIR/orbit/PIPELINE-*.json 2>/dev/null
- Find the file with
"status": "running"
- Read it. Verify
phase matches where you left off
- If
phase is ahead of where you think you are, trust the file — you may have compacted
- Conflict resolution (crash-mid-update): If
phase_history contains an entry for the current phase with a completed timestamp, treat that phase as done and advance to the next phase — phase_history wins over the phase field when they disagree.
- Resume from the resolved phase. Do NOT re-ask mode selection, re-run spec, or re-discover
- Worktree recovery: If
worktree_name is set in pipeline state:
- Check if worktree still exists:
git worktree list | grep "{worktree_name}"
- If exists:
cd into the worktree path to continue work
- If not found: worktree was cleaned up externally — abort orbit with warning, set
"status": "aborted"
If no file with "status": "running" exists, orbit was not started or has completed. Do not invent one.
Crash recovery: If updated_at is older than 45 minutes and the pipeline is in status: running, assume a crash occurred. Read the state, determine the last completed phase from phase_history (rule 5 above applies), and resume from there. Report the recovery to the user.
Step 0: Preflight
Initialize pipeline state at $HARNESS_DIR/orbit/PIPELINE-{timestamp}.json:
{
"id": "{timestamp}",
"mode": null,
"phase": "auto_detect",
"status": "running",
"spec_file": null,
"goal_slug": null,
"branch": null,
"worktree_name": null,
"original_cwd": null,
"audit_fail_count": 0,
"max_retries": 3,
"audit_report": null,
"deadline": "{ISO-8601, now + 30 minutes}",
"started_at": "{ISO-8601}",
"updated_at": "{ISO-8601}",
"phase_history": []
}
Step 1: Auto-Detect Mode
DO NOT ask the user for mode selection. Auto-detect the best path:
Detection Logic
| Signal |
Mode |
Reason |
| PRD / detailed requirements doc exists in project |
council |
Rich input → council synthesizes best approach |
| User request is specific and actionable (clear goal, defined scope) |
direct |
No need for discovery — spec directly |
| User request is vague, unfocused, or "I want to..." without specifics |
council |
Council frames the problem better than guessing |
| User explicitly says "interactive" or "let me discover first" |
interactive |
Respect explicit preference |
Detection Process
- Check for PRD/requirements docs:
ls {project}/PRD*.md {project}/docs/PRD*.md {project}/requirements*.md 2>/dev/null
- Evaluate user request clarity:
- Specific: contains concrete feature descriptions, acceptance criteria, or technical constraints →
direct
- Vague: "build X", "improve Y", "add Z" without details →
council
- Record detected mode in pipeline state (
"mode": "direct|council|interactive")
- Report mode choice to user as a notification, not a question:
"Orbit mode: {mode} (auto-detected)"
- Proceed immediately to the matching step below — do not wait for confirmation
Step 2A: Direct Mode (clear request → auto-spec)
Use when: Request is specific and actionable.
- Read the user's request + any existing docs (PRD, README, AGENTS.md)
- Generate spec directly at
$HARNESS_DIR/specs/SPEC-{timestamp}.md with status: approved
- Record via
epic mem add --title "Orbit: {mode} mode decision" --type decision --importance 0.9 --body "CONTEXT"
- Proceed immediately to Step 3 — no approval gate
Step 2B: Council Auto-Spec (complex/vague request → council)
Use when: PRD exists or request needs framing.
- Gather the user's request from conversation context
- Launch 4 parallel sub-agents (Architect, Skeptic, Pragmatist, Critic) — each receives ONLY the request + codebase context, NOT the full conversation (anti-anchoring)
- Synthesize: list agreement/disagreement, produce recommended approach
- Generate spec at
$HARNESS_DIR/specs/SPEC-{timestamp}.md with status: approved
- Record via
epic mem add --title "Orbit: council decision" --type decision --importance 0.9 --body "CONTEXT"
- Proceed immediately to Step 3 — no approval gate, no "orbit go"
Step 2C: Interactive Mode (explicit user choice only)
Use when: User explicitly requested interactive mode.
- Tell user to run
/discover → /spec, then say "orbit go". STOP and wait.
- On resume: load latest
SPEC-*.md with status: approved. Proceed to Step 3.
This mode is never auto-selected. It requires explicit user opt-in.
Step 3: Build (Go)
- Load spec, extract
goal_slug
- Git preflight: verify clean working tree and not on detached HEAD:
[ -z "$(git status --porcelain)" ] || (echo "ERROR: Dirty working tree or untracked files. Commit or stash first." && exit 1)
git symbolic-ref -q HEAD || (echo "ERROR: Detached HEAD. Checkout a branch first." && exit 1)
- Worktree isolation: Create an isolated git worktree:
git worktree add .claude/worktrees/orbit-{goal_slug} -b orbit-{goal_slug} origin/{default-branch}
cd .claude/worktrees/orbit-{goal_slug}
- Record
worktree_name and original_cwd in pipeline state
- Plan tasks from Requirements (R1, R2...)
- Execute with sub-agents — TDD, debug on failure, verify before done
- Handle states: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
- Integrate: full test suite, verify ACs
Step 4: Audit
- Gather scope via
git diff --stat
- Classify changed files (API, Frontend, DB, Backend, Tests, Infra)
- Launch parallel sub-agents: Reviewer, Auditor, Test runner (+ scope-specific)
- Synthesize Audit Report: Quality/Security/Performance PASS/WARN/FAIL + Spec Coverage
- PRESERVE audit report in pipeline state
audit_report field
Step 5: Verdict
- All PASS + all AC verified → proceed to Eval (if eval.yaml exists) or Ship
- WARN → log, auto-proceed
- FAIL → increment
audit_fail_count:
< 3: plan fixes from action items, execute, return to Step 4
≥ 3: PAUSE — ask user "continue or abort?"
Step 5.5: Eval (optional — only if eval.yaml or benchmarks exist)
- Check for eval config — eval is active if ANY of these exist:
$HARNESS_DIR/eval/eval.yaml
benchmarks/baselines/latest.json in CWD (in-repo baseline)
benchmarks/eval_runner.py in CWD (auto-detected benchmark)
- If eval is active, run
epic eval --json via the eval skill
- Eval PASS → proceed to Ship
- Eval FAIL (regression detected) → increment
audit_fail_count:
< 3: plan fixes, execute, return to Step 4
≥ 3: PAUSE — ask user "continue or abort?"
- If no eval config and no benchmarks detected, skip this step entirely
Step 6: Ship
- Gate: verify PASS audit report exists
- Integration verification — run directly in worktree:
- Clean build artifacts first:
cargo clean / npm run clean / equivalent
- Full build from scratch · complete test suite · linter + formatter
- Fail → STOP. Do NOT create PR.
- Git hygiene: conventional commits, rebase, squash fixups
- Create PR via
gh pr create with spec + audit report in body
- CI watch via
gh pr checks --watch, auto-fix failures
- Exit worktree: Return to original directory and keep the worktree
Step 7: Evolve
Run the evolution engine to analyze this session and generate/improve skills.
Always run — regardless of CI outcome:
epic-harness reflect
This triggers the Ring 3 loop: observe → analyze → seed evolved skills → update metrics.
If $HARNESS_DIR/pending_synth.jsonl has records with status: "pending",
synthesize each — launch one subagent per manifest (use your host's subagent
mechanism; do NOT name a model or CLI), then apply the body it produced:
epic-harness evolve accept-synth --skill <name> --file <body.md>
Unconsumed manifests leave the template skill body in place.
If CI green (all checks passed): additionally run
epic-harness reflect --context --days 1
and record the successful orbit pattern into memory:
epic mem add --title "Orbit: {goal_slug} succeeded" \
--type pattern --importance 0.7 \
--body "Orbit completed. Mode: {mode}. AC: all verified. PR: {url}. Stack: {stack}."
Report the evolution outcome in the final summary (evolved skills generated, score trend).
Update pipeline state: "phase": "evolve", "status": "complete".
Step 8: Report
## Orbit Complete
- Pipeline: PIPELINE-{id}
- Mode: {direct|council|interactive} (auto-detected)
- Spec: SPEC-{timestamp} ({goal_slug})
- Branch: orbit-{goal_slug}
- Worktree: orbit-{goal_slug} (preserved for PR)
- PR: {URL}
- Audit retries: {count}
### Phase Summary
| Phase | Status | Retries |
|-------|--------|---------|
| Spec | approved | 0 |
| Go | complete | 0 |
| Audit | PASS | {count} |
| Eval | {PASS|SKIPPED} | 0 |
| Ship | complete | 0 |
| Evolve | complete | 0 |
### Evolution
- Skills evolved: {count}
- Score trend: {improving|stable|declining}
Red Flags
- Interactive mode proceeding without spec approval (direct and council modes auto-approve)
- Continuing after 3 audit failures without user consent
- Skipping isolated integration test
- Shipping with FAIL in security audits
- Losing audit report between phases
- Creating branch with dirty working tree
- Losing worktree reference between phases
- Skipping evolve step after ship (evolve must always run, even if CI fails)
Source: hashgraph-online/awesome-codex-plugins → plugins/epicsagas/epic-harness/skills/orbit/SKILL.md
1---2name: orbit3description: State-persisted autonomous pipeline: spec → go → audit → eval → ship → evolve in one command. Auto-detects direct/council/interactive mode. Crash-recoverable via PIPELINE-*.json. Hands-off until PR.4---5
6
7# /orbit — Complete Orbit
8
9**CRITICAL**: Run `HARNESS_DIR=$(epic path)` first. NEVER use `.harness/` in the project directory.
10
11You are entering **Orbit** mode — the full autonomous pipeline from spec to PR in one shot.
12
13## Phase Recovery Protocol
14
15At the start of **every response** during an active orbit:
16
171. Run `ls $HARNESS_DIR/orbit/PIPELINE-*.json 2>/dev/null`
182. Find the file with `"status": "running"`
193. Read it. Verify `phase` matches where you left off
204. **If `phase` is ahead of where you think you are, trust the file** — you may have compacted
215. **Conflict resolution (crash-mid-update)**: If `phase_history` contains an entry for the current `phase` with a completed timestamp, treat that phase as done and advance to the next phase — `phase_history` wins over the `phase` field when they disagree.
226. Resume from the resolved phase. Do NOT re-ask mode selection, re-run spec, or re-discover
237. **Worktree recovery**: If `worktree_name` is set in pipeline state:
24 - Check if worktree still exists: `git worktree list | grep "{worktree_name}"`
25 - If exists: `cd` into the worktree path to continue work
26 - If not found: worktree was cleaned up externally — abort orbit with warning, set `"status": "aborted"`
27
28If no file with `"status": "running"` exists, orbit was not started or has completed. Do not invent one.
29
30**Crash recovery**: If `updated_at` is older than 45 minutes and the pipeline is in `status: running`, assume a crash occurred. Read the state, determine the last completed phase from `phase_history` (rule 5 above applies), and resume from there. Report the recovery to the user.
31
32## Step 0: Preflight
33
34Initialize pipeline state at `$HARNESS_DIR/orbit/PIPELINE-{timestamp}.json`:
35```json
36{
37 "id": "{timestamp}",
38 "mode": null,
39 "phase": "auto_detect",
40 "status": "running",
41 "spec_file": null,
42 "goal_slug": null,
43 "branch": null,
44 "worktree_name": null,
45 "original_cwd": null,
46 "audit_fail_count": 0,
47 "max_retries": 3,
48 "audit_report": null,
49 "deadline": "{ISO-8601, now + 30 minutes}",
50 "started_at": "{ISO-8601}",
51 "updated_at": "{ISO-8601}",
52 "phase_history": []
53}
54```
55
56## Step 1: Auto-Detect Mode
57
58**DO NOT ask the user for mode selection.** Auto-detect the best path:
59
60### Detection Logic
61
62| Signal | Mode | Reason |
63|--------|------|--------|
64| PRD / detailed requirements doc exists in project | `council` | Rich input → council synthesizes best approach |
65| User request is specific and actionable (clear goal, defined scope) | `direct` | No need for discovery — spec directly |
66| User request is vague, unfocused, or "I want to..." without specifics | `council` | Council frames the problem better than guessing |
67| User explicitly says "interactive" or "let me discover first" | `interactive` | Respect explicit preference |
68
69### Detection Process
70
711. Check for PRD/requirements docs: `ls {project}/PRD*.md {project}/docs/PRD*.md {project}/requirements*.md 2>/dev/null`
722. Evaluate user request clarity:
73 - **Specific**: contains concrete feature descriptions, acceptance criteria, or technical constraints → `direct`
74 - **Vague**: "build X", "improve Y", "add Z" without details → `council`
753. Record detected mode in pipeline state (`"mode": "direct|council|interactive"`)
764. Report mode choice to user as a **notification**, not a question: `"Orbit mode: {mode} (auto-detected)"`
775. Proceed immediately to the matching step below — **do not wait for confirmation**
78
79## Step 2A: Direct Mode (clear request → auto-spec)
80
81**Use when**: Request is specific and actionable.
82
831. Read the user's request + any existing docs (PRD, README, AGENTS.md)
842. Generate spec directly at `$HARNESS_DIR/specs/SPEC-{timestamp}.md` with `status: approved`
853. Record via `epic mem add --title "Orbit: {mode} mode decision" --type decision --importance 0.9 --body "CONTEXT"`
864. **Proceed immediately to Step 3** — no approval gate
87
88## Step 2B: Council Auto-Spec (complex/vague request → council)
89
90**Use when**: PRD exists or request needs framing.
91
921. Gather the user's request from conversation context
932. Launch 4 parallel sub-agents (Architect, Skeptic, Pragmatist, Critic) — each receives ONLY the request + codebase context, NOT the full conversation (anti-anchoring)
943. Synthesize: list agreement/disagreement, produce recommended approach
954. Generate spec at `$HARNESS_DIR/specs/SPEC-{timestamp}.md` with `status: approved`
965. Record via `epic mem add --title "Orbit: council decision" --type decision --importance 0.9 --body "CONTEXT"`
976. **Proceed immediately to Step 3** — no approval gate, no "orbit go"
98
99## Step 2C: Interactive Mode (explicit user choice only)
100
101**Use when**: User explicitly requested interactive mode.
102
1031. Tell user to run `/discover` → `/spec`, then say "orbit go". STOP and wait.
1042. On resume: load latest `SPEC-*.md` with `status: approved`. Proceed to Step 3.
105
106**This mode is never auto-selected.** It requires explicit user opt-in.
107
108## Step 3: Build (Go)
109
1101. Load spec, extract `goal_slug`
1112. **Git preflight**: verify clean working tree and not on detached HEAD:
112 ```bash
113 [ -z "$(git status --porcelain)" ] || (echo "ERROR: Dirty working tree or untracked files. Commit or stash first." && exit 1)
114 git symbolic-ref -q HEAD || (echo "ERROR: Detached HEAD. Checkout a branch first." && exit 1)
115 ```
1163. **Worktree isolation**: Create an isolated git worktree:
117 ```bash
118 git worktree add .claude/worktrees/orbit-{goal_slug} -b orbit-{goal_slug} origin/{default-branch}
119 cd .claude/worktrees/orbit-{goal_slug}
120 ```
121 - Record `worktree_name` and `original_cwd` in pipeline state
1224. Plan tasks from Requirements (R1, R2...)
1235. Execute with sub-agents — TDD, debug on failure, verify before done
1246. Handle states: DONE / DONE_WITH_CONCERNS / NEEDS_CONTEXT / BLOCKED
1257. Integrate: full test suite, verify ACs
126
127## Step 4: Audit
128
1291. Gather scope via `git diff --stat`
1302. Classify changed files (API, Frontend, DB, Backend, Tests, Infra)
1313. Launch parallel sub-agents: Reviewer, Auditor, Test runner (+ scope-specific)
1324. Synthesize Audit Report: Quality/Security/Performance PASS/WARN/FAIL + Spec Coverage
1335. **PRESERVE audit report** in pipeline state `audit_report` field
134
135## Step 5: Verdict
136
137- **All PASS + all AC verified** → proceed to Eval (if eval.yaml exists) or Ship
138- **WARN** → log, auto-proceed
139- **FAIL** → increment `audit_fail_count`:
140 - `< 3`: plan fixes from action items, execute, return to Step 4
141 - `≥ 3`: **PAUSE** — ask user "continue or abort?"
142
143## Step 5.5: Eval (optional — only if eval.yaml or benchmarks exist)
144
1451. Check for eval config — eval is active if ANY of these exist:
146 - `$HARNESS_DIR/eval/eval.yaml`
147 - `benchmarks/baselines/latest.json` in CWD (in-repo baseline)
148 - `benchmarks/eval_runner.py` in CWD (auto-detected benchmark)
1492. If eval is active, run `epic eval --json` via the **eval** skill
1503. **Eval PASS** → proceed to Ship
1514. **Eval FAIL (regression detected)** → increment `audit_fail_count`:
152 - `< 3`: plan fixes, execute, return to Step 4
153 - `≥ 3`: **PAUSE** — ask user "continue or abort?"
1545. If no eval config and no benchmarks detected, skip this step entirely
155
156## Step 6: Ship
157
1581. **Gate**: verify PASS audit report exists
1592. **Integration verification** — run directly in worktree:
160 - Clean build artifacts first: `cargo clean` / `npm run clean` / equivalent
161 - Full build from scratch · complete test suite · linter + formatter
162 - Fail → STOP. Do NOT create PR.
1633. **Git hygiene**: conventional commits, rebase, squash fixups
1644. **Create PR** via `gh pr create` with spec + audit report in body
1655. **CI watch** via `gh pr checks --watch`, auto-fix failures
1666. **Exit worktree**: Return to original directory and keep the worktree
167
168## Step 7: Evolve
169
170Run the evolution engine to analyze this session and generate/improve skills.
171
1721. **Always run** — regardless of CI outcome:
173 ```bash
174 epic-harness reflect
175 ```
176 This triggers the Ring 3 loop: observe → analyze → seed evolved skills → update metrics.
177
178 If `$HARNESS_DIR/pending_synth.jsonl` has records with `status: "pending"`,
179 synthesize each — launch one subagent per manifest (use your host's subagent
180 mechanism; do NOT name a model or CLI), then apply the body it produced:
181 ```bash
182 epic-harness evolve accept-synth --skill <name> --file <body.md>
183 ```
184 Unconsumed manifests leave the template skill body in place.
185
1862. **If CI green** (all checks passed): additionally run
187 ```bash
188 epic-harness reflect --context --days 1
189 ```
190 and record the successful orbit pattern into memory:
191 ```bash
192 epic mem add --title "Orbit: {goal_slug} succeeded" \
193 --type pattern --importance 0.7 \
194 --body "Orbit completed. Mode: {mode}. AC: all verified. PR: {url}. Stack: {stack}."
195 ```
196
1973. Report the evolution outcome in the final summary (evolved skills generated, score trend).
198
1994. Update pipeline state: `"phase": "evolve"`, `"status": "complete"`.
200
201## Step 8: Report
202
203```
204## Orbit Complete
205- Pipeline: PIPELINE-{id}
206- Mode: {direct|council|interactive} (auto-detected)
207- Spec: SPEC-{timestamp} ({goal_slug})
208- Branch: orbit-{goal_slug}
209- Worktree: orbit-{goal_slug} (preserved for PR)
210- PR: {URL}
211- Audit retries: {count}
212
213### Phase Summary
214| Phase | Status | Retries |
215|-------|--------|---------|
216| Spec | approved | 0 |
217| Go | complete | 0 |
218| Audit | PASS | {count} |
219| Eval | {PASS|SKIPPED} | 0 |
220| Ship | complete | 0 |
221| Evolve | complete | 0 |
222
223### Evolution
224- Skills evolved: {count}
225- Score trend: {improving|stable|declining}
226```
227
228## Red Flags
229- Interactive mode proceeding without spec approval (direct and council modes auto-approve)
230- Continuing after 3 audit failures without user consent
231- Skipping isolated integration test
232- Shipping with FAIL in security audits
233- Losing audit report between phases
234- Creating branch with dirty working tree
235- Losing worktree reference between phases
236- Skipping evolve step after ship (evolve must always run, even if CI fails)
237
238---
239
240**Source:** [`hashgraph-online/awesome-codex-plugins`](https://github.com/hashgraph-online/awesome-codex-plugins) → `plugins/epicsagas/epic-harness/skills/orbit/SKILL.md`