codingbuddy-rules 3.0.3 → 3.1.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.
@@ -5,6 +5,34 @@ All notable changes to the Multi-AI Coding Assistant Common Rules System will be
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.0] - 2026-01-22
9
+
10
+ ### Added
11
+
12
+ - **Self-Hosted Plugin Marketplace**
13
+ - Claude Code plugin marketplace with GitHub Pages deployment
14
+ - `codingbuddy marketplace add` command for plugin discovery
15
+ - Automatic GitHub Pages setup in CI workflow
16
+
17
+ - **SRP Complexity Classifier**
18
+ - Multi-language support for keyword complexity analysis
19
+ - Enhanced intent detection for PLAN mode agent selection
20
+
21
+ ### Fixed
22
+
23
+ - Auto mode detection for PLAN/ACT/EVAL/AUTO keywords in hooks
24
+ - Language configuration now properly respected with diagnostic logging
25
+ - Marketplace add command GitHub repo format handling
26
+
27
+ ### Changed
28
+
29
+ - **Documentation Improvements**
30
+ - Multi-language plugin documentation (i18n)
31
+ - Multi-agent philosophy introduction added to all language versions
32
+ - Architecture diagram synchronized with current codebase
33
+
34
+ ---
35
+
8
36
  ## [3.0.0] - 2026-01-17
9
37
 
10
38
  ### Added
@@ -17,7 +17,7 @@ You have four modes of operation:
17
17
  - EVAL mode analyzes ACT results and proposes improved PLAN
18
18
  - After EVAL completes, return to PLAN mode with improvement suggestions
19
19
  - User can repeat ACT → EVAL → PLAN cycle until satisfied
20
- - Move to AUTO mode when user types `AUTO` (or localized: 자동, 自動, 自动, AUTOMÁTICO)
20
+ - Move to AUTO mode when user types `AUTO`
21
21
  - AUTO mode autonomously cycles through PLAN → ACT → EVAL until quality targets met
22
22
  - When in plan mode always output the full updated plan in every response
23
23
 
@@ -63,6 +63,81 @@ Create actionable implementation plans following TDD and augmented coding princi
63
63
 
64
64
  ---
65
65
 
66
+ ### Structured Reasoning Process (SRP)
67
+
68
+ **Purpose:**
69
+ Enhance planning quality for complex tasks through systematic thinking with explicit confidence levels.
70
+
71
+ **Activation:**
72
+ - **COMPLEX tasks**: Full SRP cycle applied automatically
73
+ - **SIMPLE tasks**: Skipped (direct answer)
74
+ - **Auto-classification**: `parse_mode` automatically classifies task complexity
75
+
76
+ **User Override Flags:**
77
+ - `--srp`: Force SRP even for SIMPLE tasks (e.g., `PLAN --srp fix typo`)
78
+ - `--no-srp`: Skip SRP even for COMPLEX tasks (e.g., `PLAN --no-srp design auth`)
79
+
80
+ **Classification Criteria:**
81
+
82
+ | Type | Criteria | Action |
83
+ |------|----------|--------|
84
+ | **SIMPLE** | Single fact, 1 file, no trade-offs, no arch impact | Direct answer |
85
+ | **COMPLEX** | Design decisions, 2+ files, trade-offs, arch impact | Apply SRP |
86
+
87
+ **The 5-Step Process:**
88
+
89
+ ```
90
+ DECOMPOSE → SOLVE → VERIFY → SYNTHESIZE → REFLECT
91
+ ↓ ↓ ↓ ↓ ↓
92
+ Break into Solve + Check Combine Retry or
93
+ sub-problems confidence quality results output
94
+ ```
95
+
96
+ **Confidence Levels (3-Tier System):**
97
+
98
+ | Level | Range | Criteria |
99
+ |-------|-------|----------|
100
+ | 🟢 High | 0.8+ | Verified facts, official docs, testable |
101
+ | 🟡 Medium | 0.5-0.79 | Reasonable inference, context-dependent |
102
+ | 🔴 Low | <0.5 | Speculation, insufficient info |
103
+
104
+ **Synthesis Rule:**
105
+ ```
106
+ Overall Confidence = min(Sub-problem Confidences)
107
+ ```
108
+
109
+ **REFLECT Safety Limits:**
110
+ - Max retries: 2 (total 3 attempts)
111
+ - After limit: Output with explicit limitations
112
+ - Retry triggers: Overall = 🔴 Low, OR (🟡 Medium AND Critical sub-problem)
113
+
114
+ **Required Output (COMPLEX tasks only):**
115
+ ```markdown
116
+ ## 🧠 Structured Reasoning
117
+
118
+ ### Problem Decomposition
119
+ | # | Sub-problem | Confidence |
120
+ |---|-------------|------------|
121
+ | 1 | [Sub-problem] | 🟢/🟡/🔴 |
122
+
123
+ ### Verification
124
+ - ✅ Logic: [Result]
125
+ - ✅ Facts: [Result]
126
+ - ✅ Completeness: [Result]
127
+ - ⚠️ Bias: [Potential bias + mitigation]
128
+
129
+ ### Overall Confidence: 🟢/🟡/🔴
130
+ **Reasoning**: [Based on min() rule]
131
+
132
+ ### ⚠️ Key Caveats
133
+ - [Important limitations or assumptions]
134
+ ```
135
+
136
+ **Reference:**
137
+ See `.ai-rules/rules/structured-reasoning-guide.md` for detailed process and examples.
138
+
139
+ ---
140
+
66
141
  ### Clarification Phase (Optional)
67
142
 
68
143
  **Purpose:**
@@ -131,6 +206,32 @@ See `.ai-rules/rules/clarification-guide.md` for detailed question guidelines.
131
206
  ## 📋 Plan Overview
132
207
  [High-level summary of what will be implemented]
133
208
 
