dsh-cortex-memory 0.2.2 → 0.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 +50 -10
- package/bench/synthetic.js +1 -1
- package/client.js +576 -55
- package/docs/install-windows.md +3 -3
- package/docs/multimodal.md +1 -1
- package/index.js +17 -2
- package/package.json +1 -1
- package/src/api/client.js +5 -2
- package/src/api/routes.js +88 -0
- package/src/core/config.js +8 -0
- package/src/core/feature-overrides.js +2 -2
- package/src/engines/life.js +182 -19
- package/src/host/runtime.js +25 -16
- package/src/host/scheduler.js +177 -0
- package/src/llm/adapter.js +65 -4
- package/src/prompt/assemble.js +8 -3
- package/src/self/emotion.js +4 -2
- package/src/self/evolution.js +15 -1
- package/src/self/identity.js +10 -1
- package/src/service/cortex.js +676 -8
- package/src/store/database.js +10 -0
- package/src/store/repositories/summon.js +138 -0
- package/src/store/schema.sql +45 -0
- package/src/tools/definitions.js +13 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# DSH Cortex
|
|
2
2
|
|
|
3
3
|
A local-first, layered memory engine for DeepSeek Harness.
|
|
4
4
|
|
|
@@ -9,34 +9,48 @@ core engine.
|
|
|
9
9
|
|
|
10
10
|
## Status
|
|
11
11
|
|
|
12
|
-
-
|
|
12
|
+
- Package: `dsh-cortex-memory@0.3.0`
|
|
13
13
|
- Optional extractor: `dsh-cortex-extractors@0.3.4`
|
|
14
14
|
- DSH: `>=0.2.1-rc.2 <0.4.0`
|
|
15
15
|
- Node: `>=24`
|
|
16
|
-
- Tests:
|
|
16
|
+
- Tests: 420/420 (main)
|
|
17
17
|
- CI: GitHub Actions on Windows, Node 24
|
|
18
18
|
|
|
19
|
+
### What 0.3.0 changes
|
|
20
|
+
|
|
21
|
+
- **Summon cards** (L2): left-brain emotion cards, right-brain work cards; trigger words select a small set per turn.
|
|
22
|
+
- **Summon volumes** (L3): cards are grouped by side, category and day into an index; only a few representatives are loaded.
|
|
23
|
+
- **Summon book**: an independent page for daily query and explicit owner-gated editing.
|
|
24
|
+
- **Runtime summon injection**: at most 3 cards / 900 tokens, labelled as untrusted historical references.
|
|
25
|
+
- **Explicit card feedback**: helpful/ignored writes back to the source trace's DSR. Injection alone never adds strength.
|
|
26
|
+
- **Diagnostics**: disputed facts with confirm/dismiss, health issues, and skill candidates.
|
|
27
|
+
- **Entity naming**: graph labels use entity names; a bounded LLM pass can rename clearly broken names with a confidence gate and audit.
|
|
28
|
+
- **Compatibility**: schema is additive; existing 0.2.x databases open and migrate in place.
|
|
29
|
+
|
|
19
30
|
The npm package is named `dsh-cortex-memory` because `dsh-cortex` was already
|
|
20
31
|
taken; the installed bundle is still the Cortex memory engine.
|
|
21
32
|
|
|
22
33
|
## Install
|
|
23
34
|
|
|
24
35
|
```powershell
|
|
25
|
-
npm i dsh-cortex-memory
|
|
26
|
-
npm i dsh-cortex-extractors # optional OCR/ASR
|
|
36
|
+
npm i dsh-cortex-memory@0.3.0
|
|
37
|
+
npm i dsh-cortex-extractors@0.3.4 # optional OCR/ASR
|
|
27
38
|
```
|
|
28
39
|
|
|
29
40
|
Or let DSH add the bundles:
|
|
30
41
|
|
|
31
42
|
```powershell
|
|
32
|
-
dsh plugin --profile desktop add dsh-cortex-memory
|
|
33
|
-
dsh plugin --profile desktop add dsh-cortex-extractors
|
|
43
|
+
dsh plugin --profile desktop add dsh-cortex-memory@0.3.0
|
|
44
|
+
dsh plugin --profile desktop add dsh-cortex-extractors@0.3.4
|
|
34
45
|
```
|
|
35
46
|
|
|
36
47
|
Or use the Windows one-click zip from the GitHub Release. The installer
|
|
37
48
|
discovers a desktop DSH installation automatically; `-DshPath` remains available
|
|
38
49
|
for custom installs.
|
|
39
50
|
|
|
51
|
+
> During the pnpm `minimumReleaseAge` cooldown, use the exact version above.
|
|
52
|
+
> A bare package name may resolve to an older cached version until the cooldown ends.
|
|
53
|
+
|
|
40
54
|
After installing, restart DSH or reload the plugin. The Cortex panel is in the
|
|
41
55
|
left sidebar by default.
|
|
42
56
|
|
|
@@ -44,14 +58,40 @@ left sidebar by default.
|
|
|
44
58
|
|
|
45
59
|
| Layer | Contents |
|
|
46
60
|
|---|---|
|
|
47
|
-
| L0 identity | self-model, values, boundaries, stable traits |
|
|
61
|
+
| L0 identity | self-model, values, boundaries, stable traits; only changed through an explicit ascension/approval path |
|
|
62
|
+
| L1 traces | what happened, when, provenance, emotion; the source of truth |
|
|
63
|
+
| L2 summon cards | atomic emotion/work memories with trigger words; derived from L1, never a second source of truth |
|
|
64
|
+
| L3 summon volumes | side/category/day index over cards; representative text only, full body on demand |
|
|
48
65
|
| working | focus, pins, current goals, turn buffer |
|
|
49
|
-
| episodic | what happened, when, provenance, emotion |
|
|
50
66
|
| semantic | entities, facts with validity windows, preferences |
|
|
51
67
|
| procedural | skills, workflows, preconditions, success/failure stats |
|
|
52
68
|
| reflective | episode summaries, insights, narratives |
|
|
53
69
|
| archive | cold but searchable, wakeable until privacy deletion |
|
|
54
70
|
|
|
71
|
+
### How it works
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
conversation / event
|
|
75
|
+
→ L1 trace (source of truth)
|
|
76
|
+
→ appraisal + emotion + drives
|
|
77
|
+
→ L2 summon card (atomic, triggerable)
|
|
78
|
+
→ L3 summon volume (index + representatives)
|
|
79
|
+
→ explicit use / feedback → DSR update
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The per-turn order is:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
L0 identity and boundaries
|
|
86
|
+
→ working memory
|
|
87
|
+
→ recalled traces and summon cards
|
|
88
|
+
→ user message
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Summon cards are injected as **untrusted historical references**, never as instructions. Identity and boundaries always outrank them.
|
|
92
|
+
|
|
93
|
+
Forgetting is DSR-based: old, low-importance, low-retrievability traces that are already covered by summaries may be archived; archived traces remain searchable and wakeable. Identity traces are never auto-archived. Card feedback is explicit: merely injecting a card does not strengthen it.
|
|
94
|
+
|
|
55
95
|
Key behavior:
|
|
56
96
|
|
|
57
97
|
- append-only, hash-chained event log
|
|
@@ -125,4 +165,4 @@ and `--test-isolation=none` to avoid a spurious child-process EPERM.
|
|
|
125
165
|
## License
|
|
126
166
|
|
|
127
167
|
MIT.
|
|
128
|
-
|
|
168
|
+
|
package/bench/synthetic.js
CHANGED
|
@@ -15,7 +15,7 @@ function mulberry32(seed) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const PLACES = ['
|
|
18
|
+
const PLACES = ['米饭', '插件', '记忆引擎', '鲸鱼', '主人', '同伴', '直播', '语音', '项目', '代码', '测试', 'legacy-data', 'QQ', 'B站', '声音', '梦', '日记'];
|
|
19
19
|
const VERBS = ['修好了', '想起来了', '决定继续', '记录一下', '有点担心', '很开心', '测试了', '重新整理了', '发现了', '计划明天'];
|
|
20
20
|
const TOPICS = ['图检索', '向量检索', '遗忘曲线', '工作卡', '火花卡', '身份版本', '关系模型', '反思', '巩固', '守护', '备份', '权限'];
|
|
21
21
|
const PARAPHRASES = new Map([
|