aether-colony 3.1.17 → 5.0.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 (183) hide show
  1. package/{runtime → .aether}/CONTEXT.md +1 -1
  2. package/{runtime → .aether}/aether-utils.sh +1772 -98
  3. package/.aether/docs/QUEEN-SYSTEM.md +211 -0
  4. package/.aether/docs/QUEEN.md +84 -0
  5. package/.aether/docs/README.md +68 -0
  6. package/.aether/docs/caste-system.md +48 -0
  7. package/{runtime → .aether/docs/disciplines}/DISCIPLINES.md +8 -8
  8. package/.aether/docs/error-codes.md +268 -0
  9. package/{runtime → .aether}/docs/known-issues.md +42 -26
  10. package/.aether/docs/queen-commands.md +97 -0
  11. package/.aether/exchange/colony-registry.xml +11 -0
  12. package/{runtime → .aether}/exchange/pheromone-xml.sh +2 -1
  13. package/.aether/exchange/pheromones.xml +87 -0
  14. package/.aether/exchange/queen-wisdom.xml +14 -0
  15. package/{runtime → .aether}/exchange/registry-xml.sh +7 -3
  16. package/{runtime → .aether}/exchange/wisdom-xml.sh +11 -4
  17. package/.aether/rules/aether-colony.md +134 -0
  18. package/.aether/schemas/example-prompt-builder.xml +234 -0
  19. package/.aether/templates/colony-state-reset.jq.template +22 -0
  20. package/.aether/templates/colony-state.template.json +35 -0
  21. package/.aether/templates/constraints.template.json +9 -0
  22. package/.aether/templates/crowned-anthill.template.md +36 -0
  23. package/.aether/templates/handoff-build-error.template.md +30 -0
  24. package/.aether/templates/handoff-build-success.template.md +39 -0
  25. package/.aether/templates/handoff.template.md +40 -0
  26. package/{runtime → .aether}/utils/atomic-write.sh +5 -5
  27. package/{runtime → .aether}/utils/chamber-compare.sh +23 -10
  28. package/{runtime → .aether}/utils/chamber-utils.sh +32 -20
  29. package/{runtime → .aether}/utils/error-handler.sh +13 -1
  30. package/{runtime → .aether}/utils/file-lock.sh +49 -13
  31. package/.aether/utils/semantic-cli.sh +413 -0
  32. package/{runtime → .aether}/utils/xml-compose.sh +7 -1
  33. package/.aether/utils/xml-convert.sh +273 -0
  34. package/.aether/utils/xml-query.sh +201 -0
  35. package/.aether/utils/xml-utils.sh +110 -0
  36. package/{runtime → .aether}/workers.md +14 -17
  37. package/.claude/agents/ant/aether-ambassador.md +264 -0
  38. package/.claude/agents/ant/aether-archaeologist.md +322 -0
  39. package/.claude/agents/ant/aether-auditor.md +266 -0
  40. package/.claude/agents/ant/aether-builder.md +187 -0
  41. package/.claude/agents/ant/aether-chaos.md +268 -0
  42. package/.claude/agents/ant/aether-chronicler.md +304 -0
  43. package/.claude/agents/ant/aether-gatekeeper.md +325 -0
  44. package/.claude/agents/ant/aether-includer.md +373 -0
  45. package/.claude/agents/ant/aether-keeper.md +271 -0
  46. package/.claude/agents/ant/aether-measurer.md +317 -0
  47. package/.claude/agents/ant/aether-probe.md +210 -0
  48. package/.claude/agents/ant/aether-queen.md +325 -0
  49. package/.claude/agents/ant/aether-route-setter.md +173 -0
  50. package/.claude/agents/ant/aether-sage.md +353 -0
  51. package/.claude/agents/ant/aether-scout.md +142 -0
  52. package/.claude/agents/ant/aether-surveyor-disciplines.md +416 -0
  53. package/.claude/agents/ant/aether-surveyor-nest.md +354 -0
  54. package/.claude/agents/ant/aether-surveyor-pathogens.md +288 -0
  55. package/.claude/agents/ant/aether-surveyor-provisions.md +359 -0
  56. package/.claude/agents/ant/aether-tracker.md +265 -0
  57. package/.claude/agents/ant/aether-watcher.md +244 -0
  58. package/.claude/agents/ant/aether-weaver.md +247 -0
  59. package/.claude/commands/ant/archaeology.md +16 -7
  60. package/.claude/commands/ant/build.md +415 -284
  61. package/.claude/commands/ant/chaos.md +19 -10
  62. package/.claude/commands/ant/colonize.md +58 -24
  63. package/.claude/commands/ant/continue.md +155 -145
  64. package/.claude/commands/ant/council.md +15 -5
  65. package/.claude/commands/ant/dream.md +16 -7
  66. package/.claude/commands/ant/entomb.md +274 -157
  67. package/.claude/commands/ant/feedback.md +33 -29
  68. package/.claude/commands/ant/flag.md +18 -10
  69. package/.claude/commands/ant/flags.md +14 -6
  70. package/.claude/commands/ant/focus.md +29 -21
  71. package/.claude/commands/ant/help.md +11 -1
  72. package/.claude/commands/ant/history.md +10 -0
  73. package/.claude/commands/ant/init.md +91 -65
  74. package/.claude/commands/ant/interpret.md +15 -4
  75. package/.claude/commands/ant/lay-eggs.md +55 -7
  76. package/.claude/commands/ant/maturity.md +11 -1
  77. package/.claude/commands/ant/migrate-state.md +14 -2
  78. package/.claude/commands/ant/oracle.md +23 -15
  79. package/.claude/commands/ant/organize.md +29 -20
  80. package/.claude/commands/ant/pause-colony.md +17 -7
  81. package/.claude/commands/ant/phase.md +17 -8
  82. package/.claude/commands/ant/plan.md +20 -9
  83. package/.claude/commands/ant/redirect.md +29 -32
  84. package/.claude/commands/ant/resume-colony.md +19 -9
  85. package/.claude/commands/ant/resume.md +272 -96
  86. package/.claude/commands/ant/seal.md +201 -191
  87. package/.claude/commands/ant/status.md +71 -32
  88. package/.claude/commands/ant/swarm.md +26 -44
  89. package/.claude/commands/ant/tunnels.md +279 -105
  90. package/.claude/commands/ant/update.md +81 -20
  91. package/.claude/commands/ant/verify-castes.md +14 -4
  92. package/.claude/commands/ant/watch.md +13 -12
  93. package/.opencode/agents/aether-ambassador.md +63 -20
  94. package/.opencode/agents/aether-archaeologist.md +29 -12
  95. package/.opencode/agents/aether-auditor.md +51 -18
  96. package/.opencode/agents/aether-builder.md +69 -19
  97. package/.opencode/agents/aether-chaos.md +29 -12
  98. package/.opencode/agents/aether-chronicler.md +60 -18
  99. package/.opencode/agents/aether-gatekeeper.md +27 -18
  100. package/.opencode/agents/aether-includer.md +27 -18
  101. package/.opencode/agents/aether-keeper.md +89 -18
  102. package/.opencode/agents/aether-measurer.md +27 -18
  103. package/.opencode/agents/aether-probe.md +60 -18
  104. package/.opencode/agents/aether-queen.md +172 -24
  105. package/.opencode/agents/aether-route-setter.md +57 -12
  106. package/.opencode/agents/aether-sage.md +26 -18
  107. package/.opencode/agents/aether-scout.md +27 -19
  108. package/.opencode/agents/aether-surveyor-disciplines.md +53 -1
  109. package/.opencode/agents/aether-surveyor-nest.md +53 -1
  110. package/.opencode/agents/aether-surveyor-pathogens.md +51 -1
  111. package/.opencode/agents/aether-surveyor-provisions.md +53 -1
  112. package/.opencode/agents/aether-tracker.md +64 -18
  113. package/.opencode/agents/aether-watcher.md +66 -19
  114. package/.opencode/agents/aether-weaver.md +61 -18
  115. package/.opencode/commands/ant/build.md +406 -192
  116. package/.opencode/commands/ant/continue.md +66 -76
  117. package/.opencode/commands/ant/entomb.md +106 -45
  118. package/.opencode/commands/ant/init.md +46 -48
  119. package/.opencode/commands/ant/organize.md +5 -5
  120. package/.opencode/commands/ant/resume.md +334 -0
  121. package/.opencode/commands/ant/seal.md +33 -24
  122. package/.opencode/commands/ant/status.md +11 -0
  123. package/.opencode/commands/ant/tunnels.md +149 -0
  124. package/.opencode/commands/ant/update.md +59 -16
  125. package/CHANGELOG.md +79 -0
  126. package/README.md +135 -353
  127. package/bin/cli.js +243 -122
  128. package/bin/generate-commands.sh +2 -2
  129. package/bin/lib/init.js +13 -3
  130. package/bin/lib/update-transaction.js +119 -117
  131. package/bin/sync-to-runtime.sh +5 -137
  132. package/bin/validate-package.sh +84 -0
  133. package/package.json +9 -6
  134. package/.opencode/agents/aether-architect.md +0 -66
  135. package/.opencode/agents/aether-guardian.md +0 -107
  136. package/.opencode/agents/workers.md +0 -1034
  137. package/runtime/QUEEN_ANT_ARCHITECTURE.md +0 -402
  138. package/runtime/data/signatures.json +0 -41
  139. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +0 -1343
  140. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +0 -2642
  141. package/runtime/docs/PHEROMONE-INJECTION.md +0 -240
  142. package/runtime/docs/PHEROMONE-INTEGRATION.md +0 -192
  143. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +0 -426
  144. package/runtime/docs/README.md +0 -94
  145. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +0 -219
  146. package/runtime/docs/biological-reference.md +0 -272
  147. package/runtime/docs/codebase-review.md +0 -399
  148. package/runtime/docs/command-sync.md +0 -164
  149. package/runtime/docs/constraints.md +0 -116
  150. package/runtime/docs/implementation-learnings.md +0 -89
  151. package/runtime/docs/namespace.md +0 -148
  152. package/runtime/docs/pathogen-schema-example.json +0 -36
  153. package/runtime/docs/pathogen-schema.md +0 -111
  154. package/runtime/docs/planning-discipline.md +0 -159
  155. package/runtime/docs/progressive-disclosure.md +0 -184
  156. package/runtime/lib/queen-utils.sh +0 -729
  157. package/runtime/planning.md +0 -159
  158. package/runtime/recover.sh +0 -136
  159. package/runtime/utils/xml-utils.sh +0 -2196
  160. package/runtime/workers-new-castes.md +0 -516
  161. /package/{runtime → .aether/docs/disciplines}/coding-standards.md +0 -0
  162. /package/{runtime → .aether/docs/disciplines}/debugging.md +0 -0
  163. /package/{runtime → .aether/docs/disciplines}/learning.md +0 -0
  164. /package/{runtime → .aether/docs/disciplines}/tdd.md +0 -0
  165. /package/{runtime → .aether/docs/disciplines}/verification-loop.md +0 -0
  166. /package/{runtime → .aether/docs/disciplines}/verification.md +0 -0
  167. /package/{runtime → .aether}/docs/pheromones.md +0 -0
  168. /package/{runtime → .aether}/model-profiles.yaml +0 -0
  169. /package/{runtime → .aether}/schemas/aether-types.xsd +0 -0
  170. /package/{runtime → .aether}/schemas/colony-registry.xsd +0 -0
  171. /package/{runtime → .aether}/schemas/pheromone.xsd +0 -0
  172. /package/{runtime → .aether}/schemas/prompt.xsd +0 -0
  173. /package/{runtime → .aether}/schemas/queen-wisdom.xsd +0 -0
  174. /package/{runtime → .aether}/schemas/worker-priming.xsd +0 -0
  175. /package/{runtime → .aether}/templates/QUEEN.md.template +0 -0
  176. /package/{runtime → .aether}/utils/colorize-log.sh +0 -0
  177. /package/{runtime → .aether}/utils/queen-to-md.xsl +0 -0
  178. /package/{runtime → .aether}/utils/spawn-tree.sh +0 -0
  179. /package/{runtime → .aether}/utils/spawn-with-model.sh +0 -0
  180. /package/{runtime → .aether}/utils/state-loader.sh +0 -0
  181. /package/{runtime → .aether}/utils/swarm-display.sh +0 -0
  182. /package/{runtime → .aether}/utils/watch-spawn-tree.sh +0 -0
  183. /package/{runtime → .aether}/utils/xml-core.sh +0 -0
