aether-colony 3.1.4 → 3.1.15

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 (124) hide show
  1. package/.claude/commands/ant/archaeology.md +12 -0
  2. package/.claude/commands/ant/build.md +382 -319
  3. package/.claude/commands/ant/chaos.md +23 -1
  4. package/.claude/commands/ant/colonize.md +147 -87
  5. package/.claude/commands/ant/continue.md +213 -23
  6. package/.claude/commands/ant/council.md +22 -0
  7. package/.claude/commands/ant/dream.md +18 -0
  8. package/.claude/commands/ant/entomb.md +178 -6
  9. package/.claude/commands/ant/init.md +87 -13
  10. package/.claude/commands/ant/lay-eggs.md +45 -5
  11. package/.claude/commands/ant/oracle.md +82 -9
  12. package/.claude/commands/ant/organize.md +2 -2
  13. package/.claude/commands/ant/pause-colony.md +86 -28
  14. package/.claude/commands/ant/phase.md +26 -0
  15. package/.claude/commands/ant/plan.md +204 -111
  16. package/.claude/commands/ant/resume-colony.md +23 -1
  17. package/.claude/commands/ant/resume.md +159 -0
  18. package/.claude/commands/ant/seal.md +177 -3
  19. package/.claude/commands/ant/swarm.md +78 -97
  20. package/.claude/commands/ant/verify-castes.md +7 -7
  21. package/.claude/commands/ant/watch.md +17 -0
  22. package/.opencode/agents/aether-ambassador.md +97 -0
  23. package/.opencode/agents/aether-archaeologist.md +91 -0
  24. package/.opencode/agents/aether-architect.md +66 -0
  25. package/.opencode/agents/aether-auditor.md +111 -0
  26. package/.opencode/agents/aether-builder.md +28 -10
  27. package/.opencode/agents/aether-chaos.md +98 -0
  28. package/.opencode/agents/aether-chronicler.md +80 -0
  29. package/.opencode/agents/aether-gatekeeper.md +107 -0
  30. package/.opencode/agents/aether-guardian.md +107 -0
  31. package/.opencode/agents/aether-includer.md +108 -0
  32. package/.opencode/agents/aether-keeper.md +106 -0
  33. package/.opencode/agents/aether-measurer.md +119 -0
  34. package/.opencode/agents/aether-probe.md +91 -0
  35. package/.opencode/agents/aether-queen.md +72 -19
  36. package/.opencode/agents/aether-route-setter.md +85 -0
  37. package/.opencode/agents/aether-sage.md +98 -0
  38. package/.opencode/agents/aether-scout.md +33 -15
  39. package/.opencode/agents/aether-surveyor-disciplines.md +334 -0
  40. package/.opencode/agents/aether-surveyor-nest.md +272 -0
  41. package/.opencode/agents/aether-surveyor-pathogens.md +209 -0
  42. package/.opencode/agents/aether-surveyor-provisions.md +277 -0
  43. package/.opencode/agents/aether-tracker.md +91 -0
  44. package/.opencode/agents/aether-watcher.md +30 -12
  45. package/.opencode/agents/aether-weaver.md +87 -0
  46. package/.opencode/agents/workers.md +1034 -0
  47. package/.opencode/commands/ant/archaeology.md +44 -26
  48. package/.opencode/commands/ant/build.md +327 -295
  49. package/.opencode/commands/ant/chaos.md +32 -4
  50. package/.opencode/commands/ant/colonize.md +119 -93
  51. package/.opencode/commands/ant/continue.md +98 -10
  52. package/.opencode/commands/ant/council.md +28 -0
  53. package/.opencode/commands/ant/dream.md +24 -0
  54. package/.opencode/commands/ant/entomb.md +73 -1
  55. package/.opencode/commands/ant/feedback.md +8 -2
  56. package/.opencode/commands/ant/flag.md +9 -3
  57. package/.opencode/commands/ant/flags.md +8 -2
  58. package/.opencode/commands/ant/focus.md +8 -2
  59. package/.opencode/commands/ant/help.md +12 -0
  60. package/.opencode/commands/ant/init.md +49 -4
  61. package/.opencode/commands/ant/lay-eggs.md +30 -2
  62. package/.opencode/commands/ant/oracle.md +39 -7
  63. package/.opencode/commands/ant/organize.md +9 -3
  64. package/.opencode/commands/ant/pause-colony.md +54 -1
  65. package/.opencode/commands/ant/phase.md +36 -4
  66. package/.opencode/commands/ant/plan.md +225 -117
  67. package/.opencode/commands/ant/redirect.md +8 -2
  68. package/.opencode/commands/ant/resume-colony.md +51 -26
  69. package/.opencode/commands/ant/seal.md +76 -0
  70. package/.opencode/commands/ant/status.md +50 -20
  71. package/.opencode/commands/ant/swarm.md +108 -104
  72. package/.opencode/commands/ant/tunnels.md +107 -2
  73. package/CHANGELOG.md +21 -0
  74. package/README.md +199 -86
  75. package/bin/cli.js +142 -25
  76. package/bin/generate-commands.sh +100 -16
  77. package/bin/lib/caste-colors.js +5 -5
  78. package/bin/lib/errors.js +16 -0
  79. package/bin/lib/file-lock.js +279 -44
  80. package/bin/lib/state-sync.js +206 -23
  81. package/bin/lib/update-transaction.js +206 -24
  82. package/bin/sync-to-runtime.sh +129 -0
  83. package/package.json +2 -2
  84. package/runtime/CONTEXT.md +160 -0
  85. package/runtime/aether-utils.sh +1421 -55
  86. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +1343 -0
  87. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +2642 -0
  88. package/runtime/docs/PHEROMONE-INJECTION.md +240 -0
  89. package/runtime/docs/PHEROMONE-INTEGRATION.md +192 -0
  90. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +426 -0
  91. package/runtime/docs/README.md +94 -0
  92. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +219 -0
  93. package/runtime/docs/biological-reference.md +272 -0
  94. package/runtime/docs/codebase-review.md +399 -0
  95. package/runtime/docs/command-sync.md +164 -0
  96. package/runtime/docs/implementation-learnings.md +89 -0
  97. package/runtime/docs/known-issues.md +217 -0
  98. package/runtime/docs/namespace.md +148 -0
  99. package/runtime/docs/planning-discipline.md +159 -0
  100. package/runtime/lib/queen-utils.sh +729 -0
  101. package/runtime/model-profiles.yaml +100 -0
  102. package/runtime/recover.sh +136 -0
  103. package/runtime/templates/QUEEN.md.template +79 -0
  104. package/runtime/utils/atomic-write.sh +5 -5
  105. package/runtime/utils/chamber-utils.sh +6 -3
  106. package/runtime/utils/error-handler.sh +200 -0
  107. package/runtime/utils/queen-to-md.xsl +395 -0
  108. package/runtime/utils/spawn-tree.sh +428 -0
  109. package/runtime/utils/spawn-with-model.sh +56 -0
  110. package/runtime/utils/state-loader.sh +215 -0
  111. package/runtime/utils/swarm-display.sh +5 -5
  112. package/runtime/utils/watch-spawn-tree.sh +90 -22
  113. package/runtime/utils/xml-compose.sh +247 -0
  114. package/runtime/utils/xml-core.sh +186 -0
  115. package/runtime/utils/xml-utils.sh +2161 -0
  116. package/runtime/verification-loop.md +1 -1
  117. package/runtime/workers-new-castes.md +516 -0
  118. package/runtime/workers.md +20 -8
  119. package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
  120. package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
  121. package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
  122. package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
  123. package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
  124. package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
