@dzhechkov/keysarium 1.1.2 → 1.3.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 (62) hide show
  1. package/README.md +7 -2
  2. package/package.json +10 -2
  3. package/templates/.claude/commands/brain-export.md +97 -20
  4. package/templates/.claude/commands/brain-import.md +75 -4
  5. package/templates/.claude/commands/dream.md +101 -0
  6. package/templates/.claude/commands/feature-adr.md +92 -0
  7. package/templates/.claude/commands/init-platform.md +161 -0
  8. package/templates/.claude/commands/learning-stats.md +130 -0
  9. package/templates/.claude/commands/workers.md +140 -0
  10. package/templates/.claude/rules/background-workers.md +72 -0
  11. package/templates/.claude/rules/dream-cycles.md +90 -0
  12. package/templates/.claude/rules/feature-adr-conventions.md +82 -0
  13. package/templates/.claude/rules/reward-learning.md +124 -0
  14. package/templates/.claude/shards/feature-adr.shard.md +98 -0
  15. package/templates/.claude/skills/feature-adr/SKILL.md +252 -0
  16. package/templates/.claude/skills/feature-adr/examples/sample-feature-output.md +257 -0
  17. package/templates/.claude/skills/feature-adr/modules/00-complexity-router.md +114 -0
  18. package/templates/.claude/skills/feature-adr/modules/01-requirements.md +113 -0
  19. package/templates/.claude/skills/feature-adr/modules/02-research.md +92 -0
  20. package/templates/.claude/skills/feature-adr/modules/03-adr.md +135 -0
  21. package/templates/.claude/skills/feature-adr/modules/04-ddd.md +114 -0
  22. package/templates/.claude/skills/feature-adr/modules/05-architecture.md +149 -0
  23. package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +129 -0
  24. package/templates/.claude/skills/feature-adr/modules/07-code.md +126 -0
  25. package/templates/.claude/skills/feature-adr/modules/08-qe.md +167 -0
  26. package/templates/.claude/skills/feature-adr/references/adr-template.md +102 -0
  27. package/templates/.claude/skills/feature-adr/references/c4-template.md +120 -0
  28. package/templates/.claude/skills/feature-adr/references/complexity-matrix.md +139 -0
  29. package/templates/.claude/skills/feature-adr/references/qe-checklist.md +86 -0
  30. package/templates/CLAUDE.md +135 -8
  31. package/templates/docs/feature-adr/01-architecture.md +750 -0
  32. package/templates/docs/feature-adr/02-functionality.md +712 -0
  33. package/templates/docs/feature-adr/03-deployment-guide.md +614 -0
  34. package/templates/docs/feature-adr/04-admin-guide.md +564 -0
  35. package/templates/docs/feature-adr/05-user-guide.md +508 -0
  36. package/templates/docs/feature-adr/06-user-flows.md +1101 -0
  37. package/templates/docs/improvement-directions.md +16 -16
  38. package/templates/docs/keysarium/01-deployment-guide.md +21 -12
  39. package/templates/docs/keysarium/02-admin-guide.md +204 -3
  40. package/templates/docs/keysarium/03-user-guide.md +224 -0
  41. package/templates/docs/keysarium/05-architecture.md +181 -0
  42. package/templates/docs/keysarium/06-user-flows.md +235 -0
  43. package/templates/docs/keysarium-core/01-architecture.md +559 -0
  44. package/templates/docs/keysarium-core/02-functionality.md +953 -0
  45. package/templates/docs/keysarium-core/03-deployment-guide.md +625 -0
  46. package/templates/docs/keysarium-core/04-admin-guide.md +529 -0
  47. package/templates/docs/keysarium-core/05-user-guide.md +599 -0
  48. package/templates/docs/keysarium-core/06-user-flows.md +804 -0
  49. package/templates/lib/background-workers.md +278 -0
  50. package/templates/lib/dream-engine.md +460 -0
  51. package/templates/lib/judge-attestation.md +322 -0
  52. package/templates/lib/memory-protocol.md +344 -0
  53. package/templates/lib/platform-adapters.md +100 -0
  54. package/templates/lib/platform-templates/copilot.md +134 -0
  55. package/templates/lib/platform-templates/cursor.md +95 -0
  56. package/templates/lib/platform-templates/opencode.md +155 -0
  57. package/templates/lib/reward-tracker.md +256 -0
  58. package/templates/lib/witness-chain.md +372 -0
  59. package/templates/lib/worker-templates/brain-export.md +187 -0
  60. package/templates/lib/worker-templates/consolidate.md +180 -0
  61. package/templates/lib/worker-templates/dream-cycle.md +154 -0
  62. package/templates/lib/worker-templates/health-check.md +255 -0
