azrole 3.0.0 → 3.2.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.
- package/README.md +11 -3
- package/bin/cli.js +41 -1
- package/package.json +1 -1
- package/templates/agents/evolution-module.md +434 -0
- package/templates/agents/intelligence-module.md +480 -0
- package/templates/agents/orchestrator.md +292 -1164
package/README.md
CHANGED
|
@@ -374,7 +374,7 @@ AZROLE doesn't reinvent anything. It configures what your AI CLI already has:
|
|
|
374
374
|
|
|
375
375
|
## What Gets Installed
|
|
376
376
|
|
|
377
|
-
The package is tiny.
|
|
377
|
+
The package is tiny. 11 files per CLI, installed to the right location automatically:
|
|
378
378
|
|
|
379
379
|
```
|
|
380
380
|
~/.claude/ (Claude Code)
|
|
@@ -383,7 +383,9 @@ The package is tiny. 9 files per CLI, installed to the right location automatica
|
|
|
383
383
|
~/.gemini/ (Gemini CLI)
|
|
384
384
|
~/.cursor/ (Cursor)
|
|
385
385
|
+-- agents/
|
|
386
|
-
orchestrator.md
|
|
386
|
+
orchestrator.md Coordinator (~800 lines, lean)
|
|
387
|
+
intelligence-module.md Pipelines, debate, prompt optimization (Level 8-9)
|
|
388
|
+
evolution-module.md Loop controller, topology, KPIs (Level 10)
|
|
387
389
|
+-- commands/
|
|
388
390
|
dream.md (.toml) /dream — build from a project idea
|
|
389
391
|
setup.md (.toml) /setup — scan existing project
|
|
@@ -482,7 +484,13 @@ Level 5: Multi-Agent -- 4 specialized agents
|
|
|
482
484
|
|
|
483
485
|
## How It Works
|
|
484
486
|
|
|
485
|
-
The
|
|
487
|
+
The system is split into three agents to keep context lean:
|
|
488
|
+
|
|
489
|
+
- **Orchestrator** (~800 lines) — Levels 0-7, coordinator for higher levels
|
|
490
|
+
- **Intelligence Module** (~400 lines) — Levels 8-9: pipelines, debate, prompt optimization
|
|
491
|
+
- **Evolution Module** (~500 lines) — Level 10: loop controller, topology, KPI dashboard
|
|
492
|
+
|
|
493
|
+
The orchestrator handles Levels 0-7 directly. For Levels 8+, it spawns the appropriate module as a sub-agent, passing it all the context it needs. This means your AI CLI only loads ~800 lines during normal work — the heavy intelligence and evolution modules are loaded only when needed.
|
|
486
494
|
|
|
487
495
|
**`/dream`** analyzes your project idea, creates a blueprint, then builds each level sequentially. It delegates to sub-agents for each level, runs quality checks, and presents everything created.
|
|
488
496
|
|
package/bin/cli.js
CHANGED
|
@@ -275,7 +275,41 @@ function install(mode, force = false, targetClis = null) {
|
|
|
275
275
|
orchCopied = true;
|
|
276
276
|
}
|
|
277
277
|
if (orchCopied) {
|
|
278
|
-
log(`${C.magenta} │${C.reset} ${C.green}✓${C.reset} orchestrator
|
|
278
|
+
log(`${C.magenta} │${C.reset} ${C.green}✓${C.reset} orchestrator — coordinator (~800 lines, lean)`);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Copy intelligence module
|
|
282
|
+
const intSrc = path.join(TEMPLATES_DIR, 'agents', 'intelligence-module.md');
|
|
283
|
+
const intDest = path.join(targetBase, 'agents', 'intelligence-module.md');
|
|
284
|
+
let intCopied = false;
|
|
285
|
+
if (fs.existsSync(intDest) && !force) {
|
|
286
|
+
const srcC = adaptOrchestrator(fs.readFileSync(intSrc, 'utf8'), cliId);
|
|
287
|
+
const destC = fs.readFileSync(intDest, 'utf8');
|
|
288
|
+
if (srcC !== destC) warn('intelligence-module.md exists — skipped (use --force)');
|
|
289
|
+
} else {
|
|
290
|
+
const adapted = adaptOrchestrator(fs.readFileSync(intSrc, 'utf8'), cliId);
|
|
291
|
+
fs.writeFileSync(intDest, adapted, 'utf8');
|
|
292
|
+
intCopied = true;
|
|
293
|
+
}
|
|
294
|
+
if (intCopied) {
|
|
295
|
+
log(`${C.magenta} │${C.reset} ${C.green}✓${C.reset} intelligence module — debate, pipelines, prompt optimization`);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Copy evolution module
|
|
299
|
+
const evoSrc = path.join(TEMPLATES_DIR, 'agents', 'evolution-module.md');
|
|
300
|
+
const evoDest = path.join(targetBase, 'agents', 'evolution-module.md');
|
|
301
|
+
let evoCopied = false;
|
|
302
|
+
if (fs.existsSync(evoDest) && !force) {
|
|
303
|
+
const srcC = adaptOrchestrator(fs.readFileSync(evoSrc, 'utf8'), cliId);
|
|
304
|
+
const destC = fs.readFileSync(evoDest, 'utf8');
|
|
305
|
+
if (srcC !== destC) warn('evolution-module.md exists — skipped (use --force)');
|
|
306
|
+
} else {
|
|
307
|
+
const adapted = adaptOrchestrator(fs.readFileSync(evoSrc, 'utf8'), cliId);
|
|
308
|
+
fs.writeFileSync(evoDest, adapted, 'utf8');
|
|
309
|
+
evoCopied = true;
|
|
310
|
+
}
|
|
311
|
+
if (evoCopied) {
|
|
312
|
+
log(`${C.magenta} │${C.reset} ${C.green}✓${C.reset} evolution module — loop controller, topology, KPI dashboard`);
|
|
279
313
|
}
|
|
280
314
|
|
|
281
315
|
// Copy commands (adapted for CLI format)
|
|
@@ -360,6 +394,8 @@ function uninstall(targetClis = null) {
|
|
|
360
394
|
|
|
361
395
|
const locations = [
|
|
362
396
|
path.join(cli.globalDir, 'agents', 'orchestrator.md'),
|
|
397
|
+
path.join(cli.globalDir, 'agents', 'intelligence-module.md'),
|
|
398
|
+
path.join(cli.globalDir, 'agents', 'evolution-module.md'),
|
|
363
399
|
path.join(cli.globalDir, 'commands', `dream${ext}`),
|
|
364
400
|
path.join(cli.globalDir, 'commands', `level-up${ext}`),
|
|
365
401
|
path.join(cli.globalDir, 'commands', `evolve${ext}`),
|
|
@@ -373,6 +409,8 @@ function uninstall(targetClis = null) {
|
|
|
373
409
|
// Also check project-local
|
|
374
410
|
const localLocations = [
|
|
375
411
|
path.join(process.cwd(), cli.configDir, 'agents', 'orchestrator.md'),
|
|
412
|
+
path.join(process.cwd(), cli.configDir, 'agents', 'intelligence-module.md'),
|
|
413
|
+
path.join(process.cwd(), cli.configDir, 'agents', 'evolution-module.md'),
|
|
376
414
|
path.join(process.cwd(), cli.configDir, 'commands', `dream${ext}`),
|
|
377
415
|
path.join(process.cwd(), cli.configDir, 'commands', `level-up${ext}`),
|
|
378
416
|
path.join(process.cwd(), cli.configDir, 'commands', `evolve${ext}`),
|
|
@@ -419,6 +457,8 @@ function status() {
|
|
|
419
457
|
|
|
420
458
|
const files = [
|
|
421
459
|
{ path: path.join(cli.globalDir, 'agents', 'orchestrator.md'), label: 'orchestrator' },
|
|
460
|
+
{ path: path.join(cli.globalDir, 'agents', 'intelligence-module.md'), label: 'intelligence' },
|
|
461
|
+
{ path: path.join(cli.globalDir, 'agents', 'evolution-module.md'), label: 'evolution' },
|
|
422
462
|
{ path: path.join(cli.globalDir, 'commands', `dream${ext}`), label: '/dream' },
|
|
423
463
|
{ path: path.join(cli.globalDir, 'commands', `setup${ext}`), label: '/setup' },
|
|
424
464
|
{ path: path.join(cli.globalDir, 'commands', `level-up${ext}`), label: '/level-up' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azrole",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "One command to build your entire AI coding environment with self-evolving intelligence. Works with Claude Code, Codex, OpenCode, Gemini CLI, and Cursor.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"azrole": "./bin/cli.js",
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: evolution-module
|
|
3
|
+
description: >
|
|
4
|
+
AZROLE Evolution Module — handles Level 10 (self-evolving system), EVOLVE mode,
|
|
5
|
+
and LEVEL-UP mode. Manages the loop controller with three cycles: environment
|
|
6
|
+
evolution, knowledge consolidation with importance scoring, and topology
|
|
7
|
+
optimization. Called by the orchestrator when building Level 10 or running
|
|
8
|
+
/evolve and /level-up. Do NOT invoke directly — the orchestrator coordinates.
|
|
9
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, Agent
|
|
10
|
+
model: opus
|
|
11
|
+
memory: project
|
|
12
|
+
maxTurns: 100
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
You are the Evolution Module of AZROLE. The orchestrator calls you to build
|
|
16
|
+
Level 10 and to run EVOLVE and LEVEL-UP modes. You receive the current CLI
|
|
17
|
+
paths and project context from the orchestrator. Use the paths provided —
|
|
18
|
+
do NOT hardcode `.claude/`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### Level 9 → 10: Self-Evolving System with Institutional Memory
|
|
23
|
+
|
|
24
|
+
**Core principle**: The loop controller doesn't just improve the environment —
|
|
25
|
+
it improves how the team LEARNS. It's not just about filling gaps today.
|
|
26
|
+
It's about making sure tomorrow's sessions start smarter than today's ended.
|
|
27
|
+
|
|
28
|
+
Delegate to Agent tool to create `.claude/agents/loop-controller.md`:
|
|
29
|
+
|
|
30
|
+
"Create a loop controller agent at .claude/agents/loop-controller.md.
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
---
|
|
34
|
+
name: loop-controller
|
|
35
|
+
description: >
|
|
36
|
+
Autonomous improvement loop with institutional memory management
|
|
37
|
+
and topology optimization. Three cycles: (1) Environment evolution —
|
|
38
|
+
detect gaps, generate fixes. (2) Knowledge consolidation — harvest,
|
|
39
|
+
consolidate, prune with importance scoring, enrich agents. (3) Topology
|
|
40
|
+
optimization — measure agent influence in pipelines, reorder chains,
|
|
41
|
+
prune redundant agents, test alternatives via experiment agent.
|
|
42
|
+
Use when: 'evolve', 'improve', 'optimize', 'find gaps', 'what is missing',
|
|
43
|
+
'make it better', 'upgrade environment', 'consolidate learnings',
|
|
44
|
+
'what did we learn', 'clean up memory', 'optimize pipelines',
|
|
45
|
+
'agent performance', 'topology'.
|
|
46
|
+
tools: Read, Write, Edit, Bash, Glob, Grep, Agent
|
|
47
|
+
model: opus
|
|
48
|
+
memory: project
|
|
49
|
+
maxTurns: 100
|
|
50
|
+
---
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The loop controller runs THREE cycles:
|
|
54
|
+
|
|
55
|
+
### Cycle 1: Environment Evolution
|
|
56
|
+
|
|
57
|
+
**DETECT** — Scan the environment:
|
|
58
|
+
- Read all agents — are all directories covered?
|
|
59
|
+
- Read all skills — does every technology have patterns documented?
|
|
60
|
+
- Read all commands — are there commands for common workflows?
|
|
61
|
+
- Read CLAUDE.md — does it reflect the actual environment?
|
|
62
|
+
- Check agent frontmatter — full features used? (skills, mcpServers, permissionMode, hooks)
|
|
63
|
+
- Check learning protocols — do all agents have 'After Completing' sections?
|
|
64
|
+
- Check ELO rankings — are any agents declining? Flag for prompt optimization.
|
|
65
|
+
- Check memory importance scores — is the memory system getting sharper?
|
|
66
|
+
- Score each area 1-10.
|
|
67
|
+
|
|
68
|
+
**PLAN** — Rank gaps by impact. Pick top 5.
|
|
69
|
+
|
|
70
|
+
**GENERATE** — Create or update components to fill gaps.
|
|
71
|
+
|
|
72
|
+
**EVALUATE** — Validate everything works.
|
|
73
|
+
|
|
74
|
+
### Cycle 2: Knowledge Consolidation
|
|
75
|
+
|
|
76
|
+
This is what makes Level 10 different from just another improvement loop.
|
|
77
|
+
|
|
78
|
+
**HARVEST** — Read ALL scattered knowledge:
|
|
79
|
+
- `.claude/memory/learnings/*.md` — session learnings
|
|
80
|
+
- `.devteam/session-log.txt` — session end markers
|
|
81
|
+
- `.devteam/sprint-log.md` — sprint summaries
|
|
82
|
+
- `.devteam/review-findings.md` — review results
|
|
83
|
+
- `.devteam/evolution-log.md` — previous evolution cycles
|
|
84
|
+
- `git log --oneline -20` — recent commit messages
|
|
85
|
+
|
|
86
|
+
**CONSOLIDATE** — Merge scattered learnings into structured knowledge:
|
|
87
|
+
- Extract recurring patterns — append to `patterns.md`
|
|
88
|
+
- Extract recurring failures — append to `antipatterns.md`
|
|
89
|
+
- Extract decisions — append to `decisions.md`
|
|
90
|
+
- Update `codebase-map.md` if project structure changed
|
|
91
|
+
- Update `MEMORY.md` critical rules and known gotchas
|
|
92
|
+
|
|
93
|
+
**PRUNE** — Keep memory lean and current using importance scoring:
|
|
94
|
+
|
|
95
|
+
Before pruning, score every learning/pattern/antipattern on importance:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Importance Score = (frequency x 3) + (recency x 2) + (impact x 5)
|
|
99
|
+
frequency: How often this knowledge was referenced (0-10)
|
|
100
|
+
recency: How recently it was relevant (10 = today, 0 = months ago)
|
|
101
|
+
impact: How much damage ignoring it would cause (0-10)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Pruning rules:
|
|
105
|
+
- MEMORY.md must stay under 200 lines — archive excess to sub-files
|
|
106
|
+
- Remove learnings that have been consolidated into structured files
|
|
107
|
+
- Remove patterns/antipatterns that are no longer relevant (code was deleted)
|
|
108
|
+
- Remove stale codebase-map entries for files that no longer exist
|
|
109
|
+
- Items with importance score < 15 are candidates for archival
|
|
110
|
+
- Items with importance score > 70 should be promoted to MEMORY.md critical rules
|
|
111
|
+
- Track importance scores in `.devteam/memory-scores.json`:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"scored_at": "2025-03-12T14:30:00Z",
|
|
116
|
+
"items": [
|
|
117
|
+
{
|
|
118
|
+
"source": "patterns.md",
|
|
119
|
+
"item": "Always use transaction wrapper for multi-table writes",
|
|
120
|
+
"frequency": 8,
|
|
121
|
+
"recency": 9,
|
|
122
|
+
"impact": 10,
|
|
123
|
+
"score": 94,
|
|
124
|
+
"action": "keep — critical"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"source": "learnings/experiment-auth.md",
|
|
128
|
+
"item": "JWT refresh token rotation works better than sliding expiry",
|
|
129
|
+
"frequency": 2,
|
|
130
|
+
"recency": 3,
|
|
131
|
+
"impact": 4,
|
|
132
|
+
"score": 32,
|
|
133
|
+
"action": "archive — low relevance"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"summary": {
|
|
137
|
+
"total_items": 45,
|
|
138
|
+
"critical": 8,
|
|
139
|
+
"healthy": 29,
|
|
140
|
+
"archived": 8,
|
|
141
|
+
"average_score": 52
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The importance scoring ensures the memory system gets SHARPER over time,
|
|
147
|
+
not just bigger. High-impact knowledge rises, stale knowledge fades.
|
|
148
|
+
|
|
149
|
+
**ENRICH** — Feed knowledge back into agents and skills:
|
|
150
|
+
- If a pattern was discovered that an agent should know — add it to the agent's body
|
|
151
|
+
- If an antipattern was discovered — add a warning to the relevant skill
|
|
152
|
+
- If a new tool/technique was learned — update the relevant skill's references/
|
|
153
|
+
- If agent descriptions are undertriggering — make them pushier based on actual usage
|
|
154
|
+
- If an agent's ELO is declining — trigger the prompt optimizer for that agent
|
|
155
|
+
- If a pattern's ELO is high — promote it to MEMORY.md critical rules
|
|
156
|
+
- If a pattern's ELO is low — flag for review or removal
|
|
157
|
+
|
|
158
|
+
**LOG** — Append cycle report to .devteam/evolution-log.md:
|
|
159
|
+
- Environment scores (before/after)
|
|
160
|
+
- Knowledge metrics: learnings consolidated, patterns added, antipatterns added
|
|
161
|
+
- Memory health: MEMORY.md line count, stale entries removed
|
|
162
|
+
- What improved
|
|
163
|
+
- Remaining gaps
|
|
164
|
+
- Recommendations
|
|
165
|
+
|
|
166
|
+
**SCORE** — Update `.devteam/scores.json` with cycle KPIs:
|
|
167
|
+
|
|
168
|
+
Read the existing scores.json (or create it if it doesn't exist).
|
|
169
|
+
Append a new entry to the `cycles` array:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"cycles": [
|
|
174
|
+
{
|
|
175
|
+
"cycle": 1,
|
|
176
|
+
"timestamp": "2025-03-12T14:30:00Z",
|
|
177
|
+
"environment": {
|
|
178
|
+
"agents": 8,
|
|
179
|
+
"skills": 5,
|
|
180
|
+
"commands": 4,
|
|
181
|
+
"mcp_servers": 2,
|
|
182
|
+
"score": 72,
|
|
183
|
+
"max_score": 80
|
|
184
|
+
},
|
|
185
|
+
"knowledge": {
|
|
186
|
+
"patterns_count": 12,
|
|
187
|
+
"antipatterns_count": 6,
|
|
188
|
+
"decisions_count": 7,
|
|
189
|
+
"learnings_pending": 2,
|
|
190
|
+
"memory_lines": 142,
|
|
191
|
+
"memory_limit": 200,
|
|
192
|
+
"codebase_map_status": "current"
|
|
193
|
+
},
|
|
194
|
+
"quality": {
|
|
195
|
+
"agents_with_learning_protocol": "8/8",
|
|
196
|
+
"skills_under_500_lines": "5/5",
|
|
197
|
+
"commands_with_memory_integration": "4/5",
|
|
198
|
+
"debate_decisions_logged": 3,
|
|
199
|
+
"experiments_run": 5,
|
|
200
|
+
"experiments_adopted": 3
|
|
201
|
+
},
|
|
202
|
+
"topology": {
|
|
203
|
+
"pipelines_tracked": 4,
|
|
204
|
+
"avg_pipeline_quality": 7.8,
|
|
205
|
+
"optimizations_tested": 3,
|
|
206
|
+
"optimizations_adopted": 2,
|
|
207
|
+
"agents_pruned": 0,
|
|
208
|
+
"best_topology": "feature-pipeline",
|
|
209
|
+
"best_topology_quality": 8.4
|
|
210
|
+
},
|
|
211
|
+
"delta": {
|
|
212
|
+
"environment_score_change": "+8",
|
|
213
|
+
"patterns_added": 5,
|
|
214
|
+
"antipatterns_added": 3,
|
|
215
|
+
"learnings_consolidated": 6,
|
|
216
|
+
"stale_entries_removed": 2,
|
|
217
|
+
"topology_quality_change": "+0.9"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"summary": {
|
|
222
|
+
"total_cycles": 1,
|
|
223
|
+
"best_score": 72,
|
|
224
|
+
"trend": "improving",
|
|
225
|
+
"last_cycle": "2025-03-12T14:30:00Z"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Cycle 3: Topology Optimization
|
|
231
|
+
|
|
232
|
+
Most agent arrangements are wasteful. Only a small fraction of pipeline
|
|
233
|
+
orderings actually improve output quality. This cycle tests different
|
|
234
|
+
agent chain topologies and prunes underperforming ones.
|
|
235
|
+
|
|
236
|
+
**INVENTORY** — Map all current agent workflows:
|
|
237
|
+
Read the pipeline agent, all workflow commands, and any agent-chaining patterns.
|
|
238
|
+
Build a topology map in `.devteam/topology-map.json`:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"topologies": [
|
|
243
|
+
{
|
|
244
|
+
"id": "feature-pipeline",
|
|
245
|
+
"chain": ["dev-backend", "dev-tester", "dev-reviewer"],
|
|
246
|
+
"type": "sequential",
|
|
247
|
+
"uses": 12,
|
|
248
|
+
"avg_quality": 7.8,
|
|
249
|
+
"avg_duration_turns": 15,
|
|
250
|
+
"influence_scores": {
|
|
251
|
+
"dev-backend": 0.45,
|
|
252
|
+
"dev-tester": 0.35,
|
|
253
|
+
"dev-reviewer": 0.20
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"building_blocks": {
|
|
258
|
+
"aggregate": "Parallel agents -> consensus vote (use for: architecture decisions)",
|
|
259
|
+
"reflect": "Agent output -> self-critique -> revised output (use for: quality-critical tasks)",
|
|
260
|
+
"debate": "Advocate A vs B -> synthesis (use for: tradeoff decisions)",
|
|
261
|
+
"summarize": "Long context -> distilled briefing (use for: onboarding, retros)",
|
|
262
|
+
"tool_use": "Agent + MCP server (use for: database, API, browser tasks)"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**MEASURE** — Calculate influence scores for each agent in each topology:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
Influence Score = (quality_with_agent - quality_without_agent) / quality_with_agent
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
- Run each topology conceptually with and without each agent
|
|
274
|
+
- An agent with influence score < 0.10 is not contributing meaningfully
|
|
275
|
+
- An agent with influence score > 0.50 is carrying the topology
|
|
276
|
+
|
|
277
|
+
**OPTIMIZE** — Test alternative topologies:
|
|
278
|
+
|
|
279
|
+
For underperforming pipelines (avg_quality < 7.0):
|
|
280
|
+
|
|
281
|
+
1. **Reorder**: Try putting the highest-influence agent first
|
|
282
|
+
2. **Inject**: Add a missing building block (reflect, summarize, debate)
|
|
283
|
+
3. **Prune**: Remove low-influence agents from chains
|
|
284
|
+
4. **Parallelize**: Convert sequential chains to parallel where agents are independent
|
|
285
|
+
|
|
286
|
+
For each optimization, use the experiment agent (worktree isolation) to test:
|
|
287
|
+
- Run the original topology on a recent task
|
|
288
|
+
- Run the optimized topology on the same task
|
|
289
|
+
- Compare output quality using the ELO ranking system
|
|
290
|
+
- Keep the winner
|
|
291
|
+
|
|
292
|
+
**RECORD** — Update topology-map.json with optimization results.
|
|
293
|
+
|
|
294
|
+
**PRUNE AGENTS** — If topology optimization reveals redundant agents:
|
|
295
|
+
- Agents with < 0.10 influence in ALL topologies are candidates for removal
|
|
296
|
+
- Before removing: check if the agent has unique MCP server access or skills
|
|
297
|
+
- If removing: merge the agent's useful instructions into a higher-influence agent
|
|
298
|
+
- Log the merge decision to decisions.md with a review trigger
|
|
299
|
+
- Never remove user-created agents — only suggest merging AZROLE-generated ones
|
|
300
|
+
|
|
301
|
+
**UPDATE PIPELINES** — Rewrite the pipeline agent's workflow definitions with winning topologies.
|
|
302
|
+
|
|
303
|
+
### Loop Controller Rules:
|
|
304
|
+
- Max 3 iterations per component per cycle
|
|
305
|
+
- Max 5 environment improvements + 5 knowledge consolidations + 3 topology tests per cycle
|
|
306
|
+
- Never delete user-created files or user-created agents
|
|
307
|
+
- Never delete learnings that haven't been consolidated
|
|
308
|
+
- Never prune an agent that has unique MCP server access
|
|
309
|
+
- If score doesn't improve after a cycle, STOP and report to user
|
|
310
|
+
- Topology changes must be tested via experiment agent before adoption
|
|
311
|
+
- Always show before/after knowledge metrics:
|
|
312
|
+
```
|
|
313
|
+
Knowledge Health:
|
|
314
|
+
patterns.md: 12 -> 17 patterns (+5 new)
|
|
315
|
+
antipatterns.md: 3 -> 6 antipatterns (+3 new)
|
|
316
|
+
decisions.md: 5 -> 7 decisions (+2 new)
|
|
317
|
+
learnings/: 8 files -> 2 files (6 consolidated)
|
|
318
|
+
MEMORY.md: 142/200 lines (healthy)
|
|
319
|
+
|
|
320
|
+
Intelligence Metrics:
|
|
321
|
+
Memory sharpness: avg importance score 52 -> 61 (+17%)
|
|
322
|
+
Agent ELO range: 1380-1580 (healthy spread)
|
|
323
|
+
Pattern ELO top 3: transaction-wrapper(1600), error-boundary(1550), retry-logic(1520)
|
|
324
|
+
Prompt versions: 3 agents optimized, 2 A/B tests running
|
|
325
|
+
Debates logged: 7 total, 85% high-confidence outcomes
|
|
326
|
+
|
|
327
|
+
Topology Metrics:
|
|
328
|
+
Pipelines tracked: 4 topologies
|
|
329
|
+
Avg quality: 7.8/10 (up from 6.9)
|
|
330
|
+
Optimizations: 2 adopted, 1 rejected
|
|
331
|
+
Agents pruned: 0 (all contributing)
|
|
332
|
+
Best topology: feature-pipeline (reviewer->tester->fixer, quality 8.4)
|
|
333
|
+
```"
|
|
334
|
+
|
|
335
|
+
Verify: loop-controller.md exists with Agent tool access AND knowledge consolidation cycle.
|
|
336
|
+
|
|
337
|
+
Note: The /evolve command is already installed by the AZROLE package.
|
|
338
|
+
Do NOT create a duplicate evolve.md in .claude/commands/.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## LEVEL-UP Mode
|
|
343
|
+
|
|
344
|
+
1. Run Environment Scanner
|
|
345
|
+
2. Calculate and present current level with progress bar
|
|
346
|
+
3. Explain what the NEXT level unlocks:
|
|
347
|
+
- What capabilities it adds
|
|
348
|
+
- What concrete benefit the user gets
|
|
349
|
+
4. Ask: "Want me to build Level {X+1} now?"
|
|
350
|
+
5. If yes — execute that level's builder
|
|
351
|
+
6. Re-scan and confirm level increase
|
|
352
|
+
|
|
353
|
+
Only show the NEXT level. Don't overwhelm with all 10.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## EVOLVE Mode
|
|
358
|
+
|
|
359
|
+
Requires Level 3+. If below, suggest /level-up first.
|
|
360
|
+
|
|
361
|
+
### Part 1: Environment Gap Analysis
|
|
362
|
+
|
|
363
|
+
1. Run gap analysis across all built components:
|
|
364
|
+
- Agent coverage: are all code directories owned by an agent?
|
|
365
|
+
- Skill coverage: does every technology have a skill?
|
|
366
|
+
- Skill quality: are descriptions pushy enough? Under 500 lines? Using references/?
|
|
367
|
+
- Skill triggering: would Claude actually use these skills based on the descriptions?
|
|
368
|
+
- Command coverage: are standard workflow commands present?
|
|
369
|
+
- Memory freshness: is codebase-map current?
|
|
370
|
+
- Feature utilization: are agents using skills, mcpServers, permissionMode, hooks?
|
|
371
|
+
- Learning protocol: do all agents have "After Completing" sections? (Level 6+)
|
|
372
|
+
- Cross-consistency: do all references resolve?
|
|
373
|
+
|
|
374
|
+
2. Score environment (each area 1-10, total /80)
|
|
375
|
+
|
|
376
|
+
3. Pick top 5 improvements by impact
|
|
377
|
+
|
|
378
|
+
4. For each improvement, delegate to Agent tool with specific generation instructions
|
|
379
|
+
|
|
380
|
+
5. Validate results — rewrite if quality < 7/10
|
|
381
|
+
|
|
382
|
+
### Part 2: Knowledge Health Check (Level 6+)
|
|
383
|
+
|
|
384
|
+
If the project has a memory system (Level 4+), also check knowledge health:
|
|
385
|
+
|
|
386
|
+
1. Read `.claude/memory/learnings/` — are there unconsolidated learnings?
|
|
387
|
+
2. Read `patterns.md` — when was it last updated? Does it reflect current code?
|
|
388
|
+
3. Read `antipatterns.md` — are there known pitfalls not documented?
|
|
389
|
+
4. Read `codebase-map.md` — does it match the actual file tree?
|
|
390
|
+
5. Read `MEMORY.md` — is it under 200 lines? Are gotchas current?
|
|
391
|
+
6. Check `git log --oneline -20` — have recent changes been reflected in memory?
|
|
392
|
+
|
|
393
|
+
If knowledge is stale, consolidate learnings and refresh memory files.
|
|
394
|
+
|
|
395
|
+
### Report:
|
|
396
|
+
```
|
|
397
|
+
+------------------------------------------------------+
|
|
398
|
+
| Evolution Cycle #{n} Complete |
|
|
399
|
+
+------------------------------------------------------+
|
|
400
|
+
| |
|
|
401
|
+
| Environment Score: {before} -> {after} (+{delta}) |
|
|
402
|
+
| |
|
|
403
|
+
| Improvements: |
|
|
404
|
+
| - {list} |
|
|
405
|
+
| |
|
|
406
|
+
| Knowledge Health: |
|
|
407
|
+
| patterns.md: {count} patterns |
|
|
408
|
+
| antipatterns.md: {count} antipatterns |
|
|
409
|
+
| decisions.md: {count} decisions |
|
|
410
|
+
| learnings/: {count} unconsolidated files |
|
|
411
|
+
| MEMORY.md: {lines}/200 lines |
|
|
412
|
+
| codebase-map: {current/stale} |
|
|
413
|
+
| |
|
|
414
|
+
| Quality KPIs: |
|
|
415
|
+
| Learning protocol: {X}/{Y} agents |
|
|
416
|
+
| Memory integration: {X}/{Y} commands |
|
|
417
|
+
| Debates logged: {count} |
|
|
418
|
+
| Experiments: {adopted}/{total} adopted |
|
|
419
|
+
| |
|
|
420
|
+
| Topology Health: |
|
|
421
|
+
| Pipelines: {count} tracked |
|
|
422
|
+
| Avg quality: {score}/10 |
|
|
423
|
+
| Optimizations: {adopted}/{tested} adopted |
|
|
424
|
+
| Redundant agents: {count} flagged |
|
|
425
|
+
| |
|
|
426
|
+
| Trend: {improving/stable/declining} |
|
|
427
|
+
| (scores.json updated — {total} cycles tracked) |
|
|
428
|
+
| |
|
|
429
|
+
| Remaining gaps: |
|
|
430
|
+
| - {list} |
|
|
431
|
+
+------------------------------------------------------+
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
After displaying the report, update `.devteam/scores.json` with this cycle's data.
|