aether-colony 5.0.0 → 5.1.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 (312) hide show
  1. package/.aether/aether-utils.sh +3150 -3349
  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 +438 -0
  30. package/.aether/commands/continue.yaml +1484 -0
  31. package/.aether/commands/council.yaml +304 -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 +469 -0
  44. package/.aether/commands/insert-phase.yaml +98 -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 +1313 -0
  57. package/.aether/commands/preferences.yaml +63 -0
  58. package/.aether/commands/redirect.yaml +123 -0
  59. package/.aether/commands/resume-colony.yaml +373 -0
  60. package/.aether/commands/resume.yaml +398 -0
  61. package/.aether/commands/run.yaml +193 -0
  62. package/.aether/commands/seal.yaml +1205 -0
  63. package/.aether/commands/skill-create.yaml +337 -0
  64. package/.aether/commands/status.yaml +364 -0
  65. package/.aether/commands/swarm.yaml +352 -0
  66. package/.aether/commands/tunnels.yaml +814 -0
  67. package/.aether/commands/update.yaml +131 -0
  68. package/.aether/commands/verify-castes.yaml +159 -0
  69. package/.aether/commands/watch.yaml +454 -0
  70. package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
  71. package/.aether/docs/QUEEN-SYSTEM.md +11 -11
  72. package/.aether/docs/README.md +32 -2
  73. package/.aether/docs/command-playbooks/README.md +23 -0
  74. package/.aether/docs/command-playbooks/build-complete.md +349 -0
  75. package/.aether/docs/command-playbooks/build-context.md +282 -0
  76. package/.aether/docs/command-playbooks/build-full.md +1682 -0
  77. package/.aether/docs/command-playbooks/build-prep.md +283 -0
  78. package/.aether/docs/command-playbooks/build-verify.md +405 -0
  79. package/.aether/docs/command-playbooks/build-wave.md +749 -0
  80. package/.aether/docs/command-playbooks/continue-advance.md +524 -0
  81. package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
  82. package/.aether/docs/command-playbooks/continue-full.md +1724 -0
  83. package/.aether/docs/command-playbooks/continue-gates.md +686 -0
  84. package/.aether/docs/command-playbooks/continue-verify.md +406 -0
  85. package/.aether/docs/context-continuity.md +84 -0
  86. package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
  87. package/.aether/docs/error-codes.md +1 -1
  88. package/.aether/docs/known-issues.md +34 -173
  89. package/.aether/docs/pheromones.md +86 -6
  90. package/.aether/docs/plans/pheromone-display-plan.md +257 -0
  91. package/.aether/docs/queen-commands.md +10 -9
  92. package/.aether/docs/source-of-truth-map.md +132 -0
  93. package/.aether/docs/xml-utilities.md +47 -0
  94. package/.aether/rules/aether-colony.md +23 -13
  95. package/.aether/scripts/incident-test-add.sh +47 -0
  96. package/.aether/scripts/weekly-audit.sh +79 -0
  97. package/.aether/skills/.index.json +649 -0
  98. package/.aether/skills/colony/.manifest.json +16 -0
  99. package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
  100. package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
  101. package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
  102. package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
  103. package/.aether/skills/colony/context-management/SKILL.md +80 -0
  104. package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
  105. package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
  106. package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
  107. package/.aether/skills/colony/state-safety/SKILL.md +84 -0
  108. package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
  109. package/.aether/skills/domain/.manifest.json +24 -0
  110. package/.aether/skills/domain/README.md +33 -0
  111. package/.aether/skills/domain/django/SKILL.md +49 -0
  112. package/.aether/skills/domain/docker/SKILL.md +52 -0
  113. package/.aether/skills/domain/golang/SKILL.md +52 -0
  114. package/.aether/skills/domain/graphql/SKILL.md +51 -0
  115. package/.aether/skills/domain/html-css/SKILL.md +48 -0
  116. package/.aether/skills/domain/nextjs/SKILL.md +45 -0
  117. package/.aether/skills/domain/nodejs/SKILL.md +53 -0
  118. package/.aether/skills/domain/postgresql/SKILL.md +53 -0
  119. package/.aether/skills/domain/prisma/SKILL.md +59 -0
  120. package/.aether/skills/domain/python/SKILL.md +50 -0
  121. package/.aether/skills/domain/rails/SKILL.md +52 -0
  122. package/.aether/skills/domain/react/SKILL.md +45 -0
  123. package/.aether/skills/domain/rest-api/SKILL.md +58 -0
  124. package/.aether/skills/domain/svelte/SKILL.md +47 -0
  125. package/.aether/skills/domain/tailwind/SKILL.md +45 -0
  126. package/.aether/skills/domain/testing/SKILL.md +53 -0
  127. package/.aether/skills/domain/typescript/SKILL.md +58 -0
  128. package/.aether/skills/domain/vue/SKILL.md +49 -0
  129. package/.aether/templates/QUEEN.md.template +23 -41
  130. package/.aether/templates/colony-state-reset.jq.template +1 -0
  131. package/.aether/templates/colony-state.template.json +4 -0
  132. package/.aether/templates/learning-observations.template.json +6 -0
  133. package/.aether/templates/midden.template.json +13 -0
  134. package/.aether/templates/pheromones.template.json +6 -0
  135. package/.aether/templates/session.template.json +9 -0
  136. package/.aether/utils/atomic-write.sh +63 -17
  137. package/.aether/utils/chamber-utils.sh +145 -2
  138. package/.aether/utils/emoji-audit.sh +166 -0
  139. package/.aether/utils/error-handler.sh +21 -7
  140. package/.aether/utils/file-lock.sh +182 -27
  141. package/.aether/utils/flag.sh +267 -0
  142. package/.aether/utils/hive.sh +572 -0
  143. package/.aether/utils/learning.sh +1928 -0
  144. package/.aether/utils/midden.sh +342 -0
  145. package/.aether/utils/oracle/oracle.md +168 -0
  146. package/.aether/utils/oracle/oracle.sh +1023 -0
  147. package/.aether/utils/pheromone.sh +2029 -0
  148. package/.aether/utils/queen.sh +1698 -0
  149. package/.aether/utils/scan.sh +860 -0
  150. package/.aether/utils/semantic-cli.sh +10 -8
  151. package/.aether/utils/session.sh +552 -0
  152. package/.aether/utils/skills.sh +509 -0
  153. package/.aether/utils/spawn-tree.sh +103 -271
  154. package/.aether/utils/spawn.sh +260 -0
  155. package/.aether/utils/state-api.sh +199 -0
  156. package/.aether/utils/state-loader.sh +8 -6
  157. package/.aether/utils/suggest.sh +611 -0
  158. package/.aether/utils/swarm-display.sh +10 -1
  159. package/.aether/utils/swarm.sh +1004 -0
  160. package/.aether/utils/watch-spawn-tree.sh +11 -2
  161. package/.aether/utils/xml-compose.sh +2 -2
  162. package/.aether/utils/xml-convert.sh +9 -5
  163. package/.aether/utils/xml-core.sh +5 -9
  164. package/.aether/utils/xml-query.sh +4 -4
  165. package/.aether/workers.md +86 -67
  166. package/.claude/agents/ant/aether-ambassador.md +2 -1
  167. package/.claude/agents/ant/aether-archaeologist.md +6 -1
  168. package/.claude/agents/ant/aether-architect.md +236 -0
  169. package/.claude/agents/ant/aether-auditor.md +6 -1
  170. package/.claude/agents/ant/aether-builder.md +38 -1
  171. package/.claude/agents/ant/aether-chaos.md +2 -1
  172. package/.claude/agents/ant/aether-chronicler.md +1 -0
  173. package/.claude/agents/ant/aether-gatekeeper.md +6 -1
  174. package/.claude/agents/ant/aether-includer.md +1 -0
  175. package/.claude/agents/ant/aether-keeper.md +1 -0
  176. package/.claude/agents/ant/aether-measurer.md +6 -1
  177. package/.claude/agents/ant/aether-oracle.md +237 -0
  178. package/.claude/agents/ant/aether-probe.md +2 -1
  179. package/.claude/agents/ant/aether-queen.md +6 -1
  180. package/.claude/agents/ant/aether-route-setter.md +6 -1
  181. package/.claude/agents/ant/aether-sage.md +68 -3
  182. package/.claude/agents/ant/aether-scout.md +38 -1
  183. package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
  184. package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
  185. package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
  186. package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
  187. package/.claude/agents/ant/aether-tracker.md +6 -1
  188. package/.claude/agents/ant/aether-watcher.md +37 -1
  189. package/.claude/agents/ant/aether-weaver.md +2 -1
  190. package/.claude/commands/ant/archaeology.md +1 -8
  191. package/.claude/commands/ant/build.md +43 -1159
  192. package/.claude/commands/ant/chaos.md +1 -14
  193. package/.claude/commands/ant/colonize.md +1 -14
  194. package/.claude/commands/ant/continue.md +40 -1026
  195. package/.claude/commands/ant/council.md +9 -16
  196. package/.claude/commands/ant/data-clean.md +81 -0
  197. package/.claude/commands/ant/dream.md +12 -9
  198. package/.claude/commands/ant/entomb.md +62 -87
  199. package/.claude/commands/ant/export-signals.md +57 -0
  200. package/.claude/commands/ant/feedback.md +18 -0
  201. package/.claude/commands/ant/flag.md +12 -0
  202. package/.claude/commands/ant/flags.md +22 -8
  203. package/.claude/commands/ant/focus.md +18 -0
  204. package/.claude/commands/ant/help.md +40 -8
  205. package/.claude/commands/ant/history.md +3 -0
  206. package/.claude/commands/ant/import-signals.md +71 -0
  207. package/.claude/commands/ant/init.md +316 -191
  208. package/.claude/commands/ant/insert-phase.md +101 -0
  209. package/.claude/commands/ant/interpret.md +11 -0
  210. package/.claude/commands/ant/lay-eggs.md +167 -158
  211. package/.claude/commands/ant/maturity.md +22 -11
  212. package/.claude/commands/ant/memory-details.md +77 -0
  213. package/.claude/commands/ant/migrate-state.md +6 -0
  214. package/.claude/commands/ant/oracle.md +317 -62
  215. package/.claude/commands/ant/organize.md +10 -5
  216. package/.claude/commands/ant/patrol.md +620 -0
  217. package/.claude/commands/ant/pause-colony.md +8 -22
  218. package/.claude/commands/ant/phase.md +26 -37
  219. package/.claude/commands/ant/pheromones.md +156 -0
  220. package/.claude/commands/ant/plan.md +175 -52
  221. package/.claude/commands/ant/preferences.md +65 -0
  222. package/.claude/commands/ant/redirect.md +18 -0
  223. package/.claude/commands/ant/resume-colony.md +34 -20
  224. package/.claude/commands/ant/resume.md +51 -7
  225. package/.claude/commands/ant/run.md +195 -0
  226. package/.claude/commands/ant/seal.md +497 -78
  227. package/.claude/commands/ant/skill-create.md +286 -0
  228. package/.claude/commands/ant/status.md +127 -1
  229. package/.claude/commands/ant/swarm.md +11 -23
  230. package/.claude/commands/ant/tunnels.md +1 -0
  231. package/.claude/commands/ant/update.md +58 -135
  232. package/.claude/commands/ant/verify-castes.md +90 -42
  233. package/.claude/commands/ant/watch.md +1 -0
  234. package/.opencode/agents/aether-ambassador.md +1 -1
  235. package/.opencode/agents/aether-architect.md +133 -0
  236. package/.opencode/agents/aether-builder.md +3 -3
  237. package/.opencode/agents/aether-oracle.md +137 -0
  238. package/.opencode/agents/aether-queen.md +1 -1
  239. package/.opencode/agents/aether-route-setter.md +1 -1
  240. package/.opencode/agents/aether-scout.md +1 -1
  241. package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
  242. package/.opencode/agents/aether-surveyor-nest.md +6 -1
  243. package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
  244. package/.opencode/agents/aether-surveyor-provisions.md +6 -1
  245. package/.opencode/agents/aether-tracker.md +1 -1
  246. package/.opencode/agents/aether-watcher.md +1 -1
  247. package/.opencode/agents/aether-weaver.md +1 -1
  248. package/.opencode/commands/ant/archaeology.md +7 -14
  249. package/.opencode/commands/ant/build.md +54 -88
  250. package/.opencode/commands/ant/chaos.md +7 -24
  251. package/.opencode/commands/ant/colonize.md +8 -17
  252. package/.opencode/commands/ant/continue.md +595 -66
  253. package/.opencode/commands/ant/council.md +11 -22
  254. package/.opencode/commands/ant/data-clean.md +77 -0
  255. package/.opencode/commands/ant/dream.md +15 -17
  256. package/.opencode/commands/ant/entomb.md +28 -18
  257. package/.opencode/commands/ant/export-signals.md +54 -0
  258. package/.opencode/commands/ant/feedback.md +24 -5
  259. package/.opencode/commands/ant/flag.md +16 -4
  260. package/.opencode/commands/ant/flags.md +24 -10
  261. package/.opencode/commands/ant/focus.md +22 -5
  262. package/.opencode/commands/ant/help.md +41 -8
  263. package/.opencode/commands/ant/history.md +9 -0
  264. package/.opencode/commands/ant/import-signals.md +68 -0
  265. package/.opencode/commands/ant/init.md +365 -156
  266. package/.opencode/commands/ant/insert-phase.md +107 -0
  267. package/.opencode/commands/ant/interpret.md +16 -0
  268. package/.opencode/commands/ant/lay-eggs.md +184 -112
  269. package/.opencode/commands/ant/maturity.md +18 -2
  270. package/.opencode/commands/ant/memory-details.md +83 -0
  271. package/.opencode/commands/ant/migrate-state.md +12 -0
  272. package/.opencode/commands/ant/oracle.md +322 -67
  273. package/.opencode/commands/ant/organize.md +14 -12
  274. package/.opencode/commands/ant/patrol.md +626 -0
  275. package/.opencode/commands/ant/pause-colony.md +12 -29
  276. package/.opencode/commands/ant/phase.md +30 -40
  277. package/.opencode/commands/ant/pheromones.md +162 -0
  278. package/.opencode/commands/ant/plan.md +184 -56
  279. package/.opencode/commands/ant/preferences.md +71 -0
  280. package/.opencode/commands/ant/redirect.md +22 -5
  281. package/.opencode/commands/ant/resume-colony.md +38 -27
  282. package/.opencode/commands/ant/resume.md +71 -20
  283. package/.opencode/commands/ant/run.md +201 -0
  284. package/.opencode/commands/ant/seal.md +230 -25
  285. package/.opencode/commands/ant/skill-create.md +63 -0
  286. package/.opencode/commands/ant/status.md +124 -31
  287. package/.opencode/commands/ant/swarm.md +3 -345
  288. package/.opencode/commands/ant/tunnels.md +3 -9
  289. package/.opencode/commands/ant/update.md +63 -127
  290. package/.opencode/commands/ant/verify-castes.md +96 -42
  291. package/.opencode/commands/ant/watch.md +7 -0
  292. package/CHANGELOG.md +278 -1
  293. package/README.md +188 -340
  294. package/bin/cli.js +236 -429
  295. package/bin/generate-commands.js +186 -0
  296. package/bin/generate-commands.sh +128 -89
  297. package/bin/lib/spawn-logger.js +0 -15
  298. package/bin/lib/update-transaction.js +285 -35
  299. package/bin/npx-install.js +178 -0
  300. package/bin/validate-package.sh +85 -3
  301. package/package.json +7 -3
  302. package/.aether/CONTEXT.md +0 -160
  303. package/.aether/docs/QUEEN.md +0 -84
  304. package/.aether/exchange/colony-registry.xml +0 -11
  305. package/.aether/exchange/pheromones.xml +0 -87
  306. package/.aether/exchange/queen-wisdom.xml +0 -14
  307. package/.aether/model-profiles.yaml +0 -100
  308. package/.aether/utils/spawn-with-model.sh +0 -56
  309. package/bin/lib/model-profiles.js +0 -445
  310. package/bin/lib/model-verify.js +0 -288
  311. package/bin/lib/proxy-health.js +0 -253
  312. package/bin/lib/telemetry.js +0 -441
