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
@@ -9,7 +9,23 @@ You are the **Queen Ant Colony**. Initialize the colony with the Queen's intenti
9
9
 
10
10
  The user's goal is: `$ARGUMENTS`
11
11
 
12
- ### Step 0: Version Check (Non-blocking)
12
+ Parse `$ARGUMENTS`:
13
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
14
+ - Otherwise: set `visual_mode = true`
15
+
16
+ ### Step 0: Initialize Visual Mode (if enabled)
17
+
18
+ If `visual_mode` is true:
19
+ ```bash
20
+ # Generate session ID
21
+ init_id="init-$(date +%s)"
22
+
23
+ # Initialize swarm display
24
+ bash .aether/aether-utils.sh swarm-display-init "$init_id"
25
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Colony initialization" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
26
+ ```
27
+
28
+ ### Step 0.5: Version Check (Non-blocking)
13
29
 
14
30
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
15
31
 
@@ -58,20 +74,53 @@ Check if `.aether/aether-utils.sh` exists using the Read tool.
58
74
  ```
59
75
  Stop here. Do not proceed.
60
76
 
61
- ### Step 2: Read Current State
77
+ ### Step 1.6: Initialize QUEEN.md Wisdom Document
78
+
79
+ After bootstrap completes (or if system files already existed), run using the Bash tool:
80
+ ```
81
+ bash .aether/aether-utils.sh queen-init
82
+ ```
83
+
84
+ Parse the JSON result:
85
+ - If `created` is true: Display `QUEEN.md initialized`
86
+ - If `created` is false and `reason` is "already_exists": Display `QUEEN.md already exists`
87
+
88
+ This step is non-blocking — proceed regardless of outcome.
89
+
90
+ ### Step 2: Read Current State with Freshness Check
91
+
92
+ Capture session start time:
93
+ ```bash
94
+ INIT_START=$(date +%s)
95
+ ```
62
96
 
63
97
  Use the Read tool to read `.aether/data/COLONY_STATE.json`.
64
98
 
65
- If the `goal` field is not null, output:
99
+ Check freshness of existing state:
100
+ ```bash
101
+ fresh_check=$(bash .aether/aether-utils.sh session-verify-fresh --command init "" "$INIT_START")
102
+ is_stale=$(echo "$fresh_check" | jq -r '.stale | length')
103
+ freshness_status=$([[ "$is_stale" -gt 0 ]] && echo "stale" || echo "fresh")
104
+ ```
105
+
106
+ If the `goal` field is not null:
107
+ - If state is stale (old session): Warn user but proceed
108
+ - If state is fresh (active session): Strongly recommend continuation
66
109
 
67
110
  ```
68
111
  Colony already initialized with goal: "{existing_goal}"
69
112
 
113
+ State freshness: {freshness_status}
114
+ Session: {session_id}
115
+ Initialized: {initialized_at}
116
+
70
117
  To reinitialize with a new goal, the current state will be reset.
71
118
  Proceeding with new goal: "{new_goal}"
72
119
  ```
73
120
 
74
- ### Step 2.5: Load Prior Colony Knowledge (Optional)
121
+ **Note:** Init never auto-clears COLONY_STATE.json. Reinitialization is an explicit user choice.
122
+
123
+ ### Step 2.6: Load Prior Colony Knowledge (Optional)
75
124
 
76
125
  Check if `.aether/data/completion-report.md` exists using the Read tool.
77
126
 
@@ -81,7 +130,7 @@ Check if `.aether/data/completion-report.md` exists using the Read tool.
81
130
  1. **Instincts** — look for the `## Colony Instincts` section. Each line has format: `N. [confidence] domain: description`. Keep only instincts with confidence >= 0.5.
82
131
  2. **Learnings** — look for the `## Colony Learnings (Validated)` section. Keep all numbered items.
83
132
 
84
- Store the extracted instincts and learnings for use in Step 3. Display a brief note:
133
+ Store the extracted instincts and learnings for use in Step 3 (Write Colony State). Display a brief note:
85
134
 
