Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

مقدمه

PRECC چیست؟

PRECC (تصحیح خطای پیش‌بینانه برای Claude Code) یک ابزار Rust است که دستورات bash مربوط به Claude Code را از طریق سازوکار رسمی PreToolUse hook رهگیری می‌کند. خطاها را پیش از وقوع اصلاح می‌کند، توکن‌ها را ذخیره و حلقه‌های تلاش مجدد را حذف می‌کند.

رایگان برای کاربران جامعه.

مسئله

Claude Code توکن‌های قابل توجهی را روی اشتباهات قابل پیشگیری هدر می‌دهد:

  • خطاهای دایرکتوری اشتباه – اجرای cargo build در یک دایرکتوری والد بدون Cargo.toml، سپس تلاش مجدد پس از خواندن خطا.
  • حلقه‌های تلاش مجدد – یک دستور ناموفق خروجی پرحجمی تولید می‌کند، Claude آن را می‌خواند، روی آن استدلال می‌کند و دوباره تلاش می‌کند. هر چرخه صدها توکن مصرف می‌کند.
  • خروجی پرحجم – دستوراتی مانند find یا ls -R هزاران خط را چاپ می‌کنند که Claude باید پردازش کند.

چهار ستون

اصلاح زمینه (cd-prepend)

تشخیص می‌دهد زمانی که دستوراتی مانند cargo build یا npm test در پوشه اشتباه اجرا می‌شوند و cd /مسیر/درست && را قبل از اجرا اضافه می‌کند.

اشکال‌زدایی GDB

فرصت‌های اتصال GDB را برای اشکال‌زدایی عمیق‌تر segfault و کرش‌ها تشخیص می‌دهد و به جای core dump خام، اطلاعات اشکال‌زدایی ساختاریافته ارائه می‌دهد.

استخراج جلسه

گزارش‌های جلسه Claude Code را برای جفت‌های خطا-اصلاح استخراج می‌کند. وقتی همان اشتباه تکرار می‌شود، PRECC از قبل اصلاح را می‌داند و به‌طور خودکار اعمال می‌کند.

مهارت‌های خودکارسازی

کتابخانه‌ای از مهارت‌های توکار و استخراج‌شده که الگوهای دستوری را مطابقت داده و بازنویسی می‌کنند. مهارت‌ها به صورت فایل‌های TOML یا ردیف‌های SQLite تعریف می‌شوند که بازرسی، ویرایش و اشتراک‌گذاری آن‌ها را آسان می‌کند.

چگونه کار می‌کند (نسخه ۳۰ ثانیه‌ای)

  1. Claude Code در آستانه اجرای یک دستور bash است.
  2. PreToolUse hook دستور را به صورت JSON از طریق stdin به precc-hook ارسال می‌کند.
  3. precc-hook دستور را در کمتر از ۳ میلی‌ثانیه از طریق پایپ‌لاین (مهارت‌ها، تصحیح دایرکتوری، فشرده‌سازی) اجرا می‌کند.
  4. دستور تصحیح‌شده به صورت JSON از طریق stdout بازگردانده می‌شود.
  5. Claude Code به جای دستور اصلی، دستور تصحیح‌شده را اجرا می‌کند.

خطاهای جزئی ادغام می‌شوند؛ دلیل بازنویسی همراه پاسخ hook ارسال می‌شود تا هر اصلاح قابل بررسی باشد، نه خاموش.

مرز ایمنی

PRECC فقط زمانی بازنویسی می‌کند که تعادل معنایی به‌طور قابل اثبات حفظ شود یا توسط کاربر قابل تأیید باشد. دستورات مخرب (rm، git push --force، git reset --hard) هرگز بازنویسی نمی‌شوند، حتی اگر مهارتی مطابقت داشته باشد. هر تغییر باید محدود باشد — دستور بازنویسی‌شده باید همچنان شامل توکن‌های اصلی دستور اولیه باشد. بازنویسی‌های نامحدود به‌طور خودکار بازگردانده می‌شوند. هر بازنویسی اعمال‌شده ثبت و نمایش داده می‌شود تا بتوانید آن را بررسی، غیرفعال یا لغو کنید.

فشرده‌سازی تطبیقی

اگر یک دستور پس از فشرده‌سازی شکست بخورد، PRECC به طور خودکار فشرده‌سازی را در تلاش بعدی رد می‌کند تا Claude خروجی کامل غیرفشرده را برای اشکال‌زدایی دریافت کند.

آمار استفاده زنده

نسخه فعلی :

معیارمقدار
فراخوانی‌های hook
توکن‌های ذخیره‌شده
نسبت صرفه‌جویی%
بازنویسی‌های RTK
تصحیحات CD
تأخیر hook ms (p50)
کاربران

Measured Savings (Ground Truth)

صرفه‌جویی بر اساس نسخه

این اعداد به‌طور خودکار از تله‌متری ناشناس به‌روزرسانی می‌شوند.

پیوندها

نصب

نصب سریع (Linux / macOS)

curl -fsSL https://peria.ai/install.sh | bash

این فایل باینری آخرین نسخه را برای پلتفرم شما دانلود می‌کند، جمع‌آزمای SHA256 را تأیید می‌کند و آن را در ~/.local/bin/ قرار می‌دهد.

پس از نصب، PRECC را مقداردهی اولیه کنید:

precc init

precc init هوک PreToolUse را در Claude Code ثبت می‌کند، پوشه‌های داده را ایجاد می‌کند و پایگاه داده مهارت‌ها را مقداردهی اولیه می‌کند.

گزینه‌های نصب

تأیید 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

ابزارهای همراه (–extras)

PRECC با ابزارهای همراه اختیاری ارائه می‌شود. آنها را با --extras نصب کنید:

curl -fsSL https://peria.ai/install.sh | bash -s -- --extras

این موارد زیر را نصب می‌کند:

ابزارکاربرد
RTKمجموعه ابزار بازنویسی دستورات
lean-ctxفشرده‌سازی زمینه برای CLAUDE.md و فایل‌های prompt
nushellشل ساختاریافته برای پایپلاین‌های پیشرفته
cocoindex-codeنمایه‌سازی کد برای حل سریع‌تر زمینه

Windows (PowerShell)

irm https://peria.ai/install.ps1 | iex

سپس مقداردهی اولیه کنید:

precc init

نصب دستی

  1. فایل باینری نسخه مربوط به پلتفرم خود را از GitHub Releases دانلود کنید.
  2. جمع‌آزمای SHA256 را با فایل .sha256 در نسخه تأیید کنید.
  3. فایل باینری را در پوشه‌ای در PATH خود قرار دهید (مثلاً ~/.local/bin/).
  4. precc init را اجرا کنید.

به‌روزرسانی

precc update

به‌روزرسانی اجباری به نسخه مشخص:

precc update --force --version 0.3.0

فعال‌سازی به‌روزرسانی خودکار:

precc update --auto

تأیید نصب

$ precc --version
precc 0.3.0

$ precc savings
Session savings: 0 tokens (no commands intercepted yet)

اگر precc پیدا نشد، مطمئن شوید که ~/.local/bin در PATH شما قرار دارد.

شروع سریع

PRECC را در ۵ دقیقه راه‌اندازی کنید.

مرحله ۱: نصب

curl -fsSL https://peria.ai/install.sh | bash

مرحله ۲: مقداردهی اولیه

$ precc init
[precc] Hook registered with Claude Code
[precc] Created ~/.local/share/precc/
[precc] Initialized heuristics.db with 8 built-in skills
[precc] Ready.

مرحله ۳: بررسی فعال بودن هوک

$ precc skills list
  # Name               Type      Triggers
  1 cargo-wrong-dir    built-in  cargo build/test/clippy outside Rust project
  2 git-wrong-dir      built-in  git * outside a repo
  3 go-wrong-dir       built-in  go build/test outside Go module
  4 make-wrong-dir     built-in  make without Makefile in cwd
  5 npm-wrong-dir      built-in  npm/npx/pnpm/yarn outside Node project
  6 python-wrong-dir   built-in  python/pytest/pip outside Python project
  7 jj-translate       built-in  git * in jj-colocated repo
  8 asciinema-gif      built-in  asciinema rec

مرحله ۴: از Claude Code به طور عادی استفاده کنید

Claude Code را باز کنید و طبق معمول کار کنید. PRECC بی‌صدا در پس‌زمینه اجرا می‌شود. وقتی Claude دستوری صادر می‌کند که شکست می‌خورد، PRECC آن را قبل از اجرا اصلاح می‌کند.

مثال: اجرای Cargo Build در پوشه اشتباه

فرض کنید پروژه شما در ~/projects/myapp/ است و Claude دستور زیر را صادر می‌کند:

cargo build

از ~/projects/ (یک سطح بالاتر، بدون Cargo.toml در آنجا).

بدون PRECC: Claude خطای could not find Cargo.toml in /home/user/projects or any parent directory را دریافت می‌کند، می‌خواند، استدلال می‌کند و با cd myapp && cargo build دوباره تلاش می‌کند. هزینه: حدود ۲۰۰۰ توکن هدر رفته.

با PRECC: هوک Cargo.toml گمشده را تشخیص می‌دهد، آن را در myapp/ پیدا می‌کند و دستور را بازنویسی می‌کند به:

cd /home/user/projects/myapp && cargo build

Claude هرگز خطایی نمی‌بیند. صفر توکن هدر رفته.

مرحله ۵: صرفه‌جویی خود را بررسی کنید

پس از یک جلسه، ببینید PRECC چند توکن صرفه‌جویی کرده است:

$ precc savings
Session Token Savings
=====================
Total estimated savings: 4,312 tokens

Breakdown:
  Pillar 1 (cd prepends):       2,104 tokens  (3 corrections)
  Pillar 4 (skill activations):   980 tokens  (2 activations)
  RTK rewrites:                 1,228 tokens  (5 rewrites)

مراحل بعدی

  • مهارت‌ها – مشاهده همه مهارت‌های موجود و نحوه ایجاد مهارت‌های خود.
  • خط لوله هوک – بفهمید در پشت صحنه چه اتفاقی می‌افتد.
  • صرفه‌جویی – تحلیل دقیق صرفه‌جویی توکن.

مجوز

PRECC دو سطح ارائه می‌دهد: Community (رایگان) و Pro.

سطح Community (رایگان)

سطح Community شامل:

  • تمام مهارت‌های داخلی (اصلاح دایرکتوری اشتباه، ترجمه jj و غیره)
  • خط لوله hook با پشتیبانی کامل Pillar 1 و Pillar 4
  • خلاصه پایه precc savings
  • استخراج جلسه با precc ingest
  • استفاده محلی نامحدود

