@dzhechkov/keysarium 1.1.2 → 1.2.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 (47) hide show
  1. package/package.json +10 -2
  2. package/templates/.claude/commands/dream.md +101 -0
  3. package/templates/.claude/commands/feature-adr.md +92 -0
  4. package/templates/.claude/commands/init-platform.md +161 -0
  5. package/templates/.claude/commands/learning-stats.md +130 -0
  6. package/templates/.claude/commands/workers.md +140 -0
  7. package/templates/.claude/rules/background-workers.md +72 -0
  8. package/templates/.claude/rules/dream-cycles.md +90 -0
  9. package/templates/.claude/rules/feature-adr-conventions.md +82 -0
  10. package/templates/.claude/rules/reward-learning.md +124 -0
  11. package/templates/.claude/shards/feature-adr.shard.md +98 -0
  12. package/templates/.claude/skills/feature-adr/SKILL.md +252 -0
  13. package/templates/.claude/skills/feature-adr/examples/sample-feature-output.md +257 -0
  14. package/templates/.claude/skills/feature-adr/modules/00-complexity-router.md +114 -0
  15. package/templates/.claude/skills/feature-adr/modules/01-requirements.md +113 -0
  16. package/templates/.claude/skills/feature-adr/modules/02-research.md +92 -0
  17. package/templates/.claude/skills/feature-adr/modules/03-adr.md +135 -0
  18. package/templates/.claude/skills/feature-adr/modules/04-ddd.md +114 -0
  19. package/templates/.claude/skills/feature-adr/modules/05-architecture.md +149 -0
  20. package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +129 -0
  21. package/templates/.claude/skills/feature-adr/modules/07-code.md +126 -0
  22. package/templates/.claude/skills/feature-adr/modules/08-qe.md +167 -0
  23. package/templates/.claude/skills/feature-adr/references/adr-template.md +102 -0
  24. package/templates/.claude/skills/feature-adr/references/c4-template.md +120 -0
  25. package/templates/.claude/skills/feature-adr/references/complexity-matrix.md +139 -0
  26. package/templates/.claude/skills/feature-adr/references/qe-checklist.md +86 -0
  27. package/templates/CLAUDE.md +124 -3
  28. package/templates/docs/improvement-directions.md +16 -16
  29. package/templates/docs/keysarium/01-deployment-guide.md +21 -12
  30. package/templates/docs/keysarium/02-admin-guide.md +204 -3
  31. package/templates/docs/keysarium/03-user-guide.md +224 -0
  32. package/templates/docs/keysarium/05-architecture.md +181 -0
  33. package/templates/docs/keysarium/06-user-flows.md +235 -0
  34. package/templates/lib/background-workers.md +278 -0
  35. package/templates/lib/dream-engine.md +460 -0
  36. package/templates/lib/judge-attestation.md +322 -0
  37. package/templates/lib/memory-protocol.md +239 -0
  38. package/templates/lib/platform-adapters.md +100 -0
  39. package/templates/lib/platform-templates/copilot.md +134 -0
  40. package/templates/lib/platform-templates/cursor.md +95 -0
  41. package/templates/lib/platform-templates/opencode.md +155 -0
  42. package/templates/lib/reward-tracker.md +256 -0
  43. package/templates/lib/witness-chain.md +372 -0
  44. package/templates/lib/worker-templates/brain-export.md +187 -0
  45. package/templates/lib/worker-templates/consolidate.md +180 -0
  46. package/templates/lib/worker-templates/dream-cycle.md +154 -0
  47. package/templates/lib/worker-templates/health-check.md +255 -0
