casualjim / dsh-headroom
Headroom context compression for DeepSeek Harness: tool-result compression, CCR retrieval, stats — over the configured Headroom proxy URL, with graceful degrade
About this plugin
Written by the registry from verified metadata, not from the README.
dsh-headroom is a DSH plugin published from the dsh-headroom package in the casualjim/dsh-plugins repository.
Capabilities and topics
dsh-headroom
DeepSeek Harness port of the noheadroom Pi extension: Headroom context compression as a DSH Cordis bundle.
What it does
- Tool-result compression — before each model step, the current session surface is sent to a Headroom proxy (
/v1/compressvia theheadroom-aiSDK client) and oversized tool results are replaced with their compressed forms. Onlytool/resultcontent mutates; user prompts, assistant text, tool-call metadata and tool ids are preserved, exactly like noheadroom's Pi policy. - CCR retrieval —
headroom_retrievemodel tool fetches full originals for hashes in compression markers. - Stats & control —
/headroom status|on|off|health|stats|mode <normal|quiet|silent>|run. - Graceful degrade — the proxy is a configured URL, never spawned or managed by this bundle. Unset or unreachable → compression is a no-op with a one-time warning; everything else keeps working.
Install
dsh plugin --profile web add <path-to-this-package>
Run a Headroom proxy yourself (or point at an existing one):
headroom proxy --port 8787
Configuration
Cordis row config (see cordis.patch.yml), environment second, defaults last.
| key | env | default | meaning |
|---|---|---|---|
baseUrl | DSH_HEADROOM_URL → HEADROOM_URL → HEADROOM_BASE_URL | null | proxy URL; null degrades |
enabled | DSH_HEADROOM_ENABLED | true | compression on at boot |
mode | DSH_HEADROOM_MODE | normal | normal/quiet/silent output |
minContextTokens | DSH_HEADROOM_MIN_CONTEXT_TOKENS | 20000 | skip passes below this surface token estimate |
minMessageChars | DSH_HEADROOM_MIN_MESSAGE_CHARS | 2000 | per-tool-result candidate floor |
timeoutMs | DSH_HEADROOM_TIMEOUT_MS | 30000 | per proxy call |
throttleMs | DSH_HEADROOM_THROTTLE_MS | 3000 | minimum gap between passes |
allowRemote | DSH_HEADROOM_ALLOW_REMOTE | false | refuse non-localhost URLs unless true |
renameToolCalls | DSH_HEADROOM_RENAME_TOOL_CALLS | true | defeat Headroom's protected-tool exclusions (read, bash, …) |
maxSeenFingerprints | DSH_HEADROOM_MAX_SEEN_FINGERPRINTS | 512 | seen-content FIFO cap |
How it integrates (no proxy reliance, no interception)
DSH has no pre-LLM-call message interception seam; instead this bundle rewrites the durable session surface, the same pattern as the built-in @deepseek-ai/dsh-compaction-tool-result-pruner:
agent/pre-stepfires → gates check (enabled, throttle, surface tokens ≥minContextTokens).- Surface snapshot → converted to OpenAI wire messages (tool results as candidates, user/assistant as context; tool-call names renamed to
pi_tool_resultso Headroom'sDEFAULT_EXCLUDE_TOOLSdoesn't skip large reads). POST /v1/compress→ result validated per message (count, roles, tool_call ids unchanged).- Each applied tool result lands as a replacement
tool/resultnode (surfaceOp: replace) preceded by the sharedcompaction/pruneshadow-price event, so token accounting subtracts the shadowed node's price. - Loop prevention (ported from noheadroom): reentrancy flag, 3s throttle, input/output/candidate fingerprint trio, seen-content FIFO (original + applied hashes), guard-skip recording.
What Headroom offers that this bundle does NOT cover
Headroom's full surface was investigated against the upstream repo (v0.36.4):
- Memory (
--memory, cross-agent store) — proxy-side feature that only operates when chat requests pass THROUGH the proxy in passthrough mode. DSH sends chat directly to its provider and only calls/v1/compress, so the proxy's memory injection is unreachable. There is no memory HTTP endpoint. - Codebase indexing (
--code-graph) — not Headroom at all: it downloads and runs the third-partycodebase-memory-mcpbinary and watches files for it. No HTTP endpoint; not usable from a compression client. headroom learn— Python CLI that mines agent session logs and shells out to theclaudeCLI. Not exposed over HTTP.- Output token reduction — implemented inside the proxy's passthrough path only.
- Kompress-v2 ML model — runs in the proxy's Rust core; we get it for free by talking to the proxy.
All of the above are proxy-side capabilities; this bundle consumes only the client-facing surface: /v1/compress, /v1/retrieve, /stats, /health.
Port notes
bridge.tsis a faithful port of noheadroom'sbridge.ts(payload build, apply-back, alignment validation, marker naturalization, cheap token estimate) re-typed against@deepseek-ai/dsh-llmmessages.client.ts+proxy-manager.tsfrom noheadroom are replaced bytransport.ts: same HTTP endpoints via the officialheadroom-aiSDK client. No proxy process management exists.- noheadroom's settings.json persistence is replaced by the cordis row config + env;
/headroom on|off|modemutate live state only. - Markers are naturalized to name the
headroom_retrievetool (noheadroom named Pi'sreadtool; DSH has no fixed read tool). - Token numbers in stats/footer text are the cheap
ceil(len/4)estimate, not provider metering.
Badge
Listed here? Link back with this badge — paste the snippet into your repository README.
[](https://dsh-plugin.com/plugins/casualjim/dsh-plugins/dsh-headroom)