@dzhechkov/p-replicator 1.10.4 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.dz-manifest.json +312 -76
  2. package/CHANGELOG.md +232 -0
  3. package/MULTIPLATFORM_ROADMAP.md +1 -1
  4. package/README/eng/01_quickstart.md +3 -3
  5. package/README/eng/02_user_guide.md +1 -1
  6. package/README/eng/03_admin_guide.md +2 -2
  7. package/README/eng/04_api_reference.md +11 -5
  8. package/README/eng/05_architecture.md +1 -1
  9. package/README/eng/README.md +2 -1
  10. package/README/ru/01_quickstart.md +3 -3
  11. package/README/ru/02_user_guide.md +1 -1
  12. package/README/ru/03_admin_guide.md +2 -2
  13. package/README/ru/04_api_reference.md +11 -5
  14. package/README/ru/05_architecture.md +1 -1
  15. package/README/ru/README.md +2 -1
  16. package/README/ru/html/index.html +9 -9
  17. package/README.md +278 -39
  18. package/package.json +5 -4
  19. package/sbom.json +665 -75
  20. package/scripts/check-pipeline-gaps.sh +413 -0
  21. package/src/commands/doctor.js +94 -4
  22. package/src/commands/init.js +1 -1
  23. package/src/rule-components.json +15 -0
  24. package/src/utils.js +35 -11
  25. package/templates/.claude/agents/harvest-coordinator.md +10 -1
  26. package/templates/.claude/agents/product-discoverer.md +38 -0
  27. package/templates/.claude/agents/replicate-coordinator.md +11 -1
  28. package/templates/.claude/commands/feature.md +81 -9
  29. package/templates/.claude/commands/go.md +9 -0
  30. package/templates/.claude/commands/harvest.md +39 -3
  31. package/templates/.claude/commands/myinsights.md +21 -26
  32. package/templates/.claude/commands/replicate.md +171 -37
  33. package/templates/.claude/commands/start.md +29 -0
  34. package/templates/.claude/hooks/capture-source-path.cjs +795 -0
  35. package/templates/.claude/hooks/check-canon.cjs +493 -0
  36. package/templates/.claude/hooks/check-embed-contract.cjs +374 -0
  37. package/templates/.claude/hooks/check-external-deps.cjs +288 -0
  38. package/templates/.claude/hooks/check-file-ownership.cjs +424 -0
  39. package/templates/.claude/hooks/check-handoff-manifest.cjs +367 -0
  40. package/templates/.claude/hooks/check-job-contract.cjs +501 -0
  41. package/templates/.claude/hooks/check-look-origin.cjs +240 -0
  42. package/templates/.claude/hooks/check-look-trace.cjs +385 -0
  43. package/templates/.claude/hooks/check-metric-source.cjs +296 -0
  44. package/templates/.claude/hooks/check-model-cost.cjs +470 -0
  45. package/templates/.claude/hooks/check-ports.cjs +434 -24
  46. package/templates/.claude/hooks/check-source-version.cjs +312 -0
  47. package/templates/.claude/hooks/check-swarm-receipts.cjs +197 -0
  48. package/templates/.claude/hooks/check-webhook-contract.cjs +535 -0
  49. package/templates/.claude/hooks/session-insights.cjs +158 -25
  50. package/templates/.claude/hooks/statusline.cjs +2 -2
  51. package/templates/.claude/hooks/write-insight.cjs +253 -0
  52. package/templates/.claude/rules/cost-of-detection-ladder.md +96 -0
  53. package/templates/.claude/rules/docker-ports.md +41 -19
  54. package/templates/.claude/rules/embeddable-widget.md +73 -0
  55. package/templates/.claude/rules/feature-lifecycle.md +13 -3
  56. package/templates/.claude/rules/honest-configuration.md +54 -0
  57. package/templates/.claude/rules/incoming-webhooks.md +99 -0
  58. package/templates/.claude/rules/insights-capture.md +10 -5
  59. package/templates/.claude/rules/long-running-job.md +73 -0
  60. package/templates/.claude/rules/model-call-cost.md +85 -0
  61. package/templates/.claude/rules/replicate-pipeline.md +123 -52
  62. package/templates/.claude/rules/skill-interface-protocol.md +1 -0
  63. package/templates/.claude/rules/swarm-file-evidence.md +46 -0
  64. package/templates/.claude/settings.json +13 -1
  65. package/templates/.claude/skills/brutal-honesty-review/SKILL.md +9 -0
  66. package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +4 -0
  67. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +46 -1
  68. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +7 -1
  69. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +20 -2
  70. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/claude-md-strategy.md +7 -0
  71. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/automation-commands.md +17 -0
  72. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle-ent.md +43 -5
  73. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle.md +43 -7
  74. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/start-command.md +19 -1
  75. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/swarm-file-evidence.md +151 -0
  76. package/templates/.claude/skills/goap-research-ed25519/SKILL.md +37 -22
  77. package/templates/.claude/skills/goap-research-ed25519/references/negative-results.md +94 -0
  78. package/templates/.claude/skills/goap-research-ed25519/scripts/check_report_evidence.py +368 -4
  79. package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +122 -5
  80. package/templates/.claude/skills/goap-research-ed25519/scripts/evidence_fetch.py +33 -16
  81. package/templates/.claude/skills/goap-research-ed25519/scripts/quote_provenance.py +342 -0
  82. package/templates/.claude/skills/goap-research-ed25519/scripts/test_ed25519_verifier.py +60 -0
  83. package/templates/.claude/skills/goap-research-ed25519/scripts/test_evidence_provenance.py +139 -6
  84. package/templates/.claude/skills/goap-research-ed25519/scripts/test_quote_provenance.py +274 -0
  85. package/templates/.claude/skills/goap-research-ed25519/scripts/test_suite_completeness.py +2 -1
  86. package/templates/.claude/skills/knowledge-extractor/SKILL.md +4 -0
  87. package/templates/.claude/skills/knowledge-extractor/modules/01-agent-review.md +16 -5
  88. package/templates/.claude/skills/pipeline-forge/SKILL.md +18 -23
  89. package/templates/.claude/skills/pipeline-forge/examples/replicate-analysis.md +7 -2
  90. package/templates/.claude/skills/pipeline-forge/references/patterns-catalog.md +19 -1
  91. package/templates/.claude/skills/pipeline-forge/references/self-extracted-patterns.md +17 -6
  92. package/templates/.claude/skills/pipeline-forge/references/skill-anatomy.md +0 -1
  93. package/templates/.claude/skills/reverse-engineering-unicorn/modules/025-cjm-prototype.md +21 -1
  94. package/templates/.claude/skills/sparc-prd-mini/SKILL.md +234 -716
  95. package/tests/e2e/lifecycle.test.js +55 -9
  96. package/tests/e2e/packed-insights-writer.test.js +308 -0
  97. package/tests/fixtures/prep-traceability-fixture/docs/features/order-refund/01_specification.md +29 -0
  98. package/tests/fixtures/prep-traceability-fixture/docs/features/order-refund/02_pseudocode.md +57 -0
  99. package/tests/snapshot/baseline.json +72 -46
  100. package/tests/snapshot/templates.test.js +47 -0
  101. package/tests/unit/absence-is-not-emptiness.test.js +15 -1
  102. package/tests/unit/capture-source-path.test.js +492 -0
  103. package/tests/unit/check-canon.test.js +403 -0
  104. package/tests/unit/check-embed-contract.test.js +422 -0
  105. package/tests/unit/check-external-deps.test.js +363 -0
  106. package/tests/unit/check-file-ownership.test.js +388 -0
  107. package/tests/unit/check-handoff-manifest.test.js +410 -0
  108. package/tests/unit/check-job-contract.test.js +514 -0
  109. package/tests/unit/check-look-origin.test.js +180 -0
  110. package/tests/unit/check-look-trace.test.js +420 -0
  111. package/tests/unit/check-metric-source.test.js +325 -0
  112. package/tests/unit/check-model-cost.test.js +425 -0
  113. package/tests/unit/check-pipeline-gaps.test.js +94 -0
  114. package/tests/unit/check-ports.test.js +773 -2
  115. package/tests/unit/check-source-version.test.js +344 -0
  116. package/tests/unit/check-swarm-receipts.test.js +231 -0
  117. package/tests/unit/check-webhook-contract.test.js +536 -0
  118. package/tests/unit/db-port-rule.test.js +43 -6
  119. package/tests/unit/detection-ladder-contract.test.js +302 -0
  120. package/tests/unit/detection-ladder-registry.test.js +52 -0
  121. package/tests/unit/doctor-insight-flow.test.js +315 -0
  122. package/tests/unit/external-dependency-check.test.js +19 -19
  123. package/tests/unit/generator-swarm-contract.test.js +287 -0
  124. package/tests/unit/guard-honest-input-meta.test.js +64 -0
  125. package/tests/unit/honest-failure-rules.test.js +574 -0
  126. package/tests/unit/hooks-project-anchored.test.js +67 -3
  127. package/tests/unit/insights-docs-tell-the-truth.test.js +52 -31
  128. package/tests/unit/insights-dz-delegation.test.js +197 -0
  129. package/tests/unit/insights-writer.test.js +285 -0
  130. package/tests/unit/look-phase-contract.test.js +231 -0
  131. package/tests/unit/negative-conclusion-gate.test.js +300 -0
  132. package/tests/unit/quote-provenance.test.js +122 -0
  133. package/tests/unit/shipped-suite-context.test.js +3 -1
  134. package/tests/unit/traceability-machine-ids.test.js +413 -0
  135. package/tests/unit/traceability-negative-fixture.test.js +322 -0
  136. package/tests/unit/utils.test.js +40 -2