209
+ ## 🧠 Structured Reasoning (COMPLEX tasks only)
210
+
211
+ ### Complexity: COMPLEX/SIMPLE
212
+ [Brief justification for classification]
213
+
214
+ ### Problem Decomposition
215
+ | # | Sub-problem | Confidence |
216
+ |---|-------------|------------|
217
+ | 1 | [Sub-problem 1] | 🟢 High |
218
+ | 2 | [Sub-problem 2] | 🟡 Medium |
219
+
220
+ ### Verification
221
+ - ✅ Logic: [Verification result]
222
+ - ✅ Facts: [Verification result]
223
+ - ✅ Completeness: [Verification result]
224
+ - ⚠️ Bias: [Potential biases and mitigations]
225
+
226
+ ### Overall Confidence: 🟢/🟡/🔴
227
+ **Reasoning**: [Why this level based on min() rule]
228
+
229
+ ### ⚠️ Key Caveats
230
+ - [Important caveat 1]
231
+ - [Important caveat 2]
232
+
233
+ *Skip this section for SIMPLE tasks*
234
+
134
235
  ## ✅ Todo List
135
236
  [Todo list created using todo_write tool - all tasks in pending status]
136
237
 
@@ -264,14 +365,24 @@ To preserve this planning session for future reference:
264
365
  - Follow framework-specific component patterns as defined in project configuration
265
366
  - 🔴 **MUST use `todo_write` tool** to create todo list for all implementation steps
266
367
  - All todo items should be in `pending` status when created in PLAN mode
368
+ - 🔴 **MUST apply Structured Reasoning Process (SRP)** for COMPLEX tasks
369
+ - SRP section must include: Problem Decomposition, Verification, Overall Confidence, Key Caveats
370
+ - Confidence levels: 🟢 High (0.8+), 🟡 Medium (0.5-0.79), 🔴 Low (<0.5)
267
371
 
268
372
  **Verification:**
269
373
  - Agent name should appear as `## Agent : [Primary Developer Agent Name]` in response
270
374
  - Mode indicator `# Mode: PLAN` should be first line
271
- - Plan should include structured sections: Plan Overview, Todo List (created with todo_write), Implementation Steps, Planning Specialist sections (when applicable), Risk Assessment, File Structure, Quality Checklist
375
+ - Plan should include structured sections: Plan Overview, Structured Reasoning (COMPLEX only), Todo List (created with todo_write), Implementation Steps, Planning Specialist sections (when applicable), Risk Assessment, File Structure, Quality Checklist
272
376
  - Todo list must be created using `todo_write` tool before outputting plan
273
377
  - All mandatory checklist items from the Primary Developer Agent should be considered during planning
274
378
  - Planning Specialist Agents should be referenced when planning respective areas (Architecture, Test Strategy, Performance, Security, Accessibility, SEO, Design System, Documentation, Code Quality)
379
+ - **SRP Verification (COMPLEX tasks):**
380
+ - Structured Reasoning section must be present
381
+ - Problem Decomposition table with confidence levels
382
+ - Verification checklist (Logic, Facts, Completeness, Bias)
383
+ - Overall Confidence with reasoning
384
+ - Key Caveats section
385
+ - If Overall Confidence = 🔴 Low after 3 attempts, explicit limitations must be stated
275
386
 
276
387
  ---
277
388
 
@@ -459,7 +570,6 @@ To preserve this implementation session for future reference:
459
570
  **Trigger:**
460
571
  - Type `EVAL` after completing ACT
461
572
  - Type `EVALUATE` (also accepted)
462
- - Korean: `평가해` or `개선안 제시해`
463
573
 
464
574
  **🔴 Agent Activation (STRICT):**
465
575
  - When EVAL is triggered, **Code Reviewer Agent** (`.ai-rules/agents/code-reviewer.json`) **MUST** be automatically activated
@@ -516,7 +626,7 @@ Self-improvement through iterative refinement
516
626
  - Evaluate OUTPUT only, not implementer's INTENT
517
627
  - No subjective assessments - use objective evidence only
518
628
  - Must identify at least 3 improvement areas OR all identified issues
519
- - Prohibited phrases: See `anti_sycophancy.prohibited_phrases` in `.ai-rules/agents/code-reviewer.json` (English + Korean)
629
+ - Prohibited phrases: See `anti_sycophancy.prohibited_phrases` in `.ai-rules/agents/code-reviewer.json`
520
630
  - Start with problems, not praise
521
631
  - Challenge every design decision
522
632
 
@@ -566,18 +676,18 @@ Self-improvement through iterative refinement
566
676
  - [ ] State management: State changes propagate correctly
567
677
  - [ ] Async flow: Async/await chains remain valid
568
678
 
569
- ## 🔍 리팩토링 검증
679
+ ## 🔍 Refactoring Verification
570
680
 
571
- **검토 범위**: [변경된 파일 목록]
681
+ **Review Scope**: [List of changed files]
572
682
 
573
- ### 발견된 문제
574
- - 🔴 `[file.ts:line]` - 조건 분기: [조건문이 특정 케이스만 처리하는 문제]
575
- - ⚠️ `[file.ts:line]` - 옵셔널 처리: [null/undefined 참조 위험]
683
+ ### Issues Found
684
+ - 🔴 `[file.ts:line]` - Conditional branching: [Condition only handles specific cases]
685
+ - ⚠️ `[file.ts:line]` - Optional handling: [null/undefined reference risk]
576
686
 
577
- ### 검증 완료 (문제 없음)
578
- - ✅ [검증 항목명]
687
+ ### Verification Complete (No Issues)
688
+ - ✅ [Verification item name]
579
689
 
580
- *스킵 사유: [신규 파일만 생성 / 문서만 변경 / 테스트만 추가 / 해당 없음]*
690
+ *Skip reason: [New files only / Documentation only / Tests only / Not applicable]*
581
691
 
582
692
  ## 📊 Objective Assessment
583
693
  | Criteria | Measured | Target | Status |
@@ -692,7 +802,7 @@ Self-improvement through iterative refinement
692
802
  3. [Improvement 3 with location + metric + evidence]
693
803
 
694
804
  ## 🔍 Anti-Sycophancy Verification
