Zhang-Zhengyuan/dsh-memory-amem ↗★ 1
@zhang-zhengyuan/dsh-tool-memory-amem
A-MEM style long-term memory for DeepSeek Harness with guarded auto-capture, hybrid retrieval, prompt recall, four model-facing memory tools, and a four-stage admission gate (rule filter + semantic dedup + trust score + retrieval-time rerank hook) tuned against the OWASP ASI06 memory-poisoning family.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Zhang-Zhengyuan/dsh-memory-amem说明文档
阅读完整 README ↗Configuration
All options come from the config: block in a later cordis patch; the plugin
resolves and validates the defaults itself. Override per-host via
~/.dsh/cordis.patch.yml (see DSH patch format):
| Option | Default | Description |
|---|---|---|
storageDir | ~/.dsh/memory-amem | Where notes live (one JSON per note + index.json). |
retrievalK | 10 | Top-k neighbors for system-prompt injection and search. |
hybridAlpha | 0.5 | BM25 ↔ semantic blend weight (0 = pure BM25, 1 = pure semantic). |
enableEvolution | true | Run LLM evolution only when relevant neighbors exist. |
enableAutoConsolidation | true | Consolidate exact duplicates instead of storing another note. |
enableAutoCapture | true | Capture only real DSH messages with source kind: user. |
enablePromptInjection | true | Inject bounded notes marked explicitly as untrusted historical data. |
memoryScope | global | global cross-session recall, or session isolation. |
maxLinksPerNote | 5 | Cap outbound links. |
maxMemoryChars | 12000 | Maximum accepted note/message length. |
promptMaxChars | 4000 | Hard bound for the complete memory prompt section. |
flushIntervalMs | 5000 | Serialized background flush interval in milliseconds. |
embeddingModel | tfidf-lite | Retriever backend (only tfidf-lite ships in v0.2.0). |
llmModel | auto | First discovered model, a model id, or provider:model. |
admission.* | enabled:true, minLength:8, maxLength:2000, ... | v0.3.0 admission gate (see below). |
The admission block is a namespace; accepted keys are listed below.
admission.* key | Default | Description |
|---|---|---|
enabled | true | Master switch. Set to false to bypass the gate and store every candidate. |
minLength | 8 | Below this length (after trim) the candidate is soft_skipped. |
maxLength | 2000 | Above this length (after trim) the candidate is hard_blocked. |
sensitivePatterns | [] | Extra raw regex patterns promoted to hard_block (e.g. \\binternal-token-\\d+). |
ephemeralPatterns | [] | Extra raw regex patterns promoted to soft_skip (e.g. ^\\[scratch\\]). |
keepPatterns | [] | Extra raw regex patterns promoted to hard_keep (e.g. \\bonly use Hono\\b). |
poisonPatterns | [] | Extra raw regex patterns promoted to hard_block against memory-poisoning attacks. |
semanticDedupThreshold | 0.85 | Top-1 neighbour score above which a near-duplicate is consolidated. Set to 1.0 to disable. |
semanticDedupMinOverlap | 0.4 | Minimum Jaccard keyword overlap (in [0, 1]) the candidate must share with the top-1 neighbour. |
enableLlmReview | false | Reserved for v0.4.0. When true, the uncertain region is forwarded to a cheap LLM classifier. |