aether-colony 3.1.17 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/{runtime → .aether}/CONTEXT.md +1 -1
  2. package/{runtime → .aether}/aether-utils.sh +1772 -98
  3. package/.aether/docs/QUEEN-SYSTEM.md +211 -0
  4. package/.aether/docs/QUEEN.md +84 -0
  5. package/.aether/docs/README.md +68 -0
  6. package/.aether/docs/caste-system.md +48 -0
  7. package/{runtime → .aether/docs/disciplines}/DISCIPLINES.md +8 -8
  8. package/.aether/docs/error-codes.md +268 -0
  9. package/{runtime → .aether}/docs/known-issues.md +42 -26
  10. package/.aether/docs/queen-commands.md +97 -0
  11. package/.aether/exchange/colony-registry.xml +11 -0
  12. package/{runtime → .aether}/exchange/pheromone-xml.sh +2 -1
  13. package/.aether/exchange/pheromones.xml +87 -0
  14. package/.aether/exchange/queen-wisdom.xml +14 -0
  15. package/{runtime → .aether}/exchange/registry-xml.sh +7 -3
  16. package/{runtime → .aether}/exchange/wisdom-xml.sh +11 -4
  17. package/.aether/rules/aether-colony.md +134 -0
  18. package/.aether/schemas/example-prompt-builder.xml +234 -0
  19. package/.aether/templates/colony-state-reset.jq.template +22 -0
  20. package/.aether/templates/colony-state.template.json +35 -0
  21. package/.aether/templates/constraints.template.json +9 -0
  22. package/.aether/templates/crowned-anthill.template.md +36 -0
  23. package/.aether/templates/handoff-build-error.template.md +30 -0
  24. package/.aether/templates/handoff-build-success.template.md +39 -0
  25. package/.aether/templates/handoff.template.md +40 -0
  26. package/{runtime → .aether}/utils/atomic-write.sh +5 -5
  27. package/{runtime → .aether}/utils/chamber-compare.sh +23 -10
  28. package/{runtime → .aether}/utils/chamber-utils.sh +32 -20
  29. package/{runtime → .aether}/utils/error-handler.sh +13 -1
  30. package/{runtime → .aether}/utils/file-lock.sh +49 -13
  31. package/.aether/utils/semantic-cli.sh +413 -0
  32. package/{runtime → .aether}/utils/xml-compose.sh +7 -1
  33. package/.aether/utils/xml-convert.sh +273 -0
  34. package/.aether/utils/xml-query.sh +201 -0
  35. package/.aether/utils/xml-utils.sh +110 -0
  36. package/{runtime → .aether}/workers.md +14 -17
  37. package/.claude/agents/ant/aether-ambassador.md +264 -0
  38. package/.claude/agents/ant/aether-archaeologist.md +322 -0
  39. package/.claude/agents/ant/aether-auditor.md +266 -0
  40. package/.claude/agents/ant/aether-builder.md +187 -0
  41. package/.claude/agents/ant/aether-chaos.md +268 -0
  42. package/.claude/agents/ant/aether-chronicler.md +304 -0
  43. package/.claude/agents/ant/aether-gatekeeper.md +325 -0
  44. package/.claude/agents/ant/aether-includer.md +373 -0
  45. package/.claude/agents/ant/aether-keeper.md +271 -0
  46. package/.claude/agents/ant/aether-measurer.md +317 -0
  47. package/.claude/agents/ant/aether-probe.md +210 -0
  48. package/.claude/agents/ant/aether-queen.md +325 -0
  49. package/.claude/agents/ant/aether-route-setter.md +173 -0
  50. package/.claude/agents/ant/aether-sage.md +353 -0
  51. package/.claude/agents/ant/aether-scout.md +142 -0
  52. package/.claude/agents/ant/aether-surveyor-disciplines.md +416 -0
  53. package/.claude/agents/ant/aether-surveyor-nest.md +354 -0
  54. package/.claude/agents/ant/aether-surveyor-pathogens.md +288 -0
  55. package/.claude/agents/ant/aether-surveyor-provisions.md +359 -0
  56. package/.claude/agents/ant/aether-tracker.md +265 -0
  57. package/.claude/agents/ant/aether-watcher.md +244 -0
  58. package/.claude/agents/ant/aether-weaver.md +247 -0
  59. package/.claude/commands/ant/archaeology.md +16 -7
  60. package/.claude/commands/ant/build.md +415 -284
  61. package/.claude/commands/ant/chaos.md +19 -10
  62. package/.claude/commands/ant/colonize.md +58 -24
  63. package/.claude/commands/ant/continue.md +155 -145
  64. package/.claude/commands/ant/council.md +15 -5
  65. package/.claude/commands/ant/dream.md +16 -7
  66. package/.claude/commands/ant/entomb.md +274 -157
  67. package/.claude/commands/ant/feedback.md +33 -29
  68. package/.claude/commands/ant/flag.md +18 -10
  69. package/.claude/commands/ant/flags.md +14 -6
  70. package/.claude/commands/ant/focus.md +29 -21
  71. package/.claude/commands/ant/help.md +11 -1
  72. package/.claude/commands/ant/history.md +10 -0
  73. package/.claude/commands/ant/init.md +91 -65
  74. package/.claude/commands/ant/interpret.md +15 -4
  75. package/.claude/commands/ant/lay-eggs.md +55 -7
  76. package/.claude/commands/ant/maturity.md +11 -1
  77. package/.claude/commands/ant/migrate-state.md +14 -2
  78. package/.claude/commands/ant/oracle.md +23 -15
  79. package/.claude/commands/ant/organize.md +29 -20
  80. package/.claude/commands/ant/pause-colony.md +17 -7
  81. package/.claude/commands/ant/phase.md +17 -8
  82. package/.claude/commands/ant/plan.md +20 -9
  83. package/.claude/commands/ant/redirect.md +29 -32
  84. package/.claude/commands/ant/resume-colony.md +19 -9
  85. package/.claude/commands/ant/resume.md +272 -96
  86. package/.claude/commands/ant/seal.md +201 -191
  87. package/.claude/commands/ant/status.md +71 -32
  88. package/.claude/commands/ant/swarm.md +26 -44
  89. package/.claude/commands/ant/tunnels.md +279 -105
  90. package/.claude/commands/ant/update.md +81 -20
  91. package/.claude/commands/ant/verify-castes.md +14 -4
  92. package/.claude/commands/ant/watch.md +13 -12
  93. package/.opencode/agents/aether-ambassador.md +63 -20
  94. package/.opencode/agents/aether-archaeologist.md +29 -12
  95. package/.opencode/agents/aether-auditor.md +51 -18
  96. package/.opencode/agents/aether-builder.md +69 -19
  97. package/.opencode/agents/aether-chaos.md +29 -12
  98. package/.opencode/agents/aether-chronicler.md +60 -18
  99. package/.opencode/agents/aether-gatekeeper.md +27 -18
  100. package/.opencode/agents/aether-includer.md +27 -18
  101. package/.opencode/agents/aether-keeper.md +89 -18
  102. package/.opencode/agents/aether-measurer.md +27 -18
  103. package/.opencode/agents/aether-probe.md +60 -18
  104. package/.opencode/agents/aether-queen.md +172 -24
  105. package/.opencode/agents/aether-route-setter.md +57 -12
  106. package/.opencode/agents/aether-sage.md +26 -18
  107. package/.opencode/agents/aether-scout.md +27 -19
  108. package/.opencode/agents/aether-surveyor-disciplines.md +53 -1
  109. package/.opencode/agents/aether-surveyor-nest.md +53 -1
  110. package/.opencode/agents/aether-surveyor-pathogens.md +51 -1
  111. package/.opencode/agents/aether-surveyor-provisions.md +53 -1
  112. package/.opencode/agents/aether-tracker.md +64 -18
  113. package/.opencode/agents/aether-watcher.md +66 -19
  114. package/.opencode/agents/aether-weaver.md +61 -18
  115. package/.opencode/commands/ant/build.md +406 -192
  116. package/.opencode/commands/ant/continue.md +66 -76
  117. package/.opencode/commands/ant/entomb.md +106 -45
  118. package/.opencode/commands/ant/init.md +46 -48
  119. package/.opencode/commands/ant/organize.md +5 -5
  120. package/.opencode/commands/ant/resume.md +334 -0
  121. package/.opencode/commands/ant/seal.md +33 -24
  122. package/.opencode/commands/ant/status.md +11 -0
  123. package/.opencode/commands/ant/tunnels.md +149 -0
  124. package/.opencode/commands/ant/update.md +59 -16
  125. package/CHANGELOG.md +79 -0
  126. package/README.md +135 -353
  127. package/bin/cli.js +243 -122
  128. package/bin/generate-commands.sh +2 -2
  129. package/bin/lib/init.js +13 -3
  130. package/bin/lib/update-transaction.js +119 -117
  131. package/bin/sync-to-runtime.sh +5 -137
  132. package/bin/validate-package.sh +84 -0
  133. package/package.json +9 -6
  134. package/.opencode/agents/aether-architect.md +0 -66
  135. package/.opencode/agents/aether-guardian.md +0 -107
  136. package/.opencode/agents/workers.md +0 -1034
  137. package/runtime/QUEEN_ANT_ARCHITECTURE.md +0 -402
  138. package/runtime/data/signatures.json +0 -41
  139. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +0 -1343
  140. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +0 -2642
  141. package/runtime/docs/PHEROMONE-INJECTION.md +0 -240
  142. package/runtime/docs/PHEROMONE-INTEGRATION.md +0 -192
  143. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +0 -426
  144. package/runtime/docs/README.md +0 -94
  145. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +0 -219
  146. package/runtime/docs/biological-reference.md +0 -272
  147. package/runtime/docs/codebase-review.md +0 -399
  148. package/runtime/docs/command-sync.md +0 -164
  149. package/runtime/docs/constraints.md +0 -116
  150. package/runtime/docs/implementation-learnings.md +0 -89
  151. package/runtime/docs/namespace.md +0 -148
  152. package/runtime/docs/pathogen-schema-example.json +0 -36
  153. package/runtime/docs/pathogen-schema.md +0 -111
  154. package/runtime/docs/planning-discipline.md +0 -159
  155. package/runtime/docs/progressive-disclosure.md +0 -184
  156. package/runtime/lib/queen-utils.sh +0 -729
  157. package/runtime/planning.md +0 -159
  158. package/runtime/recover.sh +0 -136
  159. package/runtime/utils/xml-utils.sh +0 -2196
  160. package/runtime/workers-new-castes.md +0 -516
  161. /package/{runtime → .aether/docs/disciplines}/coding-standards.md +0 -0
  162. /package/{runtime → .aether/docs/disciplines}/debugging.md +0 -0
  163. /package/{runtime → .aether/docs/disciplines}/learning.md +0 -0
  164. /package/{runtime → .aether/docs/disciplines}/tdd.md +0 -0
  165. /package/{runtime → .aether/docs/disciplines}/verification-loop.md +0 -0
  166. /package/{runtime → .aether/docs/disciplines}/verification.md +0 -0
  167. /package/{runtime → .aether}/docs/pheromones.md +0 -0
  168. /package/{runtime → .aether}/model-profiles.yaml +0 -0
  169. /package/{runtime → .aether}/schemas/aether-types.xsd +0 -0
  170. /package/{runtime → .aether}/schemas/colony-registry.xsd +0 -0
  171. /package/{runtime → .aether}/schemas/pheromone.xsd +0 -0
  172. /package/{runtime → .aether}/schemas/prompt.xsd +0 -0
  173. /package/{runtime → .aether}/schemas/queen-wisdom.xsd +0 -0
  174. /package/{runtime → .aether}/schemas/worker-priming.xsd +0 -0
  175. /package/{runtime → .aether}/templates/QUEEN.md.template +0 -0
  176. /package/{runtime → .aether}/utils/colorize-log.sh +0 -0
  177. /package/{runtime → .aether}/utils/queen-to-md.xsl +0 -0
  178. /package/{runtime → .aether}/utils/spawn-tree.sh +0 -0
  179. /package/{runtime → .aether}/utils/spawn-with-model.sh +0 -0
  180. /package/{runtime → .aether}/utils/state-loader.sh +0 -0
  181. /package/{runtime → .aether}/utils/swarm-display.sh +0 -0
  182. /package/{runtime → .aether}/utils/watch-spawn-tree.sh +0 -0
  183. /package/{runtime → .aether}/utils/xml-core.sh +0 -0
