aether-colony 5.1.0 → 5.3.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 (185) hide show
  1. package/.aether/aether-utils.sh +157 -42
  2. package/.aether/agents/aether-ambassador.md +140 -0
  3. package/.aether/agents/aether-archaeologist.md +108 -0
  4. package/.aether/agents/aether-architect.md +133 -0
  5. package/.aether/agents/aether-auditor.md +144 -0
  6. package/.aether/agents/aether-builder.md +184 -0
  7. package/.aether/agents/aether-chaos.md +115 -0
  8. package/.aether/agents/aether-chronicler.md +122 -0
  9. package/.aether/agents/aether-gatekeeper.md +116 -0
  10. package/.aether/agents/aether-includer.md +117 -0
  11. package/.aether/agents/aether-keeper.md +177 -0
  12. package/.aether/agents/aether-measurer.md +128 -0
  13. package/.aether/agents/aether-oracle.md +137 -0
  14. package/.aether/agents/aether-probe.md +133 -0
  15. package/.aether/agents/aether-queen.md +286 -0
  16. package/.aether/agents/aether-route-setter.md +130 -0
  17. package/.aether/agents/aether-sage.md +106 -0
  18. package/.aether/agents/aether-scout.md +101 -0
  19. package/.aether/agents/aether-surveyor-disciplines.md +391 -0
  20. package/.aether/agents/aether-surveyor-nest.md +329 -0
  21. package/.aether/agents/aether-surveyor-pathogens.md +264 -0
  22. package/.aether/agents/aether-surveyor-provisions.md +334 -0
  23. package/.aether/agents/aether-tracker.md +137 -0
  24. package/.aether/agents/aether-watcher.md +174 -0
  25. package/.aether/agents/aether-weaver.md +130 -0
  26. package/.aether/commands/claude/archaeology.md +334 -0
  27. package/.aether/commands/claude/build.md +65 -0
  28. package/.aether/commands/claude/chaos.md +336 -0
  29. package/.aether/commands/claude/colonize.md +259 -0
  30. package/.aether/commands/claude/continue.md +60 -0
  31. package/.aether/commands/claude/council.md +507 -0
  32. package/.aether/commands/claude/data-clean.md +81 -0
  33. package/.aether/commands/claude/dream.md +268 -0
  34. package/.aether/commands/claude/entomb.md +498 -0
  35. package/.aether/commands/claude/export-signals.md +57 -0
  36. package/.aether/commands/claude/feedback.md +96 -0
  37. package/.aether/commands/claude/flag.md +151 -0
  38. package/.aether/commands/claude/flags.md +169 -0
  39. package/.aether/commands/claude/focus.md +76 -0
  40. package/.aether/commands/claude/help.md +154 -0
  41. package/.aether/commands/claude/history.md +140 -0
  42. package/.aether/commands/claude/import-signals.md +71 -0
  43. package/.aether/commands/claude/init.md +505 -0
  44. package/.aether/commands/claude/insert-phase.md +105 -0
  45. package/.aether/commands/claude/interpret.md +278 -0
  46. package/.aether/commands/claude/lay-eggs.md +210 -0
  47. package/.aether/commands/claude/maturity.md +113 -0
  48. package/.aether/commands/claude/memory-details.md +77 -0
  49. package/.aether/commands/claude/migrate-state.md +171 -0
  50. package/.aether/commands/claude/oracle.md +642 -0
  51. package/.aether/commands/claude/organize.md +232 -0
  52. package/.aether/commands/claude/patrol.md +620 -0
  53. package/.aether/commands/claude/pause-colony.md +233 -0
  54. package/.aether/commands/claude/phase.md +115 -0
  55. package/.aether/commands/claude/pheromones.md +156 -0
  56. package/.aether/commands/claude/plan.md +693 -0
  57. package/.aether/commands/claude/preferences.md +65 -0
  58. package/.aether/commands/claude/quick.md +100 -0
  59. package/.aether/commands/claude/redirect.md +76 -0
  60. package/.aether/commands/claude/resume-colony.md +197 -0
  61. package/.aether/commands/claude/resume.md +388 -0
  62. package/.aether/commands/claude/run.md +231 -0
  63. package/.aether/commands/claude/seal.md +774 -0
  64. package/.aether/commands/claude/skill-create.md +286 -0
  65. package/.aether/commands/claude/status.md +410 -0
  66. package/.aether/commands/claude/swarm.md +349 -0
  67. package/.aether/commands/claude/tunnels.md +426 -0
  68. package/.aether/commands/claude/update.md +132 -0
  69. package/.aether/commands/claude/verify-castes.md +143 -0
  70. package/.aether/commands/claude/watch.md +239 -0
  71. package/.aether/commands/colonize.yaml +4 -0
  72. package/.aether/commands/council.yaml +205 -0
  73. package/.aether/commands/init.yaml +46 -13
  74. package/.aether/commands/insert-phase.yaml +4 -0
  75. package/.aether/commands/opencode/archaeology.md +331 -0
  76. package/.aether/commands/opencode/build.md +1168 -0
  77. package/.aether/commands/opencode/chaos.md +329 -0
  78. package/.aether/commands/opencode/colonize.md +195 -0
  79. package/.aether/commands/opencode/continue.md +1436 -0
  80. package/.aether/commands/opencode/council.md +437 -0
  81. package/.aether/commands/opencode/data-clean.md +77 -0
  82. package/.aether/commands/opencode/dream.md +260 -0
  83. package/.aether/commands/opencode/entomb.md +377 -0
  84. package/.aether/commands/opencode/export-signals.md +54 -0
  85. package/.aether/commands/opencode/feedback.md +99 -0
  86. package/.aether/commands/opencode/flag.md +149 -0
  87. package/.aether/commands/opencode/flags.md +167 -0
  88. package/.aether/commands/opencode/focus.md +73 -0
  89. package/.aether/commands/opencode/help.md +157 -0
  90. package/.aether/commands/opencode/history.md +136 -0
  91. package/.aether/commands/opencode/import-signals.md +68 -0
  92. package/.aether/commands/opencode/init.md +518 -0
  93. package/.aether/commands/opencode/insert-phase.md +111 -0
  94. package/.aether/commands/opencode/interpret.md +272 -0
  95. package/.aether/commands/opencode/lay-eggs.md +213 -0
  96. package/.aether/commands/opencode/maturity.md +108 -0
  97. package/.aether/commands/opencode/memory-details.md +83 -0
  98. package/.aether/commands/opencode/migrate-state.md +165 -0
  99. package/.aether/commands/opencode/oracle.md +593 -0
  100. package/.aether/commands/opencode/organize.md +226 -0
  101. package/.aether/commands/opencode/patrol.md +626 -0
  102. package/.aether/commands/opencode/pause-colony.md +203 -0
  103. package/.aether/commands/opencode/phase.md +113 -0
  104. package/.aether/commands/opencode/pheromones.md +162 -0
  105. package/.aether/commands/opencode/plan.md +684 -0
  106. package/.aether/commands/opencode/preferences.md +71 -0
  107. package/.aether/commands/opencode/quick.md +91 -0
  108. package/.aether/commands/opencode/redirect.md +84 -0
  109. package/.aether/commands/opencode/resume-colony.md +190 -0
  110. package/.aether/commands/opencode/resume.md +394 -0
  111. package/.aether/commands/opencode/run.md +237 -0
  112. package/.aether/commands/opencode/seal.md +452 -0
  113. package/.aether/commands/opencode/skill-create.md +63 -0
  114. package/.aether/commands/opencode/status.md +307 -0
  115. package/.aether/commands/opencode/swarm.md +15 -0
  116. package/.aether/commands/opencode/tunnels.md +400 -0
  117. package/.aether/commands/opencode/update.md +127 -0
  118. package/.aether/commands/opencode/verify-castes.md +139 -0
  119. package/.aether/commands/opencode/watch.md +227 -0
  120. package/.aether/commands/plan.yaml +53 -2
  121. package/.aether/commands/quick.yaml +104 -0
  122. package/.aether/commands/resume-colony.yaml +6 -4
  123. package/.aether/commands/resume.yaml +9 -0
  124. package/.aether/commands/run.yaml +37 -1
  125. package/.aether/commands/seal.yaml +9 -0
  126. package/.aether/commands/status.yaml +45 -1
  127. package/.aether/docs/command-playbooks/build-full.md +3 -2
  128. package/.aether/docs/command-playbooks/build-prep.md +12 -4
  129. package/.aether/docs/command-playbooks/build-verify.md +51 -0
  130. package/.aether/docs/command-playbooks/continue-advance.md +115 -6
  131. package/.aether/docs/command-playbooks/continue-full.md +1 -0
  132. package/.aether/docs/command-playbooks/continue-verify.md +33 -0
  133. package/.aether/utils/clash-detect.sh +239 -0
  134. package/.aether/utils/council.sh +425 -0
  135. package/.aether/utils/error-handler.sh +3 -3
  136. package/.aether/utils/flag.sh +23 -12
  137. package/.aether/utils/hive.sh +2 -2
  138. package/.aether/utils/hooks/clash-pre-tool-use.js +99 -0
  139. package/.aether/utils/immune.sh +508 -0
  140. package/.aether/utils/learning.sh +2 -2
  141. package/.aether/utils/merge-driver-lockfile.sh +35 -0
  142. package/.aether/utils/midden.sh +712 -0
  143. package/.aether/utils/pheromone.sh +1376 -108
  144. package/.aether/utils/queen.sh +31 -21
  145. package/.aether/utils/session.sh +264 -0
  146. package/.aether/utils/spawn-tree.sh +7 -7
  147. package/.aether/utils/spawn.sh +2 -2
  148. package/.aether/utils/state-api.sh +216 -5
  149. package/.aether/utils/swarm.sh +1 -1
  150. package/.aether/utils/worktree.sh +189 -0
  151. package/.claude/commands/ant/colonize.md +2 -0
  152. package/.claude/commands/ant/council.md +205 -0
  153. package/.claude/commands/ant/init.md +53 -14
  154. package/.claude/commands/ant/insert-phase.md +4 -0
  155. package/.claude/commands/ant/plan.md +27 -1
  156. package/.claude/commands/ant/quick.md +100 -0
  157. package/.claude/commands/ant/resume-colony.md +3 -2
  158. package/.claude/commands/ant/resume.md +9 -0
  159. package/.claude/commands/ant/run.md +37 -1
  160. package/.claude/commands/ant/seal.md +9 -0
  161. package/.claude/commands/ant/status.md +45 -1
  162. package/.opencode/commands/ant/colonize.md +2 -0
  163. package/.opencode/commands/ant/council.md +143 -0
  164. package/.opencode/commands/ant/init.md +53 -13
  165. package/.opencode/commands/ant/insert-phase.md +4 -0
  166. package/.opencode/commands/ant/plan.md +26 -1
  167. package/.opencode/commands/ant/quick.md +91 -0
  168. package/.opencode/commands/ant/resume-colony.md +3 -2
  169. package/.opencode/commands/ant/resume.md +9 -0
  170. package/.opencode/commands/ant/run.md +37 -1
  171. package/.opencode/commands/ant/status.md +2 -0
  172. package/CHANGELOG.md +116 -0
  173. package/README.md +34 -8
  174. package/bin/cli.js +103 -61
  175. package/bin/lib/banner.js +14 -0
  176. package/bin/lib/init.js +8 -7
  177. package/bin/lib/interactive-setup.js +251 -0
  178. package/bin/npx-entry.js +21 -0
  179. package/bin/npx-install.js +9 -167
  180. package/bin/validate-package.sh +23 -0
  181. package/package.json +11 -3
  182. package/.aether/docs/plans/pheromone-display-plan.md +0 -257
  183. package/.aether/schemas/example-prompt-builder.xml +0 -234
  184. package/.aether/scripts/incident-test-add.sh +0 -47
  185. package/.aether/scripts/weekly-audit.sh +0 -79
