@dzhechkov/keysarium 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +70 -10
  2. package/bin/cli.js +0 -0
  3. package/package.json +5 -3
  4. package/src/utils.js +1 -1
  5. package/templates/.claude/commands/analyst-manual.md +38 -0
  6. package/templates/.claude/commands/brain-export.md +2 -0
  7. package/templates/.claude/commands/bto-benchmark.md +302 -0
  8. package/templates/.claude/commands/casarium.md +55 -4
  9. package/templates/.claude/commands/feature-adr.md +8 -0
  10. package/templates/.claude/commands/harvest.md +28 -46
  11. package/templates/.claude/rules/trust-tiers.md +6 -0
  12. package/templates/.claude/shards/feature-adr.shard.md +64 -10
  13. package/templates/.claude/shards/phase-ai-factory.shard.md +109 -0
  14. package/templates/.claude/skills/ai-factory-mapper/README.md +90 -0
  15. package/templates/.claude/skills/ai-factory-mapper/SKILL.md +309 -0
  16. package/templates/.claude/skills/ai-factory-mapper/assets/report-template.md +123 -0
  17. package/templates/.claude/skills/ai-factory-mapper/references/catalog.md +230 -0
  18. package/templates/.claude/skills/ai-factory-mapper/references/coverage-formula.md +219 -0
  19. package/templates/.claude/skills/ai-factory-mapper/references/decomposition-checklist.md +183 -0
  20. package/templates/.claude/skills/ai-factory-mapper/references/pattern-library.md +312 -0
  21. package/templates/.claude/skills/ai-factory-mapper/scripts/build_docx_report.js +423 -0
  22. package/templates/.claude/skills/analyst-manual-full/SKILL.md +286 -0
  23. package/templates/.claude/skills/edu-site-generator/SKILL.md +254 -0
  24. package/templates/.claude/skills/edu-site-generator/examples/sample-course-structure.md +116 -0
  25. package/templates/.claude/skills/edu-site-generator/modules/00-content-analysis.md +84 -0
  26. package/templates/.claude/skills/edu-site-generator/modules/01-course-structure.md +75 -0
  27. package/templates/.claude/skills/edu-site-generator/modules/02-data-generation.md +186 -0
  28. package/templates/.claude/skills/edu-site-generator/modules/03-scaffold.md +249 -0
  29. package/templates/.claude/skills/edu-site-generator/modules/04-components.md +130 -0
  30. package/templates/.claude/skills/edu-site-generator/modules/05-gamification.md +163 -0
  31. package/templates/.claude/skills/edu-site-generator/modules/06-deploy.md +88 -0
  32. package/templates/.claude/skills/edu-site-generator/modules/07-verification.md +97 -0
  33. package/templates/.claude/skills/edu-site-generator/references/component-templates.md +436 -0
  34. package/templates/.claude/skills/edu-site-generator/references/data-schemas.md +164 -0
  35. package/templates/.claude/skills/edu-site-generator/references/exercise-catalog.md +110 -0
  36. package/templates/.claude/skills/edu-site-generator/references/tech-stack.md +69 -0
  37. package/templates/.claude/skills/feature-adr/SKILL.md +245 -59
  38. package/templates/.claude/skills/feature-adr/modules/03-adr.md +43 -0
  39. package/templates/.claude/skills/feature-adr/modules/03.5-ideation-swarm.md +180 -0
  40. package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +56 -7
  41. package/templates/.claude/skills/feature-adr/modules/08-qe.md +87 -23
  42. package/templates/.claude/skills/feature-adr/modules/09-fleet-qe.md +305 -0
  43. package/templates/.claude/skills/feature-adr/references/agentic-qe/README.md +143 -0
  44. package/templates/.claude/skills/feature-adr/references/agentic-qe/brutal-honesty-review.md +240 -0
  45. package/templates/.claude/skills/feature-adr/references/agentic-qe/chaos-engineering-resilience.md +163 -0
  46. package/templates/.claude/skills/feature-adr/references/agentic-qe/code-goal-planner.md +446 -0
  47. package/templates/.claude/skills/feature-adr/references/agentic-qe/enterprise-integration-testing.md +111 -0
  48. package/templates/.claude/skills/feature-adr/references/agentic-qe/mutation-testing.md +236 -0
  49. package/templates/.claude/skills/feature-adr/references/agentic-qe/performance-testing.md +315 -0
  50. package/templates/.claude/skills/feature-adr/references/agentic-qe/qcsd-ideation-swarm.md +126 -0
  51. package/templates/.claude/skills/feature-adr/references/agentic-qe/qcsd-production-swarm.md +108 -0
  52. package/templates/.claude/skills/feature-adr/references/agentic-qe/qe-coverage-analysis.md +193 -0
  53. package/templates/.claude/skills/feature-adr/references/agentic-qe/qe-requirements-validation.md +254 -0
  54. package/templates/.claude/skills/feature-adr/references/agentic-qe/regression-testing.md +233 -0
  55. package/templates/.claude/skills/feature-adr/references/agentic-qe/risk-based-testing.md +212 -0
  56. package/templates/.claude/skills/feature-adr/references/agentic-qe/security-testing.md +311 -0
  57. package/templates/.claude/skills/feature-adr/references/agentic-qe/shift-left-testing.md +231 -0
  58. package/templates/.claude/skills/feature-adr/references/agentic-qe/tdd-london-chicago.md +249 -0
  59. package/templates/.claude/skills/knowledge-extractor/SKILL.md +254 -0
  60. package/templates/.claude/skills/knowledge-extractor/modules/01-extract.md +188 -0
  61. package/templates/.claude/skills/knowledge-extractor/modules/02-classify.md +99 -0
  62. package/templates/.claude/skills/knowledge-extractor/modules/03-gate.md +150 -0
  63. package/templates/.claude/skills/knowledge-extractor/modules/04-integrate.md +159 -0
  64. package/templates/.claude/skills/knowledge-extractor/references/artifact-categories.md +100 -0
  65. package/templates/.claude/skills/knowledge-extractor/references/maturity-model.md +94 -0
  66. package/templates/.claude/skills/knowledge-extractor/references/quality-gates.md +98 -0
  67. package/templates/.claude/skills/knowledge-extractor/templates/artifact-card.md +63 -0
  68. package/templates/.claude/skills/knowledge-extractor/templates/harvest-report.md +102 -0
  69. package/templates/.claude/skills/transcript-site-generator/SKILL.md +287 -0
  70. package/templates/.claude/skills/transcript-site-generator/examples/sample-text-only-site.md +123 -0
  71. package/templates/.claude/skills/transcript-site-generator/examples/sample-transcript-site.md +134 -0
  72. package/templates/.claude/skills/transcript-site-generator/modules/00-input-analysis.md +132 -0
  73. package/templates/.claude/skills/transcript-site-generator/modules/01-content-parsing.md +117 -0
  74. package/templates/.claude/skills/transcript-site-generator/modules/02-site-generation.md +293 -0
  75. package/templates/.claude/skills/transcript-site-generator/modules/03-interactivity.md +406 -0
  76. package/templates/.claude/skills/transcript-site-generator/modules/04-deploy.md +130 -0
  77. package/templates/.claude/skills/transcript-site-generator/modules/05-verification.md +155 -0
  78. package/templates/.claude/skills/transcript-site-generator/references/component-catalog.md +86 -0
  79. package/templates/.claude/skills/transcript-site-generator/references/data-schemas.md +123 -0
  80. package/templates/.claude/skills/transcript-site-generator/references/tech-stack.md +132 -0
  81. package/templates/CLAUDE.md +30 -9
  82. package/templates/docs/continuous-learning-guide.md +622 -0
  83. package/templates/docs/edu-site-generator/01-deployment-guide.md +911 -0
  84. package/templates/docs/edu-site-generator/02-admin-guide.md +901 -0
  85. package/templates/docs/edu-site-generator/03-user-guide.md +1008 -0
  86. package/templates/docs/edu-site-generator/04-infrastructure-requirements.md +489 -0
  87. package/templates/docs/edu-site-generator/05-architecture.md +902 -0
  88. package/templates/docs/edu-site-generator/06-user-flows.md +759 -0
  89. package/templates/docs/improvement-directions.md +8 -4
  90. package/templates/docs/keysarium-core/02-functionality.md +3 -1
  91. package/templates/docs/skills-bto/01-deployment-guide.md +1 -1
  92. package/templates/docs/skills-bto/02-admin-guide.md +4 -1
  93. package/templates/docs/skills-bto/03-user-guide.md +4 -3
  94. package/templates/docs/skills-bto/04-infrastructure-requirements.md +2 -1
  95. package/templates/docs/skills-bto/05-architecture.md +11 -11
  96. package/templates/docs/skills-bto/06-user-flows.md +2 -1
  97. package/templates/docs/transcript-site-generator/01-deployment-guide.md +1042 -0
  98. package/templates/docs/transcript-site-generator/02-admin-guide.md +918 -0
  99. package/templates/docs/transcript-site-generator/03-user-guide.md +925 -0
  100. package/templates/docs/transcript-site-generator/04-infrastructure-requirements.md +482 -0
  101. package/templates/docs/transcript-site-generator/05-architecture.md +1068 -0
  102. package/templates/docs/transcript-site-generator/06-user-flows.md +855 -0
  103. package/templates/lib/dream-engine.md +1 -1
  104. package/templates/lib/memory-protocol.md +6 -2
  105. package/templates/lib/reward-tracker.md +6 -3
