dsh-memory-watch
Warns the session to flush what matters before context compaction kicks in, and rolls long ledgers (a home ledger, an outside work note, and a second day-per-section book) into frozen archives with a one-line digest per moved section — which section is oldest is decided by its title date, not by its position in the file. An optional startup probe records version, this build's own hash and each run's outcome.
설치
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:hzh5021/dsh-memory-watch配置
| 键 | 默认 | 说明 |
|---|---|---|
home | "" | 账本所在目录;空 = 不碰磁盘(也可用环境变量 DSH_MEMORY_WATCH_HOME) |
ledger | "长期记忆库.md" | home 下的相对路径,那本按 ## 分节的账 |
archiveDir | "记忆档案" | home 下的相对路径,搬走的原文落这儿 |
enabled | true | false = 提醒和磁盘动作一起停 |
highRatio | 0.7 | 占窗口这个比例就直接提醒(0.05–1) |
floorRatio | 0.45 | 低于它完全不打扰(0–1) |
minGrowthTokens | 24000 | 两次提醒之间至少要长这么多(0–5,000,000) |
cooldownMs | 300000 | 两次提醒之间的最小间隔,毫秒(0–24 小时) |
absoluteFallbackTokens | 90000 | 拿不到窗口信息时的绝对兜底线;0 = 关掉(0–50,000,000) |
keepSections | 12 | 压账时最新的这么多节原样留着(1–10000) |
minArchiveSections | 6 | 可搬的旧节少于这个数就不动(1–10000) |
shrinkMinRatio | 0.05 | 压完没瘦够这个比例就原样返回(0–1) |
maxCondensedLines | 3 | 一条提要最多几行(1–50) |
maxCondensedChars | 600 | 一条提要最多多少字符(40–10000) |
sectionMaxChars | 20000 | 单节超过这个长度就整本不动,交人工看(200–1,000,000) |
worknoteFile | "" | 家目录之外的另一本笔记(绝对路径);null = 不管它 |
worknoteArchiveDir | "" | 那本笔记的档案目录(相对 home 解析) |
worknoteKeepSections | 20 | 那本笔记留最新多少节不动(1–10000) |
mistakesFile | "错题集.md" | 第二本账(一天一节、一节底下是若干条);null = 不管它 |
mistakesArchiveDir | "记忆档案" | 第二本账的档案目录(相对 home 解析) |
mistakesKeepSections | 8 | 第二本账留最新多少节不动(1–10000) |
mistakesMinArchiveSections | 2 | 它可搬的旧节少于这个数就不动(1–10000) |
mistakesCondensedLines | 6 | 它一节留几行提要(1–50) |
probeFile | "" | 启动探针写到哪儿;空 = 不写。建议放工作区,别放账本目录 |
archiveDir / worknoteArchiveDir 用相对 home 的路径,写绝对路径也认。
- id: memory-watch
name: dsh-memory-watch
config:
home: /path/to/your/notes
ledger: ledger.md
archiveDir: archive
highRatio: 0.7