studyzy/dsh-lazy-tools

Project Overview项目介绍

dsh-lazy-tools is a deferred tool-loading plugin built specifically for DeepSeek Harness 0.2.0-rc.2, inspired by the CodeBuddy defer mechanism. It is installed as an external bundle through dsh plugin --profile <profile> add git:github.com/studyzy/dsh-lazy-tools, or locally as add link:/path/to/dsh-lazy-tools during development, and injects a single cordis plugin named lazy-tools via cordis.patch.yml. The plugin exposes two new agent-scope tools, tool_search and defer_execute_tool, which observe tool name, description, and parameters without ever modifying the underlying registry, and hide deferred tools at the system-prompt/assemble waterfall so their JSON schemas never enter the model context. peerDependencies pin @deepseek-ai/dsh-* 0.2.0-rc.2, @deepseek-ai/cordis 4.0.4, and @deepseek-ai/schemastery 3.18.4, so the harness preflight accepts it directly; after upgrading DSH, realign these versions, rerun pnpm install && pnpm run check, and re-add the bundle.

The default policy is Defer(*), with a small resident core (read, write, edit, bash, glob, grep, web_search, web_fetch, ask_user_question, skill) kept always visible, and three guards (tool_search, defer_execute_tool, run_code) pinned so they cannot be deferred by Defer(*). Users override defaults in cordis.patch.yml under the plugin's config field using CodeBuddy-style Defer(pattern) / NoDefer(pattern) entries; * is the only wildcard, bare names are equivalent to the wrapped form, and noDefer always wins over defer. The Web and Desktop builds additionally expose a visual configuration page at Settings → Built-in plugins → Lazy tools with six fields mirroring the YAML keys, where defer and noDefer accept comma-separated input. When autoTune is left at its default true, the plugin scans up to autoTuneWindowDays (30) days of project history keyed by absolute cwd, promotes the autoTuneTopN (20) most frequent tools to resident, and writes the result to a per-project store that overrides the global config; autoTuneMinSamples (200) gates the rewrite so brand-new projects keep using globals.

Tool sources are treated uniformly: host composition tools, agent preset tools, MCP servers, and tools registered after the agent was created all pass through the same defer and search logic, and the plugin never loosens any other restrict policy — tools blocked elsewhere return unavailable from tool_search. Development requires Node 22 or 24 with pnpm, plus scripts typecheck, typecheck:tests, test (vitest unit and integration), lint (oxlint), build (tsc + tsdown to lib/), verify:client (browser-kernel contract check), and the umbrella check; CI in .github/workflows/ci.yml runs them on both Node majors. Documented limits include: an activated tool only appears in the next request, deferred tool names are invisible until searched, session state is not persisted across resume or fork, the plugin is a no-op under PTC presentation except for the pinned run_code, and a missing UI tab after a client-side change is fixed by restarting DSH so its negative client-plugin cache resets. The project ships under the MIT license.

dsh-lazy-tools 是一个面向 DeepSeek Harness 0.2.0-rc.2 的延迟工具加载插件,灵感来自 CodeBuddy 的 Defer 机制。它在 agent 层注入一个名为 lazy-tools 的 cordis 插件,通过 tool_search 与 defer_execute_tool 两个新工具,把工具 schema 排除在模型可见列表之外,模型只在需要时按名或关键词检索并激活,从而降低 token 消耗、压缩上下文窗口,同时不改动工具注册表本身。安装方式为 dsh plugin --profile <profile> add git:github.com/studyzy/dsh-lazy-tools,本地开发可用 link: 路径重装。peerDependencies 钉住 @deepseek-ai/dsh-* 0.2.0-rc.2、cordis 4.0.4、schemastery 3.18.4,DSH 的插件兼容性预检会直接放行;升级宿主版本后需要同步更新 package.json 中的版本号并重新 pnpm install。

插件默认采用 Defer(*) 策略,把 read、write、edit、bash、glob、grep、web_search、web_fetch、ask_user_question、skill 作为常驻核心,tool_search、defer_execute_tool、run_code 被钉为守卫,永不延迟。用户可在 profile 的 cordis.patch.yml 中用 CodeBuddy 风格的 Defer(...) / NoDefer(...) 模式覆写,* 为唯一通配符,优先级 noDefer > defer > 自动调优结果。Web 与桌面端另有可视化配置页,路径为设置→内置插件→懒加载工具,六个字段与配置文件一一对应。当 autoTune 开启时,插件会按 cwd 索引项目,扫描该项目近 30 天历史,将调用最频繁的 20 个工具写入项目级存储,并用项目级覆盖全局;统计样本不足 200 次的项目保持全局配置。该方案对宿主 composition、agent preset、MCP 等所有工具来源平面一视同仁,仅在系统提示装配时对模型可见列表做减法。