86
135
  ```
87
136
  🧠 Prior colony knowledge found:
@@ -102,7 +151,7 @@ Generate a session ID in the format `session_{unix_timestamp}_{random}` and an I
102
151
 
103
152
  Use the Write tool to write `.aether/data/COLONY_STATE.json` with the v3.0 structure.
104
153
 
105
- **If Step 2.5 found instincts to inherit**, convert each into the instinct format and seed the `memory.instincts` array. Each inherited instinct should have:
154
+ **If Step 2.6 found instincts to inherit**, convert each into the instinct format and seed the `memory.instincts` array. Each inherited instinct should have:
106
155
  - `id`: `instinct_inherited_{index}`
107
156
  - `trigger`: inferred from the instinct description
108
157
  - `action`: the instinct description
@@ -115,13 +164,13 @@ Use the Write tool to write `.aether/data/COLONY_STATE.json` with the v3.0 struc
115
164
  - `applications`: 0
116
165
  - `successes`: 0
117
166
 
118
- **If Step 2.5 found validated learnings**, seed `memory.phase_learnings` with each as:
167
+ **If Step 2.6 found validated learnings**, seed `memory.phase_learnings` with each as:
119
168
  - `phase`: `"inherited"`
120
169
  - `learning`: the learning text
121
170
  - `status`: `"validated"`
122
171
  - `source`: `"inherited:completion-report"`
123
172
 
124
- **If Step 2.5 was skipped or found nothing**, use empty arrays as before.
173
+ **If Step 2.6 was skipped or found nothing**, use empty arrays as before.
125
174
 
126
175
  ```json
127
176
  {
@@ -166,7 +215,16 @@ Write `.aether/data/constraints.json`:
166
215
  }
167
216
  ```
168
217
 
169
- ### Step 5: Validate State File
218
+ ### Step 5: Initialize Context Document
219
+
220
+ Run using Bash tool:
221
+ ```
222
+ bash .aether/aether-utils.sh context-update init "$ARGUMENTS"
223
+ ```
224
+
225
+ This creates `.aether/CONTEXT.md` — the colony's persistent memory. If context collapses, this file tells the next session what we were doing.
226
+
227
+ ### Step 6: Validate State File
170
228
 
171
229
  Use the Bash tool to run:
172
230
  ```
@@ -175,7 +233,7 @@ bash .aether/aether-utils.sh validate-state colony
175
233
 
176
234
  This validates COLONY_STATE.json structure. If validation fails, output a warning.
177
235
 
178
- ### Step 5.5: Detect Nestmates
236
+ ### Step 6.5: Detect Nestmates
179
237
 
180
238
  Run using Bash tool: `node -e "const nl = require('./bin/lib/nestmate-loader'); console.log(JSON.stringify(nl.findNestmates(process.cwd())))"`
181
239
 
@@ -184,7 +242,7 @@ If nestmates are found:
184
242
  2. List each nestmate with name and truncated goal
185
243
  3. Check for shared TO-DOs or cross-project dependencies
186
244
 
187
- ### Step 5.6: Register Repo (Silent)
245
+ ### Step 6.6: Register Repo (Silent)
188
246
 
189
247
  Attempt to register this repo in the global hub. Both steps are silent on failure — registry is not required for the colony to work.
190
248
 
@@ -200,7 +258,13 @@ cp ~/.aether/version.json .aether/version.json 2>/dev/null || true
200
258
 
201
259
  If either command fails, proceed silently. These are optional bookkeeping.
202
260
 
203
- ### Step 6: Display Result
261
+ ### Step 7: Display Result
262
+
263
+ **If visual_mode is true, render final swarm display:**
264
+ ```bash
265
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Colony initialized" "Colony" '{"read":5,"grep":2,"edit":3,"bash":2}' 100 "fungus_garden" 100
266
+ bash .aether/aether-utils.sh swarm-display-render "$init_id"
267
+ ```
204
268
 
205
269
  Output this header:
206
270
 
@@ -220,7 +284,7 @@ Then output the result:
220
284
  🏠 Colony Status: READY
221
285
  📋 Session: <session_id>
222
286
 
