MCPcopy Create free account
hub / github.com/JuliusBrussee/caveman

github.com/JuliusBrussee/caveman

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.0 ↗ · + Follow · compare 7 versions
8,403 symbols 32,300 edges 820 files ⚖ MIT 1,947 documented · 23% updated 1d agov2.2.0 · 2026-08-20★ 100,189171 open issues

Browse by type

Functions 7,561 Types & classes 842
What it actually does AI analysis from the code graph
loading…
README

Caveman

why use many token when few do trick

Original skill made agents say less. Caveman 2 makes them read less too.

33.2% fewer provider-reported input tokens in a pinned Claude Code benchmark. benchmark_counterfactual

Keep your agent. Brain big. Context small.

JuliusBrussee%2Fcaveman | Trendshift

Stars 30+ agents 7 native wrap profiles License

Install · See it · Adoption paths · Caveman Proxy · Payloads · Browse · Pixel · Skill→PNG · Wrap · License


Start small

Install the MIT skill first. It needs no Caveman account, proxy, Go toolchain, or code changes. Your agent and provider stay the same; only the answer style changes.

# macOS · Linux · WSL · Git Bash
curl -fsSL https://raw.githubusercontent.com/JuliusBrussee/caveman/v1.10.0/install.sh | bash
# Windows · PowerShell 5.1+
irm https://raw.githubusercontent.com/JuliusBrussee/caveman/v1.10.0/install.ps1 | iex

The installer needs Node.js 18+, finds supported agents already on your machine, skips the rest, and is safe to rerun. Prefer one agent only?

# Claude Code
claude plugin marketplace add JuliusBrussee/caveman && claude plugin install caveman@caveman

# Gemini CLI
gemini extensions install https://github.com/JuliusBrussee/caveman

# Codex, Cursor, Windsurf, Cline, and other skills-compatible agents
npx skills add JuliusBrussee/caveman --skill '*' -a codex --yes  # replace codex with your agent profile

Type /caveman if your agent does not activate it automatically. Switch with /caveman lite|full|ultra|wenyan-lite|wenyan-full|wenyan-ultra; turn it off with /caveman off or normal mode. See INSTALL.md for the full 30+ agent matrix, dry run, flags, verification, and uninstall.

One install also brings the small tools:

Tool / command What you get
/caveman [lite\|full\|ultra\|wenyan-lite\|wenyan-full\|wenyan-ultra\|off] Shorter replies at the intensity you choose.
cavecrew-investigator, cavecrew-builder, cavecrew-reviewer Compressed subagent presets for locating, editing, and reviewing code.
/caveman-commit Terse Conventional Commit messages.
/caveman-review One-line, actionable review findings.
/caveman-compress <file> Smaller Markdown memory files, with the original backed up.
/caveman-stats Local session token usage and estimated savings in Claude Code.

That is the whole adoption path for shorter answers. Stop there if that is all you need. Add the local Proxy later when you want Caveman to shrink what the agent reads too.

Caveman started as a skill/plugin for Claude Code, Codex, Gemini, Cursor, Windsurf, Cline, Copilot, and 30+ other agents. Install once; the agent drops filler and answers in tight caveman-speak while keeping code, commands, and errors byte-for-byte exact.

Agent mouth got smaller. Appetite did not. Tool schemas, files, logs, history, and skill bodies still crossed the provider boundary in full, often on every turn. Caveman 2 shrinks that input before the provider call. Caveman Proxy sits under your existing agent; Caveman Engine powers compression and stores every moved byte for exact recovery.

Keep your agent

Caveman works underneath the stack you already use. Adopt only the layer you need.

Need Smallest Caveman path
Shorter, cleaner answers Install the MIT skill above. No Caveman account, proxy, or code changes.
Less input in Claude Code, Codex, Gemini, Aider, opencode, Hermes, or OpenClaw npm install -g @caveman-ai/cli, then wrap your existing agent with one caveman command.
Vercel AI SDK Point the OpenAI-compatible or Anthropic provider baseURL at Caveman. Keep the AI SDK loop, tools, and call sites. See the exact Vercel AI SDK recipe.
LangChain, LiteLLM, OpenAI Agents, CrewAI, PydanticAI, or a provider SDK Point the existing provider client at Caveman. See integrations/recipes/.
A new TypeScript agent Run npm create @caveman-ai/agent@latest my-agent, powered by @caveman-ai/agent.

