aether-colony 5.0.0 → 5.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 (312) hide show
  1. package/.aether/aether-utils.sh +3150 -3349
  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 +438 -0
  30. package/.aether/commands/continue.yaml +1484 -0
  31. package/.aether/commands/council.yaml +304 -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 +469 -0
  44. package/.aether/commands/insert-phase.yaml +98 -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 +1313 -0
  57. package/.aether/commands/preferences.yaml +63 -0
  58. package/.aether/commands/redirect.yaml +123 -0
  59. package/.aether/commands/resume-colony.yaml +373 -0
  60. package/.aether/commands/resume.yaml +398 -0
  61. package/.aether/commands/run.yaml +193 -0
  62. package/.aether/commands/seal.yaml +1205 -0
  63. package/.aether/commands/skill-create.yaml +337 -0
  64. package/.aether/commands/status.yaml +364 -0
  65. package/.aether/commands/swarm.yaml +352 -0
  66. package/.aether/commands/tunnels.yaml +814 -0
  67. package/.aether/commands/update.yaml +131 -0
  68. package/.aether/commands/verify-castes.yaml +159 -0
  69. package/.aether/commands/watch.yaml +454 -0
  70. package/.aether/docs/INCIDENT_TEMPLATE.md +32 -0
  71. package/.aether/docs/QUEEN-SYSTEM.md +11 -11
  72. package/.aether/docs/README.md +32 -2
  73. package/.aether/docs/command-playbooks/README.md +23 -0
  74. package/.aether/docs/command-playbooks/build-complete.md +349 -0
  75. package/.aether/docs/command-playbooks/build-context.md +282 -0
  76. package/.aether/docs/command-playbooks/build-full.md +1682 -0
  77. package/.aether/docs/command-playbooks/build-prep.md +283 -0
  78. package/.aether/docs/command-playbooks/build-verify.md +405 -0
  79. package/.aether/docs/command-playbooks/build-wave.md +749 -0
  80. package/.aether/docs/command-playbooks/continue-advance.md +524 -0
  81. package/.aether/docs/command-playbooks/continue-finalize.md +447 -0
  82. package/.aether/docs/command-playbooks/continue-full.md +1724 -0
  83. package/.aether/docs/command-playbooks/continue-gates.md +686 -0
  84. package/.aether/docs/command-playbooks/continue-verify.md +406 -0
  85. package/.aether/docs/context-continuity.md +84 -0
  86. package/.aether/docs/disciplines/DISCIPLINES.md +9 -7
  87. package/.aether/docs/error-codes.md +1 -1
  88. package/.aether/docs/known-issues.md +34 -173
  89. package/.aether/docs/pheromones.md +86 -6
  90. package/.aether/docs/plans/pheromone-display-plan.md +257 -0
  91. package/.aether/docs/queen-commands.md +10 -9
  92. package/.aether/docs/source-of-truth-map.md +132 -0
  93. package/.aether/docs/xml-utilities.md +47 -0
  94. package/.aether/rules/aether-colony.md +23 -13
  95. package/.aether/scripts/incident-test-add.sh +47 -0
  96. package/.aether/scripts/weekly-audit.sh +79 -0
  97. package/.aether/skills/.index.json +649 -0
  98. package/.aether/skills/colony/.manifest.json +16 -0
  99. package/.aether/skills/colony/build-discipline/SKILL.md +78 -0
  100. package/.aether/skills/colony/colony-interaction/SKILL.md +56 -0
  101. package/.aether/skills/colony/colony-lifecycle/SKILL.md +77 -0
  102. package/.aether/skills/colony/colony-visuals/SKILL.md +112 -0
  103. package/.aether/skills/colony/context-management/SKILL.md +80 -0
  104. package/.aether/skills/colony/error-presentation/SKILL.md +99 -0
  105. package/.aether/skills/colony/pheromone-protocol/SKILL.md +79 -0
  106. package/.aether/skills/colony/pheromone-visibility/SKILL.md +81 -0
  107. package/.aether/skills/colony/state-safety/SKILL.md +84 -0
  108. package/.aether/skills/colony/worker-priming/SKILL.md +82 -0
  109. package/.aether/skills/domain/.manifest.json +24 -0
  110. package/.aether/skills/domain/README.md +33 -0
  111. package/.aether/skills/domain/django/SKILL.md +49 -0
  112. package/.aether/skills/domain/docker/SKILL.md +52 -0
  113. package/.aether/skills/domain/golang/SKILL.md +52 -0
  114. package/.aether/skills/domain/graphql/SKILL.md +51 -0
  115. package/.aether/skills/domain/html-css/SKILL.md +48 -0
  116. package/.aether/skills/domain/nextjs/SKILL.md +45 -0
  117. package/.aether/skills/domain/nodejs/SKILL.md +53 -0
  118. package/.aether/skills/domain/postgresql/SKILL.md +53 -0
  119. package/.aether/skills/domain/prisma/SKILL.md +59 -0
  120. package/.aether/skills/domain/python/SKILL.md +50 -0
  121. package/.aether/skills/domain/rails/SKILL.md +52 -0
  122. package/.aether/skills/domain/react/SKILL.md +45 -0
  123. package/.aether/skills/domain/rest-api/SKILL.md +58 -0
  124. package/.aether/skills/domain/svelte/SKILL.md +47 -0
  125. package/.aether/skills/domain/tailwind/SKILL.md +45 -0
  126. package/.aether/skills/domain/testing/SKILL.md +53 -0
  127. package/.aether/skills/domain/typescript/SKILL.md +58 -0
  128. package/.aether/skills/domain/vue/SKILL.md +49 -0
  129. package/.aether/templates/QUEEN.md.template +23 -41
  130. package/.aether/templates/colony-state-reset.jq.template +1 -0
  131. package/.aether/templates/colony-state.template.json +4 -0
  132. package/.aether/templates/learning-observations.template.json +6 -0
  133. package/.aether/templates/midden.template.json +13 -0
  134. package/.aether/templates/pheromones.template.json +6 -0
  135. package/.aether/templates/session.template.json +9 -0
  136. package/.aether/utils/atomic-write.sh +63 -17
  137. package/.aether/utils/chamber-utils.sh +145 -2
  138. package/.aether/utils/emoji-audit.sh +166 -0
  139. package/.aether/utils/error-handler.sh +21 -7
  140. package/.aether/utils/file-lock.sh +182 -27
  141. package/.aether/utils/flag.sh +267 -0
  142. package/.aether/utils/hive.sh +572 -0
  143. package/.aether/utils/learning.sh +1928 -0
  144. package/.aether/utils/midden.sh +342 -0
  145. package/.aether/utils/oracle/oracle.md +168 -0
  146. package/.aether/utils/oracle/oracle.sh +1023 -0
  147. package/.aether/utils/pheromone.sh +2029 -0
  148. package/.aether/utils/queen.sh +1698 -0
  149. package/.aether/utils/scan.sh +860 -0
  150. package/.aether/utils/semantic-cli.sh +10 -8
  151. package/.aether/utils/session.sh +552 -0
  152. package/.aether/utils/skills.sh +509 -0
  153. package/.aether/utils/spawn-tree.sh +103 -271
  154. package/.aether/utils/spawn.sh +260 -0
  155. package/.aether/utils/state-api.sh +199 -0
  156. package/.aether/utils/state-loader.sh +8 -6
  157. package/.aether/utils/suggest.sh +611 -0
  158. package/.aether/utils/swarm-display.sh +10 -1
  159. package/.aether/utils/swarm.sh +1004 -0
  160. package/.aether/utils/watch-spawn-tree.sh +11 -2
  161. package/.aether/utils/xml-compose.sh +2 -2
  162. package/.aether/utils/xml-convert.sh +9 -5
  163. package/.aether/utils/xml-core.sh +5 -9
  164. package/.aether/utils/xml-query.sh +4 -4
  165. package/.aether/workers.md +86 -67
  166. package/.claude/agents/ant/aether-ambassador.md +2 -1
  167. package/.claude/agents/ant/aether-archaeologist.md +6 -1
  168. package/.claude/agents/ant/aether-architect.md +236 -0
  169. package/.claude/agents/ant/aether-auditor.md +6 -1
  170. package/.claude/agents/ant/aether-builder.md +38 -1
  171. package/.claude/agents/ant/aether-chaos.md +2 -1
  172. package/.claude/agents/ant/aether-chronicler.md +1 -0
  173. package/.claude/agents/ant/aether-gatekeeper.md +6 -1
  174. package/.claude/agents/ant/aether-includer.md +1 -0
  175. package/.claude/agents/ant/aether-keeper.md +1 -0
  176. package/.claude/agents/ant/aether-measurer.md +6 -1
  177. package/.claude/agents/ant/aether-oracle.md +237 -0
  178. package/.claude/agents/ant/aether-probe.md +2 -1
  179. package/.claude/agents/ant/aether-queen.md +6 -1
  180. package/.claude/agents/ant/aether-route-setter.md +6 -1
  181. package/.claude/agents/ant/aether-sage.md +68 -3
  182. package/.claude/agents/ant/aether-scout.md +38 -1
  183. package/.claude/agents/ant/aether-surveyor-disciplines.md +2 -1
  184. package/.claude/agents/ant/aether-surveyor-nest.md +2 -1
  185. package/.claude/agents/ant/aether-surveyor-pathogens.md +2 -1
  186. package/.claude/agents/ant/aether-surveyor-provisions.md +2 -1
  187. package/.claude/agents/ant/aether-tracker.md +6 -1
  188. package/.claude/agents/ant/aether-watcher.md +37 -1
  189. package/.claude/agents/ant/aether-weaver.md +2 -1
  190. package/.claude/commands/ant/archaeology.md +1 -8
  191. package/.claude/commands/ant/build.md +43 -1159
  192. package/.claude/commands/ant/chaos.md +1 -14
  193. package/.claude/commands/ant/colonize.md +1 -14
  194. package/.claude/commands/ant/continue.md +40 -1026
  195. package/.claude/commands/ant/council.md +9 -16
  196. package/.claude/commands/ant/data-clean.md +81 -0
  197. package/.claude/commands/ant/dream.md +12 -9
  198. package/.claude/commands/ant/entomb.md +62 -87
  199. package/.claude/commands/ant/export-signals.md +57 -0
  200. package/.claude/commands/ant/feedback.md +18 -0
  201. package/.claude/commands/ant/flag.md +12 -0
  202. package/.claude/commands/ant/flags.md +22 -8
  203. package/.claude/commands/ant/focus.md +18 -0
  204. package/.claude/commands/ant/help.md +40 -8
  205. package/.claude/commands/ant/history.md +3 -0
  206. package/.claude/commands/ant/import-signals.md +71 -0
  207. package/.claude/commands/ant/init.md +316 -191
  208. package/.claude/commands/ant/insert-phase.md +101 -0
  209. package/.claude/commands/ant/interpret.md +11 -0
  210. package/.claude/commands/ant/lay-eggs.md +167 -158
  211. package/.claude/commands/ant/maturity.md +22 -11
  212. package/.claude/commands/ant/memory-details.md +77 -0
  213. package/.claude/commands/ant/migrate-state.md +6 -0
  214. package/.claude/commands/ant/oracle.md +317 -62
  215. package/.claude/commands/ant/organize.md +10 -5
  216. package/.claude/commands/ant/patrol.md +620 -0
  217. package/.claude/commands/ant/pause-colony.md +8 -22
  218. package/.claude/commands/ant/phase.md +26 -37
  219. package/.claude/commands/ant/pheromones.md +156 -0
  220. package/.claude/commands/ant/plan.md +175 -52
  221. package/.claude/commands/ant/preferences.md +65 -0
  222. package/.claude/commands/ant/redirect.md +18 -0
  223. package/.claude/commands/ant/resume-colony.md +34 -20
  224. package/.claude/commands/ant/resume.md +51 -7
  225. package/.claude/commands/ant/run.md +195 -0
  226. package/.claude/commands/ant/seal.md +497 -78
  227. package/.claude/commands/ant/skill-create.md +286 -0
  228. package/.claude/commands/ant/status.md +127 -1
  229. package/.claude/commands/ant/swarm.md +11 -23
  230. package/.claude/commands/ant/tunnels.md +1 -0
  231. package/.claude/commands/ant/update.md +58 -135
  232. package/.claude/commands/ant/verify-castes.md +90 -42
  233. package/.claude/commands/ant/watch.md +1 -0
  234. package/.opencode/agents/aether-ambassador.md +1 -1
  235. package/.opencode/agents/aether-architect.md +133 -0
  236. package/.opencode/agents/aether-builder.md +3 -3
  237. package/.opencode/agents/aether-oracle.md +137 -0
  238. package/.opencode/agents/aether-queen.md +1 -1
  239. package/.opencode/agents/aether-route-setter.md +1 -1
  240. package/.opencode/agents/aether-scout.md +1 -1
  241. package/.opencode/agents/aether-surveyor-disciplines.md +6 -1
  242. package/.opencode/agents/aether-surveyor-nest.md +6 -1
  243. package/.opencode/agents/aether-surveyor-pathogens.md +6 -1
  244. package/.opencode/agents/aether-surveyor-provisions.md +6 -1
  245. package/.opencode/agents/aether-tracker.md +1 -1
  246. package/.opencode/agents/aether-watcher.md +1 -1
  247. package/.opencode/agents/aether-weaver.md +1 -1
  248. package/.opencode/commands/ant/archaeology.md +7 -14
  249. package/.opencode/commands/ant/build.md +54 -88
  250. package/.opencode/commands/ant/chaos.md +7 -24
  251. package/.opencode/commands/ant/colonize.md +8 -17
  252. package/.opencode/commands/ant/continue.md +595 -66
  253. package/.opencode/commands/ant/council.md +11 -22
  254. package/.opencode/commands/ant/data-clean.md +77 -0
  255. package/.opencode/commands/ant/dream.md +15 -17
  256. package/.opencode/commands/ant/entomb.md +28 -18
  257. package/.opencode/commands/ant/export-signals.md +54 -0
  258. package/.opencode/commands/ant/feedback.md +24 -5
  259. package/.opencode/commands/ant/flag.md +16 -4
  260. package/.opencode/commands/ant/flags.md +24 -10
  261. package/.opencode/commands/ant/focus.md +22 -5
  262. package/.opencode/commands/ant/help.md +41 -8
  263. package/.opencode/commands/ant/history.md +9 -0
  264. package/.opencode/commands/ant/import-signals.md +68 -0
  265. package/.opencode/commands/ant/init.md +365 -156
  266. package/.opencode/commands/ant/insert-phase.md +107 -0
  267. package/.opencode/commands/ant/interpret.md +16 -0
  268. package/.opencode/commands/ant/lay-eggs.md +184 -112
  269. package/.opencode/commands/ant/maturity.md +18 -2
  270. package/.opencode/commands/ant/memory-details.md +83 -0
  271. package/.opencode/commands/ant/migrate-state.md +12 -0
  272. package/.opencode/commands/ant/oracle.md +322 -67
  273. package/.opencode/commands/ant/organize.md +14 -12
  274. package/.opencode/commands/ant/patrol.md +626 -0
  275. package/.opencode/commands/ant/pause-colony.md +12 -29
  276. package/.opencode/commands/ant/phase.md +30 -40
  277. package/.opencode/commands/ant/pheromones.md +162 -0
  278. package/.opencode/commands/ant/plan.md +184 -56
  279. package/.opencode/commands/ant/preferences.md +71 -0
  280. package/.opencode/commands/ant/redirect.md +22 -5
  281. package/.opencode/commands/ant/resume-colony.md +38 -27
  282. package/.opencode/commands/ant/resume.md +71 -20
  283. package/.opencode/commands/ant/run.md +201 -0
  284. package/.opencode/commands/ant/seal.md +230 -25
  285. package/.opencode/commands/ant/skill-create.md +63 -0
  286. package/.opencode/commands/ant/status.md +124 -31
  287. package/.opencode/commands/ant/swarm.md +3 -345
  288. package/.opencode/commands/ant/tunnels.md +3 -9
  289. package/.opencode/commands/ant/update.md +63 -127
  290. package/.opencode/commands/ant/verify-castes.md +96 -42
  291. package/.opencode/commands/ant/watch.md +7 -0
  292. package/CHANGELOG.md +278 -1
  293. package/README.md +188 -340
  294. package/bin/cli.js +236 -429
  295. package/bin/generate-commands.js +186 -0
  296. package/bin/generate-commands.sh +128 -89
  297. package/bin/lib/spawn-logger.js +0 -15
  298. package/bin/lib/update-transaction.js +285 -35
  299. package/bin/npx-install.js +178 -0
  300. package/bin/validate-package.sh +85 -3
  301. package/package.json +7 -3
  302. package/.aether/CONTEXT.md +0 -160
  303. package/.aether/docs/QUEEN.md +0 -84
  304. package/.aether/exchange/colony-registry.xml +0 -11
  305. package/.aether/exchange/pheromones.xml +0 -87
  306. package/.aether/exchange/queen-wisdom.xml +0 -14
  307. package/.aether/model-profiles.yaml +0 -100
  308. package/.aether/utils/spawn-with-model.sh +0 -56
  309. package/bin/lib/model-profiles.js +0 -445
  310. package/bin/lib/model-verify.js +0 -288
  311. package/bin/lib/proxy-health.js +0 -253
  312. package/bin/lib/telemetry.js +0 -441
