aether-colony 5.0.0 → 5.2.1

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 (317) hide show
  1. package/.aether/aether-utils.sh +3226 -3345
  2. package/.aether/agents-claude/aether-ambassador.md +265 -0
  3. package/.aether/agents-claude/aether-archaeologist.md +327 -0
  4. package/.aether/agents-claude/aether-architect.md +236 -0
  5. package/.aether/agents-claude/aether-auditor.md +271 -0
  6. package/.aether/agents-claude/aether-builder.md +224 -0
  7. package/.aether/agents-claude/aether-chaos.md +269 -0
  8. package/.aether/agents-claude/aether-chronicler.md +305 -0
  9. package/.aether/agents-claude/aether-gatekeeper.md +330 -0
  10. package/.aether/agents-claude/aether-includer.md +374 -0
  11. package/.aether/agents-claude/aether-keeper.md +272 -0
  12. package/.aether/agents-claude/aether-measurer.md +322 -0
  13. package/.aether/agents-claude/aether-oracle.md +237 -0
  14. package/.aether/agents-claude/aether-probe.md +211 -0
  15. package/.aether/agents-claude/aether-queen.md +330 -0
  16. package/.aether/agents-claude/aether-route-setter.md +178 -0
  17. package/.aether/agents-claude/aether-sage.md +418 -0
  18. package/.aether/agents-claude/aether-scout.md +179 -0
  19. package/.aether/agents-claude/aether-surveyor-disciplines.md +417 -0
  20. package/.aether/agents-claude/aether-surveyor-nest.md +355 -0
  21. package/.aether/agents-claude/aether-surveyor-pathogens.md +289 -0
  22. package/.aether/agents-claude/aether-surveyor-provisions.md +360 -0
  23. package/.aether/agents-claude/aether-tracker.md +270 -0
  24. package/.aether/agents-claude/aether-watcher.md +280 -0
  25. package/.aether/agents-claude/aether-weaver.md +248 -0
  26. package/.aether/commands/archaeology.yaml +653 -0
  27. package/.aether/commands/build.yaml +1221 -0
  28. package/.aether/commands/chaos.yaml +653 -0
  29. package/.aether/commands/colonize.yaml +442 -0
  30. package/.aether/commands/continue.yaml +1484 -0
  31. package/.aether/commands/council.yaml +509 -0
  32. package/.aether/commands/data-clean.yaml +80 -0
  33. package/.aether/commands/dream.yaml +275 -0
  34. package/.aether/commands/entomb.yaml +863 -0
  35. package/.aether/commands/export-signals.yaml +64 -0
  36. package/.aether/commands/feedback.yaml +158 -0
  37. package/.aether/commands/flag.yaml +160 -0
  38. package/.aether/commands/flags.yaml +177 -0
  39. package/.aether/commands/focus.yaml +112 -0
  40. package/.aether/commands/help.yaml +167 -0
  41. package/.aether/commands/history.yaml +137 -0
  42. package/.aether/commands/import-signals.yaml +79 -0
  43. package/.aether/commands/init.yaml +502 -0
  44. package/.aether/commands/insert-phase.yaml +102 -0
  45. package/.aether/commands/interpret.yaml +285 -0
  46. package/.aether/commands/lay-eggs.yaml +224 -0
  47. package/.aether/commands/maturity.yaml +122 -0
  48. package/.aether/commands/memory-details.yaml +74 -0
  49. package/.aether/commands/migrate-state.yaml +174 -0
  50. package/.aether/commands/oracle.yaml +1224 -0
  51. package/.aether/commands/organize.yaml +446 -0
  52. package/.aether/commands/patrol.yaml +621 -0
  53. package/.aether/commands/pause-colony.yaml +424 -0
  54. package/.aether/commands/phase.yaml +124 -0
  55. package/.aether/commands/pheromones.yaml +153 -0
  56. package/.aether/commands/plan.yaml +1364 -0
  57. package/.aether/commands/preferences.yaml +63 -0
  58. package/.aether/commands/quick.yaml +104 -0
  59. package/.aether/commands/redirect.yaml +123 -0
  60. package/.aether/commands/resume-colony.yaml +375 -0
  61. package/.aether/commands/resume.yaml +407 -0
  62. package/.aether/commands/run.yaml +229 -0
  63. package/.aether/commands/seal.yaml +1214 -0
  64. package/.aether/commands/skill-create.yaml +337 -0
  65. package/.aether/commands/status.yaml +408 -0
  66. package/.aether/commands/swarm.yaml +352 -0
  67. package/.aether/commands/tunnels.yaml +814 -0
  68. package/.aether/commands/update.yaml +131 -0
  69. package/.aether/commands/verify-castes.yaml +159 -0
  70. package/.aether/commands/watch.yaml +454 -0
  71. package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
  72. package/.aether/docs/QUEEN-SYSTEM.md +11 -11
  73. package/.aether/docs/README.md +32 -2
  74. package/.aether/docs/command-playbooks/README.md +23 -0
  75. package/.aether/docs/command-playbooks/build-complete.md +349 -0
  76. package/.aether/docs/command-playbooks/build-context.md +282 -0
  77. package/.aether/docs/command-playbooks/build-full.md +1683 -0
  78. package/.aether/docs/command-playbooks/build-prep.md +284 -0
  79. package/.aether/docs/command-playbooks/build-verify.md +405 -0
  80. package/.aether/docs/command-playbooks/build-wave.md +749 -0
  81. package/.aether/docs/command-playbooks/continue-advance.md +524 -0
  82. package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
  83. package/.aether/docs/command-playbooks/continue-full.md +1725 -0
  84. package/.aether/docs/command-playbooks/continue-gates.md +686 -0
  85. package/.aether/docs/command-playbooks/continue-verify.md +407 -0
  86. package/.aether/docs/context-continuity.md +84 -0
  87. package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
  88. package/.aether/docs/error-codes.md +1 -1
  89. package/.aether/docs/known-issues.md +34 -173
  90. package/.aether/docs/pheromones.md +86 -6
  91. package/.aether/docs/plans/pheromone-display-plan.md +257 -0
  92. package/.aether/docs/queen-commands.md +10 -9
  93. package/.aether/docs/source-of-truth-map.md +132 -0
  94. package/.aether/docs/xml-utilities.md +47 -0
  95. package/.aether/rules/aether-colony.md +23 -13
  96. package/.aether/scripts/incident-test-add.sh +47 -0
  97. package/.aether/scripts/weekly-audit.sh +79 -0
  98. package/.aether/skills/.index.json +649 -0
  99. package/.aether/skills/colony/.manifest.json +16 -0
  100. package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
  101. package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
  102. package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
  103. package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
  104. package/.aether/skills/colony/context-management/SKILL.md +80 -0
  105. package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
  106. package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
  107. package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
  108. package/.aether/skills/colony/state-safety/SKILL.md +84 -0
  109. package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
  110. package/.aether/skills/domain/.manifest.json +24 -0
  111. package/.aether/skills/domain/README.md +33 -0
  112. package/.aether/skills/domain/django/SKILL.md +49 -0
  113. package/.aether/skills/domain/docker/SKILL.md +52 -0
  114. package/.aether/skills/domain/golang/SKILL.md +52 -0
  115. package/.aether/skills/domain/graphql/SKILL.md +51 -0
  116. package/.aether/skills/domain/html-css/SKILL.md +48 -0
  117. package/.aether/skills/domain/nextjs/SKILL.md +45 -0
  118. package/.aether/skills/domain/nodejs/SKILL.md +53 -0
  119. package/.aether/skills/domain/postgresql/SKILL.md +53 -0
  120. package/.aether/skills/domain/prisma/SKILL.md +59 -0
  121. package/.aether/skills/domain/python/SKILL.md +50 -0
  122. package/.aether/skills/domain/rails/SKILL.md +52 -0
  123. package/.aether/skills/domain/react/SKILL.md +45 -0
  124. package/.aether/skills/domain/rest-api/SKILL.md +58 -0
  125. package/.aether/skills/domain/svelte/SKILL.md +47 -0
  126. package/.aether/skills/domain/tailwind/SKILL.md +45 -0
  127. package/.aether/skills/domain/testing/SKILL.md +53 -0
  128. package/.aether/skills/domain/typescript/SKILL.md +58 -0
  129. package/.aether/skills/domain/vue/SKILL.md +49 -0
  130. package/.aether/templates/QUEEN.md.template +23 -41
  131. package/.aether/templates/colony-state-reset.jq.template +1 -0
  132. package/.aether/templates/colony-state.template.json +4 -0
  133. package/.aether/templates/learning-observations.template.json +6 -0
  134. package/.aether/templates/midden.template.json +13 -0
  135. package/.aether/templates/pheromones.template.json +6 -0
  136. package/.aether/templates/session.template.json +9 -0
  137. package/.aether/utils/atomic-write.sh +63 -17
  138. package/.aether/utils/chamber-utils.sh +145 -2
  139. package/.aether/utils/council.sh +425 -0
  140. package/.aether/utils/emoji-audit.sh +166 -0
  141. package/.aether/utils/error-handler.sh +21 -7
  142. package/.aether/utils/file-lock.sh +182 -27
  143. package/.aether/utils/flag.sh +278 -0
  144. package/.aether/utils/hive.sh +572 -0
  145. package/.aether/utils/immune.sh +508 -0
  146. package/.aether/utils/learning.sh +1928 -0
  147. package/.aether/utils/midden.sh +520 -0
  148. package/.aether/utils/oracle/oracle.md +168 -0
  149. package/.aether/utils/oracle/oracle.sh +1023 -0
  150. package/.aether/utils/pheromone.sh +2029 -0
  151. package/.aether/utils/queen.sh +1710 -0
  152. package/.aether/utils/scan.sh +860 -0
  153. package/.aether/utils/semantic-cli.sh +10 -8
  154. package/.aether/utils/session.sh +816 -0
  155. package/.aether/utils/skills.sh +509 -0
  156. package/.aether/utils/spawn-tree.sh +103 -271
  157. package/.aether/utils/spawn.sh +260 -0
  158. package/.aether/utils/state-api.sh +389 -0
  159. package/.aether/utils/state-loader.sh +8 -6
  160. package/.aether/utils/suggest.sh +611 -0
  161. package/.aether/utils/swarm-display.sh +10 -1
  162. package/.aether/utils/swarm.sh +1004 -0
  163. package/.aether/utils/watch-spawn-tree.sh +11 -2
  164. package/.aether/utils/xml-compose.sh +2 -2
  165. package/.aether/utils/xml-convert.sh +9 -5
  166. package/.aether/utils/xml-core.sh +5 -9
  167. package/.aether/utils/xml-query.sh +4 -4
  168. package/.aether/workers.md +86 -67
  169. package/.claude/agents/ant/aether-ambassador.md +2 -1
  170. package/.claude/agents/ant/aether-archaeologist.md +6 -1
  171. package/.claude/agents/ant/aether-architect.md +236 -0
  172. package/.claude/agents/ant/aether-auditor.md +6 -1
  173. package/.claude/agents/ant/aether-builder.md +38 -1
  174. package/.claude/agents/ant/aether-chaos.md +2 -1
  175. package/.claude/agents/ant/aether-chronicler.md +1 -0
  176. package/.claude/agents/ant/aether-gatekeeper.md +6 -1
  177. package/.claude/agents/ant/aether-includer.md +1 -0
  178. package/.claude/agents/ant/aether-keeper.md +1 -0
  179. package/.claude/agents/ant/aether-measurer.md +6 -1
  180. package/.claude/agents/ant/aether-oracle.md +237 -0
  181. package/.claude/agents/ant/aether-probe.md +2 -1
  182. package/.claude/agents/ant/aether-queen.md +6 -1
  183. package/.claude/agents/ant/aether-route-setter.md +6 -1
  184. package/.claude/agents/ant/aether-sage.md +68 -3
  185. package/.claude/agents/ant/aether-scout.md +38 -1
  186. package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
  187. package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
  188. package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
  189. package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
  190. package/.claude/agents/ant/aether-tracker.md +6 -1
  191. package/.claude/agents/ant/aether-watcher.md +37 -1
  192. package/.claude/agents/ant/aether-weaver.md +2 -1
  193. package/.claude/commands/ant/archaeology.md +1 -8
  194. package/.claude/commands/ant/build.md +43 -1159
  195. package/.claude/commands/ant/chaos.md +1 -14
  196. package/.claude/commands/ant/colonize.md +3 -14
  197. package/.claude/commands/ant/continue.md +40 -1026
  198. package/.claude/commands/ant/council.md +213 -15
  199. package/.claude/commands/ant/data-clean.md +81 -0
  200. package/.claude/commands/ant/dream.md +12 -9
  201. package/.claude/commands/ant/entomb.md +62 -87
  202. package/.claude/commands/ant/export-signals.md +57 -0
  203. package/.claude/commands/ant/feedback.md +18 -0
  204. package/.claude/commands/ant/flag.md +12 -0
  205. package/.claude/commands/ant/flags.md +22 -8
  206. package/.claude/commands/ant/focus.md +18 -0
  207. package/.claude/commands/ant/help.md +40 -8
  208. package/.claude/commands/ant/history.md +3 -0
  209. package/.claude/commands/ant/import-signals.md +71 -0
  210. package/.claude/commands/ant/init.md +349 -191
  211. package/.claude/commands/ant/insert-phase.md +105 -0
  212. package/.claude/commands/ant/interpret.md +11 -0
  213. package/.claude/commands/ant/lay-eggs.md +167 -158
  214. package/.claude/commands/ant/maturity.md +22 -11
  215. package/.claude/commands/ant/memory-details.md +77 -0
  216. package/.claude/commands/ant/migrate-state.md +6 -0
  217. package/.claude/commands/ant/oracle.md +317 -62
  218. package/.claude/commands/ant/organize.md +10 -5
  219. package/.claude/commands/ant/patrol.md +620 -0
  220. package/.claude/commands/ant/pause-colony.md +8 -22
  221. package/.claude/commands/ant/phase.md +26 -37
  222. package/.claude/commands/ant/pheromones.md +156 -0
  223. package/.claude/commands/ant/plan.md +199 -50
  224. package/.claude/commands/ant/preferences.md +65 -0
  225. package/.claude/commands/ant/quick.md +100 -0
  226. package/.claude/commands/ant/redirect.md +18 -0
  227. package/.claude/commands/ant/resume-colony.md +37 -22
  228. package/.claude/commands/ant/resume.md +60 -7
  229. package/.claude/commands/ant/run.md +231 -0
  230. package/.claude/commands/ant/seal.md +506 -78
  231. package/.claude/commands/ant/skill-create.md +286 -0
  232. package/.claude/commands/ant/status.md +171 -1
  233. package/.claude/commands/ant/swarm.md +11 -23
  234. package/.claude/commands/ant/tunnels.md +1 -0
  235. package/.claude/commands/ant/update.md +58 -135
  236. package/.claude/commands/ant/verify-castes.md +90 -42
  237. package/.claude/commands/ant/watch.md +1 -0
  238. package/.opencode/agents/aether-ambassador.md +1 -1
  239. package/.opencode/agents/aether-architect.md +133 -0
  240. package/.opencode/agents/aether-builder.md +3 -3
  241. package/.opencode/agents/aether-oracle.md +137 -0
  242. package/.opencode/agents/aether-queen.md +1 -1
  243. package/.opencode/agents/aether-route-setter.md +1 -1
  244. package/.opencode/agents/aether-scout.md +1 -1
  245. package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
  246. package/.opencode/agents/aether-surveyor-nest.md +6 -1
  247. package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
  248. package/.opencode/agents/aether-surveyor-provisions.md +6 -1
  249. package/.opencode/agents/aether-tracker.md +1 -1
  250. package/.opencode/agents/aether-watcher.md +1 -1
  251. package/.opencode/agents/aether-weaver.md +1 -1
  252. package/.opencode/commands/ant/archaeology.md +7 -14
  253. package/.opencode/commands/ant/build.md +54 -88
  254. package/.opencode/commands/ant/chaos.md +7 -24
  255. package/.opencode/commands/ant/colonize.md +10 -17
  256. package/.opencode/commands/ant/continue.md +595 -66
  257. package/.opencode/commands/ant/council.md +150 -18
  258. package/.opencode/commands/ant/data-clean.md +77 -0
  259. package/.opencode/commands/ant/dream.md +15 -17
  260. package/.opencode/commands/ant/entomb.md +28 -18
  261. package/.opencode/commands/ant/export-signals.md +54 -0
  262. package/.opencode/commands/ant/feedback.md +24 -5
  263. package/.opencode/commands/ant/flag.md +16 -4
  264. package/.opencode/commands/ant/flags.md +24 -10
  265. package/.opencode/commands/ant/focus.md +22 -5
  266. package/.opencode/commands/ant/help.md +41 -8
  267. package/.opencode/commands/ant/history.md +9 -0
  268. package/.opencode/commands/ant/import-signals.md +68 -0
  269. package/.opencode/commands/ant/init.md +396 -154
  270. package/.opencode/commands/ant/insert-phase.md +111 -0
  271. package/.opencode/commands/ant/interpret.md +16 -0
  272. package/.opencode/commands/ant/lay-eggs.md +184 -112
  273. package/.opencode/commands/ant/maturity.md +18 -2
  274. package/.opencode/commands/ant/memory-details.md +83 -0
  275. package/.opencode/commands/ant/migrate-state.md +12 -0
  276. package/.opencode/commands/ant/oracle.md +322 -67
  277. package/.opencode/commands/ant/organize.md +14 -12
  278. package/.opencode/commands/ant/patrol.md +626 -0
  279. package/.opencode/commands/ant/pause-colony.md +12 -29
  280. package/.opencode/commands/ant/phase.md +30 -40
  281. package/.opencode/commands/ant/pheromones.md +162 -0
  282. package/.opencode/commands/ant/plan.md +210 -57
  283. package/.opencode/commands/ant/preferences.md +71 -0
  284. package/.opencode/commands/ant/quick.md +91 -0
  285. package/.opencode/commands/ant/redirect.md +22 -5
  286. package/.opencode/commands/ant/resume-colony.md +41 -29
  287. package/.opencode/commands/ant/resume.md +80 -20
  288. package/.opencode/commands/ant/run.md +237 -0
  289. package/.opencode/commands/ant/seal.md +230 -25
  290. package/.opencode/commands/ant/skill-create.md +63 -0
  291. package/.opencode/commands/ant/status.md +125 -30
  292. package/.opencode/commands/ant/swarm.md +3 -345
  293. package/.opencode/commands/ant/tunnels.md +3 -9
  294. package/.opencode/commands/ant/update.md +63 -127
  295. package/.opencode/commands/ant/verify-castes.md +96 -42
  296. package/.opencode/commands/ant/watch.md +7 -0
  297. package/CHANGELOG.md +368 -1
  298. package/README.md +195 -324
  299. package/bin/cli.js +236 -429
  300. package/bin/generate-commands.js +186 -0
  301. package/bin/generate-commands.sh +128 -89
  302. package/bin/lib/spawn-logger.js +0 -15
  303. package/bin/lib/update-transaction.js +285 -35
  304. package/bin/npx-install.js +178 -0
  305. package/bin/validate-package.sh +85 -3
  306. package/package.json +16 -4
  307. package/.aether/CONTEXT.md +0 -160
  308. package/.aether/docs/QUEEN.md +0 -84
  309. package/.aether/exchange/colony-registry.xml +0 -11
  310. package/.aether/exchange/pheromones.xml +0 -87
  311. package/.aether/exchange/queen-wisdom.xml +0 -14
  312. package/.aether/model-profiles.yaml +0 -100
  313. package/.aether/utils/spawn-with-model.sh +0 -56
  314. package/bin/lib/model-profiles.js +0 -445
  315. package/bin/lib/model-verify.js +0 -288
  316. package/bin/lib/proxy-health.js +0 -253
  317. package/bin/lib/telemetry.js +0 -441
