@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
package/README.md
CHANGED
|
@@ -266,18 +266,23 @@ After completing research, extract reusable patterns:
|
|
|
266
266
|
|
|
267
267
|
The harvester reviews completed projects, identifies universal patterns, decontextualizes them, and updates `TOOLKIT_HARVEST.md`.
|
|
268
268
|
|
|
269
|
-
### Brain Portability
|
|
269
|
+
### Brain Portability (v1.1)
|
|
270
270
|
|
|
271
271
|
Export and import accumulated knowledge between projects:
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
|
-
# Export knowledge as a portable JSON container
|
|
274
|
+
# Export knowledge as a portable JSON container (v1.1 with manifest + checksum)
|
|
275
275
|
/brain-export
|
|
276
276
|
|
|
277
|
+
# Delta export — store only changes since last export (COW mode)
|
|
278
|
+
/brain-export --delta keysarium-brain-2026-03-01.json
|
|
279
|
+
|
|
277
280
|
# Import a brain container into another project
|
|
278
281
|
/brain-import path/to/brain.json
|
|
279
282
|
```
|
|
280
283
|
|
|
284
|
+
**v1.1 features:** SHA-256 integrity manifest, delta exports via JSON Patch (RFC 6902), 2-tier memory index, HOT/WARM/COLD/PURGE record lifecycle. Backward compatible with v1.0 brain files.
|
|
285
|
+
|
|
281
286
|
### Context Shards
|
|
282
287
|
|
|
283
288
|
Shards (`.claude/shards/`) are lightweight context fragments that phases load on demand. They keep the main CLAUDE.md lean while providing phase-specific instructions, semantic completion promises, and quality checklists.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/keysarium",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "AI Case Research Toolkit for Claude Code — full 7-phase pipeline
|
|
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",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"keysarium": "./bin/cli.js"
|
|
@@ -39,5 +39,13 @@
|
|
|
39
39
|
"homepage": "https://github.com/dzhechko/product-keysarium-2026#readme",
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/dzhechko/product-keysarium-2026/issues"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@dzhechkov/keysarium-core": "^1.1.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"@dzhechkov/keysarium-core": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Export accumulated knowledge as a portable brain container (JSON)"
|
|
3
|
-
argument: "optional path to specific research directory, or '
|
|
3
|
+
argument: "optional path to specific research directory, 'all' for everything, or '--delta <parent-file>' for COW export"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brain Export — Portable Knowledge Container
|
|
@@ -8,37 +8,61 @@ argument: "optional path to specific research directory, or 'all' for everything
|
|
|
8
8
|
Export accumulated knowledge, patterns, and evaluations into a portable JSON container
|
|
9
9
|
that can be imported into other projects.
|
|
10
10
|
|
|
11
|
+
Supports **full export** (default) and **delta export** (COW mode, v1.1).
|
|
12
|
+
|
|
11
13
|
## Protocol
|
|
12
14
|
|
|
13
|
-
### Step 1:
|
|
15
|
+
### Step 1: Parse Arguments & Detect Mode
|
|
16
|
+
|
|
17
|
+
1. If `$ARGUMENTS` contains `--delta <path>`:
|
|
18
|
+
- Set mode = `delta`
|
|
19
|
+
- Load parent brain file from `<path>`
|
|
20
|
+
- Verify parent is valid (`format` = `"keysarium-brain"`, has `manifest` or `version`)
|
|
21
|
+
- If parent has `manifest.checksum`, note it for verification
|
|
22
|
+
- Remaining arguments = export scope
|
|
23
|
+
2. Otherwise: set mode = `full`
|
|
24
|
+
3. If `$ARGUMENTS` specifies a path (not `--delta`), export only from that directory
|
|
25
|
+
4. If `$ARGUMENTS` is "all" or empty, export from all sources
|
|
26
|
+
|
|
27
|
+
### Step 2: Scan Knowledge Sources
|
|
14
28
|
|
|
15
29
|
Scan the following sources for exportable knowledge:
|
|
16
30
|
1. `TOOLKIT_HARVEST.md` — harvested patterns and learnings
|
|
17
31
|
2. `researches/*/` — all completed research directories
|
|
18
32
|
3. `.claude/skills/*/SKILL.md` — skill metadata and trust tiers
|
|
19
33
|
4. BTO evaluation reports (if any exist in researches)
|
|
34
|
+
5. `.keysarium/memory/` — reward data aggregates (if exists)
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
If `$ARGUMENTS` is "all" or empty, export from all sources.
|
|
36
|
+
### Step 3: Build Brain Container
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Construct a JSON structure:
|
|
38
|
+
Construct a JSON structure (v1.1 with manifest):
|
|
27
39
|
|
|
28
40
|
```json
|
|
29
41
|
{
|
|
30
|
-
"version": "1.
|
|
42
|
+
"version": "1.1",
|
|
31
43
|
"format": "keysarium-brain",
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
"manifest": {
|
|
45
|
+
"created_at": "[ISO 8601 timestamp]",
|
|
46
|
+
"source_project": "[project directory name]",
|
|
47
|
+
"source_branch": "[current git branch]",
|
|
48
|
+
"checksum": "sha256:[computed after content assembly]",
|
|
49
|
+
"record_count": "[total items across all sections]",
|
|
50
|
+
"domains": ["[list of domains found]"],
|
|
51
|
+
"skills": ["[list of skill names found]"],
|
|
52
|
+
"research_count": "[number of research summaries]",
|
|
53
|
+
"harvest_pattern_count": "[number of harvest patterns]",
|
|
54
|
+
"size_bytes": "[approximate payload size]",
|
|
55
|
+
"parent": null,
|
|
56
|
+
"parent_checksum": null,
|
|
57
|
+
"delta_type": null
|
|
58
|
+
},
|
|
35
59
|
|
|
36
60
|
"skills": {
|
|
37
61
|
"[skill-name]": {
|
|
38
|
-
"trust_tier": 0-3,
|
|
62
|
+
"trust_tier": "0-3",
|
|
39
63
|
"trust_tier_label": "Advisory|Structured|Validated|Verified",
|
|
40
|
-
"bto_score": null or float,
|
|
41
|
-
"last_evaluated": null or ISO date
|
|
64
|
+
"bto_score": "null or float",
|
|
65
|
+
"last_evaluated": "null or ISO date"
|
|
42
66
|
}
|
|
43
67
|
},
|
|
44
68
|
|
|
@@ -57,7 +81,7 @@ Construct a JSON structure:
|
|
|
57
81
|
"phases_completed": ["list of completed phases"],
|
|
58
82
|
"key_findings": ["top 3-5 findings"],
|
|
59
83
|
"chosen_cjm_variant": "A|B|C|D or null",
|
|
60
|
-
"presentation_score": null or float
|
|
84
|
+
"presentation_score": "null or float"
|
|
61
85
|
}
|
|
62
86
|
],
|
|
63
87
|
|
|
@@ -79,6 +103,14 @@ Construct a JSON structure:
|
|
|
79
103
|
"bto_evaluations_run": 0
|
|
80
104
|
},
|
|
81
105
|
|
|
106
|
+
"reward_data": {
|
|
107
|
+
"total_records": 0,
|
|
108
|
+
"domains": [],
|
|
109
|
+
"phase_averages": {},
|
|
110
|
+
"top_patterns": [],
|
|
111
|
+
"exported_from": ".keysarium/memory/"
|
|
112
|
+
},
|
|
113
|
+
|
|
82
114
|
"metadata": {
|
|
83
115
|
"export_scope": "all|[specific path]",
|
|
84
116
|
"files_scanned": 0,
|
|
@@ -87,23 +119,67 @@ Construct a JSON structure:
|
|
|
87
119
|
}
|
|
88
120
|
```
|
|
89
121
|
|
|
90
|
-
### Step
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
### Step 3a: Compute Manifest
|
|
123
|
+
|
|
124
|
+
After assembling all content sections:
|
|
125
|
+
|
|
126
|
+
1. Serialize all sections except `manifest` as JSON (sorted keys, compact)
|
|
127
|
+
2. Compute SHA-256 of the serialized string
|
|
128
|
+
3. Set `manifest.checksum` = `"sha256:{64-hex-chars}"`
|
|
129
|
+
4. Count total records: skills + research_summaries + harvest_patterns
|
|
130
|
+
5. Set `manifest.record_count`, `manifest.domains`, `manifest.skills`, `manifest.research_count`, `manifest.harvest_pattern_count`
|
|
131
|
+
6. Set `manifest.size_bytes` = byte length of serialized content
|
|
132
|
+
|
|
133
|
+
### Step 3b: Delta Mode (if mode = delta)
|
|
134
|
+
|
|
135
|
+
If exporting in delta mode:
|
|
136
|
+
|
|
137
|
+
1. Compare current full container with parent container section by section
|
|
138
|
+
2. Generate JSON Patch (RFC 6902) operations:
|
|
139
|
+
- `add` for new entries (new skills, new research summaries, new patterns)
|
|
140
|
+
- `replace` for changed values (updated trust tiers, new BTO scores)
|
|
141
|
+
- `remove` for deleted entries (rare)
|
|
142
|
+
3. If patch is empty → log "No changes since parent export" and stop
|
|
143
|
+
4. Build delta container:
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"version": "1.1",
|
|
147
|
+
"format": "keysarium-brain",
|
|
148
|
+
"manifest": {
|
|
149
|
+
"...same fields...",
|
|
150
|
+
"parent": "[parent-filename]",
|
|
151
|
+
"parent_checksum": "sha256:[parent's checksum]",
|
|
152
|
+
"delta_type": "rfc6902"
|
|
153
|
+
},
|
|
154
|
+
"patch": [ ...RFC 6902 operations... ]
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
5. `manifest.checksum` = SHA-256 of the `patch` array
|
|
158
|
+
6. `manifest.record_count` = number of patch operations
|
|
159
|
+
|
|
160
|
+
### Step 4: Write Export File
|
|
161
|
+
|
|
162
|
+
- **Full mode:** Write to `keysarium-brain-[YYYY-MM-DD].json` in project root
|
|
163
|
+
- **Delta mode:** Write to `keysarium-brain-[YYYY-MM-DD]-delta.json` in project root
|
|
164
|
+
|
|
165
|
+
### Step 5: Generate Summary
|
|
95
166
|
|
|
96
167
|
Display:
|
|
97
168
|
```
|
|
98
169
|
═══════════════════════════════════════════════════════
|
|
99
170
|
Brain Export Complete
|
|
100
171
|
|
|
172
|
+
Mode: [full|delta]
|
|
101
173
|
File: keysarium-brain-[date].json
|
|
102
174
|
Size: [file size]
|
|
175
|
+
Checksum: sha256:[first 12 chars]...
|
|
176
|
+
Parent: [parent filename or "none"]
|
|
177
|
+
|
|
103
178
|
Skills exported: [N] (tiers: [breakdown])
|
|
104
179
|
Research summaries: [N]
|
|
105
180
|
Harvest patterns: [N]
|
|
106
181
|
Domain patterns: [N domains]
|
|
182
|
+
Reward data: [N records aggregated]
|
|
107
183
|
|
|
108
184
|
Import into another project:
|
|
109
185
|
/brain-import keysarium-brain-[date].json
|
|
@@ -119,3 +195,4 @@ This export format is project-agnostic. Any multi-phase pipeline can:
|
|
|
119
195
|
1. Define its own brain schema extending the base format
|
|
120
196
|
2. Export domain-specific patterns
|
|
121
197
|
3. Import patterns from other pipelines
|
|
198
|
+
4. Use delta mode for efficient incremental exports
|
|
@@ -7,17 +7,71 @@ argument: "path to brain JSON file"
|
|
|
7
7
|
|
|
8
8
|
Import a previously exported brain container to bootstrap knowledge in a new project.
|
|
9
9
|
|
|
10
|
+
Supports v1.0 (legacy) and v1.1 (manifest + delta) containers.
|
|
11
|
+
|
|
10
12
|
## Protocol
|
|
11
13
|
|
|
12
14
|
### Step 1: Validate Brain File
|
|
13
15
|
|
|
14
16
|
1. Read the JSON file from `$ARGUMENTS`
|
|
15
17
|
2. Validate format:
|
|
16
|
-
- `
|
|
17
|
-
- `
|
|
18
|
+
- `format` field is `"keysarium-brain"`
|
|
19
|
+
- `version` field exists and is `"1.0"` or `"1.1"`
|
|
18
20
|
- Required sections present: `skills`, `harvest_patterns`, `metadata`
|
|
19
21
|
3. If validation fails → show error and stop
|
|
20
22
|
|
|
23
|
+
### Step 1a: Read Manifest (v1.1)
|
|
24
|
+
|
|
25
|
+
If `version` is `"1.1"` and `manifest` object exists:
|
|
26
|
+
|
|
27
|
+
1. Display manifest summary:
|
|
28
|
+
```
|
|
29
|
+
═══════════════════════════════════════════════════════
|
|
30
|
+
Brain Manifest
|
|
31
|
+
|
|
32
|
+
Source: [manifest.source_project]
|
|
33
|
+
Branch: [manifest.source_branch]
|
|
34
|
+
Created: [manifest.created_at]
|
|
35
|
+
Checksum: sha256:[first 12 chars]...
|
|
36
|
+
Type: [full | delta (parent: manifest.parent)]
|
|
37
|
+
|
|
38
|
+
Contents:
|
|
39
|
+
Domains: [manifest.domains]
|
|
40
|
+
Skills: [manifest.skills] ([count])
|
|
41
|
+
Research summaries: [manifest.research_count]
|
|
42
|
+
Harvest patterns: [manifest.harvest_pattern_count]
|
|
43
|
+
Total records: [manifest.record_count]
|
|
44
|
+
Size: [manifest.size_bytes] bytes
|
|
45
|
+
═══════════════════════════════════════════════════════
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Verify integrity: compute SHA-256 of content sections, compare with `manifest.checksum`
|
|
49
|
+
- If match → display "Integrity: verified"
|
|
50
|
+
- If mismatch → display "WARNING: Checksum mismatch! File may be corrupted or manually edited."
|
|
51
|
+
- Checksum mismatch does NOT block import — it is a warning only
|
|
52
|
+
|
|
53
|
+
### Step 1b: Resolve Delta (v1.1, COW mode)
|
|
54
|
+
|
|
55
|
+
If `manifest.parent` is not null (this is a delta container):
|
|
56
|
+
|
|
57
|
+
1. Log: "Delta container detected. Parent: [manifest.parent]"
|
|
58
|
+
2. Search for parent file:
|
|
59
|
+
- Same directory as the delta file
|
|
60
|
+
- Project root directory
|
|
61
|
+
- If not found → ask user: "Parent file [name] not found. Provide path or type 'partial' for partial import"
|
|
62
|
+
3. If parent found:
|
|
63
|
+
a. Load parent file
|
|
64
|
+
b. If parent also has `manifest.parent` → resolve recursively (chain)
|
|
65
|
+
c. If chain depth > 3 → warn: "Deep delta chain (depth [N]). Consider re-exporting a full brain."
|
|
66
|
+
d. Verify `manifest.parent_checksum` matches parent's actual checksum (warn if mismatch)
|
|
67
|
+
e. Apply JSON Patch (RFC 6902) operations from `patch` array to parent content
|
|
68
|
+
f. Result = fully materialized brain container. Proceed with standard import.
|
|
69
|
+
4. If parent NOT found and user chose 'partial':
|
|
70
|
+
- Extract only self-contained `add` operations from `patch` array
|
|
71
|
+
- Convert each `add` value to a standalone entry
|
|
72
|
+
- Proceed with import using only these extracted entries
|
|
73
|
+
- Log: "Partial import: [N] add operations applied, [M] operations skipped (require parent context)"
|
|
74
|
+
|
|
21
75
|
### Step 2: Selective Import
|
|
22
76
|
|
|
23
77
|
Ask user what to import:
|
|
@@ -25,7 +79,7 @@ Ask user what to import:
|
|
|
25
79
|
```
|
|
26
80
|
Brain file: [filename]
|
|
27
81
|
Source project: [source_project]
|
|
28
|
-
Exported: [exported_at]
|
|
82
|
+
Exported: [exported_at or manifest.created_at]
|
|
29
83
|
|
|
30
84
|
Available sections:
|
|
31
85
|
[1] Skills metadata ([N] skills) — trust tiers and BTO scores
|
|
@@ -33,6 +87,7 @@ Available sections:
|
|
|
33
87
|
[3] Research summaries ([N] cases) — findings and CJM choices
|
|
34
88
|
[4] Harvest patterns ([N] patterns) — reusable patterns and snippets
|
|
35
89
|
[5] Pipeline metrics — timing and performance data
|
|
90
|
+
[6] Reward data — phase averages and top patterns
|
|
36
91
|
[A] All sections
|
|
37
92
|
|
|
38
93
|
Which sections to import? (comma-separated numbers or 'A' for all)
|
|
@@ -65,6 +120,10 @@ For each imported section:
|
|
|
65
120
|
- Store as reference baseline
|
|
66
121
|
- Don't overwrite current project metrics
|
|
67
122
|
|
|
123
|
+
**Reward data:**
|
|
124
|
+
- Store phase averages as reference in `.keysarium/memory/_stats/imported-baselines.json`
|
|
125
|
+
- Don't overwrite existing reward records
|
|
126
|
+
|
|
68
127
|
### Step 4: Write Import Log
|
|
69
128
|
|
|
70
129
|
Create `brain-import-log-[YYYY-MM-DD].md` in project root:
|
|
@@ -74,6 +133,9 @@ Create `brain-import-log-[YYYY-MM-DD].md` in project root:
|
|
|
74
133
|
|
|
75
134
|
- Source: [filename]
|
|
76
135
|
- Source project: [source_project]
|
|
136
|
+
- Version: [version]
|
|
137
|
+
- Type: [full | delta]
|
|
138
|
+
- Checksum verified: [yes | no | n/a (v1.0)]
|
|
77
139
|
- Imported at: [timestamp]
|
|
78
140
|
- Sections imported: [list]
|
|
79
141
|
|
|
@@ -82,6 +144,11 @@ Create `brain-import-log-[YYYY-MM-DD].md` in project root:
|
|
|
82
144
|
|
|
83
145
|
## Conflicts Resolved
|
|
84
146
|
- [any deduplication or merge decisions]
|
|
147
|
+
|
|
148
|
+
## Delta Resolution (if applicable)
|
|
149
|
+
- Parent: [parent filename]
|
|
150
|
+
- Chain depth: [N]
|
|
151
|
+
- Patch operations applied: [N]
|
|
85
152
|
```
|
|
86
153
|
|
|
87
154
|
### Step 5: Summary
|
|
@@ -91,6 +158,8 @@ Create `brain-import-log-[YYYY-MM-DD].md` in project root:
|
|
|
91
158
|
Brain Import Complete
|
|
92
159
|
|
|
93
160
|
Source: [filename]
|
|
161
|
+
Version: [version] | Type: [full|delta]
|
|
162
|
+
Integrity: [verified | warning | n/a]
|
|
94
163
|
Sections imported: [list]
|
|
95
164
|
Skills updated: [N]
|
|
96
165
|
Patterns merged: [N]
|
|
@@ -106,7 +175,9 @@ Import log: brain-import-log-[date].md
|
|
|
106
175
|
## Modular Reuse
|
|
107
176
|
|
|
108
177
|
The import protocol handles:
|
|
109
|
-
- Version compatibility checking
|
|
178
|
+
- Version compatibility checking (v1.0 and v1.1)
|
|
179
|
+
- Manifest integrity verification (v1.1)
|
|
180
|
+
- Delta resolution with parent chain (v1.1 COW)
|
|
110
181
|
- Selective import (user chooses sections)
|
|
111
182
|
- Merge-not-overwrite strategy
|
|
112
183
|
- Conflict resolution with logging
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# /dream -- Dream Cycles Management
|
|
2
|
+
|
|
3
|
+
Manage Dream Cycles: trigger dream analysis, view insights, check trigger status.
|
|
4
|
+
|
|
5
|
+
Dream Cycles build on the reward-calibrated learning system (`lib/memory-protocol.md`,
|
|
6
|
+
`lib/reward-tracker.md`) and background workers (`lib/background-workers.md`).
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
/dream run — Manually trigger a dream cycle
|
|
12
|
+
/dream insights — Show latest insights
|
|
13
|
+
/dream status — Show trigger state
|
|
14
|
+
/dream clear — Clear old insights (keep last 10)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The argument `$ARGUMENTS` determines which subcommand to execute.
|
|
18
|
+
|
|
19
|
+
## Protocol
|
|
20
|
+
|
|
21
|
+
### 1. Parse Subcommand
|
|
22
|
+
|
|
23
|
+
Parse `$ARGUMENTS` to determine subcommand:
|
|
24
|
+
- If starts with "run" -> execute RUN
|
|
25
|
+
- If starts with "insights" -> execute INSIGHTS
|
|
26
|
+
- If starts with "status" -> execute STATUS
|
|
27
|
+
- If starts with "clear" -> execute CLEAR
|
|
28
|
+
- If empty or unrecognized -> show usage help
|
|
29
|
+
|
|
30
|
+
### 2. Execute Subcommand
|
|
31
|
+
|
|
32
|
+
#### RUN: Manually Trigger Dream Cycle
|
|
33
|
+
|
|
34
|
+
1. Read the DreamEngine protocol: `lib/dream-engine.md`
|
|
35
|
+
2. Read the worker template: `lib/worker-templates/dream-cycle.md`
|
|
36
|
+
3. Read the background workers protocol: `lib/background-workers.md`
|
|
37
|
+
4. Generate a worker ID: `wkr-{YYYYMMDD}-{HHmmss}-dream-cycle`
|
|
38
|
+
5. Create worker directory: `.keysarium/workers/{worker_id}/output/`
|
|
39
|
+
6. Register in `.keysarium/workers/registry.json`
|
|
40
|
+
7. Launch background worker agent with:
|
|
41
|
+
- Prompt: Contents of `lib/worker-templates/dream-cycle.md` with WORKER_ID, OUTPUT_DIR, TRIGGER_REASON="manual" injected
|
|
42
|
+
- Model: sonnet
|
|
43
|
+
- run_in_background: true
|
|
44
|
+
8. Report to user:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Dream cycle started.
|
|
48
|
+
ID: {worker_id}
|
|
49
|
+
Trigger: manual
|
|
50
|
+
Model: sonnet
|
|
51
|
+
Output: .keysarium/workers/{worker_id}/
|
|
52
|
+
|
|
53
|
+
Use /dream status to check progress.
|
|
54
|
+
Use /dream insights to view results after completion.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### INSIGHTS: Show Latest Insights
|
|
58
|
+
|
|
59
|
+
1. Check if `.keysarium/insights/` exists. If not, display empty state.
|
|
60
|
+
2. List all `dream-*.json` files, sort by name DESC, take the first (most recent).
|
|
61
|
+
3. Read the most recent dream result file.
|
|
62
|
+
4. Display insights using the format from `lib/dream-engine.md` (Insight Display Format).
|
|
63
|
+
5. Only show insights with `confidence >= 0.3`.
|
|
64
|
+
6. If no dream files exist, display:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
No dream insights available yet.
|
|
68
|
+
|
|
69
|
+
To generate insights:
|
|
70
|
+
1. Run several cases with /casarium (data is collected automatically)
|
|
71
|
+
2. Run /dream run to trigger analysis
|
|
72
|
+
3. Use /dream insights to view results
|
|
73
|
+
|
|
74
|
+
Dream insights are generated from accumulated reward data in .keysarium/memory/
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### STATUS: Show Trigger State
|
|
78
|
+
|
|
79
|
+
1. Read `.keysarium/insights/trigger-state.json`. If missing, display default state.
|
|
80
|
+
2. Calculate time elapsed since `last_dream_completed_at`.
|
|
81
|
+
3. Display using the format from `lib/dream-engine.md` (Status Display Format).
|
|
82
|
+
4. Evaluate triggers and show which are met.
|
|
83
|
+
5. If any trigger is met, suggest running `/dream run`.
|
|
84
|
+
|
|
85
|
+
#### CLEAR: Clear Old Insights
|
|
86
|
+
|
|
87
|
+
1. List all `dream-*.json` files in `.keysarium/insights/`.
|
|
88
|
+
2. Sort by name DESC.
|
|
89
|
+
3. Keep the 10 most recent files.
|
|
90
|
+
4. Delete older files.
|
|
91
|
+
5. Report count of deleted files.
|
|
92
|
+
6. If 10 or fewer files exist, report "Nothing to clear."
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Dream insights cleanup:
|
|
96
|
+
Total files: 15
|
|
97
|
+
Kept: 10 (most recent)
|
|
98
|
+
Deleted: 5
|
|
99
|
+
|
|
100
|
+
Trigger state preserved.
|
|
101
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# /feature-adr — Adaptive Feature Development Pipeline
|
|
2
|
+
|
|
3
|
+
## Использование
|
|
4
|
+
```
|
|
5
|
+
/feature-adr [описание фичи или путь к issue]
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Аргумент
|
|
9
|
+
$ARGUMENTS
|
|
10
|
+
|
|
11
|
+
## Действия
|
|
12
|
+
|
|
13
|
+
1. **Загрузи governance shard:** Прочитай `.claude/shards/feature-adr.shard.md`
|
|
14
|
+
2. **Загрузи скилл:** Прочитай `.claude/skills/feature-adr/SKILL.md`
|
|
15
|
+
|
|
16
|
+
3. **Step 0 — Complexity Router:**
|
|
17
|
+
- Прочитай `modules/00-complexity-router.md` и `references/complexity-matrix.md`
|
|
18
|
+
- Классифицируй фичу в S/M/L/XL
|
|
19
|
+
- Определи `{ACTIVE_STEPS}` и `{TIME_BUDGET}`
|
|
20
|
+
- Покажи Checkpoint 0 и **жди подтверждения tier**
|
|
21
|
+
|
|
22
|
+
4. **Steps 1-8 — Execute Active Steps:**
|
|
23
|
+
- Для каждого шага из `{ACTIVE_STEPS}`:
|
|
24
|
+
- Прочитай `modules/{step}.md`
|
|
25
|
+
- Выполни протокол шага
|
|
26
|
+
- Создай артефакты в `features/<slug>/`
|
|
27
|
+
- Покажи Checkpoint N
|
|
28
|
+
|
|
29
|
+
5. **Финализация:**
|
|
30
|
+
- Создай `features/<slug>/README.md` с summary
|
|
31
|
+
- Покажи итоговый отчёт
|
|
32
|
+
|
|
33
|
+
## Создание директории
|
|
34
|
+
|
|
35
|
+
При первом запуске создай:
|
|
36
|
+
```
|
|
37
|
+
features/<feature-slug>/
|
|
38
|
+
├── diagrams/ ← для Mermaid диаграмм (M+)
|
|
39
|
+
├── 03_adr/ ← для ADR файлов (M+)
|
|
40
|
+
└── 07_code_changes/ ← для манифеста изменений
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Slug: kebab-case из описания фичи (латиница, max 40 символов).
|
|
44
|
+
|
|
45
|
+
## Параллелизация (Agent Swarm)
|
|
46
|
+
|
|
47
|
+
Для L/XL тiers:
|
|
48
|
+
- Steps 2+3 запускай параллельно (2 агента, sonnet + opus)
|
|
49
|
+
- Steps 4+5 можно параллельно если Step 3 уже завершён
|
|
50
|
+
- Step 7: N параллельных агентов (по одному на модуль)
|
|
51
|
+
- Step 8: 3 параллельных агента (unit ‖ integration ‖ review)
|
|
52
|
+
|
|
53
|
+
Для S/M: всё последовательно, параллелизация не нужна.
|
|
54
|
+
|
|
55
|
+
## Model Routing
|
|
56
|
+
|
|
57
|
+
| Step | Model |
|
|
58
|
+
|------|-------|
|
|
59
|
+
| 0 Router | haiku |
|
|
60
|
+
| 1 Requirements | sonnet |
|
|
61
|
+
| 2 Research | sonnet |
|
|
62
|
+
| 3 ADR | opus |
|
|
63
|
+
| 4 DDD | opus |
|
|
64
|
+
| 5 Architecture | opus |
|
|
65
|
+
| 6 Impl Plan | sonnet |
|
|
66
|
+
| 7 Code | opus |
|
|
67
|
+
| 8 QE | sonnet |
|
|
68
|
+
|
|
69
|
+
## Checkpoint формат
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
═══════════════════════════════════════════════════════
|
|
73
|
+
⏸️ STEP N/8: [Step Name] Complete
|
|
74
|
+
<promise>[PROMISE_TAG]</promise>
|
|
75
|
+
Tier: {COMPLEXITY_TIER} | Active Steps: {ACTIVE_STEPS}
|
|
76
|
+
|
|
77
|
+
[Summary]
|
|
78
|
+
Artifacts: [list] ✅
|
|
79
|
+
|
|
80
|
+
• "ок" — next step
|
|
81
|
+
• "углуби [section]" — elaborate
|
|
82
|
+
• "[feedback]" — adjust
|
|
83
|
+
═══════════════════════════════════════════════════════
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Critical Rules
|
|
87
|
+
|
|
88
|
+
- **НИКОГДА** не пропускай Step 0 (Router) — всегда классифицируй сначала
|
|
89
|
+
- **НИКОГДА** не начинай Step 7 (Code) без Step 6 (Plan)
|
|
90
|
+
- **НИКОГДА** не пропускай Step 8 (QE) — тестирование обязательно
|
|
91
|
+
- **ВСЕГДА** жди подтверждения пользователя на Checkpoint перед переходом
|
|
92
|
+
- **ВСЕ артефакты** создаются в `features/<slug>/`, не в корне проекта
|