wogiflow 1.0.21 → 1.0.22

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 (121) hide show
  1. package/.claude/commands/wogi-bug.md +43 -0
  2. package/.claude/commands/wogi-bulk.md +144 -0
  3. package/.claude/commands/wogi-changelog.md +36 -0
  4. package/.claude/commands/wogi-compact.md +99 -0
  5. package/.claude/commands/wogi-config.md +50 -0
  6. package/.claude/commands/wogi-context.md +68 -0
  7. package/.claude/commands/wogi-correction.md +73 -0
  8. package/.claude/commands/wogi-debt.md +128 -0
  9. package/.claude/commands/wogi-deps.md +32 -0
  10. package/.claude/commands/wogi-epics.md +145 -0
  11. package/.claude/commands/wogi-export.md +100 -0
  12. package/.claude/commands/wogi-feature.md +149 -0
  13. package/.claude/commands/wogi-guided-edit.md +83 -0
  14. package/.claude/commands/wogi-health.md +43 -0
  15. package/.claude/commands/wogi-help.md +96 -0
  16. package/.claude/commands/wogi-hybrid-edit.md +36 -0
  17. package/.claude/commands/wogi-hybrid-off.md +24 -0
  18. package/.claude/commands/wogi-hybrid-setup.md +79 -0
  19. package/.claude/commands/wogi-hybrid-status.md +45 -0
  20. package/.claude/commands/wogi-hybrid.md +54 -0
  21. package/.claude/commands/wogi-import.md +44 -0
  22. package/.claude/commands/wogi-init.md +618 -0
  23. package/.claude/commands/wogi-log.md +38 -0
  24. package/.claude/commands/wogi-map-add.md +29 -0
  25. package/.claude/commands/wogi-map-check.md +35 -0
  26. package/.claude/commands/wogi-map-index.md +98 -0
  27. package/.claude/commands/wogi-map-scan.md +38 -0
  28. package/.claude/commands/wogi-map-sync.md +91 -0
  29. package/.claude/commands/wogi-map.md +33 -0
  30. package/.claude/commands/wogi-morning.md +65 -0
  31. package/.claude/commands/wogi-onboard.md +99 -0
  32. package/.claude/commands/wogi-plan.md +173 -0
  33. package/.claude/commands/wogi-ready.md +84 -0
  34. package/.claude/commands/wogi-resume.md +95 -0
  35. package/.claude/commands/wogi-review.md +636 -0
  36. package/.claude/commands/wogi-roadmap.md +241 -0
  37. package/.claude/commands/wogi-rules.md +104 -0
  38. package/.claude/commands/wogi-search.md +33 -0
  39. package/.claude/commands/wogi-session-end.md +49 -0
  40. package/.claude/commands/wogi-setup-stack.md +151 -0
  41. package/.claude/commands/wogi-skill-learn.md +66 -0
  42. package/.claude/commands/wogi-skills.md +87 -0
  43. package/.claude/commands/wogi-standup.md +28 -0
  44. package/.claude/commands/wogi-start.md +465 -0
  45. package/.claude/commands/wogi-status.md +41 -0
  46. package/.claude/commands/wogi-statusline-setup/skill.md +109 -0
  47. package/.claude/commands/wogi-story.md +98 -0
  48. package/.claude/commands/wogi-suspend.md +87 -0
  49. package/.claude/commands/wogi-test-browser.md +43 -0
  50. package/.claude/commands/wogi-trace.md +198 -0
  51. package/.claude/docs/architecture.md +37 -0
  52. package/.claude/docs/commands.md +343 -0
  53. package/.claude/docs/knowledge-base/01-setup-onboarding/README.md +177 -0
  54. package/.claude/docs/knowledge-base/01-setup-onboarding/component-indexing.md +341 -0
  55. package/.claude/docs/knowledge-base/01-setup-onboarding/framework-detection.md +269 -0
  56. package/.claude/docs/knowledge-base/01-setup-onboarding/installation.md +146 -0
  57. package/.claude/docs/knowledge-base/01-setup-onboarding/onboarding-existing.md +317 -0
  58. package/.claude/docs/knowledge-base/01-setup-onboarding/team-setup.md +346 -0
  59. package/.claude/docs/knowledge-base/02-task-execution/01-task-planning.md +259 -0
  60. package/.claude/docs/knowledge-base/02-task-execution/02-execution-loop.md +443 -0
  61. package/.claude/docs/knowledge-base/02-task-execution/03-verification.md +417 -0
  62. package/.claude/docs/knowledge-base/02-task-execution/04-completion.md +374 -0
  63. package/.claude/docs/knowledge-base/02-task-execution/05-session-review.md +170 -0
  64. package/.claude/docs/knowledge-base/02-task-execution/README.md +173 -0
  65. package/.claude/docs/knowledge-base/02-task-execution/external-integrations.md +133 -0
  66. package/.claude/docs/knowledge-base/02-task-execution/model-management.md +202 -0
  67. package/.claude/docs/knowledge-base/02-task-execution/specification-mode.md +292 -0
  68. package/.claude/docs/knowledge-base/02-task-execution/sync-daemon.md +96 -0
  69. package/.claude/docs/knowledge-base/02-task-execution/trade-offs.md +345 -0
  70. package/.claude/docs/knowledge-base/02-task-execution/workflow-steps.md +357 -0
  71. package/.claude/docs/knowledge-base/03-self-improvement/README.md +199 -0
  72. package/.claude/docs/knowledge-base/03-self-improvement/long-input-processing.md +160 -0
  73. package/.claude/docs/knowledge-base/03-self-improvement/model-learning.md +334 -0
  74. package/.claude/docs/knowledge-base/03-self-improvement/project-learning.md +301 -0
  75. package/.claude/docs/knowledge-base/03-self-improvement/skill-learning.md +372 -0
  76. package/.claude/docs/knowledge-base/03-self-improvement/skill-matching.md +304 -0
  77. package/.claude/docs/knowledge-base/03-self-improvement/team-learning.md +342 -0
  78. package/.claude/docs/knowledge-base/04-memory-context/README.md +189 -0
  79. package/.claude/docs/knowledge-base/04-memory-context/context-management.md +308 -0
  80. package/.claude/docs/knowledge-base/04-memory-context/memory-commands.md +176 -0
  81. package/.claude/docs/knowledge-base/04-memory-context/memory-systems.md +359 -0
  82. package/.claude/docs/knowledge-base/04-memory-context/prd-management.md +115 -0
  83. package/.claude/docs/knowledge-base/04-memory-context/session-persistence.md +359 -0
  84. package/.claude/docs/knowledge-base/04-memory-context/team-history.md +317 -0
  85. package/.claude/docs/knowledge-base/05-development-tools/README.md +84 -0
  86. package/.claude/docs/knowledge-base/05-development-tools/code-traces.md +278 -0
  87. package/.claude/docs/knowledge-base/05-development-tools/figma-analyzer.md +253 -0
  88. package/.claude/docs/knowledge-base/05-development-tools/guided-edit.md +173 -0
  89. package/.claude/docs/knowledge-base/05-development-tools/mcp-integrations.md +286 -0
  90. package/.claude/docs/knowledge-base/06-safety-guardrails/README.md +153 -0
  91. package/.claude/docs/knowledge-base/06-safety-guardrails/checkpoint-rollback.md +302 -0
  92. package/.claude/docs/knowledge-base/06-safety-guardrails/commit-gates.md +309 -0
  93. package/.claude/docs/knowledge-base/06-safety-guardrails/damage-control.md +292 -0
  94. package/.claude/docs/knowledge-base/06-safety-guardrails/security-scanning.md +291 -0
  95. package/.claude/docs/knowledge-base/README.md +92 -0
  96. package/.claude/docs/knowledge-base/configuration/README.md +228 -0
  97. package/.claude/docs/knowledge-base/configuration/all-options.md +1632 -0
  98. package/.claude/docs/knowledge-base/future-features.md +277 -0
  99. package/.claude/docs/stack.md +25 -0
  100. package/.claude/docs/testing.md +71 -0
  101. package/.claude/rules/README.md +60 -0
  102. package/.claude/rules/architecture/component-reuse.md +38 -0
  103. package/.claude/rules/architecture/document-structure.md +76 -0
  104. package/.claude/rules/architecture/feature-refactoring-cleanup.md +87 -0
  105. package/.claude/rules/architecture/model-management.md +35 -0
  106. package/.claude/rules/code-style/naming-conventions.md +55 -0
  107. package/.claude/rules/security/security-patterns.md +116 -0
  108. package/.claude/skills/.gitkeep +0 -0
  109. package/.claude/skills/README.md +131 -0
  110. package/.claude/skills/_template/commands/.gitkeep +0 -0
  111. package/.claude/skills/_template/knowledge/anti-patterns.md +49 -0
  112. package/.claude/skills/_template/knowledge/learnings.md +60 -0
  113. package/.claude/skills/_template/knowledge/patterns.md +45 -0
  114. package/.claude/skills/_template/rules/.gitkeep +0 -0
  115. package/.claude/skills/_template/skill.md +99 -0
  116. package/.claude/skills/_template/templates/.gitkeep +0 -0
  117. package/.claude/skills/figma-analyzer/knowledge/anti-patterns.md +216 -0
  118. package/.claude/skills/figma-analyzer/knowledge/patterns.md +144 -0
  119. package/.claude/skills/figma-analyzer/skill.md +236 -0
  120. package/lib/installer.js +59 -19
  121. package/package.json +5 -1