@@ -1,41 +1,24 @@
1
+ <!-- Generated from .aether/commands/continue.yaml - DO NOT EDIT DIRECTLY -->
1
2
  ---
2
3
  name: ant:continue
3
4
  description: "➡️🐜🚪🐜➡️ Detect build completion, reconcile state, and advance to next phase"
4
5
  ---
5
6
 
6
- You are the **Queen Ant Colony**. Reconcile completed work and advance to the next phase.
7
-
8
- ## Instructions
9
-
10
7
  ### Step -1: Normalize Arguments
11
8
 
12
9
  Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
10
 
14
11
  This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
12
 
13
+ You are the **Queen Ant Colony**. Reconcile completed work and advance to the next phase.
14
+
15
+ ## Instructions
16
+
16
17
  Parse `$normalized_args`:
17
18
  - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
19
  - Otherwise: set `visual_mode = true`
19
20
 
20
- ### Step 0: Initialize Visual Mode (if enabled)
21
-
22
- If `visual_mode` is true:
23
- ```bash
24
- # Generate session ID
25
- continue_id="continue-$(date +%s)"
26
-
27
- # Initialize swarm display
28
- bash .aether/aether-utils.sh swarm-display-init "$continue_id"
29
- bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Phase continuation" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
30
- ```
31
-
32
- ### Step 0.5: Version Check (Non-blocking)
33
-
34
- Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
35
-
36
- If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
37
-
38
- ### Step 1: Read State + Version Check
21
+ ### Step 1: Read State
39
22
 