@@ -14,15 +14,7 @@ description: >
14
14
 
15
15
  ## Architecture
16
16
 
17
- ```
18
- sparc-prd-mini/
19
- ├── SKILL.md # Оркестратор (этот файл)
20
- ├── references/
21
- │ └── sparc-methodology.md # SPARC framework (своё, уникальное)
22
- └── templates/
23
- ├── prd.md # PRD template
24
- └── CLAUDE.md # AI integration guide template
25
- ```
17
+ `SKILL.md` (оркестратор) + `references/sparc-methodology.md` (SPARC framework) + `templates/prd.md`, `templates/CLAUDE.md`.
26
18
 
27
19
  ## External Dependencies (view at runtime)
28
20
 
@@ -32,105 +24,93 @@ sparc-prd-mini/
32
24
  | Phase 1: Research | `goap-research-ed25519` | `.claude/skills/goap-research-ed25519/SKILL.md` | GOAP A* + OODA → Research Findings |
33
25
  | Phase 2: Solve | `problem-solver-enhanced` | `.claude/skills/problem-solver-enhanced/SKILL.md` | 9 modules + TRIZ → Solution Strategy |
34
26
 
35
- **Принцип:** Каждый внешний скилл — Single Source of Truth. Обновление оригинала автоматически подхватывается здесь.
36
-
37
- **Fallbacks (если скилл недоступен):**
38
- - `explore` недоступен → встроенные Socratic questions (3-5 вопросов)
39
- - `goap-research-ed25519` недоступен → прямой web_search по ключевым темам
40
- - `problem-solver-enhanced` недоступен → First Principles + SCQA only
27
+ **Принцип:** внешний скилл — Single Source of Truth. **Fallbacks:** explore встроенные Socratic questions (3-5); goap-research → прямой web_search; problem-solver → First Principles + SCQA.
41
28
 
42
29
  ## When to Use
43
30
 
44
- **Trigger Patterns:**
45
- - "sparc-prd-mini" / "PRD mini"
46
- - "создай PRD" / "подготовь документацию"
47
- - "vibe coding документация"
48
- - "SPARC документация"
49
- - "PRD auto" / "PRD manual" / "PRD с checkpoint"
50
- - "документация для разработки"
31
+ **Trigger Patterns:** "sparc-prd-mini" / "PRD mini" / "создай PRD" / "SPARC документация" / "PRD auto|manual|с checkpoint" / "документация для разработки".
51
32
 
52
33
  ## Operating Modes
53
34
 
54
- ### AUTO Mode (Default)
55
- ```
56
- Триггеры: "auto", "автоматически", "без остановок"
57
- ```
58
- Все 8 фаз выполняются последовательно без промежуточных подтверждений.
35
+ ### AUTO Mode (Default) — триггеры "auto", "автоматически", "без остановок": все 8 фаз подряд, без подтверждений.
59
36
 
60
- ### MANUAL Mode
61
- ```
62
- Триггеры: "manual", "пошагово", "с checkpoint", "с проверками"
63
- ```
64
- Checkpoint после каждой фазы. Пользователь подтверждает или корректирует.
37
+ ### MANUAL Mode — триггеры "manual", "пошагово", "с checkpoint": checkpoint после каждой фазы, пользователь подтверждает или корректирует.
65
38
 
66
- **Определение режима:**
67
- 1. Явно указан → использовать указанный
68
- 2. Задача простая → предложить AUTO
69
- 3. Задача сложная → предложить MANUAL
70
- 4. Неясно → спросить
39
+ **Определение режима:** явный → использовать; простая задача → предложить AUTO; сложная → MANUAL; неясно → спросить.
71
40
 
72
41
  ## Output Documents (11 files)
73
42
 
74
- ```
75
- /output/[product-name]-sparc/
76
- ├── PRD.md # Product Requirements Document
77
- ├── Solution_Strategy.md # Problem analysis (First Principles + TRIZ)
78
- ├── Specification.md # Requirements, user stories, acceptance criteria
79
- ├── Pseudocode.md # Algorithms, data flow, API contracts
80
- ├── Architecture.md # System design, tech stack, diagrams
81
- ├── Refinement.md # Edge cases, testing, optimization
82
- ├── Completion.md # Deployment, CI/CD, monitoring
83
- ├── Research_Findings.md # Market and technology research
84
- ├── Final_Summary.md # Executive summary
85
- └── .claude/
86
- └── CLAUDE.md # AI tools integration guide
43
+ `/output/[product-name]-sparc/`: PRD.md · Solution_Strategy.md · Specification.md · Pseudocode.md · Architecture.md · Refinement.md · Completion.md · Research_Findings.md · Final_Summary.md · `.claude/CLAUDE.md` (+ каталог) — 11 файлов.
44
+
45
+ ## Document Role Map Contract
46
+
47
+ The five SPARC documents are addressed by role, never by a caller-specific filename. A caller may
48
+ provide `DOCUMENT_ROLE_MAP`; otherwise the project-level default below applies. The active map must
49
+ contain exactly these roles: `specification`, `pseudocode`, `architecture`, `refinement`, and
50
+ `completion`.
51
+
52
+ Resolve the active map once before Phase 3. Bind its values as `SPECIFICATION_FILE`,
53
+ `PSEUDOCODE_FILE`, `ARCHITECTURE_FILE`, `REFINEMENT_FILE`, and `COMPLETION_FILE`, respectively. Every
54
+ phase and traceability gate reads or writes those resolved targets. The literal project-level names
55
+ elsewhere in this document describe the default contour; they do not override a supplied map.
56
+
57
+ ### Project-level default
58
+
59
+ ```yaml
60
+ DOCUMENT_ROLE_MAP:
61
+ specification: Specification.md
62
+ pseudocode: Pseudocode.md
63
+ architecture: Architecture.md
64
+ refinement: Refinement.md
65
+ completion: Completion.md
87
66
  ```
88
67
 
89
- ## Workflow Architecture
68
+ ### Atomic validation
69
+
70
+ If a caller supplies `DOCUMENT_ROLE_MAP`, validate the complete map before Phase 3. Missing roles,
71
+ unknown roles, empty filenames, or a mixture of supplied and default values are an unresolved target
72
+ contract: STOP and report the received map plus every missing, unknown, or empty role. Never fill an
73
+ individual role from the project-level default. When the caller also supplies `TARGET_CATALOG`, join
74
+ that catalog with every filename only after the complete role map passes validation.
75
+
76
+ ### FR/NFR/AC machine-key wire format
90
77
 
78
+ Machine keys are exact, case-sensitive joins between the `specification` and `pseudocode` roles:
79
+ `FR-<slug>-<n>`, `NFR-<slug>-<n>`, or `AC-<slug>-<n>`. For a feature contour, `<slug>` is the
80
+ lowercase hyphenated feature directory name and `<n>` is one or more decimal digits.
81
+
82
+ Declare each key in `SPECIFICATION_FILE` only as a level-three Markdown heading:
83
+
84
+ ```markdown
85
+ ### FR-order-refund-1
86
+ ### NFR-order-refund-2 — bounded latency
87
+ ### AC-order-refund-3 - accepted result
91
88
  ```
92
- ┌─────────────────────────────────────────────────────────────────┐
93
- │ INPUT: Описание продукта/идеи │
94
- │ ↓ │
95
- │ MODE SELECTION: AUTO или MANUAL │
96
- │ ↓ │
97
- │ GATE: Оценка ясности задачи │
98
- │ → Ясна? → Пропустить Explore (уведомить) │
99
- │ → Не ясна? → Phase 0: Explore │
100
- │ ↓ │
101
- │ Phase 0: EXPLORE → Product Brief │
102
- │ view(explore) │
103
- │ [MANUAL: ⏸️ CP0] │
104
- │ ↓ │
105
- │ Phase 1: RESEARCH → Research_Findings.md │
106
- │ view(goap-research-ed25519) │
107
- │ [MANUAL: ⏸️ CP1] │
108
- │ ↓ │
109
- │ Phase 2: SOLVE → Solution_Strategy.md │
110
- │ view(problem-solver-enhanced) │
111
- │ [MANUAL: ⏸️ CP2] │
112
- │ ↓ │
113
- │ Phase 3: SPECIFICATION → Specification.md + PRD.md │
114
- │ [MANUAL: ⏸️ CP3] (собственная логика) │
115
- │ ↓ │
116
- │ Phase 4: PSEUDOCODE → Pseudocode.md │
117
- │ [MANUAL: ⏸️ CP4] (собственная логика) │
118
- │ ↓ │
119
- │ Phase 5: ARCHITECTURE → Architecture.md │
120
- │ [MANUAL: ⏸️ CP5] (собственная логика) │
121
- │ ↓ │
122
- │ Phase 6: REFINEMENT → Refinement.md │
123
- │ [MANUAL: ⏸️ CP6] (собственная логика) │
124
- │ ↓ │
125
- │ Phase 7: COMPLETION → Completion.md + CLAUDE.md │
126
- │ [MANUAL: ⏸️ CP7] (собственная логика) │
127
- │ ↓ │
128
- │ SYNTHESIS → Final_Summary.md │
129
- │ ↓ │
130
- │ OUTPUT: 11 файлов │
131
- └─────────────────────────────────────────────────────────────────┘
89
+
90
+ Every `### Algorithm:` block in `PSEUDOCODE_FILE` must carry at least one standalone, exact claim;
91
+ repeat the line when one algorithm addresses several keys:
92
+
93
+ ```markdown
94
+ ### Algorithm: Validate refund
95
+
96
+ REQUIREMENT: `FR-order-refund-1`
97
+ REQUIREMENT: `NFR-order-refund-2`
132
98
  ```
