EvilIrving/dsh-context-proxy
为DeepSeek Harness提供按需上下文检索:context_query / context_slice / context_grep 工具。
项目介绍Project Overview
dsh-context-proxy 是 DSH 的按需上下文检索插件,提供 context_query、context_slice、context_grep 三个模型工具,从已持久化的会话历史中按序号、类型、文本查询、读取片段或 grep,并返回可重放引用。适合模型需要回看早前上下文、溢出文件或会话事件时使用;它不负责截断、压缩或计量,且缺少 sessionQuery/subprocess 后端时工具会返回 isError。
dsh-context-proxy is a thin on-demand context-retrieval plugin for DSH. It registers three model-facing tools—context_query, context_slice, and context_grep—to read persisted session history by sequence, type, or text, with bounded slices and replay-safe citations. Use it when the model needs earlier events or spilled context. It does not handle truncation, compaction, or metering; missing sessionQuery or subprocess backends return isError instead of hanging.
请帮我了解并安装插件:【dsh-context-proxy】【https://github.com/EvilIrving/dsh-context-proxy】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:EvilIrving/dsh-context-proxy
把 EvilIrving/dsh-context-proxy 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-context-proxy
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.
nexu-io/open-design
freestylefly/awesome-gpt-image-2
anywhere-labs/dsh-desktop
walkinglabs/learn-harness-engineering
awesome-dsh-plugin/awesome-dsh-plugin
MemTensor/MemOS