package/README.md CHANGED
@@ -28,10 +28,10 @@ After installation, open Claude Code in your project directory and start using s
28
28
 
29
29
  | Component | Count | Description |
30
30
  |-----------|-------|-------------|
31
- | **Skills** | 6 | `explore`, `frontend-design`, `goap-research`, `presentation-storyteller`, `problem-solver`, `reverse-engineering` |
32
- | **Commands** | 13 | `/casarium`, `/new-research`, `/parallel-research`, `/discovery`, `/explore-case`, `/research`, `/cjm-prototype`, `/solve`, `/architecture-phase`, `/presentation`, `/harvest`, `/brain-export`, `/brain-import` |
33
- | **Rules** | 10 | `research-quality`, `checkpoint-protocol`, `agent-swarm`, `domain-specific`, `anti-patterns`, `file-conventions`, `modular-reuse`, `feedback-loops`, `model-routing`, `trust-tiers` |
34
- | **Shards** | 8 | Context shards for each phase: `phase-0-discovery`, `phase-1-explore`, `phase-2-research`, `phase-25-cjm`, `phase-3-solve`, `phase-4-architecture`, `phase-5-presentation`, `bto-evaluation` |
31
+ | **Skills** | 9 | `explore`, `frontend-design`, `goap-research`, `presentation-storyteller`, `problem-solver`, `reverse-engineering`, `bto`, `knowledge-extractor`, `ai-factory-mapper` |
32
+ | **Commands** | 24 | `/casarium`, `/new-research`, `/parallel-research`, `/discovery`, `/explore-case`, `/research`, `/cjm-prototype`, `/solve`, `/architecture-phase`, `/presentation`, `/harvest`, `/brain-export`, `/brain-import`, `/bto`, `/bto-build`, `/bto-test`, `/bto-optimize`, `/bto-benchmark`, `/feature-adr`, `/init-platform`, `/learning-stats`, `/dream`, `/workers`, `/verify-chain` |
33
+ | **Rules** | 16 | `research-quality`, `checkpoint-protocol`, `agent-swarm`, `domain-specific`, `anti-patterns`, `file-conventions`, `modular-reuse`, `feedback-loops`, `model-routing`, `trust-tiers`, `bto-quality-gates`, `background-workers`, `dream-cycles`, `reward-learning`, `witness-chain`, `feature-adr-conventions` |
34
+ | **Shards** | 10 | Context shards for each phase: `phase-0-discovery`, `phase-1-explore`, `phase-2-research`, `phase-25-cjm`, `phase-3-solve`, `phase-4-architecture`, `phase-5-presentation`, `phase-ai-factory`, `bto-evaluation`, `feature-adr` |
35
35
  | **Agent Templates** | 5 | `discovery-worker`, `research-worker`, `cjm-variant-worker`, `presentation-worker`, `parallel-research-orchestrator` |