223
- {If instincts or learnings were inherited from Step 2.5:}
287
+ {If instincts or learnings were inherited from Step 2.6:}
224
288
  🧠 Inherited from prior colony:
225
289
  {N} instinct(s) | {N} learning(s)
226
290
  {End if}
@@ -238,4 +302,14 @@ Then output the result:
238
302
  /ant:watch 👁️ Set up live visibility
239
303
 
240
304
  💾 State persisted — safe to /clear, then run /ant:plan
305
+
306
+ 📋 Context document created at `.aether/CONTEXT.md` — read this if session resets
307
+ ```
308
+
309
+ ### Step 8: Initialize Session
310
+
311
+ Initialize session tracking to enable `/ant:resume` after context clear:
312
+
313
+ ```bash
314
+ bash .aether/aether-utils.sh session-init "$(jq -r '.session_id' .aether/data/COLONY_STATE.json)" "$ARGUMENTS"
241
315
  ```
@@ -7,6 +7,22 @@ You are the **Queen**. Begin a new colony, preserving pheromones.
7
7
 
8
8
  ## Instructions
9
9
 
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true:
17
+ ```bash
18
+ # Generate session ID
19
+ layeggs_id="layeggs-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$layeggs_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Laying first eggs" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "nursery" 0
24
+ ```
25
+
10
26
  ### Step 1: Validate Input
11
27
 
12
28
  - If `$ARGUMENTS` is empty:
@@ -26,13 +42,31 @@ You are the **Queen**. Begin a new colony, preserving pheromones.
26
42
  - Read `.aether/data/COLONY_STATE.json`
27
43
  - If goal is not null AND phases exist with status != "completed":
28
44
  ```
29
- Active colony exists: {goal}
30
-
31
- To start a new colony, you must first:
32
- 1. Complete all phases, then /ant:entomb to archive
33
- 2. Or manually reset by deleting .aether/data/COLONY_STATE.json
45
+ 🚫 Cannot lay eggs — active colony has unsaved pheromones
34
46
 
47
+ Active colony: {goal}
35
48
  Current: Phase {current_phase}, {phases_count} phases in plan
49
+
50
+ ┌─────────────────────────────────────────────────────────┐
51
+ │ COLONY LIFECYCLE │
52
+ ├─────────────────────────────────────────────────────────┤
53
+ │ │
54
+ │ 🟢 ACTIVE COLONY → 🏺 SEAL/ENTOMB → 🥚 LAY EGGS │
55
+ │ (working) (preserve memory) (new goal) │
56
+ │ │
57
+ └─────────────────────────────────────────────────────────┘
58
+
59
+ Why this matters:
60
+ Your active colony contains preserved learnings, decisions, and
61
+ instincts (pheromones) from prior work. These must be sealed
62
+ before starting a new project, or they will be lost forever.
63
+
64
+ To start a new colony:
65
+ 1. Complete work → run `/ant:seal` or `/ant:entomb` to archive
66
+ 2. Then run `/ant:lay-eggs "new goal"` to begin fresh
67
+
68
+ Emergency reset (loses all pheromones):
69
+ rm .aether/data/COLONY_STATE.json
36
70
  ```
37
71
  Stop here.
38
72
 
@@ -86,6 +120,12 @@ Write `.aether/data/constraints.json`:
86
120
 
87
121
  ### Step 6: Display Result
88
122
 
123
+ **If visual_mode is true, render final swarm display:**
124
+ ```bash
125
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "First eggs laid" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "nursery" 100
126
+ bash .aether/aether-utils.sh swarm-display-render "$layeggs_id"
127
+ ```
128
+
89
129
  ```
90
130
  🥚 ═══════════════════════════════════════════════════
91
131
  F I R S T E G G S L A I D
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ant:oracle
3
- description: "🔮🐜🧠🐜🔮 Oracle Ant - deep research agent using RALF iterative loop pattern"
3
+ description: "🔮🐜🧠🐜🔮🐜 Oracle Ant - deep research agent using RALF iterative loop pattern"
4
4
  ---
5
5
 
6
6
  You are the **Oracle Ant** command handler. You configure and launch a deep research loop that runs autonomously in a separate process.