@@ -29,13 +29,13 @@ Where builders create with optimism and watchers verify the happy path, you inve
29
29
 
30
30
  ## Target
31
31
 
32
- The user specifies what to investigate via `$ARGUMENTS`:
32
+ The user specifies what to investigate via `$normalized_args`:
33
33
 
34
34
  - **File path:** e.g., `src/auth/login.ts` — investigate that specific file
35
35
  - **Module name:** e.g., `authentication` — investigate that module/domain
36
36
  - **Feature description:** e.g., `user signup flow` — investigate that feature area
37
37
 
38
- **If `$ARGUMENTS` is empty or not provided, display usage and stop:**
38
+ **If `$normalized_args` is empty or not provided, display usage and stop:**
39
39
 
40
40
  ```
41
41
  🎲🐜🔍🐜🎲 CHAOS ANT — Resilience Tester
@@ -60,6 +60,28 @@ Categories tested:
60
60
 
61
61
  ## Instructions
62
62
 
63
+ ### Step -1: Normalize Arguments
64
+
65
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
66
+
67
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
68
+
69
+ Parse `$normalized_args`:
70
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
71
+ - Otherwise: set `visual_mode = true`
72
+
73
+ ### Step 0: Initialize Visual Mode (if enabled)
74
+
75
+ If `visual_mode` is true:
76
+ ```bash
77
+ # Generate session ID
78
+ chaos_id="chaos-$(date +%s)"
79
+
80
+ # Initialize swarm display
81
+ bash .aether/aether-utils.sh swarm-display-init "$chaos_id"
82
+ bash .aether/aether-utils.sh swarm-display-update "Chaos Ant" "chaos" "excavating" "Probing for weaknesses" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
83
+ ```
84
+
63
85
  ### Step 1: Awaken — Load Context
64
86
 
65
87
  Read these files in parallel to understand the colony and codebase:
@@ -69,14 +91,14 @@ Read these files in parallel to understand the colony and codebase:
69
91
  - `.aether/data/constraints.json` — active constraints and focus areas
70
92
 
71
93
  **Target identification:**
72
- - Parse `$ARGUMENTS` to determine the target
94
+ - Parse `$normalized_args` to determine the target
73
95
  - If it looks like a file path, verify it exists with Read. If it does not exist, search with Glob for the closest match.
74
96
  - If it looks like a module/feature name, use Grep and Glob to locate relevant files
75
97
  - Build a list of target files to investigate (aim for 1-5 core files)
76
98
 
77
99
  **If no relevant files can be found for the target:**
78
100
  ```
