aether-colony 5.0.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/.aether/aether-utils.sh +3226 -3345
  2. package/.aether/agents-claude/aether-ambassador.md +265 -0
  3. package/.aether/agents-claude/aether-archaeologist.md +327 -0
  4. package/.aether/agents-claude/aether-architect.md +236 -0
  5. package/.aether/agents-claude/aether-auditor.md +271 -0
  6. package/.aether/agents-claude/aether-builder.md +224 -0
  7. package/.aether/agents-claude/aether-chaos.md +269 -0
  8. package/.aether/agents-claude/aether-chronicler.md +305 -0
  9. package/.aether/agents-claude/aether-gatekeeper.md +330 -0
  10. package/.aether/agents-claude/aether-includer.md +374 -0
  11. package/.aether/agents-claude/aether-keeper.md +272 -0
  12. package/.aether/agents-claude/aether-measurer.md +322 -0
  13. package/.aether/agents-claude/aether-oracle.md +237 -0
  14. package/.aether/agents-claude/aether-probe.md +211 -0
  15. package/.aether/agents-claude/aether-queen.md +330 -0
  16. package/.aether/agents-claude/aether-route-setter.md +178 -0
  17. package/.aether/agents-claude/aether-sage.md +418 -0
  18. package/.aether/agents-claude/aether-scout.md +179 -0
  19. package/.aether/agents-claude/aether-surveyor-disciplines.md +417 -0
  20. package/.aether/agents-claude/aether-surveyor-nest.md +355 -0
  21. package/.aether/agents-claude/aether-surveyor-pathogens.md +289 -0
  22. package/.aether/agents-claude/aether-surveyor-provisions.md +360 -0
  23. package/.aether/agents-claude/aether-tracker.md +270 -0
  24. package/.aether/agents-claude/aether-watcher.md +280 -0
  25. package/.aether/agents-claude/aether-weaver.md +248 -0
  26. package/.aether/commands/archaeology.yaml +653 -0
  27. package/.aether/commands/build.yaml +1221 -0
  28. package/.aether/commands/chaos.yaml +653 -0
  29. package/.aether/commands/colonize.yaml +442 -0
  30. package/.aether/commands/continue.yaml +1484 -0
  31. package/.aether/commands/council.yaml +509 -0
  32. package/.aether/commands/data-clean.yaml +80 -0
  33. package/.aether/commands/dream.yaml +275 -0
  34. package/.aether/commands/entomb.yaml +863 -0
  35. package/.aether/commands/export-signals.yaml +64 -0
  36. package/.aether/commands/feedback.yaml +158 -0
  37. package/.aether/commands/flag.yaml +160 -0
  38. package/.aether/commands/flags.yaml +177 -0
  39. package/.aether/commands/focus.yaml +112 -0
  40. package/.aether/commands/help.yaml +167 -0
  41. package/.aether/commands/history.yaml +137 -0
  42. package/.aether/commands/import-signals.yaml +79 -0
  43. package/.aether/commands/init.yaml +502 -0
  44. package/.aether/commands/insert-phase.yaml +102 -0
  45. package/.aether/commands/interpret.yaml +285 -0
  46. package/.aether/commands/lay-eggs.yaml +224 -0
  47. package/.aether/commands/maturity.yaml +122 -0
  48. package/.aether/commands/memory-details.yaml +74 -0
  49. package/.aether/commands/migrate-state.yaml +174 -0
  50. package/.aether/commands/oracle.yaml +1224 -0
  51. package/.aether/commands/organize.yaml +446 -0
  52. package/.aether/commands/patrol.yaml +621 -0
  53. package/.aether/commands/pause-colony.yaml +424 -0
  54. package/.aether/commands/phase.yaml +124 -0
  55. package/.aether/commands/pheromones.yaml +153 -0
  56. package/.aether/commands/plan.yaml +1364 -0
  57. package/.aether/commands/preferences.yaml +63 -0
  58. package/.aether/commands/quick.yaml +104 -0
  59. package/.aether/commands/redirect.yaml +123 -0
  60. package/.aether/commands/resume-colony.yaml +375 -0
  61. package/.aether/commands/resume.yaml +407 -0
  62. package/.aether/commands/run.yaml +229 -0
  63. package/.aether/commands/seal.yaml +1214 -0
  64. package/.aether/commands/skill-create.yaml +337 -0
  65. package/.aether/commands/status.yaml +408 -0
  66. package/.aether/commands/swarm.yaml +352 -0
  67. package/.aether/commands/tunnels.yaml +814 -0
  68. package/.aether/commands/update.yaml +131 -0
  69. package/.aether/commands/verify-castes.yaml +159 -0
  70. package/.aether/commands/watch.yaml +454 -0
  71. package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
  72. package/.aether/docs/QUEEN-SYSTEM.md +11 -11
  73. package/.aether/docs/README.md +32 -2
  74. package/.aether/docs/command-playbooks/README.md +23 -0
  75. package/.aether/docs/command-playbooks/build-complete.md +349 -0
  76. package/.aether/docs/command-playbooks/build-context.md +282 -0
  77. package/.aether/docs/command-playbooks/build-full.md +1683 -0
  78. package/.aether/docs/command-playbooks/build-prep.md +284 -0
  79. package/.aether/docs/command-playbooks/build-verify.md +405 -0
  80. package/.aether/docs/command-playbooks/build-wave.md +749 -0
  81. package/.aether/docs/command-playbooks/continue-advance.md +524 -0
  82. package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
  83. package/.aether/docs/command-playbooks/continue-full.md +1725 -0
  84. package/.aether/docs/command-playbooks/continue-gates.md +686 -0
  85. package/.aether/docs/command-playbooks/continue-verify.md +407 -0
  86. package/.aether/docs/context-continuity.md +84 -0
  87. package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
  88. package/.aether/docs/error-codes.md +1 -1
  89. package/.aether/docs/known-issues.md +34 -173
  90. package/.aether/docs/pheromones.md +86 -6
  91. package/.aether/docs/plans/pheromone-display-plan.md +257 -0
  92. package/.aether/docs/queen-commands.md +10 -9
  93. package/.aether/docs/source-of-truth-map.md +132 -0
  94. package/.aether/docs/xml-utilities.md +47 -0
  95. package/.aether/rules/aether-colony.md +23 -13
  96. package/.aether/scripts/incident-test-add.sh +47 -0
  97. package/.aether/scripts/weekly-audit.sh +79 -0
  98. package/.aether/skills/.index.json +649 -0
  99. package/.aether/skills/colony/.manifest.json +16 -0
  100. package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
  101. package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
  102. package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
  103. package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
  104. package/.aether/skills/colony/context-management/SKILL.md +80 -0
  105. package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
  106. package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
  107. package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
  108. package/.aether/skills/colony/state-safety/SKILL.md +84 -0
  109. package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
  110. package/.aether/skills/domain/.manifest.json +24 -0
  111. package/.aether/skills/domain/README.md +33 -0
  112. package/.aether/skills/domain/django/SKILL.md +49 -0
  113. package/.aether/skills/domain/docker/SKILL.md +52 -0
  114. package/.aether/skills/domain/golang/SKILL.md +52 -0
  115. package/.aether/skills/domain/graphql/SKILL.md +51 -0
  116. package/.aether/skills/domain/html-css/SKILL.md +48 -0
  117. package/.aether/skills/domain/nextjs/SKILL.md +45 -0
  118. package/.aether/skills/domain/nodejs/SKILL.md +53 -0
  119. package/.aether/skills/domain/postgresql/SKILL.md +53 -0
  120. package/.aether/skills/domain/prisma/SKILL.md +59 -0
  121. package/.aether/skills/domain/python/SKILL.md +50 -0
  122. package/.aether/skills/domain/rails/SKILL.md +52 -0
  123. package/.aether/skills/domain/react/SKILL.md +45 -0
  124. package/.aether/skills/domain/rest-api/SKILL.md +58 -0
  125. package/.aether/skills/domain/svelte/SKILL.md +47 -0
  126. package/.aether/skills/domain/tailwind/SKILL.md +45 -0
  127. package/.aether/skills/domain/testing/SKILL.md +53 -0
  128. package/.aether/skills/domain/typescript/SKILL.md +58 -0
  129. package/.aether/skills/domain/vue/SKILL.md +49 -0
  130. package/.aether/templates/QUEEN.md.template +23 -41
  131. package/.aether/templates/colony-state-reset.jq.template +1 -0
  132. package/.aether/templates/colony-state.template.json +4 -0
  133. package/.aether/templates/learning-observations.template.json +6 -0
  134. package/.aether/templates/midden.template.json +13 -0
  135. package/.aether/templates/pheromones.template.json +6 -0
  136. package/.aether/templates/session.template.json +9 -0
  137. package/.aether/utils/atomic-write.sh +63 -17
  138. package/.aether/utils/chamber-utils.sh +145 -2
  139. package/.aether/utils/council.sh +425 -0
  140. package/.aether/utils/emoji-audit.sh +166 -0
  141. package/.aether/utils/error-handler.sh +21 -7
  142. package/.aether/utils/file-lock.sh +182 -27
  143. package/.aether/utils/flag.sh +278 -0
  144. package/.aether/utils/hive.sh +572 -0
  145. package/.aether/utils/immune.sh +508 -0
  146. package/.aether/utils/learning.sh +1928 -0
  147. package/.aether/utils/midden.sh +520 -0
  148. package/.aether/utils/oracle/oracle.md +168 -0
  149. package/.aether/utils/oracle/oracle.sh +1023 -0
  150. package/.aether/utils/pheromone.sh +2029 -0
  151. package/.aether/utils/queen.sh +1710 -0
  152. package/.aether/utils/scan.sh +860 -0
  153. package/.aether/utils/semantic-cli.sh +10 -8
  154. package/.aether/utils/session.sh +816 -0
  155. package/.aether/utils/skills.sh +509 -0
  156. package/.aether/utils/spawn-tree.sh +103 -271
  157. package/.aether/utils/spawn.sh +260 -0
  158. package/.aether/utils/state-api.sh +389 -0
  159. package/.aether/utils/state-loader.sh +8 -6
  160. package/.aether/utils/suggest.sh +611 -0
  161. package/.aether/utils/swarm-display.sh +10 -1
  162. package/.aether/utils/swarm.sh +1004 -0
  163. package/.aether/utils/watch-spawn-tree.sh +11 -2
  164. package/.aether/utils/xml-compose.sh +2 -2
  165. package/.aether/utils/xml-convert.sh +9 -5
  166. package/.aether/utils/xml-core.sh +5 -9
  167. package/.aether/utils/xml-query.sh +4 -4
  168. package/.aether/workers.md +86 -67
  169. package/.claude/agents/ant/aether-ambassador.md +2 -1
  170. package/.claude/agents/ant/aether-archaeologist.md +6 -1
  171. package/.claude/agents/ant/aether-architect.md +236 -0
  172. package/.claude/agents/ant/aether-auditor.md +6 -1
  173. package/.claude/agents/ant/aether-builder.md +38 -1
  174. package/.claude/agents/ant/aether-chaos.md +2 -1
  175. package/.claude/agents/ant/aether-chronicler.md +1 -0
  176. package/.claude/agents/ant/aether-gatekeeper.md +6 -1
  177. package/.claude/agents/ant/aether-includer.md +1 -0
  178. package/.claude/agents/ant/aether-keeper.md +1 -0
  179. package/.claude/agents/ant/aether-measurer.md +6 -1
  180. package/.claude/agents/ant/aether-oracle.md +237 -0
  181. package/.claude/agents/ant/aether-probe.md +2 -1
  182. package/.claude/agents/ant/aether-queen.md +6 -1
  183. package/.claude/agents/ant/aether-route-setter.md +6 -1
  184. package/.claude/agents/ant/aether-sage.md +68 -3
  185. package/.claude/agents/ant/aether-scout.md +38 -1
  186. package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
  187. package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
  188. package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
  189. package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
  190. package/.claude/agents/ant/aether-tracker.md +6 -1
  191. package/.claude/agents/ant/aether-watcher.md +37 -1
  192. package/.claude/agents/ant/aether-weaver.md +2 -1
  193. package/.claude/commands/ant/archaeology.md +1 -8
  194. package/.claude/commands/ant/build.md +43 -1159
  195. package/.claude/commands/ant/chaos.md +1 -14
  196. package/.claude/commands/ant/colonize.md +3 -14
  197. package/.claude/commands/ant/continue.md +40 -1026
  198. package/.claude/commands/ant/council.md +213 -15
  199. package/.claude/commands/ant/data-clean.md +81 -0
  200. package/.claude/commands/ant/dream.md +12 -9
  201. package/.claude/commands/ant/entomb.md +62 -87
  202. package/.claude/commands/ant/export-signals.md +57 -0
  203. package/.claude/commands/ant/feedback.md +18 -0
  204. package/.claude/commands/ant/flag.md +12 -0
  205. package/.claude/commands/ant/flags.md +22 -8
  206. package/.claude/commands/ant/focus.md +18 -0
  207. package/.claude/commands/ant/help.md +40 -8
  208. package/.claude/commands/ant/history.md +3 -0
  209. package/.claude/commands/ant/import-signals.md +71 -0
  210. package/.claude/commands/ant/init.md +349 -191
  211. package/.claude/commands/ant/insert-phase.md +105 -0
  212. package/.claude/commands/ant/interpret.md +11 -0
  213. package/.claude/commands/ant/lay-eggs.md +167 -158
  214. package/.claude/commands/ant/maturity.md +22 -11
  215. package/.claude/commands/ant/memory-details.md +77 -0
  216. package/.claude/commands/ant/migrate-state.md +6 -0
  217. package/.claude/commands/ant/oracle.md +317 -62
  218. package/.claude/commands/ant/organize.md +10 -5
  219. package/.claude/commands/ant/patrol.md +620 -0
  220. package/.claude/commands/ant/pause-colony.md +8 -22
  221. package/.claude/commands/ant/phase.md +26 -37
  222. package/.claude/commands/ant/pheromones.md +156 -0
  223. package/.claude/commands/ant/plan.md +199 -50
  224. package/.claude/commands/ant/preferences.md +65 -0
  225. package/.claude/commands/ant/quick.md +100 -0
  226. package/.claude/commands/ant/redirect.md +18 -0
  227. package/.claude/commands/ant/resume-colony.md +37 -22
  228. package/.claude/commands/ant/resume.md +60 -7
  229. package/.claude/commands/ant/run.md +231 -0
  230. package/.claude/commands/ant/seal.md +506 -78
  231. package/.claude/commands/ant/skill-create.md +286 -0
  232. package/.claude/commands/ant/status.md +171 -1
  233. package/.claude/commands/ant/swarm.md +11 -23
  234. package/.claude/commands/ant/tunnels.md +1 -0
  235. package/.claude/commands/ant/update.md +58 -135
  236. package/.claude/commands/ant/verify-castes.md +90 -42
  237. package/.claude/commands/ant/watch.md +1 -0
  238. package/.opencode/agents/aether-ambassador.md +1 -1
  239. package/.opencode/agents/aether-architect.md +133 -0
  240. package/.opencode/agents/aether-builder.md +3 -3
  241. package/.opencode/agents/aether-oracle.md +137 -0
  242. package/.opencode/agents/aether-queen.md +1 -1
  243. package/.opencode/agents/aether-route-setter.md +1 -1
  244. package/.opencode/agents/aether-scout.md +1 -1
  245. package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
  246. package/.opencode/agents/aether-surveyor-nest.md +6 -1
  247. package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
  248. package/.opencode/agents/aether-surveyor-provisions.md +6 -1
  249. package/.opencode/agents/aether-tracker.md +1 -1
  250. package/.opencode/agents/aether-watcher.md +1 -1
  251. package/.opencode/agents/aether-weaver.md +1 -1
  252. package/.opencode/commands/ant/archaeology.md +7 -14
  253. package/.opencode/commands/ant/build.md +54 -88
  254. package/.opencode/commands/ant/chaos.md +7 -24
  255. package/.opencode/commands/ant/colonize.md +10 -17
  256. package/.opencode/commands/ant/continue.md +595 -66
  257. package/.opencode/commands/ant/council.md +150 -18
  258. package/.opencode/commands/ant/data-clean.md +77 -0
  259. package/.opencode/commands/ant/dream.md +15 -17
  260. package/.opencode/commands/ant/entomb.md +28 -18
  261. package/.opencode/commands/ant/export-signals.md +54 -0
  262. package/.opencode/commands/ant/feedback.md +24 -5
  263. package/.opencode/commands/ant/flag.md +16 -4
  264. package/.opencode/commands/ant/flags.md +24 -10
  265. package/.opencode/commands/ant/focus.md +22 -5
  266. package/.opencode/commands/ant/help.md +41 -8
  267. package/.opencode/commands/ant/history.md +9 -0
  268. package/.opencode/commands/ant/import-signals.md +68 -0
  269. package/.opencode/commands/ant/init.md +396 -154
  270. package/.opencode/commands/ant/insert-phase.md +111 -0
  271. package/.opencode/commands/ant/interpret.md +16 -0
  272. package/.opencode/commands/ant/lay-eggs.md +184 -112
  273. package/.opencode/commands/ant/maturity.md +18 -2
  274. package/.opencode/commands/ant/memory-details.md +83 -0
  275. package/.opencode/commands/ant/migrate-state.md +12 -0
  276. package/.opencode/commands/ant/oracle.md +322 -67
  277. package/.opencode/commands/ant/organize.md +14 -12
  278. package/.opencode/commands/ant/patrol.md +626 -0
  279. package/.opencode/commands/ant/pause-colony.md +12 -29
  280. package/.opencode/commands/ant/phase.md +30 -40
  281. package/.opencode/commands/ant/pheromones.md +162 -0
  282. package/.opencode/commands/ant/plan.md +210 -57
  283. package/.opencode/commands/ant/preferences.md +71 -0
  284. package/.opencode/commands/ant/quick.md +91 -0
  285. package/.opencode/commands/ant/redirect.md +22 -5
  286. package/.opencode/commands/ant/resume-colony.md +41 -29
  287. package/.opencode/commands/ant/resume.md +80 -20
  288. package/.opencode/commands/ant/run.md +237 -0
  289. package/.opencode/commands/ant/seal.md +230 -25
  290. package/.opencode/commands/ant/skill-create.md +63 -0
  291. package/.opencode/commands/ant/status.md +125 -30
  292. package/.opencode/commands/ant/swarm.md +3 -345
  293. package/.opencode/commands/ant/tunnels.md +3 -9
  294. package/.opencode/commands/ant/update.md +63 -127
  295. package/.opencode/commands/ant/verify-castes.md +96 -42
  296. package/.opencode/commands/ant/watch.md +7 -0
  297. package/CHANGELOG.md +368 -1
  298. package/README.md +195 -324
  299. package/bin/cli.js +236 -429
  300. package/bin/generate-commands.js +186 -0
  301. package/bin/generate-commands.sh +128 -89
  302. package/bin/lib/spawn-logger.js +0 -15
  303. package/bin/lib/update-transaction.js +285 -35
  304. package/bin/npx-install.js +178 -0
  305. package/bin/validate-package.sh +85 -3
  306. package/package.json +16 -4
  307. package/.aether/CONTEXT.md +0 -160
  308. package/.aether/docs/QUEEN.md +0 -84
  309. package/.aether/exchange/colony-registry.xml +0 -11
  310. package/.aether/exchange/pheromones.xml +0 -87
  311. package/.aether/exchange/queen-wisdom.xml +0 -14
  312. package/.aether/model-profiles.yaml +0 -100
  313. package/.aether/utils/spawn-with-model.sh +0 -56
  314. package/bin/lib/model-profiles.js +0 -445
  315. package/bin/lib/model-verify.js +0 -288
  316. package/bin/lib/proxy-health.js +0 -253
  317. package/bin/lib/telemetry.js +0 -441
