aether-colony 5.0.0 → 5.2.1

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 (317) hide show
  1. package/.aether/aether-utils.sh +3226 -3345
  2. package/.aether/agents-claude/aether-ambassador.md +265 -0
  3. package/.aether/agents-claude/aether-archaeologist.md +327 -0
  4. package/.aether/agents-claude/aether-architect.md +236 -0
  5. package/.aether/agents-claude/aether-auditor.md +271 -0
  6. package/.aether/agents-claude/aether-builder.md +224 -0
  7. package/.aether/agents-claude/aether-chaos.md +269 -0
  8. package/.aether/agents-claude/aether-chronicler.md +305 -0
  9. package/.aether/agents-claude/aether-gatekeeper.md +330 -0
  10. package/.aether/agents-claude/aether-includer.md +374 -0
  11. package/.aether/agents-claude/aether-keeper.md +272 -0
  12. package/.aether/agents-claude/aether-measurer.md +322 -0
  13. package/.aether/agents-claude/aether-oracle.md +237 -0
  14. package/.aether/agents-claude/aether-probe.md +211 -0
  15. package/.aether/agents-claude/aether-queen.md +330 -0
  16. package/.aether/agents-claude/aether-route-setter.md +178 -0
  17. package/.aether/agents-claude/aether-sage.md +418 -0
  18. package/.aether/agents-claude/aether-scout.md +179 -0
  19. package/.aether/agents-claude/aether-surveyor-disciplines.md +417 -0
  20. package/.aether/agents-claude/aether-surveyor-nest.md +355 -0
  21. package/.aether/agents-claude/aether-surveyor-pathogens.md +289 -0
  22. package/.aether/agents-claude/aether-surveyor-provisions.md +360 -0
  23. package/.aether/agents-claude/aether-tracker.md +270 -0
  24. package/.aether/agents-claude/aether-watcher.md +280 -0
  25. package/.aether/agents-claude/aether-weaver.md +248 -0
  26. package/.aether/commands/archaeology.yaml +653 -0
  27. package/.aether/commands/build.yaml +1221 -0
  28. package/.aether/commands/chaos.yaml +653 -0
  29. package/.aether/commands/colonize.yaml +442 -0
  30. package/.aether/commands/continue.yaml +1484 -0
  31. package/.aether/commands/council.yaml +509 -0
  32. package/.aether/commands/data-clean.yaml +80 -0
  33. package/.aether/commands/dream.yaml +275 -0
  34. package/.aether/commands/entomb.yaml +863 -0
  35. package/.aether/commands/export-signals.yaml +64 -0
  36. package/.aether/commands/feedback.yaml +158 -0
  37. package/.aether/commands/flag.yaml +160 -0
  38. package/.aether/commands/flags.yaml +177 -0
  39. package/.aether/commands/focus.yaml +112 -0
  40. package/.aether/commands/help.yaml +167 -0
  41. package/.aether/commands/history.yaml +137 -0
  42. package/.aether/commands/import-signals.yaml +79 -0
  43. package/.aether/commands/init.yaml +502 -0
  44. package/.aether/commands/insert-phase.yaml +102 -0
  45. package/.aether/commands/interpret.yaml +285 -0
  46. package/.aether/commands/lay-eggs.yaml +224 -0
  47. package/.aether/commands/maturity.yaml +122 -0
  48. package/.aether/commands/memory-details.yaml +74 -0
  49. package/.aether/commands/migrate-state.yaml +174 -0
  50. package/.aether/commands/oracle.yaml +1224 -0
  51. package/.aether/commands/organize.yaml +446 -0
  52. package/.aether/commands/patrol.yaml +621 -0
  53. package/.aether/commands/pause-colony.yaml +424 -0
  54. package/.aether/commands/phase.yaml +124 -0
  55. package/.aether/commands/pheromones.yaml +153 -0
  56. package/.aether/commands/plan.yaml +1364 -0
  57. package/.aether/commands/preferences.yaml +63 -0
  58. package/.aether/commands/quick.yaml +104 -0
  59. package/.aether/commands/redirect.yaml +123 -0
  60. package/.aether/commands/resume-colony.yaml +375 -0
  61. package/.aether/commands/resume.yaml +407 -0
  62. package/.aether/commands/run.yaml +229 -0
  63. package/.aether/commands/seal.yaml +1214 -0
  64. package/.aether/commands/skill-create.yaml +337 -0
  65. package/.aether/commands/status.yaml +408 -0
  66. package/.aether/commands/swarm.yaml +352 -0
  67. package/.aether/commands/tunnels.yaml +814 -0
  68. package/.aether/commands/update.yaml +131 -0
  69. package/.aether/commands/verify-castes.yaml +159 -0
  70. package/.aether/commands/watch.yaml +454 -0
  71. package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
  72. package/.aether/docs/QUEEN-SYSTEM.md +11 -11
  73. package/.aether/docs/README.md +32 -2
  74. package/.aether/docs/command-playbooks/README.md +23 -0
  75. package/.aether/docs/command-playbooks/build-complete.md +349 -0
  76. package/.aether/docs/command-playbooks/build-context.md +282 -0
  77. package/.aether/docs/command-playbooks/build-full.md +1683 -0
  78. package/.aether/docs/command-playbooks/build-prep.md +284 -0
  79. package/.aether/docs/command-playbooks/build-verify.md +405 -0
  80. package/.aether/docs/command-playbooks/build-wave.md +749 -0
  81. package/.aether/docs/command-playbooks/continue-advance.md +524 -0
  82. package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
  83. package/.aether/docs/command-playbooks/continue-full.md +1725 -0
  84. package/.aether/docs/command-playbooks/continue-gates.md +686 -0
  85. package/.aether/docs/command-playbooks/continue-verify.md +407 -0
  86. package/.aether/docs/context-continuity.md +84 -0
  87. package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
  88. package/.aether/docs/error-codes.md +1 -1
  89. package/.aether/docs/known-issues.md +34 -173
  90. package/.aether/docs/pheromones.md +86 -6
  91. package/.aether/docs/plans/pheromone-display-plan.md +257 -0
  92. package/.aether/docs/queen-commands.md +10 -9
  93. package/.aether/docs/source-of-truth-map.md +132 -0
  94. package/.aether/docs/xml-utilities.md +47 -0
  95. package/.aether/rules/aether-colony.md +23 -13
  96. package/.aether/scripts/incident-test-add.sh +47 -0
  97. package/.aether/scripts/weekly-audit.sh +79 -0
  98. package/.aether/skills/.index.json +649 -0
  99. package/.aether/skills/colony/.manifest.json +16 -0
  100. package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
  101. package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
  102. package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
  103. package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
  104. package/.aether/skills/colony/context-management/SKILL.md +80 -0
  105. package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
  106. package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
  107. package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
  108. package/.aether/skills/colony/state-safety/SKILL.md +84 -0
  109. package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
  110. package/.aether/skills/domain/.manifest.json +24 -0
  111. package/.aether/skills/domain/README.md +33 -0
  112. package/.aether/skills/domain/django/SKILL.md +49 -0
  113. package/.aether/skills/domain/docker/SKILL.md +52 -0
  114. package/.aether/skills/domain/golang/SKILL.md +52 -0
  115. package/.aether/skills/domain/graphql/SKILL.md +51 -0
  116. package/.aether/skills/domain/html-css/SKILL.md +48 -0
  117. package/.aether/skills/domain/nextjs/SKILL.md +45 -0
  118. package/.aether/skills/domain/nodejs/SKILL.md +53 -0
  119. package/.aether/skills/domain/postgresql/SKILL.md +53 -0
  120. package/.aether/skills/domain/prisma/SKILL.md +59 -0
  121. package/.aether/skills/domain/python/SKILL.md +50 -0
  122. package/.aether/skills/domain/rails/SKILL.md +52 -0
  123. package/.aether/skills/domain/react/SKILL.md +45 -0
  124. package/.aether/skills/domain/rest-api/SKILL.md +58 -0
  125. package/.aether/skills/domain/svelte/SKILL.md +47 -0
  126. package/.aether/skills/domain/tailwind/SKILL.md +45 -0
  127. package/.aether/skills/domain/testing/SKILL.md +53 -0
  128. package/.aether/skills/domain/typescript/SKILL.md +58 -0
  129. package/.aether/skills/domain/vue/SKILL.md +49 -0
  130. package/.aether/templates/QUEEN.md.template +23 -41
  131. package/.aether/templates/colony-state-reset.jq.template +1 -0
  132. package/.aether/templates/colony-state.template.json +4 -0
  133. package/.aether/templates/learning-observations.template.json +6 -0
  134. package/.aether/templates/midden.template.json +13 -0
  135. package/.aether/templates/pheromones.template.json +6 -0
  136. package/.aether/templates/session.template.json +9 -0
  137. package/.aether/utils/atomic-write.sh +63 -17
  138. package/.aether/utils/chamber-utils.sh +145 -2
  139. package/.aether/utils/council.sh +425 -0
  140. package/.aether/utils/emoji-audit.sh +166 -0
  141. package/.aether/utils/error-handler.sh +21 -7
  142. package/.aether/utils/file-lock.sh +182 -27
  143. package/.aether/utils/flag.sh +278 -0
  144. package/.aether/utils/hive.sh +572 -0
  145. package/.aether/utils/immune.sh +508 -0
  146. package/.aether/utils/learning.sh +1928 -0
  147. package/.aether/utils/midden.sh +520 -0
  148. package/.aether/utils/oracle/oracle.md +168 -0
  149. package/.aether/utils/oracle/oracle.sh +1023 -0
  150. package/.aether/utils/pheromone.sh +2029 -0
  151. package/.aether/utils/queen.sh +1710 -0
  152. package/.aether/utils/scan.sh +860 -0
  153. package/.aether/utils/semantic-cli.sh +10 -8
  154. package/.aether/utils/session.sh +816 -0
  155. package/.aether/utils/skills.sh +509 -0
  156. package/.aether/utils/spawn-tree.sh +103 -271
  157. package/.aether/utils/spawn.sh +260 -0
  158. package/.aether/utils/state-api.sh +389 -0
  159. package/.aether/utils/state-loader.sh +8 -6
  160. package/.aether/utils/suggest.sh +611 -0
  161. package/.aether/utils/swarm-display.sh +10 -1
  162. package/.aether/utils/swarm.sh +1004 -0
  163. package/.aether/utils/watch-spawn-tree.sh +11 -2
  164. package/.aether/utils/xml-compose.sh +2 -2
  165. package/.aether/utils/xml-convert.sh +9 -5
  166. package/.aether/utils/xml-core.sh +5 -9
  167. package/.aether/utils/xml-query.sh +4 -4
  168. package/.aether/workers.md +86 -67
  169. package/.claude/agents/ant/aether-ambassador.md +2 -1
  170. package/.claude/agents/ant/aether-archaeologist.md +6 -1
  171. package/.claude/agents/ant/aether-architect.md +236 -0
  172. package/.claude/agents/ant/aether-auditor.md +6 -1
  173. package/.claude/agents/ant/aether-builder.md +38 -1
  174. package/.claude/agents/ant/aether-chaos.md +2 -1
  175. package/.claude/agents/ant/aether-chronicler.md +1 -0
  176. package/.claude/agents/ant/aether-gatekeeper.md +6 -1
  177. package/.claude/agents/ant/aether-includer.md +1 -0
  178. package/.claude/agents/ant/aether-keeper.md +1 -0
  179. package/.claude/agents/ant/aether-measurer.md +6 -1
  180. package/.claude/agents/ant/aether-oracle.md +237 -0
  181. package/.claude/agents/ant/aether-probe.md +2 -1
  182. package/.claude/agents/ant/aether-queen.md +6 -1
  183. package/.claude/agents/ant/aether-route-setter.md +6 -1
  184. package/.claude/agents/ant/aether-sage.md +68 -3
  185. package/.claude/agents/ant/aether-scout.md +38 -1
  186. package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
  187. package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
  188. package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
  189. package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
  190. package/.claude/agents/ant/aether-tracker.md +6 -1
  191. package/.claude/agents/ant/aether-watcher.md +37 -1
  192. package/.claude/agents/ant/aether-weaver.md +2 -1
  193. package/.claude/commands/ant/archaeology.md +1 -8
  194. package/.claude/commands/ant/build.md +43 -1159
  195. package/.claude/commands/ant/chaos.md +1 -14
  196. package/.claude/commands/ant/colonize.md +3 -14
  197. package/.claude/commands/ant/continue.md +40 -1026
  198. package/.claude/commands/ant/council.md +213 -15
  199. package/.claude/commands/ant/data-clean.md +81 -0
  200. package/.claude/commands/ant/dream.md +12 -9
  201. package/.claude/commands/ant/entomb.md +62 -87
  202. package/.claude/commands/ant/export-signals.md +57 -0
  203. package/.claude/commands/ant/feedback.md +18 -0
  204. package/.claude/commands/ant/flag.md +12 -0
  205. package/.claude/commands/ant/flags.md +22 -8
  206. package/.claude/commands/ant/focus.md +18 -0
  207. package/.claude/commands/ant/help.md +40 -8
  208. package/.claude/commands/ant/history.md +3 -0
  209. package/.claude/commands/ant/import-signals.md +71 -0
  210. package/.claude/commands/ant/init.md +349 -191
  211. package/.claude/commands/ant/insert-phase.md +105 -0
  212. package/.claude/commands/ant/interpret.md +11 -0
  213. package/.claude/commands/ant/lay-eggs.md +167 -158
  214. package/.claude/commands/ant/maturity.md +22 -11
  215. package/.claude/commands/ant/memory-details.md +77 -0
  216. package/.claude/commands/ant/migrate-state.md +6 -0
  217. package/.claude/commands/ant/oracle.md +317 -62
  218. package/.claude/commands/ant/organize.md +10 -5
  219. package/.claude/commands/ant/patrol.md +620 -0
  220. package/.claude/commands/ant/pause-colony.md +8 -22
  221. package/.claude/commands/ant/phase.md +26 -37
  222. package/.claude/commands/ant/pheromones.md +156 -0
  223. package/.claude/commands/ant/plan.md +199 -50
  224. package/.claude/commands/ant/preferences.md +65 -0
  225. package/.claude/commands/ant/quick.md +100 -0
  226. package/.claude/commands/ant/redirect.md +18 -0
  227. package/.claude/commands/ant/resume-colony.md +37 -22
  228. package/.claude/commands/ant/resume.md +60 -7
  229. package/.claude/commands/ant/run.md +231 -0
  230. package/.claude/commands/ant/seal.md +506 -78
  231. package/.claude/commands/ant/skill-create.md +286 -0
  232. package/.claude/commands/ant/status.md +171 -1
  233. package/.claude/commands/ant/swarm.md +11 -23
  234. package/.claude/commands/ant/tunnels.md +1 -0
  235. package/.claude/commands/ant/update.md +58 -135
  236. package/.claude/commands/ant/verify-castes.md +90 -42
  237. package/.claude/commands/ant/watch.md +1 -0
  238. package/.opencode/agents/aether-ambassador.md +1 -1
  239. package/.opencode/agents/aether-architect.md +133 -0
  240. package/.opencode/agents/aether-builder.md +3 -3
  241. package/.opencode/agents/aether-oracle.md +137 -0
  242. package/.opencode/agents/aether-queen.md +1 -1
  243. package/.opencode/agents/aether-route-setter.md +1 -1
  244. package/.opencode/agents/aether-scout.md +1 -1
  245. package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
  246. package/.opencode/agents/aether-surveyor-nest.md +6 -1
  247. package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
  248. package/.opencode/agents/aether-surveyor-provisions.md +6 -1
  249. package/.opencode/agents/aether-tracker.md +1 -1
  250. package/.opencode/agents/aether-watcher.md +1 -1
  251. package/.opencode/agents/aether-weaver.md +1 -1
  252. package/.opencode/commands/ant/archaeology.md +7 -14
  253. package/.opencode/commands/ant/build.md +54 -88
  254. package/.opencode/commands/ant/chaos.md +7 -24
  255. package/.opencode/commands/ant/colonize.md +10 -17
  256. package/.opencode/commands/ant/continue.md +595 -66
  257. package/.opencode/commands/ant/council.md +150 -18
  258. package/.opencode/commands/ant/data-clean.md +77 -0
  259. package/.opencode/commands/ant/dream.md +15 -17
  260. package/.opencode/commands/ant/entomb.md +28 -18
  261. package/.opencode/commands/ant/export-signals.md +54 -0
  262. package/.opencode/commands/ant/feedback.md +24 -5
  263. package/.opencode/commands/ant/flag.md +16 -4
  264. package/.opencode/commands/ant/flags.md +24 -10
  265. package/.opencode/commands/ant/focus.md +22 -5
  266. package/.opencode/commands/ant/help.md +41 -8
  267. package/.opencode/commands/ant/history.md +9 -0
  268. package/.opencode/commands/ant/import-signals.md +68 -0
  269. package/.opencode/commands/ant/init.md +396 -154
  270. package/.opencode/commands/ant/insert-phase.md +111 -0
  271. package/.opencode/commands/ant/interpret.md +16 -0
  272. package/.opencode/commands/ant/lay-eggs.md +184 -112
  273. package/.opencode/commands/ant/maturity.md +18 -2
  274. package/.opencode/commands/ant/memory-details.md +83 -0
  275. package/.opencode/commands/ant/migrate-state.md +12 -0
  276. package/.opencode/commands/ant/oracle.md +322 -67
  277. package/.opencode/commands/ant/organize.md +14 -12
  278. package/.opencode/commands/ant/patrol.md +626 -0
  279. package/.opencode/commands/ant/pause-colony.md +12 -29
  280. package/.opencode/commands/ant/phase.md +30 -40
  281. package/.opencode/commands/ant/pheromones.md +162 -0
  282. package/.opencode/commands/ant/plan.md +210 -57
  283. package/.opencode/commands/ant/preferences.md +71 -0
  284. package/.opencode/commands/ant/quick.md +91 -0
  285. package/.opencode/commands/ant/redirect.md +22 -5
  286. package/.opencode/commands/ant/resume-colony.md +41 -29
  287. package/.opencode/commands/ant/resume.md +80 -20
  288. package/.opencode/commands/ant/run.md +237 -0
  289. package/.opencode/commands/ant/seal.md +230 -25
  290. package/.opencode/commands/ant/skill-create.md +63 -0
  291. package/.opencode/commands/ant/status.md +125 -30
  292. package/.opencode/commands/ant/swarm.md +3 -345
  293. package/.opencode/commands/ant/tunnels.md +3 -9
  294. package/.opencode/commands/ant/update.md +63 -127
  295. package/.opencode/commands/ant/verify-castes.md +96 -42
  296. package/.opencode/commands/ant/watch.md +7 -0
  297. package/CHANGELOG.md +368 -1
  298. package/README.md +195 -324
  299. package/bin/cli.js +236 -429
  300. package/bin/generate-commands.js +186 -0
  301. package/bin/generate-commands.sh +128 -89
  302. package/bin/lib/spawn-logger.js +0 -15
  303. package/bin/lib/update-transaction.js +285 -35
  304. package/bin/npx-install.js +178 -0
  305. package/bin/validate-package.sh +85 -3
  306. package/package.json +16 -4
  307. package/.aether/CONTEXT.md +0 -160
  308. package/.aether/docs/QUEEN.md +0 -84
  309. package/.aether/exchange/colony-registry.xml +0 -11
  310. package/.aether/exchange/pheromones.xml +0 -87
  311. package/.aether/exchange/queen-wisdom.xml +0 -14
  312. package/.aether/model-profiles.yaml +0 -100
  313. package/.aether/utils/spawn-with-model.sh +0 -56
  314. package/bin/lib/model-profiles.js +0 -445
  315. package/bin/lib/model-verify.js +0 -288
  316. package/bin/lib/proxy-health.js +0 -253
  317. package/bin/lib/telemetry.js +0 -441
