Introduction
What is PRECC?
PRECC (Claude Code를 위한 예측 오류 수정) is a Rust tool that intercepts Claude Code bash commands via the official PreToolUse hook mechanism. It fixes errors before they happen, saving tokens and eliminating retry loops.
커뮤니티 사용자에게 무료.
The Problem
Claude Code wastes significant tokens on preventable mistakes:
- Wrong-directory errors – Running
cargo buildin a parent directory that has noCargo.toml, then retrying after reading the error. - Retry loops – A failed command produces verbose output, Claude reads it, reasons about it, and retries. Each cycle burns hundreds of tokens.
- Verbose output – Commands like
findorls -Rdump thousands of lines that Claude must process.
The Four Pillars
컨텍스트 수정 (cd-prepend)
cargo build나 npm test 같은 명령이 잘못된 디렉토리에서 실행될 때를 감지하고 실행 전에 cd /올바른/경로 &&를 추가합니다.
GDB Debugging
Detects opportunities to attach GDB for deeper debugging of segfaults and crashes, providing structured debug information instead of raw core dumps.
Session Mining
Mines Claude Code session logs for failure-fix pairs. When the same mistake recurs, PRECC already knows the fix and applies it automatically.
Automation Skills
A library of built-in and mined skills that match command patterns and rewrite them. Skills are defined as TOML files or SQLite rows, making them easy to inspect, edit, and share.
How It Works (30-Second Version)
- Claude Code is about to run a bash command.
- The PreToolUse hook sends the command to
precc-hookas JSON on stdin. precc-hookruns the command through the pipeline (skills, directory correction, compression) in under 3 milliseconds.- The corrected command is returned as JSON on stdout.
- Claude Code executes the corrected command instead.
Claude never sees the error. No tokens wasted.
Adaptive Compression
명령이 압축 후 실패하면 PRECC가 다음 재시도에서 자동으로 압축을 건너뛰어 Claude가 디버깅을 위한 전체 비압축 출력을 받습니다.
Live Usage Statistics
| Metric | Value |
|---|---|
| Hook invocations | – |
| Tokens saved | – |
| Saving ratio | –% |
| RTK rewrites | – |
| CD corrections | – |
| Hook latency | – ms (p50) |
수치는 추정치입니다. 예방된 각 실패는 전체 재시도 사이클을 회피합니다: 오류 출력, 모델 추론, 재시도 명령. These numbers update automatically from anonymized telemetry.
Links
- GitHub: https://github.com/peria-ai/precc-cc
- Website: https://peria.ai
- Documentation: https://precc.cc