dsh-cortex-memory 0.4.15 → 0.4.16
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/CHANGELOG.md +15 -7
- package/README.md +35 -16
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/core/config.js +1 -1
- package/src/core/feature-overrides.js +1 -1
- package/src/core/profile.js +8 -1
- package/test/unit/profile-paths.test.js +21 -0
- package/test/unit/profile.test.js +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.4.
|
|
3
|
+
## 0.4.16 — 2026-11-13
|
|
4
|
+
|
|
5
|
+
- Default data root moves to `DSH_HOME/cortex-memory` (desktop) and `DSH_HOME/cortex-memory/profiles/<profile>` for other profiles.
|
|
6
|
+
- Legacy `DSH_HOME/cortex` is never moved or deleted. Migration scripts copy it, keep a backup, and verify the copy before DSH opens the new root.
|
|
7
|
+
- Loader id stays `cortex` in this release; a later migration-scripted release will rename it.
|
|
8
|
+
- README extractor version corrected to 0.3.5; mojibake repaired.
|
|
9
|
+
|
|
10
|
+
## 0.4.13 — 2026-11-13
|
|
4
11
|
|
|
5
12
|
### Added
|
|
6
13
|
- `evolution` guard in Config schema (`autoActivate`, `maxPerDay`, `minIntervalMs`, `canaryTicks`, `rollbackOnError`).
|
|
@@ -14,7 +21,7 @@
|
|
|
14
21
|
- Canary ticks are persisted, not just kept in memory.
|
|
15
22
|
- Schema version bumped to 7 for the additive `canary_json` column.
|
|
16
23
|
|
|
17
|
-
## 0.4.12
|
|
24
|
+
## 0.4.12 — 2026-11-13
|
|
18
25
|
|
|
19
26
|
### Fixed
|
|
20
27
|
- `promptBudget` is normalized instead of being silently dropped and falling back to 1600.
|
|
@@ -30,12 +37,12 @@
|
|
|
30
37
|
- `gated` count in the retrieval trace.
|
|
31
38
|
- Regression tests for the prompt gate, importance exposure, identity L0, per-session recall, light/deep guardian, and configurable `promptBudget`.
|
|
32
39
|
|
|
33
|
-
## 0.4.11
|
|
40
|
+
## 0.4.11 — 2026-11-12
|
|
34
41
|
|
|
35
42
|
- Life/date fixes, graph candidate labels, neutral public package surface.
|
|
36
43
|
- Recent timeline endpoint and incremental summon rebuild.
|
|
37
44
|
|
|
38
|
-
## 0.4.0
|
|
45
|
+
## 0.4.0 — 2026-11-12
|
|
39
46
|
|
|
40
47
|
### Fixed
|
|
41
48
|
- Prompt-only injection gate; full search/API/CLI remain available.
|
|
@@ -47,15 +54,15 @@
|
|
|
47
54
|
- Tests and docs are included in the package; `npm test` works after install.
|
|
48
55
|
|
|
49
56
|
### Added
|
|
50
|
-
- `persona.selfName` / `persona.userAddress`; neutral public defaults (
|
|
57
|
+
- `persona.selfName` / `persona.userAddress`; neutral public defaults (`助手` / `用户`).
|
|
51
58
|
- `injectionGate`, `recentMinMatch`, `allowRestoreOutsideRoot` config.
|
|
52
59
|
|
|
53
60
|
### Compatibility
|
|
54
61
|
- Additive config only; no schema migration.
|
|
55
62
|
- Existing 0.3.x databases open in place.
|
|
56
|
-
- Local profiles can restore the
|
|
63
|
+
- Local profiles can restore the 本鲸 / 主人 persona through config.
|
|
57
64
|
|
|
58
|
-
## 0.3.1
|
|
65
|
+
## 0.3.1 — 026-11-12
|
|
59
66
|
|
|
60
67
|
- AI diary entries no longer append a 閳ユ粌寮懓鍐b偓?footer; web sources still inform the model but are not stored in the diary body.
|
|
61
68
|
- Manual dream generation timeout raised from 4s to 20s; `aiOnlyLife` still fails closed instead of falling back to a template.
|
|
@@ -110,3 +117,4 @@
|
|
|
110
117
|
|
|
111
118
|
|
|
112
119
|
|
|
120
|
+
|
package/README.md
CHANGED
|
@@ -9,13 +9,19 @@ core engine.
|
|
|
9
9
|
|
|
10
10
|
## Status
|
|
11
11
|
|
|
12
|
-
- Package: `dsh-cortex-memory@0.4.
|
|
13
|
-
- Optional extractor: `dsh-cortex-extractors@0.3.
|
|
12
|
+
- Package: `dsh-cortex-memory@0.4.16`
|
|
13
|
+
- Optional extractor: `dsh-cortex-extractors@0.3.5`
|
|
14
14
|
- DSH: `>=0.2.1-rc.2 <0.4.0`
|
|
15
15
|
- Node: `>=24`
|
|
16
|
-
- Tests:
|
|
16
|
+
- Tests: 437/437 (main)
|
|
17
17
|
- CI: GitHub Actions on Windows, Node 24
|
|
18
18
|
|
|
19
|
+
### What 0.4.16 changes
|
|
20
|
+
|
|
21
|
+
- **Public data path is now `~/.dsh/cortex-memory`**. The old `~/.dsh/cortex` directory is never moved or deleted; the oneclick/upgrade script copies it, verifies it, and keeps a backup.
|
|
22
|
+
- **No loader-id change in 0.4.16**: the bundle row remains `cortex` for compatibility. Renaming it to `cortex-memory` is reserved for a migration-scripted release.
|
|
23
|
+
- README extractor version corrected to 0.3.5 and corrupted characters repaired.
|
|
24
|
+
|
|
19
25
|
### What 0.4.15 changes
|
|
20
26
|
|
|
21
27
|
- **Evolution guard is configurable**: `autoActivate`, `maxPerDay`,
|
|
@@ -58,7 +64,7 @@ core engine.
|
|
|
58
64
|
- Life/date fixes: serialized LLM calls, timeouts, `Asia/Shanghai` diary time,
|
|
59
65
|
and date-header stripping.
|
|
60
66
|
- Graph candidate labels (`fromName` / `toName` / `relLabel`) and cleanup.
|
|
61
|
-
- Neutral public package surface: default `selfName:
|
|
67
|
+
- Neutral public package surface: default `selfName: 助手`, `userAddress: 用户`.
|
|
62
68
|
- Recent timeline endpoint and incremental summon rebuild.
|
|
63
69
|
|
|
64
70
|
### What 0.3.0 changes
|
|
@@ -75,18 +81,31 @@ core engine.
|
|
|
75
81
|
The npm package is named `dsh-cortex-memory` because `dsh-cortex` was already
|
|
76
82
|
taken; the installed bundle is still the Cortex memory engine.
|
|
77
83
|
|
|
84
|
+
## Data path migration
|
|
85
|
+
|
|
86
|
+
0.4.16 defaults to `DSH_HOME/cortex-memory` (or `DSH_HOME/cortex-memory/profiles/<profile>`).
|
|
87
|
+
The old `DSH_HOME/cortex` directory is never moved or deleted.
|
|
88
|
+
|
|
89
|
+
Before starting 0.4.16 with existing memories, close DSH and run:
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
powershell -ExecutionPolicy Bypass -File .\tools\migrate-cortex-path.ps1
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The script copies the old root, verifies the copied `cortex.sqlite` size, and leaves the old root as rollback.
|
|
96
|
+
|
|
78
97
|
## Install
|
|
79
98
|
|
|
80
99
|
```powershell
|
|
81
|
-
npm i dsh-cortex-memory@0.4.
|
|
82
|
-
npm i dsh-cortex-extractors@0.3.
|
|
100
|
+
npm i dsh-cortex-memory@0.4.16
|
|
101
|
+
npm i dsh-cortex-extractors@0.3.5 # optional OCR/ASR
|
|
83
102
|
```
|
|
84
103
|
|
|
85
104
|
Or let DSH add the bundles:
|
|
86
105
|
|
|
87
106
|
```powershell
|
|
88
|
-
dsh plugin --profile desktop add dsh-cortex-memory@0.4.
|
|
89
|
-
dsh plugin --profile desktop add dsh-cortex-extractors@0.3.
|
|
107
|
+
dsh plugin --profile desktop add dsh-cortex-memory@0.4.16
|
|
108
|
+
dsh plugin --profile desktop add dsh-cortex-extractors@0.3.5
|
|
90
109
|
```
|
|
91
110
|
|
|
92
111
|
Or use the Windows one-click zip from the GitHub Release. The installer
|
|
@@ -117,20 +136,20 @@ left sidebar by default.
|
|
|
117
136
|
|
|
118
137
|
```text
|
|
119
138
|
conversation / event
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
139
|
+
→ L1 trace (source of truth)
|
|
140
|
+
→ appraisal + emotion + drives
|
|
141
|
+
→ L2 summon card (atomic, triggerable)
|
|
142
|
+
→ L3 summon volume (index + representatives)
|
|
143
|
+
→ explicit use / feedback → DSR update
|
|
125
144
|
```
|
|
126
145
|
|
|
127
146
|
The per-turn order is:
|
|
128
147
|
|
|
129
148
|
```text
|
|
130
149
|
L0 identity and boundaries
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
150
|
+
→ working memory
|
|
151
|
+
→ recalled traces and summon cards
|
|
152
|
+
→ user message
|
|
134
153
|
```
|
|
135
154
|
|
|
136
155
|
Summon cards are injected as **untrusted historical references**, never as instructions. Identity and boundaries always outrank them.
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ try {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const Config = Schema ? Schema.object({
|
|
23
|
-
dataRoot: Schema.string().description('Cortex 数据目录(默认 DSH_HOME/cortex
|
|
23
|
+
dataRoot: Schema.string().description('Cortex 数据目录(默认 DSH_HOME/cortex-memory;旧库由迁移脚本复制)'),
|
|
24
24
|
dbFile: Schema.string().description('SQLite 文件;默认 dataRoot/cortex.sqlite'),
|
|
25
25
|
scope: Schema.string().default('global').description('默认 scope'),
|
|
26
26
|
persona: Schema.object({
|
package/package.json
CHANGED
package/src/core/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import { clamp } from './time.js';
|
|
|
4
4
|
import { profileDataRoot } from './profile.js';
|
|
5
5
|
|
|
6
6
|
const DSH_HOME = process.env.DSH_HOME || path.join(os.homedir(), '.dsh');
|
|
7
|
-
const DEFAULT_ROOT = process.env.CORTEX_HOME || path.join(DSH_HOME, 'cortex');
|
|
7
|
+
const DEFAULT_ROOT = process.env.CORTEX_HOME || path.join(DSH_HOME, 'cortex-memory');
|
|
8
8
|
|
|
9
9
|
export const DEFAULT_CONFIG = Object.freeze({
|
|
10
10
|
dataRoot: DEFAULT_ROOT,
|
|
@@ -25,7 +25,7 @@ export function readOverrides(dataRoot) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function loadFeatureOverrides(config = {}) {
|
|
28
|
-
const dataRoot = config.dataRoot ?? path.join(process.env.DSH_HOME || path.join(process.env.USERPROFILE || process.env.HOME || '.', '.dsh'), 'cortex');
|
|
28
|
+
const dataRoot = config.dataRoot ?? path.join(process.env.DSH_HOME || path.join(process.env.USERPROFILE || process.env.HOME || '.', '.dsh'), 'cortex-memory');
|
|
29
29
|
return readOverrides(dataRoot).current;
|
|
30
30
|
}
|
|
31
31
|
|
package/src/core/profile.js
CHANGED
|
@@ -26,7 +26,14 @@ export function detectProfileName({ argv = process.argv, env = process.env } = {
|
|
|
26
26
|
export function profileDataRoot({ argv = process.argv, env = process.env } = {}) {
|
|
27
27
|
const profile = detectProfileName({ argv, env });
|
|
28
28
|
const home = homeFromEnv(env);
|
|
29
|
-
//
|
|
29
|
+
// Keep the public bundle identity separate from legacy `cortex` data.
|
|
30
|
+
if (!profile || profile === 'desktop') return path.join(home, 'cortex-memory');
|
|
31
|
+
return path.join(home, 'cortex-memory', 'profiles', profile);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function legacyProfileDataRoot({ argv = process.argv, env = process.env } = {}) {
|
|
35
|
+
const profile = detectProfileName({ argv, env });
|
|
36
|
+
const home = homeFromEnv(env);
|
|
30
37
|
if (!profile || profile === 'desktop') return path.join(home, 'cortex');
|
|
31
38
|
return path.join(home, 'cortex', 'profiles', profile);
|
|
32
39
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { profileDataRoot, legacyProfileDataRoot } from '../../src/core/profile.js';
|
|
5
|
+
|
|
6
|
+
const home = 'C:/tmp/cortex-profile-test';
|
|
7
|
+
|
|
8
|
+
test('desktop data root is cortex-memory', () => {
|
|
9
|
+
const root = profileDataRoot({ argv: [], env: { DSH_HOME: home, DSH_PROFILE: 'desktop' } });
|
|
10
|
+
assert.equal(root, path.join(home, 'cortex-memory'));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('other profiles are isolated under cortex-memory/profiles', () => {
|
|
14
|
+
const root = profileDataRoot({ argv: [], env: { DSH_HOME: home, DSH_PROFILE: 'work' } });
|
|
15
|
+
assert.equal(root, path.join(home, 'cortex-memory', 'profiles', 'work'));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('legacy data root remains readable for migration', () => {
|
|
19
|
+
const root = legacyProfileDataRoot({ argv: [], env: { DSH_HOME: home, DSH_PROFILE: 'desktop' } });
|
|
20
|
+
assert.equal(root, path.join(home, 'cortex'));
|
|
21
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { detectProfileName, profileDataRoot } from '../../src/core/profile.js';
|
|
4
|
+
import { detectProfileName, profileDataRoot, legacyProfileDataRoot } from '../../src/core/profile.js';
|
|
5
5
|
|
|
6
6
|
test('detectProfileName reads --profile, --profile= and profile paths', () => {
|
|
7
7
|
assert.equal(detectProfileName({ argv: ['node', 'dsh', '--profile', 'cortex-clean'], env: {} }), 'cortex-clean');
|
|
@@ -12,9 +12,15 @@ test('detectProfileName reads --profile, --profile= and profile paths', () => {
|
|
|
12
12
|
assert.equal(detectProfileName({ argv: [], env: {} }), null);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
test('profileDataRoot isolates non-desktop profiles
|
|
15
|
+
test('profileDataRoot isolates non-desktop profiles under the new cortex-memory root', () => {
|
|
16
16
|
const env = { DSH_HOME: 'C:\\dsh-home' };
|
|
17
|
-
assert.equal(profileDataRoot({ argv: ['dsh', '--profile', 'agent-a'], env }), path.join('C:\\dsh-home', 'cortex', 'profiles', 'agent-a'));
|
|
18
|
-
assert.equal(profileDataRoot({ argv: ['dsh', '--profile', 'desktop'], env }), path.join('C:\\dsh-home', 'cortex'));
|
|
19
|
-
assert.equal(profileDataRoot({ argv: [], env }), path.join('C:\\dsh-home', 'cortex'));
|
|
17
|
+
assert.equal(profileDataRoot({ argv: ['dsh', '--profile', 'agent-a'], env }), path.join('C:\\dsh-home', 'cortex-memory', 'profiles', 'agent-a'));
|
|
18
|
+
assert.equal(profileDataRoot({ argv: ['dsh', '--profile', 'desktop'], env }), path.join('C:\\dsh-home', 'cortex-memory'));
|
|
19
|
+
assert.equal(profileDataRoot({ argv: [], env }), path.join('C:\\dsh-home', 'cortex-memory'));
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('legacyProfileDataRoot keeps the old cortex path for migration', () => {
|
|
23
|
+
const env = { DSH_HOME: 'C:\\dsh-home' };
|
|
24
|
+
assert.equal(legacyProfileDataRoot({ argv: ['dsh', '--profile', 'agent-a'], env }), path.join('C:\\dsh-home', 'cortex', 'profiles', 'agent-a'));
|
|
25
|
+
assert.equal(legacyProfileDataRoot({ argv: ['dsh', '--profile', 'desktop'], env }), path.join('C:\\dsh-home', 'cortex'));
|
|
20
26
|
});
|