@@ -17,9 +17,36 @@ Oracle NEVER touches COLONY_STATE.json, constraints.json, activity.log, or any c
17
17
 
18
18
  Parse `$ARGUMENTS` to determine the action:
19
19
 
20
- 1. **If `$ARGUMENTS` is exactly `stop`** — go to **Step 0b: Stop Oracle**
21
- 2. **If `$ARGUMENTS` is exactly `status`** go to **Step 0c: Show Status**
22
- 3. **Otherwise** go to **Step 1: Research Wizard**
20
+ 1. Check for flags:
21
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
22
+ - If contains `--force` or `--force-research`: set `force_research = true`
23
+ - Otherwise: set `visual_mode = true`, `force_research = false`
24
+ - Remove flags from arguments before routing
25
+
26
+ 2. **If remaining arguments is exactly `stop`** — go to **Step 0b: Stop Oracle**
27
+ 3. **If remaining arguments is exactly `status`** — go to **Step 0c: Show Status**
28
+ 4. **Otherwise** — go to **Step 0.5: Initialize Visual Mode** then **Step 1: Research Wizard**
29
+
30
+ ### Step 0.5: Initialize Visual Mode (if enabled)
31
+
32
+ If `visual_mode` is true:
33
+ ```bash
34
+ # Generate session ID
35
+ oracle_id="oracle-$(date +%s)"
36
+
37
+ # Initialize swarm display
38
+ bash .aether/aether-utils.sh swarm-display-init "$oracle_id"
39
+ bash .aether/aether-utils.sh swarm-display-update "Oracle" "oracle" "researching" "Deep research in progress" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
40
+ ```
41
+
42
+ Display visual header:
43
+ ```
44
+ 🔮🐜🧠🐜🔮 ═══════════════════════════════════════════════
45
+ O R A C L E — R e s e a r c h M o d e
46
+ ═══════════════════════════════════════════════ 🔮🐜🧠🐜🔮
47
+
48
+ Oracle peering into the depths...
49
+ ```
23
50
 
24
51
  ---
25
52
 
@@ -34,7 +61,7 @@ mkdir -p .aether/oracle && touch .aether/oracle/.stop
34
61
  Output:
35
62
 
36
63
  ```
37
- 🔮 Oracle Stop Signal Sent
64
+ 🔮🐜 Oracle Stop Signal Sent
38
65
 
39
66
  Created .aether/oracle/.stop
40
67
  The research loop will halt at the end of the current iteration.
@@ -53,7 +80,7 @@ Check if `.aether/oracle/progress.md` exists using the Read tool.
53
80
  **If it does NOT exist**, output:
54
81
 
55
82
  ```
56
- 🔮 Oracle Status: No Research In Progress
83
+ 🔮🐜 Oracle Status: No Research In Progress
57
84
 
58
85
  No progress.md found. Start a research session:
59
86
  /ant:oracle
@@ -68,7 +95,7 @@ Count the number of `## Iteration` headings in progress.md to determine iteratio
68
95
  Output:
69
96
 