@@ -0,0 +1,1221 @@
1
+ name: "ant:build"
2
+ description: "🔨🐜🏗️🐜🔨 Build a phase with pure emergence - colony self-organizes and completes tasks"
3
+ body_claude: |
4
+ You are the **Queen**. Execute `/ant:build` through modular playbooks.
5
+
6
+ The phase to build is: `$ARGUMENTS`
7
+
8
+ ## Purpose
9
+
10
+ This command is intentionally short. It orchestrates build execution by loading
11
+ smaller playbooks in sequence. This improves instruction-following reliability
12
+ without changing build behavior.
13
+
14
+ ## Rules
15
+
16
+ 1. Do **not** invoke nested slash commands like `/ant:build-prep`.
17
+ 2. Use the Read tool to load each playbook file, then execute it.
18
+ 3. Preserve variables/results from prior stages and pass them forward.
19
+ 4. Stop immediately on hard failure conditions defined in any stage.
20
+ 5. Keep existing behavior and output format from the playbooks.
21
+
22
+ ## Stage Order
23
+
24
+ Run these stages in order:
25
+
26
+ 1. `.aether/docs/command-playbooks/build-prep.md`
27
+ 2. `.aether/docs/command-playbooks/build-context.md`
28
+ 3. `.aether/docs/command-playbooks/build-wave.md`
29
+ 4. `.aether/docs/command-playbooks/build-verify.md`
30
+ 5. `.aether/docs/command-playbooks/build-complete.md`
31
+
32
+ ## Execution Contract
33
+
34
+ For each stage:
35
+
36
+ 1. Read the file with the Read tool.
37
+ 2. Execute the instructions exactly as written.
38
+ 3. Keep an in-memory stage result record:
39
+ - `stage_name`
40
+ - `status` (`ok` or `failed`)
41
+ - `key_outputs` (values needed downstream)
42
+ 4. If `status == failed`, halt and report the failure with recovery options.
43
+
44
+ ## Required Cross-Stage State
45
+
46
+ Carry these values forward when produced:
47
+
48
+ - `phase_id`
49
+ - `visual_mode`
50
+ - `verbose_mode`
51
+ - `suggest_enabled`
52
+ - `colony_depth`
53
+ - `prompt_section`
54
+ - `wave_results`
55
+ - `verification_status`
56
+ - `synthesis_status`
57
+ - `next_action`
58
+
59
+ ## Final Output
60
+
61
+ After `build-complete.md` finishes, return the normal build summary and next-step
62
+ routing exactly as defined there.
63
+
64
+ body_opencode: |
65
+ You are the **Queen**. You DIRECTLY spawn multiple workers — do not delegate to a single Prime Worker.
66
+
67
+ The phase to build is: `$normalized_args`
68
+
69
+ ## Instructions
70
+
71
+ ### Step 0.5: Load Colony State
72
+
73
+ Run using Bash tool: `bash .aether/aether-utils.sh load-state`
74
+
75
+ If the command fails (non-zero exit or JSON has ok: false):
76
+ 1. Parse error JSON
77
+ 2. If error code is E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
78
+ 3. If validation error: Display error details with recovery suggestion and stop
79
+ 4. For other errors: Display generic error and suggest /ant:status for diagnostics
80
+
81
+ If successful:
82
+ 1. Parse the state JSON from result field
83
+ 2. Check if goal is null - if so: "No colony initialized. Run /ant:init first." and stop
84
+ 3. Extract current_phase and phase name from plan.phases[current_phase - 1].name
85
+ 4. Display brief resumption context:
86
+ ```
87
+ 🔄 Resuming: Phase X - Name
88
+ ```
89
+ (If HANDOFF.md exists, this provides orientation before the build proceeds)
90
+
91
+ After displaying context, run: `bash .aether/aether-utils.sh unload-state` to release the lock.
92
+
93
+ ### Step 1: Validate + Read State
94
+
95
+ **Parse $normalized_args:**
96
+ 1. Extract the phase number (first argument)
97
+ 2. Check remaining arguments for flags:
98
+ - If contains `--verbose` or `-v`: set `verbose_mode = true`
99
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
100
+ - If contains `--depth <level>`: set `cli_depth_override = <level>`
101
+ - Otherwise: set `visual_mode = true` (visual is default)
102
+
103
+ If the phase number is empty or not a number:
104
+
105
+ ```
106
+ Usage: /ant:build <phase_number> [--verbose|-v] [--no-visual] [--depth <level>]
107
+
108
+ Options:
109
+ --verbose, -v Show full completion details (spawn tree, TDD, patterns)
110
+ --no-visual Disable real-time visual display (visual is on by default)
111
+ --depth <level> Set colony depth for this build (light|standard|deep|full)
112
+
113
+ Examples:
114
+ /ant:build 1 Build Phase 1 (with visual display)
115
+ /ant:build 1 --verbose Build Phase 1 (full details + visual)
116
+ /ant:build 1 --no-visual Build Phase 1 without visual display
117
+ /ant:build 1 --depth deep Build Phase 1 with thorough investigation
118
+ ```
119
+
120
+ Stop here.
121
+
122
+ **Set colony depth (if --depth flag provided):**
123
+ If `cli_depth_override` is set:
124
+ 1. Run using Bash tool: `bash .aether/aether-utils.sh colony-depth set "$cli_depth_override"`
125
+ 2. Parse JSON result - if `.ok` is false:
126
+ - Display: `Error: Invalid depth "$cli_depth_override". Use: light, standard, deep, full`
127
+ - Stop here
128
+ 3. If valid: Display `Colony depth: {level}`
129
+
130
+ **Auto-upgrade old state:**
131
+ If `version` field is missing, "1.0", or "2.0":
132
+ 1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
133
+ 2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
134
+ 3. Output: `State auto-upgraded to v3.0`
135
+ 4. Continue with command.
136
+
137
+ Extract:
138
+ - `goal`, `state`, `current_phase` from top level
139
+ - `plan.phases` for phase data
140
+ - `errors.records` for error context
141
+ - `memory` for decisions/learnings
142
+
143
+ **Validate:**
144
+ - If `plan.phases` is empty -> output `No project plan. Run /ant:plan first.` and stop.
145
+ - Find the phase matching the requested ID. If not found -> output `Phase {id} not found.` and stop.
146
+ - If the phase status is `"completed"` -> output `Phase {id} already completed.` and stop.
147
+
148
+ ### Step 1.5: Blocker Advisory (Non-blocking)
149
+
150
+ Check for unresolved blocker flags on the requested phase:
151
+
152
+ ```bash
153
+ bash .aether/aether-utils.sh flag-check-blockers {phase_number}
154
+ ```
155
+
156
+ Parse the JSON result (`.result.blockers`):
157
+
158
+ - **If blockers == 0:** Display nothing (or optionally a brief `No active blockers for Phase {id}.` line). Proceed to Step 2.
159
+ - **If blockers > 0:** Retrieve blocker details:
160
+ ```bash
161
+ bash .aether/aether-utils.sh flag-list --type blocker --phase {phase_number}
162
+ ```
163
+ Parse `.result.flags` and display an advisory warning:
164
+ ```
165
+ ⚠️ BLOCKER ADVISORY: {blockers} unresolved blocker(s) for Phase {id}
166
+ {for each flag in result.flags:}
167
+ - [{flag.id}] {flag.title}
168
+ {end for}
169
+
170
+ Consider reviewing with /ant:flags or auto-fixing with /ant:swarm before building.
171
+ Proceeding anyway...
172
+ ```
173
+ **This is advisory only — do NOT stop.** Continue to Step 2 regardless.
174
+
175
+ ### Step 2: Update State
176
+
177
+ Read then update `.aether/data/COLONY_STATE.json`:
178
+ - Set `state` to `"EXECUTING"`
179
+ - Set `current_phase` to the phase number
180
+ - Set the phase's `status` to `"in_progress"` in `plan.phases[N]`
181
+ - Add `build_started_at` field with current ISO-8601 UTC timestamp
182
+ - Append to `events`: `"<timestamp>|phase_started|build|Phase <id>: <name> started"`
183
+
184
+ If `events` exceeds 100 entries, keep only the last 100.
185
+
186
+ Write COLONY_STATE.json.
187
+
188
+ ### Step 3: Git Checkpoint
189
+
190
+ Create a git checkpoint for rollback capability.
191
+
192
+ ```bash
193
+ git rev-parse --git-dir 2>/dev/null
194
+ ```
195
+
196
+ - **If succeeds** (is a git repo):
197
+ 1. Check for changes in Aether-managed directories only: `.aether .claude/commands/ant .claude/commands/st .opencode bin`
198
+ 2. **If changes exist**: `git stash push -m "aether-checkpoint: pre-phase-$PHASE_NUMBER" -- .aether .claude/commands/ant .claude/commands/st .opencode bin`
199
+ - IMPORTANT: Never use `--include-untracked` — it stashes ALL files including user work!
200
+ - Verify: `git stash list | head -1 | grep "aether-checkpoint"` — warn if empty
201
+ - Store checkpoint as `{type: "stash", ref: "aether-checkpoint: pre-phase-$PHASE_NUMBER"}`
202
+ 3. **If clean working tree**: Record `HEAD` hash via `git rev-parse HEAD`
203
+ - Store checkpoint as `{type: "commit", ref: "$HEAD_HASH"}`
204
+ - **If fails** (not a git repo): Set checkpoint to `{type: "none", ref: "(not a git repo)"}`.
205
+
206
+ Rollback procedure: `git stash pop` (if type is "stash") or `git reset --hard $ref` (if type is "commit").
207
+
208
+ Output header:
209
+
210
+ ```
211
+ 🔨🐜🏗️🐜🔨 ═══════════════════════════════════════════════════
212
+ B U I L D I N G P H A S E {id}
213
+ ═══════════════════════════════════════════════════ 🔨🐜🏗️🐜🔨
214
+
215
+ 📍 Phase {id}: {name}
216
+ 💾 Git Checkpoint: {checkpoint_type} → {checkpoint_ref}
217
+ 🔄 Rollback: `git stash pop` (stash) or `git reset --hard {ref}` (commit)
218
+ ```
219
+
220
+ Run using the Bash tool with description "Showing phase progress...":
221
+ ```bash
222
+ progress_bar=$(bash .aether/aether-utils.sh generate-progress-bar "$current_phase" "$total_phases" 20 2>/dev/null || echo "")
223
+ if [[ -n "$progress_bar" ]]; then
224
+ echo "[Phase ${current_phase}/${total_phases}] ${progress_bar}"
225
+ fi
226
+ ```
227
+
228
+ ### Step 4: Load Constraints
229
+
230
+ Read `.aether/data/constraints.json` if it exists.
231
+
232
+ Format for display:
233
+ ```
234
+ CONSTRAINTS:
235
+ FOCUS: {focus areas, comma-separated}
236
+ AVOID: {patterns to avoid from constraints}
237
+ ```
238
+
239
+ If file doesn't exist or is empty:
240
+ ```
241
+ CONSTRAINTS: (none)
242
+ ```
243
+
244
+ ### Step 4.0: Load Territory Survey
245
+
246
+ Check if territory survey exists and load relevant documents:
247
+
248
+ ```bash
249
+ bash .aether/aether-utils.sh survey-load "{phase_name}" 2>/dev/null
250
+ ```
251
+
252
+ **Parse the JSON response:**
253
+ - If `.ok` is false: Set `survey_docs = null` and skip survey loading
254
+ - If successful: Extract `.docs` (comma-separated list) and `.dir`
255
+
256
+ **Determine phase type from phase name:**
257
+ | Phase Contains | Documents to Load |
258
+ |----------------|-------------------|
259
+ | UI, frontend, component, button, page | DISCIPLINES.md, CHAMBERS.md |
260
+ | API, endpoint, backend, route | BLUEPRINT.md, DISCIPLINES.md |
261
+ | database, schema, model, migration | BLUEPRINT.md, PROVISIONS.md |
262
+ | test, spec, coverage | SENTINEL-PROTOCOLS.md, DISCIPLINES.md |
263
+ | integration, external, client | TRAILS.md, PROVISIONS.md |
264
+ | refactor, cleanup, debt | PATHOGENS.md, BLUEPRINT.md |
265
+ | setup, config, initialize | PROVISIONS.md, CHAMBERS.md |
266
+ | *default* | PROVISIONS.md, BLUEPRINT.md |
267
+
268
+ **Read the relevant survey documents** from `.aether/data/survey/`:
269
+ - Extract key patterns to follow
270
+ - Note file locations for new code
271
+ - Identify known concerns to avoid
272
+
273
+ **Display summary:**
274
+ ```
275
+ ━━━ 🗺️🐜 S U R V E Y L O A D E D ━━━
276
+ {for each doc loaded}
277
+ {emoji} {filename} — {brief description}
278
+ {/for}
279
+
280
+ {if no survey}
281
+ (No territory survey — run /ant:colonize for deeper context)
282
+ {/if}
283
+ ```
284
+
285
+ **Store for builder injection:**
286
+ - `survey_patterns` — patterns to follow
287
+ - `survey_locations` — where to place files
288
+ - `survey_concerns` — concerns to avoid
289
+
290
+ ### Step 4.1: Load QUEEN.md Wisdom
291
+
292
+ Call `queen-read` to extract eternal wisdom for worker priming:
293
+
294
+ ```bash
295
+ bash .aether/aether-utils.sh queen-read 2>/dev/null
296
+ ```
297
+
298
+ **Parse the JSON response:**
299
+ - If `.ok` is false or command fails: Set `queen_wisdom = null` and skip wisdom injection
300
+ - If successful: Extract wisdom sections from `.result.wisdom`
301
+
302
+ **Store wisdom variables:**
303
+ ```
304
+ queen_philosophies = .result.wisdom.philosophies (if .result.priming.has_philosophies)
305
+ queen_patterns = .result.wisdom.patterns (if .result.priming.has_patterns)
306
+ queen_redirects = .result.wisdom.redirects (if .result.priming.has_redirects)
307
+ queen_stack_wisdom = .result.wisdom.stack_wisdom (if .result.priming.has_stack_wisdom)
308
+ queen_decrees = .result.wisdom.decrees (if .result.priming.has_decrees)
309
+ ```
310
+
311
+ **Display summary (if any wisdom exists):**
312
+ ```
313
+ ━━━ 📜🐜 Q U E E N W I S D O M ━━━
314
+ {if queen_philosophies:} 📜 Philosophies: yes{/if}
315
+ {if queen_patterns:} 🧭 Patterns: yes{/if}
316
+ {if queen_redirects:} ⚠️ Redirects: yes{/if}
317
+ {if queen_stack_wisdom:} 🔧 Stack Wisdom: yes{/if}
318
+ {if queen_decrees:} 🏛️ Decrees: yes{/if}
319
+
320
+ {if none exist:} (no eternal wisdom recorded yet){/if}
321
+ ```
322
+
323
+ **Graceful handling:** If QUEEN.md doesn't exist or `queen-read` fails, continue without wisdom injection. Workers will receive standard prompts.
324
+
325
+ ### Step 4.1.6: Load Active Pheromones (Signal Consumption)
326
+
327
+ Call `pheromone-read` to extract active colony signals for worker priming:
328
+
329
+ ```bash
330
+ bash .aether/aether-utils.sh pheromone-read 2>/dev/null
331
+ ```
332
+
333
+ **Parse the JSON response:**
334
+ - If `.ok` is false or command fails: Set `pheromone_section = null` and skip pheromone injection
335
+ - If successful: Extract signals from `.result.signals`
336
+
337
+ **Active Signals Section Template (injected into builder prompts):**
338
+ ```
339
+ --- ACTIVE SIGNALS (Pheromone Consumption) ---
340
+ {focus_section if .result.signals.focus exists:}
341
+ 🎯 FOCUS: {focus_description}
342
+ {redirect_section if .result.signals.redirect exists:}
343
+ ⚠️ AVOID: {redirect_description}
344
+ {feedback_section if .result.signals.feedback exists:}
345
+ 💬 FEEDBACK: {feedback_description}
346
+ --- END SIGNALS ---
347
+ ```
348
+
349
+ **Store for builder injection:**
350
+ - `pheromone_section` — formatted signal section for builder prompts
351
+
352
+ **Display summary (if any signals exist):**
353
+ ```
354
+ ━━━ 🦠🐜 P H E R O M O N E S D E T E C T E D ━━━
355
+ {focus_present:} 🎯 Focus signal: yes{/if}
356
+ {redirect_present:} ⚠️ Redirect signal: yes{/if}
357
+ {feedback_present:} 💬 Feedback signal: yes{/if}
358
+
359
+ {if none exist:} (no active signals){/if}
360
+ ```
361
+
362
+ **Graceful handling:** If pheromone-read fails or no signals exist, continue without pheromone injection.
363
+
364
+ ---
365
+
366
+ ### Step 4.2: Archaeologist Pre-Build Scan
367
+
368
+ **Conditional step — only fires when the phase modifies existing files.**
369
+
370
+ 1. **Detect existing-file modification:**
371
+ Examine each task in the phase. Look at task descriptions, constraints, and hints for signals:
372
+ - Keywords: "update", "modify", "add to", "integrate into", "extend", "change", "refactor", "fix"
373
+ - References to existing file paths (files that already exist in the repo)
374
+ - Task type: if a task is purely "create new file X" with no references to existing code, it is new-file-only
375
+
376
+ **If ALL tasks are new-file-only** (no existing files will be modified):
377
+ - Skip this step silently — produce no output, no spawn
378
+ - Proceed directly to Step 5
379
+
380
+ 2. **If existing code modification detected — spawn Archaeologist Scout:**
381
+
382
+ Generate archaeologist name and log:
383
+ ```bash
384
+ bash .aether/aether-utils.sh generate-ant-name "archaeologist"
385
+ bash .aether/aether-utils.sh spawn-log "Queen" "scout" "{archaeologist_name}" "Pre-build archaeology scan"
386
+ ```
387
+
388
+ Display:
389
+ ```
390
+ 🏺🐜 Archaeologist {archaeologist_name} spawning
391
+ Scanning history of files to be modified...
392
+ ```
393
+
394
+ Spawn using Task tool with `subagent_type="aether-archaeologist"`, include `description: "🏺 Archaeologist {archaeologist_name}: Pre-build history scan"`:
395
+
396
+ ```
397
+ You are {Archaeologist-Name}, a 🏺🐜 Archaeologist Ant.
398
+
399
+ Mission: Pre-build archaeology scan
400
+
401
+ Files: {list of existing files that will be modified}
402
+
403
+ Work:
404
+ 1. Read each file to understand current state
405
+ 2. Run: git log --oneline -15 -- "{file_path}" for history
406
+ 3. Run: git log --all --grep="fix\|bug\|workaround\|hack\|revert" --oneline -- "{file_path}" for incident history
407
+ 4. Run: git blame "{file_path}" | head -40 for authorship
408
+ 5. Note TODO/FIXME/HACK markers
409
+
410
+ Log activity: bash .aether/aether-utils.sh activity-log "READ" "{Ant-Name}" "description"
411
+
412
+ Report (plain text):
413
+ - WHY key code sections exist (from commits)
414
+ - Known workarounds/hacks to preserve
415
+ - Key architectural decisions
416
+ - Areas of caution (high churn, reverts, emergencies)
417
+ - Stable bedrock vs volatile sand sections
418
+ ```
419
+
420
+ **Wait for results** (blocking — use TaskOutput with `block: true`).
421
+
422
+ Log completion:
423
+ ```bash
424
+ bash .aether/aether-utils.sh spawn-complete "{archaeologist_name}" "completed" "Pre-build archaeology scan"
425
+ ```
426
+
427
+ 3. **Store and display findings:**
428
+
429
+ Store the archaeologist's output as `archaeology_context`.
430
+
431
+ Display summary:
432
+ ```
433
+ ━━━ 🏺🐜 A R C H A E O L O G Y ━━━
434
+ {summary of findings from archaeologist}
435
+ ```
436
+
437
+ 4. **Injection into builder prompts:**
438
+ The `archaeology_context` will be injected into builder prompts in Step 5.1 (see below).
439
+ If this step was skipped (no existing files modified), the archaeology section is omitted from builder prompts.
440
+
441
+ ---
442
+
443
+ ### Step 5: Initialize Swarm Display and Analyze Tasks
444
+
445
+ **YOU (the Queen) will spawn workers directly. Do NOT delegate to a single Prime Worker.**
446
+
447
+ **Show build header:**
448
+ ```
449
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
450
+ Phase {id}: {name} — {N} waves, {M} tasks
451
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
452
+ ```
453
+
454
+ Where N = number of builder waves (excluding watcher/chaos) and M = total builder tasks.
455
+
456
+ Record `build_started_at_epoch=$(date +%s)` — this epoch integer is used by the BUILD SUMMARY block in Step 7 to calculate elapsed time.
457
+
458
+ Analyze the phase tasks:
459
+
460
+ Analyze the phase tasks:
461
+
462
+ 1. **Group tasks by dependencies:**
463
+ - **Wave 1:** Tasks with `depends_on: "none"` or `depends_on: []` (can run in parallel)
464
+ - **Wave 2:** Tasks depending on Wave 1 tasks
465
+ - **Wave 3+:** Continue until all tasks assigned
466
+
467
+ 2. **Assign castes:**
468
+ - Implementation tasks → 🔨🐜 Builder
469
+ - Research/docs tasks → 🔍🐜 Scout
470
+ - Testing/validation → 👁️🐜 Watcher (ALWAYS spawn at least one)
471
+ - Resilience testing → 🎲🐜 Chaos (ALWAYS spawn one after Watcher)
472
+
473
+ 3. **Generate ant names for each worker:**
474
+ ```bash
475
+ bash .aether/aether-utils.sh generate-ant-name "builder"
476
+ bash .aether/aether-utils.sh generate-ant-name "watcher"
477
+ bash .aether/aether-utils.sh generate-ant-name "chaos"
478
+ ```
479
+
480
+ Display spawn plan with caste emojis:
481
+ ```
482
+ ━━━ 🐜 S P A W N P L A N ━━━
483
+
484
+ Wave 1 — Parallel
485
+ 🔨🐜 {Builder-Name} Task {id} {description}
486
+ 🔨🐜 {Builder-Name} Task {id} {description}
487
+
488
+ Wave 2 — After Wave 1
489
+ 🔨🐜 {Builder-Name} Task {id} {description}
490
+
491
+ Verification
492
+ 👁️🐜 {Watcher-Name} Verify all work independently
493
+ 🎲🐜 {Chaos-Name} Resilience testing (after Watcher)
494
+
495
+ Total: {N} Builders + 1 Watcher + 1 Chaos = {N+2} spawns
496
+ ```
497
+
498
+ **Caste Emoji Legend:**
499
+ - 🔨🐜 Builder (cyan if color enabled)
500
+ - 👁️🐜 Watcher (green if color enabled)
501
+ - 🎲🐜 Chaos (red if color enabled)
502
+ - 🔍🐜 Scout (yellow if color enabled)
503
+ - 🏺🐜 Archaeologist (magenta if color enabled)
504
+ - 🥚 Queen/Prime
505
+
506
+ **Every spawn must show its caste emoji.**
507
+
508
+ ### Step 5.0.5: Select and Announce Workflow Pattern
509
+
510
+ Examine the phase name and task descriptions. Select the first matching pattern:
511
+
512
+ | Phase contains | Pattern |
513
+ |----------------|---------|
514
+ | "bug", "fix", "error", "broken", "failing" | Investigate-Fix |
515
+ | "research", "oracle", "explore", "investigate" | Deep Research |
516
+ | "refactor", "restructure", "clean", "reorganize" | Refactor |
517
+ | "security", "audit", "compliance", "accessibility", "license" | Compliance |
518
+ | "docs", "documentation", "readme", "guide" | Documentation Sprint |
519
+ | (default) | SPBV |
520
+
521
+ Display the selected pattern:
522
+ ```
523
+ ━━ Pattern: {pattern_name} ━━
524
+ {announce_line from Queen's Workflow Patterns definition}
525
+ ```
526
+
527
+ Store `selected_pattern` for inclusion in the BUILD SUMMARY (Step 7).
528
+
529
+ ### Step 5.1: Spawn Wave 1 Workers (Parallel)
530
+
531
+ **CRITICAL: Spawn ALL Wave 1 workers in a SINGLE message using multiple Task tool calls.**
532
+
533
+ **CRITICAL: Spawn ALL Wave 1 workers in a SINGLE message using multiple Task tool calls.**
534
+
535
+ **Announce the wave before spawning:**
536
+
537
+ Display the spawn announcement immediately before firing Task calls:
538
+
539
+ For single-caste waves (typical — all builders):
540
+ ```
541
+ ──── 🔨🐜 Spawning {N} Builders in parallel ────
542
+ ```
543
+
544
+ For mixed-caste waves (uncommon):
545
+ ```
546
+ ──── 🐜 Spawning {N} workers ({X} 🔨 Builder, {Y} 🔍 Scout) ────
547
+ ```
548
+
549
+ For a single worker:
550
+ ```
551
+ ──── 🔨🐜 Spawning {ant_name} — {task_summary} ────
552
+ ```
553
+
554
+ **First, mark build start in context:**
555
+ ```bash
556
+ bash .aether/aether-utils.sh context-update build-start {phase_id} {wave_1_worker_count} {wave_1_task_count}
557
+ ```
558
+
559
+ Before dispatching each worker, refresh colony context so new pheromones/memory are visible:
560
+ ```bash
561
+ prime_result=$(bash .aether/aether-utils.sh colony-prime --compact 2>/dev/null)
562
+ ```
563
+ Update `prompt_section` from `prime_result.result.prompt_section`.
564
+
565
+ For each Wave 1 task, use Task tool with `subagent_type="aether-builder"`, include `description: "🔨 Builder {Ant-Name}: {task_description}"` (DO NOT use run_in_background - multiple Task calls in a single message run in parallel and block until complete):
566
+
567
+ Log each spawn and update swarm display:
568
+ ```bash
569
+ bash .aether/aether-utils.sh spawn-log "Queen" "builder" "{ant_name}" "{task_description}"
570
+ bash .aether/aether-utils.sh context-update worker-spawn "{ant_name}" "builder" "{task_description}"
571
+ ```
572
+
573
+ **Builder Worker Prompt (CLEAN OUTPUT):**
574
+ ```
575
+ You are {Ant-Name}, a 🔨🐜 Builder Ant.
576
+
577
+ Task {id}: {description}
578
+
579
+ Goal: "{colony_goal}"
580
+
581
+ { archaeology_context if exists }
582
+
583
+ { queen_wisdom_section if any wisdom exists }
584
+
585
+ { pheromone_section if pheromone_section exists }
586
+
587
+ Work:
588
+ 1. Read .aether/workers.md for Builder discipline
589
+ 2. Implement task, write tests
590
+ 3. Log activity: bash .aether/aether-utils.sh activity-log "ACTION" "{Ant-Name}" "description"
591
+
592
+ Spawn sub-workers ONLY if 3x complexity:
593
+ - Check: bash .aether/aether-utils.sh spawn-can-spawn {depth} --enforce
594
+ - Generate name: bash .aether/aether-utils.sh generate-ant-name "builder"
595
+ - Announce: "🐜 Spawning {child_name} for {reason}"
596
+ - Log: bash .aether/aether-utils.sh spawn-log "{Ant-Name}" "builder" "{child_name}" "{task}"
597
+
598
+ Count your total tool calls (Read + Grep + Edit + Bash + Write) and report as tool_count.
599
+
600
+ Return ONLY this JSON (no other text):
601
+ {"ant_name": "{Ant-Name}", "task_id": "{id}", "status": "completed|failed|blocked", "summary": "What you did", "tool_count": 0, "files_created": [], "files_modified": [], "tests_written": [], "blockers": []}
602
+ ```
603
+
604
+ **Queen Wisdom Section Template (injected only if wisdom exists):**
605
+ ```
606
+ --- QUEEN WISDOM (Eternal Guidance) ---
607
+ { if queen_philosophies: }
608
+ 📜 Philosophies:
609
+ {queen_philosophies}
610
+ { endif }
611
+ { if queen_patterns: }
612
+ 🧭 Patterns:
613
+ {queen_patterns}
614
+ { endif }
615
+ { if queen_redirects: }
616
+ ⚠️ Redirects (AVOID these):
617
+ {queen_redirects}
618
+ { endif }
619
+ { if queen_stack_wisdom: }
620
+ 🔧 Stack Wisdom:
621
+ {queen_stack_wisdom}
622
+ { endif }
623
+ { if queen_decrees: }
624
+ 🏛️ Decrees:
625
+ {queen_decrees}
626
+ { endif }
627
+ --- END QUEEN WISDOM ---
628
+ ```
629
+
630
+ **Queen Wisdom Section Template (injected only if wisdom exists):**
631
+ ```
632
+ --- QUEEN WISDOM (Eternal Guidance) ---
633
+ { if queen_philosophies: }
634
+ 📜 Philosophies:
635
+ {queen_philosophies}
636
+ { endif }
637
+ { if queen_patterns: }
638
+ 🧭 Patterns:
639
+ {queen_patterns}
640
+ { endif }
641
+ { if queen_redirects: }
642
+ ⚠️ Redirects (AVOID these):
643
+ {queen_redirects}
644
+ { endif }
645
+ { if queen_stack_wisdom: }
646
+ 🔧 Stack Wisdom:
647
+ {queen_stack_wisdom}
648
+ { endif }
649
+ { if queen_decrees: }
650
+ 🏛️ Decrees:
651
+ {queen_decrees}
652
+ { endif }
653
+ --- END QUEEN WISDOM ---
654
+ ```
655
+
656
+ **Active Signals Section (injected if pheromones exist):**
657
+ ```
658
+ --- ACTIVE SIGNALS (From User) ---
659
+
660
+ 🎯 PRIORITIES (FOCUS):
661
+ {for each priority}
662
+ - {priority}
663
+ {endfor}
664
+
665
+ ⚠️ CONSTRAINTS (REDIRECT - AVOID):
666
+ {for each constraint}
667
+ - {constraint.content}
668
+ {endfor}
669
+
670
+ --- END ACTIVE SIGNALS ---
671
+ ```
672
+
673
+ ### Step 5.2: Process Wave 1 Results
674
+
675
+ **Task calls return results directly (no TaskOutput needed).**
676
+
677
+ Before using any worker payload, validate schema:
678
+ ```bash
679
+ bash .aether/aether-utils.sh validate-worker-response builder '{worker_json}'
680
+ ```
681
+ If validation fails, treat the worker as failed with blocker `invalid_worker_response`.
682
+
683
+ **As each worker result arrives, IMMEDIATELY display a single completion line — do not wait for other workers:**
684
+
685
+ For successful workers:
686
+ ```
687
+ 🔨 {Ant-Name}: {task_description} ({tool_count} tools) ✓
688
+ ```
689
+
690
+ For failed workers:
691
+ ```
692
+ 🔨 {Ant-Name}: {task_description} ✗ ({failure_reason} after {tool_count} tools)
693
+ ```
694
+
695
+ Where `tool_count` comes from the worker's returned JSON `tool_count` field, and `failure_reason` is extracted from the first item in the worker's `blockers` array or "unknown error" if empty.
696
+
697
+ Log and update swarm display:
698
+ ```bash
699
+ bash .aether/aether-utils.sh spawn-complete "{ant_name}" "completed" "{summary}"
700
+ bash .aether/aether-utils.sh context-update worker-complete "{ant_name}" "completed"
701
+ ```
702
+
703
+ **Check for total wave failure:**
704
+
705
+ After processing all worker results in this wave, check if EVERY worker returned `status: "failed"`. If ALL workers in the wave failed:
706
+
707
+ Display a prominent halt alert:
708
+ ```
709
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
710
+ ⚠ WAVE FAILURE — BUILD HALTED
711
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
712
+
713
+ All {N} workers in Wave {X} failed. Something is fundamentally wrong.
714
+
715
+ Failed workers:
716
+ {for each failed worker in this wave:}
717
+ {caste_emoji} {Ant-Name}: {task_description} ✗ ({failure_reason} after {tool_count} tools)
718
+ {end for}
719
+
720
+ Next steps:
721
+ /ant:flags Review blockers
722
+ /ant:swarm Auto-repair mode
723
+ ```
724
+
725
+ Then STOP — do not proceed to subsequent waves, Watcher, or Chaos. Skip directly to Step 5.9 synthesis with `status: "failed"`.
726
+
727
+ **Partial wave failure — escalation path:**
728
+
729
+ If SOME (but not all) workers in the wave failed:
730
+ 1. For each failed worker, attempt Tier 3 escalation: Queen spawns a different caste for the same task
731
+ 2. If Tier 3 succeeds: continue to next wave
732
+ 3. If Tier 3 fails: display the Tier 4 ESCALATION banner (from Queen agent definition):
733
+
734
+ ```
735
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
736
+ ⚠ ESCALATION — QUEEN NEEDS YOU
737
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
738
+
739
+ Task: {failed task description}
740
+ Phase: {phase number} — {phase name}
741
+
742
+ Tried:
743
+ • Worker retry (2 attempts) — {what failed}
744
+ • Parent tried alternate approach — {what failed}
745
+ • Queen reassigned to {other caste} — {what failed}
746
+
747
+ Options:
748
+ A) {recommended option} — RECOMMENDED
749
+ B) {alternate option}
750
+ C) Skip and continue — this task will be marked blocked
751
+
752
+ Awaiting your choice.
753
+ ```
754
+
755
+ Log escalation as flag:
756
+ ```bash
757
+ bash .aether/aether-utils.sh flag-add "blocker" "{task title}" "{failure summary}" "escalation" {phase_number}
758
+ ```
759
+
760
+ If at least one worker succeeded, continue normally to the next wave.
761
+
762
+ **Parse each worker's validated JSON output to collect:** status, files_created, files_modified, blockers
763
+
764
+ ### Step 5.3: Spawn Wave 2+ Workers (Sequential Waves)
765
+
766
+ **Before each subsequent wave, display a wave separator:**
767
+ ```
768
+ ━━━ 🐜 Wave {X} of {N} ━━━
769
+ ```
770
+ Then display the spawn announcement (same format as Step 5.1).
771
+
772
+ Repeat Step 5.1-5.2 for each subsequent wave, waiting for previous wave to complete.
773
+
774
+ ### Step 5.4: Spawn Watcher for Verification
775
+
776
+ **MANDATORY: Always spawn a Watcher — testing must be independent.**
777
+
778
+ **Announce the verification wave:**
779
+ ```
780
+ ━━━ 👁️🐜 V E R I F I C A T I O N ━━━
781
+ ──── 👁️🐜 Spawning {watcher_name} — Independent verification ────
782
+ ```
783
+
784
+ Spawn the Watcher using Task tool with `subagent_type="aether-watcher"`, include `description: "👁️ Watcher {Watcher-Name}: Independent verification"` (DO NOT use run_in_background - task blocks until complete):
785
+
786
+ ```bash
787
+ bash .aether/aether-utils.sh spawn-log "Queen" "watcher" "{watcher_name}" "Independent verification"
788
+ ```
789
+
790
+ **Watcher Worker Prompt (CLEAN OUTPUT):**
791
+ ```
792
+ You are {Watcher-Name}, a 👁️🐜 Watcher Ant.
793
+
794
+ Verify all work done by Builders in Phase {id}.
795
+
796
+ Files to verify:
797
+ - Created: {list from builder results}
798
+ - Modified: {list from builder results}
799
+
800
+ Verification:
801
+ 1. Check files exist (Read each)
802
+ 2. Run build/type-check
803
+ 3. Run tests if they exist
804
+ 4. Check success criteria: {list}
805
+
806
+ Spawn sub-workers if needed:
807
+ - Log: bash .aether/aether-utils.sh spawn-log "{Watcher-Name}" "watcher" "{child}" "{task}"
808
+ - Announce: "🐜 Spawning {child} to investigate {issue}"
809
+
810
+ Count your total tool calls (Read + Grep + Edit + Bash + Write) and report as tool_count.
811
+
812
+ Return ONLY this JSON:
813
+ {"ant_name": "{Watcher-Name}", "verification_passed": true|false, "files_verified": [], "issues_found": [], "quality_score": N, "tool_count": 0, "recommendation": "proceed|fix_required"}
814
+ ```
815
+
816
+ ### Step 5.5: Process Watcher Results
817
+
818
+ **Task call returns results directly (no TaskOutput needed).**
819
+
820
+ Validate watcher payload first:
821
+ ```bash
822
+ bash .aether/aether-utils.sh validate-worker-response watcher '{watcher_json}'
823
+ ```
824
+
825
+ **Parse the Watcher's validated JSON response:** verification_passed, issues_found, quality_score, recommendation
826
+
827
+ **Display Watcher completion line:**
828
+
829
+ For successful verification:
830
+ ```
831
+ 👁️ {Watcher-Name}: Independent verification ({tool_count} tools) ✓
832
+ ```
833
+
834
+ For failed verification:
835
+ ```
836
+ 👁️ {Watcher-Name}: Independent verification ✗ ({issues_found count} issues after {tool_count} tools)
837
+ ```
838
+
839
+ **Store results for synthesis in Step 5.7**
840
+
841
+ ### Step 5.6: Spawn Chaos Ant for Resilience Testing
842
+
843
+ **After the Watcher completes, spawn a Chaos Ant to probe the phase work for edge cases and boundary conditions.**
844
+
845
+ Generate a chaos ant name and log the spawn:
846
+ ```bash
847
+ bash .aether/aether-utils.sh generate-ant-name "chaos"
848
+ bash .aether/aether-utils.sh spawn-log "Queen" "chaos" "{chaos_name}" "Resilience testing of Phase {id} work"
849
+ ```
850
+
851
+ **Retrieve existing flags for this phase** (to avoid duplicate findings):
852
+ ```bash
853
+ bash .aether/aether-utils.sh flag-list --phase {phase_number}
854
+ ```
855
+ Parse the result and extract unresolved flag titles into a list: `{existing_flag_titles}` (comma-separated titles from `.result.flags[].title`). If no flags exist, set `{existing_flag_titles}` to "None".
856
+
857
+ **Announce the resilience testing wave:**
858
+ ```
859
+ ──── 🎲🐜 Spawning {chaos_name} — resilience testing ────
860
+ ```
861
+
862
+ Spawn the Chaos Ant using Task tool with `subagent_type="aether-chaos"`, include `description: "🎲 Chaos {Chaos-Name}: Resilience testing"` (DO NOT use run_in_background - task blocks until complete):
863
+
864
+ **Chaos Ant Prompt (CLEAN OUTPUT):**
865
+ ```
866
+ You are {Chaos-Name}, a 🎲🐜 Chaos Ant.
867
+
868
+ Test Phase {id} work for edge cases and boundary conditions.
869
+
870
+ Files to test:
871
+ - {list from builder results}
872
+
873
+ Skip these known issues: {existing_flag_titles}
874
+
875
+ Rules:
876
+ - Max 5 scenarios
877
+ - Read-only (don't modify code)
878
+ - Focus: edge cases, boundaries, error handling
879
+
880
+ Count your total tool calls (Read + Grep + Edit + Bash + Write) and report as tool_count.
881
+
882
+ Return ONLY this JSON:
883
+ {"ant_name": "{Chaos-Name}", "scenarios_tested": 5, "findings": [{"id": 1, "category": "edge_case|boundary|error_handling", "severity": "critical|high|medium|low", "title": "...", "description": "..."}], "overall_resilience": "strong|moderate|weak", "tool_count": 0, "summary": "..."}
884
+ ```
885
+
886
+ ### Step 5.7: Process Chaos Ant Results
887
+
888
+ **Task call returns results directly (no TaskOutput needed).**
889
+
890
+ **Parse the Chaos Ant's JSON response:** findings, overall_resilience, summary
891
+
892
+ **Display Chaos completion line:**
893
+ ```
894
+ 🎲 {Chaos-Name}: Resilience testing ({tool_count} tools) ✓
895
+ ```
896
+
897
+ **Store results for synthesis in Step 5.9**
898
+
899
+ **Flag critical/high findings:**
900
+
901
+ If any findings have severity `"critical"` or `"high"`:
902
+ ```bash
903
+ # Create a blocker flag for each critical/high chaos finding
904
+ bash .aether/aether-utils.sh flag-add "blocker" "{finding.title}" "{finding.description}" "chaos-testing" {phase_number}
905
+ ```
906
+
907
+ Log the flag:
908
+ ```bash
909
+ bash .aether/aether-utils.sh activity-log "FLAG" "Chaos" "Created blocker: {finding.title}"
910
+ ```
911
+
912
+ Log chaos ant completion and update swarm display:
913
+ ```bash
914
+ bash .aether/aether-utils.sh spawn-complete "{chaos_name}" "completed" "{summary}"
915
+ ```
916
+
917
+ ### Step 5.8: Create Flags for Verification Failures
918
+
919
+ If the Watcher reported `verification_passed: false` or `recommendation: "fix_required"`:
920
+
921
+ For each issue in `issues_found`:
922
+ ```bash
923
+ # Create a blocker flag for each verification failure
924
+ bash .aether/aether-utils.sh flag-add "blocker" "{issue_title}" "{issue_description}" "verification" {phase_number}
925
+ ```
926
+
927
+ Log the flag creation:
928
+ ```bash
929
+ bash .aether/aether-utils.sh activity-log "FLAG" "Watcher" "Created blocker: {issue_title}"
930
+ ```
931
+
932
+ This ensures verification failures are persisted as blockers that survive context resets. Chaos Ant findings are flagged in Step 5.7.
933
+
934
+ ### Step 5.9: Synthesize Results
935
+
936
+ **This step runs after all worker tasks have completed (Builders, Watcher, Chaos).**
937
+
938
+ Collect all worker outputs and create phase summary:
939
+
940
+ ```json
941
+ {
942
+ "status": "completed" | "failed" | "blocked",
943
+ "summary": "...",
944
+ "tasks_completed": [...],
945
+ "tasks_failed": [...],
946
+ "files_created": [...],
947
+ "files_modified": [...],
948
+ "spawn_metrics": {
949
+ "spawn_count": {total workers spawned, including archaeologist if Step 4.5 fired},
950
+ "builder_count": {N},
951
+ "watcher_count": 1,
952
+ "chaos_count": 1,
953
+ "archaeologist_count": {0 or 1, conditional on Step 4.5},
954
+ "parallel_batches": {number of waves}
955
+ },
956
+ "spawn_tree": {
957
+ "{Archaeologist-Name}": {"caste": "archaeologist", "task": "pre-build history scan", "status": "completed"},
958
+ "{Builder-Name}": {"caste": "builder", "task": "...", "status": "completed"},
959
+ "{Watcher-Name}": {"caste": "watcher", "task": "verify", "status": "completed"},
960
+ "{Chaos-Name}": {"caste": "chaos", "task": "resilience testing", "status": "completed"}
961
+ },
962
+ "verification": {from Watcher output},
963
+ "resilience": {from Chaos Ant output},
964
+ "archaeology": {from Archaeologist output, or null if Step 4.5 was skipped},
965
+ "quality_notes": "..."
966
+ }
967
+ ```
968
+
969
+ **Graveyard Recording:**
970
+ For each worker that returned `status: "failed"`:
971
+ For each file in that worker's `files_modified` or `files_created`:
972
+ ```bash
973
+ bash .aether/aether-utils.sh grave-add "{file}" "{ant_name}" "{task_id}" {phase} "{first blocker or summary}"
974
+ ```
975
+ Log the grave marker:
976
+ ```bash
977
+ bash .aether/aether-utils.sh activity-log "GRAVE" "Queen" "Grave marker placed at {file} — {ant_name} failed: {summary}"
978
+ ```
979
+
980
+ **Error Handoff Update:**
981
+ If workers failed, update handoff with error context for recovery:
982
+
983
+ Resolve the build error handoff template path:
984
+ Check ~/.aether/system/templates/handoff-build-error.template.md first,
985
+ then .aether/templates/handoff-build-error.template.md.
986
+
987
+ If no template found: output "Template missing: handoff-build-error.template.md. Run aether update to fix." and stop.
988
+
989
+ Read the template file. Fill all {{PLACEHOLDER}} values:
990
+ - {{PHASE_NUMBER}} → current phase number
991
+ - {{PHASE_NAME}} → current phase name
992
+ - {{BUILD_TIMESTAMP}} → current ISO-8601 UTC timestamp
993
+ - {{FAILED_WORKERS}} → formatted list of failed workers (one "- {ant_name}: {failure_summary}" per line)
994
+ - {{GRAVE_MARKERS}} → formatted list of grave markers (one "- {file}: {caution_level} caution" per line)
995
+
996
+ Remove the HTML comment lines at the top of the template.
997
+ Write the result to .aether/HANDOFF.md using the Write tool.
998
+
999
+ Only fires when workers fail. Zero impact on successful builds.
1000
+
1001
+ --- SPAWN TRACKING ---
1002
+
1003
+ The spawn tree will be visible in `/ant:watch` because each spawn is logged.
1004
+
1005
+ --- OUTPUT FORMAT ---
1006
+
1007
+ Return JSON:
1008
+ {
1009
+ "status": "completed" | "failed" | "blocked",
1010
+ "summary": "What the phase accomplished",
1011
+ "tasks_completed": ["1.1", "1.2"],
1012
+ "tasks_failed": [],
1013
+ "files_created": ["path1", "path2"],
1014
+ "files_modified": ["path3"],
1015
+ "spawn_metrics": {
1016
+ "spawn_count": 6,
1017
+ "watcher_count": 1,
1018
+ "chaos_count": 1,
1019
+ "archaeologist_count": 1,
1020
+ "builder_count": 3,
1021
+ "parallel_batches": 2,
1022
+ "sequential_tasks": 1
1023
+ },
1024
+ "spawn_tree": {
1025
+ "Relic-8": {"caste": "archaeologist", "task": "pre-build history scan", "status": "completed", "children": {}},
1026
+ "Hammer-42": {"caste": "builder", "task": "...", "status": "completed", "children": {}},
1027
+ "Vigil-17": {"caste": "watcher", "task": "...", "status": "completed", "children": {}},
1028
+ "Entropy-9": {"caste": "chaos", "task": "resilience testing", "status": "completed", "children": {}}
1029
+ },
1030
+ "verification": {
1031
+ "build": {"command": "npm run build", "exit_code": 0, "passed": true},
1032
+ "tests": {"command": "npm test", "passed": 24, "failed": 0, "total": 24},
1033
+ "success_criteria": [
1034
+ {"criterion": "API endpoint exists", "evidence": "GET /api/users returns 200", "passed": true},
1035
+ {"criterion": "Tests cover happy path", "evidence": "3 tests in users.test.ts", "passed": true}
1036
+ ]
1037
+ },
1038
+ "debugging": {
1039
+ "issues_encountered": 0,
1040
+ "issues_resolved": 0,
1041
+ "fix_attempts": 0,
1042
+ "architectural_concerns": []
1043
+ },
1044
+ "tdd": {
1045
+ "cycles_completed": 5,
1046
+ "tests_added": 5,
1047
+ "tests_total": 47,
1048
+ "coverage_percent": 85,
1049
+ "all_passing": true
1050
+ },
1051
+ "learning": {
1052
+ "patterns_observed": [
1053
+ {
1054
+ "type": "success",
1055
+ "trigger": "when implementing API endpoints",
1056
+ "action": "use repository pattern with DI",
1057
+ "evidence": "All tests passed first try"
1058
+ }
1059
+ ],
1060
+ "instincts_applied": ["instinct_123"],
1061
+ "instinct_outcomes": [
1062
+ {"id": "instinct_123", "success": true}
1063
+ ]
1064
+ },
1065
+ "quality_notes": "Any concerns or recommendations",
1066
+ "ui_touched": true | false
1067
+ }
1068
+ ```
1069
+
1070
+ ### Step 6: Visual Checkpoint (if UI touched)
1071
+
1072
+ Parse synthesis result. If `ui_touched` is true:
1073
+
1074
+ ```
1075
+ ━━━ 🖼️🐜 V I S U A L C H E C K P O I N T ━━━
1076
+
1077
+ UI changes detected. Verify appearance before continuing.
1078
+
1079
+ Files touched:
1080
+ {list files from files_created + files_modified that match UI patterns}
1081
+
1082
+ Options:
1083
+ 1. Approve - UI looks correct
1084
+ 2. Reject - needs changes (describe issues)
1085
+ 3. Skip - defer visual review
1086
+ ```
1087
+
1088
+ Use AskUserQuestion to get approval. Record in events:
1089
+ - If approved: `"<timestamp>|visual_approved|build|Phase {id} UI approved"`
1090
+ - If rejected: `"<timestamp>|visual_rejected|build|Phase {id} UI rejected: {reason}"`
1091
+
1092
+ ### Step 6.5: Update Handoff Document
1093
+
1094
+ After synthesis is complete, update the handoff document with current state for session recovery:
1095
+
1096
+ ```bash
1097
+ # Update handoff with build results
1098
+ jq -n \
1099
+ --arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
1100
+ --arg goal "$(jq -r '.goal' .aether/data/COLONY_STATE.json)" \
1101
+ --arg phase "$(jq -r '.current_phase' .aether/data/COLONY_STATE.json)" \
1102
+ --arg phase_name "{phase_name}" \
1103
+ --arg status "{synthesis.status}" \
1104
+ --arg summary "{synthesis.summary}" \
1105
+ --argjson tasks_completed '{synthesis.tasks_completed | length}' \
1106
+ --argjson tasks_failed '{synthesis.tasks_failed | length}' \
1107
+ --arg next_action "{if synthesis.status == "completed" then "/ant:continue" else "/ant:flags" end}" \
1108
+ '{
1109
+ "last_updated": $timestamp,
1110
+ "goal": $goal,
1111
+ "current_phase": $phase,
1112
+ "phase_name": $phase_name,
1113
+ "build_status": $status,
1114
+ "summary": $summary,
1115
+ "tasks_completed": $tasks_completed,
1116
+ "tasks_failed": $tasks_failed,
1117
+ "next_recommended_action": $next_action,
1118
+ "can_resume": true,
1119
+ "note": "Phase build completed. Run /ant:continue to advance if verification passed."
1120
+ }' > .aether/data/last-build-result.json
1121
+ ```
1122
+
1123
+ Resolve the build success handoff template path:
1124
+ Check ~/.aether/system/templates/handoff-build-success.template.md first,
1125
+ then .aether/templates/handoff-build-success.template.md.
1126
+
1127
+ If no template found: output "Template missing: handoff-build-success.template.md. Run aether update to fix." and stop.
1128
+
1129
+ Read the template file. Fill all {{PLACEHOLDER}} values:
1130
+ - {{GOAL}} → colony goal (from COLONY_STATE.json)
1131
+ - {{PHASE_NUMBER}} → current phase number
1132
+ - {{PHASE_NAME}} → current phase name
1133
+ - {{BUILD_STATUS}} → synthesis.status
1134
+ - {{BUILD_TIMESTAMP}} → current ISO-8601 UTC timestamp
1135
+ - {{BUILD_SUMMARY}} → synthesis summary
1136
+ - {{TASKS_COMPLETED}} → count of completed tasks
1137
+ - {{TASKS_FAILED}} → count of failed tasks
1138
+ - {{FILES_CREATED}} → count of created files
1139
+ - {{FILES_MODIFIED}} → count of modified files
1140
+ - {{SESSION_NOTE}} → "Build succeeded — ready to advance." if status is completed, else "Build completed with issues — review before continuing."
1141
+
1142
+ Remove the HTML comment lines at the top of the template.
1143
+ Write the result to .aether/HANDOFF.md using the Write tool.
1144
+
1145
+ This ensures the handoff always reflects the latest build state, even if the session crashes before explicit pause.
1146
+
1147
+ ### Step 6.6: Update Context Document
1148
+
1149
+ Log this build activity to `.aether/CONTEXT.md`:
1150
+
1151
+ ```bash
1152
+ bash .aether/aether-utils.sh context-update activity "build {phase_id}" "{synthesis.status}" "{files_created_count + files_modified_count}"
1153
+ ```
1154
+
1155
+ Mark build as complete in context:
1156
+ ```bash
1157
+ bash .aether/aether-utils.sh context-update build-complete "{synthesis.status}" "{synthesis.status == 'completed' ? 'success' : 'failed'}"
1158
+ ```
1159
+
1160
+ Also update safe-to-clear status:
1161
+ - If build completed successfully: `context-update safe-to-clear "YES" "Build complete, ready to continue"`
1162
+ - If build failed: `context-update safe-to-clear "NO" "Build failed — run /ant:swarm or /ant:flags"`
1163
+
1164
+ ### Step 7: Display Results
1165
+
1166
+ **This step runs ONLY after synthesis is complete. All values come from actual worker results.**
1167
+
1168
+ **Display BUILD SUMMARY (always shown, replaces compact/verbose split):**
1169
+
1170
+ Calculate `total_tools` by summing `tool_count` from all worker return JSONs (builders + watcher + chaos).
1171
+ Calculate `elapsed` using `build_started_at_epoch` (epoch integer captured at Step 5 start): `$(( $(date +%s) - build_started_at_epoch ))` formatted as Xm Ys.
1172
+
1173
+ ```
1174
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1175
+ B U I L D S U M M A R Y
1176
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1177
+ Phase {id}: {name}
1178
+ Pattern: {selected_pattern}
1179
+
1180
+ Workers: {pass_count} passed {fail_count} failed ({total} total)
1181
+ Tools: {total_tools} calls across all workers
1182
+ Duration: {elapsed}
1183
+
1184
+ {if fail_count > 0:}
1185
+ Failed:
1186
+ {for each failed worker:}
1187
+ {caste_emoji} {Ant-Name}: {task_description} ✗ ({failure_reason} after {tool_count} tools)
1188
+ {end for}
1189
+
1190
+ Retry: /ant:swarm to auto-repair failed tasks, or /ant:flags to review blockers
1191
+ {end if}
1192
+ ```
1193
+
1194
+ **If verbose_mode is true**, additionally show the spawn tree and TDD details after the BUILD SUMMARY block (keep the existing verbose-only sections: Colony Work Tree, Tasks Completed, TDD, Patterns Learned, Debugging, Model Routing). Prepend with:
1195
+ ```
1196
+ ━━ Details (--verbose) ━━
1197
+ ```
1198
+
1199
+ After displaying the BUILD SUMMARY (and optional verbose details), display Next Steps based on synthesis results:
1200
+ ```bash
1201
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json 2>/dev/null || echo "IDLE")
1202
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json 2>/dev/null || echo "0")
1203
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json 2>/dev/null || echo "0")
1204
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
1205
+ ```
1206
+
1207
+ **Routing Note:** The state-based Next Up block above routes based on colony state. If verification failed or blockers exist, review `/ant:flags` before continuing.
1208
+
1209
+ **IMPORTANT:** Build does NOT update task statuses or advance state. Run `/ant:continue` to:
1210
+ - Mark tasks as completed
1211
+ - Extract learnings
1212
+ - Advance to next phase
1213
+
1214
+ ### Step 8: Update Session
1215
+
1216
+ Update the session tracking file to enable `/ant:resume` after context clear:
1217
+
1218
+ ```bash
1219
+ bash .aether/aether-utils.sh session-update "/ant:build {phase_id}" "/ant:continue" "Phase {phase_id} build completed: {synthesis.status}"
1220
+ ```
1221
+