dsh-agent-compact: An Agent-Driven Span Compaction DSH plugin for DeepSeek Harness
mimichunterz/dsh-agent-compact
DSH plugin for agent-driven span compaction: compress chosen conversation spans into self-written checkpoints instead of the official head-anchored full-context sweep.
Let the DeepSeek Harness agent autonomously choose finished, no-longer-needed conversation spans to compress and replace them with self-written checkpoints, minimizing information loss.
dsh plugin --profile web add github:mimichunterz/dsh-agent-compact- Category
- Memory & Context
- Platform
- DSH-Plugin
- Author
- mimichunterz
- Distribution
- Plugin
dsh-agent-compact Key Features
dsh-agent-compact Repository

dsh-agent-compact Repo Summary
dsh-agent-compact is a context compression plugin (DSH plugin) for DeepSeek Harness, maintained by MimicHunterZ, written in TypeScript, and last updated in 2026-08. It solves the problem that the official compaction mechanism only compresses from the start of the conversation, causing the opening task plan and direction to be partially lost along with the compressed information. This plugin allows the agent to autonomously call context_compact to compress a span of the conversation it chooses—the finished, no-longer-needed middle—and replace it with a checkpoint the agent writes itself, minimizing information loss. Key capabilities include: precise span selection via startAnchor / endAnchor (with CJK punctuation-width tolerance), a mandatory summary parameter (the agent-written Markdown checkpoint), archiving of the raw span to a spill store (~/.dsh/spill/session-<hash>/<hex>-<seq>.txt, sequential naming, restart-safe), and no separate LLM summarizer request—the tool call happens inside the agent's normal turn and is billed like any other turn.
What core features does the dsh-agent-compact DSH plugin support?
- Agent-chosen span compression: The agent selects the span via
startAnchor/endAnchor(unique-prefix matching, CJK punctuation-width tolerant), enabling precise targeting of any middle segment. - Agent-written checkpoint: The
summaryparameter is mandatory, so the compressed span is replaced with a Markdown checkpoint the agent wrote itself, preserving key details instead of an auto-generated summary. - Raw data archiving: The full raw span is archived to the spill store before replacement; the path is echoed in the shadow message so the model can read the raw text back, and it survives restarts.
- No extra summarizer request: Reuses the host engine's stock transaction (boundary validation, tool-pair balance, surface replacement) with no separate LLM summarizer call, saving cost.
How to install dsh-agent-compact?
Use the following command, then restart the profile for the context_compact tool to appear:
dsh plugin --profile web add github:mimichunterz/dsh-agent-compact
For a local checkout, run dsh plugin --profile web add ./agent-compact. The dsh plugin command forwards to pnpm in the profile directory and appends the bundle to dsh.profile.bundles. The bundle's own cordis.patch.yml pins the spill archive root to ~/.dsh/spill; deployments can override it via the profile's cordis.patch.yml.
How to uninstall dsh-agent-compact?
Use the following command, then restart the profile:
dsh plugin --profile web remove @mimichunterz/agent-compact
This forwards to pnpm remove, uninstalling the package and reconciling the bundle out of dsh.profile.bundles. If the plugin was additionally mounted through a row in the profile's cordis.patch.yml (dev mode), remove that row too, otherwise it will re-mount on the next boot.
What configuration options does dsh-agent-compact have?
| Field | Default | Meaning |
|---|---|---|
autoArchive | true | Whether to save the full raw span to a spill artifact before replacing it |
Configuration can be passed through the inserted row in the profile's cordis.patch.yml or a bundle patch.
How does dsh-agent-compact work?
patchEngine() (see src/optimizer.ts) wraps the engine's summarize() method: when an _externalSummary (the agent-written checkpoint) is present, it uses that summary directly, bypassing the official engine's auto-summarization. The tool call happens inside the agent's normal turn and is billed like any other turn; only the extra summarizer request the official engine would make for the same span is avoided.