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 PyPI downloads 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

With pip

pip install slim-shady

Gives you the slim command (plus tiktoken for real token counts).

Or download the .exe (no Python needed)

  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.)

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.4.tar.gz (15.0 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.4-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slim_shady-0.1.4.tar.gz
  • Upload date:
  • Size: 15.0 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.4.tar.gz
Algorithm Hash digest
SHA256 35ec0505bb5f7d5122c3bbf9820d59928db817858017ae2282e129e232a36bbf
MD5 f183c120c34af00482c3060c289c433a
BLAKE2b-256 afc8332455f378775ee928c9ad88463e6ea2bb0a32896c255f3993cd30b69110

See more details on using hashes here.

Provenance

The following attestation bundles were made for slim_shady-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: slim_shady-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dafe500f1c4c53d37305a2dcd4e3e98c3cc54629d7ba1c8414e44449b4510432
MD5 cae3de93f60673b2e30c64aebf70cdb3
BLAKE2b-256 1834d7149a5aa7fa1a74cab86b8327690db2a086a4cc1ca0478fb88b1e512ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for slim_shady-0.1.4-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