@@ -13,7 +13,7 @@ Parse `$ARGUMENTS`:
13
13
 
14
14
  ### Step 0: Initialize Visual Mode (if enabled)
15
15
 
16
- If `visual_mode` is true:
16
+ If `visual_mode` is true, run using the Bash tool with description "Initializing resume display...":
17
17
  ```bash
18
18
  # Generate session ID
19
19
  resume_id="resume-$(date +%s)"
@@ -25,13 +25,13 @@ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "
25
25
 
26
26
  ### Step 0.5: Version Check (Non-blocking)
27
27
 
28
- Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
28
+ Run using the Bash tool with description "Checking colony version...": `bash .aether/aether-utils.sh version-check-cached 2>/dev/null || true`
29
29
 
30
30
  If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
31
31
 
32
32
  ### Step 1: Load State and Validate
33
33
 
34
- Run using Bash tool: `bash .aether/aether-utils.sh load-state`
34
+ Run using the Bash tool with description "Restoring colony session...": `bash .aether/aether-utils.sh load-state`
35
35
 
36
36
  If successful:
37
37
  1. Parse state from result
@@ -58,9 +58,9 @@ If `signals` array is empty or all expired, treat as "no active pheromones."
58
58
  Output header:
59
59
 
60
60
  ```
61
- 🚦➡️🐜💨💨 ═══════════════════════════════════════════════════
61
+ 🚦➡️🐜💨💨 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
62
  C O L O N Y R E S U M E D