@@ -0,0 +1,199 @@
1
+ # Self-Improvement & Learning
2
+
3
+ How WogiFlow learns and improves over time through feedback, corrections, and pattern recognition.
4
+
5
+ ---
6
+
7
+ ## The Learning System
8
+
9
+ WogiFlow learns at four levels:
10
+
11
+ ```
12
+ ┌─────────────────────────────────────────────────────────────────────┐
13
+ │ LEARNING HIERARCHY │
14
+ ├─────────────────────────────────────────────────────────────────────┤
15
+ │ │
16
+ │ ┌───────────────┐ │
17
+ │ │ 4. Team Level │ ← Cross-project patterns, shared knowledge │
18
+ │ └───────┬───────┘ │
19
+ │ │ │
20
+ │ ┌───────▼───────┐ │
21
+ │ │ 3. Model Level│ ← Per-model optimizations, error patterns │
22
+ │ └───────┬───────┘ │
23
+ │ │ │
24
+ │ ┌───────▼───────┐ │
25
+ │ │ 2. Skill Level│ ← Framework patterns, anti-patterns │
26
+ │ └───────┬───────┘ │
27
+ │ │ │
28
+ │ ┌───────▼───────┐ │
29
+ │ │1. Project Level│ ← decisions.md, feedback patterns │
30
+ │ └───────────────┘ │
31
+ │ │
32
+ └─────────────────────────────────────────────────────────────────────┘
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Why Learning Matters
38
+
39
+ **The Problem**: AI makes the same mistakes repeatedly because it doesn't remember corrections.
40
+
41
+ **The Solution**: WogiFlow captures corrections and patterns, then applies them to future work:
42
+ - Corrections update decisions.md
43
+ - Patterns are extracted into skills
44
+ - Model-specific behaviors are adapted
45
+ - Team knowledge is shared
46
+
47
+ ---
48
+
49
+ ## Quick Start
50
+
51
+ ### Enable Learning
52
+
53
+ ```json
54
+ {
55
+ "skillLearning": {
56
+ "enabled": true,
57
+ "autoExtract": true,
58
+ "autoCreateSkills": "ask"
59
+ }
60
+ }
61
+ ```
62
+
63
+ ### Trigger Learning
64
+
65
+ - **Automatic**: On task completion, commits, compaction
66
+ - **Manual**: Correction reports, feedback patterns
67
+
68
+ ### View Learnings
69
+
70
+ ```bash
71
+ # View current decisions
72
+ cat .workflow/state/decisions.md
73
+
74
+ # View feedback patterns
75
+ cat .workflow/state/feedback-patterns.md
76
+
77
+ # View skill learnings
78
+ cat .claude/skills/*/knowledge/patterns.md
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Features in This Category
84
+
85
+ | Feature | Purpose |
86
+ |---------|---------|
87
+ | [Project Learning](./project-learning.md) | decisions.md updates, feedback patterns |
88
+ | [Skill Learning](./skill-learning.md) | Framework patterns, skill creation |
89
+ | [Model Learning](./model-learning.md) | Per-model optimization, adapters |
90
+ | [Team Learning](./team-learning.md) | Knowledge routing, promotion |
91
+
92
+ ---
93
+
94
+ ## Key Configuration
95
+
96
+ ```json
97
+ {
98
+ "skillLearning": {
99
+ "enabled": true,
100
+ "autoExtract": true,
101
+ "triggers": {
102
+ "onCommit": true,
103
+ "onTaskComplete": true,
104
+ "onCompact": true
105
+ },
106
+ "minCorrectionsToLearn": 1,
107
+ "autoCreateSkills": "ask"
108
+ },
109
+ "modelAdapters": {
110
+ "enabled": true,
111
+ "autoLearn": true
112
+ },
113
+ "knowledgeRouting": {
114
+ "autoDetect": true,
115
+ "confirmWithUser": true,
116
+ "defaultScope": "local"
117
+ }
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ## The Feedback Loop
124
+
125
+ ```
126
+ User Corrects AI
127
+
128
+ ┌─────────────────────────────────────────┐
129
+ │ 1. Fix the immediate issue │
130
+ ├─────────────────────────────────────────┤
131
+ │ 2. Offer to persist correction │
132
+ │ - decisions.md (project) │
133
+ │ - agents/*.md (personas) │
134
+ │ - config.json (behavior) │
135
+ │ - .claude/skills/*/patterns.md (framework) │
136
+ ├─────────────────────────────────────────┤
137
+ │ 3. Update selected location │
138
+ ├─────────────────────────────────────────┤
139
+ │ 4. Log to feedback-patterns.md │
140
+ ├─────────────────────────────────────────┤
141
+ │ 5. Commit learning │
142
+ └─────────────────────────────────────────┘
143
+
144
+ Future work uses new knowledge
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Learning Locations
150
+
151
+ | What | Where | Updated By |
152
+ |------|-------|------------|
153
+ | Coding patterns | `decisions.md` | AI + User |
154
+ | Agent behaviors | `agents/*.md` | AI + User |
155
+ | Config settings | `config.json` | AI + User |
156
+ | Framework patterns | `.claude/skills/*/patterns.md` | AI |
157
+ | Model behaviors | `model-adapters/*.md` | System |
158
+ | Feedback history | `feedback-patterns.md` | System |
159
+
160
+ ---
161
+
162
+ ## Correction Types
163
+
164
+ | Type | Example | Persists To |
165
+ |------|---------|-------------|
166
+ | Pattern | "Always use axios wrapper" | decisions.md |
167
+ | Style | "Don't use semicolons" | decisions.md |
168
+ | Architecture | "Services go in /services" | decisions.md |
169
+ | Framework | "NestJS uses decorators" | .claude/skills/nestjs/patterns.md |
170
+ | Behavior | "Ask before deleting files" | config.json |
171
+ | Agent | "Tester should mock external APIs" | agents/tester.md |
172
+
173
+ ---
174
+
175
+ ## Commands
176
+
177
+ | Command | Purpose |
178
+ |---------|---------|
179
+ | `/wogi-skill-learn` | Trigger learning extraction |
180
+ | `/wogi-correction` | Create detailed correction report |
181
+ | `/wogi-rules` | View and manage project rules |
182
+
183
+ ---
184
+
185
+ ## Best Practices
186
+
187
+ 1. **Correct Once, Persist Forever**: Always choose to persist corrections
188
+ 2. **Be Specific**: "Use axios from lib/api" not just "use axios"
189
+ 3. **Review Learnings**: Periodically check decisions.md for accuracy
190
+ 4. **Share Team Patterns**: Promote valuable patterns to team level
191
+ 5. **Clean Up Outdated**: Remove patterns that no longer apply
192
+
193
+ ---
194
+
195
+ ## Related
196
+
197
+ - [Task Execution](../02-task-execution/) - Where learnings are applied
198
+ - [Memory & Context](../04-memory-context/) - How learnings are stored
199
+ - [Configuration](../configuration/all-options.md) - Learning settings
@@ -0,0 +1,160 @@
1
+ # Long Input Processing
2
+
3
+ <!-- PINS: overview, gate-system, content-classification, processing-modes -->
4
+
5
+ A smart gate system for processing large inputs (transcripts, specs, requirements) with automatic content classification.
6
+
7
+ ---
8
+
9
+ ## Overview
10
+ <!-- PIN: overview -->
11
+
12
+ The Long Input Processing system automatically detects and handles large inputs using a gate mechanism that:
13
+
14
+ 1. **Checks input size** against configurable thresholds
15
+ 2. **Classifies content type** (transcript, spec, requirements, code)
16
+ 3. **Recommends processing mode** based on content type
17
+ 4. **Triggers appropriate extraction** when needed
18
+
19
+ This replaces the old `/transcript-digestion` skill with a more flexible, automatic approach.
20
+
21
+ ---
22
+
23
+ ## The Gate System
24
+ <!-- PIN: gate-system -->
25
+
26
+ ```
27
+ User Input → Long Input Gate → Content Classification → Processing Mode
28
+ ↓ ↓ ↓
29
+ Check thresholds Detect type full|quick|skip|ask
30
+ ```
31
+
32
+ ### Thresholds
33
+
34
+ | Metric | Default | Description |
35
+ |--------|---------|-------------|
36
+ | `charThreshold` | 2000 | Characters to trigger gate |
37
+ | `lineThreshold` | 50 | Lines to trigger gate |
38
+
39
+ ### When Gate Triggers
40
+
41
+ The gate activates when input exceeds **either** threshold, then classifies content to determine action.
42
+
43
+ ---
44
+
45
+ ## Content Classification
46
+ <!-- PIN: content-classification -->
47
+
48
+ The system auto-detects content type using pattern matching:
49
+
50
+ | Type | Patterns Detected |
51
+ |------|-------------------|
52
+ | `transcript` | Meeting notes, speaker labels, timestamps |
53
+ | `spec` | PRD language, "must/shall/should", acceptance criteria |
54
+ | `requirements` | Feature requests, user stories, "as a...I want..." |
55
+ | `code` | Import statements, syntax patterns, file extensions |
56
+
57
+ ---
58
+
59
+ ## Processing Modes
60
+ <!-- PIN: processing-modes -->
61
+
62
+ | Mode | Description | When Used |
63
+ |------|-------------|-----------|
64
+ | `full` | Complete 4-pass extraction with clarifications | Transcripts, specs, requirements |
65
+ | `quick` | Fast single-pass scan | Unknown content types |
66
+ | `skip` | No extraction | Code content |
67
+ | `ask` | Prompt user to choose | When `smartDefault` is disabled |
68
+
69
+ ### The 4-Pass Algorithm (Full Mode)
70
+
71
+ 1. **Pass 1: Topic Extraction** - Identify distinct features/themes
72
+ 2. **Pass 2: Statement Association** - Map every statement to a topic
73
+ 3. **Pass 3: Orphan Check** - Find unmapped statements, ensure 100% coverage
74
+ 4. **Pass 4: Contradiction Resolution** - Detect mind-changes, ask for clarification
75
+
76
+ ---
77
+
78
+ ## Configuration
79
+
80
+ ```json
81
+ {
82
+ "longInputGate": {
83
+ "enabled": true,
84
+ "charThreshold": 2000,
85
+ "lineThreshold": 50,
86
+ "smartDefault": true,
87
+ "contentRules": {
88
+ "transcript": "full",
89
+ "spec": "full",
90
+ "requirements": "full",
91
+ "code": "skip",
92
+ "default": "quick"
93
+ },
94
+ "supportedLanguages": ["en", "uk", "ru", "he"]
95
+ }
96
+ }
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Integration with Voice Input
102
+
103
+ Voice recordings flow through the system as:
104
+
105
+ ```
106
+ Voice Recording → Task Creation → Long Input Gate → Processing
107
+ ```
108
+
109
+ Not directly to processing - the gate decides based on content.
110
+
111
+ ---
112
+
113
+ ## Scripts
114
+
115
+ | Script | Purpose |
116
+ |--------|---------|
117
+ | `flow-long-input.js` | Main processing logic |
118
+ | `flow-long-input-chunking.js` | Handle large inputs via chunking |
119
+ | `flow-long-input-language.js` | Multi-language support |
120
+ | `flow-long-input-parsing.js` | VTT/SRT/transcript parsing |
121
+ | `flow-long-input-stories.js` | Story generation from extracted requirements |
122
+ | `hooks/core/long-input-gate.js` | Gate hook for automatic detection |
123
+
124
+ ---
125
+
126
+ ## Migration from transcript-digestion
127
+ <!-- PIN: migration -->
128
+
129
+ The old `/transcript-digestion` skill has been replaced with automatic detection:
130
+
131
+ | Old | New |
132
+ |-----|-----|
133
+ | `/transcript-digestion` command | Automatic via long-input-gate |
134
+ | `transcriptDigestion` config | `longInputGate` config |
135
+ | Skill-based invocation | Hook-based detection |
136
+ | `.claude/skills/transcript-digestion/` | (deleted) |
137
+
138
+ ### Migration Steps
139
+
140
+ If upgrading from an older version:
141
+
142
+ 1. **Update config**: Rename `transcriptDigestion` → `longInputGate` in `.workflow/config.json`
143
+ 2. **Remove old skill**: Delete `.claude/skills/transcript-digestion/` if it exists
144
+ 3. **Remove from installed**: Remove `transcript-digestion` from `skills.installed` array
145
+ 4. **No action needed**: The new system is automatic - no slash command needed
146
+
147
+ ### Backward Compatibility
148
+
149
+ The system will recognize the old `transcriptDigestion` config key and warn about migration, but new installations should use `longInputGate`.
150
+
151
+ ---
152
+
153
+ ## Related
154
+
155
+ - [Voice Input](../05-development-tools/voice-input.md) - Recording transcripts
156
+ - [Task Execution](../02-task-execution/02-execution-loop.md) - How tasks flow through gates
157
+
158
+ ---
159
+
160
+ Last updated: 2026-01-14
@@ -0,0 +1,334 @@
1
+ # Model-Level Learning
2
+
3
+ Per-model optimization, adapters, and error pattern learning.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Different LLMs have different behaviors:
10
+ - Claude excels at reasoning
11
+ - Local models may struggle with complex types
12
+ - Some models output markdown when code is expected
13
+
14
+ Model adapters learn these behaviors and optimize prompts accordingly.
15
+
16
+ ---
17
+
18
+ ## Configuration
19
+
20
+ ```json
21
+ {
22
+ "modelAdapters": {
23
+ "enabled": true,
24
+ "autoLearn": true,
25
+ "directory": ".workflow/model-adapters"
26
+ }
27
+ }
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Model Adapter Structure
33
+
34
+ ```
35
+ .workflow/model-adapters/
36
+ ├── claude-sonnet.json
37
+ ├── qwen3-coder.json
38
+ ├── gpt-4o-mini.json
39
+ └── llama-3.json
40
+ ```
41
+
42
+ ### Adapter Content
43
+
44
+ ```json
45
+ {
46
+ "modelId": "qwen3-coder",
47
+ "lastUpdated": "2024-01-15T10:30:00Z",
48
+ "stats": {
49
+ "totalRequests": 150,
50
+ "successRate": 0.87,
51
+ "avgRetries": 1.3
52
+ },
53
+ "behaviors": {
54
+ "outputFormat": {
55
+ "tendency": "markdown-wrapped",
56
+ "adjustment": "Specify: Output ONLY code, no markdown"
57
+ },
58
+ "typeHandling": {
59
+ "tendency": "struggles-with-generics",
60
+ "adjustment": "Simplify complex types in prompt"
61
+ }
62
+ },
63
+ "errorPatterns": [
64
+ {
65
+ "signature": "unexpected-markdown",
66
+ "frequency": 23,
67
+ "recovery": "strip-markdown-fences"
68
+ },
69
+ {
70
+ "signature": "import-not-found",
71
+ "frequency": 15,
72
+ "recovery": "provide-import-paths"
73
+ }
74
+ ],
75
+ "promptAdjustments": {
76
+ "prefix": "Output ONLY TypeScript code. No explanations.",
77
+ "suffix": "",
78
+ "temperature": 0.5
79
+ }
80
+ }
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Auto-Learning
86
+
87
+ When `autoLearn` is enabled:
88
+
89
+ ```
90
+ Request to LLM
91
+
92
+ Success/Failure recorded
93
+
94
+ ┌─────────────────────────────────────────┐
95
+ │ Analyze error patterns │
96
+ │ - Same error 3+ times? │
97
+ │ - Known fix available? │
98
+ │ - Prompt adjustment helps? │
99
+ └─────────────────────────────────────────┘
100
+
101
+ Update model adapter
102
+
103
+ Apply learnings to future requests
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Error Categories
109
+
110
+ | Category | Description | Recovery |
111
+ |----------|-------------|----------|
112
+ | `import` | Import path errors | Provide explicit paths |
113
+ | `type` | Type mismatches | Simplify types |
114
+ | `syntax` | Markdown in output | Strip formatting |
115
+ | `runtime` | Logic errors | Add validation |
116
+ | `unknown` | Unclassified | Log for analysis |
117
+
118
+ ---
119
+
120
+ ## Adaptive Learning
121
+
122
+ From `flow-adaptive-learning.js`:
123
+
124
+ ### Error Analysis
125
+
126
+ ```javascript
127
+ analyzeFailure(error, context) {
128
+ // Categorize the error
129
+ // Extract signature
130
+ // Check against known patterns
131
+ // Suggest recovery strategy
132
+ }
133
+ ```
134
+
135
+ ### Prompt Refinement
136
+
137
+ ```javascript
138
+ refinePromptForRetry(originalPrompt, errorHistory) {
139
+ // Learn from failure pattern
140
+ // Adjust prompt for retry
141
+ // Apply model-specific fixes
142
+ }
143
+ ```
144
+
145
+ ### Success Recording
146
+
147
+ ```javascript
148
+ recordSuccessfulRecovery(modelId, errorSignature, recoveryStrategy) {
149
+ // Track what worked
150
+ // Update adapter with learning
151
+ // Improve future success rate
152
+ }
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Prompt Adjustments
158
+
159
+ Model adapters can modify prompts:
160
+
161
+ ### Prefix Adjustments
162
+
163
+ ```json
164
+ {
165
+ "promptAdjustments": {
166
+ "prefix": "You are a code generator. Output ONLY valid TypeScript code."
167
+ }
168
+ }
169
+ ```
170
+
171
+ ### Temperature Adjustments
172
+
173
+ ```json
174
+ {
175
+ "promptAdjustments": {
176
+ "temperature": 0.3 // Lower for more deterministic output
177
+ }
178
+ }
179
+ ```
180
+
181
+ ### Context Window
182
+
183
+ ```json
184
+ {
185
+ "promptAdjustments": {
186
+ "maxContextTokens": 4096 // Limit for smaller models
187
+ }
188
+ }
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Recovery Strategies
194
+
195
+ When errors occur, adapters suggest recovery:
196
+
197
+ ### Markdown Stripping
198
+
199
+ For models that wrap code in markdown:
200
+ ```javascript
201
+ if (errorCategory === 'syntax' && signature === 'unexpected-markdown') {
202
+ // Strip ```typescript and ``` fences
203
+ code = code.replace(/```\w*\n?/g, '');
204
+ }
205
+ ```
206
+
207
+ ### Import Path Resolution
208
+
209
+ For import errors:
210
+ ```javascript
211
+ if (errorCategory === 'import') {
212
+ // Provide explicit import map in retry prompt
213
+ prompt += `\n\nAvailable imports:\n${formatImportMap()}`;
214
+ }
215
+ ```
216
+
217
+ ### Type Simplification
218
+
219
+ For type errors:
220
+ ```javascript
221
+ if (errorCategory === 'type') {
222
+ // Simplify generic types in prompt
223
+ prompt = simplifyTypes(prompt);
224
+ }
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Hybrid Mode Integration
230
+
231
+ Model adapters are crucial for hybrid mode:
232
+
233
+ ```json
234
+ {
235
+ "hybrid": {
236
+ "planner": {
237
+ "adaptToExecutor": true, // Use adapter knowledge
238
+ "useAdapterKnowledge": true
239
+ }
240
+ }
241
+ }
242
+ ```
243
+
244
+ ### How It Works
245
+
246
+ 1. **Plan Creation**: Claude creates detailed plan
247
+ 2. **Adapter Lookup**: Find adapter for executor model
248
+ 3. **Prompt Adjustment**: Apply model-specific modifications
249
+ 4. **Execution**: Send optimized prompt to local LLM
250
+ 5. **Error Handling**: Use adapter's recovery strategies
251
+ 6. **Learning**: Record outcomes for future improvement
252
+
253
+ ---
254
+
255
+ ## Statistics Tracking
256
+
257
+ ```json
258
+ {
259
+ "stats": {
260
+ "totalRequests": 150,
261
+ "successRate": 0.87,
262
+ "avgRetries": 1.3,
263
+ "errorBreakdown": {
264
+ "import": 15,
265
+ "type": 8,
266
+ "syntax": 23,
267
+ "runtime": 4
268
+ }
269
+ }
270
+ }
271
+ ```
272
+
273
+ Used for:
274
+ - Identifying problematic patterns
275
+ - Measuring improvement over time
276
+ - Choosing best model for task type
277
+
278
+ ---
279
+
280
+ ## Manual Adapter Configuration
281
+
282
+ Create custom adapter:
283
+
284
+ ```bash
285
+ cat > .workflow/model-adapters/custom-model.json << 'EOF'
286
+ {
287
+ "modelId": "custom-model",
288
+ "behaviors": {
289
+ "outputFormat": {
290
+ "tendency": "verbose-explanations",
291
+ "adjustment": "Be concise. Code only."
292
+ }
293
+ },
294
+ "promptAdjustments": {
295
+ "prefix": "You are a TypeScript expert. Output clean, typed code.",
296
+ "temperature": 0.4
297
+ }
298
+ }
299
+ EOF
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Viewing Model Performance
305
+
306
+ ```bash
307
+ # Check adapter stats
308
+ cat .workflow/model-adapters/qwen3-coder.json | jq '.stats'
309
+
310
+ # Output:
311
+ # {
312
+ # "totalRequests": 150,
313
+ # "successRate": 0.87,
314
+ # "avgRetries": 1.3
315
+ # }
316
+ ```
317
+
318
+ ---
319
+
320
+ ## Best Practices
321
+
322
+ 1. **Let Auto-Learn Work**: Don't manually edit adapters frequently
323
+ 2. **Review Error Patterns**: Check what's failing most
324
+ 3. **Test Different Models**: Some models work better for certain tasks
325
+ 4. **Lower Temperature**: For code generation, 0.3-0.5 is often better
326
+ 5. **Provide Clear Examples**: Models learn from explicit patterns
327
+
328
+ ---
329
+
330
+ ## Related
331
+
332
+ - [Project Learning](./project-learning.md) - Project-specific patterns
333
+ - [Skill Learning](./skill-learning.md) - Framework patterns
334
+ - [Hybrid Mode](../02-task-execution/02-execution-loop.md#hybrid-mode)