40
23
  Read `.aether/data/COLONY_STATE.json`.
41
24
 
@@ -91,7 +74,31 @@ If `state == "EXECUTING"`:
91
74
  If `state != "EXECUTING"`:
92
75
  - Normal continue flow (no build to reconcile)
93
76
 
94
- ### Step 1.5: Verification Loop Gate (MANDATORY)
77
+ ### Step 1.5.2: Load Survey Context (Non-blocking)
78
+
79
+ Run:
80
+ ```bash
81
+ survey_check=$(bash .aether/aether-utils.sh survey-verify 2>/dev/null || true)
82
+ survey_docs=$(ls -1 .aether/data/survey/*.md 2>/dev/null | wc -l | tr -d ' ')
83
+ survey_latest=$(ls -t .aether/data/survey/*.md 2>/dev/null | head -1)
84
+ if [[ -n "$survey_latest" ]]; then
85
+ now_epoch=$(date +%s)
86
+ modified_epoch=$(stat -f %m "$survey_latest" 2>/dev/null || stat -c %Y "$survey_latest" 2>/dev/null || echo 0)
87
+ survey_age_days=$(( (now_epoch - modified_epoch) / 86400 ))
88
+ else
89
+ survey_age_days=-1
90
+ fi
91
+ echo "{\"docs\":$survey_docs,\"age_days\":$survey_age_days,\"verify\":$survey_check}"
92
+ ```
93
+
94
+ Interpretation:
95
+ - If `docs == 0`: display `🗺️ Survey: not found (run /ant:colonize for stronger context)` and continue.
96
+ - If `age_days > 14`: display `🗺️ Survey: {docs} docs loaded ({age_days}d old, consider /ant:colonize --force-resurvey)` and continue.
97
+ - Otherwise: display `🗺️ Survey: {docs} docs loaded ({age_days}d old)` and continue.
98
+
99
+ Survey context is advisory only and must not block advancement by itself.
100
+
101
+ ### Step 1.5.3: Verification Loop Gate (MANDATORY)
95
102
 
