ClawHub
SkillsPluginsOfficialDocsSupport
K
SkillsPRECC

PRECC

Yijun Yu@yijunyu
Predictive Error Correction for Claude Code — corrects bash commands before execution, predicts token costs via a trained ML oracle, and captures opt-in counterfactual telemetry

Install

$
openclaw skills install @yijunyu/precc
Security check
Review
Version
0.3.112
Updated
Nov 7, 2026
License
MIT-0

Latest: v0.3.112

PRECC v0.3.112

PRECC now runs inside the DeepSeek Harness

PRECC's command correction has so far needed Claude Code's PreToolUse hook. The DeepSeek Harness (DSH) has no such event, so DSH sessions ran with no correction and contributed nothing to PRECC's savings measurements. This release ships a native DSH plugin that closes that gap.

  • A native DSH plugin (plugins/dsh). It listens to DSH's tools/execute waterfall, asks precc-hook for a rewrite using a Claude-compatible PreToolUse event, and runs the rewritten command inside the same authorised tool call — so wrong-directory commands get corrected and verbose output gets wrapped through RTK/lean-ctx/nushell, exactly as under Claude Code.
  • Savings are measured in DSH too. The plugin sends a best-effort PostToolUse observation, so DSH sessions now feed PRECC's savings metrics instead of being invisible to them.
  • Fails open, by design. A missing hook, a timeout, malformed JSON, or an unchanged command all let the original command run untouched. A broken hook can never block a command. A PRECC deny is surfaced as a tool error.
  • No DSH or npm dependencies. The plugin uses only tools/execute and no package-private DSH imports, so it pins no private DSH sub-package version. It intercepts only the bash tool; DSH's native read, grep and glob are untouched.

Install is dsh plugin --profile <name> add <path>/plugins/dsh, then restart the profile — the bundle patch inserts a precc-bash row with enabled: true, which can be disabled from the plugin config. README.md documents it as "Option 4: DeepSeek Harness (DSH)".

Judge-labelled command classes (opt-in)

PRECC picks a compressor from the two-word command class (git status, cargo build). Measured on session logs, that class is precise but only fires on classes it already has history for — it cannot see a flood coming from a line-range dump or an && chain it has never met. This release adds an opt-in second opinion for exactly those cases.

  • A judge labels commands off the hot path. Point PRECC_JEV_URL at a local System One endpoint (jev-rs, any GGUF) and precc-learner labels Bash commands with a semantic class and a flood probability, then publishes two flat snapshots. The hook only reads those snapshots and never calls a model, so the sub-5ms budget is untouched.
  • Semantic classes pool thin evidence. A sem:<class> row aggregates measurements across two-word classes, and is consulted only when the exact class has no row of its own — so it adds coverage without overriding anything PRECC has measured directly.
  • Flood predictions pick the strongest compressor. An exact command predicted to flood at ≥ 0.80 is routed through lean-ctx, or RTK when lean-ctx is off.
  • Off by default. With PRECC_JEV_URL unset both snapshots stay empty and behaviour is identical to v0.3.111. When a label does fire it is recorded in the hook's reasons as jev-class:<class> or jev-flood:<p>.

Model size matters for this one: a 4B model scored at chance on the labelling task, while a 73 GB model reached 0.53 precision / 0.53 recall on floods the command class misses, taking the union's recall to 0.74. Point PRECC_JEV_URL at a large model or leave the feature off.

Upgrade

bash
precc update                                    # macOS / Linux
powershell
iwr -useb https://peria.ai/install.ps1 | iex    # Windows
Other

PRECC — Predictive Error Correction for Claude Code

PRECC saves ~34 % of Claude Code costs through three savings pillars: correcting bash commands before they fail, compressing tool output, and reducing context token usage via semantic search and file compression. v1.1 adds a token-cost prediction oracle (precc predict) that ships its own trainable ridge model, and opt-in counterfactual telemetry for measuring would-have-run vs. did-run deltas. Ships as a single Rust binary.

Three Savings Pillars

Pillar 1: Command Correction & Output Compression

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

Pillar 2: Semantic Code Search (cocoindex-code)

  • Optional AST-aware semantic search across 28+ languages, saving ~70% of search tokens
  • Built into the precc-hook binary; no extra scripts needed
  • Requires separate cocoindex-code install (pipx install cocoindex-code)

Pillar 3: Context File Compression

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

Token-Cost Prediction Oracle (v1.1)

precc predict records a prediction → actual labelled dataset for any multi-step task you plan in tokens (never in wall-clock time). It ships two predictors:

  • heuristic-1 — rule-based category × length estimator, available out of the box.
  • trained-v1 — closed-form ridge regression on category + log(description length), persisted to ~/.local/share/precc/predict_model.json. Fit it from your own closed predictions with precc predict --train; subsequent predictions are tagged trained-v1 automatically.
bash
precc predict "<task description>"               # log a prediction
precc predict --record <id> <actual_tokens>       # close the loop
precc predict --train                             # fit trained-v1
precc predict --eval                              # MAPE per category