133
99
 
100
+ Prose, comments, tables, examples, `REALISES: SC-...`, and nested `SC-FR-*` scenario IDs are not
101
+ machine-key declarations. Duplicate declarations on either role are invalid; matching sets prove
102
+ cross-document linkage only, not that an algorithm semantically implements the requirement.
103
+
104
+ ## Workflow Architecture
105
+
106
+ `INPUT → mode (AUTO|MANUAL) → clarity gate → P0? → P1 → P2 → P3 → P4 → P5 → P6 → P7 → SYNTHESIS`.
107
+ If the task is clear, skip P0 and notify the user; otherwise run it. MANUAL pauses at CP0–CP7.
108
+
109
+ P0→`view(explore)`→Product Brief; P1→`view(goap-research-ed25519)`→`Research_Findings.md`;
110
+ P2→`view(problem-solver-enhanced)`→`Solution_Strategy.md`; P3→`Specification.md`+`PRD.md`;
111
+ P4→`Pseudocode.md`; P5→`Architecture.md`; P6→`Refinement.md`; P7→`Completion.md`+`CLAUDE.md`;
112
+ SYNTHESIS→`Final_Summary.md`; final package totals 11 files.
113
+
134
114
  ---
135
115
 
136
116
  ## Phase Execution Protocol
@@ -149,15 +129,7 @@ Checkpoint после каждой фазы. Пользователь подтв
149
129
  - Непонятны ключевые функции
150
130
  - Противоречивые требования
151
131
 
152
- **При пропуске Explore:**
153
- ```
154
- ⚡ Фаза Explore пропущена — задача достаточно ясна.
155
- Сформирован Product Brief на основе вашего запроса.
156
- [показать Product Brief]
157
-
158
- [AUTO: переходим к Research...]
159
- [MANUAL: ⏸️ CHECKPOINT 0 — подтвердите или скорректируйте]
160
- ```
132
+ **При пропуске Explore:** сообщить «⚡ Фаза Explore пропущена — задача достаточно ясна», показать Product Brief; AUTO → сразу Research, MANUAL → CHECKPOINT 0.
161
133
 
162
134
  ---
163
135
 
@@ -169,47 +141,12 @@ view(".claude/skills/explore/SKILL.md")
169
141
  → Scope: уточнить продукт, аудиторию, features, constraints
170
142
  ```
171
143
 
172
- **Output — Product Brief:**
173
- ```markdown
174
- ## Product Brief
175
-
176
- **Product Name:** [Название]
177
- **Problem Statement:** [Какую проблему решаем]
178
- **Target Users:** [Целевая аудитория]
179
- **Core Value Proposition:** [Ключевая ценность]
180
-
181
- ### Key Features (MVP)
182
- 1. [Feature 1]
183
- 2. [Feature 2]
184
- 3. [Feature 3]
185
-
186
- ### Technical Context
187
- - Platform: [Web/Mobile/Desktop/API]
188
- - Stack Preferences: [Если есть]
189
- - Integrations: [Внешние системы]
190
- - Constraints: [Ограничения]
191
-
192
- ### Success Criteria
193
- - [Критерий 1]
194
- - [Критерий 2]
195
- ```
196
-
197
- **[MANUAL] CP0:**
198
- ```
199
- ═══════════════════════════════════════════════════════════════
200
- ⏸️ CHECKPOINT 0: Product Brief Complete
201
-
202
- [показать Product Brief]
203
-
204
- Команды:
205
- • "ок" → перейти к Research
206
- • "уточни X" → уточнить аспект
207
- • "добавь Y" → добавить feature/requirement
208
- • "измени Z" → изменить параметр
144
+ **Output — Product Brief:** `## Product Brief` with Product Name, Problem Statement, Target Users,
145
+ Core Value Proposition; `### Key Features (MVP)` numbered Feature 1–3; `### Technical Context` with
146
+ Platform `[Web/Mobile/Desktop/API]`, Stack Preferences, Integrations, Constraints; `### Success
147
+ Criteria` with Criteria 1–2.
209
148
 
210
- Ваше решение?
211
- ═══════════════════════════════════════════════════════════════
212
- ```
149
+ **[MANUAL] CP0:** show Product Brief; `ок` → Research; `уточни X`, `добавь Y`, `измени Z` edit it.
213
150
 
214
151
  ---
215
152
 
@@ -227,63 +164,15 @@ view(".claude/skills/goap-research-ed25519/SKILL.md")
227
164
  - User Research (поведенческие паттерны, боли)
228
165
  - Integration Research (APIs, compatibility)
229
166
 
230
- **Output — Research_Findings.md:**
231
- ```markdown
232
- ## Research Findings
233
-
234
- ### Executive Summary
235
- [Ключевые находки в 2-3 предложениях]
236
-
237
- ### Research Objective
238
- [Исходные вопросы]
239
-
240
- ### Methodology
241
- [GOAP план, источники]
167
+ **Output — `Research_Findings.md`:** `## Research Findings` with Executive Summary (2–3 sentences),
168
+ Research Objective, Methodology (GOAP plan + sources), Market Analysis, Competitive Landscape table
169
+ `Competitor | Strengths | Weaknesses | Differentiation`, Technology Assessment, User Insights (all
170
+ findings use inline citations), Confidence Assessment (High = 3+ sources; Medium = 2; Low = needs
171
+ research), numbered Sources with URLs/reliability ratings, and Research Path Log with actions and
172
+ replanning decisions.
242
173
 
