PRECC Tool Cuts Claude Code API Costs with Pre-Tool-Call Compression

PRECC is an open source tool that reduces Claude Code API costs by compressing redundant context before it reaches the model. It uses a pre-tool-call hook that intercepts Bash, Read, and Grep calls to apply compression algorithms.
How It Works
The tool addresses cost issues where API bills were climbing due to redundant context being sent multiple times. Common sources of waste include:
- Same file contents sent repeatedly
- Verbose shell output
- Overlapping grep results that the model doesn't need in full
The pre-tool-call hook runs RTK (Redundancy-aware Token Kompression) on tool output before it reaches Claude. The compression process:
- Deduplicates repeated spans
- Strips noise
- Summarises large reads
- Returns compressed version to the model
Performance Results
The hook runs in approximately 2.93ms, adding no perceptible latency to operations. In practice, users see 40-66% fewer input tokens across typical coding sessions. Model output quality remains unchanged because the compression preserves signal while stripping redundancy.
This type of optimization is particularly useful for developers using Claude Code extensively, where repeated file reads and tool outputs can significantly increase token usage and costs.
📖 Read the full source: r/ClaudeAI
👀 See Also

OpenJet v0.4: Zero-Config Local Coding Agent with llama.cpp Backend
OpenJet v0.4 is an open-source terminal coding agent for local LLMs that auto-detects hardware, configures llama.cpp, and provides a Claude Code-style workflow with no API keys.

OpenClaw-WebTop: Run OpenClaw with Ollama and Ubuntu Desktop in GitHub Codespaces
OpenClaw-WebTop provides a way to run a complete OpenClaw instance with Ollama and Ubuntu MATE desktop directly in a browser using GitHub Codespaces, requiring no local Docker installation or VPS.

Shipshots MCP Server: Claude Designs App Store Screenshots and Preview Videos
Shipshots is a visual editor with an MCP server that lets Claude design marketing materials through tool calls. It generates app store screenshots, animated preview videos, and social media visuals based on text descriptions.

Crispy VS Code Extension Adds Agent Memory and Multi-Agent Features for Claude and Codex
Crispy is an open-source VS Code extension that wraps Claude Code and Codex CLIs with a GUI, adding local agent memory with semantic search, multi-agent sessions, conversation forking, and dedicated tool views. It runs on Linux, macOS, and Windows under MIT license.