@dzhechkov/keysarium 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +70 -10
  2. package/bin/cli.js +0 -0
  3. package/package.json +5 -3
  4. package/src/utils.js +1 -1
  5. package/templates/.claude/commands/analyst-manual.md +38 -0
  6. package/templates/.claude/commands/brain-export.md +2 -0
  7. package/templates/.claude/commands/bto-benchmark.md +302 -0
  8. package/templates/.claude/commands/casarium.md +55 -4
  9. package/templates/.claude/commands/feature-adr.md +8 -0
  10. package/templates/.claude/commands/harvest.md +28 -46
  11. package/templates/.claude/rules/trust-tiers.md +6 -0
  12. package/templates/.claude/shards/feature-adr.shard.md +64 -10
  13. package/templates/.claude/shards/phase-ai-factory.shard.md +109 -0
  14. package/templates/.claude/skills/ai-factory-mapper/README.md +90 -0
  15. package/templates/.claude/skills/ai-factory-mapper/SKILL.md +309 -0
  16. package/templates/.claude/skills/ai-factory-mapper/assets/report-template.md +123 -0
  17. package/templates/.claude/skills/ai-factory-mapper/references/catalog.md +230 -0
  18. package/templates/.claude/skills/ai-factory-mapper/references/coverage-formula.md +219 -0
  19. package/templates/.claude/skills/ai-factory-mapper/references/decomposition-checklist.md +183 -0
  20. package/templates/.claude/skills/ai-factory-mapper/references/pattern-library.md +312 -0
  21. package/templates/.claude/skills/ai-factory-mapper/scripts/build_docx_report.js +423 -0
  22. package/templates/.claude/skills/analyst-manual-full/SKILL.md +286 -0
  23. package/templates/.claude/skills/edu-site-generator/SKILL.md +254 -0
  24. package/templates/.claude/skills/edu-site-generator/examples/sample-course-structure.md +116 -0
  25. package/templates/.claude/skills/edu-site-generator/modules/00-content-analysis.md +84 -0
  26. package/templates/.claude/skills/edu-site-generator/modules/01-course-structure.md +75 -0
  27. package/templates/.claude/skills/edu-site-generator/modules/02-data-generation.md +186 -0
  28. package/templates/.claude/skills/edu-site-generator/modules/03-scaffold.md +249 -0
  29. package/templates/.claude/skills/edu-site-generator/modules/04-components.md +130 -0
  30. package/templates/.claude/skills/edu-site-generator/modules/05-gamification.md +163 -0
  31. package/templates/.claude/skills/edu-site-generator/modules/06-deploy.md +88 -0
  32. package/templates/.claude/skills/edu-site-generator/modules/07-verification.md +97 -0
  33. package/templates/.claude/skills/edu-site-generator/references/component-templates.md +436 -0
  34. package/templates/.claude/skills/edu-site-generator/references/data-schemas.md +164 -0
  35. package/templates/.claude/skills/edu-site-generator/references/exercise-catalog.md +110 -0
  36. package/templates/.claude/skills/edu-site-generator/references/tech-stack.md +69 -0
  37. package/templates/.claude/skills/feature-adr/SKILL.md +245 -59
  38. package/templates/.claude/skills/feature-adr/modules/03-adr.md +43 -0
  39. package/templates/.claude/skills/feature-adr/modules/03.5-ideation-swarm.md +180 -0
  40. package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +56 -7
  41. package/templates/.claude/skills/feature-adr/modules/08-qe.md +87 -23
  42. package/templates/.claude/skills/feature-adr/modules/09-fleet-qe.md +305 -0
  43. package/templates/.claude/skills/feature-adr/references/agentic-qe/README.md +143 -0
  44. package/templates/.claude/skills/feature-adr/references/agentic-qe/brutal-honesty-review.md +240 -0
  45. package/templates/.claude/skills/feature-adr/references/agentic-qe/chaos-engineering-resilience.md +163 -0
  46. package/templates/.claude/skills/feature-adr/references/agentic-qe/code-goal-planner.md +446 -0
  47. package/templates/.claude/skills/feature-adr/references/agentic-qe/enterprise-integration-testing.md +111 -0
  48. package/templates/.claude/skills/feature-adr/references/agentic-qe/mutation-testing.md +236 -0
  49. package/templates/.claude/skills/feature-adr/references/agentic-qe/performance-testing.md +315 -0
  50. package/templates/.claude/skills/feature-adr/references/agentic-qe/qcsd-ideation-swarm.md +126 -0
  51. package/templates/.claude/skills/feature-adr/references/agentic-qe/qcsd-production-swarm.md +108 -0
  52. package/templates/.claude/skills/feature-adr/references/agentic-qe/qe-coverage-analysis.md +193 -0
  53. package/templates/.claude/skills/feature-adr/references/agentic-qe/qe-requirements-validation.md +254 -0
  54. package/templates/.claude/skills/feature-adr/references/agentic-qe/regression-testing.md +233 -0
  55. package/templates/.claude/skills/feature-adr/references/agentic-qe/risk-based-testing.md +212 -0
  56. package/templates/.claude/skills/feature-adr/references/agentic-qe/security-testing.md +311 -0
  57. package/templates/.claude/skills/feature-adr/references/agentic-qe/shift-left-testing.md +231 -0
  58. package/templates/.claude/skills/feature-adr/references/agentic-qe/tdd-london-chicago.md +249 -0
  59. package/templates/.claude/skills/knowledge-extractor/SKILL.md +254 -0
  60. package/templates/.claude/skills/knowledge-extractor/modules/01-extract.md +188 -0
  61. package/templates/.claude/skills/knowledge-extractor/modules/02-classify.md +99 -0
  62. package/templates/.claude/skills/knowledge-extractor/modules/03-gate.md +150 -0
  63. package/templates/.claude/skills/knowledge-extractor/modules/04-integrate.md +159 -0
  64. package/templates/.claude/skills/knowledge-extractor/references/artifact-categories.md +100 -0
  65. package/templates/.claude/skills/knowledge-extractor/references/maturity-model.md +94 -0
  66. package/templates/.claude/skills/knowledge-extractor/references/quality-gates.md +98 -0
  67. package/templates/.claude/skills/knowledge-extractor/templates/artifact-card.md +63 -0
  68. package/templates/.claude/skills/knowledge-extractor/templates/harvest-report.md +102 -0
  69. package/templates/.claude/skills/transcript-site-generator/SKILL.md +287 -0
  70. package/templates/.claude/skills/transcript-site-generator/examples/sample-text-only-site.md +123 -0
  71. package/templates/.claude/skills/transcript-site-generator/examples/sample-transcript-site.md +134 -0
  72. package/templates/.claude/skills/transcript-site-generator/modules/00-input-analysis.md +132 -0
  73. package/templates/.claude/skills/transcript-site-generator/modules/01-content-parsing.md +117 -0
  74. package/templates/.claude/skills/transcript-site-generator/modules/02-site-generation.md +293 -0
  75. package/templates/.claude/skills/transcript-site-generator/modules/03-interactivity.md +406 -0
  76. package/templates/.claude/skills/transcript-site-generator/modules/04-deploy.md +130 -0
  77. package/templates/.claude/skills/transcript-site-generator/modules/05-verification.md +155 -0
  78. package/templates/.claude/skills/transcript-site-generator/references/component-catalog.md +86 -0
  79. package/templates/.claude/skills/transcript-site-generator/references/data-schemas.md +123 -0
  80. package/templates/.claude/skills/transcript-site-generator/references/tech-stack.md +132 -0
  81. package/templates/CLAUDE.md +30 -9
  82. package/templates/docs/continuous-learning-guide.md +622 -0
  83. package/templates/docs/edu-site-generator/01-deployment-guide.md +911 -0
  84. package/templates/docs/edu-site-generator/02-admin-guide.md +901 -0
  85. package/templates/docs/edu-site-generator/03-user-guide.md +1008 -0
  86. package/templates/docs/edu-site-generator/04-infrastructure-requirements.md +489 -0
  87. package/templates/docs/edu-site-generator/05-architecture.md +902 -0
  88. package/templates/docs/edu-site-generator/06-user-flows.md +759 -0
  89. package/templates/docs/improvement-directions.md +8 -4
  90. package/templates/docs/keysarium-core/02-functionality.md +3 -1
  91. package/templates/docs/skills-bto/01-deployment-guide.md +1 -1
  92. package/templates/docs/skills-bto/02-admin-guide.md +4 -1
  93. package/templates/docs/skills-bto/03-user-guide.md +4 -3
  94. package/templates/docs/skills-bto/04-infrastructure-requirements.md +2 -1
  95. package/templates/docs/skills-bto/05-architecture.md +11 -11
  96. package/templates/docs/skills-bto/06-user-flows.md +2 -1
  97. package/templates/docs/transcript-site-generator/01-deployment-guide.md +1042 -0
  98. package/templates/docs/transcript-site-generator/02-admin-guide.md +918 -0
  99. package/templates/docs/transcript-site-generator/03-user-guide.md +925 -0
  100. package/templates/docs/transcript-site-generator/04-infrastructure-requirements.md +482 -0
  101. package/templates/docs/transcript-site-generator/05-architecture.md +1068 -0
  102. package/templates/docs/transcript-site-generator/06-user-flows.md +855 -0
  103. package/templates/lib/dream-engine.md +1 -1
  104. package/templates/lib/memory-protocol.md +6 -2
  105. package/templates/lib/reward-tracker.md +6 -3
