@shion-lab/dsh-plugin-memory
August 15, 2026 ยท View on GitHub
Industrial-grade 4-tier persistent memory, self-correction, and cognitive defense engine for DeepSeek Harness (
dsh).Featuring Git-tracked Markdown storage, dense vector semantic search, red-light pollution guards, polarity conflict detection, and half-life recency decay.
Distilled from the battle-tested memory dynamics of desktop companion AI system Shion (็ดซ่).
๐ Why dsh-plugin-memory? / ไธบไปไน้่ฆ็ซไฝๆไน
่ฎฐๅฟไธ่ช็้ฒๆค๏ผ
By default, DeepSeek Harness operates in a stateless manner: once a session closes, all project-specific architectural rules, user preferences, and hard-earned debugging lessons are lost.
Furthermore, naive memory plugins suffer from memory pollution, hallucinations, and polarity conflicts (e.g. saving stack traces or conflicting rules).
@shion-lab/dsh-plugin-memory introduces a production-grade 4-tier cognitive architecture directly ported from companion agent practices (ๆ็ผ่ชไผด้ๅผๆบ่ฝไฝใ็ดซ่ใๅฎๆ่ฎฐๅฟไฝ็ณป):
- ๐ก๏ธ Tier 1: MemoryGuard (Red-light Anti-Pollution Gate):
- Strictly blocks stack traces (
Traceback...), test runner output (pytest PASSED/FAILED), diff blocks, and API secrets (sk-...) from polluting memory.
- Strictly blocks stack traces (
- โ๏ธ Tier 2: MemoryConflictDetector (Subject & Polarity Resolution):
- Automatically identifies and resolves contradictory rules on the same subject (e.g.
forbid tailwindvsrequire tailwind), archiving outdated rules and preventing split-brain directives.
- Automatically identifies and resolves contradictory rules on the same subject (e.g.
- ๐ Tier 3: Git-Tracked Markdown Knowledge Base (
.dsh/MEMORY.md):- Human-in-the-loop, version-controlled repository conventions with
[โ Verified]test-passed badges.
- Human-in-the-loop, version-controlled repository conventions with
- ๐ง Tier 4: Dense Vector Hybrid Vitality Engine (
.dsh/memory_store.json):- Dense Vectors: Cosine similarity semantic search (OpenAI / Ollama).
- Recency Decay: 30-day half-life exponential decay.
- Frequency Reinforcement: Automatically reinforces frequently accessed wisdom.
- Dream Consolidation (
dream()): Background clustering and duplicate merging.
๐ฆ Installation
npm install -g @shion-lab/dsh-plugin-memory
๐ Quick Start
Mode A: Lightweight Zero-Config (Markdown-only)
Add to cordis.yml:
plugins:
"@deepseek-ai/dsh": {}
"@shion-lab/dsh-plugin-memory":
storagePath: ".dsh/MEMORY.md"
autoRecall: true
maxRecallChars: 3500
Mode B: Full Semantic Hybrid Vector Engine (with Ollama or OpenAI embeddings)
plugins:
"@deepseek-ai/dsh": {}
"@shion-lab/dsh-plugin-memory":
storagePath: ".dsh/MEMORY.md"
topK: 6
embedding:
enabled: true
provider: "ollama" # or "openai-compatible"
apiBase: "http://localhost:11434"
model: "nomic-embed-text"
dimension: 768
๐ ๏ธ API & Tool Calling Reference
remember(topic, content, options): Persists rule with red-light checks, conflict resolution, and optional{ verified: true }certification.correct(topic, newContent, reason): Explicitly corrects or supersedes outdated knowledge, recording an audit trail.recall(query, topK): Hybrid RRF recall with verification bonus and recency decay.dream(): Consolidates duplicate fragments and optimizes memory budget.forget(topic): Deletes specified memory item.
๐ License
MIT ยฉ Shion Lab