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

Echo-TTS Ported to Apple Silicon with MLX for Native TTS with Voice Cloning
Echo-TTS, a 2.4B parameter diffusion text-to-speech model with voice cloning, has been ported from CUDA to run natively on Apple M-series silicon using MLX. On a base 16GB M4 Mac mini, a 5-second voice clone takes about 10 seconds to generate, while 30-second clones take about 60 seconds.

VidLens MCP Server: Persistent YouTube Knowledge Base for Claude
VidLens is a free, open-source MCP server that indexes YouTube content locally with semantic embeddings, treating videos as a persistent knowledge base rather than extracting temporary transcripts. It provides 41 tools across 10 modules for searching, analyzing, and retrieving video content.

Browser Harness: Giving LLMs raw CDP access to self-correct browser tasks
Browser Harness strips away browser frameworks, giving LLMs direct CDP websocket access and letting them write missing tools mid-task. Demonstrated by self-inventing an upload_file() function.

KANBAII: A Visual Kanban Board Built with Claude Code for AI-Assisted Development
A developer built KANBAII, a local kanban board tool entirely with Claude Code over two months. It provides visual task management, AI planning, and parallel execution modes for Claude Code workflows.