# Repository Briefing: NightFrost42/dsh-compaction-weave
> Source: https://repoforai.com/repo/NightFrost42/dsh-compaction-weave (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/NightFrost42/dsh-compaction-weave
- **Official Docs / Website**: https://www.npmjs.com/package/dsh-compaction-weave
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: JavaScript
- **License**: MIT
- **Engineering Health**: A (86/100 · Maintenance 35/35 · Adoption 11/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.8.0 (2026-12-03) — https://github.com/NightFrost42/dsh-compaction-weave/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: CLI
- **Momentum**: 83 ★ total (+1 24h / +9 7d) · 7 forks
- **Topics**: `context-compression`, `conversation-history`, `deepseek-harness`, `dsh-plugin`, `javascript`, `llm`, `prompt-caching`
- **When to Use**: Best for: Long-running DeepSeek Harness coding or research sessions where exact constraints, old tool output and resumable compaction matter more than a minimal setup. Skip if: Your host is not DSH, you must keep a different compaction engine active, or you cannot retain original messages and attachments locally.

## Overview
```text
### Architecture & Core Mechanics
DSH Compaction Weave is a native JavaScript ESM plugin that takes over DeepSeek Harness's built-in @deepseek-ai/dsh-compaction-basic, not a standalone inference server. Its bundled index and engine entrypoints, bundle-index.mjs and bundle-engine.mjs, use shared globalThis state for in-place upgrades. On a capacity trigger, a configured idle trigger or /compact, the engine resolves the route window and measures context in two views before selecting a compaction path.

Stage 1 uses hysteresis to fold eligible old tool output, read-only command entries and unsigned reasoning traces without a model call. If that is insufficient, checkpoint-compile reuses a JIT candidate when available or compiles a span with complete tool-call pairs into a v2 checkpoint. Deterministic A1 auditing and two size-reduction checks gate acceptance. The engine writes originals and attachments to a local zstd write-ahead archive before atomically replacing active history.

### Key Capabilities & Differentiators
Summarization follows the current session model unless a separate provider and model are configured. The default balanced preset allows one JIT warm-up per cycle at or above 90% effective capacity when Stage 1 is insufficient. The default summary cap is 8,192 output tokens; shard concurrency defaults to two and falls back to one on rate limits. An engine-filled checkpoint section keeps up to four recent verbatim user excerpts under a 960-token default budget, and the format retains v1 compatibility.

For exact details omitted from the checkpoint, history_list enumerates archived ranges, history_search runs pure JavaScript BM25F over archived text and attachment indexes with batched queries[], and history_read slices originals by physical line or literal substring. Pause and resume preserve committed chunks; a changed policy requires confirmation before automatic continuation. context_compact queues incremental work at a safe tool-batch boundary: queued is an acknowledgement, not evidence of a completed compaction.

### Trade-offs & Limitations
Weave trades a simpler summarization path for explicit requirement checks, durable history and recoverability. A1 can catch changes to booleans, CLI flags, exact scalars and hard polarity without a second LLM audit, but it is not a proof that every semantic nuance survived. Folding may avoid a summary call; JIT, retries and retrieval can still add work. Source isolation and credential redaction for workspace rereads do not make the full-fidelity archive safe to share.

In the published v0.8.0 small-window benchmark, retention was 93.83% for GPT-6.1 Sol and 94.96% for DeepSeek-V4.1-Flash. Compared with dsh-basic, both improved pooled accuracy and reduced end-to-end time, but the DeepSeek run cost 13% more. Both models completed the 100K long-window suite at 100%, with retention of 98.43%–99.14%; these are suite results, not service guarantees. Weave yields to presets with their own engine and does not support running alongside billion-context or other compaction plugins and proxies.

### Hardware & Deployment Guide
Install into a DeepSeek Harness profile on Node.js >=24.9.0 and DSH >=0.2.2-rc.1 <1.0.0-0. Stop the target profile, run dsh plugin --profile web add dsh-compaction-weave with web replaced by the actual profile name, then restart it. DSH also accepts a local .tgz, including through the desktop plugin manager. An offline package changes how the plugin is installed, not whether the configured summary model needs a network connection.

From v0.7.2, the self-contained runtime entrypoints address stale submodule caching during hot upgrades. If an in-place upgrade from v0.7.0 or v0.7.1 fails, disable and uninstall the old plugin, fully restart DSH, then install v0.8.0. Saved settings apply to subsequent compactions without a restart; in-flight work keeps its original settings. Plan local disk capacity and access controls around retained messages and attachments. No plugin-specific GPU or VRAM requirement is specified.
```

## Key Capabilities
```text
- Window sizing: Exact provider/model mapping takes precedence over adapter declaration, provider wildcard and fallback.
- Low-cost first pass: Hysteretic Stage 1 folds eligible old content with zero model calls; default JIT allows one warm-up per cycle at or above 90% effective capacity.
- Checkpoint format: Compact v2 uses four sections, preserves compatibility with v1 and inserts up to four recent verbatim user excerpts within a 960-token default budget.
- Commit safeguards: Deterministic A1 audit and two size checks gate replacement; the zstd write-ahead archive is written before active history changes.
- Original-history lookup: Pure JavaScript BM25F accepts batched queries[], while history_read retrieves source text and attachments by physical line range or literal substring.
- Recovery: Persistent progress resumes without repeating committed chunks; billion-context migration creates a SHA-256 baseline backup.
```

## Quick Start / Clone
```bash
git clone https://github.com/NightFrost42/dsh-compaction-weave.git
cd dsh-compaction-weave
npm test
npm run check
npm run pack:release
```