96
103
  **The Iron Law:** No phase advancement without fresh verification evidence.
97
104
 
@@ -161,7 +168,74 @@ Record: pass count, fail count, exit code. **STOP if fails.**
161
168
  ```
162
169
  Record: coverage percentage (target: 80%+ for new code)
163
170
 
164
- **Phase 5: Security Scan**:
171
+ #### Step 1.5.1: Probe Coverage Agent (Conditional)
172
+
173
+ **Test coverage improvement -- runs when coverage < 80% AND tests pass.**
174
+
175
+ 1. **Check coverage threshold condition:**
176
+ - Coverage data is already available from Phase 4 coverage check
177
+ - If tests failed: Skip Probe silently (coverage data unreliable)
178
+ - If coverage_percent >= 80%: Skip Probe silently, continue to Phase 5
179
+ - If coverage_percent < 80% AND tests passed: Proceed to spawn Probe
180
+
181
+ 2. **If skipping Probe:**
182
+ ```
183
+ Probe: Coverage at {coverage_percent}% -- {reason_for_skip}
184
+ ```
185
+ Continue to Phase 5: Secrets Scan.
186
+
187
+ 3. **If spawning Probe:**
188
+
189
+ a. Generate Probe name and dispatch:
190
+ Run using the Bash tool with description "Generating Probe name...": `probe_name=$(bash .aether/aether-utils.sh generate-ant-name "probe") && bash .aether/aether-utils.sh spawn-log "Queen" "probe" "$probe_name" "Coverage improvement: ${coverage_percent}%" && echo "{\"name\":\"$probe_name\"}"`
191
+
192
+ b. Display:
193
+ ```
194
+ ━━━ 🧪🐜 P R O B E ━━━
195
+ ──── 🧪🐜 Spawning {probe_name} — Coverage improvement ────
196
+ ```
197
+
198
+ d. Determine uncovered files:
199
+ Run using the Bash tool with description "Getting modified source files...": `modified_source_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && source_files=$(echo "$modified_source_files" | grep -v "\.test\." | grep -v "\.spec\." | grep -v "__tests__") && echo "$source_files"`
200
+
201
+ e. Spawn Probe agent:
202
+
203
+ > **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-probe"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-probe agent definition from `.opencode/agents/aether-probe.md`).
204
+
205
+ Probe mission: Improve test coverage for uncovered code paths in the modified files.
206
+ - Analyze the modified source files for uncovered branches and edge cases
207
+ - Identify which paths lack test coverage
208
+ - Generate test cases that exercise uncovered code paths
209
+ - Run the new tests to verify they pass
210
+ - Report coverage improvements and edge cases discovered
211
+
212
+ Constraints:
213
+ - Test files ONLY -- never modify source code
214
+ - Follow existing test conventions in the codebase
215
+ - Do NOT delete or modify existing tests
216
+
217
+ f. Parse Probe JSON output and log completion:
218
+ Extract: `tests_added`, `coverage.lines`, `coverage.branches`, `coverage.functions`, `edge_cases_discovered`
219
+
220
+ Run using the Bash tool with description "Logging Probe completion...": `bash .aether/aether-utils.sh spawn-complete "$probe_name" "completed" "{probe_summary}"`
221
+
222
+ g. Log findings to midden:
223
+ Run using the Bash tool with description "Logging Probe findings to midden...": `bash .aether/aether-utils.sh midden-write "coverage" "Probe generated tests, coverage: ${coverage_lines}%/${coverage_branches}%/${coverage_functions}%" "probe"`
224
+
225
+ 4. **NON-BLOCKING continuation:**
226
+ Display Probe findings summary:
227
+ ```
228
+ Probe complete -- Findings logged to midden, continuing verification...
229
+ Tests added: {count}
230
+ Edge cases discovered: {count}
231
+ ```
232
+
233
+ **CRITICAL:** ALWAYS continue to Phase 5 (Secrets Scan) regardless of Probe results. Probe is strictly non-blocking.
234
+
235
+ 5. **Record Probe status for verification report:**
236
+ Set `probe_status = "ACTIVE"` and store tests_added count and edge_cases count for the verification report.
237
+
238
+ **Phase 5: Secrets Scan**:
165
239
  ```bash
166
240
  # Check for exposed secrets
167
241
  grep -rn "sk-\|api_key\|password\s*=" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | head -10
@@ -195,7 +269,10 @@ Display:
195
269
  🧹 Lint [PASS/FAIL/SKIP] (X warnings)
196
270
  🧪 Tests [PASS/FAIL/SKIP] (X/Y passed)
197
271
  Coverage {percent}% (target: 80%)
198
- 🔒 Security [PASS/FAIL] (X issues)
272
+ 🧪 Probe [ACTIVE/SKIP] (tests added: X, edge cases: Y)
273
+ 🔒 Secrets [PASS/FAIL] (X issues)
274
+ 📦 Gatekeeper [PASS/WARN/SKIP] (X critical, X high)
275
+ 👥 Auditor [PASS/FAIL] (score: X/100)
199
276
  📋 Diff [X files changed]
200
277
 
201
278
  ──────────────────────────────────────────────────
@@ -380,9 +457,299 @@ Run /ant:build {phase} again after fixing.
380
457
 
381
458
  Do NOT proceed to Step 2.
382
459
 
