- Home
- Plugin
- Sicurezza e permessi
- dsh-rtk-plugin
dsh-rtk-plugin
errrepe/dsh-rtk-plugin
RTK (Reusable Token Kompressor) tool for DeepSeek Harness — token-optimized CLI proxy exposing read/ls/git/grep/err/test/json and more through the standard shell sandbox.
Installazione
dsh plugin --profile web add github:errrepe/dsh-rtk-pluginREADME
dsh-rtk-plugin
RTK (Reusable Token Kompressor) tool for DeepSeek Harness — a high-performance CLI proxy that filters and compresses command output before it reaches the model context, saving substantial tokens.
This bundle exposes RTK as a model-facing rtk tool through the standard
ctx.shell capability seam, so every call inherits the harness's sandbox
policy, timeout handling, and cancellation exactly like the native bash
tool.
What the tool does
The model (and you, via @) gets one tool, rtk, that runs any RTK
subcommand with token-optimized output:
| Subcommand | Use |
|---|---|
read <file> | Read a file with intelligent filtering (-n line numbers, -m N max lines, --tail-lines N, -l minimal|aggressive) |
ls / find | Compact directory listing / file finding |
git <args> | Compact git output (status, log, diff, branch…) |
grep / rg | Compact search, grouped by file |
err -- <cmd> | Run any command, show only errors/warnings |
test -- <cmd> | Run tests, show only failures |
json <file> | Compact JSON (-d depth, --keys-only for structure only) |
deps | Summarize project dependencies |
diff / log / wc | Condensed diff / deduplicated logs / compact counts |
smart <file> | 2-line technical summary of a file |
summary -- <cmd> | Heuristic summary of command output |
Plus wrappers for tree, gh, glab, aws, psql, pnpm, docker, kubectl, jest, vitest, prisma, tsc, next, lint, prettier, cargo, npm, npx, ruff, playwright, dotnet, wget, env, curl, format.
The tool's command parameter takes the subcommand without the leading
rtk (e.g. read -n -m 50 package.json, git status, err -- npm run build).
Prerequisites
- RTK installed and on the
PATHthe shell executor uses (brew install rtk/rtk --versionto check). If it lives elsewhere, see Configuration.
Install
Into a profile (recommended — survives restarts):
dsh plugin --profile web add dsh-rtk-plugin # from npm (once published)
dsh plugin --profile web add /path/to/dsh-rtk-plugin # from a local checkout
Then restart dsh web (or the profile's host) for the composition to pick
up the new bundle row.
Uninstall / disable
dsh plugin --profile web remove dsh-rtk-plugin
Or disable just the row in the profile's cordis.patch.yml:
- id: rtk
disabled: true
Default routing (enforced)
By default (guardBash: true) every single bash command whose first word
maps 1:1 to an RTK wrapper (grep, rg, ls, cat→read, git, wc,
find) is denied at the tools/guard layer. The denial message tells the
model to retry through the rtk tool:
Route 'grep' through the rtk tool ... Retry as rtk command 'grep …'
Compound or piped commands (|, &&, ;, `, $(, >, <, () and
multi-line scripts are exempt — RTK cannot wrap them, so they run raw.
Explicit opt-out: when the model really needs raw output, it appends a shell comment that the guard checks for:
grep pattern file.txt # no-rtk # or: # raw
Either marker lets the call through.
Settings UI (enable/disable)
Since 0.3.0 the plugin exposes a persisted toggle in the browser, like dsh-simple-english:
- Composer chip (
conversation.input.left) — labelRTK: On/Off, always visible while typing. Click to flipenabled. - Settings > General row — shows RTK title, hint, enabled toggle, guard toggle, and rtkPath input.
- Settings > Plugins card — same controls inside the plugins configurable tab (
settings.plugin.item), so the plugin appears where you expect it.
All three read and write through /api/dsh-rtk/{describe,mutate} (loopback-only) and persist to ~/.dsh/settings.yaml:
rtk:
enabled: true # master switch — when false, tool advises to enable and guard is off
guardBash: true # when true, single bash with wrappable tokens is denied
rtkPath: rtk # binary path, e.g. /opt/homebrew/bin/rtk
The settings layer resolves as: schema defaults → composition base (your cordis.patch.yml config) → user document (settings.yaml). Changing the UI re-shapes the very next model step via system prompt and guard.
i18n: the client detects navigator.language and shows labels in English, Chinese (zh), or Portuguese (pt).
Disable via code still works:
- id: rtk
disabled: true
Or via CLI:
dsh plugin --profile web disable dsh-rtk-plugin
dsh plugin --profile web enable dsh-rtk-plugin
System prompt (always use RTK)
When enabled is true, the plugin registers a system prompt section tool:rtk at order 106 (near tool guidance):
RTK (Reusable Token Kompressor) is installed. Prefer the rtk tool for token-optimized output over raw bash. Use rtk read for file reads (cat maps to read), rtk grep/rg for search, rtk ls/find for listings, rtk git for git status/log/diff, plus rtk json, smart, diff, log, wc, deps, err, test, summary. Single bash commands with wrappable tokens (grep, rg, ls, cat, git, wc, find) will be denied — retry as rtk without leading rtk. Compound, piped, or multi-line commands run raw. Append '# no-rtk' or '# raw' to force raw output. rtk gain tracking needs workspace-write and may fail under sandbox — expected, not a bug.
When enabled is false, the section returns empty string and leaves no residue. When guardBash is false, the prompt says "Guard is off: rtk is opt-in, but prefer it".
This matches RTK upstream's hook behavior — the model should always use RTK for single commands that RTK wraps, and fall back to raw bash only for pipes/compounds or explicit bypass.
Configuration
The bundle row accepts options via the profile's cordis.patch.yml (the base layer that seeds the settings namespace on first run):
- id: rtk
name: 'dsh-rtk-plugin'
config:
enabled: true # default: true — set false to start disabled
rtkPath: /opt/homebrew/bin/rtk # default: 'rtk' (PATH resolution)
guardBash: true # default: true — set false to keep rtk opt-in
After first start you can edit the same keys in Settings UI instead of YAML — the UI writes to ~/.dsh/settings.yaml and survives restarts.
Notes and limitations
rtk gain(savings history) may fail under a file sandbox because its tracking DB lives outside the session workspace — expected, not a tool bug.- RTK output is already token-optimized; avoid piping it through additional filters.
- Non-zero exits are reported as
[exit code: N]markers; sandbox denials as[sandbox: file access denied under <mode> mode]— the same vocabulary as the native bash tool.
Development
npm test # smoke tests (no harness needed)
Pure JavaScript, no build step — index.js is the published source.
License
Plugin correlati
dsh-infinite-gen-4
minglink/dsh-infinite-gen-4
api-relay-audit
toby-bridges/api-relay-audit
dsh-redteam-model
seaof0/dsh-redteam-model
dsh-auto-review
perrylink/dsh-auto-review