improved-compact
Run the following command in DeepSeek Harness:
dsh plugin install muou000/improved-compact
Paste the following prompt into your AI chat to install this plugin:
Run dsh plugin install muou000/improved-compact inside DeepSeek Harness; the plugin source is at https://github.com/muou000/improved-compact and it replaces the base compaction-basic with the improved-compact provider on install.
About this plugin
The default compaction in DeepSeek Harness hits a familiar wall in long sessions: the moment context pressure rises, a summary model fires and a crude uniform prune silently drops constraints, user corrections, and exact values buried in tool output. improved-compact exists to close that gap. It layers six deterministic safeguards on top of the standard ctx.compaction service, turning compaction from a squeeze-it-in strategy into a deliberate keep-what-matters, drop-what-repeats, alert-what-costs approach.
Under the hood, the provider triggers a model-free tool-result prune at 60 percent of the window and only calls a summary model at 80 percent. Pruning preserves head and tail segments, recovers high-signal lines such as goals, constraints, paths, commands, and key=value assignments from the dropped middle, and exempts goal, todo, and request_user_input tools by default. Assignments follow last-write-wins so an earlier value never overwrites a later correction. The most recent direct user message is kept verbatim when it fits the budget, falling back to bounded Verbatim Anchors otherwise. A summary missing or misordering any of the eight native checkpoint sections is rejected at write time, and consecutive compactions are capped at 1800 Unicode code points to prevent drift. Request-cost budgeting alerts by default and can be configured for hard blocking, all without reading prompt bodies. The install patch also lowers the spill inline threshold from 50000 to 8192 bytes so large tool outputs are persisted to the spill store from the moment they are produced.
It suits production DSH agent users running multi-tool, long-horizon sessions; developers who want auditable, reversible compaction instead of a black-box summariser; and teams that prefer soft alerting first with optional hard guards. Uninstalling restores the base profile immediately, and existing session logs need no migration because the provider writes only upstream-standard events.
Use Cases
- Key constraints and exact values lost in mid-context during long multi-tool sessions
- Production agents needing auditable, reversible compaction instead of black-box summarisation
- Teams preferring soft alerting before hard blocking under context pressure
- Large tool outputs repeatedly consuming subsequent request windows, solved by one-time spill persistence
Best For
- DSH agent developers running long-horizon, multi-tool production sessions
- DevOps teams standardising compaction behaviour across profiles with reversible rollback
- Teams that prefer deterministic, inspectable compaction rules over LLM-based semantic classification
Related Plugins
A service-oriented sidebar framework for DSH, offering a full workbench with file explorer, embedded browser, real terminal, Git panel, and extensible plugin services.
A beautiful, practical Claude Code-style TUI plugin with pixel whale top bar, flowing glow title, real-time status line, streaming thought expansion, time rewind, context progress bar and TPS gauge — zero core changes.
The plugin market for DeepSeek Harness: browse/search/one-click install community plugins and themes, with updates, backup/restore, hot disable, diagnostics, and AI fix.
A persistent whale widget on the DSH web UI that shows DeepSeek balance, today's usage, and per-turn cost, with drag-and-snap and sound effects.