383
- If no CRITICAL issues, continue to Step 1.8.
460
+ If no CRITICAL issues, continue to Step 1.7.1.
461
+
462
+ ### Step 1.7.1: Proactive Refactoring Gate (Conditional)
463
+
464
+ **Complexity-based refactoring -- runs when code exceeds maintainability thresholds.**
465
+
466
+ 1. **Get modified/created files from recent work:**
467
+ Run using the Bash tool with description "Getting modified files for complexity check...": `modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && echo "$modified_files"`
468
+
469
+ 2. **Check complexity thresholds for each file:**
470
+
471
+ For each file, check:
472
+ - Line count > 300 lines
473
+ - Long functions > 50 lines (simplified heuristic)
474
+ - Directory density > 10 new files
475
+
476
+ Run using the Bash tool with description "Checking complexity thresholds...":
477
+ ```bash
478
+ modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only)
479
+
480
+ complexity_trigger=false
481
+ files_needing_refactor=""
482
+
483
+ for file in $modified_files; do
484
+ if [[ -f "$file" ]]; then
485
+ line_count=$(wc -l < "$file" 2>/dev/null || echo "0")
486
+ if [[ "$line_count" -gt 300 ]]; then
487
+ complexity_trigger=true
488
+ files_needing_refactor="$files_needing_refactor $file"
489
+ continue
490
+ fi
491
+
492
+ long_funcs=$(grep -c "^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*(" "$file" 2>/dev/null || echo "0")
493
+ if [[ "$long_funcs" -gt 50 ]]; then
494
+ complexity_trigger=true
495
+ files_needing_refactor="$files_needing_refactor $file"
496
+ fi
497
+ fi
498
+ done
499
+
500
+ if [[ -n "$modified_files" ]]; then
501
+ dir_counts=$(echo "$modified_files" | xargs -I {} dirname {} 2>/dev/null | sort | uniq -c | sort -rn)
502
+ high_density_dir=$(echo "$dir_counts" | awk '$1 > 10 {print $2}' | head -1)
503
+ if [[ -n "$high_density_dir" ]]; then
504
+ complexity_trigger=true
505
+ fi
506
+ fi
507
+
508
+ echo "{\"complexity_trigger\": \"$complexity_trigger\", \"files_needing_refactor\": \"$files_needing_refactor\"}"
509
+ ```
510
+
511
+ 3. **If complexity thresholds NOT exceeded:**
512
+ ```
513
+ Weaver: Complexity thresholds not exceeded -- skipping proactive refactoring
514
+ ```
515
+ Continue to Step 1.8.
516
+
517
+ 4. **If complexity thresholds exceeded:**
518
+
519
+ a. **Establish test baseline before refactoring:**
520
+ Run using the Bash tool with description "Establishing test baseline...": `test_output_before=$(npm test 2>&1 || echo "TEST_FAILED") && tests_passing_before=$(echo "$test_output_before" | grep -oE '[0-9]+ passing' | grep -oE '[0-9]+' || echo "0") && echo "Baseline: $tests_passing_before tests passing"`
521
+
522
+ b. **Generate Weaver name and dispatch:**
523
+ Run using the Bash tool with description "Generating Weaver name...": `weaver_name=$(bash .aether/aether-utils.sh generate-ant-name "weaver") && bash .aether/aether-utils.sh spawn-log "Queen" "weaver" "$weaver_name" "Proactive refactoring" && echo "{\"name\":\"$weaver_name\"}"`
524
+
525
+ c. **Display:**
526
+ ```
527
+ ━━━ 🔄🐜 W E A V E R ━━━
528
+ ──── 🔄🐜 Spawning {weaver_name} — Proactive refactoring ────
529
+ ```
530
+
531
+ e. **Spawn Weaver agent:**
532
+
533
+ > **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-weaver"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-weaver agent definition from `.opencode/agents/aether-weaver.md`).
534
+
535
+ Weaver mission: Refactor complex code to improve maintainability while preserving behavior.
536
+ - Analyze target files for complexity issues
537
+ - Plan incremental refactoring steps
538
+ - Execute one step at a time
539
+ - Run tests after each step
540
+ - If tests pass, continue; if fail, revert and try smaller step
541
+ - Report all changes made
542
+
543
+ Constraints:
544
+ - NEVER change behavior -- only structure
545
+ - Run tests after each refactoring step
546
+ - If tests fail, revert immediately
547
+ - Do NOT modify test expectations to make tests pass
548
+ - Do NOT modify .aether/ system files
549
+
550
+ f. **Parse Weaver JSON output and verify tests:**
551
+ Extract: `files_refactored`, `tests_all_passing`, `complexity_before`, `complexity_after`
552
+
553
+ Run using the Bash tool with description "Verifying tests after refactoring...":
554
+ ```bash
555
+ test_output_after=$(npm test 2>&1 || echo "TEST_FAILED")
556
+ tests_passing_after=$(echo "$test_output_after" | grep -oE '[0-9]+ passing' | grep -oE '[0-9]+' || echo "0")
557
+
558
+ if [[ "$tests_passing_after" -lt "$tests_passing_before" ]]; then
559
+ echo "REVERT_NEEDED: Tests failed after refactoring"
560
+ git checkout -- $files_needing_refactor
561
+ weaver_status="reverted"
562
+ else
563
+ echo "PASSING: Tests passing after refactoring ($tests_passing_after)"
564
+ weaver_status="completed"
565
+ fi
566
+ ```
567
+
568
+ g. **Log completion:**
569
+ Run using the Bash tool with description "Logging Weaver completion...": `bash .aether/aether-utils.sh spawn-complete "$weaver_name" "$weaver_status" "Refactoring $weaver_status"`
570
+
571
+ h. **Log to midden:**
572
+ Run using the Bash tool with description "Logging refactoring activity to midden...": `bash .aether/aether-utils.sh midden-write "refactoring" "Weaver refactored files, complexity before/after: ${complexity_before}/${complexity_after}" "weaver"`
573
+
574
+ 5. **Display completion:**
575
+ ```
576
+ Weaver: Proactive refactoring {weaver_status}
577
+ Files refactored: {count} | Complexity: {before} -> {after}
578
+ ```
579
+
580
+ 6. **NON-BLOCKING continuation:**
581
+ The Weaver step is NON-BLOCKING -- continue to Step 1.8 regardless of refactoring results.
582
+
583
+ Continue to Step 1.8.
584
+
585
+ ### Step 1.8: Gatekeeper Security Gate (Conditional)
586
+
587
+ **Supply chain security audit -- runs only when package.json exists.**
588
+
589
+ First, check for package.json:
590
+ Run using the Bash tool with description "Checking for package.json...": `test -f package.json && echo "exists" || echo "missing"`
591
+
592
+ **If package.json is missing:**
593
+ ```
594
+ Gatekeeper: No package.json found -- skipping supply chain audit
595
+ ```
596
+ Continue to Step 1.9.
597
+
598
+ **If package.json exists:**
599
+
600
+ 1. Generate Gatekeeper name and log spawn:
601
+ Run using the Bash tool with description "Generating Gatekeeper name...": `gatekeeper_name=$(bash .aether/aether-utils.sh generate-ant-name "gatekeeper") && bash .aether/aether-utils.sh spawn-log "Queen" "gatekeeper" "$gatekeeper_name" "Supply chain security audit" && echo "{\"name\":\"$gatekeeper_name\"}"`
602
+
603
+ 2. Display:
604
+ ```
605
+ ━━━ 📦🐜 G A T E K E E P E R ━━━
606
+ ──── 📦🐜 Spawning {gatekeeper_name} — Supply chain security audit ────
607
+ ```
608
+
609
+ 4. Spawn Gatekeeper agent:
610
+
611
+ > **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-gatekeeper"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-gatekeeper agent definition from `.opencode/agents/aether-gatekeeper.md`).
612
+
613
+ Gatekeeper mission: Perform supply chain security audit on this codebase.
614
+ - Inventory all dependencies from package.json
615
+ - Scan for known CVEs using npm audit or equivalent
616
+ - Check license compliance for all packages
617
+ - Assess dependency health (outdated, deprecated, maintenance status)
618
+ - Report findings with severity levels
619
+
620
+ 5. Parse Gatekeeper JSON output and log completion:
621
+ Extract: `security.critical`, `security.high`, `status`
622
+
623
+ Run using the Bash tool with description "Logging Gatekeeper completion...": `bash .aether/aether-utils.sh spawn-complete "$gatekeeper_name" "completed" "{gatekeeper_summary}"`
624
+
625
+ **Gate Decision Logic:**
626
+
627
+ - **If `security.critical > 0`:**
628
+ ```
629
+ GATEKEEPER GATE FAILED
630
+
631
+ Critical security vulnerabilities detected: {critical_count}
632
+
633
+ CRITICAL CVEs must be fixed before phase advancement.
634
+
635
+ Required Actions:
636
+ 1. Run `npm audit` to see full details
637
+ 2. Fix or update vulnerable dependencies
638
+ 3. Run /ant:continue again after resolving
639
+
640
+ The phase will NOT advance with critical CVEs.
641
+ ```
642
+ **CRITICAL:** Do NOT proceed to Step 1.9. Stop here.
643
+
644
+ - **If `security.high > 0`:**
645
+ ```
646
+ Gatekeeper: {high_count} high-severity issues found
647
+
648
+ Security warnings logged to midden for later review.
649
+ Proceeding with caution...
650
+ ```
651
+ Run using the Bash tool with description "Logging high-severity warnings...": `bash .aether/aether-utils.sh midden-write "security" "High CVEs found: $high_count" "gatekeeper"`
652
+ Continue to Step 1.9.
653
+
654
+ - **If clean (no critical or high):**
655
+ ```
656
+ Gatekeeper: No critical security issues found
657
+ ```
658
+ Continue to Step 1.9.
384
659
 
