You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: skills/caveman-stats/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Reads the current Claude Code session log directly and reports actual input/outp
8
8
9
9
Output also includes an `Est. rule overhead` and `Est. net` line whenever the savings figure above them is unambiguous (a single benchmarked mode with a known turn count — no guessing across mixed or unattributed spans). Overhead estimates the per-turn INPUT-token cost of the rules the skill injects every turn — default 1,250 tokens/turn, override with `CAVEMAN_RULE_OVERHEAD_TOKENS` if you've measured your own setup. Net is savings minus that overhead. On short, terse replies this can go negative — caveman's OUTPUT savings don't clear its INPUT cost — and the line says so directly instead of hiding it behind a gross-savings number. Background: `docs/HONEST-NUMBERS.md`.
10
10
11
-
Each run also writes a lifetime-savings suffix file used by the statusline badge (`⛏ 12.4k`). That badge stays a gross-savings figure on purpose — it is a glanceable summary, not a full accounting; run `/caveman-stats` for the net picture.
11
+
Each displayed run and each SessionEnd snapshot also writes a lifetime-savings suffix file used by the statusline badge (`⛏ 12.4k`). That badge stays a gross-savings figure on purpose — it is a glanceable summary, not a full accounting; run `/caveman-stats` for the net picture.
Copy file name to clipboardExpand all lines: skills/caveman-stats/SKILL.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,11 @@ name: caveman-stats
3
3
description: >
4
4
Show real token usage and estimated savings for the current session.
5
5
Reads directly from the Claude Code session log — no AI estimation.
6
-
Triggers on /caveman-stats. Output is injected by the mode-tracker hook;
7
-
the model itself does not compute the numbers.
6
+
Triggers on /caveman-stats for display and SessionEnd for silent lifetime
7
+
recording. Output is injected by the mode-tracker hook; the model itself does
8
+
not compute the numbers.
8
9
---
9
10
10
-
This skill is delivered by `hooks/caveman-stats.js` (read by `hooks/caveman-mode-tracker.js` on `/caveman-stats`). The model does not need to do anything when this skill fires — the hook returns `decision: "block"` with the formatted stats as the reason. The user sees the numbers immediately.
11
+
This skill is delivered by `hooks/caveman-stats.js` (read by `hooks/caveman-mode-tracker.js` on `/caveman-stats`, and by the SessionEnd hook as `--record`). The model does not need to do anything when this skill fires — the prompt hook returns `decision: "block"` with the formatted stats as the reason. The user sees the numbers immediately; SessionEnd records silently.
11
12
12
13
Output also includes `Est. rule overhead` and `Est. net` lines wherever a savings estimate exists with a known turn count. Rule overhead is the estimated per-turn INPUT-token cost of the injected caveman rules (default 1,250 tokens/turn, override with `CAVEMAN_RULE_OVERHEAD_TOKENS`) times the turn count. Net is savings minus that overhead — when negative, the output says so plainly and suggests turning caveman off for that workload, rather than hiding the net-negative regime behind a gross-savings number (see `docs/HONEST-NUMBERS.md`).
Copy file name to clipboardExpand all lines: src/hooks/README.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,14 @@ If you installed caveman standalone (without the plugin), the unified Node insta
24
24
25
25
- Reads `$CLAUDE_CONFIG_DIR/.caveman-active` (default `~/.claude/.caveman-active`) and outputs a colored badge
26
26
- Shows `[CAVEMAN]`, `[CAVEMAN:ULTRA]`, `[CAVEMAN:WENYAN]`, etc.
27
-
- Appends the lifetime savings suffix `⛏ 12.4k` from `$CLAUDE_CONFIG_DIR/.caveman-statusline-suffix` (written by `caveman-stats.js` on each `/caveman-stats` run; absent until the first run, so fresh installs render no fake number). Opt out with `CAVEMAN_STATUSLINE_SAVINGS=0`.
27
+
- Appends the lifetime savings suffix `⛏ 12.4k` from `$CLAUDE_CONFIG_DIR/.caveman-statusline-suffix` (written by `caveman-stats.js` after `/caveman-stats` and at SessionEnd; absent until the first snapshot, so fresh installs render no fake number). Opt out with `CAVEMAN_STATUSLINE_SAVINGS=0`.
28
+
29
+
### `caveman-stats.js --record` — SessionEnd hook
30
+
31
+
- Runs when Claude Code ends a session
32
+
- Reads `transcript_path` from hook stdin and appends the latest stats snapshot to `$CLAUDE_CONFIG_DIR/.caveman-history.jsonl`
33
+
- Writes no stdout, so the hook does not interrupt shutdown
34
+
- Keeps duplicate snapshots safe: lifetime views count only the newest row per `session_id`
0 commit comments