aether-colony 3.1.1 β†’ 3.1.2

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.
@@ -1,982 +0,0 @@
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 0: Version Check (Non-blocking)
13
-
14
- Run using the Bash tool: `bash .aether/aether-utils.sh version-check 2>/dev/null || true`
15
-
16
- If the command succeeds and the JSON result contains a non-empty string, display it as a one-line notice. Proceed regardless of outcome.
17
-
18
- ### Step 0.6: Verify LiteLLM Proxy
19
-
20
- Check that the LiteLLM proxy is running for model routing:
21
-
22
- ```bash
23
- curl -s http://localhost:4000/health | grep -q "healthy" && echo "Proxy healthy" || echo "Proxy not running - workers will use default model"
24
- ```
25
-
26
- If proxy is not healthy, log a warning but continue (workers will fall back to default routing).
27
-
28
- ### Step 0.5: Load Colony State
29
-
30
- Run using Bash tool: `bash .aether/aether-utils.sh load-state`
31
-
32
- If the command fails (non-zero exit or JSON has ok: false):
33
- 1. Parse error JSON
34
- 2. If error code is E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
35
- 3. If validation error: Display error details with recovery suggestion and stop
36
- 4. For other errors: Display generic error and suggest /ant:status for diagnostics
37
-
38
- If successful:
39
- 1. Parse the state JSON from result field
40
- 2. Check if goal is null - if so: "No colony initialized. Run /ant:init first." and stop
41
- 3. Extract current_phase and phase name from plan.phases[current_phase - 1].name
42
- 4. Display brief resumption context:
43
- ```
44
- πŸ”„ Resuming: Phase X - Name
45
- ```
46
- (If HANDOFF.md exists, this provides orientation before the build proceeds)
47
-
48
- After displaying context, run: `bash .aether/aether-utils.sh unload-state` to release the lock.
49
-
50
- ### Step 1: Validate + Read State
51
-
52
- **Parse $ARGUMENTS:**
53
- 1. Extract the phase number (first argument)
54
- 2. Check remaining arguments for flags:
55
- - If contains `--verbose` or `-v`: set `verbose_mode = true`
56
- - If contains `--model <name>` or `-m <name>`: set `cli_model_override = <name>`
57
- - Otherwise: set defaults
58
-
59
- If the phase number is empty or not a number:
60
-
61
- ```
62
- Usage: /ant:build <phase_number> [--verbose|-v] [--model <model>|-m <model>]
63
-
64
- Options:
65
- --verbose, -v Show full completion details (spawn tree, TDD, patterns)
66
- --model, -m <name> Override model for this build (one-time)
67
-
68
- Examples:
69
- /ant:build 1 Build Phase 1 (compact output)
70
- /ant:build 1 --verbose Build Phase 1 (full details)
71
- /ant:build 3 -v Build Phase 3 (full details)
72
- /ant:build 1 --model glm-5 Build Phase 1 with glm-5 for all workers
73
- ```
74
-
75
- Stop here.
76
-
77
- **Validate CLI model override (if provided):**
78
- If `cli_model_override` is set:
79
- 1. Validate the model: `bash .aether/aether-utils.sh model-profile validate "$cli_model_override"`
80
- 2. Parse JSON result - if `.result.valid` is false:
81
- - Display: `Error: Invalid model "$cli_model_override"`
82
- - Display: `Valid models: {list from .result.models}`
83
- - Stop here
84
- 3. If valid: Display `Using override model: {model}`
85
-
86
- **Auto-upgrade old state:**
87
- If `version` field is missing, "1.0", or "2.0":
88
- 1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
89
- 2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
90
- 3. Output: `State auto-upgraded to v3.0`
91
- 4. Continue with command.
92
-
93
- Extract:
94
- - `goal`, `state`, `current_phase` from top level
95
- - `plan.phases` for phase data
96
- - `errors.records` for error context
97
- - `memory` for decisions/learnings
98
-
99
- **Validate:**
100
- - If `plan.phases` is empty -> output `No project plan. Run /ant:plan first.` and stop.
101
- - Find the phase matching the requested ID. If not found -> output `Phase {id} not found.` and stop.
102
- - If the phase status is `"completed"` -> output `Phase {id} already completed.` and stop.
103
-
104
- ### Step 1.5: Blocker Advisory (Non-blocking)
105
-
106
- Check for unresolved blocker flags on the requested phase:
107
-
108
- ```bash
109
- bash .aether/aether-utils.sh flag-check-blockers {phase_number}
110
- ```
111
-
112
- Parse the JSON result (`.result.blockers`):
113
-
114
- - **If blockers == 0:** Display nothing (or optionally a brief `No active blockers for Phase {id}.` line). Proceed to Step 2.
115
- - **If blockers > 0:** Retrieve blocker details:
116
- ```bash
117
- bash .aether/aether-utils.sh flag-list --type blocker --phase {phase_number}
118
- ```
119
- Parse `.result.flags` and display an advisory warning:
120
- ```
121
- ⚠️ BLOCKER ADVISORY: {blockers} unresolved blocker(s) for Phase {id}
122
- {for each flag in result.flags:}
123
- - [{flag.id}] {flag.title}
124
- {end for}
125
-
126
- Consider reviewing with /ant:flags or auto-fixing with /ant:swarm before building.
127
- Proceeding anyway...
128
- ```
129
- **This is advisory only β€” do NOT stop.** Continue to Step 2 regardless.
130
-
131
- ### Step 2: Update State
132
-
133
- Read then update `.aether/data/COLONY_STATE.json`:
134
- - Set `state` to `"EXECUTING"`
135
- - Set `current_phase` to the phase number
136
- - Set the phase's `status` to `"in_progress"` in `plan.phases[N]`
137
- - Add `build_started_at` field with current ISO-8601 UTC timestamp
138
- - Append to `events`: `"<timestamp>|phase_started|build|Phase <id>: <name> started"`
139
-
140
- If `events` exceeds 100 entries, keep only the last 100.
141
-
142
- Write COLONY_STATE.json.
143
-
144
- ### Step 3: Git Checkpoint
145
-
146
- Create a git checkpoint for rollback capability.
147
-
148
- ```bash
149
- git rev-parse --git-dir 2>/dev/null
150
- ```
151
-
152
- - **If succeeds** (is a git repo):
153
- 1. Check for changes in Aether-managed directories only: `.aether .claude/commands/ant .claude/commands/st .opencode runtime bin`
154
- 2. **If changes exist**: `git stash push -m "aether-checkpoint: pre-phase-$PHASE_NUMBER" -- .aether .claude/commands/ant .claude/commands/st .opencode runtime bin`
155
- - IMPORTANT: Never use `--include-untracked` β€” it stashes ALL files including user work!
156
- - Verify: `git stash list | head -1 | grep "aether-checkpoint"` β€” warn if empty
157
- - Store checkpoint as `{type: "stash", ref: "aether-checkpoint: pre-phase-$PHASE_NUMBER"}`
158
- 3. **If clean working tree**: Record `HEAD` hash via `git rev-parse HEAD`
159
- - Store checkpoint as `{type: "commit", ref: "$HEAD_HASH"}`
160
- - **If fails** (not a git repo): Set checkpoint to `{type: "none", ref: "(not a git repo)"}`.
161
-
162
- Rollback procedure: `git stash pop` (if type is "stash") or `git reset --hard $ref` (if type is "commit").
163
-
164
- Output header:
165
-
166
- ```
167
- πŸ”¨πŸœπŸ—οΈπŸœπŸ”¨ ═══════════════════════════════════════════════════
168
- B U I L D I N G P H A S E {id}
169
- ═══════════════════════════════════════════════════ πŸ”¨πŸœπŸ—οΈπŸœπŸ”¨
170
-
171
- πŸ“ Phase {id}: {name}
172
- πŸ’Ύ Git Checkpoint: {checkpoint_type} β†’ {checkpoint_ref}
173
- πŸ”„ Rollback: `git stash pop` (stash) or `git reset --hard {ref}` (commit)
174
- ```
175
-
176
- ### Step 4: Load Constraints
177
-
178
- Read `.aether/data/constraints.json` if it exists.
179
-
180
- Format for display:
181
- ```
182
- CONSTRAINTS:
183
- FOCUS: {focus areas, comma-separated}
184
- AVOID: {patterns to avoid from constraints}
185
- ```
186
-
187
- If file doesn't exist or is empty:
188
- ```
189
- CONSTRAINTS: (none)
190
- ```
191
-
192
- ### Step 4.5: Archaeologist Pre-Build Scan
193
-
194
- **Conditional step β€” only fires when the phase modifies existing files.**
195
-
196
- 1. **Detect existing-file modification:**
197
- Examine each task in the phase. Look at task descriptions, constraints, and hints for signals:
198
- - Keywords: "update", "modify", "add to", "integrate into", "extend", "change", "refactor", "fix"
199
- - References to existing file paths (files that already exist in the repo)
200
- - Task type: if a task is purely "create new file X" with no references to existing code, it is new-file-only
201
-
202
- **If ALL tasks are new-file-only** (no existing files will be modified):
203
- - Skip this step silently β€” produce no output, no spawn
204
- - Proceed directly to Step 5
205
-
206
- 2. **If existing code modification detected β€” spawn Archaeologist Scout:**
207
-
208
- Generate archaeologist name and log:
209
- ```bash
210
- bash .aether/aether-utils.sh generate-ant-name "archaeologist"
211
- bash .aether/aether-utils.sh spawn-log "Queen" "scout" "{archaeologist_name}" "Pre-build archaeology scan"
212
- ```
213
-
214
- Display:
215
- ```
216
- 🏺 Spawning Archaeologist: {archaeologist_name}
217
- Scanning history of files to be modified...
218
- ```
219
-
220
- Spawn a Scout (using Task tool with `subagent_type="general"`) with this prompt:
221
-
222
- ```
223
- You are {Archaeologist-Name}, a 🏺 Archaeologist Ant (Scout) in the Aether Colony.
224
-
225
- --- YOUR MISSION ---
226
- Perform a pre-build archaeology scan on files that are about to be modified.
227
-
228
- --- FILES TO INVESTIGATE ---
229
- {list of existing files that will be modified by this phase's tasks}
230
-
231
- --- INSTRUCTIONS ---
232
- For each file:
233
- 1. Read the file to understand its current state
234
- 2. Run: git log --oneline -15 -- "{file_path}" to see recent history
235
- 3. Run: git log --all --grep="fix\|bug\|workaround\|hack\|revert" --oneline -- "{file_path}" to find incident history
236
- 4. Run: git blame "{file_path}" | head -40 to see authorship of key sections
237
- 5. Note any TODO/FIXME/HACK markers in the current code
238
-
239
- --- MODEL CONTEXT ---
240
- Assigned model: {model} (from caste: archaeologist)
241
- This ant is running as: {Ant-Name} (archaeologist caste)
242
-
243
- --- OUTPUT ---
244
- For each file, report:
245
- - WHY key code sections exist (from commit messages)
246
- - Known workarounds or hacks that must not be broken
247
- - Key architectural decisions visible in history
248
- - Areas of caution (high churn, reverted changes, emergency fixes)
249
- - Sections that are stable bedrock vs volatile sand
250
-
251
- Include in your header:
252
- Model: {model} | Caste: archaeologist | Ant: {Ant-Name}
253
-
254
- Keep the report concise and actionable β€” builders need quick context, not a thesis.
255
- Format as plain text with file headers. No JSON output needed.
256
- ```
257
-
258
- **Wait for results** (blocking β€” use TaskOutput with `block: true`).
259
-
260
- Log completion:
261
- ```bash
262
- bash .aether/aether-utils.sh spawn-complete "{archaeologist_name}" "completed" "Pre-build archaeology scan"
263
- ```
264
-
265
- 3. **Store and display findings:**
266
-
267
- Store the archaeologist's output as `archaeology_context`.
268
-
269
- Display summary:
270
- ```
271
- 🏺 ARCHAEOLOGY CONTEXT
272
- =====================
273
- {summary of findings from archaeologist}
274
- ```
275
-
276
- 4. **Injection into builder prompts:**
277
- The `archaeology_context` will be injected into builder prompts in Step 5.1 (see below).
278
- If this step was skipped (no existing files modified), the archaeology section is omitted from builder prompts.
279
-
280
- ### Step 5: Analyze Tasks and Plan Spawns
281
-
282
- **YOU (the Queen) will spawn workers directly. Do NOT delegate to a single Prime Worker.**
283
-
284
- Log phase start:
285
- ```bash
286
- bash .aether/aether-utils.sh activity-log "EXECUTING" "Queen" "Phase {id}: {name} - Queen dispatching workers"
287
- ```
288
-
289
- Analyze the phase tasks:
290
-
291
- 1. **Group tasks by dependencies:**
292
- - **Wave 1:** Tasks with `depends_on: "none"` or `depends_on: []` (can run in parallel)
293
- - **Wave 2:** Tasks depending on Wave 1 tasks
294
- - **Wave 3+:** Continue until all tasks assigned
295
-
296
- 2. **Assign castes:**
297
- - Implementation tasks β†’ πŸ”¨ Builder
298
- - Research/docs tasks β†’ πŸ” Scout
299
- - Testing/validation β†’ πŸ‘οΈ Watcher (ALWAYS spawn at least one)
300
- - Resilience testing β†’ 🎲 Chaos (ALWAYS spawn one after Watcher)
301
-
302
- 3. **Generate ant names for each worker:**
303
- ```bash
304
- bash .aether/aether-utils.sh generate-ant-name "builder"
305
- bash .aether/aether-utils.sh generate-ant-name "watcher"
306
- bash .aether/aether-utils.sh generate-ant-name "chaos"
307
- ```
308
-
309
- Display spawn plan:
310
- ```
311
- 🐜 SPAWN PLAN
312
- =============
313
- Wave 1 (parallel):
314
- πŸ”¨{Builder-Name}: Task {id} - {description}
315
- πŸ”¨{Builder-Name}: Task {id} - {description}
316
-
317
- Wave 2 (after Wave 1):
318
- πŸ”¨{Builder-Name}: Task {id} - {description}
319
-
320
- Verification:
321
- πŸ‘οΈ{Watcher-Name}: Verify all work independently
322
- 🎲{Chaos-Name}: Resilience testing (after Watcher)
323
-
324
- Total: {N} Builders + 1 Watcher + 1 Chaos = {N+2} spawns
325
- ```
326
-
327
- ### Step 5.1: Spawn Wave 1 Workers (Parallel)
328
-
329
- **CRITICAL: Spawn ALL Wave 1 workers in a SINGLE message using multiple Task tool calls.**
330
-
331
- For each Wave 1 task, use Task tool with `subagent_type="general"` and `run_in_background: true`:
332
-
333
- Log each spawn:
334
- ```bash
335
- bash .aether/aether-utils.sh spawn-log "Queen" "builder" "{ant_name}" "{task_description}"
336
- ```
337
-
338
- **Model Assignment:**
339
-
340
- Before spawning each worker, get the optimal model for their caste with task-based routing:
341
-
342
- ```bash
343
- # Get model assignment for this caste with task-based routing
344
- model_info=$(bash .aether/aether-utils.sh model-profile select "{caste}" "{task_description}" "{cli_model_override}")
345
- model=$(echo "$model_info" | jq -r '.result.model')
346
- source=$(echo "$model_info" | jq -r '.result.source')
347
-
348
- # Log model assignment with source
349
- bash .aether/aether-utils.sh activity-log "MODEL" "Queen" "{ant_name} ({caste}): assigned to $model (source: $source)"
350
- ```
351
-
352
- **Environment Setup for Workers:**
353
-
354
- When spawning workers, the following environment variables must be set for Claude Code to use the LiteLLM proxy with the correct model:
355
-
356
- ```bash
357
- export ANTHROPIC_BASE_URL="http://localhost:4000"
358
- export ANTHROPIC_AUTH_TOKEN="sk-litellm-local"
359
- export ANTHROPIC_MODEL="$model" # From model-profile get above
360
- ```
361
-
362
- **IMPORTANT:** The Task tool inherits environment from the parent Claude Code process. Set these variables in the shell before spawning workers, or ensure they are already set in the parent environment.
363
-
364
- ### Step 5.1.5: Export Model Environment
365
-
366
- Before spawning workers, export the environment variables for LiteLLM proxy routing:
367
-
368
- ```bash
369
- export ANTHROPIC_BASE_URL="http://localhost:4000"
370
- export ANTHROPIC_AUTH_TOKEN="sk-litellm-local"
371
- ```
372
-
373
- For each worker spawn, also export their specific model:
374
-
375
- ```bash
376
- export ANTHROPIC_MODEL="$model" # From model-profile get
377
- ```
378
-
379
- **Note:** These environment variables will be inherited by spawned workers via the Task tool, enabling automatic model routing through the LiteLLM proxy.
380
-
381
- **Builder Worker Prompt Template:**
382
- ```
383
- You are {Ant-Name}, a πŸ”¨ Builder Ant in the Aether Colony at depth {depth}.
384
-
385
- --- YOUR TASK ---
386
- Task {id}: {description}
387
-
388
- --- MODEL CONTEXT ---
389
- Optimal model for this task: {model} (from caste: {caste})
390
- Model characteristics: {model_description}
391
- Task complexity expectation: {simple|medium|complex}
392
-
393
- The model has been pre-selected based on your caste's typical work patterns.
394
- - glm-5: Use for complex reasoning, architecture, planning
395
- - kimi-k2.5: Use for fast implementation, coding, refactoring
396
- - minimax-2.5: Use for validation, research, quick checks
397
-
398
- --- CONTEXT ---
399
- Goal: "{colony_goal}"
400
- Phase: {phase_name}
401
-
402
- --- CONSTRAINTS ---
403
- {constraints from Step 4}
404
-
405
- --- COLONY KNOWLEDGE ---
406
- {Include this section ONLY if memory.instincts or memory.phase_learnings exist in COLONY_STATE.json.}
407
-
408
- Top Instincts (proven patterns β€” follow these):
409
- {For each instinct in memory.instincts where confidence >= 0.5, sorted by confidence descending, max 5:}
410
- [{confidence}] {trigger} β†’ {action}
411
- {If none qualify: omit this sub-section}
412
-
413
- Recent Learnings:
414
- {For each learning in memory.phase_learnings (last 3 phases only) where status == "validated":}
415
- - {claim}
416
- {If none qualify: omit this sub-section}
417
-
418
- Error Patterns to Avoid:
419
- {For each pattern in errors.flagged_patterns:}
420
- ⚠️ {description}
421
- {If none: omit this sub-section}
422
-
423
- {If archaeology_context exists (Step 4.5 produced findings):}
424
- --- ARCHAEOLOGY CONTEXT ---
425
- The following historical insights were discovered about files you will modify:
426
- {archaeology_context findings}
427
- {End if β€” omit this entire section if Step 4.5 was skipped}
428
-
429
- --- INSTRUCTIONS ---
430
- 1. Read .aether/workers.md for Builder discipline
431
- 2. Implement the task completely
432
- 3. Write actual test files (not just claims)
433
- 4. Log your work: bash .aether/aether-utils.sh activity-log "CREATED" "{ant_name} (Builder)" "{file_path}"
434
- 5. Before modifying any file, check for grave markers:
435
- bash .aether/aether-utils.sh grave-check "{file_path}"
436
- If caution_level is "high": read the failure_summary, add extra test coverage for that area, mention the graveyard in your summary
437
- If caution_level is "low": note it and proceed carefully
438
- If caution_level is "none": proceed normally
439
-
440
- --- SPAWN CAPABILITY ---
441
- You are at depth {depth}. You MAY spawn sub-workers if you encounter genuine surprise (3x expected complexity).
442
-
443
- Spawn limits by depth:
444
- - Depth 1: max 4 spawns
445
- - Depth 2: max 2 spawns
446
- - Depth 3: NO spawns (complete inline)
447
-
448
- When to spawn:
449
- - Task is 3x larger than expected
450
- - Discovered sub-domain requiring different expertise
451
- - Found blocking dependency needing parallel investigation
452
-
453
- DO NOT spawn for work you can complete in < 10 tool calls.
454
-
455
- Before spawning:
456
- 1. Check: bash .aether/aether-utils.sh spawn-can-spawn {depth}
457
- 2. Generate name: bash .aether/aether-utils.sh generate-ant-name "{caste}"
458
- 3. Log: bash .aether/aether-utils.sh spawn-log "{your_name}" "{caste}" "{child_name}" "{task}"
459
- 4. Use Task tool with subagent_type="general"
460
- 5. After completion: bash .aether/aether-utils.sh spawn-complete "{child_name}" "{status}" "{summary}"
461
-
462
- Full spawn format: .aether/workers.md section "Spawning Sub-Workers"
463
-
464
- --- OUTPUT ---
465
- Return JSON:
466
- {
467
- "ant_name": "{your name}",
468
- "task_id": "{task_id}",
469
- "status": "completed" | "failed" | "blocked",
470
- "summary": "What you accomplished",
471
- "files_created": [],
472
- "files_modified": [],
473
- "tests_written": [],
474
- "blockers": [],
475
- "spawns": [],
476
- "model_context": {
477
- "assigned": "{model}",
478
- "caste": "builder",
479
- "source": "caste-default",
480
- "reported_at": "ISO-8601 timestamp"
481
- }
482
- }
483
- ```
484
-
485
- ### Step 5.2: Collect Wave 1 Results (BLOCKING)
486
-
487
- **CRITICAL: You MUST wait for ALL Wave 1 workers to complete before proceeding.**
488
-
489
- For each spawned worker, call TaskOutput with `block: true` to wait for completion:
490
- - Use the task_id from each Task tool response
491
- - Do NOT proceed to Step 5.3 until ALL workers have returned results
492
- - Parse each worker's JSON output to collect: status, files_created, files_modified, blockers
493
-
494
- Store all results for synthesis in Step 5.6.
495
-
496
- For each completed worker, log:
497
- ```bash
498
- bash .aether/aether-utils.sh spawn-complete "{ant_name}" "completed" "{summary}"
499
- ```
500
-
501
- **Only proceed to Step 5.3 after ALL Wave 1 TaskOutput calls have returned.**
502
-
503
- ### Step 5.3: Spawn Wave 2+ Workers (Sequential Waves)
504
-
505
- Repeat Step 5.1-5.2 for each subsequent wave, waiting for previous wave to complete.
506
-
507
- ### Step 5.4: Spawn Watcher for Verification
508
-
509
- **MANDATORY: Always spawn a Watcher β€” testing must be independent.**
510
-
511
- ```bash
512
- bash .aether/aether-utils.sh spawn-log "Queen" "watcher" "{watcher_name}" "Independent verification"
513
- ```
514
-
515
- **Watcher Worker Prompt:**
516
- ```
517
- You are {Watcher-Name}, a πŸ‘οΈ Watcher Ant in the Aether Colony at depth {depth}.
518
-
519
- --- YOUR MISSION ---
520
- Independently verify all work done by Builders in Phase {id}.
521
-
522
- --- MODEL CONTEXT ---
523
- Optimal model for verification: {model} (from caste: watcher)
524
- Model characteristics: Efficient validation and testing model
525
- Verification focus: Quick, thorough checks with fast turnaround
526
-
527
- --- WHAT TO VERIFY ---
528
- Files created: {list from builder results}
529
- Files modified: {list from builder results}
530
-
531
- --- COMMAND RESOLUTION ---
532
- Resolve build, test, type-check, and lint commands using this priority chain (stop at first match per command):
533
- 1. **CLAUDE.md** β€” Check project CLAUDE.md (in your system context) for explicit commands
534
- 2. **CODEBASE.md** β€” Read `.planning/CODEBASE.md` `## Commands` section
535
- 3. **Fallback** β€” Use language-specific examples below (Execution Verification section)
536
-
537
- Use resolved commands for all verification steps below.
538
-
539
- --- VERIFICATION CHECKLIST ---
540
- 1. Do the files exist? (Read each one)
541
- 2. Does the code compile/parse? (Run build command)
542
- 3. Do tests exist AND pass? (Run test command)
543
- 4. Are success criteria met? {list success_criteria}
544
-
545
- --- EXECUTION VERIFICATION (MANDATORY) ---
546
- Before assigning a quality score, you MUST attempt to execute the code:
547
-
548
- 1. Syntax check: Run the language's syntax checker
549
- - Python: `python3 -m py_compile {file}`
550
- - Swift: `swiftc -parse {file}`
551
- - TypeScript: `npx tsc --noEmit`
552
-
553
- 2. Import check: Verify main entry point can be imported
554
- - Python: `python3 -c "import {module}"`
555
- - Node: `node -e "require('{entry}')"`
556
-
557
- 3. Launch test: Attempt to start the application briefly
558
- - Run main entry point with timeout
559
- - If GUI, try headless mode if possible
560
- - If launches successfully = pass
561
- - If crashes = CRITICAL severity
562
-
563
- 4. Test suite: If tests exist, run them
564
- - Record pass/fail counts
565
-
566
- CRITICAL: If ANY execution check fails, quality_score CANNOT exceed 6/10.
567
-
568
- --- SPAWN CAPABILITY ---
569
- You are at depth {depth}. You MAY spawn sub-workers for:
570
- - Deep investigation of suspicious code patterns
571
- - Parallel verification of independent components
572
- - Debugging assistance for complex failures
573
-
574
- Spawn limits: Depth 1β†’4, Depth 2β†’2, Depth 3β†’0
575
-
576
- Before spawning:
577
- bash .aether/aether-utils.sh spawn-log "{your_name}" "{caste}" "{child_name}" "{task}"
578
-
579
- --- CRITICAL ---
580
- - You did NOT build this code β€” verify it objectively
581
- - "Build passing" is NOT enough β€” check runtime execution
582
- - Be skeptical β€” Builders may have cut corners
583
-
584
- --- OUTPUT ---
585
- Return JSON:
586
- {
587
- "ant_name": "{your name}",
588
- "verification_passed": true | false,
589
- "files_verified": [],
590
- "execution_verification": {
591
- "syntax_check": {"command": "...", "passed": true|false},
592
- "import_check": {"command": "...", "passed": true|false},
593
- "launch_test": {"command": "...", "passed": true|false, "error": null},
594
- "test_suite": {"command": "...", "passed": N, "failed": N}
595
- },
596
- "build_result": {"command": "...", "passed": true|false},
597
- "test_result": {"command": "...", "passed": N, "failed": N},
598
- "success_criteria_results": [
599
- {"criterion": "...", "passed": true|false, "evidence": "..."}
600
- ],
601
- "issues_found": [],
602
- "quality_score": N,
603
- "recommendation": "proceed" | "fix_required",
604
- "spawns": [],
605
- "model_context": {
606
- "assigned": "{model}",
607
- "caste": "watcher",
608
- "source": "caste-default",
609
- "reported_at": "ISO-8601 timestamp"
610
- }
611
- }
612
- ```
613
-
614
- ### Step 5.4.1: Collect Watcher Results (BLOCKING)
615
-
616
- **CRITICAL: You MUST wait for the Watcher to complete before proceeding.**
617
-
618
- Call TaskOutput with `block: true` using the Watcher's task_id:
619
- - Wait for the Watcher's JSON response
620
- - Parse: verification_passed, issues_found, quality_score, recommendation
621
- - Store results for synthesis in Step 5.6
622
-
623
- **Only proceed to Step 5.4.2 after Watcher TaskOutput has returned.**
624
-
625
- ### Step 5.4.2: Spawn Chaos Ant for Resilience Testing
626
-
627
- **After the Watcher completes, spawn a Chaos Ant to probe the phase work for edge cases and boundary conditions.**
628
-
629
- Generate a chaos ant name and log the spawn:
630
- ```bash
631
- bash .aether/aether-utils.sh generate-ant-name "chaos"
632
- bash .aether/aether-utils.sh spawn-log "Queen" "chaos" "{chaos_name}" "Resilience testing of Phase {id} work"
633
- ```
634
-
635
- **Retrieve existing flags for this phase** (to avoid duplicate findings):
636
- ```bash
637
- bash .aether/aether-utils.sh flag-list --phase {phase_number}
638
- ```
639
- Parse the result and extract unresolved flag titles into a list: `{existing_flag_titles}` (comma-separated titles from `.result.flags[].title`). If no flags exist, set `{existing_flag_titles}` to "None".
640
-
641
- Spawn the Chaos Ant using Task tool with `subagent_type="general"`:
642
-
643
- **Chaos Ant Prompt:**
644
- ```
645
- You are {Chaos-Name}, a 🎲 Chaos Ant (Resilience Tester) in the Aether Colony at depth {depth}.
646
-
647
- --- YOUR MISSION ---
648
- Probe the work done by Builders in Phase {id} for edge cases, boundary conditions, and unexpected inputs.
649
-
650
- --- MODEL CONTEXT ---
651
- Optimal model for chaos testing: {model} (from caste: chaos)
652
- Model characteristics: Efficient edge case exploration
653
- Testing focus: Rapid probing of boundaries and edge cases
654
-
655
- --- SCOPE ---
656
- Files created: {list from builder results}
657
- Files modified: {list from builder results}
658
-
659
- --- EXISTING FLAGS (already known β€” do NOT re-report) ---
660
- {existing_flag_titles}
661
- These issues have already been flagged. Do NOT report findings that duplicate or overlap with the above titles. Focus your 5 scenarios on NEW, undiscovered issues only.
662
-
663
- --- RULES ---
664
- 1. Limit to 5 edge case scenarios maximum
665
- 2. You are a TESTER, not an attacker β€” use investigating/probing language
666
- 3. Do NOT modify any code β€” read-only analysis
667
- 4. Focus on: edge cases, boundary conditions, error handling gaps, state corruption risks, unexpected inputs
668
- 5. Do NOT re-report issues listed in EXISTING FLAGS above β€” skip any finding that substantially overlaps with a known flag
669
-
670
- --- OUTPUT ---
671
- Return JSON:
672
- {
673
- "ant_name": "{your name}",
674
- "scenarios_tested": 5,
675
- "findings": [
676
- {
677
- "id": 1,
678
- "category": "edge_case|boundary|error_handling|state|unexpected_input",
679
- "severity": "critical|high|medium|low|info",
680
- "title": "...",
681
- "description": "...",
682
- "reproduction_steps": ["..."],
683
- "affected_files": ["..."],
684
- "recommendation": "..."
685
- }
686
- ],
687
- "overall_resilience": "strong|moderate|weak",
688
- "summary": "...",
689
- "model_context": {
690
- "assigned": "{model}",
691
- "caste": "chaos",
692
- "source": "caste-default",
693
- "reported_at": "ISO-8601 timestamp"
694
- }
695
- }
696
- ```
697
-
698
- **Collect Chaos Ant results (BLOCKING):**
699
-
700
- Call TaskOutput with `block: true` using the Chaos Ant's task_id:
701
- - Wait for the Chaos Ant's JSON response
702
- - Parse: findings, overall_resilience, summary
703
- - Store results for synthesis in Step 5.6
704
-
705
- **Flag critical/high findings:**
706
-
707
- If any findings have severity `"critical"` or `"high"`:
708
- ```bash
709
- # Create a blocker flag for each critical/high chaos finding
710
- bash .aether/aether-utils.sh flag-add "blocker" "{finding.title}" "{finding.description}" "chaos-testing" {phase_number}
711
- ```
712
-
713
- Log the flag:
714
- ```bash
715
- bash .aether/aether-utils.sh activity-log "FLAG" "Chaos" "Created blocker: {finding.title}"
716
- ```
717
-
718
- Log chaos ant completion:
719
- ```bash
720
- bash .aether/aether-utils.sh spawn-complete "{chaos_name}" "completed" "{summary}"
721
- ```
722
-
723
- **Only proceed to Step 5.5 after Chaos Ant TaskOutput has returned.**
724
-
725
- ### Step 5.5: Create Flags for Verification Failures
726
-
727
- If the Watcher reported `verification_passed: false` or `recommendation: "fix_required"`:
728
-
729
- For each issue in `issues_found`:
730
- ```bash
731
- # Create a blocker flag for each verification failure
732
- bash .aether/aether-utils.sh flag-add "blocker" "{issue_title}" "{issue_description}" "verification" {phase_number}
733
- ```
734
-
735
- Log the flag creation:
736
- ```bash
737
- bash .aether/aether-utils.sh activity-log "FLAG" "Watcher" "Created blocker: {issue_title}"
738
- ```
739
-
740
- This ensures verification failures are persisted as blockers that survive context resets. Chaos Ant findings are flagged in Step 5.4.2.
741
-
742
- ### Step 5.6: Synthesize Results
743
-
744
- **This step runs ONLY after ALL TaskOutput calls have returned (Steps 5.2, 5.3, 5.4.1, 5.4.2).**
745
-
746
- Collect all worker outputs and create phase summary:
747
-
748
- ```json
749
- {
750
- "status": "completed" | "failed" | "blocked",
751
- "summary": "...",
752
- "tasks_completed": [...],
753
- "tasks_failed": [...],
754
- "files_created": [...],
755
- "files_modified": [...],
756
- "spawn_metrics": {
757
- "spawn_count": {total workers spawned, including archaeologist if Step 4.5 fired},
758
- "builder_count": {N},
759
- "watcher_count": 1,
760
- "chaos_count": 1,
761
- "archaeologist_count": {0 or 1, conditional on Step 4.5},
762
- "parallel_batches": {number of waves}
763
- },
764
- "spawn_tree": {
765
- "{Archaeologist-Name}": {"caste": "archaeologist", "task": "pre-build history scan", "status": "completed"},
766
- "{Builder-Name}": {"caste": "builder", "task": "...", "status": "completed"},
767
- "{Watcher-Name}": {"caste": "watcher", "task": "verify", "status": "completed"},
768
- "{Chaos-Name}": {"caste": "chaos", "task": "resilience testing", "status": "completed"}
769
- },
770
- "verification": {from Watcher output},
771
- "resilience": {from Chaos Ant output},
772
- "archaeology": {from Archaeologist output, or null if Step 4.5 was skipped},
773
- "quality_notes": "..."
774
- }
775
- ```
776
-
777
- **Graveyard Recording:**
778
- For each worker that returned `status: "failed"`:
779
- For each file in that worker's `files_modified` or `files_created`:
780
- ```bash
781
- bash .aether/aether-utils.sh grave-add "{file}" "{ant_name}" "{task_id}" {phase} "{first blocker or summary}"
782
- ```
783
- Log the grave marker:
784
- ```bash
785
- bash .aether/aether-utils.sh activity-log "GRAVE" "Queen" "Grave marker placed at {file} β€” {ant_name} failed: {summary}"
786
- ```
787
-
788
- Only fires when workers fail. Zero impact on successful builds.
789
-
790
- --- SPAWN TRACKING ---
791
-
792
- The spawn tree will be visible in `/ant:watch` because each spawn is logged.
793
-
794
- --- OUTPUT FORMAT ---
795
-
796
- Return JSON:
797
- {
798
- "status": "completed" | "failed" | "blocked",
799
- "summary": "What the phase accomplished",
800
- "tasks_completed": ["1.1", "1.2"],
801
- "tasks_failed": [],
802
- "files_created": ["path1", "path2"],
803
- "files_modified": ["path3"],
804
- "spawn_metrics": {
805
- "spawn_count": 6,
806
- "watcher_count": 1,
807
- "chaos_count": 1,
808
- "archaeologist_count": 1,
809
- "builder_count": 3,
810
- "parallel_batches": 2,
811
- "sequential_tasks": 1
812
- },
813
- "spawn_tree": {
814
- "Relic-8": {"caste": "archaeologist", "task": "pre-build history scan", "status": "completed", "children": {}},
815
- "Hammer-42": {"caste": "builder", "task": "...", "status": "completed", "children": {}},
816
- "Vigil-17": {"caste": "watcher", "task": "...", "status": "completed", "children": {}},
817
- "Entropy-9": {"caste": "chaos", "task": "resilience testing", "status": "completed", "children": {}}
818
- },
819
- "verification": {
820
- "build": {"command": "npm run build", "exit_code": 0, "passed": true},
821
- "tests": {"command": "npm test", "passed": 24, "failed": 0, "total": 24},
822
- "success_criteria": [
823
- {"criterion": "API endpoint exists", "evidence": "GET /api/users returns 200", "passed": true},
824
- {"criterion": "Tests cover happy path", "evidence": "3 tests in users.test.ts", "passed": true}
825
- ]
826
- },
827
- "debugging": {
828
- "issues_encountered": 0,
829
- "issues_resolved": 0,
830
- "fix_attempts": 0,
831
- "architectural_concerns": []
832
- },
833
- "tdd": {
834
- "cycles_completed": 5,
835
- "tests_added": 5,
836
- "tests_total": 47,
837
- "coverage_percent": 85,
838
- "all_passing": true
839
- },
840
- "learning": {
841
- "patterns_observed": [
842
- {
843
- "type": "success",
844
- "trigger": "when implementing API endpoints",
845
- "action": "use repository pattern with DI",
846
- "evidence": "All tests passed first try"
847
- }
848
- ],
849
- "instincts_applied": ["instinct_123"],
850
- "instinct_outcomes": [
851
- {"id": "instinct_123", "success": true}
852
- ]
853
- },
854
- "quality_notes": "Any concerns or recommendations",
855
- "ui_touched": true | false
856
- }
857
- ```
858
-
859
- ### Step 6: Visual Checkpoint (if UI touched)
860
-
861
- Parse synthesis result. If `ui_touched` is true:
862
-
863
- ```
864
- Visual Checkpoint
865
- =================
866
-
867
- UI changes detected. Verify appearance before continuing.
868
-
869
- Files touched:
870
- {list files from files_created + files_modified that match UI patterns}
871
-
872
- Options:
873
- 1. Approve - UI looks correct
874
- 2. Reject - needs changes (describe issues)
875
- 3. Skip - defer visual review
876
- ```
877
-
878
- Use AskUserQuestion to get approval. Record in events:
879
- - If approved: `"<timestamp>|visual_approved|build|Phase {id} UI approved"`
880
- - If rejected: `"<timestamp>|visual_rejected|build|Phase {id} UI rejected: {reason}"`
881
-
882
- ### Step 7: Display Results
883
-
884
- **This step runs ONLY after synthesis is complete. All values come from actual worker results.**
885
-
886
- Display build summary based on synthesis results AND `verbose_mode` from Step 1:
887
-
888
- **If verbose_mode = false (compact output, ~12 lines):**
889
-
890
- ```
891
- πŸ”¨ PHASE {id} {status_icon}
892
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
893
- πŸ“ {name}
894
- πŸ“Š {status} | πŸ“ {files_created count} created, {files_modified count} modified
895
- 🐜 {spawn_count} workers | πŸ§ͺ {tests_total} tests {if all_passing}passing{else}{passed}/{total}{end if}
896
- {if learning.patterns_observed.length > 0:}🧠 +{patterns_observed.length} patterns{end if}
897
-
898
- {if synthesis.status == "failed" OR verification.recommendation == "fix_required":}
899
- ⚠️ BLOCKERS: {first 2 issues, comma-separated}
900
- {end if}
901
-
902
- ➑️ Next: {primary_command}
903
- --verbose for spawn tree, TDD details, patterns
904
- ```
905
-
906
- **Status icon logic:** completed+proceed = checkmark, blockers = warning, failed = X
907
-
908
- **Primary command logic:**
909
- - completed + proceed: `/ant:continue`
910
- - has blockers: `/ant:flags`
911
- - failed: `/ant:swarm`
912
-
913
- **If verbose_mode = true (full output):**
914
-
915
- ```
916
- πŸ”¨πŸœπŸ—οΈπŸœπŸ”¨ ═══════════════════════════════════════════════════
917
- P H A S E {id} C O M P L E T E
918
- ═══════════════════════════════════════════════════ πŸ”¨πŸœπŸ—οΈπŸœπŸ”¨
919
-
920
- πŸ“ Phase {id}: {name}
921
- πŸ“Š Status: {status}
922
- πŸ’Ύ Git Checkpoint: {commit_hash}
923
-
924
- πŸ“ Summary:
925
- {summary from synthesis}
926
-
927
- 🐜 Colony Work Tree:
928
- πŸ‘‘Queen
929
- {for each spawn in spawn_tree:}
930
- β”œβ”€β”€ {caste_emoji}{ant_name}: {task} [{status}]
931
- {end for}
932
-
933
- βœ… Tasks Completed:
934
- {for each task in tasks_completed:}
935
- 🐜 {task_id}: done
936
- {end for}
937
- {for each task in tasks_failed:}
938
- ❌ {task_id}: failed
939
- {end for}
940
-
941
- πŸ“ Files: {files_created count} created, {files_modified count} modified
942
-
943
- {if tdd.tests_added > 0:}
944
- πŸ§ͺ TDD: {tdd.cycles_completed} cycles | {tdd.tests_added} tests | {tdd.coverage_percent}% coverage
945
- {end if}
946
-
947
- {if learning.patterns_observed not empty:}
948
- 🧠 Patterns Learned:
949
- {for each pattern in learning.patterns_observed:}
950
- 🐜 {pattern.trigger} β†’ {pattern.action}
951
- {end for}
952
- {end if}
953
-
954
- {if debugging.issues_encountered > 0:}
955
- πŸ”§ Debugging: {debugging.issues_resolved}/{debugging.issues_encountered} resolved
956
- {end if}
957
-
958
- πŸ€– Model Routing:
959
- {for each spawn in spawn_tree where model_context exists:}
960
- {caste_emoji}{ant_name}: {model_context.assigned} {if model_context.assigned matches caste expectation:}βœ“{else}⚠️{end if}
961
- {end for}
962
- Proxy: {if proxy_healthy:}βœ“ Healthy @ http://localhost:4000{else}βœ— Not running (using default model){end if}
963
-
964
- 🐜 Next Steps:
965
- {if synthesis.status == "completed" AND verification.recommendation == "proceed":}
966
- /ant:continue ➑️ Advance to next phase
967
- /ant:feedback πŸ’¬ Give feedback first
968
- {else if synthesis.status == "failed" OR verification.recommendation == "fix_required":}
969
- ⚠️ BLOCKERS DETECTED - Cannot proceed until resolved
970
- /ant:flags 🚩 View blockers
971
- /ant:swarm πŸ”₯ Auto-fix issues
972
- {end if}
973
-
974
- πŸ’Ύ State persisted β€” safe to /clear, then run /ant:continue
975
- ```
976
-
977
- **Conditional Next Steps:** The suggestions above are based on actual worker results. If verification failed or blockers exist, `/ant:continue` is NOT suggested.
978
-
979
- **IMPORTANT:** Build does NOT update task statuses or advance state. Run `/ant:continue` to:
980
- - Mark tasks as completed
981
- - Extract learnings
982
- - Advance to next phase