aether-colony 5.3.2 → 5.3.3

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 (165) hide show
  1. package/.aether/aether-utils.sh +181 -5
  2. package/.aether/commands/build.yaml +35 -0
  3. package/.aether/commands/entomb.yaml +1 -1
  4. package/.aether/commands/init.yaml +29 -12
  5. package/.aether/commands/oracle.yaml +70 -0
  6. package/.aether/commands/patrol.yaml +2 -2
  7. package/.aether/commands/run.yaml +3 -3
  8. package/.aether/commands/swarm.yaml +1 -1
  9. package/.aether/docs/command-playbooks/build-complete.md +41 -8
  10. package/.aether/docs/command-playbooks/build-full.md +7 -7
  11. package/.aether/docs/command-playbooks/build-prep.md +1 -1
  12. package/.aether/docs/command-playbooks/continue-advance.md +33 -0
  13. package/.aether/docs/command-playbooks/continue-finalize.md +15 -1
  14. package/.aether/docs/command-playbooks/continue-full.md +15 -1
  15. package/.aether/docs/source-of-truth-map.md +10 -10
  16. package/.aether/docs/structural-learning-stack.md +283 -0
  17. package/.aether/utils/consolidation-seal.sh +196 -0
  18. package/.aether/utils/consolidation.sh +127 -0
  19. package/.aether/utils/curation-ants/archivist.sh +97 -0
  20. package/.aether/utils/curation-ants/critic.sh +214 -0
  21. package/.aether/utils/curation-ants/herald.sh +102 -0
  22. package/.aether/utils/curation-ants/janitor.sh +121 -0
  23. package/.aether/utils/curation-ants/librarian.sh +99 -0
  24. package/.aether/utils/curation-ants/nurse.sh +153 -0
  25. package/.aether/utils/curation-ants/orchestrator.sh +181 -0
  26. package/.aether/utils/curation-ants/scribe.sh +164 -0
  27. package/.aether/utils/curation-ants/sentinel.sh +119 -0
  28. package/.aether/utils/event-bus.sh +301 -0
  29. package/.aether/utils/graph.sh +559 -0
  30. package/.aether/utils/instinct-store.sh +401 -0
  31. package/.aether/utils/learning.sh +79 -7
  32. package/.aether/utils/session.sh +13 -0
  33. package/.aether/utils/state-api.sh +1 -1
  34. package/.aether/utils/trust-scoring.sh +347 -0
  35. package/.aether/utils/worktree.sh +97 -0
  36. package/.claude/commands/ant/entomb.md +1 -1
  37. package/.claude/commands/ant/init.md +29 -12
  38. package/.claude/commands/ant/oracle.md +35 -0
  39. package/.claude/commands/ant/patrol.md +2 -2
  40. package/.claude/commands/ant/run.md +3 -3
  41. package/.claude/commands/ant/swarm.md +1 -1
  42. package/.opencode/commands/ant/build.md +35 -0
  43. package/.opencode/commands/ant/init.md +29 -12
  44. package/.opencode/commands/ant/oracle.md +35 -0
  45. package/.opencode/commands/ant/patrol.md +2 -2
  46. package/.opencode/commands/ant/run.md +3 -3
  47. package/CHANGELOG.md +83 -0
  48. package/README.md +22 -9
  49. package/bin/lib/update-transaction.js +8 -3
  50. package/bin/npx-entry.js +0 -0
  51. package/package.json +1 -1
  52. package/.aether/agents/aether-ambassador.md +0 -140
  53. package/.aether/agents/aether-archaeologist.md +0 -108
  54. package/.aether/agents/aether-architect.md +0 -133
  55. package/.aether/agents/aether-auditor.md +0 -144
  56. package/.aether/agents/aether-builder.md +0 -184
  57. package/.aether/agents/aether-chaos.md +0 -115
  58. package/.aether/agents/aether-chronicler.md +0 -122
  59. package/.aether/agents/aether-gatekeeper.md +0 -116
  60. package/.aether/agents/aether-includer.md +0 -117
  61. package/.aether/agents/aether-keeper.md +0 -177
  62. package/.aether/agents/aether-measurer.md +0 -128
  63. package/.aether/agents/aether-oracle.md +0 -137
  64. package/.aether/agents/aether-probe.md +0 -133
  65. package/.aether/agents/aether-queen.md +0 -286
  66. package/.aether/agents/aether-route-setter.md +0 -130
  67. package/.aether/agents/aether-sage.md +0 -106
  68. package/.aether/agents/aether-scout.md +0 -101
  69. package/.aether/agents/aether-surveyor-disciplines.md +0 -391
  70. package/.aether/agents/aether-surveyor-nest.md +0 -329
  71. package/.aether/agents/aether-surveyor-pathogens.md +0 -264
  72. package/.aether/agents/aether-surveyor-provisions.md +0 -334
  73. package/.aether/agents/aether-tracker.md +0 -137
  74. package/.aether/agents/aether-watcher.md +0 -174
  75. package/.aether/agents/aether-weaver.md +0 -130
  76. package/.aether/commands/claude/archaeology.md +0 -334
  77. package/.aether/commands/claude/build.md +0 -65
  78. package/.aether/commands/claude/chaos.md +0 -336
  79. package/.aether/commands/claude/colonize.md +0 -259
  80. package/.aether/commands/claude/continue.md +0 -60
  81. package/.aether/commands/claude/council.md +0 -507
  82. package/.aether/commands/claude/data-clean.md +0 -81
  83. package/.aether/commands/claude/dream.md +0 -268
  84. package/.aether/commands/claude/entomb.md +0 -498
  85. package/.aether/commands/claude/export-signals.md +0 -57
  86. package/.aether/commands/claude/feedback.md +0 -96
  87. package/.aether/commands/claude/flag.md +0 -151
  88. package/.aether/commands/claude/flags.md +0 -169
  89. package/.aether/commands/claude/focus.md +0 -76
  90. package/.aether/commands/claude/help.md +0 -154
  91. package/.aether/commands/claude/history.md +0 -140
  92. package/.aether/commands/claude/import-signals.md +0 -71
  93. package/.aether/commands/claude/init.md +0 -505
  94. package/.aether/commands/claude/insert-phase.md +0 -105
  95. package/.aether/commands/claude/interpret.md +0 -278
  96. package/.aether/commands/claude/lay-eggs.md +0 -210
  97. package/.aether/commands/claude/maturity.md +0 -113
  98. package/.aether/commands/claude/memory-details.md +0 -77
  99. package/.aether/commands/claude/migrate-state.md +0 -171
  100. package/.aether/commands/claude/oracle.md +0 -642
  101. package/.aether/commands/claude/organize.md +0 -232
  102. package/.aether/commands/claude/patrol.md +0 -620
  103. package/.aether/commands/claude/pause-colony.md +0 -233
  104. package/.aether/commands/claude/phase.md +0 -115
  105. package/.aether/commands/claude/pheromones.md +0 -156
  106. package/.aether/commands/claude/plan.md +0 -693
  107. package/.aether/commands/claude/preferences.md +0 -65
  108. package/.aether/commands/claude/quick.md +0 -100
  109. package/.aether/commands/claude/redirect.md +0 -76
  110. package/.aether/commands/claude/resume-colony.md +0 -197
  111. package/.aether/commands/claude/resume.md +0 -388
  112. package/.aether/commands/claude/run.md +0 -231
  113. package/.aether/commands/claude/seal.md +0 -774
  114. package/.aether/commands/claude/skill-create.md +0 -286
  115. package/.aether/commands/claude/status.md +0 -410
  116. package/.aether/commands/claude/swarm.md +0 -349
  117. package/.aether/commands/claude/tunnels.md +0 -426
  118. package/.aether/commands/claude/update.md +0 -132
  119. package/.aether/commands/claude/verify-castes.md +0 -143
  120. package/.aether/commands/claude/watch.md +0 -239
  121. package/.aether/commands/opencode/archaeology.md +0 -331
  122. package/.aether/commands/opencode/build.md +0 -1168
  123. package/.aether/commands/opencode/chaos.md +0 -329
  124. package/.aether/commands/opencode/colonize.md +0 -195
  125. package/.aether/commands/opencode/continue.md +0 -1436
  126. package/.aether/commands/opencode/council.md +0 -437
  127. package/.aether/commands/opencode/data-clean.md +0 -77
  128. package/.aether/commands/opencode/dream.md +0 -260
  129. package/.aether/commands/opencode/entomb.md +0 -377
  130. package/.aether/commands/opencode/export-signals.md +0 -54
  131. package/.aether/commands/opencode/feedback.md +0 -99
  132. package/.aether/commands/opencode/flag.md +0 -149
  133. package/.aether/commands/opencode/flags.md +0 -167
  134. package/.aether/commands/opencode/focus.md +0 -73
  135. package/.aether/commands/opencode/help.md +0 -157
  136. package/.aether/commands/opencode/history.md +0 -136
  137. package/.aether/commands/opencode/import-signals.md +0 -68
  138. package/.aether/commands/opencode/init.md +0 -518
  139. package/.aether/commands/opencode/insert-phase.md +0 -111
  140. package/.aether/commands/opencode/interpret.md +0 -272
  141. package/.aether/commands/opencode/lay-eggs.md +0 -213
  142. package/.aether/commands/opencode/maturity.md +0 -108
  143. package/.aether/commands/opencode/memory-details.md +0 -83
  144. package/.aether/commands/opencode/migrate-state.md +0 -165
  145. package/.aether/commands/opencode/oracle.md +0 -593
  146. package/.aether/commands/opencode/organize.md +0 -226
  147. package/.aether/commands/opencode/patrol.md +0 -626
  148. package/.aether/commands/opencode/pause-colony.md +0 -203
  149. package/.aether/commands/opencode/phase.md +0 -113
  150. package/.aether/commands/opencode/pheromones.md +0 -162
  151. package/.aether/commands/opencode/plan.md +0 -684
  152. package/.aether/commands/opencode/preferences.md +0 -71
  153. package/.aether/commands/opencode/quick.md +0 -91
  154. package/.aether/commands/opencode/redirect.md +0 -84
  155. package/.aether/commands/opencode/resume-colony.md +0 -190
  156. package/.aether/commands/opencode/resume.md +0 -394
  157. package/.aether/commands/opencode/run.md +0 -237
  158. package/.aether/commands/opencode/seal.md +0 -452
  159. package/.aether/commands/opencode/skill-create.md +0 -63
  160. package/.aether/commands/opencode/status.md +0 -307
  161. package/.aether/commands/opencode/swarm.md +0 -15
  162. package/.aether/commands/opencode/tunnels.md +0 -400
  163. package/.aether/commands/opencode/update.md +0 -127
  164. package/.aether/commands/opencode/verify-castes.md +0 -139
  165. package/.aether/commands/opencode/watch.md +0 -227