79
- 🎲 Chaos Ant cannot locate target: $ARGUMENTS
101
+ 🎲 Chaos Ant cannot locate target: $normalized_args
80
102
  Searched for matching files and modules but found nothing.
81
103
  Please provide a valid file path, module name, or feature description.
82
104
  ```
@@ -206,6 +228,12 @@ For each scenario, produce a finding in this format. Display each to the termina
206
228
 
207
229
  ### Step 5: Produce the Chaos Report
208
230
 
231
+ **If visual_mode is true, render final swarm display:**
232
+ ```bash
233
+ bash .aether/aether-utils.sh swarm-display-update "Chaos Ant" "chaos" "completed" "Resilience test complete" "Colony" '{"read":8,"grep":4,"edit":0,"bash":3}' 100 "fungus_garden" 100
234
+ bash .aether/aether-utils.sh swarm-display-render "$chaos_id"
235
+ ```
236
+
209
237
  After all 5 scenarios, compile the structured report:
210
238
 
211
239
  ```
@@ -1,12 +1,45 @@
1
1
  ---
2
2
  name: ant:colonize
3
- description: "🔍🐜🗺️🐜🔍 Analyze codebase and prepare for colony work"
3
+ description: "📊🐜🗺️🐜📊 Survey territory with 4 parallel scouts for comprehensive colony intelligence"
4
4
  ---
5
5
 
6
- You are the **Queen**. Perform initial codebase analysis.
6
+ You are the **Queen**. Dispatch Surveyor Ants to map the territory.
7
+
8
+ The arguments are: `$normalized_args`
9
+
10
+ **Parse arguments:**
11
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
12
+ - Otherwise: set `visual_mode = true`
7
13
 
8
14
  ## Instructions
9
15
 
16
+ ### Step -1: Normalize Arguments
17
+
18
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
19
+
20
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
21
+
22
+ ### Step 0: Initialize Visual Mode (if enabled)
23
+
24
+ If `visual_mode` is true:
25
+ ```bash
26
+ # Generate session ID
27
+ colonize_id="colonize-$(date +%s)"
28
+
29
+ # Initialize swarm display
30
+ bash .aether/aether-utils.sh swarm-display-init "$colonize_id"
31
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "dispatching" "Surveying territory" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
32
+ ```
33
+
34
+ Display header:
35
+ ```
36
+ 📊🐜🗺️🐜📊 ═══════════════════════════════════════════════
37
+ C O L O N I Z E — T e r r i t o r y S u r v e y
38
+ ═══════════════════════════════════════════════ 📊🐜🗺️🐜📊
39
+
40
+ Queen dispatching Surveyor Ants...
41
+ ```
42
+
10
43
  ### Step 1: Validate
11
44
 
12
45
  Read `.aether/data/COLONY_STATE.json`.
@@ -15,15 +48,15 @@ Read `.aether/data/COLONY_STATE.json`.
15
48
  1. Create `.aether/data/` directory if it does not exist.
16
49
  2. Write a minimal COLONY_STATE.json:
17
50
  `{"version": "3.0", "goal": null, "state": "IDLE", "current_phase": 0, "session_id": null, "initialized_at": null, "build_started_at": null, "plan": {"generated_at": null, "confidence": null, "phases": []}, "memory": {"phase_learnings": [], "decisions": [], "instincts": []}, "errors": {"records": [], "flagged_patterns": []}, "signals": [], "graveyards": [], "events": []}`
18
- 3. Output: "No colony state found. Bootstrapping minimal state for codebase analysis."
51
+ 3. Output: "No colony state found. Bootstrapping minimal state for territory survey."
19
52
 
20
- **If the file exists:** continue (colonize works with or without a goal).
53
+ **If the file exists:** continue.
21
54
 
22
55
  **If `plan.phases` is not empty:** output "Colony already has phases. Use /ant:continue.", stop.
23
56
 
24
- ### Step 2: Surface Scan
57
+ ### Step 2: Quick Surface Scan (for session context)
25
58
 
26
- Use Glob to find key files (read up to 20 total).
59
+ Use Glob to find key files (read up to 20 total) to provide context for the survey.
27
60
 
28
61
  **Package manifests:**
