aether-colony 3.1.5 → 3.1.16

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 (133) hide show
  1. package/.claude/commands/ant/archaeology.md +12 -0
  2. package/.claude/commands/ant/build.md +382 -319
  3. package/.claude/commands/ant/chaos.md +23 -1
  4. package/.claude/commands/ant/colonize.md +147 -87
  5. package/.claude/commands/ant/continue.md +213 -23
  6. package/.claude/commands/ant/council.md +22 -0
  7. package/.claude/commands/ant/dream.md +18 -0
  8. package/.claude/commands/ant/entomb.md +178 -6
  9. package/.claude/commands/ant/init.md +87 -13
  10. package/.claude/commands/ant/lay-eggs.md +45 -5
  11. package/.claude/commands/ant/oracle.md +82 -9
  12. package/.claude/commands/ant/organize.md +2 -2
  13. package/.claude/commands/ant/pause-colony.md +86 -28
  14. package/.claude/commands/ant/phase.md +26 -0
  15. package/.claude/commands/ant/plan.md +204 -111
  16. package/.claude/commands/ant/resume-colony.md +23 -1
  17. package/.claude/commands/ant/resume.md +159 -0
  18. package/.claude/commands/ant/seal.md +177 -3
  19. package/.claude/commands/ant/swarm.md +78 -97
  20. package/.claude/commands/ant/verify-castes.md +7 -7
  21. package/.claude/commands/ant/watch.md +17 -0
  22. package/.opencode/agents/aether-ambassador.md +97 -0
  23. package/.opencode/agents/aether-archaeologist.md +91 -0
  24. package/.opencode/agents/aether-architect.md +66 -0
  25. package/.opencode/agents/aether-auditor.md +111 -0
  26. package/.opencode/agents/aether-builder.md +28 -10
  27. package/.opencode/agents/aether-chaos.md +98 -0
  28. package/.opencode/agents/aether-chronicler.md +80 -0
  29. package/.opencode/agents/aether-gatekeeper.md +107 -0
  30. package/.opencode/agents/aether-guardian.md +107 -0
  31. package/.opencode/agents/aether-includer.md +108 -0
  32. package/.opencode/agents/aether-keeper.md +106 -0
  33. package/.opencode/agents/aether-measurer.md +119 -0
  34. package/.opencode/agents/aether-probe.md +91 -0
  35. package/.opencode/agents/aether-queen.md +72 -19
  36. package/.opencode/agents/aether-route-setter.md +85 -0
  37. package/.opencode/agents/aether-sage.md +98 -0
  38. package/.opencode/agents/aether-scout.md +33 -15
  39. package/.opencode/agents/aether-surveyor-disciplines.md +334 -0
  40. package/.opencode/agents/aether-surveyor-nest.md +272 -0
  41. package/.opencode/agents/aether-surveyor-pathogens.md +209 -0
  42. package/.opencode/agents/aether-surveyor-provisions.md +277 -0
  43. package/.opencode/agents/aether-tracker.md +91 -0
  44. package/.opencode/agents/aether-watcher.md +30 -12
  45. package/.opencode/agents/aether-weaver.md +87 -0
  46. package/.opencode/agents/workers.md +1034 -0
  47. package/.opencode/commands/ant/archaeology.md +44 -26
  48. package/.opencode/commands/ant/build.md +326 -294
  49. package/.opencode/commands/ant/chaos.md +32 -4
  50. package/.opencode/commands/ant/colonize.md +119 -93
  51. package/.opencode/commands/ant/continue.md +98 -10
  52. package/.opencode/commands/ant/council.md +28 -0
  53. package/.opencode/commands/ant/dream.md +24 -0
  54. package/.opencode/commands/ant/entomb.md +73 -1
  55. package/.opencode/commands/ant/feedback.md +8 -2
  56. package/.opencode/commands/ant/flag.md +9 -3
  57. package/.opencode/commands/ant/flags.md +8 -2
  58. package/.opencode/commands/ant/focus.md +8 -2
  59. package/.opencode/commands/ant/help.md +12 -0
  60. package/.opencode/commands/ant/init.md +49 -4
  61. package/.opencode/commands/ant/lay-eggs.md +30 -2
  62. package/.opencode/commands/ant/oracle.md +39 -7
  63. package/.opencode/commands/ant/organize.md +8 -2
  64. package/.opencode/commands/ant/pause-colony.md +54 -1
  65. package/.opencode/commands/ant/phase.md +36 -4
  66. package/.opencode/commands/ant/plan.md +224 -116
  67. package/.opencode/commands/ant/redirect.md +8 -2
  68. package/.opencode/commands/ant/resume-colony.md +51 -26
  69. package/.opencode/commands/ant/seal.md +76 -0
  70. package/.opencode/commands/ant/status.md +50 -20
  71. package/.opencode/commands/ant/swarm.md +108 -104
  72. package/.opencode/commands/ant/tunnels.md +107 -2
  73. package/CHANGELOG.md +16 -0
  74. package/README.md +199 -86
  75. package/bin/cli.js +142 -25
  76. package/bin/generate-commands.sh +100 -16
  77. package/bin/lib/caste-colors.js +5 -5
  78. package/bin/lib/errors.js +16 -0
  79. package/bin/lib/file-lock.js +279 -44
  80. package/bin/lib/state-sync.js +206 -23
  81. package/bin/lib/update-transaction.js +206 -24
  82. package/bin/sync-to-runtime.sh +138 -0
  83. package/package.json +2 -2
  84. package/runtime/CONTEXT.md +160 -0
  85. package/runtime/aether-utils.sh +1421 -55
  86. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +1343 -0
  87. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +2642 -0
  88. package/runtime/docs/PHEROMONE-INJECTION.md +240 -0
  89. package/runtime/docs/PHEROMONE-INTEGRATION.md +192 -0
  90. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +426 -0
  91. package/runtime/docs/README.md +94 -0
  92. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +219 -0
  93. package/runtime/docs/biological-reference.md +272 -0
  94. package/runtime/docs/codebase-review.md +399 -0
  95. package/runtime/docs/command-sync.md +164 -0
  96. package/runtime/docs/implementation-learnings.md +89 -0
  97. package/runtime/docs/known-issues.md +217 -0
  98. package/runtime/docs/namespace.md +148 -0
  99. package/runtime/docs/planning-discipline.md +159 -0
  100. package/runtime/exchange/pheromone-xml.sh +574 -0
  101. package/runtime/exchange/registry-xml.sh +269 -0
  102. package/runtime/exchange/wisdom-xml.sh +312 -0
  103. package/runtime/lib/queen-utils.sh +729 -0
  104. package/runtime/model-profiles.yaml +100 -0
  105. package/runtime/recover.sh +136 -0
  106. package/runtime/schemas/aether-types.xsd +255 -0
  107. package/runtime/schemas/colony-registry.xsd +309 -0
  108. package/runtime/schemas/pheromone.xsd +163 -0
  109. package/runtime/schemas/prompt.xsd +416 -0
  110. package/runtime/schemas/queen-wisdom.xsd +325 -0
  111. package/runtime/schemas/worker-priming.xsd +276 -0
  112. package/runtime/templates/QUEEN.md.template +79 -0
  113. package/runtime/utils/atomic-write.sh +5 -5
  114. package/runtime/utils/chamber-utils.sh +6 -3
  115. package/runtime/utils/error-handler.sh +200 -0
  116. package/runtime/utils/queen-to-md.xsl +395 -0
  117. package/runtime/utils/spawn-tree.sh +428 -0
  118. package/runtime/utils/spawn-with-model.sh +56 -0
  119. package/runtime/utils/state-loader.sh +215 -0
  120. package/runtime/utils/swarm-display.sh +5 -5
  121. package/runtime/utils/watch-spawn-tree.sh +90 -22
  122. package/runtime/utils/xml-compose.sh +247 -0
  123. package/runtime/utils/xml-core.sh +186 -0
  124. package/runtime/utils/xml-utils.sh +2196 -0
  125. package/runtime/verification-loop.md +1 -1
  126. package/runtime/workers-new-castes.md +516 -0
  127. package/runtime/workers.md +18 -6
  128. package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
  129. package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
  130. package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
  131. package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
  132. package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
  133. package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
