On-demand tool loading: keeps a few hot tool groups resident and hides the rest behind a searchable index, cutting the per-turn tool-definition payload from about 130K to 15K characters. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-lazy-tools
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Leafseaquiet/dsh-lazy-tools
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 中文
On-demand tool loading for DeepSeek Harness. Keep a handful of hot tools resident, defer the rest behind a searchable index. The per-turn tool-definition payload drops from ~130K characters to ~15K.
The problem
DSH puts every tool definition into the system prompt, every turn. Once you install a few plugins that number gets out of hand — on my machine it was 137 tools, 130,565 characters, 85.6% of the whole system prompt — larger than the conversation history itself.
The cost is not only money:
- Even at the discounted cache rate, those definitions still occupy the equivalent of ~37K tokens per turn.
- Accuracy drops when the model has too many tools to choose from (Anthropic puts the threshold around 30–50).
- The tools you actually use get buried.
Real usage tells the story. Across 15 recent sessions and 9,837 actual tool calls, the top 10 tools accounted for 87%. Twenty-four novel-writing tools were called 15 times in total; thirteen bilibili tools were never called at all.
The result
tool definitions 130,565 chars -> ~15K (4 resident groups)
per-turn tokens ~37K equivalent -> ~4K
share of prompt 85.6% -> ~12%
Install
Add it to your DSH profile as a bundle:
{
"dependencies": {
"dsh-lazy-tools": "^0.2.0"
},
"dsh": {
"profile": {
"bundles": ["dsh-lazy-tools"]
}
}
}
That file is ~/.dsh/profiles/<profile>/package.json. Run npm install in that directory, then restart DSH. On first run it writes ~/.dsh/lazy-tools.json.
Working from a local checkout instead? Use "dsh-lazy-tools": "file:/path/to/dsh-lazy-tools".
Node 20+. No runtime dependencies — standard library only.
Usage
From the model side:
tool_search() list every group and its state
tool_search(query: "ledger") keyword search, activates the best-scoring group only
tool_search(names: ["computer"]) activate the group that owns an exact tool name
tool_search(group: "novel") activate a whole group by id or display name
tool_search(group: "*") escape hatch: activate everything
The model does not have to search first. If it calls a hidden tool directly, a tools/pre-execute guard intercepts the call, activates the whole group, and returns one line telling it to simply call again next turn.
Configuration
~/.dsh/lazy-tools.json, re-read on restart.
{
"enabled": true,
"enabledForSubagents": false,
"persistActivation": true,
"persistScope": "cwd",
"residentGroups": ["core", "network", "context", "jobs"],
"groups": {
"novel-forge": { "name": "Novel", "prefix": ["novel_"] },
"computer-use": { "name": "Desktop", "prefix": ["computer"], "match": ["windows", "ui_elements"] }
},
"aliases": { "ledger": "novel_ledger", "save": "write" }
}
| Field | Meaning |
|---|---|
enabled |
Master switch |
enabledForSubagents |
Whether subagents get the same treatment (default false: they are short-lived and hiding tools makes them harder to find) |
persistActivation |
Whether activation state is written to disk |
persistScope |
Granularity of that file: session, cwd (default) or global |
residentGroups |
Group ids that are never hidden |
groups |
Group definitions: match for exact names, prefix for prefixes |
aliases |
Search terms mapped to tool names, expanded at query time |
How a tool is assigned to a group
exact match (highest) > longest matching prefix > auto: fallback
Order in the config file does not matter. When two plugins have prefixes that contain each other, the shorter one cannot steal the tool:
"short": { "prefix": ["novel"] }
"novel-forge": { "prefix": ["novel_"] }
novel_ledger goes to novel-forge (6 characters beats 5). A tool that no group claims is bucketed by the first segment of its name (mystery_tool -> auto:mystery) and shown as "auto:mystery" so hand-written groups stay distinguishable.
On "group by owning plugin"
Not possible — naming convention is all there is. The registrations returned by tools.view() carry only { definition, when }, with no source field. The workable convention is "prefix equals plugin name": plugins that follow it group correctly with zero configuration, the rest fall through to auto:. Two plugins that ignore the convention and share a prefix end up in one group, and there is no way to tell them apart.
Startup checks
Once per process, the plugin validates its own configuration and warns about the four mistakes that are otherwise silent:
| Check | What it reports |
|---|---|
| Duplicate display name | Two groups both called "Memory" — naming one only hits the first |
| Group matches nothing | A typo in prefix / match means the group can never be activated |
| Alias to a missing tool | "ledger": "novel_ledgr" |
| Tool claimed by several groups | Lists the overlapping tools and who actually got them |
Settings panel
Settings -> Lazy tools. Every control is a switch or a dropdown; nothing has to be typed in: enable, subagent handling, remember activation, persistence scope (dropdown), open config file, and per-group activate / deactivate.
The panel only edits the persisted layer. It never mutates running agents — changing the tool table invalidates the prefix cache, so when to restart is the user's call.
Routes under /.dsh-lazy-tools/:
| Route | Method | Purpose |
|---|---|---|
/state |
GET | Configuration, per-group tool counts, activation state |
/config |
POST | Whitelisted fields; an unknown persistScope is returned unchanged |
/group |
POST | { id, activated } |
/open-config |
POST | Opens the config file |
How it works
- On
agent/created, each agent gets three things: thetool_searchtool, atools/pre-executeguard, and a one-line system-prompt summary. - Compute which tools should be hidden, then
agent.ctx.tools.restrict({ deny }). - Activation lifts the old restriction before recomputing —
view()returns the already-restricted set, so restricting again without lifting would shrink it every time. - A
syncingflag prevents recursion throughtools/change. - Tools registered in the agent's own scope are not in
restrictableNames, sotool_searchcan never hide itself. - Zero dependencies: no
import @deepseek-ai/dsh-tools(it does not resolve inside a profile), definitions are written by hand.
Why another one
@studyzy/dsh-lazy-tools on npm has the same idea but pins @deepseek-ai/dsh-system-prompt@0.2.0-rc.2. Since 0.2.2-rc.5, system-prompt/assemble no longer carries tools inside assembly (it is merged back after the waterfall), so that plugin reads undefined, throws, gets caught by its own try/catch, and fails open to "every tool offered as usual" — the panel looks installed, and only the log shows warnings.
This version uses tools.restrict(), a public API that does not depend on the shape of assembly.
The trade-off
Activating a group rebuilds the tool table, and that turn pays the prefix cache once more. The arithmetic: it only saves money when k < N x 0.1 (N turns, k activations). Saving money is not the point here — fewer tools to choose from and 37K tokens read per turn are.
The real lever for cost is conversation history, not tool definitions.
License
MIT
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38608
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37289
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
yikart/AiToEarn#dsh-plugin-aitoearn★ 28947
Generate copy, images and short videos, and publish with one click to Douyin, Kuaishou, Xiaohongshu, WeChat Official, Bilibili, Facebook, TikTok and more, covering the full content lifecycle from creation to publishing and monetization.
superdesigndev/treg★ 10049
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6112
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
Hithink-Tech-Org/Financial-API#hithink-finance★ 4761
Query Hithink Finance data in DeepSeek Harness, view charts in chat, and save refreshable dashboards.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.