oh-my-codex 0.18.13 → 0.18.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/Cargo.lock +6 -6
  2. package/Cargo.toml +1 -1
  3. package/README.md +31 -11
  4. package/dist/agents/__tests__/native-config.test.js +25 -0
  5. package/dist/agents/__tests__/native-config.test.js.map +1 -1
  6. package/dist/agents/native-config.d.ts.map +1 -1
  7. package/dist/agents/native-config.js +5 -1
  8. package/dist/agents/native-config.js.map +1 -1
  9. package/dist/autopilot/__tests__/fsm.test.js +7 -0
  10. package/dist/autopilot/__tests__/fsm.test.js.map +1 -1
  11. package/dist/autopilot/__tests__/planner-routing.test.d.ts +2 -0
  12. package/dist/autopilot/__tests__/planner-routing.test.d.ts.map +1 -0
  13. package/dist/autopilot/__tests__/planner-routing.test.js +74 -0
  14. package/dist/autopilot/__tests__/planner-routing.test.js.map +1 -0
  15. package/dist/autopilot/__tests__/ralplan-gate.test.js +315 -0
  16. package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -1
  17. package/dist/autopilot/completion-gate.js +1 -1
  18. package/dist/autopilot/completion-gate.js.map +1 -1
  19. package/dist/autopilot/fsm.d.ts +2 -2
  20. package/dist/autopilot/fsm.d.ts.map +1 -1
  21. package/dist/autopilot/fsm.js +3 -0
  22. package/dist/autopilot/fsm.js.map +1 -1
  23. package/dist/autopilot/planner-routing.d.ts +21 -0
  24. package/dist/autopilot/planner-routing.d.ts.map +1 -0
  25. package/dist/autopilot/planner-routing.js +59 -0
  26. package/dist/autopilot/planner-routing.js.map +1 -0
  27. package/dist/autopilot/ralplan-gate.d.ts.map +1 -1
  28. package/dist/autopilot/ralplan-gate.js +30 -0
  29. package/dist/autopilot/ralplan-gate.js.map +1 -1
  30. package/dist/autoresearch/goal.d.ts.map +1 -1
  31. package/dist/autoresearch/goal.js +10 -1
  32. package/dist/autoresearch/goal.js.map +1 -1
  33. package/dist/cli/__tests__/autoresearch-goal.test.js +33 -0
  34. package/dist/cli/__tests__/autoresearch-goal.test.js.map +1 -1
  35. package/dist/cli/__tests__/codex-plugin-layout.test.js +30 -0
  36. package/dist/cli/__tests__/codex-plugin-layout.test.js.map +1 -1
  37. package/dist/cli/__tests__/doctor-artifact-ownership.test.d.ts +2 -0
  38. package/dist/cli/__tests__/doctor-artifact-ownership.test.d.ts.map +1 -0
  39. package/dist/cli/__tests__/doctor-artifact-ownership.test.js +158 -0
  40. package/dist/cli/__tests__/doctor-artifact-ownership.test.js.map +1 -0
  41. package/dist/cli/__tests__/doctor-spark-routing.test.js +13 -0
  42. package/dist/cli/__tests__/doctor-spark-routing.test.js.map +1 -1
  43. package/dist/cli/__tests__/doctor-warning-copy.test.js +1 -0
  44. package/dist/cli/__tests__/doctor-warning-copy.test.js.map +1 -1
  45. package/dist/cli/__tests__/index.test.js +5 -0
  46. package/dist/cli/__tests__/index.test.js.map +1 -1
  47. package/dist/cli/__tests__/nested-help-routing.test.js +4 -0
  48. package/dist/cli/__tests__/nested-help-routing.test.js.map +1 -1
  49. package/dist/cli/__tests__/package-bin-contract.test.js +7 -1
  50. package/dist/cli/__tests__/package-bin-contract.test.js.map +1 -1
  51. package/dist/cli/__tests__/performance-goal.test.js +22 -0
  52. package/dist/cli/__tests__/performance-goal.test.js.map +1 -1
  53. package/dist/cli/__tests__/resume.test.js +96 -0
  54. package/dist/cli/__tests__/resume.test.js.map +1 -1
  55. package/dist/cli/__tests__/session-scoped-runtime.test.js +162 -0
  56. package/dist/cli/__tests__/session-scoped-runtime.test.js.map +1 -1
  57. package/dist/cli/__tests__/session-search.test.js +36 -0
  58. package/dist/cli/__tests__/session-search.test.js.map +1 -1
  59. package/dist/cli/__tests__/setup-agents-overwrite.test.js +35 -1
  60. package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -1
  61. package/dist/cli/__tests__/setup-install-mode.test.js +33 -0
  62. package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
  63. package/dist/cli/__tests__/team.test.js +17 -3
  64. package/dist/cli/__tests__/team.test.js.map +1 -1
  65. package/dist/cli/__tests__/ultragoal.test.js +37 -0
  66. package/dist/cli/__tests__/ultragoal.test.js.map +1 -1
  67. package/dist/cli/__tests__/update.test.js +1 -0
  68. package/dist/cli/__tests__/update.test.js.map +1 -1
  69. package/dist/cli/autoresearch-goal.d.ts.map +1 -1
  70. package/dist/cli/autoresearch-goal.js +2 -1
  71. package/dist/cli/autoresearch-goal.js.map +1 -1
  72. package/dist/cli/doctor.d.ts +22 -0
  73. package/dist/cli/doctor.d.ts.map +1 -1
  74. package/dist/cli/doctor.js +263 -4
  75. package/dist/cli/doctor.js.map +1 -1
  76. package/dist/cli/index.d.ts +1 -1
  77. package/dist/cli/index.d.ts.map +1 -1
  78. package/dist/cli/index.js +65 -4
  79. package/dist/cli/index.js.map +1 -1
  80. package/dist/cli/performance-goal.d.ts.map +1 -1
  81. package/dist/cli/performance-goal.js +4 -2
  82. package/dist/cli/performance-goal.js.map +1 -1
  83. package/dist/cli/plugin-marketplace.d.ts +1 -0
  84. package/dist/cli/plugin-marketplace.d.ts.map +1 -1
  85. package/dist/cli/plugin-marketplace.js +67 -5
  86. package/dist/cli/plugin-marketplace.js.map +1 -1
  87. package/dist/cli/project-runtime-codex-homes.d.ts +2 -0
  88. package/dist/cli/project-runtime-codex-homes.d.ts.map +1 -1
  89. package/dist/cli/project-runtime-codex-homes.js +112 -5
  90. package/dist/cli/project-runtime-codex-homes.js.map +1 -1
  91. package/dist/cli/setup.d.ts.map +1 -1
  92. package/dist/cli/setup.js +15 -6
  93. package/dist/cli/setup.js.map +1 -1
  94. package/dist/cli/ultragoal.d.ts.map +1 -1
  95. package/dist/cli/ultragoal.js +5 -1
  96. package/dist/cli/ultragoal.js.map +1 -1
  97. package/dist/cli/update.d.ts.map +1 -1
  98. package/dist/cli/update.js +3 -0
  99. package/dist/cli/update.js.map +1 -1
  100. package/dist/config/__tests__/models.test.js +21 -1
  101. package/dist/config/__tests__/models.test.js.map +1 -1
  102. package/dist/config/models.d.ts +5 -0
  103. package/dist/config/models.d.ts.map +1 -1
  104. package/dist/config/models.js +23 -0
  105. package/dist/config/models.js.map +1 -1
  106. package/dist/goal-workflows/codex-goal-snapshot.d.ts +2 -0
  107. package/dist/goal-workflows/codex-goal-snapshot.d.ts.map +1 -1
  108. package/dist/goal-workflows/codex-goal-snapshot.js +10 -0
  109. package/dist/goal-workflows/codex-goal-snapshot.js.map +1 -1
  110. package/dist/hooks/__tests__/autopilot-skill-contract.test.js +7 -0
  111. package/dist/hooks/__tests__/autopilot-skill-contract.test.js.map +1 -1
  112. package/dist/hooks/__tests__/keyword-detector.test.js +46 -0
  113. package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
  114. package/dist/hooks/__tests__/notify-fallback-watcher.test.js +100 -0
  115. package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
  116. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js +75 -0
  117. package/dist/hooks/__tests__/notify-hook-all-workers-idle.test.js.map +1 -1
  118. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +225 -0
  119. package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js.map +1 -1
  120. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js +75 -0
  121. package/dist/hooks/__tests__/notify-hook-team-dispatch.test.js.map +1 -1
  122. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js +200 -0
  123. package/dist/hooks/__tests__/notify-hook-team-leader-nudge.test.js.map +1 -1
  124. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js +187 -12
  125. package/dist/hooks/__tests__/notify-hook-team-tmux-guard.test.js.map +1 -1
  126. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js +225 -0
  127. package/dist/hooks/__tests__/notify-hook-tmux-heal.test.js.map +1 -1
  128. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js +0 -0
  129. package/dist/hooks/__tests__/notify-hook-tmux-scrollback.test.js.map +1 -1
  130. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js +75 -0
  131. package/dist/hooks/__tests__/notify-hook-worker-idle.test.js.map +1 -1
  132. package/dist/hooks/keyword-detector.d.ts.map +1 -1
  133. package/dist/hooks/keyword-detector.js +4 -0
  134. package/dist/hooks/keyword-detector.js.map +1 -1
  135. package/dist/hud/__tests__/reconcile.test.js +137 -2
  136. package/dist/hud/__tests__/reconcile.test.js.map +1 -1
  137. package/dist/hud/__tests__/state.test.js +107 -0
  138. package/dist/hud/__tests__/state.test.js.map +1 -1
  139. package/dist/hud/__tests__/tmux.test.js +17 -0
  140. package/dist/hud/__tests__/tmux.test.js.map +1 -1
  141. package/dist/hud/reconcile.d.ts.map +1 -1
  142. package/dist/hud/reconcile.js +21 -7
  143. package/dist/hud/reconcile.js.map +1 -1
  144. package/dist/hud/render.d.ts.map +1 -1
  145. package/dist/hud/render.js +9 -0
  146. package/dist/hud/render.js.map +1 -1
  147. package/dist/hud/state.d.ts.map +1 -1
  148. package/dist/hud/state.js +43 -5
  149. package/dist/hud/state.js.map +1 -1
  150. package/dist/hud/types.d.ts +6 -0
  151. package/dist/hud/types.d.ts.map +1 -1
  152. package/dist/hud/types.js.map +1 -1
  153. package/dist/modes/__tests__/base-autopilot-gates.test.js +48 -0
  154. package/dist/modes/__tests__/base-autopilot-gates.test.js.map +1 -1
  155. package/dist/modes/base.d.ts.map +1 -1
  156. package/dist/modes/base.js +1 -0
  157. package/dist/modes/base.js.map +1 -1
  158. package/dist/performance-goal/artifacts.d.ts.map +1 -1
  159. package/dist/performance-goal/artifacts.js +10 -1
  160. package/dist/performance-goal/artifacts.js.map +1 -1
  161. package/dist/ralplan/__tests__/consensus-gate.test.js +112 -0
  162. package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -1
  163. package/dist/ralplan/consensus-gate.d.ts +23 -0
  164. package/dist/ralplan/consensus-gate.d.ts.map +1 -1
  165. package/dist/ralplan/consensus-gate.js +133 -21
  166. package/dist/ralplan/consensus-gate.js.map +1 -1
  167. package/dist/scripts/__tests__/codex-native-hook.test.js +831 -2
  168. package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
  169. package/dist/scripts/codex-native-hook.d.ts.map +1 -1
  170. package/dist/scripts/codex-native-hook.js +486 -21
  171. package/dist/scripts/codex-native-hook.js.map +1 -1
  172. package/dist/scripts/notify-hook/team-tmux-guard.d.ts.map +1 -1
  173. package/dist/scripts/notify-hook/team-tmux-guard.js +87 -8
  174. package/dist/scripts/notify-hook/team-tmux-guard.js.map +1 -1
  175. package/dist/scripts/notify-hook/tmux-injection.js +1 -1
  176. package/dist/scripts/notify-hook/tmux-injection.js.map +1 -1
  177. package/dist/scripts/run-compiled-ci.d.ts +2 -0
  178. package/dist/scripts/run-compiled-ci.d.ts.map +1 -0
  179. package/dist/scripts/run-compiled-ci.js +77 -0
  180. package/dist/scripts/run-compiled-ci.js.map +1 -0
  181. package/dist/scripts/sync-plugin-mirror.d.ts.map +1 -1
  182. package/dist/scripts/sync-plugin-mirror.js +1 -0
  183. package/dist/scripts/sync-plugin-mirror.js.map +1 -1
  184. package/dist/session-history/search.d.ts.map +1 -1
  185. package/dist/session-history/search.js +24 -9
  186. package/dist/session-history/search.js.map +1 -1
  187. package/dist/state/__tests__/operations.test.js +107 -3
  188. package/dist/state/__tests__/operations.test.js.map +1 -1
  189. package/dist/state/operations.d.ts.map +1 -1
  190. package/dist/state/operations.js +57 -2
  191. package/dist/state/operations.js.map +1 -1
  192. package/dist/team/__tests__/delivery-e2e-smoke.test.js +22 -1
  193. package/dist/team/__tests__/delivery-e2e-smoke.test.js.map +1 -1
  194. package/dist/team/__tests__/model-contract.test.js +57 -1
  195. package/dist/team/__tests__/model-contract.test.js.map +1 -1
  196. package/dist/team/__tests__/runtime.test.js +1468 -110
  197. package/dist/team/__tests__/runtime.test.js.map +1 -1
  198. package/dist/team/__tests__/scaling.test.js +63 -0
  199. package/dist/team/__tests__/scaling.test.js.map +1 -1
  200. package/dist/team/__tests__/state.test.js +24 -1
  201. package/dist/team/__tests__/state.test.js.map +1 -1
  202. package/dist/team/__tests__/tmux-session.test.js +512 -0
  203. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  204. package/dist/team/__tests__/worker-bootstrap.test.js +42 -9
  205. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  206. package/dist/team/model-contract.d.ts +16 -0
  207. package/dist/team/model-contract.d.ts.map +1 -1
  208. package/dist/team/model-contract.js +41 -1
  209. package/dist/team/model-contract.js.map +1 -1
  210. package/dist/team/runtime.d.ts.map +1 -1
  211. package/dist/team/runtime.js +116 -30
  212. package/dist/team/runtime.js.map +1 -1
  213. package/dist/team/scaling.d.ts.map +1 -1
  214. package/dist/team/scaling.js +9 -1
  215. package/dist/team/scaling.js.map +1 -1
  216. package/dist/team/state/types.d.ts +2 -0
  217. package/dist/team/state/types.d.ts.map +1 -1
  218. package/dist/team/state/types.js.map +1 -1
  219. package/dist/team/state.d.ts +3 -0
  220. package/dist/team/state.d.ts.map +1 -1
  221. package/dist/team/state.js +20 -0
  222. package/dist/team/state.js.map +1 -1
  223. package/dist/team/tmux-session.d.ts +38 -3
  224. package/dist/team/tmux-session.d.ts.map +1 -1
  225. package/dist/team/tmux-session.js +275 -36
  226. package/dist/team/tmux-session.js.map +1 -1
  227. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  228. package/dist/team/worker-bootstrap.js +26 -1
  229. package/dist/team/worker-bootstrap.js.map +1 -1
  230. package/dist/ultragoal/__tests__/artifacts.test.js +238 -0
  231. package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -1
  232. package/dist/ultragoal/__tests__/docs-contract.test.js +3 -0
  233. package/dist/ultragoal/__tests__/docs-contract.test.js.map +1 -1
  234. package/dist/ultragoal/artifacts.d.ts +15 -0
  235. package/dist/ultragoal/artifacts.d.ts.map +1 -1
  236. package/dist/ultragoal/artifacts.js +167 -4
  237. package/dist/ultragoal/artifacts.js.map +1 -1
  238. package/dist/utils/__tests__/agents-md.test.js +39 -1
  239. package/dist/utils/__tests__/agents-md.test.js.map +1 -1
  240. package/dist/utils/__tests__/agents-model-table.test.js +28 -0
  241. package/dist/utils/__tests__/agents-model-table.test.js.map +1 -1
  242. package/dist/utils/agents-md.d.ts +4 -0
  243. package/dist/utils/agents-md.d.ts.map +1 -1
  244. package/dist/utils/agents-md.js +25 -0
  245. package/dist/utils/agents-md.js.map +1 -1
  246. package/dist/utils/agents-model-table.d.ts +7 -3
  247. package/dist/utils/agents-model-table.d.ts.map +1 -1
  248. package/dist/utils/agents-model-table.js +16 -8
  249. package/dist/utils/agents-model-table.js.map +1 -1
  250. package/dist/verification/__tests__/ci-rust-gates.test.js +4 -0
  251. package/dist/verification/__tests__/ci-rust-gates.test.js.map +1 -1
  252. package/package.json +2 -2
  253. package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
  254. package/plugins/oh-my-codex/hooks/codex-native-hook.mjs +59 -8
  255. package/plugins/oh-my-codex/skills/autopilot/SKILL.md +9 -5
  256. package/plugins/oh-my-codex/skills/autoresearch-goal/SKILL.md +3 -0
  257. package/plugins/oh-my-codex/skills/performance-goal/SKILL.md +3 -0
  258. package/plugins/oh-my-codex/skills/ralplan/SKILL.md +1 -1
  259. package/plugins/oh-my-codex/skills/ultragoal/SKILL.md +22 -4
  260. package/plugins/oh-my-codex/skills/ultrawork/SKILL.md +2 -2
  261. package/plugins/oh-my-codex/skills/ultrawork/references/agent-tiers.md +61 -0
  262. package/skills/autopilot/SKILL.md +9 -5
  263. package/skills/autoresearch-goal/SKILL.md +3 -0
  264. package/skills/ecomode/SKILL.md +1 -1
  265. package/skills/ecomode/references/agent-tiers.md +61 -0
  266. package/skills/performance-goal/SKILL.md +3 -0
  267. package/skills/ralplan/SKILL.md +1 -1
  268. package/skills/ultragoal/SKILL.md +22 -4
  269. package/skills/ultrawork/SKILL.md +2 -2
  270. package/skills/ultrawork/references/agent-tiers.md +61 -0
  271. package/src/scripts/__tests__/codex-native-hook.test.ts +975 -40
  272. package/src/scripts/codex-native-hook.ts +529 -22
  273. package/src/scripts/notify-hook/team-tmux-guard.ts +92 -8
  274. package/src/scripts/notify-hook/tmux-injection.ts +1 -1
  275. package/src/scripts/run-compiled-ci.ts +85 -0
  276. package/src/scripts/sync-plugin-mirror.ts +1 -0
  277. package/templates/AGENTS.md +6 -0
