ངོ་སྤྲོད།
PRECC ཅི་ཞིག་ཡིན།
PRECC (Claude Code ཡི་སྔོན་བརྟག་ནོར་འཆུག་བཅོས་སྒྲིག) ནི་ཆོག་ཅན་གྱི PreToolUse hook བརྒྱུད་ནས Claude Code bash བཀའ་རྒྱ་བར་གཅོད་བྱེད་པའི Rust ལག་ཆ་ཞིག་ཡིན། ནོར་འཆུག་*མ་བྱུང་གོང་*བཅོས་སྒྲིག་བྱས་ནས token འགྲོ་གྲོན་ཉུང་དུ་གཏོང་།
སྤྱི་ཚོགས་བཀོལ་མཁན་ལ་རིན་མེད།
དཀའ་ངལ།
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.
རྩ་དོན་བཞི།
Context Fix (cd-prepend)
Detects when commands like cargo build or npm test run in the wrong directory and prepends cd /correct/path && before execution.
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.
ལས་ཀ་ཇི་ལྟར་བྱེད།
- 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
If a command fails after compression, PRECC automatically skips compression on the retry so Claude gets the full uncompressed output to debug with.
དུས་ཐོག་བཀོལ་སྤྱོད་གྲངས་ཐོ།
| ཚད་གཞི། | གྲངས་ཀ |
|---|---|
| Hook invocations | – |
| Tokens saved | – |
| Saving ratio | –% |
| RTK rewrites | – |
| CD corrections | – |
| Hook latency | – ms (p50) |
Figures are estimates. Each prevented failure avoids a full retry cycle: error output, model reasoning, and retry command. These numbers update automatically from anonymized telemetry.
སྦྲེལ་མཐུད།
- GitHub: https://github.com/peria-ai/precc-cc
- Website: https://peria.ai
- Documentation: https://precc.cc