popeye-cli 1.9.5 → 2.0.0

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 (318) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/CONTRIBUTING.md +15 -1
  3. package/README.md +57 -0
  4. package/cheatsheet.md +65 -0
  5. package/dist/cli/commands/debug-context.d.ts +64 -0
  6. package/dist/cli/commands/debug-context.d.ts.map +1 -0
  7. package/dist/cli/commands/debug-context.js +221 -0
  8. package/dist/cli/commands/debug-context.js.map +1 -0
  9. package/dist/cli/commands/debug-prompts.d.ts +25 -0
  10. package/dist/cli/commands/debug-prompts.d.ts.map +1 -0
  11. package/dist/cli/commands/debug-prompts.js +80 -0
  12. package/dist/cli/commands/debug-prompts.js.map +1 -0
  13. package/dist/cli/commands/debug.d.ts +68 -0
  14. package/dist/cli/commands/debug.d.ts.map +1 -0
  15. package/dist/cli/commands/debug.js +543 -0
  16. package/dist/cli/commands/debug.js.map +1 -0
  17. package/dist/cli/commands/index.d.ts +1 -0
  18. package/dist/cli/commands/index.d.ts.map +1 -1
  19. package/dist/cli/commands/index.js +1 -0
  20. package/dist/cli/commands/index.js.map +1 -1
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +2 -1
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/cli/interactive.d.ts.map +1 -1
  25. package/dist/cli/interactive.js +25 -0
  26. package/dist/cli/interactive.js.map +1 -1
  27. package/dist/generators/all.d.ts.map +1 -1
  28. package/dist/generators/all.js +2 -0
  29. package/dist/generators/all.js.map +1 -1
  30. package/dist/generators/templates/database-docker.d.ts.map +1 -1
  31. package/dist/generators/templates/database-docker.js +10 -0
  32. package/dist/generators/templates/database-docker.js.map +1 -1
  33. package/dist/generators/templates/fullstack.d.ts +4 -1
  34. package/dist/generators/templates/fullstack.d.ts.map +1 -1
  35. package/dist/generators/templates/fullstack.js +6 -2
  36. package/dist/generators/templates/fullstack.js.map +1 -1
  37. package/dist/pipeline/artifact-manager.d.ts +47 -0
  38. package/dist/pipeline/artifact-manager.d.ts.map +1 -0
  39. package/dist/pipeline/artifact-manager.js +251 -0
  40. package/dist/pipeline/artifact-manager.js.map +1 -0
  41. package/dist/pipeline/artifact-validators.d.ts +29 -0
  42. package/dist/pipeline/artifact-validators.d.ts.map +1 -0
  43. package/dist/pipeline/artifact-validators.js +173 -0
  44. package/dist/pipeline/artifact-validators.js.map +1 -0
  45. package/dist/pipeline/change-request.d.ts +47 -0
  46. package/dist/pipeline/change-request.d.ts.map +1 -0
  47. package/dist/pipeline/change-request.js +91 -0
  48. package/dist/pipeline/change-request.js.map +1 -0
  49. package/dist/pipeline/check-runner.d.ts +47 -0
  50. package/dist/pipeline/check-runner.d.ts.map +1 -0
  51. package/dist/pipeline/check-runner.js +417 -0
  52. package/dist/pipeline/check-runner.js.map +1 -0
  53. package/dist/pipeline/command-resolver.d.ts +9 -0
  54. package/dist/pipeline/command-resolver.d.ts.map +1 -0
  55. package/dist/pipeline/command-resolver.js +140 -0
  56. package/dist/pipeline/command-resolver.js.map +1 -0
  57. package/dist/pipeline/consensus/consensus-runner.d.ts +44 -0
  58. package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -0
  59. package/dist/pipeline/consensus/consensus-runner.js +212 -0
  60. package/dist/pipeline/consensus/consensus-runner.js.map +1 -0
  61. package/dist/pipeline/constitution.d.ts +45 -0
  62. package/dist/pipeline/constitution.d.ts.map +1 -0
  63. package/dist/pipeline/constitution.js +82 -0
  64. package/dist/pipeline/constitution.js.map +1 -0
  65. package/dist/pipeline/gate-engine.d.ts +55 -0
  66. package/dist/pipeline/gate-engine.d.ts.map +1 -0
  67. package/dist/pipeline/gate-engine.js +270 -0
  68. package/dist/pipeline/gate-engine.js.map +1 -0
  69. package/dist/pipeline/index.d.ts +26 -0
  70. package/dist/pipeline/index.d.ts.map +1 -0
  71. package/dist/pipeline/index.js +35 -0
  72. package/dist/pipeline/index.js.map +1 -0
  73. package/dist/pipeline/migration.d.ts +15 -0
  74. package/dist/pipeline/migration.d.ts.map +1 -0
  75. package/dist/pipeline/migration.js +76 -0
  76. package/dist/pipeline/migration.js.map +1 -0
  77. package/dist/pipeline/orchestrator.d.ts +28 -0
  78. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  79. package/dist/pipeline/orchestrator.js +238 -0
  80. package/dist/pipeline/orchestrator.js.map +1 -0
  81. package/dist/pipeline/packets/audit-report-builder.d.ts +11 -0
  82. package/dist/pipeline/packets/audit-report-builder.d.ts.map +1 -0
  83. package/dist/pipeline/packets/audit-report-builder.js +32 -0
  84. package/dist/pipeline/packets/audit-report-builder.js.map +1 -0
  85. package/dist/pipeline/packets/consensus-packet-builder.d.ts +35 -0
  86. package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -0
  87. package/dist/pipeline/packets/consensus-packet-builder.js +80 -0
  88. package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -0
  89. package/dist/pipeline/packets/index.d.ts +12 -0
  90. package/dist/pipeline/packets/index.d.ts.map +1 -0
  91. package/dist/pipeline/packets/index.js +8 -0
  92. package/dist/pipeline/packets/index.js.map +1 -0
  93. package/dist/pipeline/packets/plan-packet-builder.d.ts +21 -0
  94. package/dist/pipeline/packets/plan-packet-builder.d.ts.map +1 -0
  95. package/dist/pipeline/packets/plan-packet-builder.js +27 -0
  96. package/dist/pipeline/packets/plan-packet-builder.js.map +1 -0
  97. package/dist/pipeline/packets/rca-packet-builder.d.ts +19 -0
  98. package/dist/pipeline/packets/rca-packet-builder.d.ts.map +1 -0
  99. package/dist/pipeline/packets/rca-packet-builder.js +22 -0
  100. package/dist/pipeline/packets/rca-packet-builder.js.map +1 -0
  101. package/dist/pipeline/phases/architecture.d.ts +7 -0
  102. package/dist/pipeline/phases/architecture.d.ts.map +1 -0
  103. package/dist/pipeline/phases/architecture.js +60 -0
  104. package/dist/pipeline/phases/architecture.js.map +1 -0
  105. package/dist/pipeline/phases/audit.d.ts +8 -0
  106. package/dist/pipeline/phases/audit.d.ts.map +1 -0
  107. package/dist/pipeline/phases/audit.js +144 -0
  108. package/dist/pipeline/phases/audit.js.map +1 -0
  109. package/dist/pipeline/phases/consensus-architecture.d.ts +7 -0
  110. package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -0
  111. package/dist/pipeline/phases/consensus-architecture.js +84 -0
  112. package/dist/pipeline/phases/consensus-architecture.js.map +1 -0
  113. package/dist/pipeline/phases/consensus-master-plan.d.ts +7 -0
  114. package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -0
  115. package/dist/pipeline/phases/consensus-master-plan.js +81 -0
  116. package/dist/pipeline/phases/consensus-master-plan.js.map +1 -0
  117. package/dist/pipeline/phases/consensus-role-plans.d.ts +7 -0
  118. package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -0
  119. package/dist/pipeline/phases/consensus-role-plans.js +85 -0
  120. package/dist/pipeline/phases/consensus-role-plans.js.map +1 -0
  121. package/dist/pipeline/phases/done.d.ts +7 -0
  122. package/dist/pipeline/phases/done.d.ts.map +1 -0
  123. package/dist/pipeline/phases/done.js +45 -0
  124. package/dist/pipeline/phases/done.js.map +1 -0
  125. package/dist/pipeline/phases/implementation.d.ts +8 -0
  126. package/dist/pipeline/phases/implementation.d.ts.map +1 -0
  127. package/dist/pipeline/phases/implementation.js +42 -0
  128. package/dist/pipeline/phases/implementation.js.map +1 -0
  129. package/dist/pipeline/phases/index.d.ts +20 -0
  130. package/dist/pipeline/phases/index.d.ts.map +1 -0
  131. package/dist/pipeline/phases/index.js +19 -0
  132. package/dist/pipeline/phases/index.js.map +1 -0
  133. package/dist/pipeline/phases/intake.d.ts +8 -0
  134. package/dist/pipeline/phases/intake.d.ts.map +1 -0
  135. package/dist/pipeline/phases/intake.js +40 -0
  136. package/dist/pipeline/phases/intake.js.map +1 -0
  137. package/dist/pipeline/phases/phase-context.d.ts +30 -0
  138. package/dist/pipeline/phases/phase-context.d.ts.map +1 -0
  139. package/dist/pipeline/phases/phase-context.js +33 -0
  140. package/dist/pipeline/phases/phase-context.js.map +1 -0
  141. package/dist/pipeline/phases/production-gate.d.ts +8 -0
  142. package/dist/pipeline/phases/production-gate.d.ts.map +1 -0
  143. package/dist/pipeline/phases/production-gate.js +84 -0
  144. package/dist/pipeline/phases/production-gate.js.map +1 -0
  145. package/dist/pipeline/phases/qa-validation.d.ts +7 -0
  146. package/dist/pipeline/phases/qa-validation.d.ts.map +1 -0
  147. package/dist/pipeline/phases/qa-validation.js +50 -0
  148. package/dist/pipeline/phases/qa-validation.js.map +1 -0
  149. package/dist/pipeline/phases/recovery-loop.d.ts +7 -0
  150. package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -0
  151. package/dist/pipeline/phases/recovery-loop.js +91 -0
  152. package/dist/pipeline/phases/recovery-loop.js.map +1 -0
  153. package/dist/pipeline/phases/review.d.ts +8 -0
  154. package/dist/pipeline/phases/review.d.ts.map +1 -0
  155. package/dist/pipeline/phases/review.js +127 -0
  156. package/dist/pipeline/phases/review.js.map +1 -0
  157. package/dist/pipeline/phases/role-planning.d.ts +7 -0
  158. package/dist/pipeline/phases/role-planning.d.ts.map +1 -0
  159. package/dist/pipeline/phases/role-planning.js +75 -0
  160. package/dist/pipeline/phases/role-planning.js.map +1 -0
  161. package/dist/pipeline/phases/stuck.d.ts +7 -0
  162. package/dist/pipeline/phases/stuck.d.ts.map +1 -0
  163. package/dist/pipeline/phases/stuck.js +51 -0
  164. package/dist/pipeline/phases/stuck.js.map +1 -0
  165. package/dist/pipeline/repo-snapshot.d.ts +24 -0
  166. package/dist/pipeline/repo-snapshot.d.ts.map +1 -0
  167. package/dist/pipeline/repo-snapshot.js +343 -0
  168. package/dist/pipeline/repo-snapshot.js.map +1 -0
  169. package/dist/pipeline/role-execution-adapter.d.ts +59 -0
  170. package/dist/pipeline/role-execution-adapter.d.ts.map +1 -0
  171. package/dist/pipeline/role-execution-adapter.js +159 -0
  172. package/dist/pipeline/role-execution-adapter.js.map +1 -0
  173. package/dist/pipeline/skill-loader.d.ts +34 -0
  174. package/dist/pipeline/skill-loader.d.ts.map +1 -0
  175. package/dist/pipeline/skill-loader.js +156 -0
  176. package/dist/pipeline/skill-loader.js.map +1 -0
  177. package/dist/pipeline/skills/defaults.d.ts +16 -0
  178. package/dist/pipeline/skills/defaults.d.ts.map +1 -0
  179. package/dist/pipeline/skills/defaults.js +189 -0
  180. package/dist/pipeline/skills/defaults.js.map +1 -0
  181. package/dist/pipeline/type-defs/artifacts.d.ts +202 -0
  182. package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -0
  183. package/dist/pipeline/type-defs/artifacts.js +66 -0
  184. package/dist/pipeline/type-defs/artifacts.js.map +1 -0
  185. package/dist/pipeline/type-defs/audit.d.ts +256 -0
  186. package/dist/pipeline/type-defs/audit.d.ts.map +1 -0
  187. package/dist/pipeline/type-defs/audit.js +54 -0
  188. package/dist/pipeline/type-defs/audit.js.map +1 -0
  189. package/dist/pipeline/type-defs/checks.d.ts +81 -0
  190. package/dist/pipeline/type-defs/checks.d.ts.map +1 -0
  191. package/dist/pipeline/type-defs/checks.js +38 -0
  192. package/dist/pipeline/type-defs/checks.js.map +1 -0
  193. package/dist/pipeline/type-defs/enums.d.ts +43 -0
  194. package/dist/pipeline/type-defs/enums.d.ts.map +1 -0
  195. package/dist/pipeline/type-defs/enums.js +55 -0
  196. package/dist/pipeline/type-defs/enums.js.map +1 -0
  197. package/dist/pipeline/type-defs/index.d.ts +12 -0
  198. package/dist/pipeline/type-defs/index.d.ts.map +1 -0
  199. package/dist/pipeline/type-defs/index.js +12 -0
  200. package/dist/pipeline/type-defs/index.js.map +1 -0
  201. package/dist/pipeline/type-defs/packets.d.ts +806 -0
  202. package/dist/pipeline/type-defs/packets.d.ts.map +1 -0
  203. package/dist/pipeline/type-defs/packets.js +109 -0
  204. package/dist/pipeline/type-defs/packets.js.map +1 -0
  205. package/dist/pipeline/type-defs/snapshot.d.ts +52 -0
  206. package/dist/pipeline/type-defs/snapshot.d.ts.map +1 -0
  207. package/dist/pipeline/type-defs/snapshot.js +35 -0
  208. package/dist/pipeline/type-defs/snapshot.js.map +1 -0
  209. package/dist/pipeline/type-defs/state.d.ts +449 -0
  210. package/dist/pipeline/type-defs/state.d.ts.map +1 -0
  211. package/dist/pipeline/type-defs/state.js +88 -0
  212. package/dist/pipeline/type-defs/state.js.map +1 -0
  213. package/dist/pipeline/types.d.ts +16 -0
  214. package/dist/pipeline/types.d.ts.map +1 -0
  215. package/dist/pipeline/types.js +16 -0
  216. package/dist/pipeline/types.js.map +1 -0
  217. package/dist/types/audit.d.ts +6 -6
  218. package/dist/workflow/index.d.ts.map +1 -1
  219. package/dist/workflow/index.js +48 -0
  220. package/dist/workflow/index.js.map +1 -1
  221. package/package.json +1 -1
  222. package/skills/ARBITRATOR.md +137 -0
  223. package/skills/ARCHITECT.md +167 -0
  224. package/skills/AUDITOR.md +128 -0
  225. package/skills/AUDIT_REPORT_SCHEMA.md +20 -0
  226. package/skills/BACKEND_PROGRAMMER.md +95 -0
  227. package/skills/CONSENSUS_PACKET_SCHEMA.md +166 -0
  228. package/skills/DB_EXPERT.md +106 -0
  229. package/skills/DEBUGGER.md +286 -0
  230. package/skills/DISPATCHER.md +157 -0
  231. package/skills/FRONTEND_PROGRAMMER.md +84 -0
  232. package/skills/JOURNALIST.md +247 -0
  233. package/skills/MARKETING_EXPERT.md +23 -0
  234. package/skills/PHASE_GATE_ENGINE_SPEC.md +171 -0
  235. package/skills/PLAN_PACKET_SCHEMA.md +222 -0
  236. package/skills/POPEYE_CONSTITUTION.md +177 -0
  237. package/skills/POPEYE_FULL_AUTONOMY_PIPELINE.md +537 -0
  238. package/skills/PRODUCTION_READINESS_SCHEMA.md +19 -0
  239. package/skills/QA_TESTER.md +40 -0
  240. package/skills/RCA_PACKET_SCHEMA.md +22 -0
  241. package/skills/RELEASE_MANAGER.md +60 -0
  242. package/skills/REVIEWER.md +133 -0
  243. package/skills/SOCIAL_EXPERT.md +22 -0
  244. package/skills/UI_UX_SPECIALIST.md +22 -0
  245. package/skills/WEBSITE_PROGRAMMER.md +37 -0
  246. package/src/cli/commands/debug-context.ts +265 -0
  247. package/src/cli/commands/debug-prompts.ts +91 -0
  248. package/src/cli/commands/debug.ts +662 -0
  249. package/src/cli/commands/index.ts +1 -0
  250. package/src/cli/index.ts +2 -0
  251. package/src/cli/interactive.ts +27 -0
  252. package/src/generators/all.ts +2 -0
  253. package/src/generators/templates/database-docker.ts +10 -0
  254. package/src/generators/templates/fullstack.ts +6 -2
  255. package/src/pipeline/artifact-manager.ts +339 -0
  256. package/src/pipeline/artifact-validators.ts +224 -0
  257. package/src/pipeline/change-request.ts +119 -0
  258. package/src/pipeline/check-runner.ts +504 -0
  259. package/src/pipeline/command-resolver.ts +168 -0
  260. package/src/pipeline/consensus/consensus-runner.ts +317 -0
  261. package/src/pipeline/constitution.ts +109 -0
  262. package/src/pipeline/gate-engine.ts +347 -0
  263. package/src/pipeline/index.ts +82 -0
  264. package/src/pipeline/migration.ts +91 -0
  265. package/src/pipeline/orchestrator.ts +314 -0
  266. package/src/pipeline/packets/audit-report-builder.ts +47 -0
  267. package/src/pipeline/packets/consensus-packet-builder.ts +112 -0
  268. package/src/pipeline/packets/index.ts +15 -0
  269. package/src/pipeline/packets/plan-packet-builder.ts +52 -0
  270. package/src/pipeline/packets/rca-packet-builder.ts +38 -0
  271. package/src/pipeline/phases/architecture.ts +73 -0
  272. package/src/pipeline/phases/audit.ts +193 -0
  273. package/src/pipeline/phases/consensus-architecture.ts +104 -0
  274. package/src/pipeline/phases/consensus-master-plan.ts +100 -0
  275. package/src/pipeline/phases/consensus-role-plans.ts +105 -0
  276. package/src/pipeline/phases/done.ts +68 -0
  277. package/src/pipeline/phases/implementation.ts +48 -0
  278. package/src/pipeline/phases/index.ts +21 -0
  279. package/src/pipeline/phases/intake.ts +54 -0
  280. package/src/pipeline/phases/phase-context.ts +86 -0
  281. package/src/pipeline/phases/production-gate.ts +113 -0
  282. package/src/pipeline/phases/qa-validation.ts +63 -0
  283. package/src/pipeline/phases/recovery-loop.ts +118 -0
  284. package/src/pipeline/phases/review.ts +149 -0
  285. package/src/pipeline/phases/role-planning.ts +92 -0
  286. package/src/pipeline/phases/stuck.ts +62 -0
  287. package/src/pipeline/repo-snapshot.ts +395 -0
  288. package/src/pipeline/role-execution-adapter.ts +238 -0
  289. package/src/pipeline/skill-loader.ts +192 -0
  290. package/src/pipeline/skills/defaults.ts +215 -0
  291. package/src/pipeline/type-defs/artifacts.ts +81 -0
  292. package/src/pipeline/type-defs/audit.ts +67 -0
  293. package/src/pipeline/type-defs/checks.ts +47 -0
  294. package/src/pipeline/type-defs/enums.ts +62 -0
  295. package/src/pipeline/type-defs/index.ts +12 -0
  296. package/src/pipeline/type-defs/packets.ts +131 -0
  297. package/src/pipeline/type-defs/snapshot.ts +55 -0
  298. package/src/pipeline/type-defs/state.ts +165 -0
  299. package/src/pipeline/types.ts +16 -0
  300. package/src/workflow/index.ts +48 -0
  301. package/tests/cli/commands/debug.test.ts +376 -0
  302. package/tests/pipeline/artifact-manager.test.ts +183 -0
  303. package/tests/pipeline/artifact-validators.test.ts +207 -0
  304. package/tests/pipeline/change-request.test.ts +180 -0
  305. package/tests/pipeline/check-runner.test.ts +157 -0
  306. package/tests/pipeline/command-resolver.test.ts +159 -0
  307. package/tests/pipeline/consensus-runner.test.ts +206 -0
  308. package/tests/pipeline/consensus-scoring.test.ts +163 -0
  309. package/tests/pipeline/constitution.test.ts +122 -0
  310. package/tests/pipeline/gate-engine.test.ts +195 -0
  311. package/tests/pipeline/migration.test.ts +133 -0
  312. package/tests/pipeline/orchestrator.test.ts +614 -0
  313. package/tests/pipeline/packets/builders.test.ts +347 -0
  314. package/tests/pipeline/repo-snapshot.test.ts +189 -0
  315. package/tests/pipeline/role-execution-adapter.test.ts +299 -0
  316. package/tests/pipeline/skill-loader.test.ts +186 -0
  317. package/tests/pipeline/start-env-checks.test.ts +123 -0
  318. package/tests/pipeline/types.test.ts +156 -0