@@ -37,7 +37,8 @@ Autopilot must not run a separate broad expansion/planning/execution/QA/validati
37
37
 
38
38
  2. **Phase `ralplan`** — consensus planning gate
39
39
  - Ground the task with pre-context intake and the deep-interview artifact.
40
- - Run or resume `$ralplan` to produce/update PRD and test-spec artifacts.
40
+ - Current ownership rule: Autopilot records `planning_routing` in state before heavy planning. When the Autopilot/main model resolves to a cheap/mini lane (for example `o4-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 configured `agentModels.planner` is an explicit opt-in that forces dedicated `[planner]` ownership even when `[main]` is not cheap/mini.
41
+ - Run or resume `$ralplan` to produce/update PRD and test-spec artifacts. If `planning_routing.owner` is `planner`, use the dedicated `[planner]` role for the initial Planner draft/decomposition before the Architect→Critic consensus gates.
41
42
  - PRD/test-spec files alone are not completion evidence. Ralplan may hand off only after durable consensus evidence records a subsequent `Architect` approval first and a subsequent `Critic` approval second.
42
43
  - When returning from a non-clean review or QA pass, include `return_to_ralplan_reason` and the findings as first-class planning input.
43
44
  - If either review is missing, blocked, out of order, or non-approving, remain in `ralplan` or report an explicit blocker/max-iteration outcome; do not progress to `$ultragoal`, `$team`, `$ralph`, or implementation.
@@ -53,7 +54,7 @@ Autopilot must not run a separate broad expansion/planning/execution/QA/validati
53
54
  - Run `$code-review` on the diff/artifacts produced by `$ultragoal`.
54
55
  - A clean review means final recommendation `APPROVE` with architectural status `CLEAR`.
55
56
  - `COMMENT`, `REQUEST CHANGES`, any architectural `WATCH`/`BLOCK`, or any unresolved finding is not clean.
56
- - If not clean, increment the review cycle, persist `review_verdict`, set `return_to_ralplan_reason`, and transition back to Phase `ralplan`.
57
+ - If not clean because the implementation must be repaired, increment the review cycle, persist `review_verdict`, set `current_phase:"rework"`, and carry the findings as the sanctioned execution-fix input. Return to Phase `ralplan` only when the review shows the plan/requirements are wrong or incomplete.
57
58
 
58
59
  5. **Phase `ultraqa`** — adversarial QA gate
59
60
  - Run `$ultraqa` after a clean code review when user-facing behavior, workflows, CLI/runtime behavior, integration surfaces, or regression risk warrant adversarial QA.
@@ -84,7 +85,7 @@ Before Phase `deep-interview` or `ralplan` starts or resumes:
84
85
  - Always execute the recommended phases in order: `deep-interview`, then `ralplan`, then `ultragoal`, then `code-review`, then `ultraqa`.
85
86
  - `$team` is conditional and explicit: use it only within an Ultragoal story when parallel execution materially improves throughput, quality, or safety.
86
87
  - Never skip directly from vague/freeform expansion to implementation; unclear input must be clarified and planned through `$deep-interview` and `$ralplan`.
87
- - A non-clean `$code-review` or failed `$ultraqa` always returns to `$ralplan`; do not patch findings ad hoc outside the loop.
88
+ - A non-clean `$code-review` that requires implementation repair enters Phase `rework`; a non-clean review that changes the plan/requirements, or failed `$ultraqa`, returns to `$ralplan`.
88
89
  - Each phase must write/update Autopilot state before handing off.
89
90
  - Use existing hooks, `.omx/state`, `$deep-interview`, `$ralplan`, `$ultragoal`, optional `$team`, `$code-review`, `$ultraqa`, and pipeline primitives; do not invent a separate execution framework.
90
91
  - Preserve legacy compatibility: if a user explicitly requests the old Ralph execution lane, use `$ralph` as an intentional alternate execution phase, but do not present it as Autopilot's default recommended loop.
@@ -140,8 +141,9 @@ Required fields:
140
141
  - **On missing ralplan consensus evidence**: keep `current_phase:"ralplan"`, persist `ralplan_consensus_gate.complete:false` with `blocked_reason`, and report an explicit blocker or max-iteration outcome instead of handing off to execution.
141
142
  - **On ultragoal -> code-review**: set `current_phase:"code-review"`, persist implementation/test/ledger evidence under `handoff_artifacts.ultragoal`.
142
143
  - **On code-review -> ultraqa**: set `current_phase:"ultraqa"` only after a real `$code-review` stage/subagent has produced durable evidence; persist the clean review under `handoff_artifacts.code_review` with its source thread/tool/stage reference. Do not author `review_verdict:{clean:true}` from the leader's own summary.
144
+ - **On non-clean code-review requiring implementation repair**: increment `review_cycle`, set `current_phase:"rework"`, persist `review_verdict`, persist the phase handoff under `handoff_artifacts.code_review`, and keep the fix scoped to the review findings before returning to `code-review`.
143
145
  - **On clean review + passed/skipped QA**: set `active:false`, `current_phase:"complete"`, persist `review_verdict:{recommendation:"APPROVE", architectural_status:"CLEAR", clean:true}`, `qa_verdict:{clean:true, skipped:<boolean>, reason:<string|null>}`, and `completed_at` only when both gates have durable source evidence. Required evidence is either (a) actual `$code-review`/`$ultraqa` stage 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 at `code-review` or `ultraqa` and record a blocker instead of self-attesting a clean gate.
144
- - **On non-clean review or failed QA**: increment `iteration` and `review_cycle`, set `current_phase:"ralplan"`, persist `review_verdict` or `qa_verdict`, persist the phase handoff, and set `return_to_ralplan_reason` to a concise findings-driven reason.
146
+ - **On non-clean review requiring plan changes or failed QA**: increment `iteration` and `review_cycle`, set `current_phase:"ralplan"`, persist `review_verdict` or `qa_verdict`, persist the phase handoff, and set `return_to_ralplan_reason` to a concise findings-driven reason.
145
147
  - **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.
146
148
  - **On cancellation**: run `$cancel`; preserve progress for resume rather than deleting handoff artifacts.
147
149
  </State_Management>
@@ -151,6 +153,7 @@ When the user says `continue`, `resume`, or `keep going` while Autopilot is acti
151
153
  - `deep-interview`: clarify requirements and record the handoff artifact.
152
154
  - `ralplan`: run/update consensus planning from current handoffs and any `return_to_ralplan_reason`.
153
155
  - `ultragoal`: execute the approved plan durably and record verification/ledger evidence.
156
+ - `rework`: perform only the implementation fixes required by the current code-review findings, record fresh implementation/verification evidence, and return to `code-review`.
154
157
  - `team`: continue explicit team work only when it is nested under the active Ultragoal story and report evidence back to the leader.
155
158
  - `code-review`: review the current diff and decide clean vs return-to-ralplan.
156
159
  - `ultraqa`: run or explicitly skip adversarial QA based on the documented condition, then finish if clean or transition to `ralplan` with findings if not clean.
@@ -167,7 +170,7 @@ Autopilot may be represented by the configurable pipeline orchestrator (`src/pip
167
170
  deep-interview -> ralplan -> ultragoal -> code-review -> ultraqa
168
171
  ```
169
172
 
170
- Pipeline state should use `current_phase` values that match the same phase names (`deep-interview`, `ralplan`, `ultragoal`, `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.
173
+ 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.
171
174
  </Pipeline_Orchestrator>
172
175
 
173
176
  <Escalation_And_Stop_Conditions>
@@ -181,6 +184,7 @@ Pipeline state should use `current_phase` values that match the same phase names
181
184
  - [ ] Phase `deep-interview` produced/updated clarified requirements or a concise spec
182
185
  - [ ] Phase `ralplan` produced/updated approved planning artifacts and durable sequential evidence from a subsequent `Architect` approval followed by a subsequent `Critic` approval
183
186
  - [ ] Phase `ultragoal` implemented and verified the plan with fresh evidence and durable ledger/checkpoint references
187
+ - [ ] Phase `rework` was used for implementation-only review fixes when applicable, with findings scoped to a fresh code-review cycle
184
188
  - [ ] `$team` was used only if the active Ultragoal story needed coordinated parallel work, or explicitly recorded as not needed
185
189
  - [ ] Phase `code-review` returned a clean verdict (`APPROVE` + `CLEAR`)
186
190
  - [ ] Phase `ultraqa` passed, or was explicitly skipped because the change was docs-only/trivially non-runtime with evidence
@@ -31,6 +31,9 @@ Use this workflow when a research mission should be bound to Codex goal-mode foc
31
31
  5. Completion is blocked until professor-critic validation records `verdict=pass`. After the mission audit passes, call `update_goal({status: "complete"})`, call `get_goal` again, then run:
32
32
  `omx autoresearch-goal complete --slug <slug> --codex-goal-json <get_goal-json-or-path>`
33
33
  6. Treat the completion command as read-only reconciliation plus durable OMX state update; hooks and shell commands must not mutate Codex goal state.
34
+ 7. After the completion command succeeds, run `/goal clear` in the Codex UI before starting another goal in this same thread/session. OMX prints this terminal cleanup step but does not invoke hidden clear routes.
34
35
 
35
36
  ## Completion gate
36
37
  A passing professor-critic artifact and a matching complete Codex `get_goal` snapshot are required. Assistant prose, partial tests, or a failed/blocked verdict are not sufficient.
38
+
39
+ Lifecycle: `create_goal` starts the Codex thread goal, `update_goal({status: "complete"})` marks terminal success after the professor-critic and audit pass, and `/goal clear` removes the completed thread goal when another same-thread goal is needed. OMX shell commands and hooks reconcile snapshots and print the cleanup instruction; they must not mutate hidden Codex goal state.
@@ -55,6 +55,7 @@ omx performance-goal complete --slug startup-latency --evidence "final evaluator
55
55
  - call `create_goal` only when no active goal exists and the objective is explicit;
56
56
  - work only against the evaluator contract;
57
57
  - after evaluator pass and completion audit, call `update_goal({status: "complete"})`, call `get_goal` again, and pass that snapshot to `omx performance-goal complete --codex-goal-json`;
58
+ - after `omx performance-goal complete` succeeds, run `/goal clear` in the Codex UI before starting another goal in this same thread/session; OMX prints this terminal cleanup step but does not invoke hidden clear routes;
58
59
  3. Optimize in small reversible patches.
59
60
  4. Run the evaluator and related regression tests.
60
61
  5. Record each pass/fail/blocker with `checkpoint`.
@@ -63,3 +64,5 @@ omx performance-goal complete --slug startup-latency --evidence "final evaluator
63
64
  ## Completion Gate
64
65
 
65
66
  A performance goal is incomplete unless `.omx/goals/performance/<slug>/state.json` contains a `lastValidation.status` of `pass` and `omx performance-goal complete` receives a matching complete Codex `get_goal` snapshot via `--codex-goal-json`. Passing ordinary tests alone is not sufficient unless they are the declared evaluator contract.
67
+
68
+ Lifecycle: `create_goal` starts the Codex thread goal, `update_goal({status: "complete"})` marks terminal success after the evaluator and audit pass, and `/goal clear` removes the completed thread goal when another same-thread goal is needed. OMX shell commands and hooks reconcile snapshots and print the cleanup instruction; they must not mutate hidden Codex goal state.
@@ -42,7 +42,7 @@ $plan --consensus --interactive <arguments>
42
42
  ```
43
43
 
44
44
  The consensus workflow:
45
- 1. **Planner** creates an adaptive plan (right-sized to task scope; do not default to exactly five steps) and a compact **RALPLAN-DR summary** before review:
45
+ 1. **Planner** creates an adaptive plan (right-sized to task scope; do not default to exactly five steps) and a compact **RALPLAN-DR summary** before review. Current `[main]` vs `[planner]` behavior: standalone `$ralplan` may be authored by the active main planning lane unless the caller/runtime supplies a dedicated planner routing record; inside `$autopilot`, state field `planning_routing.owner:"planner"` means the initial Planner draft/decomposition must use dedicated `[planner]`. Set `.omx-config.json` `agentModels.planner` to opt into a specific planner model and force dedicated planner ownership for complex Autopilot planning even when `[main]` is not cheap/mini. The RALPLAN-DR summary includes:
46
46
  - Principles (3-5)
47
47
  - Decision Drivers (top 3)
48
48
  - Viable Options (>=2) with bounded pros/cons
@@ -94,8 +94,10 @@ The final ultragoal story is not complete until the active agent has run the fin
94
94
  1. Run targeted verification for the story.
95
95
  2. Run `ai-slop-cleaner` on changed files only; if there are no relevant edits, the cleaner still runs and records a passed/no-op report.
96
96
  3. Rerun verification after the cleaner pass.
97
- 4. Run `$code-review` through the independent review path. Clean means `codeReview.recommendation: "APPROVE"`, `codeReview.architectStatus: "CLEAR"`, and `codeReview.independentReview` contains distinct completed `code-reviewer` and `architect` subagent evidence. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing subagent evidence, unavailable delegation, and same-lane/self-review are non-clean.
98
- 5. If review is non-clean, do **not** call `update_goal`. Record durable blocker work instead:
97
+ 4. Run the architecture-invariant audit: derive non-negotiable architecture/domain invariants from the brief/spec/interview/accepted steering/goal artifacts, list the source artifacts, and prove each required invariant with implementation, test, and independent review evidence.
98
+ 5. Run `$code-review` through the independent review path. Clean means `codeReview.recommendation: "APPROVE"`, `codeReview.architectStatus: "CLEAR"`, `codeReview.independentReview` contains distinct completed `code-reviewer` and `architect` subagent evidence, and `architectureInvariantGate.status: "passed"` proves every required invariant. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing subagent evidence, unavailable delegation, same-lane/self-review, and unproved architecture invariants are non-clean.
99
+ 6. If review or invariant proof is non-clean, do **not** call `update_goal`. Record durable blocker work instead:
100
+
99
101
 
100
102
  ```sh
101
103
  omx ultragoal record-review-blockers --goal-id <id> --title "Resolve final code-review blockers" --objective "<blocker-resolution objective>" --evidence "<review findings>" --codex-goal-json <active-get-goal-json-or-path>
@@ -103,7 +105,8 @@ The final ultragoal story is not complete until the active agent has run the fin
103
105
 
104
106
  This marks the current story `review_blocked`, appends a pending blocker-resolution story, keeps the Codex goal active, and lets `omx ultragoal complete-goals` start the blocker next. In legacy per-story mode, the blocker may need an available Codex goal context because the old per-story Codex goal remains active/incomplete.
105
107
 
106
- 6. If review is clean, call `update_goal({status: "complete"})`, call `get_goal`, and checkpoint with a structured final gate:
108
+ 7. If review and invariant proof are clean, call `update_goal({status: "complete"})`, call `get_goal`, and checkpoint with a structured final gate:
109
+
107
110
 
108
111
  ```sh
109
112
  omx ultragoal checkpoint --goal-id <id> --status complete --evidence "<tests/files/review evidence>" --codex-goal-json <fresh-complete-get-goal-json-or-path> --quality-gate-json <quality-gate-json-or-path>
@@ -123,6 +126,21 @@ The final ultragoal story is not complete until the active agent has run the fin
123
126
  "codeReviewer": { "agentRole": "code-reviewer", "evidence": "code-reviewer subagent APPROVE evidence" },
124
127
  "architect": { "agentRole": "architect", "evidence": "architect subagent CLEAR evidence" }
125
128
  }
129
+ },
130
+ "architectureInvariantGate": {
131
+ "status": "passed",
132
+ "sourceArtifacts": [".omx/ultragoal/brief.md", ".omx/ultragoal/goals.json"],
133
+ "evidence": "final invariant audit proved all required architecture/domain invariants",
134
+ "invariants": [
135
+ {
136
+ "invariant": "Preserve the existing parser boundary.",
137
+ "source": ".omx/ultragoal/brief.md#architecture-invariants",
138
+ "status": "proved",
139
+ "implementationEvidence": "changed files preserve the parser boundary",
140
+ "testEvidence": "parser-boundary regression passed",
141
+ "reviewEvidence": "architect review confirmed the boundary is intact"
142
+ }
143
+ ]
126
144
  }
127
145
  }
128
146
  ```
@@ -131,7 +149,7 @@ The final ultragoal story is not complete until the active agent has run the fin
131
149
 
132
150
  - The shell command cannot directly invoke Codex interactive `/goal`; it emits a model-facing handoff for the active Codex agent.
133
151
  - Ultragoal intentionally does not invoke `/goal clear` or hidden `thread/goal/clear`; the model-facing tool surface only provides `get_goal`, `create_goal`, and `update_goal`.
134
- - After a completed aggregate ultragoal run, clear the Codex goal manually with `/goal clear` before starting another ultragoal run in the same session/thread.
152
+ - After a completed aggregate ultragoal run, `/goal clear` is the explicit terminal cleanup step before starting another goal in the same Codex thread/session: `create_goal` starts, `update_goal({status: "complete"})` marks terminal success, and `/goal clear` removes the completed thread goal for the next same-thread goal. OMX prints this next step but does not invoke hidden clear routes.
135
153
  - Never call `create_goal` when `get_goal` reports a different active goal.
136
154
  - Never call `update_goal` unless the aggregate run or legacy per-story goal is actually complete.
137
155
  - In aggregate mode, intermediate story checkpoints require a matching `active` Codex snapshot; final story completion requires a matching `complete` snapshot after `update_goal`.
@@ -35,7 +35,7 @@ Sequential task execution wastes time when tasks are independent. Ultrawork keep
35
35
  - When useful, run a direct-tool lane and one or more background evidence lanes at the same time. Evidence lanes can cover docs, tests, regression mapping, or bounded repo analysis.
36
36
  - Fire independent agent calls simultaneously -- never serialize independent work.
37
37
  - Always pass the `model` parameter explicitly when delegating.
38
- - Read `docs/shared/agent-tiers.md` before first delegation for agent selection guidance.
38
+ - Read `references/agent-tiers.md` before first delegation for agent selection guidance.
39
39
  - Auto-delegate `researcher` when official docs, version-aware framework guidance, best practices, or external dependency behavior materially affect task correctness; treat it as an evidence lane, not a replacement primary workflow.
40
40
  - Use `run_in_background: true` for operations over ~30 seconds (installs, builds, tests).
41
41
  - Run quick commands (git status, file reads, simple checks) in the foreground.
@@ -44,7 +44,7 @@ Sequential task execution wastes time when tasks are independent. Ultrawork keep
44
44
  </Execution_Policy>
45
45
 
46
46
  <Steps>
47
- 1. **Read agent reference**: Load `docs/shared/agent-tiers.md` for tier selection.
47
+ 1. **Read agent reference**: Load `references/agent-tiers.md` for tier selection.
48
48
  2. **Context + certainty check**:
49
49
  - State the task intent in one sentence.
50
50
  - List the constraints and unknowns that could invalidate a quick fix.
@@ -0,0 +1,61 @@
1
+ # Agent Tiers
2
+
3
+ This file defines practical tier guidance for OMX agent routing.
4
+
5
+ ## Mental Model
6
+
7
+ OMX now separates three concepts:
8
+
9
+ - `role`: what the agent is responsible for (`executor`, `planner`, `architect`)
10
+ - `tier`: how much reasoning/cost to spend (`LOW`, `STANDARD`, `THOROUGH`)
11
+ - `posture`: how the role behaves (`frontier-orchestrator`, `deep-worker`, `fast-lane`)
12
+ - `exactModel`: optional role pin that bypasses tier defaults when a role needs a
13
+ specific model contract.
14
+
15
+ Use role to choose responsibility, tier to choose depth, and posture to choose operating style.
16
+
17
+ ## Tiers
18
+
19
+ - `LOW`:
20
+ Fast lookups and narrow checks.
21
+ Use for simple exploration, style checks, and lightweight doc edits.
22
+ Typical roles: `explore`, `style-reviewer`, `writer`.
23
+
24
+ - `STANDARD`:
25
+ Default tier for implementation, debugging, and normal verification.
26
+ Typical roles: `executor`, `debugger`, `test-engineer`, `quality-reviewer`.
27
+
28
+ - `THOROUGH`:
29
+ Use for architectural, security-sensitive, or high-impact multi-file work.
30
+ Typical roles: `architect`, `critic`, `security-reviewer`, `executor`.
31
+ Note: `deep-executor` is deprecated; route implementation to `executor`.
32
+
33
+ ## Selection Rules
34
+
35
+ 1. Start at `STANDARD` for most code changes.
36
+ 2. Use `LOW` only when the task is bounded and non-invasive.
37
+ 3. Escalate to `THOROUGH` for:
38
+ - security/auth/trust-boundary changes
39
+ - architectural decisions with system-wide impact
40
+ - large refactors across many files
41
+ 4. For Ralph completion checks, use at least `STANDARD` architect verification.
42
+
43
+ ## Posture Guidance
44
+
45
+ - `frontier-orchestrator`:
46
+ - Best for steerable frontier models and leader-style roles.
47
+ - Prioritizes intent classification, delegation, verification, and architectural judgment.
48
+ - Typical roles: `planner`, `analyst`, `architect`, `critic`, `code-reviewer`.
49
+ - Ralplan keeps `planner` and `architect` in this posture but pins them to
50
+ exact `gpt-5.4-mini` with high reasoning; the `critic` consensus gate stays
51
+ on the frontier lane.
52
+
53
+ - `deep-worker`:
54
+ - Best for implementation-heavy roles that should carry work to completion.
55
+ - Prioritizes direct execution, minimal diffs, and strict verification.
56
+ - Typical roles: `executor`, `debugger`, `test-engineer`, `build-fixer`.
57
+
58
+ - `fast-lane`:
59
+ - Best for cheap/fast models used for triage, search, and narrow synthesis.
60
+ - Prioritizes quick routing, concise search, and escalation over deep autonomous work.
61
+ - Typical roles: `explore`, `writer`, and lightweight research/search specialists.
@@ -37,7 +37,8 @@ Autopilot must not run a separate broad expansion/planning/execution/QA/validati
37
37
 
38
38
  2. **Phase `ralplan`** — consensus planning gate
39
39
  - Ground the task with pre-context intake and the deep-interview artifact.
40
- - Run or resume `$ralplan` to produce/update PRD and test-spec artifacts.
40
+ - Current ownership rule: Autopilot records `planning_routing` in state before heavy planning. When the Autopilot/main model resolves to a cheap/mini lane (for example `o4-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 configured `agentModels.planner` is an explicit opt-in that forces dedicated `[planner]` ownership even when `[main]` is not cheap/mini.
41
+ - Run or resume `$ralplan` to produce/update PRD and test-spec artifacts. If `planning_routing.owner` is `planner`, use the dedicated `[planner]` role for the initial Planner draft/decomposition before the Architect→Critic consensus gates.
41
42
  - PRD/test-spec files alone are not completion evidence. Ralplan may hand off only after durable consensus evidence records a subsequent `Architect` approval first and a subsequent `Critic` approval second.
42
43
  - When returning from a non-clean review or QA pass, include `return_to_ralplan_reason` and the findings as first-class planning input.
43
44
  - If either review is missing, blocked, out of order, or non-approving, remain in `ralplan` or report an explicit blocker/max-iteration outcome; do not progress to `$ultragoal`, `$team`, `$ralph`, or implementation.
@@ -53,7 +54,7 @@ Autopilot must not run a separate broad expansion/planning/execution/QA/validati
53
54
  - Run `$code-review` on the diff/artifacts produced by `$ultragoal`.
54
55
  - A clean review means final recommendation `APPROVE` with architectural status `CLEAR`.
55
56
  - `COMMENT`, `REQUEST CHANGES`, any architectural `WATCH`/`BLOCK`, or any unresolved finding is not clean.
56
- - If not clean, increment the review cycle, persist `review_verdict`, set `return_to_ralplan_reason`, and transition back to Phase `ralplan`.
57
+ - If not clean because the implementation must be repaired, increment the review cycle, persist `review_verdict`, set `current_phase:"rework"`, and carry the findings as the sanctioned execution-fix input. Return to Phase `ralplan` only when the review shows the plan/requirements are wrong or incomplete.
57
58
 
58
59
  5. **Phase `ultraqa`** — adversarial QA gate
59
60
  - Run `$ultraqa` after a clean code review when user-facing behavior, workflows, CLI/runtime behavior, integration surfaces, or regression risk warrant adversarial QA.
@@ -84,7 +85,7 @@ Before Phase `deep-interview` or `ralplan` starts or resumes:
84
85
  - Always execute the recommended phases in order: `deep-interview`, then `ralplan`, then `ultragoal`, then `code-review`, then `ultraqa`.
85
86
  - `$team` is conditional and explicit: use it only within an Ultragoal story when parallel execution materially improves throughput, quality, or safety.
86
87
  - Never skip directly from vague/freeform expansion to implementation; unclear input must be clarified and planned through `$deep-interview` and `$ralplan`.
87
- - A non-clean `$code-review` or failed `$ultraqa` always returns to `$ralplan`; do not patch findings ad hoc outside the loop.
88
+ - A non-clean `$code-review` that requires implementation repair enters Phase `rework`; a non-clean review that changes the plan/requirements, or failed `$ultraqa`, returns to `$ralplan`.
88
89
  - Each phase must write/update Autopilot state before handing off.
89
90
  - Use existing hooks, `.omx/state`, `$deep-interview`, `$ralplan`, `$ultragoal`, optional `$team`, `$code-review`, `$ultraqa`, and pipeline primitives; do not invent a separate execution framework.
90
91
  - Preserve legacy compatibility: if a user explicitly requests the old Ralph execution lane, use `$ralph` as an intentional alternate execution phase, but do not present it as Autopilot's default recommended loop.
@@ -140,8 +141,9 @@ Required fields:
140
141
  - **On missing ralplan consensus evidence**: keep `current_phase:"ralplan"`, persist `ralplan_consensus_gate.complete:false` with `blocked_reason`, and report an explicit blocker or max-iteration outcome instead of handing off to execution.
141
142
  - **On ultragoal -> code-review**: set `current_phase:"code-review"`, persist implementation/test/ledger evidence under `handoff_artifacts.ultragoal`.
142
143
  - **On code-review -> ultraqa**: set `current_phase:"ultraqa"` only after a real `$code-review` stage/subagent has produced durable evidence; persist the clean review under `handoff_artifacts.code_review` with its source thread/tool/stage reference. Do not author `review_verdict:{clean:true}` from the leader's own summary.
144
+ - **On non-clean code-review requiring implementation repair**: increment `review_cycle`, set `current_phase:"rework"`, persist `review_verdict`, persist the phase handoff under `handoff_artifacts.code_review`, and keep the fix scoped to the review findings before returning to `code-review`.
143
145
  - **On clean review + passed/skipped QA**: set `active:false`, `current_phase:"complete"`, persist `review_verdict:{recommendation:"APPROVE", architectural_status:"CLEAR", clean:true}`, `qa_verdict:{clean:true, skipped:<boolean>, reason:<string|null>}`, and `completed_at` only when both gates have durable source evidence. Required evidence is either (a) actual `$code-review`/`$ultraqa` stage 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 at `code-review` or `ultraqa` and record a blocker instead of self-attesting a clean gate.
144
- - **On non-clean review or failed QA**: increment `iteration` and `review_cycle`, set `current_phase:"ralplan"`, persist `review_verdict` or `qa_verdict`, persist the phase handoff, and set `return_to_ralplan_reason` to a concise findings-driven reason.
146
+ - **On non-clean review requiring plan changes or failed QA**: increment `iteration` and `review_cycle`, set `current_phase:"ralplan"`, persist `review_verdict` or `qa_verdict`, persist the phase handoff, and set `return_to_ralplan_reason` to a concise findings-driven reason.
145
147
  - **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.
146
148
  - **On cancellation**: run `$cancel`; preserve progress for resume rather than deleting handoff artifacts.
147
149
  </State_Management>
@@ -151,6 +153,7 @@ When the user says `continue`, `resume`, or `keep going` while Autopilot is acti
151
153
  - `deep-interview`: clarify requirements and record the handoff artifact.
152
154
  - `ralplan`: run/update consensus planning from current handoffs and any `return_to_ralplan_reason`.
153
155
  - `ultragoal`: execute the approved plan durably and record verification/ledger evidence.
156
+ - `rework`: perform only the implementation fixes required by the current code-review findings, record fresh implementation/verification evidence, and return to `code-review`.
154
157
  - `team`: continue explicit team work only when it is nested under the active Ultragoal story and report evidence back to the leader.
155
158
  - `code-review`: review the current diff and decide clean vs return-to-ralplan.
156
159
  - `ultraqa`: run or explicitly skip adversarial QA based on the documented condition, then finish if clean or transition to `ralplan` with findings if not clean.
@@ -167,7 +170,7 @@ Autopilot may be represented by the configurable pipeline orchestrator (`src/pip
167
170
  deep-interview -> ralplan -> ultragoal -> code-review -> ultraqa
168
171
  ```
169
172
 
170
- Pipeline state should use `current_phase` values that match the same phase names (`deep-interview`, `ralplan`, `ultragoal`, `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.
173
+ 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.
171
174
  </Pipeline_Orchestrator>
172
175
 
173
176
  <Escalation_And_Stop_Conditions>
@@ -181,6 +184,7 @@ Pipeline state should use `current_phase` values that match the same phase names
181
184
  - [ ] Phase `deep-interview` produced/updated clarified requirements or a concise spec
182
185
  - [ ] Phase `ralplan` produced/updated approved planning artifacts and durable sequential evidence from a subsequent `Architect` approval followed by a subsequent `Critic` approval
183
186
  - [ ] Phase `ultragoal` implemented and verified the plan with fresh evidence and durable ledger/checkpoint references
187
+ - [ ] Phase `rework` was used for implementation-only review fixes when applicable, with findings scoped to a fresh code-review cycle
184
188
  - [ ] `$team` was used only if the active Ultragoal story needed coordinated parallel work, or explicitly recorded as not needed
185
189
  - [ ] Phase `code-review` returned a clean verdict (`APPROVE` + `CLEAR`)
186
190
  - [ ] Phase `ultraqa` passed, or was explicitly skipped because the change was docs-only/trivially non-runtime with evidence
@@ -31,6 +31,9 @@ Use this workflow when a research mission should be bound to Codex goal-mode foc
31
31
  5. Completion is blocked until professor-critic validation records `verdict=pass`. After the mission audit passes, call `update_goal({status: "complete"})`, call `get_goal` again, then run:
32
32
  `omx autoresearch-goal complete --slug <slug> --codex-goal-json <get_goal-json-or-path>`
33
33
  6. Treat the completion command as read-only reconciliation plus durable OMX state update; hooks and shell commands must not mutate Codex goal state.
34
+ 7. After the completion command succeeds, run `/goal clear` in the Codex UI before starting another goal in this same thread/session. OMX prints this terminal cleanup step but does not invoke hidden clear routes.
34
35
 
35
36
  ## Completion gate
36
37
  A passing professor-critic artifact and a matching complete Codex `get_goal` snapshot are required. Assistant prose, partial tests, or a failed/blocked verdict are not sufficient.
38
+
39
+ Lifecycle: `create_goal` starts the Codex thread goal, `update_goal({status: "complete"})` marks terminal success after the professor-critic and audit pass, and `/goal clear` removes the completed thread goal when another same-thread goal is needed. OMX shell commands and hooks reconcile snapshots and print the cleanup instruction; they must not mutate hidden Codex goal state.
@@ -47,7 +47,7 @@ Ecomode is a modifier that combines with execution modes:
47
47
 
48
48
  **FIRST ACTION:** Before delegating any work, read the agent reference file:
49
49
  ```
50
- Read file: docs/shared/agent-tiers.md
50
+ Read file: references/agent-tiers.md
51
51
  ```
52
52
  This provides the complete agent tier matrix, MCP tool assignments, and selection guidance.
53
53
 
@@ -0,0 +1,61 @@
1
+ # Agent Tiers
2
+
3
+ This file defines practical tier guidance for OMX agent routing.
4
+
5
+ ## Mental Model
6
+
7
+ OMX now separates three concepts:
8
+
9
+ - `role`: what the agent is responsible for (`executor`, `planner`, `architect`)
10
+ - `tier`: how much reasoning/cost to spend (`LOW`, `STANDARD`, `THOROUGH`)
11
+ - `posture`: how the role behaves (`frontier-orchestrator`, `deep-worker`, `fast-lane`)
12
+ - `exactModel`: optional role pin that bypasses tier defaults when a role needs a
13
+ specific model contract.
14
+
15
+ Use role to choose responsibility, tier to choose depth, and posture to choose operating style.
16
+
17
+ ## Tiers
18
+
19
+ - `LOW`:
20
+ Fast lookups and narrow checks.
21
+ Use for simple exploration, style checks, and lightweight doc edits.
22
+ Typical roles: `explore`, `style-reviewer`, `writer`.
23
+
24
+ - `STANDARD`:
25
+ Default tier for implementation, debugging, and normal verification.
26
+ Typical roles: `executor`, `debugger`, `test-engineer`, `quality-reviewer`.
27
+
28
+ - `THOROUGH`:
29
+ Use for architectural, security-sensitive, or high-impact multi-file work.
30
+ Typical roles: `architect`, `critic`, `security-reviewer`, `executor`.
31
+ Note: `deep-executor` is deprecated; route implementation to `executor`.
32
+
33
+ ## Selection Rules
34
+
35
+ 1. Start at `STANDARD` for most code changes.
36
+ 2. Use `LOW` only when the task is bounded and non-invasive.
37
+ 3. Escalate to `THOROUGH` for:
38
+ - security/auth/trust-boundary changes
39
+ - architectural decisions with system-wide impact
40
+ - large refactors across many files
41
+ 4. For Ralph completion checks, use at least `STANDARD` architect verification.
42
+
43
+ ## Posture Guidance
44
+
45
+ - `frontier-orchestrator`:
46
+ - Best for steerable frontier models and leader-style roles.
47
+ - Prioritizes intent classification, delegation, verification, and architectural judgment.
48
+ - Typical roles: `planner`, `analyst`, `architect`, `critic`, `code-reviewer`.
49
+ - Ralplan keeps `planner` and `architect` in this posture but pins them to
50
+ exact `gpt-5.4-mini` with high reasoning; the `critic` consensus gate stays
51
+ on the frontier lane.
52
+
53
+ - `deep-worker`:
54
+ - Best for implementation-heavy roles that should carry work to completion.
55
+ - Prioritizes direct execution, minimal diffs, and strict verification.
56
+ - Typical roles: `executor`, `debugger`, `test-engineer`, `build-fixer`.
57
+
58
+ - `fast-lane`:
59
+ - Best for cheap/fast models used for triage, search, and narrow synthesis.
60
+ - Prioritizes quick routing, concise search, and escalation over deep autonomous work.
61
+ - Typical roles: `explore`, `writer`, and lightweight research/search specialists.
@@ -55,6 +55,7 @@ omx performance-goal complete --slug startup-latency --evidence "final evaluator
55
55
  - call `create_goal` only when no active goal exists and the objective is explicit;
56
56
  - work only against the evaluator contract;
57
57
  - after evaluator pass and completion audit, call `update_goal({status: "complete"})`, call `get_goal` again, and pass that snapshot to `omx performance-goal complete --codex-goal-json`;
58
+ - after `omx performance-goal complete` succeeds, run `/goal clear` in the Codex UI before starting another goal in this same thread/session; OMX prints this terminal cleanup step but does not invoke hidden clear routes;
58
59
  3. Optimize in small reversible patches.
59
60
  4. Run the evaluator and related regression tests.
60
61
  5. Record each pass/fail/blocker with `checkpoint`.
@@ -63,3 +64,5 @@ omx performance-goal complete --slug startup-latency --evidence "final evaluator
63
64
  ## Completion Gate
64
65
 
65
66
  A performance goal is incomplete unless `.omx/goals/performance/<slug>/state.json` contains a `lastValidation.status` of `pass` and `omx performance-goal complete` receives a matching complete Codex `get_goal` snapshot via `--codex-goal-json`. Passing ordinary tests alone is not sufficient unless they are the declared evaluator contract.
67
+
68
+ Lifecycle: `create_goal` starts the Codex thread goal, `update_goal({status: "complete"})` marks terminal success after the evaluator and audit pass, and `/goal clear` removes the completed thread goal when another same-thread goal is needed. OMX shell commands and hooks reconcile snapshots and print the cleanup instruction; they must not mutate hidden Codex goal state.
@@ -42,7 +42,7 @@ $plan --consensus --interactive <arguments>
42
42
  ```
43
43
 
44
44
  The consensus workflow:
45
- 1. **Planner** creates an adaptive plan (right-sized to task scope; do not default to exactly five steps) and a compact **RALPLAN-DR summary** before review:
45
+ 1. **Planner** creates an adaptive plan (right-sized to task scope; do not default to exactly five steps) and a compact **RALPLAN-DR summary** before review. Current `[main]` vs `[planner]` behavior: standalone `$ralplan` may be authored by the active main planning lane unless the caller/runtime supplies a dedicated planner routing record; inside `$autopilot`, state field `planning_routing.owner:"planner"` means the initial Planner draft/decomposition must use dedicated `[planner]`. Set `.omx-config.json` `agentModels.planner` to opt into a specific planner model and force dedicated planner ownership for complex Autopilot planning even when `[main]` is not cheap/mini. The RALPLAN-DR summary includes:
46
46
  - Principles (3-5)
47
47
  - Decision Drivers (top 3)
48
48
  - Viable Options (>=2) with bounded pros/cons
@@ -94,8 +94,10 @@ The final ultragoal story is not complete until the active agent has run the fin
94
94
  1. Run targeted verification for the story.
95
95
  2. Run `ai-slop-cleaner` on changed files only; if there are no relevant edits, the cleaner still runs and records a passed/no-op report.
96
96
  3. Rerun verification after the cleaner pass.
97
- 4. Run `$code-review` through the independent review path. Clean means `codeReview.recommendation: "APPROVE"`, `codeReview.architectStatus: "CLEAR"`, and `codeReview.independentReview` contains distinct completed `code-reviewer` and `architect` subagent evidence. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing subagent evidence, unavailable delegation, and same-lane/self-review are non-clean.
98
- 5. If review is non-clean, do **not** call `update_goal`. Record durable blocker work instead:
97
+ 4. Run the architecture-invariant audit: derive non-negotiable architecture/domain invariants from the brief/spec/interview/accepted steering/goal artifacts, list the source artifacts, and prove each required invariant with implementation, test, and independent review evidence.
98
+ 5. Run `$code-review` through the independent review path. Clean means `codeReview.recommendation: "APPROVE"`, `codeReview.architectStatus: "CLEAR"`, `codeReview.independentReview` contains distinct completed `code-reviewer` and `architect` subagent evidence, and `architectureInvariantGate.status: "passed"` proves every required invariant. `COMMENT`, `WATCH`, `REQUEST CHANGES`, `BLOCK`, missing subagent evidence, unavailable delegation, same-lane/self-review, and unproved architecture invariants are non-clean.
99
+ 6. If review or invariant proof is non-clean, do **not** call `update_goal`. Record durable blocker work instead:
100
+
99
101
 
100
102
  ```sh
101
103
  omx ultragoal record-review-blockers --goal-id <id> --title "Resolve final code-review blockers" --objective "<blocker-resolution objective>" --evidence "<review findings>" --codex-goal-json <active-get-goal-json-or-path>
@@ -103,7 +105,8 @@ The final ultragoal story is not complete until the active agent has run the fin
103
105
 
104
106
  This marks the current story `review_blocked`, appends a pending blocker-resolution story, keeps the Codex goal active, and lets `omx ultragoal complete-goals` start the blocker next. In legacy per-story mode, the blocker may need an available Codex goal context because the old per-story Codex goal remains active/incomplete.
105
107
 
106
- 6. If review is clean, call `update_goal({status: "complete"})`, call `get_goal`, and checkpoint with a structured final gate:
108
+ 7. If review and invariant proof are clean, call `update_goal({status: "complete"})`, call `get_goal`, and checkpoint with a structured final gate:
109
+
107
110
 
108
111
  ```sh
109
112
  omx ultragoal checkpoint --goal-id <id> --status complete --evidence "<tests/files/review evidence>" --codex-goal-json <fresh-complete-get-goal-json-or-path> --quality-gate-json <quality-gate-json-or-path>
@@ -123,6 +126,21 @@ The final ultragoal story is not complete until the active agent has run the fin
123
126
  "codeReviewer": { "agentRole": "code-reviewer", "evidence": "code-reviewer subagent APPROVE evidence" },
124
127
  "architect": { "agentRole": "architect", "evidence": "architect subagent CLEAR evidence" }
125
128
  }
129
+ },
130
+ "architectureInvariantGate": {
131
+ "status": "passed",
132
+ "sourceArtifacts": [".omx/ultragoal/brief.md", ".omx/ultragoal/goals.json"],
133
+ "evidence": "final invariant audit proved all required architecture/domain invariants",
134
+ "invariants": [
135
+ {
136
+ "invariant": "Preserve the existing parser boundary.",
137
+ "source": ".omx/ultragoal/brief.md#architecture-invariants",
138
+ "status": "proved",
139
+ "implementationEvidence": "changed files preserve the parser boundary",
140
+ "testEvidence": "parser-boundary regression passed",
141
+ "reviewEvidence": "architect review confirmed the boundary is intact"
142
+ }
143
+ ]
126
144
  }
127
145
  }
128
146
  ```
@@ -131,7 +149,7 @@ The final ultragoal story is not complete until the active agent has run the fin
131
149
 
132
150
  - The shell command cannot directly invoke Codex interactive `/goal`; it emits a model-facing handoff for the active Codex agent.
133
151
  - Ultragoal intentionally does not invoke `/goal clear` or hidden `thread/goal/clear`; the model-facing tool surface only provides `get_goal`, `create_goal`, and `update_goal`.
134
- - After a completed aggregate ultragoal run, clear the Codex goal manually with `/goal clear` before starting another ultragoal run in the same session/thread.
152
+ - After a completed aggregate ultragoal run, `/goal clear` is the explicit terminal cleanup step before starting another goal in the same Codex thread/session: `create_goal` starts, `update_goal({status: "complete"})` marks terminal success, and `/goal clear` removes the completed thread goal for the next same-thread goal. OMX prints this next step but does not invoke hidden clear routes.
135
153
  - Never call `create_goal` when `get_goal` reports a different active goal.
136
154
  - Never call `update_goal` unless the aggregate run or legacy per-story goal is actually complete.
137
155
  - In aggregate mode, intermediate story checkpoints require a matching `active` Codex snapshot; final story completion requires a matching `complete` snapshot after `update_goal`.
@@ -35,7 +35,7 @@ Sequential task execution wastes time when tasks are independent. Ultrawork keep
35
35
  - When useful, run a direct-tool lane and one or more background evidence lanes at the same time. Evidence lanes can cover docs, tests, regression mapping, or bounded repo analysis.
36
36
  - Fire independent agent calls simultaneously -- never serialize independent work.
37
37
  - Always pass the `model` parameter explicitly when delegating.
38
- - Read `docs/shared/agent-tiers.md` before first delegation for agent selection guidance.
38
+ - Read `references/agent-tiers.md` before first delegation for agent selection guidance.
39
39
  - Auto-delegate `researcher` when official docs, version-aware framework guidance, best practices, or external dependency behavior materially affect task correctness; treat it as an evidence lane, not a replacement primary workflow.
40
40
  - Use `run_in_background: true` for operations over ~30 seconds (installs, builds, tests).
41
41
  - Run quick commands (git status, file reads, simple checks) in the foreground.
@@ -44,7 +44,7 @@ Sequential task execution wastes time when tasks are independent. Ultrawork keep
44
44
  </Execution_Policy>
45
45
 
46
46
  <Steps>
47
- 1. **Read agent reference**: Load `docs/shared/agent-tiers.md` for tier selection.
47
+ 1. **Read agent reference**: Load `references/agent-tiers.md` for tier selection.
48
48
  2. **Context + certainty check**:
49
49
  - State the task intent in one sentence.
50
50
  - List the constraints and unknowns that could invalidate a quick fix.
@@ -0,0 +1,61 @@
1
+ # Agent Tiers
2
+
3
+ This file defines practical tier guidance for OMX agent routing.
4
+
5
+ ## Mental Model
6
+
7
+ OMX now separates three concepts:
8
+
9
+ - `role`: what the agent is responsible for (`executor`, `planner`, `architect`)
10
+ - `tier`: how much reasoning/cost to spend (`LOW`, `STANDARD`, `THOROUGH`)
11
+ - `posture`: how the role behaves (`frontier-orchestrator`, `deep-worker`, `fast-lane`)
12
+ - `exactModel`: optional role pin that bypasses tier defaults when a role needs a
13
+ specific model contract.
14
+
15
+ Use role to choose responsibility, tier to choose depth, and posture to choose operating style.
16
+
17
+ ## Tiers
18
+
19
+ - `LOW`:
20
+ Fast lookups and narrow checks.
21
+ Use for simple exploration, style checks, and lightweight doc edits.
22
+ Typical roles: `explore`, `style-reviewer`, `writer`.
23
+
24
+ - `STANDARD`:
25
+ Default tier for implementation, debugging, and normal verification.
26
+ Typical roles: `executor`, `debugger`, `test-engineer`, `quality-reviewer`.
27
+
28
+ - `THOROUGH`:
29
+ Use for architectural, security-sensitive, or high-impact multi-file work.
30
+ Typical roles: `architect`, `critic`, `security-reviewer`, `executor`.
31
+ Note: `deep-executor` is deprecated; route implementation to `executor`.
32
+
33
+ ## Selection Rules
34
+
35
+ 1. Start at `STANDARD` for most code changes.
36
+ 2. Use `LOW` only when the task is bounded and non-invasive.
37
+ 3. Escalate to `THOROUGH` for:
38
+ - security/auth/trust-boundary changes
39
+ - architectural decisions with system-wide impact
40
+ - large refactors across many files
41
+ 4. For Ralph completion checks, use at least `STANDARD` architect verification.
42
+
43
+ ## Posture Guidance
44
+
45
+ - `frontier-orchestrator`:
46
+ - Best for steerable frontier models and leader-style roles.
47
+ - Prioritizes intent classification, delegation, verification, and architectural judgment.
48
+ - Typical roles: `planner`, `analyst`, `architect`, `critic`, `code-reviewer`.
49
+ - Ralplan keeps `planner` and `architect` in this posture but pins them to
50
+ exact `gpt-5.4-mini` with high reasoning; the `critic` consensus gate stays
51
+ on the frontier lane.
52
+
53
+ - `deep-worker`:
54
+ - Best for implementation-heavy roles that should carry work to completion.
55
+ - Prioritizes direct execution, minimal diffs, and strict verification.
56
+ - Typical roles: `executor`, `debugger`, `test-engineer`, `build-fixer`.
57
+
58
+ - `fast-lane`:
59
+ - Best for cheap/fast models used for triage, search, and narrow synthesis.
60
+ - Prioritizes quick routing, concise search, and escalation over deep autonomous work.
61
+ - Typical roles: `explore`, `writer`, and lightweight research/search specialists.