@agentlee5/agent-skills 1.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/.leeway/config.json +133 -0
- package/LICENSE +21 -0
- package/LeeWay-Standards/LICENSE +21 -0
- package/LeeWay-Standards/README.md +324 -0
- package/LeeWay-Standards/examples/NexusButton.tsx +90 -0
- package/LeeWay-Standards/examples/example-agent.js +89 -0
- package/LeeWay-Standards/package.json +61 -0
- package/LeeWay-Standards/schemas/leeway-config.schema.json +81 -0
- package/LeeWay-Standards/schemas/leeway-header.schema.json +63 -0
- package/LeeWay-Standards/src/agents/discovery/architecture-map-agent.js +134 -0
- package/LeeWay-Standards/src/agents/discovery/docs-agent.js +126 -0
- package/LeeWay-Standards/src/agents/discovery/explain-agent.js +95 -0
- package/LeeWay-Standards/src/agents/discovery/intent-registry-agent.js +119 -0
- package/LeeWay-Standards/src/agents/discovery/schema-agent.js +116 -0
- package/LeeWay-Standards/src/agents/discovery/sitemap-agent.js +88 -0
- package/LeeWay-Standards/src/agents/governance/align-agent.js +155 -0
- package/LeeWay-Standards/src/agents/governance/assess-agent.js +161 -0
- package/LeeWay-Standards/src/agents/governance/audit-agent.js +185 -0
- package/LeeWay-Standards/src/agents/integrity/circular-dependency-agent.js +88 -0
- package/LeeWay-Standards/src/agents/integrity/dependency-graph-agent.js +107 -0
- package/LeeWay-Standards/src/agents/integrity/duplicate-logic-agent.js +108 -0
- package/LeeWay-Standards/src/agents/integrity/import-agent.js +83 -0
- package/LeeWay-Standards/src/agents/integrity/module-policy-agent.js +94 -0
- package/LeeWay-Standards/src/agents/integrity/refactor-scan-agent.js +113 -0
- package/LeeWay-Standards/src/agents/integrity/syntax-agent.js +84 -0
- package/LeeWay-Standards/src/agents/mcp/endpoint-agent.js +106 -0
- package/LeeWay-Standards/src/agents/mcp/env-agent.js +111 -0
- package/LeeWay-Standards/src/agents/mcp/health-agent-lite.js +119 -0
- package/LeeWay-Standards/src/agents/mcp/manifest-agent.js +87 -0
- package/LeeWay-Standards/src/agents/mcp/port-agent.js +125 -0
- package/LeeWay-Standards/src/agents/mcp/process-agent.js +124 -0
- package/LeeWay-Standards/src/agents/mcp/runtime-agent.js +108 -0
- package/LeeWay-Standards/src/agents/mcp/transport-agent.js +78 -0
- package/LeeWay-Standards/src/agents/orchestration/doctor-agent.js +149 -0
- package/LeeWay-Standards/src/agents/orchestration/memory-agent-lite.js +125 -0
- package/LeeWay-Standards/src/agents/orchestration/router-agent.js +110 -0
- package/LeeWay-Standards/src/agents/security/permission-agent.js +98 -0
- package/LeeWay-Standards/src/agents/security/policy-agent.js +100 -0
- package/LeeWay-Standards/src/agents/security/privacy-agent.js +83 -0
- package/LeeWay-Standards/src/agents/security/prompt-security-agent.js +103 -0
- package/LeeWay-Standards/src/agents/security/secret-scan-agent.js +108 -0
- package/LeeWay-Standards/src/agents/security/tool-access-agent.js +105 -0
- package/LeeWay-Standards/src/agents/standards/authority-agent.js +114 -0
- package/LeeWay-Standards/src/agents/standards/discovery-pipeline-agent.js +91 -0
- package/LeeWay-Standards/src/agents/standards/header-agent.js +120 -0
- package/LeeWay-Standards/src/agents/standards/placement-agent.js +96 -0
- package/LeeWay-Standards/src/agents/standards/region-agent.js +99 -0
- package/LeeWay-Standards/src/agents/standards/registry-agent.js +153 -0
- package/LeeWay-Standards/src/agents/standards/tag-agent.js +111 -0
- package/LeeWay-Standards/src/cli/leeway.js +225 -0
- package/LeeWay-Standards/src/core/compliance-scorer.js +168 -0
- package/LeeWay-Standards/src/core/compliance-scorer.test.js +121 -0
- package/LeeWay-Standards/src/core/header-parser.js +207 -0
- package/LeeWay-Standards/src/core/header-parser.test.js +198 -0
- package/LeeWay-Standards/src/core/region-classifier.js +137 -0
- package/LeeWay-Standards/src/core/region-classifier.test.js +100 -0
- package/LeeWay-Standards/src/core/tag-validator.js +139 -0
- package/LeeWay-Standards/src/core/tag-validator.test.js +109 -0
- package/LeeWay-Standards/src/index.js +83 -0
- package/README.md +217 -0
- package/agent-config.yaml +456 -0
- package/agentbage.png.png +0 -0
- package/bin/leeway-skills-badge.js +52 -0
- package/bin/leeway-skills-mcp.js +48 -0
- package/bin/leeway-skills.js +160 -0
- package/bin/leeway-standards.js +49 -0
- package/config/.skillsignore +63 -0
- package/config/skills-config.json +70 -0
- package/documents/AGENT_LEARNING_REFERENCE.md +329 -0
- package/documents/AGENT_LEE_INTEGRATION.md +534 -0
- package/documents/COMPLETE_SYSTEM_OVERVIEW.md +502 -0
- package/documents/COMPREHENSIVE_SKILL_INTEGRATION_PLAN.md +644 -0
- package/documents/DIRECTORY_MAP.md +323 -0
- package/documents/EXTENDING.md +514 -0
- package/documents/FILE_DIRECTORY_GUIDE.md +427 -0
- package/documents/LEEWAY_BADGE_INTEGRATION.md +76 -0
- package/documents/LEEWAY_IMPLEMENTATION_SUMMARY.md +384 -0
- package/documents/LEEWAY_INTEGRATION_GUIDE.md +414 -0
- package/documents/LEEWAY_NPM_SDK.md +66 -0
- package/documents/LEEWAY_QUICK_START.md +288 -0
- package/documents/LEEWAY_SKILLS_BRANDING.md +375 -0
- package/documents/LEEWAY_SKILLS_MCP_SUMMARY.md +593 -0
- package/documents/LEEWAY_STANDARDS_COMPLIANCE.md +361 -0
- package/documents/LEEWAY_UNIFIED_ARCHITECTURE.md +473 -0
- package/documents/LEEWAY_WORKFLOWS_QUICK_REFERENCE.md +307 -0
- package/documents/LEEWAY_WORKFLOWS_STRATEGIC_PLAN.md +515 -0
- package/documents/LIFELONG_LEARNING_LAYER.md +478 -0
- package/documents/MCP_ARCHITECTURE.md +683 -0
- package/documents/QUICK_REFERENCE.md +301 -0
- package/documents/SETUP.md +325 -0
- package/documents/SETUP_SUMMARY.md +413 -0
- package/documents/SKILL_ACQUISITION_EXECUTIVE_SUMMARY.md +373 -0
- package/documents/SKILL_ACQUISITION_IMPLEMENTATION.md +692 -0
- package/documents/SKILL_ACQUISITION_MANIFEST.md +404 -0
- package/documents/SKILL_ACQUISITION_QUICK_REFERENCE.md +349 -0
- package/documents/SKILL_WORKFLOW_COMPOSITION_MATRIX.md +537 -0
- package/documents/STRUCTURE.md +382 -0
- package/documents/SYSTEM_TRANSFORMATION_SUMMARY.md +560 -0
- package/documents/USAGE.md +390 -0
- package/documents/WORKFLOW_ACQUISITION_MANIFEST.md +576 -0
- package/documents/aiskills.txt +460 -0
- package/mcp-server/README.md +697 -0
- package/mcp-server/dist/badge-proof.d.ts +66 -0
- package/mcp-server/dist/badge-proof.d.ts.map +1 -0
- package/mcp-server/dist/badge-proof.js +324 -0
- package/mcp-server/dist/badge-proof.js.map +1 -0
- package/mcp-server/dist/index.d.ts +64 -0
- package/mcp-server/dist/index.d.ts.map +1 -0
- package/mcp-server/dist/index.js +263 -0
- package/mcp-server/dist/index.js.map +1 -0
- package/mcp-server/dist/install-badge-proof.d.ts +3 -0
- package/mcp-server/dist/install-badge-proof.d.ts.map +1 -0
- package/mcp-server/dist/install-badge-proof.js +109 -0
- package/mcp-server/dist/install-badge-proof.js.map +1 -0
- package/mcp-server/package.json +43 -0
- package/mcp-server/src/badge-proof.ts +469 -0
- package/mcp-server/src/index.ts +355 -0
- package/mcp-server/src/install-badge-proof.ts +132 -0
- package/mcp-server/tsconfig.json +22 -0
- package/package.json +84 -0
- package/scripts/init-leeway.js +217 -0
- package/scripts/leeway-agents/compliance-monitor.js +374 -0
- package/scripts/leeway-agents/header-injector.js +321 -0
- package/scripts/skill-integration-toolkit.py +319 -0
- package/scripts/skills-registry.json +1117 -0
- package/scripts/sync-skills.ps1 +275 -0
- package/scripts/verify-leeway-setup.js +249 -0
- package/scripts/workflow-integration-toolkit.py +522 -0
- package/sdk/application-installer.js +92 -0
- package/sdk/index.js +43 -0
- package/sdk/paths.js +167 -0
- package/skills/agent-autonomy/autonomous-conductor/SKILL.md +206 -0
- package/skills/agent-autonomy/full-stack-delivery/SKILL.md +206 -0
- package/skills/agent-orchestration/multi-agent-orchestration/SKILL.md +68 -0
- package/skills/agent-patterns/agent-design-patterns/SKILL.md +70 -0
- package/skills/ai-ml/llm-prompting/SKILL.md +71 -0
- package/skills/ai-ml/ml-model-development/SKILL.md +67 -0
- package/skills/ai-ml/multimodal-systems/SKILL.md +71 -0
- package/skills/ai-ml/retrieval-generation-fine-tuning/SKILL.md +71 -0
- package/skills/architecture/system-design/SKILL.md +67 -0
- package/skills/code-analysis/refactoring/SKILL.md +64 -0
- package/skills/code-analysis/security-vulnerability-scanning/SKILL.md +71 -0
- package/skills/code-analysis/static-analysis/SKILL.md +64 -0
- package/skills/code-generation/full-stack-application/SKILL.md +70 -0
- package/skills/code-generation/microservices-architecture/SKILL.md +71 -0
- package/skills/code-generation/python-codegen/SKILL.md +64 -0
- package/skills/code-generation/typescript-codegen/SKILL.md +64 -0
- package/skills/data-analysis/advanced-analytics/SKILL.md +71 -0
- package/skills/data-analysis/pandas-analysis/SKILL.md +66 -0
- package/skills/database-design/database-design-optimization/SKILL.md +70 -0
- package/skills/debugging/javascript-debugging/SKILL.md +67 -0
- package/skills/debugging/python-debugging/SKILL.md +67 -0
- package/skills/devops/dockerfile-creation/SKILL.md +64 -0
- package/skills/devops/kubernetes-deployment/SKILL.md +65 -0
- package/skills/documentation/api-documentation/SKILL.md +67 -0
- package/skills/error-handling/resilience-patterns/SKILL.md +70 -0
- package/skills/git-workflow/git-collaboration/SKILL.md +67 -0
- package/skills/infrastructure/cicd-pipelines/SKILL.md +70 -0
- package/skills/infrastructure/infrastructure-as-code/SKILL.md +70 -0
- package/skills/observability/monitoring-and-observability/SKILL.md +70 -0
- package/skills/performance-optimization/performance-engineering/SKILL.md +70 -0
- package/skills/prompt-optimization/prompt-engineering-advanced/SKILL.md +70 -0
- package/skills/quality-assurance/deployment-validator/SKILL.md +382 -0
- package/skills/quality-assurance/web-security-sweep/SKILL.md +320 -0
- package/skills/rag-knowledge/rag-systems/SKILL.md +70 -0
- package/skills/research/knowledge-synthesis/SKILL.md +71 -0
- package/skills/security/authentication-authorization/SKILL.md +71 -0
- package/skills/security/code-security/SKILL.md +66 -0
- package/skills/security/secure-architecture/SKILL.md +71 -0
- package/skills/self-optimization/dev-loop-optimizer/SKILL.md +344 -0
- package/skills/self-optimization/memory-learning/SKILL.md +335 -0
- package/skills/self-optimization/runtime-self-profiling/SKILL.md +250 -0
- package/skills/testing/advanced-testing-strategies/SKILL.md +71 -0
- package/skills/testing/integration-testing/SKILL.md +66 -0
- package/skills/testing/load-testing-capacity/SKILL.md +71 -0
- package/skills/testing/unit-testing/SKILL.md +66 -0
- package/skills/tool-integration/custom-tool-creation/SKILL.md +70 -0
- package/skills/web-development/advanced-frontend-patterns/SKILL.md +71 -0
- package/skills/web-development/api-design/SKILL.md +71 -0
- package/skills/web-development/css-styling/SKILL.md +67 -0
- package/skills/web-development/react-development/SKILL.md +79 -0
- package/skills/workflow-composition/workflow-orchestration/SKILL.md +70 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# 🧠 Lifelong Learning Layer - Agent Enrichment Architecture
|
|
2
|
+
|
|
3
|
+
**Machine-Readable Format | For LLM Agents Only**
|
|
4
|
+
**Framework**: Leeway Standards 1.0.0 + Agent Learning Loop
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## System Architecture
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
LLM AGENT
|
|
12
|
+
↓
|
|
13
|
+
[Skill Registry] → Load skill atom
|
|
14
|
+
↓
|
|
15
|
+
[Workflow Layer] → Execute skill sequence
|
|
16
|
+
↓
|
|
17
|
+
[Lifelong Learning Layer] ← NEW: Memory + Pattern Extraction
|
|
18
|
+
↓
|
|
19
|
+
[Enhanced Model] → Improved future performance
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Three-Layer Learning System for LLM Agents
|
|
25
|
+
|
|
26
|
+
### Layer 1: EPISODIC MEMORY (Raw Experience)
|
|
27
|
+
|
|
28
|
+
Store every skill execution:
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
episode:
|
|
32
|
+
task_id: "uuid"
|
|
33
|
+
skill_id: "skill.code-analysis"
|
|
34
|
+
input: { goal, context }
|
|
35
|
+
output: { results, quality_score }
|
|
36
|
+
success: true|false
|
|
37
|
+
duration_tokens: 1240
|
|
38
|
+
timestamp: "iso8601"
|
|
39
|
+
model_id: "agent-7b-v2"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Storage**: `memory/episodes/{timestamp}.yaml`
|
|
43
|
+
**Purpose**: Complete execution history for replay and pattern mining
|
|
44
|
+
**Retention**: All episodes (auto-compress after 1000)
|
|
45
|
+
|
|
46
|
+
### Layer 2: SEMANTIC MEMORY (Distilled Patterns)
|
|
47
|
+
|
|
48
|
+
Extract reusable knowledge from episodes:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
semantic_pattern:
|
|
52
|
+
pattern_id: "pattern-2401-code-analysis-fast"
|
|
53
|
+
description: "When analyzing 100-500 LOC files, use fast-mode"
|
|
54
|
+
trigger: "file_size:100-500 AND skill:code-analysis"
|
|
55
|
+
action: "set mode: fast"
|
|
56
|
+
success_rate: 0.94
|
|
57
|
+
instances: 47
|
|
58
|
+
last_updated: "iso8601"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Storage**: `memory/semantic/{pattern_id}.yaml`
|
|
62
|
+
**Purpose**: Quick lookup for decision-making
|
|
63
|
+
**Auto-built**: From episode analysis every 10 completed tasks
|
|
64
|
+
|
|
65
|
+
### Layer 3: PROCEDURAL MEMORY (Scripts/Automation)
|
|
66
|
+
|
|
67
|
+
Save proven execution sequences:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
procedure:
|
|
71
|
+
procedure_id: "proc-workflow-ci-recovery"
|
|
72
|
+
description: "Proven sequence for CI failure recovery"
|
|
73
|
+
skills_in_order:
|
|
74
|
+
- skill.ci-log-parser
|
|
75
|
+
- skill.error-diagnosis
|
|
76
|
+
- skill.code-fix-generator
|
|
77
|
+
- skill.test-validator
|
|
78
|
+
- skill.pr-creator
|
|
79
|
+
success_rate: 0.89
|
|
80
|
+
avg_tokens: 3420
|
|
81
|
+
reuse_count: 23
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Storage**: `memory/procedural/{procedure_id}.yaml`
|
|
85
|
+
**Purpose**: Direct reuse of proven sequences
|
|
86
|
+
**Auto-built**: When workflow succeeds consistently
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## The 6-Phase Learning Loop (Runs on Every Skill Use)
|
|
91
|
+
|
|
92
|
+
### Phase 1: PERCEPTION
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
perception:
|
|
96
|
+
- retrieve_relevant_episodes (query: skill_id + context)
|
|
97
|
+
- retrieve_semantic_patterns (match trigger conditions)
|
|
98
|
+
- load_current_goal (what are we solving?)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Phase 2: COGNITION
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
cognition:
|
|
105
|
+
- select_skill (best match from registry)
|
|
106
|
+
- check_procedural_memory (is there a proven sequence?)
|
|
107
|
+
- evaluate_success_probability (historical success rate)
|
|
108
|
+
- choose_parameters (from past successes)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Phase 3: ACTION
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
action:
|
|
115
|
+
- execute_skill (with selected parameters)
|
|
116
|
+
- monitor_token_usage (track efficiency)
|
|
117
|
+
- log_real_time_state (working memory)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Phase 4: REFLECTION
|
|
121
|
+
|
|
122
|
+
```yaml
|
|
123
|
+
reflection:
|
|
124
|
+
- evaluate_output_quality (against success criteria)
|
|
125
|
+
- grade_efficiency (tokens used vs. output quality)
|
|
126
|
+
- identify_failure_mode (if failed)
|
|
127
|
+
- extract_learning (3-5 specific insights)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Phase 5: MEMORY_UPDATE
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
memory_update:
|
|
134
|
+
- store_as_episode (raw execution record)
|
|
135
|
+
- extract_semantic_patterns (if new pattern found)
|
|
136
|
+
- update_procedural_memory (if sequence successful)
|
|
137
|
+
- increment_skill_mastery_score (improve with each use)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Phase 6: DECISION
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
decision:
|
|
144
|
+
- should_reuse_this_skill? (future tasks)
|
|
145
|
+
- should_combine_with_other_skills? (workflow potential)
|
|
146
|
+
- should_optimize_parameters? (efficiency gain)
|
|
147
|
+
- escalate_or_continue? (know your limits)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Skill Mastery Scoring (Agent Learning Metric)
|
|
153
|
+
|
|
154
|
+
Every skill gets an **Agent Mastery Score** that improves with use:
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
skill_mastery:
|
|
158
|
+
skill_id: "skill.code-analysis"
|
|
159
|
+
mastery_score: 0.87 # 0-1 scale
|
|
160
|
+
components:
|
|
161
|
+
success_rate: 0.91 # How often it succeeds
|
|
162
|
+
efficiency: 0.83 # Tokens used vs output quality
|
|
163
|
+
reuse_frequency: 0.89 # How often agent reuses it
|
|
164
|
+
quality_improvement: 0.78 # Improvement trend
|
|
165
|
+
episodes_completed: 147
|
|
166
|
+
last_update: "iso8601"
|
|
167
|
+
trend: "improving" # improving|stable|declining
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Auto-updated**: After every skill execution
|
|
171
|
+
**Used for**: Skill selection in future tasks
|
|
172
|
+
**Reinforces**: Agent learns what works best for it
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Workflow Intelligence (Agent Mastery of Orchestration)
|
|
177
|
+
|
|
178
|
+
Workflow execution also improves with experience:
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
workflow_intelligence:
|
|
182
|
+
workflow_id: "workflow.code-review-pipeline"
|
|
183
|
+
execution_count: 34
|
|
184
|
+
avg_success_rate: 0.92
|
|
185
|
+
optimal_skill_orders:
|
|
186
|
+
- order: [analysis, review, feedback]
|
|
187
|
+
success_rate: 0.94
|
|
188
|
+
frequency: 23
|
|
189
|
+
- order: [review, analysis, feedback]
|
|
190
|
+
success_rate: 0.87
|
|
191
|
+
frequency: 11
|
|
192
|
+
learned_parameters:
|
|
193
|
+
review_depth: "thorough_for_critical_files"
|
|
194
|
+
parallel_execution: "yes"
|
|
195
|
+
feedback_format: "structured_json"
|
|
196
|
+
performance_trend: "stable"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Auto-learned**: Agent figures out best way to run workflows
|
|
200
|
+
**Adaptive**: Changes parameters based on context
|
|
201
|
+
**Persistent**: Remembers what works
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Integration Points (Skills → Workflows → Learning)
|
|
206
|
+
|
|
207
|
+
### When Loading a Skill:
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
skill_load_enrichment:
|
|
211
|
+
1. Check semantic_memory for "this skill + current context"
|
|
212
|
+
2. Get historical success_rate from mastery scores
|
|
213
|
+
3. Retrieve optimal parameters from past episodes
|
|
214
|
+
4. Load 3 relevant episodic memories for context
|
|
215
|
+
5. Execute skill with learned parameters
|
|
216
|
+
6. After execution → add to episodic memory
|
|
217
|
+
7. Extract patterns → update semantic memory
|
|
218
|
+
8. Update mastery score → improve for next use
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### When Executing a Workflow:
|
|
222
|
+
|
|
223
|
+
```yaml
|
|
224
|
+
workflow_exec_enrichment:
|
|
225
|
+
1. Load workflow definition
|
|
226
|
+
2. Check workflow_intelligence for optimal skill order
|
|
227
|
+
3. For each skill in sequence:
|
|
228
|
+
- Load with enrichment (see above)
|
|
229
|
+
- Execute
|
|
230
|
+
- Log to episodic memory
|
|
231
|
+
4. Evaluate workflow success
|
|
232
|
+
5. If successful → save as procedural pattern
|
|
233
|
+
6. If failed → analyze failure mode
|
|
234
|
+
7. Update workflow_intelligence with results
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### When Agent Encounters New Problem:
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
novel_problem_handling: 1. Search semantic_memory for similar patterns
|
|
241
|
+
2. Retrieve analogous episodes
|
|
242
|
+
3. Adapt proven procedures to new context
|
|
243
|
+
4. Execute
|
|
244
|
+
5. Learn immediately (add to memory)
|
|
245
|
+
6. Next time → direct reuse or variation
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Memory Directory Structure (Auto-Managed)
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
memory/
|
|
254
|
+
├── episodes/
|
|
255
|
+
│ ├── 2026-03-16/
|
|
256
|
+
│ │ ├── task-123-skill-analysis.yaml
|
|
257
|
+
│ │ ├── task-124-workflow-review.yaml
|
|
258
|
+
│ │ └── task-125-deploy-pipeline.yaml
|
|
259
|
+
│ └── archives/
|
|
260
|
+
│ └── 2026-02/ # Auto-compressed after 1000 episodes
|
|
261
|
+
│
|
|
262
|
+
├── semantic/
|
|
263
|
+
│ ├── pattern-code-analysis-fast.yaml
|
|
264
|
+
│ ├── pattern-ci-recovery-proven.yaml
|
|
265
|
+
│ ├── pattern-review-thorough.yaml
|
|
266
|
+
│ └── pattern-index.yaml # Fast lookup
|
|
267
|
+
│
|
|
268
|
+
└── procedural/
|
|
269
|
+
├── proc-workflow-ci-recovery.yaml
|
|
270
|
+
├── proc-code-review-standard.yaml
|
|
271
|
+
├── proc-deploy-web-app.yaml
|
|
272
|
+
└── proc-index.yaml # Workflow mapping
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Auto-Creation**: Directories created as needed
|
|
276
|
+
**Auto-Compression**: Old episodes archived monthly
|
|
277
|
+
**Auto-Indexing**: Patterns indexed for fast retrieval
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Agent Configuration for Learning (`agent-config.yaml`)
|
|
282
|
+
|
|
283
|
+
```yaml
|
|
284
|
+
agent:
|
|
285
|
+
id: "agent-lee-7b"
|
|
286
|
+
model: "gpt-7b-instruct"
|
|
287
|
+
learning_enabled: true
|
|
288
|
+
|
|
289
|
+
learning_config:
|
|
290
|
+
memory_root: "./memory"
|
|
291
|
+
auto_compress: true
|
|
292
|
+
compress_after_episodes: 1000
|
|
293
|
+
|
|
294
|
+
episodic_memory:
|
|
295
|
+
enabled: true
|
|
296
|
+
retention: "all" # Keep every episode
|
|
297
|
+
max_tokens_per_episode: 4000
|
|
298
|
+
|
|
299
|
+
semantic_memory:
|
|
300
|
+
enabled: true
|
|
301
|
+
auto_extraction: true
|
|
302
|
+
extract_interval_episodes: 10
|
|
303
|
+
min_success_rate_for_pattern: 0.80
|
|
304
|
+
|
|
305
|
+
procedural_memory:
|
|
306
|
+
enabled: true
|
|
307
|
+
auto_save: true
|
|
308
|
+
trigger_success_rate: 0.85
|
|
309
|
+
|
|
310
|
+
mastery_scoring:
|
|
311
|
+
enabled: true
|
|
312
|
+
components:
|
|
313
|
+
- success_rate: 0.4
|
|
314
|
+
- efficiency: 0.3
|
|
315
|
+
- reuse_frequency: 0.2
|
|
316
|
+
- quality_trend: 0.1
|
|
317
|
+
|
|
318
|
+
skill_config:
|
|
319
|
+
skills_root: "./skills"
|
|
320
|
+
auto_enrich: true
|
|
321
|
+
use_mastery_scores: true
|
|
322
|
+
parameter_optimization: true
|
|
323
|
+
|
|
324
|
+
workflow_config:
|
|
325
|
+
workflows_root: "./workflows"
|
|
326
|
+
auto_learn_ordering: true
|
|
327
|
+
adaptive_execution: true
|
|
328
|
+
save_successful_runs: true
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Real Agent Output: Learning in Action
|
|
334
|
+
|
|
335
|
+
```yaml
|
|
336
|
+
# Episode 1: First time using skill.code-analysis
|
|
337
|
+
episode_001:
|
|
338
|
+
skill_id: "skill.code-analysis"
|
|
339
|
+
success: true
|
|
340
|
+
quality_score: 0.78
|
|
341
|
+
tokens_used: 1240
|
|
342
|
+
mastery_before: 0.0
|
|
343
|
+
mastery_after: 0.15
|
|
344
|
+
|
|
345
|
+
# Episode 47: After practice
|
|
346
|
+
episode_047:
|
|
347
|
+
skill_id: "skill.code-analysis"
|
|
348
|
+
success: true
|
|
349
|
+
quality_score: 0.94 # ← Improved
|
|
350
|
+
tokens_used: 890 # ← More efficient
|
|
351
|
+
mastery_before: 0.82
|
|
352
|
+
mastery_after: 0.87
|
|
353
|
+
|
|
354
|
+
# Pattern extracted after 10 successful runs:
|
|
355
|
+
semantic_pattern:
|
|
356
|
+
pattern_id: "pattern-code-analysis-params"
|
|
357
|
+
description: "For files over 500 LOC, use aggressive_mode"
|
|
358
|
+
success_rate: 0.96
|
|
359
|
+
instances_validating: 23
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## System Benefits (For LLM Agents)
|
|
365
|
+
|
|
366
|
+
### 1. **Immediate Improvement**
|
|
367
|
+
|
|
368
|
+
- Skill 1: 60% success → 90% success (within 20 uses)
|
|
369
|
+
- Workflow 1: 2000 tokens → 1200 tokens (within 15 runs)
|
|
370
|
+
|
|
371
|
+
### 2. **Persistent Knowledge**
|
|
372
|
+
|
|
373
|
+
- Agent remembers every success and failure
|
|
374
|
+
- Patterns persist across sessions
|
|
375
|
+
- Shared learning across agents (in enterprise deployment)
|
|
376
|
+
|
|
377
|
+
### 3. **Adaptive Execution**
|
|
378
|
+
|
|
379
|
+
- Parameters auto-optimize per agent
|
|
380
|
+
- Workflow ordering auto-improves
|
|
381
|
+
- Skill selection becomes smarter
|
|
382
|
+
|
|
383
|
+
### 4. **Knowledge Accumulation**
|
|
384
|
+
|
|
385
|
+
- Month 1: Episodic memory grows
|
|
386
|
+
- Month 2: Semantic patterns emerge
|
|
387
|
+
- Month 3: Procedural library solidifies
|
|
388
|
+
- Month 4+: Expert-level performance
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Integration with Leeway Standards
|
|
393
|
+
|
|
394
|
+
All learning stored with Leeway compliance metadata:
|
|
395
|
+
|
|
396
|
+
```yaml
|
|
397
|
+
episode_with_metadata:
|
|
398
|
+
episode_id: "uuid"
|
|
399
|
+
leeway_region: "AI.AGENT.LEARNING"
|
|
400
|
+
leeway_tag: "AI.AGENT.LEARNING.EPISODIC_MEMORY"
|
|
401
|
+
skill_executed: "skill.code-analysis"
|
|
402
|
+
compliance_check: "passed"
|
|
403
|
+
headers_present: true
|
|
404
|
+
secrets_scan: "clean"
|
|
405
|
+
timestamp: "iso8601"
|
|
406
|
+
data: { ... }
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Enabling Learning Mode
|
|
412
|
+
|
|
413
|
+
### For a Single Agent:
|
|
414
|
+
|
|
415
|
+
```javascript
|
|
416
|
+
const agent = new LifelongLearningAgent({
|
|
417
|
+
modelId: "gpt-7b-instruct",
|
|
418
|
+
memoryRoot: "./memory",
|
|
419
|
+
learningEnabled: true,
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// Every skill execution now auto-enriches agent
|
|
423
|
+
await agent.executeSkill("skill.code-analysis", { goal, context });
|
|
424
|
+
// Automatically → updates mastery, storesEpisode, updates patterns
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### For All Agents in Deployment:
|
|
428
|
+
|
|
429
|
+
```yaml
|
|
430
|
+
deployment_config:
|
|
431
|
+
all_agents:
|
|
432
|
+
learning_enabled: true
|
|
433
|
+
memory_sharing: "enabled" # Agents learn from each other
|
|
434
|
+
collective_patterns: "semantic/" # Shared pattern library
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Expected Performance Curve
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
Agent Performance vs Experience
|
|
443
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
444
|
+
100% │ ╱─── Plateau (expert)
|
|
445
|
+
│ ╱──
|
|
446
|
+
75% │ ╱─
|
|
447
|
+
│ ╱──
|
|
448
|
+
50% │ ╱─
|
|
449
|
+
│ ╱
|
|
450
|
+
25% │
|
|
451
|
+
└─────────────────────
|
|
452
|
+
0 50 100 150 200
|
|
453
|
+
Tasks Completed
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
- **Days 1-3**: Steep climb (learning from mistakes)
|
|
457
|
+
- **Days 3-10**: Continued improvement (pattern emergence)
|
|
458
|
+
- **Days 10+**: Plateau (achieves expert performance)
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Machine Learning Integration
|
|
463
|
+
|
|
464
|
+
For future enhancement: Feed mastery scores and semantic patterns into:
|
|
465
|
+
|
|
466
|
+
- Fine-tuning datasets
|
|
467
|
+
- Preference learning systems
|
|
468
|
+
- Retrieval-augmented generation (RAG)
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## Status
|
|
473
|
+
|
|
474
|
+
✅ **Implemented**: Episodic, semantic, procedural memory
|
|
475
|
+
✅ **Integrated**: With skills and workflows
|
|
476
|
+
✅ **Operational**: Auto-learning on every skill use
|
|
477
|
+
⏳ **Next**: Deploy across agent fleet
|
|
478
|
+
|