AI Agent Hub
Back to plugins
🤖

dsh-plugin-save-token

Model Inference Updated 2026.09.04

Run the following command in DeepSeek Harness:

dsh plugin install vibe-any/dsh-plugin-save-token

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install vibe-any/dsh-plugin-save-token in your terminal to install the plugin, source at https://github.com/vibe-any/dsh-plugin-save-token, then restart your dsh instance to activate it.

About this plugin

In multi-turn agentic sessions, large tool outputs — API JSON, CLI tables, raw logs — keep re-entering the context window and quietly dominate the token bill. Brute-force truncation, however, measurably hurts model accuracy: research shows that even padding with irrelevant content alone can drop performance by 13.9% to 85%. dsh-plugin-save-token takes a different approach: structure-aware, reversible compression that trims redundant bytes while the original text is always written to disk and restorable in a single step.

Several complementary strategies work together. Pipe-delimited dense tables get verbatim head and tail retention with stride-sampled middle rows annotated by original line number, giving the model a coordinate map rather than a broken window. Homogeneous JSON arrays are first re-encoded via a TOON-style lossless route — one schema header plus CSV data rows — saving 30% to 60% of tokens with zero information loss. Byte-identical tool outputs within a 90-second window are collapsed into a single reference to prevent duplicate context bloat. Every compressed candidate must pass a dual gate: the byte gate (no more than 72% of original size and at least 500 bytes saved) and the token gate (estimated tokens strictly decrease). If either gate fails, the output passes through untouched. Up to 25 error, fatal, or traceback lines within omitted log regions are always retained so debugging evidence is never lost. A live dashboard in Settings and a persistent strip under the input box display per-turn billed tokens, cumulative savings, and a top-tools leaderboard.

This plugin is built for developers and teams running multi-turn agent tasks on DeepSeek Harness where tool output is printed directly into the context — verbose test runs, raw log dumps, and large JSON registries see the biggest gains. When agents use a write-then-read pattern, compression simply does not trigger and adds zero overhead.

Use Cases

  • Multi-turn agent sessions where large JSON or CLI tables re-enter the context and inflate token costs
  • Verbose test outputs or raw logs printed directly into conversation that need compression without losing debug signals
  • Repeated identical tool calls within a short window producing byte-identical outputs that should be deduplicated

Best For

  • Developers running multi-turn agent tasks on DeepSeek Harness
  • AI application teams balancing token cost against model accuracy
  • Engineering teams that require auditable, reversible context compression policies