aether-colony 5.3.2 → 5.4.0

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