@tr1v3r/dsh-ltm
Structured long-term memory for DeepSeek Harness: CJK-aware tokenized search, hybrid rerank, dedupe, expiry review, and migration from dsh-memory — zero mandatory network 适合需要本地化、无网依赖的长期记忆搜索与去重管理。
Install
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:tr1v3r/dsh-ltmREADME
Read the full README ↗Configuration
| key | default | meaning |
|---|---|---|
path | (required) | SQLite file, or :memory: |
defaultScope | "" | fallback scope, or fixed scope when automatic detection is disabled |
autoProjectScope | true | derive the active project from each agent session's cwd/Git repository |
escapeSequences | [] | optional output sequences broken with a zero-width space before prompt rendering |
promptRecentCount | 10 | unpinned recent memories in the recall section |
promptMaxChars | 2000 | hard UTF-16 character budget of the section; pinned survive first |
promptMaxTokens | (unset) | optional positive safe-integer hard token cap, alongside characters |
promptTokenizerPath | (unset) | local supported Hugging Face tokenizer.json; required together with promptMaxTokens |
maxTextChars | 2000 | max characters per memory |
searchLimitDefault / searchLimitMax | 10 / 50 | search result limits |
promptOrder | 50 | recall section order |
dedupeThreshold | 0.8 | Jaccard similarity ≥ this marks a near-duplicate on write |
dedupeCosineThreshold | 0.92 | cosine similarity ≥ this also marks a near-duplicate |
staleAfterDays | 90 | memories unconfirmed for this long render as stale |
Memory text is preserved exactly in recalled prompts by default. escapeSequences is an explicit deployment-level opt-in for environments that pass rendered prompts through an additional delimiter-based parser; DSH itself does not require it.
Invalid values (empty path, non-integer bounds, thresholds outside [0,1], escape sequences shorter than 2 chars or containing a zero-width space) throw at plugin load — fail loud, not at first tool call.
Automatic project isolation
With autoProjectScope: true, every agent resolves its own session.header.cwd; the shared DSH process cwd is never used. A Git checkout is identified by its canonical common Git directory, so subdirectories and linked worktrees share one project scope. A non-Git workspace is identified by its canonical directory. Git scope names contain only a short SHA-256 digest so every linked-worktree layout stays identical; directory scopes also include a readable basename. Absolute paths are never stored.
Model-facing defaults are intentionally narrow:
- writes and near-duplicate checks use the active project scope;
- search and automatic prompt recall see only the active project plus global memories (
scope=""); - update, forget, confirm, and merge reject records outside those visible scopes, and merge never crosses scope boundaries;
memory_listand the CLI remain explicit cross-project aggregation/administration surfaces.
Set autoProjectScope: false to use only defaultScope as a fixed deployment scope (use "" for global-only operation). Scope is a context-isolation boundary, not an operating-system permission boundary; anyone with direct access to the SQLite file or CLI can still administer every record.
Optional offline prompt token budget