npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-compact

v0.1.0

Published

Compaction telemetry & shadow-cost reporting for DeepSeek Harness: tracks every compaction's shadowed tokens, summary cost, and model, with a /compact-stats report.

Readme

dsh-compact

Compaction telemetry & shadow-cost reporting for DeepSeek Harness (dsh).

Every time dsh compacts your context it shadows tens of thousands of tokens behind a summary — and pays a one-shot LLM call to write that summary. The compaction/* events carry all of this (shadowedTokenCount, the summary's usage, provider/model, failure codes), but there is no way to see it without trawling the session log. dsh-compact listens to the session/event firehose and turns the lifecycle into accounting:

  • What left the surface — shadowed tokens per compaction, cumulative
  • What it cost — summary LLM usage per compaction (tokens of the summarization call itself)
  • Net effect — shadowed minus summary tokens: the actual surface reduction
  • Reliability — failed attempts (busy / cancelled / summary / …) counted separately, crash-recovered compaction/summary without a matching start still recorded

All of it via one command:

/compact-stats
dsh-compact — 2 compaction(s), 0 failure(s)
shadowed 60,000 tok · summaries ~1,900 tok · net −58,100 tok on the surface
summary LLM cost: 60,400 tok across calls

time               turn   shadowed   summary   model
14:32:05           7      12,000     ~500      deepseek-chat
14:29:11           3      48,000     ~1,400    deepseek-chat

Install

dsh plugin --profile <name> add dsh-compact
# or from git:
dsh plugin --profile <name> add github:leesama/dsh-compact

Configure

- id: compact
  name: dsh-compact
  config:
    reportRows: 10     # rows in the /compact-stats table
    persist: true      # use an explicitly injected store; default mounting is in-memory

How it works

session/event (firehose)
  ├─ compaction/start    → open a record (manual turns: turn = null)
  ├─ compaction/summary  → attach shadowedTokenCount / summary / usage / model
  └─ compaction/end      → close the record (error? → failure row)
                            → persist via the injected store
commands
  └─ /compact-stats      → table + cumulative totals

The fold logic (src/engine.ts) is a pure reducer, tolerant of crash-recovery orderings (summary without start, bare failed end). The suite named test:e2e drives apply() against a mock session firehose; these are simulated integration tests, not a real DSH process test. Its persistence round-trips use an in-memory test store. A custom host can pass a CompactionStore explicitly; normal plugin mounting uses a no-op store, and a storageDomain adapter is not implemented.

test:package separately builds the release, packs and installs the tarball into a temporary directory, and imports its entry in a fresh Node process. This verifies the published module layout, not full DSH behavior.

Development

npm install
npm run typecheck   # tsc --noEmit (strict)
npm test            # unit + e2e
npm run test:coverage
npm run test:package # pack, install and load the built module
npm run build       # tsc → lib/

License

MIT