PRECC
by @yijunyu
Automatically fixes bash command errors, compresses CLI output, and redirects code search for efficient, cost-saving Claude Code execution.
clawhub install preccπ About This Skill
PRECC β Predictive Error Correction for Claude Code
PRECC saves ~34% of Claude Code costs through three pillars: fixing bash commands before they fail, compressing tool output, and reducing context token usage via semantic search and file compression. Ships as a single Rust binary.
Three Savings Pillars
Pillar 1: Command Correction & Output Compression
cargo build or npm test is run in the wrong directory and prepends cd /correct/path &&precc debugPillar 2: Semantic Code Search (cocoindex-code)
grep/rg and redirects through AST-aware semantic searchprecc-hook binary; no extra scripts neededPillar 3: Context File Compression
precc compressprecc compress --revertInstall
curl -fsSL https://raw.githubusercontent.com/yijunyu/precc-cc/main/scripts/install.sh | bash
precc init
Usage
Once installed, PRECC works automatically as a PreToolUse hook.
# Mine existing session history for failure-fix patterns
precc ingest --allView what PRECC has learned
precc skills listView unified savings report (all three pillars)
precc savingsSemantic code search (requires cocoindex-code)
ccc init && ccc index
ccc search "authentication middleware"Compress context files
precc compress --dry-run # preview
precc compress # compress
precc compress --revert # revert
Measured Results
| Metric | Value | |--------|-------| | Cost savings | $296 / $878 (34%) | | Failures prevented | 352 / 358 (98%) | | Bash calls improved | 894 / 5,384 (17%) | | Cache reads saved | 988M / 1.67B tokens (59%) | | Hook latency | 2.93ms avg (1.77ms overhead) |
Links
π‘ Examples
Once installed, PRECC works automatically as a PreToolUse hook.
# Mine existing session history for failure-fix patterns
precc ingest --allView what PRECC has learned
precc skills listView unified savings report (all three pillars)
precc savingsSemantic code search (requires cocoindex-code)
ccc init && ccc index
ccc search "authentication middleware"Compress context files
precc compress --dry-run # preview
precc compress # compress
precc compress --revert # revert