@@ -0,0 +1,180 @@
1
+ # Step 3.5: QCSD Ideation Swarm
2
+
3
+ > Quality criteria assessment using HTSM v6.3, Risk Storming, and Testability analysis on refined ADR before implementation begins.
4
+
5
+ ## Source
6
+
7
+ Adapted from [agentic-qe qcsd-ideation-swarm](https://github.com/proffesor-for-testing/agentic-qe) (Tier 3: Verified).
8
+
9
+ > Load: `references/agentic-qe/qcsd-ideation-swarm.md`
10
+
11
+ ## When
12
+
13
+ M+ tiers. This step runs AFTER Step 3 (ADR) and BEFORE Step 6 (Implementation Plan).
14
+ - **M:** Core agents only (3 agents)
15
+ - **L/XL:** Core + conditional agents (3-9 agents based on feature flags)
16
+
17
+ ## Model
18
+
19
+ sonnet (analytical quality assessment — multiple parallel agents)
20
+
21
+ ## Input
22
+
23
+ - `{REQUIREMENTS}` from Step 1
24
+ - `{ADR_DECISIONS}` from Step 3 (with shift-left validation results)
25
+ - `{RESEARCH_FINDINGS}` from Step 2 (if L/XL)
26
+ - `{DOMAIN_MODEL}` from Step 4 (if available)
27
+
28
+ ## Protocol
29
+
30
+ ### 1. Flag Detection (MANDATORY)
31
+
32
+ Scan feature requirements + ADR decisions and SET these flags:
33
+
34
+ ```
35
+ □ HAS_UI = FALSE
36
+ Set TRUE if feature contains: UI, frontend, visual, component, screen, page, form,
37
+ button, modal, dialog, dashboard, widget, interface, display, view, layout, CSS, styling
38
+
39
+ □ HAS_SECURITY = FALSE
40
+ Set TRUE if feature contains: auth, security, credential, token, encrypt, PII,
41
+ compliance, password, login, session, OAuth, JWT, permission, role, access control
42
+
43
+ □ HAS_UX = FALSE
44
+ Set TRUE if feature contains: user experience, UX, journey, usability, user flow,
45
+ persona, friction, delight, onboarding, retention, engagement
46
+ ```
47
+
48
+ Output flag detection results before proceeding.
49
+
50
+ ### 2. Spawn Core Agents (3 parallel — MANDATORY)
51
+
52
+ ALL THREE core agents MUST be spawned in a SINGLE message:
53
+
54
+ #### Agent 1: Quality Criteria Recommender (HTSM v6.3)
55
+
56
+ Analyze ALL 10 HTSM categories with weight and testability score:
57
+
58
+ | Category | Focus |
59
+ |----------|-------|
60
+ | Capability | Does it do what's required? |
61
+ | Reliability | Under stress, load, edge cases |
62
+ | Usability | Learnability, accessibility, efficiency |
63
+ | Charisma | Visual design, responsiveness |
64
+ | Security | Authentication, authorization, data protection |
65
+ | Scalability | Growth handling, resource limits |
66
+ | Compatibility | Browsers, devices, APIs, integrations |
67
+ | Performance | Speed, throughput, resource usage |
68
+ | Installability | Deployment, configuration, migration |
69
+ | Development | Testability, maintainability, portability |
70
+
71
+ **Output**: Quality criteria analysis with weighted scores per category.
72
+
73
+ #### Agent 2: Risk Assessor (SFDIPOT)
74
+
75
+ Apply SFDIPOT risk framework:
76
+ - **S**tructure: Code architecture, component dependencies
77
+ - **F**unction: Business logic, calculations, workflows
78
+ - **D**ata: Data integrity, migrations, edge values
79
+ - **I**nterfaces: API contracts, integration points
80
+ - **P**latform: OS, browser, infrastructure dependencies
81
+ - **O**perations: Deployment, monitoring, maintenance
82
+ - **T**ime: Scheduling, concurrency, timeouts, caching
83
+
84
+ **Output**: Minimum 10 risks with probability (1-5), impact (1-5), and risk score.
85
+
86
+ #### Agent 3: Requirements Validator (Testability Scoring)
87
+
88
+ Apply 10 Principles of Testability, score each 0-100:
89
+ 1. Observability — can we see what the system does?
90
+ 2. Controllability — can we put it in the state we need?
91
+ 3. Decomposability — can we test parts independently?
92
+ 4. Simplicity — is it only as complex as needed?
93
+ 5. Stability — does it change predictably?
94
+ 6. Information — do we have what we need to test?
95
+ 7. Communication — do we know what to test?
96
+ 8. Relation to prior work — can we leverage past tests?
97
+ 9. Time — do we have enough time to test?
98
+ 10. Accountability — who owns quality?
99
+
100
+ **Output**: Testability score (0-100) with per-principle breakdown.
101
+
102
+ ### 3. Spawn Conditional Agents (L/XL, based on flags)
103
+
104
+ | Flag | Agent | Analysis |
105
+ |------|-------|----------|
106
+ | HAS_UI | Accessibility Auditor | WCAG 2.2 AA compliance assessment |
107
+ | HAS_SECURITY | Security Auditor | STRIDE threat modeling |
108
+ | HAS_UX | QX Partner | User journey and experience quality |
109
+
110
+ ### 4. GO/NO-GO Decision
111
+
112
+ After all agents complete, apply decision logic:
113
+
114
+ | Metric | NO-GO | CONDITIONAL | GO |
115
+ |--------|-------|-------------|-----|
116
+ | Testability Score | < 40 | 40-79 | ≥ 80 |
117
+ | HTSM Coverage | < 6/10 categories | 6-7/10 | ≥ 8/10 |
118
+ | AC Completeness | < 50% | 50-89% | ≥ 90% |
119
+ | Critical Risks | > 2 | 1-2 | 0 |
120
+
121
+ - **NO-GO**: BLOCK. Requirements/ADR need rework. Return to Step 1 or Step 3.
122
+ - **CONDITIONAL**: Proceed with warnings. Pass findings to Steps 6-8 as advisory context.
123
+ - **GO**: Full confidence. Proceed to Step 6.
124
+
125
+ ### 5. Synthesis Report
126
+
127
+ Generate consolidated `03.5_ideation_report.md` with:
128
+ 1. Executive summary (GO/CONDITIONAL/NO-GO verdict)
129
+ 2. Quality criteria scores (10 HTSM categories)
130
+ 3. Risk matrix (top 10 risks by risk score)
131
+ 4. Testability assessment (10 principles with scores)
132
+ 5. Test ideas (categorized: unit / integration / E2E)
133
+ 6. Conditional agent findings (if any)
134
+ 7. Recommendations prioritized by risk × impact
135
+
136
+ ## Output
137
+
138
+ Create `features/<slug>/03.5_ideation_report.md` with full QCSD report.
139
+
140
+ Set `{IDEATION_VERDICT}` variable (GO | CONDITIONAL | NO-GO).
141
+ Set `{QUALITY_RISKS}` variable with top risks for downstream steps.
142
+
143
+ ## Checkpoint Format
144
+
145
+ ```
146
+ ═══════════════════════════════════════════════════════
147
+ ⏸️ STEP 3.5: QCSD Ideation Swarm Complete
148
+ <promise>FEATURE_ADR_QUALITY_ASSESSED</promise>
149
+ Tier: {COMPLEXITY_TIER}
150
+
151
+ Verdict: {GO | CONDITIONAL | NO-GO}
152
+ Agents spawned: {N} (3 core + {M} conditional)
153
+ Testability: {score}/100 | HTSM: {N}/10 | Critical risks: {K}
154
+
155
+ • "ок" — proceed to implementation planning
156
+ • "NO-GO: rework [area]" — return to Step 1/3
157
+ • "углуби [category]" — deeper analysis
158
+ ═══════════════════════════════════════════════════════
159
+ ```
160
+
161
+ ## Quality Gates
162
+
163
+ - [ ] All 3 core agents spawned and completed
164
+ - [ ] Conditional agents spawned for all TRUE flags
165
+ - [ ] GO/NO-GO decision applied correctly
166
+ - [ ] NO-GO blocks pipeline (returns to Step 1 or 3)
167
+ - [ ] Testability score computed (0-100)
168
+ - [ ] Risk matrix contains ≥10 risks
169
+ - [ ] HTSM 10 categories all evaluated
170
+ - [ ] Ideation report created
171
+
172
+ ## Anti-Patterns
173
+
174
+ | Anti-Pattern | Detection | Fix |
175
+ |-------------|-----------|-----|
176
+ | Skipping ideation "for speed" | No 03.5 artifact | BLOCK — mandatory for M+ |
177
+ | Fewer than 3 core agents | Agent count < 3 | BLOCK — all 3 required |
178
+ | Skipping conditional agents | TRUE flag without agent | BLOCK — spawn if flag is TRUE |
179
+ | Ignoring NO-GO verdict | Proceeding despite NO-GO | BLOCK — rework required |
180
+ | Placeholder analysis | "[TODO]" in report | Reject — full analysis required |
@@ -10,17 +10,48 @@ Always runs. Adapts depth by tier:
10
10
 
11
11
  ## Model
12
12
 
13
- sonnet (analytical decomposition)
13
+ sonnet (analytical decomposition) + code-goal-planner SPARC-GOAP methodology
14
14
 
15
15
  ## Input
16
16
 
17
17
  - `{REQUIREMENTS}` from Step 1
18
18
  - `{ADR_DECISIONS}` from Step 3 (M+)
19
+ - `{IDEATION_VERDICT}` and `{QUALITY_RISKS}` from Step 3.5 (M+)
19
20
  - `{DOMAIN_MODEL}` from Step 4 (L/XL)
20
21
  - `{ARCHITECTURE}` from Step 5 (M+)
21
22
 
22
23
  ## Protocol
23
24
 
25
+ > Load: `references/agentic-qe/code-goal-planner.md` for SPARC-GOAP methodology.
26
+
27
+ ### 0. Apply SPARC-GOAP Goal State Analysis
28
+
29
+ Before decomposing tasks, define the goal state using the code-goal-planner SPARC methodology:
30
+
31
+ ```yaml
32
+ goal: implement_{feature_slug}
33
+ current_state:
34
+ features_complete: [existing features in codebase]
35
+ test_coverage: {current %}
36
+ relevant_files: [files that will be affected]
37
+
38
+ goal_state:
39
+ features_complete: [...current, {new feature}]
40
+ test_coverage: {target %}
41
+ acceptance_criteria: [from {REQUIREMENTS}]
42
+ adr_decisions_implemented: [from {ADR_DECISIONS}]
43
+ quality_risks_mitigated: [from {QUALITY_RISKS}]
44
+
45
+ sparc_phases:
46
+ specification: {REQUIREMENTS} + {ADR_DECISIONS}
47
+ pseudocode: Algorithm/logic design from ADRs
48
+ architecture: {ARCHITECTURE} + {DOMAIN_MODEL}
49
+ refinement: TDD cycles per task group
50
+ completion: Integration + deployment + validation
51
+ ```
52
+
53
+ This analysis provides the planning context for task decomposition below.
54
+
24
55
  ### 1. Decompose into Tasks
25
56
 
26
57
  Break the feature into atomic tasks. Each task should be:
@@ -28,13 +59,16 @@ Break the feature into atomic tasks. Each task should be:
28
59
  - **Completable** — produces working code (not half-done)
29
60
  - **Testable** — has clear done criteria
30
61
 
31
- Task format:
62
+ Task format (SPARC-enhanced):
32
63
  ```
33
64
  TASK-{N}: {Title}
34
65
  Description: {What to do}
66
+ SPARC Phase: specification | pseudocode | architecture | refinement | completion
35
67
  Files: {Files to create/modify}
36
68
  Depends on: TASK-{M} (or none)
37
69
  Test: {How to verify it works}
70
+ Success Criteria: {Measurable outcome}
71
+ Risk Mitigation: {From QUALITY_RISKS if applicable}
38
72
  ```
39
73
 
40
74
  ### 2. Order by Dependencies
@@ -54,16 +88,17 @@ Rules:
54
88
  - Tasks with no dependencies go first
55
89
  - Parallel-safe tasks are marked for concurrent execution
56
90
  - Tests depend on the code they test (but can be written first — TDD)
91
+ - Map each task group to a SPARC phase (spec → pseudo → arch → refine → complete)
57
92
 
58
93
  ### 3. Identify Parallel Groups
59
94
 
60
95
  Group tasks that can be worked on simultaneously:
61
96
 
62
97
  ```
63
- Group 1: TASK-1, TASK-6 (no dependencies, can parallel)
64
- Group 2: TASK-2, TASK-3 (depend on Group 1)
65
- Group 3: TASK-4 (depends on Group 2)
66
- Group 4: TASK-5 (depends on all)
98
+ Group 1: TASK-1, TASK-6 (no dependencies, can parallel) [SPARC: architecture]
99
+ Group 2: TASK-2, TASK-3 (depend on Group 1) [SPARC: refinement]
100
+ Group 3: TASK-4 (depends on Group 2) [SPARC: refinement]
101
+ Group 4: TASK-5 (depends on all) [SPARC: completion]
67
102
  ```
68
103
 
69
104
  For L/XL: assign parallel groups to different agents.
@@ -76,12 +111,26 @@ Insert checkpoints between groups:
76
111
  - After controllers → verify API contract
77
112
  - After tests → verify coverage
78
113
 
79
- ### 5. Risk Assessment
114
+ ### 5. Risk Assessment (enhanced with QCSD findings)
80
115
 
81
116
  For each group, identify:
82
117
  - What could block this task?
83
118
  - What's the fallback if approach doesn't work?
84
119
  - Does this task have external dependencies (APIs, packages)?
120
+ - **NEW**: Which risks from `{QUALITY_RISKS}` (Step 3.5) affect this task?
121
+ - **NEW**: What mitigation from the ideation report applies here?
122
+
123
+ ### 6. Requirements Gap Check
124
+
125
+ Before finalizing the plan, validate completeness:
126
+
127
+ 1. Cross-reference every `{REQUIREMENT}` (FR-N) → at least one TASK covers it
128
+ 2. Cross-reference every `{ADR_DECISION}` → at least one TASK implements it
129
+ 3. Cross-reference every critical risk from `{QUALITY_RISKS}` → mitigation in some TASK
130
+ 4. If gaps found → add missing TASKs and re-order the DAG
131
+ 5. **Iterate until no gaps remain** (max 3 iterations, then flag for user)
132
+
133
+ This gap-check loop ensures the implementation plan is complete before coding begins.
85
134
 
86
135
  ## Output
87
136
 
@@ -56,19 +56,53 @@ For critical user flows:
56
56
  - Test with realistic data volumes
57
57
  - Test failure recovery scenarios
58
58
 
59
- ### 3. Code Review (M+)
59
+ ### 3. Code Review via Brutal Honesty Review (M+)
60
60
 
61
- Adapted from agentic-qe brutal-honesty-review protocol:
61
+ > Load: `references/agentic-qe/brutal-honesty-review.md`
62
62
 
63
- #### Review Dimensions
63
+ Apply the **brutal-honesty-review** protocol from agentic-qe (Tier 2: Validated).
64
64
 
65
- | Dimension | Weight | Questions |
66
- |-----------|--------|-----------|
67
- | **Correctness** | 30% | Does it do what requirements say? Edge cases handled? |
68
- | **Security** | 20% | Injection risks? Auth bypasses? Data exposure? |
69
- | **Maintainability** | 20% | Readable? Follows patterns? Future-proof? |
70
- | **Performance** | 15% | N+1 queries? Unnecessary allocations? Missing indexes? |
71
- | **Consistency** | 15% | Matches codebase conventions? Naming consistent? |
65
+ #### Mode Selection
66
+
67
+ Choose review mode based on context:
68
+
69
+ | Mode | When | Style |
70
+ |------|------|-------|
71
+ | **Linus** (technical precision) | Code has architectural/performance issues | "You're holding the lock for the entire I/O. Did you test under load?" |
72
+ | **Ramsay** (standards-driven quality) | Tests or quality is subpar | "15 tests, 14 happy path. Where's the edge cases?" |
73
+ | **Bach** (BS detection) | Architecture decisions seem cargo-cult | "Why are you using microservices for a single-user tool?" |
74
+
75
+ **Default mode**: Linus for code review, Ramsay for test review.
76
+ **Calibration**: Level 1 (Direct) — professional and actionable.
77
+
78
+ #### Review Structure (per finding)
79
+
80
+ ```markdown
81
+ ## What's Broken
82
+ [Surgical description — specific file, line, function]
83
+
84
+ ## Why It's Wrong
85
+ [Technical explanation with evidence, not opinion]
86
+
87
+ ## What Correct Looks Like
88
+ [Clear model of excellence — code example or pattern reference]
89
+
90
+ ## How to Fix It
91
+ [Actionable steps, specific to this codebase]
92
+
93
+ ## Why This Matters
94
+ [Impact if not fixed — security, performance, maintainability]
95
+ ```
96
+
97
+ #### Review Dimensions (weighted)
98
+
99
+ | Dimension | Weight | Mode | Questions |
100
+ |-----------|--------|------|-----------|
101
+ | **Correctness** | 30% | Linus | Does it do what requirements say? Edge cases handled? |
102
+ | **Security** | 20% | Linus | Injection risks? Auth bypasses? Data exposure? |
103
+ | **Maintainability** | 20% | Ramsay | Readable? Follows patterns? Future-proof? |
104
+ | **Performance** | 15% | Linus | N+1 queries? Unnecessary allocations? Missing indexes? |
105
+ | **Consistency** | 15% | Ramsay | Matches codebase conventions? Naming consistent? |
72
106
 
73
107
  #### Review Process
74
108
 
@@ -76,24 +110,51 @@ Adapted from agentic-qe brutal-honesty-review protocol:
76
110
  2. **Check against requirements** — is anything missing or extra?
77
111
  3. **Check against ADR decisions** — does code match chosen approach?
78
112
  4. **Check against architecture** — do components match diagrams?
79
- 5. **Flag issues** with severity:
80
- - 🔴 **BLOCKER** — must fix before merge
81
- - 🟡 **WARNING** — should fix, but not blocking
113
+ 5. **Check against QCSD ideation risks** — are `{QUALITY_RISKS}` from Step 3.5 mitigated?
114
+ 6. **Flag issues** with severity:
115
+ - 🔴 **BLOCKER** — must fix before merge (Linus mode: "This is completely broken")
116
+ - 🟡 **WARNING** — should fix, but not blocking (Ramsay mode: "This is RAW")
82
117
  - 🔵 **SUGGESTION** — nice to have improvement
83
118
 
84
- ### 4. Multi-Agent Review Panel (XL only)
119
+ ### 4. Multi-Agent Review Panel (L/XL)
120
+
121
+ For L/XL features, spawn 3 parallel review agents using brutal-honesty modes:
122
+
123
+ | Agent | Role | Mode | Model | Focus |
124
+ |-------|------|------|-------|-------|
125
+ | Agent 1 | Correctness Reviewer | Linus | sonnet | Requirements coverage, logic errors, performance |
126
+ | Agent 2 | Security Reviewer | Linus | sonnet | OWASP top 10, auth, data exposure |
127
+ | Agent 3 | Quality & Architecture Reviewer | Ramsay | sonnet | Test quality, pattern compliance, ADR adherence |
85
128
 
86
- For XL features, spawn 3 parallel review agents:
129
+ Each agent produces independent findings using the brutal-honesty structure
130
+ (What's Broken → Why → Correct → Fix → Impact). Synthesize into single report.
87
131
 
88
- | Agent | Role | Model | Focus |
89
- |-------|------|-------|-------|
90
- | Agent 1 | Correctness Reviewer | sonnet | Requirements coverage, logic errors |
91
- | Agent 2 | Security Reviewer | sonnet | OWASP top 10, auth, data exposure |
92
- | Agent 3 | Architecture Reviewer | sonnet | Pattern compliance, ADR adherence |
132
+ ### 5. Gap Detection Loop (M+)
133
+
134
+ After review findings are compiled, run a gap check:
135
+
136
+ ```
137
+ ITERATION {N}:
138
+ 1. Check: Every FR-{N} from requirements → has passing test or verification
139
+ 2. Check: Every ADR decision → reflected in code
140
+ 3. Check: Every critical risk from QCSD → has mitigation in code
141
+ 4. Check: Every 🔴 BLOCKER → has fix plan
142
+
143
+ If gaps found:
144
+ → List gaps explicitly
145
+ → Fix gaps (return to Step 7 for code changes if needed)
146
+ → Re-run smoke tests
147
+ → Increment iteration counter
148
+
149
+ If no gaps:
150
+ → Proceed to acceptance criteria validation
151
+
152
+ Max iterations: 3. After 3 iterations, flag remaining gaps for user decision.
153
+ ```
93
154
 
94
- Each agent produces independent findings. Synthesize into single report.
155
+ This loop implements the "did we miss something?" recursive check from the original pipeline spec.
95
156
 
96
- ### 5. Acceptance Criteria Validation
157
+ ### 6. Acceptance Criteria Validation
97
158
 
98
159
  For each requirement from Step 1:
99
160
  ```
@@ -103,7 +164,7 @@ FR-{N}: {requirement}
103
164
  Test: {test name or manual verification}
104
165
  ```
105
166
 
106
- ### 6. QE Report
167
+ ### 7. QE Report
107
168
 
108
169
  Compile all findings into a structured report:
109
170
 
@@ -164,4 +225,7 @@ Verdict: {READY | NEEDS FIXES | CONDITIONAL}
164
225
  - [ ] No 🔴 BLOCKER findings remain
165
226
  - [ ] All MUST requirements have ✅ PASS status
166
227
  - [ ] Test coverage adequate for tier (S: smoke, M: unit, L: unit+integration, XL: full)
228
+ - [ ] Brutal-honesty review completed (M+) with structured findings
229
+ - [ ] Gap detection loop completed with zero remaining gaps (M+)
230
+ - [ ] QCSD quality risks from Step 3.5 verified as mitigated (M+)
167
231
  - [ ] QE report created and complete