@@ -0,0 +1,1205 @@
1
+ name: "ant:seal"
2
+ description: "🏺🐜🏺 Seal the colony with Crowned Anthill milestone"
3
+ body_claude: |
4
+ You are the **Queen**. Seal the colony with a ceremony — no archiving.
5
+
6
+ ## Instructions
7
+
8
+ Parse `$ARGUMENTS`:
9
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
10
+ - Otherwise: set `visual_mode = true`
11
+
12
+ <failure_modes>
13
+ ### Crowned Anthill Write Failure
14
+ If writing the Crowned Anthill milestone document fails:
15
+ - Do not mark the colony as sealed in state
16
+ - Report the error -- sealing is incomplete
17
+ - Recovery: user can re-run /ant:seal after fixing the issue
18
+
19
+ ### State Update Failure After Seal
20
+ If COLONY_STATE.json update fails after seal document is written:
21
+ - The seal document exists but state doesn't reflect it
22
+ - Report the inconsistency
23
+ - Options: (1) Retry state update only, (2) Manual state fix, (3) Re-run /ant:seal
24
+ </failure_modes>
25
+
26
+ <success_criteria>
27
+ Command is complete when:
28
+ - Crowned Anthill milestone document is written
29
+ - COLONY_STATE.json reflects sealed status
30
+ - All phase evidence is summarized in the seal document
31
+ - User sees confirmation of successful seal
32
+ </success_criteria>
33
+
34
+ <read_only>
35
+ Do not touch during seal:
36
+ - .aether/dreams/ (user notes)
37
+ - .aether/chambers/ (archived colonies -- seal does NOT archive)
38
+ - Source code files
39
+ - .env* files
40
+ - .claude/settings.json
41
+ </read_only>
42
+
43
+ ### Step 0: Initialize Visual Mode (if enabled)
44
+
45
+ If `visual_mode` is true:
46
+ ### Step 1: Read State
47
+
48
+ Read `.aether/data/COLONY_STATE.json`.
49
+
50
+ If file missing or `goal: null`:
51
+ ```
52
+ No colony initialized. Run /ant:init first.
53
+ ```
54
+ Stop here.
55
+
56
+ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `milestone`, `version`, `initialized_at`.
57
+
58
+ ### Step 2: Maturity Gate
59
+
60
+ Run `bash .aether/aether-utils.sh milestone-detect` to get `milestone`, `phases_completed`, `total_phases`.
61
+
62
+ **If milestone is already "Crowned Anthill":**
63
+ ```
64
+ Colony already sealed at Crowned Anthill.
65
+ Run /ant:entomb to archive this colony to chambers.
66
+ ```
67
+ Stop here.
68
+
69
+ **If state is "EXECUTING":**
70
+ ```
71
+ Colony is still executing. Run /ant:continue first.
72
+ ```
73
+ Stop here.
74
+
75
+ **If all phases complete** (phases_completed == total_phases, or milestone is "Sealed Chambers"):
76
+ - Set `incomplete_warning = ""` (no warning needed)
77
+ - Proceed to Step 3.
78
+
79
+ **If phases are incomplete** (any other milestone — First Mound, Open Chambers, Brood Stable, Ventilated Nest, etc.):
80
+ - Set `incomplete_warning = "WARNING: {phases_completed} of {total_phases} phases complete. Sealing now will mark incomplete work as the final state."`
81
+ - Proceed to Step 3 (warn but DO NOT block).
82
+
83
+ ### Step 3: Confirmation
84
+
85
+ Display what will be sealed:
86
+ ```
87
+ SEAL COLONY
88
+
89
+ Goal: {goal}
90
+ Phases: {phases_completed} of {total_phases} completed
91
+ Current Milestone: {milestone}
92
+
93
+ {If incomplete_warning is not empty, display it here}
94
+
95
+ This will:
96
+ - Award the Crowned Anthill milestone
97
+ - Write CROWNED-ANTHILL.md ceremony record
98
+ - Promote colony wisdom to QUEEN.md
99
+
100
+ Seal this colony? (yes/no)
101
+ ```
102
+
103
+ Use `AskUserQuestion with yes/no options`.
104
+
105
+ If not "yes":
106
+ ```
107
+ Sealing cancelled. Colony remains active.
108
+ ```
109
+ Stop here.
110
+
111
+ ### Step 3.5: Analytics Review
112
+
113
+ Before wisdom approval, spawn Sage to analyze colony trends and provide data-driven insights.
114
+
115
+ **Check phase threshold and spawn Sage:**
116
+ ```bash
117
+ # Check if colony has enough history for meaningful analytics
118
+ phases_completed=$(jq '[.plan.phases[] | select(.status == "completed")] | length' .aether/data/COLONY_STATE.json 2>/dev/null || echo "0")
119
+
120
+ if [[ "$phases_completed" -ge 3 ]]; then
121
+ # Generate Sage name and dispatch
122
+ sage_name=$(bash .aether/aether-utils.sh generate-ant-name "sage")
123
+ bash .aether/aether-utils.sh spawn-log "Queen" "sage" "$sage_name" "Colony analytics review"
124
+
125
+ # Display spawn notification
126
+ echo ""
127
+ echo "━━━ 📜🐜 S A G E ━━━"
128
+ echo "──── 📜🐜 Spawning $sage_name — Colony analytics review ────"
129
+ fi
130
+ ```
131
+
132
+ **Spawn Sage using Task tool when threshold is met:**
133
+ If phases_completed >= 3, spawn the Sage agent using Task tool with `subagent_type="aether-sage"`:
134
+
135
+ ```xml
136
+ <task>
137
+ <description>📜 Sage {sage_name}: Colony analytics review</description>
138
+ <prompt>
139
+ You are {sage_name}, a 📜 Sage Ant.
140
+
141
+ Mission: Analyze colony history and provide data-driven insights for wisdom promotion
142
+
143
+ Data Sources:
144
+ - COLONY_STATE.json: Colony configuration, phases, learnings, instincts
145
+ - activity.log: Activity history with timestamps
146
+ - midden.json: Failure patterns and flagged issues
147
+
148
+ Analysis Areas:
149
+ 1. Velocity Trends: Phase completion rate over time
150
+ 2. Bug Density: Error frequency and patterns from midden
151
+ 3. Review Turnaround: Time from build to continue
152
+
153
+ Work:
154
+ 1. Read COLONY_STATE.json for phase history and learnings
155
+ 2. Read activity.log for velocity patterns
156
+ 3. Read midden.json for bug density analysis
157
+ 4. Calculate metrics and identify trends
158
+ 5. Provide recommendations for wisdom promotion
159
+
160
+ **IMPORTANT:** You are strictly read-only. Do not modify any files.
161
+
162
+ Log activity: bash .aether/aether-utils.sh activity-log "ANALYZING" "{sage_name}" "description"
163
+
164
+ Return ONLY this JSON (no other text):
165
+ {{
166
+ "ant_name": "{sage_name}",
167
+ "caste": "sage",
168
+ "status": "completed" | "failed" | "blocked",
169
+ "summary": "What you analyzed and found",
170
+ "key_findings": [],
171
+ "trends": {{
172
+ "velocity": "increasing|stable|decreasing",
173
+ "bug_density": "high|medium|low",
174
+ "review_turnaround": "fast|moderate|slow"
175
+ }},
176
+ "metrics_analyzed": [],
177
+ "predictions": [],
178
+ "recommendations": [
179
+ {{"priority": 1, "action": "", "expected_impact": ""}}
180
+ ],
181
+ "next_steps": [],
182
+ "blockers": []
183
+ }}
184
+ </prompt>
185
+ </task>
186
+ ```
187
+
188
+ **FALLBACK:** If "Agent type not found", use general-purpose agent and inject role: "You are a Sage Ant - analytics specialist that extracts trends from history to guide decisions."
189
+
190
+ **Parse Sage JSON output:**
191
+ After spawn, extract from response: `key_findings`, `trends`, `recommendations`
192
+
193
+ Log completion and update swarm display:
194
+ ```bash
195
+ bash .aether/aether-utils.sh spawn-complete "$sage_name" "completed" "Analytics review complete"
196
+ ```
197
+
198
+ **Display Sage completion line:**
199
+ ```
200
+ 📜 {sage_name}: Colony analytics review complete ✓
201
+ Velocity: {trend} | Bug density: {level} | Review turnaround: {speed}
202
+ ```
203
+
204
+ **Log high-priority recommendations to midden (non-blocking):**
205
+ For each recommendation with priority <= 2:
206
+ ```bash
207
+ bash .aether/aether-utils.sh midden-write "analytics" "Sage recommendation (P{priority}): {action}" "sage"
208
+ ```
209
+
210
+ **Display insights summary:**
211
+ ```
212
+ 📜 Sage Insights:
213
+ Key Findings: {count}
214
+ Top Recommendation: {first recommendation action}
215
+ ```
216
+
217
+ **Continue to Step 3.6 (non-blocking):**
218
+ Proceed to Step 3.6 regardless of Sage findings — Sage is strictly non-blocking.
219
+
220
+ **If phases_completed < 3:**
221
+ Skip silently (no output) — proceed directly to Step 3.6.
222
+
223
+ ### Step 3.6: Wisdom Approval
224
+
225
+ Before sealing, review wisdom proposals accumulated during this colony's lifecycle.
226
+
227
+ ```bash
228
+ # --- Batch auto-promotion for auto-threshold observations (QUEEN-02) ---
229
+ # Auto-promote observations meeting higher recurrence thresholds
230
+ # before presenting the interactive review for lower-threshold proposals.
231
+
232
+ obs_file=".aether/data/learning-observations.json"
233
+ auto_promoted_count=0
234
+
235
+ if [[ -f "$obs_file" ]]; then
236
+ for encoded in $(jq -r '.observations[] | @base64' "$obs_file" 2>/dev/null); do
237
+ content=$(echo "$encoded" | base64 -d | jq -r '.content // empty')
238
+ wisdom_type=$(echo "$encoded" | base64 -d | jq -r '.wisdom_type // "pattern"')
239
+ colony=$(echo "$encoded" | base64 -d | jq -r '.colonies[0] // "unknown"')
240
+ [[ -z "$content" ]] && continue
241
+
242
+ result=$(bash .aether/aether-utils.sh learning-promote-auto "$wisdom_type" "$content" "$colony" "learning" 2>/dev/null || echo '{}')
243
+ was_promoted=$(echo "$result" | jq -r '.result.promoted // false' 2>/dev/null || echo "false")
244
+ if [[ "$was_promoted" == "true" ]]; then
245
+ auto_promoted_count=$((auto_promoted_count + 1))
246
+ fi
247
+ done
248
+ fi
249
+
250
+ if [[ "$auto_promoted_count" -gt 0 ]]; then
251
+ echo "Auto-promoted $auto_promoted_count observation(s) to QUEEN.md (met recurrence thresholds)"
252
+ echo ""
253
+ fi
254
+ # --- END Batch auto-promotion ---
255
+
256
+ # Check for pending proposals
257
+ proposals=$(bash .aether/aether-utils.sh learning-check-promotion 2>/dev/null || echo '{"proposals":[]}')
258
+ proposal_count=$(echo "$proposals" | jq '.proposals | length')
259
+
260
+ if [[ "$proposal_count" -gt 0 ]]; then
261
+ echo ""
262
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
263
+ echo " 🧠 WISDOM REVIEW"
264
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
265
+ echo ""
266
+ echo "Review wisdom proposals before sealing this colony."
267
+ echo "Approved proposals will be promoted to QUEEN.md."
268
+ echo ""
269
+
270
+ # Run approval workflow (blocking)
271
+ bash .aether/aether-utils.sh learning-approve-proposals
272
+
273
+ echo ""
274
+ echo "Wisdom review complete. Proceeding with sealing ceremony..."
275
+ echo ""
276
+ else
277
+ echo "No wisdom proposals to review."
278
+ fi
279
+ ```
280
+
281
+ ### Step 3.7: Hive Promotion (NON-BLOCKING)
282
+
283
+ After QUEEN.md promotion, promote abstracted instincts to the cross-colony hive.
284
+
285
+ **Extract high-confidence instincts for hive promotion:**
286
+ ```bash
287
+ # Get instincts with confidence >= 0.8
288
+ high_conf_instincts=$(jq -r '.memory.instincts[] | select(.confidence >= 0.8) | @base64' .aether/data/COLONY_STATE.json 2>/dev/null || echo "")
289
+
290
+ # Derive source repo name from current directory
291
+ source_repo="$(pwd)"
292
+
293
+ # Read domain tags from registry (NOT from instinct.domain which is a category, not a repo domain)
294
+ repo_domain_tags=$(jq -r --arg repo "$(pwd)" \
295
+ '[.repos[] | select(.path == $repo) | .domain_tags // []] | .[0] // [] | join(",")' \
296
+ "$HOME/.aether/registry.json" 2>/dev/null || echo "")
297
+
298
+ hive_promoted_count=0
299
+ hive_errors=0
300
+ for encoded in $high_conf_instincts; do
301
+ [[ -z "$encoded" ]] && continue
302
+
303
+ # Extract trigger and action fields from the instinct object
304
+ trigger=$(echo "$encoded" | base64 -d | jq -r '.trigger // empty')
305
+ action=$(echo "$encoded" | base64 -d | jq -r '.action // empty')
306
+ confidence=$(echo "$encoded" | base64 -d | jq -r '.confidence // 0.7')
307
+
308
+ [[ -z "$trigger" || -z "$action" ]] && continue
309
+
310
+ # Strip leading "When " or "when " from trigger to avoid "When When..." stutter
311
+ trigger_clean=$(echo "$trigger" | sed 's/^[Ww]hen //')
312
+
313
+ # Build the promotion text in "When {trigger}: {action}" format
314
+ promote_text="When ${trigger_clean}: ${action}"
315
+
316
+ # Build hive-promote args with --text and --source-repo (required)
317
+ promote_args=(hive-promote --text "$promote_text" --source-repo "$source_repo" --confidence "$confidence")
318
+ [[ -n "$repo_domain_tags" ]] && promote_args+=(--domain "$repo_domain_tags")
319
+
320
+ # Call hive-promote which orchestrates abstract + store
321
+ result=$(bash .aether/aether-utils.sh "${promote_args[@]}" 2>/dev/null || echo '{}')
322
+ was_promoted=$(echo "$result" | jq -r '.result.action // "skipped"' 2>/dev/null || echo "skipped")
323
+
324
+ if [[ "$was_promoted" == "promoted" || "$was_promoted" == "merged" ]]; then
325
+ hive_promoted_count=$((hive_promoted_count + 1))
326
+ fi
327
+ done
328
+
329
+ if [[ "$hive_promoted_count" -gt 0 ]]; then
330
+ echo "Hive promotion: $hive_promoted_count instinct(s) promoted to cross-colony hive"
331
+ fi
332
+ ```
333
+
334
+ **Continue to Step 4 (non-blocking):**
335
+ Proceed to Step 4 regardless of hive promotion results — hive promotion is strictly non-blocking.
336
+
337
+ ### Step 4: Log Seal Activity
338
+
339
+ Log the seal ceremony to activity log:
340
+ ```bash
341
+ bash .aether/aether-utils.sh activity-log "MODIFIED" "Queen" "Colony sealed - wisdom review completed"
342
+ ```
343
+
344
+ ### Step 4.5: Increment Colony Version
345
+
346
+ Before writing the Crowned Anthill milestone, increment `colony_version` in COLONY_STATE.json.
347
+
348
+ ```bash
349
+ # Read current colony_version (default to 0 for backward compat with older colonies)
350
+ current_colony_version=$(jq -r '.colony_version // 0' .aether/data/COLONY_STATE.json 2>/dev/null || echo 0)
351
+ # Guard against non-integer values (floats, strings)
352
+ [[ "$current_colony_version" =~ ^[0-9]+$ ]] || current_colony_version=0
353
+ new_colony_version=$(( current_colony_version + 1 ))
354
+
355
+ # Write incremented value back — guard against empty output destroying the file
356
+ updated=$(jq --argjson v "$new_colony_version" '.colony_version = $v' .aether/data/COLONY_STATE.json 2>/dev/null)
357
+ if [[ -n "$updated" && ${#updated} -gt 10 ]]; then
358
+ echo "$updated" > .aether/data/COLONY_STATE.json
359
+ else
360
+ echo "Warning: jq update failed — colony_version defaults to 1, state file unchanged"
361
+ new_colony_version=1
362
+ fi
363
+ ```
364
+
365
+ Use `new_colony_version` as `{colony_version}` throughout the rest of the seal ceremony (e.g., display as "Crowned Anthill v{colony_version}").
366
+
367
+ **Error handling:** If jq fails or produces empty/short output, COLONY_STATE.json is NOT overwritten and `new_colony_version` defaults to 1. Never let version increment failures block the seal.
368
+
369
+ ### Step 5: Update Milestone to Crowned Anthill
370
+
371
+ Update COLONY_STATE.json:
372
+ 1. Set `milestone` to `"Crowned Anthill"`
373
+ 2. Set `milestone_updated_at` to current ISO-8601 timestamp
374
+ 3. Append event: `"<timestamp>|milestone_reached|seal|Achieved Crowned Anthill milestone"`
375
+
376
+ Run `bash .aether/aether-utils.sh validate-state colony` after write.
377
+
378
+ ### Step 5.1: Update Changelog
379
+
380
+ **MANDATORY: Record the seal in the project changelog. This step is never skipped.**
381
+
382
+ If no `CHANGELOG.md` exists, `changelog-append` creates one automatically.
383
+
384
+ Build a summary of what the colony accomplished across all phases:
385
+ - Collect completed phase names from COLONY_STATE.json
386
+ - Summarize the goal and key outcomes in one line
387
+
388
+ ```bash
389
+ bash .aether/aether-utils.sh changelog-append \
390
+ "$(date +%Y-%m-%d)" \
391
+ "seal-crowned-anthill" \
392
+ "00" \
393
+ "{key_files_csv}" \
394
+ "Colony sealed at Crowned Anthill;{goal}" \
395
+ "{phases_completed} phases completed;Colony wisdom promoted to QUEEN.md" \
396
+ ""
397
+ ```
398
+
399
+ - `{key_files_csv}` — list the most significant files created or modified across the colony's lifetime (derive from phase plans or git log)
400
+ - `{goal}` — the colony goal from COLONY_STATE.json
401
+
402
+ **Error handling:** If `changelog-append` fails, log to midden and continue — changelog failure never blocks sealing.
403
+
404
+ ### Step 5.2: Update Registry (Silent)
405
+
406
+ Mark the colony as inactive in the global registry. This is silent on failure — registry is not required for the colony to work.
407
+
408
+ Run using the Bash tool (ignore errors):
409
+ ```bash
410
+ bash .aether/aether-utils.sh registry-add "$(pwd)" "$(jq -r '.version // "unknown"' ~/.aether/version.json 2>/dev/null || echo 'unknown')" --active false 2>/dev/null || true
411
+ ```
412
+
413
+ If the command fails, proceed silently. This is optional bookkeeping.
414
+
415
+ ### Step 5.5: Documentation Coverage Audit
416
+
417
+ Before writing the seal document, spawn a Chronicler to survey documentation coverage.
418
+
419
+ **Generate Chronicler name and dispatch:**
420
+ ```bash
421
+ # Generate unique chronicler name
422
+ chronicler_name=$(bash .aether/aether-utils.sh generate-ant-name "chronicler")
423
+
424
+ # Log spawn and update swarm display
425
+ bash .aether/aether-utils.sh spawn-log "Queen" "chronicler" "$chronicler_name" "Documentation coverage audit"
426
+ ```
427
+
428
+ **Display:**
429
+ ```
430
+ ━━━ 📝🐜 C H R O N I C L E R ━━━
431
+ ──── 📝🐜 Spawning {chronicler_name} — documentation coverage audit ────
432
+ ```
433
+
434
+ **Spawn Chronicler using Task tool:**
435
+ Spawn the Chronicler using Task tool with `subagent_type="aether-chronicler"`:
436
+
437
+ ```xml
438
+ <task>
439
+ <description>📝 Chronicler {chronicler_name}: Documentation coverage audit</description>
440
+ <prompt>
441
+ You are {chronicler_name}, a 📝 Chronicler Ant.
442
+
443
+ Mission: Documentation coverage audit before seal ceremony
444
+
445
+ Survey the following documentation types:
446
+ - README.md (project overview, quick start)
447
+ - API documentation (endpoints, parameters, responses)
448
+ - Guides (tutorials, how-tos, best practices)
449
+ - Changelogs (version history, release notes)
450
+ - Code comments (JSDoc, TSDoc inline documentation)
451
+ - Architecture docs (system design, decisions)
452
+
453
+ Work:
454
+ 1. Check if README.md exists and covers: installation, usage, examples
455
+ 2. Look for docs/ directory and survey guide coverage
456
+ 3. Check for API documentation (OpenAPI, README sections, etc.)
457
+ 4. Verify CHANGELOG.md exists and has recent entries
458
+ 5. Sample source files for inline documentation coverage
459
+ 6. Identify documentation gaps (missing, outdated, incomplete)
460
+
461
+ **IMPORTANT:** You are strictly read-only. Do not modify any files.
462
+
463
+ Log activity: bash .aether/aether-utils.sh activity-log "SURVEYING" "{chronicler_name}" "description"
464
+
465
+ Return ONLY this JSON (no other text):
466
+ {
467
+ "ant_name": "{chronicler_name}",
468
+ "caste": "chronicler",
469
+ "status": "completed" | "failed" | "blocked",
470
+ "summary": "What you surveyed and found",
471
+ "documentation_created": [],
472
+ "documentation_updated": [],
473
+ "pages_documented": 0,
474
+ "code_examples_verified": [],
475
+ "coverage_percent": 0,
476
+ "gaps_identified": [
477
+ {"type": "README|API|Guide|Changelog|Comments|Architecture", "severity": "high|medium|low", "description": "...", "location": "..."}
478
+ ],
479
+ "blockers": []
480
+ }
481
+ </prompt>
482
+ </task>
483
+ ```
484
+
485
+ **FALLBACK:** If "Agent type not found", use general-purpose agent and inject role: "You are a Chronicler Ant - documentation specialist that surveys and identifies documentation gaps."
486
+
487
+ **Parse Chronicler JSON output:**
488
+ Extract from response: `coverage_percent`, `gaps_identified`, `pages_documented`
489
+
490
+ Log completion and update swarm display:
491
+ ```bash
492
+ bash .aether/aether-utils.sh spawn-complete "$chronicler_name" "completed" "Documentation audit complete"
493
+ ```
494
+
495
+ **Display Chronicler completion line:**
496
+ ```
497
+ 📝 {chronicler_name}: Documentation coverage audit ({pages_documented} pages, {coverage_percent}% coverage) ✓
498
+ ```
499
+
500
+ **Log gaps to midden (non-blocking):**
501
+ For each gap in `gaps_identified` with severity "high" or "medium":
502
+ ```bash
503
+ bash .aether/aether-utils.sh midden-write "documentation" "Gap ({severity}): {description} at {location}" "chronicler"
504
+ ```
505
+
506
+ **Display summary:**
507
+ ```
508
+ 📝 Chronicler complete — {coverage_percent}% coverage, {gap_count} gaps logged to midden
509
+ ```
510
+
511
+ **Continue to Step 6 (non-blocking):**
512
+ Proceed to Step 6 regardless of Chronicler findings — Chronicler is strictly non-blocking.
513
+
514
+ ### Step 6: Write CROWNED-ANTHILL.md
515
+
516
+ Calculate colony age:
517
+ ```bash
518
+ initialized_at=$(jq -r '.initialized_at // empty' .aether/data/COLONY_STATE.json)
519
+ if [[ -n "$initialized_at" ]]; then
520
+ init_epoch=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$initialized_at" +%s 2>/dev/null || echo 0)
521
+ now_epoch=$(date +%s)
522
+ if [[ "$init_epoch" -gt 0 ]]; then
523
+ colony_age_days=$(( (now_epoch - init_epoch) / 86400 ))
524
+ else
525
+ colony_age_days=0
526
+ fi
527
+ else
528
+ colony_age_days=0
529
+ fi
530
+ ```
531
+
532
+ Extract phase recap:
533
+ ```bash
534
+ phase_recap=""
535
+ while IFS= read -r phase_line; do
536
+ phase_name=$(echo "$phase_line" | jq -r '.name')
537
+ phase_status=$(echo "$phase_line" | jq -r '.status')
538
+ phase_recap="${phase_recap} - ${phase_name}: ${phase_status}\n"
539
+ done < <(jq -c '.plan.phases[]' .aether/data/COLONY_STATE.json 2>/dev/null)
540
+ ```
541
+
542
+ Write the seal document:
543
+ ```bash
544
+ version=$(jq -r '.version // "3.0"' .aether/data/COLONY_STATE.json)
545
+ seal_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
546
+ ```
547
+
548
+ Resolve the crowned-anthill template path:
549
+ Check ~/.aether/system/templates/crowned-anthill.template.md first,
550
+ then .aether/templates/crowned-anthill.template.md.
551
+
552
+ If no template found: output "Template missing: crowned-anthill.template.md. Run aether update to fix." and stop.
553
+
554
+ Read the template file. Fill all {{PLACEHOLDER}} values:
555
+ - {{GOAL}} → goal (from colony state)
556
+ - {{SEAL_DATE}} → seal_date (ISO-8601 UTC timestamp)
557
+ - {{VERSION}} → version (from colony state)
558
+ - {{TOTAL_PHASES}} → total_phases
559
+ - {{PHASES_COMPLETED}} → phases_completed
560
+ - {{COLONY_AGE_DAYS}} → colony_age_days
561
+ - {{PROMOTIONS_MADE}} → promotions_made
562
+ - {{PHASE_RECAP}} → phase recap list (one entry per line, formatted from the bash loop above)
563
+
564
+ Remove the HTML comment lines at the top of the template (lines starting with <!--).
565
+ Write the result to .aether/CROWNED-ANTHILL.md using the Write tool.
566
+
567
+ ### Step 6.5: Export XML Archive (best-effort)
568
+
569
+ Export colony data as a combined XML archive and a standalone pheromones.xml. Both are best-effort — seal proceeds even if XML export fails.
570
+
571
+ ```bash
572
+ # Check if xmllint is available
573
+ if command -v xmllint >/dev/null 2>&1; then
574
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml ".aether/exchange/colony-archive.xml" 2>&1)
575
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
576
+ if [[ "$xml_ok" == "true" ]]; then
577
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
578
+ xml_export_line="XML Archive: colony-archive.xml (${xml_pheromone_count} active signals)"
579
+ else
580
+ xml_export_line="XML Archive: export failed (non-blocking)"
581
+ fi
582
+
583
+ # Also export standalone pheromones.xml for cross-colony sharing
584
+ pher_result=$(bash .aether/aether-utils.sh pheromone-export-xml ".aether/exchange/pheromones.xml" 2>&1)
585
+ pher_ok=$(echo "$pher_result" | jq -r '.ok // false' 2>/dev/null)
586
+ if [[ "$pher_ok" == "true" ]]; then
587
+ pher_signal_count=$(jq '[.signals[] | select(.active != false)] | length' .aether/data/pheromones.json 2>/dev/null || echo "0")
588
+ pher_export_line="Signal Export: pheromones.xml (${pher_signal_count} signals, importable by other colonies)"
589
+ else
590
+ pher_export_line="Signal Export: failed (non-blocking)"
591
+ fi
592
+
593
+ # Export standalone queen-wisdom.xml for cross-colony wisdom sharing
594
+ wisdom_result=$(bash .aether/aether-utils.sh wisdom-export-xml ".aether/exchange/queen-wisdom.xml" 2>&1)
595
+ wisdom_ok=$(echo "$wisdom_result" | jq -r '.ok // false' 2>/dev/null)
596
+ if [[ "$wisdom_ok" == "true" ]]; then
597
+ wisdom_count=$(echo "$wisdom_result" | jq -r '.result.entries // 0' 2>/dev/null)
598
+ wisdom_export_line="Wisdom Export: queen-wisdom.xml (${wisdom_count} entries)"
599
+ else
600
+ wisdom_export_line="Wisdom Export: failed (non-blocking)"
601
+ fi
602
+
603
+ # Export standalone colony-registry.xml for lineage tracking
604
+ registry_result=$(bash .aether/aether-utils.sh registry-export-xml ".aether/exchange/colony-registry.xml" 2>&1)
605
+ registry_ok=$(echo "$registry_result" | jq -r '.ok // false' 2>/dev/null)
606
+ if [[ "$registry_ok" == "true" ]]; then
607
+ registry_count=$(echo "$registry_result" | jq -r '.result.colonies // 0' 2>/dev/null)
608
+ registry_export_line="Registry Export: colony-registry.xml (${registry_count} colonies)"
609
+ else
610
+ registry_export_line="Registry Export: failed (non-blocking)"
611
+ fi
612
+ else
613
+ xml_export_line="XML Archive: skipped (xmllint not available)"
614
+ pher_export_line="Signal Export: skipped (xmllint not available)"
615
+ wisdom_export_line="Wisdom Export: skipped (xmllint not available)"
616
+ registry_export_line="Registry Export: skipped (xmllint not available)"
617
+ fi
618
+ ```
619
+
620
+ ### Step 7: Display Ceremony
621
+
622
+
623
+ Display the ASCII art ceremony:
624
+ ```
625
+ . .
626
+ /|\ /|\
627
+ / | \ / | \
628
+ / | X | \
629
+ / | / \ | \
630
+ / |/ \| \
631
+ / / \ \
632
+ /____ / ___ \ ____\
633
+ / / \ \
634
+ / / \ \
635
+ /_/ \_\
636
+ | CROWNED |
637
+ | ANTHILL |
638
+ |__________|
639
+ ```
640
+
641
+ Below the ASCII art, display:
642
+ ```
643
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
644
+ C R O W N E D A N T H I L L v{colony_version}
645
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
646
+
647
+ Goal: {goal}
648
+ Phases: {phases_completed} of {total_phases} completed
649
+ Milestone: Crowned Anthill v{colony_version}
650
+ {If incomplete_warning is not empty: display it}
651
+ Wisdom Promoted: {promotion_summary}
652
+
653
+ Seal Document: .aether/CROWNED-ANTHILL.md
654
+ {xml_export_line}
655
+ {pher_export_line}
656
+ {wisdom_export_line}
657
+ {registry_export_line}
658
+
659
+ The colony stands crowned and sealed.
660
+ Its wisdom lives on in QUEEN.md.
661
+ The anthill has reached its final form.
662
+
663
+ ──────────────────────────────────────────────────
664
+ 🐜 Next Up
665
+ ──────────────────────────────────────────────────
666
+ /ant:entomb 🏺 Archive colony to chambers
667
+ /ant:lay-eggs 🥚 Start a new colony
668
+ /ant:tunnels 🗄️ Browse archived chambers
669
+ ```
670
+
671
+ ### Step 7.5: Commit Suggestion (Non-blocking)
672
+
673
+ After the ceremony, offer to commit all colony work.
674
+
675
+ **Gate check — skip silently if any fail:**
676
+ 1. Not a git repo: `git rev-parse --git-dir 2>/dev/null` fails → skip
677
+ 2. Clean working tree: `git status --porcelain 2>/dev/null` is empty → skip to Step 7.6 (may still want to push)
678
+
679
+ **If uncommitted changes exist:**
680
+
681
+ Generate a seal commit message:
682
+ ```bash
683
+ seal_commit=$(bash .aether/aether-utils.sh generate-commit-message seal "$phases_completed" "$goal" "$colony_age_days" 2>/dev/null)
684
+ seal_message=$(echo "$seal_commit" | jq -r '.result.message // "aether-seal: colony sealed"')
685
+ seal_body=$(echo "$seal_commit" | jq -r '.result.body // ""')
686
+ ```
687
+
688
+ Display the suggestion:
689
+ ```
690
+ ──────────────────────────────────────────────────
691
+ Commit suggestion:
692
+
693
+ $seal_message
694
+
695
+ $seal_body
696
+ ──────────────────────────────────────────────────
697
+ ```
698
+
699
+ Prompt with AskUserQuestion (3 options):
700
+ 1. **Commit with this message** — Run `git add -A && git commit -m "$seal_message" -m "$seal_body"`
701
+ 2. **Edit message** — Ask user for their preferred message, then commit with that
702
+ 3. **Skip** — Do not commit
703
+
704
+ If the user chooses option 1 or 2 and the commit succeeds, set `seal_committed = true`.
705
+ If the commit fails or user skips, set `seal_committed = false`.
706
+
707
+ **Error handling:** If `generate-commit-message` fails, fall back to message `"aether-seal: colony sealed"`. Never let commit suggestion failures stop the seal flow.
708
+
709
+ ### Step 7.6: Push Suggestion (Non-blocking)
710
+
711
+ Only show if a commit was just made in Step 7.5 (`seal_committed == true`) OR if there are unpushed commits.
712
+
713
+ **Gate check — skip silently if any fail:**
714
+ 1. Not a git repo → skip
715
+ 2. No remote configured: `git remote -v 2>/dev/null` is empty → skip
716
+
717
+ **Check for unpushed commits:**
718
+ ```bash
719
+ unpushed=$(git log --oneline @{u}..HEAD 2>/dev/null | wc -l | tr -d ' ')
720
+ ```
721
+ If `unpushed == 0` and `seal_committed == false` → skip (nothing to push)
722
+
723
+ **If there are commits to push:**
724
+
725
+ Detect current branch and upstream status:
726
+ ```bash
727
+ current_branch=$(git branch --show-current)
728
+ has_upstream=$(git rev-parse --abbrev-ref @{u} 2>/dev/null && echo "yes" || echo "no")
729
+ ```
730
+
731
+ Display:
732
+ ```
733
+ Push {unpushed} commit(s) to remote?
734
+ Branch: {current_branch}
735
+ ```
736
+
737
+ Prompt with AskUserQuestion (2 options):
738
+ 1. **Push now** — If upstream exists: `git push`. If no upstream: `git push -u origin $current_branch`
739
+ 2. **I'll push later** — Skip
740
+
741
+ Display result: `Pushed to origin/{current_branch}` on success, or `Push skipped` if declined.
742
+
743
+ **Error handling:** If push fails, display the error message but do not stop the seal flow. Suggest: "You can push manually with `git push`."
744
+
745
+ **Safety:** Never auto-push. Always require explicit user approval via AskUserQuestion.
746
+
747
+ ### Edge Cases
748
+
749
+ **Colony already at Crowned Anthill:**
750
+ - Display message and guide to /ant:entomb. Do NOT re-seal.
751
+
752
+ **Phases incomplete:**
753
+ - Warn but allow. The seal proceeds after confirmation.
754
+
755
+ **Missing QUEEN.md:**
756
+ - queen-init creates it. If that fails, skip promotion (non-fatal).
757
+
758
+ **Missing initialized_at:**
759
+ - Colony age defaults to 0 days.
760
+
761
+ **Empty phases array:**
762
+ - Can seal a colony with 0 phases (rare but valid). phases_completed = 0, total_phases = 0.
763
+
764
+ body_opencode: |
765
+ You are the **Queen**. Seal the colony when all work is complete.
766
+
767
+ ## Instructions
768
+
769
+ Parse `$normalized_args`:
770
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
771
+ - Otherwise: set `visual_mode = true`
772
+
773
+ ### Step 1: Read State
774
+
775
+ Read `.aether/data/COLONY_STATE.json`.
776
+
777
+ If file missing or `goal: null`:
778
+ ```
779
+ No colony initialized. Run /ant:init first.
780
+ ```
781
+ Stop here.
782
+
783
+ ### Step 2: Validate Colony Is Complete
784
+
785
+ Extract: `goal`, `current_phase`, `plan.phases`, `milestone`, `state`.
786
+
787
+ **Precondition 1: All phases must be completed**
788
+
789
+ Check if all phases in `plan.phases` have `status: "completed"`:
790
+ ```
791
+ all_completed = all(phase.status == "completed" for phase in plan.phases)
792
+ ```
793
+
794
+ If NOT all completed:
795
+ ```
796
+ Cannot archive colony with incomplete phases.
797
+
798
+ Completed phases: X of Y
799
+ Remaining: {list of incomplete phase names}
800
+
801
+ Run /ant:continue to complete remaining phases first.
802
+ ```
803
+ Stop here.
804
+
805
+ **Precondition 2: State must not be EXECUTING**
806
+
807
+ If `state == "EXECUTING"`:
808
+ ```
809
+ Colony is still executing. Run /ant:continue to reconcile first.
810
+ ```
811
+ Stop here.
812
+
813
+ ### Step 3: Check Milestone Eligibility
814
+
815
+ The full milestone progression is:
816
+ - **First Mound** — Phase 1 complete (first runnable)
817
+ - **Open Chambers** — Feature work underway (2+ phases complete)
818
+ - **Brood Stable** — Tests consistently green
819
+ - **Ventilated Nest** — Perf/latency acceptable (build + lint clean)
820
+ - **Sealed Chambers** — All phases complete (interfaces frozen)
821
+ - **Crowned Anthill** — Release-ready (user confirms via /ant:seal)
822
+
823
+ **If current milestone is "Crowned Anthill":**
824
+ ```
825
+ Colony is already at Crowned Anthill milestone.
826
+ No further archiving needed.
827
+
828
+ Use /ant:status to view colony state.
829
+ ```
830
+ Stop here.
831
+
832
+ **If current milestone is "Sealed Chambers":**
833
+ - Proceed to Step 4 (will upgrade to Crowned Anthill)
834
+
835
+ **If current milestone is "First Mound", "Open Chambers", "Brood Stable", "Ventilated Nest", or any intermediate milestone:**
836
+ - Since all phases are complete, the colony qualifies for both Sealed Chambers and Crowned Anthill
837
+ - The current logic allows proceeding to Step 4 (seal as Crowned Anthill)
838
+ - If user wants to explicitly achieve Sealed Chambers first, they can manually update milestone via COLONY_STATE.json
839
+
840
+ **If milestone is unrecognized (not in the 6 known stages):**
841
+ ```
842
+ Unknown milestone: {milestone}
843
+
844
+ The milestone "{milestone}" is not recognized.
845
+ Known milestones: First Mound, Open Chambers, Brood Stable, Ventilated Nest, Sealed Chambers, Crowned Anthill
846
+
847
+ Run /ant:status to check colony state.
848
+ ```
849
+ Stop here.
850
+
851
+ ### Step 4: Archive Colony State
852
+
853
+ Create archive directory:
854
+ ```
855
+ archive_dir=".aether/data/archive/session_$(date -u +%s)_archive"
856
+ mkdir -p "$archive_dir"
857
+ ```
858
+
859
+ Copy the following files to the archive directory:
860
+ 1. `.aether/data/COLONY_STATE.json` → `$archive_dir/COLONY_STATE.json`
861
+ 2. `.aether/data/activity.log` → `$archive_dir/activity.log`
862
+ 3. `.aether/data/spawn-tree.txt` → `$archive_dir/spawn-tree.txt`
863
+ 4. `.aether/data/flags.json` → `$archive_dir/flags.json` (if exists)
864
+ 5. `.aether/data/constraints.json` → `$archive_dir/constraints.json` (if exists)
865
+
866
+ Create archive manifest file `$archive_dir/manifest.json`:
867
+ ```json
868
+ {
869
+ "archived_at": "<ISO-8601 timestamp>",
870
+ "goal": "<colony goal>",
871
+ "total_phases": <number>,
872
+ "milestone": "Crowned Anthill",
873
+ "files": [
874
+ "COLONY_STATE.json",
875
+ "activity.log",
876
+ "spawn-tree.txt",
877
+ "flags.json",
878
+ "constraints.json"
879
+ ]
880
+ }
881
+ ```
882
+
883
+ ### Step 4.5: Increment Colony Version
884
+
885
+ Before writing the Crowned Anthill milestone, increment `colony_version` in COLONY_STATE.json.
886
+
887
+ ```bash
888
+ # Read current colony_version (default to 0 for backward compat with older colonies)
889
+ current_colony_version=$(jq -r '.colony_version // 0' .aether/data/COLONY_STATE.json 2>/dev/null || echo 0)
890
+ # Guard against non-integer values (floats, strings)
891
+ [[ "$current_colony_version" =~ ^[0-9]+$ ]] || current_colony_version=0
892
+ new_colony_version=$(( current_colony_version + 1 ))
893
+
894
+ # Write incremented value back — guard against empty output destroying the file
895
+ updated=$(jq --argjson v "$new_colony_version" '.colony_version = $v' .aether/data/COLONY_STATE.json 2>/dev/null)
896
+ if [[ -n "$updated" && ${#updated} -gt 10 ]]; then
897
+ echo "$updated" > .aether/data/COLONY_STATE.json
898
+ else
899
+ echo "Warning: jq update failed — colony_version defaults to 1, state file unchanged"
900
+ new_colony_version=1
901
+ fi
902
+ ```
903
+
904
+ Use `new_colony_version` as `{colony_version}` throughout the rest of the seal ceremony (e.g., display as "Crowned Anthill v{colony_version}").
905
+
906
+ **Error handling:** If jq fails or produces empty/short output, COLONY_STATE.json is NOT overwritten and `new_colony_version` defaults to 1. Never let version increment failures block the seal.
907
+
908
+ ### Step 5: Update Milestone to Crowned Anthill
909
+
910
+ Update COLONY_STATE.json:
911
+ 1. Set `milestone` to `"Crowned Anthill"`
912
+ 2. Set `milestone_updated_at` to current ISO-8601 timestamp
913
+ 3. Append event: `"<timestamp>|milestone_reached|archive|Achieved Crowned Anthill milestone - colony archived"`
914
+
915
+ ### Step 5.1: Update Changelog
916
+
917
+ **MANDATORY: Record the seal in the project changelog. This step is never skipped.**
918
+
919
+ If no `CHANGELOG.md` exists, `changelog-append` creates one automatically.
920
+
921
+ Build a summary of what the colony accomplished across all phases:
922
+ - Collect completed phase names from COLONY_STATE.json
923
+ - Summarize the goal and key outcomes in one line
924
+
925
+ ```bash
926
+ bash .aether/aether-utils.sh changelog-append \
927
+ "$(date +%Y-%m-%d)" \
928
+ "seal-crowned-anthill" \
929
+ "00" \
930
+ "{key_files_csv}" \
931
+ "Colony sealed at Crowned Anthill;{goal}" \
932
+ "{phases_completed} phases completed;Colony wisdom promoted to QUEEN.md" \
933
+ ""
934
+ ```
935
+
936
+ - `{key_files_csv}` — list the most significant files created or modified across the colony's lifetime (derive from phase plans or git log)
937
+ - `{goal}` — the colony goal from COLONY_STATE.json
938
+
939
+ **Error handling:** If `changelog-append` fails, log to midden and continue — changelog failure never blocks sealing.
940
+
941
+ ### Step 5.2: Update Registry (Silent)
942
+
943
+ Mark the colony as inactive in the global registry. This is silent on failure — registry is not required for the colony to work.
944
+
945
+ Run using the Bash tool (ignore errors):
946
+ ```bash
947
+ bash .aether/aether-utils.sh registry-add "$(pwd)" "$(jq -r '.version // "unknown"' ~/.aether/version.json 2>/dev/null || echo 'unknown')" --active false 2>/dev/null || true
948
+ ```
949
+
950
+ If the command fails, proceed silently. This is optional bookkeeping.
951
+
952
+ ### Step 5.25: Hive Promotion (NON-BLOCKING)
953
+
954
+ After wisdom promotion, promote abstracted instincts to the cross-colony hive.
955
+
956
+ **Extract high-confidence instincts for hive promotion:**
957
+ ```bash
958
+ # Get instincts with confidence >= 0.8
959
+ high_conf_instincts=$(jq -r '.memory.instincts[] | select(.confidence >= 0.8) | @base64' .aether/data/COLONY_STATE.json 2>/dev/null || echo "")
960
+
961
+ # Derive source repo name from current directory
962
+ source_repo="$(pwd)"
963
+
964
+ # Read domain tags from registry (NOT from instinct.domain which is a category, not a repo domain)
965
+ repo_domain_tags=$(jq -r --arg repo "$(pwd)" \
966
+ '[.repos[] | select(.path == $repo) | .domain_tags // []] | .[0] // [] | join(",")' \
967
+ "$HOME/.aether/registry.json" 2>/dev/null || echo "")
968
+
969
+ hive_promoted_count=0
970
+ hive_errors=0
971
+ for encoded in $high_conf_instincts; do
972
+ [[ -z "$encoded" ]] && continue
973
+
974
+ # Extract trigger and action fields from the instinct object
975
+ trigger=$(echo "$encoded" | base64 -d | jq -r '.trigger // empty')
976
+ action=$(echo "$encoded" | base64 -d | jq -r '.action // empty')
977
+ confidence=$(echo "$encoded" | base64 -d | jq -r '.confidence // 0.7')
978
+
979
+ [[ -z "$trigger" || -z "$action" ]] && continue
980
+
981
+ # Strip leading "When " or "when " from trigger to avoid "When When..." stutter
982
+ trigger_clean=$(echo "$trigger" | sed 's/^[Ww]hen //')
983
+
984
+ # Build the promotion text in "When {trigger}: {action}" format
985
+ promote_text="When ${trigger_clean}: ${action}"
986
+
987
+ # Build hive-promote args with --text and --source-repo (required)
988
+ promote_args=(hive-promote --text "$promote_text" --source-repo "$source_repo" --confidence "$confidence")
989
+ [[ -n "$repo_domain_tags" ]] && promote_args+=(--domain "$repo_domain_tags")
990
+
991
+ # Call hive-promote which orchestrates abstract + store
992
+ result=$(bash .aether/aether-utils.sh "${promote_args[@]}" 2>/dev/null || echo '{}')
993
+ was_promoted=$(echo "$result" | jq -r '.result.action // "skipped"' 2>/dev/null || echo "skipped")
994
+
995
+ if [[ "$was_promoted" == "promoted" || "$was_promoted" == "merged" ]]; then
996
+ hive_promoted_count=$((hive_promoted_count + 1))
997
+ fi
998
+ done
999
+
1000
+ if [[ "$hive_promoted_count" -gt 0 ]]; then
1001
+ echo "Hive promotion: $hive_promoted_count instinct(s) promoted to cross-colony hive"
1002
+ fi
1003
+ ```
1004
+
1005
+ **Continue to Step 5.5 (non-blocking):**
1006
+ Proceed to Step 5.5 regardless of hive promotion results — hive promotion is strictly non-blocking.
1007
+
1008
+ ### Step 5.5: Write Final Handoff
1009
+
1010
+ After archiving, write the final handoff documenting the completed colony:
1011
+
1012
+ Resolve the handoff template path:
1013
+ Check ~/.aether/system/templates/handoff.template.md first,
1014
+ then .aether/templates/handoff.template.md.
1015
+
1016
+ If no template found: output "Template missing: handoff.template.md. Run aether update to fix." and stop.
1017
+
1018
+ Read the template file. Fill all {{PLACEHOLDER}} values:
1019
+ - {{CHAMBER_NAME}} → archive directory name
1020
+ - {{GOAL}} → goal
1021
+ - {{PHASES_COMPLETED}} → total_phases (OpenCode seal archives completed colonies)
1022
+ - {{TOTAL_PHASES}} → total_phases
1023
+ - {{MILESTONE}} → "Crowned Anthill"
1024
+ - {{ENTOMB_TIMESTAMP}} → seal timestamp
1025
+
1026
+ Remove the HTML comment lines at the top of the template.
1027
+ Write the result to .aether/HANDOFF.md using the Write tool.
1028
+
1029
+ This handoff serves as the final record of the completed colony.
1030
+
1031
+ ### Step 5.75: Export XML Archive (best-effort)
1032
+
1033
+ Export colony data as a combined XML archive and a standalone pheromones.xml. Both are best-effort — seal proceeds even if XML export fails.
1034
+
1035
+ ```bash
1036
+ # Check if xmllint is available
1037
+ if command -v xmllint >/dev/null 2>&1; then
1038
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml ".aether/exchange/colony-archive.xml" 2>&1)
1039
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
1040
+ if [[ "$xml_ok" == "true" ]]; then
1041
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
1042
+ xml_export_line="XML Archive: colony-archive.xml (${xml_pheromone_count} active signals)"
1043
+ else
1044
+ xml_export_line="XML Archive: export failed (non-blocking)"
1045
+ fi
1046
+
1047
+ # Also export standalone pheromones.xml for cross-colony sharing
1048
+ pher_result=$(bash .aether/aether-utils.sh pheromone-export-xml ".aether/exchange/pheromones.xml" 2>&1)
1049
+ pher_ok=$(echo "$pher_result" | jq -r '.ok // false' 2>/dev/null)
1050
+ if [[ "$pher_ok" == "true" ]]; then
1051
+ pher_signal_count=$(jq '[.signals[] | select(.active != false)] | length' .aether/data/pheromones.json 2>/dev/null || echo "0")
1052
+ pher_export_line="Signal Export: pheromones.xml (${pher_signal_count} signals, importable by other colonies)"
1053
+ else
1054
+ pher_export_line="Signal Export: failed (non-blocking)"
1055
+ fi
1056
+
1057
+ # Export standalone queen-wisdom.xml for cross-colony wisdom sharing
1058
+ wisdom_result=$(bash .aether/aether-utils.sh wisdom-export-xml ".aether/exchange/queen-wisdom.xml" 2>&1)
1059
+ wisdom_ok=$(echo "$wisdom_result" | jq -r '.ok // false' 2>/dev/null)
1060
+ if [[ "$wisdom_ok" == "true" ]]; then
1061
+ wisdom_count=$(echo "$wisdom_result" | jq -r '.result.entries // 0' 2>/dev/null)
1062
+ wisdom_export_line="Wisdom Export: queen-wisdom.xml (${wisdom_count} entries)"
1063
+ else
1064
+ wisdom_export_line="Wisdom Export: failed (non-blocking)"
1065
+ fi
1066
+
1067
+ # Export standalone colony-registry.xml for lineage tracking
1068
+ registry_result=$(bash .aether/aether-utils.sh registry-export-xml ".aether/exchange/colony-registry.xml" 2>&1)
1069
+ registry_ok=$(echo "$registry_result" | jq -r '.ok // false' 2>/dev/null)
1070
+ if [[ "$registry_ok" == "true" ]]; then
1071
+ registry_count=$(echo "$registry_result" | jq -r '.result.colonies // 0' 2>/dev/null)
1072
+ registry_export_line="Registry Export: colony-registry.xml (${registry_count} colonies)"
1073
+ else
1074
+ registry_export_line="Registry Export: failed (non-blocking)"
1075
+ fi
1076
+ else
1077
+ xml_export_line="XML Archive: skipped (xmllint not available)"
1078
+ pher_export_line="Signal Export: skipped (xmllint not available)"
1079
+ wisdom_export_line="Wisdom Export: skipped (xmllint not available)"
1080
+ registry_export_line="Registry Export: skipped (xmllint not available)"
1081
+ fi
1082
+ ```
1083
+
1084
+ ### Step 6: Display Result
1085
+
1086
+ Output:
1087
+ ```
1088
+ 🏺 ════════════════════════════════════════════════════
1089
+ C R O W N E D A N T H I L L v{colony_version}
1090
+ ══════════════════════════════════════════════════ 🏺
1091
+
1092
+ ✅ Colony archived successfully!
1093
+
1094
+ 👑 Goal: {goal (truncated to 60 chars)}
1095
+ 📍 Phases: {total_phases} completed
1096
+ 🏆 Milestone: Crowned Anthill v{colony_version}
1097
+
1098
+ 📦 Archive Location: {archive_dir}
1099
+ - COLONY_STATE.json
1100
+ - activity.log
1101
+ - spawn-tree.txt
1102
+ - flags.json (if existed)
1103
+ - constraints.json (if existed)
1104
+ {xml_export_line}
1105
+ {pher_export_line}
1106
+ {wisdom_export_line}
1107
+ {registry_export_line}
1108
+
1109
+ 🐜 The colony has reached its final form.
1110
+ The anthill stands crowned and sealed.
1111
+ History is preserved. The colony rests.
1112
+
1113
+ 💾 State persisted — safe to /clear
1114
+
1115
+ 🐜 What would you like to do next?
1116
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
1117
+ 2. /ant:tunnels — Browse archived colonies
1118
+ 3. /clear — Clear context and continue
1119
+
1120
+ Use AskUserQuestion with these three options.
1121
+
1122
+ If option 1 selected: proceed to run /ant:lay-eggs flow
1123
+ If option 2 selected: run /ant:tunnels
1124
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
1125
+ ```
1126
+
1127
+ ### Step 6.5: Commit Suggestion (Non-blocking)
1128
+
1129
+ After the ceremony, offer to commit all colony work.
1130
+
1131
+ **Gate check — skip silently if any fail:**
1132
+ 1. Not a git repo: `git rev-parse --git-dir 2>/dev/null` fails -> skip
1133
+ 2. Clean working tree: `git status --porcelain 2>/dev/null` is empty -> skip to Step 6.6
1134
+
1135
+ **If uncommitted changes exist:**
1136
+
1137
+ Generate a seal commit message:
1138
+ ```bash
1139
+ seal_commit=$(bash .aether/aether-utils.sh generate-commit-message seal "$phases_completed" "$goal" "$colony_age_days" 2>/dev/null)
1140
+ seal_message=$(echo "$seal_commit" | jq -r '.result.message // "aether-seal: colony sealed"')
1141
+ seal_body=$(echo "$seal_commit" | jq -r '.result.body // ""')
1142
+ ```
1143
+
1144
+ Display the suggestion:
1145
+ ```
1146
+ Commit suggestion:
1147
+ $seal_message
1148
+ $seal_body
1149
+ ```
1150
+
1151
+ Prompt with AskUserQuestion (3 options):
1152
+ 1. **Commit with this message** — Run `git add -A && git commit -m "$seal_message" -m "$seal_body"`
1153
+ 2. **Edit message** — Ask user for their preferred message, then commit with that
1154
+ 3. **Skip** — Do not commit
1155
+
1156
+ If the user chooses option 1 or 2 and the commit succeeds, set `seal_committed = true`.
1157
+ If the commit fails or user skips, set `seal_committed = false`.
1158
+
1159
+ **Error handling:** If `generate-commit-message` fails, fall back to message `"aether-seal: colony sealed"`. Never let commit suggestion failures stop the seal flow.
1160
+
1161
+ ### Step 6.6: Push Suggestion (Non-blocking)
1162
+
1163
+ Only show if a commit was just made in Step 6.5 (`seal_committed == true`) OR if there are unpushed commits.
1164
+
1165
+ **Gate check — skip silently if any fail:**
1166
+ 1. Not a git repo -> skip
1167
+ 2. No remote configured: `git remote -v 2>/dev/null` is empty -> skip
1168
+
1169
+ **Check for unpushed commits:**
1170
+ ```bash
1171
+ unpushed=$(git log --oneline @{u}..HEAD 2>/dev/null | wc -l | tr -d ' ')
1172
+ ```
1173
+ If `unpushed == 0` and `seal_committed == false` -> skip
1174
+
1175
+ **If there are commits to push:**
1176
+
1177
+ Detect current branch and upstream status:
1178
+ ```bash
1179
+ current_branch=$(git branch --show-current)
1180
+ has_upstream=$(git rev-parse --abbrev-ref @{u} 2>/dev/null && echo "yes" || echo "no")
1181
+ ```
1182
+
1183
+ Display: `Push {unpushed} commit(s) to remote? Branch: {current_branch}`
1184
+
1185
+ Prompt with AskUserQuestion (2 options):
1186
+ 1. **Push now** — If upstream exists: `git push`. If no upstream: `git push -u origin $current_branch`
1187
+ 2. **I'll push later** — Skip
1188
+
1189
+ Display result on success or skip.
1190
+
1191
+ **Error handling:** If push fails, display the error but do not stop the seal flow.
1192
+
1193
+ **Safety:** Never auto-push. Always require explicit user approval.
1194
+
1195
+ ### Edge Cases
1196
+
1197
+ **If milestone is already "Sealed Chambers" but phases are complete:**
1198
+ - Proceed with archiving and upgrade to Crowned Anthill
1199
+
1200
+ **If any archive files are missing:**
1201
+ - Archive what exists, note in manifest which files were missing
1202
+
1203
+ **If archive directory already exists:**
1204
+ - Append timestamp to make unique: `session_<ts>_archive_<random>`
1205
+