مقدمة
ما هو 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، مما يسهل فحصها وتحريرها ومشاركتها.
كيف يعمل (نسخة الـ 30 ثانية)
- Claude Code على وشك تشغيل أمر bash.
- يرسل PreToolUse hook الأمر إلى
precc-hookبصيغة JSON عبر stdin. - يعالج
precc-hookالأمر عبر المسار (المهارات، تصحيح المجلد، الضغط) في أقل من 3 ميلي ثانية. - يعود الأمر المصحح بصيغة JSON عبر stdout.
- ينفذ Claude Code الأمر المصحح بدلاً من الأصلي.
تُختصر الأخطاء التافهة؛ ويُرفق سبب إعادة الكتابة في استجابة الـ hook، بحيث يمكن مراجعة كل تصحيح بدلاً من أن يكون صامتاً.
حدود الأمان
لا يعيد PRECC الكتابة إلا عندما يكون التكافؤ الدلالي محفوظاً بشكل قابل للإثبات أو قابلاً للتحقق من قبل المستخدم. الأوامر المدمرة (rm، git push --force، git reset --hard) لا يُعاد كتابتها أبداً حتى لو تطابقت مهارة. يجب أن تكون كل عملية تغيير محدودة — يجب أن يحتوي الأمر المعاد كتابته على الرموز الأساسية للأمر الأصلي. تُعاد العمليات غير المحدودة تلقائياً. كل عملية إعادة كتابة مُطبَّقة تُسجَّل وتُعرَض لتتمكن من مراجعتها أو تعطيلها أو التراجع عنها.
الضغط التكيفي
إذا فشل أمر بعد الضغط، يتخطى PRECC الضغط تلقائياً في المحاولة التالية حتى يحصل Claude على المخرجات الكاملة غير المضغوطة لتصحيح الأخطاء.
إحصاءات الاستخدام المباشرة
الإصدار الحالي –:
| المقياس | القيمة |
|---|---|
| الرموز الموفرة | – |
| نسبة التوفير | –% |
| زمن استجابة الـ hook | – ms (p50) |
| المستخدمون | – |
| crates.io downloads | – |
crates.io downloads count CI, docs.rs and mirror traffic — they are not a measure of unique users.
التوفير حسب الإصدار
تتحدث هذه الأرقام تلقائياً من بيانات القياس عن بُعد المجهولة الهوية.
روابط
- GitHub: https://github.com/peri-a-i/precc-cc
- الموقع: https://peria.ai
- التوثيق: https://precc.cc
التثبيت
التثبيت السريع (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
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 | صدفة منظمة لخطوط الأنابيب المتقدمة |
| 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 (المعرّف precc-token-saver). عند نشر إصدار عام، يقوم سير عمل GitHub Actions باسم clawhub-publish.yml بدفع حزمة المهارات إلى سجل ClawHub، بحيث يمكن للمستخدمين النهائيين تثبيت PRECC عبر واجهة سطر أوامر ClawHub بدلاً من مثبّت curl:
# 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
كل واجهة تقارير في PRECC تعمل تحت Claude Code تعمل أيضًا تحت 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 الخاص بك.
البدء السريع
شغّل PRECC في 5 دقائق.
الخطوة 1: التثبيت
curl -fsSL https://peria.ai/install.sh | bash
الخطوة 2: التهيئة
$ precc init
[precc] Hook registered with Claude Code
[precc] Created ~/.local/share/precc/
[precc] Initialized heuristics.db with 8 built-in skills
[precc] Ready.
الخطوة 3: تحقق من أن الخطاف نشط
$ 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
الخطوة 4: استخدم 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. التكلفة: ~2,000 رمز مهدر.
مع PRECC: يكتشف الخطاف Cargo.toml المفقود، يجده في myapp/، ويعيد كتابة الأمر إلى:
cd /home/user/projects/myapp && cargo build
لا يرى Claude أي خطأ أبداً. صفر رموز مهدرة.
الخطوة 5: تحقق من مدخراتك
بعد الجلسة، تحقق من عدد الرموز التي وفرها 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، إلخ)
- خط أنابيب الخطاف مع دعم كامل لـ Pillar 1 و Pillar 4
- ملخص أساسي لـ
precc savings - تنقيب الجلسات مع
precc ingest - استخدام محلي غير محدود
مستوى Pro
يفتح Pro ميزات إضافية:
- تفصيل مفصل للتوفير –
precc savings --allمع تحليل لكل أمر - تسجيل GIF –
precc gifلإنشاء صور GIF متحركة للطرفية - الامتثال للسياج الجغرافي IP – للبيئات المنظمة
- تقارير البريد الإلكتروني –
precc mail reportلإرسال التحليلات - تحليل GitHub Actions –
precc 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 في أقل من 5 ميلي ثانية.
كيف يستدعي 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 الأمر الأصلي.
تفاصيل المراحل
المرحلة 1: تحليل JSON
يقرأ كائن JSON الكامل من stdin. يستخرج tool_input.command. إذا فشل التحليل، يخرج الخطاف فورًا ويستخدم Claude Code الأمر الأصلي (تصميم fail-open).
المرحلة 2: مطابقة المهارات
يستعلم قاعدة بيانات SQLite الاستدلالية عن المهارات التي يتطابق نمط تشغيلها مع الأمر. يتم التحقق من المهارات بترتيب الأولوية. يتم تقييم مهارات TOML المدمجة والمهارات المستخرجة.
المرحلة 3: تصحيح الدليل
لأوامر البناء (cargo، go، make، npm، python، إلخ)، يتحقق مما إذا كان ملف المشروع المتوقع موجودًا في الدليل الحالي. إذا لم يكن كذلك، يفحص الدلائل القريبة للعثور على أقرب تطابق ويضيف cd <dir> && في البداية.
يستخدم مسح الدليل فهرس نظام ملفات مخزنًا مؤقتًا مع TTL مدته 5 ثوانٍ للحفاظ على السرعة.
المرحلة 4: فحص GDB
إذا كان من المحتمل أن ينتج الأمر عطلًا (مثل تشغيل ملف ثنائي للتصحيح)، يمكن لـ PRECC اقتراح أو حقن أغلفة GDB لالتقاط مخرجات تصحيح منظمة بدلاً من سجلات الأعطال الخام.
المرحلة 5: إعادة كتابة RTK
يطبق قواعد RTK (مجموعة أدوات إعادة الكتابة) التي تختصر الأوامر المطولة وتقمع المخرجات المزعجة أو تعيد هيكلة الأوامر لكفاءة الرموز.
المرحلة 6: إصدار JSON
يُسلسل الأمر المعدل مرة أخرى إلى JSON ويكتبه إلى stdout. إذا لم يتم إجراء تغييرات، تشير المخرجات إلى Claude Code لاستخدام الأمر الأصلي.
الأداء
يكتمل الأنبوب بأكمله في أقل من 5 ميلي ثانية (p99). التحسينات الرئيسية:
- SQLite في وضع WAL للقراءات المتزامنة بدون قفل
- أنماط regex مترجمة مسبقًا لمطابقة المهارات
- عمليات مسح نظام الملفات المخزنة مؤقتًا (TTL مدته 5 ثوانٍ)
- لا توجد مكالمات شبكة في المسار الساخن
- Fail-open: أي خطأ يعود إلى الأمر الأصلي
اختبار الخطاف يدويًا
يمكنك استدعاء الخطاف مباشرة:
$ echo '{"tool_input":{"command":"cargo build"}}' | precc-hook
{"hookSpecificOutput":{"updatedInput":{"command":"cd /home/user/myapp && cargo build"}}}
المهارات
المهارات هي قواعد مطابقة الأنماط التي يستخدمها PRECC لاكتشاف الأوامر وتصحيحها. يمكن أن تكون مدمجة (موزعة كملفات TOML) أو مستخرجة من سجلات الجلسات.
المهارات المدمجة
| المهارة | يُفعَّل عند | الإجراء |
|---|---|---|
cargo-wrong-dir | cargo build/test/clippy خارج مشروع Rust | إضافة cd إلى أقرب دليل Cargo.toml |
git-wrong-dir | git * خارج مستودع git | إضافة cd إلى أقرب دليل .git |
go-wrong-dir | go build/test خارج وحدة Go | إضافة cd إلى أقرب دليل go.mod |
make-wrong-dir | make بدون Makefile في الدليل الحالي | إضافة cd إلى أقرب دليل Makefile |
npm-wrong-dir | npm/npx/pnpm/yarn خارج مشروع Node | إضافة cd إلى أقرب دليل package.json |
python-wrong-dir | python/pytest/pip خارج مشروع Python | إضافة cd إلى أقرب مشروع Python |
jj-translate | git * في مستودع jj مشترك | إعادة الكتابة إلى أمر jj المكافئ |
asciinema-gif | asciinema 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.
ملخص سريع
$ 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
شريط الحالة
بعد التثبيت، يضيف PRECC إدخال statusLine إلى ~/.claude/settings.json بحيث يعرض شريط حالة Claude Code مقاييس الجلسة المباشرة:
$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)
اضبط PRECC_LANG لعرض التسميات بلغتك — راجع فصل التعريب.
كل مقطع:
| المقطع | المصدر | المعنى | هل يُعاد التعيين عند إعادة تشغيل الجلسة؟ |
|---|---|---|---|
$0.42 spent | cost.total_cost_usd | تكلفة الجلسة التراكمية المُبلَّغ عنها من قِبل Claude Code | نعم |
1.2M in/out | total_input_tokens + total_output_tokens | رموز الإدخال غير المخزنة مؤقتاً + الإخراج عبر الجلسة | نعم |
📊 last cmd: −1.2K | قياس PRECC لأحدث أمر Bash | التوفير الحقيقي المُقاس من إعادة تشغيل الأصلي | لا (يستمر عبر الجلسات) |
PRECC: 7 fixes | metrics.log | عدد التصحيحات في هذه الجلسة — العدد فقط، بدون تقدير زائف للرموز | نعم |
5.8ms avg | زمن استجابة PRECC hook p50 | الوقت الذي قضاه PRECC في معالجة كل استدعاء أداة | نعم |
bash 18% of total | post_observations.log | حصة رموز الجلسة الصادرة من إخراج Bash — توضح لماذا تكون توفيرات PRECC بطبيعتها جزءاً من التكلفة الإجمالية (يحسّن PRECC إخراج Bash فقط) | نعم |
this session: 320 saved over 7 cmds (~$0.05) | .lifetime_summary.json − baseline | الفرق الفعلي لكل جلسة. مخفي عندما يكون الفرق صفراً (بداية الجلسة) | نعم (يُعاد التقاط خط الأساس) |
lifetime: 8.9K saved over 217 cmds (~$2.85) | .lifetime_summary.json | الرموز المتراكمة الموفّرة والأوامر المعاد قياسها منذ أول تثبيت لـ PRECC، بالإضافة إلى قيمة تقديرية بالدولار الأمريكي بالسعر الحالي لكل رمز | لا |
يُوضع المقطع lifetime: في النهاية ليكون الأول الذي يُقتطع إذا قصّت واجهة Claude Code الشريط من الحافة اليمنى.
لماذا لا تنقسم التكلفة وعدد الرموز
إن 1.2M in/out المعروض ليس المقام الذي أنتج $0.42 spent. يُحسب cost.total_cost_usd الخاص بـ Claude Code من التفصيل الكامل لرموز API — الإدخال الأساسي والإخراج بالإضافة إلى قراءات الذاكرة المؤقتة وإنشاءات الذاكرة المؤقتة. لا تُكشف أعداد رموز الذاكرة المؤقتة التراكمية على مستوى الجلسة في مخطط statusline، لذا يمكن لـ PRECC إظهار الجزء المرئي فقط (غير المؤقت).
في الجلسات الطويلة التي تحتوي على إعادة قراءة كثيفة للملفات، قد تصل قراءات الذاكرة المؤقتة إلى 10 أضعاف عدد الرموز المرئية. لهذا السبب سيكون اقترانهما كنسبة مضللاً — يعرضهما PRECC كمقاطع مستقلة بدلاً من ذلك.
لماذا لا يحسب PRECC التكلفة
رقم التكلفة موثوق. يقرأ PRECC cost.total_cost_usd حرفياً من JSON الذي يضخّه Claude Code عبر stdin إلى أمر الحالة. وهو نفس الرقم الذي يخصمه Claude Code من اشتراكك/ميزانية استخدامك. يمكنك التحقق منه في أي وقت باستخدام الأمر المائل المدمج /cost — يجب أن يتطابقا.
ما الذي يقود التكلفة
بالنسبة لـ Claude Opus 4.6:
| Token type | Standard (≤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 |
أكبر العوامل في الجلسات الطويلة عادةً هي رموز الإخراج (النوع الأغلى لكل رمز، خصوصاً في مستوى السياق 1M)، وقراءات الذاكرة المؤقتة المتكررة (رخيصة بشكل فردي ولكنها تتراكم بسرعة عبر دورات كثيرة)، وإنشاءات الذاكرة المؤقتة (تُكتب مرة واحدة لكل قراءة ملف بمعدل ~1.25× من معدل الإدخال الأساسي). يقلّص PRECC تكلفة الرموز المرئية عبر ضغط إخراج Bash (يُظهر مقطع 📊 last cmd: التوفير لكل أمر)، لكنه لا يستطيع تقليل قراءات الذاكرة المؤقتة للملفات التي حمّلها Claude بالفعل.
عدّادات جلسة مستقرة
يحسب مقطع “PRECC: N fixes” الأحداث منذ بداية الجلسة المُحفوظة، التي تُكتب إلى ~/.local/share/precc/sessions/<session_id>.start عند أول تحديث للـ statusline في كل جلسة. هذا يجعل العدّ رتيباً — لا يمكن أن ينخفض في منتصف الجلسة حتى لو كان cost.total_duration_ms مفقوداً في تحديث معين.
لقطة العمر الكلي المحدّثة تلقائياً
يقرأ المقطع lifetime: من ~/.local/share/precc/.lifetime_summary.json، الذي يُعاد كتابته في كل قياس PostToolUse وفي كل استدعاء لـ precc savings. يقرأ المقطع this session: نفس ملف العمر لكنه يطرح خط أساس لكل جلسة محفوظ في أول تحديث لكل جلسة. لا حاجة للتحديث اليدوي — تتحدث الملفات تلقائياً.
إخفاء شريط الحالة
إذا كنت تفضل الاحتفاظ بشريط الحالة الحالي، فعيّن أمر statusLine الخاص بك في ~/.claude/settings.json. سيكتشف مثبّت PRECC القيمة المخصصة ويتركها كما هي في التحديثات اللاحقة.
لإخفاء سطر 📊 PRECC لكل تفاعل فقط (في additionalContext)، عيّن PRECC_QUIET=1 في بيئة الشِل لديك.
Related research
PRECC’s three savings mechanisms each have a counterpart in the recent literature. These are related work — the ideas PRECC’s design draws on. Their reported figures are their measurements, not PRECC’s: PRECC only ever quotes numbers measured on your own machine (see “measured, not estimated”, above).
- Output/trajectory trimming (PRECC’s
diet+ bash-output compression) — Reducing Cost of LLM Agents with Trajectory Reduction (AgentDiet), FSE 2026, arXiv:2509.23586. Removes redundant/expired trajectory content post-hoc; reports −39.9–59.7% input tokens. PRECC applies the same idea pre-execution and deterministically (no extra LLM call). - Skills as programs (PRECC’s mined + builtin rewrite skills) — Harnessing LLM Agents with Skill Programs, arXiv:2605.17734. Frames reusable agent skills as executable program functions — the same analogy behind PRECC’s command-rewrite skills (a pattern → a deterministic rewrite).
- Context compression (PRECC’s
compress+lean-ctxwrapping) — Compress the Context, Keep the Commitments: A Formal Framework for Verifiable LLM Context Compression, arXiv:2605.17304. Recent work on compressing context without losing required information — the property PRECC’s deterministic, cache-stable rewrites aim to preserve.
الضغط
يقوم 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...
كيف يعمل التنقيب
- يقرأ PRECC ملف سجل JSONL للجلسة.
- يحدد أزواج الأوامر حيث فشل الأمر الأول وكان الثاني إعادة محاولة مصححة.
- يستخرج النمط (ما الخطأ) والإصلاح (ما فعله Claude بشكل مختلف).
- تُخزن الأنماط في
~/.local/share/precc/history.db. - عندما يصل نمط إلى عتبة الثقة، يصبح مهارة مُستخرجة في
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 على Linux، 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
ماذا يفعل
- يحلل عنوان URL لتشغيل GitHub Actions لاستخراج المالك والمستودع ومعرف التشغيل.
- يجلب سجلات التشغيل عبر واجهة GitHub API (يستخدم
GITHUB_TOKENإذا تم تعيينه، وإلا الوصول العام). - يحدد الخطوة الفاشلة ويستخرج أسطر الخطأ ذات الصلة.
- يحلل الخطأ ويقترح إصلاحاً بناءً على أنماط فشل CI الشائعة.
أنماط الفشل المدعومة
- حاويات خدمة مفقودة (قواعد بيانات، Redis، إلخ.)
- نظام تشغيل أو بنية المشغل غير صحيحة
- متغيرات بيئة أو أسرار مفقودة
- فشل تثبيت التبعيات
- انتهاء مهلة الاختبارات
- أخطاء الأذونات
- إخفاقات التخزين المؤقت التي تسبب بناء بطيء
السياج الجغرافي
يتضمن 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://telemetry.peria.ai/v1/precc عبر HTTPS. تُستخدم البيانات فقط لفهم أنماط الاستخدام وتحديد أولويات التطوير.
التنبؤ بتكلفة الرموز
يوفّر PRECC أداة عرّافة للتنبؤ بتكلفة الرموز حتى يتسنى للخطط متعددة الخطوات أن تُحدَّد ميزانيتها بالرموز لا بالوقت الفعلي. سجّل تنبؤًا قبل كل خطوة، وقيّد القيمة الفعلية بعد إنجاز العمل، وستُدرّب مجموعة البيانات متنبئًا مدمجًا يتحسّن بمرور الوقت.
تسجيل تنبؤ
مرّر وصفًا من سطر واحد للخطوة المخطّطة. يصنّفها PRECC (feat / fix / test / refactor / measurement / doc / chore / unknown)، ويقدّر عدد الرموز، ويطبع معرّفًا (id) ستستخدمه لإغلاق الحلقة.
$ precc predict "Implement read-deltas with mtime check"
id=42 category=feat predicted=5680 tokens (confidence=0.50, model=trained-v1)
Record actual when done: precc predict --record 42 <actual_tokens>
تسجيل القيمة الفعلية
بعد اكتمال الخطوة، ابحث عن العدد الفعلي للرموز في تذييل الجلسة أو في القياس عن بُعد وأعده عبر المعرّف (id).
$ precc predict --record 42 6300
Recorded actual=6300 tokens for prediction id=42.
تدريب trained-v1
بمجرد أن يصبح لديك عشرة تنبؤات مغلقة على الأقل، طبّق انحدار ridge المسمى trained-v1 على log10(actual) مقابل log10(طول الوصف) مع متغير وهمي one-hot للفئة. التطابق مغلق الشكل (Cholesky على المعادلات الطبيعية مع ridge λ=1) ويعمل في أجزاء من الثانية.
$ precc predict --train
Trained trained-v1 on 22 closed predictions (λ=1).
Model file : ~/.local/share/precc/predict_model.json
Confidence : 0.50
Intercept : +1.0016
log_desc : +1.2339
Categories :
unknown +0.4811
doc +0.4474
measurement +0.3422
test +0.1071
refactor +0.0326
feat +0.0071
fix -0.1096
chore -0.3063
بعد التدريب، يستخدم كل استدعاء جديد precc predict نموذج trained-v1 تلقائيًا إلى أن تحذف ملف النموذج أو تستبدله. تحتفظ التنبؤات القديمة بقيمة model_version الأصلية، حتى تتمكن من مقارنة المتنبئين عبر الزمن.
فحص دقة المتنبئ
يُبلغ precc predict --eval عن متوسط الخطأ النسبي المطلق (MAPE) إجمالًا ولكل فئة، محسوبًا فقط على التنبؤات المغلقة (الصفوف التي تحتوي على القيمتين المتوقعة والفعلية).
$ precc predict --eval
Predictions logged : 30
With actuals (closed): 22
Mean predicted : 1483 tokens
Mean actual : 47238 tokens
MAPE (statistical) : 76.4%
By category:
category n predicted actual MAPE
feat 6 4605 5250 26.2%
unknown 4 1597 30526 52.6%
test 4 924 38900 56.4%
...
سرد التنبؤات الأخيرة
يعرض precc predict --list الصفوف الأخيرة بترتيب زمني عكسي. الصفوف المفتوحة (بدون قيمة فعلية) جاهزة للإغلاق.
$ precc predict --list --limit 5
id ts category predicted actual conf description
30 2026-05-09 09:40:51 feat 5348 - 0.50 Run the synthetic-fleet pilot...
29 2026-05-09 08:56:48 test 1050 - 0.60 Train predictor: trained-v1...
28 2026-05-09 07:44:18 test 915 150000 0.60 Implement minimal task-12...
لماذا الرموز وليس الوقت الفعلي
تقديرات الوقت غير قابلة للقياس بأثر رجعي ولا تتراكم عبر الأجهزة أو الجلسات. أعداد الرموز حتمية وقابلة للمقارنة وتُنمّي مجموعة بيانات موسومة تُحسّن المتنبئ مع كل حلقة مغلقة. الهدف من العرّافة هو تحويل التقدير من لعبة تخمين إلى قياس.
مكان تخزين البيانات
تُخزَّن جميع بيانات التنبؤ محليًا على جهازك. لا يُرفع أي شيء.
~/.local/share/precc/
├── metrics.db — predictions table (oracle DB)
└── predict_model.json — trained-v1 coefficients (after `--train`)
التوطين
يعرض PRECC سطر الحالة والرسائل القصيرة بـ 28 لغة. الترجمات مُجمَّعة داخل الملف التنفيذي، لذا لا يكلف اختيار اللغة أي إدخال/إخراج إضافي أثناء الخطّاف.
تعيين اللغة
اضبط متغير البيئة PRECC_LANG على رمز لغة مدعوم. تتقدم هذه القيمة على أي مصدر آخر.
$ PRECC_LANG=zh precc savings
$ export PRECC_LANG=ja
الحفظ الدائم عبر consent.toml
أضف [ui] preferred_language = "ja" (أو أي رمز مدعوم) إلى ~/.config/precc/consent.toml للاحتفاظ بالخيار عبر الأصداف دون تصدير متغير بيئة.
# ~/.config/precc/consent.toml
[ui]
preferred_language = "ja"
ترتيب الحل
يفحص PRECC أولاً PRECC_LANG، ثم [ui] preferred_language في consent.toml، ثم يلجأ إلى الإنجليزية. تفوز أول إشارة غير فارغة وتُخزَّن مؤقتاً طوال دورة حياة العملية.
1. PRECC_LANG (environment variable)
2. consent.toml ([ui] preferred_language)
3. "en" (default)
التغطية
يشمل جدول الترجمة 28 عمود لغة. الخلايا التي لا يمكننا التحقق منها يدوياً تُترك فارغة وتعود إلى الإنجليزية عند البحث، بدلاً من عرض نص مُختلَق. إذا كان بإمكانك تحسين ترجمة فأرسلها إلى المنبع.
en es de zh fr pt ja vi nl hu ar fa tr ko
th my mn bo pl ru zt da sv fi it is2 ro cs
لماذا يبقى سريعاً
تُخزَّن الترجمات بوصفها مصفوفات const تُنشَأ زمن التجميع داخل الملف التنفيذي precc-core، وليس في SQLite. يجري الخطّاف بحثاً واحداً في الذاكرة، لذا فإن تكلفة الترجمة غير ملحوظة بالنسبة لميزانية الخطّاف < 5 مللي ثانية بالنسبة المئوية الـ 99.
خريطة ذهنية
يتم إنشاء هذه الصفحة تلقائيًا من mindmap.db — لقطة SQLite لجميع جلسات تطوير PRECC المسجلة وتكويدات git. يمكن تتبع كل صف إلى مصدره (commit:<sha> أو session:<id> أو doc:<path>).
نظرة عامة
- الجلسات التي تم تحليلها: 22
- الرسائل: 14023
- استدعاءات الأدوات: 5072
- الإيداعات: 205
- النطاق الزمني: 2026-03-20T07:04:14.787Z → 2026-04-19T11:50:10.153Z
- الجهد (الرموز):
- الإدخال: 27928
- الإخراج: 2750669
- عمليات كتابة ذاكرة التخزين المؤقت: 43349705
- عمليات قراءة ذاكرة التخزين المؤقت: 1936351239
الميزات
| النطاق | العنوان | الحالة | الإيداعات | الرموز | الأول | الأخير | المصدر |
|---|---|---|---|---|---|---|---|
bench | feat(bench): SWE-bench Verified/Lite driver scaffolding | stabilizing | 4 | 4344299 | 2026-04-17 | 2026-04-17 | commit:5bdd027d |
benchmark_gate.sh | feat: benchmark_gate.sh + pin tb dataset to 0.1.1 | shipped | 1 | 4344299 | 2026-04-17 | 2026-04-17 | commit:99fa9a74 |
real | feat: real lean-ctx (not stub), wider campaign, doc updates | shipped | 2 | 29821152 | 2026-04-07 | 2026-04-17 | commit:6095720a |
precc_mode=benchmark | feat: PRECC_MODE=benchmark toggle + pairwise benchmark harness | shipped | 1 | 4344299 | 2026-04-17 | 2026-04-17 | commit:50c5a30f |
add | feat: add precc update self-update command | shipped | 14 | 42557107 | 2026-03-09 | 2026-04-17 | commit:e5542fba |
negotiable | feat: negotiable rewrites, skill decay, explain/undo — response to critic | shipped | 1 | 4344299 | 2026-04-17 | 2026-04-17 | commit:6fda67e4 |
statusline | feat: statusline shows actual session token consumption + cost | stabilizing | 3 | 25424915 | 2026-04-08 | 2026-04-13 | commit:4f65556d |
public | feat: public repo commits attributed to Ce-cyber-art | shipped | 1 | 25382119 | 2026-04-10 | 2026-04-10 | commit:0e4840e4 |
short | feat: short install URL https://peria.ai/install.sh | shipped | 1 | 25382119 | 2026-04-09 | 2026-04-09 | commit:615d3d06 |
rewrite | feat: rewrite Pillar 2b (ccc) and Pillar 3 (compress) in Rust for single-binary deployment | shipped | 2 | 38118074 | 2026-03-20 | 2026-04-08 | commit:78621579 |
shorten | feat: shorten statusline segments to fit narrower terminals | shipped | 1 | 25382119 | 2026-04-08 | 2026-04-08 | commit:ef2c88b4 |
drop | feat: drop fake token estimate, append cost estimate to lifetime segment | stabilizing | 2 | 25382119 | 2026-04-08 | 2026-04-08 | commit:2702f3f9 |
update | feat: update pricing to $5/6mo + $10/yr, add webhook server | stabilizing | 9 | 38118074 | 2026-02-25 | 2026-04-08 | commit:2d366031 |
clearer | feat: clearer statusline labels — meas:, drop confusing %, add bash share | shipped | 1 | 25382119 | 2026-04-08 | 2026-04-08 | commit:4cd837b7 |
stable | feat: stable machine_hash for telemetry dedup | stabilizing | 2 | 25382119 | 2026-04-08 | 2026-04-08 | commit:3073f428 |
lifetime | feat: lifetime savings segment in statusline | shipped | 1 | 25382119 | 2026-04-08 | 2026-04-08 | commit:9af422e8 |
precc | feat: precc analyze frequencies — data-driven rule gap discovery | shipped | 3 | 25382119 | 2026-04-07 | 2026-04-08 | commit:d6f24c50 |
per-interaction | feat: per-interaction PRECC savings line in PostToolUse | shipped | 1 | 25382119 | 2026-04-08 | 2026-04-08 | commit:e3bc282e |
webhook | feat: webhook auto-regenerates stats.json on telemetry POST | stabilizing | 2 | 29134186 | 2026-03-31 | 2026-04-08 | commit:912b75f3 |
per-email | feat: per-email aggregation for telemetry | shipped | 1 | 25382119 | 2026-04-08 | 2026-04-08 | commit:14c95e7d |
v0.3.3 | feat: v0.3.3 — companion tools default-on, install-script clarity | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:48fca046 |
measurement | feat: measurement campaign script — real per-mode measurements | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:36760587 |
quote-aware | feat: quote-aware chain split + sysadmin tool whitelist (54.2% → 55.5%) | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:f6580598 |
; | feat: ; chain support + ssh inner-command parsing for measurement | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:10093218 |
expand | feat: expand is_safe_to_rerun coverage + measurement timeout/cache | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:c5a7ea79 |
multi-mode | feat: multi-mode adaptive compression with failure learning | shipped | 1 | 25382119 | 2026-04-07 | 2026-04-07 | commit:81475afc |
measured | feat: measured savings in telemetry, detailed live stats, update nudge | shipped | 1 | 25382119 | 2026-04-06 | 2026-04-06 | commit:06907091 |
scientific | feat: scientific token savings measurement, telemetry dedup, 28-language docs | shipped | 1 | 25382119 | 2026-04-06 | 2026-04-06 | commit:78a20ef2 |
v0.3.2 | feat: v0.3.2 — hook safety, adaptive compression, on-demand metrics import | shipped | 1 | 25382119 | 2026-04-05 | 2026-04-05 | commit:a0c0c882 |
self-hosted | feat: self-hosted telemetry endpoint at peria.ai, install UX improvements | shipped | 1 | 2565703 | 2026-04-04 | 2026-04-04 | commit:8212a18e |
auto-update | feat: auto-update consent prompt on init and manual update | shipped | 1 | 1924302 | 2026-04-02 | 2026-04-02 | commit:818be6dd |
use | perf: use pre-built binaries for lean-ctx and nushell installation | stabilizing | 4 | 10170252 | 2026-03-09 | 2026-03-31 | commit:8c612e55 |
authorize | feat: authorize peria.ai server for license key generation | shipped | 2 | 1186364 | 2026-03-31 | 2026-03-31 | commit:53dfe832 |
license | feat: license keys, SMTP mail-agent, updated business plan and demos | stabilizing | 2 | 10170252 | 2026-03-09 | 2026-03-31 | commit:b07c9dfb |
lean-ctx | feat: lean-ctx integration for deep output compression | shipped | 1 | 1186364 | 2026-03-31 | 2026-03-31 | commit:07361e62 |
integrate | feat: integrate three-pillar savings from precc-cc (cocoindex-code, token-saver, ClawHub) | shipped | 2 | 10170252 | 2026-03-20 | 2026-03-31 | commit:af4205f1 |
windows | feat: Windows build via CI, deploy triggers workflow | stabilizing | 2 | 2533692 | 2026-03-29 | 2026-03-29 | commit:7404761b |
monthly | feat: monthly usage report via email for Pro users | shipped | 1 | 2533692 | 2026-03-28 | 2026-03-28 | commit:77ad78bc |
nushell | feat: nushell what-if analysis, skill clustering, comment blocker, bash unwrap (v0.2.6) | shipped | 1 | 2337941 | 2026-03-27 | 2026-03-27 | commit:803df684 |
geofence | feat: geofence compliance guard, 3rd-party skill Claude interaction tracking (v0.2.5) | shipped | 1 | 2337941 | 2026-03-26 | 2026-03-26 | commit:0c9fc765 |
stripe | feat: Stripe payment integration, context pressure, GHA analysis | shipped | 2 | 2457088 | 2026-03-21 | 2026-03-22 | commit:8eb16f78 |
context | feat: context pressure warning, GHA analysis, statusline context % | shipped | 1 | 2166141 | 2026-03-20 | 2026-03-20 | commit:894621ba |
statusline, | feat: statusline, squash deploy, ClaWHub metadata, SHA256 checksums | shipped | 1 | 2166141 | 2026-03-20 | 2026-03-20 | commit:7ab15883 |
gumroad | feat: Gumroad license verification via API (v0.2.2) | shipped | 1 | 0 | 2026-03-13 | 2026-03-13 | commit:75c5e480 |
per-user | feat: per-user email-based license keys with Gumroad webhook (v0.2.2) | shipped | 1 | 0 | 2026-03-13 | 2026-03-13 | commit:6d056958 |
posttooluse | feat: PostToolUse observability + comprehensive test coverage (v0.2.1) | shipped | 1 | 0 | 2026-03-12 | 2026-03-12 | commit:6e33b7e4 |
multi-tool | feat: multi-tool hook dispatch, subagent propagation & Read/Grep filters (v0.2.0) | shipped | 1 | 0 | 2026-03-12 | 2026-03-12 | commit:1bf5a108 |
skill | feat: skill advisor, sharing credits, telemetry & Rust actionbook (v0.1.9) | shipped | 1 | 0 | 2026-03-12 | 2026-03-12 | commit:d41d310e |
fire | feat: fire anonymous update-check ping on precc update (opt-out via PRECC_NO_TELEMETRY=1) | shipped | 1 | 0 | 2026-03-10 | 2026-03-10 | commit:7acce69d |
enforce | feat: enforce license tier gates (Free/Pro) on ingest, mined skills, gif, mail, savings | shipped | 1 | 0 | 2026-03-10 | 2026-03-10 | commit:a7bd23e3 |
translate | feat: translate git commands to jj (Jujutsu) in colocated repos | shipped | 1 | 0 | 2026-03-09 | 2026-03-09 | commit:d8a29e48 |
rtk | feat(rtk): sync rewrite rules with upstream RTK v0.27.2 | shipped | 1 | 0 | 2026-03-09 | 2026-03-09 | commit:ad7dca0e |
apply | feat: apply skill portfolio per command for maximum token savings | shipped | 1 | 0 | 2026-03-09 | 2026-03-09 | commit:b2490073 |
pitch | feat(pitch): add bilingual EN/ZH PowerPoint pitch deck | shipped | 2 | 0 | 2026-02-27 | 2026-02-28 | commit:8876c4b7 |
hook | perf(hook): skip heuristics.db open via plain-text prefix cache | shipped | 1 | 0 | 2026-02-27 | 2026-02-27 | commit:89537483 |
init | feat(init): embed builtin skills in binary via include_str! | shipped | 1 | 0 | 2026-02-26 | 2026-02-26 | commit:3a837b13 |
cli | feat(cli): add precc skills export command | shipped | 2 | 0 | 2026-02-26 | 2026-02-26 | commit:59beea8d |
gdb | feat(gdb): re-enable Pillar 2 GDB hook suggestion | shipped | 1 | 0 | 2026-02-26 | 2026-02-26 | commit:a8428025 |
skills | feat(skills): add git wrong-dir skill and context mapping | stabilizing | 2 | 0 | 2026-02-25 | 2026-02-25 | commit:352474e1 |
metrics | feat(metrics): record hook latency, rtk_rewrite, cd_prepend via append-log | shipped | 1 | 0 | 2026-02-25 | 2026-02-25 | commit:9bf31d12 |
demo | feat(demo): add investor demo suite | shipped | 1 | 0 | 2026-02-25 | 2026-02-25 | commit:c818a0ac |
security | feat(security): SQLCipher encryption, binary hardening, multi-platform CI | shipped | 1 | 0 | 2026-02-25 | 2026-02-25 | commit:efd3dfc8 |
ingest | feat(ingest): add –force flag to re-mine already-recorded sessions | shipped | 1 | 0 | 2026-02-22 | 2026-02-22 | commit:85cc8f6f |
التبعيات (وحدات precc-core)
advisor→db,promote,skillsdiet→lean_ctxmetrics→dbmining→skillsmode_selector→db,modemulti_probe→diet,lean_ctx,mode,nushell,post_observe,rtknushell→lean_ctx,mining,rtkpromote→db,skillsrtk→lean_ctxsharing→db,license,skillsskill_advisor→mining,nushellskills→dbtelemetry→db,license,mining
الخطط والمهام
الخطط (طلبات التصميم/البنية)
- [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)
المهام (إدخالات TaskCreate / TodoWrite)
- completed: 89
- in_progress: 3
- deleted: 2
أحدث 30 مهمة:
- [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 reportthat 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 <build\|test\|check\|clippy>without -p, reads cachedcargo 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-baselinesubcommand. 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)
العوائق (إشارات الفشل/التعثر التي أبلغ عنها المستخدم)
- 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)
القرارات والمبررات
- 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-eventsto 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 Script — Decision: Replace the
rtk-rewrite.shshell script hook with a compiled Rust binary (precc-hook). Alternatives considered: source:doc:ALTERNATIVES.md - 2. SQLite vs Key-Value Store — Decision: Use SQLite for both
history.dbandheuristics.db. Alternatives considered: source:doc:ALTERNATIVES.md - 3. Workspace of 4 Crates vs Monolith — Decision: 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 CLI — Decision: 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 Mining — Decision: Support both modes —
precc-learnerdaemon for continuous mining,precc ingestfor on-demand. Alternatives considered: source:doc:ALTERNATIVES.md - 6. Confidence Thresholds — Decision: 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 Strategy — Decision: Port RTK’s rewriting logic into
precc-coreas the final pipeline stage, rather than running both hooks in sequence. Alternatives considered: source:doc:ALTERNATIVES.md - 8. Skill Storage Format — Decision: TOML files for built-in skills, SQLite rows for mined/user skills. Alternatives considered: source:
doc:ALTERNATIVES.md - 9. Session Log Format — Decision: 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
مؤشرات الأداء الرئيسية بمرور الوقت
| المقياس | الوحدة | الأول | الأخير | Δ | العينات | آخر مصدر |
|---|---|---|---|---|---|---|
at | x | 0.1 | 1.25 | +1.15 | 2 | commit:4f65556d |
build | ms | 3 | 480 | +477 | 2 | commit:f84bab49 |
hook | ms | 5 | 3 | -2 | 2 | commit:f81e4543 |
precc | tokens | 423 | 87 | -336 | 2 | commit:e3bc282e |
saved | ms | 4.8 | 6.3 | +1.5 | 2 | commit:ec17f16c |
الجهد حسب الجلسة (أفضل 10 حسب الرموز)
| الجلسة | الأول ← الأخير | الرسائل | الإدخال | الإخراج | كتابة ذاكرة التخزين المؤقت | قراءة ذاكرة التخزين المؤقت |
|---|---|---|---|---|---|---|
ebd81938 | 2026-04-04 → 2026-04-13 | 4517 | 4547 | 686622 | 24690950 | 1020430414 |
781fe484 | 2026-04-16 → 2026-04-17 | 1434 | 1341 | 603596 | 3739362 | 259708120 |
10175339 | 2026-03-28 → 2026-03-30 | 1318 | 1176 | 102469 | 2430047 | 110606429 |
5761d7ca | 2026-03-26 → 2026-03-28 | 1180 | 4363 | 137056 | 2196522 | 116605673 |
550c7bab | 2026-03-20 → 2026-03-22 | 1064 | 1466 | 104943 | 2059732 | 92991217 |
905ff169 | 2026-04-18 → 2026-04-19 | 650 | 1698 | 496929 | 1572668 | 63432376 |
d65ad15f | 2026-03-31 → 2026-04-04 | 752 | 558 | 78099 | 1845645 | 58334554 |
3b5e2947 | 2026-03-22 → 2026-03-23 | 1162 | 896 | 128068 | 1526203 | 102403205 |
0925455d | 2026-04-19 → 2026-04-19 | 440 | 830 | 262128 | 1226054 | 32943523 |
43541885 | 2026-03-31 → 2026-03-31 | 566 | 7353 | 82683 | 1096328 | 41667559 |
استخدام PRECC مع Cursor
تم بناء PRECC باعتباره خطاف PreToolUse من أجل Claude Code، غير أن مكتبة المهارات الكامنة وراءه — cargo-wrong-dir وgit-wrong-dir وnpm-wrong-dir وjj-translate ورفاقها — مستقلة عن المحرر. باستخدام مقتطف صَدَفة صغير يمكنك توجيه كل أمر تكتبه في الطرفية المدمجة لـ Cursor عبر precc-hook كي تستفيد نفس عمليات إعادة الكتابة التي توفّر الرموز (tokens) على Claude Code من توفيرها أيضاً على Cursor.
Requires
precc≥ 0.3.45. Earlier versions don’t plant the integration scripts under<data_dir>/integrations/cursor/. Runprecc updateto upgrade if you have an older release.
ما الذي يشمله
يلتقط التكامل الأوامر التي تكتبها في طرفية Cursor. في zsh يعيد كتابة سطر الأوامر تلقائياً قبل الضغط على Enter؛ أما في bash فلا يستطيع سوى التحذير (إذ يُطلَق فخّ DEBUG بعد اكتمال الأمر). أما الأوامر التي يُطلقها وكيل Cursor باعتبارها عمليات فرعية من نوع bash -c فلا تُحمَّل ضمنها تهيئة الصَدَفة التفاعلية لديك، ولذلك لا يراها الخطاف؛ ويستلزم سدّ هذه الثغرة وسيطاً (shim) عبر PATH، وهو ليس موجوداً في هذا الدليل بعد. كما أن استدعاءات الأدوات غير الصَدَفية في Cursor (تعديلات الملفات والبحث في الشيفرة) تقع خارج النطاق أيضاً.
التثبيت
zsh (إعادة كتابة تلقائية)
source ~/.local/share/precc/integrations/cursor/precc-preexec.zsh
شغّل precc init مرة واحدة — سيقوم بزرع السكربت في المسار أعلاه (يستخدم <data_dir> من تخزين precc، لذا يُحترم CLAUDE_CONFIG_DIR وعزل الملفات الشخصية الأخرى). ثم أضف سطر source إلى ~/.zshrc. يجب أن يكون كل من precc-hook وjq ضمن PATH؛ ويتوقف السكربت بصمت دون أي تأثير إذا كان أحدهما مفقودًا.
bash (تحذير فقط)
source ~/.local/share/precc/integrations/cursor/precc-preexec.bash
شغّل precc init مرة واحدة — سيقوم بزرع السكربت في المسار أعلاه. ثم أضف سطر source إلى ~/.bashrc. يقوم مصيدة DEBUG بطباعة إعادة الكتابة المقترحة إلى stderr دون تطبيقها؛ يمكنك نسخ الاقتراح يدويًا.
التحقق
في طرفية Cursor، نفّذ cd /tmp (في أي مكان خارج مشروع Rust) ثم اكتب أمر بناء بلغة Rust واضغط Enter. في zsh ينبغي أن يتغيّر المخزن المؤقت موضعياً إلى الصورة المعاد كتابتها بواسطة PRECC (وعادةً ما تكون إضافة بادئة على شاكلة cd PATH && …). أما في bash فيُفترض أن ترى في stderr سطراً بصيغة [precc] suggested rewrite: ….
ملاحظات تحفّظية
- يضيف زمن استجابة
precc-hookلكل ضغطة مفتاح. يستهدف الخطاف ما دون 5 ms عند p50، لكن قيمة p99 تكون أعلى عند برودة المخابئ (cold caches)؛ راجع ملاحظات زمن استجابة الخطاف في هذا الكتاب. - لا توجد بيانات قياسية (telemetry) من هذا المسار. سيُبلِّغ الخطاف تحت أيٍّ كان
agent_classالذي يكتشفه، والذي لن يكونclaude-code— لذا فإن توفيراتك على Cursor لن تظهر في صفحة الإحصاءات العامة. - يومض سبب إعادة الكتابة عبر
zle -Mلمدة ضغطة مفتاح واحدة. هادئ، وغير حصري (modal). - لتغطية الوكيل، تكون وسائط (shim) عبر
PATH(أغلفة في~/.precc/bin/cargoو~/.precc/bin/gitو…) هي الخطوة التالية المخطط لها.
مرجع الأوامر
مرجع كامل لجميع أوامر PRECC.
precc init
تهيئة PRECC وتسجيل الـ hook مع 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
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 doctor
Self-diagnose a broken or silent install.
precc doctor
Self-diagnose the install: settings.json hook registration, hook binary
path + permissions, and when the hook last fired. Run this first when
`precc savings` reports 0 tokens saved on a fresh install.
Options:
(none)
precc debug
Launch a GDB debugging session for a binary.
precc debug [BINARY] [ARGS...]
GDB-based debugging helper (Pillar 2).
Arguments:
BINARY Binary to debug
ARGS... Arguments to pass to the binary
precc explain
See what PRECC recently rewrote, and why.
precc explain [--since 1h] [--limit 20]
Show recent PRECC rewrites with their diff and the reasons each fired —
the audit trail for what PRECC changed.
Options:
--since SINCE Time window, e.g. "30m", "1h", "24h" (default: 1h)
--limit LIMIT Cap at N most-recent rewrites (default: 20)
precc undo
Undo a specific rewrite by its id.
precc undo ID
Revert a rewrite by id: re-disables the skill(s) that produced it.
Arguments:
ID Rewrite id from `precc explain` (16-hex-char hash)
precc recall
Search your cross-session knowledge mindmap.
precc recall QUERY [--kind KIND] [--limit 20]
Search the cross-session knowledge mindmap for past decisions, plans,
commits, blockers, and commands. Case-insensitive substring, newest first.
Arguments:
QUERY Query string
Options:
--kind KIND Restrict to: decision, plan, task, feature, blocker,
commit, command
--limit LIMIT Cap on hits returned (default: 20)
precc audit
Measure the token cost of your context surfaces.
precc audit <claude-md | claudeignore | positioning>
Measure the token cost of context surfaces. No opinions — just numbers.
Subcommands:
claude-md Bytes, estimated tokens, and per-section sizes of
CLAUDE.md (project + ~/.claude).
claudeignore Per-path bytes/tokens a .claudeignore could exclude from
Grep/Glob/Read (node_modules/, dist/, target/, …).
--write appends missing entries.
positioning Which positioning angles are backed by measured numbers.
precc analyze
Find command classes PRECC does not yet cover.
precc analyze frequencies
Count Bash command-class frequencies from session logs and report the
classes PRECC does not yet cover (rule-gap discovery).
الأسئلة الشائعة
هل PRECC آمن للاستخدام؟
نعم. يستخدم PRECC آلية hooks PreToolUse الرسمية لـ Claude Code – نفس نقطة التمديد التي صممتها Anthropic لهذا الغرض بالضبط. الـ hook:
- يعمل بالكامل دون اتصال (لا استدعاءات شبكة في المسار الحرج)
- يكتمل في أقل من 5 مللي ثانية
- هو fail-open: إذا حدث خطأ، يتم تنفيذ الأمر الأصلي دون تعديل
- يعدل الأوامر فقط، ولا ينفذها أبداً بنفسه
- يخزن البيانات محلياً في قواعد بيانات SQLite
هل يعمل PRECC مع أدوات البرمجة الذكية الأخرى؟
تم تصميم PRECC خصيصاً لـ Claude Code. يعتمد على بروتوكول hooks PreToolUse الذي يوفره Claude Code. لا يعمل مع Cursor أو Copilot أو Windsurf أو أدوات البرمجة الذكية الأخرى.
ما البيانات التي يرسلها القياس عن بعد؟
القياس عن بعد اختياري فقط. عند تفعيله، يرسل:
- إصدار PRECC ونظام التشغيل والبنية
- أعداد مجمعة (الأوامر المعترضة، المهارات المفعلة)
- متوسط زمن الاستجابة
لا يرسل نصوص أوامر أو مسارات ملفات أو أسماء مشاريع أو أي معلومات تعريف شخصية. يمكنك معاينة البيانات بالضبط باستخدام precc telemetry preview قبل الاشتراك. انظر القياس عن بعد للتفاصيل.
كيف أقوم بإلغاء تثبيت PRECC؟
PRECC is fully reversible — remove it in three steps:
-
إزالة تسجيل الـ hook:
# 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 إلى المستوى المجتمعي. جميع الوظائف الأساسية تستمر في العمل:
- المهارات المدمجة تبقى نشطة
- خط أنابيب الـ hook يعمل بشكل طبيعي
precc savingsيعرض العرض الملخصprecc ingestوتعدين الجلسات يعملان
تصبح ميزات Pro غير متوفرة حتى التجديد:
precc savings --all(تفصيل مفصل)precc compressprecc gifprecc ghaprecc geofence- تقارير البريد الإلكتروني
يبدو أن الـ hook لا يعمل. كيف أقوم بالتصحيح؟
Run precc doctor first — it automates every check below. To diagnose by hand:
-
تحقق من تسجيل الـ hook:
precc init -
اختبر الـ hook يدوياً:
echo '{"tool_input":{"command":"cargo build"}}' | precc-hook -
تحقق من أن الملف الثنائي في مسار PATH:
which precc-hook -
تحقق من تكوين hook في
~/.claude/settings.json.
هل يبطئ PRECC عمل Claude Code؟
لا. يكتمل الـ hook في أقل من 5 مللي ثانية (p99). هذا غير محسوس مقارنة بالوقت الذي يقضيه Claude في التفكير وتوليد الاستجابات.
هل يمكنني استخدام PRECC في CI/CD؟
تم تصميم PRECC لجلسات Claude Code التفاعلية. في CI/CD، لا توجد نسخة Claude Code للربط بها. ومع ذلك، يمكن لـ precc gha تحليل عمليات GitHub Actions الفاشلة من أي بيئة.
كيف تختلف المهارات المستخرجة عن المهارات المدمجة؟
المهارات المدمجة تأتي مع PRECC وتغطي أنماط الدليل الخطأ الشائعة. المهارات المستخرجة يتم تعلمها من سجلات جلساتك الخاصة – تلتقط أنماطاً فريدة لسير عملك. كلاهما يُخزن في SQLite ويُقيَّم بشكل متطابق بواسطة خط أنابيب الـ hook.
هل يمكنني مشاركة المهارات مع فريقي؟
نعم. صدّر أي مهارة إلى TOML باستخدام precc skills export NAME وشارك الملف. يمكن لأعضاء الفريق وضعه في مجلد 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.