ICCuse/dsh-premise-guard
Post-compaction premise-drift guard plugin for DeepSeek Harness: after a compaction summary drops a critical literal anchor it injects a one-shot notice telling the model what it may have lost and how to recover it
已收录
0
Memory
Bundle 已验证
预览
功能介绍
压缩后前提漂移守卫:摘要丢失关键字面锚点时注入一次性提醒。
适合
- 适合使用上下文压缩、且依赖精确路径、字面量、键值对或错误码的长 DSH 会话。
- 适合需要在压缩摘要遗漏关键字面锚点时立即收到提醒的工作流。
- 适合希望通过确定性方式检测前提漂移、又不增加 LLM 调用或存储的团队。
不适合
- 不适合不使用上下文压缩,或不依赖精确字面细节的会话。
- 不适合丢失内容主要是语义信息、无法表示为所提取字面锚点的情况。
- 不适合需要持续强制约束的工作流;每次检测到的告警只会注入一次提醒。
README
@deepseek-ai/dsh-premise-guard
| 中文 | English |
Post-compaction premise-drift guard. After a compaction/summary event, it extracts distinctive literal anchors (file paths, quoted literals, key=value pairs, error codes) from the shadowed span’s text, checks whether the committed summary still contains them, and — when a critical anchor vanished — injects a one-shot notice into the next step telling the model what it may have lost and how to recover it from the append-only log.
Why
Recall-oriented designs (recallable-compaction, session-query tools) make shadowed content reachable when suspected. Nothing says “you just dropped a key fact”. This guard turns the compaction summary into a checked handoff: the model learns the moment a path, value, or error string it was relying on is no longer in the summarized context.
How it works
| Hook | Role |
|---|---|
session/event (compaction/summary) |
Re-derives the shadowed span’s text from shadowedSeqs (the log keeps every byte), extracts anchors, and compares against event.data.summary. |
agent/pre-step |
Injects one notice (plugin source) naming up to maxAnchors vanished anchors and the shadowed seq range, once per alarm; a new user prompt skips delivery. |
Anchor extraction is deterministic and pure — no LLM calls, no new storage.
Config
| Field | Default | Meaning |
|---|---|---|
maxAnchors |
5 |
Vanished anchors named in one notice. |
minAnchorLength |
6 |
Anchors shorter than this are never critical. |
maxNoticeChars |
400 |
Notice text cap. |
All three must be integers >= 1; misconfiguration throws at plugin load.
Install
Not on npm yet - install from this repository:
npm install github:ICCuse/dsh-premise-guard
# or: pnpm add github:ICCuse/dsh-premise-guard
Then mount the bundle (declared in package.json ‘dsh.bundle’):
- id: dsh-premise-guard
name: 'dsh-premise-guard'
Or, once published, ‘dsh plugin –profile web add dsh-premise-guard’.
常见问题常见问题
在启用了 DSH 的终端中执行已验证命令 dsh plugin --profile default add github:ICCuse/dsh-premise-guard。命令会解析公开 package 元数据,并保持插件与本页展示的目录身份一致。
兼容性以页面上展示的 bundle 与 profile 状态为准。如果某个 profile 尚未检测到,请先保持禁用,并在生产启用前阅读仓库文档。
GitHub 链接和 activity 元数据是 release 与维护状态的来源。新版本发布后重新查看本页,确认目录已经观察到最新版本。