aether-colony 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/.aether/aether-utils.sh +157 -42
  2. package/.aether/agents/aether-ambassador.md +140 -0
  3. package/.aether/agents/aether-archaeologist.md +108 -0
  4. package/.aether/agents/aether-architect.md +133 -0
  5. package/.aether/agents/aether-auditor.md +144 -0
  6. package/.aether/agents/aether-builder.md +184 -0
  7. package/.aether/agents/aether-chaos.md +115 -0
  8. package/.aether/agents/aether-chronicler.md +122 -0
  9. package/.aether/agents/aether-gatekeeper.md +116 -0
  10. package/.aether/agents/aether-includer.md +117 -0
  11. package/.aether/agents/aether-keeper.md +177 -0
  12. package/.aether/agents/aether-measurer.md +128 -0
  13. package/.aether/agents/aether-oracle.md +137 -0
  14. package/.aether/agents/aether-probe.md +133 -0
  15. package/.aether/agents/aether-queen.md +286 -0
  16. package/.aether/agents/aether-route-setter.md +130 -0
  17. package/.aether/agents/aether-sage.md +106 -0
  18. package/.aether/agents/aether-scout.md +101 -0
  19. package/.aether/agents/aether-surveyor-disciplines.md +391 -0
  20. package/.aether/agents/aether-surveyor-nest.md +329 -0
  21. package/.aether/agents/aether-surveyor-pathogens.md +264 -0
  22. package/.aether/agents/aether-surveyor-provisions.md +334 -0
  23. package/.aether/agents/aether-tracker.md +137 -0
  24. package/.aether/agents/aether-watcher.md +174 -0
  25. package/.aether/agents/aether-weaver.md +130 -0
  26. package/.aether/commands/claude/archaeology.md +334 -0
  27. package/.aether/commands/claude/build.md +65 -0
  28. package/.aether/commands/claude/chaos.md +336 -0
  29. package/.aether/commands/claude/colonize.md +259 -0
  30. package/.aether/commands/claude/continue.md +60 -0
  31. package/.aether/commands/claude/council.md +507 -0
  32. package/.aether/commands/claude/data-clean.md +81 -0
  33. package/.aether/commands/claude/dream.md +268 -0
  34. package/.aether/commands/claude/entomb.md +498 -0
  35. package/.aether/commands/claude/export-signals.md +57 -0
  36. package/.aether/commands/claude/feedback.md +96 -0
  37. package/.aether/commands/claude/flag.md +151 -0
  38. package/.aether/commands/claude/flags.md +169 -0
  39. package/.aether/commands/claude/focus.md +76 -0
  40. package/.aether/commands/claude/help.md +154 -0
  41. package/.aether/commands/claude/history.md +140 -0
  42. package/.aether/commands/claude/import-signals.md +71 -0
  43. package/.aether/commands/claude/init.md +505 -0
  44. package/.aether/commands/claude/insert-phase.md +105 -0
  45. package/.aether/commands/claude/interpret.md +278 -0
  46. package/.aether/commands/claude/lay-eggs.md +210 -0
  47. package/.aether/commands/claude/maturity.md +113 -0
  48. package/.aether/commands/claude/memory-details.md +77 -0
  49. package/.aether/commands/claude/migrate-state.md +171 -0
  50. package/.aether/commands/claude/oracle.md +642 -0
  51. package/.aether/commands/claude/organize.md +232 -0
  52. package/.aether/commands/claude/patrol.md +620 -0
  53. package/.aether/commands/claude/pause-colony.md +233 -0
  54. package/.aether/commands/claude/phase.md +115 -0
  55. package/.aether/commands/claude/pheromones.md +156 -0
  56. package/.aether/commands/claude/plan.md +693 -0
  57. package/.aether/commands/claude/preferences.md +65 -0
  58. package/.aether/commands/claude/quick.md +100 -0
  59. package/.aether/commands/claude/redirect.md +76 -0
  60. package/.aether/commands/claude/resume-colony.md +197 -0
  61. package/.aether/commands/claude/resume.md +388 -0
  62. package/.aether/commands/claude/run.md +231 -0
  63. package/.aether/commands/claude/seal.md +774 -0
  64. package/.aether/commands/claude/skill-create.md +286 -0
  65. package/.aether/commands/claude/status.md +410 -0
  66. package/.aether/commands/claude/swarm.md +349 -0
  67. package/.aether/commands/claude/tunnels.md +426 -0
  68. package/.aether/commands/claude/update.md +132 -0
  69. package/.aether/commands/claude/verify-castes.md +143 -0
  70. package/.aether/commands/claude/watch.md +239 -0
  71. package/.aether/commands/colonize.yaml +4 -0
  72. package/.aether/commands/council.yaml +205 -0
  73. package/.aether/commands/init.yaml +46 -13
  74. package/.aether/commands/insert-phase.yaml +4 -0
  75. package/.aether/commands/opencode/archaeology.md +331 -0
  76. package/.aether/commands/opencode/build.md +1168 -0
  77. package/.aether/commands/opencode/chaos.md +329 -0
  78. package/.aether/commands/opencode/colonize.md +195 -0
  79. package/.aether/commands/opencode/continue.md +1436 -0
  80. package/.aether/commands/opencode/council.md +437 -0
  81. package/.aether/commands/opencode/data-clean.md +77 -0
  82. package/.aether/commands/opencode/dream.md +260 -0
  83. package/.aether/commands/opencode/entomb.md +377 -0
  84. package/.aether/commands/opencode/export-signals.md +54 -0
  85. package/.aether/commands/opencode/feedback.md +99 -0
  86. package/.aether/commands/opencode/flag.md +149 -0
  87. package/.aether/commands/opencode/flags.md +167 -0
  88. package/.aether/commands/opencode/focus.md +73 -0
  89. package/.aether/commands/opencode/help.md +157 -0
  90. package/.aether/commands/opencode/history.md +136 -0
  91. package/.aether/commands/opencode/import-signals.md +68 -0
  92. package/.aether/commands/opencode/init.md +518 -0
  93. package/.aether/commands/opencode/insert-phase.md +111 -0
  94. package/.aether/commands/opencode/interpret.md +272 -0
  95. package/.aether/commands/opencode/lay-eggs.md +213 -0
  96. package/.aether/commands/opencode/maturity.md +108 -0
  97. package/.aether/commands/opencode/memory-details.md +83 -0
  98. package/.aether/commands/opencode/migrate-state.md +165 -0
  99. package/.aether/commands/opencode/oracle.md +593 -0
  100. package/.aether/commands/opencode/organize.md +226 -0
  101. package/.aether/commands/opencode/patrol.md +626 -0
  102. package/.aether/commands/opencode/pause-colony.md +203 -0
  103. package/.aether/commands/opencode/phase.md +113 -0
  104. package/.aether/commands/opencode/pheromones.md +162 -0
  105. package/.aether/commands/opencode/plan.md +684 -0
  106. package/.aether/commands/opencode/preferences.md +71 -0
  107. package/.aether/commands/opencode/quick.md +91 -0
  108. package/.aether/commands/opencode/redirect.md +84 -0
  109. package/.aether/commands/opencode/resume-colony.md +190 -0
  110. package/.aether/commands/opencode/resume.md +394 -0
  111. package/.aether/commands/opencode/run.md +237 -0
  112. package/.aether/commands/opencode/seal.md +452 -0
  113. package/.aether/commands/opencode/skill-create.md +63 -0
  114. package/.aether/commands/opencode/status.md +307 -0
  115. package/.aether/commands/opencode/swarm.md +15 -0
  116. package/.aether/commands/opencode/tunnels.md +400 -0
  117. package/.aether/commands/opencode/update.md +127 -0
  118. package/.aether/commands/opencode/verify-castes.md +139 -0
  119. package/.aether/commands/opencode/watch.md +227 -0
  120. package/.aether/commands/plan.yaml +53 -2
  121. package/.aether/commands/quick.yaml +104 -0
  122. package/.aether/commands/resume-colony.yaml +6 -4
  123. package/.aether/commands/resume.yaml +9 -0
  124. package/.aether/commands/run.yaml +37 -1
  125. package/.aether/commands/seal.yaml +9 -0
  126. package/.aether/commands/status.yaml +45 -1
  127. package/.aether/docs/command-playbooks/build-full.md +3 -2
  128. package/.aether/docs/command-playbooks/build-prep.md +12 -4
  129. package/.aether/docs/command-playbooks/build-verify.md +51 -0
  130. package/.aether/docs/command-playbooks/continue-advance.md +115 -6
  131. package/.aether/docs/command-playbooks/continue-full.md +1 -0
  132. package/.aether/docs/command-playbooks/continue-verify.md +33 -0
  133. package/.aether/utils/clash-detect.sh +239 -0
  134. package/.aether/utils/council.sh +425 -0
  135. package/.aether/utils/error-handler.sh +3 -3
  136. package/.aether/utils/flag.sh +23 -12
  137. package/.aether/utils/hive.sh +2 -2
  138. package/.aether/utils/hooks/clash-pre-tool-use.js +99 -0
  139. package/.aether/utils/immune.sh +508 -0
  140. package/.aether/utils/learning.sh +2 -2
  141. package/.aether/utils/merge-driver-lockfile.sh +35 -0
  142. package/.aether/utils/midden.sh +712 -0
  143. package/.aether/utils/pheromone.sh +1376 -108
  144. package/.aether/utils/queen.sh +31 -21
  145. package/.aether/utils/session.sh +264 -0
  146. package/.aether/utils/spawn-tree.sh +7 -7
  147. package/.aether/utils/spawn.sh +2 -2
  148. package/.aether/utils/state-api.sh +216 -5
  149. package/.aether/utils/swarm.sh +1 -1
  150. package/.aether/utils/worktree.sh +189 -0
  151. package/.claude/commands/ant/colonize.md +2 -0
  152. package/.claude/commands/ant/council.md +205 -0
  153. package/.claude/commands/ant/init.md +53 -14
  154. package/.claude/commands/ant/insert-phase.md +4 -0
  155. package/.claude/commands/ant/plan.md +27 -1
  156. package/.claude/commands/ant/quick.md +100 -0
  157. package/.claude/commands/ant/resume-colony.md +3 -2
  158. package/.claude/commands/ant/resume.md +9 -0
  159. package/.claude/commands/ant/run.md +37 -1
  160. package/.claude/commands/ant/seal.md +9 -0
  161. package/.claude/commands/ant/status.md +45 -1
  162. package/.opencode/commands/ant/colonize.md +2 -0
  163. package/.opencode/commands/ant/council.md +143 -0
  164. package/.opencode/commands/ant/init.md +53 -13
  165. package/.opencode/commands/ant/insert-phase.md +4 -0
  166. package/.opencode/commands/ant/plan.md +26 -1
  167. package/.opencode/commands/ant/quick.md +91 -0
  168. package/.opencode/commands/ant/resume-colony.md +3 -2
  169. package/.opencode/commands/ant/resume.md +9 -0
  170. package/.opencode/commands/ant/run.md +37 -1
  171. package/.opencode/commands/ant/status.md +2 -0
  172. package/CHANGELOG.md +116 -0
  173. package/README.md +34 -8
  174. package/bin/cli.js +103 -61
  175. package/bin/lib/banner.js +14 -0
  176. package/bin/lib/init.js +8 -7
  177. package/bin/lib/interactive-setup.js +251 -0
  178. package/bin/npx-entry.js +21 -0
  179. package/bin/npx-install.js +9 -167
  180. package/bin/validate-package.sh +23 -0
  181. package/package.json +11 -3
  182. package/.aether/docs/plans/pheromone-display-plan.md +0 -257
  183. package/.aether/schemas/example-prompt-builder.xml +0 -234
  184. package/.aether/scripts/incident-test-add.sh +0 -47
  185. package/.aether/scripts/weekly-audit.sh +0 -79
