Caveman

repository·main·Indexed 13 days ago

https://github.com/juliusbrussee/caveman

A skill and plugin for AI coding agents (such as Claude Code, Cursor, and Gemini) that compresses prose output to reduce token usage by up to 65% while maintaining 100% technical accuracy for code and commands. It includes tools for session-based compression levels (lite, full, ultra, wenyan), input token optimization via /caveman-compress, and specialized cavecrew subagents for context management.

Tokens
27.7K
Snippets
82
Records
145
Agent score
99%

What's inside Caveman

  1. Privacy and Security of caveman

    main

    Caveman does not use telemetry, analytics, accounts, or a backend. It does not 'phone home'.

    • Network Activity: Zero network calls occur after installation.
    • Local Execution: The skill is a prompt, hooks are local scripts, and /caveman-stats reads logs already existing on your local disk.
    • Install-time: Only fetches from GitHub and your agent's own registries during the initial setup.
  2. What is caveman and how does it work?

    main

    caveman is a compression mode for LLM responses designed to reduce token usage while preserving technical accuracy. It transforms model responses into "caveman-style" prose by removing articles, filler, pleasantries, and hedging, while keeping technical details, code blocks, error strings, and symbols exact.

    Measured to cut approximately 65% of output tokens, the mode persists for the entire session until explicitly stopped or changed.

    Auto-clarity rule: The system automatically reverts to normal prose for critical information such as security warnings, irreversible-action confirmations, or complex multi-step sequences to prevent ambiguity. It also reverts if the user repeats a question.

  3. Boundaries of caveman mode persistence

    main

    Caveman mode is designed for chat interactions. It does not persist outside of the chat context. When writing the following, the system will use normal prose:

    • Code and comments
    • Documentation
    • Commits
    • Issue/PR/MR text
    • Memory files
    • Third-party messages (unless /caveman-compress is explicitly used)

    To revert to normal prose within a session, use stop caveman or normal mode.

  4. How caveman works and its core commands

    main

    Caveman reduces token usage by instructing agents to drop filler, keep substance, and use fragments, while strictly preserving code, commands, and errors.

    Core Workflow & Commands:

    1. Installation: Drops a skill file into your agent.
    2. Claude Code Integration: Uses a hook to write a tiny flag file each session, enabling 'caveman mode' automatically.
    3. /caveman-stats: Reads your session log to count tokens saved and displays the number in your statusline.
    4. /caveman-compress: Rewrites memory files (such as CLAUDE.md) to ensure future sessions start with a smaller context, saving tokens long-term.
  5. Understand caveman-stats output metrics

    main

    When running /caveman-stats, the output follows this format:

    Session: 47 turns
    Input:   12,304 tokens
    Output:   3,891 tokens (caveman)
    Baseline: 11,247 tokens (estimated without caveman)
    Saved:    7,356 tokens (~65%)
    Est. rule overhead: 58,750 (input, ~1,250/turn over 47 turns)
    Est. net: -51,394 (caveman cost more than it saved for this workload — consider turning it off)

    Key distinction: Gross vs. Net

    • Statusline Badge: Displays a gross-savings figure (e.g., ⛏ 12.4k) as a glanceable summary.
    • /caveman-stats command: Provides the net picture, accounting for the input token overhead required to run the caveman rules.
  6. When caveman mode automatically reverts to normal mode

    main

    To prevent technical errors or safety risks, caveman mode will automatically drop its compression and switch to normal prose (Auto-Clarity) during:

    • Security warnings.
    • Irreversible action confirmations (e.g., destructive database operations).
    • Multi-step sequences where omitting conjunctions or articles might cause the user to misinterpret the order of operations.
    • Technical ambiguity: If the compression itself makes a command unclear (e.g., "migrate table drop column backup first").
    • User requests: If the user asks to clarify or repeats a question.

    Once the critical or ambiguous part is handled, the model will resume caveman mode.

  7. Follow caveman-commit formatting rules

    main

    When generating commit messages via caveman-commit, adhere to these structural rules:

    Subject Line

    Format: <type>(<scope>): <imperative summary>

    • Types: feat, fix, refactor, perf, docs, test, chore, build, ci, style, revert.
    • Scope: Optional.
    • Mood: Use imperative mood (e.g., add, fix, remove) instead of past tense (added) or present continuous (adding).
    • Length: Aim for $\le$ 50 characters; hard cap at 72.
    • Punctuation: No trailing period. Match project convention for capitalization after the colon.

    Body (Optional)

    Only include a body if the subject is not self-explanatory. Use a body for:

    • Non-obvious why (reasoning).
    • Breaking changes.
    • Migration notes.
    • Linked issues.

    Body Formatting:

    • Wrap text at 72 characters.
    • Use - for bullets (do not use *).
    • Reference issues/PRs at the end using Closes #42 or Refs #17.

    Prohibited Content

    • Fluff: Avoid "This commit does X", "I", "we", "now", or "currently".
    • Attribution: Do not include "As requested by..." (use Co-authored-by instead) or AI attribution like "Generated with Claude Code" (unless specifically requested via an Assisted-by trailer).
    • Redundancy: Do not restate file names if the <scope> already covers them.
    • Emojis: Do not use emojis unless the specific project convention requires them.
    feat(api): add GET /users/:id/profile
    
    Mobile client needs profile data without the full user payload
    to reduce LTE bandwidth on cold-launch screens.
    
    Closes #128
  8. Understand Caveman mode boundaries and Auto-Clarity

    main

    Caveman mode follows specific rules regarding when it is applied and when it is automatically suspended to ensure safety and clarity.

    Automatic Suspension (Auto-Clarity)

    The system will automatically drop Caveman mode and revert to normal prose in the following scenarios:

    • Security warnings: When communicating potential risks.
    • Irreversible action confirmations: When a user is about to perform a destructive or permanent action.
    • Complex sequences: Multi-step instructions where terse language might lead to misinterpretation.
    • User confusion: If the user is confused or repeating themselves.

    Content Boundaries

    Even when Caveman mode is active, certain technical outputs are exempt and will always use normal prose:

    • Code blocks
    • Commit messages
    • PR (Pull Request) descriptions
  9. Understand how caveman affects token usage

    main

    Caveman is a system-prompt skill designed to make models write shorter output. It does not compress your input, context, files, or the model's thinking tokens.

    Token Impact Summary

    • Output Reduction: Averages 65% (range 22–87%) compared to default verbose replies.
    • Input Cost (Overhead): Adds approximately ~1–1.5k tokens per turn due to the injection of SKILL.md rules and skill-list entries into the context.
    • Input Reduction: 0%. The skill itself does not reduce input size.
    • Memory Files: Using /caveman-compress on memory files can result in an average input reduction of ~46% for those specific files.
  10. Rules for caveman mode communication

    main

    When caveman mode is active, the following communication constraints apply to ensure technical accuracy and token efficiency:

    What to Drop

    • Articles: a, an, the (except in lite mode).
    • Filler: just, really, basically, actually, simply.
    • Pleasantries: sure, certainly, of course, happy to.
    • Hedging: Avoid non-committal language.
    • Narration: No tool-call narration, no preamble, no plans, and no progress notes before or between tool calls.
    • Decoration: No decorative tables, no emojis, and no causal arrows ().
    • Verbosity: Use short synonyms (e.g., fix instead of implement a solution for).

    What to Preserve (CRITICAL)

    • Technical Substance: All technical terms, code blocks, API names, CLI commands, and exact error strings must remain unchanged.
    • Negation: Never drop not, never, no, only, or except as this flips meaning.
    • Precision: Numbers and units must be exact.
    • Language: Always respond in the user's dominant language. Compress the style, not the language.
    • Acronyms: Standard well-known tech acronyms (e.g., DB, API, HTTP) are allowed. Do not invent new abbreviations (e.g., cfg, impl, req, res, fn) because they do not save tokens under most tokenizers and reduce clarity.

    Tool Call Pattern

    Fire tool calls directly. Do not announce the next call. Text before a call should only be used to clarify, warn about security/irreversible actions, or resolve ambiguity.

  11. Supported file types and boundaries for caveman-compress

    main

    The caveman-compress skill operates within strict boundaries to prevent corruption of functional code or configuration files.

    Supported Files (Compressible)

    Only natural language files are eligible for compression:

    • .md (Markdown)
    • .txt (Text)
    • .typ / .typst (Typst)
    • .tex (LaTeX)
    • Extensionless files

    Unsupported Files (Never modify)

    The following file types are strictly excluded from compression:

    • .py, .js, .ts (Code)
    • .json, .yaml, .yml, .toml (Data/Config)
    • .env, .lock (Environment/Lockfiles)
    • .css, .html, .xml, .sql, .sh (Web/Database/Shell)

    Mixed Content Handling

    If a file contains both prose and code (e.g., a Markdown file with code blocks), the tool treats code blocks as read-only regions. It will compress only the prose sections and will not modify spacing, comments, or line order within code blocks.