سطح Pro

Pro ویژگی‌های اضافی را باز می‌کند:

  • جزئیات صرفه‌جوییprecc savings --all با تحلیل هر دستور
  • ضبط GIFprecc gif برای ایجاد GIF متحرک ترمینال
  • انطباق geofence IP – برای محیط‌های تحت نظارت
  • گزارش‌های ایمیلیprecc mail report برای ارسال تحلیل‌ها
  • تحلیل GitHub Actionsprecc gha برای رفع اشکال گردش کار ناموفق
  • فشرده‌سازی زمینهprecc compress برای بهینه‌سازی CLAUDE.md
  • پشتیبانی اولویت‌دار

فعال‌سازی مجوز

$ precc license activate XXXX-XXXX-XXXX-XXXX --email you@example.com
[precc] License activated for you@example.com
[precc] Plan: Pro
[precc] Expires: 2027-04-03

بررسی وضعیت مجوز

$ precc license status
License: Pro
Email:   you@example.com
Expires: 2027-04-03
Status:  Active

فعال‌سازی GitHub Sponsors

اگر PRECC را از طریق GitHub Sponsors حمایت می‌کنید، مجوز شما به‌طور خودکار از طریق ایمیل GitHub فعال می‌شود. نیازی به کلید نیست – فقط مطمئن شوید ایمیل حامی مطابقت دارد:

$ precc license status
License: Pro (GitHub Sponsors)
Email:   you@example.com
Status:  Active (auto-renewed)

اثر انگشت دستگاه

هر مجوز به اثر انگشت دستگاه متصل است. خود را ببینید با:

$ precc license fingerprint
Fingerprint: a1b2c3d4e5f6...

اگر نیاز به انتقال مجوز به ماشین جدید دارید، ابتدا غیرفعال کنید:

precc license deactivate

سپس در ماشین جدید فعال کنید.

مجوز منقضی شده؟

وقتی مجوز Pro منقضی شود، PRECC به سطح Community برمی‌گردد. تمام مهارت‌های داخلی و عملکردهای اصلی به کار خود ادامه می‌دهند. فقط ویژگی‌های خاص Pro غیرقابل دسترس می‌شوند. برای جزئیات بیشتر سوالات متداول را ببینید.

خط لوله هوک

باینری precc-hook هسته PRECC است. بین Claude Code و شل قرار می‌گیرد و هر دستور bash را در کمتر از ۵ میلی‌ثانیه پردازش می‌کند.

نحوه فراخوانی هوک توسط Claude Code

Claude Code از هوک‌های PreToolUse پشتیبانی می‌کند – برنامه‌های خارجی که می‌توانند ورودی‌های ابزار را قبل از اجرا بررسی و تغییر دهند. وقتی Claude قصد اجرای دستور bash را دارد، JSON را به precc-hook از طریق stdin ارسال و پاسخ را از stdout می‌خواند.

مراحل خط لوله

Claude Code
    |
    v
+---------------------------+
| 1. Parse JSON stdin       |  Read the command from Claude Code
+---------------------------+
    |
    v
+---------------------------+
| 2. Skill matching         |  Query heuristics.db for matching skills (Pillar 4)
+---------------------------+
    |
    v
+---------------------------+
| 3. Directory correction   |  Resolve correct working directory (Pillar 1)
+---------------------------+
    |
    v
+---------------------------+
| 4. GDB check              |  Detect debug opportunities (Pillar 2)
+---------------------------+
    |
    v
+---------------------------+
| 5. RTK rewriting          |  Apply command rewrites for token savings
+---------------------------+
    |
    v
+---------------------------+
| 6. Emit JSON stdout       |  Return modified command to Claude Code
+---------------------------+
    |
    v
  Shell executes corrected command

مثال: ورودی و خروجی JSON

ورودی (از Claude Code)

{
  "tool_input": {
    "command": "cargo build"
  }
}

PRECC تشخیص می‌دهد که دایرکتوری فعلی Cargo.toml ندارد، اما ./myapp/Cargo.toml وجود دارد.

خروجی (به Claude Code)

{
  "hookSpecificOutput": {
    "updatedInput": {
      "command": "cd /home/user/projects/myapp && cargo build"
    }
  }
}

اگر نیازی به تغییر نباشد، updatedInput.command خالی است و Claude Code از دستور اصلی استفاده می‌کند.

جزئیات مراحل

مرحله ۱: تجزیه JSON

شیء JSON کامل را از stdin می‌خواند. tool_input.command را استخراج می‌کند. اگر تجزیه شکست بخورد، هوک فوراً خارج می‌شود و Claude Code از دستور اصلی استفاده می‌کند (طراحی fail-open).

مرحله ۲: تطبیق مهارت‌ها

پایگاه داده اکتشافی SQLite را برای مهارت‌هایی که الگوی فعال‌سازی آنها با دستور مطابقت دارد جستجو می‌کند. مهارت‌ها به ترتیب اولویت بررسی می‌شوند.

مرحله ۳: اصلاح دایرکتوری

برای دستورات ساخت (cargo، go، make، npm، python و غیره)، بررسی می‌کند که آیا فایل پروژه مورد انتظار در دایرکتوری فعلی وجود دارد. اگر نه، دایرکتوری‌های نزدیک را برای نزدیک‌ترین تطابق اسکن و cd <dir> && را در ابتدا اضافه می‌کند.

اسکن دایرکتوری از یک شاخص سیستم فایل کش شده با TTL پنج ثانیه‌ای برای حفظ سرعت استفاده می‌کند.

مرحله ۴: بررسی GDB

اگر احتمال دارد دستور باعث خرابی شود (مثلاً اجرای باینری debug)، PRECC می‌تواند wrapper‌های GDB را پیشنهاد یا تزریق کند تا خروجی debug ساختاریافته به جای لاگ‌های خرابی خام ثبت شود.

مرحله ۵: بازنویسی RTK

قوانین RTK (جعبه ابزار بازنویسی) را اعمال می‌کند که دستورات طولانی را کوتاه، خروجی‌های پر سر و صدا را سرکوب یا دستورات را برای بهره‌وری توکن بازسازی می‌کند.

مرحله ۶: ارسال JSON

دستور تغییریافته را به JSON سریال‌سازی کرده و روی stdout می‌نویسد. اگر تغییری ایجاد نشده باشد، خروجی به Claude Code سیگنال می‌دهد که از دستور اصلی استفاده کند.

عملکرد

کل خط لوله در کمتر از ۵ میلی‌ثانیه (p99) تکمیل می‌شود. بهینه‌سازی‌های کلیدی:

  • SQLite در حالت WAL برای خواندن همزمان بدون قفل
  • الگوهای regex از پیش کامپایل شده برای تطبیق مهارت‌ها
  • اسکن‌های سیستم فایل کش شده (TTL پنج ثانیه‌ای)
  • بدون فراخوانی شبکه در مسیر اصلی
  • Fail-open: هر خطایی به دستور اصلی بازمی‌گردد

تست دستی هوک

می‌توانید هوک را مستقیماً فراخوانی کنید:

$ echo '{"tool_input":{"command":"cargo build"}}' | precc-hook
{"hookSpecificOutput":{"updatedInput":{"command":"cd /home/user/myapp && cargo build"}}}

مهارت‌ها

مهارت‌ها قوانین تطبیق الگو هستند که PRECC برای شناسایی و اصلاح دستورات استفاده می‌کند. آن‌ها می‌توانند داخلی (به صورت فایل‌های TOML) یا استخراج‌شده از لاگ‌های جلسه باشند.

مهارت‌های داخلی

مهارتفعال‌سازیعملکرد
cargo-wrong-dircargo build/test/clippy خارج از پروژه Rustافزودن cd به نزدیک‌ترین پوشه Cargo.toml
git-wrong-dirgit * خارج از مخزن gitافزودن cd به نزدیک‌ترین پوشه .git
go-wrong-dirgo build/test خارج از ماژول Goافزودن cd به نزدیک‌ترین پوشه go.mod
make-wrong-dirmake بدون Makefile در پوشه فعلیافزودن cd به نزدیک‌ترین پوشه Makefile
npm-wrong-dirnpm/npx/pnpm/yarn خارج از پروژه Nodeافزودن cd به نزدیک‌ترین پوشه package.json
python-wrong-dirpython/pytest/pip خارج از پروژه Pythonافزودن cd به نزدیک‌ترین پروژه Python
jj-translategit * در مخزن jj هم‌مکانبازنویسی به دستور jj معادل
asciinema-gifasciinema recبازنویسی به precc gif

فهرست مهارت‌ها

$ precc skills list
  # Name               Type      Triggers
  1 cargo-wrong-dir    built-in  cargo build/test/clippy outside Rust project
  2 git-wrong-dir      built-in  git * outside a repo
  3 go-wrong-dir       built-in  go build/test outside Go module
  4 make-wrong-dir     built-in  make without Makefile in cwd
  5 npm-wrong-dir      built-in  npm/npx/pnpm/yarn outside Node project
  6 python-wrong-dir   built-in  python/pytest/pip outside Python project
  7 jj-translate       built-in  git * in jj-colocated repo
  8 asciinema-gif      built-in  asciinema rec
  9 fix-pytest-path    mined     pytest with wrong test path

نمایش جزئیات مهارت

$ precc skills show cargo-wrong-dir
Name:        cargo-wrong-dir
Type:        built-in
Source:      skills/builtin/cargo-wrong-dir.toml
Description: Detects cargo commands run outside a Rust project and prepends
             cd to the directory containing the nearest Cargo.toml.
Trigger:     ^cargo\s+(build|test|clippy|run|check|bench|doc)
Action:      prepend_cd
Marker:      Cargo.toml
Activations: 12

صادرکردن مهارت به TOML

$ precc skills export cargo-wrong-dir
[skill]
name = "cargo-wrong-dir"
description = "Prepend cd for cargo commands outside a Rust project"
trigger = "^cargo\\s+(build|test|clippy|run|check|bench|doc)"
action = "prepend_cd"
marker = "Cargo.toml"
priority = 10

ویرایش مهارت

$ precc skills edit cargo-wrong-dir

این تعریف مهارت را در $EDITOR شما باز می‌کند. پس از ذخیره، مهارت به طور خودکار بارگذاری مجدد می‌شود.

دستور Advise

precc skills advise جلسه اخیر شما را تحلیل می‌کند و مهارت‌های جدید را بر اساس الگوهای تکراری پیشنهاد می‌دهد:

$ precc skills advise
Analyzed 47 commands from the last session.