@@ -0,0 +1,177 @@
1
+ # POPEYE CONSTITUTION
2
+ Version: 1.0
3
+ Authority: Supreme Governance Layer of Popeye CLI
4
+ Scope: Applies to ALL roles, agents, reviewers, arbitrators, and dispatcher.
5
+
6
+ ---
7
+
8
+ ## 1. Purpose
9
+
10
+ The purpose of this Constitution is to:
11
+ - Prevent hallucination
12
+ - Prevent mock implementations and shortcuts
13
+ - Enforce alignment with the Master Plan
14
+ - Ensure deterministic, evidence-based delivery
15
+ - Maintain architectural integrity
16
+ - Guarantee cross-role synchronization
17
+
18
+ This document overrides all role-specific behavior.
19
+
20
+ ---
21
+
22
+ ## 2. Source of Truth Hierarchy
23
+
24
+ 1. Master Plan (explicitly approved version)
25
+ 2. Architecture Document (if exists)
26
+ 3. Repo State (actual filesystem)
27
+ 4. Approved Change Requests
28
+ 5. Role Plans
29
+ 6. Implementation Artifacts
30
+
31
+ No role may invent information outside these layers.
32
+
33
+ ---
34
+
35
+ ## 3. Anti-Hallucination Law
36
+
37
+ No agent may:
38
+ - Invent APIs
39
+ - Invent environment variables
40
+ - Invent database fields
41
+ - Invent files that do not exist
42
+ - Assume implicit behavior
43
+ - Assume integrations without evidence
44
+
45
+ If information is missing:
46
+ - The agent must explicitly state the missing input.
47
+ - The agent must request clarification or produce a Change Request.
48
+
49
+ Silence is not permission.
50
+
51
+ ---
52
+
53
+ ## 4. No-Shortcut Rule
54
+
55
+ The following are forbidden unless explicitly approved:
56
+
57
+ - TODO placeholders
58
+ - Fake endpoints
59
+ - Mock UI disconnected from real API
60
+ - Dummy DB adapters
61
+ - Hardcoded temporary values
62
+ - "Simulated" integrations
63
+ - Skipping tests
64
+ - Skipping migrations
65
+ - Skipping wiring between layers
66
+
67
+ Violation triggers automatic rejection by Reviewer.
68
+
69
+ ---
70
+
71
+ ## 5. Evidence Requirement Standard
72
+
73
+ Every claim must include evidence in one of the following forms:
74
+
75
+ - File path + symbol name
76
+ - File path + line reference
77
+ - Terminal command + expected output
78
+ - Schema reference
79
+ - Explicit artifact link
80
+
81
+ Example:
82
+
83
+ > Implemented endpoint in `apps/backend/api/users.py::create_user`
84
+ > Migration created in `alembic/versions/20260201_add_users_table.py`
85
+
86
+ No evidence = invalid claim.
87
+
88
+ ---
89
+
90
+ ## 6. Role Isolation Principle
91
+
92
+ Each role must:
93
+ - Operate only within its defined responsibilities
94
+ - Not override decisions owned by another role
95
+ - Request clarification instead of assuming
96
+
97
+ Architecture decisions belong to Architect.
98
+ Schema decisions belong to DB Expert.
99
+ Integration tests belong to QA.
100
+ Conflict resolution belongs to Arbitrator.
101
+
102
+ ---
103
+
104
+ ## 7. Definition of Done (Global)
105
+
106
+ A feature is considered complete only if:
107
+
108
+ - Architecture is approved
109
+ - Role plans pass consensus
110
+ - Code builds successfully
111
+ - Tests pass
112
+ - Integration is real (no mocks unless approved)
113
+ - No Constitution violations exist
114
+ - Reviewer approves with evidence
115
+
116
+ ---
117
+
118
+ ## 8. Change Control
119
+
120
+ Any deviation from Master Plan requires:
121
+
122
+ 1. Explicit Change Request
123
+ 2. Rationale
124
+ 3. Impact analysis
125
+ 4. Consensus approval
126
+ 5. Version update
127
+
128
+ Silent drift is prohibited.
129
+
130
+ ---
131
+
132
+ ## 9. Consensus Enforcement
133
+
134
+ All major artifacts must pass consensus threshold (default: 95%).
135
+
136
+ Artifacts requiring consensus:
137
+ - Master Plan
138
+ - Architecture
139
+ - Role Plans
140
+ - Security-sensitive changes
141
+ - Schema changes
142
+ - Recovery plans
143
+
144
+ Implementation cannot begin without required approvals.
145
+
146
+ ---
147
+
148
+ ## 10. Automatic Rejection Triggers
149
+
150
+ The following cause immediate rejection:
151
+
152
+ - Hallucinated file references
153
+ - Missing evidence
154
+ - Mocked integrations without approval
155
+ - Unapproved architecture changes
156
+ - Schema mismatches
157
+ - Broken build
158
+
159
+ ---
160
+
161
+ ## 11. Dispatcher Authority
162
+
163
+ Dispatcher may:
164
+ - Block phase progression
165
+ - Request missing artifacts
166
+ - Enforce sequencing
167
+ - Trigger review
168
+ - Abort workflow if Constitution violated
169
+
170
+ Dispatcher may NOT:
171
+ - Modify code
172
+ - Override architecture
173
+ - Bypass consensus
174
+
175
+ ---
176
+
177
+ End of Constitution.
@@ -0,0 +1,537 @@
1
+ # Popeye Full Autonomy Pipeline Spec
2
+ Version: 1.1 (Autonomy Hardening Gap Fixes)
3
+ Goal: 1 idea -> 1 prompt -> Popeye -> production-ready system (PASS Production Gate)
4
+
5
+ This spec defines the end-to-end autonomous workflow Popeye must execute, including:
6
+ - Phase sequencing (no skipping)
7
+ - Required artifacts per phase
8
+ - Consensus mechanics
9
+ - Hard gates and pass/fail criteria
10
+ - Recovery loop (Debugger-driven RCA → targeted fixes)
11
+ - Immutable documentation (Journalist)
12
+ - Release packaging (Release Manager)
13
+
14
+ ---
15
+
16
+ ## 0) Roles and Ownership Map
17
+
18
+ ### Orchestration & Governance
19
+ - **Popeye (Dispatcher/Manager)**: phase control, routing, dependency enforcement, gate decisions
20
+ - **Reviewer(s)**: independent plan audits + structured votes
21
+ - **Arbitrator**: convergence mediator + binding decision + merged plan patch when needed
22
+ - **Journalist**: immutable recording of all approved artifacts under `/docs/`
23
+
24
+ ### Build Roles
25
+ - **Architect**: system topology, contracts, repo structure blueprint, env vars, integration contracts
26
+ - **DB Expert**: schema, migrations, indexes, rollback strategy
27
+ - **Backend Programmer**: services/endpoints/business logic + tests
28
+ - **Frontend Programmer**: UI + typed client + auth flow + error/empty/loading states
29
+ - **Website Programmer**: marketing/docs website (if part of Master Plan)
30
+ - **QA / Tester**: test plan first-class + validation after implementation
31
+
32
+ ### Post-Build Intelligence
33
+ - **Debugger**: RCA root cause analysis + ownership + corrective recommendation
34
+ - **Auditor**: holistic final system audit
35
+ - **Release Manager**: production packaging + deployment steps + rollback plan + release notes
36
+
37
+ ---
38
+
39
+ ## 1) Artifact System (Mandatory)
40
+
41
+ All key workflow decisions are materialized into artifacts.
42
+
43
+ ### Artifact locations (canonical)
44
+ - `/docs/master-plan/`
45
+ - `/docs/architecture/`
46
+ - `/docs/role-plans/`
47
+ - `/docs/consensus/`
48
+ - `/docs/arbitration/`
49
+ - `/docs/audit/`
50
+ - `/docs/incidents/`
51
+ - `/docs/production/`
52
+ - `/docs/release/`
53
+ - `/docs/INDEX.md` (Journalist-maintained)
54
+
55
+ ### Artifact types (minimum)
56
+ - Master Plan (md + optional json)
57
+ - Architecture (md + optional json)
58
+ - Role Plans (md + optional json per role)
59
+ - Plan Packet (md/json structure per schema)
60
+ - Consensus Packet (md/json structure per schema)
61
+ - Audit Report (md/json)
62
+ - RCA Report (md/json)
63
+ - Production Readiness Report (md/json)
64
+ - Release Notes (md)
65
+
66
+ ### Immutability rule
67
+ Artifacts are never overwritten. New versions create new files.
68
+
69
+ ---
70
+
71
+ ## 2) Gate Engine: State Machine (No Skipping)
72
+
73
+ ### States
74
+ 1. INTAKE
75
+ 2. CONSENSUS_MASTER_PLAN
76
+ 3. ARCHITECTURE
77
+ 4. CONSENSUS_ARCHITECTURE
78
+ 5. ROLE_PLANNING
79
+ 6. CONSENSUS_ROLE_PLANS
80
+ 7. IMPLEMENTATION
81
+ 8. QA_VALIDATION
82
+ 9. REVIEW
83
+ 10. AUDIT
84
+ 11. PRODUCTION_GATE
85
+ 12. RECOVERY_LOOP (conditional)
86
+ 13. DONE (PASS)
87
+ 14. STUCK (safety valve)
88
+
89
+ ### Allowed transitions
90
+ - Each phase may only transition to the next if all required artifacts exist and the gate passes.
91
+ - Any failure routes to RECOVERY_LOOP, except missing inputs which route back to the phase that needs them.
92
+
93
+ ### v1.1 Gate Behaviors (Autonomy Hardening)
94
+
95
+ Between phase execution and transition, the orchestrator now applies three additional checks:
96
+
97
+ 1. **Constitution Verification**: Before every `evaluateGate()` call, verifies that `skills/POPEYE_CONSTITUTION.md` has not been modified since pipeline start (SHA-256 hash comparison). If the constitution is invalid, the gate is blocked.
98
+
99
+ 2. **Gate Result Merge**: After gate evaluation, preserves `score`/`consensusScore` values stored by consensus phase handlers while updating `pass`/`blockers` from the gate engine. Prevents overwriting of consensus scores.
100
+
101
+ 3. **Change Request (CR) Routing**: After REVIEW and AUDIT phases pass their gates, checks `pipeline.pendingChangeRequests` for any `proposed` CRs. If found, deterministically routes to the appropriate consensus phase (based on change type) rather than continuing normal progression. CR lifecycle: `proposed` -> `approved` (when routed) or `rejected`.
102
+
103
+ ### v1.1 Pipeline State Additions
104
+
105
+ ```
106
+ pendingChangeRequests?: Array<{
107
+ cr_id: string;
108
+ change_type: 'scope' | 'architecture' | 'dependency' | 'config' | 'requirement';
109
+ target_phase: PipelinePhase;
110
+ status: 'proposed' | 'approved' | 'rejected';
111
+ }>;
112
+ ```
113
+
114
+ ---
115
+
116
+ ## 3) Phase-by-Phase Specification
117
+
118
+ ### Phase 1 — INTAKE
119
+ **Purpose**: Normalize a single user prompt into a structured Master Plan v1 (deterministic scope).
120
+
121
+ **Inputs**
122
+ - User prompt (idea/spec)
123
+ - Any repo context (if project already exists)
124
+
125
+ **Actions**
126
+ - Extract:
127
+ - Product goal
128
+ - Users & primary workflows
129
+ - Must-have features
130
+ - Nice-to-have features
131
+ - Out-of-scope items
132
+ - Non-functional requirements (security, performance, compliance)
133
+ - Constraints (stack, hosting, DB, auth, integrations)
134
+ - Success criteria / Definition of Done
135
+
136
+ **Outputs (required)**
137
+ - `Master Plan v1` → `/docs/master-plan/master_plan_<id>_v1_<date>.md`
138
+ - `Plan Packet` for Master Plan review (per schema)
139
+
140
+ **Gate conditions**
141
+ - Master Plan is deterministic (no vague “add features”).
142
+ - Assumptions are explicit.
143
+ - Out-of-scope is explicit.
144
+
145
+ **Failure modes**
146
+ - Missing critical requirements → add explicit assumptions + flagged “Open Questions” section (still proceeds to consensus).
147
+
148
+ ---
149
+
150
+ ### Phase 2 — CONSENSUS on Master Plan
151
+ **Purpose**: Multi-LLM validation that the Master Plan is coherent, complete, and non-hallucinatory.
152
+
153
+ **Inputs**
154
+ - Master Plan Plan Packet
155
+
156
+ **Actions**
157
+ - Reviewer(s) produce structured votes
158
+ - Arbitrator converges if needed
159
+
160
+ **Outputs (required)**
161
+ - `Consensus Packet` → `/docs/consensus/consensus_<packet-id>_v1_<date>.md`
162
+ - If patched: `Master Plan v2` + updated packet version
163
+
164
+ **Gate conditions (PASS)**
165
+ - Consensus threshold met (e.g., ≥95% approvals)
166
+ - No unresolved blocking issues
167
+ - No Constitution violations
168
+ - Plan is complete enough to design architecture
169
+
170
+ **If FAIL**
171
+ - Return to INTAKE with explicit revision instructions (Dispatcher-owned)
172
+ - Re-run consensus
173
+
174
+ ---
175
+
176
+ ### Phase 3 — ARCHITECTURE
177
+ **Purpose**: Create system architecture + explicit contracts so BE/FE/DB can plan without inventing.
178
+
179
+ **Inputs**
180
+ - Approved Master Plan
181
+ - Repo snapshot (what exists)
182
+
183
+ **Actions (Architect)**
184
+ - Define:
185
+ - System topology & boundaries
186
+ - Module/service boundaries
187
+ - API contracts (OpenAPI-like)
188
+ - Auth model and security assumptions
189
+ - Data ownership boundaries
190
+ - Env var list
191
+ - Repo layout blueprint
192
+ - Error handling strategy
193
+ - Scaling assumptions & risks
194
+
195
+ **Outputs (required)**
196
+ - Architecture doc → `/docs/architecture/architecture_<id>_v1_<date>.md`
197
+ - Contract section(s) included (API, data, env, auth)
198
+ - Plan Packet for Architecture review
199
+
200
+ **Gate conditions**
201
+ - Contracts explicit enough for FE/BE to build without guessing
202
+ - Env vars enumerated
203
+ - Integration points enumerated
204
+
205
+ ---
206
+
207
+ ### Phase 4 — CONSENSUS on Architecture
208
+ **Purpose**: Ensure architecture is feasible, consistent, and complete.
209
+
210
+ **Inputs**
211
+ - Architecture Plan Packet
212
+
213
+ **Outputs**
214
+ - Consensus Packet
215
+ - If patched: Architecture v2
216
+
217
+ **Gate conditions (PASS)**
218
+ - Consensus threshold met
219
+ - No unresolved integration gaps
220
+ - No contradictory contracts
221
+
222
+ **If FAIL**
223
+ - Return to ARCHITECTURE with targeted patch instructions
224
+
225
+ ---
226
+
227
+ ### Phase 5 — ROLE PLANNING
228
+ **Purpose**: Produce deterministic implementation plans by role, based on approved architecture.
229
+
230
+ **Inputs**
231
+ - Approved Master Plan
232
+ - Approved Architecture
233
+ - Repo snapshot
234
+
235
+ **Actions**
236
+ - DB Expert plan (schema + migrations + rollback + indexes)
237
+ - BE plan (endpoints + services + validation + tests)
238
+ - FE plan (screens + typed client + auth + error/empty/loading + tests as relevant)
239
+ - Website plan (pages + SEO + analytics + brand alignment) if in scope
240
+ - QA plan (critical paths + integration tests + regression suite + commands)
241
+
242
+ **Outputs (required)**
243
+ - Role plans under `/docs/role-plans/`
244
+ - `db_plan_<id>_v1_<date>.md`
245
+ - `backend_plan_<id>_v1_<date>.md`
246
+ - `frontend_plan_<id>_v1_<date>.md`
247
+ - `website_plan_<id>_v1_<date>.md` (if relevant)
248
+ - `qa_plan_<id>_v1_<date>.md`
249
+ - Either:
250
+ - One combined Plan Packet referencing all role plans, OR
251
+ - One Plan Packet per role plan
252
+
253
+ **Gate conditions**
254
+ - Ownership respected (schema only by DB Expert, contracts only by Architect)
255
+ - Each plan includes deterministic file-level outputs
256
+ - QA plan lists executable tests (not “write tests”)
257
+
258
+ ---
259
+
260
+ ### Phase 6 — CONSENSUS on Role Plans
261
+ **Purpose**: Prevent downstream gaps and shortcuts by validating each role plan.
262
+
263
+ **Inputs**
264
+ - Role Plan Packet(s)
265
+
266
+ **Outputs**
267
+ - Consensus Packet(s) for role plans
268
+ - Patched role plans if needed
269
+
270
+ **Gate conditions (PASS)**
271
+ - All required plans are approved
272
+ - Dependencies satisfied:
273
+ - FE depends on API contracts
274
+ - BE depends on DB plan if DB exists
275
+ - QA depends on feature list + contracts
276
+
277
+ **If FAIL**
278
+ - Return only the failing plan to ROLE PLANNING (targeted iteration)
279
+
280
+ ---
281
+
282
+ ### Phase 7 — IMPLEMENTATION
283
+ **Purpose**: Build the system according to the approved plans (no drift).
284
+
285
+ **Inputs**
286
+ - Approved Architecture
287
+ - Approved Role Plans
288
+ - Approved QA plan
289
+
290
+ **Actions**
291
+ - BE implements endpoints/services/auth/validation
292
+ - DB implements migrations/models
293
+ - FE implements UI and wires to real endpoints
294
+ - Website implements site pages if in scope
295
+ - Unit tests added as defined in QA/role plans
296
+
297
+ **Outputs**
298
+ - Code changes in repo
299
+ - Build/test command logs captured (for later gates)
300
+ - Updated repo snapshot
301
+
302
+ **Gate conditions**
303
+ - Implementation matches plan (no unapproved changes)
304
+ - No placeholders/mocks unless explicitly approved
305
+
306
+ ---
307
+
308
+ ### Phase 8 — QA VALIDATION
309
+ **Purpose**: Execute QA plan and validate critical paths.
310
+
311
+ **Inputs**
312
+ - QA plan
313
+ - Repo state
314
+ - Build/test outputs
315
+
316
+ **Actions**
317
+ - Run specified tests
318
+ - Validate critical workflows end-to-end
319
+ - Produce QA report
320
+
321
+ **Outputs (required)**
322
+ - QA validation report → `/docs/role-plans/qa_validation_<id>_<date>.md`
323
+ - Any failures captured as incidents (optional early RCA trigger)
324
+
325
+ **Gate conditions (PASS)**
326
+ - All critical path tests pass
327
+ - Any known gaps are explicitly listed (should route to recovery if blocking)
328
+
329
+ ---
330
+
331
+ ### Phase 9 — REVIEW
332
+ **Purpose**: Verify the implementation matches approved plans with evidence.
333
+
334
+ **Inputs**
335
+ - Repo snapshot
336
+ - Approved plans + contracts
337
+ - QA report
338
+
339
+ **Actions**
340
+ - Reviewer checks:
341
+ - plan alignment
342
+ - evidence references
343
+ - no shortcuts
344
+ - integration wiring
345
+ - Generate fresh repo snapshot and diff against baseline (role-plan-approval snapshot)
346
+ - Detect implementation drift (config changes, significant line deltas)
347
+
348
+ **Outputs**
349
+ - Review decision doc -> `/docs/consensus/review_<id>_<date>.md`
350
+ - If rejected: structured blocking list
351
+ - v1.1: Change Request artifacts for detected drift (stored as `change_request` artifacts)
352
+ - v1.1: Pending CRs registered in `pipeline.pendingChangeRequests` for orchestrator routing
353
+
354
+ **Gate conditions (PASS)**
355
+ - Reviewer approves with evidence
356
+ - No Constitution violations
357
+
358
+ **v1.1 Post-Gate Behavior**
359
+ - After REVIEW gate passes, orchestrator checks `pendingChangeRequests` for proposed CRs
360
+ - If CRs exist, routes to the appropriate consensus phase (e.g., CONSENSUS_MASTER_PLAN for scope drift)
361
+ - If no CRs, continues to AUDIT normally
362
+
363
+ ---
364
+
365
+ ### Phase 10 — AUDIT
366
+ **Purpose**: Holistic verification before Production Gate.
367
+
368
+ **Inputs**
369
+ - Everything above + repo snapshot + logs
370
+
371
+ **Actions (Auditor)**
372
+ - Integration audit (FE<->BE, BE<->DB)
373
+ - Config/env audit
374
+ - Tests/coverage audit
375
+ - Migration audit
376
+ - Basic security audit
377
+ - Deployment readiness audit
378
+
379
+ **Outputs (required)**
380
+ - Audit Report -> `/docs/audit/audit_<id>_<date>.md`
381
+ - Audit Report schema (JSON)
382
+ - v1.1: Change Request artifacts for blocking architectural/security findings
383
+ - v1.1: Pending CRs registered in `pipeline.pendingChangeRequests` for orchestrator routing
384
+
385
+ **Gate conditions (PASS)**
386
+ - No P0/P1 findings open
387
+ - Deployment path exists
388
+ - No hardcoded secrets
389
+ - End-to-end wiring verified
390
+
391
+ **v1.1 Post-Gate Behavior**
392
+ - After AUDIT gate passes, orchestrator checks `pendingChangeRequests` for proposed CRs
393
+ - Architectural findings (integration/schema blocking issues) create CRs targeting CONSENSUS_ARCHITECTURE
394
+ - Security findings create CRs targeting CONSENSUS_MASTER_PLAN
395
+ - If CRs exist, routes to the appropriate consensus phase before PRODUCTION_GATE
396
+ - If no CRs, continues to PRODUCTION_GATE normally
397
+
398
+ **If FAIL**
399
+ - Enter RECOVERY_LOOP
400
+
401
+ ---
402
+
403
+ ### Phase 11 — PRODUCTION GATE
404
+ **Purpose**: Binary pass/fail “production-ready” decision.
405
+
406
+ **Inputs**
407
+ - Audit PASS
408
+ - Build/test/lint/typecheck results
409
+ - Deployment instructions present
410
+
411
+ **Required checks (minimum)**
412
+ - Build passes
413
+ - Tests pass (unit + integration as required)
414
+ - Lint/typecheck pass (as applicable)
415
+ - Migrations apply cleanly (if DB)
416
+ - Audit PASS
417
+ - No unresolved incidents
418
+
419
+ **Outputs (required)**
420
+ - Production Readiness Report → `/docs/production/production_readiness_<id>_<date>.md`
421
+ - Final verdict: PASS/FAIL
422
+
423
+ **If PASS**
424
+ - Transition to DONE (with logging + release)
425
+
426
+ **If FAIL**
427
+ - Enter RECOVERY_LOOP
428
+
429
+ ---
430
+
431
+ ## 4) Recovery Loop (FAIL -> Debugger -> Plan -> Fix -> Retest)
432
+
433
+ ### Phase 12 — RECOVERY_LOOP (conditional)
434
+ **Purpose**: Self-heal deterministically using RCA, not guesswork.
435
+
436
+ **Inputs**
437
+ - Failure evidence (logs, stack traces, failing tests, audit findings)
438
+ - All `/docs/` artifacts (Journalist record)
439
+ - Repo snapshot
440
+
441
+ **Steps**
442
+ 1) **Debugger produces RCA**
443
+ - root cause (precise)
444
+ - origin phase (architecture / role planning / implementation / config / QA)
445
+ - ownership (which role must fix)
446
+ - recommended corrective actions
447
+ - prevention suggestion
448
+ - v1.1: `requires_phase_rewind_to` field specifying which phase to rewind to
449
+
450
+ 2) **Dispatcher generates Recovery Plan**
451
+ - targeted tasks mapped to responsible role(s)
452
+ - artifacts to update (if needed)
453
+ - whether consensus required (schema/contract changes must re-consensus)
454
+
455
+ 3) **Consensus on Recovery Plan** (recommended; mandatory for architecture/schema changes)
456
+
457
+ 4) **Implement fixes** (by responsible role)
458
+
459
+ 5) **Post-recovery routing** (v1.1 — RCA-driven rewind):
460
+ - Orchestrator reads latest RCA JSON artifact from disk
461
+ - If RCA specifies `requires_phase_rewind_to`, pipeline rewinds to that phase
462
+ - Otherwise, retests the originally failed phase, then proceeds forward:
463
+ - If failed at Audit -> rerun Audit
464
+ - If failed at Production Gate -> rerun Production checks
465
+ - If failed tests -> rerun tests + QA validation
466
+ - If no failed phase is tracked, defaults to QA_VALIDATION
467
+
468
+ **Outputs (required)**
469
+ - RCA report -> `/docs/incidents/rca_<id>_<date>.md` (both markdown and JSON, JSON includes `requires_phase_rewind_to`)
470
+ - Recovery plan packet + consensus packet
471
+ - Updated artifacts if scope/contracts changed
472
+
473
+ **Stop conditions**
474
+ - Max recovery iterations (default: 5)
475
+ - If exceeded -> STUCK state with “Stuck Report”
476
+
477
+ ---
478
+
479
+ ## 5) PASS Path: Journalist + Release Notes
480
+
481
+ ### Phase 13 — DONE (PASS)
482
+ **Purpose**: Finalize immutable documentation + release packaging.
483
+
484
+ **Actions**
485
+ - Journalist:
486
+ - logs all final Plan/Consensus/Audit/Production artifacts under `/docs/`
487
+ - updates `/docs/INDEX.md`
488
+ - Release Manager:
489
+ - produces release notes
490
+ - produces deployment instructions
491
+ - produces rollback plan
492
+ - stores under `/docs/release/`
493
+
494
+ **Outputs (required)**
495
+ - `/docs/release/release_notes_<id>_<date>.md`
496
+ - `/docs/release/deployment_<id>_<date>.md`
497
+ - `/docs/release/rollback_<id>_<date>.md`
498
+ - `/docs/INDEX.md` updated
499
+
500
+ ---
501
+
502
+ ## 6) STUCK State (Safety Valve)
503
+
504
+ If recovery iterations exceed max, Popeye must stop and output:
505
+
506
+ **Stuck Report** → `/docs/incidents/stuck_<id>_<date>.md` including:
507
+ - current failing gate
508
+ - last RCA summary
509
+ - top 3 suspected resolution paths
510
+ - what missing human input is required (if any)
511
+ - which artifacts must be updated
512
+
513
+ ---
514
+
515
+ ## 7) Non-Negotiable Rules (Autonomy Hardening)
516
+
517
+ - No skipping phases
518
+ - No “mock until later” unless explicitly approved by consensus
519
+ - Any schema/contract change requires:
520
+ - updated artifact(s)
521
+ - re-consensus
522
+ - Journalist record
523
+ - Every plan claim must be evidenced against repo snapshot
524
+ - Production readiness is binary, not “looks good”
525
+
526
+ ### v1.1 Additions
527
+
528
+ - Constitution integrity is verified at every gate (SHA-256 hash comparison). A modified constitution blocks all gate progression until resolved.
529
+ - Consensus scores from phase handlers are never overwritten by gate engine evaluation (gate result merge rule).
530
+ - REVIEW and AUDIT phases must register detected issues as Change Requests in `pipeline.pendingChangeRequests`.
531
+ - CRs are routed deterministically by the orchestrator (not advisory). The routing is a deterministic transition, not a suggestion.
532
+ - RCA packets must include a `requires_phase_rewind_to` field when the root cause originates in a phase earlier than the one that failed. The orchestrator reads this from the JSON artifact on disk.
533
+ - CRs are processed one at a time (first `proposed` CR is routed and marked `approved` before the next is considered).
534
+
535
+ ---
536
+
537
+ End of Spec.