@@ -1,693 +0,0 @@
1
- <!-- Generated from .aether/commands/plan.yaml - DO NOT EDIT DIRECTLY -->
2
- ---
3
- name: ant:plan
4
- description: "📊🐜🗺️🐜📊 Show project plan or generate project-specific phases"
5
- ---
6
-
7
- You are the **Queen**. Orchestrate research and planning until the selected confidence target is reached within the selected iteration budget.
8
-
9
- ## Instructions
10
-
11
- Parse `$ARGUMENTS`:
12
- - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
13
- - Otherwise: set `visual_mode = true`
14
-
15
- ### Step 1: Read State
16
-
17
- Read `.aether/data/COLONY_STATE.json`.
18
-
19
- **Auto-upgrade old state:**
20
- If `version` field is missing, "1.0", or "2.0":
21
- 1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
22
- 2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
23
- 3. Output: `State auto-upgraded to v3.0`
24
- 4. Continue with command.
25
-
26
- Extract: `goal`, `milestone`, `plan.phases`
27
-
28
- **Validate:** If `goal: null`:
29
- ```
30
- No colony initialized. Run /ant:init "<goal>" first.
31
- ```
32
- Stop here.
33
-
34
- If `milestone` == `"Crowned Anthill"`:
35
- ```
36
- This colony has been sealed. Start a new colony with /ant:init "new goal".
37
- ```
38
- Stop here.
39
-
40
- ### Step 1.5: Load State and Show Resumption Context
41
-
42
- Run using Bash tool: `bash .aether/aether-utils.sh load-state`
43
-
44
- If successful and goal is not null:
45
- 1. Extract current_phase from state
46
- 2. Get phase name from plan.phases[current_phase - 1].name (or "(unnamed)")
47
- 3. Display brief resumption context:
48
- ```
49
- 🔄 Resuming: Phase X - Name
50
- ```
51
-
52
- If .aether/HANDOFF.md exists (detected in load-state output):
53
- - Display "Resuming from paused session"
54
- - Read .aether/HANDOFF.md for additional context
55
- - Remove .aether/HANDOFF.md after display (cleanup)
56
-
57
- Run: `bash .aether/aether-utils.sh unload-state` to release lock.
58
-
59
- **Error handling:**
60
- - If E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
61
- - If validation error: Display error details with recovery suggestion and stop
62
- - For other errors: Display generic error and suggest /ant:status for diagnostics
63
-
64
- ### Step 2: Check Existing Plan
65
-
66
- If `plan.phases` has entries (non-empty array), skip to **Step 6** (Display Plan).
67
-
68
- Parse `$ARGUMENTS`:
69
- - If contains `--accept`: Set `force_accept = true` (accept current plan regardless of confidence)
70
- - Otherwise: `force_accept = false`
71
-
72
- Select planning depth (prompt user if not explicitly provided):
73
- - Presets:
74
- - `fast`: `target_confidence = 80`, `max_iterations = 4`
75
- - `balanced`: `target_confidence = 90`, `max_iterations = 6`
76
- - `deep`: `target_confidence = 95`, `max_iterations = 8`
77
- - `exhaustive`: `target_confidence = 99`, `max_iterations = 12`
78
- - Preset selectors:
79
- - `--fast`, `--balanced`, `--deep`, `--exhaustive`
80
- - `--quality fast|balanced|deep|exhaustive`
81
- - CLI overrides:
82
- - `--target <70-99>` to set `target_confidence`
83
- - `--max-iterations <2-12>` to set `max_iterations`
84
- - If no preset/overrides are provided, ask:
85
- `Planning depth? 1) Fast 2) Balanced 3) Deep (recommended) 4) Exhaustive`
86
- - Map user choice to a preset, default to `deep` on unclear input.
87
- - If overrides are out of range, clamp to valid ranges and continue.
88
-
89
- ### Step 2.5: Load Compact Context Capsule
90
-
91
- Run using the Bash tool with description "Loading compact planning context...":
92
- ```bash
93
- bash .aether/aether-utils.sh context-capsule --compact --json 2>/dev/null
94
- ```
95
-
96
- If JSON is valid and `.ok == true`, extract `.result.prompt_section` into `context_capsule_prompt`.
97
- If command fails or returns invalid JSON, set `context_capsule_prompt = ""` and continue.
98
-
99
- ### Step 3: Initialize Planning State
100
-
101
- Update watch files for tmux visibility:
102
-
103
- Write `.aether/data/watch-status.txt`:
104
- ```
105
- AETHER COLONY :: PLANNING
106
- ==========================
107
-
108
- State: PLANNING
109
- Phase: 0/0 (generating plan)
110
- Confidence: 0%
111
- Iteration: 0/{max_iterations}
112
-
113
- Active Workers:
114
- [Research] Starting...
115
- [Planning] Waiting...
116
-
117
- Last Activity:
118
- Planning loop initiated
119
- ```
120
-
121
- Write `.aether/data/watch-progress.txt`:
122
- ```
123
- Progress
124
- ========
125
-
126
- [ ] 0%
127
-
128
- Target: {target_confidence}% confidence
129
-
130
- Iteration: 0/{max_iterations}
131
- Gaps: (analyzing...)
132
- ```
133
-
134
- ### Step 3.5: Load Territory Survey
135
-
136
- Check if territory survey exists before research:
137
-
138
- ```bash
139
- ls .aether/data/survey/*.md 2>/dev/null
140
- ```
141
-
142
- **If survey exists:**
143
- 1. **Always read PATHOGENS.md first** — understand known concerns before planning
144
- 2. Read other relevant docs based on goal keywords:
145
-
146
- | Goal Contains | Additional Documents |
147
- |---------------|---------------------|
148
- | UI, frontend, component, page | DISCIPLINES.md, CHAMBERS.md |
149
- | API, backend, endpoint | BLUEPRINT.md, DISCIPLINES.md |
150
- | database, schema, model | BLUEPRINT.md, PROVISIONS.md |
151
- | test, spec | SENTINEL-PROTOCOLS.md, DISCIPLINES.md |
152
- | integration, external | TRAILS.md, PROVISIONS.md |
153
- | refactor, cleanup | PATHOGENS.md, BLUEPRINT.md |
154
-
155
- **Inject survey context into scout and planner prompts:**
156
- - Include key patterns from DISCIPLINES.md
157
- - Reference architecture from BLUEPRINT.md
158
- - Note tech stack from PROVISIONS.md
159
- - Flag concerns from PATHOGENS.md
160
-
161
- **Display:**
162
- ```
163
- 🗺️ Territory survey loaded — incorporating context into planning
164
- ```
165
-
166
- **If no survey:** Continue without survey context (scouts will do fresh exploration)
167
-
168
- ### Step 3.6: Phase Domain Research
169
-
170
- Investigate domain knowledge for each phase before the planning loop begins. This runs every time `/ant:plan` generates a new plan -- no skip flag.
171
-
172
- **1. Retrieve hive wisdom for research priming:**
173
-
174
- ```bash
175
- hive_context=$(bash .aether/aether-utils.sh hive-read --limit 5 --format text 2>/dev/null)
176
- ```
177
-
178
- Parse the JSON result to extract `.result.text` as `hive_text`. If command fails or returns empty, set `hive_text = ""`.
179
-
180
- **2. Clean any previous research for this phase:**
181
-
182
- ```bash
183
- research_dir=".aether/data/phase-research"
184
- mkdir -p "$research_dir"
185
- rm -f "$research_dir/phase-{phase_number}-research.md"
186
- ```
187
-
188
- Re-running /ant:plan always re-researches from scratch.
189
-
190
- **3. Spawn Research Scout** via Task tool with `subagent_type="aether-scout"`:
191
-
192
- FALLBACK: If "Agent type not found", use general-purpose and inject role: "You are a Scout Ant performing Phase Domain Research."
193
-
194
- ```
195
- You are a Scout Ant performing Phase Domain Research.
196
-
197
- --- MISSION ---
198
- Investigate the domain knowledge needed for Phase {phase_number}: {phase_name}
199
- Goal: "{goal}"
200
- Phase description: "{phase_description}"
201
-
202
- {context_capsule_prompt}
203
-
204
- --- PRE-EXISTING COLONY WISDOM ---
205
- {hive_text}
206
-
207
- --- RESEARCH AREAS ---
208
- 1. Key patterns in the existing codebase relevant to this phase
209
- 2. External library/API documentation if the phase involves external tools
210
- 3. Common gotchas and pitfalls in this domain
211
- 4. Recommended implementation approach based on findings
212
-
213
- --- SCOPE CONSTRAINTS ---
214
- - Maximum 5 key patterns
215
- - Maximum 3 gotchas
216
- - Maximum 1 recommended approach paragraph
217
- - Total output under 3000 words
218
- - Prioritize actionable guidance over exhaustive documentation
219
- - Check hive wisdom above first -- do not re-discover known patterns
220
-
221
- --- TOOLS ---
222
- Use: Glob, Grep, Read, WebSearch, WebFetch
223
- Do NOT use: Task, Write, Edit
224
-
225
- --- OUTPUT FORMAT ---
226
- Return JSON:
227
- {
228
- "hive_wisdom_used": ["list of hive entries that were relevant"],
229
- "key_patterns": [
230
- {"pattern": "description", "source": "file path or URL", "relevance": "why it matters for this phase"}
231
- ],
232
- "external_context": [
233
- {"topic": "what", "finding": "description", "source": "URL or doc reference"}
234
- ],
235
- "gotchas": [
236
- {"issue": "what can go wrong", "prevention": "how to avoid it", "source": "evidence"}
237
- ],
238
- "recommended_approach": "synthesis paragraph",
239
- "files_to_study": ["path1", "path2"]
240
- }
241
- ```
242
-
243
- **4. Wait for scout to complete** (blocking -- direct Task return).
244
-
245
- **5. Parse scout JSON output and write RESEARCH.md to disk.** The Queen (plan.md orchestrator) writes the file -- scout is read-only. Write to: `.aether/data/phase-research/phase-{phase_number}-research.md`
246
-
247
- RESEARCH.md format (6 fixed sections):
248
-
249
- ```markdown
250
- # Phase {N} Research: {Phase Name}
251
-
252
- **Generated:** {ISO-8601 timestamp}
253
- **Phase:** {N} - {Phase Name}
254
- **Research scope:** {brief summary of what was investigated}
255
-
256
- ## Hive Wisdom (Pre-existing Knowledge)
257
- {Format hive_wisdom_used entries, or "No relevant hive wisdom found" if empty}
258
-
259
- ## Key Patterns
260
- {Format each key_patterns entry as: **{pattern}:** {relevance} (Source: {source})}
261
-
262
- ## External Context
263
- {Format each external_context entry as: **{topic}:** {finding} (Source: {source})}
264
- {If empty: "No external research needed for this phase"}
265
-
266
- ## Gotchas
267
- {Format each gotchas entry as: **{issue}:** {prevention} (Source: {source})}
268
-
269
- ## Recommended Approach
270
- {recommended_approach text}
271
-
272
- ## Files to Study
273
- {Format as bullet list of file paths}
274
- ```
275
-
276
- **6. Store research findings** in a variable `research_findings_summary` for injection into the Route-Setter prompt in Step 4. This is a compact summary (not the full RESEARCH.md):
277
-
278
- ```
279
- Key Patterns: {bullet list of pattern names}
280
- Gotchas: {bullet list of gotcha titles}
281
- Recommended: {recommended_approach, first sentence only}
282
- Files: {comma-separated file paths}
283
- ```
284
-
285
- **7. Display completion:**
286
-
287
- ```
288
- Research complete: phase-{phase_number}-research.md ({word_count} words)
289
- ```
290
-
291
- ### Step 4: Research and Planning Loop
292
-
293
- Initialize tracking:
294
- - `iteration = 0`
295
- - `confidence = 0`
296
- - `gaps = []` (list of knowledge gaps)
297
- - `plan_draft = null`
298
- - `last_confidence = 0`
299
- - `stall_count = 0` (consecutive iterations with < 5% improvement)
300
-
301
- **Loop (max {max_iterations} iterations, 2 agents per iteration: 1 scout + 1 planner):**
302
-
303
- ```
304
- while iteration < max_iterations AND confidence < target_confidence:
305
- iteration += 1
306
-
307
- # === AUTO-BREAK CHECKS (no user prompt needed) ===
308
- if iteration > 1:
309
- if confidence >= target_confidence:
310
- Log: "Confidence threshold reached ({confidence}%), finalizing plan"
311
- break
312
- if stall_count >= 2:
313
- Log: "Planning stalled at {confidence}%, finalizing current plan"
314
- break
315
-
316
- # === RESEARCH PHASE (always runs — 1 scout per iteration) ===
317
-
318
- if iteration == 1:
319
-
320
- # Broad exploration on first pass
321
- Spawn Research Scout via Task tool with subagent_type="aether-scout":
322
-
323
- """
324
- You are a Scout Ant in the Aether Colony.
325
-
326
- --- MISSION ---
327
- Research the codebase to understand what exists and how it works.
328
-
329
- Goal: "{goal}"
330
- Iteration: {iteration}/{max_iterations}
331
-
332
- {context_capsule_prompt}
333
-
334
- --- EXPLORATION AREAS ---
335
- Cover ALL of these in a single pass:
336
- 1. Core architecture, entry points, and main modules
337
- 2. Business logic and domain models
338
- 3. Testing patterns and quality practices
339
- 4. Configuration, dependencies, and infrastructure
340
- 5. Edge cases, error handling, and validation
341
-
342
- --- TOOLS ---
343
- Use: Glob, Grep, Read, WebSearch, WebFetch
344
- Do NOT use: Task, Write, Edit
345
-
346
- --- OUTPUT CONSTRAINTS ---
347
- Maximum 5 findings (prioritize by impact on the goal).
348
- Maximum 2 sentences per finding.
349
- Maximum 3 knowledge gaps identified.
350
-
351
- --- OUTPUT FORMAT ---
352
- Return JSON:
353
- {
354
- "findings": [
355
- {"area": "...", "discovery": "...", "source": "file or search"}
356
- ],
357
- "gaps_remaining": [
358
- {"id": "gap_N", "description": "..."}
359
- ],
360
- "overall_knowledge_confidence": 0-100
361
- }
362
- """
363
-
364
- else:
365
-
366
- # Gap-focused research on subsequent passes
367
- Spawn Gap-Focused Scout via Task tool with subagent_type="aether-scout":
368
-
369
- """
370
- You are a Scout Ant in the Aether Colony (gap-focused research).
371
-
372
- --- MISSION ---
373
- Investigate ONLY these specific knowledge gaps. Do not explore broadly.
374
-
375
- Goal: "{goal}"
376
- Iteration: {iteration}/{max_iterations}
377
-
378
- {context_capsule_prompt}
379
-
380
- --- GAPS TO INVESTIGATE ---
381
- {for each gap in gaps:}
382
- - {gap.id}: {gap.description}
383
- {end for}
384
-
385
- --- TOOLS ---
386
- Use: Glob, Grep, Read, WebSearch, WebFetch
387
- Do NOT use: Task, Write, Edit
388
-
389
- --- OUTPUT CONSTRAINTS ---
390
- Maximum 3 findings (one per gap investigated).
391
- Maximum 2 sentences per finding.
392
- Only report gaps that are STILL unresolved after your research.
393
-
394
- --- OUTPUT FORMAT ---
395
- Return JSON:
396
- {
397
- "findings": [
398
- {"area": "...", "discovery": "...", "source": "file or search"}
399
- ],
400
- "gaps_remaining": [
401
- {"id": "gap_N", "description": "..."}
402
- ],
403
- "gaps_resolved": ["gap_1", "gap_2"],
404
- "overall_knowledge_confidence": 0-100
405
- }
406
- """
407
-
408
- # Wait for scout to complete.
409
- # Update gaps list from scout results.
410
-
411
- # === PLANNING PHASE (always runs — 1 planner per iteration) ===
412
-
413
- Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="aether-route-setter":
414
- # 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."
415
-
416
- """
417
- You are a Route-Setter Ant in the Aether Colony.
418
-
419
- --- MISSION ---
420
- Create or refine a project plan based on research findings.
421
-
422
- Goal: "{goal}"
423
- Iteration: {iteration}/{max_iterations}
424
-
425
- {context_capsule_prompt}
426
-
427
- --- PLANNING DISCIPLINE ---
428
-
429
- Key rules:
430
- - Bite-sized tasks (2-5 minutes each) - one action per task
431
- - Goal-oriented - describe WHAT to achieve, not HOW
432
- - Constraints define boundaries, not implementation
433
- - Hints point toward patterns, not solutions
434
- - Success criteria are testable outcomes
435
-
436
- Task format (GOAL-ORIENTED):
437
- ```
438
- Task N.1: {goal description}
439
- Goal: What to achieve (not how)
440
- Constraints:
441
- - Boundaries and requirements
442
- - Integration points
443
- Hints:
444
- - Pointer to existing patterns (optional)
445
- - Relevant files to reference (optional)
446
- Success Criteria:
447
- - Testable outcome 1
448
- - Testable outcome 2
449
- ```
450
-
451
- DO NOT include:
452
- - Exact code to write
453
- - Specific function names (unless critical API)
454
- - Implementation details
455
- - Line-by-line instructions
456
-
457
- Workers discover implementations by reading existing code and patterns.
458
- This enables TRUE EMERGENCE - different approaches based on context.
459
-
460
- --- RESEARCH FINDINGS ---
461
- {scout.findings formatted — compact, max 5 items}
462
-
463
- --- PHASE DOMAIN RESEARCH (from Step 3.6) ---
464
- {research_findings_summary if available, otherwise omit this section}
465
-
466
- Remaining Gaps:
467
- {gaps formatted — compact, max 3 items}
468
-
469
- --- CURRENT PLAN DRAFT ---
470
- {if plan_draft:}
471
- {plan_draft}
472
- {else:}
473
- No plan yet. Create initial draft.
474
- {end if}
475
-
476
- --- INSTRUCTIONS ---
477
- 1. If no plan exists, create 3-6 phases with concrete tasks
478
- 2. If plan exists, refine based on NEW information only
479
- 3. Rate confidence across 5 dimensions
480
- 4. Keep response concise — no verbose explanations
481
-
482
- Do NOT assign castes to tasks - describe the work only.
483
-
484
- --- OUTPUT CONSTRAINTS ---
485
- Maximum 6 phases. Maximum 4 tasks per phase.
486
- Maximum 2 sentence description per task.
487
- Confidence dimensions as single numbers, not paragraphs.
488
-
489
- --- OUTPUT FORMAT ---
490
- Return JSON:
491
- {
492
- "plan": {
493
- "phases": [
494
- {
495
- "id": 1,
496
- "name": "...",
497
- "description": "...",
498
- "tasks": [
499
- {
500
- "id": "1.1",
501
- "goal": "What to achieve (not how)",
502
- "constraints": ["boundary 1", "boundary 2"],
503
- "hints": ["optional pointer to pattern"],
504
- "success_criteria": ["testable outcome 1", "testable outcome 2"],
505
- "depends_on": []
506
- }
507
- ],
508
- "success_criteria": ["...", "..."]
509
- }
510
- ]
511
- },
512
- "confidence": {
513
- "knowledge": 0-100,
514
- "requirements": 0-100,
515
- "risks": 0-100,
516
- "dependencies": 0-100,
517
- "effort": 0-100,
518
- "overall": 0-100
519
- },
520
- "delta_reasoning": "One sentence: what changed from last iteration",
521
- "unresolved_gaps": ["...", "..."]
522
- }
523
- """
524
-
525
- Parse planning results. Update plan_draft and confidence.
526
-
527
- # === UPDATE WATCH FILES ===
528
-
529
- Update `.aether/data/watch-status.txt` with current state.
530
- Update `.aether/data/watch-progress.txt` with progress bar.
531
-
532
- # === STALL TRACKING ===
533
-
534
- delta = confidence - last_confidence
535
- if delta < 5:
536
- stall_count += 1
537
- else:
538
- stall_count = 0
539
-
540
- last_confidence = confidence
541
- ```
542
-
543
- **After loop exits (auto-finalize, no user prompt needed):**
544
-
545
- ```
546
- Planning complete after {iteration} iteration(s).
547
-
548
- Confidence: {confidence}%
549
- {if gaps remain:}
550
- Note: {gaps.length} knowledge gap(s) deferred — these can be resolved during builds.
551
- {end if}
552
- ```
553
-
554
- Proceed directly to Step 5. No user confirmation needed — the plan auto-finalizes.
555
-
556
- ### Step 5: Finalize Plan
557
-
558
- Once loop exits (confidence >= {target_confidence}, max iterations reached, or stall detected):
559
-
560
- Read current COLONY_STATE.json, then update:
561
- - Set `plan.phases` to the final phases array
562
- - Set `plan.generated_at` to ISO-8601 timestamp
563
- - Set `state` to `"READY"`
564
- - Append event: `"<timestamp>|plan_generated|plan|Generated {N} phases with {confidence}% confidence"`
565
-
566
- Write COLONY_STATE.json.
567
-
568
- **Verify the write** — read back and confirm the plan persisted:
569
- ```bash
570
- verify_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
571
- verify_timestamp=$(jq -r '.plan.generated_at' .aether/data/COLONY_STATE.json)
572
- verify_state=$(jq -r '.state' .aether/data/COLONY_STATE.json)
573
- if [[ "$verify_phases" -lt 1 || "$verify_timestamp" == "null" || "$verify_state" != "READY" ]]; then
574
- echo "ERROR: Plan write verification failed (phases=$verify_phases, generated_at=$verify_timestamp, state=$verify_state)"
575
- echo "Attempting retry write..."
576
- # Retry: re-read, update, write via state API
577
- bash .aether/aether-utils.sh state-write "$(jq --argjson phases "$(echo '$PLAN_JSON' | jq '.plan.phases')" --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" '.plan.phases = $phases | .plan.generated_at = $ts | .state = "READY"' .aether/data/COLONY_STATE.json)"
578
- verify_phases=$(jq '.plan.phases | length' .aether/data/COLONY_STATE.json)
579
- if [[ "$verify_phases" -lt 1 ]]; then
580
- echo "FATAL: Retry write also failed. Plan was not persisted."
581
- echo "Re-run /ant:plan to regenerate."
582
- stop
583
- fi
584
- fi
585
- echo "Plan verified: $verify_phases phases, generated_at=$verify_timestamp, state=$verify_state"
586
- ```
587
-
588
- Log: `bash .aether/aether-utils.sh activity-log "PLAN_COMPLETE" "queen" "Plan finalized with {confidence}% confidence"`
589
-
590
- Update watch-status.txt:
591
- ```
592
- AETHER COLONY :: READY
593
- =======================
594
-
595
- State: READY
596
- Plan: {N} phases generated
597
- Confidence: {confidence}%
598
-
599
- Ready to build.
600
- ```
601
-
602
- ### Step 6: Update Session
603
-
604
- Update the session tracking file to enable `/ant:resume` after context clear:
605
-
606
- ```bash
607
- bash .aether/aether-utils.sh session-update "/ant:plan" "/ant:build 1" "Plan generated with {confidence}% confidence, {N} phases"
608
- ```
609
-
610
- ### Step 7: Display Plan
611
-
612
- Read `plan.phases` from COLONY_STATE.json and display:
613
-
614
- ```
615
- 📊🐜🗺️🐜📊 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
616
- C O L O N Y P L A N
617
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 📊🐜🗺️🐜📊
618
-
619
- 👑 Goal: {goal}
620
-
621
- {if plan was just generated:}
622
- 📊 Confidence: {confidence}%
623
- 🔄 Iterations: {iteration}
624
- {end if}
625
-
626
- ─────────────────────────────────────────────────────
627
-
628
- 📍 Phase {id}: {name} [{STATUS}]
629
- {description}
630
-
631
- 🐜 Tasks:
632
- {status_icon} {id}: {description}
633
-
634
- ✅ Success Criteria:
635
- • {criterion}
636
-
637
- ─────────────────────────────────────────────────────
638
- (repeat for each phase)
639
-
640
- 🐜 Next Steps:
641
- {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.}
642
- /ant:build {first_incomplete_phase} 🔨 Phase {first_incomplete_phase}: {phase_name}
643
- /ant:focus "<area>" 🎯 Focus colony attention
644
- /ant:status 📊 View colony status
645
-
646
- 💾 Plan persisted — safe to /clear before building
647
- ```
648
-
649
- Status icons: pending = `[ ]`, in_progress = `[~]`, completed = `[✓]`
650
-
651
- After displaying the plan, generate the state-based Next Up block:
652
- ```bash
653
- state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
654
- current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
655
- total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
656
- bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
657
- ```
658
-
659
- ---
660
-
661
- ## Confidence Scoring Reference
662
-
663
- Each dimension rated 0-100%:
664
-
665
- | Dimension | What It Measures |
666
- |-----------|------------------|
667
- | Knowledge | Understanding of codebase structure, patterns, tech stack |
668
- | Requirements | Clarity of success criteria and acceptance conditions |
669
- | Risks | Identification of potential blockers and failure modes |
670
- | Dependencies | Understanding of what affects what, ordering constraints |
671
- | Effort | Ability to estimate relative complexity of tasks |
672
-
673
- **Overall** = weighted average (knowledge 25%, requirements 25%, risks 20%, dependencies 15%, effort 15%)
674
-
675
- **Target:** Use the selected planning depth target. Higher targets trade latency for stronger up-front plan quality.
676
-
677
- ---
678
-
679
- ## Auto-Termination Safeguards
680
-
681
- The planning loop terminates automatically without requiring user input:
682
-
683
- 1. **Confidence Threshold**: Loop exits when overall confidence reaches `{target_confidence}%`
684
-
685
- 2. **Hard Iteration Cap**: Maximum `{max_iterations}` iterations (2 subagents per iteration: 1 scout + 1 planner)
686
-
687
- 3. **Stall Detection**: If confidence improves < 5% for 2 consecutive iterations, auto-finalize current plan
688
-
689
- 4. **Single Scout Research**: One researcher per iteration (broad on iteration 1, gap-focused on 2+) — no parallel Alpha/Beta or synthesis agent
690
-
691
- 5. **Compressed Output**: Subagents limited to 5 findings max, 2-sentence summaries, compact JSON
692
-
693
- 6. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence