Skip to main content

Compress LLM output safely. Save tokens without breaking your code.

Project description

Brevix — Compress AI responses. Save tokens. Keep meaning.

Brevix

Compress LLM output safely. Save tokens without breaking your code.

CI Tests PyPI npm skills.sh License: MIT Python Claude Code Plugin

Brevix is a universal output-compression layer for LLM coding tools. It cuts response tokens 40-75% with a deterministic rule engine and verifies the compressed result still means the same thing as the original — so brevity never breaks correctness.

Works with Claude Code, Cursor, Windsurf, OpenAI Codex CLI, Google Antigravity, Gemini CLI, GitHub Copilot Chat, Aider, Continue.dev, Cline, Roo Code, Zed AI, Augment, Kilo, OpenHands, Tabnine, Warp, Replit, Sourcegraph Amp, plus any tool that reads AGENTS.md.


What Brevix gives you

Capability Brevix
Rule-based compression — Lite, Full, Ultra
Adaptive Auto mode (picks safest aggressive level per response)
Accuracy Guard — semantic similarity verification before emit
Strict mode — auto-fall-back to original when meaning would be lost
Protected regions — code, URLs, error quotes are never touched
File-level compression with .original backup (CLAUDE.md, AGENTS.md, …)
MCP middleware (brevix-shrink) — compresses tool/prompt/resource descriptions
Real Claude Code session-log token counts (stats --real --since 7d)
Statusline badge — [BREVIX] ⛏ X.Xk saved
Subagents — investigator / builder / reviewer with terse output formats
Three-arm A/B eval harness with tiktoken o200k_base
20 platform install targets, idempotent BREVIX:BEGIN/END markers
100% local — no telemetry, no API calls in the engine
Free + MIT

Brevix's edge: every compressed output is scored against the original locally. If similarity drops below your threshold, you get warned — or in strict mode, the original is emitted instead. No silent meaning loss on dense technical prose.


Install

One-liner (macOS / Linux / WSL)

curl -fsSL https://raw.githubusercontent.com/Yash-Koladiya30/brevix/main/install.sh | bash -s -- --all

Windows (PowerShell)

irm https://raw.githubusercontent.com/Yash-Koladiya30/brevix/main/install.ps1 | iex

Via skills CLI (one command, 9 tools)

Auto-installs Brevix skills into Antigravity, Claude Code, Cline, Codex, Cursor, Gemini CLI, GitHub Copilot, Kiro CLI, and Qoder simultaneously:

npx skills add https://github.com/Yash-Koladiya30/brevix

Or pick a specific skill:

npx skills add https://github.com/Yash-Koladiya30/brevix --skill brevix
npx skills add https://github.com/Yash-Koladiya30/brevix --skill brevix-commit
npx skills add https://github.com/Yash-Koladiya30/brevix --skill brevix-stats

Listing: https://skills.sh/Yash-Koladiya30/brevix

Manual

pip install brevix                  # core
pip install 'brevix[guard]'         # + semantic Accuracy Guard
pip install 'brevix[tokens]'        # + accurate tiktoken counts
pip install 'brevix[all]'           # everything

Plug into your LLM coding tool

brevix install --list                # show all 20 targets
brevix install claude-code           # Claude Code plugin layout
brevix install cursor                # .cursor/rules/brevix.mdc
brevix install codex                 # AGENTS.md + .codex/hooks.json
brevix install gemini                # gemini-extension.json + GEMINI.md
brevix install all                   # write rule files for every tool

Idempotent — re-running updates the Brevix block, leaves your other content alone.

Claude Code marketplace

/plugin marketplace add Yash-Koladiya30/brevix
/plugin install brevix@brevix

MCP middleware (compress upstream MCP server descriptions)

npm install -g brevix-shrink

Then wrap any MCP server in your Claude config:

{
  "mcpServers": {
    "fs-shrunk": {
      "command": "npx",
      "args": ["brevix-shrink", "npx", "-y",
               "@modelcontextprotocol/server-filesystem", "/tmp"]
    }
  }
}

Usage

Slash commands (Claude Code, Cursor, etc.)

/brevix                # toggle on (full mode)
/brevix lite           # gentle compression
/brevix ultra          # max compression
/brevix auto           # pick best mode per response
/brevix off            # disable
/brevix-commit         # terse Conventional Commit message
/brevix-check          # run Accuracy Guard on a snippet
/brevix-stats          # show savings

For Codex CLI (no slash commands), use $brevix lite|full|ultra|auto|off.

CLI

