← 返回
未分类 中文

PRECC

Automatically fixes bash command errors, compresses CLI output, and redirects code search for efficient, cost-saving Claude Code execution.
自动修复 bash 命令错误,压缩 CLI 输出,并重定向代码搜索,实现高效、节约成本的 Claude Code 运行。
yijunyu yijunyu 来源
未分类 clawhub v0.2.4-1 1 版本 100000 Key: 无需
★ 0
Stars
📥 675
下载
💾 0
安装
1
版本
#latest

概述

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

  • Fixes wrong-directory commands — Detects when cargo build or npm test is run in the wrong directory and prepends cd /correct/path &&
  • Prevents repeated failures — Learns from past session failures and auto-corrects commands that would fail the same way
  • Compresses CLI output — Rewrites commands to use RTK for 60-90% smaller output
  • Suggests GDB debugging — When a command fails repeatedly, suggests precc debug

Pillar 2: Semantic Code Search (cocoindex-code)

  • Intercepts grep/rg and redirects through AST-aware semantic search
  • Built into the precc-hook binary; no extra scripts needed
  • Understands code structure across 28+ languages, saving ~70% of search tokens

Pillar 3: Context File Compression

  • Strips filler words from CLAUDE.md and memory files via precc compress
  • Reduces tokens loaded on every API call (~30% compression)
  • Backups saved automatically, revertible with precc compress --revert

Install

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 --all

# View what PRECC has learned
precc skills list

# View unified savings report (all three pillars)
precc savings

# Semantic 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

MetricValue
---------------
Cost savings$296 / $878 (34%)
Failures prevented352 / 358 (98%)
Bash calls improved894 / 5,384 (17%)
Cache reads saved988M / 1.67B tokens (59%)
Hook latency2.93ms avg (1.77ms overhead)

Links

  • GitHub: https://github.com/yijunyu/precc-cc
  • ClawHub: https://clawhub.ai/skills/precc
  • cocoindex-code: https://github.com/cocoindex-io/cocoindex-code
  • token-saver: https://clawhub.ai/skills/token-saver
  • RTK: https://github.com/rtk-ai/rtk

版本历史

共 1 个版本

  • v0.2.4-1 当前
    2026-05-02 13:26 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,378 📥 320,408
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 676 📥 325,411
ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,226 📥 267,804