I built a local context compressor for AI coding agents in Rust (50%++ reduction on noisy logs)

Hello r/programmer!

I've been building BJIR (Bloat Judgement & I/O Refiner) - a CLI tool for context hygiene in AI-assisted development.

The problem it solves: When you're working with coding agents (Claude Code, Cursor, Codex), the context you feed them is usually terrible. Build logs with 500 lines of progress bars. Diffs with 800 lines of lockfile churn. Stack traces tangled with Docker output. Agent traces full of repeated tool-call chatter.

All that noise burns your token budget and buries the actual signal the AI needs.

What BJIR does:

It acts as a local, deterministic compression layer before context reaches the model:

git diff | bjir diff          # strip lockfile noise, keep real changes
bjir pnpm build               # run build, capture + refine the failure
bjir cargo test               # test, surface only what failed
cat error.log | bjir log      # condense verbose logs

You get a BJIR REPORT: original size, refined size, token estimate, detected signals, and cleaned output - ready to paste. Redaction is on by default - secrets, tokens, and credential-like strings get masked automatically.

Why local/deterministic matters:

A lot of "context compression" tools call an LLM to summarize. BJIR doesn't - the refiner runs entirely on your machine. No API calls in the hot path, no privacy exposure, reproducible output. The LLM-based agent (bjir chat) is opt-in and separate.

Reduction numbers from bundled fixtures:

Log with secrets       ~92.9%
Noisy JSON log         ~89.3%
Lockfile-heavy diff    ~73.1%
Build log              ~63.9%
Agent trace            ~40.3%

Technical details:

  • Written in Rust (97% of the codebase), organized as a Cargo workspace
  • Refiner is fully local - no LLM calls, no network, no telemetry
  • Redaction is on by default (API keys, tokens, DB URLs, webhooks)
  • History is metadata-only (counts, reductions, timestamps - no raw content)
  • Optional built-in AI agent (bjir chat) that applies reduction at every layer - supports Claude, OpenAI, Ollama (local), Gemini
  • Hook integrations for Claude Code, Cursor, Codex, Windsurf, Cline, Hermes

Install:

brew install gogetrekt/bjir/bjir

or

curl -fsSL https://raw.githubusercontent.com/gogetrekt/bjir/main/scripts/install.sh | sh

This project is still actively evolving, currently around 40% of the intended scope (maybe). I'm looking for contributors who want to be involved in the full development process, from building new reducers and agent hook integrations to Windows testing and fixture tests.

Links:

Happy to answer questions about the architecture, the reduction model, or the agent integration design. It's early but functional - v2.1.0 just shipped today.

reddit.com
u/duffydave — 2 months ago