29
62
  - package.json, Cargo.toml, pyproject.toml, go.mod, Gemfile, pom.xml, build.gradle
@@ -37,107 +70,119 @@ Use Glob to find key files (read up to 20 total).
37
70
  **Config:**
38
71
  - tsconfig.json, .eslintrc.*, jest.config.*, vite.config.*, webpack.config.*
39
72
 
40
- Read found files. Extract:
41
- - Tech stack (language, framework, key dependencies)
73
+ Read found files. Extract basic info:
74
+ - Tech stack (language, framework)
42
75
  - Entry points (main files)
43
- - Key directories (src/, lib/, tests/, etc.)
44
- - File counts per top-level directory
45
-
46
- ### Step 2.5: Command Detection
47
-
48
- Detect build, test, type-check, and lint commands from two sources. Track each command with its source attribution (`claude_md` or `heuristic`).
49
-
50
- **Source 1 — CLAUDE.md (priority):**
51
-
52
- Read `CLAUDE.md` in the project root. If it does not exist, skip to Source 2.
53
- Scan for commands under headings matching: `Commands`, `Scripts`, `Development`, `Build`, `Testing`, `Lint`, or similar.
54
- Also extract inline code blocks containing patterns like `npm`, `npx`, `yarn`, `pnpm`, `cargo`, `go`, `pytest`, `make`, `gradle`, `mvn`.
55
- For each command found, store: `{ label, command, source: "claude_md" }`.
56
-
57
- **Source 2 — Heuristic from package manifests:**
58
-
59
- Using the manifests found in Step 2, infer commands with this table:
76
+ - Key directories
60
77
 
61
- | Manifest | Field/Pattern | Label | Command |
62
- |---|---|---|---|
63
- | package.json | `scripts.test` | test | `npm test` |
64
- | package.json | `scripts.build` | build | `npm run build` |
65
- | package.json | `scripts.lint` | lint | `npm run lint` |
66
- | package.json | `scripts.typecheck` or `scripts.type-check` | typecheck | `npm run typecheck` |
67
- | Cargo.toml | (exists) | test | `cargo test` |
68
- | Cargo.toml | (exists) | build | `cargo build` |
69
- | Cargo.toml | `clippy` in deps | lint | `cargo clippy` |
70
- | pyproject.toml | `[tool.pytest]` or pytest in deps | test | `pytest` |
71
- | pyproject.toml | `[tool.ruff]` or ruff in deps | lint | `ruff check .` |
72
- | pyproject.toml | `[tool.mypy]` or mypy in deps | typecheck | `mypy .` |
73
- | go.mod | (exists) | test | `go test ./...` |
74
- | go.mod | (exists) | build | `go build ./...` |
78
+ ### Step 3: Dispatch Surveyor Ants (Parallel)
75
79
 
76
- For each inferred command, only store it if no command with the same label was already found from CLAUDE.md (CLAUDE.md wins per-label). Store as: `{ label, command, source: "heuristic" }`.
77
-
78
- If neither source yields any commands, set the detected commands list to empty.
80
+ Create the survey directory:
81
+ ```bash
82
+ mkdir -p .aether/data/survey
83
+ ```
79
84
 
80
- ### Step 3: Write CODEBASE.md
85
+ Generate unique names for the 4 Surveyor Ants and log their dispatch:
86
+ ```bash
87
+ bash .aether/aether-utils.sh generate-ant-name "surveyor"
88
+ bash .aether/aether-utils.sh generate-ant-name "surveyor"
89
+ bash .aether/aether-utils.sh generate-ant-name "surveyor"
90
+ bash .aether/aether-utils.sh generate-ant-name "surveyor"
91
+ ```
81
92
 
82
- Create `.planning/CODEBASE.md` (ensure `.planning/` exists first):
93
+ Log the dispatch:
94
+ ```bash
95
+ bash .aether/aether-utils.sh spawn-log "Queen" "surveyor" "{provisions_name}" "Mapping provisions and trails"
96
+ bash .aether/aether-utils.sh spawn-log "Queen" "surveyor" "{nest_name}" "Mapping nest structure"
97
+ bash .aether/aether-utils.sh spawn-log "Queen" "surveyor" "{disciplines_name}" "Mapping disciplines and sentinels"
98
+ bash .aether/aether-utils.sh spawn-log "Queen" "surveyor" "{pathogens_name}" "Identifying pathogens"
99
+ ```
83
100
 
