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.2.tar.gz (14.9 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.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slim_shady-0.1.2.tar.gz
  • Upload date:
  • Size: 14.9 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.2.tar.gz
Algorithm Hash digest
SHA256 8b8958582ce80bb45d4ea84c44c27daf3c5544d6982ee6290c5d56610f2fcda0
MD5 6422a642759dfa207545e8b47ca4d408
BLAKE2b-256 b2abff6ca95ebd5eb74be38c8e5ccceb98489881150837a99a8c76a27e628e62

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: slim_shady-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43694bc252887e95de92fe29ed11cc73dba4460ba39b738cfc4f111871053b1b
MD5 af8fd45ae29b73d50b74defba190cce0
BLAKE2b-256 c0136a8cc5cc233e88391c6ac65639c89983e178d496f2e9a9759346946f6c3f

See more details on using hashes here.

Provenance

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