@@ -0,0 +1,349 @@
1
+ <!-- Generated from .aether/commands/swarm.yaml - DO NOT EDIT DIRECTLY -->
2
+ ---
3
+ name: ant:swarm
4
+ description: "🔥🐜🗡️🐜🔥 Real-time colony swarm display + stubborn bug destroyer"
5
+ ---
6
+
7
+ You are the **Queen Ant Colony**. Deploy the swarm to destroy a stubborn bug or view real-time colony activity.
8
+
9
+ ## Instructions
10
+
11
+ ### Quick View Mode (No Arguments)
12
+
13
+ If `$ARGUMENTS` is empty or equals "--watch":
14
+
15
+ Run the real-time swarm display:
16
+ ```bash
17
+ bash .aether/utils/swarm-display.sh
18
+ ```
19
+
20
+ This shows:
21
+ - Active ants with caste colors and emojis (🔨🐜 Builder in blue, etc.)
22
+ - Tool usage stats per ant (📖5 🔍3 ✏️2 ⚡1)
23
+ - Trophallaxis metrics (🍯 token consumption)
24
+ - Timing information (elapsed time per ant)
25
+ - Chamber activity map (which nest zones have active ants)
26
+ - Animated status phrases ("excavating...", "foraging...")
27
+
28
+ Display updates automatically as ants start/complete work.
29
+ Press Ctrl+C to exit.
30
+
31
+ ### Bug Destruction Mode (With Arguments)
32
+
33
+ The problem to investigate is: `$ARGUMENTS`
34
+
35
+ #### Step 1: Validate Input
36
+
37
+ If `$ARGUMENTS` is empty:
38
+ ```
39
+ 🔥🐜🗡️🐜🔥 SWARM
40
+
41
+ Deploy parallel scouts to investigate and fix stubborn bugs.
42
+
43
+ Usage: /ant:swarm "<describe the problem>"
44
+
45
+ Examples:
46
+ /ant:swarm "Tests keep failing in auth module"
47
+ /ant:swarm "TypeError: Cannot read property 'id' of undefined"
48
+ /ant:swarm "API returns 500 but I can't find the cause"
49
+
50
+ This is the nuclear option - use when repeated fix attempts fail.
51
+ ```
52
+ Stop here.
53
+
54
+ #### Step 2: Read State & Initialize
55
+
56
+ Read `.aether/data/COLONY_STATE.json`.
57
+ If `goal` is null → "No colony initialized. Run /ant:init first.", stop.
58
+
59
+ Generate swarm ID: `swarm-<unix_timestamp>`
60
+
61
+ Initialize swarm findings:
62
+ ```bash
63
+ bash .aether/aether-utils.sh swarm-findings-init "<swarm_id>"
64
+ ```
65
+
66
+ #### Step 2.5: Check for Stale Swarm Session
67
+
68
+ Capture session start time:
69
+ ```bash
70
+ SWARM_START=$(date +%s)
71
+ ```
72
+
73
+ Check for stale swarm files:
74
+ ```bash
75
+ stale_check=$(bash .aether/aether-utils.sh session-verify-fresh --command swarm "" "$SWARM_START")
76
+ has_stale=$(echo "$stale_check" | jq -r '.stale | length')
77
+
78
+ if [[ "$has_stale" -gt 0 ]]; then
79
+ # Auto-clear stale swarm findings (safe - findings are temporary)
80
+ bash .aether/aether-utils.sh session-clear --command swarm
81
+ echo "Cleared stale swarm findings for fresh investigation"
82
+ fi
83
+ ```
84
+
85
+ After initializing findings, verify swarm files are fresh:
86
+ ```bash
87
+ verify_result=$(bash .aether/aether-utils.sh session-verify-fresh --command swarm "" "$SWARM_START")
88
+ if [[ $(echo "$verify_result" | jq -r '.missing | length') -gt 0 ]]; then
89
+ echo "Warning: Swarm files not properly initialized"
90
+ fi
91
+ ```
92
+
93
+ Display header:
94
+ ```
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+ 🔥🐜🗡️🐜🔥 S W A R M D E P L O Y E D
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+
99
+ 🎯 Target: "{problem description}"
100
+ 📍 Swarm ID: {swarm_id}
101
+
102
+ ⚡ Deploying 4 parallel scouts...
103
+ ```
104
+
105
+ #### Step 3: Create Git Checkpoint
106
+
107
+ Before any investigation that might lead to fixes, run using the Bash tool:
108
+ ```bash
109
+ bash .aether/aether-utils.sh autofix-checkpoint "pre-swarm-$SWARM_ID"
110
+ ```
111
+
112
+ Store the result for potential rollback:
113
+ - `checkpoint_type` = result.type ("stash", "commit", or "none")
114
+ - `checkpoint_ref` = result.ref
115
+
116
+ ```
117
+ 💾 Checkpoint: {checkpoint_type} → {checkpoint_ref}
118
+ ```
119
+
120
+ #### Step 4: Read Context
121
+
122
+ Read existing blockers for context:
123
+ ```bash
124
+ bash .aether/aether-utils.sh flag-list --type blocker
125
+ ```
126
+
127
+ Read recent activity:
128
+ ```bash
129
+ tail -50 .aether/data/activity.log 2>/dev/null || echo "(no activity log)"
130
+ ```
131
+
132
+ Scan recent git commits for context:
133
+ ```bash
134
+ git log --oneline -20 2>/dev/null || echo "(no git history)"
135
+ ```
136
+
137
+ #### Step 5: Deploy 4 Parallel Scouts
138
+
139
+ Use the **Task** tool to spawn 4 scouts **in a single message** (parallel execution):
140
+
141
+ **Scout 1: 🏛️ Git Archaeologist** (use Task tool with `subagent_type="aether-archaeologist"`)
142
+ # FALLBACK: If "Agent type not found", use general-purpose and inject role: "You are an Archaeologist Ant - git historian that excavates why code exists."
143
+ ```
144
+ You are {swarm_id}-Archaeologist, a 🏛️🐜 Archaeologist Ant.
145
+
146
+ Investigate git history for: {problem description}
147
+
148
+ Steps:
149
+ 1. Run `git log --oneline -30`
150
+ 2. Run `git log -p --since="1 week ago" -- {relevant files}`
151
+ 3. Run `git blame {suspected file}` if mentioned
152
+ 4. Find commits that introduced the bug
153
+
154
+ Return ONLY this JSON:
155
+ {"scout": "git-archaeologist", "confidence": 0.0-1.0, "finding": {"likely_cause": "...", "relevant_commits": [], "when_it_broke": "...", "evidence": []}, "suggested_fix": "..."}
156
+ ```
157
+
158
+ **Scout 2: 🔍 Pattern Hunter** (use Task tool with `subagent_type="aether-scout"`)
159
+ ```
160
+ You are {swarm_id}-PatternHunter, a 🔍🐜 Scout Ant.
161
+
162
+ Find working patterns for: {problem description}
163
+
164
+ Steps:
165
+ 1. Grep/glob for related working code
166
+ 2. Find how other parts handle this
167
+ 3. Look for test files showing correct usage
168
+ 4. Identify applicable patterns
169
+
170
+ Return ONLY this JSON:
171
+ {"scout": "pattern-hunter", "confidence": 0.0-1.0, "finding": {"working_examples": [], "applicable_patterns": [], "differences": "..."}, "suggested_fix": "..."}
172
+ ```
173
+
174
+ **Scout 3: 💥 Error Analyst** (use Task tool with `subagent_type="aether-tracker"`)
175
+ ```
176
+ You are {swarm_id}-ErrorAnalyst, a 🔍🐜 Tracker Ant.
177
+
178
+ Analyze error: {problem description}
179
+
180
+ Steps:
181
+ 1. Trace through stack trace frames
182
+ 2. Identify actual failing line vs surface error
183
+ 3. Check for null refs, async issues, type mismatches
184
+ 4. Look for error handling masking the issue
185
+
186
+ Return ONLY this JSON:
187
+ {"scout": "error-analyst", "confidence": 0.0-1.0, "finding": {"root_cause": "...", "error_chain": [], "masked_by": "...", "category": "null-ref|async|type|logic|config|dependency"}, "suggested_fix": "..."}
188
+ ```
189
+
190
+ **Scout 4: 🌐 Web Researcher** (use Task tool with `subagent_type="aether-scout"`)
191
+ ```
192
+ You are {swarm_id}-WebResearcher, a 🔍🐜 Scout Ant.
193
+
194
+ Research external solutions for: {problem description}
195
+
196
+ Steps:
197
+ 1. Search for exact error message
198
+ 2. Find library/framework docs
199
+ 3. Check GitHub issues
200
+ 4. Find Stack Overflow answers
201
+
202
+ Return ONLY this JSON:
203
+ {"scout": "web-researcher", "confidence": 0.0-1.0, "finding": {"known_issue": true/false, "documentation_link": "...", "similar_issues": [], "community_solutions": []}, "suggested_fix": "..."}
204
+ ```
205
+
206
+ Wait for all 4 scouts to complete.
207
+
208
+ #### Step 6: Collect and Cross-Compare Findings
209
+
210
+ As each scout returns, add their findings:
211
+ ```bash
212
+ bash .aether/aether-utils.sh swarm-findings-add "{swarm_id}" "{scout_type}" "{confidence}" '{finding_json}'
213
+ ```
214
+
215
+ Display each scout's report as they complete:
216
+ ```
217
+ 🏛️ Archaeologist [{confidence}]
218
+ {summary of finding}
219
+
220
+ 🔍 PatternHunter [{confidence}]
221
+ {summary of finding}
222
+
223
+ 💥 ErrorAnalyst [{confidence}]
224
+ {summary of finding}
225
+
226
+ 🌐 WebResearcher [{confidence}]
227
+ {summary of finding}
228
+ ```
229
+
230
+ #### Step 7: Synthesize Solution
231
+
232
+ Cross-compare all findings:
233
+ 1. Identify where scouts agree (high confidence)
234
+ 2. Note where scouts disagree (investigate further)
235
+ 3. Weight by confidence scores
236
+ 4. Prefer findings with concrete evidence
237
+
238
+ Rank fix options:
239
+ ```
240
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
241
+ S O L U T I O N R A N K I N G
242
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
243
+
244
+ #1 [0.85 confidence] {best solution}
245
+ Evidence: {supporting scouts}
246
+
247
+ #2 [0.72 confidence] {alternative}
248
+ Evidence: {supporting scouts}
249
+
250
+ #3 [0.45 confidence] {fallback}
251
+ Evidence: {limited support}
252
+ ```
253
+
254
+ #### Step 8: Apply Best Fix
255
+
256
+ Select the highest-confidence solution and apply it:
257
+
258
+ **Command Resolution:** Before running verification, resolve `{build_command}` and `{test_command}` using this priority chain (stop at first match per command):
259
+ 1. **CLAUDE.md** — Check project CLAUDE.md (in your system context) for explicit build/test commands
260
+ 2. **CODEBASE.md** — Read `.aether/data/codebase.md` `## Commands` section
261
+ 3. **Fallback** — Use project manifest heuristics (e.g., `npm run build`/`npm test` for package.json)
262
+
263
+ ```
264
+ 🔧 Applying Fix #1...
265
+ ```
266
+
267
+ Make the actual code changes using Edit/Write tools.
268
+
269
+ After applying:
270
+ ```bash
271
+ # Run verification
272
+ {build_command} 2>&1 | tail -30
273
+ {test_command} 2>&1 | tail -50
274
+ ```
275
+
276
+ #### Step 9: Verify and Report
277
+
278
+ **If verification passes:**
279
+ ```
280
+ ✅ FIX VERIFIED
281
+
282
+ Build: PASS
283
+ Tests: PASS
284
+
285
+ 🔥🐜🗡️🐜🔥 Swarm successful!
286
+
287
+ The fix will be confirmed when you run:
288
+ /ant:continue
289
+ ```
290
+
291
+ Inject learnings:
292
+ - Add FOCUS for the pattern that worked (to constraints.json)
293
+ - Add REDIRECT for the anti-pattern that caused the bug (to constraints.json)
294
+
295
+ Set solution in swarm findings and log success:
296
+ ```bash
297
+ bash .aether/aether-utils.sh swarm-solution-set "{swarm_id}" '{solution_json}'
298
+ bash .aether/aether-utils.sh activity-log "SWARM_SUCCESS" "Queen" "Swarm {swarm_id} fixed: {brief description}"
299
+ ```
300
+
301
+ **If verification fails:**
302
+ ```
303
+ ❌ FIX VERIFICATION FAILED
304
+
305
+ Build: {status}
306
+ Tests: {status}
307
+
308
+ Attempting rollback...
309
+ ```
310
+
311
+ Rollback and log failure:
312
+ ```bash
313
+ bash .aether/aether-utils.sh autofix-rollback "{checkpoint_type}" "{checkpoint_ref}"
314
+ bash .aether/aether-utils.sh activity-log "SWARM_FAILED" "Queen" "Swarm {swarm_id} fix failed verification"
315
+ ```
316
+
317
+ Track attempt count. If this is the 3rd failure on the same issue:
318
+ ```
319
+ ⚠️ ARCHITECTURAL CONCERN
320
+
321
+ This problem has resisted 3 swarm attempts.
322
+
323
+ This suggests:
324
+ - Root cause may be architectural, not implementational
325
+ - Pattern may be fundamentally unsound
326
+ - Different approach needed
327
+
328
+ Recommended:
329
+ - Review the codebase architecture
330
+ - Consider refactoring vs. patching
331
+ - Create a new phase for structural fix
332
+
333
+ Swarm will not attempt further fixes on this issue.
334
+ ```
335
+
336
+ #### Step 10: Cleanup
337
+
338
+ Archive findings:
339
+ ```bash
340
+ bash .aether/aether-utils.sh swarm-cleanup "{swarm_id}" --archive
341
+ ```
342
+
343
+ Generate the state-based Next Up block:
344
+ ```bash
345
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
346
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
347
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
348
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
349
+ ```