84
- ```markdown
85
- # Codebase Overview
101
+ **Spawn 4 Surveyor Ants in parallel using the Task tool:**
86
102
 
87
- **Stack:** <language> + <framework>
88
- **Entry:** <main entry points>
103
+ Each Task should use `subagent_type="aether-surveyor-{focus}"`:
104
+ 1. `aether-surveyor-provisions` Maps PROVISIONS.md and TRAILS.md
105
+ 2. `aether-surveyor-nest` — Maps BLUEPRINT.md and CHAMBERS.md
106
+ 3. `aether-surveyor-disciplines` — Maps DISCIPLINES.md and SENTINEL-PROTOCOLS.md
107
+ 4. `aether-surveyor-pathogens` — Maps PATHOGENS.md
89
108
 
90
- **Structure:**
91
- - <dir>/ (<count> files)
92
- - ...
109
+ **Prompt for each surveyor:**
110
+ ```
111
+ You are Surveyor Ant {name}. Explore this codebase and write your survey documents.
93
112
 
94
- **Key Dependencies:**
95
- - <dep1>: <purpose>
96
- - <dep2>: <purpose>
97
- - ...
113
+ Focus: {provisions|nest|disciplines|pathogens}
98
114
 
99
- ## Commands
100
- <for each detected command from Step 2.5>
101
- - **<label>**: `<command>` (<source: claude_md | heuristic>)
102
- <if no commands detected>
103
- No build system detected.
104
- </if>
115
+ The surface scan found:
116
+ - Language: {language}
117
+ - Framework: {framework}
118
+ - Key directories: {dirs}
105
119
 
106
- **Test Location:** <tests/ or __tests__/ or similar>
120
+ Write your documents to `.aether/data/survey/` following your agent template.
121
+ Return only confirmation when complete — do not include document contents.
122
+ ```
107
123
 
108
- **Notes:**
109
- - <any notable patterns or conventions observed>
124
+ Collect confirmations from all 4 surveyors. Each should return:
125
+ - Document name(s) written
126
+ - Line count(s)
127
+ - Brief status
128
+
129
+ ### Step 4: Verify Survey Completeness
130
+
131
+ Check that all 7 documents were created:
132
+ ```bash
133
+ ls .aether/data/survey/PROVISIONS.md 2>/dev/null && echo "PROVISIONS: OK" || echo "PROVISIONS: MISSING"
134
+ ls .aether/data/survey/TRAILS.md 2>/dev/null && echo "TRAILS: OK" || echo "TRAILS: MISSING"
135
+ ls .aether/data/survey/BLUEPRINT.md 2>/dev/null && echo "BLUEPRINT: OK" || echo "BLUEPRINT: MISSING"
136
+ ls .aether/data/survey/CHAMBERS.md 2>/dev/null && echo "CHAMBERS: OK" || echo "CHAMBERS: MISSING"
137
+ ls .aether/data/survey/DISCIPLINES.md 2>/dev/null && echo "DISCIPLINES: OK" || echo "DISCIPLINES: MISSING"
138
+ ls .aether/data/survey/SENTINEL-PROTOCOLS.md 2>/dev/null && echo "SENTINEL: OK" || echo "SENTINEL: MISSING"
139
+ ls .aether/data/survey/PATHOGENS.md 2>/dev/null && echo "PATHOGENS: OK" || echo "PATHOGENS: MISSING"
110
140
  ```
111
141
 
112
- Keep output under 50 lines. Focus on what's relevant to the colony goal (if set), or provide a general codebase overview.
142
+ If any documents are missing, note which ones in the output.
113
143
 
114
- ### Step 4: Update State
144
+ ### Step 5: Update State
115
145
 
116
146
  Read `.aether/data/COLONY_STATE.json`. Update:
117
147
  - Set `state` to `"IDLE"` (ready for planning)
148
+ - Set `territory_surveyed` to `"<ISO-8601 UTC>"`
118
149
 
119
150
  Write Event: Append to the `events` array as pipe-delimited string:
120
- `"<ISO-8601 UTC>|codebase_colonized|colonize|Codebase analyzed: <primary language/framework>"`
151
+ `"<ISO-8601 UTC>|territory_surveyed|colonize|Territory surveyed: 7 documents"`
121
152
 
122
153
  If the `events` array exceeds 100 entries, remove the oldest entries to keep only 100.
123
154
 
124
155
  Write the updated COLONY_STATE.json.
125
156
 
126
- ### Step 5: Confirm
157
+ ### Step 6: Confirm
127
158
 
128
159
  Output header:
129
160
 
130
161
  ```
131
- 🔍🐜🗺️🐜🔍 ═══════════════════════════════════════════════════
132
- C O D E B A S E A N A L Y S I S
133
- ═══════════════════════════════════════════════════ 🔍🐜🗺️🐜🔍
162
+ 📊🐜🗺️🐜📊 ═══════════════════════════════════════════════════
163
+ T E R R I T O R Y S U R V E Y C O M P L E T E
164
+ ═══════════════════════════════════════════════════ 📊🐜🗺️🐜📊
134
165
  ```
135
166
 
136
167
  Then output:
137
168
 
138
169
  ```