63
- ═══════════════════════════════════════════════════ 🚦➡️🐜💨💨
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🚦➡️🐜💨💨
64
64
  ```
65
65
 
66
66
  Read the .aether/HANDOFF.md for context about what was happening, then display:
@@ -93,10 +93,10 @@ CONTEXT FROM HANDOFF
93
93
  NEXT ACTIONS
94
94
  ```
95
95
 
96
- **If visual_mode is true, render final swarm display:**
96
+ **If visual_mode is true, render final swarm display** by running using the Bash tool with description "Updating resume display...":
97
97
  ```bash
98
98
  bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Colony resumed" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "fungus_garden" 100
99
- bash .aether/aether-utils.sh swarm-display-inline "$resume_id"
99
+ bash .aether/aether-utils.sh swarm-display-text "$resume_id"
100
100
  ```
101
101
 
102
102
  Route to next action based on state:
@@ -113,9 +113,19 @@ Use Write tool to update COLONY_STATE.json:
113
113
  - Update last_updated timestamp
114
114
  - Add event: `{timestamp, type: "colony_resumed", worker: "resume", details: "Session resumed"}`
115
115
 
116
- Use Bash tool to remove HANDOFF.md: `rm -f .aether/HANDOFF.md`
116
+ Use Bash tool with description "Cleaning up handoff file..." to remove HANDOFF.md: `rm -f .aether/HANDOFF.md`
117
117
 
