aether-colony 1.1.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 (207) hide show
  1. package/.aether/CONTEXT.md +160 -0
  2. package/.aether/QUEEN.md +84 -0
  3. package/.aether/aether-utils.sh +7749 -0
  4. package/.aether/docs/QUEEN-SYSTEM.md +211 -0
  5. package/.aether/docs/README.md +68 -0
  6. package/.aether/docs/caste-system.md +48 -0
  7. package/.aether/docs/disciplines/DISCIPLINES.md +93 -0
  8. package/.aether/docs/disciplines/coding-standards.md +197 -0
  9. package/.aether/docs/disciplines/debugging.md +207 -0
  10. package/.aether/docs/disciplines/learning.md +254 -0
  11. package/.aether/docs/disciplines/tdd.md +257 -0
  12. package/.aether/docs/disciplines/verification-loop.md +167 -0
  13. package/.aether/docs/disciplines/verification.md +116 -0
  14. package/.aether/docs/error-codes.md +268 -0
  15. package/.aether/docs/known-issues.md +233 -0
  16. package/.aether/docs/pheromones.md +205 -0
  17. package/.aether/docs/queen-commands.md +97 -0
  18. package/.aether/exchange/colony-registry.xml +11 -0
  19. package/.aether/exchange/pheromone-xml.sh +575 -0
  20. package/.aether/exchange/pheromones.xml +87 -0
  21. package/.aether/exchange/queen-wisdom.xml +14 -0
  22. package/.aether/exchange/registry-xml.sh +273 -0
  23. package/.aether/exchange/wisdom-xml.sh +319 -0
  24. package/.aether/midden/approach-changes.md +5 -0
  25. package/.aether/midden/build-failures.md +5 -0
  26. package/.aether/midden/test-failures.md +5 -0
  27. package/.aether/model-profiles.yaml +100 -0
  28. package/.aether/rules/aether-colony.md +134 -0
  29. package/.aether/schemas/aether-types.xsd +255 -0
  30. package/.aether/schemas/colony-registry.xsd +309 -0
  31. package/.aether/schemas/example-prompt-builder.xml +234 -0
  32. package/.aether/schemas/pheromone.xsd +163 -0
  33. package/.aether/schemas/prompt.xsd +416 -0
  34. package/.aether/schemas/queen-wisdom.xsd +325 -0
  35. package/.aether/schemas/worker-priming.xsd +276 -0
  36. package/.aether/templates/QUEEN.md.template +79 -0
  37. package/.aether/templates/colony-state-reset.jq.template +22 -0
  38. package/.aether/templates/colony-state.template.json +35 -0
  39. package/.aether/templates/constraints.template.json +9 -0
  40. package/.aether/templates/crowned-anthill.template.md +36 -0
  41. package/.aether/templates/handoff-build-error.template.md +30 -0
  42. package/.aether/templates/handoff-build-success.template.md +39 -0
  43. package/.aether/templates/handoff.template.md +40 -0
  44. package/.aether/templates/learning-observations.template.json +6 -0
  45. package/.aether/templates/midden.template.json +7 -0
  46. package/.aether/templates/pheromones.template.json +6 -0
  47. package/.aether/templates/session.template.json +9 -0
  48. package/.aether/utils/atomic-write.sh +219 -0
  49. package/.aether/utils/chamber-compare.sh +193 -0
  50. package/.aether/utils/chamber-utils.sh +297 -0
  51. package/.aether/utils/colorize-log.sh +132 -0
  52. package/.aether/utils/error-handler.sh +212 -0
  53. package/.aether/utils/file-lock.sh +158 -0
  54. package/.aether/utils/queen-to-md.xsl +395 -0
  55. package/.aether/utils/semantic-cli.sh +413 -0
  56. package/.aether/utils/spawn-tree.sh +428 -0
  57. package/.aether/utils/spawn-with-model.sh +56 -0
  58. package/.aether/utils/state-loader.sh +215 -0
  59. package/.aether/utils/swarm-display.sh +268 -0
  60. package/.aether/utils/watch-spawn-tree.sh +253 -0
  61. package/.aether/utils/xml-compose.sh +253 -0
  62. package/.aether/utils/xml-convert.sh +273 -0
  63. package/.aether/utils/xml-core.sh +186 -0
  64. package/.aether/utils/xml-query.sh +201 -0
  65. package/.aether/utils/xml-utils.sh +110 -0
  66. package/.aether/workers.md +765 -0
  67. package/.claude/agents/ant/aether-ambassador.md +264 -0
  68. package/.claude/agents/ant/aether-archaeologist.md +322 -0
  69. package/.claude/agents/ant/aether-auditor.md +266 -0
  70. package/.claude/agents/ant/aether-builder.md +187 -0
  71. package/.claude/agents/ant/aether-chaos.md +268 -0
  72. package/.claude/agents/ant/aether-chronicler.md +304 -0
  73. package/.claude/agents/ant/aether-gatekeeper.md +325 -0
  74. package/.claude/agents/ant/aether-includer.md +373 -0
  75. package/.claude/agents/ant/aether-keeper.md +271 -0
  76. package/.claude/agents/ant/aether-measurer.md +317 -0
  77. package/.claude/agents/ant/aether-probe.md +210 -0
  78. package/.claude/agents/ant/aether-queen.md +325 -0
  79. package/.claude/agents/ant/aether-route-setter.md +173 -0
  80. package/.claude/agents/ant/aether-sage.md +353 -0
  81. package/.claude/agents/ant/aether-scout.md +142 -0
  82. package/.claude/agents/ant/aether-surveyor-disciplines.md +416 -0
  83. package/.claude/agents/ant/aether-surveyor-nest.md +354 -0
  84. package/.claude/agents/ant/aether-surveyor-pathogens.md +288 -0
  85. package/.claude/agents/ant/aether-surveyor-provisions.md +359 -0
  86. package/.claude/agents/ant/aether-tracker.md +265 -0
  87. package/.claude/agents/ant/aether-watcher.md +244 -0
  88. package/.claude/agents/ant/aether-weaver.md +247 -0
  89. package/.claude/commands/ant/archaeology.md +341 -0
  90. package/.claude/commands/ant/build.md +1160 -0
  91. package/.claude/commands/ant/chaos.md +349 -0
  92. package/.claude/commands/ant/colonize.md +270 -0
  93. package/.claude/commands/ant/continue.md +1070 -0
  94. package/.claude/commands/ant/council.md +309 -0
  95. package/.claude/commands/ant/dream.md +265 -0
  96. package/.claude/commands/ant/entomb.md +487 -0
  97. package/.claude/commands/ant/feedback.md +78 -0
  98. package/.claude/commands/ant/flag.md +139 -0
  99. package/.claude/commands/ant/flags.md +155 -0
  100. package/.claude/commands/ant/focus.md +58 -0
  101. package/.claude/commands/ant/help.md +122 -0
  102. package/.claude/commands/ant/history.md +137 -0
  103. package/.claude/commands/ant/init.md +409 -0
  104. package/.claude/commands/ant/interpret.md +267 -0
  105. package/.claude/commands/ant/lay-eggs.md +201 -0
  106. package/.claude/commands/ant/maturity.md +102 -0
  107. package/.claude/commands/ant/memory-details.md +77 -0
  108. package/.claude/commands/ant/migrate-state.md +165 -0
  109. package/.claude/commands/ant/oracle.md +387 -0
  110. package/.claude/commands/ant/organize.md +227 -0
  111. package/.claude/commands/ant/pause-colony.md +247 -0
  112. package/.claude/commands/ant/phase.md +126 -0
  113. package/.claude/commands/ant/plan.md +544 -0
  114. package/.claude/commands/ant/redirect.md +58 -0
  115. package/.claude/commands/ant/resume-colony.md +182 -0
  116. package/.claude/commands/ant/resume.md +363 -0
  117. package/.claude/commands/ant/seal.md +306 -0
  118. package/.claude/commands/ant/status.md +272 -0
  119. package/.claude/commands/ant/swarm.md +361 -0
  120. package/.claude/commands/ant/tunnels.md +425 -0
  121. package/.claude/commands/ant/update.md +209 -0
  122. package/.claude/commands/ant/verify-castes.md +95 -0
  123. package/.claude/commands/ant/watch.md +238 -0
  124. package/.opencode/agents/aether-ambassador.md +140 -0
  125. package/.opencode/agents/aether-archaeologist.md +108 -0
  126. package/.opencode/agents/aether-auditor.md +144 -0
  127. package/.opencode/agents/aether-builder.md +184 -0
  128. package/.opencode/agents/aether-chaos.md +115 -0
  129. package/.opencode/agents/aether-chronicler.md +122 -0
  130. package/.opencode/agents/aether-gatekeeper.md +116 -0
  131. package/.opencode/agents/aether-includer.md +117 -0
  132. package/.opencode/agents/aether-keeper.md +177 -0
  133. package/.opencode/agents/aether-measurer.md +128 -0
  134. package/.opencode/agents/aether-probe.md +133 -0
  135. package/.opencode/agents/aether-queen.md +286 -0
  136. package/.opencode/agents/aether-route-setter.md +130 -0
  137. package/.opencode/agents/aether-sage.md +106 -0
  138. package/.opencode/agents/aether-scout.md +101 -0
  139. package/.opencode/agents/aether-surveyor-disciplines.md +386 -0
  140. package/.opencode/agents/aether-surveyor-nest.md +324 -0
  141. package/.opencode/agents/aether-surveyor-pathogens.md +259 -0
  142. package/.opencode/agents/aether-surveyor-provisions.md +329 -0
  143. package/.opencode/agents/aether-tracker.md +137 -0
  144. package/.opencode/agents/aether-watcher.md +174 -0
  145. package/.opencode/agents/aether-weaver.md +130 -0
  146. package/.opencode/commands/ant/archaeology.md +338 -0
  147. package/.opencode/commands/ant/build.md +1200 -0
  148. package/.opencode/commands/ant/chaos.md +346 -0
  149. package/.opencode/commands/ant/colonize.md +202 -0
  150. package/.opencode/commands/ant/continue.md +938 -0
  151. package/.opencode/commands/ant/council.md +305 -0
  152. package/.opencode/commands/ant/dream.md +262 -0
  153. package/.opencode/commands/ant/entomb.md +367 -0
  154. package/.opencode/commands/ant/feedback.md +80 -0
  155. package/.opencode/commands/ant/flag.md +137 -0
  156. package/.opencode/commands/ant/flags.md +153 -0
  157. package/.opencode/commands/ant/focus.md +56 -0
  158. package/.opencode/commands/ant/help.md +124 -0
  159. package/.opencode/commands/ant/history.md +127 -0
  160. package/.opencode/commands/ant/init.md +337 -0
  161. package/.opencode/commands/ant/interpret.md +256 -0
  162. package/.opencode/commands/ant/lay-eggs.md +141 -0
  163. package/.opencode/commands/ant/maturity.md +92 -0
  164. package/.opencode/commands/ant/memory-details.md +77 -0
  165. package/.opencode/commands/ant/migrate-state.md +153 -0
  166. package/.opencode/commands/ant/oracle.md +338 -0
  167. package/.opencode/commands/ant/organize.md +224 -0
  168. package/.opencode/commands/ant/pause-colony.md +220 -0
  169. package/.opencode/commands/ant/phase.md +123 -0
  170. package/.opencode/commands/ant/plan.md +531 -0
  171. package/.opencode/commands/ant/redirect.md +67 -0
  172. package/.opencode/commands/ant/resume-colony.md +178 -0
  173. package/.opencode/commands/ant/resume.md +363 -0
  174. package/.opencode/commands/ant/seal.md +247 -0
  175. package/.opencode/commands/ant/status.md +272 -0
  176. package/.opencode/commands/ant/swarm.md +357 -0
  177. package/.opencode/commands/ant/tunnels.md +406 -0
  178. package/.opencode/commands/ant/update.md +191 -0
  179. package/.opencode/commands/ant/verify-castes.md +85 -0
  180. package/.opencode/commands/ant/watch.md +220 -0
  181. package/.opencode/opencode.json +3 -0
  182. package/CHANGELOG.md +325 -0
  183. package/DISCLAIMER.md +74 -0
  184. package/LICENSE +21 -0
  185. package/README.md +258 -0
  186. package/bin/cli.js +2436 -0
  187. package/bin/generate-commands.sh +291 -0
  188. package/bin/lib/caste-colors.js +57 -0
  189. package/bin/lib/colors.js +76 -0
  190. package/bin/lib/errors.js +255 -0
  191. package/bin/lib/event-types.js +190 -0
  192. package/bin/lib/file-lock.js +695 -0
  193. package/bin/lib/init.js +454 -0
  194. package/bin/lib/logger.js +242 -0
  195. package/bin/lib/model-profiles.js +445 -0
  196. package/bin/lib/model-verify.js +288 -0
  197. package/bin/lib/nestmate-loader.js +130 -0
  198. package/bin/lib/proxy-health.js +253 -0
  199. package/bin/lib/spawn-logger.js +266 -0
  200. package/bin/lib/state-guard.js +602 -0
  201. package/bin/lib/state-sync.js +516 -0
  202. package/bin/lib/telemetry.js +441 -0
  203. package/bin/lib/update-transaction.js +1454 -0
  204. package/bin/npx-install.js +178 -0
  205. package/bin/sync-to-runtime.sh +6 -0
  206. package/bin/validate-package.sh +88 -0
  207. package/package.json +70 -0
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: ant:resume-colony
3
+ description: "🚦➡️🐜💨💨 Resume colony from saved session - restores all state"
4
+ ---
5
+
6
+ You are the **Queen Ant Colony**. Restore state from a paused session.
7
+
8
+ ## Instructions
9
+
10
+ Parse `$ARGUMENTS`:
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
13
+
14
+ ### Step 0: Initialize Visual Mode (if enabled)
15
+
16
+ If `visual_mode` is true, run using the Bash tool with description "Initializing resume display...":
17
+ ```bash
18
+ # Generate session ID
19
+ resume_id="resume-$(date +%s)"
20
+
21
+ # Initialize swarm display
22
+ bash .aether/aether-utils.sh swarm-display-init "$resume_id"
23
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Resuming colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
24
+ ```
25
+
26
+ ### Step 0.5: Version Check (Non-blocking)
27
+
28
+ Run using the Bash tool with description "Checking colony version...": `bash .aether/aether-utils.sh version-check-cached 2>/dev/null || true`
29
+
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
+
32
+ ### Step 1: Load State and Validate
33
+
34
+ Run using the Bash tool with description "Restoring colony session...": `bash .aether/aether-utils.sh load-state`
35
+
36
+ If successful:
37
+ 1. Parse state from result
38
+ 2. If goal is null: Show "No colony state found..." message and stop
39
+ 3. Check if paused flag is true - if not, note "Colony was not paused, but resuming anyway"
40
+ 4. Extract all state fields for display
41
+
42
+ Keep state loaded (don't unload yet) - we'll need it for the full display.
43
+
44
+ ### Step 2: Compute Active Signals
45
+
46
+ Read active signals from COLONY_STATE.json `signals` array (already loaded in Step 1).
47
+
48
+ Filter signals where:
49
+ - `expires_at` is null (permanent signals like INIT), OR
50
+ - `expires_at` > current timestamp (not expired)
51
+
52
+ If `signals` array is empty or all expired, treat as "no active pheromones."
53
+
54
+ ### Step 3: Display Restored State
55
+
56
+ **Note:** Other ant commands (`/ant:status`, `/ant:build`, `/ant:plan`, `/ant:continue`) also show brief resumption context automatically. This full resume provides complete state restoration for explicit session recovery.
57
+
58
+ Output header:
59
+
60
+ ```
61
+ 🚦➡️🐜💨💨 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62
+ C O L O N Y R E S U M E D
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🚦➡️🐜💨💨
64
+ ```
65
+
66
+ Read the .aether/HANDOFF.md for context about what was happening, then display:
67
+
68
+ ```
69
+ +=====================================================+
70
+ | AETHER COLONY :: RESUMED |
71
+ +=====================================================+
72
+
73
+ Goal: "<goal>"
74
+ State: <state>
75
+ Session: <session_id>
76
+ Phase: <current_phase>
77
+
78
+ ACTIVE PHEROMONES
79
+ {TYPE padded to 10 chars} [{bar of 20 chars using filled/empty}] {current_strength:.2f}
80
+ "{content}"
81
+
82
+ Where the bar uses round(current_strength * 20) filled characters and spaces for the remainder.
83
+
84
+ If no active signals: (no active pheromones)
85
+
86
+ PHASE PROGRESS
87
+ Phase <id>: <name> [<status>]
88
+ (list all phases from plan.phases)
89
+
90
+ CONTEXT FROM HANDOFF
91
+ <summarize what was happening from .aether/HANDOFF.md>
92
+
93
+ NEXT ACTIONS
94
+ ```
95
+
96
+ **If visual_mode is true, render final swarm display** by running using the Bash tool with description "Updating resume display...":
97
+ ```bash
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-text "$resume_id"
100
+ ```
101
+
102
+ Route to next action based on state:
103
+ - If state is `READY` and there's a pending phase -> suggest `/ant:build <phase>`
104
+ - If state is `EXECUTING` -> note that a build was interrupted, suggest restarting with `/ant:build <phase>`
105
+ - If state is `PLANNING` -> note that planning was interrupted, suggest `/ant:plan`
106
+ - Otherwise -> suggest `/ant:status` for full overview
107
+
108
+ ### Step 6: Clear Paused State and Cleanup
109
+
110
+ Use Write tool to update COLONY_STATE.json:
111
+ - Remove or set to false: `"paused": false`
112
+ - Remove: `"paused_at"` field
113
+ - Update last_updated timestamp
114
+ - Add event: `{timestamp, type: "colony_resumed", worker: "resume", details: "Session resumed"}`
115
+
116
+ Use Bash tool with description "Cleaning up handoff file..." to remove HANDOFF.md: `rm -f .aether/HANDOFF.md`
117
+
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
+ ```
129
+
130
+ ---
131
+
132
+ ## Auto-Recovery Pattern Reference
133
+
134
+ The colony uses a tiered auto-recovery pattern to maintain context across session boundaries:
135
+
136
+ ### Format Tiers
137
+
138
+ | Context | Format | When Used |
139
+ |---------|--------|-----------|
140
+ | Brief | `🔄 Resuming: Phase X - Name` | Action commands (build, plan, continue) |
141
+ | Extended | Brief + last activity timestamp | Status command |
142
+ | Full | Complete state with pheromones, workers, context | resume-colony command |
143
+
144
+ ### Brief Format (Action Commands)
145
+
146
+ Used by `/ant:build`, `/ant:plan`, `/ant:continue`:
147
+
148
+ ```
149
+ 🔄 Resuming: Phase <current_phase> - <phase_name>
150
+ ```
151
+
152
+ Provides minimal orientation before executing the command's primary function.
153
+
154
+ ### Extended Format (Status Command)
155
+
156
+ Used by `/ant:status` Step 1.5:
157
+
158
+ ```
159
+ 🔄 Resuming: Phase <current_phase> - <phase_name>
160
+ Last activity: <last_event_timestamp>
161
+ ```
162
+
163
+ Adds temporal context to help gauge session staleness.
164
+
165
+ ### Full Format (Resume-Colony)
166
+
167
+ Used by `/ant:resume-colony`:
168
+
169
+ - Complete header with ASCII art
170
+ - Goal, state, session ID, phase
171
+ - Active pheromones with strength bars
172
+ - Worker status by caste
173
+ - Phase progress for all phases
174
+ - Handoff context summary
175
+ - Next action routing
176
+
177
+ ### Implementation Notes
178
+
179
+ 1. **State Source:** All formats read from `.aether/data/COLONY_STATE.json`
180
+ 2. **Phase Name:** Extracted from `plan.phases[current_phase - 1].name`
181
+ 3. **Last Activity:** Parsed from the last entry in `events` array
182
+ 4. **Edge Cases:** Handle missing phase names, empty events, phase 0
@@ -0,0 +1,363 @@
1
+ ---
2
+ name: resume
3
+ description: "Resume Previous Session"
4
+ symbol: refresh
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
+ RESUME SESSION
39
+
40
+ No previous session found.
41
+
42
+ Start fresh: /ant:init "your goal"
43
+ Or check: /ant:status
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ ```
46
+
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`
54
+
55
+ ---
56
+
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:
71
+
72
+ ```
73
+ State file missing or corrupted.
74
+
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
87
+
88
+ Use the Read tool to read `.aether/data/constraints.json`.
89
+
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 "")
114
+ ```
115
+
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
+ ```
122
+
123
+ Store `drift_detected=true`, `commit_count`, `changed_count` for dashboard rendering.
124
+
125
+ If `baseline_commit` is empty or matches `current_commit`: set `drift_detected=false`.
126
+
127
+ Restore identically regardless of time elapsed — no warnings about session age.
128
+
129
+ ---
130
+
131
+ ### Step 6: Compute Workflow Position and Next-Step Guidance
132
+
133
+ Compute `suggested_next` dynamically from COLONY_STATE.json data. Do not use the static value from session.json.
134
+
135
+ Use this decision tree:
136
+
137
+ ```
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.
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.
196
+ Goal: {goal}
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**
204
+
205
+ Check: plan.phases is empty AND plan.generated_at is not null
206
+
207
+ Output and STOP:
208
+
209
+ ```
210
+ BLOCKED: Plan was attempted but has no phases.
211
+ Required: Run /ant:plan to regenerate the plan.
212
+ Goal: {goal}
213
+ ```
214
+
215
+ Stop here — do not continue to Step 8 or render the dashboard.
216
+
217
+ ---
218
+
219
+ **BLOCK CONDITION 3: Build interrupted**
220
+
221
+ Check: state == "EXECUTING" AND the last 3 events show no recent build activity
222
+
223
+ Output and STOP:
224
+
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).
238
+
239
+ ```
240
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
241
+ RESUME SESSION
242
+
243
+ Next: {recommended}
244
+ {reason}
245
+ {if alternatives exist:}
246
+ Also: {alternatives, comma-separated}
247
+ {end}
248
+
249
+ {if drift_detected:}
250
+ Note: Codebase changed since last session ({commit_count} commit(s), {changed_count} file(s) modified)
251
+ {end}
252
+
253
+ Goal: {goal}
254
+ State: {state}
255
+ Phase: {current_phase}/{total_phases}
256
+
257
+ Phase Progress:
258
+ {for each phase in plan.phases:}
259
+ [{status_icon}] Phase {id}: {name}
260
+ {end}
261
+ ```
262
+
263
+ Status icons:
264
+ - completed: `v` (checkmark)
265
+ - in_progress: `~` (tilde)
266
+ - pending: ` ` (space)
267
+
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}
285
+
286
+ ---
287
+
288
+ ### Step 8.5: Display Memory Health (Secondary)
289
+
290
+ Run using the Bash tool with description "Loading memory health...":
291
+ ```bash
292
+ bash .aether/aether-utils.sh resume-dashboard
293
+ ```
294
+
295
+ Extract memory_health from the JSON result:
296
+ - wisdom_count
297
+ - pending_promotions
298
+ - recent_failures
299
+
300
+ Display after the main dashboard:
301
+ ```
302
+ 📊 Memory Health
303
+ Wisdom: {wisdom_count} entries | Pending: {pending_promotions} promotions | Failures: {recent_failures} recent
304
+
305
+ Run /ant:memory-details for full breakdown
306
+ ```
307
+
308
+ If all counts are 0, show:
309
+ ```
310
+ 📊 Memory Health
311
+ No accumulated wisdom yet. Complete phases to build colony memory.
312
+ ```
313
+
314
+ Last Command: {last_command}
315
+ Session: {session_id}
316
+ ```
317
+
318
+ ---
319
+
320
+ ### Step 9: Mark Session Resumed
321
+
322
+ Run using the Bash tool with description "Marking session as resumed...":
323
+ ```bash
324
+ bash .aether/aether-utils.sh session-mark-resumed
325
+ ```
326
+
327
+ ### Step 10: Next Up
328
+
329
+ Generate the state-based Next Up block by running using the Bash tool with description "Generating Next Up suggestions...":
330
+ ```bash
331
+ state=$(jq -r '.state // "IDLE"' .aether/data/COLONY_STATE.json)
332
+ current_phase=$(jq -r '.current_phase // 0' .aether/data/COLONY_STATE.json)
333
+ total_phases=$(jq -r '.plan.phases | length' .aether/data/COLONY_STATE.json)
334
+ bash .aether/aether-utils.sh print-next-up "$state" "$current_phase" "$total_phases"
335
+ ```
336
+
337
+ ---
338
+
339
+ ## Error Handling Reference
340
+
341
+ | Condition | Response |
342
+ |-----------|----------|
343
+ | session.json missing (exists=false) | "No previous session found" — offer /ant:init and /ant:status |
344
+ | COLONY_STATE.json missing or corrupted | Pause, ask user: start fresh or recover |
345
+ | constraints.json missing | Skip silently (no pheromones) |
346
+ | CONTEXT.md missing | Fall back to COLONY_STATE.json narrative |
347
+ | No plan phases, no generated_at | BLOCK — redirect to /ant:plan |
348
+ | Plan attempted but no phases | BLOCK — redirect to /ant:plan |
349
+ | State EXECUTING, events show no activity | BLOCK — redirect to /ant:continue |
350
+ | baseline_commit matches current HEAD | No drift warning shown |
351
+ | baseline_commit differs from current HEAD | Show informational drift note |
352
+
353
+ ---
354
+
355
+ ## Key Constraints
356
+
357
+ - Use Read tool for COLONY_STATE.json and constraints.json (not bash cat/jq)
358
+ - Use Bash tool only for aether-utils.sh commands and git commands
359
+ - Handle ALL missing/corrupted file cases gracefully
360
+ - Time-agnostic: restore identically regardless of how long ago the session was
361
+ - Decisions shown as flat list — no user vs Claude distinction
362
+ - Blocking guards run BEFORE dashboard rendering (early-return pattern)
363
+ - Drift detection is informational only — not alarming, not a blocker