安装
快速安装 (Linux / macOS)
curl -fsSL https://peria.ai/install.sh | bash
这会下载适用于您平台的最新版本二进制文件,验证SHA256校验和,并将其放置在 ~/.local/bin/ 中。
安装后,初始化PRECC:
precc init
precc init 在Claude Code中注册PreToolUse钩子,创建数据目录,并初始化技能数据库。
安装选项
SHA256验证
默认情况下,安装程序会根据已发布的SHA256校验和验证二进制文件。要跳过验证(不推荐):
curl -fsSL https://peria.ai/install.sh | bash -s -- --no-verify
自定义安装前缀
安装到自定义位置:
curl -fsSL https://peria.ai/install.sh | bash -s -- --prefix /opt/precc
OpenCLI (–opencli) — WebFetch token savings
PRECC can also install OpenCLI, a third-party Node.js tool that turns ~148 websites (HackerNews, Reddit, arxiv, bilibili, zhihu, x.com, …) into structured-output commands. When installed, PRECC’s two built-in webfetch-opencli-* skills auto-rewrite raw curl/wget calls into the corresponding opencli <site> command for 5–50× smaller output.
precc init --opencli
This runs npm install -g @jackwener/opencli (requires Node.js 20+) and prints the URL for OpenCLI’s optional Chrome extension. The extension is only needed to reuse logged-in cookies on private pages; public sources work without it.
Skipping --opencli keeps PRECC fully self-contained — the auto-rewrite skill inlines a command -v opencli check that falls back to the original command when OpenCLI isn’t installed, so the skill is safe to ship default-on.
The Chrome extension requests broad permissions (debugger, <all_urls>, cookies). Operators should review them before installing it; --opencli only handles the npm package, not the extension.
附加工具 (–extras)
PRECC附带可选的附加工具。使用 --extras 安装它们:
curl -fsSL https://peria.ai/install.sh | bash -s -- --extras
这将安装:
| 工具 | 用途 |
|---|---|
| RTK | 命令重写工具包 |
| lean-ctx | CLAUDE.md和提示文件的上下文压缩 |
| nushell | 用于高级管道的结构化Shell |
| cocoindex-code | 代码索引以加快上下文解析 |
Windows (PowerShell)
irm https://peria.ai/install.ps1 | iex
然后初始化:
precc init
手动安装
- 从 GitHub Releases 下载适用于您平台的发布二进制文件。
- 根据版本中的
.sha256文件验证SHA256校验和。 - 将二进制文件放置在
PATH中的目录中(例如~/.local/bin/)。 - 运行
precc init。
更新
precc update
强制更新到特定版本:
precc update --force --version 0.3.0
启用自动更新:
precc update --auto
在 OpenClaw / ClawHub 下安装
PRECC 在 plugins/openclaw/openclaw.plugin.json 提供插件清单(id 为 precc-token-saver)。每当发布公开版本时,GitHub Actions 工作流 clawhub-publish.yml 会将技能包推送到 ClawHub 注册表,因此最终用户可以通过 ClawHub CLI 而不是 curl 安装器来安装 PRECC:
# ClawHub CLI
clawhub install precc
# Or pin the plugin manifest (id: precc-token-saver) via OpenClaw's
# plugin marketplace UI or its CLI equivalent.
节省如何在 OpenClaw 下呈现
在 Claude Code 下可用的每一个 PRECC 报告界面在 OpenClaw 下同样可用——precc savings、precc savings --all、本地化的状态行(设置 PRECC_LANG=zh,状态行会以你的语言显示)以及本地改写审计日志,都从你机器上同一组 SQLCipher 数据库读取数据。docs/symposium-plan/openclaw-savings-reporting.md 中的另一份规范描述了未来在每个钩子响应中加入结构化的 preccSavings 字段,以及在默认阈值 $0.05 时发送一行会话结束通知;这一部分尚未发布。
验证安装
$ precc --version
precc 0.3.0
$ precc savings
Session savings: 0 tokens (no commands intercepted yet)
如果找不到 precc,请确保 ~/.local/bin 在您的 PATH 中。