118
- Run: `bash .aether/aether-utils.sh unload-state` to release lock.
118
+ Run using the Bash tool with description "Releasing colony lock...": `bash .aether/aether-utils.sh unload-state` to release lock.
119
+
120
+ ### Step 7: Next Up
121
+
122
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
123
+ ```bash
124
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
125
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
126
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
127
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
128
+ ```
119
129
 
120
130
  ---
121
131
 
@@ -1,21 +1,12 @@
1
- # /ant:resume — Resume Previous Session
2
-
3
- Resume work from where you left off after a context clear or new session start.
4
-
5
- ## When to Use
1
+ ---
2
+ name: resume
3
+ description: "Resume Previous Session"
4
+ symbol: refresh
5
+ ---
6
6
 
7
- - After running `/clear` and wanting to continue previous work
8
- - When opening a new Claude Code session with existing colony state
9
- - To check what you were working on and pick up where you left off
10
-
11
- ## What It Does
7
+ # /ant:resume Resume Previous Session
12
8
 
13
- 1. Reads `.aether/data/session.json` to understand previous activity
14
- 2. Reads `COLONY_STATE.json` to verify colony status
15
- 3. Checks `TO-DOs.md` for relevant pending work
16
- 4. Presents a summary and asks if you want to resume
17
- 5. If yes: Restores context and suggests next step
18
- 6. If no: Offers to start fresh with `/ant:init`
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.
19
10
 
