运行时依赖
安装命令
点击复制技能文档
PRECC — Predictive Error Correction for Claude Code
PRECC saves ~34% of Claude Code costs through three pillars: fixing bash commands before they fAIl, 压缩ing 工具 输出, and reducing 上下文 令牌 usage via semantic 搜索 and file 压缩ion. Ships as a single Rust binary.
Three Savings Pillars Pillar 1: Command Correction & 输出 压缩ion Fixes wrong-directory commands — 检测s when cargo build or npm test is 运行 in the wrong directory and prepends cd /correct/path && 预防s repeated 失败s — Learns from past 会话 失败s and auto-corrects commands that would fAIl the same way 压缩es 命令行工具 输出 — Rewrites commands to use RTK for 60-90% smaller 输出 Suggests GDB 调试ging — When a command fAIls repeatedly, suggests precc 调试 Pillar 2: Semantic Code 搜索 (coco索引-code) Intercepts grep/rg and redirects through AST-aware semantic 搜索 Built into the precc-hook binary; no extra scripts needed Understands code structure across 28+ languages, saving ~70% of 搜索 令牌s Pillar 3: 上下文 File 压缩ion Strips filler words from CLAUDE.md and memory files via precc 压缩 Reduces 令牌s loaded on every API call (~30% 压缩ion) 备份s saved automatically, revertible with precc 压缩 --revert 安装 curl -fsSL https://raw.githubusercontent.com/yijunyu/precc-cc/mAIn/scripts/安装.sh | bash precc init
Usage
Once 安装ed, PRECC works automatically as a Pre工具Use hook.
# Mine existing 会话 历史 for 失败-fix patterns precc ingest --all
# View what PRECC has learned precc 技能s 列出
# View unified savings 报告 (all three pillars) precc savings
# Semantic code 搜索 (requires coco索引-code) ccc init && ccc 索引 ccc 搜索 "authentication 中间件"
# 压缩 上下文 files precc 压缩 --dry-运行 # preview precc 压缩 # 压缩 precc 压缩 --revert # revert
Measured 结果s Metric Value Cost savings $296 / $878 (34%) 失败s 预防ed 352 / 358 (98%) Bash calls improved 894 / 5,384 (17%) 缓存 reads saved 988M / 1.67B 令牌s (59%) Hook latency 2.93ms avg (1.77ms overhead) Links GitHub: https://github.com/yijunyu/precc-cc ClawHub: https://ClawHub.AI/技能s/precc coco索引-code: https://github.com/coco索引-io/coco索引-code 令牌-saver: https://ClawHub.AI/技能s/令牌-saver RTK: https://github.com/rtk-AI/rtk