Suggested skills:
  1. docker-wrong-dir: You ran `docker compose up` outside the project root 3 times.
     Suggested trigger: ^docker\s+compose
     Suggested marker: docker-compose.yml

  2. terraform-wrong-dir: You ran `terraform plan` outside the infra directory 2 times.
     Suggested trigger: ^terraform\s+(plan|apply|init)
     Suggested marker: main.tf

Accept suggestion [1/2/skip]?

خوشه‌بندی مهارت‌ها

$ precc skills cluster

مهارت‌های استخراج‌شده مشابه را گروه‌بندی می‌کند تا الگوهای تکراری یا هم‌پوشان را شناسایی کند.

مهارت‌های استخراج‌شده در مقابل داخلی

مهارت‌های داخلی همراه PRECC ارائه می‌شوند و در skills/builtin/*.toml تعریف شده‌اند. آن‌ها رایج‌ترین خطاهای پوشه نادرست را پوشش می‌دهند.

مهارت‌های استخراج‌شده توسط precc ingest یا دیمن precc-learner از لاگ‌های جلسه شما ایجاد می‌شوند. در ~/.local/share/precc/heuristics.db ذخیره می‌شوند و مختص گردش کار شما هستند. برای جزئیات استخراج را ببینید.

صرفه‌جویی

PRECC صرفه‌جویی تخمینی توکن‌ها را از هر رهگیری پیگیری می‌کند. از precc savings برای مشاهده میزان اتلاف جلوگیری‌شده استفاده کنید.

خلاصه سریع

$ precc savings
Session Token Savings
=====================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens

Breakdown:
  Pillar 1 (cd prepends):         <span data-stat="session_p1_tokens">3,204</span> tokens  (<span data-stat="session_p1_count">6</span> corrections)
  Pillar 4 (skill activations):   <span data-stat="session_p4_tokens">1,560</span> tokens  (<span data-stat="session_p4_count">4</span> activations)
  RTK rewrites:                   <span data-stat="session_rtk_tokens">2,749</span> tokens  (<span data-stat="session_rtk_count">11</span> rewrites)
  Lean-ctx wraps:                 <span data-stat="session_lean_tokens">1,228</span> tokens  (<span data-stat="session_lean_count">2</span> wraps)

جزئیات کامل (Pro)

$ precc savings --all
Session Token Savings (Detailed)
================================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens

Command-by-command:
  #  Time   Command                          Saving   Source
  1  09:12  cargo build                      534 tk   cd prepend (cargo-wrong-dir)
  2  09:14  cargo test                       534 tk   cd prepend (cargo-wrong-dir)
  3  09:15  git status                       412 tk   cd prepend (git-wrong-dir)
  4  09:18  npm install                      824 tk   cd prepend (npm-wrong-dir)
  5  09:22  find . -name "*.rs"              387 tk   RTK rewrite (output truncation)
  6  09:25  cat src/main.rs                  249 tk   RTK rewrite (lean-ctx wrap)
  7  09:31  cargo clippy                     534 tk   cd prepend (cargo-wrong-dir)
  ...

Pillar Breakdown:
  Pillar 1 (context resolution):   <span data-stat="session_p1_tokens">3,204</span> tokens  <span data-stat="session_p1_pct">36.6</span>%
  Pillar 2 (GDB debugging):            0 tokens   0.0%
  Pillar 3 (mined preventions):        0 tokens   0.0%
  Pillar 4 (automation skills):    <span data-stat="session_p4_tokens">1,560</span> tokens  <span data-stat="session_p4_pct">17.8</span>%
  RTK rewrites:                    <span data-stat="session_rtk_tokens">2,749</span> tokens  <span data-stat="session_rtk_pct">31.5</span>%
  Lean-ctx wraps:                  <span data-stat="session_lean_tokens">1,228</span> tokens  <span data-stat="session_lean_pct">14.1</span>%

نحوه تخمین صرفه‌جویی

هر نوع اصلاح دارای هزینه تخمینی توکن بر اساس آنچه بدون PRECC رخ می‌داد است:

نوع اصلاحصرفه‌جویی تخمینیدلیل
cd prepend~500 tokensخروجی خطا + استدلال Claude + تلاش مجدد
فعال‌سازی مهارت~400 tokensخروجی خطا + استدلال Claude + تلاش مجدد
RTK rewrite~250 tokensخروجی طولانی که Claude باید بخواند
Lean-ctx wrap~600 tokensمحتوای فایل بزرگ فشرده شده
پیشگیری استخراج‌شده~500 tokensالگوی شکست شناخته‌شده اجتناب شد

اینها تخمین‌های محتاطانه هستند. صرفه‌جویی واقعی اغلب بیشتر است زیرا استدلال Claude درباره خطاها می‌تواند طولانی باشد.

صرفه‌جویی تجمعی

صرفه‌جویی‌ها در پایگاه داده PRECC بین جلسات باقی می‌مانند. با گذشت زمان، می‌توانید تأثیر کلی را پیگیری کنید:

$ precc savings
Session Token Savings
=====================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens

Lifetime savings: <span data-stat="total_tokens_saved">142,389</span> tokens across <span data-stat="total_sessions">47</span> sessions

Status Bar

After installation, PRECC wires a statusLine entry into ~/.claude/settings.json so the Claude Code status bar shows live session metrics:

$0.42 spent | 1.2M in/out | 📊 last cmd: −1.2K | PRECC: 7 fixes | 5.8ms avg | this session: 320 saved over 7 cmds (~$0.05) | lifetime: 8.9K saved over 217 cmds (~$2.85)

Each segment:

SegmentSourceMeaningResets on session restart?
$0.42 spentClaude Code’s cost.total_cost_usdCumulative session cost reported by Claude CodeYes
1.2M in/outClaude Code’s total_input_tokens + total_output_tokensNon-cached input + output tokens across the sessionYes
📊 last cmd: −1.2KPRECC measurement of the most recent Bash commandReal ground-truth saving from re-running the originalNo (persists across sessions)
PRECC: 7 fixesPRECC session aggregate from metrics.logNumber of corrections this session — fix count only, no fake token estimateYes
5.8ms avgPRECC hook latency p50Time PRECC spent processing each tool callYes
bash 18% of totalPRECC post_observations.log filtered by session windowShare of session tokens that came from Bash output — clarifies why PRECC’s savings are naturally a fraction of total cost (PRECC only optimizes Bash output)Yes
this session: 320 saved over 7 cmds (~$0.05)~/.local/share/precc/.lifetime_summary.json minus the per-session baseline at ~/.local/share/precc/sessions/<session_id>.savings_baselineReal per-session delta. Baseline is captured the first time PRECC sees this session_id; subsequent refreshes compute current_lifetime − baseline so the value reflects savings accrued in this session only. Hidden when delta is zero (start of session)Yes (baseline re-snapshots)
lifetime: 8.9K saved over 217 cmds (~$2.85)~/.local/share/precc/.lifetime_summary.json + current session’s cost.total_cost_usd / total_used_tokens rateCumulative tokens saved and re-measured commands since PRECC was first installed, plus an estimated USD value computed from the current session’s per-token rate. Cost estimate is conservative — it uses (input+output) as the denominator while the cost includes cache tokens, so the per-token rate is overstated and the resulting savings figure is lower than actualNo

The lifetime: segment is placed last so it’s the first to be truncated if Claude Code’s UI clips the bar at the right edge.

Why cost and token count don’t divide

The displayed 1.2M in/out is not the denominator that produced $0.42 spent. Claude Code’s cost.total_cost_usd is computed from the API’s full token breakdown — base input, output, plus cache reads and cache creations. The session-wide cumulative cache token counts are not exposed in the statusline schema, so PRECC can only show the visible (non-cache) portion.

On long sessions with heavy file rereads, cache reads can be 10× the visible token count. That’s why pairing the two as a ratio would mislead — PRECC shows them as independent segments instead.

Why PRECC doesn’t compute the cost

The cost number is authoritative. PRECC reads cost.total_cost_usd verbatim from the JSON Claude Code pipes into the status command on stdin. That’s the same number Claude Code charges against your subscription/usage budget. You can verify it any time with the built-in /cost slash command — both should agree.

What drives the cost

For Claude Opus 4.6:

Token typeStandard (≤200k context)1M context tier
Input$15 / MTok$30 / MTok
Output$75 / MTok$150 / MTok
Cache write$18.75 / MTok$37.50 / MTok
Cache read$1.50 / MTok$3 / MTok

The biggest drivers on long sessions are usually:

  1. Output tokens — most expensive per-token type, especially on the 1M context tier
  2. Repeated cache reads — cheap individually but accumulate fast across many turns
  3. Cache creations — written once per file read, ~1.25× the base input rate

PRECC reduces the visible-token cost by compressing Bash output (the 📊 last cmd: segment shows the per-command saving), but it cannot reduce cache reads of files Claude has already loaded.

Stable session counts

The “PRECC: N fixes” segment counts events since the persisted session start, written to ~/.local/share/precc/sessions/<session_id>.start on the first statusline refresh of each session. This makes the count monotonic — it cannot drop mid-session even if cost.total_duration_ms is missing on a particular refresh (which would otherwise collapse the window to “since now” and silently drop nearly all events).

Auto-refreshed lifetime snapshot

The lifetime: segment reads ~/.local/share/precc/.lifetime_summary.json, which is rewritten:

  • On every PostToolUse measurement (so it stays current as commands accumulate)
  • On every precc savings invocation

The this session: segment reads the same lifetime file but subtracts a per-session baseline persisted to ~/.local/share/precc/sessions/<session_id>.savings_baseline on the first refresh of each session.

No need to manually refresh anything — the files update themselves.

Suppressing the status bar

If you’d rather keep your existing status bar, set your own statusLine command in ~/.claude/settings.json. PRECC’s installer will detect the custom value and leave it alone on subsequent updates.

To suppress only the per-interaction 📊 PRECC line (in additionalContext), set PRECC_QUIET=1 in your shell environment.

فشرده‌سازی

precc compress فایل CLAUDE.md و سایر فایل‌های زمینه را کوچک می‌کند تا مصرف توکن هنگام بارگذاری توسط Claude Code کاهش یابد. این یک ویژگی Pro است.

استفاده پایه

$ precc compress .
[precc] Scanning directory: .
[precc] Found 3 context files:
         CLAUDE.md (2,847 tokens -> 1,203 tokens, -57.7%)
         ARCHITECTURE.md (4,112 tokens -> 2,044 tokens, -50.3%)
         ALTERNATIVES.md (3,891 tokens -> 1,967 tokens, -49.5%)
[precc] Total: 10,850 tokens -> 5,214 tokens (-51.9%)
[precc] Files compressed. Use --revert to restore originals.

اجرای آزمایشی

پیش‌نمایش تغییرات بدون اصلاح فایل‌ها:

$ precc compress . --dry-run
[precc] Dry run -- no files will be modified.
[precc] CLAUDE.md: 2,847 tokens -> 1,203 tokens (-57.7%)
[precc] ARCHITECTURE.md: 4,112 tokens -> 2,044 tokens (-50.3%)
[precc] ALTERNATIVES.md: 3,891 tokens -> 1,967 tokens (-49.5%)
[precc] Total: 10,850 tokens -> 5,214 tokens (-51.9%)

بازگردانی

فایل‌های اصلی به‌طور خودکار پشتیبان‌گیری می‌شوند. برای بازیابی آنها:

$ precc compress --revert
[precc] Restored 3 files from backups.

چه چیزی فشرده می‌شود

فشرده‌ساز چندین تبدیل اعمال می‌کند:

  • فضاهای خالی و خطوط خالی اضافی را حذف می‌کند
  • عبارات طولانی را کوتاه می‌کند و معنی را حفظ می‌کند
  • جداول و فهرست‌ها را فشرده می‌کند
  • نظرات و قالب‌بندی تزئینی را حذف می‌کند
  • تمام بلوک‌های کد، مسیرها و شناسه‌های فنی را حفظ می‌کند

خروجی فشرده همچنان قابل خواندن است – فشرده‌سازی یا مبهم‌سازی نشده است.

هدف‌گیری فایل‌های خاص

$ precc compress CLAUDE.md
[precc] CLAUDE.md: 2,847 tokens -> 1,203 tokens (-57.7%)

گزارش‌ها

precc report یک داشبورد تحلیلی تولید می‌کند که فعالیت PRECC و صرفه‌جویی توکن را خلاصه می‌کند.

ایجاد گزارش

$ precc report
PRECC Report -- 2026-04-03
==========================

Sessions analyzed: 12
Commands intercepted: 87
Total token savings: 42,389

Top skills by activation:
  1. cargo-wrong-dir     34 activations   17,204 tokens saved
  2. npm-wrong-dir       18 activations    9,360 tokens saved
  3. git-wrong-dir       12 activations    4,944 tokens saved
  4. RTK rewrite         15 activations    3,750 tokens saved
  5. python-wrong-dir     8 activations    4,131 tokens saved

Savings by pillar:
  Pillar 1 (context resolution):  28,639 tokens  67.6%
  Pillar 4 (automation skills):    7,000 tokens  16.5%
  RTK rewrites:                    3,750 tokens   8.8%
  Lean-ctx wraps:                  3,000 tokens   7.1%

Recent corrections:
  2026-04-03 09:12  cargo build -> cd myapp && cargo build
  2026-04-03 09:18  npm test -> cd frontend && npm test
  2026-04-03 10:05  git status -> cd repo && git status
  ...

ارسال گزارش با ایمیل

گزارش را به آدرس ایمیل ارسال کنید (نیاز به تنظیمات ایمیل دارد، به Email مراجعه کنید):

$ precc report --email
[precc] Report sent to you@example.com

آدرس گیرنده از ~/.config/precc/mail.toml خوانده می‌شود. همچنین می‌توانید از precc mail report EMAIL برای ارسال به آدرس خاص استفاده کنید.

داده‌های گزارش

گزارش‌ها از پایگاه داده محلی PRECC در ~/.local/share/precc/history.db تولید می‌شوند. هیچ داده‌ای از دستگاه شما خارج نمی‌شود مگر اینکه صراحتاً گزارش را ایمیل کنید.

استخراج

PRECC لاگ‌های جلسات Claude Code را استخراج می‌کند تا الگوهای خطا-اصلاح را بیاموزد. وقتی همان اشتباه را دوباره می‌بیند، اصلاح را به‌طور خودکار اعمال می‌کند.

دریافت لاگ‌های جلسه

دریافت یک فایل

$ precc ingest ~/.claude/logs/session-2026-04-03.jsonl
[precc] Parsing session-2026-04-03.jsonl...
[precc] Found 142 commands, 8 failure-fix pairs
[precc] Stored 8 patterns in history.db
[precc] 2 new skill candidates identified

دریافت همه لاگ‌ها

$ precc ingest --all
[precc] Scanning ~/.claude/logs/...
[precc] Found 23 session files (14 new, 9 already ingested)
[precc] Parsing 14 new files...
[precc] Found 47 failure-fix pairs across 14 sessions
[precc] Stored 47 patterns in history.db
[precc] 5 new skill candidates identified

اجبار دریافت مجدد

برای پردازش مجدد فایل‌هایی که قبلاً دریافت شده‌اند:

$ precc ingest --all --force
[precc] Re-ingesting all 23 session files...

نحوه کار استخراج

  1. PRECC فایل لاگ JSONL جلسه را می‌خواند.
  2. جفت دستوراتی را شناسایی می‌کند که دستور اول شکست خورده و دومی تلاش مجدد اصلاح‌شده بود.
  3. الگو (چه اشتباهی رخ داد) و اصلاح (چه کاری متفاوت انجام شد) را استخراج می‌کند.
  4. الگوها در ~/.local/share/precc/history.db ذخیره می‌شوند.
  5. وقتی الگویی به آستانه اطمینان برسد، به مهارت استخراج‌شده در heuristics.db تبدیل می‌شود.

نمونه الگو

Failure: pytest tests/test_auth.py
Error:   ModuleNotFoundError: No module named 'myapp'
Fix:     cd /home/user/myapp && pytest tests/test_auth.py
Pattern: pytest outside project root -> prepend cd

دیمن precc-learner

دیمن precc-learner در پس‌زمینه اجرا می‌شود و به‌طور خودکار لاگ‌های جلسه جدید را زیر نظر می‌گیرد:

$ precc-learner &
[precc-learner] Watching ~/.claude/logs/ for new sessions...
[precc-learner] Processing session-2026-04-03-1412.jsonl... 3 new patterns

دیمن از اعلان‌های سیستم فایل (inotify در لینوکس، FSEvents در macOS) استفاده می‌کند و بلافاصله پس از پایان جلسه واکنش نشان می‌دهد.

از الگوها به مهارت‌ها

الگوهای استخراج‌شده زمانی به مهارت ارتقا می‌یابند که این معیارها را برآورده کنند:

  • حداقل 3 بار در جلسات مختلف دیده شده
  • الگوی اصلاح سازگار (همان نوع اصلاح هر بار)
  • هیچ مثبت کاذبی شناسایی نشده

می‌توانید نامزدهای مهارت را بررسی کنید:

$ precc skills advise

برای جزئیات مدیریت مهارت‌ها به Skills مراجعه کنید.

ذخیره‌سازی داده

  • جفت‌های خطا-اصلاح: ~/.local/share/precc/history.db
  • مهارت‌های ارتقا یافته: ~/.local/share/precc/heuristics.db

هر دو پایگاه داده SQLite در حالت WAL برای دسترسی همزمان امن هستند.

ایمیل

PRECC می‌تواند گزارش‌ها و فایل‌ها را از طریق ایمیل ارسال کند. این نیاز به تنظیم یکباره SMTP دارد.

راه‌اندازی

$ precc mail setup
SMTP host: smtp.gmail.com
SMTP port [587]: 587
Username: you@gmail.com
Password: ********
From address [you@gmail.com]: you@gmail.com
[precc] Mail configuration saved to ~/.config/precc/mail.toml
[precc] Sending test email to you@gmail.com...
[precc] Test email sent successfully.

فایل پیکربندی

پیکربندی در ~/.config/precc/mail.toml ذخیره می‌شود:

[smtp]
host = "smtp.gmail.com"
port = 587
username = "you@gmail.com"
password = "app-password-here"
from = "you@gmail.com"
tls = true

می‌توانید این فایل را مستقیماً ویرایش کنید:

$EDITOR ~/.config/precc/mail.toml

برای Gmail، از رمز عبور برنامه به جای رمز عبور حساب خود استفاده کنید.

ارسال گزارش‌ها

$ precc mail report team@example.com
[precc] Generating report...
[precc] Sending to team@example.com...
[precc] Report sent.

ارسال فایل‌ها

$ precc mail send colleague@example.com output.log
[precc] Sending output.log to colleague@example.com...
[precc] Sent (14.2 KB).

پشتیبانی از رله SSH

اگر دستگاه شما نمی‌تواند مستقیماً به سرور SMTP دسترسی پیدا کند (مثلاً پشت فایروال شرکتی)، PRECC از رله از طریق تونل SSH پشتیبانی می‌کند:

[smtp]
host = "localhost"
port = 2525

[ssh_relay]
host = "relay.example.com"
user = "you"
remote_port = 587
local_port = 2525

PRECC قبل از ارسال به طور خودکار تونل SSH را برقرار می‌کند.

ضبط GIF

precc gif ضبط‌های GIF متحرک از جلسات ترمینال از اسکریپت‌های bash ایجاد می‌کند. این یک ویژگی Pro است.

استفاده پایه

$ precc gif script.sh 30s
[precc] Recording script.sh (max 30s)...
[precc] Running: echo "Hello, world!"
[precc] Running: cargo build --release
[precc] Running: cargo test
[precc] Recording complete.
[precc] Output: script.gif (1.2 MB, 24s)

آرگومان اول یک اسکریپت bash حاوی دستورات اجرایی است. آرگومان دوم حداکثر طول ضبط است.

فرمت اسکریپت

اسکریپت یک فایل bash استاندارد است:

#!/bin/bash
echo "Building project..."
cargo build --release
echo "Running tests..."
cargo test
echo "Done!"

شبیه‌سازی ورودی

برای دستورات تعاملی، مقادیر ورودی را به عنوان آرگومان‌های اضافی ارائه دهید:

$ precc gif interactive-demo.sh 60s "yes" "my-project" "3"

هر آرگومان اضافی به عنوان یک خط stdin هنگامی که اسکریپت ورودی درخواست می‌کند ارائه می‌شود.

گزینه‌های خروجی

فایل خروجی به طور پیش‌فرض بر اساس نام اسکریپت نام‌گذاری می‌شود (script.gif). GIF از تم تاریک ترمینال با ابعاد استاندارد 80x24 استفاده می‌کند.

چرا GIF به جای asciinema؟

مهارت داخلی asciinema-gif به طور خودکار asciinema rec را به precc gif بازنویسی می‌کند. فایل‌های GIF قابل حمل‌تر هستند – بدون نیاز به پخش‌کننده در GitHub README، Slack و ایمیل نمایش داده می‌شوند.

تحلیل GitHub Actions

precc gha اجراهای ناموفق GitHub Actions را تحلیل کرده و اصلاحات پیشنهاد می‌دهد. این یک ویژگی Pro است.

استفاده

URL اجرای ناموفق GitHub Actions را ارسال کنید:

$ precc gha https://github.com/myorg/myrepo/actions/runs/12345678
[precc] Fetching run 12345678...
[precc] Run: CI / build (ubuntu-latest)
[precc] Status: failure
[precc] Failed step: Run cargo test

[precc] Log analysis:
  Error: test result: FAILED. 2 passed; 1 failed
  Failed test: tests::integration::test_database_connection
  Cause: thread 'tests::integration::test_database_connection' panicked at
         'called Result::unwrap() on an Err value: Connection refused'

[precc] Suggested fix:
  The test requires a database connection but the CI environment does not
  start a database service. Add a services block to your workflow:

    services:
      postgres:
        image: postgres:15
        ports:
          - 5432:5432
        env:
          POSTGRES_PASSWORD: test

عملکرد

  1. URL اجرای GitHub Actions را تحلیل کرده و مالک، مخزن و شناسه اجرا را استخراج می‌کند.
  2. لاگ‌های اجرا را از طریق API GitHub دریافت می‌کند (در صورت تنظیم از GITHUB_TOKEN استفاده می‌کند، در غیر این صورت دسترسی عمومی).
  3. مرحله ناموفق را شناسایی کرده و خطوط خطای مربوطه را استخراج می‌کند.
  4. خطا را تحلیل کرده و بر اساس الگوهای رایج خرابی CI اصلاحی پیشنهاد می‌دهد.

الگوهای خرابی پشتیبانی‌شده

  • کانتینرهای سرویس گمشده (پایگاه‌های داده، Redis و غیره)
  • سیستم‌عامل یا معماری runner نادرست
  • متغیرهای محیطی یا secrets گمشده
  • خرابی‌های نصب وابستگی
  • وقفه‌های زمانی تست
  • خطاهای مجوز
  • عدم وجود کش که باعث ساخت کند می‌شود

حصار جغرافیایی

PRECC شامل بررسی انطباق حصار جغرافیایی IP برای محیط‌های تحت نظارت است. این یک ویژگی Pro است.

مرور کلی

برخی سازمان‌ها نیاز دارند که ابزارهای توسعه فقط در مناطق جغرافیایی تایید شده کار کنند. ویژگی حصار جغرافیایی PRECC تأیید می‌کند که آدرس IP دستگاه فعلی در لیست مناطق مجاز قرار دارد.

بررسی انطباق

$ precc geofence check
[precc] Current IP: 203.0.113.42
[precc] Region: US-East (Virginia)
[precc] Status: COMPLIANT
[precc] Policy: us-east-1, us-west-2, eu-west-1

اگر دستگاه خارج از مناطق مجاز باشد:

$ precc geofence check
[precc] Current IP: 198.51.100.7
[precc] Region: AP-Southeast (Singapore)
[precc] Status: NON-COMPLIANT
[precc] Policy: us-east-1, us-west-2, eu-west-1
[precc] Warning: Current region is not in the allowed list.

بروزرسانی داده‌های حصار جغرافیایی

$ precc geofence refresh
[precc] Fetching updated IP geolocation data...
[precc] Updated. Cache expires in 24h.

مشاهده اطلاعات حصار جغرافیایی

$ precc geofence info
Geofence Configuration
======================
Policy file:    ~/.config/precc/geofence.toml
Allowed regions: us-east-1, us-west-2, eu-west-1
Cache age:      2h 14m
Last check:     2026-04-03 09:12:00 UTC
Status:         COMPLIANT

پاک کردن حافظه پنهان

$ precc geofence clear
[precc] Geofence cache cleared.

پیکربندی

سیاست حصار جغرافیایی در ~/.config/precc/geofence.toml تعریف شده است:

[geofence]
allowed_regions = ["us-east-1", "us-west-2", "eu-west-1"]
check_on_init = true
block_on_violation = false

مقدار block_on_violation = true را تنظیم کنید تا از عملکرد PRECC در خارج از مناطق مجاز جلوگیری شود.

تله‌متری

PRECC از تله‌متری ناشناس اختیاری برای بهبود ابزار پشتیبانی می‌کند. هیچ داده‌ای بدون رضایت صریح شما جمع‌آوری نمی‌شود.

فعال‌سازی

$ precc telemetry consent
[precc] Telemetry enabled. Thank you for helping improve PRECC.
[precc] You can revoke consent at any time with: precc telemetry revoke

غیرفعال‌سازی

$ precc telemetry revoke
[precc] Telemetry disabled. No further data will be sent.

بررسی وضعیت

$ precc telemetry status
Telemetry: disabled
Last sent: never

پیش‌نمایش داده‌هایی که ارسال خواهد شد

قبل از فعال‌سازی، می‌توانید دقیقاً ببینید چه داده‌هایی جمع‌آوری خواهد شد:

$ precc telemetry preview
Telemetry payload (this session):
{
  "version": "0.3.0",
  "os": "linux",
  "arch": "x86_64",
  "skills_activated": 12,
  "commands_intercepted": 87,
  "pillars_used": [1, 4],
  "avg_hook_latency_ms": 2.3,
  "session_count": 1
}

آنچه جمع‌آوری می‌شود

  • نسخه PRECC، سیستم‌عامل و معماری
  • شمارش‌های تجمیعی: دستورات رهگیری‌شده، مهارت‌های فعال‌شده، ستون‌های استفاده‌شده
  • میانگین تأخیر هوک
  • تعداد جلسات

آنچه جمع‌آوری نمی‌شود

  • بدون متن دستور یا آرگومان
  • بدون مسیر فایل یا نام پوشه
  • بدون نام پروژه یا آدرس مخزن
  • بدون اطلاعات شناسایی شخصی (PII)
  • بدون آدرس IP (سرور آنها را ثبت نمی‌کند)

بازنویسی متغیر محیطی

برای غیرفعال کردن تله‌متری بدون اجرای دستور (مفید در CI یا محیط‌های مشترک):

export PRECC_NO_TELEMETRY=1

این بر تنظیمات رضایت اولویت دارد.

مقصد داده‌ها

داده‌های تله‌متری از طریق HTTPS به https://telemetry.peria.ai/v1/precc ارسال می‌شود. داده‌ها فقط برای درک الگوهای استفاده و اولویت‌بندی توسعه استفاده می‌شود.

Mindmap

This page is auto-generated from mindmap.db — a SQLite snapshot of all recorded PRECC development sessions and git commits. Every row traces back to its source (commit:<sha>, session:<id>, or doc:<path>).

Overview

  • Sessions analyzed: 22
  • Messages: 14023
  • Tool invocations: 5072
  • Commits: 205
  • Time range: 2026-03-20T07:04:14.787Z → 2026-04-19T11:50:10.153Z
  • Effort (tokens):
    • input: 27928
    • output: 2750669
    • cache writes: 43349705
    • cache reads: 1936351239

Features

ScopeTitleStatusCommitsTokensFirstLastSource
benchfeat(bench): SWE-bench Verified/Lite driver scaffoldingstabilizing443442992026-04-172026-04-17commit:5bdd027d
benchmark_gate.shfeat: benchmark_gate.sh + pin tb dataset to 0.1.1shipped143442992026-04-172026-04-17commit:99fa9a74
realfeat: real lean-ctx (not stub), wider campaign, doc updatesshipped2298211522026-04-072026-04-17commit:6095720a
precc_mode=benchmarkfeat: PRECC_MODE=benchmark toggle + pairwise benchmark harnessshipped143442992026-04-172026-04-17commit:50c5a30f
addfeat: add precc update self-update commandshipped14425571072026-03-092026-04-17commit:e5542fba
negotiablefeat: negotiable rewrites, skill decay, explain/undo — response to criticshipped143442992026-04-172026-04-17commit:6fda67e4
statuslinefeat: statusline shows actual session token consumption + coststabilizing3254249152026-04-082026-04-13commit:4f65556d
publicfeat: public repo commits attributed to Ce-cyber-artshipped1253821192026-04-102026-04-10commit:0e4840e4
shortfeat: short install URL https://peria.ai/install.shshipped1253821192026-04-092026-04-09commit:615d3d06
rewritefeat: rewrite Pillar 2b (ccc) and Pillar 3 (compress) in Rust for single-binary deploymentshipped2381180742026-03-202026-04-08commit:78621579
shortenfeat: shorten statusline segments to fit narrower terminalsshipped1253821192026-04-082026-04-08commit:ef2c88b4
dropfeat: drop fake token estimate, append cost estimate to lifetime segmentstabilizing2253821192026-04-082026-04-08commit:2702f3f9
updatefeat: update pricing to $5/6mo + $10/yr, add webhook serverstabilizing9381180742026-02-252026-04-08commit:2d366031
clearerfeat: clearer statusline labels — meas:, drop confusing %, add bash shareshipped1253821192026-04-082026-04-08commit:4cd837b7
stablefeat: stable machine_hash for telemetry dedupstabilizing2253821192026-04-082026-04-08commit:3073f428
lifetimefeat: lifetime savings segment in statuslineshipped1253821192026-04-082026-04-08commit:9af422e8
preccfeat: precc analyze frequencies — data-driven rule gap discoveryshipped3253821192026-04-072026-04-08commit:d6f24c50
per-interactionfeat: per-interaction PRECC savings line in PostToolUseshipped1253821192026-04-082026-04-08commit:e3bc282e
webhookfeat: webhook auto-regenerates stats.json on telemetry POSTstabilizing2291341862026-03-312026-04-08commit:912b75f3
per-emailfeat: per-email aggregation for telemetryshipped1253821192026-04-082026-04-08commit:14c95e7d
v0.3.3feat: v0.3.3 — companion tools default-on, install-script clarityshipped1253821192026-04-072026-04-07commit:48fca046
measurementfeat: measurement campaign script — real per-mode measurementsshipped1253821192026-04-072026-04-07commit:36760587
quote-awarefeat: quote-aware chain split + sysadmin tool whitelist (54.2% → 55.5%)shipped1253821192026-04-072026-04-07commit:f6580598
;feat: ; chain support + ssh inner-command parsing for measurementshipped1253821192026-04-072026-04-07commit:10093218
expandfeat: expand is_safe_to_rerun coverage + measurement timeout/cacheshipped1253821192026-04-072026-04-07commit:c5a7ea79
multi-modefeat: multi-mode adaptive compression with failure learningshipped1253821192026-04-072026-04-07commit:81475afc
measuredfeat: measured savings in telemetry, detailed live stats, update nudgeshipped1253821192026-04-062026-04-06commit:06907091
scientificfeat: scientific token savings measurement, telemetry dedup, 28-language docsshipped1253821192026-04-062026-04-06commit:78a20ef2
v0.3.2feat: v0.3.2 — hook safety, adaptive compression, on-demand metrics importshipped1253821192026-04-052026-04-05commit:a0c0c882
self-hostedfeat: self-hosted telemetry endpoint at peria.ai, install UX improvementsshipped125657032026-04-042026-04-04commit:8212a18e
auto-updatefeat: auto-update consent prompt on init and manual updateshipped119243022026-04-022026-04-02commit:818be6dd
useperf: use pre-built binaries for lean-ctx and nushell installationstabilizing4101702522026-03-092026-03-31commit:8c612e55
authorizefeat: authorize peria.ai server for license key generationshipped211863642026-03-312026-03-31commit:53dfe832
licensefeat: license keys, SMTP mail-agent, updated business plan and demosstabilizing2101702522026-03-092026-03-31commit:b07c9dfb
lean-ctxfeat: lean-ctx integration for deep output compressionshipped111863642026-03-312026-03-31commit:07361e62
integratefeat: integrate three-pillar savings from precc-cc (cocoindex-code, token-saver, ClawHub)shipped2101702522026-03-202026-03-31commit:af4205f1
windowsfeat: Windows build via CI, deploy triggers workflowstabilizing225336922026-03-292026-03-29commit:7404761b
monthlyfeat: monthly usage report via email for Pro usersshipped125336922026-03-282026-03-28commit:77ad78bc
nushellfeat: nushell what-if analysis, skill clustering, comment blocker, bash unwrap (v0.2.6)shipped123379412026-03-272026-03-27commit:803df684
geofencefeat: geofence compliance guard, 3rd-party skill Claude interaction tracking (v0.2.5)shipped123379412026-03-262026-03-26commit:0c9fc765
stripefeat: Stripe payment integration, context pressure, GHA analysisshipped224570882026-03-212026-03-22commit:8eb16f78
contextfeat: context pressure warning, GHA analysis, statusline context %shipped121661412026-03-202026-03-20commit:894621ba
statusline,feat: statusline, squash deploy, ClaWHub metadata, SHA256 checksumsshipped121661412026-03-202026-03-20commit:7ab15883
gumroadfeat: Gumroad license verification via API (v0.2.2)shipped102026-03-132026-03-13commit:75c5e480
per-userfeat: per-user email-based license keys with Gumroad webhook (v0.2.2)shipped102026-03-132026-03-13commit:6d056958
posttoolusefeat: PostToolUse observability + comprehensive test coverage (v0.2.1)shipped102026-03-122026-03-12commit:6e33b7e4
multi-toolfeat: multi-tool hook dispatch, subagent propagation & Read/Grep filters (v0.2.0)shipped102026-03-122026-03-12commit:1bf5a108
skillfeat: skill advisor, sharing credits, telemetry & Rust actionbook (v0.1.9)shipped102026-03-122026-03-12commit:d41d310e
firefeat: fire anonymous update-check ping on precc update (opt-out via PRECC_NO_TELEMETRY=1)shipped102026-03-102026-03-10commit:7acce69d
enforcefeat: enforce license tier gates (Free/Pro) on ingest, mined skills, gif, mail, savingsshipped102026-03-102026-03-10commit:a7bd23e3
translatefeat: translate git commands to jj (Jujutsu) in colocated reposshipped102026-03-092026-03-09commit:d8a29e48
rtkfeat(rtk): sync rewrite rules with upstream RTK v0.27.2shipped102026-03-092026-03-09commit:ad7dca0e
applyfeat: apply skill portfolio per command for maximum token savingsshipped102026-03-092026-03-09commit:b2490073
pitchfeat(pitch): add bilingual EN/ZH PowerPoint pitch deckshipped202026-02-272026-02-28commit:8876c4b7
hookperf(hook): skip heuristics.db open via plain-text prefix cacheshipped102026-02-272026-02-27commit:89537483
initfeat(init): embed builtin skills in binary via include_str!shipped102026-02-262026-02-26commit:3a837b13
clifeat(cli): add precc skills export commandshipped202026-02-262026-02-26commit:59beea8d
gdbfeat(gdb): re-enable Pillar 2 GDB hook suggestionshipped102026-02-262026-02-26commit:a8428025
skillsfeat(skills): add git wrong-dir skill and context mappingstabilizing202026-02-252026-02-25commit:352474e1
metricsfeat(metrics): record hook latency, rtk_rewrite, cd_prepend via append-logshipped102026-02-252026-02-25commit:9bf31d12
demofeat(demo): add investor demo suiteshipped102026-02-252026-02-25commit:c818a0ac
securityfeat(security): SQLCipher encryption, binary hardening, multi-platform CIshipped102026-02-252026-02-25commit:efd3dfc8
ingestfeat(ingest): add –force flag to re-mine already-recorded sessionsshipped102026-02-222026-02-22commit:85cc8f6f

Dependencies (precc-core modules)

  • advisordb, promote, skills
  • dietlean_ctx
  • metricsdb
  • miningskills
  • mode_selectordb, mode
  • multi_probediet, lean_ctx, mode, nushell, post_observe, rtk
  • nushelllean_ctx, mining, rtk
  • promotedb, skills
  • rtklean_ctx
  • sharingdb, license, skills
  • skill_advisormining, nushell
  • skillsdb
  • telemetrydb, license, mining

Plans & Tasks

Plans (prompts requesting design/architecture)

  • [proposed] indeed the measurement needs to be based on precc-cc’s established KPI’s. If the two ideas are so close, perhaps you can draft a plan to integrate them (algorithmatically) step-by-step, then start to use Rust (consistent with Precc) to impl… — session:905ff169 (2026-04-18)
  • [proposed] 西班牙语网站上有人评价:中文翻譯(繁體): — session:781fe484 (2026-04-16)
  • [proposed] That’s a really solid framing — using pre-tool-call hooks as quality gates instead of just optimization is a big shift in mindset. You’re essentially moving from “make the model cheaper” to “make the system more correct,” whic… — session:ebd81938 (2026-04-05)
  • [proposed] Plan the integration of both tools, make sure we don’t take their credit and maintain a clear interface so that once it evolves, we can get smaller changes to integrate with their future changes — session:43541885 (2026-03-31)
  • [proposed] for the benchmark, we need to prepare a table to record the comparison for existing historical scenarios, as a “what-if” analysis because there is no way to measure the results for future usages. For this requirement, plan out a step-by-ste… — session:5761d7ca (2026-03-27)
  • [proposed] while bash could be improved using RTK, would its replacement with nushell a better choice for Claude Code? If so, plan an option for replacing bash with nushell to gain better accuracy and hence potentially more token savings by some small… — session:5761d7ca (2026-03-27)

Tasks (TaskCreate / TodoWrite entries)

  • completed: 89
  • in_progress: 3
  • deleted: 2

Most recent 30 tasks:

  • [completed] Re-ingest and review residual pending — Run precc mindmap build after the fix, then classify the actually-pending tasks (done-but-unclosed vs genuinely-unfinished). — session:0925455d (2026-04-19)
  • [completed] Fold TaskCreate/TaskUpdate + dedupe TodoWrite — Replay TaskCreate/TaskUpdate events per (session_id, taskId) to derive final status. For TodoWrite, keep only the last call per session. — session:0925455d (2026-04-19)
  • [completed] Run ingest and produce MINDMAP.md — Execute ingest on local sessions + git, then render output to docs/MINDMAP.md. — session:0925455d (2026-04-19)
  • [completed] Wire precc mindmap CLI subcommand — Add ingest/render subcommands to precc-cli. — session:0925455d (2026-04-19)
  • [completed] Write mindmap render module — Query DB and render nested markdown mindmap with KPIs, features, plans, blockers. — session:0925455d (2026-04-19)
  • [completed] Write mindmap ingest module — Parse JSONL sessions + git log, extract messages/tokens/commands/decisions into SQLite. — session:0925455d (2026-04-19)
  • [completed] Design SQLite mindmap schema — Tables: sessions, messages, commands, features, plans, tasks, kpis, decisions, dependencies. Every row traces to source (session_id+uuid or commit sha). — session:0925455d (2026-04-19)
  • [in_progress] Step 4: HeaderSlicePass + kernel corpus — Shallow-clone Linux kernel, adapt filter for kernel conventions (Fixes: tag, selftests/ and kunit test-surface detection, .c/.h classification). Measure how many recent fix commits ship with a test an… — session:905ff169 (2026-04-19)
  • [completed] Step 6: concurrency extraction — Add Pipeline::run_parallel_applies that parallelizes applies() via std::thread::scope when pass count ≥ threshold. Falls back to serial below threshold (thread-spawn overhead > savings). Benchmark s… — session:905ff169 (2026-04-19)
  • [completed] [parallel] AST-aware #[test] extractor — Use syn (Rust) or tree-sitter-rust (Python) to detect added #[test] fns in a commit diff and emit a test-only patch. Gates fail→pass verification on this repo. Not blocking; parallel work for the Ru… — session:905ff169 (2026-04-19)
  • [completed] Step 7: precc skvm report tooling — Wire had_solid_hit into metrics log. Add precc skvm report that surfaces pass activation counts, cache hit rate, hook-latency percentiles. Read from metrics.db + skvm_solid_cache. Closes the observa… — session:905ff169 (2026-04-19)
  • [completed] Wire SolidificationPass into live hook — Add stage_solidification_lookup (front, short-circuits on hit) and stage_solidification_record (end) to Pipeline. Gate behind PRECC_SOLIDIFY. Add had_solid_hit flag. Open cache via db::open_metrics fo… — session:905ff169 (2026-04-19)
  • [completed] Step 3: solidification cache — skvm::solid module: Cache (SQLite-backed) with lookup/record, Key with normalization, SolidificationPass at pipeline front. Gated by PRECC_SOLIDIFY=1. Tests with in-memory DB. No wiring into live hook… — session:905ff169 (2026-04-19)
  • [completed] Wire CdPrependPass into hook’s stage_context — Replace the direct context::resolve/apply calls in precc-hook::Pipeline::stage_context with CdPrependPass via HookIR. Verify no hook tests regress; full cargo test green. — session:905ff169 (2026-04-19)
  • [completed] Step 2: migrate cd_prepend through Pass trait — Re-express the existing cd-prepend stage as a Pass impl that reuses the current context resolution. Diff-test: on a fixture corpus, the new pass must produce byte-identical output to the legacy path. … — session:905ff169 (2026-04-19)
  • [completed] Step 5 preview: CrateSlicePass sketch — Implement CrateSlicePass in precc-core::skvm::passes::crate_slice. Detects cargo &lt;build\|test\|check\|clippy&gt; without -p, reads cached cargo metadata, narrows to -p when unambiguous. Wire a minimal K… — session:905ff169 (2026-04-19)
  • [completed] Step 1: Pass trait + HookIR — precc-core::skvm::{pass, ir}. Pass trait with name/capability/applies/run. HookIR holds command, cwd, and mutable output. Capability enum: Detect|Rewrite|Slice|Verify. No behavior change; no passes re… — session:905ff169 (2026-04-19)
  • [completed] Step 0: baseline harness — Add precc-core::skvm::baseline module + precc report --skvm-baseline subcommand. Snapshots K1 (hook latency p50/p99), K3 (token savings total), activation counts from metrics.db into a named baselin… — session:905ff169 (2026-04-19)
  • [completed] Build K3-only replay corpus — For each of the 82 fix-surface commits, derive ground-truth set of changed crates and emit realistic cargo commands. CrateSlicePass evaluation will read this corpus and measure narrowing precision/rec… — session:905ff169 (2026-04-18)
  • [deleted] Run verifier over 33 candidates — Execute verifier, collect verdicts. Apply size gate to verified set. Emit precc_self_corpus.jsonl. — session:905ff169 (2026-04-18)
  • [deleted] Write fail-at-parent verifier — Per candidate: git worktree at parent, apply only test-file diff, cargo test (expect added tests FAIL), reset + apply full commit, cargo test (expect PASS). Per-worktree CARGO_TARGET_DIR to avoid tras… — session:905ff169 (2026-04-18)
  • [completed] Classify test surface of 33 candidates — Split candidates into pure_test_path (tests/ only) vs mixed_file_test (production + #[test] in same file). Reports count by class. Cheap, no cargo. — session:905ff169 (2026-04-18)
  • [completed] Run first Terminal-bench batch (5 tasks) — Execute scripts/benchmark.sh –tasks 5 using OAuth token from subscription as ANTHROPIC_API_KEY. Verify arm A (vanilla) works, then arm B (PRECC), then compare.json. — session:781fe484 (2026-04-17)
  • [completed] Add precc explain and precc undo — explain –since 1h: lists recent rewrites with diff + skill + confidence (reads stash + rewrite_log). undo <id>: re-disables the skill that produced rewrite id. — session:781fe484 (2026-04-16)
  • [completed] Confidence decay on retry-after-rewrite — post_observe: if same command class is retried within 60s after a PRECC rewrite, decrement skill confidence by 0.05 (or count as false-correction event). Below SUGGEST_THRESHOLD (0.3) skill auto-disab… — session:781fe484 (2026-04-16)
  • [completed] Add precc skills disable/enable per-project — CLI commands to disable a skill in the current project (writes to .precc/disabled-skills file at project root). Hook reads this list and skips matching skills. — session:781fe484 (2026-04-16)
  • [completed] Make every rewrite visible via additionalContext — In precc-hook, whenever the pipeline produces a non-trivial rewrite (cd-prepend, skill, RTK, lean-ctx, nushell, diet), append a one-line summary “PRECC rewrote: <orig> -> <new> [reason]” to additional… — session:781fe484 (2026-04-16)
  • [completed] Soften overstated claims in intro — Replace “Claude never sees the error. No tokens wasted.” with measured language matching README. Update strings_intro.sql and re-translate the new key for all 28 langs. — session:781fe484 (2026-04-16)
  • [completed] Fix per-language html lang and dir — build-book.sh must rewrite book.toml language= and text-direction= per language so generated pages have correct lang/dir attributes. RTL for ar, fa. — session:781fe484 (2026-04-16)
  • [completed] Rebuild book and verify — Run scripts/build-book.sh to regenerate introduction.md per language, verify first lines now show translations — session:781fe484 (2026-04-16)

Blockers (user-reported failure/stuck signals)

  • look at all the historical session logs and executed commands to summarize a mark down document like Mindmap showing (1) the features, status, decisions, dependencies, and effort (tokens releated to its development); (2) the plans, tasks, s… — session:0925455d (2026-04-19)
  • check if it is working? why precc savings –all doesn’t work? — session:ebd81938 (2026-04-13)
  • i tried that url it doesn’t work? — session:ebd81938 (2026-04-08)
  • why I can’t see the “last: “ messages? — session:ebd81938 (2026-04-08)
  • not yet. I would wait to get more data from telemetry to update the website. But now you need to investigate on those “unmeasured” cases, why we cannot measure them? — session:ebd81938 (2026-04-07)
  • regarding the live usage statistics https://precc.cc/en/#live-usage-statistics, we need to report the percentages based on the duration of releases, i.e., how much saving was made by which release (otherwise it is easy to mislead readers to… — session:ebd81938 (2026-04-06)
  • https://precc.cc cannot find the server — session:ebd81938 (2026-04-05)
  • can see key_id mk_1TDiUmFxhHEidPnDw5esdOMa, but cannot reveal or see the sk_live_… — session:d65ad15f (2026-04-01)
  • PS C:\Users\y00577373> iwr -useb https://raw.githubusercontent.com/peria-ai/precc-cc/main/scripts/install.ps1 | iex — session:10175339 (2026-03-30)
  • why can’t you create peria-ai or peri-a-i organizations — session:10175339 (2026-03-28)
  • the hello_world_do example has the following errors: NPU run failed. — session:3b5e2947 (2026-03-22)

Decisions & Rationale

  • feat(bench): clean-subset metrics (exclude timeouts & infra failures) — When one arm times out or the agent fails to install, the resulting tokens/pass numbers aren’t measuring PRECC — they’re measuring tb’s source: commit:5bdd027d (commit 2026-04-17)
  • fix(bench): drop –include-hook-events (causes 401 Invalid API key) — Adding --include-hook-events to the tb agent command caused Claude Code to return api_error_status=401 on first turn, even though the source: commit:025995d9 (commit 2026-04-17)
  • feat: PRECC_MODE=benchmark toggle + pairwise benchmark harness — Problem (from reviewer): the “trivial vs semantic” error-shaping claim is rhetoric without a measurable boundary. A rewriter that saves tokens source: commit:50c5a30f (commit 2026-04-17)
  • docs: update savings.md.tpl + README to match new statusline labels — - Σ → meas: throughout - New ‘bash X% of total’ segment row in segment table source: commit:2d366031 (commit 2026-04-08)
  • feat: clearer statusline labels — meas:, drop confusing %, add bash share — Three statusline UX changes from user feedback: 1. Lifetime segment renamed from ‘Σ 8.9K (22% over 217)’ to source: commit:4cd837b7 (commit 2026-04-08)
  • docs: explain statusline cost vs token semantics in book + README — Adds a ‘Status Bar’ section to docs/book/templates/savings.md.tpl and README.md explaining: source: commit:6028b64c (commit 2026-04-08)
  • feat: v0.3.3 — companion tools default-on, install-script clarity — The single biggest change: install.sh now installs companion tools (lean-ctx, RTK, nushell, cocoindex-code) BY DEFAULT instead of source: commit:48fca046 (commit 2026-04-07)
  • feat: quote-aware chain split + sysadmin tool whitelist (54.2% → 55.5%) — Three improvements that increase measurable Bash invocation coverage: 1. Quote-aware top-level chain split source: commit:f6580598 (commit 2026-04-07)
  • fix: command_class env stripping, skill validation, ssh/journalctl/kubectl diet rules — 1. command_class strips env prefixes and noise: - RUST_BACKTRACE=1 cargo test → “cargo test” source: commit:f4220343 (commit 2026-04-07)
  • feat: multi-mode adaptive compression with failure learning — New modules: - mode.rs: CompressionMode enum (basic/diet/nushell/lean-ctx/rtk/adaptive-expand) source: commit:81475afc (commit 2026-04-07)
  • test: comprehensive tests for ccc and compress modules (319 → 386 tests) — ccc.rs: +20 tests covering edge cases for is_eligible (flags, whitespace, empty input), extract_pattern (no path, multiple flags, boundary length), source: commit:448430e2 (commit 2026-03-20)
  • feat(gdb): re-enable Pillar 2 GDB hook suggestion — - Add open_history_readonly() to db.rs (same pattern as heuristics) - Add count_recent_failures() to gdb.rs: queries failure_fix_pairs for source: commit:a8428025 (commit 2026-02-26)
  • fix(mining): correct summary counters and orphaned events on –force re-mine — Three bugs fixed: 1. mine_session returned Skipped for sessions with no Bash events even source: commit:3ef089d8 (commit 2026-02-22)
  • 1. Compiled Rust Binary vs Shell ScriptDecision: Replace the rtk-rewrite.sh shell script hook with a compiled Rust binary (precc-hook). Alternatives considered: source: doc:ALTERNATIVES.md
  • 2. SQLite vs Key-Value StoreDecision: Use SQLite for both history.db and heuristics.db. Alternatives considered: source: doc:ALTERNATIVES.md
  • 3. Workspace of 4 Crates vs MonolithDecision: Structure the project as a Cargo workspace with 4 crates: precc-core, precc-hook, precc-cli, precc-learner. Alternatives considered: source: doc:ALTERNATIVES.md
  • 4. GDB Hook Integration vs Standalone CLIDecision: Implement GDB debugging as a CLI command (precc debug) rather than as an automatic hook rewrite. Alternatives considered: source: doc:ALTERNATIVES.md
  • 5. Background Daemon vs On-Demand MiningDecision: Support both modes — precc-learner daemon for continuous mining, precc ingest for on-demand. Alternatives considered: source: doc:ALTERNATIVES.md
  • 6. Confidence ThresholdsDecision: Three-tier confidence system: auto-apply (≥ 0.7), suggest (0.3-0.7), hidden (< 0.3). Alternatives considered: source: doc:ALTERNATIVES.md
  • 7. RTK Subsumption StrategyDecision: Port RTK’s rewriting logic into precc-core as the final pipeline stage, rather than running both hooks in sequence. Alternatives considered: source: doc:ALTERNATIVES.md
  • 8. Skill Storage FormatDecision: TOML files for built-in skills, SQLite rows for mined/user skills. Alternatives considered: source: doc:ALTERNATIVES.md
  • 9. Session Log FormatDecision: Read Claude Code’s native JSONL format directly rather than converting to a custom format. Rationale: Claude Code already writes detailed session logs in JSONL format at ~/.claude/projects/*/. Creating a custom format would mean: source: doc:ALTERNATIVES.md

KPIs over time

MetricUnitFirstLatestΔSamplesLast source
atx0.11.25+1.152commit:4f65556d
buildms3480+4772commit:f84bab49
hookms53-22commit:f81e4543
precctokens42387-3362commit:e3bc282e
savedms4.86.3+1.52commit:ec17f16c

Effort by session (top 10 by tokens)

SessionFirst → LastMsgsinputoutputCache writeCache read
ebd819382026-04-04 → 2026-04-1345174547686622246909501020430414
781fe4842026-04-16 → 2026-04-17143413416035963739362259708120
101753392026-03-28 → 2026-03-30131811761024692430047110606429
5761d7ca2026-03-26 → 2026-03-28118043631370562196522116605673
550c7bab2026-03-20 → 2026-03-2210641466104943205973292991217
905ff1692026-04-18 → 2026-04-196501698496929157266863432376
d65ad15f2026-03-31 → 2026-04-0475255878099184564558334554
3b5e29472026-03-22 → 2026-03-2311628961280681526203102403205
0925455d2026-04-19 → 2026-04-19440830262128122605432943523
435418852026-03-31 → 2026-03-31566735382683109632841667559

مرجع دستورات

مرجع کامل برای تمام دستورات PRECC.


precc init

مقداردهی اولیه PRECC و ثبت هوک با Claude Code.

