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

token-optimizer

v0.2.2

Published

Reduce coding-agent token waste by filtering noisy tool, shell, MCP, and read output while preserving useful results.

Downloads

1,315

Readme

token-optimizer

Reduce token waste from coding-agent tool output.

token-optimizer filters noisy command output before it is sent back into an AI coding agent. It keeps errors, failures, changed files, paths, summaries, and other useful details, while removing repeated progress output, boilerplate, wrappers, and duplicated history.

It is useful for Codex, OpenCode, Cursor, Claude Desktop, and other coding-agent setups that read terminal or MCP tool output.

Install

npm global install

npm install -g token-optimizer
token-optimizer install
token-optimizer status

This exposes the token-optimizer command through npm's global bin directory. If your shell cannot find it, add your npm global bin directory to PATH.

You can also run it without a global install:

npx token-optimizer status
npx token-optimizer install

One-line shell install

macOS/Linux:

curl -fsSL https://raw.githubusercontent.com/edisonaugusthy/token-optimizer/main/install.sh | bash

Windows PowerShell:

irm https://raw.githubusercontent.com/edisonaugusthy/token-optimizer/main/install.ps1 | iex

The shell installers place the filter in ~/.config/token-optimizer and create a token-optimizer command shim:

token-optimizer
token-optimizer stats
token-optimizer run git status --short

On macOS/Linux the shim is installed to ~/.local/bin/token-optimizer. If that directory is not on PATH, add this to your shell rc file:

export PATH="$HOME/.local/bin:$PATH"

Commands

token-optimizer            # show install status and token totals
token-optimizer status     # same as above
token-optimizer install    # detect agents and wire MCP config
token-optimizer update     # update package and refresh configs
token-optimizer uninstall  # remove managed config blocks
token-optimizer stats      # show token savings totals

Standalone filter commands:

to-filter git status --short
to-filter npm test
to-filter stats

Shell-installer shim:

token-optimizer run npm test
token-optimizer run rg "TODO" src

What It Filters

token-optimizer focuses on output that coding agents commonly send back into context:

  • Git status, diffs, logs, commits, pulls, pushes, and fetches.
  • Test output from npm, pnpm, yarn, bun, deno, pytest, cargo, go, rspec, Playwright, Gradle, Maven, .NET, PHP, and more.
  • Build and lint output from TypeScript, ESLint, Ruff, Go, Cargo, Make, CMake, Ninja, Vite, Next, Turbo, Nx, Docker, Kubernetes, Helm, and Terraform.
  • Search and listing output from rg, grep, find, tree, and directory reads.
  • MCP and browser/tool output where repeated metadata or duplicate lines are common.

The filter preserves exit codes. If filtering fails, raw output is returned.

How It Saves Tokens

Savings come from output the tool actually changes:

  • Removing repeated progress bars and spinner lines.
  • Grouping long file lists into smaller summaries.
  • Keeping failure details while dropping passing-test noise.
  • Removing duplicated browser console/network lines.
  • Cleaning repeated MCP metadata and schema descriptions.
  • Trimming old duplicate tool outputs from agent history while keeping the newest full copy.

It does not rely on current-output caps or response-token caps.

Manual Agent Rule

If you want to route shell commands manually, add this to your agent instructions:

Always route shell commands through the token filter:

```bash
node ~/.config/token-optimizer/filter.js <command> [args...]
```

Request raw/full/verbose output when exact logs are required.

Local Development

npm install
npm run build
npm test

Useful local commands:

node dist/scripts/setup.js status
node dist/scripts/setup.js install
node dist/scripts/filter.js git status --short
node dist/scripts/filter.js stats

Uninstall

token-optimizer uninstall

For shell-installer installs:

curl -fsSL https://raw.githubusercontent.com/edisonaugusthy/token-optimizer/main/install.sh | bash -s -- --uninstall

Windows:

irm https://raw.githubusercontent.com/edisonaugusthy/token-optimizer/main/install.ps1 | iex -Uninstall

License

MIT