aether-colony 1.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 (207) hide show
  1. package/.aether/CONTEXT.md +160 -0
  2. package/.aether/QUEEN.md +84 -0
  3. package/.aether/aether-utils.sh +7749 -0
  4. package/.aether/docs/QUEEN-SYSTEM.md +211 -0
  5. package/.aether/docs/README.md +68 -0
  6. package/.aether/docs/caste-system.md +48 -0
  7. package/.aether/docs/disciplines/DISCIPLINES.md +93 -0
  8. package/.aether/docs/disciplines/coding-standards.md +197 -0
  9. package/.aether/docs/disciplines/debugging.md +207 -0
  10. package/.aether/docs/disciplines/learning.md +254 -0
  11. package/.aether/docs/disciplines/tdd.md +257 -0
  12. package/.aether/docs/disciplines/verification-loop.md +167 -0
  13. package/.aether/docs/disciplines/verification.md +116 -0
  14. package/.aether/docs/error-codes.md +268 -0
  15. package/.aether/docs/known-issues.md +233 -0
  16. package/.aether/docs/pheromones.md +205 -0
  17. package/.aether/docs/queen-commands.md +97 -0
  18. package/.aether/exchange/colony-registry.xml +11 -0
  19. package/.aether/exchange/pheromone-xml.sh +575 -0
  20. package/.aether/exchange/pheromones.xml +87 -0
  21. package/.aether/exchange/queen-wisdom.xml +14 -0
  22. package/.aether/exchange/registry-xml.sh +273 -0
  23. package/.aether/exchange/wisdom-xml.sh +319 -0
  24. package/.aether/midden/approach-changes.md +5 -0
  25. package/.aether/midden/build-failures.md +5 -0
  26. package/.aether/midden/test-failures.md +5 -0
  27. package/.aether/model-profiles.yaml +100 -0
  28. package/.aether/rules/aether-colony.md +134 -0
  29. package/.aether/schemas/aether-types.xsd +255 -0
  30. package/.aether/schemas/colony-registry.xsd +309 -0
  31. package/.aether/schemas/example-prompt-builder.xml +234 -0
  32. package/.aether/schemas/pheromone.xsd +163 -0
  33. package/.aether/schemas/prompt.xsd +416 -0
  34. package/.aether/schemas/queen-wisdom.xsd +325 -0
  35. package/.aether/schemas/worker-priming.xsd +276 -0
  36. package/.aether/templates/QUEEN.md.template +79 -0
  37. package/.aether/templates/colony-state-reset.jq.template +22 -0
  38. package/.aether/templates/colony-state.template.json +35 -0
  39. package/.aether/templates/constraints.template.json +9 -0
  40. package/.aether/templates/crowned-anthill.template.md +36 -0
  41. package/.aether/templates/handoff-build-error.template.md +30 -0
  42. package/.aether/templates/handoff-build-success.template.md +39 -0
  43. package/.aether/templates/handoff.template.md +40 -0
  44. package/.aether/templates/learning-observations.template.json +6 -0
  45. package/.aether/templates/midden.template.json +7 -0
  46. package/.aether/templates/pheromones.template.json +6 -0
  47. package/.aether/templates/session.template.json +9 -0
  48. package/.aether/utils/atomic-write.sh +219 -0
  49. package/.aether/utils/chamber-compare.sh +193 -0
  50. package/.aether/utils/chamber-utils.sh +297 -0
  51. package/.aether/utils/colorize-log.sh +132 -0
  52. package/.aether/utils/error-handler.sh +212 -0
  53. package/.aether/utils/file-lock.sh +158 -0
  54. package/.aether/utils/queen-to-md.xsl +395 -0
  55. package/.aether/utils/semantic-cli.sh +413 -0
  56. package/.aether/utils/spawn-tree.sh +428 -0
  57. package/.aether/utils/spawn-with-model.sh +56 -0
  58. package/.aether/utils/state-loader.sh +215 -0
  59. package/.aether/utils/swarm-display.sh +268 -0
  60. package/.aether/utils/watch-spawn-tree.sh +253 -0
  61. package/.aether/utils/xml-compose.sh +253 -0
  62. package/.aether/utils/xml-convert.sh +273 -0
  63. package/.aether/utils/xml-core.sh +186 -0
  64. package/.aether/utils/xml-query.sh +201 -0
  65. package/.aether/utils/xml-utils.sh +110 -0
  66. package/.aether/workers.md +765 -0
  67. package/.claude/agents/ant/aether-ambassador.md +264 -0
  68. package/.claude/agents/ant/aether-archaeologist.md +322 -0
  69. package/.claude/agents/ant/aether-auditor.md +266 -0
  70. package/.claude/agents/ant/aether-builder.md +187 -0
  71. package/.claude/agents/ant/aether-chaos.md +268 -0
  72. package/.claude/agents/ant/aether-chronicler.md +304 -0
  73. package/.claude/agents/ant/aether-gatekeeper.md +325 -0
  74. package/.claude/agents/ant/aether-includer.md +373 -0
  75. package/.claude/agents/ant/aether-keeper.md +271 -0
  76. package/.claude/agents/ant/aether-measurer.md +317 -0
  77. package/.claude/agents/ant/aether-probe.md +210 -0
  78. package/.claude/agents/ant/aether-queen.md +325 -0
  79. package/.claude/agents/ant/aether-route-setter.md +173 -0
  80. package/.claude/agents/ant/aether-sage.md +353 -0
  81. package/.claude/agents/ant/aether-scout.md +142 -0
  82. package/.claude/agents/ant/aether-surveyor-disciplines.md +416 -0
  83. package/.claude/agents/ant/aether-surveyor-nest.md +354 -0
  84. package/.claude/agents/ant/aether-surveyor-pathogens.md +288 -0
  85. package/.claude/agents/ant/aether-surveyor-provisions.md +359 -0
  86. package/.claude/agents/ant/aether-tracker.md +265 -0
  87. package/.claude/agents/ant/aether-watcher.md +244 -0
  88. package/.claude/agents/ant/aether-weaver.md +247 -0
  89. package/.claude/commands/ant/archaeology.md +341 -0
  90. package/.claude/commands/ant/build.md +1160 -0
  91. package/.claude/commands/ant/chaos.md +349 -0
  92. package/.claude/commands/ant/colonize.md +270 -0
  93. package/.claude/commands/ant/continue.md +1070 -0
  94. package/.claude/commands/ant/council.md +309 -0
  95. package/.claude/commands/ant/dream.md +265 -0
  96. package/.claude/commands/ant/entomb.md +487 -0
  97. package/.claude/commands/ant/feedback.md +78 -0
  98. package/.claude/commands/ant/flag.md +139 -0
  99. package/.claude/commands/ant/flags.md +155 -0
  100. package/.claude/commands/ant/focus.md +58 -0
  101. package/.claude/commands/ant/help.md +122 -0
  102. package/.claude/commands/ant/history.md +137 -0
  103. package/.claude/commands/ant/init.md +409 -0
  104. package/.claude/commands/ant/interpret.md +267 -0
  105. package/.claude/commands/ant/lay-eggs.md +201 -0
  106. package/.claude/commands/ant/maturity.md +102 -0
  107. package/.claude/commands/ant/memory-details.md +77 -0
  108. package/.claude/commands/ant/migrate-state.md +165 -0
  109. package/.claude/commands/ant/oracle.md +387 -0
  110. package/.claude/commands/ant/organize.md +227 -0
  111. package/.claude/commands/ant/pause-colony.md +247 -0
  112. package/.claude/commands/ant/phase.md +126 -0
  113. package/.claude/commands/ant/plan.md +544 -0
  114. package/.claude/commands/ant/redirect.md +58 -0
  115. package/.claude/commands/ant/resume-colony.md +182 -0
  116. package/.claude/commands/ant/resume.md +363 -0
  117. package/.claude/commands/ant/seal.md +306 -0
  118. package/.claude/commands/ant/status.md +272 -0
  119. package/.claude/commands/ant/swarm.md +361 -0
  120. package/.claude/commands/ant/tunnels.md +425 -0
  121. package/.claude/commands/ant/update.md +209 -0
  122. package/.claude/commands/ant/verify-castes.md +95 -0
  123. package/.claude/commands/ant/watch.md +238 -0
  124. package/.opencode/agents/aether-ambassador.md +140 -0
  125. package/.opencode/agents/aether-archaeologist.md +108 -0
  126. package/.opencode/agents/aether-auditor.md +144 -0
  127. package/.opencode/agents/aether-builder.md +184 -0
  128. package/.opencode/agents/aether-chaos.md +115 -0
  129. package/.opencode/agents/aether-chronicler.md +122 -0
  130. package/.opencode/agents/aether-gatekeeper.md +116 -0
  131. package/.opencode/agents/aether-includer.md +117 -0
  132. package/.opencode/agents/aether-keeper.md +177 -0
  133. package/.opencode/agents/aether-measurer.md +128 -0
  134. package/.opencode/agents/aether-probe.md +133 -0
  135. package/.opencode/agents/aether-queen.md +286 -0
  136. package/.opencode/agents/aether-route-setter.md +130 -0
  137. package/.opencode/agents/aether-sage.md +106 -0
  138. package/.opencode/agents/aether-scout.md +101 -0
  139. package/.opencode/agents/aether-surveyor-disciplines.md +386 -0
  140. package/.opencode/agents/aether-surveyor-nest.md +324 -0
  141. package/.opencode/agents/aether-surveyor-pathogens.md +259 -0
  142. package/.opencode/agents/aether-surveyor-provisions.md +329 -0
  143. package/.opencode/agents/aether-tracker.md +137 -0
  144. package/.opencode/agents/aether-watcher.md +174 -0
  145. package/.opencode/agents/aether-weaver.md +130 -0
  146. package/.opencode/commands/ant/archaeology.md +338 -0
  147. package/.opencode/commands/ant/build.md +1200 -0
  148. package/.opencode/commands/ant/chaos.md +346 -0
  149. package/.opencode/commands/ant/colonize.md +202 -0
  150. package/.opencode/commands/ant/continue.md +938 -0
  151. package/.opencode/commands/ant/council.md +305 -0
  152. package/.opencode/commands/ant/dream.md +262 -0
  153. package/.opencode/commands/ant/entomb.md +367 -0
  154. package/.opencode/commands/ant/feedback.md +80 -0
  155. package/.opencode/commands/ant/flag.md +137 -0
  156. package/.opencode/commands/ant/flags.md +153 -0
  157. package/.opencode/commands/ant/focus.md +56 -0
  158. package/.opencode/commands/ant/help.md +124 -0
  159. package/.opencode/commands/ant/history.md +127 -0
  160. package/.opencode/commands/ant/init.md +337 -0
  161. package/.opencode/commands/ant/interpret.md +256 -0
  162. package/.opencode/commands/ant/lay-eggs.md +141 -0
  163. package/.opencode/commands/ant/maturity.md +92 -0
  164. package/.opencode/commands/ant/memory-details.md +77 -0
  165. package/.opencode/commands/ant/migrate-state.md +153 -0
  166. package/.opencode/commands/ant/oracle.md +338 -0
  167. package/.opencode/commands/ant/organize.md +224 -0
  168. package/.opencode/commands/ant/pause-colony.md +220 -0
  169. package/.opencode/commands/ant/phase.md +123 -0
  170. package/.opencode/commands/ant/plan.md +531 -0
  171. package/.opencode/commands/ant/redirect.md +67 -0
  172. package/.opencode/commands/ant/resume-colony.md +178 -0
  173. package/.opencode/commands/ant/resume.md +363 -0
  174. package/.opencode/commands/ant/seal.md +247 -0
  175. package/.opencode/commands/ant/status.md +272 -0
  176. package/.opencode/commands/ant/swarm.md +357 -0
  177. package/.opencode/commands/ant/tunnels.md +406 -0
  178. package/.opencode/commands/ant/update.md +191 -0
  179. package/.opencode/commands/ant/verify-castes.md +85 -0
  180. package/.opencode/commands/ant/watch.md +220 -0
  181. package/.opencode/opencode.json +3 -0
  182. package/CHANGELOG.md +325 -0
  183. package/DISCLAIMER.md +74 -0
  184. package/LICENSE +21 -0
  185. package/README.md +258 -0
  186. package/bin/cli.js +2436 -0
  187. package/bin/generate-commands.sh +291 -0
  188. package/bin/lib/caste-colors.js +57 -0
  189. package/bin/lib/colors.js +76 -0
  190. package/bin/lib/errors.js +255 -0
  191. package/bin/lib/event-types.js +190 -0
  192. package/bin/lib/file-lock.js +695 -0
  193. package/bin/lib/init.js +454 -0
  194. package/bin/lib/logger.js +242 -0
  195. package/bin/lib/model-profiles.js +445 -0
  196. package/bin/lib/model-verify.js +288 -0
  197. package/bin/lib/nestmate-loader.js +130 -0
  198. package/bin/lib/proxy-health.js +253 -0
  199. package/bin/lib/spawn-logger.js +266 -0
  200. package/bin/lib/state-guard.js +602 -0
  201. package/bin/lib/state-sync.js +516 -0
  202. package/bin/lib/telemetry.js +441 -0
  203. package/bin/lib/update-transaction.js +1454 -0
  204. package/bin/npx-install.js +178 -0
  205. package/bin/sync-to-runtime.sh +6 -0
  206. package/bin/validate-package.sh +88 -0
  207. package/package.json +70 -0
