常见问题
PRECC安全吗?
是的。PRECC使用Claude Code官方的PreToolUse钩子机制——Anthropic专门为此目的设计的扩展点。该钩子:
- 完全离线运行(热路径中无网络调用)
- 在5毫秒内完成
- 是fail-open的:如果出现任何问题,原始命令将不受修改地运行
- 只修改命令,从不自己执行它们
- 将数据存储在本地SQLite数据库中
PRECC能与其他AI编码工具一起使用吗?
PRECC专为Claude Code设计。它依赖于Claude Code提供的PreToolUse钩子协议。它不适用于Cursor、Copilot、Windsurf或其他AI编码工具。
遥测发送什么数据?
遥测仅在选择加入后启用。启用后发送:
- PRECC版本、操作系统和架构
- 汇总计数(拦截的命令、激活的技能)
- 平均钩子延迟
它不发送命令文本、文件路径、项目名称或任何个人身份信息。您可以在选择加入前使用 precc telemetry preview 预览确切的数据。详见遥测。
如何卸载PRECC?
PRECC is fully reversible — remove it in three steps:
-
移除钩子注册:
# Delete the hook entry from Claude Code's settings # (precc init added it; removing it disables PRECC) -
删除二进制文件:
rm ~/.local/bin/precc ~/.local/bin/precc-hook ~/.local/bin/precc-learner -
删除数据(可选):
rm -rf ~/.local/share/precc/ rm -rf ~/.config/precc/
我的许可证过期了。会发生什么?
PRECC恢复到社区版。所有核心功能继续正常工作:
- 内置技能保持活跃
- 钩子管道正常运行
precc savings显示摘要视图precc ingest和会话挖掘正常工作
Pro功能在续订前不可用:
precc savings --all(详细分类)precc compressprecc gifprecc ghaprecc geofence- 电子邮件报告
钩子似乎没有运行。如何调试?
Run precc doctor first — it automates every check below. To diagnose by hand:
-
检查钩子是否已注册:
precc init -
手动测试钩子:
echo '{"tool_input":{"command":"cargo build"}}' | precc-hook -
检查二进制文件是否在PATH中:
which precc-hook -
检查
~/.claude/settings.json中的Claude Code钩子配置。
PRECC会减慢Claude Code吗?
不会。钩子在5毫秒内完成(p99)。与Claude推理和生成回复所花费的时间相比,这是不可察觉的。
我可以在CI/CD中使用PRECC吗?
PRECC是为交互式Claude Code会话设计的。在CI/CD中,没有Claude Code实例可以挂钩。但是,precc gha 可以从任何环境分析失败的GitHub Actions运行。
挖掘的技能与内置技能有何不同?
内置技能随PRECC提供,涵盖常见的错误目录模式。挖掘的技能从您的特定会话日志中学习——它们捕获您工作流程中独特的模式。两者都存储在SQLite中,并由钩子管道以相同方式评估。
我可以与团队共享技能吗?
可以。使用 precc skills export NAME 将任何技能导出为TOML并共享文件。团队成员可以将其放在 skills/ 目录中或导入到他们的启发式数据库中。
Why do I see zero tokens saved?
If precc savings reports 0 tokens despite an active Claude Code session burning input/output tokens, the hook is not firing. Three causes account for almost every reported instance:
-
You are on v0.3.42 or v0.3.43. These releases shipped a data-path regression where the hook wrote metrics to a directory that the CLI then read from a different directory — both ran, but the savings number stayed at 0. Fixed in v0.3.44 (data paths routed through
db::data_dir()). Upgrade with:precc update -
Your
settings.jsonis missing the hook entry. Runprecc doctor(available in v0.3.53+). It checks each precondition of the hot path — settings file, hook entry, binary on$PATH, heuristics DB, recent invocations — and reports the first one that fails:precc doctorIf doctor is not available because you are on an older release, run
precc initto (re)register the hook. -
Your session has not yet hit a skill trigger. PRECC only intercepts Bash commands matching one of the active skills. If your session has been pure file editing or pure web fetching against domains not covered by
webfetch-opencli, you have not yet given the hook anything to compress or rewrite. This is normal. Runprecc skills listto see what triggers exist.
If after upgrading and running precc doctor you still see zero savings, file an issue at https://github.com/peri-a-i/precc-cc/issues with the output of precc doctor.
My MCP server (e.g. lean-ctx) is pegging CPU. How do I kill it safely without taking Claude Code down with it?
PRECC does not ship or supervise MCP servers — but this is a recurring trap because some MCP binaries (notably lean-ctx) are also invoked as per-Bash-tool-call wrappers by the Claude Code harness, not just as long-running servers. A naive pkill <name> then matches many short-lived wrappers in addition to the server.
Identify the runaway PID, do not kill by name:
pgrep -f "^lean-ctx$" \
| xargs -I{} ps -o pid,%cpu,etime,args -p {} \
| sort -k2 -nr | head -3
The top row is the long-running server (large etime, high %cpu). Send SIGTERM to only that PID:
kill -TERM <pid>
Avoid these forms, all of which can also kill Claude Code or break in-flight tool calls:
pkill lean-ctx— matches transientlean-ctx -c <cmd>wrappers spawned per Bash tool call.pkill -9 -f lean-ctx— same broad match, plus ungraceful exit leaves the MCP stdio half-open.pkill -g <pgid>/kill -- -<pgid>— kills the whole process group, which includesclaudeitself when the MCP server shares a session with it.
If after a clean SIGTERM the server does not exit within a few seconds, escalate with kill -KILL <pid> on the same single PID (still not by name). Claude Code will lose those MCP tools until you restart it; it should not exit on its own.
This advice is independent of PRECC — but PRECC users frequently run lean-ctx, so it is worth documenting here.
What is OpenCLI and do I need it?
OpenCLI is a third-party Node.js tool that turns ~148 websites into structured-output CLI commands (opencli hackernews top, opencli reddit search <q>, opencli arxiv search <q>, …). PRECC ships two built-in skills that work with it:
webfetch-opencli-hint— fires oncurl/wget/http/fetchagainst any of 11 OpenCLI-supported domains andsuggest_fix-es the equivalentopencli <site> …command. Suggestion only; never modifies the command.webfetch-opencli-hackernews— auto-rewritescurl|wget news.ycombinator.comtoopencli hackernews topwith an inlinecommand -v openclifallback to the original command if OpenCLI isn’t installed.
You don’t need OpenCLI for PRECC to work. The hint skill costs nothing; the auto-rewrite skill is safe to ship default-on because of the fallback.
If you want OpenCLI’s WebFetch token savings, install it with:
precc init --opencli
That runs npm install -g @jackwener/opencli (Node.js 20+ required). For cookie-reuse on logged-in pages, also install OpenCLI’s Chrome extension separately — see the project README. The extension requests broad permissions (debugger, <all_urls>, cookies); review them before installing.
precc doctor reports OpenCLI’s presence on $PATH as an informational line:
i opencli: installed (webfetch-opencli skills will auto-rewrite)
or
i opencli: not installed (run `precc init --opencli` if you want WebFetch token savings)
Never marks doctor as failing — the integration is fully opt-in.