dearbld/dsh-living-memory ↗★ 2

dsh-living-memory

Living memory for DeepSeek Harness — self-tending knowledge base: nightly patrol, temporal decay, RRF hybrid recall, knowledge graph, telemetry. Built by 暖暖 (NuanNuan). 适合需要长期记忆管理和复杂知识检索的深度用户。

패키지
dsh-living-memory
호환성
미검증
버전
0.2.10
라이선스
MIT
최근 업데이트
2026. 9. 25.

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:dearbld/dsh-living-memory

Configuration reference (0.2.7)

Everything is environment-variable driven — no config file required. All knobs live under the LEGION_ prefix and ship with sane defaults, so the plugin is fully functional with zero configuration. Set a variable only when you actually want to change that behavior.

Models & retrieval tuning

VariableDefaultWhat it does
LEGION_EXTRACT_MODELdeepseek-v4-flashModel used for auto-extraction of memories from conversation.
LEGION_SPOKEN_MODELdeepseek-chatModel used to generate colloquial query prefixes (bridges "how users ask" vs "how notes are written").
LEGION_RERANK_MODELgte-rerank-v2Online rerank model for precision re-ordering of hybrid results.
LEGION_RERANK_TOPN20How many re-ranked entries feed back into the fused ranking.
LEGION_RERANK_CAND50Candidate pool size handed to the reranker.
LEGION_EXTRACT_TIMEOUT_MS120000Per-request timeout for the extraction call (added in 0.1.5 — bounds the global extraction lock).
LEGION_INSTRUCT_TEXT(built-in)Override the instruction sent with query-side embeddings.
LEGION_VEC_ON(off)Vector channel master switch: unset = fully off (zero embedding calls), query = query-side only, 1 = query + write-time embedding + nightly backfill.
LEGION_VEC_BF_BUDGET600Per-patrol backfill budget for embedding entries that predate the vector channel (0–2000; 0 = explicitly off).

Feature switches — set to 1 to disable

Each subsystem can be turned off independently. Useful for debugging, A/B comparison, or running a minimal setup:

SwitchDisables
LEGION_AUTORECALL_OFFPer-turn automatic recall injection into the prompt.
LEGION_RERANK_OFFThe online rerank layer (falls back to pure hybrid ranking).
LEGION_INSTRUCT_OFFQuery-side embedding instruction.
LEGION_EPISODIC_OFFThe read_episodic source-replay action.
LEGION_ENTITIES_OFFCross-entry entity hop injection.
LEGION_GENERALIZED_OFFCommunity-based generalized recall injection.
LEGION_SEMANTIC_EDGE_OFFSemantic-neighbor edge building during nightly consolidation.
LEGION_SEMANTIC_DEDUP_OFFSemantic duplicate detection (cosine ≥ 0.92).
LEGION_VALIDATED_OFFValidated-count reinforcement (repeated knowledge ranks higher).
LEGION_FADEMEM_OFFValidation-slowed forgetting (validated entries decay slower).
LEGION_RELEVANCY_OFFHit-based relevancy counterweighting.
LEGION_COMPACT_BRIDGE_OFFCompaction anchors (facts preserved across context compression).
LEGION_BACKLOG_OFFNightly backlog sweeping of un-extracted sessions.
LEGION_SIGNALS_OFFTool-error / user-correction trigger signals.
LEGION_STAMP_OFFAutomatic supersede-stamping on contradiction detection.
LEGION_PRECLASSIFY_OFFConflict pre-classification.
LEGION_RESOLVE_OFFEntity resolution (merging same-entity mentions).
LEGION_SPOKEN_OFFSpoken-prefix generation entirely.
LEGION_SPOKEN_BOOST_OFFThe seat-bonus for spoken-prefix matches.
LEGION_PPR_QUERY_OFFQuery-side Personalized PageRank boost.
LEGION_VEC_FALLBACK_OFFVector-channel fallback path.
LEGION_A25_OFFPersistence of the extraction buffer across restarts.
LEGION_A12_OFFMessage-level watermark (dedup across extraction runs).
LEGION_A14_OFFWrite-time embedding (vectors become available on next patrol instead).
LEGION_MIRROR_WM_OFFIncremental MEMORY.md mirroring.
LEGION_KNOWN_FIXES_OFFKnown-hallucination correction hints in the extraction prompt.
LEGION_USAGE_WEEKLY_OFFWeekly usage summary generation.
LEGION_DECAY_LEGACYSet to 1 to revert to the single-tier decay curve.
LEGION_SPACEGATE_OFFThe per-space write gate (mainly for test rigs).
LEGION_TIMELINE_DAY_OFFThe timeline day parameter (per-day reading); with this set, day is rejected with an explicit message.

Debug & maintenance

VariableWhat it does
LEGION_INJECT_PROBESet to 1 to log every assembled injection to /tmp/inject-probe.log (zero overhead when off).
LEGION_DRILL_PATROLSet to 1 to force one full nightly-patrol run immediately on load (drill/testing only).
LEGION_SEARCH_PROF_ONSet to 1 to log one search-prof line per search with per-segment timings (FTS/co-occurrence+PPR/entity-hop/generalization/assembly; zero overhead when off).

Paths & data files

VariableDefaultWhat it overrides
MEMORY_DB_PATH~/.dsh/dsh-living-memory/memory.sqlite3Database location.
LEGION_GUARD_RULES_PATH~/.dsh/dsh-living-memory/guard-rules.jsonYour full guard-rules file (see the section above).
LEGION_DICT_EXTRA_PATH~/.dsh/dsh-living-memory/dict-extra.jsonExtra dictionary entries for the tokenizer.
LEGION_SNAPSHOT_DIR~/.dsh/dsh-living-memory/snapshotsNightly snapshot directory (7-day rotation).
LEGION_MODULE_SCAN_DIR~/.dsh/dsh-living-memory/modulesDirectory scanned for per-space auto-registration.
LEGION_SURGERY_FLAG_PATH…/surgery.flagWhile this file exists, patrol and writes are suspended (maintenance mode).

Credentials

Keys are not environment variables — they live in the DSH credential manager:

  • DEEPSEEK_MEMORY_KEY — API key for extraction & spoken-prefix models.
  • EMBEDDING_BAILIAN_KEY — API key for the vector + rerank channel (optional; without it the plugin runs on the keyword channel only).