695
- - [ ] No prohibited phrases used (English: Great job, Well done, Excellent / Korean: 잘했어, 훌륭해, 완벽해, etc.)
805
+ - [ ] No prohibited phrases used (e.g., Great job, Well done, Excellent, Perfect, etc.)
696
806
  - [ ] At least 3 improvement areas OR all identified issues reported
697
807
  - [ ] All findings include objective evidence (location, metric, target)
698
808
  - [ ] Devil's Advocate Analysis completed
@@ -756,10 +866,6 @@ To preserve this evaluation session for future reference:
756
866
 
757
867
  **Trigger:**
758
868
  - Type `AUTO` to start autonomous execution
759
- - Korean: `자동`
760
- - Japanese: `自動`
761
- - Chinese: `自动`
762
- - Spanish: `AUTOMÁTICO`
763
869
 
764
870
  **Purpose:**
765
871
  Autonomous iterative development - automatically cycling through planning, implementation, and evaluation until quality standards are met.
@@ -770,6 +876,12 @@ Autonomous iterative development - automatically cycling through planning, imple
770
876
  - Creates implementation plan following TDD and augmented coding principles
771
877
  - Activates Primary Developer Agent automatically
772
878
  - Outputs structured plan with todo items
879
+ - **SRP Integration**: For COMPLEX tasks, applies full Structured Reasoning Process
880
+ - SRP confidence affects iteration decision
881
+ - If SRP Overall = 🔴 Low after PLAN, additional analysis may be needed
882
+ - If Critical sub-problem unresolved, continues to ACT with explicit caveats
883
+ - EVAL phase considers SRP predictions vs actual outcomes
884
+ - SRP helps identify root causes when iterations don't converge
773
885
 
774
886
  2. **Execution Phase: ACT**
775
887
  - Executes the plan created in PLAN phase
@@ -830,7 +942,7 @@ Max Iterations: [maxIterations]
830
942
 
831
943
  Issues Found:
832
944
  - Critical: [N]
833
- - High: [N] <- 반복 필요 (if Critical > 0 OR High > 0)
945
+ - High: [N] <- iteration required (if Critical > 0 OR High > 0)
834
946
  - Medium: [N]
835
947
  - Low: [N]
836
948
 
@@ -860,13 +972,13 @@ Modified Files:
860
972
  ---
861
973
  # Mode: AUTO - MAX ITERATIONS REACHED
862
974
 
863
- [maxIterations] 시도했지만 일부 이슈가 남아있습니다.
975
+ After [maxIterations] attempts, some issues remain unresolved.
864
976
 
865
977
  Remaining Issues:
866
978
  - [CRITICAL] [Issue description]
867
979
  - [HIGH] [Issue description]
868
980
 
869
- 시도한 접근:
981
+ Attempted Approaches:
870
982
  - Iteration 1: [approach]
871
983
  - Iteration 2: [approach]
872
984
  - Iteration 3: [approach]
@@ -948,7 +1060,7 @@ Specialized agents available in `.ai-rules/agents/` directory:
948
1060
 
949
1061
  **Code Reviewer** (`.ai-rules/agents/code-reviewer.json`)
950
1062
  - **Expertise**: Comprehensive code quality evaluation, architecture analysis, performance/security assessment, risk identification
951
- - **Use when**: 🔴 **STRICT**: When user types `EVAL`, `EVALUATE`, `평가해`, or `개선안 제시해`, this Agent **MUST** be activated automatically
1063
+ - **Use when**: 🔴 **STRICT**: When user types `EVAL` or `EVALUATE`, this Agent **MUST** be activated automatically
952
1064
  - **Key traits**: Evidence-based evaluation (validated through web search), honest about limitations, multi-dimensional analysis, references other rules (no duplication)
953
1065
 
954
1066
  **Security Specialist** (`.ai-rules/agents/security-specialist.json`)
@@ -1063,7 +1175,7 @@ Specialized agents available in `.ai-rules/agents/` directory:
1063
1175
  **Code Reviewer** (`@.ai-rules/agents/code-reviewer.json`)
1064
1176
 
1065
1177
  ✅ **Use for (Auto-activated):**
1066
- - 🔴 **STRICT**: When user types `EVAL`, `EVALUATE`, `평가해`, or `개선안 제시해`, this Agent **MUST** be activated automatically
1178
+ - 🔴 **STRICT**: When user types `EVAL` or `EVALUATE`, this Agent **MUST** be activated automatically
1067
1179
  - Comprehensive code quality evaluation requests
1068
1180
  - Pre-production quality verification
1069
1181
  - Architecture and design pattern reviews
