@dzhechkov/keysarium 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/package.json +10 -2
- package/templates/.claude/commands/brain-export.md +97 -20
- package/templates/.claude/commands/brain-import.md +75 -4
- package/templates/.claude/commands/dream.md +101 -0
- package/templates/.claude/commands/feature-adr.md +92 -0
- package/templates/.claude/commands/init-platform.md +161 -0
- package/templates/.claude/commands/learning-stats.md +130 -0
- package/templates/.claude/commands/workers.md +140 -0
- package/templates/.claude/rules/background-workers.md +72 -0
- package/templates/.claude/rules/dream-cycles.md +90 -0
- package/templates/.claude/rules/feature-adr-conventions.md +82 -0
- package/templates/.claude/rules/reward-learning.md +124 -0
- package/templates/.claude/shards/feature-adr.shard.md +98 -0
- package/templates/.claude/skills/feature-adr/SKILL.md +252 -0
- package/templates/.claude/skills/feature-adr/examples/sample-feature-output.md +257 -0
- package/templates/.claude/skills/feature-adr/modules/00-complexity-router.md +114 -0
- package/templates/.claude/skills/feature-adr/modules/01-requirements.md +113 -0
- package/templates/.claude/skills/feature-adr/modules/02-research.md +92 -0
- package/templates/.claude/skills/feature-adr/modules/03-adr.md +135 -0
- package/templates/.claude/skills/feature-adr/modules/04-ddd.md +114 -0
- package/templates/.claude/skills/feature-adr/modules/05-architecture.md +149 -0
- package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +129 -0
- package/templates/.claude/skills/feature-adr/modules/07-code.md +126 -0
- package/templates/.claude/skills/feature-adr/modules/08-qe.md +167 -0
- package/templates/.claude/skills/feature-adr/references/adr-template.md +102 -0
- package/templates/.claude/skills/feature-adr/references/c4-template.md +120 -0
- package/templates/.claude/skills/feature-adr/references/complexity-matrix.md +139 -0
- package/templates/.claude/skills/feature-adr/references/qe-checklist.md +86 -0
- package/templates/CLAUDE.md +135 -8
- package/templates/docs/feature-adr/01-architecture.md +750 -0
- package/templates/docs/feature-adr/02-functionality.md +712 -0
- package/templates/docs/feature-adr/03-deployment-guide.md +614 -0
- package/templates/docs/feature-adr/04-admin-guide.md +564 -0
- package/templates/docs/feature-adr/05-user-guide.md +508 -0
- package/templates/docs/feature-adr/06-user-flows.md +1101 -0
- package/templates/docs/improvement-directions.md +16 -16
- package/templates/docs/keysarium/01-deployment-guide.md +21 -12
- package/templates/docs/keysarium/02-admin-guide.md +204 -3
- package/templates/docs/keysarium/03-user-guide.md +224 -0
- package/templates/docs/keysarium/05-architecture.md +181 -0
- package/templates/docs/keysarium/06-user-flows.md +235 -0
- package/templates/docs/keysarium-core/01-architecture.md +559 -0
- package/templates/docs/keysarium-core/02-functionality.md +953 -0
- package/templates/docs/keysarium-core/03-deployment-guide.md +625 -0
- package/templates/docs/keysarium-core/04-admin-guide.md +529 -0
- package/templates/docs/keysarium-core/05-user-guide.md +599 -0
- package/templates/docs/keysarium-core/06-user-flows.md +804 -0
- package/templates/lib/background-workers.md +278 -0
- package/templates/lib/dream-engine.md +460 -0
- package/templates/lib/judge-attestation.md +322 -0
- package/templates/lib/memory-protocol.md +344 -0
- package/templates/lib/platform-adapters.md +100 -0
- package/templates/lib/platform-templates/copilot.md +134 -0
- package/templates/lib/platform-templates/cursor.md +95 -0
- package/templates/lib/platform-templates/opencode.md +155 -0
- package/templates/lib/reward-tracker.md +256 -0
- package/templates/lib/witness-chain.md +372 -0
- package/templates/lib/worker-templates/brain-export.md +187 -0
- package/templates/lib/worker-templates/consolidate.md +180 -0
- package/templates/lib/worker-templates/dream-cycle.md +154 -0
- package/templates/lib/worker-templates/health-check.md +255 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# ADR Template
|
|
2
|
+
|
|
3
|
+
Use this template for every Architecture Decision Record.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# ADR-{NNN}: {Short Title of Decision}
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
{Proposed | Accepted | Deprecated | Superseded by ADR-{M}}
|
|
13
|
+
|
|
14
|
+
## Date
|
|
15
|
+
|
|
16
|
+
{YYYY-MM-DD}
|
|
17
|
+
|
|
18
|
+
## Context
|
|
19
|
+
|
|
20
|
+
{What is the issue that we're seeing that is motivating this decision or change?
|
|
21
|
+
Describe the forces at play — technical, business, political, social.
|
|
22
|
+
Describe the problem space, not the solution.}
|
|
23
|
+
|
|
24
|
+
## Decision Drivers
|
|
25
|
+
|
|
26
|
+
- {driver 1: e.g., "Team has no experience with technology X"}
|
|
27
|
+
- {driver 2: e.g., "Feature requires sub-100ms latency"}
|
|
28
|
+
- {driver 3: e.g., "Must integrate with existing auth system"}
|
|
29
|
+
|
|
30
|
+
## Considered Options
|
|
31
|
+
|
|
32
|
+
### Option 1: {Name}
|
|
33
|
+
|
|
34
|
+
{1-2 paragraph description of this option}
|
|
35
|
+
|
|
36
|
+
- ✅ {Pro 1}
|
|
37
|
+
- ✅ {Pro 2}
|
|
38
|
+
- ❌ {Con 1}
|
|
39
|
+
- ❌ {Con 2}
|
|
40
|
+
|
|
41
|
+
### Option 2: {Name}
|
|
42
|
+
|
|
43
|
+
{1-2 paragraph description}
|
|
44
|
+
|
|
45
|
+
- ✅ {Pro 1}
|
|
46
|
+
- ❌ {Con 1}
|
|
47
|
+
|
|
48
|
+
### Option 3: {Name} (optional)
|
|
49
|
+
|
|
50
|
+
{1-2 paragraph description}
|
|
51
|
+
|
|
52
|
+
- ✅ {Pro 1}
|
|
53
|
+
- ❌ {Con 1}
|
|
54
|
+
|
|
55
|
+
## Decision Matrix
|
|
56
|
+
|
|
57
|
+
| Criterion | Weight | Option 1 | Option 2 | Option 3 |
|
|
58
|
+
|-----------|--------|----------|----------|----------|
|
|
59
|
+
| {Criterion 1} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
60
|
+
| {Criterion 2} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
61
|
+
| {Criterion 3} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
62
|
+
| **Weighted Total** | | **{sum}** | **{sum}** | **{sum}** |
|
|
63
|
+
|
|
64
|
+
## Decision
|
|
65
|
+
|
|
66
|
+
We chose **{Option N}** because {1-2 sentence rationale linking back to decision drivers}.
|
|
67
|
+
|
|
68
|
+
## Consequences
|
|
69
|
+
|
|
70
|
+
### Positive
|
|
71
|
+
- {Positive consequence 1}
|
|
72
|
+
- {Positive consequence 2}
|
|
73
|
+
|
|
74
|
+
### Negative
|
|
75
|
+
- {Negative consequence 1 — with mitigation strategy}
|
|
76
|
+
|
|
77
|
+
### Risks
|
|
78
|
+
- {Risk 1} — Mitigation: {how to mitigate}
|
|
79
|
+
- {Risk 2} — Mitigation: {how to mitigate}
|
|
80
|
+
|
|
81
|
+
## Links
|
|
82
|
+
|
|
83
|
+
- Requirement: FR-{N}
|
|
84
|
+
- Related: ADR-{M} (if any)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## ADR Numbering
|
|
90
|
+
|
|
91
|
+
- Start from 001 for each feature
|
|
92
|
+
- Use kebab-case slugs: `001-choose-database-engine.md`
|
|
93
|
+
- Keep sequential within a feature, no gaps
|
|
94
|
+
|
|
95
|
+
## ADR Quality Checklist
|
|
96
|
+
|
|
97
|
+
- [ ] At least 2 options considered
|
|
98
|
+
- [ ] Every option has both pros and cons
|
|
99
|
+
- [ ] Decision matrix used for non-trivial decisions
|
|
100
|
+
- [ ] Consequences include both positive AND negative
|
|
101
|
+
- [ ] Risks have mitigation strategies
|
|
102
|
+
- [ ] Links to requirements present
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# C4 Diagram Templates
|
|
2
|
+
|
|
3
|
+
Reference templates for C4 architecture diagrams in Mermaid format.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Level 1: System Context
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TB
|
|
11
|
+
%% Actors
|
|
12
|
+
User["👤 User<br/><i>Description of user</i>"]
|
|
13
|
+
Admin["👤 Admin<br/><i>Description of admin</i>"]
|
|
14
|
+
|
|
15
|
+
%% System
|
|
16
|
+
System["🖥️ Our System<br/><i>What it does</i>"]
|
|
17
|
+
|
|
18
|
+
%% External Systems
|
|
19
|
+
ExtAuth["🔐 Auth Provider<br/><i>OAuth 2.0</i>"]
|
|
20
|
+
ExtPay["💳 Payment Gateway<br/><i>Stripe/etc</i>"]
|
|
21
|
+
ExtEmail["📧 Email Service<br/><i>SendGrid/etc</i>"]
|
|
22
|
+
|
|
23
|
+
%% Relationships
|
|
24
|
+
User -->|"Uses"| System
|
|
25
|
+
Admin -->|"Manages"| System
|
|
26
|
+
System -->|"Authenticates via"| ExtAuth
|
|
27
|
+
System -->|"Processes payments via"| ExtPay
|
|
28
|
+
System -->|"Sends emails via"| ExtEmail
|
|
29
|
+
|
|
30
|
+
%% Styling
|
|
31
|
+
classDef system fill:#1168bd,stroke:#0b4884,color:#fff
|
|
32
|
+
classDef external fill:#999,stroke:#666,color:#fff
|
|
33
|
+
classDef person fill:#08427b,stroke:#052e56,color:#fff
|
|
34
|
+
class System system
|
|
35
|
+
class ExtAuth,ExtPay,ExtEmail external
|
|
36
|
+
class User,Admin person
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Level 2: Container
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
graph TB
|
|
43
|
+
subgraph boundary ["System Boundary"]
|
|
44
|
+
WebApp["🌐 Web Application<br/><i>React / Next.js</i>"]
|
|
45
|
+
API["⚙️ API Server<br/><i>Node.js / Express</i>"]
|
|
46
|
+
Worker["🔄 Background Worker<br/><i>Bull / Agenda</i>"]
|
|
47
|
+
DB[("💾 Database<br/><i>PostgreSQL</i>")]
|
|
48
|
+
Cache[("⚡ Cache<br/><i>Redis</i>")]
|
|
49
|
+
Queue["📬 Message Queue<br/><i>Redis / RabbitMQ</i>"]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
User["👤 User"] -->|"HTTPS"| WebApp
|
|
53
|
+
WebApp -->|"REST/GraphQL"| API
|
|
54
|
+
API -->|"SQL"| DB
|
|
55
|
+
API -->|"Read/Write"| Cache
|
|
56
|
+
API -->|"Publish"| Queue
|
|
57
|
+
Queue -->|"Consume"| Worker
|
|
58
|
+
Worker -->|"SQL"| DB
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Level 3: Component
|
|
62
|
+
|
|
63
|
+
```mermaid
|
|
64
|
+
graph TB
|
|
65
|
+
subgraph container ["API Server"]
|
|
66
|
+
Router["🔀 Router<br/><i>Express Router</i>"]
|
|
67
|
+
AuthMW["🔐 Auth Middleware<br/><i>JWT validation</i>"]
|
|
68
|
+
Controller["📋 Controller<br/><i>Request handling</i>"]
|
|
69
|
+
Validator["✅ Validator<br/><i>Input validation</i>"]
|
|
70
|
+
Service["⚙️ Service<br/><i>Business logic</i>"]
|
|
71
|
+
Repository["💾 Repository<br/><i>Data access</i>"]
|
|
72
|
+
EventBus["📡 Event Bus<br/><i>Domain events</i>"]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
Router --> AuthMW
|
|
76
|
+
AuthMW --> Controller
|
|
77
|
+
Controller --> Validator
|
|
78
|
+
Controller --> Service
|
|
79
|
+
Service --> Repository
|
|
80
|
+
Service --> EventBus
|
|
81
|
+
Repository --> DB[("Database")]
|
|
82
|
+
EventBus --> Queue["Message Queue"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Sequence Diagram Template
|
|
86
|
+
|
|
87
|
+
```mermaid
|
|
88
|
+
sequenceDiagram
|
|
89
|
+
actor User
|
|
90
|
+
participant FE as Frontend
|
|
91
|
+
participant API as API Server
|
|
92
|
+
participant Auth as Auth Service
|
|
93
|
+
participant DB as Database
|
|
94
|
+
participant Queue as Message Queue
|
|
95
|
+
|
|
96
|
+
User->>FE: Action
|
|
97
|
+
FE->>API: POST /api/resource
|
|
98
|
+
API->>Auth: Validate token
|
|
99
|
+
Auth-->>API: Valid
|
|
100
|
+
|
|
101
|
+
API->>API: Validate input
|
|
102
|
+
API->>DB: INSERT INTO resource
|
|
103
|
+
DB-->>API: Created
|
|
104
|
+
|
|
105
|
+
API->>Queue: Publish event
|
|
106
|
+
API-->>FE: 201 Created
|
|
107
|
+
FE-->>User: Success feedback
|
|
108
|
+
|
|
109
|
+
Note over Queue: Async processing
|
|
110
|
+
Queue->>Worker: Process event
|
|
111
|
+
Worker->>DB: UPDATE status
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Tips
|
|
115
|
+
|
|
116
|
+
1. **Keep diagrams focused** — one concept per diagram
|
|
117
|
+
2. **Use consistent naming** — match code namespaces
|
|
118
|
+
3. **Show data flow direction** — arrows point from caller to callee
|
|
119
|
+
4. **Label relationships** — what protocol/format
|
|
120
|
+
5. **Highlight the new** — mark new components vs existing
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Complexity Matrix — Feature Classification Reference
|
|
2
|
+
|
|
3
|
+
## Dimension Scoring Guide
|
|
4
|
+
|
|
5
|
+
### 1. Files Affected
|
|
6
|
+
|
|
7
|
+
| Score | Range | Examples |
|
|
8
|
+
|-------|-------|---------|
|
|
9
|
+
| 1 (S) | 1-3 files | Fix typo, update config, add util function |
|
|
10
|
+
| 2 (M) | 4-10 files | New endpoint + tests + migration + handler |
|
|
11
|
+
| 3 (L) | 11-30 files | New module with models, services, controllers, tests |
|
|
12
|
+
| 4 (XL) | 30+ files | Framework migration, new subsystem |
|
|
13
|
+
|
|
14
|
+
**How to estimate:** Count modified + new + deleted files. Include tests.
|
|
15
|
+
|
|
16
|
+
### 2. Domains Touched
|
|
17
|
+
|
|
18
|
+
| Score | Range | Examples |
|
|
19
|
+
|-------|-------|---------|
|
|
20
|
+
| 1 (S) | 1 domain | Change within a single bounded context |
|
|
21
|
+
| 2 (M) | 1-2 domains | Feature spanning API + database |
|
|
22
|
+
| 3 (L) | 2-4 domains | Feature touching auth + billing + notifications |
|
|
23
|
+
| 4 (XL) | 4+ domains | Cross-cutting concern affecting all domains |
|
|
24
|
+
|
|
25
|
+
**How to identify domains:** Bounded contexts, microservices, top-level modules.
|
|
26
|
+
|
|
27
|
+
### 3. New Integrations
|
|
28
|
+
|
|
29
|
+
| Score | Range | Examples |
|
|
30
|
+
|-------|-------|---------|
|
|
31
|
+
| 1 (S) | 0 | No new external dependencies |
|
|
32
|
+
| 2 (M) | 0-1 | Adding a new npm package, calling a new API |
|
|
33
|
+
| 3 (L) | 1-3 | New database, message queue, 3rd-party service |
|
|
34
|
+
| 4 (XL) | 3+ | Multiple new infrastructure components |
|
|
35
|
+
|
|
36
|
+
### 4. Breaking Changes
|
|
37
|
+
|
|
38
|
+
| Score | Range | Examples |
|
|
39
|
+
|-------|-------|---------|
|
|
40
|
+
| 1 (S) | 0 | Fully backward compatible |
|
|
41
|
+
| 2 (M) | 0 | Backward compatible but behavior changes |
|
|
42
|
+
| 3 (L) | 0-2 | API version bump, schema migration with downtime |
|
|
43
|
+
| 4 (XL) | 2+ | Major API redesign, data model overhaul |
|
|
44
|
+
|
|
45
|
+
### 5. New Data Models
|
|
46
|
+
|
|
47
|
+
| Score | Range | Examples |
|
|
48
|
+
|-------|-------|---------|
|
|
49
|
+
| 1 (S) | 0 | No schema changes |
|
|
50
|
+
| 2 (M) | 0-1 | Add field to existing model, new simple entity |
|
|
51
|
+
| 3 (L) | 1-3 | New aggregate root, new relationship graph |
|
|
52
|
+
| 4 (XL) | 3+ | New bounded context with full entity graph |
|
|
53
|
+
|
|
54
|
+
### 6. Cross-Cutting Concerns
|
|
55
|
+
|
|
56
|
+
| Score | Range | Concerns |
|
|
57
|
+
|-------|-------|----------|
|
|
58
|
+
| 1 (S) | 0 | None |
|
|
59
|
+
| 2 (M) | 0-1 | Logging OR error handling |
|
|
60
|
+
| 3 (L) | 1-2 | Auth + caching, i18n + validation |
|
|
61
|
+
| 4 (XL) | 3+ | Auth + logging + caching + monitoring + i18n |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Step Activation by Tier
|
|
66
|
+
|
|
67
|
+
### Tier S (Score 6-8)
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Active: 0 → 1(light) → 6(inline) → 7 → 8(smoke)
|
|
71
|
+
Skipped: 2, 3, 4, 5
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Step adaptations:**
|
|
75
|
+
- Step 1: 3-5 bullet requirements, no formal document
|
|
76
|
+
- Step 6: Inline in conversation, no separate file
|
|
77
|
+
- Step 8: Smoke tests only — does it compile? Do existing tests pass?
|
|
78
|
+
|
|
79
|
+
### Tier M (Score 9-13)
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Active: 0 → 1 → 3(1 ADR) → 5(light) → 6 → 7 → 8
|
|
83
|
+
Skipped: 2, 4
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Step adaptations:**
|
|
87
|
+
- Step 3: Single ADR for the main architectural decision
|
|
88
|
+
- Step 5: Component diagram only, no full C4
|
|
89
|
+
|
|
90
|
+
### Tier L (Score 14-19)
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Active: 0 → 1 → [2 ‖ 3] → [4 ‖ 5] → 6 → 7 → 8
|
|
94
|
+
Parallel groups: (2,3) and (4,5)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Step adaptations:**
|
|
98
|
+
- Step 2: Research analogues in codebase and external patterns
|
|
99
|
+
- Step 3: Multiple ADRs for each significant decision
|
|
100
|
+
- Step 4: Bounded contexts + ubiquitous language
|
|
101
|
+
- Step 5: Full C4 (Context + Container + Component)
|
|
102
|
+
- Step 8: Unit + integration tests + code review
|
|
103
|
+
|
|
104
|
+
### Tier XL (Score 20-24)
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Active: 0 → 1 → [2 ‖ 3] → [4 ‖ 5] → 6 → 7(parallel) → 8(full)
|
|
108
|
+
Parallel groups: (2,3), (4,5), (7 per module)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Step adaptations:**
|
|
112
|
+
- All steps at full depth
|
|
113
|
+
- Step 7: Multiple parallel agents, one per module/domain
|
|
114
|
+
- Step 8: Full QE — unit + integration + e2e + performance + security review
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Quick Reference Decision Tree
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Is it a bug fix or config change?
|
|
122
|
+
→ YES → S
|
|
123
|
+
|
|
124
|
+
Does it add a new feature with new files?
|
|
125
|
+
→ YES, < 10 files → M
|
|
126
|
+
→ YES, 10-30 files → L
|
|
127
|
+
→ YES, 30+ files → XL
|
|
128
|
+
|
|
129
|
+
Does it touch multiple domains?
|
|
130
|
+
→ NO → max M
|
|
131
|
+
→ 2-4 → min L
|
|
132
|
+
→ 4+ → XL
|
|
133
|
+
|
|
134
|
+
Does it have breaking changes?
|
|
135
|
+
→ YES → min M, likely L/XL
|
|
136
|
+
|
|
137
|
+
Does it require new infrastructure?
|
|
138
|
+
→ YES → min L
|
|
139
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# QE Checklist
|
|
2
|
+
|
|
3
|
+
Unified quality engineering checklist adapted from shift-left testing and brutal-honesty review patterns.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Pre-Implementation (Shift-Left)
|
|
8
|
+
|
|
9
|
+
Before writing code, verify:
|
|
10
|
+
|
|
11
|
+
- [ ] Requirements have testable acceptance criteria
|
|
12
|
+
- [ ] Edge cases identified in requirements phase
|
|
13
|
+
- [ ] Data model validated against expected queries
|
|
14
|
+
- [ ] API contract defined before implementation
|
|
15
|
+
- [ ] Error scenarios documented
|
|
16
|
+
|
|
17
|
+
## During Implementation
|
|
18
|
+
|
|
19
|
+
While coding, continuously check:
|
|
20
|
+
|
|
21
|
+
- [ ] Each function has a clear single responsibility
|
|
22
|
+
- [ ] Error paths return meaningful messages
|
|
23
|
+
- [ ] Input validation at system boundaries
|
|
24
|
+
- [ ] No hardcoded secrets, URLs, or environment-specific values
|
|
25
|
+
- [ ] Logging at appropriate levels (debug/info/warn/error)
|
|
26
|
+
|
|
27
|
+
## Post-Implementation
|
|
28
|
+
|
|
29
|
+
### Correctness Checks
|
|
30
|
+
- [ ] All acceptance criteria have corresponding tests
|
|
31
|
+
- [ ] Happy path tested end-to-end
|
|
32
|
+
- [ ] Edge cases tested (null, empty, max, min, boundary)
|
|
33
|
+
- [ ] Error paths tested (invalid input, network failure, timeout)
|
|
34
|
+
- [ ] Concurrent access tested (if applicable)
|
|
35
|
+
|
|
36
|
+
### Security Checks (OWASP-aligned)
|
|
37
|
+
- [ ] No SQL/NoSQL injection vectors
|
|
38
|
+
- [ ] No XSS vectors in output
|
|
39
|
+
- [ ] Authentication required on all protected endpoints
|
|
40
|
+
- [ ] Authorization checked (not just authentication)
|
|
41
|
+
- [ ] Sensitive data not logged or exposed in errors
|
|
42
|
+
- [ ] CSRF protection on state-changing operations
|
|
43
|
+
- [ ] Rate limiting on public endpoints
|
|
44
|
+
- [ ] Input size limits enforced
|
|
45
|
+
|
|
46
|
+
### Performance Checks
|
|
47
|
+
- [ ] No N+1 query patterns
|
|
48
|
+
- [ ] Database queries use appropriate indexes
|
|
49
|
+
- [ ] Large result sets are paginated
|
|
50
|
+
- [ ] Expensive operations are async/cached where appropriate
|
|
51
|
+
- [ ] No unnecessary memory allocations in hot paths
|
|
52
|
+
- [ ] Connection pools sized appropriately
|
|
53
|
+
|
|
54
|
+
### Maintainability Checks
|
|
55
|
+
- [ ] Code follows existing project conventions
|
|
56
|
+
- [ ] Naming is consistent with codebase
|
|
57
|
+
- [ ] No dead code or commented-out blocks
|
|
58
|
+
- [ ] Complex logic has explanatory comments
|
|
59
|
+
- [ ] Public APIs have documentation
|
|
60
|
+
- [ ] No circular dependencies introduced
|
|
61
|
+
|
|
62
|
+
### Compatibility Checks
|
|
63
|
+
- [ ] Backward compatible with existing clients (or migration path documented)
|
|
64
|
+
- [ ] Database migration is reversible
|
|
65
|
+
- [ ] Feature flag available for gradual rollout (if applicable)
|
|
66
|
+
- [ ] Existing tests still pass
|
|
67
|
+
|
|
68
|
+
## Review Severity Guide
|
|
69
|
+
|
|
70
|
+
| Severity | Symbol | Meaning | Action |
|
|
71
|
+
|----------|--------|---------|--------|
|
|
72
|
+
| Blocker | 🔴 | Prevents merge | Must fix |
|
|
73
|
+
| Warning | 🟡 | Should fix | Fix before next release |
|
|
74
|
+
| Suggestion | 🔵 | Nice to have | Consider for future |
|
|
75
|
+
| Praise | 🟢 | Well done | No action needed |
|
|
76
|
+
|
|
77
|
+
## Tier-Specific Depth
|
|
78
|
+
|
|
79
|
+
| Check Category | S | M | L | XL |
|
|
80
|
+
|---------------|---|---|---|-----|
|
|
81
|
+
| Pre-implementation | - | Partial | Full | Full |
|
|
82
|
+
| Correctness | Smoke | Unit | Unit+Integ | Full |
|
|
83
|
+
| Security | - | Basic | Full | Full+Pentest |
|
|
84
|
+
| Performance | - | - | Basic | Full+Load |
|
|
85
|
+
| Maintainability | - | Basic | Full | Full |
|
|
86
|
+
| Compatibility | Smoke | Basic | Full | Full |
|
package/templates/CLAUDE.md
CHANGED
|
@@ -14,10 +14,26 @@
|
|
|
14
14
|
/brain-export [путь или "all"] — Экспорт знаний в portable JSON
|
|
15
15
|
/brain-import [путь к JSON] — Импорт знаний из другого проекта
|
|
16
16
|
|
|
17
|
+
/init-platform --platform <name> — Генерация конфигов для Cursor/OpenCode/Copilot
|
|
18
|
+
|
|
19
|
+
/workers start <type> — Запуск фонового воркера (consolidate, export-brain, health-check, dream-cycle)
|
|
20
|
+
/workers status — Статус активных воркеров
|
|
21
|
+
/workers stop <id> — Остановка воркера
|
|
22
|
+
/workers list — Список доступных типов воркеров
|
|
23
|
+
|
|
24
|
+
/dream run — Запуск dream cycle (анализ паттернов)
|
|
25
|
+
/dream insights — Показать последние инсайты
|
|
26
|
+
/dream status — Состояние триггеров dream cycle
|
|
27
|
+
/dream clear — Очистить старые инсайты (оставить 10)
|
|
28
|
+
|
|
29
|
+
/feature-adr [описание фичи] — Adaptive Feature Development (9 шагов, S/M/L/XL)
|
|
30
|
+
|
|
17
31
|
/bto [путь или описание] — Build-Test-Optimize полный цикл
|
|
18
32
|
/bto-build [описание] — Генерация нового скилла/команды
|
|
19
33
|
/bto-test [путь] — Мульти-агентная оценка артефакта
|
|
20
34
|
/bto-optimize [путь] — Эволюционная оптимизация промптов
|
|
35
|
+
|
|
36
|
+
/learning-stats [--domain X] [--phase N] — Reward learning аналитика
|
|
21
37
|
```
|
|
22
38
|
|
|
23
39
|
## Структура проекта
|
|
@@ -44,7 +60,12 @@ product-keysarium-2026/
|
|
|
44
60
|
│ │ ├── bto.md ← /bto — Build-Test-Optimize pipeline
|
|
45
61
|
│ │ ├── bto-build.md ← /bto-build — генерация артефактов
|
|
46
62
|
│ │ ├── bto-test.md ← /bto-test — мульти-агентная оценка
|
|
47
|
-
│ │
|
|
63
|
+
│ │ ├── bto-optimize.md ← /bto-optimize — оптимизация промптов
|
|
64
|
+
│ │ ├── feature-adr.md ← /feature-adr — adaptive feature development
|
|
65
|
+
│ │ ├── init-platform.md ← /init-platform — мульти-платформенная генерация
|
|
66
|
+
│ │ ├── learning-stats.md ← /learning-stats — reward learning аналитика
|
|
67
|
+
│ │ ├── workers.md ← /workers — управление фоновыми воркерами
|
|
68
|
+
│ │ └── dream.md ← /dream — dream cycles (анализ паттернов)
|
|
48
69
|
│ ├── shards/ ← Governance shards (per-phase rules)
|
|
49
70
|
│ │ ├── phase-0-discovery.shard.md
|
|
50
71
|
│ │ ├── phase-1-explore.shard.md
|
|
@@ -53,7 +74,8 @@ product-keysarium-2026/
|
|
|
53
74
|
│ │ ├── phase-3-solve.shard.md
|
|
54
75
|
│ │ ├── phase-4-architecture.shard.md
|
|
55
76
|
│ │ ├── phase-5-presentation.shard.md
|
|
56
|
-
│ │
|
|
77
|
+
│ │ ├── bto-evaluation.shard.md
|
|
78
|
+
│ │ └── feature-adr.shard.md
|
|
57
79
|
│ └── skills/ ← Навыки (building blocks)
|
|
58
80
|
│ ├── bto/ ← Build-Test-Optimize (мульти-агентная оценка)
|
|
59
81
|
│ ├── explore/ ← Адаптивная кларификация задач
|
|
@@ -61,7 +83,36 @@ product-keysarium-2026/
|
|
|
61
83
|
│ ├── goap-research-ed25519/ ← GOAP research + crypto verification
|
|
62
84
|
│ ├── presentation-storyteller/ ← Презентации со storytelling
|
|
63
85
|
│ ├── problem-solver-enhanced/ ← Решение проблем (TRIZ + Game Theory)
|
|
64
|
-
│
|
|
86
|
+
│ ├── reverse-engineering-unicorn/ ← Reverse engineering компаний
|
|
87
|
+
│ └── feature-adr/ ← Adaptive feature development (9 steps, S/M/L/XL)
|
|
88
|
+
├── lib/ ← Библиотечные модули
|
|
89
|
+
│ ├── background-workers.md ← Протокол фоновых воркеров
|
|
90
|
+
│ ├── memory-protocol.md ← Протокол memory_query / memory_store
|
|
91
|
+
│ ├── reward-tracker.md ← Аналитика и обнаружение паттернов
|
|
92
|
+
│ ├── dream-engine.md ← DreamEngine: concept graph + insight generation
|
|
93
|
+
│ ├── platform-adapters.md ← Реестр платформенных адаптеров
|
|
94
|
+
│ ├── platform-templates/ ← Шаблоны для генерации конфигов
|
|
95
|
+
│ │ ├── cursor.md ← Cursor (.cursorrules)
|
|
96
|
+
│ │ ├── opencode.md ← OpenCode (.opencode/)
|
|
97
|
+
│ │ └── copilot.md ← GitHub Copilot (.github/copilot-instructions.md)
|
|
98
|
+
│ └── worker-templates/ ← Шаблоны инструкций для воркеров
|
|
99
|
+
│ ├── consolidate.md ← Консолидация паттернов
|
|
100
|
+
│ ├── health-check.md ← Проверка здоровья системы
|
|
101
|
+
│ ├── brain-export.md ← Фоновый экспорт brain
|
|
102
|
+
│ └── dream-cycle.md ← Dream cycle воркер (concept graph + insights)
|
|
103
|
+
├── packages/ ← npm пакеты
|
|
104
|
+
│ ├── dz-keysarium/ ← @dzhechkov/keysarium (research pipeline)
|
|
105
|
+
│ ├── dz-skills-bto/ ← @dzhechkov/skills-bto (BTO evaluation)
|
|
106
|
+
│ ├── dz-feature-adr/ ← @dzhechkov/skills-feature-adr (feature development)
|
|
107
|
+
│ └── dz-keysarium-core/ ← @dzhechkov/keysarium-core (shared framework)
|
|
108
|
+
│ ├── governance/ ← Constitution + shards + checkpoints
|
|
109
|
+
│ ├── memory/ ← Learning protocol + reward + dream engine
|
|
110
|
+
│ ├── orchestration/ ← Queen protocol + topologies + workers + routing
|
|
111
|
+
│ ├── verification/ ← Witness chain + judge attestation + audit trail
|
|
112
|
+
│ ├── trust-tiers/ ← 4-tier classification + promotion
|
|
113
|
+
│ └── platform/ ← Multi-platform adapters (Cursor, OpenCode, Copilot)
|
|
114
|
+
├── features/ ← Директории фич (/feature-adr output)
|
|
115
|
+
│ └── [feature-slug]/ ← Каждая фича изолирована
|
|
65
116
|
└── researches/ ← Директории исследований
|
|
66
117
|
└── [case-slug]/ ← Каждое исследование изолировано
|
|
67
118
|
```
|
|
@@ -138,15 +189,51 @@ DISCOVERY → EXPLORE → RESEARCH → CJM PROTO → SOLVE → ARCHITECTU
|
|
|
138
189
|
6 именованных loops формализуют передачу данных между фазами.
|
|
139
190
|
См. `.claude/rules/feedback-loops.md` для Variable Registry.
|
|
140
191
|
|
|
141
|
-
## Portable Brain
|
|
192
|
+
## Portable Brain (v1.1)
|
|
142
193
|
|
|
143
194
|
```
|
|
144
|
-
/brain-export [путь или "all"]
|
|
145
|
-
/brain-
|
|
195
|
+
/brain-export [путь или "all"] — Экспорт знаний в JSON контейнер (v1.1 с manifest)
|
|
196
|
+
/brain-export --delta <parent-brain.json> — Дельта-экспорт (COW, JSON Patch RFC 6902)
|
|
197
|
+
/brain-import [файл.json] — Импорт знаний из другого проекта
|
|
146
198
|
```
|
|
147
199
|
|
|
148
|
-
Brain container включает: skill metadata, domain patterns,
|
|
149
|
-
harvest patterns, pipeline metrics
|
|
200
|
+
Brain container v1.1 включает: SHA-256 manifest с checksum, skill metadata, domain patterns,
|
|
201
|
+
research summaries, harvest patterns, pipeline metrics, reward data.
|
|
202
|
+
Selective import с merge-not-overwrite стратегией. Backward compatible с v1.0.
|
|
203
|
+
|
|
204
|
+
**v1.1 features:** Integrity manifest, delta exports (COW branching), 2-tier memory index,
|
|
205
|
+
HOT/WARM/COLD/PURGE record lifecycle.
|
|
206
|
+
|
|
207
|
+
## keysarium-core — Shared Framework Package
|
|
208
|
+
|
|
209
|
+
`@dzhechkov/keysarium-core` — домен-агностичный фреймворк для multi-agent пайплайнов. Содержит протоколы, которые используются и в Keysarium, и в BTO, и могут быть использованы любой командой для создания собственного пайплайна.
|
|
210
|
+
|
|
211
|
+
### Архитектура 4 пакетов
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
@dzhechkov/keysarium-core ← Общий фреймворк
|
|
215
|
+
^ ^ ^
|
|
216
|
+
| | |
|
|
217
|
+
peerDep peerDep peerDep
|
|
218
|
+
| | |
|
|
219
|
+
@dzhechkov/keysarium skills-bto skills-feature-adr
|
|
220
|
+
(исследования) (оценка) (фичи)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Модули core
|
|
224
|
+
|
|
225
|
+
| Модуль | Файлы | Назначение |
|
|
226
|
+
|--------|-------|-----------|
|
|
227
|
+
| governance/ | 3 | Constitution, shard protocol, checkpoint/promise protocol |
|
|
228
|
+
| memory/ (v1.1) | 3 | memory_query/store, reward tracking, dream engine, **2-tier index, COW branching, record lifecycle** |
|
|
229
|
+
| orchestration/ | 4 | Queen protocol, 6 topologies, workers, model routing |
|
|
230
|
+
| verification/ | 3 | Witness chain, judge attestation, audit trail |
|
|
231
|
+
| trust-tiers/ | 2 | 4-tier classification, promotion protocol |
|
|
232
|
+
| platform/ | 4 | Adapter registry + templates (Cursor, OpenCode, Copilot) |
|
|
233
|
+
|
|
234
|
+
### Связь с существующими файлами
|
|
235
|
+
|
|
236
|
+
Core — это cleanroom-экстракция из `lib/` и `.claude/rules/`. Оригинальные файлы остаются как Keysarium-специфичные референсы. Core-версии обобщены и не содержат Keysarium-специфичной терминологии.
|
|
150
237
|
|
|
151
238
|
## Domain Templates
|
|
152
239
|
|
|
@@ -195,6 +282,13 @@ bto (Build-Test-Optimize)
|
|
|
195
282
|
├── modules/build.md (генерация артефактов)
|
|
196
283
|
├── modules/test.md (мульти-агентная оценка: 3 судьи)
|
|
197
284
|
└── modules/optimize.md (эволюционная оптимизация)
|
|
285
|
+
|
|
286
|
+
feature-adr (Adaptive Feature Development)
|
|
287
|
+
├── explore (кларификация требований)
|
|
288
|
+
├── problem-solver-enhanced (trade-off анализ для ADR)
|
|
289
|
+
├── frontend-design (UI реализация, если есть)
|
|
290
|
+
├── modules/00-08 (9 шагов pipeline)
|
|
291
|
+
└── references/ (ADR template, C4 template, QE checklist)
|
|
198
292
|
```
|
|
199
293
|
|
|
200
294
|
## BTO — Build-Test-Optimize
|
|
@@ -224,6 +318,39 @@ npx @dzhechkov/skills-bto init # Установить BTO в любой пр
|
|
|
224
318
|
npx @dzhechkov/skills-bto doctor # Проверить здоровье установки
|
|
225
319
|
```
|
|
226
320
|
|
|
321
|
+
## Feature ADR — Adaptive Feature Development
|
|
322
|
+
|
|
323
|
+
9-шаговый pipeline для разработки фич любой сложности с Complexity Router.
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
/feature-adr [описание фичи] — Полный адаптивный pipeline (9 шагов)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Complexity Tiers
|
|
330
|
+
|
|
331
|
+
| Tier | Scope | Active Steps |
|
|
332
|
+
|------|-------|-------------|
|
|
333
|
+
| **S** | 1-3 файла, 1 домен | 0→1→6→7→8 |
|
|
334
|
+
| **M** | 4-10 файлов, 1-2 домена | 0→1→3→5→6→7→8 |
|
|
335
|
+
| **L** | 11-30 файлов, 2-4 домена | Полный pipeline с параллелизмом |
|
|
336
|
+
| **XL** | 30+ файлов, cross-cutting | Полный DAG + multi-agent swarm |
|
|
337
|
+
|
|
338
|
+
### Pipeline шагов
|
|
339
|
+
|
|
340
|
+
| Step | Name | Tiers | Модель |
|
|
341
|
+
|------|------|-------|--------|
|
|
342
|
+
| 0 | Complexity Router | All | haiku |
|
|
343
|
+
| 1 | Requirements | All | sonnet |
|
|
344
|
+
| 2 | Research | L/XL | sonnet |
|
|
345
|
+
| 3 | ADR | M+ | opus |
|
|
346
|
+
| 4 | DDD | L/XL | opus |
|
|
347
|
+
| 5 | Architecture | M+ | opus |
|
|
348
|
+
| 6 | Implementation Plan | All | sonnet |
|
|
349
|
+
| 7 | Code | All | opus |
|
|
350
|
+
| 8 | QE | All | sonnet |
|
|
351
|
+
|
|
352
|
+
Артефакты: `features/<feature-slug>/` (не в корне, не в researches/)
|
|
353
|
+
|
|
227
354
|
## Anti-Patterns
|
|
228
355
|
|
|
229
356
|
| Anti-Pattern | Что делать |
|