139
- Codebase analysis complete.
140
- See: .planning/CODEBASE.md
170
+ 🗺️ Colony territory has been surveyed.
171
+
172
+ Survey Reports:
173
+ 📦 PROVISIONS.md — Tech stack & dependencies
174
+ 🛤️ TRAILS.md — External integrations
175
+ 📐 BLUEPRINT.md — Architecture patterns
176
+ 🏠 CHAMBERS.md — Directory structure
177
+ 📜 DISCIPLINES.md — Coding conventions
178
+ 🛡️ SENTINEL-PROTOCOLS.md — Testing patterns
179
+ ⚠️ PATHOGENS.md — Tech debt & concerns
180
+
181
+ Location: .aether/data/survey/
182
+
183
+ {If any docs missing:}
184
+ ⚠️ Missing: {list missing documents}
185
+ {/if}
141
186
 
142
187
  Stack: <language> + <framework>
143
188
  Entry: <main entry point>
@@ -151,26 +196,7 @@ Next:
151
196
 
152
197
  {If goal is not null:}
153
198
  Next:
154
- /ant:plan Generate project plan
199
+ /ant:plan Generate project plan (will load relevant survey docs)
155
200
  /ant:focus "<area>" Inject focus before planning
156
201
  /ant:redirect "<pat>" Inject constraint before planning
157
202
  ```
158
-
159
- ### Step 5.5: Suggest Commands for CLAUDE.md
160
-
161
- Skip if all commands came from `claude_md` or none were detected. This is **non-blocking** -- do not edit CLAUDE.md automatically.
162
-
163
- For heuristic-sourced commands only, output:
164
-
165
- ```
166
- 💡 Detected commands not yet in CLAUDE.md. Consider adding:
167
- ```
168
-
169
- Then a fenced code block the user can copy-paste into CLAUDE.md:
170
-
171
- ```markdown
172
- ## Commands
173
- - <label>: `<command>`
174
- ```
175
-
176
- Then: `Paste the above into your project's CLAUDE.md to skip heuristic detection next time.`
@@ -7,7 +7,29 @@ You are the **Queen Ant Colony**. Reconcile completed work and advance to the ne
7
7
 
8
8
  ## Instructions
9
9
 
10
- ### Step 0: Version Check (Non-blocking)
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
19
+
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)
11
33
 
12
34
  Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
13
35
 
@@ -30,12 +52,29 @@ Extract: `goal`, `state`, `current_phase`, `plan.phases`, `errors`, `memory`, `e
30
52
  - If `goal: null` -> output "No colony initialized. Run /ant:init first." and stop.
31
53
  - If `plan.phases` is empty -> output "No project plan. Run /ant:plan first." and stop.
32
54
 
33
- **Auto-Recovery Header (Session Start):**
34
- If `goal` exists and state is valid, output a brief context line:
35
- ```
36
- 🔄 Resuming: Phase {current_phase} - {phase_name}
37
- ```
38
- This helps recover context after session clears. Continue immediately (non-blocking).
55
+ ### Step 1.5: Load State and Show Resumption Context
56
+
57
+ Run using Bash tool: `bash .aether/aether-utils.sh load-state`
58
+
59
+ If successful and goal is not null:
60
+ 1. Extract current_phase from state
61
+ 2. Get phase name from plan.phases[current_phase - 1].name (or "(unnamed)")
62
+ 3. Display brief resumption context:
63
+ ```
64
+ 🔄 Resuming: Phase X - Name
65
+ ```
66
+
67
+ If .aether/HANDOFF.md exists (detected in load-state output):
68
+ - Display "Resuming from paused session"
69
+ - Read .aether/HANDOFF.md for additional context
70
+ - Remove .aether/HANDOFF.md after display (cleanup)
71
+
72
+ Run: `bash .aether/aether-utils.sh unload-state` to release lock.
73
+
74
+ **Error handling:**
75
+ - If E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
76
+ - If validation error: Display error details with recovery suggestion and stop
77
+ - For other errors: Display generic error and suggest /ant:status for diagnostics
39
78
 
40
79
  **Completion Detection:**
41
80
 
@@ -65,8 +104,8 @@ Resolve each command (build, test, types, lint) using this priority chain. Stop
65
104
  **Priority 1 — CLAUDE.md (System Context):**
66
105
  Check the CLAUDE.md instructions already loaded in your system context for explicit build, test, type-check, or lint commands. These are authoritative and override all other sources.
67
106
 
68
- **Priority 2 — .planning/CODEBASE.md `## Commands`:**
69
- Read `.planning/CODEBASE.md` and look for the `## Commands` section. Use any commands listed there for slots not yet filled by Priority 1.
107
+ **Priority 2 — codebase.md `## Commands`:**
108
+ Read `.aether/data/codebase.md` and look for the `## Commands` section. Use any commands listed there for slots not yet filled by Priority 1.
70
109
 
