Caveman Learn Token Fixes
JuliusBrussee/caveman
Acts on a Caveman learn report: reviews ranked token sinks, applies cost-lowering edits one at a time with your consent, and reports what each fix returned.
Estimates the per-turn token cost of a project's .claude folder and CLAUDE.md, split into always-loaded, path-scoped and invoked-only files, and flags what runs over budget.
$ npx skills add poshan0126/dotclaude --skill context-budget -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install poshan0126/dotclaude context-budget --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/context-budget .claude/skills/context-budget && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .claude/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/poshan0126/dotclaude/tree/main/skills/context-budgetType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add poshan0126/dotclaude --skill context-budget -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install poshan0126/dotclaude context-budget --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/context-budget .agents/skills/context-budget && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .agents/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add poshan0126/dotclaude --skill context-budget -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install poshan0126/dotclaude context-budget --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/context-budget .cursor/skills/context-budget && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .cursor/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/poshan0126/dotclaude.git --path skills/context-budget--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add poshan0126/dotclaude --skill context-budget -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install poshan0126/dotclaude context-budget --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/context-budget .gemini/skills/context-budget && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .gemini/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install poshan0126/dotclaude context-budgetInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add poshan0126/dotclaude --skill context-budget -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/context-budget .github/skills/context-budget && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .github/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add poshan0126/dotclaude --skill context-budget -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install poshan0126/dotclaude context-budget --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/poshan0126/dotclaude.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/context-budget .opencode/skills/context-budget && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "context-budget" agent skill from https://github.com/poshan0126/dotclaude/tree/main/skills/context-budget into .opencode/skills/context-budget/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "context-budget", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
context-budgetEstimates the per-turn token cost of a project's .claude folder and CLAUDE.md, split into always-loaded, path-scoped and invoked-only files, and flags what runs over budget.
The agent finds CLAUDE.md, the rules, each skill's SKILL.md and the agent files, skipping folder README files that are never loaded. Rules are sorted by their frontmatter: a rule with a `paths` list is path-scoped and loads only near matching files, while a rule without one is always loaded, as is CLAUDE.md. Skills are invoked-only and cost nothing per turn, and agent files run in their own isolated context.
Tokens are counted with a characters-divided-by-four heuristic that the report labels as approximate, or with exact tokenizer counts when `--api` is passed and `ANTHROPIC_API_KEY` is set, falling back to the heuristic otherwise. The report totals each category, names the top three always-loaded contributors, gives a verdict against budget guidance, and ends with the single trim that would save the most tokens if a class is over budget.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 94b84b9. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
jqcurlFrom the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
api.anthropic.comFrom URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
ANTHROPIC_API_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Context Budget Check loads about 1.4k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 434 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from poshan0126/dotclaude at commit 94b84b9, republished under its MIT licence (© poshan0126). 434 words, ~1,350 tokens.
.claude/skills/context-budget/SKILL.md (or your agent's skills folder).Estimate the token cost of this project's .claude/ configuration and CLAUDE.md so the user can see exactly which files load every turn versus only when triggered.
From the project root:
ls CLAUDE.md 2>/dev/null
find .claude/rules -name '*.md' -type f 2>/dev/null
find .claude/skills -name 'SKILL.md' -type f 2>/dev/null
find .claude/agents -name '*.md' -type f 2>/dev/null
[ -f .claude/CLAUDE.md ] && echo "WARN: .claude/CLAUDE.md exists. CLAUDE.md belongs at the project root."Skip any file under .claude/agents/README.md, .claude/rules/README.md, etc. Those are folder descriptions, not loaded by Claude Code at runtime.
For every .md file in .claude/rules/, read the YAML frontmatter (the block between the first two --- lines).
| Frontmatter contains | Classification | Per-turn cost |
|---|---|---|
paths: [...] | Path-scoped | Loaded only when working near matched files |
No paths: (or no frontmatter) | Always-loaded | Every turn |
Other categories:
./CLAUDE.md -> always-loaded (by definition)..claude/skills/<name>/SKILL.md -> invoked-only (zero per-turn cost; only loads when the user runs /skill-name or, if disable-model-invocation is unset, when Claude auto-triggers it)..claude/agents/<name>.md -> invoked-only and runs in isolated context (per-invocation cost in its own session, not per-turn cost in the main thread).Default mode (no API call): chars-based heuristic. Anthropic documents that English text averages roughly 4 characters per token. Compute:
chars=$(wc -c < "$FILE" | tr -d ' ')
tokens=$((chars / 4))Note this in the report so the user knows the count is approximate (within roughly 10 to 15 percent of the exact count for typical config text).
--api mode: if $ARGUMENTS contains --api:
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "ERROR: --api requested but ANTHROPIC_API_KEY is not set. Falling back to heuristic."
else
CONTENT=$(jq -Rs . < "$FILE")
tokens=$(curl -s https://api.anthropic.com/v1/messages/count_tokens \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d "{\"model\":\"claude-sonnet-4-6\",\"messages\":[{\"role\":\"user\",\"content\":$CONTENT}]}" \
| jq -r '.input_tokens')
fiThe endpoint returns Anthropic's exact tokenizer count. That is the factual number Claude Code itself would see when loading the file.
Sum tokens within each category, identify the top 3 contributors among always-loaded files, then print:
Context budget for <project root>
Method: heuristic (chars/4) [or: Anthropic count_tokens API]
Always-loaded (every turn): ~N tokens
CLAUDE.md ~N tokens
.claude/rules/code-quality.md (always) ~N tokens
.claude/rules/testing.md (always) ~N tokens
Path-scoped (loaded near matched files): ~N tokens (max, if every glob matches)
.claude/rules/security.md (paths: src/api/**, ...) ~N tokens
.claude/rules/frontend.md (paths: **/*.tsx, ...) ~N tokens
Invoked-only (zero per-turn cost):
Cumulative size if every skill and agent loaded once: ~N tokens
.claude/skills/<name>/SKILL.md ~N tokens
.claude/agents/<name>.md ~N tokens
Top 3 always-loaded contributors:
1. <file> ~N tokens
2. <file> ~N tokens
3. <file> ~N tokens
Verdict: PASS / NEAR LIMIT / OVER BUDGETEnd the report with the highest-leverage trim recommendation if any class is over budget.
| Class | Target | Hard cap | Action when over |
|---|---|---|---|
CLAUDE.md | <25 non-blank lines | <50 non-blank lines | Trim per Phase 4 of /setupdotclaude. |
| Each always-loaded rule | <30 lines, ~250 tok | n/a | Push content to a path-scoped rule or into an agent. |
| Total always-loaded | <1000 tokens | <1500 tokens | Identify the single biggest contributor and trim it. |
--api (requires $ANTHROPIC_API_KEY) for the exact count from Anthropic's tokenizer.disable-model-invocation: true, meaning they only fire on /name.© poshan0126, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/context-budget of poshan0126/dotclaude.
Open the folder on GitHubat commit 94b84b9
Context Budget Check next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Context Budget Check this skillposhan0126/dotclaude | 870 | — | ~1.4k | Automated safety check: Pass | MIT | |
| Caveman Learn Token FixesJuliusBrussee/caveman | 111k | — | ~2.8k | Automated safety check: Pass | Apache-2.0 | |
| Claude Code Cost Optimizermergisi/awesome-openclaw-agents | 4k | — | ~1.1k | Automated safety check: Pass | MIT | |
| Caveman Memory File CompressorJuliusBrussee/caveman-code | 942 | — | ~1.2k | Automated safety check: Pass | MIT | |
| Claude Code Masteryborghei/Claude-Skills | 891 | — | ~1.9k | Automated safety check: Pass | MIT | |
| Context Mode Output Sandboxmksglu/context-mode | 26k | — | ~4.1k | Automated safety check: Pass | Custom licence |
JuliusBrussee/caveman
Acts on a Caveman learn report: reviews ranked token sinks, applies cost-lowering edits one at a time with your consent, and reports what each fix returned.
mergisi/awesome-openclaw-agents
Audits a project's Claude Code setup for common token-cost leaks and returns a prioritized fix list, using only static inspection of files and settings.
JuliusBrussee/caveman-code
Rewrites a memory file such as CLAUDE.md or a todo list in terse caveman-style text to cut input tokens, saving a readable backup outside the project tree.
borghei/Claude-Skills
A skill your agent uses when the user asks to "optimize CLAUDE.md", "create a new skill", "write a custom agent", "configure hooks", "manage context window", "set up MCP servers", "scaffold a skill…
mksglu/context-mode
Routes large command, file, API and browser output through context-mode tools so only the needed result enters the agent's context, instead of dumping it via Bash.
mksglu/context-mode
Routing rules for using context-mode MCP tools in Antigravity CLI: sandboxed code runs, file analysis, indexed search and web fetches that keep large output out of the conversation.
poshan0126/dotclaude
Rebuilds working context after /clear by reading a handoff note and the branch's git state, or writes that handoff note before a session ends.
poshan0126/dotclaude
Builds a quick mental model of an unfamiliar codebase by dispatching read-only Explore subagents and merging their findings into one brief.
poshan0126/dotclaude
Reviews a pull request, staged changes or a file by sending the diff to specialist reviewer agents in parallel, then merges their findings into one compact report.
poshan0126/dotclaude
Scans a codebase, interviews you, and installs only the justified Claude Code rules, hooks, agents and skills, tailored to the project's stack.
poshan0126/dotclaude
Walks through commit, push and pull request creation for the current changes, asking you to confirm the files, message, push and PR text at each step.
poshan0126/dotclaude
Interviews you about scope, behavior, edge cases and verification, then writes a self-contained SPEC.md that a fresh session can implement without this conversation.
Categories
Estimates the per-turn token cost of a project's .claude folder and CLAUDE.md, split into always-loaded, path-scoped and invoked-only files, and flags what runs over budget. md and the agent files, skipping folder README files that are never loaded.md.
Context Budget Check fits situations like: finding out which config files cost tokens on every turn; deciding what to trim from CLAUDE.md or always-loaded rules; getting exact token counts for a project's agent configuration.
Run `npx skills add poshan0126/dotclaude --skill context-budget -a claude-code`. Or copy the skill folder (skills/context-budget in poshan0126/dotclaude) into .claude/skills/context-budget in your project. Claude Code loads it when a task matches its description.
Run `npx skills add poshan0126/dotclaude --skill context-budget -a codex`. Or copy the skill folder (skills/context-budget in poshan0126/dotclaude) into .agents/skills/context-budget in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add poshan0126/dotclaude --skill context-budget -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/context-budget, .gemini/skills/context-budget, .github/skills/context-budget and .opencode/skills/context-budget in your project.
Going by SKILL.md and its folder, Context Budget Check needs the command-line tools its instructions call (jq and curl) and credentials named ANTHROPIC_API_KEY. Our summary lists: A project with a .claude folder or a CLAUDE.md; ANTHROPIC_API_KEY, only for exact counts with --api.
SKILL.md names 1 domain. In commands or code: api.anthropic.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Context Budget Check is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.4k tokens (SKILL.md is roughly 5.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Context Budget Check: Caveman Learn Token Fixes (JuliusBrussee/caveman, 111k stars), Claude Code Cost Optimizer (mergisi/awesome-openclaw-agents, 4k stars), Caveman Memory File Compressor (JuliusBrussee/caveman-code, 942 stars) and Claude Code Mastery (borghei/Claude-Skills, 891 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
poshan0126 (a GitHub user) maintains it in poshan0126/dotclaude, which has 870 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on August 27, 2026.
Source: poshan0126/dotclaude on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.