20
11
  ## Usage
21
12
 
@@ -23,137 +14,322 @@ Resume work from where you left off after a context clear or new session start.
23
14
  /ant:resume
24
15
  ```
25
16
 
26
- ## Session Recovery Flow
17
+ ---
18
+
19
+ ## Implementation
20
+
21
+ Execute the following steps in order when the user runs `/ant:resume`.
22
+
23
+ ---
27
24
 
28
- ### Step 1: Check for Existing Session
25
+ ### Step 1: Read Session State
29
26
 
27
+ Run using the Bash tool with description "Restoring colony session...":
30
28
  ```bash
31
29
  bash .aether/aether-utils.sh session-read
32
30
  ```
33
31
 
34
- Check if session exists and whether it's stale (> 24 hours old).
32
+ Parse the JSON result.
35
33
 
36
- ### Step 2: If No Session Found
34
+ - If `exists` is `false`: display the following and **stop**:
37
35
 
38
- Display:
39
36
  ```
40
- 📋 SESSION RESUME
37
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
38
+ RESUME SESSION
41
39
 
42
40
  No previous session found.
43
41
 
44
- Would you like to:
45
- 1. Start a new colony with /ant:init
46
- 2. Check status with /ant:status
47
- 3. View existing colonies with /ant:history
42
+ Start fresh: /ant:init "your goal"
43
+ Or check: /ant:status
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
48
45
  ```
49
46
 
50
- Offer to run `/ant:init` to start fresh.
47
+ - If `exists` is `true`: extract from the session data:
48
+ - `colony_goal`
49
+ - `current_phase`
50
+ - `last_command`
51
+ - `suggested_next`
52
+ - `baseline_commit`
53
+ - `session_id`
51
54
 
52
- ### Step 3: If Session Exists
55
+ ---
53
56
 
54
- Read session data and colony state, then present summary:
57
+ ### Step 2: Read COLONY_STATE.json (Authoritative Source)
58
+
59
+ Use the Read tool to read `.aether/data/COLONY_STATE.json`.
60
+
61
+ COLONY_STATE.json is the authoritative source for goal and state (session.json may be stale). Extract:
62
+ - `goal` (use this as authoritative, overriding session.json colony_goal)
63
+ - `state` (READY, PLANNING, EXECUTING, PAUSED)
64
+ - `current_phase`
65
+ - `plan.phases` (array with id, name, status for each phase)
66
+ - `plan.generated_at`
67
+ - `memory.decisions` (flat list — do NOT distinguish user vs Claude origin)
68
+ - `events` (last 5 for recent activity context)
69
+
70
+ If the file is missing or the JSON cannot be parsed, **stop immediately** and display:
55
71
 
56
72
  ```
57
- 📋 SESSION RESUME
73
+ State file missing or corrupted.
58
74
 