71
110
  **Priority 3 — Fallback Heuristic Table:**
72
111
  For any commands still unresolved, check for these files in order, use first match:
@@ -632,6 +671,49 @@ Update COLONY_STATE.json:
632
671
 
633
672
  Write COLONY_STATE.json.
634
673
 
674
+ ### Step 2.3: Update Handoff Document
675
+
676
+ After advancing the phase, update the handoff document with the new current state:
677
+
678
+ ```bash
679
+ # Determine if there's a next phase
680
+ next_phase_id=$((current_phase + 1))
681
+ has_next_phase=$(jq --arg next "$next_phase_id" '.plan.phases | map(select(.id == ($next | tonumber))) | length' .aether/data/COLONY_STATE.json)
682
+
683
+ # Write updated handoff
684
+ cat > .aether/HANDOFF.md << 'HANDOFF_EOF'
685
+ # Colony Session — Phase Advanced
686
+
687
+ ## Quick Resume
688
+ Run `/ant:build {next_phase_id}` to start working on the current phase.
689
+
690
+ ## State at Advancement
691
+ - Goal: "$(jq -r '.goal' .aether/data/COLONY_STATE.json)"
692
+ - Completed Phase: {completed_phase_id} — {completed_phase_name}
693
+ - Current Phase: {next_phase_id} — {next_phase_name}
694
+ - State: READY
695
+ - Updated: $(date -u +%Y-%m-%dT%H:%M:%SZ)
696
+
697
+ ## What Was Completed
698
+ - Phase {completed_phase_id} marked as completed
699
+ - Learnings extracted: {learning_count}
700
+ - Instincts updated: {instinct_count}
701
+
702
+ ## Current Phase Tasks
703
+ $(jq -r '.plan.phases[] | select(.id == next_phase_id) | .tasks[] | "- [ ] \(.id): \(.description)"' .aether/data/COLONY_STATE.json)
704
+
705
+ ## Next Steps
706
+ - Build current phase: `/ant:build {next_phase_id}`
707
+ - Review phase details: `/ant:phase {next_phase_id}`
708
+ - Pause colony: `/ant:pause-colony`
709
+
710
+ ## Session Note
711
+ Phase advanced successfully. Colony is READY to build Phase {next_phase_id}.
712
+ HANDOFF_EOF
713
+ ```
714
+
715
+ This handoff reflects the post-advancement state, allowing seamless resumption even if the session is lost.
716
+
635
717
  ### Step 2.4: Update Changelog
636
718
 
637
719
  **Append a changelog entry for the completed phase.**
@@ -749,7 +831,7 @@ Clear context now?
749
831
 
750
832
  3. **If option 1 ("Yes, clear context"):**
751
833
 
752
- **IMPORTANT:** OpenCode does not support programmatic /clear. Display instructions:
834
+ **IMPORTANT:** Claude Code does not support programmatic /clear. Display instructions:
753
835
  ```
754
836
  Please type: /clear
755
837
 
@@ -794,6 +876,12 @@ Runs ONLY when all phases complete.
794
876
 
795
877
  ### Step 3: Display Result
796
878
 
879
+ **If visual_mode is true, render final swarm display:**
880
+ ```bash
881
+ 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
882
+ bash .aether/aether-utils.sh swarm-display-render "$continue_id"
883
+ ```
884
+
797
885
  Output:
798
886
 
799
887
  ```
@@ -7,6 +7,28 @@ You are the **Queen Ant Colony**. Convene the council to clarify user intent and
7
7
 
8
8
  ## Instructions
9
9
 
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
19
+
20
+ ### Step 0: Initialize Visual Mode (if enabled)
21
+
22
+ If `visual_mode` is true:
23
+ ```bash
24
+ # Generate session ID
25
+ council_id="council-$(date +%s)"
26
+
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$council_id"
29
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Convening council" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
30
+ ```
31
+
10
32
  ### Step 1: Read Current State
11
33
 
12
34
  Read `.aether/data/COLONY_STATE.json`.
@@ -223,6 +245,12 @@ Keep max 100 events.
223
245
 
224
246
  ### Step 8: Display Summary
225
247
 
