How to use dsh-file-mount
Provides incremental file mounting for DeepSeek Harness: automatically tracks which lines of read files enter the model context, re-reads only supply missing or changed portions, and presents a billable "mounted files" dashboard on the web.
This article is auto-derived from indexed fields (wiki / faq / compatibility_json), not freshly AI-generated.
This article is derived from the plugin's already-indexed fields (wiki / faq / compatibility_json / readme), not freshly generated by AI. Source field is noted at the end of each section.
Quick start
dsh-file-mount
— source: plugin_wiki.wiki_content
Install & verify
dsh plugin --profile web add github:acefun29/dsh-file-mount
Run the command above in your DSH Web Profile. Then enable the plugin in the plugin list.
— source: plugins.install
Key points
- 模型侧:读过的行范围不重复进上下文(去重 marker);缺失/改动的正文写进本次 read 的工具结果(增量 / 重挂),纸条只记账本声明;文件改动后只补改动的行(行级 diff,日志追加只补新尾巴);AI 自己写过的文件回头读直接免单;
file_mount_forget工具让模型能主动强制重读。 - 界面侧:「挂载文件」标签页是仪表盘——打开时停在顶部,净节省与路径搜索固定在顶栏,文件列表单独滚动;每个文件行可展开成文件段列表,每段带新鲜度色带(绿=新鲜/黄=一般/橙=接近过期/红=已过期/灰=未知)和过期次数;另有覆盖图(色块标出已挂载行在文件中的位置)、搜索、排序、净节省与人民币折算;对话区有上下文注入折叠行,「文件已变更」时行上有角标。
- 节省统计:中文按 1 字 ≈ 1 token、其他按 4 字符 ≈ 1 token 估算;同时记账「省下的」和「纸条花掉的」,界面显示净值(为负时按 0 显示);可选把跨会话总账落盘(
statsFile)。 - id: file-mount
- compaction 后「已挂载」保证失效:被压缩掉的挂载内容离开模型上下文,插件靠 checkpoint 的
sourceEventSeqs识别并跳过,下一次读取重新锚定。
— source: plugin_wiki.readme_en (fallback readme_raw)
FAQ
What does this plugin do? Why do I need it?
It intercepts read/write/edit tool results, so when the model repeatedly reads the same file, it no longer stuffs the entire text into the context—the already-read line ranges are replaced with a brief "mounted" marker, only incrementally adding back missing lines or lines changed on disk. Files the AI just wrote are also exempted from re-reading; it also provides a "Mounted Files" dashboard showing the ledger and savings statistics.
I can't find the "Mounted Files" tab in the interface after installing. What should I do?
You must restart the harness after installation (npx @deepseek-ai/dsh --profile web), page refresh is not enough to activate it. On Windows, avoid using dsh plugin add . to install from a directory—pnpm will embed the drive letter into the profile path causing the plugin to install but not activate. Use pnpm dsh:install or a pre-built GitHub Release tarball instead.
Can the model actively discard a file's mount and force a re-read?
Yes. The model can call the file_mount_forget tool to invalidate the ledger entry for a specified path, and the next read will resend the entire file. The dashboard header also prompts: when you encounter "mounted" but can't find the content in the context, forget first then read.
What do the green/yellow/orange/red strips in the "Mounted Files" tab mean?
They are "freshness" strips—they judge whether the mounted segment might still be visible to the model based on its position in the current context. Green=just mounted, Yellow=still OK, Orange=near expiration, Red=expired, Gray=unable to determine (sessions lacking usage data). When approaching the context window limit, segments closer to the front are more likely to be evicted, the next read will resend them, and after being resent once that segment gets pinned.
Are the savings numbers accurate? How does the interface calculate them?
It's an estimate: 1 Chinese character ≈ 1 token, 4 other characters ≈ 1 token. The dashboard shows "net value" (saved tokens minus the plugin's own prompt overhead, displayed as 0 if negative), and converts to RMB at roughly ¥1 per million tokens as a reference.
Where are the cumulative savings across sessions stored?
After setting statsFile in the configuration, each session end will atomically write that session's "saved tokens / prompt overhead tokens / session count" to that JSON file; hosts can read via ctx.fileMount.stats(). Without statsFile configured, nothing is written to disk.
Which files does the plugin not manage?
Files exceeding maxManagedBytes (default 16 MiB) are not taken over; paths matching excludeGlobs (default **/node_modules/**) are also passed through as-is. These two types of files go through native read, won't write to the ledger, and won't appear on the dashboard.
Will this plugin stop working after upgrading DSH?
It won't fail immediately, but coupling points like post-compaction mount judgments and the read tool's canonical value shapes are pinned by tests/compaction.spec.ts. It's recommended to run pnpm test after each DSH upgrade—DSH will immediately alert if these shape tests are changed.
— source: plugin_wiki.faq_json
Compatibility
- DSH: 0.1.0-rc.5+(peerDependencies 全部声明 ^0.1.0-rc.5,README 验证基于 0.1.0-rc.5+)
- Node: ^22.19.0 || >=24.0.0(package.json:21 engines 字段)
- Platforms: macOS, Windows, Linux
— source: plugin_wiki.compatibility_json
Pitfalls
Review the upstream repo before installing. This guide is auto-derived from indexed fields and may lag the latest release. If anything contradicts the official docs, treat the upstream source as authoritative.
— source: general rule