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