70
97
  ```
71
- 🔮 Oracle Status
98
+ 🔮🐜 Oracle Status
72
99
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
73
100
  Topic: {topic from research.json, or "unknown"}
74
101
  Confidence: {target_confidence}%
@@ -165,6 +192,40 @@ After collecting all answers, proceed to Step 2.
165
192
 
166
193
  ---
167
194
 
195
+ ### Step 1.5: Check for Stale Oracle Session
196
+
197
+ Before starting new research, check for existing oracle session files.
198
+
199
+ Capture session start time:
200
+ ```bash
201
+ ORACLE_START=$(date +%s)
202
+ ```
203
+
204
+ Check for stale files:
205
+ ```bash
206
+ stale_check=$(bash .aether/aether-utils.sh session-verify-fresh --command oracle "" "$ORACLE_START")
207
+ has_stale=$(echo "$stale_check" | jq -r '.stale | length')
208
+ has_progress=$(echo "$stale_check" | jq -r '.fresh | length')
209
+
210
+ if [[ "$has_stale" -gt 0 ]] || [[ "$has_progress" -gt 0 ]]; then
211
+ # Found existing oracle session
212
+ if [[ "$force_research" == "true" ]]; then
213
+ bash .aether/aether-utils.sh session-clear --command oracle
214
+ echo "Cleared stale oracle session for fresh research"
215
+ else
216
+ # Existing session found - prompt user
217
+ echo "Found existing oracle session. Options:"
218
+ echo " /ant:oracle status - View current session"
219
+ echo " /ant:oracle --force - Restart with fresh session"
220
+ echo " /ant:oracle stop - Stop current session"
221
+ # Don't proceed - let user decide
222
+ exit 0
223
+ fi
224
+ fi
225
+ ```
226
+
227
+ ---
228
+
168
229
  ### Step 2: Configure Research
169
230
 
170
231
  Create the oracle directory structure:
@@ -229,6 +290,18 @@ Use the Write tool to write `.aether/oracle/progress.md`:
229
290
 
230
291
  ```
231
292
 
293
+ #### Step 2.5: Verify Oracle Files Are Fresh
294
+
295
+ Verify that progress.md and research.json were created successfully:
296
+ ```bash
297
+ verify_result=$(bash .aether/aether-utils.sh session-verify-fresh --command oracle "" "$ORACLE_START")
298
+ fresh_count=$(echo "$verify_result" | jq -r '.fresh | length')
299
+
300
+ if [[ "$fresh_count" -lt 2 ]]; then
301
+ echo "Warning: Oracle files not properly initialized"
302
+ fi
303
+ ```
304
+
232
305
  Proceed to Step 3.
233
306
 
234
307
  ---
@@ -259,13 +332,13 @@ Now launch the loop. Try tmux first, fall back to manual.
259
332
  **Try tmux:**
260
333
 
261
334
  ```bash
262
- tmux new-session -d -s oracle "cd $(pwd) && bash .aether/oracle/oracle.sh; echo ''; echo '🔮 Oracle loop finished. Press any key to close.'; read -n1" 2>/dev/null && echo "TMUX_OK" || echo "TMUX_FAIL"
335
+ tmux new-session -d -s oracle "cd $(pwd) && bash .aether/oracle/oracle.sh; echo ''; echo '🔮🐜 Oracle loop finished. Press any key to close.'; read -n1" 2>/dev/null && echo "TMUX_OK" || echo "TMUX_FAIL"
263
336
  ```
264
337
 
265
338
  **If TMUX_OK:**
266
339
 
267
340
  ```
268
- 🔮 Oracle Launched
341
+ 🔮🐜 Oracle Launched
269
342
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
270
343
 
271
344
  The Oracle is researching in a background tmux session.
@@ -48,7 +48,8 @@ If no active signals after filtering:
48
48
 
49
49
  Read `.aether/workers.md` and extract the `## Architect` section.
50
50
 
51
- Spawn via **Task tool** with `subagent_type="general"`:
51
+ Spawn via **Task tool** with `subagent_type="aether-architect"`:
52
+ # FALLBACK: If "Agent type not found", use general-purpose and inject role: "You are an Architect Ant - synthesizes knowledge and coordinates documentation."
52
53
 
53
54
  ```
54
55
  --- WORKER SPEC ---
@@ -159,7 +160,6 @@ CONSTRAINTS:
159
160
  - Do NOT flag standard framework files (package.json, tsconfig.json, etc.) as orphaned.
160
161
  - Do NOT flag .aether/ internal data files as stale (they are managed by the colony).
161
162
  - Do NOT flag .claude/ command files as stale (they are the colony's brain).
162
- - Do NOT flag .planning/ files as stale (they are project management artifacts).
163
163
  - Aim for a useful report, not an exhaustive one. 5-15 findings is ideal.
164
164
  ```
165
165
 
@@ -7,6 +7,22 @@ You are the **Queen Ant Colony**. Save current state for session handoff.
7
7
 
8
8
  ## Instructions
