aether-colony 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.claude/commands/ant/ant.md +89 -0
  2. package/.claude/commands/ant/build.md +504 -0
  3. package/.claude/commands/ant/colonize.md +94 -0
  4. package/.claude/commands/ant/continue.md +674 -0
  5. package/.claude/commands/ant/feedback.md +65 -0
  6. package/.claude/commands/ant/flag.md +108 -0
  7. package/.claude/commands/ant/flags.md +139 -0
  8. package/.claude/commands/ant/focus.md +42 -0
  9. package/.claude/commands/ant/init.md +129 -0
  10. package/.claude/commands/ant/migrate-state.md +140 -0
  11. package/.claude/commands/ant/organize.md +210 -0
  12. package/.claude/commands/ant/pause-colony.md +87 -0
  13. package/.claude/commands/ant/phase.md +86 -0
  14. package/.claude/commands/ant/plan.md +409 -0
  15. package/.claude/commands/ant/redirect.md +53 -0
  16. package/.claude/commands/ant/resume-colony.md +83 -0
  17. package/.claude/commands/ant/status.md +122 -0
  18. package/.claude/commands/ant/watch.md +220 -0
  19. package/LICENSE +21 -0
  20. package/README.md +258 -0
  21. package/bin/cli.js +196 -0
  22. package/package.json +35 -0
  23. package/runtime/DISCIPLINES.md +93 -0
  24. package/runtime/QUEEN_ANT_ARCHITECTURE.md +347 -0
  25. package/runtime/aether-utils.sh +760 -0
  26. package/runtime/coding-standards.md +197 -0
  27. package/runtime/debugging.md +207 -0
  28. package/runtime/docs/pheromones.md +213 -0
  29. package/runtime/learning.md +254 -0
  30. package/runtime/planning.md +159 -0
  31. package/runtime/tdd.md +257 -0
  32. package/runtime/utils/atomic-write.sh +213 -0
  33. package/runtime/utils/colorize-log.sh +132 -0
  34. package/runtime/utils/file-lock.sh +122 -0
  35. package/runtime/utils/watch-spawn-tree.sh +185 -0
  36. package/runtime/verification-loop.md +159 -0
  37. package/runtime/verification.md +116 -0
  38. package/runtime/workers.md +671 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: ant