385
- ### Step 1.8: TDD Evidence Gate (MANDATORY)
660
+ ### Step 1.9: Auditor Quality Gate (MANDATORY)
661
+
662
+ **Code quality audit -- runs on every `/ant:continue` for consistent coverage.**
663
+
664
+ 1. Generate Auditor name and log spawn:
665
+ Run using the Bash tool with description "Generating Auditor name...": `auditor_name=$(bash .aether/aether-utils.sh generate-ant-name "auditor") && bash .aether/aether-utils.sh spawn-log "Queen" "auditor" "$auditor_name" "Code quality audit" && echo "{\"name\":\"$auditor_name\"}"`
666
+
667
+ 2. Display:
668
+ ```
669
+ ━━━ 👥🐜 A U D I T O R ━━━
670
+ ──── 👥🐜 Spawning {auditor_name} — Code quality audit ────
671
+ ```
672
+
673
+ 4. Get modified files for audit context:
674
+ Run using the Bash tool with description "Getting modified files...": `modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && echo "$modified_files"`
675
+
676
+ 5. Spawn Auditor agent:
677
+
678
+ > **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-auditor"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-auditor agent definition from `.opencode/agents/aether-auditor.md`).
679
+
680
+ Auditor mission: Perform comprehensive code quality audit on this codebase.
681
+ - Review all modified files from the recent commit(s)
682
+ - Apply all 4 audit lenses: security, performance, quality, maintainability
683
+ - Score each finding by severity (CRITICAL/HIGH/MEDIUM/LOW/INFO)
684
+ - Calculate overall quality score (0-100)
685
+ - Document specific issues with file:line references and fix suggestions
686
+
687
+ 6. Parse Auditor JSON output and log completion:
688
+ Extract: `findings.critical`, `findings.high`, `findings.medium`, `findings.low`, `findings.info`, `overall_score`, `dimensions_audited`
689
+
690
+ Run using the Bash tool with description "Logging Auditor completion...": `bash .aether/aether-utils.sh spawn-complete "$auditor_name" "completed" "{auditor_summary}"`
691
+
692
+ **Gate Decision Logic:**
693
+
694
+ - **If `findings.critical > 0`:**
695
+ ```
696
+ AUDITOR GATE FAILED
697
+
698
+ Critical code quality issues detected: {critical_count}
699
+
700
+ CRITICAL findings must be fixed before phase advancement.
701
+
702
+ Required Actions:
703
+ 1. Review the critical issues listed below
704
+ 2. Fix each critical finding
705
+ 3. Run /ant:continue again after resolving
706
+
707
+ Critical Findings:
708
+ {list each critical finding with file:line and description}
709
+
710
+ The phase will NOT advance with critical quality issues.
711
+ ```
712
+ Run using the Bash tool with description "Logging critical quality block...": `bash .aether/aether-utils.sh error-flag-pattern "auditor-critical-findings" "$critical_count critical quality issues found" "critical"`
713
+ **CRITICAL:** Do NOT proceed to Step 1.10. Stop here.
714
+
715
+ - **Else if `overall_score < 60`:**
716
+ ```
717
+ AUDITOR GATE FAILED
718
+
719
+ Code quality score below threshold: {overall_score}/100 (threshold: 60)
720
+
721
+ Quality score must reach 60+ before phase advancement.
722
+
723
+ Required Actions:
724
+ 1. Address the top issues preventing score improvement
725
+ 2. Focus on HIGH severity items first
726
+ 3. Run /ant:continue again after improving quality
727
+
728
+ The phase will NOT advance with quality score below 60.
729
+ ```
730
+ Run using the Bash tool with description "Logging quality score block...": `bash .aether/aether-utils.sh error-flag-pattern "auditor-quality-score" "Score $overall_score below threshold 60" "critical"`
731
+ **CRITICAL:** Do NOT proceed to Step 1.10. Stop here.
732
+
733
+ - **Else if `findings.high > 0`:**
734
+ ```
735
+ Auditor: Quality score {overall_score}/100 -- PASSED with warnings
736
+
737
+ {high_count} high-severity quality issues found:
738
+ {list high findings}
739
+
740
+ Quality warnings logged to midden for later review.
741
+ Proceeding with caution...
742
+ ```
743
+ Run using the Bash tool with description "Logging high-quality warnings...": `bash .aether/aether-utils.sh midden-write "quality" "High severity issues: $high_count (score: $overall_score)" "auditor"`
744
+ Continue to Step 1.10.
745
+
746
+ - **If clean (score >= 60, no critical):**
747
+ ```
748
+ Auditor: Quality score {overall_score}/100 -- PASSED
749
+ ```
750
+ Continue to Step 1.10.
751
+
752
+ ### Step 1.10: TDD Evidence Gate (MANDATORY)
386
753
 
387
754
  **The Iron Law:** No TDD claims without actual test files.
388
755
 
@@ -424,9 +791,9 @@ bash .aether/aether-utils.sh error-flag-pattern "fabricated-tdd" "Prime Worker r
424
791
 
425
792
  **If tests_added == 0 or test files exist matching claims:**
426
793
 
427
- Continue to Step 1.9.
794
+ Continue to Step 1.11.
428
795
 
429
- ### Step 1.9: Runtime Verification Gate (MANDATORY)
796
+ ### Step 1.11: Runtime Verification Gate (MANDATORY)
430
797
 
431
798
  **The Iron Law:** Build passing ≠ App working.
432
799
 
@@ -454,7 +821,7 @@ Options:
454
821
  ```
455
822
  ✅🐜 RUNTIME VERIFIED — User confirmed app works.
456
823
  ```
457
- Continue to Step 2.
824
+ Continue to Step 1.12.
458
825
 
459
826
  **If "Yes, tested but has issues":**
460
827
  ```
@@ -493,9 +860,9 @@ User indicated no runnable app for this phase.
493
860
  Proceeding to phase advancement.
494
861
  ```
495
862
 
496
- Continue to Step 1.10.
863
+ Continue to Step 1.12.
497
864
 
498
- ### Step 1.10: Flags Gate (MANDATORY)
865
+ ### Step 1.12: Flags Gate (MANDATORY)
499
866
 
500
867
  **The Iron Law:** No phase advancement with unresolved blockers.
501
868
 
@@ -602,6 +969,38 @@ Update COLONY_STATE.json:
602
969
  - It's stating the obvious
603
970
  - There's no evidence it works
604
971
 
