DeepSeek Harness plugin

dsh-tokensave

DSH port of pi-tokensaver: keeps the tokensave semantic graph fresh and teaches the agent to prefer its semantic tools

Jump to install

Source facts

Repository
Miku196/dsh-tokensave
Latest update
Aug 16, 2026
Category
Workflow & Automation
GitHub stars
2
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/Miku196/dsh-tokensave
Plugin: dsh-tokensave
Author: Miku196

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-tokensaver

> DeepSeek Harness 移植版 pi-tokensaverPi coding agent 扩展)—— > 把 tokensave 的本地语义图引擎接进 DSH,让 agent 用语义查询代替暴力 grep/读文件,大幅省 token。

![license](LICENSE) ![version](https://github.com/Miku196/dsh-tokensave) ![dsh-plugin](https://github.com/topics/dsh-plugin)

它做什么

pi-tokensaver 阶段DSH 中的实现
1. tokensave sync + .gitignore 卫生本插件(apply 时执行 init/sync
2. 工具桥接cli 直连(0.2.0 起 MCP 模式已移除):tokensave tool <name> --args <json>,无 serve 进程、无 MCP,工具名 tokensave_*
3. 系统提示词注入本插件ctx.systemPrompt.section
4. teardown 杀进程无长驻进程,无需处理

装好后模型会自动获得 80+ 个语义图工具(search / callers / callees / body / entities / status / dead_code / circular …),并在系统提示词中被引导优先使用它们探索代码——一次语义查询省 900–2000 token。

安装(web profile 示例)

前置条件:

1. tokensave 已安装(cargo install tokensave,或从 GitHub Releases 下载 tokensave-vX.Y.Z-x86_64-windows.zip 解压后放入 PATH)。 2. dsh 可用,且 profile 目录有 pnpmdsh plugin 依赖)。

从 GitHub 安装(推荐)

dsh plugin --profile web add github:Miku196/dsh-tokensave

本地开发安装

dsh plugin --profile web add file:/path/to/dsh-tokensave

挂载配置(默认零配置,不用改任何文件)

dsh-tokensaverbundle 插件(自带 cordis.patch.yml 声明,安装后即注册)。安装后无需修改任何配置——cordis.patch.yml 里不需要(也不应该)出现 tokensaver 条目:

  • 不要 insert 同名条目——重复声明会导致 dsh 崩溃;
  • ✅ 工具调用自动跟随会话工作目录、向上找最近索引、全新目录自动 init(见下"索引定位")。

仅在特殊需求时(如 headless/无会话场景需要固定操作根),在 $DSH_HOME/profiles/web/cordis.patch.yml 里按 id 定位的 config override 覆盖:

- id: tokensaver
  config:
    binary: tokensave            # 可执行文件路径或 PATH 上的命令名(默认)
    cwd: /path/to/your/project   # 可选:固定操作根(默认跟随会话工作目录)
    autoSync: true               # 默认:启动时 init(无索引)/ sync(有索引)

> config 是整体替换:未写出的字段回落到插件的 schema 默认值。 > 0.2.0 起仅支持 cli 直连,MCP 模式(bridge: "mcp" + dsh-mcp-client 行)已移除。

保存后 dsh web 会自动热重载(无需重启)。新会话中模型即可调用 tokensave_searchtokensave_callers 等工具。

更新插件

dsh plugin --profile web update dsh-tokensaver

配置

字段默认说明
binarytokensave可执行文件路径或 PATH 命令名
cwd跟随会话工作目录可选固定操作根。不配时每次工具调用自动使用当前会话工作目录exec.agent.session.header.cwd),无需手动指定
bridgecli历史字段(仅 cli):0.2.0 起 MCP 模式已移除,填 mcp 会报错
autoSynctrue启动时 init(无索引)/ sync(有索引,含祖先索引根)
syncTimeoutMs600000同步超时
callTimeoutMs120000cli 模式单次工具调用超时
updateChecktrue启动时查 crates.io 是否有 tokensave 新版本,有则告警
updateCheckTimeoutMs10000更新检查网络超时
promptOrder150提示词 section 顺序(工具指导带 100–199)
gitignoreHygienetrue自动把 .tokensave/ 加进 .gitignore

索引定位(零配置,不用为每个文件夹建索引)

tokensave 只在精确目录找索引(不向上/向下查找),而索引覆盖整个目录树。插件因此自动补齐:

  • 每次工具调用跟随当前会话工作目录cwd 未配置时):目录或其任意祖先已有索引(.tokensave/tokensave.db)→ 直接使用该索引根,任何子目录、任何盘符(如 D:\geoC:\...\项目)下工具都自动可用;
  • 全新目录(向上找不到索引)→ 首次调用时自动 tokensave init 建索引;
  • 安全保护:主目录(~)及其直接子目录(Desktop/Documents/Downloads 等)永不自动 init——在这些位置工具会给出明确提示,避免误索引整个主目录;
  • ~/.tokensave(tokensave 的全局配置目录)不会被误判为项目索引。

任何失败都优雅降级:binary 缺失时只告警,不阻塞 profile 启动,也不注入提示词(避免模型调用不存在的工具)。

开发

# 1. 链接运行自测所需的依赖(schemastery / dsh-tools 来自 dsh 安装,勿提交 node_modules/)
npm install    # 或手动建 junction:见 test-cli.mjs 头部注释

# 2. cli 桥单元自测(工具发现 / --help 解析 / schema 生成 / 版本检测 / 真实调用)
#    Windows(PowerShell):
$env:TOKENSAVE_BINARY = "C:\path\to\tokensave.exe"
$env:TOKENSAVE_CWD = "C:\path\to\indexed\project"
node test-cli.mjs

#    macOS / Linux:
#    TOKENSAVE_BINARY=/path/to/tokensave TOKENSAVE_CWD=/path/to/indexed/project node test-cli.mjs

致谢

License

[MIT](LICENSE) © dsh-tokensaver contributors