dsh-cross-memory 0.2.4 → 0.2.5
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 +3 -3
- package/lib/config.js +34 -17
- package/lib/extract.js +4 -1
- package/lib/sync.js +37 -3
- package/lib/test/sweep.test.js +3 -1
- package/lib/test/sync.test.js +25 -1
- package/lib/types/config.d.ts +32 -15
- package/lib/types/sync.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,9 +108,9 @@ dsh plugin --profile <profile> add /path/to/packages/dsh-cross-memory
|
|
|
108
108
|
| `rotationEntries` | `16` | 每会话额外列出多少个未出现过的标题;`0` 关闭标题轮转 |
|
|
109
109
|
| `rotationEveryTurns` | `8` | 同一个长会话里每隔多少个用户轮重新发一次标题轮转块;`0` 只发一次 |
|
|
110
110
|
| `rawRecall` | `false` | 补注块是否附带来源会话的原文片段(默认关闭) |
|
|
111
|
-
| `maxEntriesPerScope` | `
|
|
112
|
-
| `maxUnusedDays` | `
|
|
113
|
-
| `snapshotMaxAgeDays` | `
|
|
111
|
+
| `maxEntriesPerScope` | `0`(不限制) | 每作用域保留上限;`0` 表示不设上限,条目一直保留,由召回排序决定用哪些。设了上限后超出部分归档最久没被读到或注入的条目(手写、`pinned`、`permanent` 除外) |
|
|
112
|
+
| `maxUnusedDays` | `0`(关闭) | 多久没用就归档(手写、`pinned`、`permanent` 除外);`0` 关闭。关闭时未读条目只是排序靠后,不会消失 |
|
|
113
|
+
| `snapshotMaxAgeDays` | `0`(关闭) | `durability: snapshot` 条目的过期天数;`0` 关闭 |
|
|
114
114
|
| `dedupeSimilarity` | `0.7` | 标题与正文字词重合度超过多少时,新记忆取代旧记忆 |
|
|
115
115
|
| `sweepIntervalHours` | `12` | 定期整理间隔;`0` 关闭 |
|
|
116
116
|
| `autoExtract` | `true` | 是否启用空闲后台抽取 |
|
package/lib/config.js
CHANGED
|
@@ -142,27 +142,36 @@ export const DEFAULT_SUMMARY_FRESH_SLOTS = 3;
|
|
|
142
142
|
/**
|
|
143
143
|
* Default cap on stored entries per scope before the least recently used are evicted.
|
|
144
144
|
*
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
export const DEFAULT_MAX_ENTRIES_PER_SCOPE =
|
|
145
|
+
* There is no cap by default (`0`). A cap is a storage decision, not a memory
|
|
146
|
+
* decision: the store is files on disk, the recall path reads an inverted index
|
|
147
|
+
* (`prefilterEntries`), and the summary already selects a bounded, ranked slice,
|
|
148
|
+
* so a large store costs index size rather than correctness. When a cap IS set,
|
|
149
|
+
* the least-attended entries are archived (never deleted) and `pinned`,
|
|
150
|
+
* `permanent` and `user`-written entries are exempt.
|
|
151
|
+
*/
|
|
152
|
+
export const DEFAULT_MAX_ENTRIES_PER_SCOPE = 0;
|
|
153
153
|
/** Default hours between periodic maintenance sweeps; `0` disables the sweep. */
|
|
154
154
|
export const DEFAULT_SWEEP_INTERVAL_HOURS = 12;
|
|
155
|
-
/**
|
|
156
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Default days an unused memory survives before it is archived; `0` disables archival.
|
|
157
|
+
*
|
|
158
|
+
* Off by default for the same reason the cap is: an entry nobody has happened to
|
|
159
|
+
* read yet is not a stale entry, and archiving it removes it from recall without
|
|
160
|
+
* a person having decided anything. Retrieval already ranks by decay and use, so
|
|
161
|
+
* an unused memory sinks instead of being lost. Set a number to re-enable the
|
|
162
|
+
* age-based sweep.
|
|
163
|
+
*/
|
|
164
|
+
export const DEFAULT_MAX_UNUSED_DAYS = 0;
|
|
157
165
|
/**
|
|
158
166
|
* Default days a `snapshot` memory survives before it is archived; `0` disables.
|
|
159
167
|
*
|
|
160
168
|
* A reading taken at one moment is wrong from the day after it was taken, and
|
|
161
169
|
* reading it does not make it right, so it cannot be judged by the unused clock
|
|
162
|
-
* that a convention is judged by.
|
|
163
|
-
*
|
|
170
|
+
* that a convention is judged by. Off by default: the decay ranking already
|
|
171
|
+
* pushes an old reading down, and archiving it outright is a loss nobody asked
|
|
172
|
+
* for. Set a number to re-enable snapshot expiry.
|
|
164
173
|
*/
|
|
165
|
-
export const DEFAULT_SNAPSHOT_MAX_AGE_DAYS =
|
|
174
|
+
export const DEFAULT_SNAPSHOT_MAX_AGE_DAYS = 0;
|
|
166
175
|
/** Default share of title/body tokens two memories must have in common to be merged. */
|
|
167
176
|
export const DEFAULT_DEDUPE_SIMILARITY = 0.7;
|
|
168
177
|
/** Default recall mode: how much of a conversation pays for cross-session memory. */
|
|
@@ -270,8 +279,16 @@ export const DEFAULT_EXTRACT_INTERVAL_MINUTES = 30;
|
|
|
270
279
|
export const DEFAULT_EXTRACT_MAX_OUTPUT_TOKENS = 8192;
|
|
271
280
|
/** Default timeout for one extraction call. */
|
|
272
281
|
export const DEFAULT_EXTRACT_TIMEOUT_MS = 120_000;
|
|
273
|
-
/**
|
|
274
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Default max drafts one extraction may produce.
|
|
284
|
+
*
|
|
285
|
+
* 8 rather than 5: on a real production session, an audit of 50 Mubea
|
|
286
|
+
* Invoice-Insight conversations found 247 durable facts, and the cap of 5 was
|
|
287
|
+
* the single biggest cause of missed material on long sessions (one audit
|
|
288
|
+
* session held 16 facts and kept 5). Eight keeps a long session's findings
|
|
289
|
+
* without letting a short one pad itself.
|
|
290
|
+
*/
|
|
291
|
+
export const DEFAULT_EXTRACT_MAX_MEMORIES = 8;
|
|
275
292
|
/** Default idle hours a session must accumulate before it is mined. */
|
|
276
293
|
export const DEFAULT_MIN_IDLE_HOURS = 6;
|
|
277
294
|
/** Default age limit: sessions idle longer than this are never mined. */
|
|
@@ -406,7 +423,7 @@ export const Config = z.object({
|
|
|
406
423
|
*/
|
|
407
424
|
rotationEveryTurns: z.number().default(DEFAULT_ROTATION_EVERY_TURNS).description('Inside one conversation, emit a fresh rotation block every this many user turns (0 keeps the old once-per-conversation behaviour).').volatile(),
|
|
408
425
|
/** Max stored entries per scope; the least-recently-updated are evicted. */
|
|
409
|
-
maxEntriesPerScope: z.number().default(DEFAULT_MAX_ENTRIES_PER_SCOPE).description('Stored memories per scope; past this cap the least
|
|
426
|
+
maxEntriesPerScope: z.number().default(DEFAULT_MAX_ENTRIES_PER_SCOPE).description('Stored memories per scope; past this cap the least-attended are archived (pinned, permanent and user-written entries are exempt). 0 (the default) means no cap: the store grows and retrieval ranks it.').volatile(),
|
|
410
427
|
/** Days an unused memory survives before it is archived. `0` disables archival. */
|
|
411
428
|
maxUnusedDays: z.number().default(DEFAULT_MAX_UNUSED_DAYS).description('Days an unused memory survives before it is archived. Archived entries are recoverable with /memories restore. 0 disables archival.').volatile(),
|
|
412
429
|
/** Days a snapshot memory survives regardless of use. `0` disables. */
|
|
@@ -624,7 +641,7 @@ export function normalizeSettings(input) {
|
|
|
624
641
|
deltaMaxBytes: positive(value.deltaMaxBytes, DEFAULT_DELTA_MAX_BYTES, 0),
|
|
625
642
|
rotationEntries: positive(value.rotationEntries, DEFAULT_ROTATION_ENTRIES, 0),
|
|
626
643
|
rotationEveryTurns: positive(value.rotationEveryTurns, DEFAULT_ROTATION_EVERY_TURNS, 0),
|
|
627
|
-
maxEntriesPerScope: positive(value.maxEntriesPerScope, DEFAULT_MAX_ENTRIES_PER_SCOPE),
|
|
644
|
+
maxEntriesPerScope: positive(value.maxEntriesPerScope, DEFAULT_MAX_ENTRIES_PER_SCOPE, 0),
|
|
628
645
|
maxUnusedDays: positive(value.maxUnusedDays, DEFAULT_MAX_UNUSED_DAYS, 0),
|
|
629
646
|
snapshotMaxAgeDays: positive(value.snapshotMaxAgeDays, DEFAULT_SNAPSHOT_MAX_AGE_DAYS, 0),
|
|
630
647
|
dedupeSimilarity: clampUnit(value.dedupeSimilarity, DEFAULT_DEDUPE_SIMILARITY),
|
package/lib/extract.js
CHANGED
|
@@ -75,6 +75,8 @@ export const EXTRACT_SYSTEM = [
|
|
|
75
75
|
'',
|
|
76
76
|
'Record: stable user preferences and working style; project architecture and conventions; build/test/deploy commands; environment and tooling facts; non-obvious gotchas; decisions and their reasons; the user\'s personal background and relationships (family, colleagues, friends, neighbours); personal habits, routines and plans; creative collaborations and shared stories; commitments and promises with their deadlines.',
|
|
77
77
|
'Do NOT record: transient task state, one-off debugging output, secrets, API keys, tokens, credentials, sensitive personal data (ID numbers, medical records, financial account details), restatements of the code the assistant just wrote, or anything already stated in the transcript as a question rather than a fact.',
|
|
78
|
+
'Do NOT record what the repository already answers: a config key and its value, an i18n key that is there to be read, the list of entry files, a script\'s CLI flags, a bug that is already fixed (name the fix only when the failure mode is non-obvious). If a later session can get it by opening the file, it is not memory.',
|
|
79
|
+
'REPORTS: when the transcript is an implementation/audit/review report (often a subagent\'s), record what the report LEARNED — the mechanism, the interface trap, the root cause, the measured result, the open gap — and skip what it was ASKED to do: the task boundary ("只改这 5 个文件", "不要 git commit"), the verification commands, the review verdict, the commit hash. Those expire with the task; the finding does not.',
|
|
78
80
|
'',
|
|
79
81
|
'Write every title and body in Simplified Chinese. Keep paths, commands, identifiers, product names and error strings exactly as they are.',
|
|
80
82
|
'The injected summary shows only the title and roughly the first 100 characters of the body (the budget forces short previews), so lead with the trigger and the decision; put the detail after.',
|
|
@@ -85,6 +87,7 @@ export const EXTRACT_SYSTEM = [
|
|
|
85
87
|
'TIME: a fact carrying a relative time (明天/上周五/前天/下周三/上个月) MUST also carry its absolute date in the body, resolved against the today\'s date given below ("前天(2026-05-25)"). A later turn may ask exactly "那次是几号", and the relative word alone cannot answer it.',
|
|
86
88
|
'UPDATES: when the transcript CHANGES an existing fact — a correction, a changed plan, a new version, a story retcon — do NOT overwrite the old state. Keep the timeline in the body: "旧:<old>;新:<new>(<date> 改)". A later turn may ask what was true BEFORE the change (改口/纠错/真实变化), and only the timeline answers it.',
|
|
87
89
|
'CONFLICTS: when the user says two things about the same subject that do not agree and the transcript does not explain why, record BOTH ("两种说法:<A>;<B>;原因未明"). Never pick one side and drop the other.',
|
|
90
|
+
'CONDITIONS: a rule or preference is usually BOUNDED — "下雨才喝", "当周有早班或盘点就不碰", "只在雨夜、最多两指", "戒到 5 月 10 日". The condition is the memory: a later turn asks "今晚那瓶能开不" and only the bounded rule answers it. Copy the condition and any deadline into the body exactly as the user set it ("条件:当周有早班或盘点则不喝;雨夜才喝,最多两指;戒到 2026-05-10"), and never record the bare preference without its bounds.',
|
|
88
91
|
'',
|
|
89
92
|
'Choose the scope of each memory:',
|
|
90
93
|
'- "global": true across the developer\'s machines and projects — how they like to work, general preferences, tooling, machine and path facts, network and proxy setup, how to move work between machines, and the user\'s personal background and relationships.',
|
|
@@ -114,7 +117,7 @@ export const EXTRACT_SYSTEM = [
|
|
|
114
117
|
'- One short sentence each, in the user\'s framing, naming the object ("把报价单发出去", not "邮件相关").',
|
|
115
118
|
'- NEVER drop the time word: if the user said 明天/周五/下周三, the loop text must start with it ("明天把登录页的截图补齐"), because a later question may be exactly "我明天要做什么"; resolve "dueAt" to the absolute ISO date computed from today\'s date given above, and omit it when no deadline was said.',
|
|
116
119
|
'- "dueAt" only when a deadline was actually said, as ISO date or date-time. Never invent one: a loop without a deadline is a note, and nagging somebody about a note turns help into supervision.',
|
|
117
|
-
'- PROGRESS: when the user reports that part of an existing obligation is done ("先还一件,还剩两件"),
|
|
120
|
+
'- PROGRESS: when the user reports that part of an existing obligation is done ("先还一件,还剩两件"), the loop text MUST be the REMAINING part with the original promise\'s wording kept ("还剩两件夜班见闻(原欠三件)"), because the ledger recognises it as the same promise and replaces the old amount. A loop that still states the full original amount ("三天内讲完欠的三件") is WRONG after a progress report: it leaves the ledger owing what is already done. Skip the obligation entirely only when nothing is left.',
|
|
118
121
|
'- Skip what the session shows as already done, and skip the assistant\'s own to-dos. An empty array is the normal result.',
|
|
119
122
|
'Prefer few high-value memories over many trivial ones. Return at most the requested number.',
|
|
120
123
|
'Reply with JSON only, no prose and no code fence: {"memories":[{"scope":"global"|"project","kind":string,"title":string,"body":string,"tags":string[],"keys":string[],"entities":string[],"appliesTo":string,"quote":string,"voice":"user"|"assistant"}],"loops":[{"text":string,"dueAt":string?}],"summary":string}',
|
package/lib/sync.js
CHANGED
|
@@ -377,6 +377,28 @@ async function tryGit(dir, args, timeout) {
|
|
|
377
377
|
return undefined;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
+
/** Run git and keep the failure text, for callers that must read git's wording. */
|
|
381
|
+
async function tryGitResult(dir, args, timeout) {
|
|
382
|
+
try {
|
|
383
|
+
return { ok: true, stdout: await git(dir, args, timeout), stderr: '' };
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
const failure = error;
|
|
387
|
+
return {
|
|
388
|
+
ok: false,
|
|
389
|
+
stdout: String(failure.stdout ?? ''),
|
|
390
|
+
stderr: String(failure.stderr ?? failure.message ?? ''),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Whether `git rebase --continue` stopped because the replayed commit is now
|
|
396
|
+
* empty (its change is already upstream). Git tells the operator to use
|
|
397
|
+
* `--skip`; the plugin must do the same, otherwise the loop spins to its cap.
|
|
398
|
+
*/
|
|
399
|
+
export function isEmptyCommitFailure(text) {
|
|
400
|
+
return /previous cherry-pick is now empty|nothing to commit|no changes added to commit|no changes did you forget|no changes - did you forget/iu.test(text);
|
|
401
|
+
}
|
|
380
402
|
/** The memory store's git transport. */
|
|
381
403
|
export class MemorySync {
|
|
382
404
|
options;
|
|
@@ -590,11 +612,23 @@ export class MemorySync {
|
|
|
590
612
|
const unmerged = await tryGit(this.dir, ['diff', '--name-only', '--diff-filter=U'], this.options.gitTimeoutMs);
|
|
591
613
|
const paths = (unmerged ?? '').split('\n').filter((line) => line.length > 0);
|
|
592
614
|
if (paths.length === 0) {
|
|
593
|
-
const cont = await
|
|
594
|
-
if (cont
|
|
615
|
+
const cont = await tryGitResult(this.dir, ['rebase', '--continue'], this.options.networkTimeoutMs);
|
|
616
|
+
if (cont.ok)
|
|
595
617
|
return { conflicts, resolvedByResolver, resolvedByTime, mergedByStructure };
|
|
596
618
|
// An empty commit (its change is already upstream) makes --continue
|
|
597
|
-
// refuse forever;
|
|
619
|
+
// refuse forever; --skip is the documented way forward. Do not gate this
|
|
620
|
+
// on a clean worktree: the memory plugin writes the store concurrently,
|
|
621
|
+
// so `git status` is routinely dirty during a sync and the old gate made
|
|
622
|
+
// the loop spin until the round cap (observed 2026-11-11 on the host).
|
|
623
|
+
if (isEmptyCommitFailure(`${cont.stdout}\n${cont.stderr}`)) {
|
|
624
|
+
const skipped = await tryGit(this.dir, ['rebase', '--skip'], this.options.gitTimeoutMs);
|
|
625
|
+
if (skipped !== undefined) {
|
|
626
|
+
mergedByStructure += 1;
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
// Fallback for git builds with different wording: only when the tree is
|
|
631
|
+
// clean is skipping safe without an explicit empty-commit signal.
|
|
598
632
|
const dirty = await tryGit(this.dir, ['status', '--porcelain'], this.options.gitTimeoutMs);
|
|
599
633
|
if ((dirty ?? '').trim() === '') {
|
|
600
634
|
const skipped = await tryGit(this.dir, ['rebase', '--skip'], this.options.gitTimeoutMs);
|
package/lib/test/sweep.test.js
CHANGED
|
@@ -40,7 +40,9 @@ function stubSession(cwd) {
|
|
|
40
40
|
/** A runtime over a temp store. */
|
|
41
41
|
async function fixture(t, settings = {}) {
|
|
42
42
|
const dir = await mkdtemp(join(tmpdir(), 'dsh-cross-memory-sweep-'));
|
|
43
|
-
|
|
43
|
+
// Retention is off by default now (the store keeps everything and retrieval
|
|
44
|
+
// ranks it), so a test about the age sweep says the window it means.
|
|
45
|
+
const runtime = new MemoriesRuntime(stubContext, { memoriesDir: dir, autoExtract: false, maxUnusedDays: 90, ...settings });
|
|
44
46
|
t.after(() => {
|
|
45
47
|
runtime.dispose();
|
|
46
48
|
return rm(dir, { recursive: true, force: true });
|
package/lib/test/sync.test.js
CHANGED
|
@@ -13,7 +13,7 @@ import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
|
13
13
|
import { hostname, tmpdir } from 'node:os';
|
|
14
14
|
import { join } from 'node:path';
|
|
15
15
|
import test from 'node:test';
|
|
16
|
-
import { MemorySync, STORE_GITIGNORE, entryStamp, isEntryPath, isHostDescriptorPath, isPersonaPath, isSessionNotePath, mergeLoopLedgers, mergePersona, newerEntry, newerHostDescriptor, newerSessionNote, nextClockDelay } from '../sync.js';
|
|
16
|
+
import { MemorySync, STORE_GITIGNORE, entryStamp, isEmptyCommitFailure, isEntryPath, isHostDescriptorPath, isPersonaPath, isSessionNotePath, mergeLoopLedgers, mergePersona, newerEntry, newerHostDescriptor, newerSessionNote, nextClockDelay } from '../sync.js';
|
|
17
17
|
import { applyConflictPlan, isArchivedEntryPath, projectRootOf } from '../sync-runtime.js';
|
|
18
18
|
import { slugify } from '../storage.js';
|
|
19
19
|
/** A logger that swallows everything; tests assert on git state, not log text. */
|
|
@@ -222,6 +222,30 @@ test('a conflicting host descriptor keeps the newer reading', () => {
|
|
|
222
222
|
assert.equal(isHostDescriptorPath('projects/a/project.json'), false);
|
|
223
223
|
assert.equal(isHostDescriptorPath('entries/hosts/note.md'), false);
|
|
224
224
|
});
|
|
225
|
+
test('git empty-commit wording is recognised, ordinary failures are not', () => {
|
|
226
|
+
// real messages from git 2.5x
|
|
227
|
+
assert.equal(isEmptyCommitFailure('The previous cherry-pick is now empty, possibly due to conflict resolution.'), true);
|
|
228
|
+
assert.equal(isEmptyCommitFailure('nothing to commit, working tree clean'), true);
|
|
229
|
+
assert.equal(isEmptyCommitFailure('CONFLICT (content): Merge conflict in entries/a.md'), false);
|
|
230
|
+
assert.equal(isEmptyCommitFailure('fatal: could not read from remote repository'), false);
|
|
231
|
+
});
|
|
232
|
+
test('an identical change on both machines becomes an empty commit and the sync still finishes', async () => {
|
|
233
|
+
const { remote, left, right } = await twoWayFixture();
|
|
234
|
+
// right records the row locally first (no sync), then left lands the very same
|
|
235
|
+
// content upstream: replaying right's commit onto it produces an empty commit.
|
|
236
|
+
await mkdir(join(right.dir, 'entries'), { recursive: true });
|
|
237
|
+
const text = entryText('same-row', 'the very same fact', '2026-04-01T00:00:00.000Z');
|
|
238
|
+
await writeFile(join(right.dir, 'entries', 'same-row.md'), text);
|
|
239
|
+
git(right.dir, 'add', '-A');
|
|
240
|
+
git(right.dir, 'commit', '-q', '-m', 'memory(right): same row');
|
|
241
|
+
await mkdir(join(left.dir, 'entries'), { recursive: true });
|
|
242
|
+
await writeFile(join(left.dir, 'entries', 'same-row.md'), text);
|
|
243
|
+
await left.sync.run('test');
|
|
244
|
+
const outcome = await right.sync.run('test');
|
|
245
|
+
assert.equal(outcome.stoppedBy, undefined, 'the empty commit no longer aborts the sync');
|
|
246
|
+
assert.equal(git(right.dir, 'status', '--porcelain').trim(), '', 'no half-finished rebase left behind');
|
|
247
|
+
assert.match(execFileSync('git', ['-C', remote, 'show', 'main:entries/same-row.md'], { encoding: 'utf8' }), /the very same fact/u);
|
|
248
|
+
});
|
|
225
249
|
test('a persona file merges as a bullet union, section by section', () => {
|
|
226
250
|
const ours = ['## 他怎么工作', '- 中文交流', '- 改完自己验', '', '## 他的标准', '- 讨厌假动作', ''].join('\n');
|
|
227
251
|
const theirs = ['## 他怎么工作', '- 中文交流', '- 一条只有 PC 记下的工作方式', '', '## 他的标准', '- 讨厌假动作', '- 一条只有 PC 记下的标准', ''].join('\n');
|
package/lib/types/config.d.ts
CHANGED
|
@@ -138,27 +138,36 @@ export declare const DEFAULT_SUMMARY_FRESH_SLOTS = 3;
|
|
|
138
138
|
/**
|
|
139
139
|
* Default cap on stored entries per scope before the least recently used are evicted.
|
|
140
140
|
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
export declare const DEFAULT_MAX_ENTRIES_PER_SCOPE =
|
|
141
|
+
* There is no cap by default (`0`). A cap is a storage decision, not a memory
|
|
142
|
+
* decision: the store is files on disk, the recall path reads an inverted index
|
|
143
|
+
* (`prefilterEntries`), and the summary already selects a bounded, ranked slice,
|
|
144
|
+
* so a large store costs index size rather than correctness. When a cap IS set,
|
|
145
|
+
* the least-attended entries are archived (never deleted) and `pinned`,
|
|
146
|
+
* `permanent` and `user`-written entries are exempt.
|
|
147
|
+
*/
|
|
148
|
+
export declare const DEFAULT_MAX_ENTRIES_PER_SCOPE = 0;
|
|
149
149
|
/** Default hours between periodic maintenance sweeps; `0` disables the sweep. */
|
|
150
150
|
export declare const DEFAULT_SWEEP_INTERVAL_HOURS = 12;
|
|
151
|
-
/**
|
|
152
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Default days an unused memory survives before it is archived; `0` disables archival.
|
|
153
|
+
*
|
|
154
|
+
* Off by default for the same reason the cap is: an entry nobody has happened to
|
|
155
|
+
* read yet is not a stale entry, and archiving it removes it from recall without
|
|
156
|
+
* a person having decided anything. Retrieval already ranks by decay and use, so
|
|
157
|
+
* an unused memory sinks instead of being lost. Set a number to re-enable the
|
|
158
|
+
* age-based sweep.
|
|
159
|
+
*/
|
|
160
|
+
export declare const DEFAULT_MAX_UNUSED_DAYS = 0;
|
|
153
161
|
/**
|
|
154
162
|
* Default days a `snapshot` memory survives before it is archived; `0` disables.
|
|
155
163
|
*
|
|
156
164
|
* A reading taken at one moment is wrong from the day after it was taken, and
|
|
157
165
|
* reading it does not make it right, so it cannot be judged by the unused clock
|
|
158
|
-
* that a convention is judged by.
|
|
159
|
-
*
|
|
166
|
+
* that a convention is judged by. Off by default: the decay ranking already
|
|
167
|
+
* pushes an old reading down, and archiving it outright is a loss nobody asked
|
|
168
|
+
* for. Set a number to re-enable snapshot expiry.
|
|
160
169
|
*/
|
|
161
|
-
export declare const DEFAULT_SNAPSHOT_MAX_AGE_DAYS =
|
|
170
|
+
export declare const DEFAULT_SNAPSHOT_MAX_AGE_DAYS = 0;
|
|
162
171
|
/** Default share of title/body tokens two memories must have in common to be merged. */
|
|
163
172
|
export declare const DEFAULT_DEDUPE_SIMILARITY = 0.7;
|
|
164
173
|
/** Default recall mode: how much of a conversation pays for cross-session memory. */
|
|
@@ -264,8 +273,16 @@ export declare const DEFAULT_EXTRACT_INTERVAL_MINUTES = 30;
|
|
|
264
273
|
export declare const DEFAULT_EXTRACT_MAX_OUTPUT_TOKENS = 8192;
|
|
265
274
|
/** Default timeout for one extraction call. */
|
|
266
275
|
export declare const DEFAULT_EXTRACT_TIMEOUT_MS = 120000;
|
|
267
|
-
/**
|
|
268
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Default max drafts one extraction may produce.
|
|
278
|
+
*
|
|
279
|
+
* 8 rather than 5: on a real production session, an audit of 50 Mubea
|
|
280
|
+
* Invoice-Insight conversations found 247 durable facts, and the cap of 5 was
|
|
281
|
+
* the single biggest cause of missed material on long sessions (one audit
|
|
282
|
+
* session held 16 facts and kept 5). Eight keeps a long session's findings
|
|
283
|
+
* without letting a short one pad itself.
|
|
284
|
+
*/
|
|
285
|
+
export declare const DEFAULT_EXTRACT_MAX_MEMORIES = 8;
|
|
269
286
|
/** Default idle hours a session must accumulate before it is mined. */
|
|
270
287
|
export declare const DEFAULT_MIN_IDLE_HOURS = 6;
|
|
271
288
|
/** Default age limit: sessions idle longer than this are never mined. */
|
package/lib/types/sync.d.ts
CHANGED
|
@@ -159,6 +159,12 @@ export declare function parseClockTime(value: string): number | undefined;
|
|
|
159
159
|
* @returns the delay, or undefined when no entry parses.
|
|
160
160
|
*/
|
|
161
161
|
export declare function nextClockDelay(clock: readonly string[], now: number): number | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Whether `git rebase --continue` stopped because the replayed commit is now
|
|
164
|
+
* empty (its change is already upstream). Git tells the operator to use
|
|
165
|
+
* `--skip`; the plugin must do the same, otherwise the loop spins to its cap.
|
|
166
|
+
*/
|
|
167
|
+
export declare function isEmptyCommitFailure(text: string): boolean;
|
|
162
168
|
/** The memory store's git transport. */
|
|
163
169
|
export declare class MemorySync {
|
|
164
170
|
private readonly options;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cross-memory",
|
|
3
3
|
"description": "Cross-session memory for the DeepSeek Harness: project-scoped and global memories with an explicit memory tool, idle-time background extraction, consolidation, and layered summary injection",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|