@@ -0,0 +1,425 @@
1
+ ---
2
+ name: ant:tunnels
3
+ description: "🕳️🐜🕳️ Explore tunnels (browse archived colonies, compare chambers)"
4
+ ---
5
+
6
+ You are the **Queen**. Browse the colony history.
7
+
8
+ ## Instructions
9
+
10
+ ### Argument Handling
11
+
12
+ - No arguments: Show timeline view (Step 4)
13
+ - One argument: Show single chamber detail with seal document (Step 3)
14
+ - Two arguments: Compare two chambers side-by-side (Step 5)
15
+ - More than two: "Too many arguments. Use: /ant:tunnels [chamber1] [chamber2]"
16
+
17
+ ### Step 1: Check for Chambers Directory
18
+
19
+ Check if `.aether/chambers/` exists.
20
+
21
+ If not:
22
+ ```
23
+ TUNNELS — Colony Timeline
24
+
25
+ No chambers found.
26
+
27
+ Archive colonies with /ant:entomb to build the tunnel network.
28
+ ```
29
+ Stop here.
30
+
31
+ ### Step 2: List All Chambers
32
+
33
+ Run using the Bash tool with description "Loading chamber list...": `bash .aether/aether-utils.sh chamber-list`
34
+
35
+ Parse JSON result into array of chambers.
36
+
37
+ If no chambers (empty array):
38
+ ```
39
+ TUNNELS — Colony Timeline
40
+
41
+ 0 colonies archived
42
+
43
+ The tunnel network is empty.
44
+ Archive colonies with /ant:entomb to preserve history.
45
+ ```
46
+ Stop here.
47
+
48
+ ### Step 3: Detail View — Show Seal Document (if one argument provided)
49
+
50
+ If `$ARGUMENTS` is not empty and contains exactly one argument:
51
+ - Treat it as chamber name
52
+ - Check if `.aether/chambers/{arguments}/` exists
53
+ - If not found:
54
+ ```
55
+ Chamber not found: {arguments}
56
+
57
+ Run /ant:tunnels to see available chambers.
58
+ ```
59
+ Stop here.
60
+
61
+ **If CROWNED-ANTHILL.md exists in the chamber:**
62
+
63
+ ```bash
64
+ seal_doc=".aether/chambers/{arguments}/CROWNED-ANTHILL.md"
65
+ ```
66
+
67
+ Display the header:
68
+ ```
69
+ CHAMBER DETAILS — {chamber_name}
70
+ ```
71
+
72
+ Then display the FULL content of `CROWNED-ANTHILL.md` (read and output the file contents — this IS the seal ceremony record).
73
+
74
+ After the seal document, check if `colony-archive.xml` exists in the chamber:
75
+
76
+ ```bash
77
+ chamber_has_xml=false
78
+ [[ -f ".aether/chambers/{chamber_name}/colony-archive.xml" ]] && chamber_has_xml=true
79
+ ```
80
+
81
+ **If `colony-archive.xml` exists in the chamber**, show footer with import option:
82
+ ```
83
+ Chamber integrity: {hash_status from chamber-verify}
84
+ Chamber location: .aether/chambers/{chamber_name}/
85
+ XML Archive: colony-archive.xml found
86
+
87
+ Actions:
88
+ 1. Import signals from this colony into current colony
89
+ 2. Return to timeline
90
+ 3. Compare with another chamber
91
+
92
+ Select an action (1/2/3)
93
+ ```
94
+
95
+ Use AskUserQuestion with three options.
96
+
97
+ If option 1 selected: proceed to Step 6 (Import Signals from Chamber).
98
+ If option 2 selected: return to timeline (run /ant:tunnels).
99
+ If option 3 selected: prompt for second chamber name then run /ant:tunnels {chamber_a} {chamber_b}.
100
+
101
+ **If `colony-archive.xml` does NOT exist in the chamber**, show the existing footer unchanged:
102
+ ```
103
+ Chamber integrity: {hash_status from chamber-verify}
104
+ Chamber location: .aether/chambers/{chamber_name}/
105
+
106
+ Run /ant:tunnels to return to timeline
107
+ Run /ant:tunnels {chamber_a} {chamber_b} to compare chambers
108
+ ```
109
+
110
+ **If CROWNED-ANTHILL.md does NOT exist (older chamber):**
111
+
112
+ Display the header:
113
+ ```
114
+ CHAMBER DETAILS — {chamber_name}
115
+
116
+ (No seal document — this chamber was created before the sealing ceremony was introduced)
117
+ ```
118
+
119
+ Fall back to manifest data display:
120
+ - Read `manifest.json` and show: goal, milestone, version, phases_completed, total_phases, entombed_at
121
+ - Show decisions count and learnings count from manifest
122
+ - Show hash status from `chamber-verify`
123
+
124
+ Footer with navigation guidance:
125
+ ```
126
+ Run /ant:tunnels to return to timeline
127
+ Run /ant:tunnels {chamber_a} {chamber_b} to compare chambers
128
+ ```
129
+
130
+ To get the hash status, run using the Bash tool with description "Verifying chamber integrity...":
131
+ - Run `bash .aether/aether-utils.sh chamber-verify .aether/chambers/{chamber_name}`
132
+ - If verified: hash_status = "verified"
133
+ - If not verified: hash_status = "hash mismatch"
134
+ - If error: hash_status = "error"
135
+
136
+ Stop here.
137
+
138
+ ### Step 4: Timeline View (default, no arguments)
139
+
140
+ Display header:
141
+ ```
142
+ TUNNELS — Colony Timeline
143
+
144
+ {count} colonies archived
145
+ ```
146
+
147
+ For each chamber in sorted list (already sorted by `chamber-list` — newest first), display as a timeline entry:
148
+ ```
149
+ [{date}] {milestone_emoji} {chamber_name}
150
+ {goal (truncated to 60 chars)}
151
+ {phases_completed} phases | {milestone}
152
+ ```
153
+
154
+ Where `milestone_emoji` is:
155
+ - Crowned Anthill: crown emoji
156
+ - Sealed Chambers: lock emoji
157
+ - Other: circle emoji
158
+
159
+ After the timeline entries, show:
160
+ ```
161
+ Run /ant:tunnels <chamber_name> to view seal document
162
+ Run /ant:tunnels <chamber_a> <chamber_b> to compare two colonies
163
+ ```
164
+
165
+ Use the entombed_at field from the chamber-list JSON to extract the date (first 10 chars of ISO timestamp).
166
+
167
+ Stop here.
168
+
169
+ ### Step 5: Chamber Comparison Mode (Two Arguments)
170
+
171
+ If two arguments provided (chamber names separated by space):
172
+ - Treat as: `/ant:tunnels <chamber_a> <chamber_b>`
173
+
174
+ Check both chambers exist. If either missing:
175
+ ```
176
+ Chamber not found: {chamber_name}
177
+
178
+ Available chambers:
179
+ {list from chamber-list}
180
+ ```
181
+ Stop here.
182
+
183
+ Run comparison using the Bash tool with description "Comparing chambers...":
184
+ ```bash
185
+ bash .aether/utils/chamber-compare.sh compare <chamber_a> <chamber_b>
186
+ bash .aether/utils/chamber-compare.sh stats <chamber_a> <chamber_b>
187
+ ```
188
+
189
+ Display comparison header:
190
+ ```
191
+ CHAMBER COMPARISON
192
+
193
+ {chamber_a} vs {chamber_b}
194
+ ```
195
+
196
+ Display side-by-side comparison:
197
+ ```
198
+ +---------------------+---------------------+
199
+ | {chamber_a} | {chamber_b} |
200
+ +---------------------+---------------------+
201
+ | Goal: {goal_a} | Goal: {goal_b} |
202
+ | | |
203
+ | {milestone_a} | {milestone_b} |
204
+ | {version_a} | {version_b} |
205
+ | | |
206
+ | {phases_a} done | {phases_b} done |
207
+ | of {total_a} | of {total_b} |
208
+ | | |
209
+ | {decisions_a} | {decisions_b} |
210
+ | decisions | decisions |
211
+ | | |
212
+ | {learnings_a} | {learnings_b} |
213
+ | learnings | learnings |
214
+ | | |
215
+ | {date_a} | {date_b} |
216
+ +---------------------+---------------------+
217
+ ```
218
+
219
+ Display growth metrics:
220
+ ```
221
+ Growth Between Chambers:
222
+ Phases: +{phases_diff} ({phases_a} -> {phases_b})
223
+ Decisions: +{decisions_diff} new
224
+ Learnings: +{learnings_diff} new
225
+ Time: {time_between} days apart
226
+ ```
227
+
228
+ If phases_diff > 0: show "Colony grew"
229
+ If phases_diff < 0: show "Colony reduced (unusual)"
230
+ If same_milestone: show "Same milestone reached"
231
+ If milestone changed: show "Milestone advanced: {milestone_a} -> {milestone_b}"
232
+
233
+ Display pheromone trail diff (new decisions/learnings in B) by running using the Bash tool with description "Analyzing pheromone differences...":
234
+ ```bash
235
+ bash .aether/utils/chamber-compare.sh diff <chamber_a> <chamber_b>
236
+ ```
237
+
238
+ Parse result and show:
239
+ ```
240
+ New Decisions in {chamber_b}:
241
+ {N} new architectural decisions
242
+ {if N <= 5, list them; else show first 3 + "...and {N-3} more"}
243
+
244
+ New Learnings in {chamber_b}:
245
+ {N} new validated learnings
246
+ {if N <= 5, list them; else show first 3 + "...and {N-3} more"}
247
+ ```
248
+
249
+ If both chambers have `CROWNED-ANTHILL.md`, note:
250
+ ```
251
+ Both colonies have seal documents. Run /ant:tunnels <name> to view individually.
252
+ ```
253
+
254
+ Footer:
255
+ ```
256
+ Run /ant:tunnels to see all chambers
257
+ Run /ant:tunnels <chamber> to view single chamber details
258
+ ```
259
+
260
+ Stop here.
261
+
262
+ ### Step 6: Import Signals from Chamber
263
+
264
+ When user selects "Import signals" from Step 3:
265
+
266
+ **Step 6.1: Check XML tools** by running using the Bash tool with description "Checking XML tools...":
267
+ ```bash
268
+ if command -v xmllint >/dev/null 2>&1; then
269
+ xmllint_available=true
270
+ else
271
+ xmllint_available=false
272
+ fi
273
+ ```
274
+
275
+ If xmllint not available:
276
+ ```
277
+ Import requires xmllint. Install it first:
278
+ macOS: xcode-select --install
279
+ Linux: apt-get install libxml2-utils
280
+ ```
281
+ Stop here (return to timeline).
282
+
283
+ **Step 6.2: Extract source colony name** by running using the Bash tool with description "Extracting colony info...":
284
+ ```bash
285
+ chamber_xml=".aether/chambers/{chamber_name}/colony-archive.xml"
286
+ # Extract colony_id from the archive root element
287
+ source_colony=$(xmllint --xpath "string(/*/@colony_id)" "$chamber_xml" 2>/dev/null)
288
+ [[ -z "$source_colony" ]] && source_colony="{chamber_name}"
289
+ ```
290
+
291
+ **Step 6.3: Extract pheromone section and show import preview**
292
+
293
+ The combined `colony-archive.xml` contains pheromones, wisdom, and registry sections. Extract the pheromone section to a temp file before counting or importing. This prevents over-counting signals from wisdom/registry sections and ensures `pheromone-import-xml` receives the format it expects (`<pheromones>` as root element).
294
+
295
+ Run using the Bash tool with description "Extracting pheromone signals...":
296
+ ```bash
297
+ # Extract the <pheromones> section from the combined archive into a standalone temp file
298
+ import_tmp_dir=$(mktemp -d)
299
+ import_tmp_pheromones="$import_tmp_dir/pheromones-extracted.xml"
300
+
301
+ # Use xmllint to extract the pheromones element (with its namespace)
302
+ xmllint --xpath "//*[local-name()='pheromones']" "$chamber_xml" > "$import_tmp_pheromones" 2>/dev/null
303
+
304
+ # Add XML declaration to make it a standalone well-formed document
305
+ if [[ -s "$import_tmp_pheromones" ]]; then
306
+ # Portable approach: prepend declaration via temp file (avoids macOS/Linux sed -i differences)
307
+ { echo '<?xml version="1.0" encoding="UTF-8"?>'; cat "$import_tmp_pheromones"; } > "$import_tmp_dir/tmp_decl.xml"
308
+ mv "$import_tmp_dir/tmp_decl.xml" "$import_tmp_pheromones"
309
+ fi
310
+
311
+ # Count pheromone signals in extracted pheromone-only XML
312
+ # Scoped to pheromone section only — no over-counting from wisdom/registry sections
313
+ pheromone_count=$(xmllint --xpath "count(//*[local-name()='signal'])" "$import_tmp_pheromones" 2>/dev/null || echo "unknown")
314
+ ```
315
+
316
+ Display:
317
+ ```
318
+ IMPORT FROM COLONY: {source_colony}
319
+
320
+ Source: .aether/chambers/{chamber_name}/colony-archive.xml
321
+ Signals available: ~{pheromone_count} pheromone signals
322
+
323
+ Import behavior:
324
+ - Signals tagged with prefix "{source_colony}:" to identify origin
325
+ - Additive merge — your current signals are never overwritten
326
+ - On conflict, your current colony wins
327
+
328
+ Import these signals? (yes/no)
329
+ ```
330
+
331
+ Use AskUserQuestion with yes/no options.
332
+
333
+ If no: "Import cancelled." Clean up: `rm -rf "$import_tmp_dir"`. Return to timeline.
334
+
335
+ **Step 6.4: Perform import**
336
+
337
+ Pass the extracted pheromone-only temp file (NOT the combined `colony-archive.xml`) to `pheromone-import-xml`, along with `$source_colony` as the second argument. This ensures:
338
+ 1. `pheromone-import-xml` receives XML with `<pheromones>` as root element (the format it expects)
339
+ 2. The prefix-tagging logic prepends `${source_colony}:` to each imported signal's ID before the merge
340
+
341
+ Run using the Bash tool with description "Importing pheromone signals...":
342
+ ```bash
343
+ # Import the EXTRACTED pheromone-only XML (NOT the combined colony-archive.xml)
344
+ # $import_tmp_pheromones has <pheromones> as root — the format pheromone-import-xml expects
345
+ # Second argument triggers prefix-tagging — imported signal IDs become "{source_colony}:original_id"
346
+ import_result=$(bash .aether/aether-utils.sh pheromone-import-xml "$import_tmp_pheromones" "$source_colony" 2>&1)
347
+ import_ok=$(echo "$import_result" | jq -r '.ok // false' 2>/dev/null)
348
+
349
+ if [[ "$import_ok" == "true" ]]; then
350
+ imported_count=$(echo "$import_result" | jq -r '.result.signal_count // 0' 2>/dev/null)
351
+ else
352
+ imported_count=0
353
+ import_error=$(echo "$import_result" | jq -r '.error // "Unknown error"' 2>/dev/null)
354
+ fi
355
+
356
+ # Clean up temp files
357
+ rm -rf "$import_tmp_dir"
358
+ ```
359
+
360
+ **Step 6.5: Display result**
361
+
362
+ If import succeeded:
363
+ ```
364
+ SIGNALS IMPORTED
365
+
366
+ Source: {source_colony}
367
+ Imported: {imported_count} pheromone signals
368
+ Tagged with: "{source_colony}:" prefix
369
+
370
+ Your colony now carries wisdom from {source_colony}.
371
+ Run /ant:status to see current colony state.
372
+ ```
373
+
374
+ If import failed:
375
+ ```
376
+ Import failed: {import_error}
377
+
378
+ The archive may be malformed. Check:
379
+ .aether/chambers/{chamber_name}/colony-archive.xml
380
+ ```
381
+
382
+ ### Edge Cases
383
+
384
+ **Malformed manifest:** show "Invalid manifest" for that chamber and skip it.
385
+
386
+ **Missing COLONY_STATE.json:** show "Incomplete chamber" for that chamber.
387
+
388
+ **Very long chamber list:** display all (no pagination for now).
389
+
390
+ **Older chambers without CROWNED-ANTHILL.md:** Fall back to manifest data in detail view.
391
+
392
+ ### Step 7: Next Up
393
+
394
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
395
+ ```bash
396
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
397
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
398
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
399
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
400
+ ```
401
+
402
+ ## Implementation Notes
403
+
404
+ The `chamber-list` utility returns JSON in this format:
405
+ ```json
406
+ {
407
+ "ok": true,
408
+ "result": [
409
+ {
410
+ "name": "add-user-auth-20260214-153022",
411
+ "goal": "Add user authentication",
412
+ "milestone": "Sealed Chambers",
413
+ "phases_completed": 5,
414
+ "entombed_at": "2026-02-14T15:30:22Z"
415
+ }
416
+ ]
417
+ }
418
+ ```
419
+
420
+ Parse with jq: `jq -r '.result[] | "\(.name)|\(.goal)|\(.milestone)|\(.phases_completed)|\(.entombed_at)"'`
421
+
422
+ For detail view, read manifest.json directly:
423
+ ```bash
424
+ jq -r '.goal, .milestone, .version, .phases_completed, .total_phases, .entombed_at, (.decisions | length), (.learnings | length)' .aether/chambers/{name}/manifest.json
425
+ ```
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: ant:update
3
+ description: "🔄🐜📦🐜🔄 Update system files from the global Aether hub"
4
+ ---
5
+
6
+ You are the **Queen Ant Colony**. Update this repo's Aether system files from the global distribution hub.
7
+
8
+ ## Instructions
9
+
10
+ ### Step 1: Check Hub Availability
11
+
12
+ Use the Read tool to read `~/.aether/version.json` (expand `~` to the user's home directory).
13
+
14
+ If the file does not exist, output:
15
+
16
+ ```
17
+ No Aether distribution hub found at ~/.aether/
18
+
19
+ To set up the hub, run:
20
+ npx aether-colony install
21
+ — or —
22
+ aether install
23
+
24
+ The hub provides system file updates across all your Aether repos.
25
+ ```
26
+
27
+ Stop here. Do not proceed.
28
+
29
+ Read the `version` field — this is the **available version**.
30
+
31
+ ### Step 2: Check Pending State and Current Version
32
+
33
+ First, check for a pending sentinel using the Bash tool with description "Checking update state...":
34
+
35
+ ```bash
36
+ test -f .aether/.update-pending && echo "PENDING" || echo "CLEAN"
37
+ ```
38
+
39
+ If output is "PENDING":
40
+ - Output: `Detected incomplete update, re-syncing...`
41
+ - Run using the Bash tool with description "Clearing incomplete update sentinel...": `rm -f .aether/.update-pending`
42
+ - Skip the version comparison entirely — proceed directly to Step 3.
43
+
44
+ If output is "CLEAN":
45
+
46
+ Use the Read tool to read `.aether/version.json`.
47
+
48
+ If the file does not exist, set current version to "unknown".
49
+ Otherwise, read the `version` field — this is the **current version**.
50
+
51
+ If current version equals available version, output:
52
+
53
+ ```
54
+ Already up to date (v{version}).
55
+
56
+ System files and commands match the global hub.
57
+ Colony data (.aether/data/) is always untouched by updates.
58
+ ```
59
+
60
+ Stop here. Do not proceed.
61
+
62
+ ### Step 3: Sync System Files from Hub
63
+
64
+ The hub stores all system files at `~/.aether/system/`.
65
+
66
+ Run ONE bash command with description "Syncing colony system files...":
67
+
68
+ ```bash
69
+ mkdir -p .aether/docs .aether/utils .aether/templates .aether/schemas .aether/exchange && \
70
+ cp -f ~/.aether/system/aether-utils.sh .aether/ && \
71
+ cp -f ~/.aether/system/workers.md .aether/ 2>/dev/null || true && \
72
+ cp -f ~/.aether/system/CONTEXT.md .aether/ 2>/dev/null || true && \
73
+ cp -f ~/.aether/system/model-profiles.yaml .aether/ 2>/dev/null || true && \
74
+ cp -Rf ~/.aether/system/docs/* .aether/docs/ 2>/dev/null || true && \
75
+ cp -Rf ~/.aether/system/utils/* .aether/utils/ 2>/dev/null || true && \
76
+ cp -Rf ~/.aether/system/templates/* .aether/templates/ 2>/dev/null || true && \
77
+ cp -Rf ~/.aether/system/schemas/* .aether/schemas/ 2>/dev/null || true && \
78
+ cp -Rf ~/.aether/system/exchange/* .aether/exchange/ 2>/dev/null || true && \
79
+ chmod +x .aether/aether-utils.sh && \
80
+ echo "System files synced"
81
+ ```
82
+
83
+ Colony data (`.aether/data/`) is never touched.
84
+
85
+ If any sync step fails, output:
86
+ ```
87
+ Update couldn't finish — some files didn't copy. Run /ant:update again to retry.
88
+ ```
89
+
90
+ ### Step 3.5: Sync Rules to .claude/rules/
91
+
92
+ Rules files teach Claude Code about the colony system. Sync them from the hub with description "Syncing colony rules...":
93
+
94
+ ```bash
95
+ # Sync rules if hub has them
96
+ if [ -d ~/.aether/system/rules ]; then
97
+ mkdir -p .claude/rules
98
+ cp -Rf ~/.aether/system/rules/* .claude/rules/ 2>/dev/null || true
99
+ echo "Rules synced"
100
+ fi
101
+ ```
102
+
103
+ ### Step 4: Sync Commands (with orphan cleanup)
104
+
105
+ Sync command files from the hub to this repo **and remove stale files** that no longer exist in the hub. This prevents renamed or deleted commands from accumulating as orphans.
106
+
107
+ For each directory pair, run using the Bash tool with description "Syncing colony commands and agents...":
108
+
109
+ ```bash
110
+ # Sync Claude commands
111
+ mkdir -p .claude/commands/ant
112
+ cp -R ~/.aether/system/commands/claude/* .claude/commands/ant/ 2>/dev/null
113
+ # Remove orphans: files in dest that aren't in hub
114
+ comm -23 \
115
+ <(cd .claude/commands/ant && find . -type f ! -name '.*' | sort) \
116
+ <(cd ~/.aether/system/commands/claude && find . -type f ! -name '.*' | sort) \
117
+ | while read f; do rm ".claude/commands/ant/$f" && echo " removed stale: .claude/commands/ant/$f"; done
118
+ echo "claude: done"
119
+
120
+ # Sync OpenCode commands
121
+ mkdir -p .opencode/commands/ant
122
+ cp -R ~/.aether/system/commands/opencode/* .opencode/commands/ant/ 2>/dev/null
123
+ comm -23 \
124
+ <(cd .opencode/commands/ant && find . -type f ! -name '.*' | sort) \
125
+ <(cd ~/.aether/system/commands/opencode && find . -type f ! -name '.*' | sort) \
126
+ | while read f; do rm ".opencode/commands/ant/$f" && echo " removed stale: .opencode/commands/ant/$f"; done
127
+ echo "opencode: done"
128
+
129
+ # Sync agents
130
+ mkdir -p .opencode/agents
131
+ cp -R ~/.aether/system/agents/* .opencode/agents/ 2>/dev/null
132
+ comm -23 \
133
+ <(cd .opencode/agents && find . -type f ! -name '.*' | sort) \
134
+ <(cd ~/.aether/system/agents && find . -type f ! -name '.*' | sort) \
135
+ | while read f; do rm ".opencode/agents/$f" && echo " removed stale: .opencode/agents/$f"; done
136
+ echo "agents: done"
137
+ ```
138
+
139
+ Report any removed stale files in the summary.
140
+
141
+ ### Step 5: Register and Version Stamp
142
+
143
+ Run using the Bash tool with description "Registering colony in hub...":
144
+ ```
145
+ bash .aether/aether-utils.sh registry-add "$(pwd)" "{available_version}"
146
+ ```
147
+
148
+ Substitute `{available_version}` with the version from Step 1.
149
+
150
+ Then use the Write tool to write `.aether/version.json`:
151
+ ```json
152
+ {
153
+ "version": "{available_version}",
154
+ "updated_at": "{ISO-8601 timestamp}"
155
+ }
156
+ ```
157
+
158
+ Then delete any leftover pending sentinel (update is now complete) using the Bash tool with description "Clearing update sentinel...":
159
+ ```bash
160
+ rm -f .aether/.update-pending
161
+ ```
162
+
163
+ ### Step 5.5: Clear Version Cache
164
+
165
+ Clear the version check cache so the next command sees the fresh version:
166
+
167
+ ```bash
168
+ rm -f .aether/data/.version-check-cache
169
+ ```
170
+
171
+ ### Step 6: Display Summary
172
+
173
+ Output:
174
+
175
+ ```
176
+ 🔄🐜📦🐜🔄 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
177
+ A E T H E R U P D A T E
178
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔄🐜📦🐜🔄
179
+
180
+ Updated: v{current_version} -> v{available_version}
181
+
182
+ System files: {N} updated
183
+ Commands: synced from hub
184
+ Agents: synced from hub
185
+ {if stale files were removed:}
186
+ Stale files removed: {count}
187
+ {list each removed file}
188
+ {end if}
189
+
190
+ Colony data (.aether/data/) untouched.
191
+ Repo registered in ~/.aether/registry.json.
192
+ ```
193
+
194
+ ### CLI Equivalents
195
+
196
+ The CLI version (`aether update`) performs the same sync-with-cleanup and also supports:
197
+
198
+ - `--dry-run` — Preview what would change without modifying any files
199
+ - `--force` — Stash uncommitted changes in managed files and proceed with the update
200
+
201
+ ### Next Up
202
+
203
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
204
+ ```bash
205
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
206
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
207
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
208
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
209
+ ```