gezi-wen/sage-mem ↗★ 19

sage-mem

Cross-session memory for DeepSeek Harness — plain markdown files, no database, no worker. 适合需要持久化跨会话上下文,且不希望使用数据库的轻量用户。

Package
sage-mem
Compatibility
Unverified
Harness peer range
>=0.1.2-rc.1
Cordis peer range
^4.0.2
Version
1.9.2
License
Apache-2.0
Last updated
Oct 26, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:gezi-wen/sage-mem

Configuration Reference

Environment Variables

VariableDefaultDescription
SAGE_MEM_DIR~/.sage-mem/memorymemory directory
SAGE_MEM_STATE_DIR`
/.sage-mem`state directory (configuration, ledger, locks, conflict queue, rollback points)
SAGE_MEM_MAX_SESSION_BYTES61440 (60 KiB, 4096–524288)total injection cap per session
SAGE_MEM_MAX_RESULTS10 (1–30)cap on the number of candidate items injected per turn
SAGE_MEM_MAX_CHARS1500 (200–20000)character cap for a single memory's injection
SAGE_MEM_MAX_BASELINE8 (1–50)number of baseline slots
SAGE_MEM_STALE_DAYS1 (0–365)threshold for marking a heading 「保存于 N 天前」(saved N days ago); 0 = mark every one
SAGE_MEM_TASK_IDemptyscope of task checkpoints; empty falls back to the session id
SAGE_MEM_DEBUGoffdebug logging; when on, the panel's 工具 ▾ → 注入调试 shows the last 8 injection attempts (read-only, never written to disk)

Value semantics: out-of-range values are clamped to the boundary, illegal values (including pure whitespace) fall back to the default.

What the Settings Page Can Change

The panel can change the five caps above (written to /settings.json, precedence settings page > environment variable > built-in default), as well as reserved names (file names that are protected and that the settings page may not write or delete, written to /reserved.json). Some items take effect only after restarting DSH, and the panel writes out both the value in effect now and the value after restart.

Files in the State Directory

FilePurpose
access.jsonaccess ledger (injected / read / use)
conflicts/.jsonwrite conflicts awaiting manual handling
tasks//WORKING.mdtask checkpoints
settings.json / reserved.json / locked.jsonsettings, reserved names, locks
autodream.json, autodream/autodream configuration, snapshots, run records
dream.jsonthe legacy name, read once only during migration

Apart from access.json, conflicts/ and tasks/, the rest is internal implementation state, and its format may change in minor versions; do not depend on it.