243
- ### Market Analysis
244
- [Findings с inline citations]
245
-
246
- ### Competitive Landscape
247
- | Competitor | Strengths | Weaknesses | Differentiation |
248
- |------------|-----------|------------|-----------------|
249
-
250
- ### Technology Assessment
251
- [Findings с inline citations]
252
-
253
- ### User Insights
254
- [Findings с inline citations]
255
-
256
- ### Confidence Assessment
257
- - **High confidence:** [claims with 3+ sources]
258
- - **Medium confidence:** [claims with 2 sources]
259
- - **Low confidence:** [areas needing more research]
260
-
261
- ### Sources
262
- [Нумерованный список с URLs и reliability ratings]
263
-
264
- ### Research Path Log
265
- [Выполненные действия, replanning decisions]
266
- ```
267
-
268
- **[MANUAL] CP1:**
269
- ```
270
- ═══════════════════════════════════════════════════════════════
271
- ⏸️ CHECKPOINT 1: Research Complete
272
-
273
- **Ключевые находки:**
274
- [краткое summary]
275
-
276
- **Источники:** [число] sources, avg reliability [X.X]
277
-
278
- Команды:
279
- • "ок" → перейти к Solve
280
- • "глубже X" → исследовать тему детальнее
281
- • "добавь источники по Y" → найти больше источников
282
- • "сравни A и B" → сравнительный анализ
283
-
284
- Ваше решение?
285
- ═══════════════════════════════════════════════════════════════
286
- ```
174
+ **[MANUAL] CP1:** show key findings plus source count and average reliability `[X.X]`; `ок` → Solve;
175
+ `глубже X`, `добавь источники по Y`, `сравни A и B` refine research.
287
176
 
288
177
  ---
289
178
 
@@ -306,64 +195,14 @@ view(".claude/skills/problem-solver-enhanced/SKILL.md")
306
195
  8. OODA Loop — Observe, Orient, Decide, Act
307
196
  9. Solution Synthesis — интеграция
308
197
 
309
- **Output — Solution_Strategy.md:**
310
- ```markdown
311
- ## Solution Strategy
312
-
313
- ### Problem Statement (SCQA)
314
- - **Situation:** [Стабильный контекст]
315
- - **Complication:** [Что изменилось/проблема]
316
- - **Question:** [Ключевой вопрос]
317
- - **Answer:** [Предлагаемое решение]
318
-
319
- ### First Principles Analysis
320
- [Фундаментальные истины и выводы]
198
+ **Output — `Solution_Strategy.md`:** `## Solution Strategy` with SCQA (Situation, Complication,
199
+ Question, Answer); First Principles; Root Cause Analysis (5 Whys: Answers 1–4, then Root Cause at
200
+ 5); Game Theory (players, interests, Nash equilibrium); Second-Order Effects; TRIZ table
201
+ `Contradiction | TRIZ Principle | Resolution`; Recommended Approach; Risk table
202
+ `Risk | Probability | Impact | Mitigation`.
321
203
 
322
- ### Root Cause Analysis (5 Whys)
323
- 1. Why? [Answer 1]
324
- 2. Why? → [Answer 2]
325
- 3. Why? → [Answer 3]
326
- 4. Why? → [Answer 4]
327
- 5. Why? → [Root Cause]
328
-
329
- ### Game Theory Analysis
330
- [Key players, interests, Nash equilibrium]
331
-
332
- ### Second-Order Effects
333
- [Consequences of consequences]
334
-
335
- ### Contradictions Resolved (TRIZ)
336
- | Contradiction | TRIZ Principle | Resolution |
337
- |---------------|----------------|------------|
338
-
339
- ### Recommended Approach
340
- [Детальное описание стратегии]
341
-
342
- ### Risk Assessment
343
- | Risk | Probability | Impact | Mitigation |
344
- |------|-------------|--------|------------|
345
- ```
346
-
347
- **[MANUAL] CP2:**
348
- ```
349
- ═══════════════════════════════════════════════════════════════
350
- ⏸️ CHECKPOINT 2: Solution Strategy Complete
351
-
352
- **Рекомендуемый подход:**
353
- [краткое summary]
354
-
355
- **Ключевые TRIZ решения:**
356
- [список]
357
-
358
- Команды:
359
- • "ок" → перейти к Specification
360
- • "альтернатива для X" → другой подход
361
- • "углуби анализ Y" → детальнее по модулю
362
- • "добавь stakeholder Z" → расширить game theory
363
-
364
- Ваше решение?
365
- ═══════════════════════════════════════════════════════════════
366
- ```
204
+ **[MANUAL] CP2:** show recommended approach and key TRIZ resolutions; `ок` → Specification;
205
+ `альтернатива для X`, `углуби анализ Y`, `добавь stakeholder Z` revise the strategy.
367
206
 
368
207
  ---
369
208
 
@@ -373,12 +212,12 @@ view(".claude/skills/problem-solver-enhanced/SKILL.md")
373
212
 
374
213
  **Inputs:** Product Brief (Phase 0) + Research (Phase 1) + Solution (Phase 2)
375
214
 
376
- **Output — Specification.md + PRD.md:**
215
+ **Output — `SPECIFICATION_FILE` + PRD.md:**
377
216
  - Executive Summary
378
217
  - User Stories with Acceptance Criteria (Gherkin)
379
218
  - Feature Matrix (MVP/v1/v2)
380
219
  - Non-Functional Requirements (performance, security, scalability)
381
- - Success Metrics
220
+ - Success Metrics (each naming its value SOURCE — closed list, see Final Summary)
382
221
 
383
222
  **User Story Format:**
384
223
  ```
@@ -406,23 +245,9 @@ view("templates/prd.md")
406
245
  → Заполнить шаблон данными из Phase 0-2
407
246
  ```
408
247
 
409
- **[MANUAL] CP3:**
410
- ```
411
- ═══════════════════════════════════════════════════════════════
412
- ⏸️ CHECKPOINT 3: Specification Complete
413
-
414
- **User Stories:** [число] total, [число] MVP
415
- **NFRs:** Performance, Security, Scalability defined
416
-
417
- Команды:
418
- • "ок" → перейти к Pseudocode
419
- • "добавь user story для X" → добавить
420
- • "уточни acceptance criteria Y" → уточнить
421
- • "измени приоритет Z" → изменить
422
-
423
- Ваше решение?
424
- ═══════════════════════════════════════════════════════════════
425
- ```
248
+ **[MANUAL] CP3:** show total/MVP story counts and whether Performance, Security, Scalability NFRs
249
+ are defined; `ок` → Pseudocode; `добавь user story для X`, `уточни acceptance criteria Y`,
250
+ `измени приоритет Z` revise the specification.
426
251
 
427
252
  ---
428
253
 
@@ -430,67 +255,25 @@ view("templates/prd.md")
430
255
 
431
256
  **Цель:** Определить алгоритмы и data flow.
432
257
 
433
- **Output — Pseudocode.md:**
434
- ```markdown
435
- ## Data Structures
436
-
437
- ### [Entity Name]
438
- type EntityName = {
439
- id: UUID
440
- field1: Type
441
- field2: Type
442
- created_at: Timestamp
443
- }
444
-
445
- ## Core Algorithms
446
-
447
- ### Algorithm: [Name]
448
- REALISES: [SC-… ids this algorithm implements, comma-separated]
449
- INPUT: [parameters]
450
- OUTPUT: [result]
451
-
452
- STEPS:
453
- 1. [step]
454
- 2. [step]
455
- 3. IF [condition]:
456
- [action]
457
- ELSE:
458
- [action]
459
- 4. RETURN [result]
460
-
461
- COMPLEXITY: O(n)
462
-
463
- ## API Contracts
464
-
465
- ### Endpoint: [Method] /path
466
- Request:
467
- Headers: { Authorization: Bearer <token> }
468
- Body: { field1: type, field2: type }
469
-
470
- Response (200):
471
- { data: type, meta: { ... } }
472
-
473
- Response (4xx/5xx):
474
- { error: { code: string, message: string } }
475
-
476
- ## State Transitions
477
- [Mermaid diagram]
478
-
479
- ## Error Handling Strategy
480
- [Error categories and responses]
481
- ```
258
+ **Output — `PSEUDOCODE_FILE`:** required blocks are `## Data Structures` (each entity names `id:
259
+ UUID`, fields and `created_at: Timestamp`); `## Core Algorithms`, where every block has:
260
+ `### Algorithm: [Name]` · `REALISES: [SC-… ids this algorithm implements]` · `INPUT:` · `OUTPUT:` ·
261
+ numbered `STEPS` with IF/ELSE and RETURN · `COMPLEXITY: O(n)`; `## API Contracts` (method/path,
262
+ Authorization Bearer header, body, Response
263
+ `200` data/meta, Response `4xx/5xx` error code/message); `## State Transitions` Mermaid; `## Error
264
+ Handling Strategy` categories/responses.
482
265
 
483
266
  **Шаг 4.9 — ПОКРЫТИЕ СЦЕНАРИЕВ (обязательный, до чекпойнта).**
