aether-colony 3.1.4 → 3.1.15

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 (124) 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 +327 -295
  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 +9 -3
  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 +225 -117
  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 +21 -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 +129 -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/lib/queen-utils.sh +729 -0
  101. package/runtime/model-profiles.yaml +100 -0
  102. package/runtime/recover.sh +136 -0
  103. package/runtime/templates/QUEEN.md.template +79 -0
  104. package/runtime/utils/atomic-write.sh +5 -5
  105. package/runtime/utils/chamber-utils.sh +6 -3
  106. package/runtime/utils/error-handler.sh +200 -0
  107. package/runtime/utils/queen-to-md.xsl +395 -0
  108. package/runtime/utils/spawn-tree.sh +428 -0
  109. package/runtime/utils/spawn-with-model.sh +56 -0
  110. package/runtime/utils/state-loader.sh +215 -0
  111. package/runtime/utils/swarm-display.sh +5 -5
  112. package/runtime/utils/watch-spawn-tree.sh +90 -22
  113. package/runtime/utils/xml-compose.sh +247 -0
  114. package/runtime/utils/xml-core.sh +186 -0
  115. package/runtime/utils/xml-utils.sh +2161 -0
  116. package/runtime/verification-loop.md +1 -1
  117. package/runtime/workers-new-castes.md +516 -0
  118. package/runtime/workers.md +20 -8
  119. package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
  120. package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
  121. package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
  122. package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
  123. package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
  124. package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
@@ -3,11 +3,33 @@ 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
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
19
+
20
+ ### Step 0: Initialize Visual Mode (if enabled)
21
+
22
+ If `visual_mode` is true:
23
+ ```bash
24
+ # Generate session ID
25
+ plan_id="plan-$(date +%s)"
26
+
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$plan_id"
29
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Generating colony plan" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
30
+ ```
31
+
32
+ ### Step 0.5: Version Check (Non-blocking)
11
33
 
12
34
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
13
35
 
@@ -32,18 +54,35 @@ No colony initialized. Run /ant:init "<goal>" first.
32
54
  ```
33
55
  Stop here.
34
56
 
35
- **Auto-Recovery Header (Session Start):**
36
- If `goal` exists and state is valid, output a brief context line:
37
- ```
38
- 🔄 Resuming: Phase {current_phase} - {phase_name}
39
- ```
40
- This helps recover context after session clears. Continue immediately (non-blocking).
57
+ ### Step 1.5: Load State and Show Resumption Context
58
+
59
+ Run using Bash tool: `bash .aether/aether-utils.sh load-state`
60
+
61
+ If successful and goal is not null:
62
+ 1. Extract current_phase from state
63
+ 2. Get phase name from plan.phases[current_phase - 1].name (or "(unnamed)")
64
+ 3. Display brief resumption context:
65
+ ```
66
+ 🔄 Resuming: Phase X - Name
67
+ ```
68
+
69
+ If .aether/HANDOFF.md exists (detected in load-state output):
70
+ - Display "Resuming from paused session"
71
+ - Read .aether/HANDOFF.md for additional context
72
+ - Remove .aether/HANDOFF.md after display (cleanup)
73
+
74
+ Run: `bash .aether/aether-utils.sh unload-state` to release lock.
75
+
76
+ **Error handling:**
77
+ - If E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
78
+ - If validation error: Display error details with recovery suggestion and stop
79
+ - For other errors: Display generic error and suggest /ant:status for diagnostics
41
80
 
42
81
  ### Step 2: Check Existing Plan
43
82
 
44
83
  If `plan.phases` has entries (non-empty array), skip to **Step 6** (Display Plan).
45
84
 
46
- Parse `$ARGUMENTS`:
85
+ Parse `$normalized_args`:
47
86
  - If contains `--accept`: Set `force_accept = true` (accept current plan regardless of confidence)
48
87
  - Otherwise: `force_accept = false`
49
88
 
@@ -59,7 +98,7 @@ AETHER COLONY :: PLANNING
59
98
  State: PLANNING
60
99
  Phase: 0/0 (generating plan)
61
100
  Confidence: 0%
62
- Iteration: 0/50
101
+ Iteration: 0/4
63
102
 
64
103
  Active Workers:
65
104
  [Research] Starting...
@@ -76,9 +115,9 @@ Progress
76
115
 
77
116
  [ ] 0%
78
117
 
79
- Target: 95% confidence
118
+ Target: 80% confidence
80
119
 
81
- Iteration: 0/50
120
+ Iteration: 0/4
82
121
  Gaps: (analyzing...)
83
122
  ```