开发与运行依赖 Node 22 或 24、pnpm,并提供 typecheck、typecheck:tests、vitest、oxlint、tsdown 打包以及 verify:client 浏览器端契约校验脚本,pnpm run check 一键串联。已知的边界条件包括:激活的工具在下一轮请求才进入工具列表,搜索前工具名对模型不可见,状态不跨会话持久化,PTC 呈现模式下除 run_code 之外不生效,项目级配置按绝对路径索引故目录迁移后需手工迁移 ~/.dsh/lazy-tools/projects.json。项目以 MIT 协议发布,源码在 studyzy/dsh-lazy-tools,CI 覆盖 lint、双轮 typecheck、测试与构建;首次在浏览器端运行若界面未出现,重启 DSH 窗口即可刷新客户端插件图缓存。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add git:github.com/studyzy/dsh-lazy-tools

把 studyzy/dsh-lazy-tools 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-lazy-tools

为 DeepSeek Harness 提供的 CodeBuddy 风格延迟工具加载插件。

一个 tool_search + defer_execute_tool 覆盖层,让工具 schema 在真正需要之前 不会进入模型上下文。

减少 token 消耗 · 缩小上下文窗口 · 保持工具可发现

CI License: MIT Node

English


它是做什么的

大多数编码 Agent 会把每一个可用工具的 JSON Schema 都塞进提示词—— 包括模型最终根本不会用到的工具。dsh-lazy-tools 颠覆了这个模型:工具 默认被延迟(deferred),只有当模型主动请求时才进入上下文。

装上即用、零配置:默认延迟长尾工具,同时保留一组常驻编码核心 (read/write/edit/bash/glob/grep/web_search/web_fetch/ ask_user_question/skill,详见默认行为)。这个核心只是起点: 开启自动调优后,插件会按项目统计真实使用情况,把每个项目里最常用的工具设为 常驻、其余全部延迟——所以每个项目最终拿到的是适合它自己的那份配置。

被延迟的工具会从模型可见的工具列表里剔除,因此它们的 schema(乃至名字) 永远不会进入模型上下文。模型通过 tool_search 按需发现它们,激活后 即可直接调用。

剔除发生在 system-prompt/assemble 这条 waterfall 上——也就是 agent loop 真正发给模型的那份 per-scope 工具表(它同时决定请求头与提供商的工具声明)。 本插件不修改工具注册表,所以它不关心工具来自哪个平面。

这是一个纯粹的暴露控制层:

  • 它不拥有、也不实现任何工具。
  • 被延迟的工具是注册表里的普通工具(宿主 composition、agent preset、MCP 等 第三方工具皆可);本插件只从模型可见列表里观察它们的 name / description / parameters 用于发现。
  • 它不代理执行——tool_search / defer_execute_tool 只负责激活,激活后 模型直接调用该工具本身。

因为完全实现在 agent 层,它适用于任何模型与任何提供商(DeepSeek、 OpenAI、Anthropic、Gemini……),不依赖提供商原生的延迟工具协议(如 Anthropic tool_reference 或 OpenAI 的 deferred-tool input items)。

特性

  • 🔍 按需发现 — tool_search 通过精确工具名(tool_names)或关键词 (queries,中英文均可)查找工具,命中即激活。
  • ⚡ 懒激活 — 命中的工具记入该 agent 的激活集合,下一轮模型请求即可 直接调用。
  • ⚡ 按名激活 — defer_execute_tool 按精确工具名直接激活一个已知工具。
  • 🧭 无侵入 — 不碰注册表:只在 system-prompt/assemble 上对模型可见的 工具列表做减法,因此与任何其他 restrict、任何工具来源、任何平面天然共存, 绝不放宽其他策略。
  • 🎛️ 灵活配置 — CodeBuddy 风格 Defer(...) / NoDefer(...) 模式,支持 * 通配符。
  • 🛡️ 自保守卫 — tool_search 与 defer_execute_tool 注册在 agent 自身作用域, 永不被延迟;保留传输 run_code 同样被钉住,Defer(*) 无法把系统锁死。
  • 📊 按项目自动调优 — 启动后第一个汇报工作目录的会话会扫描该项目最近 30 天的会话历史,统计 tool/call 频率,把最常用的 20 个工具设为常驻、其余 全部延迟。
  • 🗂️ 全局 + 项目级两层配置 — 你手写的全局 defer/noDefer 对所有项目 生效;自动调优的结果只写进独立的项目级存储,按项目覆盖全局。优先级 项目级 > 全局。全局配置永远不会被扫描结果改写。

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-plugin-auth-webserver 下一个 Next dsh-global-task-list →