ချွေတာမှု
PRECC သည် ကြားဖြတ်မှုတိုင်းမှ ခန့်မှန်းတိုကင်ချွေတာမှုကို ခြေရာခံသည်။ PRECC မည်မျှ ဖြုန်းတီးမှုကို တားဆီးခဲ့သည်ကို ကြည့်ရန် precc savings ကို သုံးပါ။
အကျဉ်းချုပ်
$ precc savings
Session Token Savings
=====================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens
Breakdown:
Pillar 1 (cd prepends): <span data-stat="session_p1_tokens">3,204</span> tokens (<span data-stat="session_p1_count">6</span> corrections)
Pillar 4 (skill activations): <span data-stat="session_p4_tokens">1,560</span> tokens (<span data-stat="session_p4_count">4</span> activations)
RTK rewrites: <span data-stat="session_rtk_tokens">2,749</span> tokens (<span data-stat="session_rtk_count">11</span> rewrites)
Lean-ctx wraps: <span data-stat="session_lean_tokens">1,228</span> tokens (<span data-stat="session_lean_count">2</span> wraps)
အသေးစိတ်ခွဲခြမ်းစိတ်ဖြာမှု (Pro)
$ precc savings --all
Session Token Savings (Detailed)
================================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens
Command-by-command:
# Time Command Saving Source
1 09:12 cargo build 534 tk cd prepend (cargo-wrong-dir)
2 09:14 cargo test 534 tk cd prepend (cargo-wrong-dir)
3 09:15 git status 412 tk cd prepend (git-wrong-dir)
4 09:18 npm install 824 tk cd prepend (npm-wrong-dir)
5 09:22 find . -name "*.rs" 387 tk RTK rewrite (output truncation)
6 09:25 cat src/main.rs 249 tk RTK rewrite (lean-ctx wrap)
7 09:31 cargo clippy 534 tk cd prepend (cargo-wrong-dir)
...
Pillar Breakdown:
Pillar 1 (context resolution): <span data-stat="session_p1_tokens">3,204</span> tokens <span data-stat="session_p1_pct">36.6</span>%
Pillar 2 (GDB debugging): 0 tokens 0.0%
Pillar 3 (mined preventions): 0 tokens 0.0%
Pillar 4 (automation skills): <span data-stat="session_p4_tokens">1,560</span> tokens <span data-stat="session_p4_pct">17.8</span>%
RTK rewrites: <span data-stat="session_rtk_tokens">2,749</span> tokens <span data-stat="session_rtk_pct">31.5</span>%
Lean-ctx wraps: <span data-stat="session_lean_tokens">1,228</span> tokens <span data-stat="session_lean_pct">14.1</span>%
ချွေတာမှုကို ခန့်မှန်းပုံ
ပြင်ဆင်မှု အမျိုးအစားတစ်ခုစီတွင် PRECC မရှိလျှင် ဖြစ်မည့်အရာအပေါ် အခြေခံ၍ ခန့်မှန်းတိုကင်ကုန်ကျစရိတ်ရှိသည်:
| ပြင်ဆင်မှုအမျိုးအစား | ခန့်မှန်းချွေတာမှု | အကြောင်းပြချက် |
|---|---|---|
| cd prepend | ~500 tokens | အမှားရလဒ် + Claude ဆင်ခြင်မှု + ပြန်ကြိုးစားမှု |
| ကျွမ်းကျင်မှုအသက်သွင်းခြင်း | ~400 tokens | အမှားရလဒ် + Claude ဆင်ခြင်မှု + ပြန်ကြိုးစားမှု |
| RTK rewrite | ~250 tokens | Claude ဖတ်ရမည့် အကျယ်တစ်ပြန့်ရလဒ် |
| Lean-ctx wrap | ~600 tokens | ဖိုင်ကြီးအကြောင်းအရာများ ချုံ့ထားသည် |
| တူးဖော်ထားသော ကြိုတင်ကာကွယ်မှု | ~500 tokens | သိထားသော ကျရှုံးမှုပုံစံကို ရှောင်လွှဲသည် |
ဤအရာများသည် ခန့်မှန်းချက်များဖြစ်ပြီး အမှန်တကယ်ချွေတာမှုသည် ပိုများနိုင်သည်။
စုဆောင်းချွေတာမှု
ချွေတာမှုများသည် PRECC ဒေတာဘေ့စ်တွင် session များအကြား ဆက်လက်ရှိနေသည်။ အချိန်ကြာလာသည်နှင့်အမျှ စုစုပေါင်းသက်ရောက်မှုကို ခြေရာခံနိုင်သည်:
$ precc savings
Session Token Savings
=====================
Total estimated savings: <span data-stat="session_tokens_saved">8,741</span> tokens
Lifetime savings: <span data-stat="total_tokens_saved">142,389</span> tokens across <span data-stat="total_sessions">47</span> sessions
Status Bar
After installation, PRECC wires a statusLine entry into ~/.claude/settings.json so the Claude Code status bar shows live session metrics:
$0.42 spent | 1.2M in/out | 📊 last cmd: −1.2K | PRECC: 7 fixes | 5.8ms avg | this session: 320 saved over 7 cmds (~$0.05) | lifetime: 8.9K saved over 217 cmds (~$2.85)
Set PRECC_LANG to render the labels in your language — see the Localization chapter.
Each segment:
| Segment | Source | Meaning | Resets on session restart? |
|---|---|---|---|
$0.42 spent | cost.total_cost_usd | Cumulative session cost reported by Claude Code | Yes |
1.2M in/out | total_input_tokens + total_output_tokens | Non-cached input + output tokens across the session | Yes |
📊 last cmd: −1.2K | PRECC measurement of the most recent Bash command | Real ground-truth saving from re-running the original | No (persists across sessions) |
PRECC: 7 fixes | metrics.log | Number of corrections this session — fix count only, no fake token estimate | Yes |
5.8ms avg | PRECC hook latency p50 | Time PRECC spent processing each tool call | Yes |
bash 18% of total | post_observations.log | Share of session tokens that came from Bash output — clarifies why PRECC’s savings are naturally a fraction of total cost (PRECC only optimizes Bash output) | Yes |
this session: 320 saved over 7 cmds (~$0.05) | .lifetime_summary.json − baseline | Real per-session delta. Hidden when delta is zero (start of session) | Yes (baseline re-snapshots) |
lifetime: 8.9K saved over 217 cmds (~$2.85) | .lifetime_summary.json | Cumulative tokens saved and re-measured commands since PRECC was first installed, plus an estimated USD value at the current per-token rate | No |
The lifetime: segment is placed last so it’s the first to be truncated if Claude Code’s UI clips the bar at the right edge.
Why cost and token count don’t divide
The displayed 1.2M in/out is not the denominator that produced $0.42 spent. Claude Code’s cost.total_cost_usd is computed from the API’s full token breakdown — base input, output, plus cache reads and cache creations. The session-wide cumulative cache token counts are not exposed in the statusline schema, so PRECC can only show the visible (non-cache) portion.
On long sessions with heavy file rereads, cache reads can be 10× the visible token count. That’s why pairing the two as a ratio would mislead — PRECC shows them as independent segments instead.
Why PRECC doesn’t compute the cost
The cost number is authoritative. PRECC reads cost.total_cost_usd verbatim from the JSON Claude Code pipes into the status command on stdin. That’s the same number Claude Code charges against your subscription/usage budget. You can verify it any time with the built-in /cost slash command — both should agree.
What drives the cost
For Claude Opus 4.6:
| Token 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 |
The biggest drivers on long sessions are usually output tokens (the most expensive per-token type, especially on the 1M context tier), repeated cache reads (cheap individually but accumulating fast across many turns), and cache creations (written once per file read at ~1.25× the base input rate). PRECC reduces the visible-token cost by compressing Bash output (the 📊 last cmd: segment shows the per-command saving), but it cannot reduce cache reads of files Claude has already loaded.
Stable session counts
The “PRECC: N fixes” segment counts events since the persisted session start, written to ~/.local/share/precc/sessions/<session_id>.start on the first statusline refresh of each session. This makes the count monotonic — it cannot drop mid-session even if cost.total_duration_ms is missing on a particular refresh.
Auto-refreshed lifetime snapshot
The lifetime: segment reads ~/.local/share/precc/.lifetime_summary.json, which is rewritten on every PostToolUse measurement and on every precc savings invocation. The this session: segment reads the same lifetime file but subtracts a per-session baseline persisted on the first refresh of each session. No manual refresh needed — the files update themselves.
Suppressing the status bar
If you’d rather keep your existing status bar, set your own statusLine command in ~/.claude/settings.json. PRECC’s installer will detect the custom value and leave it alone on subsequent updates.
To suppress only the per-interaction 📊 PRECC line (in additionalContext), set PRECC_QUIET=1 in your shell environment.
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.