@@ -0,0 +1,114 @@
1
+ # Step 4: Domain-Driven Design
2
+
3
+ > Model the domain to ensure code structure reflects business concepts.
4
+
5
+ ## When
6
+
7
+ L/XL tiers only. Can run **in parallel** with Step 5 (Architecture) if Step 3 is complete.
8
+
9
+ ## Model
10
+
11
+ opus (complex domain reasoning)
12
+
13
+ ## Input
14
+
15
+ - `{REQUIREMENTS}` from Step 1
16
+ - `{RESEARCH_FINDINGS}` from Step 2
17
+ - `{ADR_DECISIONS}` from Step 3
18
+ - Existing codebase domain structure
19
+
20
+ ## Protocol
21
+
22
+ ### 1. Identify Bounded Contexts
23
+
24
+ Analyze requirements for natural domain boundaries:
25
+
26
+ | Signal | Bounded Context |
27
+ |--------|----------------|
28
+ | Different stakeholders | Separate contexts |
29
+ | Different data lifecycles | Separate contexts |
30
+ | Different ubiquitous languages | Separate contexts |
31
+ | Shared data with different semantics | Separate contexts with shared kernel |
32
+
33
+ For **existing projects**: map new feature to existing bounded contexts first.
34
+ Only propose new contexts when the feature genuinely introduces a new domain.
35
+
36
+ ### 2. Define Ubiquitous Language
37
+
38
+ For each bounded context involved:
39
+
40
+ ```
41
+ ## Context: {Name}
42
+
43
+ | Term | Definition | NOT to be confused with |
44
+ |------|-----------|------------------------|
45
+ | {Term1} | {Precise definition} | {Common misuse} |
46
+ | {Term2} | {Precise definition} | {Common misuse} |
47
+ ```
48
+
49
+ Verify terms against:
50
+ - Existing codebase naming (Grep for conflicts)
51
+ - Requirement document terminology
52
+ - Stakeholder vocabulary
53
+
54
+ ### 3. Model Aggregates & Entities
55
+
56
+ ```
57
+ Aggregate: {Name}
58
+ ├── Root Entity: {Name}
59
+ │ ├── {field}: {type}
60
+ │ └── {field}: {type}
61
+ ├── Value Object: {Name}
62
+ │ └── {field}: {type}
63
+ └── Domain Event: {EventName}
64
+ └── {payload}
65
+ ```
66
+
67
+ Rules:
68
+ - Aggregates are consistency boundaries
69
+ - Entities have identity, Value Objects don't
70
+ - Domain Events signal state changes
71
+
72
+ ### 4. Map Relationships
73
+
74
+ ```mermaid
75
+ graph LR
76
+ A[Context A] -- Shared Kernel --> B[Context B]
77
+ A -- Upstream/Downstream --> C[Context C]
78
+ C -- Anti-Corruption Layer --> D[External System]
79
+ ```
80
+
81
+ Relationship types:
82
+ - **Shared Kernel:** Shared code/models between contexts
83
+ - **Customer-Supplier:** Upstream provides, downstream consumes
84
+ - **Conformist:** Downstream adopts upstream model as-is
85
+ - **Anti-Corruption Layer:** Translate between incompatible models
86
+ - **Open Host Service:** Public API for multiple consumers
87
+
88
+ ### 5. Validate Against Codebase
89
+
90
+ Check that proposed domain model is compatible with existing code:
91
+ - Do new entities conflict with existing names?
92
+ - Can aggregates be implemented with existing ORM/framework?
93
+ - Do relationships align with existing data access patterns?
94
+
95
+ ## Output
96
+
97
+ Create `features/<slug>/04_domain_model.md` with:
98
+ - Bounded context map
99
+ - Ubiquitous language glossary
100
+ - Aggregate/Entity/VO definitions
101
+ - Relationship diagram (Mermaid)
102
+ - Mapping to existing codebase structures
103
+
104
+ Create `features/<slug>/diagrams/domain-model.mermaid`
105
+
106
+ Set `{DOMAIN_MODEL}` variable.
107
+
108
+ ## Quality Gates
109
+
110
+ - [ ] All new terms defined in ubiquitous language
111
+ - [ ] No naming conflicts with existing codebase
112
+ - [ ] Aggregates have clear consistency boundaries
113
+ - [ ] Relationships between contexts are typed
114
+ - [ ] Domain model is implementable with current tech stack
@@ -0,0 +1,149 @@
1
+ # Step 5: Technical Architecture
2
+
3
+ > Design the technical architecture using C4 diagrams and sequence flows.
4
+
5
+ ## When
6
+
7
+ M+ tiers. Depth varies:
8
+ - **M:** Component diagram only (light)
9
+ - **L/XL:** Full C4 (Context + Container + Component) + sequence diagrams
10
+
11
+ ## Model
12
+
13
+ opus (system design)
14
+
15
+ ## Input
16
+
17
+ - `{REQUIREMENTS}` from Step 1
18
+ - `{ADR_DECISIONS}` from Step 3
19
+ - `{DOMAIN_MODEL}` from Step 4 (L/XL only)
20
+ - `{RESEARCH_FINDINGS}` from Step 2 (L/XL only)
21
+
22
+ ## Protocol
23
+
24
+ ### 1. C4 Level 1 — System Context (L/XL only)
25
+
26
+ Show the system in its environment:
27
+
28
+ ```mermaid
29
+ graph TB
30
+ User[User] --> System[Our System]
31
+ System --> ExtA[External System A]
32
+ System --> ExtB[External System B]
33
+ ```
34
+
35
+ Define:
36
+ - Who uses the system? (actors)
37
+ - What external systems does it interact with?
38
+ - What are the trust boundaries?
39
+
40
+ ### 2. C4 Level 2 — Container Diagram (L/XL only)
41
+
42
+ Show high-level technical building blocks:
43
+
44
+ ```mermaid
45
+ graph TB
46
+ subgraph System
47
+ WebApp[Web App<br/>React]
48
+ API[API Server<br/>Node.js]
49
+ DB[(Database<br/>PostgreSQL)]
50
+ Queue[Message Queue<br/>Redis]
51
+ end
52
+ WebApp --> API
53
+ API --> DB
54
+ API --> Queue
55
+ ```
56
+
57
+ ### 3. C4 Level 3 — Component Diagram (M/L/XL)
58
+
59
+ Show components within the container affected by this feature:
60
+
61
+ ```mermaid
62
+ graph TB
63
+ subgraph API
64
+ Controller[FeatureController]
65
+ Service[FeatureService]
66
+ Repository[FeatureRepository]
67
+ Validator[InputValidator]
68
+ end
69
+ Controller --> Validator
70
+ Controller --> Service
71
+ Service --> Repository
72
+ ```
73
+
74
+ For M-tier: this is the ONLY diagram required.
75
+
76
+ ### 4. Sequence Diagrams (L/XL)
77
+
78
+ For each main user flow, create a sequence diagram:
79
+
80
+ ```mermaid
81
+ sequenceDiagram
82
+ actor User
83
+ User->>Controller: POST /api/feature
84
+ Controller->>Validator: validate(input)
85
+ Validator-->>Controller: valid
86
+ Controller->>Service: createFeature(data)
87
+ Service->>Repository: save(entity)
88
+ Repository-->>Service: entity
89
+ Service-->>Controller: result
90
+ Controller-->>User: 201 Created
91
+ ```
92
+
93
+ Create at minimum:
94
+ - Happy path flow
95
+ - Main error flow
96
+ - Async flow (if applicable)
97
+
98
+ ### 5. Data Flow & Storage (L/XL)
99
+
100
+ Document:
101
+ - New tables/collections/schemas
102
+ - Migrations needed
103
+ - Data flow between components
104
+ - Caching strategy (if applicable)
105
+
106
+ ### 6. API Design (if applicable)
107
+
108
+ For features exposing APIs:
109
+
110
+ ```
111
+ POST /api/v1/{resource}
112
+ Request: { field1: type, field2: type }
113
+ Response: { id: string, ...fields }
114
+ Errors: 400, 401, 404, 422
115
+
116
+ GET /api/v1/{resource}/:id
117
+ Response: { ...full resource }
118
+ Errors: 401, 404
119
+ ```
120
+
121
+ ## Output
122
+
123
+ ### M-tier
124
+ Create `features/<slug>/05_architecture.md` with:
125
+ - Component diagram
126
+ - Brief API design (if applicable)
127
+
128
+ ### L/XL-tier
129
+ Create `features/<slug>/05_architecture.md` with:
130
+ - C4 diagrams (all 3 levels)
131
+ - Sequence diagrams
132
+ - Data model changes
133
+ - API design
134
+
135
+ Create `features/<slug>/diagrams/`:
136
+ - `architecture-c4.mermaid`
137
+ - `sequence-*.mermaid`
138
+
139
+ Set `{ARCHITECTURE}` variable.
140
+
141
+ ## Quality Gates
142
+
143
+ - [ ] Component diagram covers all new components
144
+ - [ ] Each component has clear responsibility
145
+ - [ ] ADR decisions are reflected in architecture
146
+ - [ ] Domain model (Step 4) maps to components (L/XL)
147
+ - [ ] Mermaid syntax is valid
148
+ - [ ] No circular dependencies between components
149
+ - [ ] API follows existing project conventions
@@ -0,0 +1,129 @@
1
+ # Step 6: Implementation Plan
2
+
3
+ > Decompose the feature into ordered, estimable tasks with dependencies.
4
+
5
+ ## When
6
+
7
+ Always runs. Adapts depth by tier:
8
+ - **S:** Inline checklist (3-5 items, no file)
9
+ - **M/L/XL:** Full structured plan document
10
+
11
+ ## Model
12
+
13
+ sonnet (analytical decomposition)
14
+
15
+ ## Input
16
+
17
+ - `{REQUIREMENTS}` from Step 1
18
+ - `{ADR_DECISIONS}` from Step 3 (M+)
19
+ - `{DOMAIN_MODEL}` from Step 4 (L/XL)
20
+ - `{ARCHITECTURE}` from Step 5 (M+)
21
+
22
+ ## Protocol
23
+
24
+ ### 1. Decompose into Tasks
25
+
26
+ Break the feature into atomic tasks. Each task should be:
27
+ - **Independent** — can be reviewed/tested in isolation
28
+ - **Completable** — produces working code (not half-done)
29
+ - **Testable** — has clear done criteria
30
+
31
+ Task format:
32
+ ```
33
+ TASK-{N}: {Title}
34
+ Description: {What to do}
35
+ Files: {Files to create/modify}
36
+ Depends on: TASK-{M} (or none)
37
+ Test: {How to verify it works}
38
+ ```
39
+
40
+ ### 2. Order by Dependencies
41
+
42
+ Build a dependency graph:
43
+
44
+ ```
45
+ TASK-1: Create data model
46
+ TASK-2: Create repository (depends: TASK-1)
47
+ TASK-3: Create service (depends: TASK-2)
48
+ TASK-4: Create controller (depends: TASK-3)
49
+ TASK-5: Create tests (depends: TASK-2, TASK-3, TASK-4)
50
+ TASK-6: Create migration (depends: TASK-1)
51
+ ```
52
+
53
+ Rules:
54
+ - Tasks with no dependencies go first
55
+ - Parallel-safe tasks are marked for concurrent execution
56
+ - Tests depend on the code they test (but can be written first — TDD)
57
+
58
+ ### 3. Identify Parallel Groups
59
+
60
+ Group tasks that can be worked on simultaneously:
61
+
62
+ ```
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)
67
+ ```
68
+
69
+ For L/XL: assign parallel groups to different agents.
70
+
71
+ ### 4. Define Checkpoints
72
+
73
+ Insert checkpoints between groups:
74
+ - After data model + migrations → verify schema
75
+ - After services → verify business logic
76
+ - After controllers → verify API contract
77
+ - After tests → verify coverage
78
+
79
+ ### 5. Risk Assessment
80
+
81
+ For each group, identify:
82
+ - What could block this task?
83
+ - What's the fallback if approach doesn't work?
84
+ - Does this task have external dependencies (APIs, packages)?
85
+
86
+ ## Output
87
+
88
+ ### S-tier (inline)
89
+ Inline checklist in conversation:
90
+ ```
91
+ Implementation plan:
92
+ - [ ] {task 1}
93
+ - [ ] {task 2}
94
+ - [ ] {task 3}
95
+ ```
96
+
97
+ ### M/L/XL
98
+ Create `features/<slug>/06_implementation_plan.md` with:
99
+ - Task list with dependencies
100
+ - Parallel groups
101
+ - Checkpoint schedule
102
+ - Risk assessment (L/XL)
103
+
104
+ Set `{IMPL_PLAN}` variable.
105
+
106
+ ## Checkpoint Format
107
+
108
+ ```
109
+ ═══════════════════════════════════════════════════════
110
+ ⏸️ STEP 6/8: Implementation Plan Complete
111
+ <promise>FEATURE_ADR_PLANNED</promise>
112
+ Tier: {COMPLEXITY_TIER}
113
+
114
+ {N} tasks in {M} parallel groups
115
+ Estimated {K} files to create/modify
116
+
117
+ • "ок" — start coding
118
+ • "разбей [TASK-N]" — split task further
119
+ • "объедини [TASK-N, TASK-M]" — merge tasks
120
+ ═══════════════════════════════════════════════════════
121
+ ```
122
+
123
+ ## Quality Gates
124
+
125
+ - [ ] Every task has clear done criteria
126
+ - [ ] Dependencies form a valid DAG (no cycles)
127
+ - [ ] Parallel groups correctly identified
128
+ - [ ] Each task touches identifiable files
129
+ - [ ] Total file count matches complexity tier expectation
@@ -0,0 +1,126 @@
1
+ # Step 7: Code Generation
2
+
3
+ > Implement the feature according to the plan, following existing patterns.
4
+
5
+ ## When
6
+
7
+ Always runs. Adapts by tier:
8
+ - **S:** Single-pass implementation
9
+ - **M:** Sequential task execution with checkpoints
10
+ - **L/XL:** Parallel agents per module/domain
11
+
12
+ ## Model
13
+
14
+ opus (complex code generation)
15
+
16
+ ## Input
17
+
18
+ - `{IMPL_PLAN}` from Step 6
19
+ - `{ARCHITECTURE}` from Step 5 (M+)
20
+ - `{ADR_DECISIONS}` from Step 3 (M+)
21
+ - `{DOMAIN_MODEL}` from Step 4 (L/XL)
22
+ - Codebase context (existing patterns, conventions)
23
+
24
+ ## Protocol
25
+
26
+ ### 1. Pre-Implementation Checklist
27
+
28
+ Before writing any code:
29
+ - [ ] Read existing similar implementations in codebase
30
+ - [ ] Identify naming conventions (files, classes, functions, variables)
31
+ - [ ] Identify import patterns and module structure
32
+ - [ ] Identify error handling patterns
33
+ - [ ] Identify test patterns
34
+
35
+ ### 2. Execute Tasks per Plan
36
+
37
+ For each task in `{IMPL_PLAN}`:
38
+
39
+ ```
40
+ 1. Read existing files that will be modified
41
+ 2. Implement the change following existing patterns
42
+ 3. Verify: does it match the architecture diagram?
43
+ 4. Verify: does it follow ADR decisions?
44
+ 5. Mark task complete
45
+ ```
46
+
47
+ ### 3. Parallel Execution (L/XL)
48
+
49
+ For L/XL tiers with independent modules:
50
+
51
+ | Agent | Scope | Model |
52
+ |-------|-------|-------|
53
+ | Agent 1 | Module A (data layer) | opus |
54
+ | Agent 2 | Module B (service layer) | opus |
55
+ | Agent 3 | Module C (API layer) | opus |
56
+
57
+ Each agent:
58
+ - Works only on its assigned files
59
+ - Follows the same pre-implementation checklist
60
+ - Reports completion with list of created/modified files
61
+
62
+ After all agents complete:
63
+ - Verify integration points between modules
64
+ - Fix any interface mismatches
65
+ - Run existing tests to check for regressions
66
+
67
+ ### 4. Code Quality Rules
68
+
69
+ While implementing:
70
+
71
+ | Rule | Rationale |
72
+ |------|-----------|
73
+ | Follow existing patterns | Consistency > "better" approaches |
74
+ | No over-engineering | Implement exactly what's planned |
75
+ | No premature abstraction | 3 similar lines > 1 premature helper |
76
+ | Handle errors at boundaries | Don't add internal error handling noise |
77
+ | Write self-documenting code | Clear names > comments |
78
+ | Respect ADR decisions | Don't deviate from chosen options |
79
+
80
+ ### 5. Change Manifest
81
+
82
+ Track all changes:
83
+
84
+ ```
85
+ ## Files Created
86
+ - path/to/new/file.ts — {description}
87
+
88
+ ## Files Modified
89
+ - path/to/existing/file.ts — {what changed}
90
+
91
+ ## Files Deleted
92
+ - path/to/removed/file.ts — {why}
93
+ ```
94
+
95
+ ## Output
96
+
97
+ - Actual code changes in the repository
98
+ - `features/<slug>/07_code_changes/change_manifest.md` — list of all changes
99
+
100
+ Set `{CODE_CHANGES}` variable with file list.
101
+
102
+ ## Checkpoint Format
103
+
104
+ ```
105
+ ═══════════════════════════════════════════════════════
106
+ ⏸️ STEP 7/8: Code Implementation Complete
107
+ <promise>FEATURE_ADR_IMPLEMENTED</promise>
108
+ Tier: {COMPLEXITY_TIER}
109
+
110
+ {N} files created, {M} modified, {K} deleted
111
+ Tasks completed: {completed}/{total}
112
+
113
+ • "ок" — proceed to QE
114
+ • "ревью [file]" — review specific file
115
+ • "переделай [task]" — redo specific task
116
+ ═══════════════════════════════════════════════════════
117
+ ```
118
+
119
+ ## Quality Gates
120
+
121
+ - [ ] All planned tasks implemented
122
+ - [ ] Code follows existing codebase conventions
123
+ - [ ] ADR decisions reflected in code
124
+ - [ ] No unintended side effects on existing functionality
125
+ - [ ] Change manifest is complete and accurate
126
+ - [ ] No TODO/FIXME/HACK left without justification
@@ -0,0 +1,167 @@
1
+ # Step 8: Quality Engineering
2
+
3
+ > Verify the implementation through testing, review, and validation.
4
+
5
+ ## When
6
+
7
+ Always runs. Adapts depth by tier:
8
+ - **S:** Smoke test — compile + existing tests pass
9
+ - **M:** Unit tests + basic code review
10
+ - **L:** Unit + integration tests + thorough review
11
+ - **XL:** Full QE — unit + integration + e2e + security + performance review
12
+
13
+ ## Model
14
+
15
+ sonnet (analytical evaluation)
16
+
17
+ ## Input
18
+
19
+ - `{CODE_CHANGES}` from Step 7
20
+ - `{REQUIREMENTS}` from Step 1 (for acceptance criteria)
21
+ - `{ARCHITECTURE}` from Step 5 (for structural validation)
22
+ - `{IMPL_PLAN}` from Step 6 (for completeness check)
23
+
24
+ ## Protocol
25
+
26
+ ### 1. Smoke Tests (All tiers)
27
+
28
+ ```
29
+ - [ ] Code compiles / no syntax errors
30
+ - [ ] Existing test suite passes (no regressions)
31
+ - [ ] Linter passes (if configured)
32
+ - [ ] Type checker passes (if configured)
33
+ ```
34
+
35
+ For S-tier: if all pass, proceed to checkpoint. Done.
36
+
37
+ ### 2. Test Generation (M+)
38
+
39
+ #### Unit Tests
40
+ For each new/modified module:
41
+ - Test happy path
42
+ - Test edge cases (null, empty, boundary values)
43
+ - Test error paths
44
+ - Follow existing test patterns in codebase
45
+
46
+ #### Integration Tests (L/XL)
47
+ For each integration point:
48
+ - Test API endpoints with real request/response cycle
49
+ - Test database operations with test database
50
+ - Test message queue interactions
51
+ - Test external service mocks
52
+
53
+ #### E2E Tests (XL only)
54
+ For critical user flows:
55
+ - Test complete user journey end-to-end
56
+ - Test with realistic data volumes
57
+ - Test failure recovery scenarios
58
+
59
+ ### 3. Code Review (M+)
60
+
61
+ Adapted from agentic-qe brutal-honesty-review protocol:
62
+
63
+ #### Review Dimensions
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? |
72
+
73
+ #### Review Process
74
+
75
+ 1. **Read every changed file** completely
76
+ 2. **Check against requirements** — is anything missing or extra?
77
+ 3. **Check against ADR decisions** — does code match chosen approach?
78
+ 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
82
+ - 🔵 **SUGGESTION** — nice to have improvement
83
+
84
+ ### 4. Multi-Agent Review Panel (XL only)
85
+
86
+ For XL features, spawn 3 parallel review agents:
87
+
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 |
93
+
94
+ Each agent produces independent findings. Synthesize into single report.
95
+
96
+ ### 5. Acceptance Criteria Validation
97
+
98
+ For each requirement from Step 1:
99
+ ```
100
+ FR-{N}: {requirement}
101
+ Status: ✅ PASS | ❌ FAIL | ⚠️ PARTIAL
102
+ Evidence: {how it was verified}
103
+ Test: {test name or manual verification}
104
+ ```
105
+
106
+ ### 6. QE Report
107
+
108
+ Compile all findings into a structured report:
109
+
110
+ ```markdown
111
+ # QE Report: {feature name}
112
+
113
+ ## Summary
114
+ - Tests: {passed}/{total} ({percentage}%)
115
+ - Review findings: {blockers} 🔴 {warnings} 🟡 {suggestions} 🔵
116
+ - Requirements coverage: {covered}/{total} ({percentage}%)
117
+
118
+ ## Test Results
119
+ ### Unit Tests
120
+ {details}
121
+
122
+ ### Integration Tests (L/XL)
123
+ {details}
124
+
125
+ ## Review Findings
126
+ {list of findings with severity}
127
+
128
+ ## Acceptance Criteria
129
+ {FR-N status table}
130
+
131
+ ## Verdict
132
+ ✅ READY FOR MERGE | ❌ NEEDS FIXES | ⚠️ CONDITIONAL APPROVAL
133
+ ```
134
+
135
+ ## Output
136
+
137
+ Create `features/<slug>/08_qe_report.md` with full QE report.
138
+
139
+ Set `{QE_RESULTS}` variable.
140
+
141
+ ## Checkpoint Format
142
+
143
+ ```
144
+ ═══════════════════════════════════════════════════════
145
+ ⏸️ STEP 8/8: Quality Engineering Complete
146
+ <promise>FEATURE_ADR_VERIFIED</promise>
147
+ Tier: {COMPLEXITY_TIER}
148
+
149
+ Tests: {passed}/{total} ✅
150
+ Review: {blockers} blockers, {warnings} warnings
151
+ Requirements: {covered}/{total} covered
152
+
153
+ Verdict: {READY | NEEDS FIXES | CONDITIONAL}
154
+
155
+ • "ок" — feature complete!
156
+ • "исправь [finding]" — fix specific issue
157
+ • "повтори QE" — re-run full QE
158
+ ═══════════════════════════════════════════════════════
159
+ ```
160
+
161
+ ## Quality Gates
162
+
163
+ - [ ] All smoke tests pass
164
+ - [ ] No 🔴 BLOCKER findings remain
165
+ - [ ] All MUST requirements have ✅ PASS status
166
+ - [ ] Test coverage adequate for tier (S: smoke, M: unit, L: unit+integration, XL: full)
167
+ - [ ] QE report created and complete