484
267
 
485
- Re-read `Specification.md` and collect every `SC-` scenario ID. Collect every algorithm's `REALISES`
486
- line from `Pseudocode.md`. Write a `## Scenario Coverage` block into `Pseudocode.md` — **in every
487
- case, including the one where everything is covered**, because an absent block and a block saying
488
- "all covered" are indistinguishable to the next reader:
268
+ Resolve role `specification` through `DOCUMENT_ROLE_MAP` as `SPECIFICATION_FILE`; Resolve role `pseudocode` through `DOCUMENT_ROLE_MAP` as `PSEUDOCODE_FILE`. Re-read `SPECIFICATION_FILE` and
269
+ collect every `SC-` ID; collect every algorithm's `REALISES` claim from `PSEUDOCODE_FILE`.
270
+ Write a `## Scenario Coverage` block into `PSEUDOCODE_FILE` in every
271
+ case, including the one where everything is covered:
489
272
 
490
273
  ```
491
274
  ## Scenario Coverage
492
275
 
493
- Scenarios in Specification.md: [N] · claimed by an algorithm: [M]
276
+ Scenarios in [SPECIFICATION_FILE]: [N] · claimed by an algorithm: [M]
494
277
 
495
278
  Not claimed by any algorithm:
496
279
  | Scenario | Reason |
@@ -503,49 +286,30 @@ Claimed by an algorithm but absent from Specification.md:
503
286
  | [name] | SC-… |
504
287
  ```
505
288
 
506
- **Both tables are required, and both may be the single word `none`.** A traceability check that runs
507
- one way only is half a check: without the second table an algorithm can declare `REALISES: SC-US-009-3`
508
- for a scenario nobody ever wrote, and the dangling reference reads exactly like coverage. `none` is
509
- written out rather than left blank, because an empty table and a forgotten table look identical.
289
+ Both tables are required, and both may be the single word `none`; the reverse table catches a dangling
290
+ `REALISES: SC-US-009-3`. Blank is not `none`.
510
291
 
511
292
  **Reasons are a CLOSED list of five**, and nothing else is accepted:
512
293
 
513
294
  | Reason | Means |
514
295
  |---|---|
515
296
  | `ui-only` | realised entirely in the interface, no algorithm to write |
516
- | `external-service` | performed by a third party, see `Architecture.md` → External Dependencies |
297
+ | `external-service` | performed by a third party, see the `architecture` role resolved through `DOCUMENT_ROLE_MAP` → External Dependencies |
517
298
  | `out-of-mvp-scope` | deliberately not built yet |
518
299
  | `data-only` | satisfied by a schema or constraint, not by a procedure |
519
300
  | `config-only` | satisfied by OUR OWN configuration — a server setting, a header, a policy file — with no procedure to write |
520
301
 
521
- Free text is NOT a reason, and `N/A` is NOT a reason. A field that accepts anything records nothing:
522
- the whole value of the list is that an unclaimed scenario has to be one of a small number of
523
- recognisable things, and if it is none of them, the gap is real and belongs in the algorithms.
302
+ Free text is NOT a reason, and `N/A` is NOT a reason. A field that accepts anything records nothing;
303
+ anything outside the closed list is a real algorithm gap.
524
304
 
525
- **What this establishes, and what it does not.** It establishes that a CLAIM exists and that its two
526
- ends name each other. It does NOT establish that the algorithm's steps actually perform the check the
527
- scenario describes no comparison of names can. So this catches *"nobody wrote anything about this
528
- scenario"*; it does not catch *"someone wrote a line that mentions it"*. Say so here rather than
529
- letting a later reader assume the stronger thing.
305
+ This proves only a mutual naming CLAIM. It does NOT establish that the algorithm's steps actually perform the check:
306
+ it catches "nobody wrote anything about this scenario", not a wrong implementation
307
+ that merely mentions the ID.
530
308
 
531
- **[MANUAL] CP4:**
532
- ```
533
- ═══════════════════════════════════════════════════════════════
534
- ⏸️ CHECKPOINT 4: Pseudocode Complete
309
+ The default label names `Specification.md`; a supplied map substitutes its resolved filename.
535
310
 
536
- **Data Structures:** [число] entities
537
- **Algorithms:** [число] core algorithms
538
- **API Endpoints:** [число] endpoints
539
-
540
- Команды:
541
- • "ок" → перейти к Architecture
542
- • "оптимизируй алгоритм X" → улучшить
543
- • "добавь edge case Y" → добавить обработку
544
- • "измени структуру Z" → изменить
545
-
546
- Ваше решение?
547
- ═══════════════════════════════════════════════════════════════
548
- ```
311
+ **[MANUAL] CP4:** show entity/core-algorithm/API-endpoint counts; `ок` → Architecture;
312
+ `оптимизируй алгоритм X`, `добавь edge case Y`, `измени структуру Z` revise pseudocode.
549
313
 
550
314
  ---
551
315
 
@@ -559,46 +323,43 @@ view("references/sparc-methodology.md")
559
323
  → Секция Architecture для best practices
560
324
  ```
561
325
 
562
- **Output — Architecture.md:**
563
- ```markdown
564
- ## Architecture Overview
565
-
566
- ### Architecture Style
567
- [Monolith / Microservices / Serverless / Hybrid]
568
-
569
- ### High-Level Diagram
570
- ```mermaid
571
- graph TB
572
- subgraph Client
573
- A[Web App]
574
- B[Mobile App]
575
- end
576
- subgraph API
577
- C[API Gateway]
578
- D[Service A]
579
- E[Service B]
580
- end
581
- subgraph Data
582
- F[(Database)]
583
- G[(Cache)]
584
- end
585
- ```
326
+ **Output — `ARCHITECTURE_FILE`:** required blocks are `## Architecture Overview` with style
327
+ `[Monolith / Microservices / Serverless / Hybrid]` and a Mermaid high-level diagram covering Client
328
+ (Web App, Mobile App), API (API Gateway, Service A, Service B), and Data (Database, Cache); `##
329
+ Component Breakdown`; `## Technology Stack` table `Layer | Technology | Rationale` with Frontend,
330
+ Backend, Database, Cache, Queue, Infrastructure; `## External Dependencies` as follows.
586
331
 
587
- ## Component Breakdown
588
- [Detailed component descriptions]
332
+ Record one row per external capability, not vendor: "sends email" and "reports bounces" are two
333
+ questions because a provider may do only one.
589
334
 