9
9
 
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true:
17
+ ```bash
18
+ # Generate session ID
19
+ pause_id="pause-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$pause_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Pausing colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
10
26
  ### Step 1: Read State
11
27
 
12
28
  Use the Read tool to read `.aether/data/COLONY_STATE.json`.
@@ -86,74 +102,101 @@ This flag indicates the colony is in a paused state and will be cleared on resum
86
102
 
87
103
  Before displaying the pause confirmation, check if the user has uncommitted work worth preserving.
88
104
 
89
- 1. **Check for uncommitted changes:**
105
+ **1. Check for uncommitted changes:**
90
106
  ```bash
91
107
  git status --porcelain 2>/dev/null
92
108
  ```
93
109
  If the output is empty (nothing to commit) or the command fails (not a git repo), skip this step silently and continue to Step 5.
94
110
 
95
- 2. **Check for double-prompting:**
111
+ **2. Check for double-prompting:**
96
112
  Read `last_commit_suggestion_phase` from COLONY_STATE.json (already loaded in Step 1).
97
113
  If `last_commit_suggestion_phase` equals the current phase, skip this step silently — the user was already prompted at POST-ADVANCE. Continue to Step 5.
98
114
 
99
- 3. **Generate the commit message:**
100
- ```bash
101
- bash .aether/aether-utils.sh generate-commit-message "pause" {current_phase} "{phase_name}"
102
- ```
103
- Parse the returned JSON to extract `message` and `files_changed`.
115
+ **3. Capture AI Description:**
104
116
 
105
- 4. **Check files changed:**
117
+ **As the AI, briefly describe what was in progress when pausing.**
118
+
119
+ Examples:
120
+ - "Mid-implementation of task-based routing, tests passing"
121
+ - "Completed model selection logic, integration tests pending"
122
+ - "Fixed file locking, ready for verification"
123
+
124
+ Store this as `ai_description`. If no clear description emerges, leave empty (will use fallback).
125
+
126
+ **4. Generate Enhanced Commit Message:**
106
127
  ```bash
107
- git diff --stat HEAD 2>/dev/null | tail -5
128
+ bash .aether/aether-utils.sh generate-commit-message "contextual" {current_phase} "{phase_name}" "{ai_description}" {plan_number}
108
129
  ```
109
130
 
110
- 5. **Display the suggestion:**
131
+ Parse the returned JSON to extract `message`, `body`, `files_changed`, `subsystem`, and `scope`.
132
+
133
+ **5. Display the enhanced suggestion:**
111
134
  ```
112
135
  ──────────────────────────────────────────────────
113
136
  Commit Suggestion
114
137
  ──────────────────────────────────────────────────
115
138
 
116
- Message: {generated_message}
117
- Files: {files_changed} files changed
118
- Preview: {first 5 lines of git diff --stat}
139
+ AI Description: {ai_description}
140
+
141
+ Formatted Message:
142
+ {message}
143
+
144
+ Metadata:
145
+ Scope: {scope}
146
+ Files: {files_changed} files changed
119
147
 
120
148
  ──────────────────────────────────────────────────
121
149
  ```
122
150
 
123
- 6. **Use AskUserQuestion:**
151
+ **6. Use AskUserQuestion:**
124
152
  ```
125
153
  Commit your work before pausing?
126
154
 
127
155
  1. Yes, commit with this message
128
- 2. Yes, but let me write the message
156
+ 2. Yes, but let me edit the description
129
157
  3. No, I'll commit later
130
158
  ```
131
159
 
132
- 7. **If option 1 ("Yes, commit with this message"):**
160
+ **7. If option 1 ("Yes, commit with this message"):**
133
161
  ```bash