precc init

Options:
  (none)

Effects:
  - Registers PreToolUse:Bash hook with Claude Code
  - Creates ~/.local/share/precc/ data directory
  - Initializes heuristics.db with built-in skills
  - Prompts for telemetry consent

precc ingest

استخراج الگوهای شکست-اصلاح از لاگ‌های جلسه.

precc ingest [FILE] [--all] [--force]

Arguments:
  FILE            Path to a session log file (.jsonl)

Options:
  --all           Ingest all session logs from ~/.claude/logs/
  --force         Re-process files that were already ingested

Examples:
  precc ingest session.jsonl
  precc ingest --all
  precc ingest --all --force

precc skills

مدیریت مهارت‌های خودکارسازی.

precc skills list

precc skills list

List all active skills (built-in and mined).

precc skills show

precc skills show NAME

Show detailed information about a specific skill.

Arguments:
  NAME            Skill name (e.g., cargo-wrong-dir)

precc skills export

precc skills export NAME

Export a skill definition as TOML.

Arguments:
  NAME            Skill name

precc skills edit

precc skills edit NAME

Open a skill definition in $EDITOR.

Arguments:
  NAME            Skill name

precc skills advise

precc skills advise

Analyze recent sessions and suggest new skills based on repeated patterns.

precc skills cluster

