@nanmicoder/dsh-memory
Long-term memory system for DeepSeek Harness: two-phase extraction/consolidation pipeline over session logs, with summary injection and memory tools
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:yan5236/dsh-memory说明文档
阅读完整 README ↗English · 简体中文
dsh-memory · Long-term memory plugin for DeepSeek Harness
A two-phase memory pipeline (per-session extraction → global consolidation), a summary that is always injected into new sessions, and four on-demand retrieval tools.
Why long-term memory
Without memory, every session restates user preferences and re-steps known landmines.
dsh-memory extracts durable knowledge from finished sessions and periodically consolidates it
into a dense navigation summary (injected into every session) plus a grep-friendly handbook, so
future sessions need fewer repeated instructions, waste fewer tool calls, and avoid known
failure modes.
The design is adapted from the Codex memories system (two-phase extraction/consolidation, three-layer artifact layout, job claims, cooldown, redaction) and re-composed for DSH: no SQLite, no git baseline, no resident consolidation subagent.
Features
- 🧠 Phase 1 per-session extraction: after a session turns stop (debounced, 3 min default),
its log is read, filtered, rendered, and redacted, then a model extracts structured memory
(
raw_memory+rollout_summary+slug). Low-signal sessions produce an empty no-op. - 🧩 Phase 2 global consolidation: on a cooldown (6 h default) the new raw memories are
merged into
MEMORY.md(handbook) andmemory_summary.md(dense index, exactv1first line); raw input is rotated into an archive and never consolidated twice. - 📥 Always-injected summary:
memory_summary.md(hard size cap) is injected through the system prompt of every session — zero effort for the model to see the index. - 🔍 Four memory tools:
memory_list/memory_read/memory_search/memory_add(writes only on explicit user request). - 🔒 Safety discipline: session content is treated as data, never instructions; secrets are redacted on both input and output; memory paths are confined to the memory root.
- 🔁 Reliable scheduling: one durable claim per session (KV-persisted); restarts never re-extract or double-consolidate; failures retry with backoff; orphaned claims recover.
- ⚙️ Settings page: Settings → Long-term memory for stats, manual runs, and config.
How it works
turn end ──► Phase 1 (per session) ──► rollout_summaries/.md + raw_memories.md
│
(cooldown elapsed / new memories)
▼
Phase 2 (global)
│
┌─────────────────────────────┴────────────────────────────┐
▼ ▼
memory_summary.md (injected into every session) MEMORY.md (searched on demand)