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,367 @@
1
+ ---
2
+ name: ant:entomb
3
+ description: "⚰️🐜⚰️ Entomb completed colony in chambers"
4
+ ---
5
+
6
+ You are the **Queen**. Archive the completed colony to chambers.
7
+
8
+ ## Instructions
9
+
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
19
+
20
+ ### Step 0: Initialize Visual Mode (if enabled)
21
+
22
+ If `visual_mode` is true:
23
+ ```bash
24
+ # Generate session ID
25
+ entomb_id="entomb-$(date +%s)"
26
+
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$entomb_id"
29
+ 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
30
+ ```
31
+
32
+ ### Step 1: Read State
33
+
34
+ Read `.aether/data/COLONY_STATE.json`.
35
+
36
+ If file missing or `goal: null`:
37
+ ```
38
+ No colony to entomb. Run /ant:init first.
39
+ ```
40
+ Stop here.
41
+
42
+ ### Step 2: Validate Colony Can Be Entombed
43
+
44
+ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `memory.decisions`, `memory.phase_learnings`.
45
+
46
+ **Precondition 1: All phases must be completed**
47
+
48
+ Check if all phases in `plan.phases` have `status: "completed"`:
49
+ ```
50
+ all_completed = all(phase.status == "completed" for phase in plan.phases)
51
+ ```
52
+
53
+ If NOT all completed:
54
+ ```
55
+ Cannot entomb incomplete colony.
56
+
57
+ Completed phases: X of Y
58
+ Remaining: {list of incomplete phase names}
59
+
60
+ Run /ant:continue to complete remaining phases first.
61
+ ```
62
+ Stop here.
63
+
64
+ **Precondition 2: State must not be EXECUTING**
65
+
66
+ If `state == "EXECUTING"`:
67
+ ```
68
+ Colony is still executing. Run /ant:continue to reconcile first.
69
+ ```
70
+ Stop here.
71
+
72
+ **Precondition 3: No critical errors**
73
+
74
+ Check `errors.records` for any entries with `severity: "critical"`.
75
+
76
+ If critical errors exist:
77
+ ```
78
+ Cannot entomb colony with critical errors.
79
+
80
+ Critical errors: {count}
81
+ Run /ant:continue to resolve errors first.
82
+ ```
83
+ Stop here.
84
+
85
+ ### Step 3: Compute Milestone
86
+
87
+ Determine milestone based on phases completed:
88
+ - 0 phases: "Fresh Start"
89
+ - 1 phase: "First Mound"
90
+ - 2-4 phases: "Open Chambers"
91
+ - 5+ phases: "Sealed Chambers"
92
+
93
+ If all phases completed AND user explicitly sealing: "Crowned Anthill"
94
+
95
+ For entombment, use the computed milestone or extract from state if already set.
96
+
97
+ ### Step 4: User Confirmation
98
+
99
+ Display:
100
+ ```
101
+ 🏺 ═══════════════════════════════════════════════════
102
+ E N T O M B C O L O N Y
103
+ ══════════════════════════════════════════════════ 🏺
104
+
105
+ Goal: {goal}
106
+ Phases: {completed}/{total} completed
107
+ Milestone: {milestone}
108
+
109
+ Archive will include:
110
+ - COLONY_STATE.json
111
+ - manifest.json (pheromone trails)
112
+
113
+ This will reset the active colony. Continue? (yes/no)
114
+ ```
115
+
116
+ Wait for explicit "yes" response before proceeding.
117
+
118
+ If user responds with anything other than "yes", display:
119
+ ```
120
+ Entombment cancelled. Colony remains active.
121
+ ```
122
+ Stop here.
123
+
124
+ ### Step 4.5: Check XML Tools
125
+
126
+ XML archiving is required for entombment. Check tool availability before proceeding.
127
+ Uses `command -v xmllint` directly — consistent with seal.md's tool check.
128
+
129
+ ```bash
130
+ if command -v xmllint >/dev/null 2>&1; then
131
+ xmllint_available=true
132
+ else
133
+ xmllint_available=false
134
+ fi
135
+ ```
136
+
137
+ **If xmllint is NOT available:**
138
+
139
+ Ask the user:
140
+ ```
141
+ xmllint is not installed — XML archiving requires it.
142
+
143
+ Install now?
144
+ - macOS: xcode-select --install (or brew install libxml2)
145
+ - Linux: apt-get install libxml2-utils
146
+
147
+ Install xmllint? (yes/no)
148
+ ```
149
+
150
+ Use AskUserQuestion with yes/no options.
151
+
152
+ If yes:
153
+ - On macOS: Run `xcode-select --install` or `brew install libxml2`
154
+ - On Linux: Run `sudo apt-get install -y libxml2-utils`
155
+ - After install attempt, re-check: `command -v xmllint >/dev/null 2>&1`
156
+ - If still not available after install:
157
+ ```
158
+ xmllint installation failed. Cannot entomb without XML archiving.
159
+ Install xmllint manually and try again.
160
+ ```
161
+ Stop here.
162
+
163
+ If no:
164
+ ```
165
+ Entombment requires XML archiving. Install xmllint and try again.
166
+ ```
167
+ Stop here.
168
+
169
+ ### Step 5: Create Chamber
170
+
171
+ Generate chamber name:
172
+ ```bash
173
+ sanitized_goal=$(echo "{goal}" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '-' | sed 's/^-//;s/-$//' | cut -c1-50)
174
+ timestamp=$(date -u +%Y%m%d-%H%M%S)
175
+ chamber_name="${sanitized_goal}-${timestamp}"
176
+ ```
177
+
178
+ Handle name collision: if directory exists, append counter:
179
+ ```bash
180
+ counter=1
181
+ original_name="$chamber_name"
182
+ while [[ -d ".aether/chambers/$chamber_name" ]]; do
183
+ chamber_name="${original_name}-${counter}"
184
+ counter=$((counter + 1))
185
+ done
186
+ ```
187
+
188
+ ### Step 6: Create Chamber Using Utilities
189
+
190
+ Extract decisions and learnings as JSON arrays:
191
+ ```bash
192
+ decisions_json=$(jq -c '.memory.decisions // []' .aether/data/COLONY_STATE.json)
193
+ learnings_json=$(jq -c '.memory.phase_learnings // []' .aether/data/COLONY_STATE.json)
194
+ phases_completed=$(jq '[.plan.phases[] | select(.status == "completed")] | length' .aether/data/COLONY_STATE.json)
195
+ total_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
196
+ version=$(jq -r '.version // "3.0"' .aether/data/COLONY_STATE.json)
197
+ ```
198
+
199
+ Create the chamber:
200
+ ```bash
201
+ bash .aether/aether-utils.sh chamber-create \
202
+ ".aether/chambers/{chamber_name}" \
203
+ ".aether/data/COLONY_STATE.json" \
204
+ "{goal}" \
205
+ {phases_completed} \
206
+ {total_phases} \
207
+ "{milestone}" \
208
+ "{version}" \
209
+ '{decisions_json}' \
210
+ '{learnings_json}'
211
+ ```
212
+
213
+ ### Step 6.5: Export XML Archive (hard-stop)
214
+
215
+ Export combined XML archive to the chamber. This is a HARD REQUIREMENT — entomb fails if XML export fails.
216
+
217
+ ```bash
218
+ chamber_dir=".aether/chambers/$chamber_name"
219
+ xml_result=$(bash .aether/aether-utils.sh colony-archive-xml "$chamber_dir/colony-archive.xml" 2>&1)
220
+ xml_ok=$(echo "$xml_result" | jq -r '.ok // false' 2>/dev/null)
221
+
222
+ if [[ "$xml_ok" != "true" ]]; then
223
+ # HARD STOP — remove the chamber and abort
224
+ rm -rf "$chamber_dir"
225
+ echo "XML archive export failed. Colony NOT entombed."
226
+ echo ""
227
+ echo "Error: $(echo "$xml_result" | jq -r '.error // "Unknown error"' 2>/dev/null)"
228
+ echo ""
229
+ echo "The chamber has been cleaned up. Fix the XML issue and try again."
230
+ # Do NOT proceed to state reset or any further steps
231
+ fi
232
+ ```
233
+
234
+ If xml_ok is true, store for display:
235
+ ```bash
236
+ xml_pheromone_count=$(echo "$xml_result" | jq -r '.result.pheromone_count // 0' 2>/dev/null)
237
+ xml_archive_line="XML Archive: colony-archive.xml (${xml_pheromone_count} active signals)"
238
+ ```
239
+
240
+ **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.
241
+
242
+ ### Step 7: Verify Chamber Integrity
243
+
244
+ Run verification:
245
+ ```bash
246
+ bash .aether/aether-utils.sh chamber-verify ".aether/chambers/{chamber_name}"
247
+ ```
248
+
249
+ If verification fails, display error and stop:
250
+ ```
251
+ ❌ Chamber verification failed.
252
+
253
+ Error: {verification_error}
254
+
255
+ The colony has NOT been reset. Please check the chamber directory:
256
+ .aether/chambers/{chamber_name}/
257
+ ```
258
+ Stop here.
259
+
260
+ ### Step 8: Reset Colony State
261
+
262
+ Backup current state:
263
+ ```bash
264
+ cp .aether/data/COLONY_STATE.json .aether/data/COLONY_STATE.json.bak
265
+ ```
266
+
267
+ Reset state (including memory fields, already promoted to QUEEN.md):
268
+ ```bash
269
+ # Resolve jq template path (hub-first)
270
+ jq_template=""
271
+ for path in \
272
+ "$HOME/.aether/system/templates/colony-state-reset.jq.template" \
273
+ ".aether/templates/colony-state-reset.jq.template"; do
274
+ if [[ -f "$path" ]]; then
275
+ jq_template="$path"
276
+ break
277
+ fi
278
+ done
279
+
280
+ if [[ -z "$jq_template" ]]; then
281
+ echo "Template missing: colony-state-reset.jq.template. Run aether update to fix."
282
+ exit 1
283
+ fi
284
+
285
+ jq -f "$jq_template" .aether/data/COLONY_STATE.json.bak > .aether/data/COLONY_STATE.json
286
+ ```
287
+
288
+ Verify reset succeeded:
289
+ ```bash
290
+ new_goal=$(jq -r '.goal' .aether/data/COLONY_STATE.json)
291
+ if [[ "$new_goal" != "null" ]]; then
292
+ # Restore from backup
293
+ mv .aether/data/COLONY_STATE.json.bak .aether/data/COLONY_STATE.json
294
+ echo "Error: State reset failed. Restored from backup."
295
+ exit 1
296
+ fi
297
+ ```
298
+
299
+ Remove backup after successful reset:
300
+ ```bash
301
+ rm -f .aether/data/COLONY_STATE.json.bak
302
+ ```
303
+
304
+ ### Step 8.5: Write Final Handoff
305
+
306
+ After entombing the colony, write the final handoff documenting the archived colony:
307
+
308
+ Resolve the handoff template path:
309
+ Check ~/.aether/system/templates/handoff.template.md first,
310
+ then .aether/templates/handoff.template.md.
311
+
312
+ If no template found: output "Template missing: handoff.template.md. Run aether update to fix." and stop.
313
+
314
+ Read the template file. Fill all {{PLACEHOLDER}} values:
315
+ - {{CHAMBER_NAME}} → chamber_name
316
+ - {{GOAL}} → goal
317
+ - {{PHASES_COMPLETED}} → phases completed count
318
+ - {{TOTAL_PHASES}} → total phases count
319
+ - {{MILESTONE}} → milestone
320
+ - {{ENTOMB_TIMESTAMP}} → current ISO-8601 UTC timestamp
321
+
322
+ Remove the HTML comment lines at the top of the template.
323
+ Write the result to .aether/HANDOFF.md using the Write tool.
324
+
325
+ This handoff serves as the record of the entombed colony.
326
+
327
+ ### Step 9: Display Result
328
+
329
+ ```
330
+ 🏺 ═══════════════════════════════════════════════════
331
+ C O L O N Y E N T O M B E D
332
+ ══════════════════════════════════════════════════ 🏺
333
+
334
+ ✅ Colony archived successfully
335
+
336
+ 👑 Goal: {goal}
337
+ 📍 Phases: {completed} completed
338
+ 🏆 Milestone: {milestone}
339
+
340
+ 📦 Chamber: .aether/chambers/{chamber_name}/
341
+ {xml_archive_line}
342
+
343
+ 🐜 The colony rests. Its learnings are preserved.
344
+
345
+ 💾 State persisted — safe to /clear
346
+
347
+ 🐜 What would you like to do next?
348
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
349
+ 2. /ant:tunnels — Browse archived colonies
350
+ 3. /clear — Clear context and continue
351
+
352
+ Use AskUserQuestion with these three options.
353
+
354
+ If option 1 selected: proceed to run /ant:lay-eggs flow
355
+ If option 2 selected: run /ant:tunnels
356
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
357
+ ```
358
+
359
+ ### Edge Cases
360
+
361
+ **Chamber name collision:** Automatically append counter to make unique.
362
+
363
+ **Missing files during archive:** Note in output but continue with available files.
364
+
365
+ **State reset failure:** Restore from backup, display error, do not claim success.
366
+
367
+ **Empty phases array:** Can entomb a colony that was initialized but had no phases planned (treat as 0 of 0 completed).
@@ -0,0 +1,80 @@
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 signal.
7
+
8
+ ## Instructions
9
+
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ The feedback message is: `$normalized_args`
17
+
18
+ ### Step 1: Validate
19
+ If `$normalized_args` empty -> show usage: `/ant:feedback <message>`, stop.
20
+ If content > 500 chars -> "Signal content too long (max 500 chars)", stop.
21
+
22
+ ### Step 2: Read + Update State
23
+ Read `.aether/data/COLONY_STATE.json`.
24
+ If `goal: null` -> "No colony initialized.", stop.
25
+
26
+ Generate ISO-8601 timestamp.
27
+
28
+ **Add signal:**
29
+ Append to `signals` array:
30
+ ```json
31
+ {
32
+ "id": "feedback_<timestamp_ms>",
33
+ "type": "FEEDBACK",
34
+ "content": "<feedback message>",
35
+ "priority": "low",
36
+ "created_at": "<ISO-8601>",
37
+ "expires_at": "phase_end"
38
+ }
39
+ ```
40
+
41
+ **Create instinct from feedback:**
42
+ User feedback is high-value learning. Append to `memory.instincts`:
43
+ ```json
44
+ {
45
+ "id": "instinct_<timestamp>",
46
+ "trigger": "<infer from feedback context>",
47
+ "action": "<the feedback guidance>",
48
+ "confidence": 0.7,
49
+ "domain": "<infer: testing|architecture|code-style|debugging|workflow>",
50
+ "source": "user_feedback",
51
+ "evidence": ["User feedback: <content>"],
52
+ "created_at": "<ISO-8601>",
53
+ "last_applied": null,
54
+ "applications": 0,
55
+ "successes": 0
56
+ }
57
+ ```
58
+
59
+ Write COLONY_STATE.json.
60
+
61
+ ### Step 3: Confirm
62
+
63
+ Output header:
64
+
65
+ ```
66
+ 💬🐜🧠🐜💬 ═══════════════════════════════════════════════════
67
+ F E E D B A C K S I G N A L
68
+ ═══════════════════════════════════════════════════ 💬🐜🧠🐜💬
69
+ ```
70
+
71
+ Then output:
72
+ ```
73
+ 💬 FEEDBACK signal emitted
74
+
75
+ "{content preview}"
76
+
77
+ 🧠 Instinct created: [0.7] <domain>: <action summary>
78
+
79
+ 🐜 The colony will remember this guidance.
80
+ ```
@@ -0,0 +1,137 @@
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
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ The flag is: `$normalized_args`
17
+
18
+ ### Step 1: Parse Arguments
19
+
20
+ Parse `$normalized_args` for:
21
+ - `--type` or `-t`: blocker | issue | note (default: issue)
22
+ - `--phase` or `-p`: phase number (optional)
23
+ - Remaining text: the flag title/description
24
+
25
+ Examples:
26
+ - `/ant:flag "Build fails on auth module"` → issue type
27
+ - `/ant:flag --type blocker "API rate limit hit"` → blocker type
28
+ - `/ant:flag -t note -p 3 "Consider refactoring later"` → note for phase 3
29
+
30
+ If `$normalized_args` is empty:
31
+ ```
32
+ Usage: /ant:flag "<description>" [--type blocker|issue|note] [--phase N]
33
+
34
+ Types:
35
+ blocker Critical issue that blocks phase advancement
36
+ issue Warning that should be addressed (default)
37
+ note Informational for future reference
38
+
39
+ Examples:
40
+ /ant:flag "Build fails on auth"
41
+ /ant:flag --type blocker "Tests hanging"
42
+ /ant:flag -t note "Consider refactoring"
43
+ ```
44
+ Stop here.
45
+
46
+ ### Step 2: Validate Colony
47
+
48
+ Read `.aether/data/COLONY_STATE.json`.
49
+ If file missing or `goal: null`:
50
+ ```
51
+ No colony initialized. Run /ant:init first.
52
+ ```
53
+ Stop here.
54
+
55
+ ### Step 3: Create Flag
56
+
57
+ Run:
58
+ ```bash
59
+ bash .aether/aether-utils.sh flag-add "{type}" "{title}" "{description}" "manual" {phase_or_null}
60
+ ```
61
+
62
+ Parse the result for the flag ID.
63
+
64
+ ### Step 4: Confirm
65
+
66
+ Output header based on flag type:
67
+
68
+ **For blocker:**
69
+ ```
70
+ 🚩🐜📋🐜🚩 ═══════════════════════════════════════════════════
71
+ B L O C K E R F L A G C R E A T E D
72
+ ═══════════════════════════════════════════════════ 🚩🐜📋🐜🚩
73
+ ```
74
+
75
+ **For issue:**
76
+ ```
77
+ 🚩🐜📋🐜🚩 ═══════════════════════════════════════════════════
78
+ I S S U E F L A G C R E A T E D
79
+ ═══════════════════════════════════════════════════ 🚩🐜📋🐜🚩
80
+ ```
81
+
82
+ **For note:**
83
+ ```
84
+ 🚩🐜📋🐜🚩 ═══════════════════════════════════════════════════
85
+ N O T E F L A G C R E A T E D
86
+ ═══════════════════════════════════════════════════ 🚩🐜📋🐜🚩
87
+ ```
88
+
89
+ Then output based on flag type:
90
+
91
+ **For blocker:**
92
+ ```
93
+ 🚫 BLOCKER flag created
94
+
95
+ "{title}"
96
+
97
+ ID: {flag_id}
98
+ Phase: {phase or "all"}
99
+
100
+ ⚠️ This will BLOCK phase advancement until resolved.
101
+ Use /ant:flags to view all flags.
102
+ ```
103
+
104
+ **For issue:**
105
+ ```
106
+ ⚠️ ISSUE flag created
107
+
108
+ "{title}"
109
+
110
+ ID: {flag_id}
111
+ Phase: {phase or "all"}
112
+
113
+ Use /ant:flags to view all flags.
114
+ ```
115
+
116
+ **For note:**
117
+ ```
118
+ 📝 NOTE flag created
119
+
120
+ "{title}"
121
+
122
+ ID: {flag_id}
123
+ Phase: {phase or "all"}
124
+
125
+ Use /ant:flags to view all flags.
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Flag Lifecycle
131
+
132
+ 1. **Created** - Flag is active and visible
133
+ 2. **Acknowledged** - Flag noted but continuing (issues/notes only)
134
+ 3. **Resolved** - Flag closed with resolution message
135
+ 4. **Auto-resolved** - Blockers auto-resolve on build_pass
136
+
137
+ Blockers CANNOT be acknowledged - they must be resolved before phase advancement.