precc skills cluster

Group similar mined skills to identify redundant or overlapping patterns.

precc report

تولید گزارش تحلیلی.

precc report [--email]

Options:
  --email         Send the report via email (requires mail setup)

precc savings

نمایش صرفه‌جویی توکن.

precc savings [--all]

Options:
  --all           Show detailed per-command breakdown (Pro)

precc compress

فشرده‌سازی فایل‌های زمینه برای کاهش مصرف توکن.

precc compress [DIR] [--dry-run] [--revert]

Arguments:
  DIR             Directory or file to compress (default: current directory)

Options:
  --dry-run       Preview changes without modifying files
  --revert        Restore files from backup

precc license

مدیریت مجوز PRECC شما.

precc license activate

precc license activate KEY --email EMAIL

Arguments:
  KEY             License key (XXXX-XXXX-XXXX-XXXX)

Options:
  --email EMAIL   Email address associated with the license

precc license status

precc license status

Display current license status, plan, and expiration.

precc license deactivate

precc license deactivate

Deactivate the license on this machine.

precc license fingerprint

precc license fingerprint

Display the device fingerprint for this machine.

precc mail

عملکرد ایمیل.

precc mail setup

precc mail setup

Interactive SMTP configuration. Saves to ~/.config/precc/mail.toml.