84
123
 
@@ -87,76 +126,162 @@ Log start:
87
126
  bash .aether/aether-utils.sh activity-log "PLAN_START" "queen" "Iterative planning loop initiated for goal"
88
127
  ```
89
128
 
90
- ### Step 4: Iterative Research/Planning Loop
129
+ ### Step 3.5: Load Territory Survey
130
+
131
+ Check if territory survey exists before research:
132
+
133
+ ```bash
134
+ ls .aether/data/survey/*.md 2>/dev/null
135
+ ```
136
+
137
+ **If survey exists:**
138
+ 1. **Always read PATHOGENS.md first** — understand known concerns before planning
139
+ 2. Read other relevant docs based on goal keywords:
140
+
141
+ | Goal Contains | Additional Documents |
142
+ |---------------|---------------------|
143
+ | UI, frontend, component, page | DISCIPLINES.md, CHAMBERS.md |
144
+ | API, backend, endpoint | BLUEPRINT.md, DISCIPLINES.md |
145
+ | database, schema, model | BLUEPRINT.md, PROVISIONS.md |
146
+ | test, spec | SENTINEL-PROTOCOLS.md, DISCIPLINES.md |
147
+ | integration, external | TRAILS.md, PROVISIONS.md |
148
+ | refactor, cleanup | PATHOGENS.md, BLUEPRINT.md |
149
+
150
+ **Inject survey context into scout and planner prompts:**
151
+ - Include key patterns from DISCIPLINES.md
152
+ - Reference architecture from BLUEPRINT.md
153
+ - Note tech stack from PROVISIONS.md
154
+ - Flag concerns from PATHOGENS.md
155
+
156
+ **Display:**
157
+ ```
158
+ 🗺️ Territory survey loaded — incorporating context into planning
159
+ ```
160
+
161
+ **If no survey:** Continue without survey context (scouts will do fresh exploration)
162
+
163
+ ### Step 4: Research and Planning Loop
91
164
 
92
165
  Initialize tracking:
93
166
  - `iteration = 0`
94
167
  - `confidence = 0`
95
168
  - `gaps = []` (list of knowledge gaps)
96
- - `stuck_counts = {}` (gap_id -> count of iterations without progress)
97
169
  - `plan_draft = null`
98
170
  - `last_confidence = 0`
99
171
  - `stall_count = 0` (consecutive iterations with < 5% improvement)
100
172
 
101
- **Loop (max 50 iterations):**
173
+ **Loop (max 4 iterations, 2 agents per iteration: 1 scout + 1 planner):**
102
174
 
103
175
  ```
104
- while iteration < 50 AND confidence < 95:
176
+ while iteration < 4 AND confidence < 80:
105
177
  iteration += 1
106
178
 
107
- # === RESEARCH PHASE ===
179
+ # === AUTO-BREAK CHECKS (no user prompt needed) ===
180
+ if iteration > 1:
181
+ if confidence >= 80:
182
+ Log: "Confidence threshold reached ({confidence}%), finalizing plan"
183
+ break
184
+ if stall_count >= 2:
185
+ Log: "Planning stalled at {confidence}%, finalizing current plan"
186
+ break
187
+
188
+ # === RESEARCH PHASE (always runs — 1 scout per iteration) ===
189
+
190
+ if iteration == 1:
191
+
192
+ # Broad exploration on first pass
193
+ Spawn Research Scout via Task tool with subagent_type="general-purpose":
194
+
195
+ """
196
+ You are a Scout Ant in the Aether Colony.
197
+
198
+ --- MISSION ---
199
+ Research the codebase to understand what exists and how it works.
200
+
201
+ Goal: "{goal}"
202
+ Iteration: {iteration}/4
203
+
204
+ --- EXPLORATION AREAS ---
205
+ Cover ALL of these in a single pass:
206
+ 1. Core architecture, entry points, and main modules
207
+ 2. Business logic and domain models
208
+ 3. Testing patterns and quality practices
209
+ 4. Configuration, dependencies, and infrastructure
210
+ 5. Edge cases, error handling, and validation
211
+
212
+ --- TOOLS ---
213
+ Use: Glob, Grep, Read, WebSearch, WebFetch
214
+ Do NOT use: Task, Write, Edit
215
+
216
+ --- OUTPUT CONSTRAINTS ---
217
+ Maximum 5 findings (prioritize by impact on the goal).
218
+ Maximum 2 sentences per finding.
219
+ Maximum 3 knowledge gaps identified.
220
+
221
+ --- OUTPUT FORMAT ---
222
+ Return JSON:
223
+ {
224
+ "findings": [
225
+ {"area": "...", "discovery": "...", "source": "file or search"}
226
+ ],
227
+ "gaps_remaining": [
228
+ {"id": "gap_N", "description": "..."}
229
+ ],
230
+ "overall_knowledge_confidence": 0-100
231
+ }
232
+ """
108
233
 
109
- Spawn Research Ant (Scout) via Task tool with subagent_type="general":
234
+ else:
110
235
 
111
- """
112
- You are a Scout Ant in the Aether Colony.
236
+ # Gap-focused research on subsequent passes
237
+ Spawn Gap-Focused Scout via Task tool with subagent_type="general-purpose":
113
238
 
114
- --- MISSION ---
115
- Research the codebase and domain to fill knowledge gaps for planning.
239
+ """
240
+ You are a Scout Ant in the Aether Colony (gap-focused research).
116
241
 
117
- Goal: "{goal}"
118
- Iteration: {iteration}/50
119
-
120
- {if gaps is not empty:}
121
- --- SPECIFIC GAPS TO INVESTIGATE ---
122
- Focus ONLY on these gaps:
123
- {for each gap in gaps:}
124
- - {gap.id}: {gap.description}
125
- {end for}
126
- {else:}
127
- --- INITIAL EXPLORATION ---
128
- This is iteration 1. Explore:
129
- 1. Codebase structure (Glob for key files)
130
- 2. Existing patterns and conventions
131
- 3. Dependencies and tech stack
132
- 4. Any existing tests or docs
133
- {end if}
242
+ --- MISSION ---
243
+ Investigate ONLY these specific knowledge gaps. Do not explore broadly.
134
244
 
135
- --- TOOLS ---
136
- Use: Glob, Grep, Read, WebSearch, WebFetch
137
- Do NOT use: Task, Write, Edit
245
+ Goal: "{goal}"
246
+ Iteration: {iteration}/4
138
247
 
139
- --- OUTPUT FORMAT ---
140
- Return JSON:
141
- {
142
- "findings": [
143
- {"area": "...", "discovery": "...", "confidence": 0-100}
144
- ],
145
- "gaps_remaining": [
146
- {"id": "gap_N", "description": "..."}
147
- ],
148
- "gaps_resolved": ["gap_1", "gap_2"],
149
- "overall_knowledge_confidence": 0-100
150
- }
151
- """
248
+ --- GAPS TO INVESTIGATE ---
249
+ {for each gap in gaps:}
250
+ - {gap.id}: {gap.description}
251
+ {end for}
252
+
253
+ --- TOOLS ---
254
+ Use: Glob, Grep, Read, WebSearch, WebFetch
255
+ Do NOT use: Task, Write, Edit
152
256
 
153
- Parse research results. Update gaps list.
257
+ --- OUTPUT CONSTRAINTS ---
258
+ Maximum 3 findings (one per gap investigated).
259
+ Maximum 2 sentences per finding.
260
+ Only report gaps that are STILL unresolved after your research.
154
261
 
155
- Log: `bash .aether/aether-utils.sh activity-log "RESEARCH" "scout" "Iteration {iteration}: {summary}"`
262
+ --- OUTPUT FORMAT ---
263
+ Return JSON:
264
+ {
265
+ "findings": [
266
+ {"area": "...", "discovery": "...", "source": "file or search"}
267
+ ],
268
+ "gaps_remaining": [
269
+ {"id": "gap_N", "description": "..."}
270
+ ],
271
+ "gaps_resolved": ["gap_1", "gap_2"],
272
+ "overall_knowledge_confidence": 0-100
273
+ }
274
+ """
156
275
 
157
- # === PLANNING PHASE ===
276
+ # Wait for scout to complete.
277
+ # Update gaps list from scout results.
158
278
 
159
- Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="general":
279
+ Log: `bash .aether/aether-utils.sh activity-log "RESEARCH" "scout" "Iteration {iteration}: {scout.findings.length} findings, {scout.gaps_remaining.length} gaps"`
280
+
281
+ # === PLANNING PHASE (always runs — 1 planner per iteration) ===
282
+
283
+ Spawn Planning Ant (Route-Setter) via Task tool with subagent_type="general-purpose":
284
+ # NOTE: Claude Code uses aether-route-setter; OpenCode uses general-purpose with role injection
160
285
 
161
286
  """
162
287
  You are a Route-Setter Ant in the Aether Colony.
@@ -165,7 +290,7 @@ while iteration < 50 AND confidence < 95:
165
290
  Create or refine a project plan based on research findings.
166
291
 
167
292
  Goal: "{goal}"
168
- Iteration: {iteration}/50
293
+ Iteration: {iteration}/4
169
294
 
170
295
  --- PLANNING DISCIPLINE ---
171
296
  Read .aether/planning.md for full reference.
@@ -202,7 +327,10 @@ while iteration < 50 AND confidence < 95:
202
327
  This enables TRUE EMERGENCE - different approaches based on context.
203
328
 
204
329
  --- RESEARCH FINDINGS ---
205
- {research_results.findings formatted}
330
+ {scout.findings formatted — compact, max 5 items}
331
+
332
+ Remaining Gaps:
333
+ {gaps formatted — compact, max 3 items}
206
334
 
207
335
  --- CURRENT PLAN DRAFT ---
208
336
  {if plan_draft:}
@@ -211,18 +339,19 @@ while iteration < 50 AND confidence < 95:
211
339
  No plan yet. Create initial draft.
212
340
  {end if}
213
341
 
214
- --- REMAINING GAPS ---
215
- {gaps_remaining}
216
-
217
342
  --- INSTRUCTIONS ---
218
343
  1. If no plan exists, create 3-6 phases with concrete tasks
219
- 2. Each task must have: exact file paths, steps, expected outputs
220
- 3. If plan exists, refine based on NEW information only
221
- 4. Rate confidence across 5 dimensions
222
- 5. Explain what changed from last iteration
344
+ 2. If plan exists, refine based on NEW information only
345
+ 3. Rate confidence across 5 dimensions
346
+ 4. Keep response concise no verbose explanations
223
347
 
224
348
  Do NOT assign castes to tasks - describe the work only.
225
349
 
350
+ --- OUTPUT CONSTRAINTS ---
351
+ Maximum 6 phases. Maximum 4 tasks per phase.
352
+ Maximum 2 sentence description per task.
353
+ Confidence dimensions as single numbers, not paragraphs.
354
+
226
355
  --- OUTPUT FORMAT ---
227
356
  Return JSON:
228
357
  {
@@ -254,7 +383,7 @@ while iteration < 50 AND confidence < 95:
254
383
  "effort": 0-100,
255
384
  "overall": 0-100
256
385
  },
257
- "delta_reasoning": "What NEW information changed the plan",
386
+ "delta_reasoning": "One sentence: what changed from last iteration",
258
387
  "unresolved_gaps": ["...", "..."]
259
388
  }
260
389
  """
@@ -268,64 +397,33 @@ while iteration < 50 AND confidence < 95:
268
397
  Update `.aether/data/watch-status.txt` with current state.
269
398
  Update `.aether/data/watch-progress.txt` with progress bar.
270
399
 
271
- # === ANTI-STUCK CHECKS ===
400
+ # === STALL TRACKING ===
272
401
 
273
- # Check 1: Gap stuck detection
274
- for each gap in gaps:
275
- if gap was in previous iteration's gaps:
276
- stuck_counts[gap.id] += 1
277
- if stuck_counts[gap.id] >= 3:
278
- mark gap as "needs_human_input"
279
- remove from active gaps
280
-
281
- # Check 2: Stall detection
282
402
  delta = confidence - last_confidence
283
403
  if delta < 5:
284
404
  stall_count += 1
285
405
  else:
286
406
  stall_count = 0
287
407
 
288
- if stall_count >= 3 AND iteration > 5:
289
- # Stalled - ask user
290
- Display current plan and confidence
291
- Ask: "Planning has stalled at {confidence}%. Options:"
292
- 1. Continue iterating (may not improve)
293
- 2. Accept current plan
294
- 3. Provide guidance on: {gaps marked needs_human_input}
295
-
296
- if user chooses "accept" OR force_accept:
297
- break loop
298
- if user provides guidance:
299
- add guidance to gaps as FOCUS constraint
300
- reset stall_count
301
-
302
- # Check 3: Diminishing returns
303
- if delta < 2 AND iteration > 10:
304
- Display: "Approaching local maximum at {confidence}%."
305
- Ask: "Continue or accept current plan?"
306
- if user accepts:
307
- break loop
308
-
309
408
  last_confidence = confidence
310
409
  ```
311
410
 
312
- **After loop exits:**
411
+ **After loop exits (auto-finalize, no user prompt needed):**
313
412
 
314
- If `iteration == 50` and `confidence < 95`:
315
413
  ```
316
- Planning reached maximum iterations.
414
+ Planning complete after {iteration} iteration(s).
317
415
 
318
- Current confidence: {confidence}%
319
- Unresolved gaps:
320
- {list gaps marked needs_human_input}
321
-
322
- Recommendation: {proceed if confidence > 70, else get human input}
416
+ Confidence: {confidence}%
417
+ {if gaps remain:}
418
+ Note: {gaps.length} knowledge gap(s) deferred — these can be resolved during builds.
419
+ {end if}
323
420
  ```
324
- Ask user to accept or provide input.
421
+
422
+ Proceed directly to Step 5. No user confirmation needed — the plan auto-finalizes.
325
423
 
326
424
  ### Step 5: Finalize Plan
327
425
 
328
- Once plan is accepted (confidence >= 95 OR user approved):
426
+ Once loop exits (confidence >= 80, max iterations reached, or stall detected):
329
427
 
330
428
  Read current COLONY_STATE.json, then update:
331
429
  - Set `plan.phases` to the final phases array
@@ -351,6 +449,12 @@ Ready to build.
351
449
 
352
450
  ### Step 6: Display Plan
353
451
 
452
+ **If visual_mode is true, render final swarm display:**
453
+ ```bash
454
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Plan generated" "Colony" '{"read":8,"grep":4,"edit":2,"bash":1}' 100 "fungus_garden" 100
455
+ bash .aether/aether-utils.sh swarm-display-render "$plan_id"
456
+ ```
457
+
354
458
  Read `plan.phases` from COLONY_STATE.json and display:
355
459
 
356
460
  ```
@@ -406,18 +510,22 @@ Each dimension rated 0-100%:
406
510
 
407
511
  **Overall** = weighted average (knowledge 25%, requirements 25%, risks 20%, dependencies 15%, effort 15%)
408
512
 
409
- **Target: 95%** - High confidence plan ready for autonomous execution.
513
+ **Target: 80%** - Sufficient confidence for autonomous execution. Higher confidence is achieved during builds as gaps are resolved.
410
514
 
411
515
  ---
412
516
 
413
- ## Anti-Stuck Safeguards
517
+ ## Auto-Termination Safeguards
518
+
519
+ The planning loop terminates automatically without requiring user input:
520
+
521
+ 1. **Confidence Threshold**: Loop exits when overall confidence reaches 80%
414
522
 
415
- 1. **Gap Tracking**: Each gap has a `stuck_count`. After 3 iterations without progress, marked "needs human input"
523
+ 2. **Hard Iteration Cap**: Maximum 4 iterations (8 subagents total: 1 scout + 1 planner per iteration)
416
524
 
417
- 2. **Stall Detection**: If confidence improves < 5% for 3 consecutive iterations after iteration 5, pause for user decision
525
+ 3. **Stall Detection**: If confidence improves < 5% for 2 consecutive iterations, auto-finalize current plan
418
526
 
419
- 3. **Diminishing Returns**: If confidence improves < 2% after iteration 10, offer to accept current plan
527
+ 4. **Single Scout Research**: One researcher per iteration (broad on iteration 1, gap-focused on 2+) no parallel Alpha/Beta or synthesis agent
420
528
 
421
- 4. **Focused Research**: Research Ant receives SPECIFIC gaps, not open-ended exploration (after iteration 1)
529
+ 5. **Compressed Output**: Subagents limited to 5 findings max, 2-sentence summaries, compact JSON
422
530
 
423
- 5. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence
531
+ 6. **Escape Hatch**: `/ant:plan --accept` accepts current plan regardless of confidence
@@ -7,11 +7,17 @@ You are the **Queen**. Add an AVOID constraint.
7
7
 
8
8
  ## Instructions
9
9
 
10
- The pattern to avoid is: `$ARGUMENTS`
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ The pattern to avoid is: `$normalized_args`
11
17
 
12
18
  ### Step 1: Validate
13
19
 
14
- If `$ARGUMENTS` empty -> show usage: `/ant:redirect <pattern to avoid>`, stop.
20
+ If `$normalized_args` empty -> show usage: `/ant:redirect <pattern to avoid>`, stop.
15
21
  If content > 500 chars -> "Redirect content too long (max 500 chars)", stop.
16
22
 
17
23
  ### Step 2: Read + Update Constraints
@@ -7,27 +7,45 @@ 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
+ ### Step -1: Normalize Arguments
11
11
 
12
- Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
13
 
14
- If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
15
 
16
- ### Step 1: Read State Files
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
17
19
 
18
- Use the Read tool to read these files (in parallel):
19
- - `.aether/HANDOFF.md`
20
- - `.aether/data/COLONY_STATE.json`
20
+ ### Step 0: Initialize Visual Mode (if enabled)
21
21
 
22
- If `COLONY_STATE.json` has `goal: null`, output:
22
+ If `visual_mode` is true:
23
+ ```bash
24
+ # Generate session ID
25
+ resume_id="resume-$(date +%s)"
23
26
 
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$resume_id"
29
+ 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
30
  ```
25
- No colony state found. Either:
26
- /ant:init "<goal>" Start a new colony
27
- Check .aether/HANDOFF.md for manual recovery
28
- ```
29
31
 
30
- Stop here.
32
+ ### Step 0.5: Version Check (Non-blocking)
33
+
34
+ Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
35
+
36
+ If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
37
+
38
+ ### Step 1: Load State and Validate
39
+
40
+ Run using Bash tool: `bash .aether/aether-utils.sh load-state`
41
+
42
+ If successful:
43
+ 1. Parse state from result
44
+ 2. If goal is null: Show "No colony state found..." message and stop
45
+ 3. Check if paused flag is true - if not, note "Colony was not paused, but resuming anyway"
46
+ 4. Extract all state fields for display
47
+
48
+ Keep state loaded (don't unload yet) - we'll need it for the full display.
31
49
 
32
50
  ### Step 2: Compute Active Signals
33
51
 
@@ -51,7 +69,7 @@ Output header:
51
69
  ═══════════════════════════════════════════════════ 🚦➡️🐜💨💨
52
70
  ```
53
71
 
54
- Read the HANDOFF.md for context about what was happening, then display:
72
+ Read the .aether/HANDOFF.md for context about what was happening, then display:
55
73
 
56
74
  ```
57
75
  +=====================================================+
@@ -71,33 +89,40 @@ ACTIVE PHEROMONES
71
89
 
72
90
  If no active signals: (no active pheromones)
73
91
 
74
- WORKERS
75
-
76
- If ALL workers have "idle" status, display:
77
- All 6 workers idle -- colony ready
78
-
79
- Otherwise, group by status with caste name:
80
- Active:
81
- builder: currently executing
82
- Idle:
83
- colonizer route-setter watcher scout architect
84
-
85
92
  PHASE PROGRESS
86
93
  Phase <id>: <name> [<status>]
87
94
  (list all phases from plan.phases)
88
95
 
89
96
  CONTEXT FROM HANDOFF
90
- <summarize what was happening from HANDOFF.md>
97
+ <summarize what was happening from .aether/HANDOFF.md>
91
98
 
92
99
  NEXT ACTIONS
93
100
  ```
94
101
 
102
+ **If visual_mode is true, render final swarm display:**
103
+ ```bash
104
+ 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
105
+ bash .aether/aether-utils.sh swarm-display-render "$resume_id"
106
+ ```
107
+
95
108
  Route to next action based on state:
96
109
  - If state is `READY` and there's a pending phase -> suggest `/ant:build <phase>`
97
110
  - If state is `EXECUTING` -> note that a build was interrupted, suggest restarting with `/ant:build <phase>`
98
111
  - If state is `PLANNING` -> note that planning was interrupted, suggest `/ant:plan`
99
112
  - Otherwise -> suggest `/ant:status` for full overview
100
113
 
114
+ ### Step 6: Clear Paused State and Cleanup
115
+
116
+ Use Write tool to update COLONY_STATE.json:
117
+ - Remove or set to false: `"paused": false`
118
+ - Remove: `"paused_at"` field
119
+ - Update last_updated timestamp
120
+ - Add event: `{timestamp, type: "colony_resumed", worker: "resume", details: "Session resumed"}`
121
+
122
+ Use Bash tool to remove HANDOFF.md: `rm -f .aether/HANDOFF.md`
123
+
124
+ Run: `bash .aether/aether-utils.sh unload-state` to release lock.
125
+
101
126
  ---
102
127
 
103
128
  ## Auto-Recovery Pattern Reference