@@ -0,0 +1,469 @@
1
+ name: "ant:init"
2
+ description: "Initialize Aether colony - scan repo, approve charter, create colony"
3
+ body: |
4
+ You are the **Queen Ant Colony**. Initialize the colony with the Queen's intention.
5
+
6
+ ## Instructions
7
+
8
+ The user's goal is: `{{ARGUMENTS}}`
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
+ {{#opencode}}
15
+ Note: Use `$normalized_args` instead of `$ARGUMENTS` throughout this command.
16
+
17
+ ### Step 0: Initialize Visual Mode (if enabled)
18
+
19
+ If `visual_mode` is true:
20
+ {{/opencode}}
21
+
22
+ <failure_modes>
23
+ ### Colony State Overwrite
24
+ Re-init mode detects existing COLONY_STATE.json and preserves all state. Charter content is updated in-place via charter-write. Colony state, wisdom, instincts, learnings, pheromones, and phase progress are never reset.
25
+
26
+ ### Write Failure Mid-Init
27
+ If writing COLONY_STATE.json fails partway:
28
+ - Remove the incomplete file (partial state is worse than no state)
29
+ - Report the error
30
+ - Recovery: user can run /ant:init again safely
31
+ </failure_modes>
32
+
33
+ <success_criteria>
34
+ Command is complete when:
35
+ - User has approved the charter prompt (Charter, Context, Pheromones sections)
36
+ - Charter content is written to QUEEN.md via charter-write
37
+ - COLONY_STATE.json exists and is valid JSON (fresh init only)
38
+ - Session file is written
39
+ - User sees confirmation of colony creation or re-init
40
+ </success_criteria>
41
+
42
+ <read_only>
43
+ Do not touch during init:
44
+ - .aether/dreams/ (user notes)
45
+ - .aether/chambers/ (archived colonies)
46
+ - .env* files
47
+ - .claude/settings.json
48
+ - .github/workflows/
49
+ </read_only>
50
+
51
+ ### Step 1: Validate Input
52
+
53
+ If `{{ARGUMENTS}}` is empty or blank, output:
54
+
55
+ ```
56
+ Aether Colony
57
+
58
+ Initialize the colony with a goal. This scans the repo, generates
59
+ a charter for your approval, then creates colony files.
60
+
61
+ Usage: /ant:init "<your goal here>"
62
+
63
+ Examples:
64
+ /ant:init "Build a REST API with authentication"
65
+ /ant:init "Create a soothing sound application"
66
+ /ant:init "Design a calculator CLI tool"
67
+ ```
68
+
69
+ Stop here. Do not proceed.
70
+
71
+ ### Step 1.5: Verify Aether Setup
72
+
73
+ Check if `.aether/aether-utils.sh` exists using the Read tool.
74
+
75
+ **If the file already exists** -- skip this step entirely. Aether is set up.
76
+
77
+ **If the file does NOT exist:**
78
+ ```
79
+ Aether is not set up in this repo yet.
80
+
81
+ Run /ant:lay-eggs first to create the .aether/ directory
82
+ with all system files, then run /ant:init "your goal" to
83
+ start a colony.
84
+
85
+ If the global hub isn't installed either:
86
+ npm install -g aether-colony (installs the hub)
87
+ /ant:lay-eggs (sets up this repo)
88
+ /ant:init "your goal" (starts the colony)
89
+ ```
90
+ Stop here. Do not proceed.
91
+
92
+ ### Step 2: Initialize QUEEN.md
93
+
94
+ {{TOOL_PREFIX "Initializing QUEEN.md..."}}
95
+ ```
96
+ bash .aether/aether-utils.sh queen-init
97
+ ```
98
+
99
+ Parse the JSON result:
100
+ - If `created` is true: Display `QUEEN.md initialized`
101
+ - If `created` is false and `reason` is "already_exists": Display `QUEEN.md already exists`
102
+
103
+ This step is non-blocking -- proceed regardless of outcome.
104
+
105
+ ### Step 3: Scan Repository
106
+
107
+ Run the scan via Bash tool:
108
+ ```bash
109
+ scan_result=$(bash .aether/aether-utils.sh init-research 2>/dev/null)
110
+ scan_data=$(echo "$scan_result" | jq '.result')
111
+ ```
112
+
113
+ Extract fields with jq defaults for missing data:
114
+ - `tech_langs`: `.tech_stack.languages | if length > 0 then join(", ") else "not detected" end`
115
+ - `tech_fwks`: `.tech_stack.frameworks | if length > 0 then join(", ") else "none" end`
116
+ - `tech_pkg`: `.tech_stack.package_managers | join(", ")`
117
+ - `complexity`: `.complexity.size`
118
+ - `file_count`: `.complexity.metrics.file_count`
119
+ - `top_dirs`: `.directory_structure.top_level_dirs | if . and length > 0 then join(", ") else "flat" end`
120
+ - `commit_count`: `.git_history.commit_count // "unknown"`
121
+ - `is_git`: `.git_history.is_git_repo // false`
122
+ - `survey_suggestion`: `.survey_status.suggestion.reason // empty`
123
+ - `has_active`: `.prior_colonies.has_active_colony // false`
124
+ - `active_goal`: `.prior_colonies.active_goal // empty`
125
+
126
+ **Intelligence fields (new):**
127
+ - `colony_context_colonies`: `.colony_context.prior_colonies // []` -- array of prior colony summaries (each has goal, phases, outcome, summary)
128
+ - `colony_context_charter`: `.colony_context.existing_charter // {}` -- existing charter content from QUEEN.md
129
+ - `governance_rules`: `.governance.rules // []` -- array of governance rule objects (each has rule, source, strength)
130
+ - `pheromone_suggestions`: `.pheromone_suggestions // []` -- array of suggestion objects (each has type, content, reason, priority)
131
+
132
+ If `scan_result` is empty or `jq` fails, set all fields to fallback values (empty arrays/objects for intelligence fields) and proceed (graceful degradation -- never stop init because scan fails).
133
+
134
+ ### Step 4: Detect Re-Init Mode
135
+
136
+ Use Read tool to check `.aether/data/COLONY_STATE.json`.
137
+
138
+ - If file exists AND has a non-null `goal` field: set `reinit_mode = true`, store `existing_goal`
139
+ - Otherwise: set `reinit_mode = false`
140
+
141
+ If re-init mode, read existing charter entries from `.aether/QUEEN.md`:
142
+ ```bash
143
+ existing_intent=$(grep '\[charter\] \*\*Intent\*\*:' .aether/QUEEN.md 2>/dev/null | sed 's/.*\*\*Intent\*\*: //' | sed 's/ (Colony:.*//' || true)
144
+ existing_vision=$(grep '\[charter\] \*\*Vision\*\*:' .aether/QUEEN.md 2>/dev/null | sed 's/.*\*\*Vision\*\*: //' | sed 's/ (Colony:.*//' || true)
145
+ existing_governance=$(grep '\[charter\] \*\*Governance\*\*:' .aether/QUEEN.md 2>/dev/null | sed 's/.*\*\*Governance\*\*: //' | sed 's/ (Colony:.*//' || true)
146
+ existing_goals=$(grep '\[charter\] \*\*Goal\*\*:' .aether/QUEEN.md 2>/dev/null | sed 's/.*\*\*Goal\*\*: //' | sed 's/ (Colony:.*//' || true)
147
+ ```
148
+
149
+ Strip `(Colony: ...)` suffixes using sed. If grep finds nothing, variables remain empty.
150
+
151
+ ### Step 5: Assemble and Display Approval Prompt
152
+
153
+ Display a brief header:
154
+ ```
155
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
156
+ A E T H E R C O L O N Y I N I T
157
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
+ ```
159
+
160
+ If re-init mode, display:
161
+ ```
162
+ Re-init mode detected (existing goal: "{existing_goal}")
163
+ Charter will be updated. All colony state, wisdom, instincts, and progress will be preserved.
164
+ ```
165
+
166
+ Then display the approval prompt as formatted Markdown. Section ordering: Prior Context (if any) -> Charter -> Context -> Pheromones.
167
+
168
+ **Section 1: Prior Context (conditional -- only when prior colonies exist)**
169
+
170
+ If `colony_context_colonies` has entries (length > 0), display:
171
+ ```markdown
172
+ ## Prior Context
173
+
174
+ Previous colonies in this repo:
175
+
176
+ {For each colony (max 3, most recent first):}
177
+ - **{goal}** -- {outcome} ({phases} phases){if summary is non-empty: ". {summary}"}
178
+ ```
179
+
180
+ Per locked decision: when no prior colonies exist, omit this section entirely. No placeholder, no header.
181
+
182
+ Keep each colony to 1-2 lines. Show goal, outcome (milestone), phase count, and summary from CROWNED-ANTHILL.md if available.
183
+
184
+ **Section 2: Charter**
185
+ ```markdown
186
+ ## Charter
187
+
188
+ **Intent:** {user's goal from {{ARGUMENTS}}, or existing_intent if re-init}
189
+ **Vision:** {derived from user's goal by Claude, or existing_vision if re-init}
190
+ **Governance:** {see governance logic below}
191
+ **Goals:** {blank for fresh init, or existing_goals if re-init}
192
+ ```
193
+
194
+ For fresh init, Claude should derive a brief Vision from the user's goal (1-2 sentences). Goals start blank. The user fills them in if desired.
195
+
196
+ **Governance field logic:**
197
+ - For fresh init with `governance_rules` available (length > 0): pre-populate with semicolon-separated rule text from the detected rules. Format: `"TDD required; ESLint enforced; Follow CONTRIBUTING.md"`. These are editable by the user.
198
+ - For fresh init with no governance_rules: leave blank.
199
+ - For re-init with existing_governance non-empty: pre-populate from existing QUEEN.md charter entries.
200
+ - For re-init with existing_governance empty but governance_rules available: pre-populate from governance_rules.
201
+
202
+ For re-init, pre-populate Intent, Vision, and Goals from existing QUEEN.md charter entries.
203
+
204
+ **Section 3: Context**
205
+ ```markdown
206
+ ## Context
207
+
208
+ **Tech Stack:** {tech_langs} | {tech_fwks} | {tech_pkg}
209
+ **Project Size:** {complexity} ({file_count} files)
210
+ **Structure:** {top_dirs}
211
+ **Git:** {commit_count} commits
212
+ {if survey_suggestion: **Note:** {survey_suggestion}}
213
+ ```
214
+
215
+ **Section 4: Pheromones**
216
+
217
+ If `pheromone_suggestions` has entries (length > 0), display:
218
+ ```markdown
219
+ ## Pheromones
220
+
221
+ Suggested signals based on repo analysis:
222
+
223
+ 1. [FOCUS] Testing infrastructure present (47 test files) -- maintain TDD discipline
224
+ 2. [REDIRECT] Environment files detected -- never commit secrets or .env files
225
+ 3. [FOCUS] Code quality tools configured -- follow existing lint/format rules
226
+
227
+ Edit, remove, or add signals as needed. Approved signals will be auto-applied.
228
+ ```
229
+
230
+ The numbered list uses the actual type and content from `pheromone_suggestions`. Each line format: `{N}. [{type}] {content}`.
231
+
232
+ Per locked decision: suggestions are fully editable. User can reword, remove, or add their own.
233
+ Per locked decision: all sections look the same -- no visual distinction between auto-generated and user-written content.
234
+
235
+ If no pheromone suggestions available (empty array), display the existing default:
236
+ ```markdown
237
+ ## Pheromones
238
+
239
+ No pheromone suggestions yet -- use /ant:focus and /ant:redirect to guide the colony.
240
+ ```
241
+
242
+ End with clear instructions:
243
+ ```
244
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
245
+ Review the prompt above. You can:
246
+ - Edit any section (just describe your changes)
247
+ - Say "approve" or "looks good" to proceed
248
+ - Say "cancel" to abort
249
+
250
+ If you don't respond, the colony will not be initialized.
251
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
252
+ ```
253
+
254
+ **STOP HERE.** Wait for the user's response. Do NOT proceed to Step 6 until the user responds.
255
+
256
+ ### Step 6: Handle User Response
257
+
258
+ Parse the user's response:
259
+ - If the user approves (says "approve", "looks good", "yes", "ok", or similar): proceed to Step 7
260
+ - If the user provides edits: apply the edits to the relevant section(s), re-display the full prompt, increment a revision counter, and wait again
261
+ - If the user cancels: display "Colony initialization cancelled." and stop
262
+ - Max 2 revision rounds. After 2 rejections/edits, display: "Maximum revisions reached. Approve current version, or cancel init?" and wait for final decision
263
+
264
+ When applying edits, Claude updates the section content in memory (not files) and re-displays the full prompt. Each re-display includes a revision counter: "(Revision {N}/2)"
265
+
266
+ ### Step 7: Create Colony (Post-Approval)
267
+
268
+ Only reached after user approval. ALL file writes happen here.
269
+
270
+ **If re-init mode:**
271
+
272
+ 1. Write charter content via:
273
+ ```bash
274
+ bash .aether/aether-utils.sh charter-write --intent "{approved_intent}" --vision "{approved_vision}" --governance "{approved_governance}" --goals "{approved_goals}"
275
+ ```
276
+
277
+ 2. Auto-apply approved pheromone suggestions (see pheromone auto-apply below).
278
+
279
+ 3. Optionally update the goal field in COLONY_STATE.json in-place:
280
+ ```bash
281
+ jq --arg new_goal "{approved_intent}" '.goal = $new_goal' .aether/data/COLONY_STATE.json > .aether/data/COLONY_STATE.json.tmp && mv .aether/data/COLONY_STATE.json.tmp .aether/data/COLONY_STATE.json
282
+ ```
283
+
284
+ 4. Run `bash .aether/aether-utils.sh session-init "$(jq -r '.session_id' .aether/data/COLONY_STATE.json)" "{approved_intent}"`
285
+
286
+ 5. Skip to Step 8 (display result). Do NOT write COLONY_STATE.json from template, do NOT write constraints.json, do NOT write pheromones.json.
287
+
288
+ **If fresh init:**
289
+
290
+ 1. Initialize QUEEN.md (already done in Step 2)
291
+ 2. Write charter content via charter-write (same command as above)
292
+ 3. Auto-apply approved pheromone suggestions (see pheromone auto-apply below).
293
+ 4. Write COLONY_STATE.json from template:
294
+ - Generate a session ID in the format `session_{unix_timestamp}_{random}` and an ISO-8601 UTC timestamp
295
+ - Resolve template: check `~/.aether/system/templates/colony-state.template.json` first, then `.aether/templates/colony-state.template.json`
296
+ - If no template found: output "Template missing: colony-state.template.json. Run aether update to fix." and stop
297
+ - Read the template file. Follow its `_instructions` field
298
+ - Replace placeholders: `__GOAL__` with approved intent, `__SESSION_ID__` with generated session ID, `__ISO8601_TIMESTAMP__` with current timestamp, `__PHASE_LEARNINGS__` with `[]`, `__INSTINCTS__` with `[]`
299
+ - Remove ALL keys starting with underscore
300
+ - Write the resulting JSON to `.aether/data/COLONY_STATE.json` using the Write tool
301
+
302
+ 5. Write constraints.json from template:
303
+ - Resolve template: check `~/.aether/system/templates/constraints.template.json` first, then `.aether/templates/constraints.template.json`
304
+ - If no template found: output "Template missing: constraints.template.json. Run aether update to fix." and stop
305
+ - Read template, follow `_instructions`, remove `_` prefixed keys, write to `.aether/data/constraints.json`
306
+
307
+ 6. Initialize runtime files from templates (non-blocking):
308
+ ```bash
309
+ for template in pheromones midden learning-observations; do
310
+ if [[ "$template" == "midden" ]]; then
311
+ target=".aether/data/midden/midden.json"
312
+ else
313
+ target=".aether/data/${template}.json"
314
+ fi
315
+ if [[ ! -f "$target" ]]; then
316
+ template_file=""
317
+ for path in ~/.aether/system/templates/${template}.template.json .aether/templates/${template}.template.json; do
318
+ if [[ -f "$path" ]]; then
319
+ template_file="$path"
320
+ break
321
+ fi
322
+ done
323
+ if [[ -n "$template_file" ]]; then
324
+ jq 'with_entries(select(.key | startswith("_") | not))' "$template_file" > "$target" 2>/dev/null || true
325
+ fi
326
+ fi
327
+ done
328
+ ```
329
+
330
+ 7. Run `bash .aether/aether-utils.sh context-update init "{approved_intent}"`
331
+ 8. Run `bash .aether/aether-utils.sh validate-state colony`
332
+ 9. Register repo (silent on failure):
333
+ ```bash
334
+ domain_tags=$(bash .aether/aether-utils.sh domain-detect 2>/dev/null | jq -r '.result.tags // ""' || echo "")
335
+ bash .aether/aether-utils.sh registry-add "$(pwd)" "$(jq -r '.version // "unknown"' ~/.aether/version.json 2>/dev/null || echo 'unknown')" --goal "{approved_intent}" --active true --tags "$domain_tags" 2>/dev/null || true
336
+ cp ~/.aether/version.json .aether/version.json 2>/dev/null || true
337
+ ```
338
+ 10. Seed QUEEN.md from hive (non-blocking):
339
+ ```bash
340
+ domain_tags=$(jq -r --arg repo "$(pwd)" \
341
+ '[.repos[] | select(.path == $repo) | .domain_tags // []] | .[0] // [] | join(",")' \
342
+ "$HOME/.aether/registry.json" 2>/dev/null || echo "")
343
+ seed_args="queen-seed-from-hive --limit 5"
344
+ [[ -n "$domain_tags" ]] && seed_args="$seed_args --domain $domain_tags"
345
+ seed_result=$(bash .aether/aether-utils.sh $seed_args 2>/dev/null || echo '{}')
346
+ seeded_count=$(echo "$seed_result" | jq -r '.result.seeded // 0' 2>/dev/null || echo "0")
347
+ ```
348
+ 11. Run `bash .aether/aether-utils.sh session-init "{session_id}" "{approved_intent}"`
349
+
350
+ **Pheromone auto-apply (referenced by both re-init and fresh init paths above):**
351
+
352
+ If approved pheromone suggestions exist (the user kept them in the prompt and didn't remove them during the approval loop):
353
+
354
+ For each approved pheromone suggestion, call:
355
+ ```bash
356
+ bash .aether/aether-utils.sh pheromone-write "{type}" '{content}' --source "system:init" --reason '{reason}' --ttl "30d" 2>/dev/null || true
357
+ ```
358
+
359
+ Implementation notes:
360
+ - Claude (the LLM executing init.md) tracks which pheromones the user kept, edited, or removed during the approval loop (Step 6). Only emit pheromones that survived approval.
361
+ - Use single quotes around pheromone content and reason to avoid shell metacharacter issues (per pitfall 4).
362
+ - Each `pheromone-write` call uses `2>/dev/null || true` to make it non-blocking -- a failed write should never stop colony creation.
363
+ - The `--source "system:init"` tag identifies these as init-derived pheromones.
364
+ - The `--ttl "30d"` gives suggestions a 30-day lifespan (project-level conventions, not phase-specific).
365
+ - `pheromone-write` handles deduplication via content hashing -- if a signal with the same content already exists, it will reinforce rather than duplicate.
366
+
367
+ ### Step 7.5: Import Previous Colony Data (optional)
368
+
369
+ Check if previous colony chambers contain importable XML data:
370
+
371
+ ```bash
372
+ # Find most recent chamber with XML files (per D-07)
373
+ latest_chamber=$(ls -d .aether/chambers/20* 2>/dev/null | sort -r | head -1)
374
+ xml_import_available=false
375
+ import_summary=""
376
+
377
+ if [[ -n "$latest_chamber" ]]; then
378
+ xml_count=$(find "$latest_chamber" -maxdepth 1 -name "*.xml" ! -name "colony-archive.xml" 2>/dev/null | wc -l | tr -d ' ')
379
+ if [[ "$xml_count" -gt 0 ]] && command -v xmllint >/dev/null 2>&1; then
380
+ xml_import_available=true
381
+ chamber_name=$(basename "$latest_chamber")
382
+ # Count importable items for display
383
+ signal_count=$(jq '.signals | length' "$latest_chamber/pheromones.json" 2>/dev/null || echo "0")
384
+ import_summary="Found ${signal_count} signal(s) and ${xml_count} XML file(s) from colony '${chamber_name}'"
385
+ fi
386
+ fi
387
+ ```
388
+
389
+ **If xml_import_available is true:**
390
+
391
+ Display the import offer (per D-08):
392
+ ```
393
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
394
+ PREVIOUS COLONY DATA FOUND
395
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
396
+
397
+ {import_summary}
398
+
399
+ Import signals and wisdom from this colony?
400
+ This will add to (not replace) your current colony data.
401
+
402
+ Import? (yes/no)
403
+ ```
404
+
405
+ Use `AskUserQuestion` with yes/no options.
406
+
407
+ **If user selects "yes":**
408
+
409
+ Import ALL available data types (per D-09 -- no cherry-picking):
410
+
411
+ ```bash
412
+ # Import pheromones (per D-09)
413
+ if [[ -f "$latest_chamber/pheromones.xml" ]]; then
414
+ pher_import=$(bash .aether/aether-utils.sh pheromone-import-xml "$latest_chamber/pheromones.xml" "imported" 2>/dev/null || echo '{"ok":false}')
415
+ pher_imported=$(echo "$pher_import" | jq -r '.result.imported // 0' 2>/dev/null || echo "0")
416
+ echo "Pheromones: ${pher_imported} signal(s) imported"
417
+ fi
418
+
419
+ # Import wisdom to queen-wisdom.json (per D-09)
420
+ if [[ -f "$latest_chamber/queen-wisdom.xml" ]]; then
421
+ wis_import=$(bash .aether/aether-utils.sh wisdom-import-xml "$latest_chamber/queen-wisdom.xml" ".aether/data/queen-wisdom.json" 2>/dev/null || echo '{"ok":false}')
422
+ wis_imported=$(echo "$wis_import" | jq -r '.result.imported // 0' 2>/dev/null || echo "0")
423
+ echo "Wisdom: ${wis_imported} entries(s) imported to queen-wisdom.json"
424
+ fi
425
+
426
+ # Import registry lineage (per D-09)
427
+ if [[ -f "$latest_chamber/colony-registry.xml" ]]; then
428
+ reg_import=$(bash .aether/aether-utils.sh registry-import-xml "$latest_chamber/colony-registry.xml" 2>/dev/null || echo '{"ok":false}')
429
+ reg_imported=$(echo "$reg_import" | jq -r '.result.imported // 0' 2>/dev/null || echo "0")
430
+ echo "Registry: ${reg_imported} colon(ies) lineage imported"
431
+ fi
432
+ ```
433
+
434
+ All imports are non-blocking -- log warning and continue if any fails.
435
+
436
+ **If user selects "no":**
437
+
438
+ Display "Import skipped. Starting fresh colony." and proceed to Step 8.
439
+
440
+ **If xml_import_available is false (no chambers, no XML, or no xmllint):**
441
+
442
+ Skip silently -- proceed directly to Step 8 without any mention of import (per D-11).
443
+ ### Step 8: Display Result
444
+
445
+ Display the success header and result block:
446
+
447
+ ```
448
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
449
+ A E T H E R C O L O N Y
450
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
451
+
452
+ Queen has set the colony's intention
453
+
454
+ "{approved_intent}"
455
+
456
+ Colony Status: READY
457
+
458
+ {If re-init: " Mode: Re-init (charter updated, state preserved)"}
459
+ {If fresh and seeded_count > 0: " Hive wisdom: {seeded_count} cross-colony pattern(s) seeded into QUEEN.md"}
460
+
461
+ State persisted -- safe to /clear, then run /ant:plan
462
+
463
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
464
+ Next Up
465
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
466
+ /ant:plan Generate execution plan
467
+ /ant:status Check colony state
468
+ /ant:focus Set initial focus
469
+ ```
@@ -0,0 +1,98 @@
1
+ name: "ant:insert-phase"
2
+ description: "➕🐜 Insert a corrective phase into the active plan"
3
+ body: |
4
+ You are the **Queen**. Insert a new corrective phase without forcing the user to provide flags.
5
+
6
+ ## Instructions
7
+
8
+ ### Step 1: Validate Colony State
9
+
10
+ Read `.aether/data/COLONY_STATE.json`.
11
+
12
+ If `goal` is null:
13
+ `No colony initialized. Run /ant:init first.`
14
+ Stop.
15
+
16
+ If `plan.phases` is empty:
17
+ `No project plan. Run /ant:plan first.`
18
+ Stop.
19
+
20
+ Determine:
21
+ - `current_phase`
22
+ - `total_phases`
23
+ - `current_phase_name` (if available)
24
+
25
+ ### Step 2: Collect Minimal Input
26
+
27
+ This command is designed to work with no arguments.
28
+
29
+ If `{{ARGUMENTS}}` is non-empty:
30
+ - Use `{{ARGUMENTS}}` as the issue summary.
31
+ - Skip the first question.
32
+
33
+ Otherwise ask:
34
+ ```text
35
+ What is not working and needs a corrective phase?
36
+ ```
37
+
38
+ Then ask:
39
+ ```text
40
+ What should the inserted phase accomplish?
41
+ ```
42
+
43
+ Then ask (optional):
44
+ ```text
45
+ Any hard constraints to enforce while fixing this? (or say "none")
46
+ ```
47
+
48
+ If constraints answer is `none` (case-insensitive), treat constraints as empty.
49
+
50
+ ### Step 3: Derive Phase Name
51
+
52
+ Create a concise phase name from the user goal:
53
+ - Start with `Stabilize`
54
+ - Add a short noun phrase from the goal (max 6 words)
55
+ - Keep under 80 characters
56
+
57
+ Example:
58
+ - Goal: `Fix retry flow and stop duplicate requests`
59
+ - Name: `Stabilize retry flow and duplicate requests`
60
+
61
+ ### Step 4: Insert Phase Safely
62
+
63
+ {{TOOL_PREFIX "Inserting corrective phase..."}}
64
+
65
+ ```bash
66
+ bash .aether/aether-utils.sh phase-insert "<phase_name>" "<goal_text>" "<constraints_text>"
67
+ ```
68
+
69
+ Parse JSON result:
70
+ - If `ok != true`, display error and stop.
71
+ - Extract `inserted_phase_id` and `after_phase`.
72
+
73
+ ### Step 5: Confirm Outcome
74
+
75
+ Display:
76
+
77
+ ```text
78
+ Inserted corrective phase successfully.
79
+ New phase: <inserted_phase_id> — <phase_name>
80
+ Inserted after phase: <after_phase>
81
+ Goal: <goal_text>
82
+ ```
83
+
84
+ If constraints were provided, also display:
85
+ ```text
86
+ Constraints captured: <constraints_text>
87
+ ```
88
+
89
+ ### Step 6: Next Up
90
+
91
+ Show:
92
+
93
+ ```text
94
+ Next steps:
95
+ /ant:phase <inserted_phase_id> Review inserted phase details
96
+ /ant:build <inserted_phase_id> Execute corrective phase
97
+ /ant:status Verify updated plan state
98
+ ```