precc mail report

precc mail report EMAIL

Send a PRECC analytics report to the specified email address.

Arguments:
  EMAIL           Recipient email address

precc mail send

precc mail send EMAIL FILE

Send a file as an email attachment.

Arguments:
  EMAIL           Recipient email address
  FILE            Path to the file to send

precc update

به‌روزرسانی PRECC به آخرین نسخه.

precc update [--force] [--version VERSION] [--auto]

Options:
  --force             Force update even if already on latest
  --version VERSION   Update to a specific version
  --auto              Enable automatic updates

precc telemetry

مدیریت تله‌متری ناشناس.

precc telemetry consent

Opt in to anonymous telemetry.

precc telemetry revoke

precc telemetry revoke

Opt out of telemetry. No further data will be sent.

precc telemetry status

precc telemetry status

Show current telemetry consent status.

precc telemetry preview

precc telemetry preview

Display the telemetry payload that would be sent (without sending it).

precc geofence

رعایت حصار جغرافیایی IP (Pro).

precc geofence check

precc geofence check

Check if the current machine is in an allowed region.

precc geofence refresh

precc geofence refresh

Refresh the IP geolocation cache.

precc geofence clear

precc geofence clear

Clear the geofence cache.

precc geofence info

precc geofence info

Display geofence configuration and current status.

