@dzhechkov/keysarium 1.2.0 → 1.4.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 +29 -11
- package/package.json +2 -2
- package/src/utils.js +1 -1
- package/templates/.claude/commands/brain-export.md +99 -20
- package/templates/.claude/commands/brain-import.md +75 -4
- package/templates/.claude/commands/bto-benchmark.md +302 -0
- package/templates/.claude/commands/harvest.md +28 -46
- package/templates/.claude/rules/trust-tiers.md +1 -0
- package/templates/.claude/skills/knowledge-extractor/SKILL.md +254 -0
- package/templates/.claude/skills/knowledge-extractor/modules/01-extract.md +188 -0
- package/templates/.claude/skills/knowledge-extractor/modules/02-classify.md +99 -0
- package/templates/.claude/skills/knowledge-extractor/modules/03-gate.md +150 -0
- package/templates/.claude/skills/knowledge-extractor/modules/04-integrate.md +159 -0
- package/templates/.claude/skills/knowledge-extractor/references/artifact-categories.md +100 -0
- package/templates/.claude/skills/knowledge-extractor/references/maturity-model.md +94 -0
- package/templates/.claude/skills/knowledge-extractor/references/quality-gates.md +98 -0
- package/templates/.claude/skills/knowledge-extractor/templates/artifact-card.md +63 -0
- package/templates/.claude/skills/knowledge-extractor/templates/harvest-report.md +102 -0
- package/templates/CLAUDE.md +42 -22
- package/templates/docs/continuous-learning-guide.md +622 -0
- 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 +8 -4
- package/templates/docs/keysarium-core/01-architecture.md +559 -0
- package/templates/docs/keysarium-core/02-functionality.md +955 -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/docs/skills-bto/01-deployment-guide.md +1 -1
- package/templates/docs/skills-bto/02-admin-guide.md +4 -1
- package/templates/docs/skills-bto/03-user-guide.md +4 -3
- package/templates/docs/skills-bto/04-infrastructure-requirements.md +2 -1
- package/templates/docs/skills-bto/05-architecture.md +11 -11
- package/templates/docs/skills-bto/06-user-flows.md +2 -1
- package/templates/lib/dream-engine.md +1 -1
- package/templates/lib/memory-protocol.md +131 -22
- 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** |
|
|
32
|
-
| **Commands** |
|
|
33
|
-
| **Rules** |
|
|
34
|
-
| **Shards** |
|
|
31
|
+
| **Skills** | 8 | `explore`, `frontend-design`, `goap-research`, `presentation-storyteller`, `problem-solver`, `reverse-engineering`, `bto`, `knowledge-extractor` |
|
|
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** | 9 | 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`, `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) |
|
|
@@ -255,29 +255,47 @@ Create a new file under `.claude/rules/`:
|
|
|
255
255
|
|
|
256
256
|
Rules are automatically loaded by Claude Code and enforced across all phases.
|
|
257
257
|
|
|
258
|
-
### Knowledge Harvesting
|
|
258
|
+
### Knowledge Harvesting (knowledge-extractor skill)
|
|
259
259
|
|
|
260
|
-
After completing research, extract reusable patterns:
|
|
260
|
+
After completing research, extract reusable patterns using the multi-agent knowledge-extractor:
|
|
261
261
|
|
|
262
262
|
```bash
|
|
263
|
-
/harvest researches/<slug>/
|
|
264
|
-
/harvest
|
|
263
|
+
/harvest researches/<slug>/ # Full harvest from one directory
|
|
264
|
+
/harvest researches/<slug>/ only patterns # Extract only patterns
|
|
265
|
+
/harvest all # Harvest from all researches
|
|
266
|
+
/harvest all only rules,templates # All researches, specific categories
|
|
267
|
+
/harvest features/my-feature/ # Harvest from a feature directory
|
|
265
268
|
```
|
|
266
269
|
|
|
267
|
-
|
|
270
|
+
**Pipeline:** Extract (5 parallel agents) → Classify (7 categories) → User Checkpoint → Gate (8 quality checks) → Integrate (auto-place)
|
|
268
271
|
|
|
269
|
-
|
|
272
|
+
| Stage | What Happens |
|
|
273
|
+
|-------|-------------|
|
|
274
|
+
| **Extract** | 5 parallel agents scan through different lenses: patterns, commands, rules, templates, snippets |
|
|
275
|
+
| **Classify** | Findings sorted into 7 categories (`skills`, `commands`, `hooks`, `rules`, `templates`, `patterns`, `snippets`) with cross-dedup |
|
|
276
|
+
| **User Review** | Numbered list of findings with granular control (`#N` commands to accept/reject/merge) |
|
|
277
|
+
| **Quality Gates** | 8 blocking gates in 2 passes: deterministic (G1-G2, G5-G7) + semantic via haiku (G3-G4, G8) |
|
|
278
|
+
| **Integrate** | Auto-placement into `.claude/` directories + `TOOLKIT_HARVEST.md` update + harvest report |
|
|
279
|
+
|
|
280
|
+
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.
|
|
281
|
+
|
|
282
|
+
### Brain Portability (v1.1)
|
|
270
283
|
|
|
271
284
|
Export and import accumulated knowledge between projects:
|
|
272
285
|
|
|
273
286
|
```bash
|
|
274
|
-
# Export knowledge as a portable JSON container
|
|
287
|
+
# Export knowledge as a portable JSON container (v1.1 with manifest + checksum)
|
|
275
288
|
/brain-export
|
|
276
289
|
|
|
290
|
+
# Delta export — store only changes since last export (COW mode)
|
|
291
|
+
/brain-export --delta keysarium-brain-2026-03-01.json
|
|
292
|
+
|
|
277
293
|
# Import a brain container into another project
|
|
278
294
|
/brain-import path/to/brain.json
|
|
279
295
|
```
|
|
280
296
|
|
|
297
|
+
**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.
|
|
298
|
+
|
|
281
299
|
### Context Shards
|
|
282
300
|
|
|
283
301
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/keysarium",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
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": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "https://github.com/dzhechko/product-keysarium-2026/issues"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@dzhechkov/keysarium-core": "^1.
|
|
44
|
+
"@dzhechkov/keysarium-core": "^1.1.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"@dzhechkov/keysarium-core": {
|
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 (
|
|
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' },
|
|
@@ -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,16 @@ 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
|
+
"most_reused_records": [],
|
|
112
|
+
"total_usage_count": 0,
|
|
113
|
+
"exported_from": ".keysarium/memory/"
|
|
114
|
+
},
|
|
115
|
+
|
|
82
116
|
"metadata": {
|
|
83
117
|
"export_scope": "all|[specific path]",
|
|
84
118
|
"files_scanned": 0,
|
|
@@ -87,23 +121,67 @@ Construct a JSON structure:
|
|
|
87
121
|
}
|
|
88
122
|
```
|
|
89
123
|
|
|
90
|
-
### Step
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
124
|
+
### Step 3a: Compute Manifest
|
|
125
|
+
|
|
126
|
+
After assembling all content sections:
|
|
127
|
+
|
|
128
|
+
1. Serialize all sections except `manifest` as JSON (sorted keys, compact)
|
|
129
|
+
2. Compute SHA-256 of the serialized string
|
|
130
|
+
3. Set `manifest.checksum` = `"sha256:{64-hex-chars}"`
|
|
131
|
+
4. Count total records: skills + research_summaries + harvest_patterns
|
|
132
|
+
5. Set `manifest.record_count`, `manifest.domains`, `manifest.skills`, `manifest.research_count`, `manifest.harvest_pattern_count`
|
|
133
|
+
6. Set `manifest.size_bytes` = byte length of serialized content
|
|
134
|
+
|
|
135
|
+
### Step 3b: Delta Mode (if mode = delta)
|
|
136
|
+
|
|
137
|
+
If exporting in delta mode:
|
|
138
|
+
|
|
139
|
+
1. Compare current full container with parent container section by section
|
|
140
|
+
2. Generate JSON Patch (RFC 6902) operations:
|
|
141
|
+
- `add` for new entries (new skills, new research summaries, new patterns)
|
|
142
|
+
- `replace` for changed values (updated trust tiers, new BTO scores)
|
|
143
|
+
- `remove` for deleted entries (rare)
|
|
144
|
+
3. If patch is empty → log "No changes since parent export" and stop
|
|
145
|
+
4. Build delta container:
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"version": "1.1",
|
|
149
|
+
"format": "keysarium-brain",
|
|
150
|
+
"manifest": {
|
|
151
|
+
"...same fields...",
|
|
152
|
+
"parent": "[parent-filename]",
|
|
153
|
+
"parent_checksum": "sha256:[parent's checksum]",
|
|
154
|
+
"delta_type": "rfc6902"
|
|
155
|
+
},
|
|
156
|
+
"patch": [ ...RFC 6902 operations... ]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
5. `manifest.checksum` = SHA-256 of the `patch` array
|
|
160
|
+
6. `manifest.record_count` = number of patch operations
|
|
161
|
+
|
|
162
|
+
### Step 4: Write Export File
|
|
163
|
+
|
|
164
|
+
- **Full mode:** Write to `keysarium-brain-[YYYY-MM-DD].json` in project root
|
|
165
|
+
- **Delta mode:** Write to `keysarium-brain-[YYYY-MM-DD]-delta.json` in project root
|
|
166
|
+
|
|
167
|
+
### Step 5: Generate Summary
|
|
95
168
|
|
|
96
169
|
Display:
|
|
97
170
|
```
|
|
98
171
|
═══════════════════════════════════════════════════════
|
|
99
172
|
Brain Export Complete
|
|
100
173
|
|
|
174
|
+
Mode: [full|delta]
|
|
101
175
|
File: keysarium-brain-[date].json
|
|
102
176
|
Size: [file size]
|
|
177
|
+
Checksum: sha256:[first 12 chars]...
|
|
178
|
+
Parent: [parent filename or "none"]
|
|
179
|
+
|
|
103
180
|
Skills exported: [N] (tiers: [breakdown])
|
|
104
181
|
Research summaries: [N]
|
|
105
182
|
Harvest patterns: [N]
|
|
106
183
|
Domain patterns: [N domains]
|
|
184
|
+
Reward data: [N records aggregated]
|
|
107
185
|
|
|
108
186
|
Import into another project:
|
|
109
187
|
/brain-import keysarium-brain-[date].json
|
|
@@ -119,3 +197,4 @@ This export format is project-agnostic. Any multi-phase pipeline can:
|
|
|
119
197
|
1. Define its own brain schema extending the base format
|
|
120
198
|
2. Export domain-specific patterns
|
|
121
199
|
3. Import patterns from other pipelines
|
|
200
|
+
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
|