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