DeepSeek Harness Plugin

haidai233/dsh-plugin-trim

Category Tools & Capabilities Added 2026-11-17

Trims the tool surface per session. Each session owns a profile — a tool whitelist — applied through `agent.ctx.tools.restrict({ allow })` on that agent scope only, and switching one session never touches another; `full` is the built-in no-restriction profile. The provider only picks the default: a session created or switched onto a local provider (explicit `localProvider`, `routes`, a loopback/private baseURL, or a local-ish id) gets the `local` profile, a cloud one gets `full`, and the re-plan runs on model-selection events plus one delayed pass because the projection can land after the event. Profiles are editable from the panel and persisted under `~/.dsh/plugin-trim-state.json`; an explicit per-session choice overrides the provider default until cleared. A separate, opt-in layer physically disables whole plugin entries through `pluginManager.setPluginEnabled` — that one is profile-scoped by API and the panel labels it as such rather than pretending it can be per-session. A `tool_trim` tool exposes list/status/profile/set/apply/restore to the model. The panel is served by a loopback-only HTTP server the plugin starts on its own fixed port — `http://127.0.0.1:12256/` (auto-bumps on collision, configurable) — because the DSH port changes on every restart and a locally linked package gets no market card in the sidebar; it lists live sessions with their profile and tool count, an editor per profile, a provider picker limited to providers declared in the profile or currently in use, and the full plugin list with search and paging. Two implementation details worth knowing: `tools.restrict()` is an intersection and cannot widen, so the old restriction is released before the visible set is read — otherwise switching to a bigger profile would shrink instead of grow; and every disposer is registered on `ctx.effect`, without which a hot reload leaves an unremovable restriction behind. Measured on a 12GB laptop GPU with a 27B model and a fully resident 256K cache, same conversation: 105 tools / 56,306 prompt tokens / 22.5 tok/s decode, 62 / 34,207 / 43.0 after disabling three tool-heavy plugins, 14 / 12,890 / 66.8 after a session moved to the local profile, with prefill rising from 487 to 1,310 tok/s. Restricting also drops the skill catalog injection, roughly 4.3K more tokens. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

Install

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:haidai233/dsh-plugin-trim

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).

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.