@@ -3,11 +3,27 @@ name: ant:plan
3
3
  description: "📊🐜🗺️🐜📊 Show project plan or generate project-specific phases"
4
4
  ---
5
5
 
6
- You are the **Queen**. Orchestrate iterative research and planning until 95% confidence.
6
+ You are the **Queen**. Orchestrate research and planning until 80% confidence (maximum 4 iterations).
7
7
 
8
8
  ## Instructions
9
9
 
10
- ### Step 0: Version Check (Non-blocking)
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
22
+ bash .aether/aether-utils.sh swarm-display-init "$plan_id"
23
+ 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
24
+ ```
25
+
26
+ ### Step 0.5: Version Check (Non-blocking)
11
27
 
12
28
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
13
29
 
@@ -76,7 +92,7 @@ AETHER COLONY :: PLANNING
76
92
  State: PLANNING
77
93
  Phase: 0/0 (generating plan)
78
94
  Confidence: 0%
79
- Iteration: 0/50
95
+ Iteration: 0/4
80
96
 
81
97
  Active Workers:
82
98
  [Research] Starting...
@@ -93,9 +109,9 @@ Progress
93
109
 
94
110
  [ ] 0%
95
111
 
96
- Target: 95% confidence
112
+ Target: 80% confidence
97
113
 
98
- Iteration: 0/50
114
+ Iteration: 0/4
99
115
  Gaps: (analyzing...)
100
116
  ```
