@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,124 @@
1
+ # Reward Learning Rules
2
+
3
+ ## Purpose
4
+
5
+ Govern how the Keysarium pipeline integrates with the Reward-Calibrated Learning System. These rules define when and how to call `memory_query()` and `memory_store()`, how reward scores are assigned, and how historical patterns influence phase execution.
6
+
7
+ ## Core Protocol
8
+
9
+ Read `lib/memory-protocol.md` for the full protocol specification.
10
+ Read `lib/reward-tracker.md` for analytics and pattern detection.
11
+
12
+ ## When to Call memory_query()
13
+
14
+ **Trigger:** At the START of every pipeline phase (Phase 0 through Phase 5).
15
+
16
+ **Protocol:**
17
+ 1. Before loading the phase's governance shard, check if `.keysarium/memory/` exists.
18
+ 2. If it exists, call `memory_query()` with the current context:
19
+ - `phase`: Current phase identifier (e.g., "phase-2")
20
+ - `domain`: Detected domain from Phase 0 (or "unknown" if Phase 0 has not run yet)
21
+ - `slug`: Current case slug
22
+ - `skill`: Skill about to be loaded for this phase
23
+ 3. Log the number of patterns loaded.
24
+ 4. If relevant patterns are found, incorporate the top 3 into the phase brief:
25
+ - Include high-reward approaches from similar past cases
26
+ - Apply actionable advice from domain patterns
27
+ - Note any bottleneck warnings for the current phase/domain combination
28
+ 5. If no patterns are found (first run or no relevant data), proceed normally.
29
+
30
+ **Exception:** Phase 0 (Discovery) may not have a domain yet. Query with `domain: "unknown"` to load cross-domain patterns.
31
+
32
+ ## When to Call memory_store()
33
+
34
+ **Trigger:** At every CHECKPOINT, after the user responds.
35
+
36
+ **Protocol:**
37
+ 1. After displaying the checkpoint banner and receiving user response.
38
+ 2. Classify the user response into a reward level (see Reward Assignment below).
39
+ 3. Call `memory_store()` with:
40
+ - The phase result (artifacts created, promise tag emitted)
41
+ - The reward score and label
42
+ - Context metadata (upstream promises, patterns loaded, agent count)
43
+ - Outcome metadata (user response, iteration count)
44
+ 4. Log the stored reward.
45
+ 5. Continue with the checkpoint protocol as normal (proceed / adjust / redo).
46
+
47
+ **Exception:** If the session ends without a user response at the checkpoint, do NOT store a record. Only explicit user responses generate reward data.
48
+
49
+ ## Reward Assignment
50
+
51
+ Map the user's checkpoint response to a reward score:
52
+
53
+ | User Response Pattern | Reward | Label | Examples |
54
+ |----------------------|--------|-------|----------|
55
+ | Immediate approval | 1.0 | excellent | "ok", "ок", "next", "продолжай", "good", single-word approval |
56
+ | Minor adjustments | 0.7 | good | "углуби X", "expand section Y", "add one more competitor", feedback on 1 area |
57
+ | Significant rework | 0.3 | needs_work | "rework the approach", "this misses the point of X and Y", feedback on 3+ areas |
58
+ | Complete restart | 0.0 | failed | "start over", "this is wrong", "redo this phase completely" |
59
+
60
+ ### Classification Rules
61
+
62
+ 1. **Count the areas of feedback:** 0 areas = 1.0, 1 area = 0.7, 2+ areas = 0.3, full restart = 0.0
63
+ 2. **Positive feedback with minor note** counts as 1.0 (e.g., "great work, just fix the typo")
64
+ 3. **Multiple rounds:** If user gives feedback more than twice on the same phase, cap reward at 0.3
65
+ 4. **Ambiguous responses:** Default to 0.7 (assume minor adjustment)
66
+
67
+ ## Integration with Promise Tags
68
+
69
+ Every `memory_store()` call includes the promise tag emitted at the checkpoint:
70
+
71
+ | Phase | Promise Tag in Record |
72
+ |-------|----------------------|
73
+ | Phase 0 | `DISCOVERY_COMPLETE` |
74
+ | Phase 1 | `CASE_EXPLORED` |
75
+ | Phase 2 | `RESEARCH_PARANOID_PASSED` |
76
+ | Phase 2.5 | `CJM_VALIDATED` |
77
+ | Phase 3 | `SOLUTION_DESIGNED` |
78
+ | Phase 4 | `ARCHITECTURE_DEFINED` |
79
+ | Phase 5 | `PRESENTATION_READY` |
80
+
81
+ If a promise is `_INCOMPLETE`, the reward should be 0.3 or lower.
82
+
83
+ ## Integration with Feedback Loops
84
+
85
+ This system adds a new feedback loop to the Variable Registry (see `.claude/rules/feedback-loops.md`):
86
+
87
+ ### Loop 7: Memory -> All Phases
88
+
89
+ | Property | Value |
90
+ |----------|-------|
91
+ | Direction | `.keysarium/memory/` -> Phase 0-5 start |
92
+ | Variable | `{MEMORY_PATTERNS}` |
93
+ | Payload | Top reward records + domain patterns from memory_query() |
94
+ | Consumers | All phases (loaded at phase start) |
95
+ | Persistence | `.keysarium/memory/{domain}/{slug}/` |
96
+
97
+ **Contract:** `memory_query()` is called before each phase starts. Empty result is acceptable (first run).
98
+
99
+ ## Retention Policy
100
+
101
+ - **Default:** 90 days from record creation
102
+ - **Configuration:** Set in `.keysarium/memory/config.json` via `retention_days`
103
+ - **Enforcement:** Expired records are purged during `memory_query()` calls
104
+ - **Override:** Set `retention_days: 0` to disable expiration (keep forever)
105
+ - **Manual purge:** Delete `.keysarium/memory/` directory to reset all memory
106
+
107
+ ## Error Handling
108
+
109
+ | Situation | Behavior |
110
+ |-----------|----------|
111
+ | `.keysarium/memory/` does not exist | `memory_query()` returns empty; `memory_store()` creates it |
112
+ | `config.json` missing | Use defaults (90 days, 10 max results, enabled) |
113
+ | Corrupted JSON file during query | Skip file, log warning, continue with other records |
114
+ | Write failure during store | Log error, continue pipeline (memory is non-blocking) |
115
+ | Unknown domain | Store under `unknown/` directory |
116
+
117
+ ## Rules Summary
118
+
119
+ 1. **ALWAYS** call `memory_query()` at the start of every phase
120
+ 2. **ALWAYS** call `memory_store()` at every checkpoint after user responds
121
+ 3. **NEVER** block the pipeline if memory operations fail
122
+ 4. **NEVER** store a record without an explicit user response
123
+ 5. **ALWAYS** log memory operations (patterns loaded, reward stored)
124
+ 6. Memory operations are **advisory** -- they enhance quality but are not mandatory gates
@@ -0,0 +1,98 @@
1
+ # Feature ADR — Governance Shard
2
+
3
+ ## Skill
4
+ Load: `.claude/skills/feature-adr/SKILL.md`
5
+
6
+ ## Prerequisites
7
+ - None (standalone command, not part of casarium pipeline)
8
+
9
+ ## Mandatory Outputs by Tier
10
+
11
+ ### Tier S
12
+ - `features/<slug>/00_complexity_assessment.md`
13
+ - `features/<slug>/06_implementation_plan.md` (or inline)
14
+ - `features/<slug>/08_qe_report.md`
15
+ - `features/<slug>/README.md`
16
+ - Actual code changes in repository
17
+
18
+ ### Tier M
19
+ All of S, plus:
20
+ - `features/<slug>/01_requirements.md`
21
+ - `features/<slug>/03_adr/001-*.md`
22
+ - `features/<slug>/05_architecture.md`
23
+ - `features/<slug>/07_code_changes/change_manifest.md`
24
+ - `features/<slug>/diagrams/` (component diagram)
25
+
26
+ ### Tier L
27
+ All of M, plus:
28
+ - `features/<slug>/02_research.md`
29
+ - `features/<slug>/04_domain_model.md`
30
+ - `features/<slug>/diagrams/domain-model.mermaid`
31
+ - `features/<slug>/diagrams/architecture-c4.mermaid`
32
+ - `features/<slug>/diagrams/sequence-*.mermaid`
33
+
34
+ ### Tier XL
35
+ All of L (full depth on every artifact)
36
+
37
+ ## Step-Level Quality Gates
38
+
39
+ | Step | Gate |
40
+ |------|------|
41
+ | 0 | Tier classification justified with dimension scores |
42
+ | 1 | All requirements have acceptance criteria (M+) |
43
+ | 2 | Research findings verified, not hallucinated (L/XL) |
44
+ | 3 | Every ADR has ≥2 alternatives (M+) |
45
+ | 4 | Domain model compatible with existing codebase (L/XL) |
46
+ | 5 | Mermaid diagrams valid syntax (M+) |
47
+ | 6 | Task dependencies form valid DAG |
48
+ | 7 | Code follows existing codebase conventions |
49
+ | 8 | No blocker findings remain, all MUST requirements pass |
50
+
51
+ ## Agent Swarm
52
+
53
+ ### S/M tier
54
+ Sequential execution. No parallel agents needed.
55
+
56
+ ### L tier
57
+ - Steps 2+3: 2 parallel agents (sonnet + opus)
58
+ - Step 8: 3 parallel agents (sonnet × 3)
59
+
60
+ ### XL tier
61
+ - Steps 2+3: 2 parallel agents
62
+ - Steps 4+5: 2 parallel agents (if Step 3 done)
63
+ - Step 7: N parallel agents (per module)
64
+ - Step 8: 3 parallel agents (review panel)
65
+
66
+ ## Model Routing
67
+
68
+ | Step | Model | Rationale |
69
+ |------|-------|-----------|
70
+ | 0 | haiku | Simple classification |
71
+ | 1 | sonnet | Analytical requirements |
72
+ | 2 | sonnet | Research synthesis |
73
+ | 3 | opus | Complex trade-off reasoning |
74
+ | 4 | opus | Domain modeling |
75
+ | 5 | opus | System design |
76
+ | 6 | sonnet | Task decomposition |
77
+ | 7 | opus | Code generation |
78
+ | 8 | sonnet | Review and testing |
79
+
80
+ ## Promise Tags
81
+
82
+ | Step | Promise |
83
+ |------|---------|
84
+ | 0 | `<promise>FEATURE_ADR_ROUTED</promise>` |
85
+ | 1 | `<promise>FEATURE_ADR_REQUIREMENTS_GATHERED</promise>` |
86
+ | 2-5 | `<promise>FEATURE_ADR_DESIGNED</promise>` |
87
+ | 6 | `<promise>FEATURE_ADR_PLANNED</promise>` |
88
+ | 7 | `<promise>FEATURE_ADR_IMPLEMENTED</promise>` |
89
+ | 8 | `<promise>FEATURE_ADR_VERIFIED</promise>` |
90
+
91
+ ## Anti-Patterns to Check
92
+
93
+ - Skip Step 0 → BLOCK
94
+ - Code without plan (skip Step 6) → BLOCK
95
+ - No QE (skip Step 8) → BLOCK
96
+ - Over-engineer S-tier (run full pipeline for trivial change) → FLAG
97
+ - Under-engineer XL-tier (skip ADR/DDD) → FLAG
98
+ - ADR with only 1 alternative → FLAG
@@ -0,0 +1,252 @@
1
+ ---
2
+ name: feature-adr
3
+ description: >
4
+ 9-step feature development pipeline with Complexity Router (S/M/L/XL),
5
+ ADR-driven architecture decisions, DDD modeling, and multi-agent QE.
6
+ Triggers on "реализуй фичу", "feature implementation", "добавь функциональность",
7
+ "implement feature", "/feature-adr".
8
+ trust_tier: 0
9
+ trust_tier_label: "Advisory"
10
+ trust_tier_path: "Run /bto-test to promote to Tier 1"
11
+ ---
12
+
13
+ # Feature ADR — Adaptive Feature Development Pipeline
14
+
15
+ > 9-шаговый pipeline для разработки фич любой сложности.
16
+ > Complexity Router автоматически определяет масштаб (S/M/L/XL) и пропускает ненужные шаги.
17
+
18
+ ## When To Activate
19
+
20
+ Trigger on:
21
+ - "реализуй фичу [описание]"
22
+ - "implement feature [description]"
23
+ - "добавь функциональность [описание]"
24
+ - "feature [описание]"
25
+ - `/feature-adr [описание или путь к issue]`
26
+
27
+ ## Architecture
28
+
29
+ ```
30
+ .claude/skills/feature-adr/
31
+ ├── SKILL.md ← This file (orchestrator)
32
+ ├── modules/
33
+ │ ├── 00-complexity-router.md ← Step 0: S/M/L/XL classification
34
+ │ ├── 01-requirements.md ← Step 1: Requirements gathering
35
+ │ ├── 02-research.md ← Step 2: Analogues & patterns research
36
+ │ ├── 03-adr.md ← Step 3: Architecture Decision Records
37
+ │ ├── 04-ddd.md ← Step 4: Domain-Driven Design
38
+ │ ├── 05-architecture.md ← Step 5: Technical architecture
39
+ │ ├── 06-implementation-plan.md ← Step 6: Task decomposition & ordering
40
+ │ ├── 07-code.md ← Step 7: Code generation
41
+ │ └── 08-qe.md ← Step 8: Quality Engineering
42
+ ├── references/
43
+ │ ├── complexity-matrix.md ← S/M/L/XL criteria & step activation
44
+ │ ├── adr-template.md ← ADR document template
45
+ │ ├── c4-template.md ← C4 diagram templates
46
+ │ └── qe-checklist.md ← Quality engineering checklist
47
+ └── examples/
48
+ └── sample-feature-output.md ← Example output for M-tier feature
49
+ ```
50
+
51
+ ## Pipeline Overview
52
+
53
+ ```
54
+ Step 0 Step 1 Step 2 Step 3 Step 4
55
+ ROUTER → REQUIREMENTS → RESEARCH → ADR → DDD
56
+ (all) (all) (L/XL) (M+) (L/XL)
57
+ │ │
58
+ └──→ Step 5 ←┘
59
+ ARCHITECTURE
60
+ (M+)
61
+ │
62
+ ↓
63
+ Step 6
64
+ IMPL PLAN
65
+ (all)
66
+ │
67
+ ↓
68
+ Step 7
69
+ CODE
70
+ (all)
71
+ │
72
+ ↓
73
+ Step 8
74
+ QE
75
+ (all)
76
+ ```
77
+
78
+ ## Complexity Tiers
79
+
80
+ | Tier | Scope | Steps | Example |
81
+ |------|-------|-------|---------|
82
+ | **S** | 1-3 files, single domain | 0→1→6→7→8 | Bug fix, config change, small util |
83
+ | **M** | 4-10 files, 1-2 domains | 0→1→3→5(light)→6→7→8 | New API endpoint, UI component |
84
+ | **L** | 11-30 files, 2-4 domains | 0→1→2→3→4→5→6→7→8 | New module, integration |
85
+ | **XL** | 30+ files, cross-cutting | Full DAG with parallelism | New subsystem, major refactor |
86
+
87
+ See `references/complexity-matrix.md` for detailed classification criteria.
88
+
89
+ ## Step Activation Matrix
90
+
91
+ ```
92
+ Step | S | M | L | XL | Model |
93
+ ───────────────────────────────────────────────────────
94
+ 0 Complexity Router | ✓ | ✓ | ✓ | ✓ | haiku |
95
+ 1 Requirements | ✓ | ✓ | ✓ | ✓ | sonnet |
96
+ 2 Research | - | - | ✓ | ✓ | sonnet |
97
+ 3 ADR | - | ✓ | ✓ | ✓ | opus |
98
+ 4 DDD | - | - | ✓ | ✓ | opus |
99
+ 5 Architecture | - | ✓ | ✓ | ✓ | opus |
100
+ 6 Implementation Plan | ✓ | ✓ | ✓ | ✓ | sonnet |
101
+ 7 Code | ✓ | ✓ | ✓ | ✓ | opus |
102
+ 8 QE | ✓ | ✓ | ✓ | ✓ | sonnet |
103
+ ```
104
+
105
+ ## DAG Dependencies
106
+
107
+ Steps are NOT purely linear. The DAG defines what can run in parallel:
108
+
109
+ ```
110
+ Group 1 (sequential): Step 0 → Step 1
111
+ Group 2 (parallel): Step 2 ‖ Step 3 (after Step 1)
112
+ Group 3 (parallel): Step 4 ‖ Step 5 (after Steps 2+3)
113
+ Group 4 (sequential): Step 6 (after Step 5)
114
+ Group 5 (sequential): Step 7 (after Step 6)
115
+ Group 6 (sequential): Step 8 (after Step 7)
116
+ ```
117
+
118
+ For tiers S/M, the DAG collapses to a linear sequence (no parallelism needed).
119
+
120
+ ## Agent Swarm Strategy
121
+
122
+ ### Per-Step Parallelism (L/XL tiers only)
123
+
124
+ | Step | Agents | Tasks |
125
+ |------|--------|-------|
126
+ | Step 2 | 2 parallel (sonnet) | Codebase patterns ‖ External analogues |
127
+ | Step 3+4 | 2 parallel (opus) | ADR drafting ‖ DDD modeling |
128
+ | Step 7 | N parallel (opus) | One agent per independent module/file |
129
+ | Step 8 | 3 parallel (sonnet) | Unit tests ‖ Integration tests ‖ Code review |
130
+
131
+ ### Cross-Step Parallelism
132
+
133
+ For L/XL: Steps 2 and 3 run in parallel after Step 1 completes.
134
+ For L/XL: Steps 4 and 5 can overlap if Step 3 finishes before Step 2.
135
+
136
+ ## Execution Protocol
137
+
138
+ ### 1. Load Governance
139
+ ```
140
+ Read: .claude/shards/feature-adr.shard.md
141
+ ```
142
+
143
+ ### 2. Run Step 0 (Complexity Router)
144
+ ```
145
+ Read: modules/00-complexity-router.md
146
+ Read: references/complexity-matrix.md
147
+ → Output: {COMPLEXITY_TIER}, {ACTIVE_STEPS}, {TIME_BUDGET}
148
+ → Checkpoint 0
149
+ ```
150
+
151
+ ### 3. Execute Active Steps per DAG
152
+ For each active step:
153
+ ```
154
+ Read: modules/<step>.md
155
+ Execute protocol
156
+ → Create artifacts in features/<feature-slug>/
157
+ → Checkpoint N
158
+ ```
159
+
160
+ ### 4. Final Verification
161
+ After Step 8 completes, verify:
162
+ - All mandatory artifacts exist per tier
163
+ - QE checks passed
164
+ - ADR decisions are traceable to code (L/XL)
165
+
166
+ ## Cross-Phase Variables
167
+
168
+ | Variable | Set In | Used In | Type |
169
+ |----------|--------|---------|------|
170
+ | `{COMPLEXITY_TIER}` | Step 0 | All steps | S/M/L/XL |
171
+ | `{ACTIVE_STEPS}` | Step 0 | Orchestrator | list[int] |
172
+ | `{TIME_BUDGET}` | Step 0 | All steps | dict |
173
+ | `{REQUIREMENTS}` | Step 1 | Steps 2-8 | structured |
174
+ | `{RESEARCH_FINDINGS}` | Step 2 | Steps 3-5 | structured |
175
+ | `{ADR_DECISIONS}` | Step 3 | Steps 4-7 | list[ADR] |
176
+ | `{DOMAIN_MODEL}` | Step 4 | Steps 5-7 | structured |
177
+ | `{ARCHITECTURE}` | Step 5 | Steps 6-7 | structured |
178
+ | `{IMPL_PLAN}` | Step 6 | Step 7 | list[task] |
179
+ | `{QE_RESULTS}` | Step 8 | Final report | structured |
180
+
181
+ ## Output Directory Structure
182
+
183
+ All artifacts are created in `features/<feature-slug>/`:
184
+
185
+ ```
186
+ features/<feature-slug>/
187
+ ├── 00_complexity_assessment.md ← Always
188
+ ├── 01_requirements.md ← Always
189
+ ├── 02_research.md ← L/XL only
190
+ ├── 03_adr/ ← M+ only
191
+ │ ├── 001-<decision>.md
192
+ │ └── ...
193
+ ├── 04_domain_model.md ← L/XL only
194
+ ├── 05_architecture.md ← M+ only
195
+ ├── 06_implementation_plan.md ← Always
196
+ ├── 07_code_changes/ ← Always (actual code in repo)
197
+ │ └── change_manifest.md ← List of modified files
198
+ ├── 08_qe_report.md ← Always
199
+ ├── diagrams/ ← M+ only
200
+ │ ├── architecture-c4.mermaid
201
+ │ ├── sequence-*.mermaid
202
+ │ └── domain-model.mermaid
203
+ └── README.md ← Always (auto-generated summary)
204
+ ```
205
+
206
+ ## Promise Tags
207
+
208
+ | Step | Promise Tag |
209
+ |------|-------------|
210
+ | Step 0 | `<promise>FEATURE_ADR_ROUTED</promise>` |
211
+ | Step 1 | `<promise>FEATURE_ADR_REQUIREMENTS_GATHERED</promise>` |
212
+ | Steps 2-5 | `<promise>FEATURE_ADR_DESIGNED</promise>` |
213
+ | Step 6 | `<promise>FEATURE_ADR_PLANNED</promise>` |
214
+ | Step 7 | `<promise>FEATURE_ADR_IMPLEMENTED</promise>` |
215
+ | Step 8 | `<promise>FEATURE_ADR_VERIFIED</promise>` |
216
+
217
+ ## External Skills (loaded as needed)
218
+
219
+ | Skill | Used In | Purpose |
220
+ |-------|---------|---------|
221
+ | explore | Step 1 | Requirements clarification |
222
+ | problem-solver-enhanced | Step 3 | Trade-off analysis for ADR decisions |
223
+ | frontend-design | Step 7 | UI implementation (if feature has UI) |
224
+
225
+ ## Anti-Patterns
226
+
227
+ | Anti-Pattern | Detection | Fix |
228
+ |-------------|-----------|-----|
229
+ | Skip complexity assessment | Jump straight to coding | BLOCK — always run Step 0 |
230
+ | Over-engineer S-tier | Run full pipeline for a config change | Router should classify as S |
231
+ | Under-engineer XL-tier | Skip ADR/DDD for major refactor | Router should classify as XL |
232
+ | ADR without alternatives | Only one option considered | Require ≥2 alternatives per ADR |
233
+ | Architecture without ADR | Diagram before decisions | Step 5 requires Step 3 output |
234
+ | Code without plan | Start coding without Step 6 | BLOCK — plan is mandatory |
235
+ | No QE | Ship without testing | BLOCK — Step 8 is mandatory |
236
+
237
+ ## Checkpoint Format
238
+
239
+ ```
240
+ ═══════════════════════════════════════════════════════
241
+ ⏸️ STEP N/8: [Step Name] Complete
242
+ <promise>[PROMISE_TAG]</promise>
243
+ Tier: {COMPLEXITY_TIER} | Active Steps: {ACTIVE_STEPS}
244
+
245
+ [2-3 line summary]
246
+ Artifacts: [list] ✅
247
+
248
+ • "ок" — next step
249
+ • "углуби [section]" — elaborate
250
+ • "[feedback]" — adjust
251
+ ═══════════════════════════════════════════════════════
252
+ ```