Compresses shell output before the model sees it via the local `rtk` CLI: the master switch follows rtk readiness unless set, `prefix` shadows `bash` per agent and asks `rtk rewrite` for an equivalent command, and the opt-in `pipe` form filters a finished result through `rtk pipe`; compound commands are rewritten segment by segment, small or low-gain output passes through, and a guard refuses an empty result, success claimed over failures, a dropped commit hash and `+N more` folded listings, with stderr and the exit marker reattached; every failure falls back to the original command and output, and a settings card reports command counts, saved tokens and a per-filter chart via the official Typert Remote namespace. Requires `rtk` 1.0+ on `PATH`; without it the plugin loads and compresses nothing.
Install
# from npm (prebuilt)
dsh plugin --profile web add @jayyuen66/dsh-rtk
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:JayYuen666/dsh-rtk
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
A dsh plugin that puts the local rtk binary between a shell tool and the model. rtk itself stays on your machine; the plugin only orchestrates it.
Contents
- What it does
- Install
- Verify it is live
- What it does not provide
- Enabling it in dsh
- The two shapes
- Settings
- Support surface
- External dependency
- Data and privacy
- Known boundaries
- Development
- Feedback
- License
What it does
- Two compression shapes; the master switch follows rtk readiness.
prefixshadowsbashper agent and routes the command throughrtk rewritefirst;pipefeeds a finished shell result throughrtk pipe -f <filter>and replaces only the model-facing text. Until you setenabledexplicitly, it is on only when a supported rtk is detected;prefixis the default form andpipeis opt-in. - Nothing is compressed that is not worth it. Outputs under
minBytes(256) and rewrites that save less thanminGainRatio(0.95) pass through unchanged. The plugin never claims a saving it did not make. - Failures keep their text. The guard rejects any compression that loses the failing assertion, the file:line, or the exit marker — a compressed failure that hides why it failed is worse than no compression.
- Fail-open everywhere. rtk missing, rtk too old, a rewrite that rewrites destructively, a command that is not safe to rewrite: the original command runs, the original output is delivered, and nothing is lost.
- Compound commands are rewritten segment by segment.
cd <repo> && cargo test— the shape multi-repo work produces constantly — is split into segments and only the one carrying the output is rewritten (cd <repo> && rtk cargo test). Constructs that cannot be split (command substitution, redirection, background&, unbalanced quotes) still run unchanged as a whole. - A settings card. Command counts, tokens saved, the savings rate, and a per-filter bar chart of token savings — read from a host storage domain through the official Typert Remote namespace.
Install
dsh plugin --profile web add @jayyuen66/dsh-rtk
Remove with dsh plugin --profile web remove @jayyuen66/dsh-rtk. The package is on the public npm registry; no credentials, no scoped-registry line.
- Node.js
>= 24.9(ESM-only; that floor is what makesrequire()of an ESM entry work, henceengines.node). - Host
dshat0.2.2-rc.2or later on the0.2.xline. The host readsengines.dsh(^0.2.2-rc.2) and it decides alone — with that field present, compatibility is judged beforepeerDependenciesis ever consulted, prereleases included. Any0.2.xat or above0.2.2-rc.2passes the host gate;0.2.2-rc.1and anything older does not. Strict npm peer resolution likewise accepts nothing below0.2.2-rc.2, and on the prerelease side only the0.2.2tuple (0.2.2-rc.2onward) — a later minor's prerelease such as0.2.3-rc.1waits for its stable release.0.3.0and later need the risk grantdsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk. The support window rolls: at publish time this package is checked against every released host version inside the window — the judgement is the host's--dump-configlayer line for this package, while the settings card and its namespace calls are verified once in full on the release's development baseline — and re-verified once the window moves, so the version number in this bullet is not a standing promise. - No
@deepseek-ai/*underdependencies, by contract (test/publish-manifest.test.ts). Profiles install withnodeLinker: hoistedandautoInstallPeers: false, so a host package there becomes a real second copy;@deepseek-ai/dsh-toolskeys its scheduler with a plainSymbol, so every native tool call throws in that profile while build, typecheck and coverage stay green. The@deepseek-ai/dsh*peers carry the same support-window range (^0.2.2-rc.2), while the exact pins indevDependenciesare the compile-time discipline against a second host type surface — not a claim the host consults. rtk >= 1.0.0onPATH. This is the one runtime dependency outside npm:brew install rtkon macOS/Linux,winget install rtk-ai.rtkon Windows. Without it the plugin still loads and every compression path fails open.- What ships:
host.js,client.js,cordis.patch.yml,icon.svg, both READMEs,CHANGELOG.md,THIRD_PARTY_NOTICES.md,locale/zh.json+locale/en.json, anddocs/(both DETAIL files). Artifacts are rebuilt byprepack, never committed.
Verify it is live
- The layer is mounted.
dsh --profile web --dump-configends with# == @jayyuen66/dsh-rtkplus- id: rtk. That command is the only accepted signal and is not read-only — read layer lines from stdout and check stderr separately; accept both# == <layer>and# == <layer>, patched by <path>. - rtk is found. The card's readiness line names the binary it resolved and its version.
rtk not foundthere means the host process'sPATHdiffers from your shell's. - A command is compressed. With
enabled: trueand the card's counters at zero, ask the model to run a build or a test suite: the next card refresh shows the call and the byte delta. - The card renders. The settings page lists "rtk 输出压缩" (or its English title); toggling a value plus Save round-trips with a 200 and the dirty state clears.
What it does not provide
- No HTTP route of its own. The card's data plane is the official Typert Remote namespace through the host
/apigateway; auth, Host/DNS-rebinding/Origin checks and body limits are all the gateway's. - No CLI subcommand.
dsh rtk …does not exist. - No rtk code bundled. The plugin invokes the
rtkcommand as a subprocess and consumes its stdout. rtk's Apache-2.0 surface is what it uses; nothing from the BUSL engine is linked or redistributed. - No rewriting of input arguments. dsh deliberately forbids
tools/pre-executefrom rewriting a tool call's arguments (they are already logged and rendered). Theprefixshape therefore works by shadowingbashper agent, not by mutating an existing call. - Required surfaces:
settings/tools/subprocess(all ininject).spillStoreandstorageDomainare read throughctx.get()and degrade gracefully when absent.
Enabling it in dsh
dsh.bundle.patchpoints atcordis.patch.yml, whoseinsert:block carries a- id: dsh-plugin-sharedsupplier row (keep it enabled; disabling it removes the cards' shared component supply) plus the- id: rtkentry withname: "@jayyuen66/dsh-rtk"— the bare package name is what makes the host scan the client half. The card components come from the shared client row, externalized as@jayyuen66/dsh-plugin-shared/client; the host module table providesreact,zodand that shared row.- A missing injected surface keeps cordis from activating the entry (startup diagnostic:
pending (waiting for service: …)); a malformed ctx throwsrequired services … missingfrom apply. - Deployment defaults go on the registration line's
config:; precedence is card runtime value > row config > schema.default(). - The master switch follows rtk readiness. Until you set
enabledexplicitly, it stays off when rtk is missing or below the supported floor and turns on once a supported rtk is detected.prefixis the default form. Turn the switch off manually to pin it off, or on to pin it on; both the switch and the form selector take effect on the next tool call.
The two shapes
| prefix | pipe | |
|---|---|---|
| When | before the command runs | after the shell result exists |
| How | shadow bash per agent, ask rtk rewrite, run the rewritten form |
feed captured stdout through rtk pipe -f <filter> |
| What the model sees | the compressed output of the rewritten command | the compressed output, original markers and exit code preserved |
| Failure mode | rewrite rejected → original command runs | filter unusable → original text delivered |
| Compound commands | rewritten segment by segment: only the output-bearing segment changes | the whole command's output is compressed together |
| Default | on when enabled is on |
off (waiting for rtk to cover more shapes) |
Compound handling under prefix deserves its own paragraph: rtk already rewrites segment by segment (rewrite_compound in discover/registry.rs), and cd /tmp && cargo test measurably becomes cd /tmp && rtk cargo test. The plugin splits both the original command and the product into segments, requires the separator sequence to match one for one, and runs P1–P4 on each segment (a segment that was not touched must be byte-identical; the touched one may only gain a leading rtk ). Anything else is rejected and the original command runs.
Settings
| Key | Default | Meaning |
|---|---|---|
enabled |
unset | master switch; until set, on only when a supported rtk is detected |
enabledForms |
['prefix'] |
which shapes may act; takes effect on the next tool call |
denyCommands |
[] |
extra command patterns never rewritten |
enabledFilters |
['cargo-test','pytest','ctest'] |
pipe filters that may act |
minBytes |
256 |
outputs smaller than this are never compressed |
minGainRatio |
0.95 |
a compression that keeps ≥95% of the bytes is discarded |
stdoutCapBytes |
64000 |
cap on what the filter returns: the compressed body is tail-truncated to this many bytes (the exit marker is kept) |
warnHint |
true |
append the compile-warning hint after cargo test |
rewriteHostEnv |
'' |
value for RTK_REWRITE_HOST; empty leaves it unset |
pipeTimeoutMs |
3000 |
restart-only |
rewriteTimeoutMs |
2000 |
restart-only |
rewriteCacheSize |
256 |
restart-only |
vitestMaxMajor |
5 |
restart-only; vitest at or above this major is not compressed |
logFilterMode |
'off' |
restart-only |
The config schema has 14 fields; 13 of them carry built-in defaults, while enabled follows rtk readiness until you set it explicitly. 9 of them volatile — the settings card writes those and they take effect on the next tool call, enabledForms included. The remaining non-volatile deployment values, 5 of them, are read once at assembly, so changing them needs a restart. The prefix form also writes to rtk's own history.db, because the rewritten command is what actually runs.
Support surface
engines.dsh and the @deepseek-ai/dsh* peers are ^0.2.2-rc.2 (one line, no union); @deepseek-ai/schemastery peer is ^3.19.0; engines.node is >=24.9.0.
External dependency
rtk 1.2.0 was the version every claim in this repository was measured against. The plugin requires >= 1.0.0; below that it reports the version it found and does nothing.
Data and privacy
- Command text leaves the host process only as an argv to your own
rtkbinary. No network call is made by this plugin. - Counters live in the host's storage domain (
<DSH_HOME>/storages/), one record per filter plus a summary; the records carry command counts, bytes before/after, and tokens before/after. Nothing else is persisted. - Tokens are estimated by the host's
tokenMeter(falling back tobytes / 4when the service is absent — the same density as rtk's ownestimate_tokens_from_len). The rewrite form cannot see the original output, so what it saves is only visible throughrtk gain; every number on the card comes from the output-compression form. - Compressed originals can be spilled into the host's spill area when they exceed the inline budget — the same mechanism every other host tool uses, with the same per-session partition.
Known boundaries
rtk rewritedoes not know whether a flag asks for more detail. It rewritescargo test -- --nocaptureandpytest -vvjust like the quiet form, and the detail is then compressed away. The plugin refuses to rewrite any command carrying a detail flag; when it does compress, the loss is bounded by the guard, not by rtk.npm run <script>is never rewritten. rtk maps a script name to a tool name (npm run lint→rtk lint), which would run ESLint instead of your script. The plugin drops any rewrite that removes a word from the original command.- Listing commands fold.
ls,find,grep/rgcan replace a long listing with a+N moremarker; the guard detects the marker family and rejects the compression, so folded listings never reach the model through this plugin. - Approvals see the command you asked for, not the rewritten one. The shadow rewrites
args.commandinsideexecute, which runs after the pipeline'stools/pre-executestage. General command approval (auto-review, danger-guard, Claude-Code-style hooks) therefore evaluates the frozen original arguments (cargo test) while the rewritten form (rtk cargo test) is what actually runs. Sandbox escalation approval is insideorig.executeand is preserved untouched, because the plugin never spawns the command itself. The plugin's own safety net in front of that gap is three subtractions — the information-loss deny table (git diff/git log/git show <ref>/ls/find/grep/rg/cargo clippy/aws), the P1–P4 rewrite checks (only a prefix may be stripped, no script-runner word may disappear), and the vitest major gate. Danger commands (rm -rf,git push --force) are not in rtk's rewrite surface at all, so they run unchanged and are reviewed unchanged — danger-guard is not bypassed. - If any segment of a compound command hits the deny list, the whole command runs unchanged. The deny list (
git diff/git log/ls/find/grep/rg/cargo clippy/aws, …) and the vitest major gate are evaluated per segment, becausecd x && git diffstarts withcd— evaluating the whole string would disable the entire table. On a hit the command is not taken apart either: someone typingcd X && git statusexpects one complete execution, and handing the first half to the shell while stitching the second half back is not the plugin's job. rtk pipeon a failing pytest run keeps the failure names but not always the assertion body. The guard checks for a success claim and for the failing line; a filter output that passes both but still loses detail is a known limit of the filter, not of the guard.
Development
pnpm install --ignore-scripts
pnpm run check # typecheck + lint + build + test + fmt:check
pnpm run smoke @jayyuen66/dsh-rtk from the umbrella workspace mounts the package into a sandbox DSH_HOME; the accepted signal is the --dump-config layer line.
Feedback
Issues and pull requests are welcome: https://github.com/JayYuen666/dsh-rtk/issues.
If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The missed the module table line is especially useful: it tells us whether the shared client row was materialized.
License
MIT for this plugin. rtk is Apache-2.0 for the CLI and command filters this plugin uses; see THIRD_PARTY_NOTICES.md.
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 37546
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★ 36997
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.
superdesigndev/treg★ 8164
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★ 5864
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
sixtysevenlf/dsh-blender-plugin★ 2147
Lets a DSH agent drive a local Blender over a direct TCP channel with 15 tools: viewport frames, custom-angle renders, Python execution, headless and job offload, transaction rollback, and a planning layer of 228 ops across 34 families.
helloHub1212/dsh-windows-mcp★ 1456
Bridges the CursorTouch/Windows-MCP desktop automation server into DSH through the official MCP client bridge, registering its screenshot, UI tree snapshot, mouse and keyboard input, clipboard, process and registry tools as mcp__windows__* tools for the model, and adds a windows_mcp_doctor diagnostic tool. Computer Use is off by default and is switched on from the plugin panel.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.