@@ -0,0 +1,777 @@
1
+ # Structured Reasoning Process (SRP) Guide
2
+
3
+ A systematic approach to enhance PLAN mode's planning capabilities through structured thinking.
4
+
5
+ ## Overview
6
+
7
+ The Structured Reasoning Process (SRP) is a 5-step framework that improves planning quality by:
8
+ - Breaking down complex problems systematically
9
+ - Providing explicit confidence levels for transparency
10
+ - Verifying logic and completeness before output
11
+ - Enabling iterative refinement when needed
12
+
13
+ **When Applied**: Automatically for COMPLEX tasks, skipped for SIMPLE tasks.
14
+
15
+ ---
16
+
17
+ ## Process Flowchart
18
+
19
+ ```mermaid
20
+ flowchart TD
21
+ START([Task Received]) --> CLASSIFY{Classify Complexity}
22
+
23
+ CLASSIFY -->|SIMPLE| DIRECT[Direct Answer]
24
+ DIRECT --> OUTPUT_SIMPLE[/"Output: Answer + Confidence + Caveats"/]
25
+
26
+ CLASSIFY -->|COMPLEX| DECOMPOSE[1. DECOMPOSE<br/>Break into sub-problems]
27
+
28
+ DECOMPOSE --> SOLVE[2. SOLVE<br/>Solve each + assign confidence]
29
+ SOLVE --> VERIFY[3. VERIFY<br/>Check logic, facts, completeness]
30
+ VERIFY --> SYNTHESIZE[4. SYNTHESIZE<br/>Combine with min rule]
31
+ SYNTHESIZE --> REFLECT{5. REFLECT<br/>Meets quality?}
32
+
33
+ REFLECT -->|"🟢 High or<br/>🟡 Medium (no critical)"| OUTPUT_COMPLEX[/"Output: Structured Reasoning"/]
34
+ REFLECT -->|"🔴 Low or<br/>Critical unresolved"| RETRY{Retry count < 2?}
35
+
36
+ RETRY -->|Yes| DECOMPOSE
37
+ RETRY -->|No| OUTPUT_CAVEATS[/"Output with explicit limitations"/]
38
+
39
+ OUTPUT_SIMPLE --> END([Complete])
40
+ OUTPUT_COMPLEX --> END
41
+ OUTPUT_CAVEATS --> END
42
+
43
+ style DECOMPOSE fill:#e1f5fe
44
+ style SOLVE fill:#e1f5fe
45
+ style VERIFY fill:#e1f5fe
46
+ style SYNTHESIZE fill:#e1f5fe
47
+ style REFLECT fill:#fff3e0
48
+ style RETRY fill:#ffebee
49
+ ```
50
+
51
+ **Legend:**
52
+ - 🔵 Blue boxes: Core SRP steps
53
+ - 🟠 Orange diamond: Quality decision point
54
+ - 🔴 Red diamond: Retry decision
55
+
56
+ <details>
57
+ <summary>📄 Text Fallback (for non-Mermaid environments)</summary>
58
+
59
+ ```
60
+ ┌─────────────────┐
61
+ │ Task Received │
62
+ └────────┬────────┘
63
+
64
+ ┌────────▼────────┐
65
+ │ SIMPLE or │
66
+ │ COMPLEX? │
67
+ └────────┬────────┘
68
+ ┌─────────────┴─────────────┐
69
+ │ │
70
+ ┌──────▼──────┐ ┌───────▼───────┐
71
+ │ SIMPLE │ │ COMPLEX │
72
+ │ Answer │ │ 1. DECOMPOSE │
73
+ └──────┬──────┘ └───────┬───────┘
74
+ │ │
75
+ │ ┌───────▼───────┐
76
+ │ │ 2. SOLVE │
77
+ │ │ + Confidence │
78
+ │ └───────┬───────┘
79
+ │ │
80
+ │ ┌───────▼───────┐
81
+ │ │ 3. VERIFY │
82
+ │ └───────┬───────┘
83
+ │ │
84
+ │ ┌───────▼───────┐
85
+ │ │ 4. SYNTHESIZE │
86
+ │ │ min() rule │
87
+ │ └───────┬───────┘
88
+ │ │
89
+ │ ┌───────▼───────┐
90
+ │ │ 5. REFLECT │
91
+ │ │ Quality OK? │
92
+ │ └───────┬───────┘
93
+ │ ┌─────┴─────┐
94
+ │ │ │
95
+ │ ┌──────▼──┐ ┌────▼────┐
96
+ │ │ 🟢/🟡 │ │ 🔴 │
97
+ │ │ Output │ │ Retry? │
98
+ │ └────┬────┘ └────┬────┘
99
+ │ │ ┌───┴───┐
100
+ │ │ │ │
101
+ │ │ ┌────▼───┐ ┌─▼─┐
102
+ │ │ │ Yes │ │No │
103
+ │ │ │(<2 try)│ └─┬─┘
104
+ │ │ └────┬───┘ │
105
+ │ │ │ │
106
+ │ │ ┌────▼────┐ │
107
+ │ │ │ Return │ │
108
+ │ │ │ to │ │
109
+ │ │ │DECOMPOSE│ │
110
+ │ │ └─────────┘ │
111
+ │ │ │
112
+ │ │ ┌────────────▼─┐
113
+ │ │ │Output with │
114
+ │ │ │limitations │
115
+ │ │ └──────┬───────┘
116
+ │ │ │
117
+ └───────────────────┴───────────┴────────┐
118
+
119
+ ┌─────────▼─────────┐
120
+ │ Complete │
121
+ └───────────────────┘
122
+ ```
123
+
124
+ </details>
125
+
126
+ ---
127
+
128
+ ## Complexity Classification
129
+
130
+ Before applying SRP, classify the task:
131
+
132
+ ### SIMPLE Tasks (Skip SRP)
133
+
134
+ Direct answer without full SRP cycle.
135
+
136
+ **Criteria:**
137
+ - Single fact verification
138
+ - Definition or syntax questions
139
+ - Clear yes/no questions
140
+ - Single file modification
141
+ - No architectural impact
142
+ - No trade-off analysis needed
143
+
144
+ **Examples:**
145
+ - "What is the return type of this function?"
146
+ - "How do I declare a readonly property in TypeScript?"
147
+ - "Does this component exist in the codebase?"
148
+
149
+ ### COMPLEX Tasks (Apply SRP)
150
+
151
+ Full SRP cycle required.
152
+
153
+ **Criteria:**
154
+ - Design decisions required
155
+ - Multiple factors to analyze
156
+ - Trade-off evaluation needed
157
+ - 2+ files/modules affected
158
+ - Architectural implications
159
+ - Multiple valid approaches exist
160
+
161
+ **Examples:**
162
+ - "How should we design the authentication system?"
163
+ - "What's the best approach for state management?"
164
+ - "How can we optimize the performance of this feature?"
165
+
166
+ ### Classification Rule
167
+
168
+ ```
169
+ IF (scope <= 1 file) AND (no dependency analysis) AND (no trade-offs)
170
+ → SIMPLE
171
+ ELSE
172
+ → COMPLEX
173
+ ```
174
+
175
+ ---
176
+
177
+ ## The 5-Step Process
178
+
179
+ ### 1. DECOMPOSE
180
+
181
+ Break the problem into manageable sub-problems.
182
+
183
+ **Guidelines:**
184
+ - Identify independent sub-problems
185
+ - Each sub-problem should be answerable
186
+ - Aim for 2-5 sub-problems (not too granular)
187
+ - Consider dependencies between sub-problems
188
+
189
+ **Output Format:**
190
+ ```markdown
191
+ ### Problem Decomposition
192
+ | # | Sub-problem | Type | Dependencies |
193
+ |---|-------------|------|--------------|
194
+ | 1 | [Description] | Technical/Design/Risk | None |
195
+ | 2 | [Description] | Technical/Design/Risk | #1 |
196
+ ```
197
+
198
+ ---
199
+
200
+ ### 2. SOLVE
201
+
202
+ Address each sub-problem and assign confidence levels.
203
+
204
+ **For Each Sub-problem:**
205
+ 1. Analyze the specific question
206
+ 2. Consider available evidence
207
+ 3. Formulate a solution
208
+ 4. Assign confidence level
209
+
210
+ **Confidence Level Assignment:**
211
+
212
+ | Level | Indicator | Criteria |
213
+ |-------|-----------|----------|
214
+ | 🟢 High | 0.8+ | Official docs, verified facts, testable, matches existing patterns |
215
+ | 🟡 Medium | 0.5-0.79 | Reasonable inference, context-dependent, best practice but not absolute |
216
+ | 🔴 Low | <0.5 | Speculation, insufficient info, multiple valid alternatives |
217
+
218
+ **Output Format:**
219
+ ```markdown
220
+ ### Sub-problem Solutions
221
+ | # | Sub-problem | Solution | Confidence | Evidence |
222
+ |---|-------------|----------|------------|----------|
223
+ | 1 | [Question] | [Answer] | 🟢 High | [Source/Reasoning] |
224
+ | 2 | [Question] | [Answer] | 🟡 Medium | [Source/Reasoning] |
225
+ ```
226
+
227
+ ---
228
+
229
+ ### 3. VERIFY
230
+
231
+ Check each solution for quality and correctness.
232
+
233
+ **Verification Checklist:**
234
+
235
+ | Aspect | Check | Questions |
236
+ |--------|-------|-----------|
237
+ | **Logic** | ✅/⚠️ | Is the reasoning valid? Any logical fallacies? |
238
+ | **Facts** | ✅/⚠️ | Are stated facts accurate? Can they be verified? |
239
+ | **Completeness** | ✅/⚠️ | Are all aspects covered? Any missing considerations? |
240
+ | **Bias** | ✅/⚠️ | Any assumptions? Alternative perspectives considered? |
241
+
242
+ **Output Format:**
243
+ ```markdown
244
+ ### Verification
245
+ - ✅ Logic: [Result and notes]
246
+ - ✅ Facts: [Result and notes]
247
+ - ⚠️ Completeness: [Result and notes - if issues found]
248
+ - ⚠️ Bias: [Potential biases and mitigations]
249
+ ```
250
+
251
+ ---
252
+
253
+ ### 4. SYNTHESIZE
254
+
255
+ Combine sub-problem solutions into a coherent whole.
256
+
257
+ **Critical vs Non-critical Sub-problems:**
258
+
259
+ Before combining, classify each sub-problem:
260
+
261
+ | Type | Criteria | Examples |
262
+ |------|----------|----------|
263
+ | **Critical** | • Directly affects core functionality<br>• Blocking dependency for others<br>• Security/safety implications<br>• Plan cannot proceed without it | Auth method selection, Data model design, API contract definition |
264
+ | **Non-critical** | • Enhancement or optimization<br>• Independent of other sub-problems<br>• No security impact<br>• Plan can proceed with caveats | Performance tuning, UI polish, Documentation |
265
+
266
+ **Quick Classification Rule:**
267
+ ```
268
+ IF sub-problem failure would:
269
+ - Block implementation entirely → Critical
270
+ - Cause security vulnerability → Critical
271
+ - Break other sub-problems → Critical
272
+ - Only reduce quality/performance → Non-critical
273
+ ```
274
+
275
+ **Combination Rule:**
276
+ ```
277
+ Overall Confidence = min(Sub-problem Confidences)
278
+ ```
279
+
280
+ **Rationale:** The overall plan is only as reliable as its weakest component.
281
+
282
+ **Exception Handling:**
283
+
284
+ | Scenario | Overall Result |
285
+ |----------|----------------|
286
+ | Any Critical sub-problem = 🔴 Low | 🔴 Low (must REFLECT) |
287
+ | Non-critical = 🔴 Low, Critical = 🟢 High | 🟡 Medium (add caveats) |
288
+ | All = 🟢 High | 🟢 High |
289
+
290
+ **Output Format:**
291
+ ```markdown
292
+ ### Synthesis
293
+ **Overall Confidence**: 🟡 Medium
294
+
295
+ **Reasoning**: Sub-problem #2 has Medium confidence due to [reason],
296
+ which limits overall confidence per min() rule.
297
+
298
+ **Integration Notes:**
299
+ - [How solutions connect]
300
+ - [Dependencies resolved]
301
+ ```
302
+
303
+ ---
304
+
305
+ ### 5. REFLECT
306
+
307
+ Evaluate if the result meets quality standards.
308
+
309
+ **Decision Flow:**
310
+
311
+ ```
312
+ IF Overall Confidence = 🔴 Low OR (🟡 Medium AND Critical sub-problem exists)
313
+ AND retry_count < 2
314
+ THEN
315
+ → Identify weakness
316
+ → Retry from DECOMPOSE with refined approach
317
+ ELSE
318
+ → Output final result with caveats
319
+ ```
320
+
321
+ **Retry Strategies:**
322
+
323
+ | Retry # | Strategy |
324
+ |---------|----------|
325
+ | 1 | Further decompose weak sub-problems |
326
+ | 2 | Explore alternative approaches |
327
+ | 3+ | Output current result + explicit limitations |
328
+
329
+ **Output Format (if retrying):**
330
+ ```markdown
331
+ ### Reflection (Retry Needed)
332
+ **Current Confidence**: 🔴 Low
333
+ **Weak Points**:
334
+ - Sub-problem #2: [Why it's weak]
335
+ **Retry Strategy**: [Approach for next attempt]
336
+
337
+ ---
338
+ [Return to DECOMPOSE with new approach]
339
+ ```
340
+
341
+ **Output Format (if complete):**
342
+ ```markdown
343
+ ### Reflection (Complete)
344
+ **Final Confidence**: 🟡 Medium
345
+ **Attempts**: 2/3
346
+ **Remaining Uncertainties**:
347
+ - [Uncertainty 1 and why it couldn't be resolved]
348
+ ```
349
+
350
+ ---
351
+
352
+ ## Required Output Format
353
+
354
+ All COMPLEX tasks must include these sections:
355
+
356
+ ```markdown
357
+ ## 🧠 Structured Reasoning
358
+
359
+ ### Complexity: COMPLEX
360
+ [Brief justification]
361
+
362
+ ### Problem Decomposition
363
+ | # | Sub-problem | Confidence |
364
+ |---|-------------|------------|
365
+ | 1 | [Sub-problem 1] | 🟢 High |
366
+ | 2 | [Sub-problem 2] | 🟡 Medium |
367
+
368
+ ### Verification
369
+ - ✅ Logic: [Result]
370
+ - ✅ Facts: [Result]
371
+ - ✅ Completeness: [Result]
372
+ - ⚠️ Bias: [Result and mitigation]
373
+
374
+ ### Overall Confidence: 🟡 Medium
375
+ **Reasoning**: [Why this level based on min() rule]
376
+
377
+ ### ⚠️ Key Caveats
378
+ - [Caveat 1 - what user should be aware of]
379
+ - [Caveat 2 - limitations or assumptions]
380
+ ```
381
+
382
+ ---
383
+
384
+ ## Examples
385
+
386
+ ### Example 1: SIMPLE Task
387
+
388
+ **User Request:** "What's the TypeScript syntax for a readonly array?"
389
+
390
+ **Response:**
391
+ ```markdown
392
+ ## Answer
393
+
394
+ Use `readonly` modifier or `ReadonlyArray<T>`:
395
+
396
+ \`\`\`typescript
397
+ const arr: readonly number[] = [1, 2, 3];
398
+ // or
399
+ const arr: ReadonlyArray<number> = [1, 2, 3];
400
+ \`\`\`
401
+
402
+ **Confidence**: 🟢 High (TypeScript official documentation)
403
+ **Caveats**: None - this is standard TypeScript syntax.
404
+ ```
405
+
406
+ *Note: SRP skipped - SIMPLE task (single fact, no trade-offs)*
407
+
408
+ ---
409
+
410
+ ### Example 2: COMPLEX Task
411
+
412
+ **User Request:** "How should we implement user authentication for this app?"
413
+
414
+ **Response:**
415
+ ```markdown
416
+ ## 🧠 Structured Reasoning
417
+
418
+ ### Complexity: COMPLEX
419
+ Multiple approaches exist (JWT, session, OAuth), affects multiple modules,
420
+ requires security considerations.
421
+
422
+ ### Problem Decomposition
423
+ | # | Sub-problem | Confidence |
424
+ |---|-------------|------------|
425
+ | 1 | Authentication method selection | 🟡 Medium |
426
+ | 2 | Token storage strategy | 🟢 High |
427
+ | 3 | Session management | 🟢 High |
428
+ | 4 | Security considerations | 🟡 Medium |
429
+
430
+ ### Sub-problem Solutions
431
+
432
+ **#1 Authentication Method**
433
+ - Solution: JWT with refresh tokens
434
+ - Confidence: 🟡 Medium
435
+ - Evidence: Industry standard, but OAuth might be better for enterprise
436
+
437
+ **#2 Token Storage**
438
+ - Solution: httpOnly cookies for refresh, memory for access
439
+ - Confidence: 🟢 High
440
+ - Evidence: OWASP recommendations, prevents XSS access to tokens
441
+
442
+ **#3 Session Management**
443
+ - Solution: Server-side session with Redis
444
+ - Confidence: 🟢 High
445
+ - Evidence: Scalable, supports revocation
446
+
447
+ **#4 Security**
448
+ - Solution: CSRF protection, rate limiting, secure headers
449
+ - Confidence: 🟡 Medium
450
+ - Evidence: Standard practices, but implementation details vary
451
+
452
+ ### Verification
453
+ - ✅ Logic: Token flow is standard and well-documented
454
+ - ✅ Facts: OWASP guidelines verified
455
+ - ✅ Completeness: Covers auth, storage, session, security
456
+ - ⚠️ Bias: Favoring JWT over sessions - added trade-off discussion
457
+
458
+ ### Overall Confidence: 🟡 Medium
459
+ **Reasoning**: Sub-problems #1 and #4 have Medium confidence,
460
+ limiting overall per min() rule.
461
+
462
+ ### ⚠️ Key Caveats
463
+ - OAuth recommended if enterprise SSO is needed later
464
+ - Security implementation requires detailed review
465
+ - Rate limiting thresholds need tuning based on traffic patterns
466
+ ```
467
+
468
+ ---
469
+
470
+ ### Example 3: Boundary Case (2 files but SIMPLE)
471
+
472
+ **User Request:** "Rename the `getUserData` function to `fetchUserProfile` across the codebase"
473
+
474
+ **Classification Analysis:**
475
+ - 2+ files affected? Yes (function used in multiple places)
476
+ - Design decisions? No (just renaming)
477
+ - Trade-offs? No
478
+ - Architectural impact? No
479
+
480
+ **Response:**
481
+ ```markdown
482
+ ## Complexity: SIMPLE (despite multiple files)
483
+
484
+ This is a mechanical refactoring task - no design decisions required.
485
+
486
+ **Action:**
487
+ 1. Rename function in `userService.ts`
488
+ 2. Update all import sites
489
+
490
+ **Confidence**: 🟢 High
491
+ **Caveats**: Run tests after rename to verify no missed references.
492
+ ```
493
+
494
+ *Note: File count alone doesn't determine complexity - nature of change matters.*
495
+
496
+ ---
497
+
498
+ ### Example 4: REFLECT Retry Scenario
499
+
500
+ **User Request:** "Design a caching strategy for our API responses"
501
+
502
+ **Initial Attempt:**
503
+ ```markdown
504
+ ## 🧠 Structured Reasoning
505
+
506
+ ### Problem Decomposition
507
+ | # | Sub-problem | Confidence |
508
+ |---|-------------|------------|
509
+ | 1 | Cache location (client/server/CDN) | 🔴 Low |
510
+ | 2 | Cache invalidation strategy | 🔴 Low |
511
+ | 3 | TTL configuration | 🟡 Medium |
512
+
513
+ ### Overall Confidence: 🔴 Low
514
+ **Reasoning**: Critical sub-problems #1 and #2 are Low confidence.
515
+
516
+ ### Reflection (Retry Needed)
517
+ **Weak Points**:
518
+ - #1: Need to know traffic patterns and latency requirements
519
+ - #2: Need to understand data update frequency
520
+
521
+ **Retry Strategy**: Decompose further - ask about specific use cases
522
+ ```
523
+
524
+ **After Clarification (Retry 1):**
525
+ ```markdown
526
+ ## 🧠 Structured Reasoning (Attempt 2/3)
527
+
528
+ ### Problem Decomposition (Refined)
529
+ | # | Sub-problem | Confidence |
530
+ |---|-------------|------------|
531
+ | 1a | Client-side cache for static assets | 🟢 High |
532
+ | 1b | Server-side cache for user sessions | 🟢 High |
533
+ | 2a | Time-based invalidation for config | 🟢 High |
534
+ | 2b | Event-based invalidation for user data | 🟡 Medium |
535
+ | 3 | TTL: 5min for API, 1hr for assets | 🟢 High |
536
+
537
+ ### Overall Confidence: 🟡 Medium
538
+ **Reasoning**: All critical sub-problems now High, one non-critical Medium.
539
+
540
+ ### Reflection (Complete)
541
+ **Final Confidence**: 🟡 Medium
542
+ **Attempts**: 2/3
543
+ **Remaining Uncertainty**: Event-based invalidation needs monitoring after deployment.
544
+ ```
545
+
546
+ ---
547
+
548
+ ### Example 5: Mixed Complexity Request
549
+
550
+ **User Request:** "Fix the login button color and redesign the authentication flow"
551
+
552
+ **Response:**
553
+ ```markdown
554
+ ## Request Analysis
555
+
556
+ This request contains two distinct tasks:
557
+
558
+ | Task | Complexity | Reason |
559
+ |------|------------|--------|
560
+ | Fix login button color | SIMPLE | Single style change, no trade-offs |
561
+ | Redesign auth flow | COMPLEX | Multiple approaches, security implications |
562
+
563
+ **Recommendation**: Split into two separate tasks.
564
+
565
+ ---
566
+
567
+ ## Task 1: Login Button Color (SIMPLE)
568
+
569
+ **Action**: Change button color in `LoginButton.tsx`
570
+ **Confidence**: 🟢 High
571
+ **Caveats**: Verify color meets accessibility contrast requirements.
572
+
573
+ ---
574
+
575
+ ## Task 2: Auth Flow Redesign (COMPLEX)
576
+
577
+ ## 🧠 Structured Reasoning
578
+
579
+ ### Problem Decomposition
580
+ | # | Sub-problem | Type | Confidence |
581
+ |---|-------------|------|------------|
582
+ | 1 | Current flow pain points | Analysis | 🟡 Medium |
583
+ | 2 | OAuth vs custom auth | Critical | 🟡 Medium |
584
+ | 3 | Session management | Critical | 🟢 High |
585
+ | 4 | Migration strategy | Non-critical | 🟡 Medium |
586
+
587
+ [... continues with full SRP ...]
588
+ ```
589
+
590
+ ---
591
+
592
+ ## Integration with PLAN Mode
593
+
594
+ SRP enhances PLAN mode without replacing it:
595
+
596
+ 1. **Clarification Phase** → Gather requirements
597
+ 2. **SRP** → Structured analysis (for COMPLEX tasks)
598
+ 3. **Plan Output** → Standard PLAN format with SRP section added
599
+
600
+ The SRP section appears after "Plan Overview" and before "Implementation Steps".
601
+
602
+ ---
603
+
604
+ ## Quick Reference
605
+
606
+ | Step | Purpose | Key Output |
607
+ |------|---------|------------|
608
+ | DECOMPOSE | Break down problem | Sub-problem table |
609
+ | SOLVE | Address each part | Solutions + Confidence |
610
+ | VERIFY | Check quality | Verification checklist |
611
+ | SYNTHESIZE | Combine results | Overall confidence |
612
+ | REFLECT | Decide next step | Continue or output |
613
+
614
+ **Confidence Levels:**
615
+ - 🟢 High (0.8+): Verified facts, official sources
616
+ - 🟡 Medium (0.5-0.79): Reasonable but uncertain
617
+ - 🔴 Low (<0.5): Speculation, needs more info
618
+
619
+ **Safety Limits:**
620
+ - Max retries: 2 (total 3 attempts)
621
+ - After limit: Output with explicit limitations
622
+
623
+ ---
624
+
625
+ ## Interactive Tutorial
626
+
627
+ ### 🎯 Try SRP Yourself
628
+
629
+ Follow this guided exercise to practice the Structured Reasoning Process.
630
+
631
+ #### Exercise: "Should we use Redux or Context API for state management?"
632
+
633
+ **Step 1: Classify Complexity**
634
+ ```
635
+ Checklist:
636
+ ☐ Single fact? No - requires analysis
637
+ ☐ 1 file affected? No - affects architecture
638
+ ☐ Trade-offs involved? Yes - performance vs simplicity
639
+ ☐ Design decision? Yes
640
+
641
+ → Result: COMPLEX ✓
642
+ ```
643
+
644
+ **Step 2: DECOMPOSE**
645
+ ```
646
+ Try identifying sub-problems:
647
+
648
+ Your sub-problems:
649
+ 1. ___________________________________
650
+ 2. ___________________________________
651
+ 3. ___________________________________
652
+
653
+ Suggested sub-problems:
654
+ 1. State complexity (how much state? nested?)
655
+ 2. Performance requirements (frequent updates?)
656
+ 3. Team familiarity (learning curve?)
657
+ 4. Future scalability (will state grow?)
658
+ ```
659
+
660
+ **Step 3: SOLVE with Confidence**
661
+ ```
662
+ For each sub-problem, assign:
663
+ 🟢 High (0.8+) - You have verified facts
664
+ 🟡 Medium (0.5-0.79) - Reasonable inference
665
+ 🔴 Low (<0.5) - Speculation
666
+
667
+ Example:
668
+ | # | Sub-problem | Your Solution | Confidence |
669
+ |---|-------------|---------------|------------|
670
+ | 1 | State complexity | _____________ | 🟢/🟡/🔴 |
671
+ | 2 | Performance | _____________ | 🟢/🟡/🔴 |
672
+ ```
673
+
674
+ **Step 4: VERIFY**
675
+ ```
676
+ Check your solutions:
677
+ ☐ Logic: Is reasoning valid?
678
+ ☐ Facts: Can claims be verified?
679
+ ☐ Completeness: Anything missing?
680
+ ☐ Bias: Am I favoring one option?
681
+ ```
682
+
683
+ **Step 5: SYNTHESIZE**
684
+ ```
685
+ Apply the min() rule:
686
+ Overall = min(all sub-problem confidences)
687
+
688
+ Your overall confidence: _______
689
+ ```
690
+
691
+ **Step 6: REFLECT**
692
+ ```
693
+ Decision tree:
694
+ IF Overall = 🔴 Low → Retry with more research
695
+ IF Overall = 🟡 Medium with Critical unresolved → Retry
696
+ IF Overall = 🟢 High or 🟡 Medium (all critical resolved) → Output
697
+ ```
698
+
699
+ ---
700
+
701
+ ### 🧪 Practice Scenarios
702
+
703
+ **Scenario A: SIMPLE**
704
+ > "What's the syntax for optional chaining in TypeScript?"
705
+
706
+ Expected: Skip SRP, direct answer with `?.` syntax
707
+
708
+ ---
709
+
710
+ **Scenario B: COMPLEX**
711
+ > "How should we handle authentication in our Next.js app?"
712
+
713
+ Expected: Full SRP cycle
714
+ - Sub-problems: Auth method, token storage, session management, security
715
+ - Confidence varies by team context
716
+ - Output includes caveats
717
+
718
+ ---
719
+
720
+ **Scenario C: Boundary Case**
721
+ > "Rename `fetchData` to `loadData` across 5 files"
722
+
723
+ Expected: SIMPLE (despite multiple files)
724
+ - Reason: Mechanical change, no design decisions
725
+
726
+ ---
727
+
728
+ ### ⚠️ Common Mistakes to Avoid
729
+
730
+ Learn from these frequent errors when applying SRP:
731
+
732
+ | Mistake | Why It's Wrong | Correction |
733
+ |---------|----------------|------------|
734
+ | **Classifying everything as COMPLEX** | Wastes time on trivial tasks | Use the IF rule: 1 file + no trade-offs = SIMPLE |
735
+ | **Skipping VERIFY step** | Leads to flawed conclusions | Always run the 4-point checklist (Logic, Facts, Completeness, Bias) |
736
+ | **Assigning 🟢 High without evidence** | False confidence, bad decisions | Only 🟢 High for verified facts with sources |
737
+ | **Ignoring min() rule in SYNTHESIZE** | Overconfident final assessment | Overall = weakest sub-problem confidence |
738
+ | **Retrying more than 2 times** | Infinite loop, no progress | After 3 attempts, output with explicit limitations |
739
+ | **Treating all sub-problems as Critical** | No prioritization, paralysis | Use the "Would failure block implementation?" test |
740
+ | **Forgetting caveats in output** | User unaware of limitations | Always include ⚠️ Key Caveats section |
741
+
742
+ **Anti-patterns in Practice:**
743
+
744
+ ```markdown
745
+ ❌ Wrong: "Confidence: 🟢 High (I think this is correct)"
746
+ ✅ Right: "Confidence: 🟢 High (TypeScript docs, verified in playground)"
747
+
748
+ ❌ Wrong: Overall Confidence: 🟢 High (average of 🟢, 🟡, 🟢)
749
+ ✅ Right: Overall Confidence: 🟡 Medium (min of 🟢, 🟡, 🟢 per synthesis rule)
750
+
751
+ ❌ Wrong: Retry attempt 4/3 - trying one more approach
752
+ ✅ Right: Attempt 3/3 reached. Output with explicit limitations.
753
+ ```
754
+
755
+ ---
756
+
757
+ ### 📝 Self-Assessment Checklist
758
+
759
+ After completing a PLAN with SRP, verify:
760
+
761
+ | Check | Done? |
762
+ |-------|-------|
763
+ | Classified SIMPLE vs COMPLEX correctly | ☐ |
764
+ | Sub-problems are independent and answerable | ☐ |
765
+ | Each confidence level has evidence | ☐ |
766
+ | Verification checklist completed | ☐ |
767
+ | Overall confidence follows min() rule | ☐ |
768
+ | Caveats clearly stated | ☐ |
769
+ | Retry limit respected (max 2) | ☐ |
770
+
771
+ ---
772
+
773
+ ## References
774
+
775
+ - Core workflow: `core.md`
776
+ - TDD practices: `augmented-coding.md`
777
+ - Project context: `project.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codingbuddy-rules",
3
- "version": "3.0.3",
3
+ "version": "3.1.1",
4
4
  "description": "AI coding rules for consistent practices across AI assistants",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",