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,531 @@
1
+ ---
2
+ name: ant:plan
3
+ description: "πŸ“ŠπŸœπŸ—ΊοΈπŸœπŸ“Š Show project plan or generate project-specific phases"
4
+ ---
5
+
6
+ You are the **Queen**. Orchestrate research and planning until 80% confidence (maximum 4 iterations).
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
+ plan_id="plan-$(date +%s)"
26
+
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$plan_id"
29
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Generating colony plan" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
30
+ ```
31
+
32
+ ### Step 0.5: Version Check (Non-blocking)
33
+
34
+ Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
35
+
36
+ If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
37
+
38
+ ### Step 1: Read State + Version Check
39
+
40
+ Read `.aether/data/COLONY_STATE.json`.
41
+
42
+ **Auto-upgrade old state:**
43
+ If `version` field is missing, "1.0", or "2.0":
44
+ 1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
45
+ 2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
46
+ 3. Output: `State auto-upgraded to v3.0`
47
+ 4. Continue with command.
48
+
49
+ Extract: `goal`, `plan.phases`
50
+
51
+ **Validate:** If `goal: null`:
52
+ ```
53
+ No colony initialized. Run /ant:init "<goal>" first.
54
+ ```
55
+ Stop here.
56
+
57
+ ### Step 1.5: Load State and Show Resumption Context
58
+
59
+ Run using Bash tool: `bash .aether/aether-utils.sh load-state`
60
+
61
+ If successful and goal is not null:
62
+ 1. Extract current_phase from state
63
+ 2. Get phase name from plan.phases[current_phase - 1].name (or "(unnamed)")
64
+ 3. Display brief resumption context:
65
+ ```
66
+ πŸ”„ Resuming: Phase X - Name
67
+ ```
68
+
69
+ If .aether/HANDOFF.md exists (detected in load-state output):
70
+ - Display "Resuming from paused session"
71
+ - Read .aether/HANDOFF.md for additional context
72
+ - Remove .aether/HANDOFF.md after display (cleanup)
73
+
74
+ Run: `bash .aether/aether-utils.sh unload-state` to release lock.
75
+
76
+ **Error handling:**
77
+ - If E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
78
+ - If validation error: Display error details with recovery suggestion and stop
79
+ - For other errors: Display generic error and suggest /ant:status for diagnostics
80
+
81
+ ### Step 2: Check Existing Plan
82
+
83
+ If `plan.phases` has entries (non-empty array), skip to **Step 6** (Display Plan).
84
+
85
+ Parse `$normalized_args`:
86
+ - If contains `--accept`: Set `force_accept = true` (accept current plan regardless of confidence)
87
+ - Otherwise: `force_accept = false`
88
+
89
+ ### Step 3: Initialize Planning State
90
+
91
+ Update watch files for tmux visibility:
92
+
93
+ Write `.aether/data/watch-status.txt`:
94
+ ```
95
+ AETHER COLONY :: PLANNING
96
+ ==========================
97
+
98
+ State: PLANNING
99
+ Phase: 0/0 (generating plan)
100
+ Confidence: 0%
101
+ Iteration: 0/4
102
+
103
+ Active Workers:
104
+ [Research] Starting...
105
+ [Planning] Waiting...
106
+
107
+ Last Activity:
108
+ Planning loop initiated
109
+ ```
110
+
111
+ Write `.aether/data/watch-progress.txt`:
112
+ ```
113
+ Progress
114
+ ========
115
+
116
+ [ ] 0%
117
+
118
+ Target: 80% confidence
119
+
120
+ Iteration: 0/4
121
+ Gaps: (analyzing...)
122
+ ```
123
+
124
+ Log start:
125
+ ```bash
126
+ bash .aether/aether-utils.sh activity-log "PLAN_START" "queen" "Iterative planning loop initiated for goal"
127
+ ```
128
+
129
+ ### Step 3.5: Load Territory Survey
130
+
131
+ Check if territory survey exists before research:
132
+
133
+ ```bash
134
+ ls .aether/data/survey/*.md 2>/dev/null
135
+ ```
136
+
137
+ **If survey exists:**
138
+ 1. **Always read PATHOGENS.md first** β€” understand known concerns before planning
139
+ 2. Read other relevant docs based on goal keywords:
140
+
141
+ | Goal Contains | Additional Documents |
142
+ |---------------|---------------------|
143
+ | UI, frontend, component, page | DISCIPLINES.md, CHAMBERS.md |
144
+ | API, backend, endpoint | BLUEPRINT.md, DISCIPLINES.md |
145
+ | database, schema, model | BLUEPRINT.md, PROVISIONS.md |
146
+ | test, spec | SENTINEL-PROTOCOLS.md, DISCIPLINES.md |
147
+ | integration, external | TRAILS.md, PROVISIONS.md |
148
+ | refactor, cleanup | PATHOGENS.md, BLUEPRINT.md |
149
+
150
+ **Inject survey context into scout and planner prompts:**
151
+ - Include key patterns from DISCIPLINES.md
152
+ - Reference architecture from BLUEPRINT.md
153
+ - Note tech stack from PROVISIONS.md
154
+ - Flag concerns from PATHOGENS.md
155
+
156
+ **Display:**
157
+ ```
158
+ πŸ—ΊοΈ Territory survey loaded β€” incorporating context into planning
159
+ ```
160
+
161
+ **If no survey:** Continue without survey context (scouts will do fresh exploration)
162
+
163
+ ### Step 4: Research and Planning Loop
164
+
165
+ Initialize tracking:
166
+ - `iteration = 0`
167
+ - `confidence = 0`
168
+ - `gaps = []` (list of knowledge gaps)
169
+ - `plan_draft = null`
170
+ - `last_confidence = 0`
171
+ - `stall_count = 0` (consecutive iterations with < 5% improvement)
172
+
173
+ **Loop (max 4 iterations, 2 agents per iteration: 1 scout + 1 planner):**
174
+
175
+ ```
176
+ while iteration < 4 AND confidence < 80:
177
+ iteration += 1
178
+
179
+ # === AUTO-BREAK CHECKS (no user prompt needed) ===
180
+ if iteration > 1:
181
+ if confidence >= 80:
182
+ Log: "Confidence threshold reached ({confidence}%), finalizing plan"
183
+ break
184
+ if stall_count >= 2:
185
+ Log: "Planning stalled at {confidence}%, finalizing current plan"
186
+ break
187
+
188
+ # === RESEARCH PHASE (always runs β€” 1 scout per iteration) ===
189
+
190
+ if iteration == 1:
191
+
192
+ # Broad exploration on first pass
193
+ Spawn Research Scout via Task tool with subagent_type="aether-scout":
194
+
195
+ """
196
+ You are a Scout Ant in the Aether Colony.
197
+
198
+ --- MISSION ---
199
+ Research the codebase to understand what exists and how it works.
200
+
201
+ Goal: "{goal}"
202
+ Iteration: {iteration}/4
203
+
204
+ --- EXPLORATION AREAS ---
205
+ Cover ALL of these in a single pass:
206
+ 1. Core architecture, entry points, and main modules
207
+ 2. Business logic and domain models
208
+ 3. Testing patterns and quality practices
209
+ 4. Configuration, dependencies, and infrastructure
210
+ 5. Edge cases, error handling, and validation
211
+
212
+ --- TOOLS ---
213
+ Use: Glob, Grep, Read, WebSearch, WebFetch
214
+ Do NOT use: Task, Write, Edit
215
+
216
+ --- OUTPUT CONSTRAINTS ---
217
+ Maximum 5 findings (prioritize by impact on the goal).
218
+ Maximum 2 sentences per finding.
219
+ Maximum 3 knowledge gaps identified.
220
+
221
+ --- OUTPUT FORMAT ---
222
+ Return JSON:
223
+ {
224
+ "findings": [
225
+ {"area": "...", "discovery": "...", "source": "file or search"}
226
+ ],
227
+ "gaps_remaining": [
228
+ {"id": "gap_N", "description": "..."}
229
+ ],
230
+ "overall_knowledge_confidence": 0-100
231
+ }
232
+ """
233
+
234
+ else:
235
+
236
+ # Gap-focused research on subsequent passes
237
+ Spawn Gap-Focused Scout via Task tool with subagent_type="aether-scout":
238
+
239
+ """
240
+ You are a Scout Ant in the Aether Colony (gap-focused research).
241
+
242
+ --- MISSION ---
243
+ Investigate ONLY these specific knowledge gaps. Do not explore broadly.
244
+
245
+ Goal: "{goal}"
246
+ Iteration: {iteration}/4
247
+
248
+ --- GAPS TO INVESTIGATE ---
249
+ {for each gap in gaps:}
250
+ - {gap.id}: {gap.description}
251
+ {end for}
252
+
253
+ --- TOOLS ---
254
+ Use: Glob, Grep, Read, WebSearch, WebFetch
255
+ Do NOT use: Task, Write, Edit
256
+
257
+ --- OUTPUT CONSTRAINTS ---
258
+ Maximum 3 findings (one per gap investigated).
259
+ Maximum 2 sentences per finding.
260
+ Only report gaps that are STILL unresolved after your research.
261
+
262
+ --- OUTPUT FORMAT ---
263
+ Return JSON:
264
+ {
265
+ "findings": [
266
+ {"area": "...", "discovery": "...", "source": "file or search"}
267
+ ],
268
+ "gaps_remaining": [
269
+ {"id": "gap_N", "description": "..."}
270
+ ],
271
+ "gaps_resolved": ["gap_1", "gap_2"],
272
+ "overall_knowledge_confidence": 0-100
273
+ }
274
+ """
275
+
276
+ # Wait for scout to complete.
277
+ # Update gaps list from scout results.
278
+
279
+ Log: `bash .aether/aether-utils.sh activity-log "RESEARCH" "scout" "Iteration {iteration}: {scout.findings.length} findings, {scout.gaps_remaining.length} gaps"`
280
+
281
+ # === PLANNING PHASE (always runs β€” 1 planner per iteration) ===
282
+
283
+ Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="aether-route-setter":
284
+ # NOTE: Claude Code uses aether-route-setter; OpenCode now uses same specialist agent
285
+
286
+ """
287
+ You are a Route-Setter Ant in the Aether Colony.
288
+
289
+ --- MISSION ---
290
+ Create or refine a project plan based on research findings.
291
+
292
+ Goal: "{goal}"
293
+ Iteration: {iteration}/4
294
+
295
+ --- PLANNING DISCIPLINE ---
296
+ Read .aether/planning.md for full reference.
297
+
298
+ Key rules:
299
+ - Bite-sized tasks (2-5 minutes each) - one action per task
300
+ - Goal-oriented - describe WHAT to achieve, not HOW
301
+ - Constraints define boundaries, not implementation
302
+ - Hints point toward patterns, not solutions
303
+ - Success criteria are testable outcomes
304
+
305
+ Task format (GOAL-ORIENTED):
306
+ ```
307
+ Task N.1: {goal description}
308
+ Goal: What to achieve (not how)
309
+ Constraints:
310
+ - Boundaries and requirements
311
+ - Integration points
312
+ Hints:
313
+ - Pointer to existing patterns (optional)
314
+ - Relevant files to reference (optional)
315
+ Success Criteria:
316
+ - Testable outcome 1
317
+ - Testable outcome 2
318
+ ```
319
+
320
+ DO NOT include:
321
+ - Exact code to write
322
+ - Specific function names (unless critical API)
323
+ - Implementation details
324
+ - Line-by-line instructions
325
+
326
+ Workers discover implementations by reading existing code and patterns.
327
+ This enables TRUE EMERGENCE - different approaches based on context.
328
+
329
+ --- RESEARCH FINDINGS ---
330
+ {scout.findings formatted β€” compact, max 5 items}
331
+
332
+ Remaining Gaps:
333
+ {gaps formatted β€” compact, max 3 items}
334
+
335
+ --- CURRENT PLAN DRAFT ---
336
+ {if plan_draft:}
337
+ {plan_draft}
338
+ {else:}
339
+ No plan yet. Create initial draft.
340
+ {end if}
341
+
342
+ --- INSTRUCTIONS ---
343
+ 1. If no plan exists, create 3-6 phases with concrete tasks
344
+ 2. If plan exists, refine based on NEW information only
345
+ 3. Rate confidence across 5 dimensions
346
+ 4. Keep response concise β€” no verbose explanations
347
+
348
+ Do NOT assign castes to tasks - describe the work only.
349
+
350
+ --- OUTPUT CONSTRAINTS ---
351
+ Maximum 6 phases. Maximum 4 tasks per phase.
352
+ Maximum 2 sentence description per task.
353
+ Confidence dimensions as single numbers, not paragraphs.
354
+
355
+ --- OUTPUT FORMAT ---
356
+ Return JSON:
357
+ {
358
+ "plan": {
359
+ "phases": [
360
+ {
361
+ "id": 1,
362
+ "name": "...",
363
+ "description": "...",
364
+ "tasks": [
365
+ {
366
+ "id": "1.1",
367
+ "goal": "What to achieve (not how)",
368
+ "constraints": ["boundary 1", "boundary 2"],
369
+ "hints": ["optional pointer to pattern"],
370
+ "success_criteria": ["testable outcome 1", "testable outcome 2"],
371
+ "depends_on": []
372
+ }
373
+ ],
374
+ "success_criteria": ["...", "..."]
375
+ }
376
+ ]
377
+ },
378
+ "confidence": {
379
+ "knowledge": 0-100,
380
+ "requirements": 0-100,
381
+ "risks": 0-100,
382
+ "dependencies": 0-100,
383
+ "effort": 0-100,
384
+ "overall": 0-100
385
+ },
386
+ "delta_reasoning": "One sentence: what changed from last iteration",
387
+ "unresolved_gaps": ["...", "..."]
388
+ }
389
+ """
390
+
391
+ Parse planning results. Update plan_draft and confidence.
392
+
393
+ Log: `bash .aether/aether-utils.sh activity-log "PLANNING" "route-setter" "Confidence: {confidence}% (+{delta}%)"`
394
+
395
+ # === UPDATE WATCH FILES ===
396
+
397
+ Update `.aether/data/watch-status.txt` with current state.
398
+ Update `.aether/data/watch-progress.txt` with progress bar.
399
+
400
+ # === STALL TRACKING ===
401
+
402
+ delta = confidence - last_confidence
403
+ if delta < 5:
404
+ stall_count += 1
405
+ else:
406
+ stall_count = 0
407
+
408
+ last_confidence = confidence
409
+ ```
410
+
411
+ **After loop exits (auto-finalize, no user prompt needed):**
412
+
413
+ ```
414
+ Planning complete after {iteration} iteration(s).
415
+
416
+ Confidence: {confidence}%
417
+ {if gaps remain:}
418
+ Note: {gaps.length} knowledge gap(s) deferred β€” these can be resolved during builds.
419
+ {end if}
420
+ ```
421
+
422
+ Proceed directly to Step 5. No user confirmation needed β€” the plan auto-finalizes.
423
+
424
+ ### Step 5: Finalize Plan
425
+
426
+ Once loop exits (confidence >= 80, max iterations reached, or stall detected):
427
+
428
+ Read current COLONY_STATE.json, then update:
429
+ - Set `plan.phases` to the final phases array
430
+ - Set `plan.generated_at` to ISO-8601 timestamp
431
+ - Set `state` to `"READY"`
432
+ - Append event: `"<timestamp>|plan_generated|plan|Generated {N} phases with {confidence}% confidence"`
433
+
434
+ Write COLONY_STATE.json.
435
+
436
+ Log: `bash .aether/aether-utils.sh activity-log "PLAN_COMPLETE" "queen" "Plan finalized with {confidence}% confidence"`
437
+
438
+ Update watch-status.txt:
439
+ ```
440
+ AETHER COLONY :: READY
441
+ =======================
442
+
443
+ State: READY
444
+ Plan: {N} phases generated
445
+ Confidence: {confidence}%
446
+
447
+ Ready to build.
448
+ ```
449
+
450
+ ### Step 6: Display Plan
451
+
452
+ **If visual_mode is true, render final swarm display:**
453
+ ```bash
454
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Plan generated" "Colony" '{"read":8,"grep":4,"edit":2,"bash":1}' 100 "fungus_garden" 100
455
+ bash .aether/aether-utils.sh swarm-display-render "$plan_id"
456
+ ```
457
+
458
+ Read `plan.phases` from COLONY_STATE.json and display:
459
+
460
+ ```
461
+ πŸ“ŠπŸœπŸ—ΊοΈπŸœπŸ“Š ═══════════════════════════════════════════════════
462
+ C O L O N Y P L A N
463
+ ═══════════════════════════════════════════════════ πŸ“ŠπŸœπŸ—ΊοΈπŸœπŸ“Š
464
+
465
+ πŸ‘‘ Goal: {goal}
466
+
467
+ {if plan was just generated:}
468
+ πŸ“Š Confidence: {confidence}%
469
+ πŸ”„ Iterations: {iteration}
470
+ {end if}
471
+
472
+ ─────────────────────────────────────────────────────
473
+
474
+ πŸ“ Phase {id}: {name} [{STATUS}]
475
+ {description}
476
+
477
+ 🐜 Tasks:
478
+ {status_icon} {id}: {description}
479
+
480
+ βœ… Success Criteria:
481
+ β€’ {criterion}
482
+
483
+ ─────────────────────────────────────────────────────
484
+ (repeat for each phase)
485
+
486
+ 🐜 Next Steps:
487
+ {Calculate first_incomplete_phase: iterate through phases, find first where status != 'completed'. Default to 1 if all complete or no phases. Look up its name from plan.phases[id].name.}
488
+ /ant:build {first_incomplete_phase} πŸ”¨ Phase {first_incomplete_phase}: {phase_name}
489
+ /ant:focus "<area>" 🎯 Focus colony attention
490
+ /ant:status πŸ“Š View colony status
491
+
492
+ πŸ’Ύ Plan persisted β€” safe to /clear before building
493
+ ```
494
+
495
+ Status icons: pending = `[ ]`, in_progress = `[~]`, completed = `[βœ“]`
496
+
497
+ ---
498
+
499
+ ## Confidence Scoring Reference
500
+
501
+ Each dimension rated 0-100%:
502
+
503
+ | Dimension | What It Measures |
504
+ |-----------|------------------|
505
+ | Knowledge | Understanding of codebase structure, patterns, tech stack |
506
+ | Requirements | Clarity of success criteria and acceptance conditions |
507
+ | Risks | Identification of potential blockers and failure modes |
508
+ | Dependencies | Understanding of what affects what, ordering constraints |
509
+ | Effort | Ability to estimate relative complexity of tasks |
510
+
511
+ **Overall** = weighted average (knowledge 25%, requirements 25%, risks 20%, dependencies 15%, effort 15%)
512
+
513
+ **Target: 80%** - Sufficient confidence for autonomous execution. Higher confidence is achieved during builds as gaps are resolved.
514
+
515
+ ---
516
+
517
+ ## Auto-Termination Safeguards
518
+
519
+ The planning loop terminates automatically without requiring user input:
520
+
521
+ 1. **Confidence Threshold**: Loop exits when overall confidence reaches 80%
522
+
523
+ 2. **Hard Iteration Cap**: Maximum 4 iterations (8 subagents total: 1 scout + 1 planner per iteration)
524
+
525
+ 3. **Stall Detection**: If confidence improves < 5% for 2 consecutive iterations, auto-finalize current plan
526
+
527
+ 4. **Single Scout Research**: One researcher per iteration (broad on iteration 1, gap-focused on 2+) β€” no parallel Alpha/Beta or synthesis agent
528
+
529
+ 5. **Compressed Output**: Subagents limited to 5 findings max, 2-sentence summaries, compact JSON
530
+
531
+ 6. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: ant:redirect
3
+ description: "⚠️🐜🚧🐜⚠️ Emit REDIRECT signal to warn colony away from patterns"
4
+ ---
5
+
6
+ You are the **Queen**. Add an AVOID constraint.
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 pattern to avoid is: `$normalized_args`
17
+
18
+ ### Step 1: Validate
19
+
20
+ If `$normalized_args` empty -> show usage: `/ant:redirect <pattern to avoid>`, stop.
21
+ If content > 500 chars -> "Redirect content too long (max 500 chars)", stop.
22
+
23
+ ### Step 2: Read + Update Constraints
24
+
25
+ Read `.aether/data/COLONY_STATE.json`.
26
+ If `goal: null` -> "No colony initialized.", stop.
27
+
28
+ Read `.aether/data/constraints.json`. If file doesn't exist, create it with:
29
+ ```json
30
+ {"version": "1.0", "focus": [], "constraints": []}
31
+ ```
32
+
33
+ Generate constraint ID: `c_<unix_timestamp_ms>`
34
+
35
+ Append to `constraints` array:
36
+ ```json
37
+ {
38
+ "id": "<generated_id>",
39
+ "type": "AVOID",
40
+ "content": "<pattern to avoid>",
41
+ "source": "user:redirect",
42
+ "created_at": "<ISO-8601 timestamp>"
43
+ }
44
+ ```
45
+
46
+ If `constraints` array exceeds 10 entries, remove the oldest entries to keep only 10.
47
+
48
+ Write constraints.json.
49
+
50
+ ### Step 3: Confirm
51
+
52
+ Output header:
53
+
54
+ ```
55
+ ⚠️🐜🚧🐜⚠️ ═══════════════════════════════════════════════════
56
+ R E D I R E C T S I G N A L
57
+ ═══════════════════════════════════════════════════ ⚠️🐜🚧🐜⚠️
58
+ ```
59
+
60
+ Then output:
61
+ ```
62
+ 🚫 REDIRECT signal emitted
63
+
64
+ Avoid: "{content preview}"
65
+
66
+ 🐜 Colony warned away from this pattern.
67
+ ```