Zhang-Zhengyuan/dsh-memory-amem1

@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.

包名
@zhang-zhengyuan/dsh-tool-memory-amem
版本
0.3.0
许可证
MIT
最近更新
2026年8月16日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Zhang-Zhengyuan/dsh-memory-amem

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):

OptionDefaultDescription
storageDir~/.dsh/memory-amemWhere notes live (one JSON per note + index.json).
retrievalK10Top-k neighbors for system-prompt injection and search.
hybridAlpha0.5BM25 ↔ semantic blend weight (0 = pure BM25, 1 = pure semantic).
enableEvolutiontrueRun LLM evolution only when relevant neighbors exist.
enableAutoConsolidationtrueConsolidate exact duplicates instead of storing another note.
enableAutoCapturetrueCapture only real DSH messages with source kind: user.
enablePromptInjectiontrueInject bounded notes marked explicitly as untrusted historical data.
memoryScopeglobalglobal cross-session recall, or session isolation.
maxLinksPerNote5Cap outbound links.
maxMemoryChars12000Maximum accepted note/message length.
promptMaxChars4000Hard bound for the complete memory prompt section.
flushIntervalMs5000Serialized background flush interval in milliseconds.
embeddingModeltfidf-liteRetriever backend (only tfidf-lite ships in v0.2.0).
llmModelautoFirst 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.* keyDefaultDescription
enabledtrueMaster switch. Set to false to bypass the gate and store every candidate.
minLength8Below this length (after trim) the candidate is soft_skipped.
maxLength2000Above 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.
semanticDedupThreshold0.85Top-1 neighbour score above which a near-duplicate is consolidated. Set to 1.0 to disable.
semanticDedupMinOverlap0.4Minimum Jaccard keyword overlap (in [0, 1]) the candidate must share with the top-1 neighbour.
enableLlmReviewfalseReserved for v0.4.0. When true, the uncertain region is forwarded to a cheap LLM classifier.