izanagi-ai 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +53 -0
- package/CHANGELOG.md +198 -0
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/ROADMAP.md +131 -0
- package/RULES.md +202 -0
- package/SYSTEM.md +201 -0
- package/agents/INDEX.md +40 -0
- package/agents/architect-agent.json +15 -0
- package/agents/bug-hunter-agent.json +14 -0
- package/agents/database-agent.json +14 -0
- package/agents/devops-agent.json +15 -0
- package/agents/docs-agent.json +15 -0
- package/agents/pm-agent.json +14 -0
- package/agents/professor-agent.json +15 -0
- package/agents/security-agent.json +14 -0
- package/agents/senior-engineer-agent.json +16 -0
- package/agents/techlead-agent.json +15 -0
- package/architecture/clean-architecture.md +98 -0
- package/architecture/cqrs-specialist.md +102 -0
- package/architecture/ddd-specialist.md +97 -0
- package/architecture/event-driven-architect.md +79 -0
- package/architecture/hexagonal-architecture.md +96 -0
- package/architecture/microservices-expert.md +83 -0
- package/architecture/monolith-expert.md +67 -0
- package/architecture/repository-pattern.md +73 -0
- package/architecture/unit-of-work.md +92 -0
- package/backend/README.md +29 -0
- package/bin/nexus.js +8 -0
- package/core/compression-engine.md +194 -0
- package/core/context-engine.md +239 -0
- package/core/decision-engine.md +377 -0
- package/core/evolution-engine.md +169 -0
- package/core/planning-engine.md +201 -0
- package/core/quality-gates.md +233 -0
- package/core/reflection-engine.md +182 -0
- package/core/skill-resolver.json +169 -0
- package/core/token-manager.md +152 -0
- package/database/database-engineer.md +244 -0
- package/database/mysql-specialist.md +61 -0
- package/database/postgresql-specialist.md +70 -0
- package/database/redis-specialist.md +73 -0
- package/database/sql-optimizer.md +95 -0
- package/database/sqlserver-specialist.md +69 -0
- package/devops/ci-cd-specialist.md +101 -0
- package/devops/devops-engineer.md +358 -0
- package/devops/docker-expert.md +105 -0
- package/devops/git-expert.md +76 -0
- package/devops/git-flow-specialist.md +71 -0
- package/devops/kubernetes-specialist.md +84 -0
- package/devops/linux-specialist.md +82 -0
- package/devops/windows-specialist.md +43 -0
- package/dist/cli/commands/compile.d.ts +2 -0
- package/dist/cli/commands/compile.d.ts.map +1 -0
- package/dist/cli/commands/compile.js +44 -0
- package/dist/cli/commands/compile.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +88 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +26 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +50 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/run.d.ts +2 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +49 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/installer.d.ts +5 -0
- package/dist/installer.d.ts.map +1 -0
- package/dist/installer.js +86 -0
- package/dist/installer.js.map +1 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +8 -0
- package/dist/postinstall.js.map +1 -0
- package/frontend/README.md +19 -0
- package/memory/context-recovery.md +49 -0
- package/memory/conversation-summarizer.md +65 -0
- package/memory/long-term-project-memory.md +58 -0
- package/memory/memory-manager.md +299 -0
- package/memory/session-compression.md +182 -0
- package/memory/smart-recall.md +37 -0
- package/optimization/compact-example.md +87 -0
- package/optimization/cost-optimizer.md +53 -0
- package/optimization/prompt-optimizer.md +194 -0
- package/optimization/token-audit.md +177 -0
- package/optimization/token-reducer.md +202 -0
- package/package.json +67 -0
- package/security/owasp-auditor.md +249 -0
- package/security/pentest-reviewer.md +109 -0
- package/security/security-engineer.md +238 -0
- package/skills/INDEX.md +434 -0
- package/skills/accessibility-reviewer.md +63 -0
- package/skills/agentic-coding.md +56 -0
- package/skills/ai-agent/SKILL.md +107 -0
- package/skills/ai-agent-dev/SKILL.md +117 -0
- package/skills/alternative-solution-generator.md +72 -0
- package/skills/architecture-patterns/SKILL.md +113 -0
- package/skills/breaking-change-detector.md +84 -0
- package/skills/bug-hunter.md +234 -0
- package/skills/bug-prevention.md +75 -0
- package/skills/chaos-engineering/SKILL.md +108 -0
- package/skills/clean-code-validator.md +218 -0
- package/skills/cloud-architect/SKILL.md +78 -0
- package/skills/cloud-infra/SKILL.md +99 -0
- package/skills/code-auditor.md +24 -0
- package/skills/complexity-analyzer.md +102 -0
- package/skills/confidence-estimator.md +53 -0
- package/skills/continuous-improvement.md +46 -0
- package/skills/continuous-learning-engine.md +51 -0
- package/skills/cto-advisor.md +66 -0
- package/skills/data-engineer/SKILL.md +76 -0
- package/skills/data-engineering/SKILL.md +82 -0
- package/skills/debug-specialist.md +215 -0
- package/skills/dependency-analyzer.md +78 -0
- package/skills/design-pattern-advisor.md +78 -0
- package/skills/documentation-writer.md +66 -0
- package/skills/dry-kiss-yagni-validator.md +114 -0
- package/skills/economia-tokens/SKILL.md +40 -0
- package/skills/er-diagram-builder.md +85 -0
- package/skills/feature-flags/SKILL.md +95 -0
- package/skills/frontend/SKILL.md +327 -0
- package/skills/frontend-dev/SKILL.md +178 -0
- package/skills/graphql/SKILL.md +104 -0
- package/skills/hallucination-detection.md +49 -0
- package/skills/handoff-sessao/SKILL.md +32 -0
- package/skills/i18n-l10n/SKILL.md +103 -0
- package/skills/iac-terraform/SKILL.md +98 -0
- package/skills/legacy-migration/SKILL.md +91 -0
- package/skills/logging-expert.md +78 -0
- package/skills/mcp-server-dev.md +33 -0
- package/skills/memoria-projeto/SKILL.md +49 -0
- package/skills/mobile-dev/SKILL.md +82 -0
- package/skills/mobile-engineer/SKILL.md +74 -0
- package/skills/monitoring-specialist.md +59 -0
- package/skills/observability-expert.md +60 -0
- package/skills/performance-optimizer.md +239 -0
- package/skills/principal-engineer.md +55 -0
- package/skills/privacy-engineer/SKILL.md +79 -0
- package/skills/professor-modo/SKILL.md +33 -0
- package/skills/project-manager.md +74 -0
- package/skills/prompt-engineering.md +27 -0
- package/skills/qa/SKILL.md +231 -0
- package/skills/qa-engineer/SKILL.md +222 -0
- package/skills/readme-generator.md +42 -0
- package/skills/refactoring-specialist.md +250 -0
- package/skills/release-planner.md +70 -0
- package/skills/requirement-analyzer.md +65 -0
- package/skills/risk-analyzer.md +73 -0
- package/skills/root-cause-analyzer.md +210 -0
- package/skills/scalability-expert.md +73 -0
- package/skills/security-privacy/SKILL.md +98 -0
- package/skills/self-correction.md +54 -0
- package/skills/self-critique.md +42 -0
- package/skills/senior-code-reviewer.md +193 -0
- package/skills/sequence-diagram-builder.md +56 -0
- package/skills/serverless-edge/SKILL.md +103 -0
- package/skills/software-architect.md +356 -0
- package/skills/solid-validator.md +332 -0
- package/skills/sre-reliability/SKILL.md +115 -0
- package/skills/staff-engineer.md +61 -0
- package/skills/task-planner.md +61 -0
- package/skills/tech-lead.md +59 -0
- package/skills/technical-debt-analyzer.md +81 -0
- package/skills/technical-writer.md +39 -0
- package/skills/tradeoff-analyzer.md +79 -0
- package/skills/uml-generator.md +72 -0
- package/skills/ux-reviewer.md +61 -0
- package/skills/wasm/SKILL.md +133 -0
- package/skills/web-perf-engineer/SKILL.md +75 -0
- package/skills/web-perf-seo/SKILL.md +111 -0
- package/skills/websocket-realtime/SKILL.md +107 -0
- package/teaching/adaptive-teaching.md +37 -0
- package/teaching/code-explainer.md +172 -0
- package/teaching/interactive-teaching.md +41 -0
- package/teaching/learning-tracker.md +63 -0
- package/teaching/mentor-mode.md +200 -0
- package/teaching/professor-mode.md +222 -0
- package/testing/e2e-test-engineer.md +68 -0
- package/testing/integration-test-engineer.md +74 -0
- package/testing/mocking-specialist.md +78 -0
- package/testing/unit-test-engineer.md +209 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Core: Decision Engine
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: Critical
|
|
5
|
+
> Dependencies: Context Engine, Skill Registry
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The Decision Engine is the entry point of every interaction. It classifies the incoming task, determines urgency and complexity, selects the appropriate skill chain (DAG), and validates that all dependencies are satisfied before execution.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Classify any input into a task type with confidence ≥ 90%.
|
|
19
|
+
- Route to the correct skill chain with zero ambiguity.
|
|
20
|
+
- Detect missing dependencies before execution.
|
|
21
|
+
- Respect token budget at routing time.
|
|
22
|
+
- Log every decision for reflection and evolution.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Classification Schema
|
|
27
|
+
|
|
28
|
+
Every task is classified into exactly one category:
|
|
29
|
+
|
|
30
|
+
| Category | Examples |
|
|
31
|
+
|----------|----------|
|
|
32
|
+
| `new_project` | "Create a blog", "Start a SaaS app" |
|
|
33
|
+
| `new_feature` | "Add payment gateway", "Add search" |
|
|
34
|
+
| `bug` | "Login is broken", "500 error on checkout" |
|
|
35
|
+
| `refactor` | "Clean up this controller", "Extract service" |
|
|
36
|
+
| `review` | "Review my PR", "Is this code good?" |
|
|
37
|
+
| `question` | "How do I use Enum in PHP?", "What is CQRS?" |
|
|
38
|
+
| `explain` | "Explain this code", "Why is this slow?" |
|
|
39
|
+
| `security_audit` | "Audit my API", "Check for vulnerabilities" |
|
|
40
|
+
| `optimize` | "This query is slow", "Reduce memory usage" |
|
|
41
|
+
| `debug` | "Stack trace here", "Why is this null?" |
|
|
42
|
+
| `test` | "Write tests for this", "Coverage report" |
|
|
43
|
+
| `devops` | "Deploy to production", "Set up CI/CD" |
|
|
44
|
+
| `teach` | "Teach me Laravel", "What is dependency injection?" |
|
|
45
|
+
| `plan` | "Plan the next sprint", "Break down this feature" |
|
|
46
|
+
| `document` | "Document this API", "Generate README" |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Skill Chain Matrix
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
new_project:
|
|
54
|
+
chain:
|
|
55
|
+
- core/planning-engine
|
|
56
|
+
- skills/software-architect
|
|
57
|
+
- skills/requirement-analyzer
|
|
58
|
+
- skills/risk-analyzer
|
|
59
|
+
- skills/software-architect
|
|
60
|
+
budget: 3000
|
|
61
|
+
quality_gates: [security, style, completeness]
|
|
62
|
+
|
|
63
|
+
new_feature:
|
|
64
|
+
chain:
|
|
65
|
+
- skills/software-architect
|
|
66
|
+
- skills/requirement-analyzer
|
|
67
|
+
- coding/backend-engineer
|
|
68
|
+
- testing/unit-test-engineer
|
|
69
|
+
budget: 2500
|
|
70
|
+
quality_gates: [security, style, completeness]
|
|
71
|
+
|
|
72
|
+
bug:
|
|
73
|
+
chain:
|
|
74
|
+
- skills/debug-specialist
|
|
75
|
+
- skills/root-cause-analyzer
|
|
76
|
+
- skills/bug-hunter
|
|
77
|
+
- testing/integration-test-engineer
|
|
78
|
+
- teaching/professor-mode
|
|
79
|
+
budget: 2000
|
|
80
|
+
quality_gates: [security, completeness]
|
|
81
|
+
|
|
82
|
+
refactor:
|
|
83
|
+
chain:
|
|
84
|
+
- skills/software-architect
|
|
85
|
+
- skills/complexity-analyzer
|
|
86
|
+
- skills/refactoring-specialist
|
|
87
|
+
- testing/unit-test-engineer
|
|
88
|
+
- skills/solid-validator
|
|
89
|
+
budget: 2000
|
|
90
|
+
quality_gates: [style, completeness]
|
|
91
|
+
|
|
92
|
+
review:
|
|
93
|
+
chain:
|
|
94
|
+
- skills/senior-code-reviewer
|
|
95
|
+
- security/security-engineer
|
|
96
|
+
- skills/performance-optimizer
|
|
97
|
+
- skills/clean-code-validator
|
|
98
|
+
- skills/solid-validator
|
|
99
|
+
budget: 1500
|
|
100
|
+
quality_gates: [security, style, clarity]
|
|
101
|
+
|
|
102
|
+
question:
|
|
103
|
+
chain:
|
|
104
|
+
- teaching/professor-mode
|
|
105
|
+
- teaching/code-explainer
|
|
106
|
+
- teaching/interactive-teaching
|
|
107
|
+
budget: 1000
|
|
108
|
+
quality_gates: [clarity, completeness]
|
|
109
|
+
|
|
110
|
+
teach:
|
|
111
|
+
chain:
|
|
112
|
+
- teaching/professor-mode
|
|
113
|
+
- teaching/mentor-mode
|
|
114
|
+
- teaching/adaptive-teaching
|
|
115
|
+
- teaching/learning-tracker
|
|
116
|
+
budget: 1500
|
|
117
|
+
quality_gates: [clarity, completeness]
|
|
118
|
+
|
|
119
|
+
security_audit:
|
|
120
|
+
chain:
|
|
121
|
+
- security/security-engineer
|
|
122
|
+
- security/owasp-auditor
|
|
123
|
+
- security/pentest-reviewer
|
|
124
|
+
- skills/bug-prevention
|
|
125
|
+
- skills/documentation-writer
|
|
126
|
+
budget: 3000
|
|
127
|
+
quality_gates: [security, completeness]
|
|
128
|
+
|
|
129
|
+
optimize:
|
|
130
|
+
chain:
|
|
131
|
+
- skills/performance-optimizer
|
|
132
|
+
- skills/complexity-analyzer
|
|
133
|
+
- skills/dependency-analyzer
|
|
134
|
+
- database/sql-optimizer
|
|
135
|
+
budget: 2000
|
|
136
|
+
quality_gates: [style, completeness]
|
|
137
|
+
|
|
138
|
+
devops:
|
|
139
|
+
chain:
|
|
140
|
+
- devops/devops-engineer
|
|
141
|
+
- devops/docker-expert
|
|
142
|
+
- devops/ci-cd-specialist
|
|
143
|
+
- security/security-engineer
|
|
144
|
+
budget: 2500
|
|
145
|
+
|
|
146
|
+
debug:
|
|
147
|
+
chain:
|
|
148
|
+
- skills/debug-specialist
|
|
149
|
+
- skills/root-cause-analyzer
|
|
150
|
+
- skills/logging-expert
|
|
151
|
+
budget: 2000
|
|
152
|
+
quality_gates: [completeness]
|
|
153
|
+
|
|
154
|
+
test:
|
|
155
|
+
chain:
|
|
156
|
+
- testing/unit-test-engineer
|
|
157
|
+
- testing/integration-test-engineer
|
|
158
|
+
- testing/e2e-test-engineer
|
|
159
|
+
budget: 2000
|
|
160
|
+
quality_gates: [completeness]
|
|
161
|
+
|
|
162
|
+
explain:
|
|
163
|
+
chain:
|
|
164
|
+
- teaching/code-explainer
|
|
165
|
+
- teaching/professor-mode
|
|
166
|
+
- skills/documentation-writer
|
|
167
|
+
budget: 1200
|
|
168
|
+
quality_gates: [clarity, completeness]
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
quality_gates: [security, completeness]
|
|
172
|
+
|
|
173
|
+
plan:
|
|
174
|
+
chain:
|
|
175
|
+
- core/planning-engine
|
|
176
|
+
- skills/requirement-analyzer
|
|
177
|
+
- skills/risk-analyzer
|
|
178
|
+
- skills/task-planner
|
|
179
|
+
budget: 2000
|
|
180
|
+
quality_gates: [completeness]
|
|
181
|
+
|
|
182
|
+
document:
|
|
183
|
+
chain:
|
|
184
|
+
- skills/documentation-writer
|
|
185
|
+
- skills/technical-writer
|
|
186
|
+
- skills/readme-generator
|
|
187
|
+
budget: 1500
|
|
188
|
+
quality_gates: [clarity, completeness]
|
|
189
|
+
|
|
190
|
+
unknown:
|
|
191
|
+
chain:
|
|
192
|
+
- skills/requirement-analyzer
|
|
193
|
+
- core/planning-engine
|
|
194
|
+
- skills/software-architect
|
|
195
|
+
- teaching/professor-mode
|
|
196
|
+
budget: 2000
|
|
197
|
+
quality_gates: [clarity, completeness]
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Decision Algorithm
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
function classify(input):
|
|
206
|
+
input = normalize(input.lower())
|
|
207
|
+
|
|
208
|
+
if keywords("create|new|start|build|init") AND keywords("project|app|system"):
|
|
209
|
+
return "new_project"
|
|
210
|
+
|
|
211
|
+
if keywords("bug|error|broken|fail|crash|exception|wrong|issue"):
|
|
212
|
+
return "bug"
|
|
213
|
+
|
|
214
|
+
if keywords("refactor|clean|extract|improve|restructure|rewrite"):
|
|
215
|
+
return "refactor"
|
|
216
|
+
|
|
217
|
+
if keywords("review|check|approve|validate|audit|pr|merge"):
|
|
218
|
+
if keywords("security|vulnerability|owasp"):
|
|
219
|
+
return "security_audit"
|
|
220
|
+
return "review"
|
|
221
|
+
|
|
222
|
+
if keywords("how|what|why|when|where|explain|mean|difference"):
|
|
223
|
+
return "question"
|
|
224
|
+
|
|
225
|
+
if keywords("teach|learn|train|understand|concept|mentor"):
|
|
226
|
+
return "teach"
|
|
227
|
+
|
|
228
|
+
if keywords("deploy|ci|cd|pipeline|infra|server|container|docker|kubernetes"):
|
|
229
|
+
return "devops"
|
|
230
|
+
|
|
231
|
+
if keywords("slow|fast|performance|optimize|benchmark|bottleneck|memory|cpu"):
|
|
232
|
+
return "optimize"
|
|
233
|
+
|
|
234
|
+
if keywords("test|coverage|spec|assert|mock|phpunit|pest|jest|pytest"):
|
|
235
|
+
return "test"
|
|
236
|
+
|
|
237
|
+
if keywords("plan|sprint|task|story|backlog|milestone|roadmap"):
|
|
238
|
+
return "plan"
|
|
239
|
+
|
|
240
|
+
if keywords("document|readme|docs|wiki|manual|guide"):
|
|
241
|
+
return "document"
|
|
242
|
+
|
|
243
|
+
if keywords("add|implement|feature|module|functionality|custom"):
|
|
244
|
+
return "new_feature"
|
|
245
|
+
|
|
246
|
+
if keywords("debug|stack|trace|null|undefined|ddd|var_dump|dd"):
|
|
247
|
+
return "debug"
|
|
248
|
+
|
|
249
|
+
return "unknown"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Routing Protocol
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
1. Receive input
|
|
258
|
+
2. Normalize and tokenize
|
|
259
|
+
3. Run classification algorithm
|
|
260
|
+
4. If confidence < 70%:
|
|
261
|
+
4a. Flag as "uncertain"
|
|
262
|
+
4b. Append Context Engine clarification
|
|
263
|
+
4c. Ask user for clarification
|
|
264
|
+
4d. Re-classify with new input
|
|
265
|
+
5. Look up skill chain from matrix
|
|
266
|
+
6. Validate all chain dependencies are available
|
|
267
|
+
7. Check token budget (sum of all skills ≤ max)
|
|
268
|
+
8. If budget exceeded:
|
|
269
|
+
8a. Activate Token Manager
|
|
270
|
+
8b. Compress lower-priority skills in chain
|
|
271
|
+
9. Execute chain in order
|
|
272
|
+
10. Pass output to Quality Gates
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Rules
|
|
278
|
+
|
|
279
|
+
### Always
|
|
280
|
+
|
|
281
|
+
- ✅ Classify before acting.
|
|
282
|
+
- ✅ Validate dependencies before execution.
|
|
283
|
+
- ✅ Log every decision (input, classification, chain, confidence).
|
|
284
|
+
- ✅ If uncertain, ask for clarification.
|
|
285
|
+
- ✅ Respect token budget.
|
|
286
|
+
|
|
287
|
+
### Never
|
|
288
|
+
|
|
289
|
+
- ❌ Execute without classification.
|
|
290
|
+
- ❌ Skip dependency validation.
|
|
291
|
+
- ❌ Execute a chain that exceeds the token budget.
|
|
292
|
+
- ❌ Assume classification with confidence < 70%.
|
|
293
|
+
- ❌ Modify the chain matrix without reflection.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Metrics
|
|
298
|
+
|
|
299
|
+
| Metric | Target | How to Measure |
|
|
300
|
+
|--------|--------|---------------|
|
|
301
|
+
| Classification accuracy | ≥ 90% | Compare classification vs user feedback |
|
|
302
|
+
| Chain execution success | 100% | Count failed executions |
|
|
303
|
+
| Clarification rate | ≤ 10% | Percent of inputs needing clarification |
|
|
304
|
+
| Budget compliance | 100% | Check no chain exceeds budget |
|
|
305
|
+
| Routing latency | < 100ms | Time from input to chain start |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Quality Gates (Pre-Routing)
|
|
310
|
+
|
|
311
|
+
1. ✅ Input is not empty
|
|
312
|
+
2. ✅ Input language is supported
|
|
313
|
+
3. ✅ Classification returns a valid category
|
|
314
|
+
4. ✅ Chain exists for category
|
|
315
|
+
5. ✅ All dependencies in chain exist
|
|
316
|
+
6. ✅ Token budget sufficient
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Memory Hooks
|
|
321
|
+
|
|
322
|
+
```yaml
|
|
323
|
+
on_classify:
|
|
324
|
+
- load: user_task_history (last 5)
|
|
325
|
+
- load: project_context
|
|
326
|
+
|
|
327
|
+
on_route:
|
|
328
|
+
- save: last_classification
|
|
329
|
+
- save: chain_used
|
|
330
|
+
|
|
331
|
+
on_error:
|
|
332
|
+
- save: classification_error
|
|
333
|
+
- notify: Reflection Engine
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Token Budget
|
|
339
|
+
|
|
340
|
+
| Operation | Tokens |
|
|
341
|
+
|-----------|--------|
|
|
342
|
+
| Normalization | 20 |
|
|
343
|
+
| Classification | 100 |
|
|
344
|
+
| Chain lookup | 30 |
|
|
345
|
+
| Dependency validation | 40 |
|
|
346
|
+
| **Total per routing** | **190** |
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Reflection
|
|
351
|
+
|
|
352
|
+
### Pre-delivery
|
|
353
|
+
|
|
354
|
+
- [ ] Is the classification correct?
|
|
355
|
+
- [ ] Could this input match multiple categories?
|
|
356
|
+
- [ ] Is the chain optimal for this task?
|
|
357
|
+
- [ ] Is budget sufficient?
|
|
358
|
+
|
|
359
|
+
### Post-delivery
|
|
360
|
+
|
|
361
|
+
- [ ] Did the chain produce the expected output?
|
|
362
|
+
- [ ] Was any skill in the chain unnecessary?
|
|
363
|
+
- [ ] Should a new category be added?
|
|
364
|
+
- [ ] Should the chain matrix be updated?
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Changelog
|
|
369
|
+
|
|
370
|
+
### 1.0.0 (2026-07-17)
|
|
371
|
+
|
|
372
|
+
- Initial release
|
|
373
|
+
- 15 task categories
|
|
374
|
+
- Keyword-based classification algorithm
|
|
375
|
+
- Skill chain matrix for all categories
|
|
376
|
+
- Confidence threshold at 70%
|
|
377
|
+
- Token budget enforcement
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Core: Evolution Engine
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: Reflection Engine, Memory Manager, Skill Registry
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The Evolution Engine is the self-improvement mechanism of Nexus AI. It receives structured feedback from the Reflection Engine, detects recurring patterns, and automatically updates skill files, rules, and configurations to prevent repeated mistakes and improve over time.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Update skills automatically based on reflection data.
|
|
19
|
+
- Eliminate recurring mistakes within 3 occurrences.
|
|
20
|
+
- Track skill evolution history per version.
|
|
21
|
+
- Never introduce breaking changes without user approval.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Reflection Engine
|
|
29
|
+
↓
|
|
30
|
+
Evolution Trigger (pattern detected ≥ threshold)
|
|
31
|
+
↓
|
|
32
|
+
Load current skill file
|
|
33
|
+
↓
|
|
34
|
+
Generate diff (proposed change)
|
|
35
|
+
↓
|
|
36
|
+
Validate change (no breaking, no regression)
|
|
37
|
+
↓
|
|
38
|
+
Flag for user approval (if major) OR auto-apply (if minor)
|
|
39
|
+
↓
|
|
40
|
+
Update skill file
|
|
41
|
+
↓
|
|
42
|
+
Update changelog
|
|
43
|
+
↓
|
|
44
|
+
Log evolution event
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Change Types
|
|
50
|
+
|
|
51
|
+
| Type | Auto-apply | User Approval | Example |
|
|
52
|
+
|------|-----------|---------------|---------|
|
|
53
|
+
| **Patch** | ✅ Yes | ❌ No | Fix typo, update budget estimate |
|
|
54
|
+
| **Minor** | ❌ No | ✅ Yes | Add new rule, extend workflow |
|
|
55
|
+
| **Major** | ❌ No | ✅ Yes | Restructure skill, change dependencies |
|
|
56
|
+
| **Deprecation** | ❌ No | ✅ Yes | Remove obsolete skill or rule |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Pattern → Action Mapping
|
|
61
|
+
|
|
62
|
+
```yaml
|
|
63
|
+
patterns:
|
|
64
|
+
token_waste:
|
|
65
|
+
threshold: 5 occurrences
|
|
66
|
+
action: "Reduce token budget for skill by 10%"
|
|
67
|
+
auto_apply: true
|
|
68
|
+
|
|
69
|
+
misclassification:
|
|
70
|
+
threshold: 3 occurrences
|
|
71
|
+
action: "Update Decision Engine classification keywords"
|
|
72
|
+
auto_apply: false
|
|
73
|
+
|
|
74
|
+
security_gap:
|
|
75
|
+
threshold: 1 occurrence
|
|
76
|
+
action: "Immediate skill update — add security rule"
|
|
77
|
+
auto_apply: false
|
|
78
|
+
|
|
79
|
+
user_confusion:
|
|
80
|
+
threshold: 3 occurrences
|
|
81
|
+
action: "Add Professor Mode activation to skill chain"
|
|
82
|
+
auto_apply: true
|
|
83
|
+
|
|
84
|
+
missing_dependency:
|
|
85
|
+
threshold: 2 occurrences
|
|
86
|
+
action: "Add missing dependency to skill declaration"
|
|
87
|
+
auto_apply: true
|
|
88
|
+
|
|
89
|
+
budget_exceeded:
|
|
90
|
+
threshold: 3 occurrences
|
|
91
|
+
action: "Increase budget or compress skill output"
|
|
92
|
+
auto_apply: true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Evolution Log Format
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
evolution:
|
|
101
|
+
id: "evo-20260717-001"
|
|
102
|
+
timestamp: "2026-07-17T12:00:00Z"
|
|
103
|
+
|
|
104
|
+
source:
|
|
105
|
+
reflection_ids: ["ref-001", "ref-005", "ref-012"]
|
|
106
|
+
pattern: "token_waste"
|
|
107
|
+
occurrences: 5
|
|
108
|
+
|
|
109
|
+
change:
|
|
110
|
+
type: "patch"
|
|
111
|
+
target: "skills/backend-engineer.md"
|
|
112
|
+
field: "token_budget"
|
|
113
|
+
old_value: 800
|
|
114
|
+
new_value: 720
|
|
115
|
+
reason: "Recurring token waste in code examples"
|
|
116
|
+
|
|
117
|
+
status: "auto_applied"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Rules
|
|
123
|
+
|
|
124
|
+
### Always
|
|
125
|
+
|
|
126
|
+
- ✅ Log every evolution event with full traceability.
|
|
127
|
+
- ✅ Require user approval for minor and major changes.
|
|
128
|
+
- ✅ Validate changes before applying (no regressions).
|
|
129
|
+
- ✅ Update CHANGELOG.md for every evolution.
|
|
130
|
+
- ✅ Track which reflection triggered the change.
|
|
131
|
+
|
|
132
|
+
### Never
|
|
133
|
+
|
|
134
|
+
- ❌ Auto-apply changes that affect skill structure.
|
|
135
|
+
- ❌ Apply changes that break backward compatibility without user approval.
|
|
136
|
+
- ❌ Delete skill files without user confirmation.
|
|
137
|
+
- ❌ Ignore pattern thresholds (always act at threshold).
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Metrics
|
|
142
|
+
|
|
143
|
+
| Metric | Target | How to Measure |
|
|
144
|
+
|--------|--------|---------------|
|
|
145
|
+
| Auto-apply accuracy | ≥ 95% | No user reverts of auto-applied changes |
|
|
146
|
+
| Recurring mistake elimination | ≤ 1 recurrence after fix | Track mistake IDs |
|
|
147
|
+
| Evolution events per week | ≥ 2 | Count logged events |
|
|
148
|
+
| User approval rate | ≥ 80% | Approved / requested changes |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Quality Gates (Pre-Apply)
|
|
153
|
+
|
|
154
|
+
1. ✅ Change improves the system (not neutral or worse).
|
|
155
|
+
2. ✅ Change does not break existing dependencies.
|
|
156
|
+
3. ✅ Change is compatible with SYSTEM.md version.
|
|
157
|
+
4. ✅ Change is documented in CHANGELOG.md.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Changelog
|
|
162
|
+
|
|
163
|
+
### 1.0.0 (2026-07-17)
|
|
164
|
+
|
|
165
|
+
- Initial release
|
|
166
|
+
- 6 pattern → action mappings
|
|
167
|
+
- 4 change types with auto-apply rules
|
|
168
|
+
- Full traceability from reflection to change
|
|
169
|
+
- Validation gate before any change
|