precc gif

ضبط GIF متحرک از اسکریپت‌های bash (Pro).

precc gif SCRIPT LENGTH [INPUTS...]

Arguments:
  SCRIPT          Path to a bash script
  LENGTH          Maximum recording duration (e.g., 30s, 2m)
  INPUTS...       Optional input lines for interactive prompts

Examples:
  precc gif demo.sh 30s
  precc gif interactive.sh 60s "yes" "my-project"

precc gha

تحلیل اجراهای ناموفق GitHub Actions (Pro).

precc gha URL

Arguments:
  URL             GitHub Actions run URL

Example:
  precc gha https://github.com/org/repo/actions/runs/12345678

precc cache-hint

نمایش اطلاعات راهنمای حافظه پنهان برای پروژه فعلی.

precc cache-hint

precc trial

شروع آزمایشی Pro.

precc trial EMAIL

Arguments:
  EMAIL           Email address for the trial

precc nushell

راه‌اندازی یک جلسه Nushell با ادغام PRECC.

precc nushell

سوالات متداول

آیا PRECC برای استفاده امن است؟

بله. PRECC از مکانیزم رسمی hook PreToolUse کد Claude استفاده می‌کند – همان نقطه توسعه‌ای که Anthropic دقیقاً برای این منظور طراحی کرده است. هوک:

  • کاملاً آفلاین اجرا می‌شود (بدون فراخوانی شبکه در مسیر حساس)
  • در کمتر از ۵ میلی‌ثانیه تکمیل می‌شود
  • fail-open است: اگر مشکلی پیش بیاید، دستور اصلی بدون تغییر اجرا می‌شود
  • فقط دستورات را تغییر می‌دهد، هرگز خودش اجرا نمی‌کند
  • داده‌ها را به صورت محلی در پایگاه داده SQLite ذخیره می‌کند

آیا PRECC با سایر ابزارهای کدنویسی هوش مصنوعی کار می‌کند؟

PRECC به طور خاص برای Claude Code طراحی شده است. به پروتکل hook PreToolUse که Claude Code ارائه می‌دهد متکی است. با Cursor، Copilot، Windsurf یا سایر ابزارهای کدنویسی هوش مصنوعی کار نمی‌کند.

تله‌متری چه داده‌هایی ارسال می‌کند؟

تله‌متری فقط اختیاری است. وقتی فعال شود، ارسال می‌کند:

  • نسخه PRECC، سیستم‌عامل و معماری
  • شمارش‌های تجمیعی (دستورات رهگیری‌شده، مهارت‌های فعال‌شده)
  • میانگین تأخیر هوک

متن دستور، مسیر فایل، نام پروژه یا اطلاعات شناسایی شخصی ارسال نمی‌کند. قبل از فعال‌سازی می‌توانید بار دقیق را با precc telemetry preview مشاهده کنید. برای جزئیات تله‌متری را ببینید.

چگونه PRECC را حذف کنم؟

??faq_uninstall_a_intro??

  1. حذف ثبت هوک:

    # Delete the hook entry from Claude Code's settings
    # (precc init added it; removing it disables PRECC)
    
  2. حذف فایل باینری:

    rm ~/.local/bin/precc ~/.local/bin/precc-hook ~/.local/bin/precc-learner
    
  3. حذف داده‌ها (اختیاری):

    rm -rf ~/.local/share/precc/
    rm -rf ~/.config/precc/
    

مجوز من منقضی شده. چه اتفاقی می‌افتد؟

PRECC به سطح Community بازمی‌گردد. تمام عملکردهای اصلی همچنان کار می‌کنند:

  • مهارت‌های داخلی فعال می‌مانند
  • خط لوله hook به طور عادی اجرا می‌شود
  • precc savings نمای خلاصه را نشان می‌دهد
  • precc ingest و استخراج جلسات کار می‌کنند

ویژگی‌های Pro تا تمدید غیرفعال می‌شوند:

  • precc savings --all (جزئیات کامل)
  • precc compress
  • precc gif
  • precc gha
  • precc geofence
  • گزارش‌های ایمیلی

به نظر می‌رسد هوک اجرا نمی‌شود. چگونه اشکال‌زدایی کنم؟

??faq_debug_a_intro??

  1. بررسی کنید که هوک ثبت شده باشد:

    precc init
    
  2. هوک را به صورت دستی تست کنید:

    echo '{"tool_input":{"command":"cargo build"}}' | precc-hook
    
  3. بررسی کنید که فایل باینری در PATH شما باشد:

    which precc-hook
    
  4. پیکربندی hook در ~/.claude/settings.json را بررسی کنید.

آیا PRECC باعث کندی Claude Code می‌شود؟

خیر. هوک در کمتر از ۵ میلی‌ثانیه (p99) تکمیل می‌شود. این در مقایسه با زمانی که Claude صرف استدلال و تولید پاسخ می‌کند نامحسوس است.

آیا می‌توانم از PRECC در CI/CD استفاده کنم؟

PRECC برای جلسات تعاملی Claude Code طراحی شده است. در CI/CD، نسخه‌ای از Claude Code برای اتصال وجود ندارد. با این حال، precc gha می‌تواند اجراهای ناموفق GitHub Actions را از هر محیطی تحلیل کند.

مهارت‌های استخراج‌شده چه تفاوتی با مهارت‌های داخلی دارند؟

مهارت‌های داخلی با PRECC ارائه می‌شوند و الگوهای رایج پوشه اشتباه را پوشش می‌دهند. مهارت‌های استخراج‌شده از لاگ‌های جلسه خاص شما آموخته می‌شوند. هر دو در SQLite ذخیره و به طور یکسان توسط خط لوله hook ارزیابی می‌شوند.

آیا می‌توانم مهارت‌ها را با تیمم به اشتراک بگذارم؟

بله. هر مهارتی را با precc skills export NAME به TOML صادر کنید و فایل را به اشتراک بگذارید.

زبان‌های دیگر