aether-colony 5.3.2 → 5.3.3
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.
- package/.aether/aether-utils.sh +181 -5
- package/.aether/commands/build.yaml +35 -0
- package/.aether/commands/entomb.yaml +1 -1
- package/.aether/commands/init.yaml +29 -12
- package/.aether/commands/oracle.yaml +70 -0
- package/.aether/commands/patrol.yaml +2 -2
- package/.aether/commands/run.yaml +3 -3
- package/.aether/commands/swarm.yaml +1 -1
- package/.aether/docs/command-playbooks/build-complete.md +41 -8
- package/.aether/docs/command-playbooks/build-full.md +7 -7
- package/.aether/docs/command-playbooks/build-prep.md +1 -1
- package/.aether/docs/command-playbooks/continue-advance.md +33 -0
- package/.aether/docs/command-playbooks/continue-finalize.md +15 -1
- package/.aether/docs/command-playbooks/continue-full.md +15 -1
- package/.aether/docs/source-of-truth-map.md +10 -10
- package/.aether/docs/structural-learning-stack.md +283 -0
- package/.aether/utils/consolidation-seal.sh +196 -0
- package/.aether/utils/consolidation.sh +127 -0
- package/.aether/utils/curation-ants/archivist.sh +97 -0
- package/.aether/utils/curation-ants/critic.sh +214 -0
- package/.aether/utils/curation-ants/herald.sh +102 -0
- package/.aether/utils/curation-ants/janitor.sh +121 -0
- package/.aether/utils/curation-ants/librarian.sh +99 -0
- package/.aether/utils/curation-ants/nurse.sh +153 -0
- package/.aether/utils/curation-ants/orchestrator.sh +181 -0
- package/.aether/utils/curation-ants/scribe.sh +164 -0
- package/.aether/utils/curation-ants/sentinel.sh +119 -0
- package/.aether/utils/event-bus.sh +301 -0
- package/.aether/utils/graph.sh +559 -0
- package/.aether/utils/instinct-store.sh +401 -0
- package/.aether/utils/learning.sh +79 -7
- package/.aether/utils/session.sh +13 -0
- package/.aether/utils/state-api.sh +1 -1
- package/.aether/utils/trust-scoring.sh +347 -0
- package/.aether/utils/worktree.sh +97 -0
- package/.claude/commands/ant/entomb.md +1 -1
- package/.claude/commands/ant/init.md +29 -12
- package/.claude/commands/ant/oracle.md +35 -0
- package/.claude/commands/ant/patrol.md +2 -2
- package/.claude/commands/ant/run.md +3 -3
- package/.claude/commands/ant/swarm.md +1 -1
- package/.opencode/commands/ant/build.md +35 -0
- package/.opencode/commands/ant/init.md +29 -12
- package/.opencode/commands/ant/oracle.md +35 -0
- package/.opencode/commands/ant/patrol.md +2 -2
- package/.opencode/commands/ant/run.md +3 -3
- package/CHANGELOG.md +83 -0
- package/README.md +22 -9
- package/bin/lib/update-transaction.js +8 -3
- package/bin/npx-entry.js +0 -0
- package/package.json +1 -1
- package/.aether/agents/aether-ambassador.md +0 -140
- package/.aether/agents/aether-archaeologist.md +0 -108
- package/.aether/agents/aether-architect.md +0 -133
- package/.aether/agents/aether-auditor.md +0 -144
- package/.aether/agents/aether-builder.md +0 -184
- package/.aether/agents/aether-chaos.md +0 -115
- package/.aether/agents/aether-chronicler.md +0 -122
- package/.aether/agents/aether-gatekeeper.md +0 -116
- package/.aether/agents/aether-includer.md +0 -117
- package/.aether/agents/aether-keeper.md +0 -177
- package/.aether/agents/aether-measurer.md +0 -128
- package/.aether/agents/aether-oracle.md +0 -137
- package/.aether/agents/aether-probe.md +0 -133
- package/.aether/agents/aether-queen.md +0 -286
- package/.aether/agents/aether-route-setter.md +0 -130
- package/.aether/agents/aether-sage.md +0 -106
- package/.aether/agents/aether-scout.md +0 -101
- package/.aether/agents/aether-surveyor-disciplines.md +0 -391
- package/.aether/agents/aether-surveyor-nest.md +0 -329
- package/.aether/agents/aether-surveyor-pathogens.md +0 -264
- package/.aether/agents/aether-surveyor-provisions.md +0 -334
- package/.aether/agents/aether-tracker.md +0 -137
- package/.aether/agents/aether-watcher.md +0 -174
- package/.aether/agents/aether-weaver.md +0 -130
- package/.aether/commands/claude/archaeology.md +0 -334
- package/.aether/commands/claude/build.md +0 -65
- package/.aether/commands/claude/chaos.md +0 -336
- package/.aether/commands/claude/colonize.md +0 -259
- package/.aether/commands/claude/continue.md +0 -60
- package/.aether/commands/claude/council.md +0 -507
- package/.aether/commands/claude/data-clean.md +0 -81
- package/.aether/commands/claude/dream.md +0 -268
- package/.aether/commands/claude/entomb.md +0 -498
- package/.aether/commands/claude/export-signals.md +0 -57
- package/.aether/commands/claude/feedback.md +0 -96
- package/.aether/commands/claude/flag.md +0 -151
- package/.aether/commands/claude/flags.md +0 -169
- package/.aether/commands/claude/focus.md +0 -76
- package/.aether/commands/claude/help.md +0 -154
- package/.aether/commands/claude/history.md +0 -140
- package/.aether/commands/claude/import-signals.md +0 -71
- package/.aether/commands/claude/init.md +0 -505
- package/.aether/commands/claude/insert-phase.md +0 -105
- package/.aether/commands/claude/interpret.md +0 -278
- package/.aether/commands/claude/lay-eggs.md +0 -210
- package/.aether/commands/claude/maturity.md +0 -113
- package/.aether/commands/claude/memory-details.md +0 -77
- package/.aether/commands/claude/migrate-state.md +0 -171
- package/.aether/commands/claude/oracle.md +0 -642
- package/.aether/commands/claude/organize.md +0 -232
- package/.aether/commands/claude/patrol.md +0 -620
- package/.aether/commands/claude/pause-colony.md +0 -233
- package/.aether/commands/claude/phase.md +0 -115
- package/.aether/commands/claude/pheromones.md +0 -156
- package/.aether/commands/claude/plan.md +0 -693
- package/.aether/commands/claude/preferences.md +0 -65
- package/.aether/commands/claude/quick.md +0 -100
- package/.aether/commands/claude/redirect.md +0 -76
- package/.aether/commands/claude/resume-colony.md +0 -197
- package/.aether/commands/claude/resume.md +0 -388
- package/.aether/commands/claude/run.md +0 -231
- package/.aether/commands/claude/seal.md +0 -774
- package/.aether/commands/claude/skill-create.md +0 -286
- package/.aether/commands/claude/status.md +0 -410
- package/.aether/commands/claude/swarm.md +0 -349
- package/.aether/commands/claude/tunnels.md +0 -426
- package/.aether/commands/claude/update.md +0 -132
- package/.aether/commands/claude/verify-castes.md +0 -143
- package/.aether/commands/claude/watch.md +0 -239
- package/.aether/commands/opencode/archaeology.md +0 -331
- package/.aether/commands/opencode/build.md +0 -1168
- package/.aether/commands/opencode/chaos.md +0 -329
- package/.aether/commands/opencode/colonize.md +0 -195
- package/.aether/commands/opencode/continue.md +0 -1436
- package/.aether/commands/opencode/council.md +0 -437
- package/.aether/commands/opencode/data-clean.md +0 -77
- package/.aether/commands/opencode/dream.md +0 -260
- package/.aether/commands/opencode/entomb.md +0 -377
- package/.aether/commands/opencode/export-signals.md +0 -54
- package/.aether/commands/opencode/feedback.md +0 -99
- package/.aether/commands/opencode/flag.md +0 -149
- package/.aether/commands/opencode/flags.md +0 -167
- package/.aether/commands/opencode/focus.md +0 -73
- package/.aether/commands/opencode/help.md +0 -157
- package/.aether/commands/opencode/history.md +0 -136
- package/.aether/commands/opencode/import-signals.md +0 -68
- package/.aether/commands/opencode/init.md +0 -518
- package/.aether/commands/opencode/insert-phase.md +0 -111
- package/.aether/commands/opencode/interpret.md +0 -272
- package/.aether/commands/opencode/lay-eggs.md +0 -213
- package/.aether/commands/opencode/maturity.md +0 -108
- package/.aether/commands/opencode/memory-details.md +0 -83
- package/.aether/commands/opencode/migrate-state.md +0 -165
- package/.aether/commands/opencode/oracle.md +0 -593
- package/.aether/commands/opencode/organize.md +0 -226
- package/.aether/commands/opencode/patrol.md +0 -626
- package/.aether/commands/opencode/pause-colony.md +0 -203
- package/.aether/commands/opencode/phase.md +0 -113
- package/.aether/commands/opencode/pheromones.md +0 -162
- package/.aether/commands/opencode/plan.md +0 -684
- package/.aether/commands/opencode/preferences.md +0 -71
- package/.aether/commands/opencode/quick.md +0 -91
- package/.aether/commands/opencode/redirect.md +0 -84
- package/.aether/commands/opencode/resume-colony.md +0 -190
- package/.aether/commands/opencode/resume.md +0 -394
- package/.aether/commands/opencode/run.md +0 -237
- package/.aether/commands/opencode/seal.md +0 -452
- package/.aether/commands/opencode/skill-create.md +0 -63
- package/.aether/commands/opencode/status.md +0 -307
- package/.aether/commands/opencode/swarm.md +0 -15
- package/.aether/commands/opencode/tunnels.md +0 -400
- package/.aether/commands/opencode/update.md +0 -127
- package/.aether/commands/opencode/verify-castes.md +0 -139
- package/.aether/commands/opencode/watch.md +0 -227
|
@@ -1,1436 +0,0 @@
|
|
|
1
|
-
<!-- Generated from .aether/commands/continue.yaml - DO NOT EDIT DIRECTLY -->
|
|
2
|
-
---
|
|
3
|
-
name: ant:continue
|
|
4
|
-
description: "➡️🐜🚪🐜➡️ Detect build completion, reconcile state, and advance to next phase"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
### Step -1: Normalize Arguments
|
|
8
|
-
|
|
9
|
-
Run: `normalized_args=$(bash .aether/aether-utils.sh normalize-args "$@")`
|
|
10
|
-
|
|
11
|
-
This ensures arguments work correctly in both Claude Code and OpenCode. Use `$normalized_args` throughout this command.
|
|
12
|
-
|
|
13
|
-
You are the **Queen Ant Colony**. Reconcile completed work and advance to the next phase.
|
|
14
|
-
|
|
15
|
-
## Instructions
|
|
16
|
-
|
|
17
|
-
Parse `$normalized_args`:
|
|
18
|
-
- If contains `--no-visual`: set `visual_mode = false` (visual is ON by default)
|
|
19
|
-
- Otherwise: set `visual_mode = true`
|
|
20
|
-
|
|
21
|
-
### Step 1: Read State
|
|
22
|
-
|
|
23
|
-
Read `.aether/data/COLONY_STATE.json`.
|
|
24
|
-
|
|
25
|
-
**Auto-upgrade old state:**
|
|
26
|
-
If `version` field is missing, "1.0", or "2.0":
|
|
27
|
-
1. Preserve: `goal`, `state`, `current_phase`, `plan.phases`
|
|
28
|
-
2. Write upgraded v3.0 state (same structure as /ant:init but preserving data)
|
|
29
|
-
3. Output: `State auto-upgraded to v3.0`
|
|
30
|
-
4. Continue with command.
|
|
31
|
-
|
|
32
|
-
Extract: `goal`, `state`, `current_phase`, `plan.phases`, `errors`, `memory`, `events`, `build_started_at`.
|
|
33
|
-
|
|
34
|
-
**Validation:**
|
|
35
|
-
- If `goal: null` -> output "No colony initialized. Run /ant:init first." and stop.
|
|
36
|
-
- If `plan.phases` is empty -> output "No project plan. Run /ant:plan first." and stop.
|
|
37
|
-
|
|
38
|
-
### Step 1.5: Load State and Show Resumption Context
|
|
39
|
-
|
|
40
|
-
Run using Bash tool: `bash .aether/aether-utils.sh load-state`
|
|
41
|
-
|
|
42
|
-
If successful and goal is not null:
|
|
43
|
-
1. Extract current_phase from state
|
|
44
|
-
2. Get phase name from plan.phases[current_phase - 1].name (or "(unnamed)")
|
|
45
|
-
3. Display brief resumption context:
|
|
46
|
-
```
|
|
47
|
-
🔄 Resuming: Phase X - Name
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
If .aether/HANDOFF.md exists (detected in load-state output):
|
|
51
|
-
- Display "Resuming from paused session"
|
|
52
|
-
- Read .aether/HANDOFF.md for additional context
|
|
53
|
-
- Remove .aether/HANDOFF.md after display (cleanup)
|
|
54
|
-
|
|
55
|
-
Run: `bash .aether/aether-utils.sh unload-state` to release lock.
|
|
56
|
-
|
|
57
|
-
**Error handling:**
|
|
58
|
-
- If E_FILE_NOT_FOUND: "No colony initialized. Run /ant:init first." and stop
|
|
59
|
-
- If validation error: Display error details with recovery suggestion and stop
|
|
60
|
-
- For other errors: Display generic error and suggest /ant:status for diagnostics
|
|
61
|
-
|
|
62
|
-
**Completion Detection:**
|
|
63
|
-
|
|
64
|
-
If `state == "EXECUTING"`:
|
|
65
|
-
1. Check if `build_started_at` exists
|
|
66
|
-
2. Look for phase completion evidence:
|
|
67
|
-
- Activity log entries showing task completion
|
|
68
|
-
- Files created/modified matching phase tasks
|
|
69
|
-
3. If no evidence and build started > 30 min ago:
|
|
70
|
-
- Display "Stale EXECUTING state. Build may have been interrupted."
|
|
71
|
-
- Offer: continue anyway or rollback to git checkpoint
|
|
72
|
-
- Rollback procedure: `git stash list | grep "aether-checkpoint"` to find ref, then `git stash pop <ref>` to restore
|
|
73
|
-
|
|
74
|
-
If `state != "EXECUTING"`:
|
|
75
|
-
- Normal continue flow (no build to reconcile)
|
|
76
|
-
|
|
77
|
-
### Step 1.5.2: Load Survey Context (Non-blocking)
|
|
78
|
-
|
|
79
|
-
Run:
|
|
80
|
-
```bash
|
|
81
|
-
survey_check=$(bash .aether/aether-utils.sh survey-verify 2>/dev/null || true)
|
|
82
|
-
survey_docs=$(ls -1 .aether/data/survey/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
83
|
-
survey_latest=$(ls -t .aether/data/survey/*.md 2>/dev/null | head -1)
|
|
84
|
-
if [[ -n "$survey_latest" ]]; then
|
|
85
|
-
now_epoch=$(date +%s)
|
|
86
|
-
modified_epoch=$(stat -f %m "$survey_latest" 2>/dev/null || stat -c %Y "$survey_latest" 2>/dev/null || echo 0)
|
|
87
|
-
survey_age_days=$(( (now_epoch - modified_epoch) / 86400 ))
|
|
88
|
-
else
|
|
89
|
-
survey_age_days=-1
|
|
90
|
-
fi
|
|
91
|
-
echo "{\"docs\":$survey_docs,\"age_days\":$survey_age_days,\"verify\":$survey_check}"
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Interpretation:
|
|
95
|
-
- If `docs == 0`: display `🗺️ Survey: not found (run /ant:colonize for stronger context)` and continue.
|
|
96
|
-
- If `age_days > 14`: display `🗺️ Survey: {docs} docs loaded ({age_days}d old, consider /ant:colonize --force-resurvey)` and continue.
|
|
97
|
-
- Otherwise: display `🗺️ Survey: {docs} docs loaded ({age_days}d old)` and continue.
|
|
98
|
-
|
|
99
|
-
Survey context is advisory only and must not block advancement by itself.
|
|
100
|
-
|
|
101
|
-
### Step 1.5.3: Verification Loop Gate (MANDATORY)
|
|
102
|
-
|
|
103
|
-
**The Iron Law:** No phase advancement without fresh verification evidence.
|
|
104
|
-
|
|
105
|
-
Before ANY phase can advance, execute the 6-phase verification loop. See `.aether/docs/disciplines/verification-loop.md` for full reference.
|
|
106
|
-
|
|
107
|
-
#### 1. Command Resolution (Priority Chain)
|
|
108
|
-
|
|
109
|
-
Resolve each command (build, test, types, lint) using this priority chain. Stop at the first source that provides a value for each command:
|
|
110
|
-
|
|
111
|
-
**Priority 1 — CLAUDE.md (System Context):**
|
|
112
|
-
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.
|
|
113
|
-
|
|
114
|
-
**Priority 2 — codebase.md `## Commands`:**
|
|
115
|
-
Read `.aether/data/codebase.md` and look for the `## Commands` section. Use any commands listed there for slots not yet filled by Priority 1.
|
|
116
|
-
|
|
117
|
-
**Priority 3 — Fallback Heuristic Table:**
|
|
118
|
-
For any commands still unresolved, check for these files in order, use first match:
|
|
119
|
-
|
|
120
|
-
| File | Build | Test | Types | Lint |
|
|
121
|
-
|------|-------|------|-------|------|
|
|
122
|
-
| `package.json` | `npm run build` | `npm test` | `npx tsc --noEmit` | `npm run lint` |
|
|
123
|
-
| `Cargo.toml` | `cargo build` | `cargo test` | (built-in) | `cargo clippy` |
|
|
124
|
-
| `go.mod` | `go build ./...` | `go test ./...` | `go vet ./...` | `golangci-lint run` |
|
|
125
|
-
| `pyproject.toml` | `python -m build` | `pytest` | `pyright .` | `ruff check .` |
|
|
126
|
-
| `Makefile` | `make build` | `make test` | (check targets) | `make lint` |
|
|
127
|
-
|
|
128
|
-
If no build system detected, skip build/test/type/lint checks but still verify success criteria.
|
|
129
|
-
|
|
130
|
-
#### 2. Run 6-Phase Verification Loop
|
|
131
|
-
|
|
132
|
-
Execute all applicable phases and capture output:
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
136
|
-
👁️🐜 V E R I F I C A T I O N L O O P
|
|
137
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
138
|
-
Phase {id} — Checking colony work...
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Phase 1: Build Check** (if command exists):
|
|
142
|
-
```bash
|
|
143
|
-
{build_command} 2>&1 | tail -30
|
|
144
|
-
```
|
|
145
|
-
Record: exit code, any errors. **STOP if fails.**
|
|
146
|
-
|
|
147
|
-
**Phase 2: Type Check** (if command exists):
|
|
148
|
-
```bash
|
|
149
|
-
{type_command} 2>&1 | head -30
|
|
150
|
-
```
|
|
151
|
-
Record: error count. Report all type errors.
|
|
152
|
-
|
|
153
|
-
**Phase 3: Lint Check** (if command exists):
|
|
154
|
-
```bash
|
|
155
|
-
{lint_command} 2>&1 | head -30
|
|
156
|
-
```
|
|
157
|
-
Record: warning count, error count.
|
|
158
|
-
|
|
159
|
-
**Phase 4: Test Check** (if command exists):
|
|
160
|
-
```bash
|
|
161
|
-
{test_command} 2>&1 | tail -50
|
|
162
|
-
```
|
|
163
|
-
Record: pass count, fail count, exit code. **STOP if fails.**
|
|
164
|
-
|
|
165
|
-
**Coverage Check** (if coverage command exists):
|
|
166
|
-
```bash
|
|
167
|
-
{coverage_command} # e.g., npm run test:coverage
|
|
168
|
-
```
|
|
169
|
-
Record: coverage percentage (target: 80%+ for new code)
|
|
170
|
-
|
|
171
|
-
#### Step 1.5.1: Probe Coverage Agent (Conditional)
|
|
172
|
-
|
|
173
|
-
**Test coverage improvement -- runs when coverage < 80% AND tests pass.**
|
|
174
|
-
|
|
175
|
-
1. **Check coverage threshold condition:**
|
|
176
|
-
- Coverage data is already available from Phase 4 coverage check
|
|
177
|
-
- If tests failed: Skip Probe silently (coverage data unreliable)
|
|
178
|
-
- If coverage_percent >= 80%: Skip Probe silently, continue to Phase 5
|
|
179
|
-
- If coverage_percent < 80% AND tests passed: Proceed to spawn Probe
|
|
180
|
-
|
|
181
|
-
2. **If skipping Probe:**
|
|
182
|
-
```
|
|
183
|
-
Probe: Coverage at {coverage_percent}% -- {reason_for_skip}
|
|
184
|
-
```
|
|
185
|
-
Continue to Phase 5: Secrets Scan.
|
|
186
|
-
|
|
187
|
-
3. **If spawning Probe:**
|
|
188
|
-
|
|
189
|
-
a. Generate Probe name and dispatch:
|
|
190
|
-
Run using the Bash tool with description "Generating Probe name...": `probe_name=$(bash .aether/aether-utils.sh generate-ant-name "probe") && bash .aether/aether-utils.sh spawn-log "Queen" "probe" "$probe_name" "Coverage improvement: ${coverage_percent}%" && echo "{\"name\":\"$probe_name\"}"`
|
|
191
|
-
|
|
192
|
-
b. Display:
|
|
193
|
-
```
|
|
194
|
-
━━━ 🧪🐜 P R O B E ━━━
|
|
195
|
-
──── 🧪🐜 Spawning {probe_name} — Coverage improvement ────
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
d. Determine uncovered files:
|
|
199
|
-
Run using the Bash tool with description "Getting modified source files...": `modified_source_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && source_files=$(echo "$modified_source_files" | grep -v "\.test\." | grep -v "\.spec\." | grep -v "__tests__") && echo "$source_files"`
|
|
200
|
-
|
|
201
|
-
e. Spawn Probe agent:
|
|
202
|
-
|
|
203
|
-
> **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-probe"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-probe agent definition from `.opencode/agents/aether-probe.md`).
|
|
204
|
-
|
|
205
|
-
Probe mission: Improve test coverage for uncovered code paths in the modified files.
|
|
206
|
-
- Analyze the modified source files for uncovered branches and edge cases
|
|
207
|
-
- Identify which paths lack test coverage
|
|
208
|
-
- Generate test cases that exercise uncovered code paths
|
|
209
|
-
- Run the new tests to verify they pass
|
|
210
|
-
- Report coverage improvements and edge cases discovered
|
|
211
|
-
|
|
212
|
-
Constraints:
|
|
213
|
-
- Test files ONLY -- never modify source code
|
|
214
|
-
- Follow existing test conventions in the codebase
|
|
215
|
-
- Do NOT delete or modify existing tests
|
|
216
|
-
|
|
217
|
-
f. Parse Probe JSON output and log completion:
|
|
218
|
-
Extract: `tests_added`, `coverage.lines`, `coverage.branches`, `coverage.functions`, `edge_cases_discovered`
|
|
219
|
-
|
|
220
|
-
Run using the Bash tool with description "Logging Probe completion...": `bash .aether/aether-utils.sh spawn-complete "$probe_name" "completed" "{probe_summary}"`
|
|
221
|
-
|
|
222
|
-
g. Log findings to midden:
|
|
223
|
-
Run using the Bash tool with description "Logging Probe findings to midden...": `bash .aether/aether-utils.sh midden-write "coverage" "Probe generated tests, coverage: ${coverage_lines}%/${coverage_branches}%/${coverage_functions}%" "probe"`
|
|
224
|
-
|
|
225
|
-
4. **NON-BLOCKING continuation:**
|
|
226
|
-
Display Probe findings summary:
|
|
227
|
-
```
|
|
228
|
-
Probe complete -- Findings logged to midden, continuing verification...
|
|
229
|
-
Tests added: {count}
|
|
230
|
-
Edge cases discovered: {count}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
**CRITICAL:** ALWAYS continue to Phase 5 (Secrets Scan) regardless of Probe results. Probe is strictly non-blocking.
|
|
234
|
-
|
|
235
|
-
5. **Record Probe status for verification report:**
|
|
236
|
-
Set `probe_status = "ACTIVE"` and store tests_added count and edge_cases count for the verification report.
|
|
237
|
-
|
|
238
|
-
**Phase 5: Secrets Scan**:
|
|
239
|
-
```bash
|
|
240
|
-
# Check for exposed secrets
|
|
241
|
-
grep -rn "sk-\|api_key\|password\s*=" --include="*.ts" --include="*.js" --include="*.py" src/ 2>/dev/null | head -10
|
|
242
|
-
|
|
243
|
-
# Check for debug artifacts
|
|
244
|
-
grep -rn "console\.log\|debugger" --include="*.ts" --include="*.tsx" --include="*.js" src/ 2>/dev/null | head -10
|
|
245
|
-
```
|
|
246
|
-
Record: potential secrets (critical), debug artifacts (warning).
|
|
247
|
-
|
|
248
|
-
**Phase 6: Diff Review**:
|
|
249
|
-
```bash
|
|
250
|
-
git diff --stat
|
|
251
|
-
```
|
|
252
|
-
Review changed files for unintended modifications.
|
|
253
|
-
|
|
254
|
-
**Success Criteria Check:**
|
|
255
|
-
Read phase success criteria from `plan.phases[current].success_criteria`.
|
|
256
|
-
For EACH criterion:
|
|
257
|
-
1. Identify what proves it (file exists? test passes? output shows X?)
|
|
258
|
-
2. Run the check
|
|
259
|
-
3. Record evidence or gap
|
|
260
|
-
|
|
261
|
-
Display:
|
|
262
|
-
```
|
|
263
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
264
|
-
👁️🐜 V E R I F I C A T I O N R E P O R T
|
|
265
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
266
|
-
|
|
267
|
-
🔨 Build [PASS/FAIL/SKIP]
|
|
268
|
-
🔍 Types [PASS/FAIL/SKIP] (X errors)
|
|
269
|
-
🧹 Lint [PASS/FAIL/SKIP] (X warnings)
|
|
270
|
-
🧪 Tests [PASS/FAIL/SKIP] (X/Y passed)
|
|
271
|
-
Coverage {percent}% (target: 80%)
|
|
272
|
-
🧪 Probe [ACTIVE/SKIP] (tests added: X, edge cases: Y)
|
|
273
|
-
🔒 Secrets [PASS/FAIL] (X issues)
|
|
274
|
-
📦 Gatekeeper [PASS/WARN/SKIP] (X critical, X high)
|
|
275
|
-
👥 Auditor [PASS/FAIL] (score: X/100)
|
|
276
|
-
📋 Diff [X files changed]
|
|
277
|
-
|
|
278
|
-
──────────────────────────────────────────────────
|
|
279
|
-
🐜 Success Criteria
|
|
280
|
-
──────────────────────────────────────────────────
|
|
281
|
-
✅ {criterion 1}: {specific evidence}
|
|
282
|
-
✅ {criterion 2}: {specific evidence}
|
|
283
|
-
❌ {criterion 3}: {what's missing}
|
|
284
|
-
|
|
285
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
286
|
-
Overall: READY / NOT READY
|
|
287
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
#### 3. Gate Decision
|
|
291
|
-
|
|
292
|
-
**If NOT READY (any of: build fails, tests fail, critical security issues, success criteria unmet):**
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
296
|
-
⛔🐜 V E R I F I C A T I O N F A I L E D
|
|
297
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
298
|
-
|
|
299
|
-
Phase {id} cannot advance until issues are resolved.
|
|
300
|
-
|
|
301
|
-
🚨 Issues Found:
|
|
302
|
-
{list each failure with specific evidence}
|
|
303
|
-
|
|
304
|
-
🔧 Required Actions:
|
|
305
|
-
1. Fix the issues listed above
|
|
306
|
-
2. Run /ant:continue again to re-verify
|
|
307
|
-
|
|
308
|
-
The phase will NOT advance until verification passes.
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
**CRITICAL:** Do NOT proceed to Step 2. Do NOT advance the phase.
|
|
312
|
-
Do NOT offer workarounds. Verification is mandatory.
|
|
313
|
-
|
|
314
|
-
Use AskUserQuestion to confirm they understand what needs to be fixed:
|
|
315
|
-
- Show the specific failures
|
|
316
|
-
- Ask if they want to fix now or need help
|
|
317
|
-
|
|
318
|
-
**If READY (all checks pass with evidence):**
|
|
319
|
-
|
|
320
|
-
```
|
|
321
|
-
✅🐜 VERIFICATION PASSED
|
|
322
|
-
|
|
323
|
-
All checks completed with evidence:
|
|
324
|
-
{list each check and its evidence}
|
|
325
|
-
|
|
326
|
-
Proceeding to gate checks...
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
Continue to Step 1.6.
|
|
330
|
-
|
|
331
|
-
### Step 1.6: Spawn Enforcement Gate (MANDATORY)
|
|
332
|
-
|
|
333
|
-
**The Iron Law:** No phase advancement without worker spawning for non-trivial phases.
|
|
334
|
-
|
|
335
|
-
Read `.aether/data/spawn-tree.txt` to count spawns for this phase.
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
grep -c "spawned" .aether/data/spawn-tree.txt 2>/dev/null || echo "0"
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
Also check for Watcher spawns specifically:
|
|
342
|
-
```bash
|
|
343
|
-
grep -c "watcher" .aether/data/spawn-tree.txt 2>/dev/null || echo "0"
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**HARD REJECTION - If spawn_count == 0 and phase had 3+ tasks:**
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
350
|
-
⛔🐜 S P A W N G A T E F A I L E D
|
|
351
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
352
|
-
|
|
353
|
-
This phase had {task_count} tasks but spawn_count: 0
|
|
354
|
-
The Prime Worker violated the spawn protocol.
|
|
355
|
-
|
|
356
|
-
🐜 The colony requires actual parallelism:
|
|
357
|
-
- Prime Worker MUST spawn specialists for non-trivial work
|
|
358
|
-
- A single agent doing everything is NOT a colony
|
|
359
|
-
- "Justifications" for not spawning are not accepted
|
|
360
|
-
|
|
361
|
-
🔧 Required Actions:
|
|
362
|
-
1. Run /ant:build {phase} again
|
|
363
|
-
2. Prime Worker MUST spawn at least 1 specialist
|
|
364
|
-
3. Re-run /ant:continue after spawns complete
|
|
365
|
-
|
|
366
|
-
The phase will NOT advance until spawning occurs.
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**CRITICAL:** Do NOT proceed to Step 1.7. Do NOT advance the phase.
|
|
370
|
-
Log the violation:
|
|
371
|
-
```bash
|
|
372
|
-
bash .aether/aether-utils.sh activity-log "BLOCKED" "colony" "Spawn gate failed: {task_count} tasks, 0 spawns"
|
|
373
|
-
bash .aether/aether-utils.sh error-flag-pattern "no-spawn-violation" "Prime Worker completed phase without spawning specialists" "critical"
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
**HARD REJECTION - If watcher_count == 0 (no testing separation):**
|
|
377
|
-
|
|
378
|
-
```
|
|
379
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
380
|
-
⛔👁️🐜 W A T C H E R G A T E F A I L E D
|
|
381
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
382
|
-
|
|
383
|
-
No Watcher ant was spawned for testing/verification.
|
|
384
|
-
Testing MUST be performed by a separate agent, not the builder.
|
|
385
|
-
|
|
386
|
-
🐜 Why this matters:
|
|
387
|
-
- Builders verify their own work = confirmation bias
|
|
388
|
-
- Independent Watchers catch bugs builders miss
|
|
389
|
-
- "Build passing" ≠ "App working"
|
|
390
|
-
|
|
391
|
-
🔧 Required Actions:
|
|
392
|
-
1. Run /ant:build {phase} again
|
|
393
|
-
2. Prime Worker MUST spawn at least 1 Watcher
|
|
394
|
-
3. Watcher must independently verify the work
|
|
395
|
-
|
|
396
|
-
The phase will NOT advance until a Watcher validates.
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
**CRITICAL:** Do NOT proceed. Log the violation.
|
|
400
|
-
|
|
401
|
-
**If spawn_count >= 1 AND watcher_count >= 1:**
|
|
402
|
-
|
|
403
|
-
```
|
|
404
|
-
✅🐜 SPAWN GATE PASSED — {spawn_count} workers | {watcher_count} watchers
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
Continue to Step 1.7.
|
|
408
|
-
|
|
409
|
-
### Step 1.7: Anti-Pattern Gate
|
|
410
|
-
|
|
411
|
-
Scan all modified/created files for known anti-patterns. This catches recurring bugs before they reach production.
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
bash .aether/aether-utils.sh check-antipattern "{file_path}"
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
Run for each file in `files_created` and `files_modified` from Prime Worker output.
|
|
418
|
-
|
|
419
|
-
**Anti-Pattern Report:**
|
|
420
|
-
|
|
421
|
-
```
|
|
422
|
-
🔍🐜 Anti-Pattern Scan — {count} files scanned
|
|
423
|
-
|
|
424
|
-
{if critical issues:}
|
|
425
|
-
🛑 CRITICAL (must fix):
|
|
426
|
-
{list each with file:line and description}
|
|
427
|
-
|
|
428
|
-
{if warnings:}
|
|
429
|
-
⚠️ WARNINGS:
|
|
430
|
-
{list each with file:line and description}
|
|
431
|
-
|
|
432
|
-
{if clean:}
|
|
433
|
-
✅🐜 No anti-patterns detected
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
**CRITICAL issues block phase advancement:**
|
|
437
|
-
- Swift didSet infinite recursion
|
|
438
|
-
- Exposed secrets/credentials
|
|
439
|
-
- SQL injection patterns
|
|
440
|
-
- Known crash patterns
|
|
441
|
-
|
|
442
|
-
**WARNINGS are logged but don't block:**
|
|
443
|
-
- TypeScript `any` usage
|
|
444
|
-
- Console.log in production code
|
|
445
|
-
- TODO/FIXME comments
|
|
446
|
-
|
|
447
|
-
If CRITICAL issues found, display:
|
|
448
|
-
|
|
449
|
-
```
|
|
450
|
-
⛔🐜 ANTI-PATTERN GATE FAILED
|
|
451
|
-
|
|
452
|
-
Critical anti-patterns detected:
|
|
453
|
-
{list issues with file paths}
|
|
454
|
-
|
|
455
|
-
Run /ant:build {phase} again after fixing.
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
Do NOT proceed to Step 2.
|
|
459
|
-
|
|
460
|
-
If no CRITICAL issues, continue to Step 1.7.1.
|
|
461
|
-
|
|
462
|
-
### Step 1.7.1: Proactive Refactoring Gate (Conditional)
|
|
463
|
-
|
|
464
|
-
**Complexity-based refactoring -- runs when code exceeds maintainability thresholds.**
|
|
465
|
-
|
|
466
|
-
1. **Get modified/created files from recent work:**
|
|
467
|
-
Run using the Bash tool with description "Getting modified files for complexity check...": `modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && echo "$modified_files"`
|
|
468
|
-
|
|
469
|
-
2. **Check complexity thresholds for each file:**
|
|
470
|
-
|
|
471
|
-
For each file, check:
|
|
472
|
-
- Line count > 300 lines
|
|
473
|
-
- Long functions > 50 lines (simplified heuristic)
|
|
474
|
-
- Directory density > 10 new files
|
|
475
|
-
|
|
476
|
-
Run using the Bash tool with description "Checking complexity thresholds...":
|
|
477
|
-
```bash
|
|
478
|
-
modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only)
|
|
479
|
-
|
|
480
|
-
complexity_trigger=false
|
|
481
|
-
files_needing_refactor=""
|
|
482
|
-
|
|
483
|
-
for file in $modified_files; do
|
|
484
|
-
if [[ -f "$file" ]]; then
|
|
485
|
-
line_count=$(wc -l < "$file" 2>/dev/null || echo "0")
|
|
486
|
-
if [[ "$line_count" -gt 300 ]]; then
|
|
487
|
-
complexity_trigger=true
|
|
488
|
-
files_needing_refactor="$files_needing_refactor $file"
|
|
489
|
-
continue
|
|
490
|
-
fi
|
|
491
|
-
|
|
492
|
-
long_funcs=$(grep -c "^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]*(" "$file" 2>/dev/null || echo "0")
|
|
493
|
-
if [[ "$long_funcs" -gt 50 ]]; then
|
|
494
|
-
complexity_trigger=true
|
|
495
|
-
files_needing_refactor="$files_needing_refactor $file"
|
|
496
|
-
fi
|
|
497
|
-
fi
|
|
498
|
-
done
|
|
499
|
-
|
|
500
|
-
if [[ -n "$modified_files" ]]; then
|
|
501
|
-
dir_counts=$(echo "$modified_files" | xargs -I {} dirname {} 2>/dev/null | sort | uniq -c | sort -rn)
|
|
502
|
-
high_density_dir=$(echo "$dir_counts" | awk '$1 > 10 {print $2}' | head -1)
|
|
503
|
-
if [[ -n "$high_density_dir" ]]; then
|
|
504
|
-
complexity_trigger=true
|
|
505
|
-
fi
|
|
506
|
-
fi
|
|
507
|
-
|
|
508
|
-
echo "{\"complexity_trigger\": \"$complexity_trigger\", \"files_needing_refactor\": \"$files_needing_refactor\"}"
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
3. **If complexity thresholds NOT exceeded:**
|
|
512
|
-
```
|
|
513
|
-
Weaver: Complexity thresholds not exceeded -- skipping proactive refactoring
|
|
514
|
-
```
|
|
515
|
-
Continue to Step 1.8.
|
|
516
|
-
|
|
517
|
-
4. **If complexity thresholds exceeded:**
|
|
518
|
-
|
|
519
|
-
a. **Establish test baseline before refactoring:**
|
|
520
|
-
Run using the Bash tool with description "Establishing test baseline...": `test_output_before=$(npm test 2>&1 || echo "TEST_FAILED") && tests_passing_before=$(echo "$test_output_before" | grep -oE '[0-9]+ passing' | grep -oE '[0-9]+' || echo "0") && echo "Baseline: $tests_passing_before tests passing"`
|
|
521
|
-
|
|
522
|
-
b. **Generate Weaver name and dispatch:**
|
|
523
|
-
Run using the Bash tool with description "Generating Weaver name...": `weaver_name=$(bash .aether/aether-utils.sh generate-ant-name "weaver") && bash .aether/aether-utils.sh spawn-log "Queen" "weaver" "$weaver_name" "Proactive refactoring" && echo "{\"name\":\"$weaver_name\"}"`
|
|
524
|
-
|
|
525
|
-
c. **Display:**
|
|
526
|
-
```
|
|
527
|
-
━━━ 🔄🐜 W E A V E R ━━━
|
|
528
|
-
──── 🔄🐜 Spawning {weaver_name} — Proactive refactoring ────
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
e. **Spawn Weaver agent:**
|
|
532
|
-
|
|
533
|
-
> **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-weaver"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-weaver agent definition from `.opencode/agents/aether-weaver.md`).
|
|
534
|
-
|
|
535
|
-
Weaver mission: Refactor complex code to improve maintainability while preserving behavior.
|
|
536
|
-
- Analyze target files for complexity issues
|
|
537
|
-
- Plan incremental refactoring steps
|
|
538
|
-
- Execute one step at a time
|
|
539
|
-
- Run tests after each step
|
|
540
|
-
- If tests pass, continue; if fail, revert and try smaller step
|
|
541
|
-
- Report all changes made
|
|
542
|
-
|
|
543
|
-
Constraints:
|
|
544
|
-
- NEVER change behavior -- only structure
|
|
545
|
-
- Run tests after each refactoring step
|
|
546
|
-
- If tests fail, revert immediately
|
|
547
|
-
- Do NOT modify test expectations to make tests pass
|
|
548
|
-
- Do NOT modify .aether/ system files
|
|
549
|
-
|
|
550
|
-
f. **Parse Weaver JSON output and verify tests:**
|
|
551
|
-
Extract: `files_refactored`, `tests_all_passing`, `complexity_before`, `complexity_after`
|
|
552
|
-
|
|
553
|
-
Run using the Bash tool with description "Verifying tests after refactoring...":
|
|
554
|
-
```bash
|
|
555
|
-
test_output_after=$(npm test 2>&1 || echo "TEST_FAILED")
|
|
556
|
-
tests_passing_after=$(echo "$test_output_after" | grep -oE '[0-9]+ passing' | grep -oE '[0-9]+' || echo "0")
|
|
557
|
-
|
|
558
|
-
if [[ "$tests_passing_after" -lt "$tests_passing_before" ]]; then
|
|
559
|
-
echo "REVERT_NEEDED: Tests failed after refactoring"
|
|
560
|
-
git checkout -- $files_needing_refactor
|
|
561
|
-
weaver_status="reverted"
|
|
562
|
-
else
|
|
563
|
-
echo "PASSING: Tests passing after refactoring ($tests_passing_after)"
|
|
564
|
-
weaver_status="completed"
|
|
565
|
-
fi
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
g. **Log completion:**
|
|
569
|
-
Run using the Bash tool with description "Logging Weaver completion...": `bash .aether/aether-utils.sh spawn-complete "$weaver_name" "$weaver_status" "Refactoring $weaver_status"`
|
|
570
|
-
|
|
571
|
-
h. **Log to midden:**
|
|
572
|
-
Run using the Bash tool with description "Logging refactoring activity to midden...": `bash .aether/aether-utils.sh midden-write "refactoring" "Weaver refactored files, complexity before/after: ${complexity_before}/${complexity_after}" "weaver"`
|
|
573
|
-
|
|
574
|
-
5. **Display completion:**
|
|
575
|
-
```
|
|
576
|
-
Weaver: Proactive refactoring {weaver_status}
|
|
577
|
-
Files refactored: {count} | Complexity: {before} -> {after}
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
6. **NON-BLOCKING continuation:**
|
|
581
|
-
The Weaver step is NON-BLOCKING -- continue to Step 1.8 regardless of refactoring results.
|
|
582
|
-
|
|
583
|
-
Continue to Step 1.8.
|
|
584
|
-
|
|
585
|
-
### Step 1.8: Gatekeeper Security Gate (Conditional)
|
|
586
|
-
|
|
587
|
-
**Supply chain security audit -- runs only when package.json exists.**
|
|
588
|
-
|
|
589
|
-
First, check for package.json:
|
|
590
|
-
Run using the Bash tool with description "Checking for package.json...": `test -f package.json && echo "exists" || echo "missing"`
|
|
591
|
-
|
|
592
|
-
**If package.json is missing:**
|
|
593
|
-
```
|
|
594
|
-
Gatekeeper: No package.json found -- skipping supply chain audit
|
|
595
|
-
```
|
|
596
|
-
Continue to Step 1.9.
|
|
597
|
-
|
|
598
|
-
**If package.json exists:**
|
|
599
|
-
|
|
600
|
-
1. Generate Gatekeeper name and log spawn:
|
|
601
|
-
Run using the Bash tool with description "Generating Gatekeeper name...": `gatekeeper_name=$(bash .aether/aether-utils.sh generate-ant-name "gatekeeper") && bash .aether/aether-utils.sh spawn-log "Queen" "gatekeeper" "$gatekeeper_name" "Supply chain security audit" && echo "{\"name\":\"$gatekeeper_name\"}"`
|
|
602
|
-
|
|
603
|
-
2. Display:
|
|
604
|
-
```
|
|
605
|
-
━━━ 📦🐜 G A T E K E E P E R ━━━
|
|
606
|
-
──── 📦🐜 Spawning {gatekeeper_name} — Supply chain security audit ────
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
4. Spawn Gatekeeper agent:
|
|
610
|
-
|
|
611
|
-
> **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-gatekeeper"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-gatekeeper agent definition from `.opencode/agents/aether-gatekeeper.md`).
|
|
612
|
-
|
|
613
|
-
Gatekeeper mission: Perform supply chain security audit on this codebase.
|
|
614
|
-
- Inventory all dependencies from package.json
|
|
615
|
-
- Scan for known CVEs using npm audit or equivalent
|
|
616
|
-
- Check license compliance for all packages
|
|
617
|
-
- Assess dependency health (outdated, deprecated, maintenance status)
|
|
618
|
-
- Report findings with severity levels
|
|
619
|
-
|
|
620
|
-
5. Parse Gatekeeper JSON output and log completion:
|
|
621
|
-
Extract: `security.critical`, `security.high`, `status`
|
|
622
|
-
|
|
623
|
-
Run using the Bash tool with description "Logging Gatekeeper completion...": `bash .aether/aether-utils.sh spawn-complete "$gatekeeper_name" "completed" "{gatekeeper_summary}"`
|
|
624
|
-
|
|
625
|
-
**Gate Decision Logic:**
|
|
626
|
-
|
|
627
|
-
- **If `security.critical > 0`:**
|
|
628
|
-
```
|
|
629
|
-
GATEKEEPER GATE FAILED
|
|
630
|
-
|
|
631
|
-
Critical security vulnerabilities detected: {critical_count}
|
|
632
|
-
|
|
633
|
-
CRITICAL CVEs must be fixed before phase advancement.
|
|
634
|
-
|
|
635
|
-
Required Actions:
|
|
636
|
-
1. Run `npm audit` to see full details
|
|
637
|
-
2. Fix or update vulnerable dependencies
|
|
638
|
-
3. Run /ant:continue again after resolving
|
|
639
|
-
|
|
640
|
-
The phase will NOT advance with critical CVEs.
|
|
641
|
-
```
|
|
642
|
-
**CRITICAL:** Do NOT proceed to Step 1.9. Stop here.
|
|
643
|
-
|
|
644
|
-
- **If `security.high > 0`:**
|
|
645
|
-
```
|
|
646
|
-
Gatekeeper: {high_count} high-severity issues found
|
|
647
|
-
|
|
648
|
-
Security warnings logged to midden for later review.
|
|
649
|
-
Proceeding with caution...
|
|
650
|
-
```
|
|
651
|
-
Run using the Bash tool with description "Logging high-severity warnings...": `bash .aether/aether-utils.sh midden-write "security" "High CVEs found: $high_count" "gatekeeper"`
|
|
652
|
-
Continue to Step 1.9.
|
|
653
|
-
|
|
654
|
-
- **If clean (no critical or high):**
|
|
655
|
-
```
|
|
656
|
-
Gatekeeper: No critical security issues found
|
|
657
|
-
```
|
|
658
|
-
Continue to Step 1.9.
|
|
659
|
-
|
|
660
|
-
### Step 1.9: Auditor Quality Gate (MANDATORY)
|
|
661
|
-
|
|
662
|
-
**Code quality audit -- runs on every `/ant:continue` for consistent coverage.**
|
|
663
|
-
|
|
664
|
-
1. Generate Auditor name and log spawn:
|
|
665
|
-
Run using the Bash tool with description "Generating Auditor name...": `auditor_name=$(bash .aether/aether-utils.sh generate-ant-name "auditor") && bash .aether/aether-utils.sh spawn-log "Queen" "auditor" "$auditor_name" "Code quality audit" && echo "{\"name\":\"$auditor_name\"}"`
|
|
666
|
-
|
|
667
|
-
2. Display:
|
|
668
|
-
```
|
|
669
|
-
━━━ 👥🐜 A U D I T O R ━━━
|
|
670
|
-
──── 👥🐜 Spawning {auditor_name} — Code quality audit ────
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
4. Get modified files for audit context:
|
|
674
|
-
Run using the Bash tool with description "Getting modified files...": `modified_files=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only) && echo "$modified_files"`
|
|
675
|
-
|
|
676
|
-
5. Spawn Auditor agent:
|
|
677
|
-
|
|
678
|
-
> **Platform note**: In Claude Code, use `Task tool with subagent_type="aether-auditor"`. In OpenCode, use the equivalent agent spawning mechanism for your platform (e.g., invoke the aether-auditor agent definition from `.opencode/agents/aether-auditor.md`).
|
|
679
|
-
|
|
680
|
-
Auditor mission: Perform comprehensive code quality audit on this codebase.
|
|
681
|
-
- Review all modified files from the recent commit(s)
|
|
682
|
-
- Apply all 4 audit lenses: security, performance, quality, maintainability
|
|
683
|
-
- Score each finding by severity (CRITICAL/HIGH/MEDIUM/LOW/INFO)
|
|
684
|
-
- Calculate overall quality score (0-100)
|
|
685
|
-
- Document specific issues with file:line references and fix suggestions
|
|
686
|
-
|
|
687
|
-
6. Parse Auditor JSON output and log completion:
|
|
688
|
-
Extract: `findings.critical`, `findings.high`, `findings.medium`, `findings.low`, `findings.info`, `overall_score`, `dimensions_audited`
|
|
689
|
-
|
|
690
|
-
Run using the Bash tool with description "Logging Auditor completion...": `bash .aether/aether-utils.sh spawn-complete "$auditor_name" "completed" "{auditor_summary}"`
|
|
691
|
-
|
|
692
|
-
**Gate Decision Logic:**
|
|
693
|
-
|
|
694
|
-
- **If `findings.critical > 0`:**
|
|
695
|
-
```
|
|
696
|
-
AUDITOR GATE FAILED
|
|
697
|
-
|
|
698
|
-
Critical code quality issues detected: {critical_count}
|
|
699
|
-
|
|
700
|
-
CRITICAL findings must be fixed before phase advancement.
|
|
701
|
-
|
|
702
|
-
Required Actions:
|
|
703
|
-
1. Review the critical issues listed below
|
|
704
|
-
2. Fix each critical finding
|
|
705
|
-
3. Run /ant:continue again after resolving
|
|
706
|
-
|
|
707
|
-
Critical Findings:
|
|
708
|
-
{list each critical finding with file:line and description}
|
|
709
|
-
|
|
710
|
-
The phase will NOT advance with critical quality issues.
|
|
711
|
-
```
|
|
712
|
-
Run using the Bash tool with description "Logging critical quality block...": `bash .aether/aether-utils.sh error-flag-pattern "auditor-critical-findings" "$critical_count critical quality issues found" "critical"`
|
|
713
|
-
**CRITICAL:** Do NOT proceed to Step 1.10. Stop here.
|
|
714
|
-
|
|
715
|
-
- **Else if `overall_score < 60`:**
|
|
716
|
-
```
|
|
717
|
-
AUDITOR GATE FAILED
|
|
718
|
-
|
|
719
|
-
Code quality score below threshold: {overall_score}/100 (threshold: 60)
|
|
720
|
-
|
|
721
|
-
Quality score must reach 60+ before phase advancement.
|
|
722
|
-
|
|
723
|
-
Required Actions:
|
|
724
|
-
1. Address the top issues preventing score improvement
|
|
725
|
-
2. Focus on HIGH severity items first
|
|
726
|
-
3. Run /ant:continue again after improving quality
|
|
727
|
-
|
|
728
|
-
The phase will NOT advance with quality score below 60.
|
|
729
|
-
```
|
|
730
|
-
Run using the Bash tool with description "Logging quality score block...": `bash .aether/aether-utils.sh error-flag-pattern "auditor-quality-score" "Score $overall_score below threshold 60" "critical"`
|
|
731
|
-
**CRITICAL:** Do NOT proceed to Step 1.10. Stop here.
|
|
732
|
-
|
|
733
|
-
- **Else if `findings.high > 0`:**
|
|
734
|
-
```
|
|
735
|
-
Auditor: Quality score {overall_score}/100 -- PASSED with warnings
|
|
736
|
-
|
|
737
|
-
{high_count} high-severity quality issues found:
|
|
738
|
-
{list high findings}
|
|
739
|
-
|
|
740
|
-
Quality warnings logged to midden for later review.
|
|
741
|
-
Proceeding with caution...
|
|
742
|
-
```
|
|
743
|
-
Run using the Bash tool with description "Logging high-quality warnings...": `bash .aether/aether-utils.sh midden-write "quality" "High severity issues: $high_count (score: $overall_score)" "auditor"`
|
|
744
|
-
Continue to Step 1.10.
|
|
745
|
-
|
|
746
|
-
- **If clean (score >= 60, no critical):**
|
|
747
|
-
```
|
|
748
|
-
Auditor: Quality score {overall_score}/100 -- PASSED
|
|
749
|
-
```
|
|
750
|
-
Continue to Step 1.10.
|
|
751
|
-
|
|
752
|
-
### Step 1.10: TDD Evidence Gate (MANDATORY)
|
|
753
|
-
|
|
754
|
-
**The Iron Law:** No TDD claims without actual test files.
|
|
755
|
-
|
|
756
|
-
If Prime Worker reported TDD metrics (tests_added, tests_total, coverage_percent), verify test files exist:
|
|
757
|
-
|
|
758
|
-
```bash
|
|
759
|
-
# Check for test files based on project type
|
|
760
|
-
find . -name "*.test.*" -o -name "*_test.*" -o -name "*Tests.swift" -o -name "test_*.py" 2>/dev/null | head -10
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
**If Prime Worker claimed tests_added > 0 but no test files found:**
|
|
764
|
-
|
|
765
|
-
```
|
|
766
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
767
|
-
⛔🧪🐜 T D D G A T E F A I L E D
|
|
768
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
769
|
-
|
|
770
|
-
Prime Worker claimed:
|
|
771
|
-
tests_added: {claimed_count}
|
|
772
|
-
tests_total: {claimed_total}
|
|
773
|
-
coverage: {claimed_coverage}%
|
|
774
|
-
|
|
775
|
-
But no test files were found in the codebase.
|
|
776
|
-
|
|
777
|
-
🚨 CRITICAL violation — fabricated TDD metrics.
|
|
778
|
-
|
|
779
|
-
🔧 Required Actions:
|
|
780
|
-
1. Run /ant:build {phase} again
|
|
781
|
-
2. Actually write test files (not just claim them)
|
|
782
|
-
3. Tests must exist and be runnable
|
|
783
|
-
|
|
784
|
-
The phase will NOT advance with fabricated metrics.
|
|
785
|
-
```
|
|
786
|
-
|
|
787
|
-
**CRITICAL:** Do NOT proceed. Log the violation:
|
|
788
|
-
```bash
|
|
789
|
-
bash .aether/aether-utils.sh error-flag-pattern "fabricated-tdd" "Prime Worker reported TDD metrics without creating test files" "critical"
|
|
790
|
-
```
|
|
791
|
-
|
|
792
|
-
**If tests_added == 0 or test files exist matching claims:**
|
|
793
|
-
|
|
794
|
-
Continue to Step 1.11.
|
|
795
|
-
|
|
796
|
-
### Step 1.11: Runtime Verification Gate (MANDATORY)
|
|
797
|
-
|
|
798
|
-
**The Iron Law:** Build passing ≠ App working.
|
|
799
|
-
|
|
800
|
-
Before advancing, the user must confirm the application actually runs.
|
|
801
|
-
|
|
802
|
-
Use AskUserQuestion:
|
|
803
|
-
|
|
804
|
-
```
|
|
805
|
-
──────────────────────────────────────────────────
|
|
806
|
-
🐜 Runtime Verification Required
|
|
807
|
-
──────────────────────────────────────────────────
|
|
808
|
-
|
|
809
|
-
Build checks passed — but does the app actually work?
|
|
810
|
-
|
|
811
|
-
Have you tested the application at runtime?
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
Options:
|
|
815
|
-
1. **Yes, tested and working** - App runs correctly, features work
|
|
816
|
-
2. **Yes, tested but has issues** - App runs but has bugs (describe)
|
|
817
|
-
3. **No, haven't tested yet** - Need to test before continuing
|
|
818
|
-
4. **Skip (not applicable)** - No runnable app in this phase (e.g., library code)
|
|
819
|
-
|
|
820
|
-
**If "Yes, tested and working":**
|
|
821
|
-
```
|
|
822
|
-
✅🐜 RUNTIME VERIFIED — User confirmed app works.
|
|
823
|
-
```
|
|
824
|
-
Continue to Step 1.12.
|
|
825
|
-
|
|
826
|
-
**If "Yes, tested but has issues":**
|
|
827
|
-
```
|
|
828
|
-
⛔🐜 RUNTIME GATE FAILED — User reported issues.
|
|
829
|
-
|
|
830
|
-
Please describe the issues so they can be addressed:
|
|
831
|
-
```
|
|
832
|
-
|
|
833
|
-
Use AskUserQuestion to get issue details. Log to errors.records:
|
|
834
|
-
```bash
|
|
835
|
-
bash .aether/aether-utils.sh error-add "runtime" "critical" "{user_description}" {phase}
|
|
836
|
-
```
|
|
837
|
-
|
|
838
|
-
Do NOT proceed to Step 2.
|
|
839
|
-
|
|
840
|
-
**If "No, haven't tested yet":**
|
|
841
|
-
```
|
|
842
|
-
⏸️🐜 RUNTIME PENDING — Test the app, then run /ant:continue again.
|
|
843
|
-
|
|
844
|
-
- [ ] App launches without crashing
|
|
845
|
-
- [ ] Core features work as expected
|
|
846
|
-
- [ ] UI responds to user interaction
|
|
847
|
-
- [ ] No freezes or hangs
|
|
848
|
-
```
|
|
849
|
-
|
|
850
|
-
Do NOT proceed to Step 2.
|
|
851
|
-
|
|
852
|
-
**If "Skip (not applicable)":**
|
|
853
|
-
|
|
854
|
-
Only valid for phases that don't produce runnable code (e.g., documentation, config files, library code with no entry point).
|
|
855
|
-
|
|
856
|
-
```
|
|
857
|
-
⏭️ RUNTIME CHECK SKIPPED
|
|
858
|
-
|
|
859
|
-
User indicated no runnable app for this phase.
|
|
860
|
-
Proceeding to phase advancement.
|
|
861
|
-
```
|
|
862
|
-
|
|
863
|
-
Continue to Step 1.12.
|
|
864
|
-
|
|
865
|
-
### Step 1.12: Flags Gate (MANDATORY)
|
|
866
|
-
|
|
867
|
-
**The Iron Law:** No phase advancement with unresolved blockers.
|
|
868
|
-
|
|
869
|
-
First, auto-resolve any flags eligible for resolution now that verification has passed:
|
|
870
|
-
```bash
|
|
871
|
-
bash .aether/aether-utils.sh flag-auto-resolve "build_pass"
|
|
872
|
-
```
|
|
873
|
-
|
|
874
|
-
Then check for remaining blocking flags:
|
|
875
|
-
```bash
|
|
876
|
-
bash .aether/aether-utils.sh flag-check-blockers {current_phase}
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
Parse result for `blockers`, `issues`, and `notes` counts.
|
|
880
|
-
|
|
881
|
-
**If blockers > 0:**
|
|
882
|
-
|
|
883
|
-
```
|
|
884
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
885
|
-
⛔🚩🐜 F L A G S G A T E F A I L E D
|
|
886
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
887
|
-
|
|
888
|
-
{blockers} blocker(s) must be resolved first.
|
|
889
|
-
|
|
890
|
-
🚩 Active Blockers:
|
|
891
|
-
{list each blocker flag with ID, title, and description}
|
|
892
|
-
|
|
893
|
-
🔧 Required Actions:
|
|
894
|
-
1. Fix the issues described in each blocker
|
|
895
|
-
2. Resolve flags: /ant:flags --resolve {flag_id} "resolution message"
|
|
896
|
-
3. Run /ant:continue again after resolving all blockers
|
|
897
|
-
```
|
|
898
|
-
|
|
899
|
-
**CRITICAL:** Do NOT proceed to Step 2. Do NOT advance the phase.
|
|
900
|
-
|
|
901
|
-
**If blockers == 0 but issues > 0:**
|
|
902
|
-
|
|
903
|
-
```
|
|
904
|
-
⚠️🐜 FLAGS: {issues} issue(s) noted (non-blocking)
|
|
905
|
-
|
|
906
|
-
{list each issue flag}
|
|
907
|
-
|
|
908
|
-
Use /ant:flags to review.
|
|
909
|
-
```
|
|
910
|
-
|
|
911
|
-
Continue to Step 2.
|
|
912
|
-
|
|
913
|
-
**If all clear (no blockers or issues):**
|
|
914
|
-
|
|
915
|
-
```
|
|
916
|
-
✅🐜 FLAGS GATE PASSED — No blockers.
|
|
917
|
-
```
|
|
918
|
-
|
|
919
|
-
Continue to Step 2.
|
|
920
|
-
|
|
921
|
-
### Step 2: Update State
|
|
922
|
-
|
|
923
|
-
Find current phase in `plan.phases`.
|
|
924
|
-
Determine next phase (`current_phase + 1`).
|
|
925
|
-
|
|
926
|
-
**If no next phase (all complete):** Skip to Step 2.6 (commit suggestion), then Step 2.5 (completion).
|
|
927
|
-
|
|
928
|
-
Update COLONY_STATE.json:
|
|
929
|
-
|
|
930
|
-
1. **Mark current phase completed:**
|
|
931
|
-
- Set `plan.phases[current].status` to `"completed"`
|
|
932
|
-
- Set all tasks in phase to `"completed"`
|
|
933
|
-
|
|
934
|
-
2. **Extract learnings (with validation status):**
|
|
935
|
-
|
|
936
|
-
**CRITICAL: Learnings start as HYPOTHESES until verified.**
|
|
937
|
-
|
|
938
|
-
A learning is only "validated" if:
|
|
939
|
-
- The code was actually run and tested
|
|
940
|
-
- The feature works in practice, not just in theory
|
|
941
|
-
- User has confirmed the behavior
|
|
942
|
-
|
|
943
|
-
Append to `memory.phase_learnings`:
|
|
944
|
-
```json
|
|
945
|
-
{
|
|
946
|
-
"id": "learning_<unix_timestamp>",
|
|
947
|
-
"phase": <phase_number>,
|
|
948
|
-
"phase_name": "<name>",
|
|
949
|
-
"learnings": [
|
|
950
|
-
{
|
|
951
|
-
"claim": "<specific actionable learning>",
|
|
952
|
-
"status": "hypothesis",
|
|
953
|
-
"tested": false,
|
|
954
|
-
"evidence": "<what observation led to this>",
|
|
955
|
-
"disproven_by": null
|
|
956
|
-
}
|
|
957
|
-
],
|
|
958
|
-
"timestamp": "<ISO-8601>"
|
|
959
|
-
}
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
**Status values:**
|
|
963
|
-
- `hypothesis` - Recorded but not verified (DEFAULT)
|
|
964
|
-
- `validated` - Tested and confirmed working
|
|
965
|
-
- `disproven` - Found to be incorrect
|
|
966
|
-
|
|
967
|
-
**Do NOT record a learning if:**
|
|
968
|
-
- It wasn't actually tested
|
|
969
|
-
- It's stating the obvious
|
|
970
|
-
- There's no evidence it works
|
|
971
|
-
|
|
972
|
-
2.5. **Record learning observations for threshold tracking:**
|
|
973
|
-
|
|
974
|
-
For each learning extracted, record an observation to enable threshold-based wisdom promotion.
|
|
975
|
-
|
|
976
|
-
Run using the Bash tool with description "Recording learning observations...":
|
|
977
|
-
```bash
|
|
978
|
-
colony_name=$(bash .aether/aether-utils.sh colony-name 2>/dev/null | jq -r '.result.name // ""')
|
|
979
|
-
[[ -z "$colony_name" ]] && colony_name="unknown"
|
|
980
|
-
|
|
981
|
-
# Get learnings from the current phase
|
|
982
|
-
current_phase_learnings=$(jq -r --argjson phase "$current_phase" '.memory.phase_learnings[] | select(.phase == $phase)' .aether/data/COLONY_STATE.json 2>/dev/null || echo "")
|
|
983
|
-
|
|
984
|
-
if [[ -n "$current_phase_learnings" ]]; then
|
|
985
|
-
echo "$current_phase_learnings" | jq -r '.learnings[]?.claim // empty' 2>/dev/null | while read -r claim; do
|
|
986
|
-
if [[ -n "$claim" ]]; then
|
|
987
|
-
# Default wisdom_type to "pattern" (threshold: 3 observations)
|
|
988
|
-
bash .aether/aether-utils.sh memory-capture "learning" "$claim" "pattern" "worker:continue" 2>/dev/null || true
|
|
989
|
-
fi
|
|
990
|
-
done
|
|
991
|
-
echo "Recorded observations for threshold tracking"
|
|
992
|
-
else
|
|
993
|
-
echo "No learnings to record"
|
|
994
|
-
fi
|
|
995
|
-
```
|
|
996
|
-
|
|
997
|
-
This records each learning in `learning-observations.json` with:
|
|
998
|
-
- Content hash for deduplication (same claim across phases increments count)
|
|
999
|
-
- Observation count (increments if seen before)
|
|
1000
|
-
- Colony name for cross-colony tracking
|
|
1001
|
-
|
|
1002
|
-
When observations reach threshold (default: 3 for "pattern" type), they become eligible for promotion in Step 2.1.5.
|
|
1003
|
-
|
|
1004
|
-
3. **Extract instincts from patterns:**
|
|
1005
|
-
|
|
1006
|
-
Read activity.log for patterns from this phase's build.
|
|
1007
|
-
|
|
1008
|
-
For each pattern observed (success, error_resolution, user_feedback):
|
|
1009
|
-
|
|
1010
|
-
**If pattern matches existing instinct:**
|
|
1011
|
-
- Update confidence: +0.1 for success outcome, -0.1 for failure
|
|
1012
|
-
- Increment applications count
|
|
1013
|
-
- Update last_applied timestamp
|
|
1014
|
-
|
|
1015
|
-
**If new pattern:**
|
|
1016
|
-
- Create new instinct with initial confidence:
|
|
1017
|
-
- success: 0.4
|
|
1018
|
-
- error_resolution: 0.5
|
|
1019
|
-
- user_feedback: 0.7
|
|
1020
|
-
|
|
1021
|
-
Append to `memory.instincts`:
|
|
1022
|
-
```json
|
|
1023
|
-
{
|
|
1024
|
-
"id": "instinct_<unix_timestamp>",
|
|
1025
|
-
"trigger": "<when X>",
|
|
1026
|
-
"action": "<do Y>",
|
|
1027
|
-
"confidence": 0.5,
|
|
1028
|
-
"status": "hypothesis",
|
|
1029
|
-
"domain": "<testing|architecture|code-style|debugging|workflow>",
|
|
1030
|
-
"source": "phase-<id>",
|
|
1031
|
-
"evidence": ["<specific observation that led to this>"],
|
|
1032
|
-
"tested": false,
|
|
1033
|
-
"created_at": "<ISO-8601>",
|
|
1034
|
-
"last_applied": null,
|
|
1035
|
-
"applications": 0,
|
|
1036
|
-
"successes": 0,
|
|
1037
|
-
"failures": 0
|
|
1038
|
-
}
|
|
1039
|
-
```
|
|
1040
|
-
|
|
1041
|
-
**Instinct confidence updates:**
|
|
1042
|
-
- Success when applied: +0.1, increment `successes`
|
|
1043
|
-
- Failure when applied: -0.15, increment `failures`
|
|
1044
|
-
- If `failures` >= 2 and `successes` == 0: mark `status: "disproven"`
|
|
1045
|
-
- If `successes` >= 2 and tested: mark `status: "validated"`
|
|
1046
|
-
|
|
1047
|
-
Cap: Keep max 30 instincts (remove lowest confidence when exceeded).
|
|
1048
|
-
|
|
1049
|
-
4. **Advance state:**
|
|
1050
|
-
- Set `current_phase` to next phase number
|
|
1051
|
-
- Set `state` to `"READY"`
|
|
1052
|
-
- Set `build_started_at` to null
|
|
1053
|
-
- Append event: `"<timestamp>|phase_advanced|continue|Completed Phase <id>, advancing to Phase <next>"`
|
|
1054
|
-
|
|
1055
|
-
5. **Cap enforcement:**
|
|
1056
|
-
- Keep max 20 phase_learnings
|
|
1057
|
-
- Keep max 30 decisions
|
|
1058
|
-
- Keep max 30 instincts (remove lowest confidence)
|
|
1059
|
-
- Keep max 100 events
|
|
1060
|
-
|
|
1061
|
-
Write COLONY_STATE.json.
|
|
1062
|
-
|
|
1063
|
-
Validate the state file:
|
|
1064
|
-
Run using the Bash tool with description "Validating colony state...": `bash .aether/aether-utils.sh validate-state colony`
|
|
1065
|
-
|
|
1066
|
-
### Step 2.1: Auto-Emit Phase Pheromones (SILENT)
|
|
1067
|
-
|
|
1068
|
-
**This entire step produces NO user-visible output.** All pheromone operations run silently -- learnings are deposited in the background. If any pheromone call fails, log the error and continue. Phase advancement must never fail due to pheromone errors.
|
|
1069
|
-
|
|
1070
|
-
#### 2.1a: Auto-emit FEEDBACK pheromone for phase outcome
|
|
1071
|
-
|
|
1072
|
-
After learning extraction completes in Step 2, auto-emit a FEEDBACK signal summarizing the phase:
|
|
1073
|
-
|
|
1074
|
-
```bash
|
|
1075
|
-
# phase_id and phase_name come from Step 2 state update
|
|
1076
|
-
# Take the top 1-3 learnings by evidence strength from memory.phase_learnings
|
|
1077
|
-
# Compress into a single summary sentence
|
|
1078
|
-
|
|
1079
|
-
phase_feedback="Phase $phase_id ($phase_name) completed. Key patterns: {brief summary of 1-3 learnings from Step 2}"
|
|
1080
|
-
# Fallback if no learnings: "Phase $phase_id ($phase_name) completed without notable patterns."
|
|
1081
|
-
|
|
1082
|
-
bash .aether/aether-utils.sh pheromone-write FEEDBACK "$phase_feedback" \
|
|
1083
|
-
--strength 0.6 \
|
|
1084
|
-
--source "worker:continue" \
|
|
1085
|
-
--reason "Auto-emitted on phase advance: captures what worked and what was learned" \
|
|
1086
|
-
--ttl "30d" 2>/dev/null || true
|
|
1087
|
-
```
|
|
1088
|
-
|
|
1089
|
-
The strength is 0.6 (auto-emitted = lower than user-emitted 0.7). Source is "worker:continue" to distinguish from user-emitted feedback. TTL is 30d so it survives phase transitions and can guide subsequent work.
|
|
1090
|
-
|
|
1091
|
-
#### 2.1b: Auto-emit REDIRECT for recurring error patterns
|
|
1092
|
-
|
|
1093
|
-
Check `errors.flagged_patterns[]` in COLONY_STATE.json for patterns that have appeared in 2+ phases:
|
|
1094
|
-
|
|
1095
|
-
```bash
|
|
1096
|
-
flagged_patterns=$(jq -r '.errors.flagged_patterns[]? | select(.count >= 2) | .pattern' .aether/data/COLONY_STATE.json 2>/dev/null || true)
|
|
1097
|
-
```
|
|
1098
|
-
|
|
1099
|
-
For each pattern returned by the above query, emit a REDIRECT signal:
|
|
1100
|
-
|
|
1101
|
-
```bash
|
|
1102
|
-
bash .aether/aether-utils.sh pheromone-write REDIRECT "$pattern_text" \
|
|
1103
|
-
--strength 0.7 \
|
|
1104
|
-
--source "system" \
|
|
1105
|
-
--reason "Auto-emitted: error pattern recurred across 2+ phases" \
|
|
1106
|
-
--ttl "30d" 2>/dev/null || true
|
|
1107
|
-
```
|
|
1108
|
-
|
|
1109
|
-
Also capture each recurring pattern as a resolution candidate:
|
|
1110
|
-
|
|
1111
|
-
```bash
|
|
1112
|
-
bash .aether/aether-utils.sh memory-capture \
|
|
1113
|
-
"resolution" \
|
|
1114
|
-
"$pattern_text" \
|
|
1115
|
-
"pattern" \
|
|
1116
|
-
"worker:continue" 2>/dev/null || true
|
|
1117
|
-
```
|
|
1118
|
-
|
|
1119
|
-
If `errors.flagged_patterns` doesn't exist or is empty, skip silently.
|
|
1120
|
-
|
|
1121
|
-
#### 2.1c: Expire phase_end signals and archive to midden
|
|
1122
|
-
|
|
1123
|
-
After auto-emission, expire all signals with `expires_at == "phase_end"`:
|
|
1124
|
-
|
|
1125
|
-
Run using the Bash tool with description "Maintaining pheromone memory...": `bash .aether/aether-utils.sh pheromone-expire --phase-end-only 2>/dev/null && bash .aether/aether-utils.sh eternal-init 2>/dev/null`
|
|
1126
|
-
|
|
1127
|
-
### Step 2.1.5: Check for Promotion Proposals
|
|
1128
|
-
|
|
1129
|
-
After extracting learnings, check for observations that have met promotion thresholds and present the tick-to-approve UX.
|
|
1130
|
-
|
|
1131
|
-
**Normal proposal flow (MEM-01: Silent skip if empty):**
|
|
1132
|
-
|
|
1133
|
-
1. **Check for proposals:**
|
|
1134
|
-
```bash
|
|
1135
|
-
proposals=$(bash .aether/aether-utils.sh learning-check-promotion 2>/dev/null || echo '{"proposals":[]}')
|
|
1136
|
-
proposal_count=$(echo "$proposals" | jq '.proposals | length')
|
|
1137
|
-
```
|
|
1138
|
-
|
|
1139
|
-
2. **If proposals exist, invoke the approval workflow:**
|
|
1140
|
-
|
|
1141
|
-
Only show the approval UI when there are actual proposals to review:
|
|
1142
|
-
|
|
1143
|
-
```bash
|
|
1144
|
-
if [[ "$proposal_count" -gt 0 ]]; then
|
|
1145
|
-
bash .aether/aether-utils.sh learning-approve-proposals
|
|
1146
|
-
fi
|
|
1147
|
-
# If no proposals, silently skip without notice
|
|
1148
|
-
```
|
|
1149
|
-
|
|
1150
|
-
The learning-approve-proposals function handles:
|
|
1151
|
-
- Displaying proposals with checkbox UI
|
|
1152
|
-
- Capturing user selection
|
|
1153
|
-
- Executing batch promotions via queen-promote
|
|
1154
|
-
- Deferring unselected proposals
|
|
1155
|
-
- Offering undo after successful promotions
|
|
1156
|
-
|
|
1157
|
-
**Skip conditions:**
|
|
1158
|
-
- learning-check-promotion returns empty or fails
|
|
1159
|
-
- No proposals to review (silent skip - no output)
|
|
1160
|
-
- QUEEN.md does not exist
|
|
1161
|
-
|
|
1162
|
-
### Step 2.2: Update Handoff Document
|
|
1163
|
-
|
|
1164
|
-
After advancing the phase, update the handoff document with the new current state:
|
|
1165
|
-
|
|
1166
|
-
```bash
|
|
1167
|
-
# Determine if there's a next phase
|
|
1168
|
-
next_phase_id=$((current_phase + 1))
|
|
1169
|
-
has_next_phase=$(jq --arg next "$next_phase_id" '.plan.phases | map(select(.id == ($next | tonumber))) | length' .aether/data/COLONY_STATE.json)
|
|
1170
|
-
|
|
1171
|
-
# Write updated handoff
|
|
1172
|
-
cat > .aether/HANDOFF.md << 'HANDOFF_EOF'
|
|
1173
|
-
# Colony Session — Phase Advanced
|
|
1174
|
-
|
|
1175
|
-
## Quick Resume
|
|
1176
|
-
Run `/ant:build {next_phase_id}` to start working on the current phase.
|
|
1177
|
-
|
|
1178
|
-
## State at Advancement
|
|
1179
|
-
- Goal: "$(jq -r '.goal' .aether/data/COLONY_STATE.json)"
|
|
1180
|
-
- Completed Phase: {completed_phase_id} — {completed_phase_name}
|
|
1181
|
-
- Current Phase: {next_phase_id} — {next_phase_name}
|
|
1182
|
-
- State: READY
|
|
1183
|
-
- Updated: $(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
1184
|
-
|
|
1185
|
-
## What Was Completed
|
|
1186
|
-
- Phase {completed_phase_id} marked as completed
|
|
1187
|
-
- Learnings extracted: {learning_count}
|
|
1188
|
-
- Instincts updated: {instinct_count}
|
|
1189
|
-
|
|
1190
|
-
## Current Phase Tasks
|
|
1191
|
-
$(jq -r '.plan.phases[] | select(.id == next_phase_id) | .tasks[] | "- [ ] \(.id): \(.description)"' .aether/data/COLONY_STATE.json)
|
|
1192
|
-
|
|
1193
|
-
## Next Steps
|
|
1194
|
-
- Build current phase: `/ant:build {next_phase_id}`
|
|
1195
|
-
- Review phase details: `/ant:phase {next_phase_id}`
|
|
1196
|
-
- Pause colony: `/ant:pause-colony`
|
|
1197
|
-
|
|
1198
|
-
## Session Note
|
|
1199
|
-
Phase advanced successfully. Colony is READY to build Phase {next_phase_id}.
|
|
1200
|
-
HANDOFF_EOF
|
|
1201
|
-
```
|
|
1202
|
-
|
|
1203
|
-
This handoff reflects the post-advancement state, allowing seamless resumption even if the session is lost.
|
|
1204
|
-
|
|
1205
|
-
### Step 2.3: Update Changelog
|
|
1206
|
-
|
|
1207
|
-
**MANDATORY: Append a changelog entry for the completed phase. This step is never skipped.**
|
|
1208
|
-
|
|
1209
|
-
If no `CHANGELOG.md` exists, `changelog-append` creates one automatically.
|
|
1210
|
-
|
|
1211
|
-
**Step 2.3.1: Collect plan data**
|
|
1212
|
-
|
|
1213
|
-
```bash
|
|
1214
|
-
bash .aether/aether-utils.sh changelog-collect-plan-data "{phase_identifier}" "{plan_number}"
|
|
1215
|
-
```
|
|
1216
|
-
|
|
1217
|
-
Parse the returned JSON to extract `files`, `decisions`, `worked`, and `requirements` arrays.
|
|
1218
|
-
|
|
1219
|
-
- `{phase_identifier}` is the full phase name (e.g., `36-memory-capture`)
|
|
1220
|
-
- `{plan_number}` is the plan number (e.g., `01`)
|
|
1221
|
-
|
|
1222
|
-
If the command fails (e.g., no plan file found), fall back to collecting data manually:
|
|
1223
|
-
- Files: from `git diff --stat` of the completed phase
|
|
1224
|
-
- Decisions: from COLONY_STATE.json `memory.decisions` (last 5)
|
|
1225
|
-
- Worked/requirements: leave empty
|
|
1226
|
-
|
|
1227
|
-
**Step 2.3.2: Append changelog entry**
|
|
1228
|
-
|
|
1229
|
-
```bash
|
|
1230
|
-
bash .aether/aether-utils.sh changelog-append \
|
|
1231
|
-
"$(date +%Y-%m-%d)" \
|
|
1232
|
-
"{phase_identifier}" \
|
|
1233
|
-
"{plan_number}" \
|
|
1234
|
-
"{files_csv}" \
|
|
1235
|
-
"{decisions_semicolon_separated}" \
|
|
1236
|
-
"{worked_semicolon_separated}" \
|
|
1237
|
-
"{requirements_csv}"
|
|
1238
|
-
```
|
|
1239
|
-
|
|
1240
|
-
This atomically writes the entry. If the project already has a Keep a Changelog format, it adds a "Colony Work Log" separator section to keep both formats clean.
|
|
1241
|
-
|
|
1242
|
-
**Error handling:** If `changelog-append` fails, log to midden and continue — changelog failure never blocks phase advancement.
|
|
1243
|
-
|
|
1244
|
-
### Step 2.4: Commit Suggestion (Optional)
|
|
1245
|
-
|
|
1246
|
-
**This step is non-blocking. Skipping does not affect phase advancement or any subsequent steps. Failure to commit has zero consequences.**
|
|
1247
|
-
|
|
1248
|
-
After the phase is advanced and changelog updated, suggest a commit to preserve the milestone.
|
|
1249
|
-
|
|
1250
|
-
1. **Generate the commit message:**
|
|
1251
|
-
```bash
|
|
1252
|
-
bash .aether/aether-utils.sh generate-commit-message "milestone" {phase_id} "{phase_name}" "{one_line_summary}"
|
|
1253
|
-
```
|
|
1254
|
-
Parse the returned JSON to extract `message` and `files_changed`.
|
|
1255
|
-
|
|
1256
|
-
2. **Check files changed:**
|
|
1257
|
-
```bash
|
|
1258
|
-
git diff --stat HEAD 2>/dev/null | tail -5
|
|
1259
|
-
```
|
|
1260
|
-
If not in a git repo or no changes detected, skip this step silently.
|
|
1261
|
-
|
|
1262
|
-
3. **Display the suggestion:**
|
|
1263
|
-
```
|
|
1264
|
-
──────────────────────────────────────────────────
|
|
1265
|
-
Commit Suggestion
|
|
1266
|
-
──────────────────────────────────────────────────
|
|
1267
|
-
|
|
1268
|
-
Message: {generated_message}
|
|
1269
|
-
Files: {files_changed} files changed
|
|
1270
|
-
Preview: {first 5 lines of git diff --stat}
|
|
1271
|
-
|
|
1272
|
-
──────────────────────────────────────────────────
|
|
1273
|
-
```
|
|
1274
|
-
|
|
1275
|
-
4. **Use AskUserQuestion:**
|
|
1276
|
-
```
|
|
1277
|
-
Commit this milestone?
|
|
1278
|
-
|
|
1279
|
-
1. Yes, commit with this message
|
|
1280
|
-
2. Yes, but let me write the message
|
|
1281
|
-
3. No, I'll commit later
|
|
1282
|
-
```
|
|
1283
|
-
|
|
1284
|
-
5. **If option 1 ("Yes, commit with this message"):**
|
|
1285
|
-
```bash
|
|
1286
|
-
git add -A && git commit -m "{generated_message}"
|
|
1287
|
-
```
|
|
1288
|
-
Display: `Committed: {generated_message} ({files_changed} files)`
|
|
1289
|
-
|
|
1290
|
-
6. **If option 2 ("Yes, but let me write the message"):**
|
|
1291
|
-
Use AskUserQuestion to get the user's custom commit message, then:
|
|
1292
|
-
```bash
|
|
1293
|
-
git add -A && git commit -m "{custom_message}"
|
|
1294
|
-
```
|
|
1295
|
-
Display: `Committed: {custom_message} ({files_changed} files)`
|
|
1296
|
-
|
|
1297
|
-
7. **If option 3 ("No, I'll commit later"):**
|
|
1298
|
-
Display: `Skipped. Your changes are saved on disk but not committed.`
|
|
1299
|
-
|
|
1300
|
-
8. **Record the suggestion to prevent double-prompting:**
|
|
1301
|
-
Set `last_commit_suggestion_phase` to `{phase_id}` in COLONY_STATE.json (add the field at the top level if it does not exist).
|
|
1302
|
-
|
|
1303
|
-
**Error handling:** If any git command fails (not a repo, merge conflict, pre-commit hook rejection), display the error output and continue to the next step. The commit suggestion is advisory only -- it never blocks the flow.
|
|
1304
|
-
|
|
1305
|
-
Continue to Step 2.5 (Context Clear Suggestion), then to Step 2.7 (Project Completion) or Step 3 (Display Result).
|
|
1306
|
-
|
|
1307
|
-
### Step 2.5: Context Clear Suggestion (Optional)
|
|
1308
|
-
|
|
1309
|
-
**This step is non-blocking. Skipping does not affect phase advancement.**
|
|
1310
|
-
|
|
1311
|
-
After committing (or skipping commit), suggest clearing context to refresh before the next phase.
|
|
1312
|
-
|
|
1313
|
-
1. **Display the suggestion:**
|
|
1314
|
-
```
|
|
1315
|
-
──────────────────────────────────────────────────
|
|
1316
|
-
Context Refresh
|
|
1317
|
-
──────────────────────────────────────────────────
|
|
1318
|
-
|
|
1319
|
-
State is fully persisted and committed.
|
|
1320
|
-
Phase {next_id} is ready to build.
|
|
1321
|
-
|
|
1322
|
-
──────────────────────────────────────────────────
|
|
1323
|
-
```
|
|
1324
|
-
|
|
1325
|
-
2. **Use AskUserQuestion:**
|
|
1326
|
-
```
|
|
1327
|
-
Clear context now?
|
|
1328
|
-
|
|
1329
|
-
1. Yes, clear context then run /ant:build {next_id}
|
|
1330
|
-
2. No, continue in current context
|
|
1331
|
-
```
|
|
1332
|
-
|
|
1333
|
-
3. **If option 1 ("Yes, clear context"):**
|
|
1334
|
-
|
|
1335
|
-
**IMPORTANT:** Most AI platforms do not support programmatic context clearing. Display instructions:
|
|
1336
|
-
```
|
|
1337
|
-
Please clear your context/conversation, then run: /ant:build {next_id}
|
|
1338
|
-
```
|
|
1339
|
-
|
|
1340
|
-
Record the suggestion: Set `context_clear_suggested` to `true` in COLONY_STATE.json.
|
|
1341
|
-
|
|
1342
|
-
4. **If option 2 ("No, continue in current context"):**
|
|
1343
|
-
Display: `Continuing in current context. State is saved.`
|
|
1344
|
-
|
|
1345
|
-
Continue to Step 2.6 (Context Update), then Step 2.7 (Project Completion) or Step 3 (Display Result).
|
|
1346
|
-
|
|
1347
|
-
### Step 2.6: Update Context Document
|
|
1348
|
-
|
|
1349
|
-
After phase advancement is complete, update `.aether/CONTEXT.md`:
|
|
1350
|
-
|
|
1351
|
-
**Log the activity:**
|
|
1352
|
-
```bash
|
|
1353
|
-
bash .aether/aether-utils.sh context-update activity "continue" "Phase {prev_id} completed, advanced to {next_id}" "---"
|
|
1354
|
-
```
|
|
1355
|
-
|
|
1356
|
-
**Update the phase:**
|
|
1357
|
-
```bash
|
|
1358
|
-
bash .aether/aether-utils.sh context-update update-phase {next_id} "{next_phase_name}" "YES" "Phase advanced, ready to build"
|
|
1359
|
-
```
|
|
1360
|
-
|
|
1361
|
-
**Log any decisions from this session:**
|
|
1362
|
-
If any architectural decisions were made during verification, also run:
|
|
1363
|
-
```bash
|
|
1364
|
-
bash .aether/aether-utils.sh context-update decision "{decision_description}" "{rationale}" "Queen"
|
|
1365
|
-
```
|
|
1366
|
-
|
|
1367
|
-
### Step 2.7: Project Completion
|
|
1368
|
-
|
|
1369
|
-
Runs ONLY when all phases complete.
|
|
1370
|
-
|
|
1371
|
-
1. Read activity.log and errors.records
|
|
1372
|
-
2. Display tech debt report:
|
|
1373
|
-
|
|
1374
|
-
```
|
|
1375
|
-
🐜 ═══════════════════════════════════════════════════
|
|
1376
|
-
🎉 P R O J E C T C O M P L E T E 🎉
|
|
1377
|
-
═══════════════════════════════════════════════════ 🐜
|
|
1378
|
-
|
|
1379
|
-
👑 Goal Achieved: {goal}
|
|
1380
|
-
📍 Phases Completed: {total}
|
|
1381
|
-
|
|
1382
|
-
{if flagged_patterns:}
|
|
1383
|
-
⚠️ Persistent Issues:
|
|
1384
|
-
{list any flagged_patterns}
|
|
1385
|
-
{end if}
|
|
1386
|
-
|
|
1387
|
-
🧠 Colony Learnings:
|
|
1388
|
-
{condensed learnings from memory.phase_learnings}
|
|
1389
|
-
|
|
1390
|
-
🐜 The colony rests. Well done!
|
|
1391
|
-
```
|
|
1392
|
-
|
|
1393
|
-
3. Write summary to `.aether/data/completion-report.md`
|
|
1394
|
-
4. Display next commands and stop.
|
|
1395
|
-
|
|
1396
|
-
### Step 3: Display Result
|
|
1397
|
-
|
|
1398
|
-
Output:
|
|
1399
|
-
|
|
1400
|
-
```
|
|
1401
|
-
🐜 ═══════════════════════════════════════════════════
|
|
1402
|
-
P H A S E A D V A N C E M E N T
|
|
1403
|
-
═══════════════════════════════════════════════════ 🐜
|
|
1404
|
-
|
|
1405
|
-
✅ Phase {prev_id}: {prev_name} -- COMPLETED
|
|
1406
|
-
|
|
1407
|
-
🧠 Learnings Extracted:
|
|
1408
|
-
{list learnings added}
|
|
1409
|
-
|
|
1410
|
-
🐜 Instincts Updated:
|
|
1411
|
-
{for each instinct created or updated:}
|
|
1412
|
-
[{confidence}] {domain}: {action}
|
|
1413
|
-
{end for}
|
|
1414
|
-
|
|
1415
|
-
─────────────────────────────────────────────────────
|
|
1416
|
-
|
|
1417
|
-
➡️ Advancing to Phase {next_id}: {next_name}
|
|
1418
|
-
{next_description}
|
|
1419
|
-
📋 Tasks: {task_count}
|
|
1420
|
-
📊 State: READY
|
|
1421
|
-
|
|
1422
|
-
🐜 Next Steps:
|
|
1423
|
-
/ant:build {next_id} 🔨 Start building Phase {next_id}: {next_name}
|
|
1424
|
-
/ant:phase {next_id} 📋 Review phase details first
|
|
1425
|
-
/ant:focus "<area>" 🎯 Guide colony attention
|
|
1426
|
-
|
|
1427
|
-
💾 State persisted — context clear suggested above
|
|
1428
|
-
```
|
|
1429
|
-
|
|
1430
|
-
**IMPORTANT:** In the "Next Steps" section above, substitute the actual phase number for `{next_id}` (calculated in Step 2 as `current_phase + 1`). For example, if advancing to phase 4, output `/ant:build 4` not `/ant:build {next_id}`.
|
|
1431
|
-
|
|
1432
|
-
### Step 4: Update Session
|
|
1433
|
-
|
|
1434
|
-
Update the session tracking file to enable `/ant:resume` after context clear:
|
|
1435
|
-
|
|
1436
|
-
Run using the Bash tool with description "Saving session state...": `bash .aether/aether-utils.sh session-update "/ant:continue" "/ant:build {next_id}" "Phase {prev_id} completed, advanced to Phase {next_id}"`
|