36
36
  | **Library** | 4 | `phase-utils`, `agent-patterns`, `skill-loader`, `domain-templates` |
37
37
  | **Documentation** | 12 | Deployment, admin, user guide, infrastructure, architecture, flows (for Keysarium and BTO) |
@@ -95,6 +95,9 @@ claude
95
95
 
96
96
  # Start a full case study (runs all 7 phases with checkpoints)
97
97
  /casarium Analyze how AI can automate customer support in banking
98
+
99
+ # Same pipeline + Cloud.ru AI Factory mapping on every phase
100
+ /casarium --ai-factory Analyze how AI can automate customer support in banking
98
101
  ```
99
102
 
100
103
  ### Individual Phases
@@ -134,12 +137,52 @@ claude
134
137
 
135
138
  ```bash
136
139
  /casarium Как AI может автоматизировать процесс обработки обращений клиентов в банке, сократив время ответа с 4 часов до 15 минут?
140
+
141
+ # Same case + AI Factory service mapping
142
+ /casarium --ai-factory Как AI может автоматизировать процесс обработки обращений клиентов в банке, сократив время ответа с 4 часов до 15 минут?
137
143
  ```
138
144
 
139
145
  The toolkit processes cases in any language and adapts domain rules accordingly.
140
146
 
141
147
  ---
142
148
 
149
+ ## Cloud.ru AI Factory Mode (`--ai-factory`)
150
+
151
+ Add the `--ai-factory` flag to `/casarium` to get full Cloud.ru Evolution AI Factory mapping integrated across all phases of the pipeline.
152
+
153
+ ```bash
154
+ /casarium --ai-factory <case text>
155
+ ```
156
+
157
+ ### What it adds
158
+
159
+ | Phase | Addition |
160
+ |-------|----------|
161
+ | **Phase 0** | AI Factory applicability assessment appended to `00_product_discovery.md` |
162
+ | **Phase 1** | AI Factory context paragraph in `01_case_brief.md` |
163
+ | **Phase 2** | Full ai-factory-mapper workflow (catalog sync + decomposition + mapping) → new artifact `02.6_ai_factory_mapping.md` |
164
+ | **Phase 2.5** | Each CJM step annotated with the AI Factory service that handles it |
165
+ | **Phase 3** | Gap analysis + coverage scoring (%) appended to `03_solution_strategy.md` |
166
+ | **Phase 4** | AI Factory services named in C4 diagram + new `diagrams/ai-factory-pipeline.mermaid` |
167
+ | **Phase 5** | Full AI Factory report (`ai_factory_analysis.md`) + "AI Factory Coverage" slide |
168
+
169
+ ### Additional artifacts (--ai-factory only)
170
+
171
+ ```
172
+ researches/<case-slug>/
173
+ ├── 02.6_ai_factory_mapping.md # Step→service mapping with ✅/⚠️/❌
174
+ ├── ai_factory_analysis.md # Full analysis report
175
+ ├── ai_factory_analysis.docx # DOCX report (if Node.js available)
176
+ └── diagrams/
177
+ └── ai-factory-pipeline.mermaid # Mermaid flowchart of the AI Factory pipeline
178
+ ```
179
+
180
+ ### Zero-degradation guarantee
181
+
182
+ Without `--ai-factory`, the pipeline is **identical** to v1.4. The flag is purely additive — no existing artifacts are modified or removed, no phases are altered, no checkpoints are changed.
183
+
184
+ ---
185
+
143
186
  ## Domain Support
144
187
 
145
188
  The toolkit automatically detects the domain from the case description and applies domain-specific rules:
@@ -205,19 +248,23 @@ researches/<case-slug>/
205
248
  ├── 01_case_brief.md # Phase 1 output
206
249
  ├── 02_research_findings.md # Phase 2 output
207
250
  ├── 02.5_trend_brief.md # Phase 2.5 output
251
+ ├── 02.6_ai_factory_mapping.md # Phase 2 output (--ai-factory only)
208
252
  ├── 03_solution_strategy.md # Phase 3 output
209
253
  ├── 04_architecture.md # Phase 4 output
210
254
  ├── 05_presentation_content.md # Phase 5 output
211
255
  ├── 06_speaker_script.md # Phase 5 output
212
256
  ├── 07_qa_preparation.md # Phase 5 output
213
257
  ├── 08_executive_summary.md # Phase 5 output (mandatory)
258
+ ├── ai_factory_analysis.md # Phase 5 output (--ai-factory only)
259
+ ├── ai_factory_analysis.docx # Phase 5 output (--ai-factory only, if Node.js available)
214
260
  ├── prototype/
215
261
  │ └── cjm-prototype.jsx # Phase 2.5 React prototype
216
262
  ├── diagrams/
217
263
  │ ├── architecture-c4.mermaid
218
264
  │ ├── sequence-main-flow.mermaid
219
265
  │ ├── process-as-is.mermaid
220
- │ └── process-to-be.mermaid
266
+ │ ├── process-to-be.mermaid
267
+ │ └── ai-factory-pipeline.mermaid # Phase 4 output (--ai-factory only)
221
268
  └── README.md
222
269
  ```
223
270
 
@@ -255,16 +302,29 @@ Create a new file under `.claude/rules/`:
255
302
 
256
303
  Rules are automatically loaded by Claude Code and enforced across all phases.
257
304
 
258
- ### Knowledge Harvesting
305
+ ### Knowledge Harvesting (knowledge-extractor skill)
259
306
 
260
- After completing research, extract reusable patterns:
307
+ After completing research, extract reusable patterns using the multi-agent knowledge-extractor:
261
308
 
262
309
  ```bash
263
- /harvest researches/<slug>/ # Harvest from one research
264
- /harvest all # Harvest from all researches
310
+ /harvest researches/<slug>/ # Full harvest from one directory
311
+ /harvest researches/<slug>/ only patterns # Extract only patterns
312
+ /harvest all # Harvest from all researches
313
+ /harvest all only rules,templates # All researches, specific categories
314
+ /harvest features/my-feature/ # Harvest from a feature directory
265
315
  ```
