按需取回薄层:context_query / context_slice / context_grep 三个工具读取已持久化的历史,引用可回放。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:EvilIrving/dsh-context-proxy
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Thin on-demand context-retrieval layer for the DeepSeek Harness.
Automatic truncation, spill-to-disk, compaction, and token metering are already
owned by output-retention, spill-policy, compaction-basic, and
session-query. This package adds only the missing piece: three model-facing
tools that read already-persisted history back on demand.
Install
dsh plugin --profile <name> add github:EvilIrving/dsh-context-proxy
Or, from a checkout:
dsh plugin --profile <name> add ./dsh-context-proxy
The bundle patch inserts one plugin row (dsh-context-proxy). sessionQuery
and subprocess are optional backends (ctx.get): without a sessionQuery
backend each tool degrades to an isError result instead of waiting forever.
Tools
| Tool | Backing seam | Returns |
|---|---|---|
context_query |
sessionQuery.filterEvents |
lightweight { seq, type, text } matches by seq/type/surface/text |
context_slice |
sessionQuery.readEvent |
one event plus a bounded before/after window |
context_grep |
subprocess (packaged rg) or sessionQuery.filterEvents |
matches with { text, citation } |
Citations are replay-safe: context_query/context_slice cite session:<seq>
(rebuildable from the canonical log), and context_grep cites either a spill
path (path:line, fast local path) or session:<seq> (semantic-text fallback
when no spill path is supplied or available).
Config
export interface Config {
readWindowDefault: number // default before/after for context_slice (default 0)
grepMaxBytes: number // rg stdout in-memory cap (default 1 MiB)
rgGraceMs: number // rg termination grace (default 5000)
}
Dependencies
sessionQueryandsubprocessare optional services read viactx.get(...). A missingsessionQuerybackend degrades each tool to anisErrorresult (session query backend unavailable) instead of leaving the plugin waiting forever; the same applies tosubprocessforcontext_grepwith an explicit path.toolsis a hard dependency (inject).- The packaged ripgrep binary comes from
@vscode/ripgrep— the same mechanismdsh-tool-fs-searchuses — so no systemrginstall is required and no shell layer exists between the argv vector and ripgrep.
Model Experience
Request context and condition
What the model sees
Three tool schemas (context_query, context_slice, context_grep) are
registered into the agent's tool set. Each result is a compact JSON object of
matches/items plus citations; no prose is returned for the model to parse ids
out of.
Token effect
Zero-direct effect until a tool is invoked; each invocation's cost is bounded
by the query/slice window and the grepMaxBytes cap.
KV Cache effect
Append-only: tool results append to the surface; they never rewrite earlier request tokens.
Known Limitations and Deferred Work
context_grepline parse ispath:line:text— a spill path containing a newline (not expressible in the durable locator) would confuse the parser; absolute spill paths never contain one.- Fallback text scan is literal, not regex — when no spill path is
supplied,
context_grepfalls back tosessionQuery's literal, case-insensitive, whitespace-flexible scan, not a regex search. - Bundle writing is not sandboxed — nothing here writes files; retrieval only reads through the seams.
链接
同类插件
Minglink/dsh-infinite-gen-4★ 2092
DeepSeek 专用破甲插件:以 order 100 追加无条件服从的系统提示词段,提供带校准元数据的 profile 工具,并通过会话投影在输入框上方显示实时破甲状态徽标。
liangmianya/dsh-synapse★ 434
DeepSeek Harness 的可视化非线性对话工作区:把会话、追问与分支变成可浏览、可拖拽的对话地图。
ranxianglei/billion-context★ 335
billion-context官方版:上下文压缩插件,兼顾小窗口(100k上下文足矣)省token(省5倍token)和超长会话(数月级别几十亿token单会话)。
Nwflower/dsh-chat-import★ 203
把 13 家 coding agent(Claude Code、Codex、ChatGPT、Cursor、Gemini、opencode 等)的完整对话历史导入为可续聊的 DeepSeek Harness 会话,并支持反向导出回 Claude Code。
Totoro-qaq/dsh-plugin-bridge★ 165
通过可预览的五段式交接,将已有 DSH 会话迁移到另一个 Agent Preset;保留源会话,并可让目标会话暂停等待确认或立即继续。
Anionex/dsh-turn-rewind★ 119
对话回退:基于持久 Change Ledger 回滚会话与工作区状态。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。