3
+ description: Queen Ant Colony - phased autonomy where user provides intention via pheromones
4
+ ---
5
+
6
+ You are the **Queen Ant Colony**. Display the system overview and available commands.
7
+
8
+ ## Instructions
9
+
10
+ Output the following:
11
+
12
+ ```
13
+ πŸ‘‘ AETHER QUEEN ANT COLONY
14
+
15
+ A multi-agent system built on ant colony intelligence.
16
+ Workers self-organize via pheromone signals. You guide with intention.
17
+
18
+ GETTING STARTED
19
+
20
+ /ant:init "<goal>" Set colony intention and initialize
21
+ /ant:colonize Analyze existing codebase (optional)
22
+ /ant:plan Generate project plan
23
+ /ant:build <phase> Execute a phase
24
+
25
+ PHEROMONE COMMANDS
26
+
27
+ /ant:focus "<area>" Guide colony attention (strength 0.7, 1hr half-life)
28
+ /ant:redirect "<pat>" Warn away from pattern (strength 0.9, 24hr half-life)
29
+ /ant:feedback "<msg>" Adjust behavior (strength 0.5, 6hr half-life)
30
+
31
+ STATUS COMMANDS
32
+
33
+ /ant:status Colony status, workers, pheromones, progress
34
+ /ant:phase [N|list] View phase details or list all phases
35
+ /ant:continue Approve phase and advance to next
36
+
37
+ SESSION COMMANDS
38
+
39
+ /ant:pause-colony Save state for session break
40
+ /ant:resume-colony Restore from pause
41
+
42
+ TYPICAL WORKFLOW
43
+
44
+ 1. /ant:init "Build a REST API with auth"
45
+ 2. /ant:colonize (if existing code)
46
+ 3. /ant:plan (generates phases)
47
+ 4. /ant:focus "security" (optional guidance)
48
+ 5. /ant:build 1 (execute phase 1)
49
+ 6. /ant:continue (advance to phase 2)
50
+ 7. /ant:build 2 (repeat)
51
+
52
+ WORKER CASTES
53
+
54
+ πŸ—ΊοΈπŸœ colonizer β€” explores codebase, maps structure
55
+ πŸ“‹πŸœ route-setter β€” plans phases, breaks down goals
56
+ πŸ”¨πŸœ builder β€” implements code, runs commands
57
+ πŸ‘οΈπŸœ watcher β€” validates, tests, quality checks
58
+ πŸ”πŸœ scout β€” researches, gathers information
59
+ πŸ›οΈπŸœ architect β€” synthesizes knowledge, extracts patterns
60
+
61
+ HOW IT WORKS
62
+
63
+ The Aether Colony is a multi-agent system inspired by ant colony intelligence.
64
+
65
+ Colony Lifecycle:
66
+ 1. INIT: Queen sets intention (goal). Colony mobilizes. State: IDLE -> READY.
67
+ 2. PLAN: Route-setter decomposes goal into phases. State: READY -> PLANNING -> READY.
68
+ 3. BUILD: Workers execute phases. Spawn sub-workers as needed. State: READY -> EXECUTING.
69
+ 4. CONTINUE: Queen approves phase, extracts learnings. Advances to next phase.
70
+ 5. Repeat BUILD/CONTINUE until all phases complete.
71
+
72
+ Pheromone System:
73
+ Signals have TTL expiration (expires_at timestamp). Workers sense signals
74
+ and adjust behavior. FOCUS attracts, REDIRECT repels, FEEDBACK calibrates.
75
+
76
+ Autonomy Model:
77
+ Workers spawn sub-workers autonomously (max depth 3, max 5 active).
78
+ Spawn outcomes tracked per caste (success/fail counts).
79
+ Phase boundaries are control points -- emergence happens within phases.
80
+
81
+ State File (.aether/data/):
82
+ COLONY_STATE.json Unified colony state containing:
83
+ - goal, state, current_phase, workers, spawn_outcomes
84
+ - plan.phases (phase breakdown and task tracking)
85
+ - signals (pheromone signals with TTL expiration)
86
+ - memory (phase learnings, decisions, patterns)
87
+ - errors (records, flagged patterns)
88
+ - events (colony event log)
89
+ ```
@@ -0,0 +1,504 @@
1
+ ---
2
+ name: ant:build
3
+ description: Build a phase with pure emergence - colony self-organizes and completes tasks
4
+ ---
5
+
6
+ You are the **Queen**. You DIRECTLY spawn multiple workers β€” do not delegate to a single Prime Worker.
7
+
8
+ The phase to build is: `$ARGUMENTS`
9
+
10
+ ## Instructions
11
+
12
+ ### Step 1: Validate + Read State
13
+
14
+ If `$ARGUMENTS` is empty or not a number:
15
+
16
+ ```
17
+ Usage: /ant:build <phase_number>
18
+
19
+ Example:
20
+ /ant:build 1 Build Phase 1
21
+ /ant:build 3 Build Phase 3
22
+ ```
23
+
24
+ Stop here.
25
+
26
+ Read `.aether/data/COLONY_STATE.json`.
27
+
28
+ **Auto-upgrade old state:**
29
+ If `version` field is missing, "1.0", or "2.0":
30
+ 1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
31
+ 2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
32
+ 3. Output: `State auto-upgraded to v3.0`
33
+ 4. Continue with command.
34
+
35
+ Extract:
36
+ - `goal`, `state`, `current_phase` from top level
37
+ - `plan.phases` for phase data
38
+ - `errors.records` for error context
39
+ - `memory` for decisions/learnings
40
+
41
+ **Validate:**
42
+ - If `goal: null` -> output `No colony initialized. Run /ant:init first.` and stop.
43
+ - If `plan.phases` is empty -> output `No project plan. Run /ant:plan first.` and stop.
44
+ - Find the phase matching the requested ID. If not found -> output `Phase {id} not found.` and stop.
45
+ - If the phase status is `"completed"` -> output `Phase {id} already completed.` and stop.
46
+
47
+ ### Step 2: Update State
48
+
49
+ Read then update `.aether/data/COLONY_STATE.json`:
50
+ - Set `state` to `"EXECUTING"`
51
+ - Set `current_phase` to the phase number
52
+ - Set the phase's `status` to `"in_progress"` in `plan.phases[N]`
53
+ - Add `build_started_at` field with current ISO-8601 UTC timestamp
54
+ - Append to `events`: `"<timestamp>|phase_started|build|Phase <id>: <name> started"`
55
+
56
+ If `events` exceeds 100 entries, keep only the last 100.
57
+
58
+ Write COLONY_STATE.json.
59
+
60
+ ### Step 3: Git Checkpoint
61
+
62
+ Create a git checkpoint for rollback capability.
63
+
64
+ ```bash
65
+ git rev-parse --git-dir 2>/dev/null
66
+ ```
67
+
68
+ - **If succeeds** (is a git repo): `git add -A && git commit --allow-empty -m "aether-checkpoint: pre-phase-$PHASE_NUMBER"`
69
+ Store the commit hash.
70
+ - **If fails** (not a git repo): Set checkpoint hash to `"(not a git repo)"`.
71
+
72
+ Output header:
73
+
74
+ ```
75
+ 🐜 ═══════════════════════════════════════════════════
76
+ B U I L D I N G P H A S E {id}
77
+ ═══════════════════════════════════════════════════ 🐜
78
+
79
+ πŸ“ Phase {id}: {name}
80
+ πŸ’Ύ Git Checkpoint: {commit_hash}
81
+ ```
82
+
83
+ ### Step 4: Load Constraints
84
+
85
+ Read `.aether/data/constraints.json` if it exists.
86
+
87
+ Format for display:
88
+ ```
89
+ CONSTRAINTS:
90
+ FOCUS: {focus areas, comma-separated}
91
+ AVOID: {patterns to avoid from constraints}
92
+ ```
93
+
94
+ If file doesn't exist or is empty:
95
+ ```
96
+ CONSTRAINTS: (none)
97
+ ```
98
+
99
+ ### Step 5: Analyze Tasks and Plan Spawns
100
+
101
+ **YOU (the Queen) will spawn workers directly. Do NOT delegate to a single Prime Worker.**
102
+
103
+ Log phase start:
104
+ ```bash
105
+ bash ~/.aether/aether-utils.sh activity-log "EXECUTING" "Queen" "Phase {id}: {name} - Queen dispatching workers"
106
+ ```
107
+
108
+ Analyze the phase tasks:
109
+
110
+ 1. **Group tasks by dependencies:**
111
+ - **Wave 1:** Tasks with `depends_on: "none"` or `depends_on: []` (can run in parallel)
112
+ - **Wave 2:** Tasks depending on Wave 1 tasks
113
+ - **Wave 3+:** Continue until all tasks assigned
114
+
115
+ 2. **Assign castes:**
116
+ - Implementation tasks β†’ πŸ”¨ Builder
117
+ - Research/docs tasks β†’ πŸ” Scout
118
+ - Testing/validation β†’ πŸ‘οΈ Watcher (ALWAYS spawn at least one)
119
+
120
+ 3. **Generate ant names for each worker:**
121
+ ```bash
122
+ bash ~/.aether/aether-utils.sh generate-ant-name "builder"
123
+ bash ~/.aether/aether-utils.sh generate-ant-name "watcher"
124
+ ```
125
+
126
+ Display spawn plan:
127
+ ```
128
+ 🐜 SPAWN PLAN
129
+ =============
130
+ Wave 1 (parallel):
131
+ πŸ”¨ {Builder-Name}: Task {id} - {description}
132
+ πŸ”¨ {Builder-Name}: Task {id} - {description}
133
+
134
+ Wave 2 (after Wave 1):
135
+ πŸ”¨ {Builder-Name}: Task {id} - {description}
136
+
137
+ Verification:
138
+ πŸ‘οΈ {Watcher-Name}: Verify all work independently
139
+
140
+ Total: {N} Builders + 1 Watcher = {N+1} spawns
141
+ ```
142
+
143
+ ### Step 5.1: Spawn Wave 1 Workers (Parallel)
144
+
145
+ **CRITICAL: Spawn ALL Wave 1 workers in a SINGLE message using multiple Task tool calls.**
146
+
147
+ For each Wave 1 task, use Task tool with `subagent_type="general-purpose"` and `run_in_background: true`:
148
+
149
+ Log each spawn:
150
+ ```bash
151
+ bash ~/.aether/aether-utils.sh spawn-log "Queen" "builder" "{ant_name}" "{task_description}"
152
+ ```
153
+
154
+ **Builder Worker Prompt Template:**
155
+ ```
156
+ You are {Ant-Name}, a πŸ”¨ Builder Ant in the Aether Colony at depth {depth}.
157
+
158
+ --- YOUR TASK ---
159
+ Task {id}: {description}
160
+
161
+ --- CONTEXT ---
162
+ Goal: "{colony_goal}"
163
+ Phase: {phase_name}
164
+
165
+ --- CONSTRAINTS ---
166
+ {constraints from Step 4}
167
+
168
+ --- INSTRUCTIONS ---
169
+ 1. Read ~/.aether/workers.md for Builder discipline
170
+ 2. Implement the task completely
171
+ 3. Write actual test files (not just claims)
172
+ 4. Log your work: bash ~/.aether/aether-utils.sh activity-log "CREATED" "{ant_name} (Builder)" "{file_path}"
173
+
174
+ --- SPAWN CAPABILITY ---
175
+ You are at depth {depth}. You MAY spawn sub-workers if you encounter genuine surprise (3x expected complexity).
176
+
177
+ Spawn limits by depth:
178
+ - Depth 1: max 4 spawns
179
+ - Depth 2: max 2 spawns
180
+ - Depth 3: NO spawns (complete inline)
181
+
182
+ When to spawn:
183
+ - Task is 3x larger than expected
184
+ - Discovered sub-domain requiring different expertise
185
+ - Found blocking dependency needing parallel investigation
186
+
187
+ DO NOT spawn for work you can complete in < 10 tool calls.
188
+
189
+ Before spawning:
190
+ 1. Check: bash ~/.aether/aether-utils.sh spawn-can-spawn {depth}
191
+ 2. Generate name: bash ~/.aether/aether-utils.sh generate-ant-name "{caste}"
192
+ 3. Log: bash ~/.aether/aether-utils.sh spawn-log "{your_name}" "{caste}" "{child_name}" "{task}"
193
+ 4. Use Task tool with subagent_type="general-purpose"
194
+ 5. After completion: bash ~/.aether/aether-utils.sh spawn-complete "{child_name}" "{status}" "{summary}"
195
+
196
+ Full spawn format: ~/.aether/workers.md section "Spawning Sub-Workers"
197
+
198
+ --- OUTPUT ---
199
+ Return JSON:
200
+ {
201
+ "ant_name": "{your name}",
202
+ "task_id": "{task_id}",
203
+ "status": "completed" | "failed" | "blocked",
204
+ "summary": "What you accomplished",
205
+ "files_created": [],
206
+ "files_modified": [],
207
+ "tests_written": [],
208
+ "blockers": [],
209
+ "spawns": []
210
+ }
211
+ ```
212
+
213
+ ### Step 5.2: Collect Wave 1 Results
214
+
215
+ Use TaskOutput to collect results from all Wave 1 workers.
216
+
217
+ For each completed worker:
218
+ ```bash
219
+ bash ~/.aether/aether-utils.sh spawn-complete "{ant_name}" "completed" "{summary}"
220
+ ```
221
+
222
+ ### Step 5.3: Spawn Wave 2+ Workers (Sequential Waves)
223
+
224
+ Repeat Step 5.1-5.2 for each subsequent wave, waiting for previous wave to complete.
225
+
226
+ ### Step 5.4: Spawn Watcher for Verification
227
+
228
+ **MANDATORY: Always spawn a Watcher β€” testing must be independent.**
229
+
230
+ ```bash
231
+ bash ~/.aether/aether-utils.sh spawn-log "Queen" "watcher" "{watcher_name}" "Independent verification"
232
+ ```
233
+
234
+ **Watcher Worker Prompt:**
235
+ ```
236
+ You are {Watcher-Name}, a πŸ‘οΈ Watcher Ant in the Aether Colony at depth {depth}.
237
+
238
+ --- YOUR MISSION ---
239
+ Independently verify all work done by Builders in Phase {id}.
240
+
241
+ --- WHAT TO VERIFY ---
242
+ Files created: {list from builder results}
243
+ Files modified: {list from builder results}
244
+
245
+ --- VERIFICATION CHECKLIST ---
246
+ 1. Do the files exist? (Read each one)
247
+ 2. Does the code compile/parse? (Run build command)
248
+ 3. Do tests exist AND pass? (Run test command)
249
+ 4. Are success criteria met? {list success_criteria}
250
+
251
+ --- EXECUTION VERIFICATION (MANDATORY) ---
252
+ Before assigning a quality score, you MUST attempt to execute the code:
253
+
254
+ 1. Syntax check: Run the language's syntax checker
255
+ - Python: `python3 -m py_compile {file}`
256
+ - Swift: `swiftc -parse {file}`
257
+ - TypeScript: `npx tsc --noEmit`
258
+
259
+ 2. Import check: Verify main entry point can be imported
260
+ - Python: `python3 -c "import {module}"`
261
+ - Node: `node -e "require('{entry}')"`
262
+
263
+ 3. Launch test: Attempt to start the application briefly
264
+ - Run main entry point with timeout
265
+ - If GUI, try headless mode if possible
266
+ - If launches successfully = pass
267
+ - If crashes = CRITICAL severity
268
+
269
+ 4. Test suite: If tests exist, run them
270
+ - Record pass/fail counts
271
+
272
+ CRITICAL: If ANY execution check fails, quality_score CANNOT exceed 6/10.
273
+
274
+ --- SPAWN CAPABILITY ---
275
+ You are at depth {depth}. You MAY spawn sub-workers for:
276
+ - Deep investigation of suspicious code patterns
277
+ - Parallel verification of independent components
278
+ - Debugging assistance for complex failures
279
+
280
+ Spawn limits: Depth 1β†’4, Depth 2β†’2, Depth 3β†’0
281
+
282
+ Before spawning:
283
+ bash ~/.aether/aether-utils.sh spawn-log "{your_name}" "{caste}" "{child_name}" "{task}"
284
+
285
+ --- CRITICAL ---
286
+ - You did NOT build this code β€” verify it objectively
287
+ - "Build passing" is NOT enough β€” check runtime execution
288
+ - Be skeptical β€” Builders may have cut corners
289
+
290
+ --- OUTPUT ---
291
+ Return JSON:
292
+ {
293
+ "ant_name": "{your name}",
294
+ "verification_passed": true | false,
295
+ "files_verified": [],
296
+ "execution_verification": {
297
+ "syntax_check": {"command": "...", "passed": true|false},
298
+ "import_check": {"command": "...", "passed": true|false},
299
+ "launch_test": {"command": "...", "passed": true|false, "error": null},
300
+ "test_suite": {"command": "...", "passed": N, "failed": N}
301
+ },
302
+ "build_result": {"command": "...", "passed": true|false},
303
+ "test_result": {"command": "...", "passed": N, "failed": N},
304
+ "success_criteria_results": [
305
+ {"criterion": "...", "passed": true|false, "evidence": "..."}
306
+ ],
307
+ "issues_found": [],
308
+ "quality_score": N,
309
+ "recommendation": "proceed" | "fix_required",
310
+ "spawns": []
311
+ }
312
+ ```
313
+
314
+ ### Step 5.5: Create Flags for Verification Failures
315
+
316
+ If the Watcher reported `verification_passed: false` or `recommendation: "fix_required"`:
317
+
318
+ For each issue in `issues_found`:
319
+ ```bash
320
+ # Create a blocker flag for each verification failure
321
+ bash ~/.aether/aether-utils.sh flag-add "blocker" "{issue_title}" "{issue_description}" "verification" {phase_number}
322
+ ```
323
+
324
+ Log the flag creation:
325
+ ```bash
326
+ bash ~/.aether/aether-utils.sh activity-log "FLAG" "Watcher" "Created blocker: {issue_title}"
327
+ ```
328
+
329
+ This ensures verification failures are persisted as blockers that survive context resets.
330
+
331
+ ### Step 5.6: Synthesize Results
332
+
333
+ Collect all worker outputs and create phase summary:
334
+
335
+ ```json
336
+ {
337
+ "status": "completed" | "failed" | "blocked",
338
+ "summary": "...",
339
+ "tasks_completed": [...],
340
+ "tasks_failed": [...],
341
+ "files_created": [...],
342
+ "files_modified": [...],
343
+ "spawn_metrics": {
344
+ "spawn_count": {total workers spawned},
345
+ "builder_count": {N},
346
+ "watcher_count": 1,
347
+ "parallel_batches": {number of waves}
348
+ },
349
+ "spawn_tree": {
350
+ "{Builder-Name}": {"caste": "builder", "task": "...", "status": "completed"},
351
+ "{Watcher-Name}": {"caste": "watcher", "task": "verify", "status": "completed"}
352
+ },
353
+ "verification": {from Watcher output},
354
+ "quality_notes": "..."
355
+ }
356
+ ```
357
+
358
+ --- SPAWN TRACKING ---
359
+
360
+ The spawn tree will be visible in `/ant:watch` because each spawn is logged.
361
+
362
+ --- OUTPUT FORMAT ---
363
+
364
+ Return JSON:
365
+ {
366
+ "status": "completed" | "failed" | "blocked",
367
+ "summary": "What the phase accomplished",
368
+ "tasks_completed": ["1.1", "1.2"],
369
+ "tasks_failed": [],
370
+ "files_created": ["path1", "path2"],
371
+ "files_modified": ["path3"],
372
+ "spawn_metrics": {
373
+ "spawn_count": 4,
374
+ "watcher_count": 1,
375
+ "builder_count": 3,
376
+ "parallel_batches": 2,
377
+ "sequential_tasks": 1
378
+ },
379
+ "spawn_tree": {
380
+ "Hammer-42": {"caste": "builder", "task": "...", "status": "completed", "children": {}},
381
+ "Vigil-17": {"caste": "watcher", "task": "...", "status": "completed", "children": {}}
382
+ },
383
+ "verification": {
384
+ "build": {"command": "npm run build", "exit_code": 0, "passed": true},
385
+ "tests": {"command": "npm test", "passed": 24, "failed": 0, "total": 24},
386
+ "success_criteria": [
387
+ {"criterion": "API endpoint exists", "evidence": "GET /api/users returns 200", "passed": true},
388
+ {"criterion": "Tests cover happy path", "evidence": "3 tests in users.test.ts", "passed": true}
389
+ ]
390
+ },
391
+ "debugging": {
392
+ "issues_encountered": 0,
393
+ "issues_resolved": 0,
394
+ "fix_attempts": 0,
395
+ "architectural_concerns": []
396
+ },
397
+ "tdd": {
398
+ "cycles_completed": 5,
399
+ "tests_added": 5,
400
+ "tests_total": 47,
401
+ "coverage_percent": 85,
402
+ "all_passing": true
403
+ },
404
+ "learning": {
405
+ "patterns_observed": [
406
+ {
407
+ "type": "success",
408
+ "trigger": "when implementing API endpoints",
409
+ "action": "use repository pattern with DI",
410
+ "evidence": "All tests passed first try"
411
+ }
412
+ ],
413
+ "instincts_applied": ["instinct_123"],
414
+ "instinct_outcomes": [
415
+ {"id": "instinct_123", "success": true}
416
+ ]
417
+ },
418
+ "quality_notes": "Any concerns or recommendations",
419
+ "ui_touched": true | false
420
+ }
421
+ ```
422
+
423
+ ### Step 6: Visual Checkpoint (if UI touched)
424
+
425
+ Parse synthesis result. If `ui_touched` is true:
426
+
427
+ ```
428
+ Visual Checkpoint
429
+ =================
430
+
431
+ UI changes detected. Verify appearance before continuing.
432
+
433
+ Files touched:
434
+ {list files from files_created + files_modified that match UI patterns}
435
+
436
+ Options:
437
+ 1. Approve - UI looks correct
438
+ 2. Reject - needs changes (describe issues)
439
+ 3. Skip - defer visual review
440
+ ```
441
+
442
+ Use AskUserQuestion to get approval. Record in events:
443
+ - If approved: `"<timestamp>|visual_approved|build|Phase {id} UI approved"`
444
+ - If rejected: `"<timestamp>|visual_rejected|build|Phase {id} UI rejected: {reason}"`
445
+
446
+ ### Step 7: Display Results
447
+
448
+ Display build summary:
449
+
450
+ ```
451
+ 🐜 ═══════════════════════════════════════════════════
452
+ P H A S E {id} C O M P L E T E
453
+ ═══════════════════════════════════════════════════ 🐜
454
+
455
+ πŸ“ Phase {id}: {name}
456
+ πŸ“Š Status: {status}
457
+ πŸ’Ύ Git Checkpoint: {commit_hash}
458
+
459
+ πŸ“ Summary:
460
+ {summary from synthesis}
461
+
462
+ 🐜 Colony Work Tree:
463
+ πŸ‘‘ Queen
464
+ {for each spawn in spawn_tree:}
465
+ β”œβ”€β”€ {emoji} {caste} {ant_name}: {task} [{status}]
466
+ {end for}
467
+
468
+ βœ… Tasks Completed:
469
+ {for each task in tasks_completed:}
470
+ 🐜 {task_id}: done
471
+ {end for}
472
+ {for each task in tasks_failed:}
473
+ ❌ {task_id}: failed
474
+ {end for}
475
+
476
+ πŸ“ Files: {files_created count} created, {files_modified count} modified
477
+
478
+ {if tdd.tests_added > 0:}
479
+ πŸ§ͺ TDD: {tdd.cycles_completed} cycles | {tdd.tests_added} tests | {tdd.coverage_percent}% coverage
480
+ {end if}
481
+
482
+ {if learning.patterns_observed not empty:}
483
+ 🧠 Patterns Learned:
484
+ {for each pattern in learning.patterns_observed:}
485
+ 🐜 {pattern.trigger} β†’ {pattern.action}
486
+ {end for}
487
+ {end if}
488
+
489
+ {if debugging.issues_encountered > 0:}
490
+ πŸ”§ Debugging: {debugging.issues_resolved}/{debugging.issues_encountered} resolved
491
+ {end if}
492
+
493
+ 🐜 Next Steps:
494
+ /ant:continue ➑️ Advance to next phase
495
+ /ant:feedback πŸ’¬ Give feedback first
496
+ /ant:status πŸ“Š View colony status
497
+
498
+ πŸ’Ύ State persisted to .aether/data/ β€” safe to /clear if needed
499
+ ```
500
+
501
+ **IMPORTANT:** Build does NOT update task statuses or advance state. Run `/ant:continue` to:
502
+ - Mark tasks as completed
503
+ - Extract learnings
504
+ - Advance to next phase
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: ant:colonize
3
+ description: Analyze codebase and prepare for colony work
4
+ ---
5
+
6
+ You are the **Queen**. Perform initial codebase analysis.
7
+
8
+ ## Instructions
9
+
10
+ ### Step 1: Validate
11
+
12
+ Read `.aether/data/COLONY_STATE.json`.
13
+
14
+ If `goal: null` -> output "No colony initialized. Run /ant:init first.", stop.
15
+ If `plan.phases` not empty -> output "Colony already has phases. Use /ant:continue.", stop.
16
+
17
+ ### Step 2: Surface Scan
18
+
19
+ Use Glob to find key files (read up to 20 total).
20
+
21
+ **Package manifests:**
22
+ - package.json, Cargo.toml, pyproject.toml, go.mod, Gemfile, pom.xml, build.gradle
23
+
24
+ **Documentation:**
25
+ - README.md, README.*, docs/README.md
26
+
27
+ **Entry points:**
28
+ - src/index.*, src/main.*, main.*, app.*, lib/index.*, index.*
29
+
30
+ **Config:**
31
+ - tsconfig.json, .eslintrc.*, jest.config.*, vite.config.*, webpack.config.*
32
+
33
+ Read found files. Extract:
34
+ - Tech stack (language, framework, key dependencies)
35
+ - Entry points (main files)
36
+ - Key directories (src/, lib/, tests/, etc.)
37
+ - File counts per top-level directory
38
+
39
+ ### Step 3: Write CODEBASE.md
40
+
41
+ Create `.planning/CODEBASE.md` (ensure `.planning/` exists first):
42
+
43
+ ```markdown
44
+ # Codebase Overview
45
+
46
+ **Stack:** <language> + <framework>
47
+ **Entry:** <main entry points>
48
+
49
+ **Structure:**
50
+ - <dir>/ (<count> files)
51
+ - ...
52
+
53
+ **Key Dependencies:**
54
+ - <dep1>: <purpose>
55
+ - <dep2>: <purpose>
56
+ - ...
57
+
58
+ **Test Location:** <tests/ or __tests__/ or similar>
59
+
60
+ **Notes:**
61
+ - <any notable patterns or conventions observed>
62
+ ```
63
+
64
+ Keep output under 50 lines. Focus on what's relevant to the colony goal.
65
+
66
+ ### Step 4: Update State
67
+
68
+ Read `.aether/data/COLONY_STATE.json`. Update:
69
+ - Set `state` to `"IDLE"` (ready for planning)
70
+
71
+ Write Event: Append to the `events` array as pipe-delimited string:
72
+ `"<ISO-8601 UTC>|codebase_colonized|colonize|Codebase analyzed: <primary language/framework>"`
73
+
74
+ If the `events` array exceeds 100 entries, remove the oldest entries to keep only 100.
75
+
76
+ Write the updated COLONY_STATE.json.
77
+
78
+ ### Step 5: Confirm
79
+
80
+ Output:
81
+
82
+ ```
83
+ Codebase analysis complete.
84
+ See: .planning/CODEBASE.md
85
+
86
+ Stack: <language> + <framework>
87
+ Entry: <main entry point>
88
+ Files: <total count> across <N> directories
89
+
90
+ Next:
91
+ /ant:plan Generate project plan
92
+ /ant:focus "<area>" Inject focus before planning
93
+ /ant:redirect "<pat>" Inject constraint before planning
94
+ ```