Skip to main content

Shrink AI-agent command output to save tokens (git + npm, Windows)

Project description

slim-shady

Install as slim-shady; the command you run is slim.

ci release license

Shrink AI-agent command output so it burns fewer tokens.

When an AI coding assistant runs git status or npm install, the raw output can be hundreds of lines — and every line costs tokens, money, and context-window space. slim runs the command, compresses the output (keeping what matters, dropping the noise), and returns the compact version. Same information, ~70–90% fewer tokens.

Windows · works with git and npm · integrates with Claude Code

$ slim git status
branch: main
summary: 0 staged, 1 modified, 3 untracked
modified (1):
  M src/app.py
untracked (3):
  README.md  LICENSE  tests/
[slim: hid ~58 tokens - run 'slim expand' for full output]

Install

Download the .exe (no Python needed) — easiest

  1. Grab slim.exe from the latest release.
  2. Put it in a folder on your PATH.
  3. Run slim git status. (You only need git/npm installed — the tools it wraps.)

Or install with pip

pip install git+https://github.com/SRUJAN-cpu/slim-shady

Quick start

slim init -g          # turn on automatic mode for all projects (see below)
slim git status       # try it manually
slim gain             # see how many tokens you've saved
slim doctor           # check everything is wired up

Make it automatic (recommended)

Typing slim every time is annoying. slim init installs a Claude Code hook so your agent's git/npm commands are compressed automatically — when it runs git status, it's transparently rewritten to slim git status.

slim init       # this project only
slim init -g    # all projects (global ~/.claude settings)

Restart Claude Code afterwards. See hooks/README.md for details and manual setup.

Commands

slim git <args>     run git, return compressed output
slim npm <args>     run npm, return compressed output
slim expand         print the full output of the last slim command
slim gain           savings dashboard (tokens saved, by tool, biggest)
slim reset          clear saved stats
slim doctor         health check: PATH, hook, tokenizer, tools
slim init [-g]      install the Claude Code auto-rewrite hook (-g = global)
slim --version      print version
slim --raw git ...  debug: show before/after + % saved

How it works

  1. slim dispatches to a per-tool filter that understands that command's output.
  2. Each filter applies four strategies:
    • filter — drop noise (ANSI colors, progress bars, npm http/timing lines)
    • group — e.g. untracked files grouped by directory
    • truncate — keep the head/tail of long blocks, hide the redundant middle
    • dedupe — collapse repeated lines into line (xN)
  3. For git, known subcommands re-run a compact native variant (--porcelain, --oneline, --stat). For npm, the command runs once (installs/tests have side effects) and the captured output is compressed.
  4. Errors, failures, warnings and summaries are always kept. Anything hidden is recoverable with slim expand.

How tokens are counted

slim measures savings by tokenizing text locally — no API calls during normal use:

saved = count(raw output) - count(compressed output)
  • Both the .exe and the pip install count with tiktoken, a real tokenizer. The .exe bundles tiktoken's vocab so it works fully offline.
  • tiktoken uses GPT's vocabulary — a close proxy for Claude, usually within a few percent, not exact. That's why counts are labelled ~.
  • A ~4 chars/token estimate remains only as a crash-safety fallback; slim doctor shows which counter is active.

Build the .exe yourself

build.bat        # produces dist\slim.exe (bundles tiktoken, fully offline)

Scope & limitations

  • Windows, git + npm only (more commands planned).
  • tiktoken approximates Claude's tokenizer, so counts aren't Claude-exact (~).
  • Some Unicode glyphs (e.g. ✓) can be mangled by the Windows console; failures and summaries are always preserved.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slim_shady-0.1.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slim_shady-0.1.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file slim_shady-0.1.1.tar.gz.

File metadata

  • Download URL: slim_shady-0.1.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for slim_shady-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d7f24a1293a47dc6c3e516c87d27e49b175b9420f0e2f4042065898ca2b3889
MD5 d621b20cace3b0adb30b96734b8595ed
BLAKE2b-256 df08bdc334a5b14e2256d4df1b886a7c352d61ee7d6554da96b144e9c96d79cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for slim_shady-0.1.1.tar.gz:

Publisher: publish.yml on SRUJAN-cpu/slim-shady

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slim_shady-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: slim_shady-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for slim_shady-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 147a2f2916b6679e0a9d5537791f34557ba06b0013333a06da34757f3da9f0f0
MD5 04c2c63ab518d59cb7c566ff300462b3
BLAKE2b-256 1247028d91fb489968783f05ba6e85daa9810d9c6060097532adf86b2dac89c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for slim_shady-0.1.1-py3-none-any.whl:

Publisher: publish.yml on SRUJAN-cpu/slim-shady

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page