Julius BrusseeandClaude Fable 5 e9cb8435d6 fix(#601): attribute session tokens to the mode active when each message happened
/caveman-stats credited ALL output tokens since session start to whatever
mode the flag held at stats time: activating caveman late inflated the
estimate (verbose tokens back-computed as compressed), deactivating it
zeroed honest savings — and the wrong number compounded into the lifetime
history and statusline.

The flag files carried no timestamps, so past sessions cannot be exactly
reconstructed. Fix going forward + honest fallback:

- caveman-config: recordModeChange() appends {ts, mode, prev} to
  .caveman-mode-log.jsonl on every actual flag transition (deduped,
  symlink-safe via appendFlag, best-effort)
- mode tracker + SessionStart activate hook log every flag mutation
  (set, off, NL deactivation, one-shot restore, session-start reset)
- caveman-stats joins the log timestamps against the session JSONL
  message timestamps and computes savings per mode span; the first
  row's prev covers the pre-inception span
- with no log coverage: a flag written mid-session means the earlier
  tokens have UNKNOWN mode — they are excluded and labeled, never
  guessed (no-fake-savings); with no evidence of a mid-session change,
  whole-session attribution stays (correct when the mode never changed)
- history rows, --share, and the statusline suffix all use the
  attributed figure; mixed sessions render a per-mode breakdown with
  the estimate basis stated

Old inflated history rows cannot be retroactively corrected (the data to
re-attribute them was never recorded).

Tests: mid-session activation (inflation case), mid-session deactivation
(zeroed case), tracker transition-log dedup, unattributable-prefix
exclusion. Checksums manifest refreshed for the four changed hook files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011kmm2umRGb5nLxdimrwweZ
2026-07-02 16:09:27 +02:00
2026-04-04 12:02:51 +02:00

caveman

why use many token when few do trick

Stars Last Commit License

Before/AfterInstallWhat You GetBenchmarksFull install guide


A Claude Code skill/plugin (also Codex, Gemini, Cursor, Windsurf, Cline, Copilot, 30+ more) that makes agent talk like caveman — cuts ~5065% of output tokens, measured (65% average vs default verbose replies, ~50% median vs a plain "answer concisely" baseline — real Claude API token counts, see Benchmarks), keeps full technical accuracy. Brain still big. Mouth small.

Honest number warning: caveman shrink output tokens only. Input tokens untouched by skill — whole-session savings smaller than the output number, and on terse tasks can be negative. Full truth: docs/HONEST-NUMBERS.md.

Before / After

🗣️ Normal Claude (69 tokens)

"The reason your React component is re-rendering is likely because you're creating a new object reference on each render cycle. When you pass an inline object as a prop, React's shallow comparison sees it as a different object every time, which triggers a re-render. I'd recommend using useMemo to memoize the object."

rock Caveman Claude (19 tokens)

"New object ref each render. Inline object prop = new ref = re-render. Wrap in useMemo."

🗣️ Normal Claude

"Sure! I'd be happy to help you with that. The issue you're experiencing is most likely caused by your authentication middleware not properly validating the token expiry. Let me take a look and suggest a fix."

rock Caveman Claude

"Bug in auth middleware. Token expiry check use < not <=. Fix:"

Same fix. Half the word — sometimes way less. Brain still big.

┌──────────────────────────────────────┐
│  OUTPUT TOKENS SAVED   █████  50-65% │
│  INPUT TOKENS SAVED    ─          0% │
│  TECHNICAL ACCURACY    ████████ 100% │
│  VIBES                 ████████  OOG │
└──────────────────────────────────────┘

Pick your level of grunt — lite (drop filler), full (default caveman), ultra (telegraphic), or wenyan (classical Chinese, even shorter). One command switch. Cost go down forever.

Speak your tongue. Caveman keep your language. You write Portuguese, caveman grunt Portuguese. Spanish, French, same. Compress the style, not the language. Code, command, error string stay exact.

"Novo ref de objeto cada render. Prop inline = novo ref = re-render. Envolva com useMemo."

rock Like this trick? Now get whole agent — caveman-code

This skill shrink what agent say. caveman-code shrink everything — full terminal coding agent, caveman top to bottom. ~2× fewer tokens than Codex on identical tasks. 20+ providers · plan mode · autopilot goal loop · MIT.

npm install -g @juliusbrussee/caveman-code

▶ Try caveman-code now →why use many token when whole agent save

Install

One line. Find every agent. Install for each.

# macOS / Linux / WSL / Git Bash
curl -fsSL https://raw.githubusercontent.com/JuliusBrussee/caveman/main/install.sh | bash

# Windows (PowerShell 5.1+)
irm https://raw.githubusercontent.com/JuliusBrussee/caveman/main/install.ps1 | iex

~30 seconds. Needs Node ≥18. Skip agent you no have. Safe to re-run.

Trigger: type /caveman or say "talk like caveman". Stop with "normal mode".

One agent only, manual command, or any of 30+ other agents → INSTALL.md. Install break? Open agent, say "Read CLAUDE.md and INSTALL.md, install caveman for me." Agent fix own brain.

What You Get

Skill What
/caveman [lite|full|ultra|wenyan] Compress every reply. Levels stick until session end.
/caveman-commit Conventional Commit messages, ≤50 char subject. Why over what.
/caveman-review One-line PR comments: L42: 🔴 bug: user null. Add guard.
/caveman-stats Real session token usage + lifetime savings + USD. Tweetable line via --share.
/caveman-compress <file> Rewrite memory file (e.g. CLAUDE.md) into caveman-speak. Cuts ~46% input tokens every session. Code/URLs/paths byte-preserved.
caveman-shrink MCP middleware. Wraps any MCP server, compresses tool descriptions. npm.
cavecrew-* Caveman subagents (investigator/builder/reviewer). ~60% fewer tokens than vanilla, main context lasts longer.

Statusline badge — Claude Code shows [CAVEMAN] ⛏ 12.4k (lifetime tokens saved). Updates every /caveman-stats run. Set CAVEMAN_STATUSLINE_SAVINGS=0 to silence.

Auto-activate every session: Claude Code, Codex, Gemini (built-in). Cursor / Windsurf / Cline / Copilot get always-on rule files via --with-init. Other agents trigger with /caveman per session. Full feature matrix in INSTALL.md.

Benchmarks

Real token counts from the Claude API. Average 65% output reduction across 10 prompts (range 22-87%) — measured against default (verbose) replies. Against a plain Answer concisely. control the median is ~50% (committed eval snapshot in evals/, tiktoken o200k_base). Both numbers are output tokens only.

Task Normal Caveman Saved
Explain React re-render bug 1180 159 87%
Fix auth middleware token expiry 704 121 83%
Set up PostgreSQL connection pool 2347 380 84%
Explain git rebase vs merge 702 292 58%
Refactor callback to async/await 387 301 22%
Architecture: microservices vs monolith 446 310 30%
Review PR for security issues 678 398 41%
Docker multi-stage build 1042 290 72%
Debug PostgreSQL race condition 1200 232 81%
Implement React error boundary 3454 456 87%
Average 1214 294 65%

Raw data and reproduction script: benchmarks/. Three-arm eval harness (baseline / terse / skill) lives in evals/ — caveman compared against Answer concisely. not against verbose default, so the delta is honest.

caveman-compress receipts (real memory files):

File Original Compressed Saved
claude-md-preferences.md 706 285 59.6%
project-notes.md 1145 535 53.3%
claude-md-project.md 1122 636 43.3%
todo-list.md 627 388 38.1%
mixed-with-code.md 888 560 36.9%
Average 898 481 46%

Important

Caveman only affects output tokens — input and thinking/reasoning tokens untouched. The skill itself adds ~11.5k input tokens per turn (the rules block), so whole-session savings are smaller than the output number, and terse workloads can come out net-negative. Caveman no make brain smaller. Caveman make mouth smaller. Biggest win is readability and speed, cost savings a bonus. When caveman wins, when caveman loses, how to measure yourself: docs/HONEST-NUMBERS.md.

A March 2026 paper "Brevity Constraints Reverse Performance Hierarchies in Language Models" found that constraining large models to brief responses improved accuracy by 26 points on certain benchmarks. Verbose not always better. Sometimes less word = more correct.

How It Work

  1. Install drop skill file in agent.
  2. Skill tell agent: drop filler, keep substance, use fragments.
  3. For Claude Code, hook also write tiny flag file each session — agent see flag, talk caveman from message one. No need say /caveman.
  4. Stats command read Claude Code session log, count tokens saved, write number to statusline.
  5. Caveman-compress sub-skill rewrite memory files (CLAUDE.md, project notes) so each session start with smaller context. Save tokens forever, not just one reply.

Maintainer detail (hook architecture, file ownership, CI sync) live in CLAUDE.md.

Lobster, Meet Rock 🦞 rock

OpenClaw the self-host gateway. One box, many agent inside (Claude Code, Codex, Pi, OpenCode), wired to your Slack / Discord / iMessage / Telegram / whatever. Tagline: "The lobster way." Lobster strong. Lobster smart. Lobster also talk a lot.

Caveman teach lobster brevity — same canonical installer, scoped to one agent:

# macOS / Linux / WSL
curl -fsSL https://raw.githubusercontent.com/JuliusBrussee/caveman/main/install.sh | bash -s -- --only openclaw

# Windows (PowerShell): no Node? install Node ≥18 first, then
npx -y github:JuliusBrussee/caveman -- --only openclaw

Two thing happen, no more:

  1. Skill drop at ~/.openclaw/workspace/skills/caveman/SKILL.md — spec-correct frontmatter (version, always: true), discoverable by openclaw skills list. Skill not auto-inject (OpenClaw load skill on demand) — that why we also do step 2.
  2. SOUL.md nudge. Tiny marker-fenced block appended to ~/.openclaw/workspace/SOUL.md. OpenClaw inject SOUL.md into every turn under "Project Context" (12K-per-file, 60K total — block well under). Lobster terse from message one. No /caveman per session. No nag.
~/.openclaw/workspace/
├── skills/caveman/SKILL.md   ← full ruleset, on-demand load
└── SOUL.md                    ← <!-- caveman-begin --> ... <!-- caveman-end -->
                                  ↑ auto-inject every turn

Custom workspace path? OPENCLAW_WORKSPACE=/your/path before the command. Uninstall: same one-liner with --uninstall — skill folder gone, SOUL.md block ripped out cleanly, your other workspace content stay untouched. Idempotent re-runs (frontmatter not double-prepended, marker block not duplicated).

Lobster claw still sharp. Lobster mouth now small. Brain still big.

Caveman Ecosystem

Five tools. One philosophy: agent do more with less.

Repo What
caveman (you here) Output compression — why use many token when few do trick
caveman-code Whole terminal coding agent — why use many token when whole agent can save
cavemem Cross-agent memory — why agent forget when agent can remember
cavekit Spec-driven build loop — why agent guess when agent can know
cavegemma Gemma 4 31B fine-tuned on caveman pairs — why prompt every turn when weight remember

Compose: cavekit drive build, caveman compress what agent say, cavemem compress what agent remember, cavegemma bake compression into weight, caveman-code ship it all as one terminal agent. One rock. Two rock. Three rock. Four rock. Five rock. That it.

More Skill From Same Cave

Caveman has siblings. JuliusBrussee/skills — five skills, one install, works in Claude Code, Cursor, Gemini, Cline, Copilot, 40+ agents:

Skill What
caveman This one. Speak less, say more.
grill-me Agent grill your plan before you build wrong thing. Checks how much you know first — no condescend, no coddle.
interface-kit Build UI that look good, load fast, work for everyone.
junior-to-senior Adversarial review pass. Junior output go in, senior output come out.
loop-factory Spec-driven task loop — inbox → active → archive, review gate between.
npx skills@latest add JuliusBrussee/skills

One command. Five skill. Cave well stocked.

Privacy

Caveman no phone home. No telemetry, no analytics, no accounts, no backend. After install, zero network calls — skill is a prompt, hooks are local scripts, /caveman-stats reads your session log on your disk. Install-time fetches (GitHub + your agents' own registries) and scanner-warning explanations: SECURITY.md.

  • docs/HONEST-NUMBERS.md — when caveman saves, when caveman costs, how to measure
  • INSTALL.md — full install matrix, all flags, per-agent detail
  • CONTRIBUTING.md — how to send patch
  • CLAUDE.md — maintainer guide (file ownership, hook architecture, CI)
  • docs/ — extra guides (Windows install, etc.)
  • Issues — bug, feature, weird behavior

Caveman Cloud

caveman make tokens small. caveman cloud prove it.

Local savings numbers (including /caveman-stats) are estimates — Caveman Cloud measures and verifies them across a team.

Star This Repo

Caveman save you token, save you money. Star cost zero. Fair trade.

Star History Chart

Also by Julius Brussee

  • Revu — local-first macOS study app with FSRS spaced repetition. revu.cards

Sponsors

caveman free forever. Sponsor keep rock sharp.

Atlas Cloud

Atlas Cloud — full-modal AI inference platform, one API.

Want rock here too? Sponsor caveman.

License

MIT — free like mass mammoth on open plain.

Languages
JavaScript 70.8%
Python 23.3%
PowerShell 3.1%
Shell 2.8%