groundswell 0.0.1

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 (120) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/.claude/system_prompts/task-breakdown.md +100 -0
  3. package/PRPs/001-hierarchical-workflow-engine.md +2438 -0
  4. package/PRPs/PRDs/001-hierarchical-workflow-engine.md +543 -0
  5. package/PRPs/PRDs/002-agent-prompt.md +390 -0
  6. package/PRPs/PRDs/003-agent-prompt.md +943 -0
  7. package/PRPs/PRDs/004-agent-prompt.md +1136 -0
  8. package/PRPs/PRDs/tasks-001.json +492 -0
  9. package/PRPs/README.md +83 -0
  10. package/PRPs/templates/prp_base.md +222 -0
  11. package/README.md +218 -0
  12. package/docs/agent.md +422 -0
  13. package/docs/prompt.md +419 -0
  14. package/docs/workflow.md +600 -0
  15. package/examples/README.md +244 -0
  16. package/examples/examples/01-basic-workflow.ts +100 -0
  17. package/examples/examples/02-decorator-options.ts +217 -0
  18. package/examples/examples/03-parent-child.ts +241 -0
  19. package/examples/examples/04-observers-debugger.ts +340 -0
  20. package/examples/examples/05-error-handling.ts +387 -0
  21. package/examples/examples/06-concurrent-tasks.ts +352 -0
  22. package/examples/examples/07-agent-loops.ts +432 -0
  23. package/examples/examples/08-sdk-features.ts +667 -0
  24. package/examples/examples/09-reflection.ts +573 -0
  25. package/examples/examples/10-introspection.ts +550 -0
  26. package/examples/index.ts +143 -0
  27. package/examples/utils/helpers.ts +57 -0
  28. package/llms_full.txt +5890 -0
  29. package/package.json +63 -0
  30. package/plan/P1P2/PRP.md +527 -0
  31. package/plan/P1P2/research/LRU_CACHE_BEST_PRACTICES.md +1929 -0
  32. package/plan/P1P2/research/LRU_CACHE_CODE_PATTERNS.md +857 -0
  33. package/plan/P1P2/research/LRU_CACHE_INTEGRATION_GUIDE.md +738 -0
  34. package/plan/P1P2/research/LRU_CACHE_RESEARCH_INDEX.md +424 -0
  35. package/plan/P1P2/research/REFLECTION_INDEX.md +291 -0
  36. package/plan/P1P2/research/REFLECTION_RESEARCH_REPORT.md +1342 -0
  37. package/plan/P1P2/research/RESEARCH_SUMMARY.md +342 -0
  38. package/plan/P1P2/research/anthropic-sdk.md +174 -0
  39. package/plan/P1P2/research/async-local-storage.md +200 -0
  40. package/plan/P1P2/research/reflection-code-patterns.md +1205 -0
  41. package/plan/P1P2/research/reflection-decision-matrix.md +421 -0
  42. package/plan/P1P2/research/reflection-implementation-guide.md +1341 -0
  43. package/plan/P1P2/research/reflection-integration-guide.md +834 -0
  44. package/plan/P1P2/research/reflection-patterns.md +1468 -0
  45. package/plan/P1P2/research/reflection-quick-reference.md +558 -0
  46. package/plan/P1P2/research/zod-schema.md +152 -0
  47. package/plan/P3P4/PRP.md +1388 -0
  48. package/plan/P3P4/research/caching-lru.md +116 -0
  49. package/plan/P3P4/research/introspection-tools.md +177 -0
  50. package/plan/P3P4/research/reflection-patterns.md +117 -0
  51. package/plan/P4P5/PRP.md +1136 -0
  52. package/plan/P4P5/research/RESEARCH_SUMMARY.md +151 -0
  53. package/plan/architecture/external_deps.md +358 -0
  54. package/plan/architecture/system_context.md +242 -0
  55. package/plan/backlog.json +867 -0
  56. package/plan/research/INTROSPECTION_RESEARCH_SUMMARY.md +378 -0
  57. package/plan/research/README-INTROSPECTION.md +352 -0
  58. package/plan/research/agent-introspection-patterns.md +1085 -0
  59. package/plan/research/introspection-security-guide.md +928 -0
  60. package/plan/research/introspection-tool-examples.md +875 -0
  61. package/scripts/generate-llms-full.ts +206 -0
  62. package/src/__tests__/integration/agent-workflow.test.ts +256 -0
  63. package/src/__tests__/integration/tree-mirroring.test.ts +114 -0
  64. package/src/__tests__/unit/agent.test.ts +169 -0
  65. package/src/__tests__/unit/cache-key.test.ts +182 -0
  66. package/src/__tests__/unit/cache.test.ts +172 -0
  67. package/src/__tests__/unit/context.test.ts +138 -0
  68. package/src/__tests__/unit/decorators.test.ts +100 -0
  69. package/src/__tests__/unit/introspection-tools.test.ts +277 -0
  70. package/src/__tests__/unit/prompt.test.ts +135 -0
  71. package/src/__tests__/unit/reflection.test.ts +210 -0
  72. package/src/__tests__/unit/tree-debugger.test.ts +85 -0
  73. package/src/__tests__/unit/workflow.test.ts +81 -0
  74. package/src/cache/cache-key.ts +244 -0
  75. package/src/cache/cache.ts +236 -0
  76. package/src/cache/index.ts +8 -0
  77. package/src/core/agent.ts +573 -0
  78. package/src/core/context.ts +119 -0
  79. package/src/core/event-tree.ts +260 -0
  80. package/src/core/factory.ts +123 -0
  81. package/src/core/index.ts +17 -0
  82. package/src/core/logger.ts +87 -0
  83. package/src/core/mcp-handler.ts +184 -0
  84. package/src/core/prompt.ts +150 -0
  85. package/src/core/workflow-context.ts +349 -0
  86. package/src/core/workflow.ts +302 -0
  87. package/src/debugger/index.ts +1 -0
  88. package/src/debugger/tree-debugger.ts +210 -0
  89. package/src/decorators/index.ts +3 -0
  90. package/src/decorators/observed-state.ts +95 -0
  91. package/src/decorators/step.ts +139 -0
  92. package/src/decorators/task.ts +96 -0
  93. package/src/examples/index.ts +2 -0
  94. package/src/examples/tdd-orchestrator.ts +65 -0
  95. package/src/examples/test-cycle-workflow.ts +64 -0
  96. package/src/index.ts +140 -0
  97. package/src/reflection/index.ts +5 -0
  98. package/src/reflection/reflection.ts +407 -0
  99. package/src/tools/index.ts +36 -0
  100. package/src/tools/introspection.ts +464 -0
  101. package/src/types/agent.ts +90 -0
  102. package/src/types/decorators.ts +25 -0
  103. package/src/types/error-strategy.ts +13 -0
  104. package/src/types/error.ts +20 -0
  105. package/src/types/events.ts +74 -0
  106. package/src/types/index.ts +55 -0
  107. package/src/types/logging.ts +24 -0
  108. package/src/types/observer.ts +18 -0
  109. package/src/types/prompt.ts +40 -0
  110. package/src/types/reflection.ts +117 -0
  111. package/src/types/sdk-primitives.ts +128 -0
  112. package/src/types/snapshot.ts +14 -0
  113. package/src/types/workflow-context.ts +163 -0
  114. package/src/types/workflow.ts +37 -0
  115. package/src/utils/id.ts +11 -0
  116. package/src/utils/index.ts +3 -0
  117. package/src/utils/observable.ts +77 -0
  118. package/tasks.json +0 -0
  119. package/tsconfig.json +22 -0
  120. package/vitest.config.ts +16 -0