134
- git add -A && git commit -m "{generated_message}"
162
+ git add -A && git commit -m "{message}" -m "{body}"
135
163
  ```
136
- Display: `Committed: {generated_message} ({files_changed} files)`
164
+ Display: `Committed: {message} ({files_changed} files)`
137
165
 
138
- 8. **If option 2 ("Yes, but let me write the message"):**
139
- Use AskUserQuestion to get the user's custom commit message, then:
140
- ```bash
141
- git add -A && git commit -m "{custom_message}"
142
- ```
143
- Display: `Committed: {custom_message} ({files_changed} files)`
166
+ **8. If option 2 ("Yes, but let me edit"):**
167
+ Prompt for custom description, then regenerate and commit.
144
168
 
145
- 9. **If option 3 ("No, I'll commit later"):**
169
+ **9. If option 3 ("No, I'll commit later"):**
146
170
  Display: `Skipped. Your changes are saved on disk but not committed.`
147
171
 
148
- 10. **Record the suggestion to prevent double-prompting:**
149
- Set `last_commit_suggestion_phase` to `{current_phase}` in COLONY_STATE.json (add the field at the top level if it does not exist).
172
+ **10. Record the suggestion:**
173
+ Set `last_commit_suggestion_phase` to `{current_phase}` in COLONY_STATE.json.
150
174
 
151
- **Error handling:** If any git command fails (not a repo, merge conflict, pre-commit hook rejection), display the error output and continue to Step 5. The commit suggestion is advisory only — it never blocks the pause flow.
175
+ **Error handling:** If any git command fails, display the error and continue to Step 5.
152
176
 
153
177
  Continue to Step 5.
154
178
 
179
+ ### Step 4.8: Update Context Document
180
+
181
+ Log this pause activity to `.aether/CONTEXT.md`:
182
+
183
+ ```bash
184
+ bash .aether/aether-utils.sh context-update activity "pause-colony" "Colony paused — handoff created" "—"
185
+ ```
186
+
187
+ Update safe-to-clear status:
188
+ ```bash
189
+ bash .aether/aether-utils.sh context-update safe-to-clear "YES" "Colony paused — safe to /clear, run /ant:resume-colony to continue"
190
+ ```
191
+
155
192
  ### Step 5: Display Confirmation
156
193
 
194
+ **If visual_mode is true, render final swarm display:**
195
+ ```bash
196
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Colony paused" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "fungus_garden" 100
197
+ bash .aether/aether-utils.sh swarm-display-render "$pause_id"
198
+ ```
199
+
157
200
  Output header:
158
201
 
159
202
  ```
@@ -176,4 +219,19 @@ Then output:
176
219
 
177
220
  To resume in a new session:
178
221
  /ant:resume-colony
222
+
223
+ 💾 State persisted — safe to /clear
224
+
225
+ 📋 Context document updated at `.aether/CONTEXT.md`
226
+
227
+ 🐜 What would you like to do next?
228
+ 1. /ant:resume-colony — Resume work in this session
229
+ 2. /ant:lay-eggs "<new goal>" — Start a new colony
230
+ 3. /clear — Clear context and continue
231
+
232
+ Use AskUserQuestion with these three options.
233
+
234
+ If option 1 selected: proceed to run /ant:resume-colony flow
235
+ If option 2 selected: run /ant:lay-eggs flow
236
+ If option 3 selected: display "Run /ant:resume-colony when ready to continue, or /ant:lay-eggs to start fresh"
179
237
  ```
@@ -89,3 +89,29 @@ Legend: [✓] completed [~] in progress [ ] pending
89
89
 
90
90
  🐜 /ant:phase <id> for details
91
91
  ```
92
+
93
+ ### Step 4: Update Handoff (Optional)
94
+
95
+ After displaying phase details, offer to update the handoff document with review notes:
96
+
97
+ Use AskUserQuestion:
98
+ ```
99
+ Update handoff with phase review notes?
100
+
101
+ 1. Yes — add notes about blockers or decisions
102
+ 2. No — continue without updating
103
+ ```
104
+
105
+ If option 1 selected:
106
+ Use AskUserQuestion to collect notes, then append to handoff:
107
+
108
+ ```bash
109
+ cat >> .aether/HANDOFF.md << 'HANDOFF_EOF'
110
+
111
+ ## Phase {id} Review Notes
112
+ - Reviewed: $(date -u +%Y-%m-%dT%H:%M:%SZ)
113
+ - Notes: {user_notes}
114
+ HANDOFF_EOF
115
+ ```
116
+
117
+ Display: `Handoff updated with review notes.`