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,487 @@
1
+ ---
2
+ name: ant:entomb
3
+ description: "⚰️🐜⚰️ Entomb completed colony in chambers"
4
+ ---
5
+
6
+ You are the **Queen**. Archive the sealed colony to chambers.
7
+
8
+ ## Instructions
9
+
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ <failure_modes>
15
+ ### Archive Write Failure
16
+ If writing to chambers/ archive fails partway:
17
+ - Do NOT delete source data (the active colony) until archive is verified
18
+ - Report what was archived vs. what failed
19
+ - Recovery: the original colony data is intact -- user can retry
20
+
21
+ ### Seal Verification Failure
22
+ If the colony was not properly sealed before entomb:
23
+ - STOP -- do not archive an incomplete colony
24
+ - Direct user to run /ant:seal first
25
+ - This is a hard gate, not a suggestion
26
+
27
+ ### Chamber Naming Conflict
28
+ If the target chamber directory already exists:
29
+ - STOP -- do not overwrite an existing archive
30
+ - Report the conflict
31
+ - Options: (1) Use a different name, (2) Merge with existing, (3) Cancel
32
+ </failure_modes>
33
+
34
+ <success_criteria>
35
+ Command is complete when:
36
+ - Colony data is fully copied to chambers/ archive directory
37
+ - Archive integrity is verified (all expected files present)
38
+ - Active colony state is cleared only after archive verification
39
+ - User sees confirmation with archive location
40
+ </success_criteria>
41
+
42
+ <read_only>
43
+ Do not touch during entomb:
44
+ - .aether/dreams/ (user notes -- not archived)
45
+ - Source code files
46
+ - .env* files
47
+ - .claude/settings.json
48
+ - .github/workflows/
49
+ - Other chamber directories (only write to the new chamber)
50
+ </read_only>
51
+
52
+ ### Step 0: Initialize Visual Mode (if enabled)
53
+
54
+ If `visual_mode` is true:
55
+ ```bash
56
+ # Generate session ID
57
+ entomb_id="entomb-$(date +%s)"
58
+
59
+ # Initialize swarm display (consolidated)
60
+ bash .aether/aether-utils.sh swarm-display-init "$entomb_id" && bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Entombing colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
61
+ ```
62
+
63
+ ### Step 1: Read State
64
+
65
+ Read `.aether/data/COLONY_STATE.json`.
66
+
67
+ If file missing or `goal: null`:
68
+ ```
69
+ No colony to entomb. Run /ant:init first.
70
+ ```
71
+ Stop here.
72
+
73
+ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `milestone`, `version`, `initialized_at`, `memory.decisions`, `memory.phase_learnings`, `memory.instincts`.
74
+
75
+ ### Step 2: Seal-First Enforcement
76
+
77
+ Check `milestone` in COLONY_STATE.json.
78
+
79
+ **If milestone != "Crowned Anthill":**
80
+ ```
81
+ Colony has not been sealed.
82
+
83
+ Current milestone: {milestone}
84
+ Required: Crowned Anthill
85
+
86
+ Run /ant:seal first to complete the sealing ceremony.
87
+ ```
88
+ Stop here.
89
+
90
+ **Belt-and-suspenders:** Also check `.aether/CROWNED-ANTHILL.md` exists. If milestone is Crowned Anthill but file is missing:
91
+ ```
92
+ CROWNED-ANTHILL.md not found — seal may have been interrupted. Run /ant:seal again.
93
+ ```
94
+ Stop here.
95
+
96
+ ### Step 3: User Confirmation
97
+
98
+ Show what will be archived:
99
+ ```
100
+ ENTOMB COLONY
101
+
102
+ Goal: {goal}
103
+ Milestone: Crowned Anthill
104
+ Phases: {phases_completed} of {total_phases}
105
+
106
+ This will:
107
+ - Archive ALL colony data to .aether/chambers/
108
+ - Copy CROWNED-ANTHILL.md, pheromones, dreams, session data
109
+ - Promote colony wisdom to QUEEN.md (cross-generational learning)
110
+ - Reset COLONY_STATE.json for a fresh start
111
+ - Clear session data
112
+
113
+ This action is permanent. The archived colony can be browsed via /ant:tunnels.
114
+
115
+ Entomb this colony? (yes/no)
116
+ ```
117
+
118
+ Use `AskUserQuestion with yes/no options`.
119
+
120
+ If not "yes":
121
+ ```
122
+ Entombment cancelled. Colony remains active.
123
+ ```
124
+ Stop here.
125
+
126
+ ### Step 3.25: Wisdom Approval
127
+
128
+ Before archiving, review wisdom proposals accumulated during this colony's lifecycle.
129
+
130
+ ```bash
131
+ # Check for pending proposals
132
+ proposals=$(bash .aether/aether-utils.sh learning-check-promotion 2>/dev/null || echo '{"proposals":[]}')
133
+ proposal_count=$(echo "$proposals" | jq '.proposals | length')
134
+
135
+ if [[ "$proposal_count" -gt 0 ]]; then
136
+ echo ""
137
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
138
+ echo " 🧠 FINAL WISDOM REVIEW"
139
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
140
+ echo ""
141
+ echo "Review wisdom proposals before archiving this colony."
142
+ echo "Approved proposals will be promoted to QUEEN.md."
143
+ echo ""
144
+
145
+ # Run approval workflow (blocking)
146
+ bash .aether/aether-utils.sh learning-approve-proposals
147
+
148
+ echo ""
149
+ echo "Wisdom review complete. Proceeding with entombment..."
150
+ echo ""
151
+ else
152
+ echo "No wisdom proposals to review."
153
+ fi
154
+ ```
155
+
156
+ ### Step 3.5: Check XML Tools
157
+
158
+ XML archiving is required for entombment. Check tool availability before proceeding.
159
+ Uses `command -v xmllint` directly — consistent with seal.md's tool check.
160
+
161
+ ```bash
162
+ if command -v xmllint >/dev/null 2>&1; then
163
+ xmllint_available=true
164
+ else
165
+ xmllint_available=false
166
+ fi
167
+ ```
168
+
169
+ **If xmllint is NOT available:**
170
+
171
+ Ask the user:
172
+ ```
173
+ xmllint is not installed — XML archiving requires it.
174
+
175
+ Install now?
176
+ - macOS: xcode-select --install (or brew install libxml2)
177
+ - Linux: apt-get install libxml2-utils
178
+
179
+ Install xmllint? (yes/no)
180
+ ```
181
+
182
+ Use AskUserQuestion with yes/no options.
183
+
184
+ If yes:
185
+ - On macOS: Run `xcode-select --install` or `brew install libxml2`
186
+ - On Linux: Run `sudo apt-get install -y libxml2-utils`
187
+ - After install attempt, re-check: `command -v xmllint >/dev/null 2>&1`
188
+ - If still not available after install:
189
+ ```
190
+ xmllint installation failed. Cannot entomb without XML archiving.
191
+ Install xmllint manually and try again.
192
+ ```
193
+ Stop here.
194
+
195
+ If no:
196
+ ```
197
+ Entombment requires XML archiving. Install xmllint and try again.
198
+ ```
199
+ Stop here.
200
+
201
+ ### Step 4: Ensure QUEEN.md Exists
202
+
203
+ Verify QUEEN.md is initialized for wisdom storage:
204
+
205
+ ```bash
206
+ queen_file=".aether/QUEEN.md"
207
+ if [[ ! -f "$queen_file" ]]; then
208
+ init_result=$(bash .aether/aether-utils.sh queen-init 2>/dev/null || echo '{"ok":false}')
209
+ init_ok=$(echo "$init_result" | jq -r '.ok // false')
210
+ if [[ "$init_ok" == "true" ]]; then
211
+ created=$(echo "$init_result" | jq -r '.result.created // false')
212
+ if [[ "$created" == "true" ]]; then
213
+ bash .aether/aether-utils.sh activity-log "CREATED" "Queen" "Initialized QUEEN.md for wisdom storage"
214
+ fi
215
+ fi
216
+ fi
217
+ ```
218
+
219
+ ### Step 5: Generate Chamber Name
220
+
221
+ Date-first naming:
222
+ ```bash
223
+ date_prefix=$(date -u +%Y-%m-%d)
224
+ sanitized_goal=$(echo "$goal" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//;s/-$//' | cut -c1-40)
225
+ chamber_name="${date_prefix}-${sanitized_goal}"
226
+ ```
227
+
228
+ Collision handling:
229
+ ```bash
230
+ counter=1
231
+ original_name="$chamber_name"
232
+ while [[ -d ".aether/chambers/$chamber_name" ]]; do
233
+ chamber_name="${original_name}-${counter}"
234
+ counter=$((counter + 1))
235
+ done
236
+ ```
237
+
238
+ ### Step 6: Create Chamber
239
+
240
+ Extract decisions and learnings as JSON arrays:
241
+ ```bash
242
+ decisions_json=$(jq -c '.memory.decisions // []' .aether/data/COLONY_STATE.json)
243
+ learnings_json=$(jq -c '.memory.phase_learnings // []' .aether/data/COLONY_STATE.json)
244
+ phases_completed=$(jq '[.plan.phases[] | select(.status == "completed")] | length' .aether/data/COLONY_STATE.json)
245
+ total_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
246
+ version=$(jq -r '.version // "3.0"' .aether/data/COLONY_STATE.json)
247
+ ```
248
+
249
+ Create the chamber:
250
+ ```bash
251
+ bash .aether/aether-utils.sh chamber-create \
252
+ ".aether/chambers/$chamber_name" \
253
+ ".aether/data/COLONY_STATE.json" \
254
+ "$goal" \
255
+ "$phases_completed" \
256
+ "$total_phases" \
257
+ "$milestone" \
258
+ "$version" \
259
+ "$decisions_json" \
260
+ "$learnings_json"
261
+ ```
262
+
263
+ ### Step 7: Archive Additional Files
264
+
265
+ AFTER chamber-create succeeds, copy additional data files:
266
+ ```bash
267
+ chamber_dir=".aether/chambers/$chamber_name"
268
+
269
+ # Archive data files (if they exist)
270
+ for f in pheromones.json session.json activity.log flags.json constraints.json spawn-tree.txt timing.log view-state.json; do
271
+ [[ -f ".aether/data/$f" ]] && cp ".aether/data/$f" "$chamber_dir/" 2>/dev/null || true
272
+ done
273
+
274
+ # Archive seal document (critical — this is the ceremony record)
275
+ [[ -f ".aether/CROWNED-ANTHILL.md" ]] && cp ".aether/CROWNED-ANTHILL.md" "$chamber_dir/"
276
+
277
+ # Archive HANDOFF.md if it exists
278
+ [[ -f ".aether/HANDOFF.md" ]] && cp ".aether/HANDOFF.md" "$chamber_dir/"
279
+
280
+ # Archive dreams directory (optional — may not exist)
281
+ [[ -d ".aether/dreams" ]] && cp -r ".aether/dreams" "$chamber_dir/dreams" 2>/dev/null || true
282
+ ```
283
+
284
+ Do NOT copy: `.aether/data/backups/`, `.aether/data/locks/`, `.aether/data/midden/`, `.aether/data/survey/`.
285
+
286
+ ### Step 7.5: Export XML Archive (hard-stop)
287
+
288
+ Export combined XML archive to the chamber. This is a HARD REQUIREMENT — entomb fails if XML export fails.
289
+
290
+ ```bash
291
+ chamber_dir=".aether/chambers/$chamber_name"
292
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml "$chamber_dir/colony-archive.xml" 2>&1)
293
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
294
+
295
+ if [[ "$xml_ok" != "true" ]]; then
296
+ # HARD STOP — remove the chamber and abort
297
+ rm -rf "$chamber_dir"
298
+ echo "XML archive export failed. Colony NOT entombed."
299
+ echo ""
300
+ echo "Error: $(echo "$xml_result" | jq -r '.error // "Unknown error"' 2>/dev/null)"
301
+ echo ""
302
+ echo "The chamber has been cleaned up. Fix the XML issue and try again."
303
+ # Do NOT proceed to state reset or any further steps
304
+ fi
305
+ ```
306
+
307
+ If xml_ok is true, store for display:
308
+ ```bash
309
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
310
+ xml_archive_line="XML Archive: colony-archive.xml (${xml_pheromone_count} active signals)"
311
+ ```
312
+
313
+ **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.
314
+
315
+ ### Step 8: Verify Chamber Integrity
316
+
317
+ Run verification:
318
+ ```bash
319
+ bash .aether/aether-utils.sh chamber-verify ".aether/chambers/$chamber_name"
320
+ ```
321
+
322
+ If verification fails, display error and stop:
323
+ ```
324
+ Chamber verification failed.
325
+
326
+ Error: {verification_error}
327
+
328
+ The colony has NOT been reset. Please check the chamber directory:
329
+ .aether/chambers/{chamber_name}/
330
+ ```
331
+ Stop here.
332
+
333
+ ### Step 9: Record in Eternal Memory
334
+
335
+ Write colony summary to eternal memory:
336
+ ```bash
337
+ bash .aether/aether-utils.sh eternal-init # idempotent
338
+ eternal_file="$HOME/.aether/eternal/memory.json"
339
+ if [[ -f "$eternal_file" ]]; then
340
+ colony_entry=$(jq -n \
341
+ --arg goal "$goal" \
342
+ --arg milestone "$milestone" \
343
+ --arg sealed_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
344
+ --arg chamber ".aether/chambers/$chamber_name" \
345
+ '{goal: $goal, milestone: $milestone, sealed_at: $sealed_at, chamber: $chamber}')
346
+ jq --argjson entry "$colony_entry" '.colonies += [$entry]' "$eternal_file" > /tmp/eternal-tmp.json \
347
+ && mv /tmp/eternal-tmp.json "$eternal_file"
348
+ fi
349
+ ```
350
+
351
+ ### Step 10: Reset Colony State
352
+
353
+ Backup current state:
354
+ ```bash
355
+ cp .aether/data/COLONY_STATE.json .aether/data/COLONY_STATE.json.bak
356
+ ```
357
+
358
+ Reset state, clearing everything including promoted wisdom (already in QUEEN.md):
359
+ ```bash
360
+ # Resolve jq template path (hub-first)
361
+ jq_template=""
362
+ for path in \
363
+ "$HOME/.aether/system/templates/colony-state-reset.jq.template" \
364
+ ".aether/templates/colony-state-reset.jq.template"; do
365
+ if [[ -f "$path" ]]; then
366
+ jq_template="$path"
367
+ break
368
+ fi
369
+ done
370
+
371
+ if [[ -z "$jq_template" ]]; then
372
+ echo "Template missing: colony-state-reset.jq.template. Run aether update to fix."
373
+ exit 1
374
+ fi
375
+
376
+ jq -f "$jq_template" .aether/data/COLONY_STATE.json.bak > .aether/data/COLONY_STATE.json
377
+ ```
378
+
379
+ Verify reset succeeded:
380
+ ```bash
381
+ new_goal=$(jq -r '.goal' .aether/data/COLONY_STATE.json)
382
+ if [[ "$new_goal" != "null" ]]; then
383
+ # Restore from backup
384
+ mv .aether/data/COLONY_STATE.json.bak .aether/data/COLONY_STATE.json
385
+ echo "Error: State reset failed. Restored from backup."
386
+ exit 1
387
+ fi
388
+ ```
389
+
390
+ Remove backup after successful reset:
391
+ ```bash
392
+ rm -f .aether/data/COLONY_STATE.json.bak
393
+ ```
394
+
395
+ Clear session data:
396
+ ```bash
397
+ rm -f .aether/data/session.json
398
+ ```
399
+
400
+ Clean up seal document (it's now in the chamber):
401
+ ```bash
402
+ rm -f .aether/CROWNED-ANTHILL.md
403
+ ```
404
+
405
+ ### Step 11: Write HANDOFF.md
406
+
407
+ Write handoff documenting the entombed colony:
408
+
409
+ Resolve the handoff template path:
410
+ Check ~/.aether/system/templates/handoff.template.md first,
411
+ then .aether/templates/handoff.template.md.
412
+
413
+ If no template found: output "Template missing: handoff.template.md. Run aether update to fix." and stop.
414
+
415
+ Read the template file. Fill all {{PLACEHOLDER}} values:
416
+ - {{CHAMBER_NAME}} → chamber_name
417
+ - {{GOAL}} → goal
418
+ - {{PHASES_COMPLETED}} → phases completed count
419
+ - {{TOTAL_PHASES}} → total phases count
420
+ - {{MILESTONE}} → milestone
421
+ - {{ENTOMB_TIMESTAMP}} → current ISO-8601 UTC timestamp
422
+
423
+ Remove the HTML comment lines at the top of the template.
424
+ Write the result to .aether/HANDOFF.md using the Write tool.
425
+
426
+ ### Step 12: Display Result
427
+
428
+ **If visual_mode is true, render swarm display (consolidated):**
429
+ ```bash
430
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Colony entombed" "Colony" '{"read":3,"grep":0,"edit":2,"bash":5}' 100 "fungus_garden" 100 && bash .aether/aether-utils.sh swarm-display-inline "$entomb_id"
431
+ ```
432
+
433
+ Display:
434
+ ```
435
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
436
+ C O L O N Y E N T O M B E D
437
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
438
+
439
+ Colony archived successfully
440
+
441
+ Goal: {goal}
442
+ Phases: {completed} completed
443
+ Milestone: {milestone}
444
+
445
+ Chamber: .aether/chambers/{chamber_name}/
446
+ {xml_archive_line}
447
+
448
+ The colony rests. Its learnings live on in QUEEN.md.
449
+
450
+ ──────────────────────────────────────────────────
451
+ 🐜 Next Up
452
+ ──────────────────────────────────────────────────
453
+ /ant:lay-eggs 🥚 Start a new colony
454
+ /ant:tunnels 🗄️ Browse archived chambers
455
+ ```
456
+
457
+ What would you like to do next?
458
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
459
+ 2. /ant:tunnels — Browse archived colonies
460
+ 3. /clear — Clear context and continue
461
+
462
+ Use AskUserQuestion with these three options.
463
+
464
+ If option 1 selected: proceed to run /ant:lay-eggs flow
465
+ If option 2 selected: run /ant:tunnels
466
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
467
+ ```
468
+
469
+ ### Edge Cases
470
+
471
+ **Colony not sealed:**
472
+ - Refuse with guidance to run /ant:seal first. This is the primary gate.
473
+
474
+ **Chamber name collision:**
475
+ - Automatically append counter to make unique.
476
+
477
+ **Missing files during archive:**
478
+ - Note in output but continue with available files. The `|| true` in the copy loop handles this.
479
+
480
+ **State reset failure:**
481
+ - Restore from backup, display error, do not claim success.
482
+
483
+ **Empty phases array:**
484
+ - Can entomb a colony that was initialized but had no phases planned (treat as 0 of 0 completed).
485
+
486
+ **Missing CROWNED-ANTHILL.md:**
487
+ - Refuse with guidance to run /ant:seal again.
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: ant:feedback
3
+ description: "Emit FEEDBACK signal to provide guidance to colony"
4
+ ---
5
+
6
+ You are the **Queen**. Emit a FEEDBACK pheromone signal.
7
+
8
+ ## Instructions
9
+
10
+ The feedback message is: `$ARGUMENTS`
11
+
12
+ ### Step 1: Validate
13
+
14
+ If `$ARGUMENTS` empty -> show usage: `/ant:feedback <message>`, stop.
15
+ If content > 500 chars -> "Signal content too long (max 500 chars)", stop.
16
+
17
+ Parse optional flags from `$ARGUMENTS`:
18
+ - `--ttl <value>`: signal lifetime (e.g., `2h`, `1d`, `7d`). Default: `phase_end`.
19
+ - Strip flags from content before using it as the feedback message.
20
+
21
+ ### Step 2: Write Signal and Create Instinct
22
+
23
+ Read `.aether/data/COLONY_STATE.json`.
24
+ If `goal: null` -> "No colony initialized.", stop.
25
+
26
+ Run using the Bash tool with description "Recording colony feedback...":
27
+ ```bash
28
+ bash .aether/aether-utils.sh pheromone-write FEEDBACK "<content>" --strength 0.7 --reason "User feedback guidance" --ttl <ttl>
29
+ ```
30
+
31
+ **Create instinct from feedback:**
32
+ User feedback is high-value learning. Generate ISO-8601 timestamp and append to `memory.instincts` in COLONY_STATE.json:
33
+ ```json
34
+ {
35
+ "id": "instinct_<timestamp>",
36
+ "trigger": "<infer from feedback context>",
37
+ "action": "<the feedback guidance>",
38
+ "confidence": 0.7,
39
+ "domain": "<infer: testing|architecture|code-style|debugging|workflow>",
40
+ "source": "user_feedback",
41
+ "evidence": ["User feedback: <content>"],
42
+ "created_at": "<ISO-8601>",
43
+ "last_applied": null,
44
+ "applications": 0,
45
+ "successes": 0
46
+ }
47
+ ```
48
+
49
+ Write COLONY_STATE.json.
50
+
51
+ ### Step 3: Get Active Counts
52
+
53
+ Run using the Bash tool with description "Counting active signals...":
54
+ ```bash
55
+ bash .aether/aether-utils.sh pheromone-count
56
+ ```
57
+
58
+ ### Step 4: Confirm
59
+
60
+ Output (4 lines, no banners):
61
+ ```
62
+ FEEDBACK signal emitted
63
+ Note: "<content truncated to 60 chars>"
64
+ Strength: 0.7 | Expires: <phase end or ttl value>
65
+ Active signals: <focus_count> FOCUS, <redirect_count> REDIRECT, <feedback_count> FEEDBACK
66
+
67
+ Instinct created: [0.7] <domain>: <action summary>
68
+ ```
69
+
70
+ ### Step 5: Next Up
71
+
72
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
73
+ ```bash
74
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
75
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
76
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
77
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
78
+ ```
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: ant:flag
3
+ description: "🚩🐜📋🐜🚩 Create a project-specific flag (blocker, issue, or note)"
4
+ ---
5
+
6
+ You are the **Queen**. Create a project-specific flag.
7
+
8
+ ## Instructions
9
+
10
+ The flag is: `$ARGUMENTS`
11
+
12
+ ### Step 1: Parse Arguments
13
+
14
+ Parse `$ARGUMENTS` for:
15
+ - `--type` or `-t`: blocker | issue | note (default: issue)
16
+ - `--phase` or `-p`: phase number (optional)
17
+ - Remaining text: the flag title/description
18
+
19
+ Examples:
20
+ - `/ant:flag "Build fails on auth module"` → issue type
21
+ - `/ant:flag --type blocker "API rate limit hit"` → blocker type
22
+ - `/ant:flag -t note -p 3 "Consider refactoring later"` → note for phase 3
23
+
24
+ If `$ARGUMENTS` is empty:
25
+ ```
26
+ Usage: /ant:flag "<description>" [--type blocker|issue|note] [--phase N]
27
+
28
+ Types:
29
+ blocker Critical issue that blocks phase advancement
30
+ issue Warning that should be addressed (default)
31
+ note Informational for future reference
32
+
33
+ Examples:
34
+ /ant:flag "Build fails on auth"
35
+ /ant:flag --type blocker "Tests hanging"
36
+ /ant:flag -t note "Consider refactoring"
37
+ ```
38
+ Stop here.
39
+
40
+ ### Step 2: Validate Colony
41
+
42
+ Read `.aether/data/COLONY_STATE.json`.
43
+ If file missing or `goal: null`:
44
+ ```
45
+ No colony initialized. Run /ant:init first.
46
+ ```
47
+ Stop here.
48
+
49
+ ### Step 3: Create Flag
50
+
51
+ Run using the Bash tool with description "Raising colony flag...":
52
+ ```bash
53
+ bash .aether/aether-utils.sh flag-add "{type}" "{title}" "{description}" "manual" {phase_or_null}
54
+ ```
55
+
56
+ Parse the result for the flag ID.
57
+
58
+ ### Step 4: Confirm
59
+
60
+ Output header based on flag type:
61
+
62
+ **For blocker:**
63
+ ```
64
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
+ 🚩🐜📋🐜🚩 B L O C K E R F L A G C R E A T E D
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+ ```
68
+
69
+ **For issue:**
70
+ ```
71
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
+ 🚩🐜📋🐜🚩 I S S U E F L A G C R E A T E D
73
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74
+ ```
75
+
76
+ **For note:**
77
+ ```
78
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
79
+ 🚩🐜📋🐜🚩 N O T E F L A G C R E A T E D
80
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
81
+ ```
82
+
83
+ Then output based on flag type:
84
+
85
+ **For blocker:**
86
+ ```
87
+ 🚫 BLOCKER flag created
88
+
89
+ "{title}"
90
+
91
+ ID: {flag_id}
92
+ Phase: {phase or "all"}
93
+
94
+ ⚠️ This will BLOCK phase advancement until resolved.
95
+ Use /ant:flags to view all flags.
96
+ ```
97
+
98
+ **For issue:**
99
+ ```
100
+ ⚠️ ISSUE flag created
101
+
102
+ "{title}"
103
+
104
+ ID: {flag_id}
105
+ Phase: {phase or "all"}
106
+
107
+ Use /ant:flags to view all flags.
108
+ ```
109
+
110
+ **For note:**
111
+ ```
112
+ 📝 NOTE flag created
113
+
114
+ "{title}"
115
+
116
+ ID: {flag_id}
117
+ Phase: {phase or "all"}
118
+
119
+ Use /ant:flags to view all flags.
120
+ ```
121
+
122
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
123
+ ```bash
124
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
125
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
126
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
127
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Flag Lifecycle
133
+
134
+ 1. **Created** - Flag is active and visible
135
+ 2. **Acknowledged** - Flag noted but continuing (issues/notes only)
136
+ 3. **Resolved** - Flag closed with resolution message
137
+ 4. **Auto-resolved** - Blockers auto-resolve on build_pass
138
+
139
+ Blockers CANNOT be acknowledged - they must be resolved before phase advancement.