Route eligible shell commands through rtk (Rust Token Killer) inside the DeepSeek Harness (
dsh) bash executor — compress tool output, save tokens, change nothing else.
LLM agents burn tokens on verbose tool output (git log, cargo build, pytest trails…). rtk already knows how to shrink those for 30–90%. This plugin bolts that filtering onto dsh's bash executor so every eligible command is auto-routed through rtk — with zero semantic change to what actually runs.
model → dsh bash tool → RtkBashExecutor.resolve()
│
┌───────────────┴────────────────┐
eligible? not eligible
(simple + whitelisted) (complex / unknown)
│ │
rtk <subcommand> … command runs unchanged
(rtk compresses output) (byte-for-byte passthrough)
Three independent guards decide (see src/wrap.ts):
- Complexity — any shell metacharacter (
| & ; < > \$`) disqualifies the command. Wrapping those would silently alter what runs, so they pass through untouched. - Whitelist — only known dev tools that
rtkactually implements are eligible (map inwrap.ts). - Availability — if the
rtkbinary is absent onPATH, the transform is the identity: the deployment behaves exactly like the stock local executor.
The plugin does not bundle or pin rtk. At dsh startup it probes rtk --version on PATH (see resolveRtk() in src/index.ts). Therefore:
- When rtk ships a new release, any user who upgrades
rtkon their machine automatically gets the new behavior — no plugin update required. - The plugin version (this repo) and the rtk version are independent; keep them separate. This README states the minimum rtk version tested against, not a lockstep number.
Requires:
rtkonPATH(rtk --versionexits 0). The plugin does not install or manage rtk — you must install and update rtk yourself (e.g.cargo install rtkor download a release binary). When rtk is absent the plugin is a silent no-op passthrough.
The plugin is disabled by default — installing it does nothing until you opt in.
# 1) from a local checkout
dsh plugin --profile web add <path-to-this-dir>
# 2) or directly from a GitHub release tarball (no local clone needed)
dsh plugin --profile web add https://github.com/DeepTrial/dsh-bash-rtk/archive/refs/tags/v0.1.0.tar.gz
# enable it via an optional overlay — add to your profile's cordis.patch.yml:
# - id: bash-sandbox
# disabled: true
# - id: bash-rtk
# disabled: false
dsh web # restart to applyThe bundled overlay snippet lives in cordis.patch.yml. It swaps the stock sandbox executor for RtkSandboxBashExecutor (file confinement preserved) and leaves the unconfined RtkBashExecutor available for danger-full-access setups.
The set of commands eligible for rtk-wrapping is defined by rtk itself — see the rtk command reference / README.md for the authoritative, maintained list. This plugin mirrors that list; when rtk adds a new subcommand, upgrade rtk (not this plugin) to pick it up.
Complex commands — pipelines, &&/;, redirects, $( ), env assignments — always run natively regardless of the whitelist.
pnpm install && pnpm run check # typecheck + test + builddevDependencies use link: into a local deepseek-harness checkout; tests run inside that workspace (the @deepseek-ai/dsh-* packages must resolve).
MIT