Repository navigation
Releases: JinShuXuan/dsh-context-budget
Release list
v0.2.0 — 字符预算预览 / 通用工具预算 / 可写配置
v0.2.0
预览改按字符预算
G2 从"按行取头尾"改为"前 1200 / 后 600 字符",削减率变成 1 − 1800/结果字符数(10.5K → 1.77K,83%)。此前按行时削减率取决于行长分布(401 行省 93%、47 行只剩 36%),而且"少行超长"的结果根本不会被外置。
工具档通用化
G1 新增 strategy: budget:按 schema 体积裁到预算内,不再依赖任何具体插件名。新装的插件带进来的工具会被同样对待,protect 名单保底(read / write / edit / ops_bash 等永不裁)。
看得见更多
/budget 增加工具表 Top 5 体积、技能目录条数与占系统提示比例——后者直接从系统提示里的 <available_skills> 块量,不需要新 API。
配置可写
新增 /budget-set key=value,落盘到 $DSH_HOME/context-budget.json。优先级:落盘值 > profile 覆盖层(cordis.patch.yml)> 包内默认。G2/G3 立即生效,toolset.* 新会话生效,重启不丢。
Config schema
导出 schemastery schema,配置页有表单可编辑;依赖解析不到时自动降级,不影响插件加载。
已知限制(详见 README)
read_many走ctx.fs读取,但 DSH 文档明确说 Direct ctx.fs reads emit no fs/observed,所以它不能替代read(编辑前置策略),精简档里不要裁read。- G2 的收益依赖会话长度:结果进入上下文后会被重发,剩余步数越多越划算;短任务里可能持平。
- 手工
link:挂载的包不会出现在插件管理器的 bundle 清单里,所以管理页看不到入口——用/budget-set。
v0.1.0 — context ledger + four opt-in gates
First public release.
What it does
Per-step context ledger for DeepSeek Harness plus four gates you can enable independently:
- L0 (always on): folds session events into a per-step ledger.
/budgetshows the fixed-prefix estimate, calls per step, gate hits, and the last realusage. Zero tokens, no behaviour change. - G1 (opt-in): removes heavy tool groups from the tool table once per session, filtered against the actually-visible set.
- G2 (opt-in): externalizes oversized results to disk, leaving head + tail + a pointer. Skips anything it cannot actually shrink.
- G3 (opt-in): answers a repeated read of an unchanged file with a pointer.
read_many(opt-in): one call, many files.
Published defaults keep everything except L0 off, so installing changes nothing.
Measured on real sessions
Fresh A/B (same machine, same model, system prompt and user message md5-identical):
| full | lean | delta | |
|---|---|---|---|
| tools | 98 | 54 | -45 (+1 read_many) |
| tool table | 93,686 chars | 45,437 chars | -51.5% |
| first-step prompt | 32,422 tokens | 16,312 tokens | -16,110 (-49.7%) |
G2 compressed a 35,292-char result to 1,952 chars (-94.5%).
Install
dsh plugin --profile web add github:JinShuXuan/dsh-context-budgetUpgrade note
This release adds two fixes: G2 no longer externalizes results it cannot shrink (a 2-line JSON used to come out 187 chars larger), and the debug log no longer writes to a hard-coded absolute path.
Configuration
DSH re-materializes cordis.yml from the package patch on startup, so persist local choices in the profile's cordis.patch.yml override layer, not in cordis.yml. See the README for details.