248
+ **If visual_mode is true, render final swarm display:**
249
+ ```bash
250
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "completed" "Council adjourned" "Colony" '{"read":3,"grep":0,"edit":2,"bash":1}' 100 "fungus_garden" 100
251
+ bash .aether/aether-utils.sh swarm-display-render "$council_id"
252
+ ```
253
+
226
254
  ```
227
255
  📜🐜🏛️🐜📜 COUNCIL ADJOURNED
228
256
 
@@ -29,6 +29,30 @@ You wander the codebase like a monk walks a garden — not to fix, not to judge,
29
29
 
30
30
  ## Instructions
31
31
 
32
+ ### Step -1: Normalize Arguments
33
+
34
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
35
+
36
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
37
+
38
+ ### Step 0: Parse Arguments
39
+
40
+ Parse `$normalized_args`:
41
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
42
+ - Otherwise: set `visual_mode = true`
43
+
44
+ ### Step 0.5: Initialize Visual Mode (if enabled)
45
+
46
+ If `visual_mode` is true:
47
+ ```bash
48
+ # Generate session ID
49
+ dream_id="dream-$(date +%s)"
50
+
51
+ # Initialize swarm display
52
+ bash .aether/aether-utils.sh swarm-display-init "$dream_id"
53
+ bash .aether/aether-utils.sh swarm-display-update "Dreamer" "dreamer" "observing" "Wandering the codebase" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "nursery" 0
54
+ ```
55
+
32
56
  ### Step 1: Awaken — Load Context
33
57
 
34
58
  Read these files in parallel to understand the world you're dreaming about:
@@ -7,6 +7,28 @@ You are the **Queen**. Archive the completed colony to chambers.
7
7
 
8
8
  ## Instructions
9
9
 
10
+ ### Step -1: Normalize Arguments
11
+
12
+ Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
13
+
14
+ This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
15
+
16
+ Parse `$normalized_args`:
17
+ - If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
18
+ - Otherwise: set `visual_mode = true`
19
+
20
+ ### Step 0: Initialize Visual Mode (if enabled)
21
+
22
+ If `visual_mode` is true:
23
+ ```bash
24
+ # Generate session ID
25
+ entomb_id="entomb-$(date +%s)"
26
+
27
+ # Initialize swarm display
28
+ bash .aether/aether-utils.sh swarm-display-init "$entomb_id"
29
+ bash .aether/aether-utils.sh swarm-display-update "Queen" "prime" "excavating" "Entombing colony" "Colony" '{"read":0,"grep":0,"edit":0,"bash":0}' 0 "fungus_garden" 0
30
+ ```
31
+
10
32
  ### Step 1: Read State
11
33
 
12
34
  Read `.aether/data/COLONY_STATE.json`.
@@ -204,6 +226,44 @@ Remove backup after successful reset:
204
226
  rm -f .aether/data/COLONY_STATE.json.bak
205
227
  ```
206
228
 
229
+ ### Step 8.5: Write Final Handoff
230
+
231
+ After entombing the colony, write the final handoff documenting the archived colony:
232
+
233
+ ```bash
234
+ cat > .aether/HANDOFF.md << 'HANDOFF_EOF'
235
+ # Colony Session — ENTOMBED
236
+
237
+ ## ⚰️ Colony Archived
238
+ **Status:** Entombed in Chambers — Colony work preserved
239
+
240
+ ## Chamber Location
241
+ .aether/chambers/{chamber_name}/
242
+
243
+ ## Colony Summary
244
+ - Goal: "{goal}"
245
+ - Phases: {completed} completed of {total}
246
+ - Milestone: {milestone}
247
+ - Entombed At: {timestamp}
248
+
249
+ ## Chamber Contents
250
+ - colony-state.json — Full colony state
251
+ - manifest.json — Archive metadata
252
+ - activity.log — Colony activity history
253
+ - spawn-tree.txt — Worker spawn records
254
+ - flags.json — Project flags (if existed)
255
+
256
+ ## Session Note
257
+ This colony has been entombed and the active state reset.
258
+ The colony rests. Its learnings are preserved in the chamber.
259
+
260
+ To start anew: /ant:lay-eggs "<new goal>"
261
+ To explore chambers: /ant:tunnels
262
+ HANDOFF_EOF
263
+ ```
264
+
265
+ This handoff serves as the record of the entombed colony.
266
+
207
267
  ### Step 9: Display Result
208
268
 
209
269
  ```
@@ -220,7 +280,19 @@ rm -f .aether/data/COLONY_STATE.json.bak
220
280
  📦 Chamber: .aether/chambers/{chamber_name}/
221
281
 
222
282
  🐜 The colony rests. Its learnings are preserved.
223
- Run /ant:lay-eggs to begin anew.
283
+
284
+ 💾 State persisted — safe to /clear
285
+
286
+ 🐜 What would you like to do next?
287
+ 1. /ant:lay-eggs "<new goal>" — Start a new colony
288
+ 2. /ant:tunnels — Browse archived colonies
289
+ 3. /clear — Clear context and continue
290
+
291
+ Use AskUserQuestion with these three options.
292
+
293
+ If option 1 selected: proceed to run /ant:lay-eggs flow
294
+ If option 2 selected: run /ant:tunnels
295
+ If option 3 selected: display "Run /ant:lay-eggs to begin anew after clearing"
224
296
  ```
225
297
 
226
298
  ### Edge Cases