972
+ 2.5. **Record learning observations for threshold tracking:**
973
+
974
+ For each learning extracted, record an observation to enable threshold-based wisdom promotion.
975
+
976
+ Run using the Bash tool with description "Recording learning observations...":
977
+ ```bash
978
+ colony_name=$(bash .aether/aether-utils.sh colony-name 2>/dev/null | jq -r '.result.name // ""')
979
+ [[ -z "$colony_name" ]] && colony_name="unknown"
980
+
981
+ # Get learnings from the current phase
982
+ current_phase_learnings=$(jq -r --argjson phase "$current_phase" '.memory.phase_learnings[] | select(.phase == $phase)' .aether/data/COLONY_STATE.json 2>/dev/null || echo "")
983
+
984
+ if [[ -n "$current_phase_learnings" ]]; then
985
+ echo "$current_phase_learnings" | jq -r '.learnings[]?.claim // empty' 2>/dev/null | while read -r claim; do
986
+ if [[ -n "$claim" ]]; then
987
+ # Default wisdom_type to "pattern" (threshold: 3 observations)
988
+ bash .aether/aether-utils.sh memory-capture "learning" "$claim" "pattern" "worker:continue" 2>/dev/null || true
989
+ fi
990
+ done
991
+ echo "Recorded observations for threshold tracking"
992
+ else
993
+ echo "No learnings to record"
994
+ fi
995
+ ```
996
+
997
+ This records each learning in `learning-observations.json` with:
998
+ - Content hash for deduplication (same claim across phases increments count)
999
+ - Observation count (increments if seen before)
1000
+ - Colony name for cross-colony tracking
1001
+
1002
+ When observations reach threshold (default: 3 for "pattern" type), they become eligible for promotion in Step 2.1.5.
1003
+
605
1004
  3. **Extract instincts from patterns:**
606
1005
 
607
1006
  Read activity.log for patterns from this phase's build.
@@ -661,7 +1060,106 @@ Update COLONY_STATE.json:
661
1060
 
662
1061
  Write COLONY_STATE.json.
663
1062
 
664
- ### Step 2.3: Update Handoff Document
1063
+ Validate the state file:
1064
+ Run using the Bash tool with description "Validating colony state...": `bash .aether/aether-utils.sh validate-state colony`
1065
+
1066
+ ### Step 2.1: Auto-Emit Phase Pheromones (SILENT)
1067
+
1068
+ **This entire step produces NO user-visible output.** All pheromone operations run silently -- learnings are deposited in the background. If any pheromone call fails, log the error and continue. Phase advancement must never fail due to pheromone errors.
1069
+
1070
+ #### 2.1a: Auto-emit FEEDBACK pheromone for phase outcome
1071
+
1072
+ After learning extraction completes in Step 2, auto-emit a FEEDBACK signal summarizing the phase:
1073
+
1074
+ ```bash
1075
+ # phase_id and phase_name come from Step 2 state update
1076
+ # Take the top 1-3 learnings by evidence strength from memory.phase_learnings
1077
+ # Compress into a single summary sentence
1078
+
1079
+ phase_feedback="Phase $phase_id ($phase_name) completed. Key patterns: {brief summary of 1-3 learnings from Step 2}"
1080
+ # Fallback if no learnings: "Phase $phase_id ($phase_name) completed without notable patterns."
1081
+
1082
+ bash .aether/aether-utils.sh pheromone-write FEEDBACK "$phase_feedback" \
1083
+ --strength 0.6 \
1084
+ --source "worker:continue" \
1085
+ --reason "Auto-emitted on phase advance: captures what worked and what was learned" \
1086
+ --ttl "30d" 2>/dev/null || true
1087
+ ```
1088
+
1089
+ The strength is 0.6 (auto-emitted = lower than user-emitted 0.7). Source is "worker:continue" to distinguish from user-emitted feedback. TTL is 30d so it survives phase transitions and can guide subsequent work.
1090
+
1091
+ #### 2.1b: Auto-emit REDIRECT for recurring error patterns
1092
+
1093
+ Check `errors.flagged_patterns[]` in COLONY_STATE.json for patterns that have appeared in 2+ phases:
1094
+
1095
+ ```bash
1096
+ flagged_patterns=$(jq -r '.errors.flagged_patterns[]? | select(.count >= 2) | .pattern' .aether/data/COLONY_STATE.json 2>/dev/null || true)
1097
+ ```
1098
+
1099
+ For each pattern returned by the above query, emit a REDIRECT signal:
1100
+
1101
+ ```bash
1102
+ bash .aether/aether-utils.sh pheromone-write REDIRECT "$pattern_text" \
1103
+ --strength 0.7 \
1104
+ --source "system" \
1105
+ --reason "Auto-emitted: error pattern recurred across 2+ phases" \
1106
+ --ttl "30d" 2>/dev/null || true
1107
+ ```
1108
+
1109
+ Also capture each recurring pattern as a resolution candidate:
1110
+
1111
+ ```bash
1112
+ bash .aether/aether-utils.sh memory-capture \
1113
+ "resolution" \
1114
+ "$pattern_text" \
1115
+ "pattern" \
1116
+ "worker:continue" 2>/dev/null || true
1117
+ ```
1118
+
1119
+ If `errors.flagged_patterns` doesn't exist or is empty, skip silently.
1120
+
1121
+ #### 2.1c: Expire phase_end signals and archive to midden
1122
+
1123
+ After auto-emission, expire all signals with `expires_at == "phase_end"`:
1124
+
1125
+ Run using the Bash tool with description "Maintaining pheromone memory...": `bash .aether/aether-utils.sh pheromone-expire --phase-end-only 2>/dev/null && bash .aether/aether-utils.sh eternal-init 2>/dev/null`
1126
+
1127
+ ### Step 2.1.5: Check for Promotion Proposals
1128
+
1129
+ After extracting learnings, check for observations that have met promotion thresholds and present the tick-to-approve UX.
1130
+
1131
+ **Normal proposal flow (MEM-01: Silent skip if empty):**
1132
+
1133
+ 1. **Check for proposals:**
1134
+ ```bash
1135
+ proposals=$(bash .aether/aether-utils.sh learning-check-promotion 2>/dev/null || echo '{"proposals":[]}')
1136
+ proposal_count=$(echo "$proposals" | jq '.proposals | length')
1137
+ ```
1138
+
1139
+ 2. **If proposals exist, invoke the approval workflow:**
1140
+
1141
+ Only show the approval UI when there are actual proposals to review:
1142
+
1143
+ ```bash
1144
+ if [[ "$proposal_count" -gt 0 ]]; then
1145
+ bash .aether/aether-utils.sh learning-approve-proposals
1146
+ fi
1147
+ # If no proposals, silently skip without notice
1148
+ ```
1149
+
1150
+ The learning-approve-proposals function handles:
1151
+ - Displaying proposals with checkbox UI
1152
+ - Capturing user selection
1153
+ - Executing batch promotions via queen-promote
1154
+ - Deferring unselected proposals
1155
+ - Offering undo after successful promotions
1156
+
1157
+ **Skip conditions:**
1158
+ - learning-check-promotion returns empty or fails
1159
+ - No proposals to review (silent skip - no output)
1160
+ - QUEEN.md does not exist
1161
+
1162
+ ### Step 2.2: Update Handoff Document
665
1163
 
666
1164
  After advancing the phase, update the handoff document with the new current state:
667
1165
 
@@ -704,33 +1202,46 @@ HANDOFF_EOF
704
1202
 
705
1203
  This handoff reflects the post-advancement state, allowing seamless resumption even if the session is lost.
706
1204
 
707
- ### Step 2.4: Update Changelog
1205
+ ### Step 2.3: Update Changelog
708
1206
 