@@ -0,0 +1,113 @@
1
+ # Step 1: Requirements Gathering
2
+
3
+ > Transform vague feature description into structured, actionable requirements.
4
+
5
+ ## When
6
+
7
+ Always runs. Adapts depth by tier:
8
+ - **S:** 3-5 bullet points, inline (no file)
9
+ - **M/L/XL:** Full structured document
10
+
11
+ ## Model
12
+
13
+ sonnet (analytical work, not creative)
14
+
15
+ ## Input
16
+
17
+ - Feature description from user
18
+ - `{COMPLEXITY_TIER}` from Step 0
19
+ - Codebase context (project structure, existing patterns)
20
+
21
+ ## Protocol
22
+
23
+ ### 1. Load Explore Skill (M/L/XL only)
24
+
25
+ ```
26
+ Read: .claude/skills/explore/SKILL.md
27
+ ```
28
+
29
+ Use the explore skill to clarify ambiguous requirements through adaptive questioning.
30
+ For S-tier: skip explore, extract requirements directly from description.
31
+
32
+ ### 2. Identify Stakeholders
33
+
34
+ | Question | Why |
35
+ |----------|-----|
36
+ | Who is the end user? | Drives UX decisions |
37
+ | Who is the developer consumer? | Drives API design |
38
+ | Who approves delivery? | Defines done criteria |
39
+
40
+ ### 3. Extract Functional Requirements
41
+
42
+ For each requirement:
43
+ ```
44
+ FR-{N}: {Description}
45
+ Priority: MUST | SHOULD | COULD
46
+ Acceptance Criteria:
47
+ - Given [context], When [action], Then [outcome]
48
+ ```
49
+
50
+ ### 4. Extract Non-Functional Requirements (M+ only)
51
+
52
+ | Category | Questions |
53
+ |----------|-----------|
54
+ | Performance | Latency targets? Throughput? |
55
+ | Security | Auth? Data sensitivity? |
56
+ | Scalability | Expected load? Growth? |
57
+ | Compatibility | Browser/OS/API versions? |
58
+ | Accessibility | WCAG level? |
59
+
60
+ ### 5. Identify Constraints
61
+
62
+ - Technical: language, framework, existing patterns to follow
63
+ - Business: timeline, budget, compliance
64
+ - Organizational: team capabilities, review process
65
+
66
+ ### 6. Define Scope Boundaries
67
+
68
+ Explicitly state:
69
+ - **In scope:** What this feature DOES
70
+ - **Out of scope:** What this feature does NOT do (but someone might assume)
71
+ - **Dependencies:** What must exist before this feature works
72
+ - **Dependents:** What will break if this feature changes
73
+
74
+ ## Output
75
+
76
+ ### For S-tier (inline)
77
+ Set `{REQUIREMENTS}` variable with 3-5 bullets. No file created.
78
+
79
+ ### For M/L/XL
80
+ Create `features/<slug>/01_requirements.md` with:
81
+ - Stakeholders
82
+ - Functional requirements (FR-1..N) with acceptance criteria
83
+ - Non-functional requirements (L/XL)
84
+ - Constraints
85
+ - Scope boundaries
86
+ - Open questions (if any remain)
87
+
88
+ Set `{REQUIREMENTS}` variable with structured data.
89
+
90
+ ## Checkpoint 1 Format
91
+
92
+ ```
93
+ ═══════════════════════════════════════════════════════
94
+ ⏸️ STEP 1/8: Requirements Complete
95
+ <promise>FEATURE_ADR_REQUIREMENTS_GATHERED</promise>
96
+ Tier: {COMPLEXITY_TIER}
97
+
98
+ {N} functional requirements identified
99
+ {M} constraints, {K} open questions
100
+
101
+ • "ок" — proceed
102
+ • "добавь [requirement]" — add more
103
+ • "убери [requirement]" — remove
104
+ ═══════════════════════════════════════════════════════
105
+ ```
106
+
107
+ ## Quality Gates
108
+
109
+ - [ ] All requirements have acceptance criteria (M+)
110
+ - [ ] Scope boundaries explicitly defined
111
+ - [ ] No ambiguous terms ("fast", "good", "flexible") without quantification
112
+ - [ ] Dependencies identified
113
+ - [ ] User confirmed requirements before proceeding
@@ -0,0 +1,92 @@
1
+ # Step 2: Research — Analogues & Patterns
2
+
3
+ > Research existing patterns in codebase and external best practices before designing.
4
+
5
+ ## When
6
+
7
+ L/XL tiers only. Can run **in parallel** with Step 3 (ADR).
8
+
9
+ ## Model
10
+
11
+ sonnet (research synthesis)
12
+
13
+ ## Input
14
+
15
+ - `{REQUIREMENTS}` from Step 1
16
+ - `{COMPLEXITY_TIER}` from Step 0
17
+ - Codebase access
18
+
19
+ ## Protocol
20
+
21
+ ### 1. Codebase Pattern Research (Agent 1 — sonnet)
22
+
23
+ Search the current codebase for:
24
+
25
+ | What | How |
26
+ |------|-----|
27
+ | Similar features | Grep for related domain terms, find analogous implementations |
28
+ | Established patterns | How does existing code handle similar problems? |
29
+ | Shared utilities | What existing helpers, services, or abstractions can be reused? |
30
+ | Test patterns | How are similar features tested? |
31
+ | Data access patterns | How do similar features access data? |
32
+
33
+ Document each finding with file path + line reference.
34
+
35
+ ### 2. External Pattern Research (Agent 2 — sonnet)
36
+
37
+ Research external analogues:
38
+
39
+ | What | How |
40
+ |------|-----|
41
+ | Industry patterns | How do similar products solve this? |
42
+ | Framework conventions | What does the framework recommend? |
43
+ | Library options | Are there well-maintained libraries for this? |
44
+ | Anti-patterns | What are known pitfalls to avoid? |
45
+
46
+ Use `goap-research-ed25519` for verified research if the feature involves:
47
+ - Security-sensitive decisions
48
+ - Compliance requirements
49
+ - Performance-critical paths
50
+
51
+ ### 3. Synthesize Findings
52
+
53
+ Combine both research streams into:
54
+
55
+ ```
56
+ ## Pattern Summary
57
+ 1. Codebase has [N] similar implementations using [pattern]
58
+ 2. Framework recommends [approach] for this type of feature
59
+ 3. Key libraries considered: [list with trade-offs]
60
+ 4. Anti-patterns to avoid: [list]
61
+
62
+ ## Recommendation
63
+ Based on research, the recommended approach is [X] because [reasons].
64
+ Alternative considered: [Y], rejected because [reasons].
65
+ ```
66
+
67
+ ## Agent Swarm (2 parallel, sonnet)
68
+
69
+ | Agent | Task | Model |
70
+ |-------|------|-------|
71
+ | Agent 1 | Codebase pattern research | sonnet |
72
+ | Agent 2 | External analogues research | sonnet |
73
+
74
+ After both complete, synthesize results sequentially.
75
+
76
+ ## Output
77
+
78
+ Create `features/<slug>/02_research.md` with:
79
+ - Codebase patterns found (with file references)
80
+ - External patterns researched
81
+ - Library evaluation (if applicable)
82
+ - Anti-patterns identified
83
+ - Recommended approach
84
+
85
+ Set `{RESEARCH_FINDINGS}` variable.
86
+
87
+ ## Quality Gates
88
+
89
+ - [ ] At least 3 codebase patterns examined
90
+ - [ ] External patterns verified (not hallucinated)
91
+ - [ ] Trade-offs documented for each alternative
92
+ - [ ] Clear recommendation with rationale
@@ -0,0 +1,135 @@
1
+ # Step 3: Architecture Decision Records
2
+
3
+ > Document each significant architectural decision with context, alternatives, and rationale.
4
+
5
+ ## When
6
+
7
+ M+ tiers. Depth varies:
8
+ - **M:** 1 ADR for the main decision
9
+ - **L/XL:** N ADRs for each significant decision
10
+
11
+ Can run **in parallel** with Step 2 (Research) for L/XL tiers.
12
+
13
+ ## Model
14
+
15
+ opus (complex reasoning for trade-off analysis)
16
+
17
+ ## Input
18
+
19
+ - `{REQUIREMENTS}` from Step 1
20
+ - `{RESEARCH_FINDINGS}` from Step 2 (if available — may arrive later in parallel)
21
+ - Codebase context
22
+
23
+ ## Protocol
24
+
25
+ ### 1. Identify Decisions
26
+
27
+ Scan requirements for decision points:
28
+
29
+ | Signal | Example |
30
+ |--------|---------|
31
+ | Technology choice | "Which database/queue/framework?" |
32
+ | Pattern choice | "Repository vs. Active Record?" |
33
+ | Integration strategy | "REST vs. GraphQL vs. gRPC?" |
34
+ | Data modeling | "Normalized vs. denormalized?" |
35
+ | Deployment strategy | "Monolith vs. microservice?" |
36
+ | Trade-off | "Consistency vs. availability?" |
37
+
38
+ For M-tier: pick the SINGLE most impactful decision.
39
+ For L/XL: identify ALL decisions, prioritize by impact.
40
+
41
+ ### 2. Draft ADR per Decision
42
+
43
+ Use template from `references/adr-template.md`:
44
+
45
+ ```markdown
46
+ # ADR-{NNN}: {Title}
47
+
48
+ ## Status
49
+ Proposed | Accepted | Superseded by ADR-{M}
50
+
51
+ ## Context
52
+ What is the issue that we're seeing that is motivating this decision?
53
+
54
+ ## Decision Drivers
55
+ - {driver 1}
56
+ - {driver 2}
57
+
58
+ ## Considered Options
59
+ 1. {Option A} — {1-line summary}
60
+ 2. {Option B} — {1-line summary}
61
+ 3. {Option C} — {1-line summary}
62
+
63
+ ## Decision
64
+ We chose **{Option X}** because...
65
+
66
+ ## Consequences
67
+ ### Positive
68
+ - ...
69
+ ### Negative
70
+ - ...
71
+ ### Risks
72
+ - ...
73
+ ```
74
+
75
+ ### 3. Evaluate Alternatives
76
+
77
+ For each ADR, evaluate alternatives using a decision matrix:
78
+
79
+ | Criterion | Weight | Option A | Option B | Option C |
80
+ |-----------|--------|----------|----------|----------|
81
+ | Simplicity | 3 | ⭐⭐⭐ | ⭐⭐ | ⭐ |
82
+ | Performance | 2 | ⭐⭐ | ⭐⭐⭐ | ⭐⭐ |
83
+ | Maintainability | 3 | ⭐⭐ | ⭐⭐ | ⭐⭐⭐ |
84
+ | Team familiarity | 2 | ⭐⭐⭐ | ⭐ | ⭐⭐ |
85
+
86
+ If decision involves complex trade-offs, load `problem-solver-enhanced` for TRIZ analysis.
87
+
88
+ ### 4. Validate Against Requirements
89
+
90
+ Each ADR must trace back to specific requirements:
91
+ - Which FR-{N} does this decision support?
92
+ - Does the decision satisfy all relevant NFRs?
93
+ - Does the decision respect constraints?
94
+
95
+ ## Anti-Patterns
96
+
97
+ | Anti-Pattern | Detection | Fix |
98
+ |-------------|-----------|-----|
99
+ | Only one alternative | Less than 2 options considered | Require ≥2 alternatives |
100
+ | No consequences | Missing positive/negative analysis | BLOCK until filled |
101
+ | Decision without context | Why is unclear | Add context section |
102
+ | Premature optimization | Choosing complex option for hypothetical scale | Prefer simpler option |
103
+
104
+ ## Output
105
+
106
+ Create `features/<slug>/03_adr/` directory with:
107
+ - `001-{decision-slug}.md` for each ADR
108
+ - Each ADR follows the template
109
+
110
+ Set `{ADR_DECISIONS}` variable with list of decisions.
111
+
112
+ ## Checkpoint Format
113
+
114
+ ```
115
+ ═══════════════════════════════════════════════════════
116
+ ⏸️ STEP 3/8: ADR Complete
117
+ Tier: {COMPLEXITY_TIER}
118
+
119
+ {N} architectural decisions documented:
120
+ 1. ADR-001: {title} → chose {option}
121
+ 2. ADR-002: {title} → chose {option}
122
+
123
+ • "ок" — proceed
124
+ • "пересмотри ADR-{N}" — reconsider decision
125
+ • "добавь ADR для [topic]" — add new decision
126
+ ═══════════════════════════════════════════════════════
127
+ ```
128
+
129
+ ## Quality Gates
130
+
131
+ - [ ] Every ADR has ≥2 alternatives considered
132
+ - [ ] Every ADR has consequences (positive + negative)
133
+ - [ ] Every ADR traces to requirements
134
+ - [ ] Decision matrix used for non-trivial choices
135
+ - [ ] No premature optimization detected
@@ -0,0 +1,114 @@
1
+ # Step 4: Domain-Driven Design
2
+
3
+ > Model the domain to ensure code structure reflects business concepts.
4
+
5
+ ## When
6
+
7
+ L/XL tiers only. Can run **in parallel** with Step 5 (Architecture) if Step 3 is complete.
8
+
9
+ ## Model
10
+
11
+ opus (complex domain reasoning)
12
+
13
+ ## Input
14
+
15
+ - `{REQUIREMENTS}` from Step 1
16
+ - `{RESEARCH_FINDINGS}` from Step 2
17
+ - `{ADR_DECISIONS}` from Step 3
18
+ - Existing codebase domain structure
19
+
20
+ ## Protocol
21
+
22
+ ### 1. Identify Bounded Contexts
23
+
24
+ Analyze requirements for natural domain boundaries:
25
+
26
+ | Signal | Bounded Context |
27
+ |--------|----------------|
28
+ | Different stakeholders | Separate contexts |
29
+ | Different data lifecycles | Separate contexts |
30
+ | Different ubiquitous languages | Separate contexts |
31
+ | Shared data with different semantics | Separate contexts with shared kernel |
32
+
33
+ For **existing projects**: map new feature to existing bounded contexts first.
34
+ Only propose new contexts when the feature genuinely introduces a new domain.
35
+
36
+ ### 2. Define Ubiquitous Language
37
+
38
+ For each bounded context involved:
39
+
40
+ ```
41
+ ## Context: {Name}
42
+
43
+ | Term | Definition | NOT to be confused with |
44
+ |------|-----------|------------------------|
45
+ | {Term1} | {Precise definition} | {Common misuse} |
46
+ | {Term2} | {Precise definition} | {Common misuse} |
47
+ ```
48
+
49
+ Verify terms against:
50
+ - Existing codebase naming (Grep for conflicts)
51
+ - Requirement document terminology
52
+ - Stakeholder vocabulary
53
+
54
+ ### 3. Model Aggregates & Entities
55
+
56
+ ```
57
+ Aggregate: {Name}
58
+ ├── Root Entity: {Name}
59
+ │ ├── {field}: {type}
60
+ │ └── {field}: {type}
61
+ ├── Value Object: {Name}
62
+ │ └── {field}: {type}
63
+ └── Domain Event: {EventName}
64
+ └── {payload}
65
+ ```
66
+
67
+ Rules:
68
+ - Aggregates are consistency boundaries
69
+ - Entities have identity, Value Objects don't
70
+ - Domain Events signal state changes
71
+
72
+ ### 4. Map Relationships
73
+
74
+ ```mermaid
75
+ graph LR
76
+ A[Context A] -- Shared Kernel --> B[Context B]
77
+ A -- Upstream/Downstream --> C[Context C]
78
+ C -- Anti-Corruption Layer --> D[External System]
79
+ ```
80
+
81
+ Relationship types:
82
+ - **Shared Kernel:** Shared code/models between contexts
83
+ - **Customer-Supplier:** Upstream provides, downstream consumes
84
+ - **Conformist:** Downstream adopts upstream model as-is
85
+ - **Anti-Corruption Layer:** Translate between incompatible models
86
+ - **Open Host Service:** Public API for multiple consumers
87
+
88
+ ### 5. Validate Against Codebase
89
+
90
+ Check that proposed domain model is compatible with existing code:
91
+ - Do new entities conflict with existing names?
92
+ - Can aggregates be implemented with existing ORM/framework?
93
+ - Do relationships align with existing data access patterns?
94
+
95
+ ## Output
96
+
97
+ Create `features/<slug>/04_domain_model.md` with:
98
+ - Bounded context map
99
+ - Ubiquitous language glossary
100
+ - Aggregate/Entity/VO definitions
101
+ - Relationship diagram (Mermaid)
102
+ - Mapping to existing codebase structures
103
+
104
+ Create `features/<slug>/diagrams/domain-model.mermaid`
105
+
106
+ Set `{DOMAIN_MODEL}` variable.
107
+
108
+ ## Quality Gates
109
+
110
+ - [ ] All new terms defined in ubiquitous language
111
+ - [ ] No naming conflicts with existing codebase
112
+ - [ ] Aggregates have clear consistency boundaries
113
+ - [ ] Relationships between contexts are typed
114
+ - [ ] Domain model is implementable with current tech stack
@@ -0,0 +1,149 @@
1
+ # Step 5: Technical Architecture
2
+
3
+ > Design the technical architecture using C4 diagrams and sequence flows.
4
+
5
+ ## When
6
+
7
+ M+ tiers. Depth varies:
8
+ - **M:** Component diagram only (light)
9
+ - **L/XL:** Full C4 (Context + Container + Component) + sequence diagrams
10
+
11
+ ## Model
12
+
13
+ opus (system design)
14
+
15
+ ## Input
16
+
17
+ - `{REQUIREMENTS}` from Step 1
18
+ - `{ADR_DECISIONS}` from Step 3
19
+ - `{DOMAIN_MODEL}` from Step 4 (L/XL only)
20
+ - `{RESEARCH_FINDINGS}` from Step 2 (L/XL only)
21
+
22
+ ## Protocol
23
+
24
+ ### 1. C4 Level 1 — System Context (L/XL only)
25
+
26
+ Show the system in its environment:
27
+
28
+ ```mermaid
29
+ graph TB
30
+ User[User] --> System[Our System]
31
+ System --> ExtA[External System A]
32
+ System --> ExtB[External System B]
33
+ ```
34
+
35
+ Define:
36
+ - Who uses the system? (actors)
37
+ - What external systems does it interact with?
38
+ - What are the trust boundaries?
39
+
40
+ ### 2. C4 Level 2 — Container Diagram (L/XL only)
41
+
42
+ Show high-level technical building blocks:
43
+
44
+ ```mermaid
45
+ graph TB
46
+ subgraph System
47
+ WebApp[Web App<br/>React]
48
+ API[API Server<br/>Node.js]
49
+ DB[(Database<br/>PostgreSQL)]
50
+ Queue[Message Queue<br/>Redis]
51
+ end
52
+ WebApp --> API
53
+ API --> DB
54
+ API --> Queue
55
+ ```
56
+
57
+ ### 3. C4 Level 3 — Component Diagram (M/L/XL)
58
+
59
+ Show components within the container affected by this feature:
60
+
61
+ ```mermaid
62
+ graph TB
63
+ subgraph API
64
+ Controller[FeatureController]
65
+ Service[FeatureService]
66
+ Repository[FeatureRepository]
67
+ Validator[InputValidator]
68
+ end
69
+ Controller --> Validator
70
+ Controller --> Service
71
+ Service --> Repository
72
+ ```
73
+
74
+ For M-tier: this is the ONLY diagram required.
75
+
76
+ ### 4. Sequence Diagrams (L/XL)
77
+
78
+ For each main user flow, create a sequence diagram:
79
+
80
+ ```mermaid
81
+ sequenceDiagram
82
+ actor User
83
+ User->>Controller: POST /api/feature
84
+ Controller->>Validator: validate(input)
85
+ Validator-->>Controller: valid
86
+ Controller->>Service: createFeature(data)
87
+ Service->>Repository: save(entity)
88
+ Repository-->>Service: entity
89
+ Service-->>Controller: result
90
+ Controller-->>User: 201 Created
91
+ ```
92
+
93
+ Create at minimum:
94
+ - Happy path flow
95
+ - Main error flow
96
+ - Async flow (if applicable)
97
+
98
+ ### 5. Data Flow & Storage (L/XL)
99
+
100
+ Document:
101
+ - New tables/collections/schemas
102
+ - Migrations needed
103
+ - Data flow between components
104
+ - Caching strategy (if applicable)
105
+
106
+ ### 6. API Design (if applicable)
107
+
108
+ For features exposing APIs:
109
+
110
+ ```
111
+ POST /api/v1/{resource}
112
+ Request: { field1: type, field2: type }
113
+ Response: { id: string, ...fields }
114
+ Errors: 400, 401, 404, 422
115
+
116
+ GET /api/v1/{resource}/:id
117
+ Response: { ...full resource }
118
+ Errors: 401, 404
119
+ ```
120
+
121
+ ## Output
122
+
123
+ ### M-tier
124
+ Create `features/<slug>/05_architecture.md` with:
125
+ - Component diagram
126
+ - Brief API design (if applicable)
127
+
128
+ ### L/XL-tier
129
+ Create `features/<slug>/05_architecture.md` with:
130
+ - C4 diagrams (all 3 levels)
131
+ - Sequence diagrams
132
+ - Data model changes
133
+ - API design
134
+
135
+ Create `features/<slug>/diagrams/`:
136
+ - `architecture-c4.mermaid`
137
+ - `sequence-*.mermaid`
138
+
139
+ Set `{ARCHITECTURE}` variable.
140
+
141
+ ## Quality Gates
142
+
143
+ - [ ] Component diagram covers all new components
144
+ - [ ] Each component has clear responsibility
145
+ - [ ] ADR decisions are reflected in architecture
146
+ - [ ] Domain model (Step 4) maps to components (L/XL)
147
+ - [ ] Mermaid syntax is valid
148
+ - [ ] No circular dependencies between components
149
+ - [ ] API follows existing project conventions