dsh-stream-agent: A Single-Stream Protocol Plugin for DeepSeek Harness
54dsb1/dsh-stream-agent
A DeepSeek Harness (DSH) plugin that replaces turn-based loops with a single-stream protocol, cutting token usage by ~71% while keeping task accuracy.
dsh-stream-agent is a reasoning optimization plugin for DeepSeek Harness that turns what the model sees and when it is interrupted from a turn-based loop into a single-stream protocol, without retraining the model. It targets the token overhead of re-injecting full context every round by letting the model emit reasoning and tf-* commands in one stream, dispatching each command the moment it closes. Successful commands are only recorded in a ledger rather than re-injected, failures interrupt the model, and tiered observations plus prefix assertions compress context further. The kernel and adapter are separated so upstream API drift only touches the thin shell, and both desktop and web clients are supported.
How to Install
dsh plugin --profile web add github:54dsb1/dsh-stream-agent- Category
- Models & Reasoning
- Platform
- DeepSeek Harness
- Author
- 54dsb1
- Distribution
- Plugin
dsh-stream-agent Key Features
dsh-stream-agent Repo Summary
What Does It Do?
Stream Agent is a DSH plugin for DeepSeek Harness that turns what the model sees and when it gets interrupted from a turn-based loop into a single-stream protocol, without retraining the model. It solves the token overhead of re-injecting full context on every round, letting the model emit reasoning plus tf-* commands in one stream and dispatch each command the moment it closes. It is written in TypeScript by 54dsb1 under Apache-2.0, has zero npm dependencies, and requires Node ≥ 24.
Core Features
- Single-stream protocol kernel: the model emits reasoning, consecutive tf-* commands and depends_on declarations in one streaming request; the parser reads chunk by chunk and dispatches commands as soon as they close instead of waiting for the stream to end.
- Success stays silent, failure interrupts: successful tf-write and tf-bash calls are only recorded in the ledger and never injected, while failures are injected; tf-read returns one full feedback pass (up to 8000 characters, head and tail kept with the middle elided) and tf-peek retrieves line ranges on demand.
- O1–O6 token optimizations: tiered observations, line skeletons, handle-directory diffing and prefix assertions compress context together; the author's live test measured weighted token use at 28.9% of the native loop baseline with task correctness at 9/10, on par with the baseline.
- Reversibility gate: gate.admit judges, rewrites or rejects every command, and independent commands run in parallel through a worker pool of at most three, keeping single-stream execution safe.
- Kernel/adapter separation: the kernel layer imports nothing from the upstream framework and can be unit-tested on its own, so upstream API drift only touches the thin adapter shell and the plugin can keep pace with DeepSeek Harness.
How to Use This Plugin?
After enabling it in DSH, just give the model a task as usual; the plugin takes over requests and tool calls at the driver layer, so no prompt rewriting is needed. The model works through the tf-* command set written into the system prompt: tf-write for writing or editing files, tf-read for reading (optionally with offset/limit), tf-bash for running commands, tf-peek for retrieving fragments, and tf-final for declaring completion. To inspect results, review the observation ledger and metrics the plugin records and compare token usage against task correctness; both desktop and web clients are supported, including session projection and resume sequence reconciliation.
How to Troubleshoot This Plugin?
If a request is refused before sending, the prefix assertion likely failed: the plugin hashes context before every request and fails closed when it is not monotonic, so check whether anything mutated already-sent context. If correctness dips on write-heavy batches, that is the documented correctness-first trade-off — the model uses full feedback for read-write verification loops, spending more tokens but keeping checks stable; consult the official notes when deciding whether to adjust the feedback strategy.
Sources
- GitHub plugin folder54dsb1/dsh-stream-agent
- README54dsb1/dsh-stream-agent README
This page is an independent rewrite of the repository README. For authoritative documentation and the latest changes, refer to the GitHub repository. Plugins are third-party code that runs on your machine once installed; inclusion does not imply endorsement — review the source before installing.
DSH Plugin Hub FAQ