59
- You were working on: {colony_goal}
60
- Current Phase: {current_phase} ({current_milestone})
61
- Last Command: {last_command}
62
- Last Active: {hours_ago} hours ago
63
- Suggested Next: {suggested_next}
75
+ Options:
76
+ 1. Start fresh with /ant:init "goal"
77
+ 2. Try to recover (I'll look for backup files)
78
+
79
+ What would you like to do?
80
+ ```
81
+
82
+ Do NOT proceed with stale or fabricated data.
83
+
84
+ ---
85
+
86
+ ### Step 3: Read Pheromone Signals
64
87
 
65
- Active TODOs:
66
- - {todo1}
67
- - {todo2}
88
+ Use the Read tool to read `.aether/data/constraints.json`.
68
89
 
69
- Would you like to resume this work?
90
+ Extract the following top-level keys:
91
+ - `focus` array — active focus signals (if key missing, treat as empty array)
92
+ - `constraints` array — active redirect/constraint signals (if key missing, treat as empty array)
93
+
94
+ If the file is missing: skip silently (no pheromones active).
95
+
96
+ Pheromones persist until explicitly cleared — no decay.
97
+
98
+ ---
99
+
100
+ ### Step 4: Read CONTEXT.md
101
+
102
+ Use the Read tool to read `.aether/CONTEXT.md` if it exists.
103
+
104
+ If missing: fall back to COLONY_STATE.json for narrative context. Note: "Context document not found — reconstructing from state."
105
+
106
+ ---
107
+
108
+ ### Step 5: Drift Detection
109
+
110
+ Extract `baseline_commit` from the session.json data read in Step 1.
111
+
112
+ ```bash
113
+ current_commit=$(git rev-parse HEAD 2>/dev/null || echo "")
70
114
  ```
71
115
 
72
- Use `AskUserQuestion` to present options:
73
- - **Yes, resume** — Continue where you left off
74
- - **Show details** — See full colony state first
75
- - **No, start fresh** Clear session and start new
116
+ If `baseline_commit` is non-empty and differs from `current_commit`:
117
+
118
+ ```bash
119
+ commit_count=$(git rev-list --count "$baseline_commit..HEAD" 2>/dev/null || echo "0")
120
+ changed_count=$(git diff --stat "$baseline_commit" HEAD 2>/dev/null | tail -1 | grep -oE '[0-9]+ file' | grep -oE '[0-9]+' || echo "0")
121
+ ```
76
122
 
77
- ### Step 4: If User Chooses "Yes, resume"
123
+ Store `drift_detected=true`, `commit_count`, `changed_count` for dashboard rendering.
78
124
 
79
- 1. Mark session as resumed:
80
- ```bash
81
- bash .aether/aether-utils.sh session-mark-resumed
82
- ```
125
+ If `baseline_commit` is empty or matches `current_commit`: set `drift_detected=false`.
83
126
 
84
- 2. Present context summary:
85
- ```
86
- 🔄 Resuming Session
127
+ Restore identically regardless of time elapsed — no warnings about session age.
87
128
 
88
- Colony: {goal}
89
- Phase: {phase} - {milestone}
90
- Context restored.
129
+ ---
91
130
 
92
- Next suggested step: {suggested_next}
93
- ```
131
+ ### Step 6: Compute Workflow Position and Next-Step Guidance
94
132
 
95
- 3. Run the suggested command or present further options based on state.
133
+ Compute `suggested_next` dynamically from COLONY_STATE.json data. Do not use the static value from session.json.
96
134
 
97
- ### Step 5: If User Chooses "Show details"
135
+ Use this decision tree:
98
136
 
99
- Display:
100
137
  ```
101
- 📊 Colony Details
138
+ Case 1 — No plan created yet:
139
+ Check: plan.phases is empty AND plan.generated_at is null
140
+ recommended = "/ant:plan"
141
+ reason = "No plan created yet"
142
+ alternatives = ["/ant:colonize — analyze codebase first"]
143
+
144
+ Case 2 — Plan ready, first phase not started:
145
+ Check: plan.phases is not empty AND state == "READY" AND current_phase == 0
146
+ recommended = "/ant:build 1"
147
+ reason = "Plan ready, first phase not started"
148
+ alternatives = ["/ant:plan — review or regenerate plan"]
149
+
150
+ Case 3 — Build in progress:
151
+ Check: state == "EXECUTING"
152
+ recommended = "/ant:continue"
153
+ reason = "Build in progress"
154
+ alternatives = ["/ant:build {current_phase} — rebuild current phase", "/ant:flags — check for blockers"]
155
+
156
+ Case 4 — Phase complete, next phase available:
157
+ Check: state == "READY" AND current_phase > 0 AND current_phase < plan.phases.length
158
+ next = current_phase + 1
159
+ recommended = "/ant:build {next}"
160
+ reason = "Phase {current_phase} complete, ready for next"
161
+ alternatives = ["/ant:plan — regenerate plan", "/ant:phase {next} — preview next phase"]
162
+
163
+ Case 5 — All phases complete:
164
+ Check: state == "READY" AND current_phase > 0 AND current_phase >= plan.phases.length
165
+ recommended = "/ant:seal"
166
+ reason = "All phases complete"
167
+ alternatives = ["/ant:status — view final state"]
168
+
169
+ Case 6 — Colony paused:
170
+ Check: state == "PAUSED"
171
+ recommended = "/ant:resume-colony"
172
+ reason = "Colony is paused"
173
+ alternatives = ["/ant:status — check state first"]
174
+
175
+ Default:
176
+ recommended = "/ant:status"
177
+ reason = "Check colony status"
178
+ alternatives = []
179
+ ```
180
+
181
+ ---
182
+
183
+ ### Step 7: Workflow-Step Blocking (Early-Return Guards)
184
+
185
+ 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.
102
186
 
187
+ **BLOCK CONDITION 1: No plan exists**
188
+
189
+ Check: plan.phases is empty AND plan.generated_at is null
190
+
191
+ Output and STOP:
192
+
193
+ ```
194
+ BLOCKED: No plan exists yet.
195
+ Required: Run /ant:plan to create a build plan.
103
196
  Goal: {goal}
104
- State: {state}
105
- Phase: {phase}
106
- Milestone: {milestone}
197
+ ```
198
+
199
+ Stop here — do not continue to Step 8 or render the dashboard.
200
+
201
+ ---
202
+
203
+ **BLOCK CONDITION 2: Plan attempted but failed**
107
204
 
108
- Recent Activity (from activity.log):
109
- {last 5 entries}
205
+ Check: plan.phases is empty AND plan.generated_at is not null
110
206
 
111
- Pending TODOs:
112
- {todos}
207
+ Output and STOP:
113
208
 
114
- [Present Yes/No choice to resume]
209
+ ```
210
+ BLOCKED: Plan was attempted but has no phases.
211
+ Required: Run /ant:plan to regenerate the plan.
212
+ Goal: {goal}
115
213
  ```
116
214
 
117
- ### Step 6: If User Chooses "No, start fresh"
215
+ Stop here do not continue to Step 8 or render the dashboard.
118
216
 
119
- 1. Clear the session:
120
- ```bash
121
- bash .aether/aether-utils.sh session-clear
122
- ```
217
+ ---
123
218
 
124
- 2. Offer:
125
- ```
126
- Session cleared.
219
+ **BLOCK CONDITION 3: Build interrupted**
127
220
 
128
- Start fresh with:
129
- - /ant:init "your new goal"
130
- - /ant:status (to check other colonies)
131
- ```
221
+ Check: state == "EXECUTING" AND the last 3 events show no recent build activity
132
222
 
133
- ## Integration with Colony Commands
223
+ Output and STOP:
134
224
 
135
- All `/ant:*` commands should update the session after execution:
225
+ ```
226
+ BLOCKED: Build may have been interrupted.
227
+ Required: Run /ant:continue to check and advance.
228
+ Goal: {goal}
229
+ ```
230
+
231
+ Stop here — do not continue to Step 8 or render the dashboard.
232
+
233
+ ---
234
+
235
+ ### Step 8: Render Dashboard
236
+
237
+ Lead with the next-step recommendation. Context follows underneath ("straight to action" ordering).
136
238
 
137
- ```bash
138
- # Example: After /ant:build completes
139
- bash .aether/aether-utils.sh session-update "/ant:build $phase" "/ant:continue" "Completed phase $phase"
140
239
  ```
240
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
241
+ RESUME SESSION
141
242
 
142
- This ensures session.json is always current for resume functionality.
243
+ Next: {recommended}
244
+ {reason}
245
+ {if alternatives exist:}
246
+ Also: {alternatives, comma-separated}
247
+ {end}
143
248
 
144
- ## Session File Location
249
+ {if drift_detected:}
250
+ Note: Codebase changed since last session ({commit_count} commit(s), {changed_count} file(s) modified)
251
+ {end}
145
252
 
146
- `.aether/data/session.json`
253
+ Goal: {goal}
254
+ State: {state}
255
+ Phase: {current_phase}/{total_phases}
147
256
 
148
- This file persists across context clears and Claude Code sessions.
257
+ Phase Progress:
258
+ {for each phase in plan.phases:}
259
+ [{status_icon}] Phase {id}: {name}
260
+ {end}
261
+ ```
149
262
 
150
- ## Stale Session Detection
263
+ Status icons:
264
+ - completed: `v` (checkmark)
265
+ - in_progress: `~` (tilde)
266
+ - pending: ` ` (space)
151
267
 
152
- Sessions older than 24 hours are marked "stale":
153
- - User is warned: "This session is X days old"
154
- - Given option to resume anyway or start fresh
155
- - Helps prevent accidentally resuming ancient work
268
+ ```
269
+ {if memory.decisions is not empty:}
270
+ Recent Decisions:
271
+ {for each of the last 5 decisions:}
272
+ - {decision text}
273
+ {end}
274
+ {end}
275
+
276
+ {if focus array or constraints array is not empty:}
277
+ Active Signals:
278
+ {for each focus signal:}
279
+ FOCUS: {focus text}
280
+ {end}
281
+ {for each constraint signal:}
282
+ REDIRECT: {constraint text}
283
+ {end}
284
+ {end}
156
285
 
157
- ## Implementation
286
+ Last Command: {last_command}
287
+ Session: {session_id}
288
+ ```
289
+
290
+ ---
291
+
292
+ ### Step 9: Mark Session Resumed
293
+
294
+ Run using the Bash tool with description "Marking session as resumed...":
295
+ ```bash
296
+ bash .aether/aether-utils.sh session-mark-resumed
297
+ ```
298
+
299
+ ### Step 10: Next Up
300
+
301
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
302
+ ```bash
303
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
304
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
305
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
306
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
307
+ ```
158
308
 
159
- Execute this flow when user runs `/ant:resume`.
309
+ ---
310
+
311
+ ## Error Handling Reference
312
+
313
+ | Condition | Response |
314
+ |-----------|----------|
315
+ | session.json missing (exists=false) | "No previous session found" — offer /ant:init and /ant:status |
316
+ | COLONY_STATE.json missing or corrupted | Pause, ask user: start fresh or recover |
317
+ | constraints.json missing | Skip silently (no pheromones) |
318
+ | CONTEXT.md missing | Fall back to COLONY_STATE.json narrative |
319
+ | No plan phases, no generated_at | BLOCK — redirect to /ant:plan |
320
+ | Plan attempted but no phases | BLOCK — redirect to /ant:plan |
321
+ | State EXECUTING, events show no activity | BLOCK — redirect to /ant:continue |
322
+ | baseline_commit matches current HEAD | No drift warning shown |
323
+ | baseline_commit differs from current HEAD | Show informational drift note |
324
+
325
+ ---
326
+
327
+ ## Key Constraints
328
+
329
+ - Use Read tool for COLONY_STATE.json and constraints.json (not bash cat/jq)
330
+ - Use Bash tool only for aether-utils.sh commands and git commands
331
+ - Handle ALL missing/corrupted file cases gracefully
332
+ - Time-agnostic: restore identically regardless of how long ago the session was
333
+ - Decisions shown as flat list — no user vs Claude distinction
334
+ - Blocking guards run BEFORE dashboard rendering (early-return pattern)
335
+ - Drift detection is informational only — not alarming, not a blocker