@@ -1,1343 +0,0 @@
1
- ---
2
- name: Aether 2.0 - Paradigm Shift Implementation Plan
3
- overview: A comprehensive plan to transform Aether from a prompt-engineering system into a learning, autonomous multi-agent platform. This includes research phases, implementation strategies, and integration with the current system for all 10 groundbreaking features.
4
- todos:
5
- - id: create-directories
6
- content: Create research directory structure (.aether/research/ and .aether/v2/)
7
- status: pending
8
- - id: create-roadmap
9
- content: Create master ROADMAP.md with all 10 features
10
- status: pending
11
- - id: f1-research
12
- content: "F1: Research LiteLLM proxy routing patterns"
13
- status: pending
14
- - id: f2-schema
15
- content: "F2: Design outcome tracking schema"
16
- status: pending
17
- - id: f3-algorithm
18
- content: "F3: Design pattern detection algorithm"
19
- status: pending
20
- - id: f4-protocol
21
- content: "F4: Design agent communication protocol"
22
- status: pending
23
- - id: f5-security
24
- content: "F5: Research sandbox security models"
25
- status: pending
26
- - id: f6-vectordb
27
- content: "F6: Compare vector database options"
28
- status: pending
29
- - id: f7-attribution
30
- content: "F7: Design cost attribution model"
31
- status: pending
32
- - id: f8-feedback-ui
33
- content: "F8: Design minimal-friction feedback UI"
34
- status: pending
35
- - id: f9-frameworks
36
- content: "F9: Compare dashboard frameworks"
37
- status: pending
38
- - id: f10-rules
39
- content: "F10: Design plan verification rules"
40
- status: pending
41
- isProject: false
42
- ---
43
-
44
- ## Aether 2.0 - Paradigm Shift Implementation Plan
45
-
46
- ### Executive Summary
47
-
48
- Transform Aether from "fancy prompt templates" into a "learning autonomous system" by implementing 10 paradigm-shifting features. This plan establishes a research directory, phases each feature, and defines integration with the existing system.
49
-
50
- ---
51
-
52
- ## Phase 0: Research Infrastructure
53
-
54
- ### 0.1 Create Research Directory Structure
55
-
56
- ```
57
- .aether/
58
- ├── research/ # NEW: Research and development
59
- │ ├── 2.0-roadmap/ # Master roadmap
60
- │ │ ├── ROADMAP.md # Overall plan
61
- │ │ ├── DEPENDENCIES.md # Feature dependencies
62
- │ │ └── PROGRESS.md # Tracking progress
63
- │ │
64
- │ ├── F1-model-routing/ # Feature 1: Actual model routing
65
- │ │ ├── RESEARCH.md # Findings and decisions
66
- │ │ ├── IMPLEMENTATION.md # Implementation plan
67
- │ │ └── prototype/ # Working prototypes
68
- │ │
69
- │ ├── F2-outcome-learning/ # Feature 2: RL from outcomes
70
- │ ├── F3-self-modifying-prompts/ # Feature 3: Evolving prompts
71
- │ ├── F4-agent-communication/ # Feature 4: Message bus
72
- │ ├── F5-execution-sandbox/ # Feature 5: Real tooling
73
- │ ├── F6-cross-project-knowledge/ # Feature 6: Knowledge transfer
74
- │ ├── F7-cost-optimization/ # Feature 7: Cost tracking
75
- │ ├── F8-human-feedback/ # Feature 8: RLHF
76
- │ ├── F9-visual-observatory/ # Feature 9: Dashboard
77
- │ └── F10-plan-verification/ # Feature 10: Formal verification
78
-
79
- └── v2/ # NEW: Version 2 implementation
80
- ├── core/ # New core modules
81
- ├── agents/ # Enhanced agent system
82
- └── integrations/ # External integrations
83
- ```
84
-
85
- ---
86
-
87
- ## Feature 1: Actual Model Routing Infrastructure
88
-
89
- ### Research Questions
90
-
91
- 1. How does LiteLLM proxy handle request routing?
92
- 2. What header/parameter patterns work for agent-type routing?
93
- 3. How do we track per-agent costs and latency?
94
- 4. What's the minimal viable proxy configuration?
95
-
96
- ### Research Tasks
97
-
98
- - Study LiteLLM proxy documentation and source code
99
- - Test routing with custom headers (`X-Agent-Type`)
100
- - Benchmark latency for different routing strategies
101
- - Design telemetry collection schema
102
- - Compare: header-based vs model-alias vs custom proxy
103
-
104
- ### Implementation Plan
105
-
106
- **Phase 1A: Proxy Configuration (2 days)**
107
-
108
- ```yaml
109
- # .aether/v2/proxy/routing.yaml
110
- router:
111
- - agent_type: builder
112
- model: kimi-k2.5
113
- timeout: 120s
114
-
115
- - agent_type: oracle
116
- model: glm-5
117
- timeout: 300s
118
-
119
- - agent_type: scout
120
- model: minimax-2.5
121
- timeout: 60s
122
- ```
123
-
124
- **Phase 1B: Request Interceptor (3 days)**
125
-
126
- ```javascript
127
- // bin/v2/request-router.js
128
- class RequestRouter {
129
- route(request) {
130
- const agentType = request.headers['x-agent-type'];
131
- const model = this.config.getMapping(agentType);
132
- const startTime = Date.now();
133
-
134
- // Route request
135
- const response = await this.proxy.forward(request, model);
136
-
137
- // Record telemetry
138
- await this.telemetry.record({
139
- agent_type: agentType,
140
- model: model,
141
- latency_ms: Date.now() - startTime,
142
- tokens_used: response.usage,
143
- success: response.ok
144
- });
145
-
146
- return response;
147
- }
148
- }
149
- ```
150
-
151
- **Phase 1C: Integration with Task Tool (2 days)**
152
-
153
- - Modify build.md to set agent-type header
154
- - Update spawn-with-model.sh to use new router
155
- - Add telemetry display to /ant:status
156
-
157
- ### Integration Points
158
-
159
- - `.aether/model-profiles.yaml` → becomes routing config
160
- - `bin/lib/telemetry.js` → enhanced for per-agent tracking
161
- - `.claude/commands/ant/build.md` → set agent headers
162
-
163
- ---
164
-
165
- ## Feature 2: Reinforcement Learning from Outcomes
166
-
167
- ### Research Questions
168
-
169
- 1. What data schema captures task outcomes effectively?
170
- 2. How do we measure "success" for different task types?
171
- 3. What ML approach works with limited training data?
172
- 4. How do we avoid bias from user ratings?
173
-
174
- ### Research Tasks
175
-
176
- - Survey RL approaches for small datasets
177
- - Design outcome schema with all relevant features
178
- - Research bandit algorithms for model selection
179
- - Study transfer learning from code completion models
180
- - Design A/B testing framework for agent selection
181
-
182
- ### Implementation Plan
183
-
184
- **Phase 2A: Outcome Schema (1 day)**
185
-
186
- ```javascript
187
- // bin/v2/outcome-tracker.js
188
- const OutcomeSchema = {
189
- task_id: String,
190
- task_type: ['implement', 'refactor', 'debug', 'test', 'research'],
191
- agent_type: String,
192
- model_used: String,
193
-
194
- // Estimates vs actuals
195
- estimated_complexity: Number, // 1-10
196
- actual_complexity: Number,
197
- estimated_time_ms: Number,
198
- actual_time_ms: Number,
199
-
200
- // Results
201
- result: ['success', 'partial', 'failed'],
202
- files_changed: Number,
203
- tests_added: Number,
204
- tests_passed: Number,
205
- bugs_introduced: Number,
206
-
207
- // Feedback
208
- user_rating: Number, // 1-5 or null
209
- user_feedback: String, // optional text
210
-
211
- // Context
212
- codebase_size: Number, // lines of code
213
- tech_stack: [String],
214
- timestamp: Date
215
- };
216
- ```
217
-
218
- **Phase 2B: Data Collection (2 days)**
219
-
220
- ```javascript
221
- // Integrate into continue.md verification step
222
- async function recordOutcome(phase, tasks, results) {
223
- for (const task of tasks) {
224
- await outcomeTracker.record({
225
- task_id: task.id,
226
- task_type: classifyTask(task.description),
227
- agent_type: task.assigned_agent,
228
- model_used: task.model,
229
- actual_complexity: inferComplexity(results),
230
- result: results.success ? 'success' : 'partial',
231
- // ... other fields
232
- });
233
- }
234
- }
235
- ```
236
-
237
- **Phase 2C: Learning Model (3 days)**
238
-
239
- ```python
240
- # bin/v2/agent-recommender.py
241
- class AgentRecommender:
242
- def recommend(self, task_type, complexity, tech_stack):
243
- # Query historical outcomes
244
- outcomes = self.query_outcomes(task_type)
245
-
246
- # Compute success rates per agent/model
247
- scores = {}
248
- for agent in ['builder', 'scout', 'oracle']:
249
- agent_outcomes = filter(lambda o: o.agent_type == agent, outcomes)
250
- success_rate = sum(o.result == 'success' for o in agent_outcomes) / len(agent_outcomes)
251
- avg_time = mean(o.actual_time_ms for o in agent_outcomes)
252
-
253
- # Weighted score: 70% success rate, 30% speed
254
- scores[agent] = 0.7 * success_rate + 0.3 * (1 / avg_time)
255
-
256
- return max(scores, key=scores.get), scores
257
- ```
258
-
259
- ### Integration Points
260
-
261
- - `.aether/data/outcomes.json` → new data file
262
- - `.claude/commands/ant/continue.md` → record after verification
263
- - `.claude/commands/ant/build.md` → query for agent selection
264
-
265
- ---
266
-
267
- ## Feature 3: Self-Modifying Prompts
268
-
269
- ### Research Questions
270
-
271
- 1. How do we safely modify prompt templates?
272
- 2. What patterns are learnable from execution history?
273
- 3. How do we version and rollback prompt changes?
274
- 4. What's the review process for auto-modifications?
275
-
276
- ### Research Tasks
277
-
278
- - Design prompt template versioning system
279
- - Research pattern extraction from logs
280
- - Study prompt optimization techniques
281
- - Design human review workflow for changes
282
- - Test A/B comparison of prompt variants
283
-
284
- ### Implementation Plan
285
-
286
- **Phase 3A: Pattern Detection (2 days)**
287
-
288
- ```javascript
289
- // bin/v2/pattern-learner.js
290
- class PatternLearner {
291
- async learnFromHistory(outcomes) {
292
- // Find patterns in successful/failed tasks
293
- const patterns = [];
294
-
295
- // Pattern: trigger phrases → better approaches
296
- const triggerPhrases = this.extractTriggers(outcomes);
297
- for (const phrase of triggerPhrases) {
298
- const withPhrase = outcomes.filter(o => o.description.includes(phrase));
299
- const successRate = withPhrase.filter(o => o.result === 'success').length / withPhrase.length;
300
-
301
- if (successRate > 0.8 && withPhrase.length >= 5) {
302
- patterns.push({
303
- trigger: phrase,
304
- recommendation: this.extractCommonApproach(withPhrase),
305
- confidence: successRate,
306
- learned_from: withPhrase.length
307
- });
308
- }
309
- }
310
-
311
- return patterns;
312
- }
313
- }
314
- ```
315
-
316
- **Phase 3B: Pattern Storage (1 day)**
317
-
318
- ```yaml
319
- # .aether/v2/learned-patterns.yaml
320
- version: 1
321
- patterns:
322
- - id: "react-tests"
323
- trigger: "React component tests failing"
324
- action: "Use @testing-library/react, check for async updates"
325
- confidence: 0.89
326
- learned_from: 12
327
- last_updated: "2026-02-15"
328
-
329
- - id: "auth-rate-limit"
330
- trigger: "authentication API"
331
- action: "Always add rate limiting to auth endpoints"
332
- confidence: 0.95
333
- learned_from: 8
334
- source: "user_feedback"
335
- ```
336
-
337
- **Phase 3C: Prompt Injection (2 days)**
338
-
339
- ```javascript
340
- // Modify prompt templates to include learned patterns
341
- function buildWorkerPrompt(basePrompt, task, learnedPatterns) {
342
- const relevantPatterns = learnedPatterns.filter(p =>
343
- task.description.toLowerCase().includes(p.trigger.toLowerCase())
344
- );
345
-
346
- if (relevantPatterns.length > 0) {
347
- return `${basePrompt}
348
-
349
- --- LEARNED PATTERNS (auto-detected as relevant) ---
350
- ${relevantPatterns.map(p => `- ${p.action} (confidence: ${p.confidence})`).join('\n')}
351
- --- END LEARNED PATTERNS ---`;
352
- }
353
-
354
- return basePrompt;
355
- }
356
- ```
357
-
358
- ### Integration Points
359
-
360
- - `.aether/v2/learned-patterns.yaml` → new config
361
- - `.claude/commands/ant/build.md` → inject patterns into worker prompts
362
- - `.aether/workers.md` → reference pattern system
363
-
364
- ---
365
-
366
- ## Feature 4: Agent-to-Agent Communication Protocol
367
-
368
- ### Research Questions
369
-
370
- 1. What message bus architecture fits Claude Code constraints?
371
- 2. How do agents discover each other's capabilities?
372
- 3. What's the addressing scheme for agents?
373
- 4. How do we handle agent failures in the communication chain?
374
-
375
- ### Research Tasks
376
-
377
- - Study message bus patterns (pub/sub, request/reply)
378
- - Design agent addressing and discovery
379
- - Research offline message handling
380
- - Design capability advertisement protocol
381
- - Test message ordering guarantees
382
-
383
- ### Implementation Plan
384
-
385
- **Phase 4A: Message Bus Core (3 days)**
386
-
387
- ```javascript
388
- // bin/v2/colony-bus.js
389
- class ColonyBus {
390
- constructor() {
391
- this.channels = new Map(); // channel → [handlers]
392
- this.messageLog = []; // for debugging/replay
393
- }
394
-
395
- // Agent subscribes to a channel
396
- subscribe(channel, agentId, handler) {
397
- if (!this.channels.has(channel)) {
398
- this.channels.set(channel, []);
399
- }
400
- this.channels.get(channel).push({ agentId, handler });
401
- }
402
-
403
- // Agent publishes a message
404
- async publish(channel, message) {
405
- const logged = {
406
- id: uuid(),
407
- channel,
408
- from: message.from,
409
- to: message.to || 'broadcast',
410
- payload: message.payload,
411
- timestamp: Date.now()
412
- };
413
- this.messageLog.push(logged);
414
-
415
- const handlers = this.channels.get(channel) || [];
416
- for (const { handler } of handlers) {
417
- await handler(logged);
418
- }
419
- }
420
- }
421
-
422
- // Predefined channels
423
- const CHANNELS = {
424
- 'colony.tasks.available': 'New tasks ready for pickup',
425
- 'colony.tasks.completed': 'Task finished',
426
- 'colony.research.needed': 'Scout needed for research',
427
- 'colony.verification.request': 'Watcher requested',
428
- 'colony.errors.critical': 'Error needs attention',
429
- 'colony.state.changed': 'State updated'
430
- };
431
- ```
432
-
433
- **Phase 4B: Agent Discovery (2 days)**
434
-
435
- ```javascript
436
- // Agents register their capabilities
437
- const agentRegistry = {
438
- 'builder-hammer-42': {
439
- type: 'builder',
440
- capabilities: ['implement', 'refactor', 'debug'],
441
- status: 'available',
442
- current_task: null,
443
- depth: 1,
444
- parent: 'queen'
445
- },
446
- 'scout-quest-17': {
447
- type: 'scout',
448
- capabilities: ['research', 'explore', 'document'],
449
- status: 'busy',
450
- current_task: 'task-123',
451
- depth: 2,
452
- parent: 'builder-hammer-42'
453
- }
454
- };
455
- ```
456
-
457
- **Phase 4C: Coordination Protocol (2 days)**
458
-
459
- ```markdown
460
- # Example: Builder requests research
461
-
462
- 1. Builder publishes to 'colony.research.needed':
463
- {
464
- from: 'builder-hammer-42',
465
- payload: {
466
- topic: 'JWT refresh token best practices',
467
- urgency: 'high',
468
- context: 'Building auth module'
469
- }
470
- }
471
-
472
- 2. Available scouts receive message
473
- 3. First scout to respond claims the task
474
- 4. Scout publishes result to 'colony.research.completed'
475
- 5. Builder receives and continues
476
- ```
477
-
478
- ### Integration Points
479
-
480
- - `.aether/v2/colony-bus.js` → new module
481
- - `.claude/commands/ant/build.md` → use bus for coordination
482
- - `.aether/data/message-log.json` → message history
483
-
484
- ---
485
-
486
- ## Feature 5: Execution Sandbox with Real Tooling
487
-
488
- ### Research Questions
489
-
490
- 1. What containerization approach works best? (Docker, Firecracker, gVisor)
491
- 2. How do we limit resource usage safely?
492
- 3. How do agents interact with the sandbox?
493
- 4. What's the security model for file system access?
494
-
495
- ### Research Tasks
496
-
497
- - Compare container runtimes for safety
498
- - Design resource limit enforcement
499
- - Research file system mapping strategies
500
- - Design API for sandbox interaction
501
- - Test security boundaries
502
-
503
- ### Implementation Plan
504
-
505
- **Phase 5A: Sandbox Configuration (2 days)**
506
-
507
- ```yaml
508
- # .aether/v2/sandbox/config.yaml
509
- runtime: docker # or firecracker, gvisor
510
-
511
- defaults:
512
- cpu_limit: "0.5"
513
- memory_limit: "512MB"
514
- timeout_seconds: 300
515
- network: none # no network by default
516
-
517
- tools:
518
- - git
519
- - npm
520
- - node
521
- - python3
522
- - pytest
523
-
524
- mount_points:
525
- - host: "${PROJECT_ROOT}/src"
526
- container: "/workspace/src"
527
- mode: "rw"
528
-
529
- - host: "${PROJECT_ROOT}/tests"
530
- container: "/workspace/tests"
531
- mode: "rw"
532
- ```
533
-
534
- **Phase 5B: Sandbox Manager (3 days)**
535
-
536
- ```javascript
537
- // bin/v2/sandbox/manager.js
538
- class SandboxManager {
539
- async createSandbox(taskId, config) {
540
- const container = await docker.createContainer({
541
- Image: 'aether-sandbox:latest',
542
- Cmd: ['/bin/bash', '-c', 'sleep infinity'],
543
- HostConfig: {
544
- CpuQuota: config.cpu_limit * 100000,
545
- Memory: config.memory_limit,
546
- NetworkMode: config.network,
547
- Binds: config.mount_points.map(m => `${m.host}:${m.container}:${m.mode}`)
548
- },
549
- Env: [
550
- `TASK_ID=${taskId}`,
551
- `TIMEOUT=${config.timeout_seconds}`
552
- ]
553
- });
554
-
555
- await container.start();
556
- return new Sandbox(container, taskId);
557
- }
558
- }
559
-
560
- class Sandbox {
561
- async execute(command) {
562
- const exec = await this.container.exec({
563
- Cmd: command.split(' '),
564
- AttachStdout: true,
565
- AttachStderr: true
566
- });
567
-
568
- const stream = await exec.start();
569
- return this.collectOutput(stream);
570
- }
571
-
572
- async writeFile(path, content) {
573
- // Write file into container
574
- }
575
-
576
- async readFile(path) {
577
- // Read file from container
578
- }
579
- }
580
- ```
581
-
582
- **Phase 5C: Agent Sandbox Interface (2 days)**
583
-
584
- ```javascript
585
- // Agents interact with sandbox through this API
586
- const sandbox = await sandboxManager.createSandbox(task.id, config);
587
-
588
- // Write initial code
589
- await sandbox.writeFile('/workspace/src/auth.ts', code);
590
-
591
- // Run tests
592
- const result = await sandbox.execute('npm test');
593
- if (result.exitCode !== 0) {
594
- // Agent sees real test failure
595
- // Can iterate until tests pass
596
- }
597
-
598
- // Read back modified files
599
- const finalCode = await sandbox.readFile('/workspace/src/auth.ts');
600
-
601
- // Cleanup
602
- await sandbox.destroy();
603
- ```
604
-
605
- ### Integration Points
606
-
607
- - `.aether/v2/sandbox/` → new sandbox module
608
- - `.claude/commands/ant/build.md` → use sandbox for builders
609
- - `Dockerfile` → sandbox image definition
610
-
611
- ---
612
-
613
- ## Feature 6: Cross-Project Knowledge Transfer
614
-
615
- ### Research Questions
616
-
617
- 1. What embedding model works best for code patterns?
618
- 2. How do we store and query vector embeddings efficiently?
619
- 3. What knowledge should transfer vs stay project-specific?
620
- 4. How do we handle knowledge conflicts between projects?
621
-
622
- ### Research Tasks
623
-
624
- - Compare vector databases (Pinecone, Weaviate, Chroma, pgvector)
625
- - Test code embedding models
626
- - Design knowledge schema and categories
627
- - Research knowledge conflict resolution
628
- - Design privacy controls for shared knowledge
629
-
630
- ### Implementation Plan
631
-
632
- **Phase 6A: Knowledge Schema (2 days)**
633
-
634
- ```javascript
635
- // bin/v2/knowledge/schema.js
636
- const KnowledgeSchema = {
637
- id: String,
638
- type: ['pattern', 'anti-pattern', 'preference', 'correction', 'insight'],
639
-
640
- content: {
641
- description: String, // What the knowledge is
642
- code_example: String, // Optional code
643
- applies_to: [String], // Tech stacks, languages
644
- },
645
-
646
- provenance: {
647
- source_project: String,
648
- learned_date: Date,
649
- times_applied: Number,
650
- success_rate: Number,
651
- user_confirmed: Boolean
652
- },
653
-
654
- embedding: {
655
- vector: [Number], // 1536 dimensions for OpenAI
656
- model: String, // Which embedding model
657
- text_hash: String // For deduplication
658
- }
659
- };
660
- ```
661
-
662
- **Phase 6B: Knowledge Store (3 days)**
663
-
664
- ```javascript
665
- // bin/v2/knowledge/store.js
666
- class KnowledgeStore {
667
- constructor(vectorDb) {
668
- this.db = vectorDb;
669
- }
670
-
671
- async addKnowledge(knowledge) {
672
- // Generate embedding
673
- const embedding = await this.embed(knowledge.description);
674
-
675
- // Store with metadata
676
- await this.db.upsert({
677
- id: knowledge.id,
678
- values: embedding,
679
- metadata: {
680
- type: knowledge.type,
681
- applies_to: knowledge.applies_to.join(','),
682
- success_rate: knowledge.provenance.success_rate,
683
- source_project: knowledge.provenance.source_project
684
- }
685
- });
686
- }
687
-
688
- async findRelevant(query, techStack, topK = 5) {
689
- const queryEmbedding = await this.embed(query);
690
-
691
- const results = await this.db.query({
692
- vector: queryEmbedding,
693
- topK: topK,
694
- filter: {
695
- applies_to: { $in: techStack }
696
- }
697
- });
698
-
699
- return results.matches.map(m => this.hydrate(m.id));
700
- }
701
- }
702
- ```
703
-
704
- **Phase 6C: Knowledge Transfer Protocol (2 days)**
705
-
706
- ```javascript
707
- // When starting a new project, transfer relevant knowledge
708
- async function initializeProjectKnowledge(goal, techStack) {
709
- const store = new KnowledgeStore();
710
-
711
- // Find relevant patterns from other projects
712
- const patterns = await store.findRelevant(goal, techStack, 10);
713
-
714
- // Seed the new project with these
715
- for (const pattern of patterns) {
716
- if (pattern.provenance.success_rate > 0.7) {
717
- await injectPattern(pattern);
718
- }
719
- }
720
-
721
- return {
722
- transferred_count: patterns.length,
723
- high_confidence: patterns.filter(p => p.provenance.success_rate > 0.7).length
724
- };
725
- }
726
- ```
727
-
728
- ### Integration Points
729
-
730
- - `.aether/v2/knowledge/` → new knowledge module
731
- - `.claude/commands/ant/init.md` → query knowledge store
732
- - `.claude/commands/ant/continue.md` → save learnings to store
733
-
734
- ---
735
-
736
- ## Feature 7: Cost/Performance Optimization Engine
737
-
738
- ### Research Questions
739
-
740
- 1. What cost metrics should we track?
741
- 2. How do we attribute costs to specific decisions?
742
- 3. What optimization strategies are most effective?
743
- 4. How do we present cost tradeoffs to users?
744
-
745
- ### Research Tasks
746
-
747
- - Design cost attribution model
748
- - Research optimization strategies
749
- - Design cost reporting UI
750
- - Study pricing across model providers
751
- - Design cost prediction model
752
-
753
- ### Implementation Plan
754
-
755
- **Phase 7A: Cost Tracking (2 days)**
756
-
757
- ```javascript
758
- // bin/v2/cost/tracker.js
759
- class CostTracker {
760
- constructor() {
761
- this.pricing = {
762
- 'kimi-k2.5': { input: 0.0003, output: 0.0015 }, // per 1K tokens
763
- 'glm-5': { input: 0.0005, output: 0.002 },
764
- 'minimax-2.5': { input: 0.0001, output: 0.0005 }
765
- };
766
- }
767
-
768
- calculateCost(model, usage) {
769
- const rates = this.pricing[model];
770
- return (usage.input_tokens / 1000 * rates.input) +
771
- (usage.output_tokens / 1000 * rates.output);
772
- }
773
-
774
- record(sessionId, agentType, model, usage, phase, task) {
775
- const cost = this.calculateCost(model, usage);
776
-
777
- return {
778
- session_id: sessionId,
779
- timestamp: Date.now(),
780
- agent_type: agentType,
781
- model: model,
782
- phase: phase,
783
- task: task,
784
- input_tokens: usage.input_tokens,
785
- output_tokens: usage.output_tokens,
786
- cost_usd: cost,
787
- latency_ms: usage.latency_ms
788
- };
789
- }
790
- }
791
- ```
792
-
793
- **Phase 7B: Cost Analysis (2 days)**
794
-
795
- ```javascript
796
- // bin/v2/cost/analyzer.js
797
- class CostAnalyzer {
798
- analyzeSession(sessionData) {
799
- const totalCost = sum(sessionData.map(e => e.cost_usd));
800
- const byAgent = groupBy(sessionData, 'agent_type');
801
- const byPhase = groupBy(sessionData, 'phase');
802
- const byModel = groupBy(sessionData, 'model');
803
-
804
- return {
805
- total_cost: totalCost,
806
- total_tokens: sum(sessionData.map(e => e.input_tokens + e.output_tokens)),
807
- avg_latency_ms: mean(sessionData.map(e => e.latency_ms)),
808
-
809
- breakdown: {
810
- by_agent: mapValues(byAgent, entries => ({
811
- cost: sum(entries.map(e => e.cost_usd)),
812
- count: entries.length
813
- })),
814
- by_phase: mapValues(byPhase, entries => ({
815
- cost: sum(entries.map(e => e.cost_usd)),
816
- count: entries.length
817
- })),
818
- by_model: mapValues(byModel, entries => ({
819
- cost: sum(entries.map(e => e.cost_usd)),
820
- count: entries.length
821
- }))
822
- },
823
-
824
- recommendations: this.generateRecommendations(sessionData)
825
- };
826
- }
827
-
828
- generateRecommendations(data) {
829
- const recs = [];
830
-
831
- // Check for expensive agents
832
- const agentCosts = groupBy(data, 'agent_type');
833
- for (const [agent, entries] of Object.entries(agentCosts)) {
834
- if (entries.length > 5 && mean(entries.map(e => e.cost_usd)) > 0.10) {
835
- recs.push({
836
- type: 'agent_optimization',
837
- message: `${agent} has high per-task cost ($${mean(entries.map(e => e.cost_usd)).toFixed(2)} avg)`,
838
- suggestion: 'Consider using a cheaper model for this agent type'
839
- });
840
- }
841
- }
842
-
843
- return recs;
844
- }
845
- }
846
- ```
847
-
848
- **Phase 7C: Cost Display (1 day)**
849
-
850
- ```markdown
851
- # Add to /ant:status output
852
-
853
- Cost This Session:
854
- Total: $0.87 (23,456 tokens)
855
-
856
- By Agent:
857
- Builder: $0.54 (62%)
858
- Scout: $0.23 (26%)
859
- Watcher: $0.10 (12%)
860
-
861
- By Phase:
862
- Planning: $0.18
863
- Building: $0.61
864
- Verify: $0.08
865
-
866
- Optimization Tips:
867
- - Scout could use minimax-2.5 (save ~$0.08)
868
- ```
869
-
870
- ### Integration Points
871
-
872
- - `.aether/v2/cost/` → new cost module
873
- - `.claude/commands/ant/status.md` → display costs
874
- - `bin/lib/telemetry.js` → enhanced with cost data
875
-
876
- ---
877
-
878
- ## Feature 8: Human-in-the-Loop RLHF
879
-
880
- ### Research Questions
881
-
882
- 1. What feedback granularity works best?
883
- 2. How do we avoid feedback fatigue?
884
- 3. How do we weight feedback vs automated metrics?
885
- 4. What's the UI for collecting feedback?
886
-
887
- ### Research Tasks
888
-
889
- - Study RLHF best practices
890
- - Design minimal-friction feedback collection
891
- - Research feedback weighting algorithms
892
- - Design feedback aggregation across sessions
893
- - Test feedback integration with outcome tracking
894
-
895
- ### Implementation Plan
896
-
897
- **Phase 8A: Feedback Schema (1 day)**
898
-
899
- ```javascript
900
- // bin/v2/feedback/schema.js
901
- const FeedbackSchema = {
902
- id: String,
903
- session_id: String,
904
- phase: Number,
905
- task_id: String,
906
-
907
- // Quick rating (primary signal)
908
- rating: ['great', 'good', 'ok', 'poor', 'bad'],
909
-
910
- // Optional details
911
- issues: [{
912
- type: ['wrong_approach', 'incomplete', 'slow', 'confusing', 'other'],
913
- description: String
914
- }],
915
-
916
- // What worked (for positive reinforcement)
917
- what_worked: String,
918
-
919
- // What to change (for improvement)
920
- suggestion: String,
921
-
922
- timestamp: Date
923
- };
924
- ```
925
-
926
- **Phase 8B: Feedback Collection UI (2 days)**
927
-
928
- ```markdown
929
- # Add to continue.md after phase completion
930
-
931
- --- FEEDBACK ---
932
- How did Phase 3 go?
933
-
934
- [1] Great - learned something new
935
- [2] Good - met expectations
936
- [3] OK - needed some fixes
937
- [4] Poor - had to redo myself
938
- [5] Bad - made things worse
939
-
940
- (You can also describe what worked or what to improve)
941
- ----------------
942
- ```
943
-
944
- **Phase 8C: Feedback Integration (2 days)**
945
-
946
- ```javascript
947
- // bin/v2/feedback/integrator.js
948
- class FeedbackIntegrator {
949
- async processFeedback(feedback) {
950
- // Store feedback
951
- await this.store.save(feedback);
952
-
953
- // If negative, extract learnings
954
- if (['poor', 'bad'].includes(feedback.rating)) {
955
- const patterns = await this.extractPatterns(feedback);
956
- for (const pattern of patterns) {
957
- // Create anti-pattern
958
- await this.knowledgeStore.addKnowledge({
959
- type: 'anti-pattern',
960
- content: pattern,
961
- provenance: {
962
- source_project: feedback.session_id,
963
- user_confirmed: true
964
- }
965
- });
966
- }
967
- }
968
-
969
- // If positive, reinforce
970
- if (['great', 'good'].includes(feedback.rating)) {
971
- const patterns = await this.extractPatterns(feedback);
972
- for (const pattern of patterns) {
973
- await this.knowledgeStore.incrementSuccess(pattern.id);
974
- }
975
- }
976
- }
977
- }
978
- ```
979
-
980
- ### Integration Points
981
-
982
- - `.aether/v2/feedback/` → new feedback module
983
- - `.claude/commands/ant/continue.md` → collect feedback
984
- - `.aether/data/feedback.json` → feedback storage
985
-
986
- ---
987
-
988
- ## Feature 9: Visual Colony Observatory
989
-
990
- ### Research Questions
991
-
992
- 1. What framework for real-time dashboard? (React, Vue, vanilla)
993
- 2. How do we efficiently watch state file changes?
994
- 3. What metrics should be displayed?
995
- 4. How do we handle large spawn trees?
996
-
997
- ### Research Tasks
998
-
999
- - Compare dashboard frameworks
1000
- - Research file watching performance
1001
- - Design responsive layout for different terminals
1002
- - Study real-time visualization patterns
1003
- - Design accessibility for dashboard
1004
-
1005
- ### Implementation Plan
1006
-
1007
- **Phase 9A: Dashboard Core (3 days)**
1008
-
1009
- ```javascript
1010
- // bin/v2/observatory/server.js
1011
- const express = require('express');
1012
- const WebSocket = require('ws');
1013
- const chokidar = require('chokidar');
1014
-
1015
- class ObservatoryServer {
1016
- constructor() {
1017
- this.app = express();
1018
- this.wss = new WebSocket.Server({ port: 7331 });
1019
-
1020
- // Watch state files for changes
1021
- this.watcher = chokidar.watch([
1022
- '.aether/data/COLONY_STATE.json',
1023
- '.aether/data/activity.log',
1024
- '.aether/data/spawn-tree.txt'
1025
- ]);
1026
-
1027
- this.watcher.on('change', (path) => this.broadcastUpdate(path));
1028
- }
1029
-
1030
- broadcastUpdate(changedFile) {
1031
- const update = this.parseUpdate(changedFile);
1032
- this.wss.clients.forEach(client => {
1033
- client.send(JSON.stringify(update));
1034
- });
1035
- }
1036
- }
1037
- ```
1038
-
1039
- **Phase 9B: Dashboard UI (4 days)**
1040
-
1041
- ```javascript
1042
- // bin/v2/observatory/ui/src/App.jsx
1043
- function ColonyDashboard() {
1044
- const [state, setState] = useState(null);
1045
-
1046
- useEffect(() => {
1047
- const ws = new WebSocket('ws://localhost:7331');
1048
- ws.onmessage = (event) => {
1049
- setState(JSON.parse(event.data));
1050
- };
1051
- }, []);
1052
-
1053
- return (
1054
- <div className="dashboard">
1055
- <Header
1056
- goal={state?.goal}
1057
- phase={state?.current_phase}
1058
- status={state?.state}
1059
- />
1060
-
1061
- <div className="main">
1062
- <SpawnTree agents={state?.agents} />
1063
- <ActivityLog entries={state?.recent_activity} />
1064
- <CostPanel costs={state?.costs} />
1065
- </div>
1066
-
1067
- <StatusBar
1068
- lastUpdate={state?.last_update}
1069
- cost={state?.session_cost}
1070
- />
1071
- </div>
1072
- );
1073
- }
1074
- ```
1075
-
1076
- **Phase 9C: Terminal Fallback (2 days)**
1077
-
1078
- ```bash
1079
- # For users without browser access
1080
- aether observatory --terminal
1081
-
1082
- # Shows live-updating terminal view
1083
- ┌─────────────────────────────────────────────────────────────┐
1084
- │ COLONY STATUS: Building Phase 3 │
1085
- │ Elapsed: 4m 23s | Cost: $0.34 | Tokens: 23,456 │
1086
- ├─────────────────────────────────────────────────────────────┤
1087
- │ Queen │
1088
- │ │ │
1089
- │ ├── Builder-1 ████████████░ DONE (auth.ts) │
1090
- │ ├── Builder-2 ██████░░░░░░░ WORKING (api.ts) │
1091
- │ └── Scout-1 ████████████ DONE (docs found) │
1092
- └─────────────────────────────────────────────────────────────┘
1093
- ```
1094
-
1095
- ### Integration Points
1096
-
1097
- - `.aether/v2/observatory/` → new dashboard module
1098
- - `bin/cli.js` → add `aether observatory` command
1099
- - `.claude/commands/ant/watch.md` → enhanced with observatory
1100
-
1101
- ---
1102
-
1103
- ## Feature 10: Formal Plan Verification
1104
-
1105
- ### Research Questions
1106
-
1107
- 1. What constraints can we statically verify?
1108
- 2. How do we detect circular dependencies?
1109
- 3. What's the schema for plan validation?
1110
- 4. How do we estimate plan feasibility?
1111
-
1112
- ### Research Tasks
1113
-
1114
- - Study constraint satisfaction for planning
1115
- - Research dependency graph analysis
1116
- - Design plan schema and validation rules
1117
- - Study effort estimation models
1118
- - Design plan repair suggestions
1119
-
1120
- ### Implementation Plan
1121
-
1122
- **Phase 10A: Plan Schema (2 days)**
1123
-
1124
- ```yaml
1125
- # .aether/v2/planning/schema.yaml
1126
- Plan:
1127
- required:
1128
- - phases: Phase[]
1129
- - dependencies: Dependency[]
1130
- - estimates: Estimate[]
1131
-
1132
- Phase:
1133
- required:
1134
- - id: String
1135
- - name: String
1136
- - tasks: Task[]
1137
- optional:
1138
- - depends_on: String[] # Phase IDs
1139
-
1140
- Task:
1141
- required:
1142
- - id: String
1143
- - description: String
1144
- - type: TaskType
1145
- optional:
1146
- - depends_on: String[] # Task IDs
1147
- - estimated_complexity: Number
1148
- - files_to_modify: String[]
1149
-
1150
- TaskType:
1151
- enum: [implement, refactor, test, document, research]
1152
-
1153
- ValidationRules:
1154
- - no_circular_dependencies
1155
- - files_must_exist_when_referenced
1156
- - complexity_sum_must_match_phase
1157
- - all_dependencies_resolvable
1158
- ```
1159
-
1160
- **Phase 10B: Verification Engine (3 days)**
1161
-
1162
- ```javascript
1163
- // bin/v2/planning/verifier.js
1164
- class PlanVerifier {
1165
- verify(plan) {
1166
- const errors = [];
1167
- const warnings = [];
1168
-
1169
- // 1. Check circular dependencies
1170
- const cycles = this.detectCycles(plan);
1171
- if (cycles.length > 0) {
1172
- errors.push({
1173
- code: 'CIRCULAR_DEPENDENCY',
1174
- message: `Circular dependency detected: ${cycles.join(' -> ')}`,
1175
- severity: 'error'
1176
- });
1177
- }
1178
-
1179
- // 2. Check file references
1180
- for (const task of plan.getAllTasks()) {
1181
- for (const file of task.files_to_modify || []) {
1182
- if (!fs.existsSync(file)) {
1183
- warnings.push({
1184
- code: 'FILE_NOT_FOUND',
1185
- message: `Task ${task.id} references file that doesn't exist: ${file}`,
1186
- severity: 'warning',
1187
- suggestion: `Create the file first or verify the path`
1188
- });
1189
- }
1190
- }
1191
- }
1192
-
1193
- // 3. Check effort estimates
1194
- const totalComplexity = plan.phases.reduce((sum, p) =>
1195
- sum + p.tasks.reduce((s, t) => s + (t.estimated_complexity || 0), 0), 0
1196
- );
1197
-
1198
- if (totalComplexity > 50) {
1199
- warnings.push({
1200
- code: 'HIGH_COMPLEXITY',
1201
- message: `Total complexity ${totalComplexity} suggests this may be too large`,
1202
- suggestion: 'Consider breaking into multiple colonies'
1203
- });
1204
- }
1205
-
1206
- return { valid: errors.length === 0, errors, warnings };
1207
- }
1208
-
1209
- detectCycles(plan) {
1210
- // Build dependency graph
1211
- const graph = new Map();
1212
- for (const phase of plan.phases) {
1213
- graph.set(phase.id, phase.depends_on || []);
1214
- for (const task of phase.tasks) {
1215
- graph.set(task.id, task.depends_on || []);
1216
- }
1217
- }
1218
-
1219
- // DFS cycle detection
1220
- return this.findCycles(graph);
1221
- }
1222
- }
1223
- ```
1224
-
1225
- **Phase 10C: Plan Repair (2 days)**
1226
-
1227
- ```javascript
1228
- // bin/v2/planning/repair.js
1229
- class PlanRepair {
1230
- suggestRepairs(verificationResult, plan) {
1231
- const repairs = [];
1232
-
1233
- for (const error of verificationResult.errors) {
1234
- switch (error.code) {
1235
- case 'CIRCULAR_DEPENDENCY':
1236
- repairs.push({
1237
- type: 'reorder',
1238
- description: 'Break cycle by reordering tasks',
1239
- actions: this.suggestReorderings(plan, error.cycle)
1240
- });
1241
- break;
1242
-
1243
- case 'FILE_NOT_FOUND':
1244
- repairs.push({
1245
- type: 'create_or_remove',
1246
- description: 'Create missing file or remove reference',
1247
- actions: [
1248
- { action: 'create', file: error.file },
1249
- { action: 'remove_reference', task: error.task }
1250
- ]
1251
- });
1252
- break;
1253
- }
1254
- }
1255
-
1256
- return repairs;
1257
- }
1258
- }
1259
- ```
1260
-
1261
- ### Integration Points
1262
-
1263
- - `.aether/v2/planning/` → new planning module
1264
- - `.claude/commands/ant/plan.md` → run verifier after planning
1265
- - `.claude/commands/ant/build.md` → verify before building
1266
-
1267
- ---
1268
-
1269
- ## Implementation Priority and Dependencies
1270
-
1271
- ```mermaid
1272
- flowchart TD
1273
- subgraph foundation [Foundation Layer]
1274
- F1[Model Routing]
1275
- F2[Outcome Tracking]
1276
- F7[Cost Tracking]
1277
- end
1278
-
1279
- subgraph learning [Learning Layer]
1280
- L3[Self-Modifying Prompts]
1281
- L6[Cross-Project Knowledge]
1282
- L8[Human Feedback]
1283
- end
1284
-
1285
- subgraph coordination [Coordination Layer]
1286
- C4[Agent Communication]
1287
- C5[Execution Sandbox]
1288
- C10[Plan Verification]
1289
- end
1290
-
1291
- subgraph presentation [Presentation Layer]
1292
- P9[Visual Observatory]
1293
- end
1294
-
1295
- F2 --> L3
1296
- F2 --> L6
1297
- F8 --> L6
1298
- F2 --> F7
1299
- C4 --> C5
1300
- F1 --> C5
1301
- L3 --> P9
1302
- F7 --> P9
1303
- C4 --> P9
1304
- ```
1305
-
1306
-
1307
-
1308
- ### Recommended Implementation Order
1309
-
1310
-
1311
- | Phase | Features | Duration | Why This Order |
1312
- | ----- | -------------------------------------------- | -------- | ------------------------------------ |
1313
- | 1 | F1 (Model Routing), F2 (Outcomes), F7 (Cost) | 3 weeks | Foundation - enables everything else |
1314
- | 2 | L8 (Feedback), L3 (Self-Modifying) | 2 weeks | Learning starts immediately |
1315
- | 3 | C10 (Plan Verification), C4 (Communication) | 2 weeks | Improves coordination |
1316
- | 4 | L6 (Cross-Project Knowledge) | 2 weeks | Requires accumulated data |
1317
- | 5 | C5 (Sandbox), P9 (Observatory) | 3 weeks | Advanced features |
1318
- | 6 | Integration and polish | 2 weeks | Make it cohesive |
1319
-
1320
-
1321
- **Total estimated time: 14 weeks**
1322
-
1323
- ---
1324
-
1325
- ## Research Directory Creation
1326
-
1327
- After plan approval, create the research directory structure:
1328
-
1329
- ```bash
1330
- mkdir -p .aether/research/{2.0-roadmap,F1-model-routing,F2-outcome-learning,F3-self-modifying-prompts,F4-agent-communication,F5-execution-sandbox,F6-cross-project-knowledge,F7-cost-optimization,F8-human-feedback,F9-visual-observatory,F10-plan-verification}
1331
-
1332
- mkdir -p .aether/v2/{core,agents,integrations,sandbox,knowledge,cost,feedback,observatory,planning}
1333
- ```
1334
-
1335
- ---
1336
-
1337
- ## Next Steps After Approval
1338
-
1339
- 1. Create research directory structure
1340
- 2. Create ROADMAP.md with detailed phases
1341
- 3. Begin F1 (Model Routing) research
1342
- 4. Set up tracking in PROGRESS.md
1343
-