709
- **Append a changelog entry for the completed phase.**
1207
+ **MANDATORY: Append a changelog entry for the completed phase. This step is never skipped.**
710
1208
 
711
- If `CHANGELOG.md` exists in the project root:
1209
+ If no `CHANGELOG.md` exists, `changelog-append` creates one automatically.
712
1210
 
713
- 1. Read the file
714
- 2. Find the `## [Unreleased]` section
715
- 3. Under the appropriate sub-heading (`### Added`, `### Changed`, or `### Fixed`), append a bullet for the completed phase:
1211
+ **Step 2.3.1: Collect plan data**
716
1212
 
1213
+ ```bash
1214
+ bash .aether/aether-utils.sh changelog-collect-plan-data "{phase_identifier}" "{plan_number}"
717
1215
  ```
718
- - **Phase {id}: {phase_name}** — {one-line summary of what was accomplished}. ({list of key files modified})
719
- ```
720
1216
 
721
- **Determining the sub-heading:**
722
- - If the phase created new features/commands → `### Added`
723
- - If the phase modified existing behavior → `### Changed`
724
- - If the phase fixed bugs → `### Fixed`
725
- - If unclear, default to `### Changed`
1217
+ Parse the returned JSON to extract `files`, `decisions`, `worked`, and `requirements` arrays.
1218
+
1219
+ - `{phase_identifier}` is the full phase name (e.g., `36-memory-capture`)
1220
+ - `{plan_number}` is the plan number (e.g., `01`)
1221
+
1222
+ If the command fails (e.g., no plan file found), fall back to collecting data manually:
1223
+ - Files: from `git diff --stat` of the completed phase
1224
+ - Decisions: from COLONY_STATE.json `memory.decisions` (last 5)
1225
+ - Worked/requirements: leave empty
1226
+
1227
+ **Step 2.3.2: Append changelog entry**
726
1228
 
727
- **The one-line summary** should describe the user-visible outcome, not implementation details. Derive it from the phase description and task summaries.
1229
+ ```bash
1230
+ bash .aether/aether-utils.sh changelog-append \
1231
+ "$(date +%Y-%m-%d)" \
1232
+ "{phase_identifier}" \
1233
+ "{plan_number}" \
1234
+ "{files_csv}" \
1235
+ "{decisions_semicolon_separated}" \
1236
+ "{worked_semicolon_separated}" \
1237
+ "{requirements_csv}"
1238
+ ```
728
1239
 
729
- **If no `## [Unreleased]` section exists**, create one at the top of the file (after the header).
1240
+ This atomically writes the entry. If the project already has a Keep a Changelog format, it adds a "Colony Work Log" separator section to keep both formats clean.
730
1241
 
731
- **If no `CHANGELOG.md` exists**, skip this step silently.
1242
+ **Error handling:** If `changelog-append` fails, log to midden and continue — changelog failure never blocks phase advancement.
732
1243
 
733
- ### Step 2.6: Commit Suggestion (Optional)
1244
+ ### Step 2.4: Commit Suggestion (Optional)
734
1245
 
735
1246
  **This step is non-blocking. Skipping does not affect phase advancement or any subsequent steps. Failure to commit has zero consequences.**
736
1247
 
@@ -791,9 +1302,9 @@ Set `last_commit_suggestion_phase` to `{phase_id}` in COLONY_STATE.json (add the
791
1302
 
792
1303
  **Error handling:** If any git command fails (not a repo, merge conflict, pre-commit hook rejection), display the error output and continue to the next step. The commit suggestion is advisory only -- it never blocks the flow.
793
1304
 
794
- Continue to Step 2.7 (Context Clear Suggestion), then to Step 2.5 (Project Completion) or Step 3 (Display Result).
1305
+ Continue to Step 2.5 (Context Clear Suggestion), then to Step 2.7 (Project Completion) or Step 3 (Display Result).
795
1306
 
796
- ### Step 2.7: Context Clear Suggestion (Optional)
1307
+ ### Step 2.5: Context Clear Suggestion (Optional)
797
1308
 
798
1309
  **This step is non-blocking. Skipping does not affect phase advancement.**
799
1310
 
@@ -821,21 +1332,39 @@ Clear context now?
821
1332
 
822
1333
  3. **If option 1 ("Yes, clear context"):**
823
1334
 
824
- **IMPORTANT:** Claude Code does not support programmatic /clear. Display instructions:
1335
+ **IMPORTANT:** Most AI platforms do not support programmatic context clearing. Display instructions:
825
1336
  ```
826
- Please type: /clear
827
-
828
- Then run: /ant:build {next_id}
1337
+ Please clear your context/conversation, then run: /ant:build {next_id}
829
1338
  ```
830
-
1339
+
831
1340
  Record the suggestion: Set `context_clear_suggested` to `true` in COLONY_STATE.json.
832
1341
 
833
1342
  4. **If option 2 ("No, continue in current context"):**
834
1343
  Display: `Continuing in current context. State is saved.`
835
1344
 
836
- Continue to Step 2.5 (Project Completion) or Step 3 (Display Result).
1345
+ Continue to Step 2.6 (Context Update), then Step 2.7 (Project Completion) or Step 3 (Display Result).
1346
+
1347
+ ### Step 2.6: Update Context Document
837
1348
 
838
- ### Step 2.5: Project Completion
1349
+ After phase advancement is complete, update `.aether/CONTEXT.md`:
1350
+
1351
+ **Log the activity:**
1352
+ ```bash
1353
+ bash .aether/aether-utils.sh context-update activity "continue" "Phase {prev_id} completed, advanced to {next_id}" "---"
1354
+ ```
1355
+
1356
+ **Update the phase:**
1357
+ ```bash
1358
+ bash .aether/aether-utils.sh context-update update-phase {next_id} "{next_phase_name}" "YES" "Phase advanced, ready to build"
1359
+ ```
1360
+
1361
+ **Log any decisions from this session:**
1362
+ If any architectural decisions were made during verification, also run:
1363
+ ```bash
1364
+ bash .aether/aether-utils.sh context-update decision "{decision_description}" "{rationale}" "Queen"
1365
+ ```
1366
+
1367
+ ### Step 2.7: Project Completion
839
1368
 
840
1369
  Runs ONLY when all phases complete.
841
1370
 
@@ -866,12 +1395,6 @@ Runs ONLY when all phases complete.
866
1395
 
867
1396
  ### Step 3: Display Result
868
1397
 
869
- **If visual_mode is true, render final swarm display:**
870
- ```bash
871
- bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Phase advanced" "Colony" '{"read":5,"grep":2,"edit":3,"bash":2}' 100 "fungus_garden" 100
872
- bash .aether/aether-utils.sh swarm-display-render "$continue_id"
873
- ```
874
-
875
1398
  Output:
876
1399
 
877
1400
  ```
@@ -905,3 +1428,9 @@ Output:
905
1428
  ```
906
1429
 
907
1430
  **IMPORTANT:** In the "Next Steps" section above, substitute the actual phase number for `{next_id}` (calculated in Step 2 as `current_phase + 1`). For example, if advancing to phase 4, output `/ant:build 4` not `/ant:build {next_id}`.
1431
+
1432
+ ### Step 4: Update Session
1433
+
1434
+ Update the session tracking file to enable `/ant:resume` after context clear:
1435
+
1436
+ Run using the Bash tool with description "Saving session state...": `bash .aether/aether-utils.sh session-update "/ant:continue" "/ant:build {next_id}" "Phase {prev_id} completed, advanced to Phase {next_id}"`