The skill

The original. MIT, and it stays MIT.

🗣️ Normal agent — 69 tokens Caveman agent — 19 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. > New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`.

Same concrete fix, fewer words. Broader reduction and quality-equivalence claims stay unpublished until a reproducible run with raw outputs is committed.

No published output-style benchmark result. Run benchmarks/run.py, review paired output quality, and commit raw results before publishing a percentage.

Use the skill by itself, or keep going when input compression becomes worth the extra setup.

Output-token counts measure length only. They do not prove semantic or technical equivalence; raw paired outputs require separate review before any quality claim.

Shorter answers only fixed output. Tool catalogs, MCP results, logs, repeated files, and skill bodies ride upstream again and again. Caveman Proxy catches them before the next model call; Caveman Engine compresses them locally.

Caveman Proxy

One command wraps your agent and routes provider traffic through a local proxy. Caveman Engine powers its compression. In a pinned 54-run Claude Code benchmark, Caveman used 33.2% fewer provider-reported input tokens than direct Claude Code while passing all 18 exact-answer checks. Method, per-case results, and limits. benchmark_counterfactual

No code change. In local mode, Caveman sends no prompts or outputs to a Caveman backend: the proxy forwards each request to your chosen provider, while CCR recovery copies stay on your disk. Claude Pro/Max OAuth credentials pass through to Anthropic as-is.

coding agent talks to a local caveman proxy that forwards upstream to the provider with auth passed through byte-exact; a CCR store below the proxy keeps the original bytes and returns a recovery handle to the agent; an MCP toolkit side-channel gives the agent caveman_retrieve, toon encode/decode, and browse

Install the CLI

npm install -g @caveman-ai/cli
caveman setup --install   # downloads the signed runtime binaries

setup --install verifies the signed checksum manifest and the SHA-256 of every binary before an atomic install. Prefer building from source? A clone plus scripts/install-local-cli.sh (macOS/Linux) or pwsh -File scripts/install-local-cli.ps1 (Windows) still works — that path needs Go and pnpm. SDK users can point provider base URLs at the local Proxy directly (ANTHROPIC_BASE_URL=http://127.0.0.1:8787/anthropic).

caveman claude                  # full stack (default): S4 compress + TOON best-of + caveman & browse MCP tools + output shrink
caveman wrap --off codex        # byte-safe pass-through metering only
caveman wrap --pixel claude     # lossy text → PNG pixel mode (model-gated)

Subscription logins work — see the note below.

Mode What it does Bytes the model sees
default stack (caveman claude) Structural compression routed per content type (table below), plus uniform JSON tool results re-encoded as TOON only when measured smaller; config toon: false turns it off. Changed, recoverable
--off Counts tokens and cost. Changes nothing. Byte-identical
--pixel Dense text slabs rendered to PNG pages for vision models. Changed, recoverable

Safety gates stay explicit:

  • CCR first. Before a lossy transform goes upstream, original bytes land in CCR, a content-addressed store on your disk. The agent retrieves them through caveman_retrieve or caveman retrieve <handle>. Parse problem, store failure, or larger result sends original bytes unchanged.
  • Visible declines. Pixel refuses sparse code. Convert refuses skills when PNG pages do not beat text. TOON runs only when its output measures smaller. Each decline includes its reason.
  • Labeled evidence. Local results report inferred: estimates for choosing what to try. verified requires real traffic and eval gates. Offline caveman never reports it.

What the engine does to a payload

detect() types each payload, then routes it to a compressor that keeps what answers depend on:

Detected type Keeps Target
json keys, structure, error/message subtrees; collapses repetitive arrays 70–90%
log errors, stack traces, first/last lines; drops INFO and progress noise 85–95%
code imports, signatures, types; elides function bodies, syntax stays valid 40–70%
diff file/hunk headers and changed lines; elides repeated context 60–80%
search-result top/bottom hits plus diagnostic/security hits 80–95%
text / HTML headings, opening/closing context, important sections 50–80%

All targets inferred. The code compressor uses tree-sitter (Go, Python, JS/TS) under cgo, with a pure-Go fallback that handles Go only. contextwindow.Pack() additionally fits candidate context into a token budget by BM25 relevance, recency, and error signal, returned in original order so chronology survives.

Beyond the proxy, the same engine powers a set of verbs:

caveman explore install         # read-only FastContext subagent: finds code as path:line
                                #   cites without burning your solver's context (Claude Code)
caveman shrink -- pnpm test     # compress noisy command output, byte-exact recoverable
caveman browse <url>            # local Chrome driver over a compressed a11y tree
caveman mem remember|recall     # durable memory; `mem recover <handle>` = original bytes
caveman learn                   # scan your real agent history → Cave Score + ranked token sinks
caveman trial -- claude         # A/B a real session, then `trial report`
caveman toon encode|decode      # the TOON re-encoder, standalone
caveman stats                   # what caveman actually did, by content type

The MCP server exposes five tools to any MCP host: caveman_compress, caveman_retrieve, caveman_stats, caveman_toon_encode, caveman_toon_decode.

Caveman Browse benchmark

Measured 2026-08-10 across five independent Chrome runs with Chrome 151.0.7922.108, Playwright 1.56.1, and Caveman's offline o200k_base counter. Results are inferred token counts, reported as medians.

Fixture Raw AX JSON Playwright ARIA Caveman full Caveman focused query
200-row operations table 398,494 15,704 13,368 — 14.88% below Playwright 121 — 129.8× smaller than Playwright
Small checkout form 4,186 67 157 — 2.34× larger 111 — 1.66× larger

Large pages reward query-focused disclosure. Tiny pages can lose because Caveman also returns action UIDs, a recovery handle, and exact accounting. Playwright baseline contains only ARIA text, so comparison favors Playwright.

Captured serializer fixture improved from 380 tokens to 58, an 84.7% reduction. Full delivered payload is 126 tokens after CCR and accounting metadata; four-tool MCP catalog costs 287 tokens. Full method, ranges, fixtures, functional gates, and claim boundary live in browse/BENCHMARK.md.

Pixel mode

The headline trick. A dense wall of text costs a lot of text tokens. Rendered to a PNG for a vision model, the same wall costs image tokens, far fewer for the right content. Pixel mode renders big request slabs (minified JSON tool catalogs, long-line logs, old history) into glyph-rendered PNG pages the model reads as vision input.

<img src="https://github.com/JuliusBrussee/caveman/raw/v2.0.0/docs/assets/pixel-pipeline.svg" alt="a

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 6,580
Method 981
Struct 555
Interface 162
Class 88
TypeAlias 25
FuncType 12

Languages

Go61%
TypeScript32%
Python7%

Modules by API surface

packages/cli/src/index.ts766 symbols
packages/agent/src/runtime.ts161 symbols
packages/sdk/python/caveman_cloud/core.py159 symbols
packages/sdk/typescript/src/index.ts130 symbols
packages/graders/src/index.ts92 symbols
proxy/providers/adapter.go91 symbols
packages/sdk/python/tests/test_runtime_policy.py70 symbols
packages/agent/src/budget.ts64 symbols
engine/pixel/transform_anthropic.go64 symbols
packages/mastra/src/index.ts57 symbols
proxy/internal/nativeruntime/runtime.go54 symbols
packages/agent/src/cli.ts51 symbols

Dependencies from manifests, versioned

github.com/chromedp/cdprotov0.0.0-2026032100182 · 1×
github.com/chromedp/sysutilv1.1.0 · 1×
github.com/go-json-experiment/jsonv0.0.0-2026021400441 · 1×
github.com/gobwas/poolv0.2.1 · 1×

Datastores touched

caveDatabase · 1 repos
appDatabase · 1 repos
mydbDatabase · 1 repos

For agents

$ claude mcp add caveman \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page