# Output compression
brevix compress "Your verbose text here" --mode full
brevix compress -                      # stdin
brevix compress . --mode auto -v       # adaptive picks best
brevix compress . --guard --strict --threshold 0.85

# File compression (memory files like CLAUDE.md, AGENTS.md, project notes)
brevix compress-file CLAUDE.md         # writes .original.md backup
brevix compress-file CLAUDE.md --dry-run

# Stats
brevix stats                           # estimated, in-process
brevix stats --real --since 7d         # parsed from Claude Code session logs
brevix stats --share                   # tweet-ready one-liner
brevix stats --reset

# Verification
brevix check "original" "compressed"
brevix count "how many tokens?"

# Install rules into a project
brevix install cursor
brevix install --list

Subagents (Claude Code)

agents/ ships three small, focused subagents that emit ~60% smaller tool results than vanilla agents:

  • brevix-investigator — read-only code locator (path:line — symbol — note)
  • brevix-builder — surgical 1-2 file edits with verification
  • brevix-reviewer — bug-focused diff review (path:line: 🔴 bug: …. fix.)

How Accuracy Guard works

  1. Compress output via the rule engine.
  2. Score the original vs compressed text with a local sentence-transformer (no API cost).
  3. If similarity ≥ threshold (default 0.85) → emit compressed. Otherwise warn, or in --strict mode fall back to original.
  4. Without sentence-transformers installed, falls back to content-word containment (drops stopwords without penalty — fair to compression).

Result: compression you can trust on production code, specs, contracts.


Compression example

Before:

The reason your React component is re-rendering on every parent update is that you are passing an inline object as a prop. In JavaScript, every render creates a new object reference, even if the contents are identical. To fix this, wrap the object in useMemo so the reference stays stable across renders.

After (full mode):

Inline object prop = new ref each render = re-render. Wrap in useMemo.

Tokens saved: ~75%. Meaning preserved: ✅ (similarity 0.91)


Benchmarks

Reproducible three-arm A/B harness in evals/. Compares no-system-prompt vs "be terse" control vs Brevix on 10 developer prompts.

arm       n   median  mean   total  vs baseline  vs control
baseline  10  221     247.3  2473   —            —
control   10  178     191.6  1916   22.5%        —
brevix    10  119     128.4  1284   48.1%        33.0%

Run yourself:

pip install 'brevix[all]' anthropic
export ANTHROPIC_API_KEY=...
python evals/llm_run.py --model claude-sonnet-4-6
python evals/measure.py

The vs control column is the honest savings — what Brevix adds beyond "just be brief."


Roadmap

  • Core compression engine (lite/full/ultra)
  • Adaptive (auto) mode
  • Accuracy Guard (semantic + content-word fallback)
  • Local stats counter
  • Multi-platform installer (20 targets)
  • File-level compression (brevix compress-file)
  • MCP middleware (brevix-shrink)
  • Statusline badge + Claude Code hooks
  • Subagents (investigator/builder/reviewer)
  • Three-arm eval harness
  • PowerShell installer + uninstaller
  • VSCode extension UI
  • Browser extension (claude.ai, chatgpt.com web)
  • Two-way compression (compress prompts before send)
  • Custom user-defined rule packs
  • Web dashboard (team tier)

License

MIT — free for personal and commercial use.


Contributing

Issues and PRs welcome. See docs/CONTRIBUTING.md.

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

brevix-0.4.1.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

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

brevix-0.4.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file brevix-0.4.1.tar.gz.

File metadata

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

File hashes

Hashes for brevix-0.4.1.tar.gz
Algorithm Hash digest
SHA256 1e50a46db2bb77cd48cf753636190b78ebc8a6cddf08f9c639247ea5144858fd
MD5 9b276a19decf07f2bccc49627c716072
BLAKE2b-256 e0eb68d6c596dc167b8aa759d32b0ddbb6973df2268d827c01654e68763ad411

See more details on using hashes here.

Provenance

The following attestation bundles were made for brevix-0.4.1.tar.gz:

Publisher: pypi.yml on Yash-Koladiya30/brevix

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

File details

Details for the file brevix-0.4.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for brevix-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db601bf0f8e6b1890dddf010c5e531f74f3ef1524bf4b0384d6193f876fbd1f4
MD5 778998e720fc3987e4168b43fe883249
BLAKE2b-256 3201c5d8886703548ca6b946960ad55652cb09b9b20d83c9b426f738283d8481

See more details on using hashes here.

Provenance

The following attestation bundles were made for brevix-0.4.1-py3-none-any.whl:

Publisher: pypi.yml on Yash-Koladiya30/brevix

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