wk544863858/dsh-plugin-magic-context ↗★ 0
dsh-plugin-magic-context
提供可逆上下文回收与历史记录器 适合需要优化上下文占用、接管压缩引擎或管理项目记忆的用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:wk544863858/dsh-plugin-magic-context说明文档
阅读完整 README ↗配置
改配置有两种途径,语义不同(详见配置界面契约):
- GUI 设置卡片:暴露
policy.*(含 historian 生成上限 / 上限抬升 / 超时)、historianEnabled、registerCompactionEngine、journal.*等 volatile 字段。写回走 settings 链路:非 volatile 键原样保留、未触碰的字段不会 materialize 进覆盖行——保存即生效 (host 侧读取一律经liveNumber/liveBoolean/liveString在决策点现取)。 - 手写 profile 覆盖行:
config是整体替换包内 patch 的 config,不是深合并。只写memory:会把registerCompactionEngine: false抹掉。手写覆盖时必须把要保留的键一并写出。
bundle 自带配置只有一行:registerCompactionEngine: false(保守首装——只做回收与 historian,
宿主压缩引擎保持原位)。要接管压缩时:
- id: magic-context-dsh
name: 'dsh-plugin-magic-context'
config:
registerCompactionEngine: true
memory: {} # 空对象即启用记忆车道:身份/工作区/共享类别全部自动解析
- id: compaction-basic
name: '@deepseek-ai/dsh-compaction-basic'
disabled: true # 二者互斥,接管时必须同时禁用宿主引擎
配置参考(完整类型见 src/dsh/config.ts;除注明外均为 profile 覆盖行可写):
| 组 | 键(默认值) | 说明 |
|---|---|---|
| 总开关 | enabled (true) · registerTools (true) · registerStatusCommand (true) · sessionNotices (true) · reduceGuidance (true) · searchHint (true) | enabled: false 保持加载但完全惰性;sessionNotices 控制会话流内的管理提示行 |
| 压缩接缝 | registerCompactionEngine(代码默认可解析即挂;bundle 随发 false)· compactionBase(宿主注入基类) | 接管需同时禁用 compaction-basic;pre-step 每步 reconcileEngine 动态挂/卸 |
| 压力策略 | policy.*:executeThreshold (65) · forceThreshold (85) · ttlMs (5 min) · assumedContextWindow (256k) · protectedToolResults (8) · historianTimeoutMs (120 s) · historianMaxTokens (8192,低于会被抬到 8192) · historianMaxTokensCeiling (32768) · baselineTokens (2000) · memoryBudgetTokens (8000) · memoryLimit (40) · forceWaitReadyMs (0) | 阈值在下一个决策点生效(含 /ctx-status 与 compaction engine 路径)。compartmentGuardMode / compartmentEntrantTokens(发布护栏)已于 2026-10-16 退役,不再是可配置项 |
| historian | historianEnabled (true) · historian.{provider, model}(默认会话最后路由的模型) | 带外运行;verify 之外的唯一 LLM 消耗点 |
| 项目记忆 | memory.{}:enabled · dbPath · project(省略用会话 cwd)· domainProjects · shareCategories · autoPromote (true) · write (true) | memory: {} 即可用;write: false 让 ctx_memory 退回只读 |
| 检索 / 向量 | memory.embedBackfill (true,查询侧内嵌补分) · memory.vectorBackfill (true,维护 tick 回填) · memory.vectorBackfillLimit (24 行/tick) | 向量车道任何失败 fail-open 降级 FTS |
| S(t) 衰减 | memory.scoring.{enabled (true),alpha (0.4),beta (0.2),archiveThreshold (2),halfLives} | 统计恒收集;2026-10-13 分发缺省起 enabled=true 接管排序;profile-JSON only,不进设置卡片 |
| 全局域 | memory.global.machine.{enabled (true),excludeProjects,autoStage (true)} · memory.global.user.{render (true),collect (true),review (true)} · memory.global.review.batchLimit (50) | 分发缺省全开(2026-10-13):入队可自动化(≤3 条/pass、≥10 候选待审时暂停),发布永远是人;LLM 分类失败 fail-closed |
| 用户画像 | memory.global.user.{render (true),collect (false),review (false)} | 读 / 收集 / 评审三半独立;写共享库的两个半边默认关 |
| 域解析 | memory.domains.source (adapter | contract) | contract 是对照用的回退杆,不是支持终态 |
| 维护 | maintenance.{enabled,intervalMs (30 min),verifyProvider,verifyModel} | LLM verify 需显式路由(未钉则跟随主对话最新路线) |
| 观测 | journal.{enabled (true),level (info),retentionDays (30),mirror (true)} · tags.retentionDays (30) | level/mirror 对下一条写入生效;挂载时就是 off 的 journal 运行中打开需重启;retentionDays 有 min(1) 下限防误剪 |