101
117
 
@@ -104,76 +120,162 @@ Log start:
104
120
  bash .aether/aether-utils.sh activity-log "PLAN_START" "queen" "Iterative planning loop initiated for goal"
105
121
  ```
106
122
 
107
- ### Step 4: Iterative Research/Planning Loop
123
+ ### Step 3.5: Load Territory Survey
124
+
125
+ Check if territory survey exists before research:
126
+
127
+ ```bash
128
+ ls .aether/data/survey/*.md 2>/dev/null
129
+ ```
130
+
131
+ **If survey exists:**
132
+ 1. **Always read PATHOGENS.md first** — understand known concerns before planning
133
+ 2. Read other relevant docs based on goal keywords:
134
+
135
+ | Goal Contains | Additional Documents |
136
+ |---------------|---------------------|
137
+ | UI, frontend, component, page | DISCIPLINES.md, CHAMBERS.md |
138
+ | API, backend, endpoint | BLUEPRINT.md, DISCIPLINES.md |
139
+ | database, schema, model | BLUEPRINT.md, PROVISIONS.md |
140
+ | test, spec | SENTINEL-PROTOCOLS.md, DISCIPLINES.md |
141
+ | integration, external | TRAILS.md, PROVISIONS.md |
142
+ | refactor, cleanup | PATHOGENS.md, BLUEPRINT.md |
143
+
144
+ **Inject survey context into scout and planner prompts:**
145
+ - Include key patterns from DISCIPLINES.md
146
+ - Reference architecture from BLUEPRINT.md
147
+ - Note tech stack from PROVISIONS.md
148
+ - Flag concerns from PATHOGENS.md
149
+
150
+ **Display:**
151
+ ```
152
+ 🗺️ Territory survey loaded — incorporating context into planning
153
+ ```
154
+
155
+ **If no survey:** Continue without survey context (scouts will do fresh exploration)
156
+
157
+ ### Step 4: Research and Planning Loop
108
158
 
109
159
  Initialize tracking:
110
160
  - `iteration = 0`
111
161
  - `confidence = 0`
112
162
  - `gaps = []` (list of knowledge gaps)
113
- - `stuck_counts = {}` (gap_id -> count of iterations without progress)
114
163
  - `plan_draft = null`
115
164
  - `last_confidence = 0`
116
165
  - `stall_count = 0` (consecutive iterations with < 5% improvement)
117
166
 
118
- **Loop (max 50 iterations):**
167
+ **Loop (max 4 iterations, 2 agents per iteration: 1 scout + 1 planner):**
119
168
 
120
169
  ```
121
- while iteration < 50 AND confidence < 95:
170
+ while iteration < 4 AND confidence < 80:
122
171
  iteration += 1
123
172
 
124
- # === RESEARCH PHASE ===
173
+ # === AUTO-BREAK CHECKS (no user prompt needed) ===
174
+ if iteration > 1:
175
+ if confidence >= 80:
176
+ Log: "Confidence threshold reached ({confidence}%), finalizing plan"
177
+ break
178
+ if stall_count >= 2:
179
+ Log: "Planning stalled at {confidence}%, finalizing current plan"
180
+ break
181
+
182
+ # === RESEARCH PHASE (always runs — 1 scout per iteration) ===
183
+
184
+ if iteration == 1:
185
+
186
+ # Broad exploration on first pass
187
+ Spawn Research Scout via Task tool with subagent_type="aether-scout":
188
+
189
+ """
190
+ You are a Scout Ant in the Aether Colony.
191
+
192
+ --- MISSION ---
193
+ Research the codebase to understand what exists and how it works.
194
+
195
+ Goal: "{goal}"
196
+ Iteration: {iteration}/4
197
+
198
+ --- EXPLORATION AREAS ---
199
+ Cover ALL of these in a single pass:
200
+ 1. Core architecture, entry points, and main modules
201
+ 2. Business logic and domain models
202
+ 3. Testing patterns and quality practices
203
+ 4. Configuration, dependencies, and infrastructure
204
+ 5. Edge cases, error handling, and validation
205
+
206
+ --- TOOLS ---
207
+ Use: Glob, Grep, Read, WebSearch, WebFetch
208
+ Do NOT use: Task, Write, Edit
209
+
210
+ --- OUTPUT CONSTRAINTS ---
211
+ Maximum 5 findings (prioritize by impact on the goal).
212
+ Maximum 2 sentences per finding.
213
+ Maximum 3 knowledge gaps identified.
214
+
215
+ --- OUTPUT FORMAT ---
216
+ Return JSON:
217
+ {
218
+ "findings": [
219
+ {"area": "...", "discovery": "...", "source": "file or search"}
220
+ ],
221
+ "gaps_remaining": [
222
+ {"id": "gap_N", "description": "..."}
223
+ ],
224
+ "overall_knowledge_confidence": 0-100
225
+ }
226
+ """
125
227
 
126
- Spawn Research Ant (Scout) via Task tool with subagent_type="general-purpose":
228
+ else:
127
229
 
128
- """
129
- You are a Scout Ant in the Aether Colony.
230
+ # Gap-focused research on subsequent passes
231
+ Spawn Gap-Focused Scout via Task tool with subagent_type="aether-scout":
130
232
 
131
- --- MISSION ---
132
- Research the codebase and domain to fill knowledge gaps for planning.
233
+ """
234
+ You are a Scout Ant in the Aether Colony (gap-focused research).
133
235
 
134
- Goal: "{goal}"
135
- Iteration: {iteration}/50
136
-
137
- {if gaps is not empty:}
138
- --- SPECIFIC GAPS TO INVESTIGATE ---
139
- Focus ONLY on these gaps:
140
- {for each gap in gaps:}
141
- - {gap.id}: {gap.description}
142
- {end for}
143
- {else:}
144
- --- INITIAL EXPLORATION ---
145
- This is iteration 1. Explore:
146
- 1. Codebase structure (Glob for key files)
147
- 2. Existing patterns and conventions
148
- 3. Dependencies and tech stack
149
- 4. Any existing tests or docs
150
- {end if}
236
+ --- MISSION ---
237
+ Investigate ONLY these specific knowledge gaps. Do not explore broadly.
151
238
 
152
- --- TOOLS ---
153
- Use: Glob, Grep, Read, WebSearch, WebFetch
154
- Do NOT use: Task, Write, Edit
239
+ Goal: "{goal}"
240
+ Iteration: {iteration}/4
155
241
 
156
- --- OUTPUT FORMAT ---
157
- Return JSON:
158
- {
159
- "findings": [
160
- {"area": "...", "discovery": "...", "confidence": 0-100}
161
- ],
162
- "gaps_remaining": [
163
- {"id": "gap_N", "description": "..."}
164
- ],
165
- "gaps_resolved": ["gap_1", "gap_2"],
166
- "overall_knowledge_confidence": 0-100
167
- }
168
- """
242
+ --- GAPS TO INVESTIGATE ---
243
+ {for each gap in gaps:}
244
+ - {gap.id}: {gap.description}
245
+ {end for}
246
+
247
+ --- TOOLS ---
248
+ Use: Glob, Grep, Read, WebSearch, WebFetch
249
+ Do NOT use: Task, Write, Edit
169
250
 
170
- Parse research results. Update gaps list.
251
+ --- OUTPUT CONSTRAINTS ---
252
+ Maximum 3 findings (one per gap investigated).
253
+ Maximum 2 sentences per finding.
254
+ Only report gaps that are STILL unresolved after your research.
171
255
 
172
- Log: `bash .aether/aether-utils.sh activity-log "RESEARCH" "scout" "Iteration {iteration}: {summary}"`
256
+ --- OUTPUT FORMAT ---
257
+ Return JSON:
258
+ {
259
+ "findings": [
260
+ {"area": "...", "discovery": "...", "source": "file or search"}
261
+ ],
262
+ "gaps_remaining": [
263
+ {"id": "gap_N", "description": "..."}
264
+ ],
265
+ "gaps_resolved": ["gap_1", "gap_2"],
266
+ "overall_knowledge_confidence": 0-100
267
+ }
268
+ """
173
269
 
174
- # === PLANNING PHASE ===
270
+ # Wait for scout to complete.
271
+ # Update gaps list from scout results.
175
272
 
176
- Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="general-purpose":
273
+ Log: `bash .aether/aether-utils.sh activity-log "RESEARCH" "scout" "Iteration {iteration}: {scout.findings.length} findings, {scout.gaps_remaining.length} gaps"`
274
+
275
+ # === PLANNING PHASE (always runs — 1 planner per iteration) ===
276
+
277
+ Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="aether-route-setter":
278
+ # 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."
177
279
 
178
280
  """
179
281
  You are a Route-Setter Ant in the Aether Colony.
@@ -182,7 +284,7 @@ while iteration < 50 AND confidence < 95:
182
284
  Create or refine a project plan based on research findings.
183
285
 
184
286
  Goal: "{goal}"
185
- Iteration: {iteration}/50
287
+ Iteration: {iteration}/4
186
288
 
187
289
  --- PLANNING DISCIPLINE ---
188
290
  Read .aether/planning.md for full reference.
@@ -219,7 +321,10 @@ while iteration < 50 AND confidence < 95:
219
321
  This enables TRUE EMERGENCE - different approaches based on context.
220
322
 
221
323
  --- RESEARCH FINDINGS ---
222
- {research_results.findings formatted}
324
+ {scout.findings formatted — compact, max 5 items}
325
+
326
+ Remaining Gaps:
327
+ {gaps formatted — compact, max 3 items}
223
328
 
224
329
  --- CURRENT PLAN DRAFT ---
225
330
  {if plan_draft:}
@@ -228,18 +333,19 @@ while iteration < 50 AND confidence < 95:
228
333
  No plan yet. Create initial draft.
229
334
  {end if}
230
335
 
231
- --- REMAINING GAPS ---
232
- {gaps_remaining}
233
-
234
336
  --- INSTRUCTIONS ---
235
337
  1. If no plan exists, create 3-6 phases with concrete tasks
236
- 2. Each task must have: exact file paths, steps, expected outputs
237
- 3. If plan exists, refine based on NEW information only
238
- 4. Rate confidence across 5 dimensions
239
- 5. Explain what changed from last iteration
338
+ 2. If plan exists, refine based on NEW information only
339
+ 3. Rate confidence across 5 dimensions
340
+ 4. Keep response concise no verbose explanations
240
341
 
241
342
  Do NOT assign castes to tasks - describe the work only.
242
343
 
344
+ --- OUTPUT CONSTRAINTS ---
345
+ Maximum 6 phases. Maximum 4 tasks per phase.
346
+ Maximum 2 sentence description per task.
347
+ Confidence dimensions as single numbers, not paragraphs.
348
+
243
349
  --- OUTPUT FORMAT ---
244
350
  Return JSON:
245
351
  {
@@ -271,7 +377,7 @@ while iteration < 50 AND confidence < 95:
271
377
  "effort": 0-100,
272
378
  "overall": 0-100
273
379
  },
274
- "delta_reasoning": "What NEW information changed the plan",
380
+ "delta_reasoning": "One sentence: what changed from last iteration",
275
381
  "unresolved_gaps": ["...", "..."]
276
382
  }
277
383
  """
@@ -285,64 +391,33 @@ while iteration < 50 AND confidence < 95:
285
391
  Update `.aether/data/watch-status.txt` with current state.
286
392
  Update `.aether/data/watch-progress.txt` with progress bar.
287
393
 
288
- # === ANTI-STUCK CHECKS ===
289
-
290
- # Check 1: Gap stuck detection
291
- for each gap in gaps:
292
- if gap was in previous iteration's gaps:
293
- stuck_counts[gap.id] += 1
294
- if stuck_counts[gap.id] >= 3:
295
- mark gap as "needs_human_input"
296
- remove from active gaps
394
+ # === STALL TRACKING ===
297
395
 
298
- # Check 2: Stall detection
299
396
  delta = confidence - last_confidence
300
397
  if delta < 5:
301
398
  stall_count += 1
302
399
  else:
303
400
  stall_count = 0
304
401
 
305
- if stall_count >= 3 AND iteration > 5:
306
- # Stalled - ask user
307
- Display current plan and confidence
308
- Ask: "Planning has stalled at {confidence}%. Options:"
309
- 1. Continue iterating (may not improve)
310
- 2. Accept current plan
311
- 3. Provide guidance on: {gaps marked needs_human_input}
312
-
313
- if user chooses "accept" OR force_accept:
314
- break loop
315
- if user provides guidance:
316
- add guidance to gaps as FOCUS constraint
317
- reset stall_count
318
-
319
- # Check 3: Diminishing returns
320
- if delta < 2 AND iteration > 10:
321
- Display: "Approaching local maximum at {confidence}%."
322
- Ask: "Continue or accept current plan?"
323
- if user accepts:
324
- break loop
325
-
326
402
  last_confidence = confidence
327
403
  ```
328
404
 
329
- **After loop exits:**
405
+ **After loop exits (auto-finalize, no user prompt needed):**
330
406
 
331
- If `iteration == 50` and `confidence < 95`:
332
407
  ```
333
- Planning reached maximum iterations.
334
-
335
- Current confidence: {confidence}%
336
- Unresolved gaps:
337
- {list gaps marked needs_human_input}
408
+ Planning complete after {iteration} iteration(s).
338
409
 
339
- Recommendation: {proceed if confidence > 70, else get human input}
410
+ Confidence: {confidence}%
411
+ {if gaps remain:}
412
+ Note: {gaps.length} knowledge gap(s) deferred — these can be resolved during builds.
413
+ {end if}
340
414
  ```
341
- Ask user to accept or provide input.
415
+
416
+ Proceed directly to Step 5. No user confirmation needed — the plan auto-finalizes.
342
417
 
343
418
  ### Step 5: Finalize Plan
344
419
 
345
- Once plan is accepted (confidence >= 95 OR user approved):
420
+ Once loop exits (confidence >= 80, max iterations reached, or stall detected):
346
421
 
347
422
  Read current COLONY_STATE.json, then update:
348
423
  - Set `plan.phases` to the final phases array
@@ -366,7 +441,21 @@ Confidence: {confidence}%
366
441
  Ready to build.
367
442
  ```
368
443
 
369
- ### Step 6: Display Plan
444
+ ### Step 6: Update Session
445
+
446
+ Update the session tracking file to enable `/ant:resume` after context clear:
447
+
448
+ ```bash
449
+ bash .aether/aether-utils.sh session-update "/ant:plan" "/ant:build 1" "Plan generated with {confidence}% confidence, {N} phases"
450
+ ```
451
+
452
+ ### Step 7: Display Plan
453
+
454
+ **If visual_mode is true, render final swarm display:**
455
+ ```bash
456
+ 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
457
+ bash .aether/aether-utils.sh swarm-display-render "$plan_id"
458
+ ```
370
459
 
371
460
  Read `plan.phases` from COLONY_STATE.json and display:
372
461
 
@@ -423,18 +512,22 @@ Each dimension rated 0-100%:
423
512
 
424
513
  **Overall** = weighted average (knowledge 25%, requirements 25%, risks 20%, dependencies 15%, effort 15%)
425
514
 
426
- **Target: 95%** - High confidence plan ready for autonomous execution.
515
+ **Target: 80%** - Sufficient confidence for autonomous execution. Higher confidence is achieved during builds as gaps are resolved.
427
516
 
428
517
  ---
429
518
 
430
- ## Anti-Stuck Safeguards
519
+ ## Auto-Termination Safeguards
520
+
521
+ The planning loop terminates automatically without requiring user input:
522
+
523
+ 1. **Confidence Threshold**: Loop exits when overall confidence reaches 80%
431
524
 
432
- 1. **Gap Tracking**: Each gap has a `stuck_count`. After 3 iterations without progress, marked "needs human input"
525
+ 2. **Hard Iteration Cap**: Maximum 4 iterations (8 subagents total: 1 scout + 1 planner per iteration)
433
526
 
434
- 2. **Stall Detection**: If confidence improves < 5% for 3 consecutive iterations after iteration 5, pause for user decision
527
+ 3. **Stall Detection**: If confidence improves < 5% for 2 consecutive iterations, auto-finalize current plan
435
528
 
436
- 3. **Diminishing Returns**: If confidence improves < 2% after iteration 10, offer to accept current plan
529
+ 4. **Single Scout Research**: One researcher per iteration (broad on iteration 1, gap-focused on 2+) no parallel Alpha/Beta or synthesis agent
437
530
 
438
- 4. **Focused Research**: Research Ant receives SPECIFIC gaps, not open-ended exploration (after iteration 1)
531
+ 5. **Compressed Output**: Subagents limited to 5 findings max, 2-sentence summaries, compact JSON
439
532
 
440
- 5. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence
533
+ 6. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence
@@ -7,7 +7,23 @@ You are the **Queen Ant Colony**. Restore state from a paused session.
7
7
 
8
8
  ## Instructions
9
9
 
10
- ### Step 0: Version Check (Non-blocking)
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
+ resume_id="resume-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$resume_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Resuming colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
26
+ ### Step 0.5: Version Check (Non-blocking)
11
27
 
12
28
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
13
29
 
@@ -77,6 +93,12 @@ CONTEXT FROM HANDOFF
77
93
  NEXT ACTIONS
78
94
  ```
79
95
 
96
+ **If visual_mode is true, render final swarm display:**
97
+ ```bash
98
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Colony resumed" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "fungus_garden" 100
99
+ bash .aether/aether-utils.sh swarm-display-render "$resume_id"
100
+ ```
101
+
80
102
  Route to next action based on state:
81
103
  - If state is `READY` and there's a pending phase -> suggest `/ant:build <phase>`
82
104
  - If state is `EXECUTING` -> note that a build was interrupted, suggest restarting with `/ant:build <phase>`
@@ -0,0 +1,159 @@
1
+ # /ant:resume — Resume Previous Session
2
+
3
+ Resume work from where you left off after a context clear or new session start.
4
+
5
+ ## When to Use
6
+
7
+ - After running `/clear` and wanting to continue previous work
8
+ - When opening a new Claude Code session with existing colony state
9
+ - To check what you were working on and pick up where you left off
10
+
11
+ ## What It Does
12
+
13
+ 1. Reads `.aether/data/session.json` to understand previous activity
14
+ 2. Reads `COLONY_STATE.json` to verify colony status
15
+ 3. Checks `TO-DOs.md` for relevant pending work
16
+ 4. Presents a summary and asks if you want to resume
17
+ 5. If yes: Restores context and suggests next step
18
+ 6. If no: Offers to start fresh with `/ant:init`
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ /ant:resume
24
+ ```
25
+
26
+ ## Session Recovery Flow
27
+
28
+ ### Step 1: Check for Existing Session
29
+
30
+ ```bash
31
+ bash .aether/aether-utils.sh session-read
32
+ ```
33
+
34
+ Check if session exists and whether it's stale (> 24 hours old).
35
+
36
+ ### Step 2: If No Session Found
37
+
38
+ Display:
39
+ ```
40
+ 📋 SESSION RESUME
41
+
42
+ No previous session found.
43
+
44
+ Would you like to:
45
+ 1. Start a new colony with /ant:init
46
+ 2. Check status with /ant:status
47
+ 3. View existing colonies with /ant:history
48
+ ```
49
+
50
+ Offer to run `/ant:init` to start fresh.
51
+
52
+ ### Step 3: If Session Exists
53
+
54
+ Read session data and colony state, then present summary:
55
+
56
+ ```
57
+ 📋 SESSION RESUME
58
+
59
+ You were working on: {colony_goal}
60
+ Current Phase: {current_phase} ({current_milestone})
61
+ Last Command: {last_command}
62
+ Last Active: {hours_ago} hours ago
63
+ Suggested Next: {suggested_next}
64
+
65
+ Active TODOs:
66
+ - {todo1}
67
+ - {todo2}
68
+
69
+ Would you like to resume this work?
70
+ ```
71
+
72
+ Use `AskUserQuestion` to present options:
73
+ - **Yes, resume** — Continue where you left off
74
+ - **Show details** — See full colony state first
75
+ - **No, start fresh** — Clear session and start new
76
+
77
+ ### Step 4: If User Chooses "Yes, resume"
78
+
79
+ 1. Mark session as resumed:
80
+ ```bash
81
+ bash .aether/aether-utils.sh session-mark-resumed
82
+ ```
83
+
84
+ 2. Present context summary:
85
+ ```
86
+ 🔄 Resuming Session
87
+
88
+ Colony: {goal}
89
+ Phase: {phase} - {milestone}
90
+ Context restored.
91
+
92
+ Next suggested step: {suggested_next}
93
+ ```
94
+
95
+ 3. Run the suggested command or present further options based on state.
96
+
97
+ ### Step 5: If User Chooses "Show details"
98
+
99
+ Display:
100
+ ```
101
+ 📊 Colony Details
102
+
103
+ Goal: {goal}
104
+ State: {state}
105
+ Phase: {phase}
106
+ Milestone: {milestone}
107
+
108
+ Recent Activity (from activity.log):
109
+ {last 5 entries}
110
+
111
+ Pending TODOs:
112
+ {todos}
113
+
114
+ [Present Yes/No choice to resume]
115
+ ```
116
+
117
+ ### Step 6: If User Chooses "No, start fresh"
118
+
119
+ 1. Clear the session:
120
+ ```bash
121
+ bash .aether/aether-utils.sh session-clear
122
+ ```
123
+
124
+ 2. Offer:
125
+ ```
126
+ Session cleared.
127
+
128
+ Start fresh with:
129
+ - /ant:init "your new goal"
130
+ - /ant:status (to check other colonies)
131
+ ```
132
+
133
+ ## Integration with Colony Commands
134
+
135
+ All `/ant:*` commands should update the session after execution:
136
+
137
+ ```bash
138
+ # Example: After /ant:build completes
139
+ bash .aether/aether-utils.sh session-update "/ant:build $phase" "/ant:continue" "Completed phase $phase"
140
+ ```
141
+
142
+ This ensures session.json is always current for resume functionality.
143
+
144
+ ## Session File Location
145
+
146
+ `.aether/data/session.json`
147
+
148
+ This file persists across context clears and Claude Code sessions.
149
+
150
+ ## Stale Session Detection
151
+
152
+ Sessions older than 24 hours are marked "stale":
153
+ - User is warned: "This session is X days old"
154
+ - Given option to resume anyway or start fresh
155
+ - Helps prevent accidentally resuming ancient work
156
+
157
+ ## Implementation
158
+
159
+ Execute this flow when user runs `/ant:resume`.