Introduction¶
DSH sessions are short, but your work isn’t. Every turn, the model has to get to know you all over again: the pitfalls you’ve hit, the conventions you’ve set, the bugs you’ve fixed—all gone once the chat ends. This plugin turns “memory” into a layer of infrastructure, letting the model auto-recall context based on each turn’s input, while ensuring memory reliability and traceability through a “review-before-record” workflow and an audit chain.
What Is This¶
z9134/dsh-sixlayer-memory is a local memory foundation plugin, currently at version 2.0.4. It is maintained by z9134 and categorized under “Memory.”
Core value: review-before-record with an auditable local memory. Each turn auto-recalls based on input; uncertain information never becomes fact outright; every action is traceable end-to-end.
Core Capabilities¶
Six-Layer Memory Architecture¶
L0 Constitution / L1 Shared / L2 Contextual / L3 Personal / L4 Runtime / L5 Archive. The write pipeline includes: trust assessment → poisoning pre-filter → S/A classification → content deduplication → persistence → audit.
Gate Axiom and S-Level Isolation¶
Non-trusted AND not a direct user input AND not a legacy_import → pending; becomes trusted only after review. Credentials/privacy are always S-level; injection, retrieval, association, and API responses never carry S-level content.
Hash Chain Audit¶
One JSONL entry per write/read/injection. Chain breakage is detectable (mem_audit).
Per-Turn Lifecycle (new in 2.0)¶
- Auto-recall:
agent/pre-stephook—this turn’s direct user input → FTS5 search → matched entries inserted as a single user message before the question; S-level/tainted entries are never included. - Candidate sedimentation:
turn/endextracts sentences containing markers like “going forward / always / remember / agreement / my habit” → written via the tool channel → Gate Axiom → pending for review. - Usage reinforcement: on recall hit, α += 0.02 (capped at 1), and an op=recall audit entry is logged.
Semantic Recall (Optional)¶
Synonymous rephrasings (“that memory usage issue from last time” → “RSS peak investigation”) can’t be retrieved by bigrams alone. Enabling semantic recall adds a vector-based layer: candidate pool = lexical hits ∪ cosine similarity over indexed records, blended and ranked by weight.
Cognition Layer¶
Emotion tagging: neutral / positive / negative / urgent, with valence and arousal scores. Importance: baseline + emotion intensity + hierarchy bonus. Association via mem_associate: from A to B, each result carries a reason and a weight.
Collaboration & Observability¶
mem_handoff / mem_check: cross-session handoff and size health checks. mem_dispatch / mem_receipt / mem_task / mem_scope: state machine sent→delivered→acked→done. Dashboard: Overview / Search / Pending Review / Handoff / Dispatch / Observability / Audit.
External Interfaces¶
Memory service: ctx.memory.recall/remember/forget/status (in-process). HTTP API: 127.0.0.1:47810, token-authenticated, read-only by default (status/recall/read). QQ: driven by the official Tencent plugin @tencent-connect/dsh-qqbot, which powers the agent; the agent ships with mem_* tools built in.
Installation & Activation¶
Install via the marketplace / npm:
dsh plugin --profile desktop add dsh-sixlayer-memory
Configuration example (profiles/desktop/cordis.patch.yml):
- insert:
- id: memory-core
name: dsh-sixlayer-memory
config:
dataDir: 'D:\001\CH002\dsh-memory-data'
authority: shadow
api:
enabled: true
token: ''
allowWrite: false
port: 47810
Restart DSH and you’re set.
Typical Usage¶
- Run checks (mandatory):
npm run check # = 8 preflight items + 19 regression suites
- Self-check within 30 seconds after restart:
mem_admin_catalog # 29 tools = load confirmed
mem_audit({ deep: true }) # hash chain integrity
mem_check() # size health check
- View the dashboard: Settings → Memory Foundation; the “Memory” tab in the chat top bar; the entry card in the right sidebar (placed alongside dsh-context’s Context panel).
Use Cases & Notes¶
Well-suited for agent development scenarios that require long-term memory, auditability, and traceability.
Note that the plugin runs with the current dsh process privileges. Review the source code and license before installing. The plugin requires Node >=22.5 and DSH >=0.2.0-rc.1 <0.3.0-0.
Closing¶
This plugin turns “memory” into an infrastructure layer: auto-recall each turn based on input, candidate sedimentation flows through the Gate Axiom into the pending-review queue, and every action is backed by an auditable hash chain. Ideal for agent development scenarios that demand reliable long-term memory and full traceability.
Catalog page: https://www.skillhub.cn/plugins/z9134/dsh-sixlayer-memory
GitHub: https://github.com/z9134/dsh-sixlayer-memory