@@ -0,0 +1,421 @@
1
+ # Reflection Patterns - Decision Matrix & Quick Reference
2
+
3
+ ## Quick Decision Tree
4
+
5
+ ```
6
+ Does your task need reflection?
7
+
8
+ ├─ Is it a critical decision (code, logic, policy)?
9
+ │ ├─ YES → Use reflection
10
+ │ └─ NO → Go to next
11
+
12
+ ├─ Can it fail in ways that need recovery?
13
+ │ ├─ YES → Use error-triggered reflection
14
+ │ └─ NO → Go to next
15
+
16
+ ├─ Does output quality vary significantly?
17
+ │ ├─ YES → Use validation or confidence-based reflection
18
+ │ └─ NO → Go to next
19
+
20
+ ├─ Do you have token/latency budget?
21
+ │ ├─ YES → Use appropriate pattern
22
+ │ └─ NO → Skip reflection or use budget-conscious pattern
23
+
24
+ └─ Not recommended for reflection
25
+ ```
26
+
27
+ ## Pattern Comparison Matrix
28
+
29
+ | Aspect | Simple | Multi-Attempt | Error-Triggered | Validation | Confidence | Tool-Feedback | Multi-Agent | State-Aware | Budget-Conscious | Timeout-Safe |
30
+ |--------|--------|----------------|-----------------|-----------|------------|---------------|-------------|------------|------------------|--------------|
31
+ | **Complexity** | 1/5 | 2/5 | 2/5 | 3/5 | 3/5 | 4/5 | 4/5 | 4/5 | 1/5 | 2/5 |
32
+ | **Latency** | +200ms | +400ms | +500ms | +400ms | +600ms | +800ms | +1000ms | +700ms | +200ms | Variable |
33
+ | **Token Cost** | +1x | +1.5x | +2x | +1.5x | +2x | +3x | +4x | +2.5x | +0.5x | +1.5x |
34
+ | **Reliability** | 3/5 | 4/5 | 4/5 | 5/5 | 4/5 | 5/5 | 5/5 | 5/5 | 2/5 | 4/5 |
35
+ | **Observability** | 2/5 | 3/5 | 4/5 | 4/5 | 3/5 | 4/5 | 4/5 | 5/5 | 1/5 | 3/5 |
36
+ | **Development Effort** | Low | Low | Medium | Medium | Medium | High | High | High | Low | Low |
37
+ | **Production Ready** | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes |
38
+ | **Testing Difficulty** | Easy | Easy | Medium | Medium | Medium | Hard | Hard | Hard | Easy | Medium |
39
+
40
+ ## Task Type → Pattern Mapping
41
+
42
+ ### Data/Content Generation Tasks
43
+
44
+ | Task | Best Pattern | Alternative | Avoid |
45
+ |------|-------------|------------|-------|
46
+ | Writing essays | Multi-Agent | Confidence | Simple |
47
+ | Code generation | Tool-Feedback | Multi-Agent | Simple |
48
+ | Data transformation | Validation | Error-Triggered | Confidence |
49
+ | Summary generation | Confidence | Simple | Tool-Feedback |
50
+
51
+ **Rationale**: Content quality is subjective and improves with review. Tool-feedback provides objective validation. Multi-agent adds diverse perspective.
52
+
53
+ ### Analysis & Decision Tasks
54
+
55
+ | Task | Best Pattern | Alternative | Avoid |
56
+ |------|-------------|------------|-------|
57
+ | Root cause analysis | State-Aware | Multi-Agent | Simple |
58
+ | Risk assessment | Confidence | Validation | Simple |
59
+ | Recommendation | Multi-Agent | Confidence | Tool-Feedback |
60
+ | Diagnosis | Confidence | State-Aware | Simple |
61
+
62
+ **Rationale**: These tasks benefit from learning history and alternative perspectives. Confidence-based triggering prevents over-thinking.
63
+
64
+ ### Structured Output Tasks
65
+
66
+ | Task | Best Pattern | Alternative | Avoid |
67
+ |------|-------------|------------|-------|
68
+ | JSON generation | Validation | Tool-Feedback | Simple |
69
+ | Schema compliance | Validation | Error-Triggered | Confidence |
70
+ | Format conversion | Error-Triggered | Validation | Multi-Agent |
71
+ | Data validation | Validation | Validation | Simple |
72
+
73
+ **Rationale**: Explicit validation rules work best for structured output. Format issues are deterministic.
74
+
75
+ ### Real-Time/Low-Latency Tasks
76
+
77
+ | Task | Best Pattern | Alternative | Avoid |
78
+ |------|-------------|------------|-------|
79
+ | Chat responses | Skip Reflection | Budget-Conscious | All others |
80
+ | Autocomplete | Skip Reflection | Budget-Conscious | All others |
81
+ | Search results | Timeout-Safe | Simple | Multi-Agent |
82
+ | Quick lookups | Skip Reflection | Timeout-Safe | All others |
83
+
84
+ **Rationale**: Latency is critical. Either skip reflection or use timeout-safe/budget-conscious with strict limits.
85
+
86
+ ### Complex/High-Stakes Tasks
87
+
88
+ | Task | Best Pattern | Alternative | Avoid |
89
+ |------|-------------|------------|-------|
90
+ | Security decisions | Multi-Agent | State-Aware | Simple |
91
+ | System architecture | State-Aware | Multi-Agent | Simple |
92
+ | Critical fixes | Tool-Feedback | State-Aware | Simple |
93
+ | Strategic planning | Multi-Agent | State-Aware | Simple |
94
+
95
+ **Rationale**: High stakes justify higher cost and latency. Multiple perspectives reduce risk of critical errors.
96
+
97
+ ### Learning/Iterative Tasks
98
+
99
+ | Task | Best Pattern | Alternative | Avoid |
100
+ |------|-------------|------------|-------|
101
+ | Test-driven development | Tool-Feedback | State-Aware | Simple |
102
+ | Continuous refinement | State-Aware | Multi-Agent | Simple |
103
+ | Error recovery | Error-Triggered | State-Aware | Simple |
104
+ | Multi-step problem solving | State-Aware | Multi-Agent | Simple |
105
+
106
+ **Rationale**: State-aware patterns capture learning and avoid repeated mistakes. Tool-feedback provides objective metrics.
107
+
108
+ ## Framework Selection Guide
109
+
110
+ ### LangChain/LangGraph
111
+ **When**: Building graph-based agentic systems with complex state management
112
+ **Strengths**:
113
+ - Built-in reflection patterns (Reflexion, LATS)
114
+ - Native state management
115
+ - Rich integrations with tools
116
+
117
+ **Patterns to use**:
118
+ - Multi-Agent Reflection
119
+ - Tool-Feedback Reflection
120
+ - State-Aware Reflection
121
+
122
+ **Cost**: Highest (multiple nodes, state management overhead)
123
+
124
+ **Example**:
125
+ ```python
126
+ from langgraph.graph import StateGraph
127
+
128
+ graph = StateGraph(AgentState)
129
+ graph.add_node("generate", generate_node)
130
+ graph.add_node("reflect", reflect_node)
131
+ graph.add_edge("generate", "reflect")
132
+ graph.add_conditional_edges("reflect", ...)
133
+ ```
134
+
135
+ ---
136
+
137
+ ### Anthropic/Claude (Direct API)
138
+ **When**: Building lightweight agents with simplicity prioritized
139
+ **Strengths**:
140
+ - Simpler to understand and implement
141
+ - Extended thinking for self-reflection
142
+ - Lower overhead
143
+
144
+ **Patterns to use**:
145
+ - Simple Reflection
146
+ - Error-Triggered Reflection
147
+ - Confidence-Based Reflection
148
+ - Budget-Conscious Reflection
149
+
150
+ **Cost**: Lower (direct API calls only)
151
+
152
+ **Recommendation**: Start here for new projects
153
+
154
+ ---
155
+
156
+ ### Google ADK
157
+ **When**: Building agents with specialized reflect-and-retry plugin
158
+ **Strengths**:
159
+ - Purpose-built for reflection
160
+ - Concurrency-safe
161
+ - Custom error detection
162
+
163
+ **Patterns to use**:
164
+ - Error-Triggered Reflection
165
+ - Tool-Feedback Reflection
166
+
167
+ **Cost**: Medium
168
+
169
+ ---
170
+
171
+ ### Custom Implementation
172
+ **When**: Highly specialized requirements not met by frameworks
173
+ **Strengths**:
174
+ - Full control
175
+ - No overhead from unused features
176
+ - Optimized for specific use case
177
+
178
+ **Patterns to use**:
179
+ - Any pattern can be custom implemented
180
+ - Typically: Simple, Error-Triggered, Validation
181
+
182
+ **Cost**: High development cost, variable runtime cost
183
+
184
+ ---
185
+
186
+ ## Error Type → Recovery Strategy
187
+
188
+ | Error Type | Retry? | Reflection? | Backoff | Max Attempts |
189
+ |-----------|--------|-----------|---------|--------------|
190
+ | **Transient (timeout, rate limit)** | YES | NO | Exponential | 3-5 |
191
+ | **Logical (wrong approach)** | YES | YES | Linear | 2-3 |
192
+ | **Invalid Input (bad data)** | NO | NO | - | 0 |
193
+ | **Model Refusal (safety)** | NO | NO | - | 0 |
194
+ | **Resource Exhausted** | YES | NO | Exponential | 2 |
195
+ | **Validation Failed** | YES | YES | Linear | 3 |
196
+
197
+ **Implementation**:
198
+ ```typescript
199
+ async function handleError(error: Error, attempt: number) {
200
+ if (isTransient(error)) {
201
+ const delay = Math.pow(2, attempt) * 1000; // Exponential backoff
202
+ await sleep(delay);
203
+ return "retry";
204
+ }
205
+
206
+ if (isLogical(error)) {
207
+ const reflection = await reflect(error);
208
+ return "reflect_and_retry";
209
+ }
210
+
211
+ return "escalate";
212
+ }
213
+ ```
214
+
215
+ ## Confidence Thresholds
216
+
217
+ ### Recommended Thresholds by Task Type
218
+
219
+ | Task Type | Reflect Below | Safe Above |
220
+ |-----------|--------------|-----------|
221
+ | High-stakes decisions | 80% | 90% |
222
+ | Code generation | 75% | 85% |
223
+ | Data transformation | 70% | 80% |
224
+ | Analysis/reasoning | 75% | 85% |
225
+ | Summary generation | 65% | 75% |
226
+ | Real-time responses | 60% | 70% |
227
+
228
+ ### Implementing Confidence Thresholds
229
+
230
+ ```typescript
231
+ async function reflectIfUncertain(task: string, threshold: number = 0.75) {
232
+ const output = await generate(task);
233
+ const confidence = await assessConfidence(output);
234
+
235
+ if (confidence >= threshold) {
236
+ return output; // Skip reflection
237
+ }
238
+
239
+ return await improveWithReflection(task, output);
240
+ }
241
+
242
+ async function assessConfidence(output: string): Promise<number> {
243
+ // Methods:
244
+ // 1. Ask model explicitly
245
+ // 2. Use perplexity/entropy metrics
246
+ // 3. Check presence of hedging language
247
+ // 4. Token probability scores
248
+ // 5. Ensemble disagreement
249
+
250
+ // Simple implementation:
251
+ const response = await client.messages.create({
252
+ model: "claude-opus-4.5",
253
+ max_tokens: 100,
254
+ messages: [{
255
+ role: "user",
256
+ content: `Rate your confidence (0-1) in this response: ${output}`
257
+ }]
258
+ });
259
+
260
+ const confidence = parseFloat(response.content[0].text);
261
+ return isNaN(confidence) ? 0.5 : confidence;
262
+ }
263
+ ```
264
+
265
+ ## Cost-Benefit Analysis
266
+
267
+ ### When Reflection Is Cost-Effective
268
+
269
+ **Cost Multiplier Formula**:
270
+ ```
271
+ Total Cost = Base Cost × Max Attempts
272
+ Benefit = Improvement % × Task Value
273
+
274
+ Reflection is worth it when:
275
+ Benefit ≥ (Cost Multiplier - 1) × Base Cost × Success Probability
276
+ ```
277
+
278
+ ### Examples
279
+
280
+ **Example 1: Code Generation**
281
+ - Base cost: 1000 tokens
282
+ - Max attempts: 3 (3x cost multiplier)
283
+ - Base success: 60%
284
+ - With reflection: 90%
285
+ - Improvement: 30%
286
+ - Task value: 100 (critical code)
287
+
288
+ Calculation:
289
+ - Total cost: 1000 × 3 = 3000 tokens = $0.09 (at Sonnet pricing)
290
+ - Benefit: 30% × 100 = 30 points improvement
291
+ - Worth it? YES (low cost for significant improvement)
292
+
293
+ **Example 2: Chat Response**
294
+ - Base cost: 100 tokens
295
+ - Max attempts: 2 (2x cost multiplier)
296
+ - Base success: 90%
297
+ - With reflection: 95%
298
+ - Improvement: 5%
299
+ - Task value: 10 (low stakes)
300
+
301
+ Calculation:
302
+ - Total cost: 100 × 2 = 200 tokens = $0.006
303
+ - Benefit: 5% × 10 = 0.5 points improvement
304
+ - Worth it? NO (high cost relative to benefit)
305
+
306
+ ## Implementation Checklist
307
+
308
+ ### Pre-Implementation
309
+ - [ ] Define task success criteria (specific, measurable)
310
+ - [ ] Estimate baseline success rate
311
+ - [ ] Calculate acceptable latency increase
312
+ - [ ] Set token budget
313
+ - [ ] Identify error types that need recovery
314
+
315
+ ### Implementation
316
+ - [ ] Choose appropriate pattern(s)
317
+ - [ ] Set max attempts (typically 3)
318
+ - [ ] Implement error detection
319
+ - [ ] Add reflection prompts
320
+ - [ ] Implement state capture
321
+ - [ ] Add observability/logging
322
+ - [ ] Test error paths
323
+ - [ ] Test success paths
324
+ - [ ] Test max attempts exceeded
325
+
326
+ ### Testing
327
+ - [ ] Unit tests for each reflection type
328
+ - [ ] Integration tests with real API
329
+ - [ ] Load tests for concurrent reflection
330
+ - [ ] Cost tracking tests
331
+ - [ ] Latency benchmarks
332
+ - [ ] Effectiveness measurement
333
+
334
+ ### Monitoring
335
+ - [ ] Success rate without reflection
336
+ - [ ] Success rate with reflection
337
+ - [ ] Average attempts per task
338
+ - [ ] Reflection effectiveness %
339
+ - [ ] Total tokens per task
340
+ - [ ] Cost multiplier
341
+ - [ ] Latency impact
342
+ - [ ] Error type frequency
343
+
344
+ ### Production
345
+ - [ ] A/B test reflection vs no reflection
346
+ - [ ] Monitor effectiveness metrics
347
+ - [ ] Watch for cost overruns
348
+ - [ ] Set alerts for reflection failures
349
+ - [ ] Document success criteria met
350
+ - [ ] Plan iteration/optimization
351
+
352
+ ## Common Mistakes & Solutions
353
+
354
+ | Mistake | Impact | Solution |
355
+ |---------|--------|----------|
356
+ | No max attempts limit | Infinite loops, infinite cost | Always set `maxAttempts <= 5` |
357
+ | Reflecting on everything | High cost, slower responses | Use confidence triggers or error-only |
358
+ | Vague success criteria | Can't tell if reflection worked | Use specific, measurable criteria |
359
+ | No state capture | Can't learn from previous attempts | Capture input/output/error for each attempt |
360
+ | Reflecting too early | Premature optimization | Use multi-attempt loop, only reflect on repeated failures |
361
+ | Wrong error categorization | Wrong recovery strategy | Categorize errors (transient/logical/invalid) first |
362
+ | Not testing failure paths | Untested code in production | Always test max retries exhausted scenario |
363
+ | Insufficient logging | Can't debug failures | Log all attempts and reflections |
364
+ | No observability | Blind to what's happening | Emit events, track metrics |
365
+ | No cost tracking | Surprise high bills | Monitor tokens per task, set budgets |
366
+
367
+ ## Decision Framework
368
+
369
+ ### Should I Use Reflection for This Task?
370
+
371
+ **Start here**: Answer these 5 questions
372
+
373
+ 1. **How critical is correctness?**
374
+ - Critical (99%+): YES, use reflection
375
+ - Important (95%+): MAYBE, depends on other factors
376
+ - Nice-to-have: NO
377
+
378
+ 2. **What's the baseline success rate?**
379
+ - Low (<70%): YES, reflection can help
380
+ - Medium (70-90%): MAYBE, depends on improvement potential
381
+ - High (>90%): NO, already working well
382
+
383
+ 3. **How much time can you spend?**
384
+ - >1 second acceptable: YES
385
+ - 100-500ms: MAYBE, use lightweight patterns
386
+ - <100ms: NO, skip reflection
387
+
388
+ 4. **What's your token budget?**
389
+ - Unlimited: YES, use comprehensive reflection
390
+ - Limited (per-task): MAYBE, use cost-conscious pattern
391
+ - Very limited: NO, skip reflection
392
+
393
+ 5. **Can you measure improvement?**
394
+ - YES: Implement reflection with metrics
395
+ - NO: Skip, or first establish measurement
396
+
397
+ ### Scoring System
398
+
399
+ **Count YES answers:**
400
+ - 5/5: Implement comprehensive reflection
401
+ - 4/5: Implement moderate reflection
402
+ - 3/5: Implement lightweight reflection
403
+ - 2/5: Implement minimal reflection
404
+ - 0-1/5: Skip reflection
405
+
406
+ ---
407
+
408
+ ## Next Steps After Reading This
409
+
410
+ 1. **Start small**: Pick one task and implement Simple Reflection
411
+ 2. **Measure**: Track success rate, latency, cost
412
+ 3. **Evaluate**: Is improvement worth the cost?
413
+ 4. **Iterate**: Adjust pattern based on results
414
+ 5. **Scale**: Apply successful patterns to other tasks
415
+
416
+ ## Related Resources
417
+
418
+ - `reflection-patterns.md` - Comprehensive pattern documentation
419
+ - `reflection-code-patterns.md` - Copy-paste-ready implementations
420
+ - `reflection-integration-guide.md` - Integration with Groundswell framework
421
+