266
316
 
267
- The harvester reviews completed projects, identifies universal patterns, decontextualizes them, and updates `TOOLKIT_HARVEST.md`.
317
+ **Pipeline:** Extract (5 parallel agents) → Classify (7 categories) → User Checkpoint → Gate (8 quality checks) → Integrate (auto-place)
318
+
319
+ | Stage | What Happens |
320
+ |-------|-------------|
321
+ | **Extract** | 5 parallel agents scan through different lenses: patterns, commands, rules, templates, snippets |
322
+ | **Classify** | Findings sorted into 7 categories (`skills`, `commands`, `hooks`, `rules`, `templates`, `patterns`, `snippets`) with cross-dedup |
323
+ | **User Review** | Numbered list of findings with granular control (`#N` commands to accept/reject/merge) |
324
+ | **Quality Gates** | 8 blocking gates in 2 passes: deterministic (G1-G2, G5-G7) + semantic via haiku (G3-G4, G8) |
325
+ | **Integrate** | Auto-placement into `.claude/` directories + `TOOLKIT_HARVEST.md` update + harvest report |
326
+
327
+ The skill is **domain-agnostic** — works in any project, not just Keysarium research pipelines. Optional integrations (reward learning, dream cycles, brain export) activate automatically when their infrastructure is present.
268
328
 
269
329
  ### Brain Portability (v1.1)
270
330
 
package/bin/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dzhechkov/keysarium",
3
- "version": "1.3.0",
4
- "description": "AI Case Research Toolkit for Claude Code — full 7-phase pipeline with feature-adr, dream cycles, background workers, multi-platform support, and reward learning",
3
+ "version": "1.5.0",
4
+ "description": "AI Case Research Toolkit for Claude Code — full 7-phase pipeline with feature-adr, dream cycles, background workers, multi-platform support, reward learning, and Cloud.ru AI Factory mapping (--ai-factory flag)",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
7
7
  "keysarium": "./bin/cli.js"
@@ -25,7 +25,9 @@
25
25
  "skills",
26
26
  "pipeline",
27
27
  "keysarium",
28
- "product-research"
28
+ "product-research",
29
+ "ai-factory",
30
+ "cloud-ru"
29
31
  ],
30
32
  "author": "dzhechko",
31
33
  "license": "MIT",