Counterfactual Telemetry (v1.1, opt-in, dormant by default)

The hook can record a (would-have-run, did-run, outcome) triple per Bash invocation to a SQLCipher-encrypted store at ~/.local/share/precc/triples.db. The stream is opt-in only — disabled by default; you turn it on per machine via the [counterfactual] section of consent.toml (CLI ceremony lands in a future release). A daily-rotated salt + agent-class fingerprint keeps the data re-identification-resistant; nothing leaves the machine until a separate upload path is configured. The telemetry schema is designed for k-anonymity, with a documented threat model.

Install

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

The install script downloads a platform-specific binary from GitHub Releases, verifies its SHA256 checksum, and places it in ~/.local/bin. It then configures a PreToolUse hook in ~/.claude/settings.json.

Live Status Line

PRECC includes a built-in status line that shows real-time session metrics directly in the Claude Code terminal:

text
PRECC: 12 fixes, ~3.6K tokens saved | 2.1ms avg

The status line is automatically configured during installation. It shows:

  • Corrections — commands fixed in the current session
  • Tokens saved — estimated token savings from all corrections
  • Hook latency — average hook execution time

To enable manually, add to ~/.claude/settings.json:

json
{
  "statusLine": {
    "type": "command",
    "command": "~/.local/bin/precc-hook --statusline"
  }
}

What PRECC Modifies

  • ~/.claude/settings.json — Adds a PreToolUse hook entry pointing to precc-hook
  • ~/.local/share/precc/ — SQLite databases for learned failure-fix patterns and skill heuristics
  • ~/.local/bin/ — Installs precc, precc-hook, and precc-learner binaries

Usage

Once installed, PRECC works automatically as a PreToolUse hook.

bash
# Mine existing session history for failure-fix patterns
precc ingest --all

# View what PRECC has learned
precc skills list

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

# Semantic code search (requires cocoindex-code)
ccc init && ccc index
ccc search "authentication middleware"

# Compress context files
precc compress --dry-run   # preview
precc compress             # compress
precc compress --revert    # revert

# Token-cost prediction (v1.1)
precc predict "<task description>"
precc predict --record <id> <actual_tokens>
precc predict --train      # fit trained-v1 once you have ≥ 10 actuals
precc predict --eval       # mean error / MAPE

Measured Results

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

Links

  • GitHub: https://github.com/peri-a-i/precc-cc
  • ClawHub: https://clawhub.ai/skills/precc
  • cocoindex-code: https://github.com/cocoindex-io/cocoindex-code
  • RTK: https://github.com/rtk-ai/rtk
ClawHub

Skills and plugins for OpenClaw agents. Part of the wider OpenClaw ecosystem.

Explore docs

SkillsPluginsOfficialAudits

Publish SkillPublish PluginCreate org

OverviewOpenClawDocsBlog

SupportGitHubDiscord

Built alongside the OpenClaw ecosystem

LobsterCrabboxClickClackCrabfleetOctopoolClawSweeperagent-skillsdiscrawlgitcrawlslacrawlnotcrawltelecrawlgraincrawlcrawlkitcrawlbaracpxmcporterTachikomaclawpatchclawbenchPeekaboocookbookplugin-inspectorwacrawlcrabpotAll projectsLobsterCrabboxClickClackCrabfleetOctopoolClawSweeperagent-skillsdiscrawlgitcrawlslacrawlnotcrawltelecrawlgraincrawlcrawlkitcrawlbaracpxmcporterTachikomaclawpatchclawbenchPeekaboocookbookplugin-inspectorwacrawlcrabpotAll projects

© 2026 OpenClaw Foundation

Privacy policy·Status·Deployed on Vercel·Powered by Convex

....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals
  hooks runners slash-commands skill.md templates scanners review-bots     safe browse paths   official gateways   publisher handles   org trust   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@
openclaw ecosystem    crabbox clickclack crawler packs gateway plugins   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship
---- downloads installs stars lineage ownership docs package integrity   >>> install scan publish verify    @@ gateway @@ registry @@ agents @@   :::: signed manifests ::::: moderated releases ::::: version history ::::
  safe browse paths   official gateways   publisher handles   org trust     30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship     hooks runners slash-commands skill.md templates scanners review-bots
....:: clawhub/openclaw ::....  skills plugins publishers trust signals   :::: signed manifests ::::: moderated releases ::::: version history ::::   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins
>>> install scan publish verify    @@ gateway @@ registry @@ agents @@     hooks runners slash-commands skill.md templates scanners review-bots   ---- downloads installs stars lineage ownership docs package integrity
  30 skills 12 plugins    /api/v1/skills   /owners   /audit   /ship   openclaw ecosystem    crabbox clickclack crawler packs gateway plugins     safe browse paths   official gateways   publisher handles   org trust
:::: signed manifests ::::: moderated releases ::::: version history ::::   ---- downloads installs stars lineage ownership docs package integrity   ....:: clawhub/openclaw ::....  skills plugins publishers trust signals