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,387 @@
1
+ ---
2
+ name: ant:oracle
3
+ description: "🔮🐜🧠🐜🔮🐜 Oracle Ant - deep research agent using RALF iterative loop pattern"
4
+ ---
5
+
6
+ You are the **Oracle Ant** command handler. You configure and launch a deep research loop that runs autonomously in a separate process.
7
+
8
+ The user's input is: `$ARGUMENTS`
9
+
10
+ ## Non-Invasive Guarantee
11
+
12
+ Oracle NEVER touches COLONY_STATE.json, constraints.json, activity.log, or any code files. Only writes to `.aether/oracle/`.
13
+
14
+ ## Instructions
15
+
16
+ ### Step 0: Parse Arguments and Route
17
+
18
+ Parse `$ARGUMENTS` to determine the action:
19
+
20
+ 1. Check for flags:
21
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
22
+ - If contains `--force` or `--force-research`: set `force_research = true`
23
+ - Otherwise: set `visual_mode = true`, `force_research = false`
24
+ - Remove flags from arguments before routing
25
+
26
+ 2. **If remaining arguments is exactly `stop`** — go to **Step 0b: Stop Oracle**
27
+ 3. **If remaining arguments is exactly `status`** — go to **Step 0c: Show Status**
28
+ 4. **Otherwise** — go to **Step 0.5: Initialize Visual Mode** then **Step 1: Research Wizard**
29
+
30
+ ### Step 0.5: Initialize Visual Mode (if enabled)
31
+
32
+ If `visual_mode` is true, run using the Bash tool with description "Initializing oracle display...":
33
+ ```bash
34
+ # Generate session ID
35
+ oracle_id="oracle-$(date +%s)"
36
+
37
+ # Initialize swarm display
38
+ bash .aether/aether-utils.sh swarm-display-init "$oracle_id"
39
+ bash .aether/aether-utils.sh swarm-display-update "Oracle" "oracle" "researching" "Deep research in progress" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
40
+ ```
41
+
42
+ Display visual header:
43
+ ```
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ 🔮🐜🧠🐜🔮 O R A C L E — R e s e a r c h M o d e
46
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
47
+
48
+ Oracle peering into the depths...
49
+ ```
50
+
51
+ ---
52
+
53
+ ### Step 0b: Stop Oracle
54
+
55
+ Create the stop signal file by running using the Bash tool with description "Stopping oracle research...":
56
+
57
+ ```bash
58
+ mkdir -p .aether/oracle && touch .aether/oracle/.stop
59
+ ```
60
+
61
+ Output:
62
+
63
+ ```
64
+ 🔮🐜 Oracle Stop Signal Sent
65
+
66
+ Created .aether/oracle/.stop
67
+ The research loop will halt at the end of the current iteration.
68
+
69
+ To check final results: /ant:oracle status
70
+ ```
71
+
72
+ Stop here. Do not proceed.
73
+
74
+ ---
75
+
76
+ ### Step 0c: Show Status
77
+
78
+ Check if `.aether/oracle/progress.md` exists using the Read tool.
79
+
80
+ **If it does NOT exist**, output:
81
+
82
+ ```
83
+ 🔮🐜 Oracle Status: No Research In Progress
84
+
85
+ No progress.md found. Start a research session:
86
+ /ant:oracle
87
+ ```
88
+
89
+ Stop here.
90
+
91
+ **If it exists**, read `.aether/oracle/progress.md` and `.aether/oracle/research.json` (if present).
92
+
93
+ Count the number of `## Iteration` headings in progress.md to determine iterations completed.
94
+
95
+ Output:
96
+
97
+ ```
98
+ 🔮🐜 Oracle Status
99
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
100
+ Topic: {topic from research.json, or "unknown"}
101
+ Confidence: {target_confidence}%
102
+ Iterations: {completed} / {max_iterations}
103
+ Started: {started_at}
104
+
105
+ Progress:
106
+ {last 50 lines of progress.md}
107
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
+
109
+ /ant:oracle stop Halt the loop
110
+ /ant:oracle Start new research
111
+ ```
112
+
113
+ Stop here.
114
+
115
+ ---
116
+
117
+ ### Step 1: Research Wizard
118
+
119
+ This is the setup phase. The Oracle asks questions to configure the research before launching.
120
+
121
+ Output the header:
122
+
123
+ ```
124
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
125
+ 🔮🐜🧠🐜🔮 O R A C L E A N T — R E S E A R C H W I Z A R D
126
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
127
+ ```
128
+
129
+ **If `$ARGUMENTS` is not empty and not a subcommand**, use it as the initial topic suggestion. Otherwise, the topic will be asked in Question 1.
130
+
131
+ Now ask questions using AskUserQuestion. Ask them one at a time so each answer can inform the next question.
132
+
133
+ **Question 1: Research Topic**
134
+
135
+ If `$ARGUMENTS` already contains a topic, skip this question and use that as the topic.
136
+
137
+ Otherwise ask:
138
+
139
+ ```
140
+ What should the Oracle research?
141
+ ```
142
+
143
+ Options:
144
+ 1. **Codebase analysis** — Deep dive into how this codebase works (architecture, patterns, conventions)
145
+ 2. **External research** — Research a technology, library, or concept using web search
146
+ 3. **Both** — Combine codebase exploration with external research
147
+
148
+ Then use a follow-up AskUserQuestion with a free-text prompt:
149
+
150
+ ```
151
+ Describe the research topic in detail. The more specific, the better the Oracle's results.
152
+ ```
153
+
154
+ (The user will type their topic via the "Other" free-text option.)
155
+
156
+ **Question 2: Research Depth**
157
+
158
+ ```
159
+ How deep should the Oracle go?
160
+ ```
161
+
162
+ Options:
163
+ 1. **Quick scan (5 iterations)** — Surface-level overview, fast results
164
+ 2. **Standard research (15 iterations)** — Thorough investigation, good balance
165
+ 3. **Deep dive (30 iterations)** — Exhaustive research, leaves no stone unturned
166
+ 4. **Marathon (50 iterations)** — Maximum depth, may take hours
167
+
168
+ **Question 3: Confidence Target**
169
+
170
+ ```
171
+ When should the Oracle consider the research complete?
172
+ ```
173
+
174
+ Options:
175
+ 1. **80% confidence** — Good enough for a first pass, stops early
176
+ 2. **90% confidence** — Solid understanding, most questions answered
177
+ 3. **95% confidence (recommended)** — Thorough, few gaps remaining
178
+ 4. **99% confidence** — Near-exhaustive, won't stop until almost everything is known
179
+
180
+ **Question 4: Research Scope** (only if topic involves codebase)
181
+
182
+ ```
183
+ Should the Oracle also search the web, or stay within the codebase?
184
+ ```
185
+
186
+ Options:
187
+ 1. **Codebase only** — Only use Glob, Grep, Read to explore local files
188
+ 2. **Codebase + web** — Also use WebSearch and WebFetch for docs, best practices, prior art
189
+ 3. **Web only** — Focus on external research (libraries, concepts, techniques)
190
+
191
+ After collecting all answers, proceed to Step 2.
192
+
193
+ ---
194
+
195
+ ### Step 1.5: Check for Stale Oracle Session
196
+
197
+ Before starting new research, check for existing oracle session files.
198
+
199
+ Capture session start time:
200
+ ```bash
201
+ ORACLE_START=$(date +%s)
202
+ ```
203
+
204
+ Check for stale files by running using the Bash tool with description "Checking for stale oracle session...":
205
+ ```bash
206
+ stale_check=$(bash .aether/aether-utils.sh session-verify-fresh --command oracle "" "$ORACLE_START")
207
+ has_stale=$(echo "$stale_check" | jq -r '.stale | length')
208
+ has_progress=$(echo "$stale_check" | jq -r '.fresh | length')
209
+
210
+ if [[ "$has_stale" -gt 0 ]] || [[ "$has_progress" -gt 0 ]]; then
211
+ # Found existing oracle session
212
+ if [[ "$force_research" == "true" ]]; then
213
+ bash .aether/aether-utils.sh session-clear --command oracle
214
+ echo "Cleared stale oracle session for fresh research"
215
+ else
216
+ # Existing session found - prompt user
217
+ echo "Found existing oracle session. Options:"
218
+ echo " /ant:oracle status - View current session"
219
+ echo " /ant:oracle --force - Restart with fresh session"
220
+ echo " /ant:oracle stop - Stop current session"
221
+ # Don't proceed - let user decide
222
+ exit 0
223
+ fi
224
+ fi
225
+ ```
226
+
227
+ ---
228
+
229
+ ### Step 2: Configure Research
230
+
231
+ Create the oracle directory structure by running using the Bash tool with description "Setting up oracle research...":
232
+
233
+ ```bash
234
+ mkdir -p .aether/oracle/archive .aether/oracle/discoveries
235
+ ```
236
+
237
+ Generate an ISO-8601 UTC timestamp.
238
+
239
+ **Archive previous research if it exists:**
240
+
241
+ Check if `.aether/oracle/progress.md` exists. If it does, run using the Bash tool with description "Archiving previous research...":
242
+
243
+ ```bash
244
+ DATE=$(date +%Y-%m-%d)
245
+ TIMESTAMP=$(date +%H%M%S)
246
+ mkdir -p .aether/oracle/archive
247
+ cp .aether/oracle/progress.md ".aether/oracle/archive/${DATE}-${TIMESTAMP}-progress.md" 2>/dev/null || true
248
+ cp .aether/oracle/research.json ".aether/oracle/archive/${DATE}-${TIMESTAMP}-research.json" 2>/dev/null || true
249
+ ```
250
+
251
+ **Write research.json:**
252
+
253
+ Use the Write tool to write `.aether/oracle/research.json`:
254
+
255
+ ```json
256
+ {
257
+ "topic": "<the research topic>",
258
+ "scope": "<codebase|web|both>",
259
+ "questions": [
260
+ "<break the topic into 3-5 specific research questions>"
261
+ ],
262
+ "max_iterations": <number from depth choice>,
263
+ "target_confidence": <number from confidence choice>,
264
+ "started_at": "<ISO-8601 UTC timestamp>"
265
+ }
266
+ ```
267
+
268
+ The `questions` array is important — break the user's topic into 3-5 concrete, specific questions that the Oracle should answer. These guide each iteration.
269
+
270
+ **Write progress.md:**
271
+
272
+ Use the Write tool to write `.aether/oracle/progress.md`:
273
+
274
+ ```markdown
275
+ # Oracle Research Progress
276
+
277
+ **Topic:** <the research topic>
278
+ **Started:** <ISO-8601 UTC timestamp>
279
+ **Target Confidence:** <N>%
280
+ **Max Iterations:** <N>
281
+ **Scope:** <codebase|web|both>
282
+
283
+ ## Research Questions
284
+ 1. <question 1>
285
+ 2. <question 2>
286
+ 3. <question 3>
287
+ ...
288
+
289
+ ---
290
+
291
+ ```
292
+
293
+ #### Step 2.5: Verify Oracle Files Are Fresh
294
+
295
+ Verify that progress.md and research.json were created successfully by running using the Bash tool with description "Verifying oracle files...":
296
+ ```bash
297
+ verify_result=$(bash .aether/aether-utils.sh session-verify-fresh --command oracle "" "$ORACLE_START")
298
+ fresh_count=$(echo "$verify_result" | jq -r '.fresh | length')
299
+
300
+ if [[ "$fresh_count" -lt 2 ]]; then
301
+ echo "Warning: Oracle files not properly initialized"
302
+ fi
303
+ ```
304
+
305
+ Proceed to Step 3.
306
+
307
+ ---
308
+
309
+ ### Step 3: Launch
310
+
311
+ Output the research configuration summary:
312
+
313
+ ```
314
+ 🔮 Research Configured
315
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
316
+
317
+ 📍 Topic: <topic>
318
+ 🔄 Iterations: <max_iterations>
319
+ 🎯 Confidence: <target_confidence>%
320
+ 🔍 Scope: <scope>
321
+
322
+ 📋 Research Questions:
323
+ 1. <question>
324
+ 2. <question>
325
+ 3. <question>
326
+
327
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
328
+ ```
329
+
330
+ Now launch the loop. Try tmux first, fall back to manual.
331
+
332
+ **Try tmux** by running using the Bash tool with description "Launching oracle in tmux...":
333
+
334
+ ```bash
335
+ tmux new-session -d -s oracle "cd $(pwd) && bash .aether/oracle/oracle.sh; echo ''; echo '🔮🐜 Oracle loop finished. Press any key to close.'; read -n1" 2>/dev/null && echo "TMUX_OK" || echo "TMUX_FAIL"
336
+ ```
337
+
338
+ **If TMUX_OK:**
339
+
340
+ ```
341
+ 🔮🐜 Oracle Launched
342
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
343
+
344
+ The Oracle is researching in a background tmux session.
345
+
346
+ 👁️ Watch live: tmux attach -t oracle
347
+ 📊 Check status: /ant:oracle status
348
+ 🛑 Stop early: /ant:oracle stop
349
+
350
+ Results will accumulate in .aether/oracle/progress.md
351
+ The Oracle will stop when it reaches {target_confidence}% confidence
352
+ or completes {max_iterations} iterations.
353
+
354
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
355
+
356
+ You can keep working. The Oracle runs independently.
357
+ ```
358
+
359
+ Stop here.
360
+
361
+ **If TMUX_FAIL** (tmux not installed or error):
362
+
363
+ ```
364
+ 🔮 Ready to Launch
365
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
366
+
367
+ tmux not available. Run this in a separate terminal:
368
+
369
+ cd {current_working_directory}
370
+ bash .aether/oracle/oracle.sh
371
+
372
+ Then come back here:
373
+ 📊 Check status: /ant:oracle status
374
+ 🛑 Stop early: /ant:oracle stop
375
+
376
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
377
+ ```
378
+
379
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
380
+ ```bash
381
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
382
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
383
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
384
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
385
+ ```
386
+
387
+ Stop here.
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: ant:organize
3
+ description: "🧹🐜🏛️🐜🧹 Run codebase hygiene report - archivist ant scans for stale files, dead code, orphaned configs (report-only)"
4
+ ---
5
+
6
+ You are the **Queen Ant Colony**. Spawn an archivist to analyze codebase hygiene.
7
+
8
+ > **Note:** `$ARGUMENTS` is unused. Future extensions could accept a path scope argument.
9
+
10
+ ## Instructions
11
+
12
+ ### Step 1: Read State
13
+
14
+ Use the Read tool to read these files (in parallel):
15
+ - `.aether/data/COLONY_STATE.json`
16
+ - `.aether/data/activity.log`
17
+
18
+ From COLONY_STATE.json, extract:
19
+ - `goal` from top level
20
+ - `plan.phases` for phase data
21
+ - `signals` for pheromone data
22
+ - `errors.records` for error patterns
23
+ - `memory` for decisions/learnings
24
+ - `events` for activity
25
+
26
+ **Validate:** If `COLONY_STATE.json` has `goal: null`, output `No colony initialized. Run /ant:init first.` and stop.
27
+
28
+ ### Step 2: Compute Active Pheromones
29
+
30
+ Read active signals from COLONY_STATE.json `signals` array (already loaded in Step 1).
31
+
32
+ Filter signals where:
33
+ - `expires_at` is null (permanent signals like INIT), OR
34
+ - `expires_at` > current timestamp (not expired)
35
+
36
+ Format as the standard ACTIVE PHEROMONES block:
37
+ ```
38
+ ACTIVE PHEROMONES:
39
+ {TYPE padded to 10 chars}: "{content}"
40
+ ```
41
+
42
+ If no active signals after filtering:
43
+ ```
44
+ (no active pheromones)
45
+ ```
46
+
47
+ ### Step 3: Spawn Archivist (Keeper-Ant)
48
+
49
+ Read `.aether/workers.md` and extract the `## Keeper` section.
50
+
51
+ Spawn via **Task tool** with `subagent_type="aether-keeper"`:
52
+ # FALLBACK: If "Agent type not found", use general-purpose and inject role: "You are a Keeper Ant - curates knowledge and synthesizes patterns."
53
+
54
+ ```
55
+ --- WORKER SPEC ---
56
+ {Architect section from .aether/workers.md}
57
+
58
+ --- ACTIVE PHEROMONES ---
59
+ {pheromone block from Step 2}
60
+
61
+ --- TASK ---
62
+ You are being spawned as an ARCHIVIST ANT (codebase hygiene analyzer).
63
+
64
+ Your mission: Produce a structured HYGIENE REPORT. You are REPORT-ONLY.
65
+ You MUST NOT delete, modify, move, or create any project files.
66
+ You may ONLY read files and produce a report.
67
+
68
+ Colony goal: "{goal from COLONY_STATE.json}"
69
+ Colony mode: {mode from COLONY_STATE.json}
70
+ Current phase: {current_phase from COLONY_STATE.json}
71
+
72
+ --- COLONY DATA ---
73
+
74
+ PROJECT PLAN:
75
+ {plan.phases from COLONY_STATE.json -- phases, tasks, their statuses}
76
+
77
+ ERROR HISTORY:
78
+ {errors.records and errors.flagged_patterns from COLONY_STATE.json}
79
+
80
+ MEMORY:
81
+ {memory.phase_learnings and memory.decisions from COLONY_STATE.json}
82
+
83
+ ACTIVITY LOG (last 50 lines):
84
+ {tail of activity.log}
85
+
86
+ --- SCAN INSTRUCTIONS ---
87
+
88
+ Analyze the codebase for hygiene issues in three categories. For each finding,
89
+ assign a confidence level: HIGH (strong evidence), MEDIUM (likely but uncertain),
90
+ or LOW (speculative). Only HIGH confidence items should be presented as actionable.
91
+
92
+ **Category 1: Stale Files**
93
+ Check for files that may no longer be needed:
94
+ - Files referenced in completed tasks that might have been scaffolding/temporary
95
+ - Look at the project structure (use Glob tool to scan key directories)
96
+ - Check for TODO/FIXME/HACK comments that reference completed phases
97
+ - Check for test fixtures or mock data that reference completed features
98
+ - Look for empty files or stub implementations
99
+
100
+ **Category 2: Dead Code Patterns**
101
+ Use colony data to identify dead code signals:
102
+ - Recurring error patterns from COLONY_STATE.json errors.flagged_patterns (code that keeps breaking may be vestigial)
103
+ - Error categories with high counts concentrated in specific files
104
+ - Imports or dependencies referenced in errors but possibly no longer needed
105
+ - Read key source files and look for commented-out code blocks, unused exports, unreachable branches
106
+
107
+ **Category 3: Orphaned Configs**
108
+ Check for configuration that may not be connected:
109
+ - .aether/data/ files that have empty or default-only content
110
+ - Environment variables referenced in code but not in any .env example
111
+ - Config files that reference features/paths that don't exist
112
+ - Package.json scripts (if exists) that reference missing files
113
+
114
+ --- OUTPUT FORMAT ---
115
+
116
+ Produce your report in this exact structure:
117
+
118
+ CODEBASE HYGIENE REPORT
119
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
120
+
121
+ Project: {goal}
122
+ Scanned: {timestamp}
123
+ Confidence threshold: HIGH findings are actionable, MEDIUM/LOW are informational
124
+
125
+ HIGH CONFIDENCE FINDINGS
126
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
127
+ {For each HIGH confidence finding:}
128
+ [{category}] {description}
129
+ Evidence: {what data/observation supports this}
130
+ Location: {file path(s)}
131
+
132
+ {If no HIGH findings: "No high-confidence hygiene issues detected."}
133
+
134
+ MEDIUM CONFIDENCE OBSERVATIONS
135
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
136
+ {For each MEDIUM confidence finding:}
137
+ [{category}] {description}
138
+ Evidence: {what data/observation supports this}
139
+ Location: {file path(s)}
140
+
141
+ {If no MEDIUM findings: "No medium-confidence observations."}
142
+
143
+ LOW CONFIDENCE NOTES
144
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
145
+ {For each LOW confidence finding:}
146
+ [{category}] {description}
147
+
148
+ {If no LOW findings: "No low-confidence notes."}
149
+
150
+ SUMMARY
151
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
152
+ High: {count} actionable findings
153
+ Medium: {count} observations
154
+ Low: {count} notes
155
+
156
+ Health: {CLEAN if 0 HIGH findings, MINOR ISSUES if 1-3 HIGH, NEEDS ATTENTION if 4+ HIGH}
157
+
158
+ CONSTRAINTS:
159
+ - Be CONSERVATIVE. When in doubt, classify as LOW confidence.
160
+ - Do NOT flag standard framework files (package.json, tsconfig.json, etc.) as orphaned.
161
+ - Do NOT flag .aether/ internal data files as stale (they are managed by the colony).
162
+ - Do NOT flag .claude/ command files as stale (they are the colony's brain).
163
+ - Aim for a useful report, not an exhaustive one. 5-15 findings is ideal.
164
+ ```
165
+
166
+ ### Step 4: Display Report
167
+
168
+ After the keeper-ant returns, display header:
169
+
170
+ ```
171
+ 🧹🐜🏛️🐜🧹 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
172
+ C O D E B A S E H Y G I E N E R E P O R T
173
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🧹🐜🏛️🐜🧹
174
+ ```
175
+
176
+ Then display using Bash tool with description "Displaying hygiene report header...":
177
+ ```bash
178
+ bash -c 'printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"'
179
+ bash -c 'printf " C O D E B A S E H Y G I E N E R E P O R T\n"'
180
+ bash -c 'printf "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n"'
181
+ ```
182
+
183
+ Then display the keeper-ant's full report verbatim.
184
+
185
+ ### Step 5: Persist Report
186
+
187
+ Use the Write tool to write the full report to `.aether/data/hygiene-report.md` (overwriting any previous report).
188
+
189
+ Display:
190
+
191
+ ```
192
+ ---
193
+ Report saved: .aether/data/hygiene-report.md
194
+
195
+ This report is advisory only. No files were modified.
196
+
197
+ Next:
198
+ /ant:status View colony status
199
+ /ant:build <phase> Continue building
200
+ /ant:focus "<area>" Focus colony on a hygiene area
201
+ ```
202
+
203
+ ### Step 6: Log Activity
204
+
205
+ Use the Bash tool with description "Logging hygiene activity..." to run:
206
+ ```
207
+ bash .aether/aether-utils.sh activity-log "COMPLETE" "queen" "Hygiene report generated"
208
+ ```
209
+
210
+ Display persistence confirmation:
211
+
212
+ ```
213
+ ---
214
+ All state persisted. Safe to /clear context if needed.
215
+ Report: .aether/data/hygiene-report.md
216
+ Resume: /ant:resume-colony
217
+ ```
218
+
219
+ ### Step 7: Next Up
220
+
221
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
222
+ ```bash
223
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
224
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
225
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
226
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
227
+ ```