package/src/utils.js CHANGED
@@ -218,7 +218,7 @@ function getTemplatesDir() {
218
218
  // ===========================================================================
219
219
 
220
220
  const COMPONENTS = {
221
- skills: { src: '.claude/skills', label: 'Skills (6 skill packs)', group: 'core' },
221
+ skills: { src: '.claude/skills', label: 'Skills (8 skill packs)', group: 'core' },
222
222
  commands: { src: '.claude/commands', label: 'Commands (13 slash commands)', group: 'core' },
223
223
  rules: { src: '.claude/rules', label: 'Rules (10 auto-loaded rules)', group: 'core' },
224
224
  shards: { src: '.claude/shards', label: 'Shards (7 context shards)', group: 'core' },
@@ -0,0 +1,38 @@
1
+ # Analyst Manual: Стратегический анализ с контрольными точками
2
+
3
+ ## Использование
4
+ ```
5
+ /analyst-manual [тема или задача для анализа]
6
+ ```
7
+
8
+ ## Аргумент
9
+ $ARGUMENTS
10
+
11
+ ## Действия
12
+
13
+ 1. **Загрузи скилл:** Прочитай `.claude/skills/analyst-manual-full/SKILL.md`
14
+ 2. **Оцени ясность задачи** (Gate: Task Clarity Assessment)
15
+ - Задача ясна → пропустить Explore, сформировать Task Brief
16
+ - Задача не ясна → Phase 1: Explore
17
+
18
+ 3. **Phase 1: Explore** (если нужен)
19
+ - Кларификация задачи, формирование Task Brief
20
+ - Output: `01_task_brief.md`
21
+ - ⏸️ **CHECKPOINT 1:** Подтверждение Task Brief + выбор verification mode
22
+
23
+ 4. **Phase 2: Verified Research** (goap-research-ed25519)
24
+ - Используй `scripts/goap_planner.py` и `scripts/ed25519_verifier.py`
25
+ - Режим: выбранный на CHECKPOINT 1 (moderate/strict/paranoid)
26
+ - Output: `02_research_findings.md`
27
+ - ⏸️ **CHECKPOINT 2:** Подтверждение findings
28
+
29
+ 5. **Phase 3: Solve** (problem-solver-enhanced)
30
+ - 9-модульный framework (First Principles, TRIZ, Game Theory, OODA)
31
+ - Output: `03_solution.md`
32
+ - ⏸️ **CHECKPOINT 3:** Подтверждение решения
33
+
34
+ 6. **Synthesis:** Финальный summary всех фаз
35
+ - Output: `04_final_summary.md`
36
+
37
+ ## Режим
38
+ **MANUAL** — подтверждение между каждой фазой обязательно.
@@ -108,6 +108,8 @@ Construct a JSON structure (v1.1 with manifest):
108
108
  "domains": [],
109
109
  "phase_averages": {},
110
110
  "top_patterns": [],
111
+ "most_reused_records": [],
112
+ "total_usage_count": 0,
111
113
  "exported_from": ".keysarium/memory/"
112
114
  },
113
115
 
@@ -0,0 +1,302 @@
1
+ # /bto-benchmark — Deterministic Benchmarking of a Skill or Command
2
+
3
+ ## Usage
4
+ ```
5
+ /bto-benchmark [path to skill directory or file]
6
+ ```
7
+
8
+ ## Parameters
9
+ - $ARGUMENTS — Path to a skill directory (`.claude/skills/<name>/`), a command file (`.claude/commands/<name>.md`), a rule file (`.claude/rules/<name>.md`), or any structured artifact. Optionally include "verbose" to show expanded per-section diagnostics for all layers.
10
+
11
+ ## Protocol
12
+
13
+ ### Step 1: Load Skill and Module
14
+
15
+ Read `.claude/skills/bto/SKILL.md`
16
+ Read `.claude/skills/bto/modules/benchmark.md`
17
+ Read `.claude/skills/bto/references/golden-samples.md`
18
+
19
+ ### Step 2: Validate Input
20
+
21
+ If $ARGUMENTS is empty:
22
+ - Ask: "Provide a path to the skill directory or artifact file you want to benchmark."
23
+ - Stop and wait.
24
+
25
+ Resolve the artifact path from $ARGUMENTS:
26
+ - Strip any trailing slash
27
+ - If the path points to a directory → look for `SKILL.md` inside it as the primary file, but include all files in the directory for context
28
+ - If the path points to a file → use that file directly
29
+ - If the path does not exist → report "Path not found: [path]" and stop
30
+
31
+ ### Step 3: Detect Artifact Type
32
+
33
+ Auto-detect from path pattern:
34
+
35
+ | Path Pattern | Detected Type |
36
+ |-------------|--------------|
37
+ | `.claude/skills/*/SKILL.md` or `.claude/skills/*/` | skill |
38
+ | `.claude/commands/*.md` | command |
39
+ | `.claude/rules/*.md` | rule |
40
+ | `.claude/agents/*.md` | agent |
41
+ | `researches/**/*.md` | research artifact |
42
+
43
+ If type cannot be determined from path → infer from file content structure.
44
+
45
+ ### Step 4: Layer B0 — Golden Sample Comparison (Deterministic)
46
+
47
+ **Purpose:** Compare artifact structure against the canonical golden sample for its type. Zero LLM cost.
48
+
49
+ Load golden samples for the detected type from `references/golden-samples.md`.
50
+
51
+ **Procedure:**
52
+
53
+ 1. Parse the artifact into a section tree (heading hierarchy, section lengths, ordering)
54
+ 2. Parse the matching golden sample into the same section tree format
55
+ 3. Compare across three structural axes:
56
+
57
+ **Axis 1 — Section Coverage:**
58
+ For each required section in the golden sample, check if the artifact contains a matching section (by heading text or semantic equivalent).
59
+ - `section_coverage = matched_sections / total_golden_sections`
60
+
61
+ **Axis 2 — Ordering Score:**
62
+ Compare the ordering of matched sections against the golden sample ordering.
63
+ - Use normalized Kendall tau distance: `ordering_score = 1 - (inversions / max_inversions)`
64
+ - If fewer than 3 matched sections → ordering_score = 1.0 (too few to meaningfully compare)
65
+
66
+ **Axis 3 — Proportion Score:**
67
+ For each matched section, compute the ratio of artifact section length to golden sample section length.
68
+ - `proportion_score = 1 - mean(|log(artifact_len / golden_len)|)` clamped to [0, 1]
69
+ - Measures whether sections are proportionally sized (not too bloated, not too thin)
70
+
71
+ **Display per-section MATCH/MISS table:**
72
+
73
+ ```
74
+ Golden Section Status Artifact Section Size Ratio
75
+ ─────────────────────────── ──────── ──────────────────────────── ──────────
76
+ ## Overview MATCH ## Overview 1.2x
77
+ ## Protocol MATCH ## Protocol 0.8x
78
+ ## Anti-Patterns MATCH ## Anti-Patterns 1.0x
79
+ ## Dependencies MISS — —
80
+ ## Quick Start MATCH ## Quick Start 1.5x
81
+ ```
82
+
83
+ **Golden Similarity Score:**
84
+ ```
85
+ B0 = section_coverage * 0.50 + ordering_score * 0.25 + proportion_score * 0.25
86
+ ```
87
+
88
+ **Gate:** If B0 < 0.30 → BLOCK immediately. The artifact's structure is too far from the expected form to benchmark meaningfully.
89
+
90
+ ### Step 5: Layer B1 — Deterministic Test Suite
91
+
92
+ **Purpose:** Run all applicable deterministic tests for the detected artifact type. Zero LLM cost.
93
+
94
+ Execute all applicable checks from `benchmark.md` for the detected artifact type. These overlap with but extend the Layer 0 checks from `/bto-test`:
95
+
96
+ **Universal Checks (U1-U12):**
97
+ - U-01: File exists and is non-empty
98
+ - U-02: UTF-8 encoding valid
99
+ - U-03: Starts with level-1 heading
100
+ - U-04: No placeholder text (`[TODO]`, `[TBD]`, `<INSERT>`, `[PLACEHOLDER]`)
101
+ - U-05: No empty sections (heading with no content before next heading)
102
+ - U-06: Consistent heading hierarchy (no h1→h3 jumps)
103
+ - U-07: No broken internal cross-references
104
+ - U-08: File size within bounds (200B – 100KB per file)
105
+ - U-09: No trailing whitespace on lines
106
+ - U-10: Standard Markdown only (no HTML unless in code blocks)
107
+ - U-11: All code blocks properly closed
108
+ - U-12: No duplicate top-level sections
109
+
110
+ **Type-Specific Checks:**
111
+ - Skill: SK-01 through SK-16 (SKILL.md exists, required sections, modules/, references/, examples/, etc.)
112
+ - Command: CM-01 through CM-08 (Usage section, Parameters, Protocol steps, Checkpoint, Critical Rules, etc.)
113
+ - Rule: RL-01 through RL-06 (Table format, detection signals, fix actions, no contradictions, etc.)
114
+ - Agent: AG-01 through AG-04 (Model specified, isolation rules, naming convention, output format)
115
+
116
+ **Display per-test PASS/FAIL table:**
117
+
118
+ ```
119
+ ID Check Result Note
120
+ ─────── ────────────────────────────────── ──────── ────────────────────────────
121
+ U-01 File exists and is non-empty PASS 8.4 KB
122
+ U-02 UTF-8 encoding PASS
123
+ ...
124
+ SK-01 SKILL.md exists at skill root PASS
125
+ SK-02 Has ## Overview section PASS
126
+ SK-03 Has ## Anti-Patterns section FAIL Section missing
127
+ ...
128
+ ```
129
+
130
+ **Test Pass Rate:**
131
+ ```
132
+ B1 = passed_tests / total_applicable_tests
133
+ ```
134
+
135
+ **Gate:** If B1 < 0.60 → BLOCK. Too many structural failures to proceed to consistency probing.
136
+
137
+ ### Step 6: Layer B2 — Consistency Probe
138
+
139
+ **Purpose:** Measure evaluation stability by running identical prompts across multiple agents. Detects artifacts that produce inconsistent interpretations.
140
+
141
+ **Model:** haiku (cost-optimized)
142
+
143
+ **Spawn 3 parallel haiku agents with the identical evaluation prompt:**
144
+
145
+ Each agent receives the exact same prompt:
146
+ ```
147
+ You are evaluating a Claude Code artifact for structural quality.
148
+ Rate these 4 dimensions (0.0 to 1.0 each, two decimal places):
149
+ 1. STRUCTURE — Does the artifact follow a clear, logical organization?
150
+ 2. CLARITY — Are instructions unambiguous and actionable?
151
+ 3. COVERAGE — Does it address all aspects implied by its title/scope?
152
+ 4. CONSISTENCY — Is the internal terminology and style uniform?
153
+ Output as JSON: {"structure": X.XX, "clarity": X.XX, "coverage": X.XX, "consistency": X.XX}
154
+ ```
155
+
156
+ **Isolation:** Each agent evaluates independently. No cross-communication.
157
+
158
+ **After all 3 return, compute structural agreement:**
159
+
160
+ For each dimension:
161
+ ```
162
+ agreement[dim] = 1 - (max(scores[dim]) - min(scores[dim]))
163
+ ```
164
+
165
+ **Consistency Score:**
166
+ ```
167
+ B2 = mean(agreement across all 4 dimensions)
168
+ ```
169
+
170
+ **Interpretation:**
171
+ - B2 > 0.85 → HIGH consistency — the artifact is unambiguously structured
172
+ - B2 0.60-0.85 → MODERATE consistency — some sections are open to interpretation
173
+ - B2 < 0.60 → LOW consistency — the artifact is structurally ambiguous
174
+
175
+ **Display per-probe comparison:**
176
+
177
+ ```
178
+ Dimension Probe 1 Probe 2 Probe 3 Range Agreement
179
+ ──────────── ────────── ────────── ────────── ──────── ──────────
180
+ STRUCTURE 0.80 0.85 0.82 0.05 0.95
181
+ CLARITY 0.70 0.75 0.65 0.10 0.90
182
+ COVERAGE 0.60 0.70 0.55 0.15 0.85
183
+ CONSISTENCY 0.75 0.78 0.73 0.05 0.95
184
+ Mean: 0.91
185
+ ```
186
+
187
+ No gate on B2 — consistency is informational and feeds into the aggregate score.
188
+
189
+ ### Step 7: Layer B3 — Performance Metrics
190
+
191
+ **Purpose:** Quantify token efficiency and information density. Zero LLM cost.
192
+
193
+ **Metric 1 — Token Efficiency:**
194
+ ```
195
+ token_efficiency = meaningful_content_tokens / total_tokens
196
+ ```
197
+ Where `meaningful_content_tokens` excludes: blank lines, decorative separators, repeated boilerplate headers, and excessive whitespace. Target: > 0.70.
198
+
199
+ **Metric 2 — Information Density:**
200
+ ```
201
+ information_density = unique_concepts / total_sections
202
+ ```
203
+ Where `unique_concepts` = count of distinct topics, terms, or instructions introduced. Measures whether each section contributes new information vs. repeating prior content. Target: > 2.0 concepts per section.
204
+
205
+ **Metric 3 — Bloat Detection:**
206
+ Identify sections where:
207
+ - Section length > 3x the golden sample equivalent → BLOATED
208
+ - Section length < 0.2x the golden sample equivalent → THIN
209
+ - Section repeats > 30% of content from another section → REDUNDANT
210
+
211
+ ```
212
+ bloat_score = 1 - (bloated_sections + thin_sections + redundant_sections) / total_sections
213
+ ```
214
+ Clamped to [0, 1].
215
+
216
+ **Performance Score:**
217
+ ```
218
+ B3 = token_efficiency * 0.35 + normalize(information_density, 0, 4) * 0.35 + bloat_score * 0.30
219
+ ```
220
+ Where `normalize(x, min, max)` clamps and scales x to [0, 1].
221
+
222
+ **Display per-section metrics:**
223
+
224
+ ```
225
+ Section Tokens Concepts Golden Ratio Flag
226
+ ───────────────────────── ──────── ────────── ────────────── ──────────
227
+ ## Overview 320 4 1.2x OK
228
+ ## Protocol 1840 12 0.8x OK
229
+ ## Anti-Patterns 580 6 2.8x BLOATED
230
+ ## Quick Start 95 2 0.3x THIN
231
+ ## Dependencies 210 3 1.0x OK
232
+ ```
233
+
234
+ ### Step 8: Aggregate & Gate
235
+
236
+ **BENCHMARK_SCORE formula:**
237
+ ```
238
+ BENCHMARK_SCORE = B0 * 0.30 + B1 * 0.35 + B2 * 0.15 + B3 * 0.20
239
+ ```
240
+
241
+ **Weight rationale:**
242
+ - B0 (Golden Comparison) at 0.30 — structural conformance is the primary benchmark signal
243
+ - B1 (Test Suite) at 0.35 — deterministic correctness is the most reliable signal
244
+ - B2 (Consistency) at 0.15 — stability matters but is a secondary signal
245
+ - B3 (Performance) at 0.20 — efficiency matters for production artifacts
246
+
247
+ **Gate:**
248
+ - BENCHMARK_SCORE < 0.50 → **BLOCK** — artifact requires significant rework before evaluation
249
+ - BENCHMARK_SCORE 0.50-0.70 → **WARN** — artifact has structural issues; proceed to TEST with caution
250
+ - BENCHMARK_SCORE > 0.70 → **PASS** — artifact meets benchmark standards; ready for TEST
251
+
252
+ Record `BENCHMARK_SCORE` for downstream consumption by `/bto-test` and `/bto`.
253
+
254
+ ---
255
+
256
+ ## Checkpoint
257
+
258
+ ```
259
+ ═══════════════════════════════════════════════════════
260
+ CHECKPOINT: BENCHMARK Complete
261
+ <promise>BTO_BENCHMARKED</promise>
262
+ Artifact: [path]
263
+ Type: [detected type]
264
+
265
+ Layer B0 (Golden): X.XX — section coverage, ordering, proportions
266
+ Layer B1 (Test Suite): X.XX — Y/Z tests passed
267
+ Layer B2 (Consistency): X.XX — agreement across 3 probes
268
+ Layer B3 (Performance): X.XX — token efficiency, density, bloat
269
+
270
+ BENCHMARK SCORE: X.XX [PASS / WARN / BLOCK]
271
+
272
+ • "ок" — proceed to TEST
273
+ • "покажи детали [B0/B1/B2/B3]" — expand layer details
274
+ • "пропусти тест" — skip TEST (if PASS)
275
+ ═══════════════════════════════════════════════════════
276
+ ```
277
+
278
+ Wait for user confirmation.
279
+
280
+ ---
281
+
282
+ ## Modular Usage
283
+
284
+ This command is also invoked internally by:
285
+ - `/bto` — as a pre-flight step before TEST phase (if benchmark module is loaded)
286
+ - `/bto-test` — optionally as a prerequisite gate (if user requests `benchmark` flag)
287
+
288
+ The `BENCHMARK_SCORE` is available to downstream commands:
289
+ - `/bto-test` may use it to calibrate Layer 1 expectations
290
+ - `/bto-optimize` may use it to set a structural baseline floor
291
+
292
+ ## Critical Rules
293
+
294
+ - Layer B0 and B1 are fully deterministic — no LLM calls, zero cost
295
+ - Layer B2 uses haiku only — NEVER use sonnet or opus for consistency probes
296
+ - Agent tool is REQUIRED for Layer B2 — do not run probes sequentially
297
+ - Golden samples from `references/golden-samples.md` are the authoritative structural reference
298
+ - If golden sample does not exist for the detected type → skip B0, set B0 = 0.50 (neutral), and log a warning
299
+ - Report `BENCHMARK_SCORE` explicitly so downstream commands can consume it
300
+ - BLOCK verdict at B0 or B1 halts the benchmark — do NOT proceed to subsequent layers
301
+ - Layer B3 bloat detection uses golden sample proportions — without a golden sample, use absolute thresholds only
302
+ - If "verbose" is in $ARGUMENTS, show expanded per-section diagnostics for all layers without prompting
@@ -6,14 +6,28 @@
6
6
  ## Использование
7
7
  ```
8
8
  /casarium [текст кейса или ссылка]
9
+ /casarium --ai-factory [текст кейса или ссылка]
9
10
  ```
10
11
 
12
+ Флаг `--ai-factory`: активирует интеграцию с Cloud.ru Evolution AI Factory на всех фазах.
13
+ Без флага: поведение полностью идентично предыдущим версиям (нулевая деградация).
14
+
11
15
  ## КРИТИЧЕСКОЕ ПРАВИЛО: ФАЙЛЫ СОЗДАЮТСЯ В МОМЕНТ ФАЗЫ
12
16
  В конце каждой фазы **немедленно создай** файл. Не откладывай.
13
17
 
14
18
  ## Режим работы
15
19
  Аргумент: $ARGUMENTS
16
20
 
21
+ ### Детекция флага --ai-factory
22
+ ```
23
+ AI_FACTORY_MODE = "--ai-factory" присутствует в $ARGUMENTS
24
+ ```
25
+ Если `AI_FACTORY_MODE = true`:
26
+ 1. Прочитай `.claude/shards/phase-ai-factory.shard.md` — это governance shard для AI Factory режима.
27
+ 2. Прочитай `.claude/skills/ai-factory-mapper/SKILL.md` — загрузи скилл.
28
+ 3. Закешируй в working memory каталог AI Factory из `.claude/skills/ai-factory-mapper/references/catalog.md`.
29
+ 4. Сообщи пользователю: "Режим --ai-factory активирован. AI Factory маппинг будет интегрирован во все фазы."
30
+
17
31
  Если аргумент содержит текст кейса — начинай работу. Если аргумент пустой — спроси текст кейса, тайминг, домен.
18
32
 
19
33
  ## Инициализация
@@ -21,7 +35,7 @@
21
35
  1. Определи название кейса → `CASE_NAME`
22
36
  2. Создай рабочую директорию: `researches/CASE_NAME/`
23
37
  3. Определи тайминг (часов на кейс, по умолчанию 4)
24
- 4. Кратко объясни 7 фаз + ожидаемые артефакты
38
+ 4. Кратко объясни 7 фаз + ожидаемые артефакты (если `AI_FACTORY_MODE`, добавь AI Factory артефакты)
25
39
  5. Распредели время:
26
40
  - Phase 0: 15% | Phase 1: 5% | Phase 2: 15% | Phase 2.5: 10% ⭐ | Phase 3: 15% | Phase 4: 15% | Phase 5: 20% | Buffer: 5%
27
41
 
@@ -45,6 +59,12 @@ ARTIFACTS (researches/CASE_NAME/):
45
59
  [ ] diagrams/process-as-is.mermaid ← Phase 3
46
60
  [ ] diagrams/process-to-be.mermaid ← Phase 3
47
61
  [ ] README.md ← Phase 6
62
+
63
+ # Только при --ai-factory:
64
+ [ ] 02.6_ai_factory_mapping.md ← Phase 2 (--ai-factory)
65
+ [ ] diagrams/ai-factory-pipeline.mermaid ← Phase 4 (--ai-factory)
66
+ [ ] ai_factory_analysis.md ← Phase 5 (--ai-factory)
67
+ [ ] ai_factory_analysis.docx ← Phase 5 (--ai-factory, если Node.js доступен)
48
68
  ```
49
69
 
50
70
  ## Pipeline
@@ -65,6 +85,10 @@ INPUT → DISCOVERY → EXPLORE → RESEARCH → CJM PROTO → SOLVE → ARCHITE
65
85
  - Phase 4: Встроенные шаблоны архитектуры
66
86
  - Phase 5: `.claude/skills/presentation-storyteller/SKILL.md`
67
87
 
88
+ Если `AI_FACTORY_MODE = true`, дополнительно при инициализации (до Phase 0):
89
+ - `.claude/skills/ai-factory-mapper/SKILL.md`
90
+ - `.claude/skills/ai-factory-mapper/references/catalog.md` (закешировать в working memory)
91
+
68
92
  ## Стратегия параллелизации (Agent Swarm)
69
93
 
70
94
  Для ускорения используй Agent tool для параллельных задач:
@@ -93,14 +117,29 @@ INPUT → DISCOVERY → EXPLORE → RESEARCH → CJM PROTO → SOLVE → ARCHITE
93
117
  Последовательно выполняй фазы, в каждой:
94
118
  1. Прочитай соответствующий SKILL.md
95
119
  2. Выполни фазу, создай артефакт
96
- 3. Покажи Checkpoint
97
- 4. Дождись "ок" или корректировки от пользователя
98
- 5. Перейди к следующей фазе
120
+ 3. Если `AI_FACTORY_MODE = true` — выполни AI Factory шаг для данной фазы (см. `.claude/shards/phase-ai-factory.shard.md`)
121
+ 4. Покажи Checkpoint
122
+ 5. Дождись "ок" или корректировки от пользователя
123
+ 6. Перейди к следующей фазе
99
124
 
100
125
  ## Phase 0-6: Детали
101
126
 
102
127
  Детальные инструкции для каждой фазы находятся в CLAUDE.md проекта и в SKILL.md соответствующих скиллов. Следуй им строго.
103
128
 
129
+ ### AI Factory интеграция по фазам (только при --ai-factory)
130
+
131
+ | Фаза | Что добавляется |
132
+ |------|----------------|
133
+ | Phase 0 | Секция "AI Factory Applicability" в `00_product_discovery.md` |
134
+ | Phase 1 | 1 параграф AI Factory контекст в `01_case_brief.md`, установить `{AI_FACTORY_SCENARIO}` |
135
+ | Phase 2 | Запуск ai-factory-mapper фаз 1–3 → новый артефакт `02.6_ai_factory_mapping.md` |
136
+ | Phase 2.5 | Аннотация каждого шага CJM-вариантов AI Factory сервисом (из `02.6_ai_factory_mapping.md`) |
137
+ | Phase 3 | Запуск ai-factory-mapper фаз 4–5 → секция "AI Factory Coverage" в `03_solution_strategy.md` |
138
+ | Phase 4 | AI Factory сервисы в C4-диаграмме + новый артефакт `diagrams/ai-factory-pipeline.mermaid` |
139
+ | Phase 5 | Запуск ai-factory-mapper фазы 6 → `ai_factory_analysis.md` + слайд "AI Factory Coverage" |
140
+
141
+ Полные инструкции — в `.claude/shards/phase-ai-factory.shard.md`.
142
+
104
143
  ## Checkpoint формат
105
144
 
106
145
  После каждой фазы покажи:
@@ -161,3 +200,15 @@ researches/CASE_NAME/
161
200
  - Если банк: on-premise, ФЗ-152, ЦБ, GigaChat/YandexGPT
162
201
  - Если мало времени: Quick Mode
163
202
  - Все артефакты в директории `researches/CASE_NAME/`
203
+
204
+ ## AI Factory Rules (только при --ai-factory)
205
+
206
+ - `{AI_FACTORY_MODE}` устанавливается один раз при инициализации и не изменяется
207
+ - AI Factory шаги **аддитивны**: они расширяют существующие артефакты, не заменяют их
208
+ - Catalog sync (`web_search`) обязателен в Phase 2 — не пропускать
209
+ - Все шаги workflow должны быть разбиты на 7–12 (правило ai-factory-mapper)
210
+ - Каждый шаг должен иметь явное ✅ / ⚠️ / ❌ без "скорее всего"
211
+ - Coverage % округляется до 5%
212
+ - `02.6_ai_factory_mapping.md` должен быть готов до начала Phase 3
213
+ - AI Factory работа в Phase 2 может быть запущена **параллельно** с основными research-агентами
214
+ - Без `--ai-factory` ни один из этих шагов не выполняется и ни один файл не создаётся
@@ -3,6 +3,8 @@
3
3
  ## Использование
4
4
  ```
5
5
  /feature-adr [описание фичи или путь к issue]
6
+ /feature-adr --full-qe [описание фичи] # Direct Mode: полные протоколы agentic-qe
7
+ /feature-adr --full-qe-extended [описание фичи] # Direct Extended: полные протоколы + доп. скиллы
6
8
  ```
7
9
 
8
10
  ## Аргумент
@@ -16,6 +18,12 @@ $ARGUMENTS
16
18
  3. **Step 0 — Complexity Router:**
17
19
  - Прочитай `modules/00-complexity-router.md` и `references/complexity-matrix.md`
18
20
  - Классифицируй фичу в S/M/L/XL
21
+ - **Проверь agentic-qe флаги:**
22
+ - `--full-qe` → проверь `which aqe` или `node_modules/agentic-qe/`.
23
+ Если найден → `{AGENTIC_QE_MODE}=direct`. Если нет → WARN, fallback to reference.
24
+ - `--full-qe-extended` → то же + `{AGENTIC_QE_MODE}=direct-extended`.
25
+ Активирует доп. скиллы (chaos, security, performance, mutation, TDD, production-swarm).
26
+ - Без флагов → `{AGENTIC_QE_MODE}=reference` (condensed копии, без установки).
19
27
  - Определи `{ACTIVE_STEPS}` и `{TIME_BUDGET}`
20
28
  - Покажи Checkpoint 0 и **жди подтверждения tier**
21
29