@@ -0,0 +1,863 @@
1
+ name: "ant:entomb"
2
+ description: "⚰️🐜⚰️ Entomb completed colony in chambers"
3
+ body_claude: |
4
+ You are the **Queen**. Archive the sealed colony to chambers.
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
+ ### Archive Write Failure
14
+ If writing to chambers/ archive fails partway:
15
+ - Do NOT delete source data (the active colony) until archive is verified
16
+ - Report what was archived vs. what failed
17
+ - Recovery: the original colony data is intact -- user can retry
18
+
19
+ ### Seal Verification Failure
20
+ If the colony was not properly sealed before entomb:
21
+ - STOP -- do not archive an incomplete colony
22
+ - Direct user to run /ant:seal first
23
+ - This is a hard gate, not a suggestion
24
+
25
+ ### Chamber Naming Conflict
26
+ If the target chamber directory already exists:
27
+ - STOP -- do not overwrite an existing archive
28
+ - Report the conflict
29
+ - Options: (1) Use a different name, (2) Merge with existing, (3) Cancel
30
+ </failure_modes>
31
+
32
+ <success_criteria>
33
+ Command is complete when:
34
+ - Colony data is fully copied to chambers/ archive directory
35
+ - Archive integrity is verified (all expected files present)
36
+ - Active colony state is cleared only after archive verification
37
+ - User sees confirmation with archive location
38
+ </success_criteria>
39
+
40
+ <read_only>
41
+ Do not touch during entomb:
42
+ - .aether/dreams/ (user notes -- not archived)
43
+ - Source code files
44
+ - .env* files
45
+ - .claude/settings.json
46
+ - .github/workflows/
47
+ - Other chamber directories (only write to the new chamber)
48
+ </read_only>
49
+
50
+ ### Step 0: Initialize Visual Mode (if enabled)
51
+
52
+ If `visual_mode` is true:
53
+ ### Step 1: Read State
54
+
55
+ Read `.aether/data/COLONY_STATE.json`.
56
+
57
+ If file missing or `goal: null`:
58
+ ```
59
+ No colony to entomb. Run /ant:init first.
60
+ ```
61
+ Stop here.
62
+
63
+ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `milestone`, `version`, `initialized_at`, `memory.decisions`, `memory.phase_learnings`, `memory.instincts`.
64
+
65
+ Read `colony_version` for display (default to 1 for backward compat with older colonies):
66
+ ```bash
67
+ colony_version=$(jq -r '.colony_version // 1' .aether/data/COLONY_STATE.json 2>/dev/null || echo 1)
68
+ [[ "$colony_version" =~ ^[0-9]+$ ]] || colony_version=1
69
+ ```
70
+
71
+ ### Step 2: Seal-First Enforcement
72
+
73
+ Check `milestone` in COLONY_STATE.json.
74
+
75
+ **If milestone != "Crowned Anthill":**
76
+ ```
77
+ Colony has not been sealed.
78
+
79
+ Current milestone: {milestone}
80
+ Required: Crowned Anthill
81
+
82
+ Run /ant:seal first to complete the sealing ceremony.
83
+ ```
84
+ Stop here.
85
+
86
+ **Belt-and-suspenders:** Also check `.aether/CROWNED-ANTHILL.md` exists. If milestone is Crowned Anthill but file is missing:
87
+ ```
88
+ CROWNED-ANTHILL.md not found — seal may have been interrupted. Run /ant:seal again.
89
+ ```
90
+ Stop here.
91
+
92
+ ### Step 3: User Confirmation
93
+
94
+ Show what will be archived:
95
+ ```
96
+ ENTOMB COLONY
97
+
98
+ Goal: {goal}
99
+ Version: v{colony_version}
100
+ Milestone: Crowned Anthill
101
+ Phases: {phases_completed} of {total_phases}
102
+
103
+ This will:
104
+ - Archive ALL colony data to .aether/chambers/
105
+ - Copy CROWNED-ANTHILL.md, pheromones, dreams, session data
106
+ - Promote colony wisdom to QUEEN.md (cross-generational learning)
107
+ - Reset COLONY_STATE.json for a fresh start
108
+ - Clear session data
109
+
110
+ This action is permanent. The archived colony can be browsed via /ant:tunnels.
111
+
112
+ Entomb this colony? (yes/no)
113
+ ```
114
+
115
+ Use `AskUserQuestion with yes/no options`.
116
+
117
+ If not "yes":
118
+ ```
119
+ Entombment cancelled. Colony remains active.
120
+ ```
121
+ Stop here.
122
+
123
+ ### Step 3.25: Wisdom Approval
124
+
125
+ Before archiving, review wisdom proposals accumulated during this colony's lifecycle.
126
+
127
+ ```bash
128
+ # Check for pending proposals
129
+ proposals=$(bash .aether/aether-utils.sh learning-check-promotion 2>/dev/null || echo '{"proposals":[]}')
130
+ proposal_count=$(echo "$proposals" | jq '.proposals | length')
131
+
132
+ if [[ "$proposal_count" -gt 0 ]]; then
133
+ echo ""
134
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
135
+ echo " 🧠 FINAL WISDOM REVIEW"
136
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
137
+ echo ""
138
+ echo "Review wisdom proposals before archiving this colony."
139
+ echo "Approved proposals will be promoted to QUEEN.md."
140
+ echo ""
141
+
142
+ # Run approval workflow (blocking)
143
+ bash .aether/aether-utils.sh learning-approve-proposals
144
+
145
+ echo ""
146
+ echo "Wisdom review complete. Proceeding with entombment..."
147
+ echo ""
148
+ else
149
+ echo "No wisdom proposals to review."
150
+ fi
151
+ ```
152
+
153
+ ### Step 3.5: Check XML Tools
154
+
155
+ XML archiving is required for entombment. Check tool availability before proceeding.
156
+ Uses `command -v xmllint` directly — consistent with seal.md's tool check.
157
+
158
+ ```bash
159
+ if command -v xmllint >/dev/null 2>&1; then
160
+ xmllint_available=true
161
+ else
162
+ xmllint_available=false
163
+ fi
164
+ ```
165
+
166
+ **If xmllint is NOT available:**
167
+
168
+ Ask the user:
169
+ ```
170
+ xmllint is not installed — XML archiving requires it.
171
+
172
+ Install now?
173
+ - macOS: xcode-select --install (or brew install libxml2)
174
+ - Linux: apt-get install libxml2-utils
175
+
176
+ Install xmllint? (yes/no)
177
+ ```
178
+
179
+ Use AskUserQuestion with yes/no options.
180
+
181
+ If yes:
182
+ - On macOS: Run `xcode-select --install` or `brew install libxml2`
183
+ - On Linux: Run `sudo apt-get install -y libxml2-utils`
184
+ - After install attempt, re-check: `command -v xmllint >/dev/null 2>&1`
185
+ - If still not available after install:
186
+ ```
187
+ xmllint installation failed. Cannot entomb without XML archiving.
188
+ Install xmllint manually and try again.
189
+ ```
190
+ Stop here.
191
+
192
+ If no:
193
+ ```
194
+ Entombment requires XML archiving. Install xmllint and try again.
195
+ ```
196
+ Stop here.
197
+
198
+ ### Step 4: Ensure QUEEN.md Exists
199
+
200
+ Verify QUEEN.md is initialized for wisdom storage:
201
+
202
+ ```bash
203
+ queen_file=".aether/QUEEN.md"
204
+ if [[ ! -f "$queen_file" ]]; then
205
+ init_result=$(bash .aether/aether-utils.sh queen-init 2>/dev/null || echo '{"ok":false}')
206
+ init_ok=$(echo "$init_result" | jq -r '.ok // false')
207
+ if [[ "$init_ok" == "true" ]]; then
208
+ created=$(echo "$init_result" | jq -r '.result.created // false')
209
+ if [[ "$created" == "true" ]]; then
210
+ bash .aether/aether-utils.sh activity-log "CREATED" "Queen" "Initialized QUEEN.md for wisdom storage"
211
+ fi
212
+ fi
213
+ fi
214
+ ```
215
+
216
+ ### Step 5: Generate Chamber Name
217
+
218
+ Date-first naming:
219
+ ```bash
220
+ date_prefix=$(date -u +%Y-%m-%d)
221
+ sanitized_goal=$(echo "$goal" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//;s/-$//' | cut -c1-40)
222
+ chamber_name="${date_prefix}-${sanitized_goal}"
223
+ ```
224
+
225
+ Collision handling:
226
+ ```bash
227
+ counter=1
228
+ original_name="$chamber_name"
229
+ while [[ -d ".aether/chambers/$chamber_name" ]]; do
230
+ chamber_name="${original_name}-${counter}"
231
+ counter=$((counter + 1))
232
+ done
233
+ ```
234
+
235
+ ### Step 6: Create Chamber
236
+
237
+ Extract decisions and learnings as JSON arrays:
238
+ ```bash
239
+ decisions_json=$(jq -c '.memory.decisions // []' .aether/data/COLONY_STATE.json)
240
+ learnings_json=$(jq -c '.memory.phase_learnings // []' .aether/data/COLONY_STATE.json)
241
+ phases_completed=$(jq '[.plan.phases[] | select(.status == "completed")] | length' .aether/data/COLONY_STATE.json)
242
+ total_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
243
+ version=$(jq -r '.version // "3.0"' .aether/data/COLONY_STATE.json)
244
+ ```
245
+
246
+ Create the chamber:
247
+ ```bash
248
+ bash .aether/aether-utils.sh chamber-create \
249
+ ".aether/chambers/$chamber_name" \
250
+ ".aether/data/COLONY_STATE.json" \
251
+ "$goal" \
252
+ "$phases_completed" \
253
+ "$total_phases" \
254
+ "$milestone" \
255
+ "$version" \
256
+ "$decisions_json" \
257
+ "$learnings_json"
258
+ ```
259
+
260
+ ### Step 7: Archive Additional Files
261
+
262
+ AFTER chamber-create succeeds, copy additional data files:
263
+ ```bash
264
+ chamber_dir=".aether/chambers/$chamber_name"
265
+
266
+ # Archive data files (if they exist)
267
+ for f in pheromones.json session.json activity.log flags.json constraints.json spawn-tree.txt timing.log view-state.json; do
268
+ [[ -f ".aether/data/$f" ]] && cp ".aether/data/$f" "$chamber_dir/" 2>/dev/null || true
269
+ done
270
+
271
+ # Archive seal document (critical — this is the ceremony record)
272
+ [[ -f ".aether/CROWNED-ANTHILL.md" ]] && cp ".aether/CROWNED-ANTHILL.md" "$chamber_dir/"
273
+
274
+ # Archive HANDOFF.md if it exists
275
+ [[ -f ".aether/HANDOFF.md" ]] && cp ".aether/HANDOFF.md" "$chamber_dir/"
276
+
277
+ # Archive dreams directory (optional — may not exist)
278
+ [[ -d ".aether/dreams" ]] && cp -r ".aether/dreams" "$chamber_dir/dreams" 2>/dev/null || true
279
+
280
+ # Archive XML exchange files to chamber (per D-04, D-05)
281
+ xml_archived=0
282
+ for xml_file in .aether/exchange/*.xml; do
283
+ [[ -f "$xml_file" ]] && cp "$xml_file" "$chamber_dir/" && xml_archived=$((xml_archived + 1))
284
+ done
285
+ if [[ "$xml_archived" -gt 0 ]]; then
286
+ echo "XML Archive: ${xml_archived} exchange file(s) copied to chamber"
287
+ fi
288
+ ```
289
+
290
+ Do NOT copy: `.aether/data/backups/`, `.aether/data/locks/`, `.aether/data/midden/`, `.aether/data/survey/`.
291
+
292
+ ### Step 7.5: Export XML Archive (hard-stop)
293
+
294
+ Export combined XML archive to the chamber. This is a HARD REQUIREMENT — entomb fails if XML export fails.
295
+
296
+ ```bash
297
+ chamber_dir=".aether/chambers/$chamber_name"
298
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml "$chamber_dir/colony-archive.xml" 2>&1)
299
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
300
+
301
+ if [[ "$xml_ok" != "true" ]]; then
302
+ # HARD STOP — remove the chamber and abort
303
+ rm -rf "$chamber_dir"
304
+ echo "XML archive export failed. Colony NOT entombed."
305
+ echo ""
306
+ echo "Error: $(echo "$xml_result" | jq -r '.error // "Unknown error"' 2>/dev/null)"
307
+ echo ""
308
+ echo "The chamber has been cleaned up. Fix the XML issue and try again."
309
+ # Do NOT proceed to state reset or any further steps
310
+ fi
311
+ ```
312
+
313
+ If xml_ok is true, store for display:
314
+ ```bash
315
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
316
+ xml_exchange_count=$(find .aether/exchange -maxdepth 1 -name "*.xml" 2>/dev/null | wc -l | tr -d ' ')
317
+ xml_archive_line="XML Archive: colony-archive.xml (${xml_pheromone_count} signals) + ${xml_exchange_count} exchange file(s)"
318
+ ```
319
+
320
+ **Critical behavior:** If XML export fails, entomb STOPS. The chamber directory is removed (cleanup). The colony state is NOT reset. The user sees a clear error and can retry after fixing the issue.
321
+
322
+ ### Step 8: Verify Chamber Integrity
323
+
324
+ Run verification:
325
+ ```bash
326
+ bash .aether/aether-utils.sh chamber-verify ".aether/chambers/$chamber_name"
327
+ ```
328
+
329
+ If verification fails, display error and stop:
330
+ ```
331
+ Chamber verification failed.
332
+
333
+ Error: {verification_error}
334
+
335
+ The colony has NOT been reset. Please check the chamber directory:
336
+ .aether/chambers/{chamber_name}/
337
+ ```
338
+ Stop here.
339
+
340
+ ### Step 9: Record in Eternal Memory
341
+
342
+ Write colony summary to eternal memory:
343
+ ```bash
344
+ bash .aether/aether-utils.sh eternal-init # idempotent
345
+ eternal_file="$HOME/.aether/eternal/memory.json"
346
+ if [[ -f "$eternal_file" ]]; then
347
+ colony_entry=$(jq -n \
348
+ --arg goal "$goal" \
349
+ --arg milestone "$milestone" \
350
+ --arg sealed_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
351
+ --arg chamber ".aether/chambers/$chamber_name" \
352
+ '{goal: $goal, milestone: $milestone, sealed_at: $sealed_at, chamber: $chamber}')
353
+ tmp_eternal="$(mktemp /tmp/aether-eternal.XXXXXX)"
354
+ jq --argjson colony_entry "$colony_entry" '.colonies = ((.colonies // []) + [$colony_entry])' "$eternal_file" > "$tmp_eternal" \
355
+ && mv "$tmp_eternal" "$eternal_file"
356
+ fi
357
+ ```
358
+
359
+ ### Step 10: Reset Colony State
360
+
361
+ Backup current state:
362
+ ```bash
363
+ cp .aether/data/COLONY_STATE.json .aether/data/COLONY_STATE.json.bak
364
+ ```
365
+
366
+ Reset state, clearing everything including promoted wisdom (already in QUEEN.md):
367
+ ```bash
368
+ # Resolve jq template path (hub-first)
369
+ jq_template=""
370
+ for path in \
371
+ "$HOME/.aether/system/templates/colony-state-reset.jq.template" \
372
+ ".aether/templates/colony-state-reset.jq.template"; do
373
+ if [[ -f "$path" ]]; then
374
+ jq_template="$path"
375
+ break
376
+ fi
377
+ done
378
+
379
+ if [[ -z "$jq_template" ]]; then
380
+ echo "Template missing: colony-state-reset.jq.template. Run aether update to fix."
381
+ exit 1
382
+ fi
383
+
384
+ jq -f "$jq_template" .aether/data/COLONY_STATE.json.bak > .aether/data/COLONY_STATE.json
385
+ ```
386
+
387
+ Verify reset succeeded:
388
+ ```bash
389
+ new_goal=$(jq -r '.goal' .aether/data/COLONY_STATE.json)
390
+ if [[ "$new_goal" != "null" ]]; then
391
+ # Restore from backup
392
+ mv .aether/data/COLONY_STATE.json.bak .aether/data/COLONY_STATE.json
393
+ echo "Error: State reset failed. Restored from backup."
394
+ exit 1
395
+ fi
396
+ ```
397
+
398
+ Remove backup after successful reset:
399
+ ```bash
400
+ rm -f .aether/data/COLONY_STATE.json.bak
401
+ ```
402
+
403
+ Clear session data:
404
+ ```bash
405
+ rm -f .aether/data/session.json
406
+ ```
407
+
408
+ Clean up seal document (it's now in the chamber):
409
+ ```bash
410
+ rm -f .aether/CROWNED-ANTHILL.md
411
+ ```
412
+
413
+ Clean up exchange XML files (now archived in chamber per D-06):
414
+ ```bash
415
+ rm -f .aether/exchange/*.xml 2>/dev/null || true
416
+ ```
417
+
418
+ ### Step 11: Write HANDOFF.md
419
+
420
+ Write handoff documenting the entombed colony:
421
+
422
+ Resolve the handoff template path:
423
+ Check ~/.aether/system/templates/handoff.template.md first,
424
+ then .aether/templates/handoff.template.md.
425
+
426
+ If no template found: output "Template missing: handoff.template.md. Run aether update to fix." and stop.
427
+
428
+ Read the template file. Fill all {{PLACEHOLDER}} values:
429
+ - {{CHAMBER_NAME}} → chamber_name
430
+ - {{GOAL}} → goal
431
+ - {{PHASES_COMPLETED}} → phases completed count
432
+ - {{TOTAL_PHASES}} → total phases count
433
+ - {{MILESTONE}} → milestone
434
+ - {{ENTOMB_TIMESTAMP}} → current ISO-8601 UTC timestamp
435
+
436
+ Remove the HTML comment lines at the top of the template.
437
+ Write the result to .aether/HANDOFF.md using the Write tool.
438
+
439
+ ### Step 12: Display Result
440
+
441
+ Display:
442
+ ```
443
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
444
+ C O L O N Y E N T O M B E D
445
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
446
+
447
+ Entombed v{colony_version}
448
+
449
+ Goal: {goal}
450
+ Phases: {completed} completed
451
+ Milestone: {milestone}
452
+
453
+ Chamber: .aether/chambers/{chamber_name}/
454
+ {xml_archive_line}
455
+
456
+ The colony rests. Its learnings live on in QUEEN.md.
457
+
458
+ ──────────────────────────────────────────────────
459
+ 🐜 Next Up
460
+ ──────────────────────────────────────────────────
461
+ /ant:lay-eggs 🥚 Start a new colony
462
+ /ant:tunnels 🗄️ Browse archived chambers
463
+ ```
464
+
465
+ What would you like to do next?
466
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
467
+ 2. /ant:tunnels — Browse archived colonies
468
+ 3. /clear — Clear context and continue
469
+
470
+ Use AskUserQuestion with these three options.
471
+
472
+ If option 1 selected: proceed to run /ant:lay-eggs flow
473
+ If option 2 selected: run /ant:tunnels
474
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
475
+ ```
476
+
477
+ ### Edge Cases
478
+
479
+ **Colony not sealed:**
480
+ - Refuse with guidance to run /ant:seal first. This is the primary gate.
481
+
482
+ **Chamber name collision:**
483
+ - Automatically append counter to make unique.
484
+
485
+ **Missing files during archive:**
486
+ - Note in output but continue with available files. The `|| true` in the copy loop handles this.
487
+
488
+ **State reset failure:**
489
+ - Restore from backup, display error, do not claim success.
490
+
491
+ **Empty phases array:**
492
+ - Can entomb a colony that was initialized but had no phases planned (treat as 0 of 0 completed).
493
+
494
+ **Missing CROWNED-ANTHILL.md:**
495
+ - Refuse with guidance to run /ant:seal again.
496
+
497
+ body_opencode: |
498
+ You are the **Queen**. Archive the completed colony to chambers.
499
+
500
+ ## Instructions
501
+
502
+ Parse `$normalized_args`:
503
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
504
+ - Otherwise: set `visual_mode = true`
505
+
506
+ ### Step 1: Read State
507
+
508
+ Read `.aether/data/COLONY_STATE.json`.
509
+
510
+ If file missing or `goal: null`:
511
+ ```
512
+ No colony to entomb. Run /ant:init first.
513
+ ```
514
+ Stop here.
515
+
516
+ ### Step 2: Validate Colony Can Be Entombed
517
+
518
+ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `memory.decisions`, `memory.phase_learnings`.
519
+
520
+ Read `colony_version` for display (default to 1 for backward compat with older colonies):
521
+ ```bash
522
+ colony_version=$(jq -r '.colony_version // 1' .aether/data/COLONY_STATE.json 2>/dev/null || echo 1)
523
+ [[ "$colony_version" =~ ^[0-9]+$ ]] || colony_version=1
524
+ ```
525
+
526
+ **Precondition 1: All phases must be completed**
527
+
528
+ Check if all phases in `plan.phases` have `status: "completed"`:
529
+ ```
530
+ all_completed = all(phase.status == "completed" for phase in plan.phases)
531
+ ```
532
+
533
+ If NOT all completed:
534
+ ```
535
+ Cannot entomb incomplete colony.
536
+
537
+ Completed phases: X of Y
538
+ Remaining: {list of incomplete phase names}
539
+
540
+ Run /ant:continue to complete remaining phases first.
541
+ ```
542
+ Stop here.
543
+
544
+ **Precondition 2: State must not be EXECUTING**
545
+
546
+ If `state == "EXECUTING"`:
547
+ ```
548
+ Colony is still executing. Run /ant:continue to reconcile first.
549
+ ```
550
+ Stop here.
551
+
552
+ **Precondition 3: No critical errors**
553
+
554
+ Check `errors.records` for any entries with `severity: "critical"`.
555
+
556
+ If critical errors exist:
557
+ ```
558
+ Cannot entomb colony with critical errors.
559
+
560
+ Critical errors: {count}
561
+ Run /ant:continue to resolve errors first.
562
+ ```
563
+ Stop here.
564
+
565
+ ### Step 3: Compute Milestone
566
+
567
+ Determine milestone based on phases completed:
568
+ - 0 phases: "Fresh Start"
569
+ - 1 phase: "First Mound"
570
+ - 2-4 phases: "Open Chambers"
571
+ - 5+ phases: "Sealed Chambers"
572
+
573
+ If all phases completed AND user explicitly sealing: "Crowned Anthill"
574
+
575
+ For entombment, use the computed milestone or extract from state if already set.
576
+
577
+ ### Step 4: User Confirmation
578
+
579
+ Display:
580
+ ```
581
+ 🏺 ═══════════════════════════════════════════════════
582
+ E N T O M B C O L O N Y
583
+ ══════════════════════════════════════════════════ 🏺
584
+
585
+ Goal: {goal}
586
+ Version: v{colony_version}
587
+ Phases: {completed}/{total} completed
588
+ Milestone: {milestone}
589
+
590
+ Archive will include:
591
+ - COLONY_STATE.json
592
+ - manifest.json (pheromone trails)
593
+
594
+ This will reset the active colony. Continue? (yes/no)
595
+ ```
596
+
597
+ Wait for explicit "yes" response before proceeding.
598
+
599
+ If user responds with anything other than "yes", display:
600
+ ```
601
+ Entombment cancelled. Colony remains active.
602
+ ```
603
+ Stop here.
604
+
605
+ ### Step 4.5: Check XML Tools
606
+
607
+ XML archiving is required for entombment. Check tool availability before proceeding.
608
+ Uses `command -v xmllint` directly — consistent with seal.md's tool check.
609
+
610
+ ```bash
611
+ if command -v xmllint >/dev/null 2>&1; then
612
+ xmllint_available=true
613
+ else
614
+ xmllint_available=false
615
+ fi
616
+ ```
617
+
618
+ **If xmllint is NOT available:**
619
+
620
+ Ask the user:
621
+ ```
622
+ xmllint is not installed — XML archiving requires it.
623
+
624
+ Install now?
625
+ - macOS: xcode-select --install (or brew install libxml2)
626
+ - Linux: apt-get install libxml2-utils
627
+
628
+ Install xmllint? (yes/no)
629
+ ```
630
+
631
+ Use AskUserQuestion with yes/no options.
632
+
633
+ If yes:
634
+ - On macOS: Run `xcode-select --install` or `brew install libxml2`
635
+ - On Linux: Run `sudo apt-get install -y libxml2-utils`
636
+ - After install attempt, re-check: `command -v xmllint >/dev/null 2>&1`
637
+ - If still not available after install:
638
+ ```
639
+ xmllint installation failed. Cannot entomb without XML archiving.
640
+ Install xmllint manually and try again.
641
+ ```
642
+ Stop here.
643
+
644
+ If no:
645
+ ```
646
+ Entombment requires XML archiving. Install xmllint and try again.
647
+ ```
648
+ Stop here.
649
+
650
+ ### Step 5: Create Chamber
651
+
652
+ Generate chamber name:
653
+ ```bash
654
+ sanitized_goal=$(echo "{goal}" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//;s/-$//' | cut -c1-50)
655
+ timestamp=$(date -u +%Y%m%d-%H%M%S)
656
+ chamber_name="${sanitized_goal}-${timestamp}"
657
+ ```
658
+
659
+ Handle name collision: if directory exists, append counter:
660
+ ```bash
661
+ counter=1
662
+ original_name="$chamber_name"
663
+ while [[ -d ".aether/chambers/$chamber_name" ]]; do
664
+ chamber_name="${original_name}-${counter}"
665
+ counter=$((counter + 1))
666
+ done
667
+ ```
668
+
669
+ ### Step 6: Create Chamber Using Utilities
670
+
671
+ Extract decisions and learnings as JSON arrays:
672
+ ```bash
673
+ decisions_json=$(jq -c '.memory.decisions // []' .aether/data/COLONY_STATE.json)
674
+ learnings_json=$(jq -c '.memory.phase_learnings // []' .aether/data/COLONY_STATE.json)
675
+ phases_completed=$(jq '[.plan.phases[] | select(.status == "completed")] | length' .aether/data/COLONY_STATE.json)
676
+ total_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
677
+ version=$(jq -r '.version // "3.0"' .aether/data/COLONY_STATE.json)
678
+ ```
679
+
680
+ Create the chamber:
681
+ ```bash
682
+ bash .aether/aether-utils.sh chamber-create \
683
+ ".aether/chambers/{chamber_name}" \
684
+ ".aether/data/COLONY_STATE.json" \
685
+ "{goal}" \
686
+ {phases_completed} \
687
+ {total_phases} \
688
+ "{milestone}" \
689
+ "{version}" \
690
+ '{decisions_json}' \
691
+ '{learnings_json}'
692
+ ```
693
+
694
+ ### Step 6.5: Export XML Archive (hard-stop)
695
+
696
+ Export combined XML archive to the chamber. This is a HARD REQUIREMENT — entomb fails if XML export fails.
697
+
698
+ ```bash
699
+ chamber_dir=".aether/chambers/$chamber_name"
700
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml "$chamber_dir/colony-archive.xml" 2>&1)
701
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
702
+
703
+ if [[ "$xml_ok" != "true" ]]; then
704
+ # HARD STOP — remove the chamber and abort
705
+ rm -rf "$chamber_dir"
706
+ echo "XML archive export failed. Colony NOT entombed."
707
+ echo ""
708
+ echo "Error: $(echo "$xml_result" | jq -r '.error // "Unknown error"' 2>/dev/null)"
709
+ echo ""
710
+ echo "The chamber has been cleaned up. Fix the XML issue and try again."
711
+ # Do NOT proceed to state reset or any further steps
712
+ fi
713
+ ```
714
+
715
+ If xml_ok is true, store for display:
716
+ ```bash
717
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
718
+ xml_exchange_count=$(find .aether/exchange -maxdepth 1 -name "*.xml" 2>/dev/null | wc -l | tr -d ' ')
719
+ xml_archive_line="XML Archive: colony-archive.xml (${xml_pheromone_count} signals) + ${xml_exchange_count} exchange file(s)"
720
+ ```
721
+
722
+ **Critical behavior:** If XML export fails, entomb STOPS. The chamber directory is removed (cleanup). The colony state is NOT reset. The user sees a clear error and can retry after fixing the issue.
723
+
724
+ **Copy exchange XML files to chamber (per D-04, D-05):**
725
+ ```bash
726
+ xml_archived=0
727
+ for xml_file in .aether/exchange/*.xml; do
728
+ [[ -f "$xml_file" ]] && cp "$xml_file" ".aether/chambers/$chamber_name/" && xml_archived=$((xml_archived + 1))
729
+ done
730
+ ```
731
+
732
+ ### Step 7: Verify Chamber Integrity
733
+
734
+ Run verification:
735
+ ```bash
736
+ bash .aether/aether-utils.sh chamber-verify ".aether/chambers/{chamber_name}"
737
+ ```
738
+
739
+ If verification fails, display error and stop:
740
+ ```
741
+ ❌ Chamber verification failed.
742
+
743
+ Error: {verification_error}
744
+
745
+ The colony has NOT been reset. Please check the chamber directory:
746
+ .aether/chambers/{chamber_name}/
747
+ ```
748
+ Stop here.
749
+
750
+ ### Step 8: Reset Colony State
751
+
752
+ Backup current state:
753
+ ```bash
754
+ cp .aether/data/COLONY_STATE.json .aether/data/COLONY_STATE.json.bak
755
+ ```
756
+
757
+ Reset state (including memory fields, already promoted to QUEEN.md):
758
+ ```bash
759
+ # Resolve jq template path (hub-first)
760
+ jq_template=""
761
+ for path in \
762
+ "$HOME/.aether/system/templates/colony-state-reset.jq.template" \
763
+ ".aether/templates/colony-state-reset.jq.template"; do
764
+ if [[ -f "$path" ]]; then
765
+ jq_template="$path"
766
+ break
767
+ fi
768
+ done
769
+
770
+ if [[ -z "$jq_template" ]]; then
771
+ echo "Template missing: colony-state-reset.jq.template. Run aether update to fix."
772
+ exit 1
773
+ fi
774
+
775
+ jq -f "$jq_template" .aether/data/COLONY_STATE.json.bak > .aether/data/COLONY_STATE.json
776
+ ```
777
+
778
+ Verify reset succeeded:
779
+ ```bash
780
+ new_goal=$(jq -r '.goal' .aether/data/COLONY_STATE.json)
781
+ if [[ "$new_goal" != "null" ]]; then
782
+ # Restore from backup
783
+ mv .aether/data/COLONY_STATE.json.bak .aether/data/COLONY_STATE.json
784
+ echo "Error: State reset failed. Restored from backup."
785
+ exit 1
786
+ fi
787
+ ```
788
+
789
+ Remove backup after successful reset:
790
+ ```bash
791
+ rm -f .aether/data/COLONY_STATE.json.bak
792
+ ```
793
+
794
+ Clean up exchange XML files (now archived in chamber per D-06):
795
+ ```bash
796
+ rm -f .aether/exchange/*.xml 2>/dev/null || true
797
+ ```
798
+
799
+ ### Step 8.5: Write Final Handoff
800
+
801
+ After entombing the colony, write the final handoff documenting the archived colony:
802
+
803
+ Resolve the handoff template path:
804
+ Check ~/.aether/system/templates/handoff.template.md first,
805
+ then .aether/templates/handoff.template.md.
806
+
807
+ If no template found: output "Template missing: handoff.template.md. Run aether update to fix." and stop.
808
+
809
+ Read the template file. Fill all {{PLACEHOLDER}} values:
810
+ - {{CHAMBER_NAME}} → chamber_name
811
+ - {{GOAL}} → goal
812
+ - {{PHASES_COMPLETED}} → phases completed count
813
+ - {{TOTAL_PHASES}} → total phases count
814
+ - {{MILESTONE}} → milestone
815
+ - {{ENTOMB_TIMESTAMP}} → current ISO-8601 UTC timestamp
816
+
817
+ Remove the HTML comment lines at the top of the template.
818
+ Write the result to .aether/HANDOFF.md using the Write tool.
819
+
820
+ This handoff serves as the record of the entombed colony.
821
+
822
+ ### Step 9: Display Result
823
+
824
+ ```
825
+ 🏺 ═══════════════════════════════════════════════════
826
+ C O L O N Y E N T O M B E D
827
+ ══════════════════════════════════════════════════ 🏺
828
+
829
+ ✅ Entombed v{colony_version}
830
+
831
+ 👑 Goal: {goal}
832
+ 📍 Phases: {completed} completed
833
+ 🏆 Milestone: {milestone}
834
+
835
+ 📦 Chamber: .aether/chambers/{chamber_name}/
836
+ {xml_archive_line}
837
+
838
+ 🐜 The colony rests. Its learnings are preserved.
839
+
840
+ 💾 State persisted — safe to /clear
841
+
842
+ 🐜 What would you like to do next?
843
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
844
+ 2. /ant:tunnels — Browse archived colonies
845
+ 3. /clear — Clear context and continue
846
+
847
+ Use AskUserQuestion with these three options.
848
+
849
+ If option 1 selected: proceed to run /ant:lay-eggs flow
850
+ If option 2 selected: run /ant:tunnels
851
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
852
+ ```
853
+
854
+ ### Edge Cases
855
+
856
+ **Chamber name collision:** Automatically append counter to make unique.
857
+
858
+ **Missing files during archive:** Note in output but continue with available files.
859
+
860
+ **State reset failure:** Restore from backup, display error, do not claim success.
861
+
862
+ **Empty phases array:** Can entomb a colony that was initialized but had no phases planned (treat as 0 of 0 completed).
863
+