@@ -0,0 +1,394 @@
1
+ <!-- Generated from .aether/commands/resume.yaml - DO NOT EDIT DIRECTLY -->
2
+ ---
3
+ name: ant:resume
4
+ description: "Resume Previous Session"
5
+ ---
6
+
7
+ ### Step -1: Normalize Arguments
8
+
9
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
10
+
11
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
12
+
13
+ # /ant:resume — Resume Previous Session
14
+
15
+ Resume work after `/clear` or in a new session. Reads colony state, detects codebase drift, and gives you a clear "do this next" recommendation.
16
+
17
+ ## Usage
18
+
19
+ ```bash
20
+ /ant:resume
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Implementation
26
+
27
+ Execute the following steps in order when the user runs `/ant:resume`.
28
+
29
+ ---
30
+
31
+ ### Step 1: Read Session State
32
+
33
+ Run::
34
+ ```bash
35
+ bash .aether/aether-utils.sh session-read
36
+ ```
37
+
38
+ Parse the JSON result.
39
+
40
+ - If `exists` is `false`: display the following and **stop**:
41
+
42
+ ```
43
+
44
+ ═══════════════════════════════════════════════════
45
+ RESUME SESSION
46
+
47
+ No previous session found.
48
+
49
+ Start fresh: /ant:init "your goal"
50
+ Or check: /ant:status
51
+
52
+ ═══════════════════════════════════════════════════
53
+ ```
54
+
55
+ - If `exists` is `true`: extract from the session data:
56
+ - `colony_goal`
57
+ - `current_phase`
58
+ - `last_command`
59
+ - `suggested_next`
60
+ - `baseline_commit`
61
+ - `session_id`
62
+
63
+ ---
64
+
65
+ ### Step 2: Read COLONY_STATE.json (Authoritative Source)
66
+
67
+ Use the Read tool to read `.aether/data/COLONY_STATE.json`.
68
+
69
+ COLONY_STATE.json is the authoritative source for goal and state (session.json may be stale). Extract:
70
+ - `goal` (use this as authoritative, overriding session.json colony_goal)
71
+ - `milestone` (check for sealed colony)
72
+ - `state` (READY, PLANNING, EXECUTING, PAUSED)
73
+ - `current_phase`
74
+ - `plan.phases` (array with id, name, status for each phase)
75
+ - `plan.generated_at`
76
+ - `memory.decisions` (flat list — do NOT distinguish user vs Claude origin)
77
+ - `events` (last 5 for recent activity context)
78
+
79
+ **If `milestone` == `"Crowned Anthill"`:** This colony has been sealed. Display:
80
+ ```
81
+ This colony has been sealed (Crowned Anthill).
82
+
83
+ Start a new colony with /ant:init "new goal"
84
+ ```
85
+ Stop here — do NOT display stale phase data from the sealed colony.
86
+
87
+ If the file is missing or the JSON cannot be parsed, **stop immediately** and display:
88
+
89
+ ```
90
+ State file missing or corrupted.
91
+
92
+ Options:
93
+ 1. Start fresh with /ant:init "goal"
94
+ 2. Try to recover (I'll look for backup files)
95
+
96
+ What would you like to do?
97
+ ```
98
+
99
+ Do NOT proceed with stale or fabricated data.
100
+
101
+ ---
102
+
103
+ ### Step 3: Read Pheromone Signals
104
+
105
+
106
+
107
+ Run::
108
+ ```bash
109
+ bash .aether/aether-utils.sh pheromone-read all
110
+ ```
111
+
112
+ Parse the JSON result. Extract `.result.signals` array.
113
+
114
+ - If `ok` is `true` and `.result.signals` is non-empty: store signals for dashboard rendering in Step 8
115
+ - If `ok` is `true` and `.result.signals` is empty: no active pheromones (skip in dashboard)
116
+ - If the command fails or returns an error: skip silently (no pheromones active)
117
+
118
+ Note: pheromone-read applies decay calculation automatically. The `effective_strength` field reflects current signal strength after time-based decay. Signals below 0.1 effective strength are already filtered out.
119
+
120
+
121
+ ---
122
+
123
+ ### Step 4: Read CONTEXT.md
124
+
125
+ Use the Read tool to read `.aether/CONTEXT.md` if it exists.
126
+
127
+ If missing: fall back to COLONY_STATE.json for narrative context. Note: "Context document not found — reconstructing from state."
128
+
129
+ ---
130
+
131
+ ### Step 5: Drift Detection
132
+
133
+ Extract `baseline_commit` from the session.json data read in Step 1.
134
+
135
+ ```bash
136
+ current_commit=$(git rev-parse HEAD 2>/dev/null || echo "")
137
+ ```
138
+
139
+ If `baseline_commit` is non-empty and differs from `current_commit`:
140
+
141
+ ```bash
142
+ commit_count=$(git rev-list --count "$baseline_commit..HEAD" 2>/dev/null || echo "0")
143
+ changed_count=$(git diff --stat "$baseline_commit" HEAD 2>/dev/null | tail -1 | grep -oE '[0-9]+ file' | grep -oE '[0-9]+' || echo "0")
144
+ ```
145
+
146
+ Store `drift_detected=true`, `commit_count`, `changed_count` for dashboard rendering.
147
+
148
+ If `baseline_commit` is empty or matches `current_commit`: set `drift_detected=false`.
149
+
150
+ Restore identically regardless of time elapsed — no warnings about session age.
151
+
152
+ ---
153
+
154
+ ### Step 6: Compute Workflow Position and Next-Step Guidance
155
+
156
+ Compute `suggested_next` dynamically from COLONY_STATE.json data. Do not use the static value from session.json.
157
+
158
+ Use this decision tree:
159
+
160
+ ```
161
+ Case 1 — No plan created yet:
162
+ Check: plan.phases is empty AND plan.generated_at is null
163
+ recommended = "/ant:plan"
164
+ reason = "No plan created yet"
165
+ alternatives = ["/ant:colonize — analyze codebase first"]
166
+
167
+ Case 2 — Plan ready, first phase not started:
168
+ Check: plan.phases is not empty AND state == "READY" AND current_phase == 0
169
+ recommended = "/ant:build 1"
170
+ reason = "Plan ready, first phase not started"
171
+ alternatives = ["/ant:plan — review or regenerate plan"]
172
+
173
+ Case 3 — Build in progress:
174
+ Check: state == "EXECUTING"
175
+ recommended = "/ant:continue"
176
+ reason = "Build in progress"
177
+ alternatives = ["/ant:build {current_phase} — rebuild current phase", "/ant:flags — check for blockers"]
178
+
179
+ Case 4 — Phase complete, next phase available:
180
+ Check: state == "READY" AND current_phase > 0 AND current_phase < plan.phases.length
181
+ next = current_phase + 1
182
+ recommended = "/ant:build {next}"
183
+ reason = "Phase {current_phase} complete, ready for next"
184
+ alternatives = ["/ant:plan — regenerate plan", "/ant:phase {next} — preview next phase"]
185
+
186
+ Case 5 — All phases complete:
187
+ Check: state == "READY" AND current_phase > 0 AND current_phase >= plan.phases.length
188
+ recommended = "/ant:seal"
189
+ reason = "All phases complete"
190
+ alternatives = ["/ant:status — view final state"]
191
+
192
+ Case 6 — Colony paused:
193
+ Check: state == "PAUSED"
194
+ recommended = "/ant:resume-colony"
195
+ reason = "Colony is paused"
196
+ alternatives = ["/ant:status — check state first"]
197
+
198
+ Default:
199
+ recommended = "/ant:status"
200
+ reason = "Check colony status"
201
+ alternatives = []
202
+ ```
203
+
204
+ ---
205
+
206
+ ### Step 7: Workflow-Step Blocking (Early-Return Guards)
207
+
208
+ Run these guards BEFORE rendering the dashboard. If a blocking condition is detected, output the block message and STOP. Do not render the dashboard. Do not offer alternative commands.
209
+
210
+ **BLOCK CONDITION 1: No plan exists**
211
+
212
+ Check: plan.phases is empty AND plan.generated_at is null
213
+
214
+ Output and STOP:
215
+
216
+ ```
217
+ BLOCKED: No plan exists yet.
218
+ Required: Run /ant:plan to create a build plan.
219
+ Goal: {goal}
220
+ ```
221
+
222
+ Stop here — do not continue to Step 8 or render the dashboard.
223
+
224
+ ---
225
+
226
+ **BLOCK CONDITION 2: Plan attempted but failed**
227
+
228
+ Check: plan.phases is empty AND plan.generated_at is not null
229
+
230
+ Output and STOP:
231
+
232
+ ```
233
+ BLOCKED: Plan was attempted but has no phases.
234
+ Required: Run /ant:plan to regenerate the plan.
235
+ Goal: {goal}
236
+ ```
237
+
238
+ Stop here — do not continue to Step 8 or render the dashboard.
239
+
240
+ ---
241
+
242
+ **BLOCK CONDITION 3: Build interrupted**
243
+
244
+ Check: state == "EXECUTING" AND the last 3 events show no recent build activity
245
+
246
+ Output and STOP:
247
+
248
+ ```
249
+ BLOCKED: Build may have been interrupted.
250
+ Required: Run /ant:continue to check and advance.
251
+ Goal: {goal}
252
+ ```
253
+
254
+ Stop here — do not continue to Step 8 or render the dashboard.
255
+
256
+ ---
257
+
258
+ ### Step 8: Render Dashboard
259
+
260
+ Lead with the next-step recommendation. Context follows underneath ("straight to action" ordering).
261
+
262
+ ```
263
+
264
+ ═══════════════════════════════════════════════════
265
+ RESUME SESSION
266
+
267
+ Next: {recommended}
268
+ {reason}
269
+ {if alternatives exist:}
270
+ Also: {alternatives, comma-separated}
271
+ {end}
272
+
273
+ {if drift_detected:}
274
+ Note: Codebase changed since last session ({commit_count} commit(s), {changed_count} file(s) modified)
275
+ {end}
276
+
277
+ Goal: {goal}
278
+ State: {state}
279
+ Phase: {current_phase}/{total_phases}
280
+
281
+ Phase Progress:
282
+ {for each phase in plan.phases:}
283
+ [{status_icon}] Phase {id}: {name}
284
+ {end}
285
+ ```
286
+
287
+ Status icons:
288
+ - completed: `v` (checkmark)
289
+ - in_progress: `~` (tilde)
290
+ - pending: ` ` (space)
291
+
292
+ ```
293
+ {if memory.decisions is not empty:}
294
+ Recent Decisions:
295
+ {for each of the last 5 decisions:}
296
+ - {decision text}
297
+ {end}
298
+ {end}
299
+
300
+ {if signals array from Step 3 is not empty:}
301
+ Active Signals:
302
+
303
+
304
+ {for each signal in signals:}
305
+ {signal.type}: "{signal.content}" [{signal.effective_strength * 100 | floor}%]
306
+ {end}
307
+
308
+ {end}
309
+ ```
310
+
311
+ ---
312
+
313
+ ### Step 8.5: Display Memory Health (Secondary)
314
+
315
+ Run::
316
+ ```bash
317
+ bash .aether/aether-utils.sh resume-dashboard
318
+ ```
319
+
320
+ Extract memory_health from the JSON result:
321
+ - wisdom_count
322
+ - pending_promotions
323
+ - recent_failures
324
+
325
+ Display after the main dashboard:
326
+ ```
327
+ 📊 Memory Health
328
+ Wisdom: {wisdom_count} entries | Pending: {pending_promotions} promotions | Failures: {recent_failures} recent
329
+
330
+ Run /ant:memory-details for full breakdown
331
+ ```
332
+
333
+ If all counts are 0, show:
334
+ ```
335
+ 📊 Memory Health
336
+ No accumulated wisdom yet. Complete phases to build colony memory.
337
+ ```
338
+
339
+ Last Command: {last_command}
340
+ Session: {session_id}
341
+ ```
342
+
343
+ ---
344
+
345
+ ### Step 9: Mark Session Resumed
346
+
347
+ Run::
348
+ ```bash
349
+ bash .aether/aether-utils.sh session-mark-resumed
350
+ ```
351
+
352
+ ### Step 10: Next Up
353
+
354
+ Generate the state-based Next Up block by Run::
355
+ ```bash
356
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
357
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
358
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
359
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Error Handling Reference
365
+
366
+ | Condition | Response |
367
+ |-----------|----------|
368
+ | session.json missing (exists=false) | "No previous session found" — offer /ant:init and /ant:status |
369
+ | COLONY_STATE.json missing or corrupted | Pause, ask user: start fresh or recover |
370
+
371
+
372
+ | pheromone-read fails | Skip silently (no pheromones) |
373
+
374
+ | CONTEXT.md missing | Fall back to COLONY_STATE.json narrative |
375
+ | No plan phases, no generated_at | BLOCK — redirect to /ant:plan |
376
+ | Plan attempted but no phases | BLOCK — redirect to /ant:plan |
377
+ | State EXECUTING, events show no activity | BLOCK — redirect to /ant:continue |
378
+ | baseline_commit matches current HEAD | No drift warning shown |
379
+ | baseline_commit differs from current HEAD | Show informational drift note |
380
+
381
+ ---
382
+
383
+ ## Key Constraints
384
+
385
+
386
+
387
+ - Use Read tool for COLONY_STATE.json (not bash cat/jq). Use Bash tool for pheromone-read (applies decay calculation).
388
+
389
+ - Use Bash tool only for aether-utils.sh commands and git commands
390
+ - Handle ALL missing/corrupted file cases gracefully
391
+ - Time-agnostic: restore identically regardless of how long ago the session was
392
+ - Decisions shown as flat list — no user vs Claude distinction
393
+ - Blocking guards run BEFORE dashboard rendering (early-return pattern)
394
+ - Drift detection is informational only — not alarming, not a blocker
@@ -0,0 +1,237 @@
1
+ <!-- Generated from .aether/commands/run.yaml - DO NOT EDIT DIRECTLY -->
2
+ ---
3
+ name: ant:run
4
+ description: "🤖🐜🔄🐜🤖 Autopilot — builds, verifies, learns, and advances through phases automatically with smart pausing"
5
+ ---
6
+
7
+ ### Step -1: Normalize Arguments
8
+
9
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
10
+
11
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
12
+
13
+ You are the **Queen**. Execute `/ant:run` — the adaptive autopilot loop.
14
+
15
+ The arguments are: `$normalized_args`
16
+
17
+ ## Purpose
18
+
19
+ This command automates the build-continue-advance cycle across multiple phases.
20
+ It reads and executes the same playbooks used by `/ant:build` and `/ant:continue`,
21
+ chaining them in a loop with intelligent pause conditions.
22
+
23
+ ## Rules
24
+
25
+ 1. Do **not** invoke nested slash commands (`/ant:build`, `/ant:continue`, etc.).
26
+ 2. Use the Read tool to load each playbook file, then execute it inline.
27
+ 3. Preserve variables/results from prior stages and pass them forward.
28
+ 4. Stop immediately on any pause condition (defined below).
29
+ 5. Keep existing behavior and output format from the playbooks.
30
+ 6. Log `autopilot_advance` events after each successful phase transition.
31
+
32
+ ## Arguments
33
+
34
+ Parse `$normalized_args` for:
35
+ - `--max-phases N` — Max phases to process (default: all remaining)
36
+ - `--replan-interval N` — Pause for replan suggestion every N phases (default: 2)
37
+ - `--continue` — Resume after a replan pause without replanning
38
+ - `--dry-run` — Preview plan without executing
39
+ - `--headless` — Run without interactive prompts; queue decisions for later review
40
+ - `--verbose` / `-v`, `--no-visual`, `--no-suggest` — Pass through to playbooks
41
+
42
+ ```
43
+ /ant:run Run all remaining phases
44
+ /ant:run --max-phases 2 Run at most 2 phases then stop
45
+ /ant:run --replan-interval 3 Suggest replan every 3 phases instead of 2
46
+ /ant:run --continue Resume after replan pause without replanning
47
+ /ant:run --dry-run Preview the autopilot plan
48
+ /ant:run --headless Run all phases without interactive prompts
49
+ /ant:run --max-phases 3 -v Run 3 phases with verbose output
50
+ ```
51
+
52
+ ## Dry Run Mode
53
+
54
+ If `--dry-run`: read COLONY_STATE.json, list remaining incomplete phases
55
+ (applying `--max-phases` cap), display the plan, then stop without executing.
56
+
57
+ ```
58
+ ━━━ A U T O P I L O T P R E V I E W ━━━
59
+ Goal: {goal} | Current: Phase {N} | Remaining: {count} | Max: {max or "all"}
60
+
61
+ Phase {id}: {name} ({task_count} tasks) -> build -> continue -> advance
62
+ ...
63
+
64
+ Pause triggers: test failures, critical Chaos findings, new blockers,
65
+ security gate failures, quality gate failures, runtime verification needed,
66
+ replan suggestion (every {replan_interval} phases)
67
+ ```
68
+
69
+ ## Autopilot Loop
70
+
71
+ ### Step 0: Initialize
72
+
73
+ 1. Read `.aether/data/COLONY_STATE.json`; validate goal + plan.phases exist
74
+ - If `milestone` == `"Crowned Anthill"`: output "This colony has been sealed. Start a new colony with `/ant:init \"new goal\"`." and stop
75
+ 2. Determine remaining incomplete phases; apply `--max-phases` cap
76
+ 3. Set `phases_completed = 0`, `autopilot_start = $(date +%s)`
77
+ 4. Record pre-build blocker count: `bash .aether/aether-utils.sh flag-check-blockers {phase}`
78
+ 5. If `--headless` flag is present:
79
+ - Run: `bash .aether/aether-utils.sh autopilot-set-headless true`
80
+ - Display: `Headless mode: ON — interactive prompts will be queued as pending decisions`
81
+ 6. Display: `AUTOPILOT ENGAGED | Goal: {goal} | Phase {N} | Max: {max or "all"}`
82
+
83
+ ### Step 1: Build Phase
84
+
85
+ Execute build playbooks in order, carrying cross-stage state
86
+ (`phase_id`, `visual_mode`, `verbose_mode`, `suggest_enabled`,
87
+ `prompt_section`, `wave_results`,
88
+ `verification_status`, `synthesis_status`, `next_action`):
89
+
90
+ 1. `.aether/docs/command-playbooks/build-prep.md`
91
+ 2. `.aether/docs/command-playbooks/build-context.md`
92
+ 3. `.aether/docs/command-playbooks/build-wave.md`
93
+ 4. `.aether/docs/command-playbooks/build-verify.md`
94
+ 5. `.aether/docs/command-playbooks/build-complete.md`
95
+
96
+ Capture the synthesis result for pause evaluation.
97
+
98
+ ### Step 2: Build Pause Check
99
+
100
+ **PAUSE if ANY of these are true** (display reason, log event, STOP):
101
+
102
+ | # | Condition | Source |
103
+ |---|-----------|--------|
104
+ | 1 | Watcher `verification_passed == false` | build-verify synthesis |
105
+ | 2 | Any Chaos finding severity `critical` or `high` | build-verify synthesis |
106
+ | 3 | New blocker flags created (count increased since Step 0.4) | flag-check-blockers |
107
+
108
+ On pause, display the AUTOPILOT PAUSED banner with reason, affected phase,
109
+ specific issues, and instruction: "Fix issues, then run /ant:run to resume."
110
+ Log: `"<timestamp>|autopilot_paused|run|Paused at Phase {id}: {reason}"`
111
+
112
+ **Headless override for visual checkpoints:** If headless mode is active and a
113
+ visual checkpoint prompt would normally be shown to the user, instead queue it as
114
+ a pending decision:
115
+ ```bash
116
+ bash .aether/aether-utils.sh pending-decision-add \
117
+ --title "Visual checkpoint: Phase {id}" \
118
+ --type "checkpoint" \
119
+ --description "{checkpoint_description}" \
120
+ --phase "{id}" \
121
+ --source "build-pause-check"
122
+ ```
123
+ Then continue without pausing.
124
+
125
+ **If no pause:** proceed to Step 3.
126
+
127
+ ### Step 3: Continue (Verify + Advance)
128
+
129
+ Execute continue playbooks in order, carrying cross-stage state
130
+ (`visual_mode`, `state`, `current_phase`, `verification_results`,
131
+ `gate_results`, `advancement_result`, `next_phase_id`, `completion_state`):
132
+
133
+ 1. `.aether/docs/command-playbooks/continue-verify.md`
134
+ 2. `.aether/docs/command-playbooks/continue-gates.md`
135
+ 3. `.aether/docs/command-playbooks/continue-advance.md`
136
+ 4. `.aether/docs/command-playbooks/continue-finalize.md`
137
+
138
+ **Autopilot override for runtime verification (Step 1.11 in continue-gates):**
139
+ Skip the AskUserQuestion prompt. Instead, auto-PAUSE with reason
140
+ "Runtime verification required" so the user can test manually before resuming.
141
+
142
+ **Headless override for runtime verification:** If headless mode is active and
143
+ runtime verification would normally pause, queue as a pending decision instead:
144
+ ```bash
145
+ bash .aether/aether-utils.sh pending-decision-add \
146
+ --title "Runtime verification needed: Phase {id}" \
147
+ --type "runtime-verification" \
148
+ --description "Manual testing required before advancing past Phase {id}" \
149
+ --phase "{id}" \
150
+ --source "continue-gates"
151
+ ```
152
+ Then continue without pausing.
153
+
154
+ ### Step 4: Continue Pause Check
155
+
156
+ **PAUSE if ANY of these are true:**
157
+
158
+ | # | Condition | Source |
159
+ |---|-----------|--------|
160
+ | 4 | Verification loop reported NOT READY | continue-verify |
161
+ | 5 | Gatekeeper found critical CVEs | continue-gates |
162
+ | 6 | Auditor critical findings or score < 60 | continue-gates |
163
+ | 7 | Unresolved blocker flags remain | continue-gates |
164
+ | 8 | Runtime verification needed | continue-gates Step 1.11 |
165
+ | 9 | All phases complete (no next phase) | continue-advance |
166
+ | 10 | Replan trigger fires (unless `--continue`) | autopilot-check-replan (Step 5.5) |
167
+
168
+ For condition 9: jump to Step 6 (celebration). For condition 10: PAUSE with
169
+ replan suggestion (see Step 5.5). For all others: PAUSE with reason, log event, STOP.
170
+
171
+ **If no pause:** proceed to Step 5.
172
+
173
+ ### Step 5: Auto-Advance and Loop
174
+
175
+ 1. Increment `phases_completed`
176
+ 2. Update autopilot state: `bash .aether/aether-utils.sh autopilot-update --action advance --phase {next} --result success`
177
+ 3. Log: `"<timestamp>|autopilot_advance|run|Phase {prev} -> {next} ({phases_completed}/{max})"`
178
+ 4. Display: `--- Autopilot: Phase {prev} done -> Phase {next} ({N}/{max}) ---`
179
+ 5. **Replan check** (see Step 5.5)
180
+ 6. If `phases_completed >= max_phases` or no incomplete phases: go to Step 6
181
+ 7. Otherwise: update `current_phase`, return to Step 1
182
+
183
+ ### Step 5.5: Replan Trigger Check
184
+
185
+ After each successful phase advance, check if a replan pause should fire:
186
+
187
+ ```bash
188
+ bash .aether/aether-utils.sh autopilot-check-replan --interval {replan_interval}
189
+ ```
190
+
191
+ If `--continue` flag was passed: skip this check entirely (user dismissed replan).
192
+
193
+ If `result.should_replan == true`: **PAUSE** with replan suggestion banner:
194
+
195
+ ```
196
+ ━━━ R E P L A N S U G G E S T E D ━━━
197
+ Phases auto-completed: {N} | Learnings accumulated: {learnings_since_last}
198
+
199
+ The colony has completed {N} phases since the last plan review.
200
+ New learnings may have changed the optimal path forward.
201
+
202
+ Options:
203
+ /ant:plan Regenerate phases with current learnings
204
+ /ant:run --continue Dismiss and continue without replanning
205
+ ```
206
+
207
+ Log: `"<timestamp>|autopilot_replan_pause|run|Replan suggested after {N} phases ({learnings} learnings)"`
208
+
209
+ If `result.should_replan == false`: proceed normally (no pause).
210
+
211
+ ### Step 6: Final Summary
212
+
213
+ ```
214
+ ━━━ A U T O P I L O T C O M P L E T E ━━━
215
+ Phases completed: {N} | Elapsed: {Xm Ys} | Now at: Phase {current}
216
+
217
+ {all complete} -> Colony goal achieved! Run /ant:seal
218
+ {max reached} -> Run /ant:run to continue
219
+ {replan} -> Run /ant:plan to replan, or /ant:run --continue to dismiss
220
+ {paused} -> Fix {reason}, then /ant:run to resume
221
+ ```
222
+
223
+ If headless mode was active and pending decisions were queued, display:
224
+ ```
225
+ Pending decisions: {N} — run `pending-decision-list` to review
226
+ ```
227
+
228
+ Update session:
229
+ `bash .aether/aether-utils.sh session-update "/ant:run" "/ant:run" "Autopilot: {N} phases, now Phase {current}"`
230
+
231
+ ## Execution Contract
232
+
233
+ For each playbook stage: Read file, execute inline, track `{stage_name, status, key_outputs}`.
234
+ If `status == failed`: evaluate pause conditions. Pause = graceful stop with saved state.
235
+ Hard failure (e.g., state corruption) = halt immediately, no recovery attempt.
236
+
237
+ On every pause: save COLONY_STATE.json, log event, update session, display resume instructions.