dsh-context-clean
English | Česky
A DeepSeek Harness plugin that exposes a model-callable context compressor:
context_clean. It strips bloat from a conversation or thinking transcript
while keeping the information that matters — numbers, paths, code, decisions.
Public, MIT-licensed. No runtime dependencies beyond the DSH tools peer.
What it removes (and what it keeps)
| Bloat removed | Preserved |
|---|
Adjacent repeated words (the the the → the) | All first occurrences |
Consecutive duplicate lines (collapsed to a [… N×]… marker) | First line of each run |
| Repeated paragraphs/blocks (later copies dropped) | First paragraph of each block |
| Runs of blank lines (collapsed to one) | Section structure |
The compressor is deliberately conservative: it only drops exact duplicates
(case- and whitespace-insensitive for paragraphs), so numbers, code lines, and
decision text are never rewritten.
Tool
context_clean(text?, path?) — clean a transcript and return the compacted
text plus a one-line before/after summary.
text — inline transcript text (required unless path is given).
path — absolute path to a text file to clean instead.
The engine is a small Python script (scripts/clean_context.py) that ships
inside the plugin, so it works regardless of the session's working directory.
Python 3 is the only prerequisite.
Install
dsh plugin --profile web add dsh-context-clean
After restarting the session, context_clean appears in the tool catalog.
CLI usage (standalone)
python3 scripts/clean_context.py transcript.txt # file → stdout + stats on stderr
cat transcript.txt | python3 scripts/clean_context.py
License
MIT.