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