590
- ## Technology Stack
335
+ | Capability needed | Provider / API | Evidence | Verdict | Requirements relying on it |
336
+ |---|---|---|---|---|
337
+ | [what the product needs it to DO] | [service] | [link to the provider's own docs naming this capability] · checked [YYYY-MM-DD] | CONFIRMED | [REQ ids] |
338
+
339
+ Evidence MUST be the PROVIDER'S OWN documentation naming the capability, check date, and a short
340
+ verbatim QUOTE. These do NOT count: landing page, marketing page, pricing page, recollection ("the
341
+ model knows this API supports it"), or a URL nobody opened. An uncited capability is not confirmed.
342
+
343
+ **Verdicts — exactly three, because two would hide a difference that matters:**
591
344
 
592
- | Layer | Technology | Rationale |
593
- |-------|------------|-----------|
594
- | Frontend | | |
595
- | Backend | | |
596
- | Database | | |
597
- | Cache | | |
598
- | Queue | | |
599
- | Infrastructure | | |
345
+ | Verdict | Means | Consequence in Phase 2 |
346
+ |---|---|---|
347
+ | CONFIRMED | cited, and the citation names this capability | none |
348
+ | UNCONFIRMED | nobody could produce a citation | the REQUIREMENTS in that row's last column cannot enter Phase 3 — defer, remove or replace them. Unrelated work continues; the run is 🟡 CAVEATS at best and the row is NAMED in the report |
349
+ | CONTRADICTED | the provider's own docs say it cannot | 🔴 NEEDS WORK — the requirement rests on something that is not there |
600
350
 
601
- ## External Dependencies
351
+ `UNCONFIRMED` is the honest no-citation/no-web state: it is neither CONFIRMED nor CONTRADICTED. It
352
+ does not pass free: **scope the consequence to the REQUIREMENT, not the run**. Listed requirements
353
+ cannot enter Phase 3 until deferred, removed, or rewritten onto confirmable ground; unrelated work
354
+ continues. Otherwise an all-UNCONFIRMED inventory would make feasibility optional behind a caveat.
355
+
356
+ With none, write exactly: *"No external dependencies — this product calls no third-party service."*
357
+ An empty section and an absent section are indistinguishable, and only one of them means anything —
358
+ that is why the sentence is prescribed verbatim.
359
+
360
+ Row names are PLACEHOLDERS: NEVER copy a provider/capability from an example; APIs drift.
361
+
362
+ Then add `## External Dependencies
602
363
 
603
364
  Every capability this product needs from someone else's service. One row per capability, not one row
604
365
  per vendor: "sends email" and "reports bounces" are two questions, and a provider can do one without
@@ -608,13 +369,9 @@ the other.
608
369
  |---|---|---|---|---|
609
370
  | [what the product needs it to DO] | [service] | [link to the provider's own docs naming this capability] · checked [YYYY-MM-DD] | CONFIRMED | [REQ ids] |
610
371
 
611
- **Evidence — what counts, and what does not.** Evidence is a link to the PROVIDER'S OWN documentation
612
- that names the specific capability, plus the date it was checked, plus **a short verbatim QUOTE from
613
- that page stating the capability**. These do NOT count, and each is a way this check gets faked: a
614
- landing page or marketing page; a pricing page; recollection — "the model knows this API supports
615
- it"; and **a URL nobody opened** — a plausible-looking link is the cheapest possible forgery, which
616
- is exactly why the quote is required and the link alone is not enough. A capability nobody could cite
617
- is not confirmed, and saying so is the point of the middle verdict.
372
+ **Evidence — what counts.** A link to the PROVIDER'S OWN documentation naming the capability,
373
+ plus the date it was checked, plus **a short verbatim QUOTE from that page stating the capability**. These do NOT count (each a known fake): a landing page or marketing page; a pricing page; recollection ("the model knows"); **a URL nobody opened** — a plausible link
374
+ is the cheapest forgery, which is why the quote is required.
618
375
 
619
376
  **Verdicts — exactly three, because two would hide a difference that matters:**
620
377
 
@@ -624,60 +381,44 @@ is not confirmed, and saying so is the point of the middle verdict.
624
381
  | UNCONFIRMED | nobody could produce a citation | the REQUIREMENTS in that row's last column cannot enter Phase 3 — defer, remove or replace them. Unrelated work continues; the run is 🟡 CAVEATS at best and the row is NAMED in the report |
625
382
  | CONTRADICTED | the provider's own docs say it cannot | 🔴 NEEDS WORK — the requirement rests on something that is not there |
626
383
 
627
- `UNCONFIRMED` is not a failure to be hidden; it is the honest state of a project on a machine with no
628
- web access. Collapsing it into CONFIRMED overstates what is known; collapsing it into CONTRADICTED
629
- blocks work that may be perfectly fineand would push people to write a citation that isn't one,
630
- which is how a gate becomes theatre.
631
-
632
- But it does not pass for free either. **The consequence is scoped to the REQUIREMENT, not to the
633
- run:** the requirements listed in an `UNCONFIRMED` row do not enter Phase 3 until they are deferred,
634
- removed, or rewritten onto something confirmable. Everything not resting on that capability proceeds.
635
- Without this scoping an inventory of nothing but `UNCONFIRMED` rows would reach Phase 3 with a
636
- caveat, and external feasibility would never have to be established at all — the check would be
637
- optional in practice while looking mandatory on paper.
384
+ `UNCONFIRMED` is the honest offline state never collapse it into CONFIRMED (overstates) or
385
+ CONTRADICTED (invites fake citations; a gate becomes theatre). Nor is it free: **the consequence is
386
+ scoped to the REQUIREMENT, not the run**requirements in an `UNCONFIRMED` row do not enter Phase 3
387
+ until deferred, removed, or rewritten onto something confirmable; unrelated work proceeds. Without
388
+ this scoping an all-`UNCONFIRMED` inventory would pass with a caveat and the check would be optional
389
+ in practice while looking mandatory on paper.
638
390
 
639
391
  **If this product has no external dependencies**, write exactly that: *"No external dependencies —
640
392
  this product calls no third-party service."* An empty section and an absent section are
641
393
  indistinguishable, and only one of them means anything.
642
394
 
643
- Names in the row above are PLACEHOLDERS. Do not copy a real provider or a real capability from any
644
- example: what an API can do drifts, and a stale fact recorded as evidence is worse than none.
645
-
646
- ## Data Architecture
647
- [Data models, relationships, storage strategy]
395
+ Row names are PLACEHOLDERS never copy a real provider/capability from an example: API facts drift,
396
+ and a stale fact recorded as evidence is worse than none.
648
397
 
649
- ## Security Architecture
650
- [Authentication, authorization, encryption]
651
-
652
- ## Scalability Considerations
653
- [Horizontal/vertical scaling, bottlenecks]
654
- ```
398
+ ## Data Architecture` (models, relationships, storage), `## Security Architecture`
399
+ (authentication, authorization, encryption), and `## Scalability Considerations`
400
+ (horizontal/vertical scaling, bottlenecks).
655
401
 
656
402
  **Шаг 5.9 — СВЕРКА С ПСЕВДОКОДОМ (обязательный, до чекпойнта).**
657
403
 
658
- Фаза 4 написала модель данных ДО того, как эта фаза выбрала хранилище и технологии, и до сих пор
659
- ничто их не сверяло. Именно отсюда берутся расхождения, которые всплывают уже в коде: поле осталось
660
- булевым, когда схема получила перечисление; алгоритм пользуется полем, которого в схеме нет; у
661
- статуса три значения в одном документе и пять в другом.
662
-
663
- Перечитай в `Pseudocode.md` ДВЕ секции `## Data Structures` и `## Core Algorithms` и сверь их с
664
- тем, что выбрано ЗДЕСЬ. Алгоритмы нужны обязательно: расхождение «алгоритм читает поле, которого в
665
- схеме нет» по одним лишь структурам данных не обнаруживается. Ищи три вида расхождений:
404
+ Фаза 4 определила логическую модель до выбора хранилища.
405
+ Resolve role `pseudocode` through `DOCUMENT_ROLE_MAP` as `PSEUDOCODE_FILE`;
406
+ Resolve role `architecture` through `DOCUMENT_ROLE_MAP` as `ARCHITECTURE_FILE`;
407
+ re-read ДВЕ секции `PSEUDOCODE_FILE` `## Data Structures` и
408
+ `## Core Algorithms` — then compare with `ARCHITECTURE_FILE`. Algorithms are mandatory: structures alone
409
+ cannot expose a read/write of a missing field. This catches boolean→enum drift, a missing algorithm
410
+ field, or a status with 3 values in one document and 5 in another. Find all three mismatch kinds:
666
411
 
667
412
  - **смена типа** — поле объявлено одним типом, а хранилище требует другого (булево против перечисления);
668
413
  - **отсутствующая колонка** — алгоритм читает или пишет поле, которого в схеме нет;
669
414
  - **несовпадение набора значений** — у одного и того же поля разное число допустимых значений.
670
415
 
671
- Какую сторону править решается по РОЛИ документа, а не по старшинству. `Pseudocode.md` держит
672
- ЛОГИЧЕСКУЮ модель (что означает поле), `Architecture.md` ФИЗИЧЕСКУЮ (где и как оно лежит).
673
- Поэтому: если эта фаза ввела осознанное физическое ограничение (тип хранилища, индекс, длина) —
674
- правится `Pseudocode.md`; если выбранная технология НАРУШАЕТ требуемую семантику (теряются значения,
675
- исчезает состояние, которым пользуется алгоритм) — меняется выбор ЗДЕСЬ, потому что требование
676
- старше удобства реализации. Секция `## Data Architecture` этого документа остаётся на месте, но
677
- описывает отображение на хранилище и связи, а НЕ пересказывает список полей: второй экземпляр списка
678
- становится вторым местом, где начинается расхождение.
416
+ Fix by document ROLE: `PSEUDOCODE_FILE` owns LOGICAL meaning; `ARCHITECTURE_FILE` owns PHYSICAL
417
+ storage. A deliberate storage constraint (type/index/length) updates pseudocode; a technology that
418
+ BREAKS required semantics is changed HERE. `## Data Architecture` describes mapping/relationships,
419
+ NEVER a second field list.
679
420
 
680
- Результат записывается в `Architecture.md` ВСЕГДА, отдельным блоком:
421
+ Результат записывается в `ARCHITECTURE_FILE` ВСЕГДА, отдельным блоком:
681
422
 
682
423
  ```markdown
683
424
  ## Reconciliation with Pseudocode
@@ -687,30 +428,14 @@ example: what an API can do drifts, and a stale fact recorded as evidence is wor
687
428
  | … | смена типа / отсутствующая колонка / несовпадение набора значений | … |
688
429
  ```
689
430
 
690
- Если сверка не нашла ничего блок всё равно пишется, и он ОБЯЗАН назвать, что именно
691
- сверялось: «Расхождений с `Pseudocode.md` не найдено. Сверены сущности: <перечисление>; алгоритмы:
692
- <перечисление>.» Одна фраза «расхождений нет» без перечня — это церемония, которую модель напишет
693
- не глядя; перечень делает утверждение проверяемым. Молчание не является результатом сверки: по нему
694
- нельзя отличить «сверили и чисто» от «не сверяли».
431
+ If clean, the block is still REQUIRED and MUST say: «Расхождений с `[PSEUDOCODE_FILE]` не найдено.
432
+ Сверены сущности: <перечисление>; алгоритмы: <перечисление>.» Bare «расхождений нет» or silence is
433
+ not evidence.
695
434
 
696
- **[MANUAL] CP5:**
697
- ```
698
- ═══════════════════════════════════════════════════════════════
699
- ⏸️ CHECKPOINT 5: Architecture Complete
435
+ Defaults are `Pseudocode.md`/`Architecture.md`; a supplied map changes filenames only.
700
436
 
701
- **Style:** [architecture style]
702
- **Components:** [число] components
703
- **Tech Stack:** [key technologies]
704
-
705
- Команды:
706
- • "ок" → перейти к Refinement
707
- • "альтернатива для X" → другая технология
708
- • "углуби безопасность" → детальнее security
709
- • "добавь диаграмму Y" → добавить
710
-
711
- Ваше решение?
712
- ═══════════════════════════════════════════════════════════════
713
- ```
437
+ **CHECKPOINT 5** — **[MANUAL] CP5:** show architecture style, component count, and key technologies; `ок` → Refinement;
438
+ `альтернатива для X`, `углуби безопасность`, `добавь диаграмму Y` revise architecture.
714
439
 
715
440
  ---
716
441
 
@@ -718,77 +443,15 @@ example: what an API can do drifts, and a stale fact recorded as evidence is wor
718
443
 
719
444
  **Цель:** Edge cases, тестирование, оптимизация.
720
445
 
721
- **Output — Refinement.md:**
722
- ```markdown
723
- ## Edge Cases Matrix
724
-
725
- | Scenario | Input | Expected | Handling |
726
- |----------|-------|----------|----------|
727
- | Empty input | | | |
728
- | Max size | | | |
729
- | Concurrent access | | | |
730
- | Network failure | | | |
731
-
732
- ## Testing Strategy
733
-
734
- ### Unit Tests
735
- [Coverage targets, critical paths]
736
-
737
- ### Integration Tests
738
- [Service interactions, API contracts]
739
-
740
- ### E2E Tests
741
- [User journeys, critical flows]
742
-
743
- ### Performance Tests
744
- [Load testing, benchmarks]
745
-
746
- ## Test Cases
747
-
748
- ### Feature: [Name]
749
- ```gherkin
750
- Scenario: [Happy path]
751
- Given [setup]
752
- When [action]
753
- Then [assertion]
446
+ **Output — `REFINEMENT_FILE`:** `## Edge Cases Matrix` table `Scenario | Input | Expected | Handling`
447
+ with every row: Empty input, Max size, Concurrent access, Network failure; `## Testing Strategy`
448
+ with Unit (coverage/critical paths), Integration (interactions/contracts), E2E (journeys/flows),
449
+ Performance (load/benchmarks); `## Test Cases` Gherkin Happy path and Error case, each Given/When/Then;
450
+ Performance Optimizations (caching/indexing/lazy loading); Security Hardening (input validation/rate
451
+ limiting/audit logs); Accessibility (WCAG/keyboard); Technical Debt (shortcuts/refactoring).
754
452
 
755
- Scenario: [Error case]
756
- Given [setup]
757
- When [invalid action]
758
- Then [error handling]
759
- ```
760
-
761
- ## Performance Optimizations
762
- [Caching, indexing, lazy loading]
763
-
764
- ## Security Hardening
765
- [Input validation, rate limiting, audit logs]
766
-
767
- ## Accessibility (a11y)
768
- [WCAG compliance, keyboard navigation]
769
-
770
- ## Technical Debt Items
771
- [Known shortcuts, future refactoring]
772
- ```
773
-
774
- **[MANUAL] CP6:**
775
- ```
776
- ═══════════════════════════════════════════════════════════════
777
- ⏸️ CHECKPOINT 6: Refinement Complete
778
-
779
- **Edge Cases:** [число] scenarios
780
- **Test Cases:** [число] tests
781
- **Optimizations:** [список]
782
-
783
- Команды:
784
- • "ок" → перейти к Completion
785
- • "добавь тест для X" → добавить test case
786
- • "углуби edge case Y" → расширить
787
- • "оптимизируй Z" → добавить оптимизацию
788
-
789
- Ваше решение?
790
- ═══════════════════════════════════════════════════════════════
791
- ```
453
+ **[MANUAL] CP6:** show edge-case/test counts and optimizations; `ок` → Completion;
454
+ `добавь тест для X`, `углуби edge case Y`, `оптимизируй Z` revise refinement.
792
455
 
793
456
  ---
794
457
 
@@ -796,74 +459,15 @@ Scenario: [Error case]
796
459
 
797
460
  **Цель:** Deployment и operational readiness.
798
461
 
799
- **Output — Completion.md + CLAUDE.md:**
800
-
801
- **Completion.md:**
802
- ```markdown
803
- ## Deployment Plan
804
-
805
- ### Pre-Deployment Checklist
806
- - [ ] All tests passing
807
- - [ ] Security audit complete
808
- - [ ] Documentation updated
809
- - [ ] Rollback plan tested
810
-
811
- ### Deployment Sequence
812
- 1. [Step 1]
813
- 2. [Step 2]
814
- 3. [Step 3]
815
-
816
- ### Rollback Procedure
817
- [Steps to rollback if issues]
818
-
819
- ## CI/CD Configuration
820
-
821
- ```yaml
822
- stages:
823
- - test
824
- - build
825
- - deploy
826
-
827
- test:
828
- script:
829
- - npm test
830
- - npm run lint
831
-
832
- deploy:
833
- script:
834
- - npm run build
835
- - deploy.sh
836
- ```
837
-
838
- ## Monitoring & Alerting
462
+ **Output — `COMPLETION_FILE` + CLAUDE.md:**
839
463
 
840
- ### Key Metrics
841
- | Metric | Threshold | Alert |
842
- |--------|-----------|-------|
843
- | Response time p99 | > 500ms | PagerDuty |
844
- | Error rate | > 1% | Slack |
845
- | CPU usage | > 80% | Email |
846
-
847
- ## Logging Strategy
848
- [Log levels, retention, aggregation]
849
-
850
- ## Handoff Checklists
851
-
852
- ### For Development Team
853
- - [ ] Repository access
854
- - [ ] Development environment setup
855
- - [ ] Code review guidelines
856
-
857
- ### For QA Team
858
- - [ ] Test environment access
859
- - [ ] Test data setup
860
- - [ ] Bug reporting process
861
-
862
- ### For Operations Team
863
- - [ ] Production access
864
- - [ ] Runbooks
865
- - [ ] Escalation procedures
866
- ```
464
+ **Completion.md required content:** Deployment Plan with Pre-Deployment checklist (all tests passing,
465
+ security audit complete, docs updated, rollback tested), Deployment Sequence Steps 1–3, and Rollback
466
+ Procedure; CI/CD stages `test → build → deploy` running `npm test`, `npm run lint`, `npm run build`,
467
+ `deploy.sh`; Monitoring table preserving `Response time p99 | > 500ms | PagerDuty`, `Error rate | >
468
+ 1% | Slack`, `CPU usage | > 80% | Email`; Logging levels/retention/aggregation; Handoff checklists:
469
+ Development (repository access, environment setup, review guidelines), QA (test environment, test
470
+ data, bug reporting), Operations (production access, runbooks, escalation).
867
471
 
868
472
  **CLAUDE.md:**
869
473
  ```
@@ -871,117 +475,46 @@ view("templates/CLAUDE.md")
871
475
  → Заполнить шаблон данными из всех предыдущих фаз
872
476
  ```
873
477
 
874
- **[MANUAL] CP7:**
875
- ```
876
- ═══════════════════════════════════════════════════════════════
877
- ⏸️ CHECKPOINT 7: Completion Ready
878
-
879
- **Deployment:** Plan + rollback ready
880
- **Monitoring:** [число] metrics configured
881
- **Handoffs:** Dev, QA, Ops checklists
882
-
883
- Команды:
884
- • "ок" / "финиш" → создать Final Package
885
- • "добавь мониторинг X" → добавить метрику
886
- • "углуби rollback" → расширить план
887
- • "измени CI/CD" → изменить pipeline
888
-
889
- Ваше решение?
890
- ═══════════════════════════════════════════════════════════════
891
- ```
478
+ **[MANUAL] CP7:** show deployment/rollback readiness, monitoring metric count, and Dev/QA/Ops
479
+ handoffs; `ок`/`финиш` → Final Package; `добавь мониторинг X`, `углуби rollback`, `измени CI/CD`
480
+ revise completion.
892
481
 
893
482
  ---
894
483
 
895
484
  ### SYNTHESIS: Final Summary
896
485
 
897
- **Output — Final_Summary.md:**
898
- ```markdown
899
- # [Product Name] - Executive Summary
900
-
901
- ## Overview
902
- [3-5 sentences describing the product and its value]
903
-
904
- ## Problem & Solution
905
- **Problem:** [What problem we're solving]
906
- **Solution:** [How we're solving it]
907
-
908
- ## Target Users
909
- [Primary and secondary personas]
910
-
911
- ## Key Features (MVP)
912
- 1. [Feature 1] - [value proposition]
913
- 2. [Feature 2] - [value proposition]
914
- 3. [Feature 3] - [value proposition]
915
-
916
- ## Technical Approach
917
- - **Architecture:** [style]
918
- - **Tech Stack:** [key technologies]
919
- - **Key Differentiators:** [technical advantages]
920
-
921
- ## Research Highlights
922
- [Top 3-5 insights from research phase]
923
-
924
- ## Success Metrics
925
- | Metric | Target | Timeline |
926
- |--------|--------|----------|
927
-
928
- ## Timeline & Phases
929
- | Phase | Features | Timeline |
930
- |-------|----------|----------|
931
- | MVP | | |
932
- | v1.0 | | |
933
- | v2.0 | | |
934
-
935
- ## Risks & Mitigations
936
- | Risk | Mitigation |
937
- |------|------------|
938
-
939
- ## Immediate Next Steps
940
- 1. [Action 1]
941
- 2. [Action 2]
942
- 3. [Action 3]
943
-
944
- ## Documentation Package
945
- - PRD.md - Product Requirements
946
- - Solution_Strategy.md - Problem Analysis
947
- - Specification.md - Detailed Requirements
948
- - Pseudocode.md - Algorithms & Data Flow
949
- - Architecture.md - System Design
950
- - Refinement.md - Testing & Edge Cases
951
- - Completion.md - Deployment & Operations
952
- - Research_Findings.md - Market & Tech Research
953
- - CLAUDE.md - AI Integration Guide
954
- ```
486
+ **Output — `Final_Summary.md`:** title `[Product Name] - Executive Summary`; Overview (3–5
487
+ sentences); Problem & Solution; primary/secondary Target Users; MVP Features 1–3 with value;
488
+ Technical Approach (Architecture, Tech Stack, Key Differentiators); top 3–5 Research Highlights;
489
+ Success Metrics table:
490
+
491
+ | Metric | Target | Timeline | Источник значения |
492
+ |--------|--------|----------|-------------------|
493
+
494
+ **Every metric MUST name where its value comes from**, from a CLOSED list: `наш журнал` · `наша БД`
495
+ · `внешний API: <метод>` · `ручное измерение: <как>`. An empty cell and "из аналитики" are BLOCKERS,
496
+ not notes — measurability is otherwise decided by the SHAPE OF A NUMBER rather than by our ability to
497
+ OBTAIN it, so an unobtainable metric passes completeness, measurability and consistency with
498
+ distinction, and the feature gets designed around a promise nobody can keep. Manual measurement is a
499
+ legitimate answer; manual measurement presented as instrumented is not. A metric naming an external
500
+ API MUST produce a row in `## External Dependencies` — that inventory is the only route by which a
501
+ metric ever reaches a lens that looks outside these documents.
502
+
503
+ Then add Timeline table with MVP, v1.0, v2.0; Risks/Mitigations table; Immediate Next Steps Actions
504
+ 1–3; Documentation Package mapping every member: `PRD.md` Product Requirements,
505
+ `Solution_Strategy.md` Problem Analysis, `Specification.md` Detailed Requirements, `Pseudocode.md`
506
+ Algorithms & Data Flow, `Architecture.md` System Design, `Refinement.md` Testing & Edge Cases,
507
+ `Completion.md` Deployment & Operations, `Research_Findings.md` Market & Tech Research, `CLAUDE.md`
508
+ AI Integration Guide.
955
509
 
956
510
  ---
957
511
 
958
512
  ## Final Package Output
959
513
 
960
- ```
961
- ═══════════════════════════════════════════════════════════════
962
- 📦 SPARC DOCUMENTATION PACKAGE COMPLETE
963
-
964
- /output/[product-name]-sparc/
965
- ├── PRD.md ✅ Product Requirements
966
- ├── Solution_Strategy.md ✅ Problem Analysis
967
- ├── Specification.md ✅ Detailed Requirements
968
- ├── Pseudocode.md ✅ Algorithms & Data Flow
969
- ├── Architecture.md ✅ System Design
970
- ├── Refinement.md ✅ Testing & Edge Cases
971
- ├── Completion.md ✅ Deployment & Operations
972
- ├── Research_Findings.md ✅ Market & Tech Research
973
- ├── Final_Summary.md ✅ Executive Summary
974
- └── .claude/
975
- └── CLAUDE.md ✅ AI Integration Guide
976
-
977
- Total: 11 files
978
-
979
- 🚀 READY FOR VIBE CODING
980
-
981
- [AUTO mode]: Все документы созданы автоматически
982
- [MANUAL mode]: Все документы проверены на checkpoints
983
- ═══════════════════════════════════════════════════════════════
984
- ```
514
+ Report `📦 SPARC DOCUMENTATION PACKAGE COMPLETE`, path `/output/[product-name]-sparc/`, and the full
515
+ tree from **Output Documents (11 files)** with ✅ descriptions. End with `Total: 11 files`, `🚀 READY
516
+ FOR VIBE CODING`, then `[AUTO mode]: Все документы созданы автоматически` or `[MANUAL mode]: Все
517
+ документы проверены на checkpoints`.
985
518
 
986
519
  ---
987
520
 
@@ -1044,7 +577,7 @@ sparc-prd-mini MANUAL
1044
577
 
1045
578
  **Actionability:**
1046
579
  - [ ] Каждое действие имеет owner и timeline
1047
- - [ ] Метрики успеха измеримы
580
+ - [ ] Метрики успеха измеримы И называют источник значения из закрытого списка
1048
581
  - [ ] Риски идентифицированы с mitigation планами
1049
582
 
1050
583
  ---
@@ -1067,23 +600,8 @@ sparc-prd-mini MANUAL
1067
600
 
1068
601
  При старте, если режим не указан:
1069
602
 
1070
- ```
1071
- ═══════════════════════════════════════════════════════════════
1072
- 🎯 SPARC PRD Mini v2 - Mode Selection
1073
-
1074
- Доступные режимы:
1075
-
1076
- 📌 AUTO — автономная генерация всех 11 документов
1077
- Быстро, без промежуточных остановок
1078
- Команда: "auto" / "автоматически"
1079
-
1080
- 📌 MANUAL — пошаговая генерация с checkpoint'ами
1081
- Контроль на каждой фазе, возможность коррекции
1082
- Команда: "manual" / "пошагово" / "с проверками"
1083
-
1084
- Какой режим предпочитаете?
1085
- ═══════════════════════════════════════════════════════════════
1086
- ```
603
+ Ask: `🎯 SPARC PRD Mini v2 — AUTO` (`auto`/`автоматически`: all 11 documents, no intermediate
604
+ stops) or `MANUAL` (`manual`/`пошагово`/`с проверками`: checkpoint each phase, corrections allowed)?
1087
605
 
1088
606
  ---
1089
607