
Rianico/dsh-better-edit
41Last commit Aug 16, 2026
dsh-better-edit DSH plugin
dsh-better-edit replaces the built-in read/edit tools with hash-anchored editing. Every line gets a 3-character content hash, and edits target hashes, eliminating the need to echo old code. This reduces token usage, prevents misapplied edits, and supports chained edits without re-reads.
How to install the dsh-better-edit DSH plugin
dsh plugin --profile <name> add dsh-better-edit # from npmThis source command needs manual review. Copying does not run it.
dsh-better-edit DSH plugin data source
dsh-better-edit DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-better-edit DSH plugin can do
- Read files with each line prefixed by a unique 3-character hash (HASH│content).
- Edit file ranges by specifying hash anchors (remove_from/remove_to) instead of line numbers or text.
- Batch edit up to 32 edits atomically with all-or-nothing rollback.
- Undo the last edit with undo_last_edit, which persists across restarts.
- Replace the built-in read/edit tools via scoped agent registration on session start.
Where the dsh-better-edit DSH plugin fits
- Reducing output token costs in long editing sessions by up to 31%.
- Avoiding patch-failure rates (46–51%) common with str_replace-style edits.
- Performing chained edits on the same file without re-reading between each edit.
- Editing files where line numbers are unstable due to prior edits above.
Who the dsh-better-edit DSH plugin is for
- DSH users who want more reliable and token-efficient code editing.
- Developers building agents or workflows that require precise file modification.
dsh-better-edit DSH plugin limitations
- Only works with text files (UTF-8); binary and non-text files are rejected.
- Not suitable for new file creation (must use the built-in write tool).
- Requires Node.js ^22.19.0 || >=24.0.0 (matching DSH's requirement).
- Lines longer than 200KB are shown as a marker with a sed hint, not full content.
dsh-better-edit DSH plugin: from the repository README
Quoted from the Rianico/dsh-better-edit README, the upstream source of the dsh-better-edit DSH plugin. Copyright remains with the original authors.
Edit by content address — not by line numbers, not by string replacement. Fewer tokens. More attention for real work. Zero misapplied edits.</strong> </p> <p align="center"> <strong>English</strong> · <a href="README.zh.md">简体中文</a> </p> <p align="center"> <a href="#quick-start">Quick Start</a> • <a href="#why-hashline">Why Hashline</a> • <a href="#benchmark">Benchmark</a> • <a href="#tools">Tools</a> • <a href="#acknowledgments">Acknowledgments</a> </p> <p align="center"> <img src="https://img.shields.io/badge/version-0.1.9-blue.svg" alt="Version"> <img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT License"> <img src="https://img.shields.io/badge/DeepSeek_Harness-Plugin-blueviolet.svg" alt="DeepSeek Harness Plugin"> <img src="https://img.shields.io/npm/v/dsh-better-edit" alt="npm version"> <img src="https://img.shields.io/npm/dm/dsh-better-edit" alt="npm downloads"> <img src="https://img.shields.io/github/stars/Rianico/dsh-better-edit?style=social" alt="GitHub Stars"> </p> <p align="center"> <img src="assets/banner.svg" alt="file.ts → read → hashed lines → edit by hash → diff" width="900"> </p> --- > *"The harness — not the mod
Read the full READMERepository license: MIT
dsh-better-edit DSH plugin questions
How do I install dsh-better-edit?
Run `dsh plugin --profile <name> add dsh-better-edit` from npm, or `dsh plugin --profile <name> add /path/to/dsh-better-edit` from a local checkout. The next session will use the hashline tools. Verify with `dsh --profile <name> --dump-config` to see the plugin layer.
What does 'hashline' mean?
Hashline is the core concept: every line of a file gets a unique 3-character hash derived from its content. The hash acts as a stable address, so edits target hashes instead of line numbers or text. This makes edits content-addressable and immune to positional drift.
Does dsh-better-edit replace the built-in read and edit tools?
Yes. On session start, the plugin registers its own `read` and `edit` tools on the agent's scope, which shadow the built-in ones. The built-in `write` tool is left in place, but a post-execute listener appends an auto-read after write results. The replacement is scoped per agent and unwinds when the agent is disposed.
What error codes can I expect and what do they mean?
The plugin defines several error codes like `[E_RANGE_STALE]` (a served line differs on disk), `[E_RANGE_UNSERVED]` (range includes lines never served), `[E_AMBIGUOUS_ANCHOR]` (hash matches multiple lines), and `[E_NOT_TEXT]` (file is binary). Each error is accompanied by fresh anchors or a clear message for retrying.
How does dsh-better-edit save tokens compared to str_replace?
Instead of echoing the old text verbatim, the edit call sends two 3-character hashes. The benchmark shows a 31% reduction in output tokens for a 12-edit session, and 43% savings on multi-line ranges. Since output tokens are billed ~5–6× input, this translates to roughly 1.4× less effective cost.