DeepTrial/dsh-bash-rtk
dsh-bash-rtk
DeepSeek Harness bash executor plugin that routes eligible commands through rtk (Rust Token Killer) to compress tool output and save tokens.
Install
npx @deepseek-ai/dsh plugin --profile web add "<path-to-this-dir>"Restart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/dsh-bash-rtk)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from DeepTrial/dsh-bash-rtk, cleaned of badges and images.
dsh-bash-rtk
Route eligible shell commands through rtk (Rust Token Killer) inside the DeepSeek Harness (
dsh) bash executor — compress tool output, save tokens, change nothing else.
Table of Contents
- Quick Example
- Requirements
- Why
- How it works
- Install & enable
- API / Configuration
- Which commands are routed
- Development
- License
Quick Example
The plugin rewrites commands at the resolve() boundary — before anything runs:
Input (command) | Resolved output | Reason |
|---|---|---|
git status | rtk git status | Simple + whitelisted |
cargo build --release | rtk cargo build --release | Simple + whitelisted |
git status | grep x | git status | grep x | Complex shell — passthrough |
ls -la | ls -la | Not whitelisted — passthrough |
git status (rtk absent) | git status | Binary missing — identity fallback |
Everything else — workdir, timeout, env, exit code, sandbox confinement — is inherited unchanged.
Requirements
- Node.js: >= 20.0.0
- rtk:
rtk --versionmust exit 0 on PATH (install separately, e.g.cargo install rtk)
Why
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.
How it works
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.
Versioning note
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.
Install & enable
…
