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.
Files changed (195) hide show
  1. package/AGENTS.md +53 -0
  2. package/CHANGELOG.md +198 -0
  3. package/LICENSE +21 -0
  4. package/README.md +96 -0
  5. package/ROADMAP.md +131 -0
  6. package/RULES.md +202 -0
  7. package/SYSTEM.md +201 -0
  8. package/agents/INDEX.md +40 -0
  9. package/agents/architect-agent.json +15 -0
  10. package/agents/bug-hunter-agent.json +14 -0
  11. package/agents/database-agent.json +14 -0
  12. package/agents/devops-agent.json +15 -0
  13. package/agents/docs-agent.json +15 -0
  14. package/agents/pm-agent.json +14 -0
  15. package/agents/professor-agent.json +15 -0
  16. package/agents/security-agent.json +14 -0
  17. package/agents/senior-engineer-agent.json +16 -0
  18. package/agents/techlead-agent.json +15 -0
  19. package/architecture/clean-architecture.md +98 -0
  20. package/architecture/cqrs-specialist.md +102 -0
  21. package/architecture/ddd-specialist.md +97 -0
  22. package/architecture/event-driven-architect.md +79 -0
  23. package/architecture/hexagonal-architecture.md +96 -0
  24. package/architecture/microservices-expert.md +83 -0
  25. package/architecture/monolith-expert.md +67 -0
  26. package/architecture/repository-pattern.md +73 -0
  27. package/architecture/unit-of-work.md +92 -0
  28. package/backend/README.md +29 -0
  29. package/bin/nexus.js +8 -0
  30. package/core/compression-engine.md +194 -0
  31. package/core/context-engine.md +239 -0
  32. package/core/decision-engine.md +377 -0
  33. package/core/evolution-engine.md +169 -0
  34. package/core/planning-engine.md +201 -0
  35. package/core/quality-gates.md +233 -0
  36. package/core/reflection-engine.md +182 -0
  37. package/core/skill-resolver.json +169 -0
  38. package/core/token-manager.md +152 -0
  39. package/database/database-engineer.md +244 -0
  40. package/database/mysql-specialist.md +61 -0
  41. package/database/postgresql-specialist.md +70 -0
  42. package/database/redis-specialist.md +73 -0
  43. package/database/sql-optimizer.md +95 -0
  44. package/database/sqlserver-specialist.md +69 -0
  45. package/devops/ci-cd-specialist.md +101 -0
  46. package/devops/devops-engineer.md +358 -0
  47. package/devops/docker-expert.md +105 -0
  48. package/devops/git-expert.md +76 -0
  49. package/devops/git-flow-specialist.md +71 -0
  50. package/devops/kubernetes-specialist.md +84 -0
  51. package/devops/linux-specialist.md +82 -0
  52. package/devops/windows-specialist.md +43 -0
  53. package/dist/cli/commands/compile.d.ts +2 -0
  54. package/dist/cli/commands/compile.d.ts.map +1 -0
  55. package/dist/cli/commands/compile.js +44 -0
  56. package/dist/cli/commands/compile.js.map +1 -0
  57. package/dist/cli/commands/doctor.d.ts +2 -0
  58. package/dist/cli/commands/doctor.d.ts.map +1 -0
  59. package/dist/cli/commands/doctor.js +88 -0
  60. package/dist/cli/commands/doctor.js.map +1 -0
  61. package/dist/cli/commands/init.d.ts +2 -0
  62. package/dist/cli/commands/init.d.ts.map +1 -0
  63. package/dist/cli/commands/init.js +26 -0
  64. package/dist/cli/commands/init.js.map +1 -0
  65. package/dist/cli/commands/list.d.ts +2 -0
  66. package/dist/cli/commands/list.d.ts.map +1 -0
  67. package/dist/cli/commands/list.js +50 -0
  68. package/dist/cli/commands/list.js.map +1 -0
  69. package/dist/cli/commands/run.d.ts +2 -0
  70. package/dist/cli/commands/run.d.ts.map +1 -0
  71. package/dist/cli/commands/run.js +49 -0
  72. package/dist/cli/commands/run.js.map +1 -0
  73. package/dist/cli/index.d.ts +2 -0
  74. package/dist/cli/index.d.ts.map +1 -0
  75. package/dist/cli/index.js +72 -0
  76. package/dist/cli/index.js.map +1 -0
  77. package/dist/index.d.ts +3 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +3 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/installer.d.ts +5 -0
  82. package/dist/installer.d.ts.map +1 -0
  83. package/dist/installer.js +86 -0
  84. package/dist/installer.js.map +1 -0
  85. package/dist/postinstall.d.ts +2 -0
  86. package/dist/postinstall.d.ts.map +1 -0
  87. package/dist/postinstall.js +8 -0
  88. package/dist/postinstall.js.map +1 -0
  89. package/frontend/README.md +19 -0
  90. package/memory/context-recovery.md +49 -0
  91. package/memory/conversation-summarizer.md +65 -0
  92. package/memory/long-term-project-memory.md +58 -0
  93. package/memory/memory-manager.md +299 -0
  94. package/memory/session-compression.md +182 -0
  95. package/memory/smart-recall.md +37 -0
  96. package/optimization/compact-example.md +87 -0
  97. package/optimization/cost-optimizer.md +53 -0
  98. package/optimization/prompt-optimizer.md +194 -0
  99. package/optimization/token-audit.md +177 -0
  100. package/optimization/token-reducer.md +202 -0
  101. package/package.json +67 -0
  102. package/security/owasp-auditor.md +249 -0
  103. package/security/pentest-reviewer.md +109 -0
  104. package/security/security-engineer.md +238 -0
  105. package/skills/INDEX.md +434 -0
  106. package/skills/accessibility-reviewer.md +63 -0
  107. package/skills/agentic-coding.md +56 -0
  108. package/skills/ai-agent/SKILL.md +107 -0
  109. package/skills/ai-agent-dev/SKILL.md +117 -0
  110. package/skills/alternative-solution-generator.md +72 -0
  111. package/skills/architecture-patterns/SKILL.md +113 -0
  112. package/skills/breaking-change-detector.md +84 -0
  113. package/skills/bug-hunter.md +234 -0
  114. package/skills/bug-prevention.md +75 -0
  115. package/skills/chaos-engineering/SKILL.md +108 -0
  116. package/skills/clean-code-validator.md +218 -0
  117. package/skills/cloud-architect/SKILL.md +78 -0
  118. package/skills/cloud-infra/SKILL.md +99 -0
  119. package/skills/code-auditor.md +24 -0
  120. package/skills/complexity-analyzer.md +102 -0
  121. package/skills/confidence-estimator.md +53 -0
  122. package/skills/continuous-improvement.md +46 -0
  123. package/skills/continuous-learning-engine.md +51 -0
  124. package/skills/cto-advisor.md +66 -0
  125. package/skills/data-engineer/SKILL.md +76 -0
  126. package/skills/data-engineering/SKILL.md +82 -0
  127. package/skills/debug-specialist.md +215 -0
  128. package/skills/dependency-analyzer.md +78 -0
  129. package/skills/design-pattern-advisor.md +78 -0
  130. package/skills/documentation-writer.md +66 -0
  131. package/skills/dry-kiss-yagni-validator.md +114 -0
  132. package/skills/economia-tokens/SKILL.md +40 -0
  133. package/skills/er-diagram-builder.md +85 -0
  134. package/skills/feature-flags/SKILL.md +95 -0
  135. package/skills/frontend/SKILL.md +327 -0
  136. package/skills/frontend-dev/SKILL.md +178 -0
  137. package/skills/graphql/SKILL.md +104 -0
  138. package/skills/hallucination-detection.md +49 -0
  139. package/skills/handoff-sessao/SKILL.md +32 -0
  140. package/skills/i18n-l10n/SKILL.md +103 -0
  141. package/skills/iac-terraform/SKILL.md +98 -0
  142. package/skills/legacy-migration/SKILL.md +91 -0
  143. package/skills/logging-expert.md +78 -0
  144. package/skills/mcp-server-dev.md +33 -0
  145. package/skills/memoria-projeto/SKILL.md +49 -0
  146. package/skills/mobile-dev/SKILL.md +82 -0
  147. package/skills/mobile-engineer/SKILL.md +74 -0
  148. package/skills/monitoring-specialist.md +59 -0
  149. package/skills/observability-expert.md +60 -0
  150. package/skills/performance-optimizer.md +239 -0
  151. package/skills/principal-engineer.md +55 -0
  152. package/skills/privacy-engineer/SKILL.md +79 -0
  153. package/skills/professor-modo/SKILL.md +33 -0
  154. package/skills/project-manager.md +74 -0
  155. package/skills/prompt-engineering.md +27 -0
  156. package/skills/qa/SKILL.md +231 -0
  157. package/skills/qa-engineer/SKILL.md +222 -0
  158. package/skills/readme-generator.md +42 -0
  159. package/skills/refactoring-specialist.md +250 -0
  160. package/skills/release-planner.md +70 -0
  161. package/skills/requirement-analyzer.md +65 -0
  162. package/skills/risk-analyzer.md +73 -0
  163. package/skills/root-cause-analyzer.md +210 -0
  164. package/skills/scalability-expert.md +73 -0
  165. package/skills/security-privacy/SKILL.md +98 -0
  166. package/skills/self-correction.md +54 -0
  167. package/skills/self-critique.md +42 -0
  168. package/skills/senior-code-reviewer.md +193 -0
  169. package/skills/sequence-diagram-builder.md +56 -0
  170. package/skills/serverless-edge/SKILL.md +103 -0
  171. package/skills/software-architect.md +356 -0
  172. package/skills/solid-validator.md +332 -0
  173. package/skills/sre-reliability/SKILL.md +115 -0
  174. package/skills/staff-engineer.md +61 -0
  175. package/skills/task-planner.md +61 -0
  176. package/skills/tech-lead.md +59 -0
  177. package/skills/technical-debt-analyzer.md +81 -0
  178. package/skills/technical-writer.md +39 -0
  179. package/skills/tradeoff-analyzer.md +79 -0
  180. package/skills/uml-generator.md +72 -0
  181. package/skills/ux-reviewer.md +61 -0
  182. package/skills/wasm/SKILL.md +133 -0
  183. package/skills/web-perf-engineer/SKILL.md +75 -0
  184. package/skills/web-perf-seo/SKILL.md +111 -0
  185. package/skills/websocket-realtime/SKILL.md +107 -0
  186. package/teaching/adaptive-teaching.md +37 -0
  187. package/teaching/code-explainer.md +172 -0
  188. package/teaching/interactive-teaching.md +41 -0
  189. package/teaching/learning-tracker.md +63 -0
  190. package/teaching/mentor-mode.md +200 -0
  191. package/teaching/professor-mode.md +222 -0
  192. package/testing/e2e-test-engineer.md +68 -0
  193. package/testing/integration-test-engineer.md +74 -0
  194. package/testing/mocking-specialist.md +78 -0
  195. 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