[{"data":1,"prerenderedAt":1403},["ShallowReactive",2],{"blog-post-reduce-claude-code-token-usage":3,"related-posts-reduce-claude-code-token-usage":1379,"decoder-links-reduce-claude-code-token-usage":1401,"hero-size-reduce-claude-code-token-usage":1402},{"id":4,"title":5,"author":6,"body":11,"category":1351,"date":1352,"definedTerm":1353,"description":1354,"extension":1355,"featured":1356,"hideToc":1356,"image":1357,"imageAlt":1358,"imageHeight":1359,"imageWidth":1360,"itemList":1353,"lang":1353,"lead":1353,"meta":1361,"navigation":785,"noindex":1356,"path":1362,"primaryHub":1353,"readingTime":1363,"redirected":1356,"relatedSlugs":1353,"seo":1364,"seoTitle":1365,"stem":1366,"subtitle":1367,"tags":1368,"updatedDate":1352,"__hash__":1378},"blog/blog/reduce-claude-code-token-usage.md","How to Reduce Claude Code Token Usage (No Plugins Needed, 2026)",{"name":7,"role":8,"avatar":9,"bio":10},"Shabnam Katoch","Growth Head","/img/avatars/shabnam-profile.jpeg","Shabnam leads growth at BetterClaw and has spent the past three years building organic distribution for AI-native products. She writes about no-code agent builders, content strategy, and what it actually takes to grow without an ads budget.",{"type":12,"value":13,"toc":1309},"minimark",[14,18,43,52,57,60,67,72,75,84,88,91,95,98,102,105,113,117,124,127,131,134,140,144,157,167,181,184,187,194,197,201,211,221,277,288,292,295,301,305,308,314,321,325,331,337,348,352,381,388,392,402,481,487,494,498,509,513,516,530,534,537,543,564,568,578,703,718,893,900,904,909,913,916,919,923,937,943,947,957,961,968,975,979,1001,1005,1008,1124,1129,1135,1138,1144,1148,1158,1164,1170,1176,1180,1190,1205,1212,1216,1224,1232,1236,1240,1256,1260,1266,1270,1284,1288,1291,1295,1298,1302,1305],[15,16,17],"p",{},"Claude Code burns tokens because every turn re-sends the conversation plus a fixed baseline of system prompt and tools, thinking bills as output, and after a break longer than the cache lifetime your next message reprocesses everything.",[15,19,20,21,25,26,30,31,34,35,38,39,42],{},"To cut ",[22,23,24],"strong",{},"Claude Code token usage"," without installing anything, check ",[27,28,29],"code",{},"/context"," and ",[27,32,33],{},"/usage",", ",[27,36,37],{},"/clear"," between tasks, lower ",[27,40,41],{},"/effort",", keep CLAUDE.md under 200 lines, trim MCP servers and watch background spend.",[15,44,45,46,51],{},"Checked against Claude Code 2.1.332 (25 Nov 2026) and its docs. For add-ons, see our ",[47,48,50],"a",{"href":49},"/blog/skills-that-reduce-token-usage","skills and plugins that reduce token usage"," guide.",[53,54,56],"h2",{"id":55},"why-does-claude-code-use-so-many-tokens","Why does Claude Code use so many tokens?",[15,58,59],{},"Because you pay for what gets re-sent, not for what you type. Every request carries a fixed baseline of system prompt and tool definitions, the whole conversation so far and every tool result in it. Thinking is billed as output on top, and a break longer than the cache lifetime makes the next request reprocess all of it.",[15,61,62],{},[63,64],"img",{"alt":65,"src":66},"Why Claude Code uses so many tokens: the fixed baseline, re-sent history, thinking billed as output, cache misses after a break and tool output","/img/blog/reduce-claude-code-token-usage-why.jpg",[68,69,71],"h3",{"id":70},"a-fixed-baseline-before-you-type","A fixed baseline before you type",[15,73,74],{},"Before your first prompt, \"CLAUDE.md, auto memory, MCP tool names, and skill descriptions all load into context,\" on top of the system prompt and tools. Systima measured \"roughly 33,000 tokens of system prompt, tool schemas, and injected scaffolding before the prompt even arrived\" (Claude Code 2.1.207, Sonnet 4.5, July 2026).",[15,76,77,78,80,81,83],{},"An XDA Developers writer's fresh session showed 51,400 tokens in ",[27,79,29],{}," (10,700 system prompt, 28,500 system tools, August 2026), and cutting four plugins and auto memory took it to about 41,400. Yours depends on your setup, so run ",[27,82,29],{}," in a fresh session.",[68,85,87],{"id":86},"history-is-re-sent-every-turn","History is re-sent every turn",[15,89,90],{},"\"Claude Code sends your full conversation with every request,\" says the cost guide, and each tool call sends another request carrying its results. Caching makes those re-reads cheaper, not free, so \"a one-line question in a session that has been open all day still draws usage for the whole conversation.\"",[68,92,94],{"id":93},"thinking-is-billed-as-output","Thinking is billed as output",[15,96,97],{},"The cost guide: \"Thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request depending on the model.\" On Opus 5.5, output costs $20 per million tokens against $4 for input. You can't turn thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, so effort (fix 3) is the dial.",[68,99,101],{"id":100},"cache-misses-after-a-break","Cache misses after a break",[15,103,104],{},"The cache lasts five minutes on an API key, cloud provider or usage credits, and an hour for the main conversation on a subscription. After that, \"your first message after a break longer than the cache lifetime misses the cache and reprocesses your full context.\"",[15,106,107,108,112],{},"On Opus 5.5, re-reading a 200,000-token conversation from a warm cache costs about $0.04, while re-caching it cold costs $1.00 to $1.60 (calculated from list prices). Our guide to ",[47,109,111],{"href":110},"/blog/ai-agent-prompt-caching-cost-savings","how prompt caching works and what breaks it"," covers the rules.",[68,114,116],{"id":115},"tool-output-and-subagents","Tool output and subagents",[15,118,119,120,123],{},"Test runs, builds, logs and ",[27,121,122],{},"git"," output land in the conversation and get re-read on every later turn. Subagents keep that bulk out of your main context, but \"The subagent's own requests still draw on your usage.\"",[15,125,126],{},"Usage jumped after a model upgrade? Claude 4.7 and later models use a tokenizer that \"produces approximately 30% more tokens for the same text,\" per Anthropic's pricing page.",[53,128,130],{"id":129},"check-your-claude-code-token-usage-first-usage-context-and-ccusage","Check your Claude Code token usage first: /usage, /context and ccusage",[15,132,133],{},"Measure before you change anything. Two of these tools are built in; the third reads Claude Code's local logs.",[15,135,136],{},[63,137],{"alt":138,"src":139},"Check Claude Code token usage first: /context for the window, /usage for the session and cache, ccusage for daily history","/img/blog/reduce-claude-code-token-usage-check.jpg",[68,141,143],{"id":142},"usage-alias-cost","/usage (alias /cost)",[15,145,146,148,149,152,153,156],{},[27,147,33],{}," (also ",[27,150,151],{},"/cost"," or ",[27,154,155],{},"/stats",") shows the session's tokens by model, split into input, output, cache read and cache write, with an estimated cost at list price. On 2.1.251 or later it adds a Prompt cache (main) line, like this docs example:",[158,159,165],"pre",{"className":160,"code":162,"language":163,"meta":164},[161],"language-text","Prompt cache (main):   14 requests · 91% of input tokens from cache · 2 misses (last 6m 10s ago, 310.2k tokens re-cached) · 1 expected rebuild (compaction or tool-result clearing) · warm (1h TTL, last activity 40s ago)\n","text","",[27,166,162],{"__ignoreMap":164},[15,168,169,170,172,173,176,177,180],{},"On paid Claude plans, ",[27,171,33],{}," also attributes recent usage to skills, subagents, plugins and MCP servers, with recommendation rows such as ",[27,174,175],{},"25%  Trim ~/code/api/CLAUDE.md · 49k tokens per request",". A row's share \"tells you how much of your usage the row applies to, not how much the change saves,\" and on 2.1.305 or later pressing ",[27,178,179],{},"f"," applies the ones it can.",[15,182,183],{},"On a subscription, the dollar figure \"isn't relevant for billing purposes\"; the plan bars are what count.",[68,185,29],{"id":186},"context",[15,188,189,190,193],{},"The commands reference: \"Visualize current context usage as a colored grid. Shows optimization suggestions for context-heavy tools, memory bloat, and capacity warnings.\" It also lists which CLAUDE.md and auto memory files loaded, and ",[27,191,192],{},"/context all"," expands the list.",[15,195,196],{},"A healthy grid at the start of a task is mostly free space; a thick memory band, unused MCP tools or leftovers from an earlier task each map to a fix below.",[68,198,200],{"id":199},"outside-the-session","Outside the session",[15,202,203,206,207,210],{},[27,204,205],{},"/insights"," writes a report on how you work (not a token count) to ",[27,208,209],{},"~/.claude/usage-data/report.html",", and its run counts against your usage. The status line can show context usage all the time, and it \"runs locally and does not consume API tokens.\"",[15,212,213,214,152,217,220],{},"For history across days, ccusage (20.1.2, 25 Nov 2026, MIT, not by Anthropic) reads Claude Code's local logs in ",[27,215,216],{},"~/.config/claude/projects/",[27,218,219],{},"~/.claude/projects/",":",[158,222,226],{"className":223,"code":224,"language":225,"meta":164,"style":164},"language-bash shiki shiki-themes github-light","npx ccusage@latest claude daily   # Claude Code tokens and estimated cost per day\nnpx ccusage@latest session        # usage by session, all detected agents\nnpx ccusage@latest blocks         # Claude Code 5-hour billing windows\n","bash",[27,227,228,251,264],{"__ignoreMap":164},[229,230,233,237,241,244,247],"span",{"class":231,"line":232},"line",1,[229,234,236],{"class":235},"s7eDp","npx",[229,238,240],{"class":239},"sYBdl"," ccusage@latest",[229,242,243],{"class":239}," claude",[229,245,246],{"class":239}," daily",[229,248,250],{"class":249},"sAwPA","   # Claude Code tokens and estimated cost per day\n",[229,252,254,256,258,261],{"class":231,"line":253},2,[229,255,236],{"class":235},[229,257,240],{"class":239},[229,259,260],{"class":239}," session",[229,262,263],{"class":249},"        # usage by session, all detected agents\n",[229,265,267,269,271,274],{"class":231,"line":266},3,[229,268,236],{"class":235},[229,270,240],{"class":239},[229,272,273],{"class":239}," blocks",[229,275,276],{"class":249},"         # Claude Code 5-hour billing windows\n",[15,278,279,280,283,284,287],{},"Its dollars are estimates, and it sends at most one usage ping per UTC day (",[27,281,282],{},"DO_NOT_TRACK=1"," stops it). CodeBurn (",[27,285,286],{},"npx codeburn",", 0.9.28) reads the same kind of files and splits spend by task, tool, model and project. Real spend lives in the Claude Console for API users and in the plan bars for subscribers.",[53,289,291],{"id":290},"_14-built-in-fixes-for-claude-code-token-usage-in-order-of-impact","14 built-in fixes for Claude Code token usage, in order of impact",[15,293,294],{},"Each fix ships with Claude Code and quotes the docs line behind it. The order is our judgement of impact, so if you only optimize one thing, make it the first.",[15,296,297],{},[63,298],{"alt":299,"src":300},"14 built-in fixes for Claude Code token usage, numbered by impact and grouped by session, model, baseline, inputs and agents","/img/blog/reduce-claude-code-token-usage-fixes.jpg",[68,302,304],{"id":303},"_1-clear-between-unrelated-tasks","1. /clear between unrelated tasks",[15,306,307],{},"Start fresh when you switch to unrelated work, because \"Old conversation crowds out the files you need next and costs tokens on every message.\"",[158,309,312],{"className":310,"code":311,"language":163,"meta":164},[161],"/clear auth-refactor\n",[27,313,311],{"__ignoreMap":164},[15,315,316,317,320],{},"The name labels the old conversation in ",[27,318,319],{},"/resume",", so nothing is lost. If the next task needs that history, compact instead.",[68,322,324],{"id":323},"_2-compact-with-a-focus-before-a-long-new-task","2. /compact with a focus before a long new task",[15,326,327,330],{},[27,328,329],{},"/compact"," swaps the history for a summary, and focus instructions decide what the summary keeps:",[158,332,335],{"className":333,"code":334,"language":163,"meta":164},[161],"/compact focus on the auth bug fix\n",[27,336,334],{"__ignoreMap":164},[15,338,339,340,342,343,347],{},"Afterwards Claude Code re-injects the root CLAUDE.md, auto memory and the plan, re-reads up to five recently edited files and restores invoked skills (up to 5,000 tokens each, 25,000 total). Don't spam it: ",[27,341,329],{}," \"reads the conversation it summarizes, so compacting a large context is itself a large request,\" and it resets the cached conversation. Thresholds live in our ",[47,344,346],{"href":345},"/blog/claude-code-auto-compact-settings","Claude Code auto-compact settings guide",".",[68,349,351],{"id":350},"_3-lower-effort-for-routine-work","3. Lower /effort for routine work",[15,353,354,355,358,359,362,363,366,367,30,370,373,374,377,378,380],{},"Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 default to ",[27,356,357],{},"medium"," on a scale from ",[27,360,361],{},"low"," to ",[27,364,365],{},"xhigh",", plus ",[27,368,369],{},"max",[27,371,372],{},"auto",". Use ",[27,375,376],{},"/effort low"," for quick back-and-forth, and don't leave ",[27,379,369],{}," on: it \"may show diminishing returns and is prone to overthinking.\"",[15,382,383,384,387],{},"Set it at the start: \"Pick your model and effort level at the top of a session,\" says the caching guide, because on most models an effort change re-reads the whole conversation with no cache hits. Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1+ keep the cache through an effort change on an API key or subscription (Fable 5.1 only since v2.1.260). For one hard question, use ",[27,385,386],{},"ultrathink"," in that prompt.",[68,389,391],{"id":390},"_4-pick-the-model-per-task","4. Pick the model per task",[15,393,394,395,398,399,347],{},"Opus 5.5 is the default model on paid plans and the API. The cost guide's advice: \"Sonnet handles most coding tasks well and costs less than Opus.\" Switch with ",[27,396,397],{},"/model sonnet",", and give simple subagents ",[27,400,401],{},"model: haiku",[403,404,405,427],"table",{},[406,407,408],"thead",{},[409,410,411,415,418,421,424],"tr",{},[412,413,414],"th",{},"Model",[412,416,417],{},"Input",[412,419,420],{},"Output",[412,422,423],{},"Cache read",[412,425,426],{},"5-minute cache write",[428,429,430,448,465],"tbody",{},[409,431,432,436,439,442,445],{},[433,434,435],"td",{},"Claude Opus 5.5",[433,437,438],{},"$4",[433,440,441],{},"$20",[433,443,444],{},"$0.20",[433,446,447],{},"$5",[409,449,450,453,456,459,462],{},[433,451,452],{},"Claude Sonnet 5.5",[433,454,455],{},"$2",[433,457,458],{},"$10",[433,460,461],{},"$0.10",[433,463,464],{},"$2.50",[409,466,467,470,472,475,478],{},[433,468,469],{},"Claude Haiku 5.5 (prompts up to 100K tokens)",[433,471,461],{},[433,473,474],{},"$0.50",[433,476,477],{},"$0.01",[433,479,480],{},"$0.125",[15,482,483],{},[484,485,486],"em",{},"Anthropic list price per million tokens, 27 Nov 2026.",[15,488,489,490,493],{},"Keep Opus for architecture and multi-step reasoning, and leave ",[27,491,492],{},"/fast"," off unless speed matters: on Opus 5.5 it costs $8 input and $40 output per million.",[68,495,497],{"id":496},"_5-cap-thinking-where-you-can","5. Cap thinking where you can",[15,499,500,501,504,505,508],{},"On a model with a fixed thinking budget, such as Opus 4.6 or Sonnet 4.6 with ",[27,502,503],{},"CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING=1",", set ",[27,506,507],{},"MAX_THINKING_TOKENS=8000",". On current models, \"Adaptive-reasoning models ignore nonzero budgets, so use effort levels there instead,\" which makes fix 3 the lever on Fable, Sonnet 5+, Haiku 5.5 and Opus 4.7+.",[68,510,512],{"id":511},"_6-keep-claudemd-under-200-lines-and-move-workflows-to-skills","6. Keep CLAUDE.md under 200 lines and move workflows to skills",[15,514,515],{},"CLAUDE.md rides along on every request. The cost guide: \"Skills load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller. Aim to keep CLAUDE.md under 200 lines by including only essentials.\"",[15,517,518,519,522,523,525,526,529],{},"Open the files with ",[27,520,521],{},"/memory","; on a paid plan, ",[27,524,33],{}," recommendations can name an oversized file. Splitting the file with ",[27,527,528],{},"@"," imports doesn't help, because imported files \"load together with the CLAUDE.md that imports them.\"",[68,531,533],{"id":532},"_7-trim-mcp-servers-and-rely-on-tool-deferral","7. Trim MCP servers and rely on tool deferral",[15,535,536],{},"Claude Code already defers MCP tools: \"MCP tool definitions are deferred by default, so only tool names and server instructions enter context until Claude uses a specific tool.\" Names still load for every connected server, so disconnect what you don't use:",[158,538,541],{"className":539,"code":540,"language":163,"meta":164},[161],"/mcp disable \u003Cserver-name>\n",[27,542,540],{"__ignoreMap":164},[15,544,545,546,34,549,34,552,30,555,558,559,563],{},"For heavy data, a CLI is lighter still: ",[27,547,548],{},"gh",[27,550,551],{},"aws",[27,553,554],{},"gcloud",[27,556,557],{},"sentry-cli"," \"are still more context-efficient than MCP servers because they don't add any per-tool listing.\" Our comparison of ",[47,560,562],{"href":561},"/blog/agent-skills-vs-mcp","MCP, skills and CLIs"," covers when each one wins.",[68,565,567],{"id":566},"_8-filter-noisy-command-output-with-a-pretooluse-hook","8. Filter noisy command output with a PreToolUse hook",[15,569,570,571,574,575,220],{},"From the docs section \"Offload processing to hooks and skills\": \"Instead of Claude reading a 10,000-line log file to find errors, a hook can grep for ",[27,572,573],{},"ERROR"," and return only matching lines, reducing context from tens of thousands of tokens to hundreds.\" Anthropic's example keeps the last 100 lines of test output. Add this to ",[27,576,577],{},"settings.json",[158,579,583],{"className":580,"code":581,"language":582,"meta":164,"style":164},"language-json shiki shiki-themes github-light","{\n  \"hooks\": {\n    \"PreToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"~/.claude/hooks/filter-test-output.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n","json",[27,584,585,591,600,608,614,629,637,643,656,667,673,679,685,691,697],{"__ignoreMap":164},[229,586,587],{"class":231,"line":232},[229,588,590],{"class":589},"sgsFI","{\n",[229,592,593,597],{"class":231,"line":253},[229,594,596],{"class":595},"sYu0t","  \"hooks\"",[229,598,599],{"class":589},": {\n",[229,601,602,605],{"class":231,"line":266},[229,603,604],{"class":595},"    \"PreToolUse\"",[229,606,607],{"class":589},": [\n",[229,609,611],{"class":231,"line":610},4,[229,612,613],{"class":589},"      {\n",[229,615,617,620,623,626],{"class":231,"line":616},5,[229,618,619],{"class":595},"        \"matcher\"",[229,621,622],{"class":589},": ",[229,624,625],{"class":239},"\"Bash\"",[229,627,628],{"class":589},",\n",[229,630,632,635],{"class":231,"line":631},6,[229,633,634],{"class":595},"        \"hooks\"",[229,636,607],{"class":589},[229,638,640],{"class":231,"line":639},7,[229,641,642],{"class":589},"          {\n",[229,644,646,649,651,654],{"class":231,"line":645},8,[229,647,648],{"class":595},"            \"type\"",[229,650,622],{"class":589},[229,652,653],{"class":239},"\"command\"",[229,655,628],{"class":589},[229,657,659,662,664],{"class":231,"line":658},9,[229,660,661],{"class":595},"            \"command\"",[229,663,622],{"class":589},[229,665,666],{"class":239},"\"~/.claude/hooks/filter-test-output.sh\"\n",[229,668,670],{"class":231,"line":669},10,[229,671,672],{"class":589},"          }\n",[229,674,676],{"class":231,"line":675},11,[229,677,678],{"class":589},"        ]\n",[229,680,682],{"class":231,"line":681},12,[229,683,684],{"class":589},"      }\n",[229,686,688],{"class":231,"line":687},13,[229,689,690],{"class":589},"    ]\n",[229,692,694],{"class":231,"line":693},14,[229,695,696],{"class":589},"  }\n",[229,698,700],{"class":231,"line":699},15,[229,701,702],{"class":589},"}\n",[15,704,705,706,709,710,713,714,717],{},"Save the script as ",[27,707,708],{},"~/.claude/hooks/filter-test-output.sh"," (after ",[27,711,712],{},"mkdir -p ~/.claude/hooks",") and ",[27,715,716],{},"chmod +x"," it:",[158,719,721],{"className":223,"code":720,"language":225,"meta":164,"style":164},"#!/bin/bash\ninput=$(cat)\ncmd=$(echo \"$input\" | jq -r '.tool_input.command')\n\n# If running tests, keep only the last 100 lines\npattern='^(npm test|pytest|go test)( [^;&|\u003C>`$#\\\\[:cntrl:]]*)?$'\nif [[ \"$cmd\" =~ $pattern ]]; then\n  filtered_cmd=\"$cmd 2>&1 | tail -n 100\"\n  echo \"$input\" | jq --arg filtered \"$filtered_cmd\" \\\n    '{hookSpecificOutput: {hookEventName: \"PreToolUse\", updatedInput: (.tool_input + {command: $filtered})}}'\nelse\n  echo \"{}\"\nfi\n",[27,722,723,728,746,781,787,792,802,826,840,871,876,881,888],{"__ignoreMap":164},[229,724,725],{"class":231,"line":232},[229,726,727],{"class":249},"#!/bin/bash\n",[229,729,730,733,737,740,743],{"class":231,"line":253},[229,731,732],{"class":589},"input",[229,734,736],{"class":735},"sD7c4","=",[229,738,739],{"class":589},"$(",[229,741,742],{"class":235},"cat",[229,744,745],{"class":589},")\n",[229,747,748,751,753,755,758,761,764,767,770,773,776,779],{"class":231,"line":266},[229,749,750],{"class":589},"cmd",[229,752,736],{"class":735},[229,754,739],{"class":589},[229,756,757],{"class":595},"echo",[229,759,760],{"class":239}," \"",[229,762,763],{"class":589},"$input",[229,765,766],{"class":239},"\"",[229,768,769],{"class":735}," |",[229,771,772],{"class":235}," jq",[229,774,775],{"class":595}," -r",[229,777,778],{"class":239}," '.tool_input.command'",[229,780,745],{"class":589},[229,782,783],{"class":231,"line":610},[229,784,786],{"emptyLinePlaceholder":785},true,"\n",[229,788,789],{"class":231,"line":616},[229,790,791],{"class":249},"# If running tests, keep only the last 100 lines\n",[229,793,794,797,799],{"class":231,"line":631},[229,795,796],{"class":589},"pattern",[229,798,736],{"class":735},[229,800,801],{"class":239},"'^(npm test|pytest|go test)( [^;&|\u003C>`$#\\\\[:cntrl:]]*)?$'\n",[229,803,804,807,810,812,815,817,820,823],{"class":231,"line":639},[229,805,806],{"class":735},"if",[229,808,809],{"class":589}," [[ ",[229,811,766],{"class":239},[229,813,814],{"class":589},"$cmd",[229,816,766],{"class":239},[229,818,819],{"class":735}," =~",[229,821,822],{"class":589}," $pattern ]]; ",[229,824,825],{"class":735},"then\n",[229,827,828,831,833,835,837],{"class":231,"line":645},[229,829,830],{"class":589},"  filtered_cmd",[229,832,736],{"class":735},[229,834,766],{"class":239},[229,836,814],{"class":589},[229,838,839],{"class":239}," 2>&1 | tail -n 100\"\n",[229,841,842,845,847,849,851,853,855,858,861,863,866,868],{"class":231,"line":658},[229,843,844],{"class":595},"  echo",[229,846,760],{"class":239},[229,848,763],{"class":589},[229,850,766],{"class":239},[229,852,769],{"class":735},[229,854,772],{"class":235},[229,856,857],{"class":595}," --arg",[229,859,860],{"class":239}," filtered",[229,862,760],{"class":239},[229,864,865],{"class":589},"$filtered_cmd",[229,867,766],{"class":239},[229,869,870],{"class":595}," \\\n",[229,872,873],{"class":231,"line":669},[229,874,875],{"class":239},"    '{hookSpecificOutput: {hookEventName: \"PreToolUse\", updatedInput: (.tool_input + {command: $filtered})}}'\n",[229,877,878],{"class":231,"line":675},[229,879,880],{"class":735},"else\n",[229,882,883,885],{"class":231,"line":681},[229,884,844],{"class":595},[229,886,887],{"class":239}," \"{}\"\n",[229,889,890],{"class":231,"line":687},[229,891,892],{"class":735},"fi\n",[15,894,895,896,899],{},"Check that ",[27,897,898],{},"/hooks"," lists it under PreToolUse, and skip it when you need full output to debug. RTK, a third-party CLI filter, automates the same idea for many commands; the guide linked at the top covers how it tested.",[68,901,903],{"id":902},"_9-delegate-verbose-work-to-subagents-but-count-their-cost","9. Delegate verbose work to subagents, but count their cost",[15,905,906,907,347],{},"The cost guide suggests handing test runs and log processing to a subagent \"so the verbose output stays in the subagent's context while only a summary returns to your main conversation.\" The catch: subagents make their own requests, and Systima measured one small task at about 121,000 tokens done directly versus 513,000 fanned out to two subagents (Claude Code 2.1.207, Sonnet 4.5). Give simple subagents ",[27,908,401],{},[68,910,912],{"id":911},"_10-keep-agent-teams-small","10. Keep agent teams small",[15,914,915],{},"Agent teams are experimental and off by default, and the cost guide's warning is stark: \"Agent teams use approximately 7x more tokens than standard sessions when teammates run in plan mode.\"",[15,917,918],{},"Use Sonnet for teammates and keep spawn prompts short, because \"everything in the spawn prompt adds to their context from the start.\" Shut each teammate down when its work is done.",[68,920,922],{"id":921},"_11-turn-off-the-artifact-tool-if-you-never-publish-artifacts","11. Turn off the Artifact tool if you never publish artifacts",[15,924,925,926,929,930,933,934,347],{},"On paid Claude plans, the Artifact tool publishes session output as a private web page. If you never use it, set ",[27,927,928],{},"\"enableArtifact\": false",", turn Artifacts off in ",[27,931,932],{},"/config"," or set ",[27,935,936],{},"CLAUDE_CODE_DISABLE_ARTIFACT=1",[15,938,939,940,942],{},"The docs don't publish the tool's token size, so compare ",[27,941,29],{}," with it on and off. They do note that \"a styled page is more token-intensive than the same content as terminal text.\"",[68,944,946],{"id":945},"_12-use-file-and-specific-prompts","12. Use @file and specific prompts",[15,948,949,950,952,953,956],{},"From the docs section \"Write specific prompts\": \"Vague requests like 'improve this codebase' trigger broad scanning.\" An ",[27,951,528],{}," mention such as ",[27,954,955],{},"@src/auth.ts"," puts that file in context directly (up to the Read tool's 25,000-token default), so Claude skips the search. Leave it out when you don't know the file yet.",[68,958,960],{"id":959},"_13-convert-heavy-inputs-to-text","13. Convert heavy inputs to text",[15,962,963,964,967],{},"Images and PDFs cost more than their text. Claude Code's tools reference says \"Claude reads short ",[27,965,966],{},".pdf"," files whole,\" and Anthropic's PDF guide puts each page at 1,500 to 3,000 text tokens plus a page image of up to 1,568 visual tokens. Through the API, a 1920x1080 screenshot costs 2,691 visual tokens on Claude 4.7 and later.",[15,969,970,971,974],{},"When you only need the words, convert first (",[27,972,973],{},"pdftotext report.pdf report.txt"," ships with poppler-utils, which Claude Code needs for page ranges anyway), paste error text instead of screenshots and trim logs to the failure. Keep images when the layout or a chart is the point.",[68,976,978],{"id":977},"_14-correct-the-window-for-gateway-or-custom-model-ids","14. Correct the window for gateway or custom model IDs",[15,980,981,982,985,986,989,990,933,993,996,997,1000],{},"Behind an LLM gateway, a warning such as ",[27,983,984],{},"⚠ Model \"my-gateway-opus\" isn't recognized · context assumed to be 1m tokens"," means Claude Code is guessing the window and compacting to fit it. If the guess is right, \"there is nothing to correct\"; otherwise run ",[27,987,988],{},"claude update",", map the ID with ",[27,991,992],{},"modelOverrides",[27,994,995],{},"CLAUDE_CODE_MAX_CONTEXT_TOKENS",". A gateway that rejects requests above 200K needs ",[27,998,999],{},"CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000"," (see the auto-compact guide in fix 2).",[53,1002,1004],{"id":1003},"background-token-usage-what-claude-code-spends-while-youre-idle","Background token usage: what Claude Code spends while you're idle",[15,1006,1007],{},"The cost guide's section of that name warns: \"A session that has been open for hours can use far more of your plan limits than your activity suggests.\"",[403,1009,1010,1023],{},[406,1011,1012],{},[409,1013,1014,1017,1020],{},[412,1015,1016],{},"What runs while you're idle",[412,1018,1019],{},"When",[412,1021,1022],{},"How to turn it off",[428,1024,1025,1037,1051,1067,1084,1097,1110],{},[409,1026,1027,1030,1033],{},[433,1028,1029],{},"Session recap",[433,1031,1032],{},"3 minutes after the last turn, terminal unfocused, 3+ turns",[433,1034,1035],{},[27,1036,932],{},[409,1038,1039,1042,1045],{},[433,1040,1041],{},"Idle compaction",[433,1043,1044],{},"About an hour idle, one-hour cache, 200,000+ tokens",[433,1046,1047,1050],{},[27,1048,1049],{},"\"idleCompaction\": false"," (v2.1.290+)",[409,1052,1053,1056,1059],{},[433,1054,1055],{},"Prompt suggestions",[433,1057,1058],{},"A short request after each reply, mostly cache reads",[433,1060,1061,1063,1064],{},[27,1062,932],{},", or ",[27,1065,1066],{},"CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false",[409,1068,1069,1075,1078],{},[433,1070,1071,1072],{},"Scheduled tasks, including ",[27,1073,1074],{},"/loop",[433,1076,1077],{},"Every interval, full context, up to 30 days",[433,1079,1080,1083],{},[27,1081,1082],{},"Esc"," stops a self-paced loop; ask Claude to cancel others",[409,1085,1086,1089,1092],{},[433,1087,1088],{},"Cross-session messages",[433,1090,1091],{},"A new turn when another session messages this one",[433,1093,1094],{},[27,1095,1096],{},"\"crossSessionInbound\": \"hold\"",[409,1098,1099,1102,1105],{},[433,1100,1101],{},"Goal check-ins",[433,1103,1104],{},"After 30 minutes of background work, 3 at most per goal",[433,1106,1107],{},[27,1108,1109],{},"CLAUDE_CODE_GOAL_CHECKIN_MINUTES=0",[409,1111,1112,1115,1118],{},[433,1113,1114],{},"Background subagents and workflows",[433,1116,1117],{},"Until each one exits",[433,1119,1120,1123],{},[27,1121,1122],{},"/tasks"," to see and stop them",[15,1125,1126],{},[484,1127,1128],{},"Checked on 2.1.332.",[15,1130,1131,1132,1134],{},"Idle compaction is usually worth keeping, since \"Your next message then sends a summary instead of the whole conversation.\" Goal check-ins were capped only in v2.1.246, and since 2.1.330 (20 Nov 2026) recurring tasks last 30 days, not 7; the Loops rows in ",[27,1133,33],{}," rank the heaviest.",[15,1136,1137],{},"The biggest idle cost sends no request at all: once the cache expires, your next message reprocesses everything, so clear or compact before you walk away. On Pro, Max or Ultra, the \"Resume this conversation?\" dialog estimates \"the share of your 5-hour usage limit that the saved conversation alone would use.\"",[15,1139,1140],{},[63,1141],{"alt":1142,"src":1143},"Background token usage in Claude Code: what runs while you're idle, when it fires and the switch that turns it off","/img/blog/reduce-claude-code-token-usage-idle.jpg",[53,1145,1147],{"id":1146},"subagents-and-agent-teams-when-they-cost-more","Subagents and agent teams: when they cost more",[15,1149,1150,1151,1154,1155,347],{},"Subagents pay off when the output is verbose and you only need the summary, or when the work is truly independent. The docs' levers: isolate high-volume work, pick a smaller model per subagent, or put them all on one model with ",[27,1152,1153],{},"CLAUDE_CODE_SUBAGENT_MODEL"," plus ",[27,1156,1157],{},"CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1",[15,1159,1160,1161,1163],{},"Watch the default. Since Claude Code 2.1.198 (1 July 2026), the built-in Explore subagent runs on your session's model instead of Haiku, and a project subagent named Explore with ",[27,1162,401],{}," takes its place. Systima's follow-up found fan-outs using 2.6x to 5.9x the input tokens of sequential work across three model families, and they weren't faster on any task it timed (through a local gateway, on small samples).",[15,1165,1166],{},[63,1167],{"alt":1168,"src":1169},"Subagents and agent teams in Claude Code: one task at 121,000 tokens done directly and 513,000 with two subagents, 2.6x to 5.9x in a follow-up, about 7x for agent teams","/img/blog/reduce-claude-code-token-usage-subagents.jpg",[15,1171,1172,1173,1175],{},"Agent teams sit at about 7x in plan mode (fix 10), and on a paid Claude plan the ",[27,1174,33],{}," attribution breakdown shows the subagent share.",[53,1177,1179],{"id":1178},"api-billing-vs-subscription-what-usage-means-for-you","API billing vs subscription: what \"usage\" means for you",[15,1181,1182,1183,1185,1186,1189],{},"\"Claude Code charges by API token consumption,\" the cost guide begins, but where that lands depends on how you sign in. On paid Claude plans, tokens count against limits that reset over a rolling five-hour window and a weekly one, shown as bars in ",[27,1184,33],{},". Past them, usage credits keep you working, and ",[27,1187,1188],{},"/usage-credits"," manages them.",[15,1191,1192,1193,1196,1197,1199,1200,1204],{},"On an API key, the Claude Console's Cost page shows real spend, and organizations can set workspace spend limits; if you pay contracted rates, an admin can set the ",[27,1194,1195],{},"modelPricing"," managed setting (v2.1.242+) so ",[27,1198,33],{}," and the status line match your bill. Comparing agents on price? Our ",[47,1201,1203],{"href":1202},"/blog/codex-vs-claude-code","Codex vs Claude Code comparison"," puts usage limits and plans side by side.",[15,1206,1207,1208,347],{},"Every BetterClaw plan is bring-your-own-key with zero markup on model inference, so for agents you run there, you pay your provider's token prices directly. ",[47,1209,1211],{"href":1210},"/pricing","See plans",[53,1213,1215],{"id":1214},"when-a-plugin-or-skill-is-worth-adding","When a plugin or skill is worth adding",[15,1217,1218,1219,30,1221,1223],{},"Add one only when ",[27,1220,29],{},[27,1222,33],{}," still show one layer dominating after the built-ins. Anthropic recommends one kind itself, code intelligence plugins for typed languages, because \"A single 'go to definition' call replaces what might otherwise be a grep followed by reading multiple candidate files.\" For the rest, such as Caveman (4.2.0) for shorter replies or RTK (1.2.1) for filtered command output, see what independent tests found in the guide linked at the top.",[15,1225,1226,1227,1231],{},"Not every job needs a Claude Code session, though. If your tokens go on recurring work such as a morning report or inbox triage, BetterClaw runs it as a hosted agent on a schedule you set. ",[47,1228,1230],{"href":1229},"/free-plan","Start free"," with 1 agent and 100 credits a month.",[53,1233,1235],{"id":1234},"frequently-asked-questions","Frequently Asked Questions",[68,1237,1239],{"id":1238},"how-do-i-check-how-many-tokens-claude-code-is-using","How do I check how many tokens Claude Code is using?",[15,1241,1242,1243,1245,1246,1248,1249,1251,1252,1255],{},"Run ",[27,1244,33],{}," (alias ",[27,1247,151],{},") for the session's tokens by model and cache, plus attribution and recommendations on paid Claude plans. Run ",[27,1250,29],{}," to see what fills the window right now, and add context usage to your status line. For daily history from local logs, run ",[27,1253,1254],{},"npx ccusage@latest","; its dollar figures are estimates.",[68,1257,1259],{"id":1258},"why-is-claude-code-burning-through-tokens-so-fast","Why is Claude Code burning through tokens so fast?",[15,1261,1262,1263,1265],{},"Five drivers: a fixed baseline of system prompt and tool definitions (about 33,000 tokens in Systima's test), the whole conversation re-sent every turn, thinking billed as output, cache misses after a break, and tool output plus subagents that send their own requests. Background work such as ",[27,1264,1074],{}," tasks can also spend while you're idle.",[68,1267,1269],{"id":1268},"does-compact-or-clear-save-more-tokens","Does /compact or /clear save more tokens?",[15,1271,1272,1274,1275,1277,1278,1280,1281,1283],{},[27,1273,37],{}," saves more: it costs nothing, and the next task starts from the baseline alone. ",[27,1276,329],{}," keeps a summary so you can carry on, but writing it means reading the whole conversation, one large request plus a cache rebuild. Use ",[27,1279,37],{}," between unrelated tasks and ",[27,1282,329],{}," with a focus when you need the thread.",[68,1285,1287],{"id":1286},"does-claude-code-charge-per-token","Does Claude Code charge per token?",[15,1289,1290],{},"On an API key or a cloud provider, yes: you pay each model's per-token price, such as $4 input and $20 output per million tokens on Opus 5.5. On paid Claude plans, the same tokens count against your plan's five-hour and weekly limits instead, and usage credits cover work beyond them.",[68,1292,1294],{"id":1293},"is-200k-tokens-a-lot-for-claude-code","Is 200k tokens a lot for Claude Code?",[15,1296,1297],{},"It's the whole window on models such as Haiku 4.5, while Opus 4.7+, Sonnet 5+, Haiku 5.5 and Fable run with 1M tokens by default. A fresh session spends tens of thousands on its baseline, and Anthropic says accuracy degrades as context grows. On Opus 5.5, re-reading 200K tokens costs about $0.04 warm and $1.00 to $1.60 to re-cache (calculated).",[68,1299,1301],{"id":1300},"do-claude-code-skills-reduce-token-usage","Do Claude Code skills reduce token usage?",[15,1303,1304],{},"Three kinds can: workflow skills that replace long CLAUDE.md sections, since skills load only when invoked; a codebase-overview skill that saves Claude from exploring; and output-trimming skills such as Caveman, which independent tests found save less than claimed. Every other skill costs tokens, because each one in the skill listing adds to your context on every turn.",[1306,1307,1308],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}",{"title":164,"searchDepth":253,"depth":253,"links":1310},[1311,1318,1323,1339,1340,1341,1342,1343],{"id":55,"depth":253,"text":56,"children":1312},[1313,1314,1315,1316,1317],{"id":70,"depth":266,"text":71},{"id":86,"depth":266,"text":87},{"id":93,"depth":266,"text":94},{"id":100,"depth":266,"text":101},{"id":115,"depth":266,"text":116},{"id":129,"depth":253,"text":130,"children":1319},[1320,1321,1322],{"id":142,"depth":266,"text":143},{"id":186,"depth":266,"text":29},{"id":199,"depth":266,"text":200},{"id":290,"depth":253,"text":291,"children":1324},[1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338],{"id":303,"depth":266,"text":304},{"id":323,"depth":266,"text":324},{"id":350,"depth":266,"text":351},{"id":390,"depth":266,"text":391},{"id":496,"depth":266,"text":497},{"id":511,"depth":266,"text":512},{"id":532,"depth":266,"text":533},{"id":566,"depth":266,"text":567},{"id":902,"depth":266,"text":903},{"id":911,"depth":266,"text":912},{"id":921,"depth":266,"text":922},{"id":945,"depth":266,"text":946},{"id":959,"depth":266,"text":960},{"id":977,"depth":266,"text":978},{"id":1003,"depth":253,"text":1004},{"id":1146,"depth":253,"text":1147},{"id":1178,"depth":253,"text":1179},{"id":1214,"depth":253,"text":1215},{"id":1234,"depth":253,"text":1235,"children":1344},[1345,1346,1347,1348,1349,1350],{"id":1238,"depth":266,"text":1239},{"id":1258,"depth":266,"text":1259},{"id":1268,"depth":266,"text":1269},{"id":1286,"depth":266,"text":1287},{"id":1293,"depth":266,"text":1294},{"id":1300,"depth":266,"text":1301},"Guides","2026-11-27",null,"Why Claude Code token usage climbs, plus 14 no-plugin fixes: /context, /usage, /clear vs /compact, effort, CLAUDE.md, MCP, idle spend. Checked Nov 2026.","md",false,"/img/blog/reduce-claude-code-token-usage.jpg","Claude Code token usage before the first prompt: an illustrative /context grid, a 33,000 to 51,400 token baseline and the built-in fixes",512,1024,{},"/blog/reduce-claude-code-token-usage","16 min read",{"title":5,"description":1354},"How to Reduce Claude Code Token Usage: 14 Built-in Fixes","blog/reduce-claude-code-token-usage","Why it burns tokens, how to check, and 14 fixes that ship with it.",[1369,1370,1371,1372,1373,1374,1375,1376,1377],"claude code token usage","reduce token usage claude code","how to reduce claude code token usage","why does claude code use so many tokens","claude code tokens","claude code token optimization","how to reduce claude code api costs","claude code /usage","ccusage","hDWirGknx7qGEFNGe8BcEzcd5m44R39jJUEIOaA6U4o",[1380,1387,1394],{"stem":1381,"title":1382,"description":1383,"date":1352,"image":1384,"category":1351,"redirected":1356,"author":1385,"readingTime":1386},"blog/claude-code-context-window","The Claude Code Context Window: How Big It Is, What Fills It, and Compact vs Clear","How big the Claude Code context window is per model (200K or 1M), what fills it, how to read /context, what survives /compact, and when to /clear instead.","/img/blog/claude-code-context-window.jpg",{"name":7,"role":8,"avatar":9,"bio":10},"17 min read",{"stem":1388,"title":1389,"description":1390,"date":1352,"image":1391,"category":1351,"redirected":1356,"author":1392,"readingTime":1393},"blog/codex-reduce-token-usage","Codex Token Usage: How to Check It (CLI, IDE, App) and How to Reduce It","See Codex token usage in /status, /usage, the dashboard and ccusage, then cut it: AGENTS.md, reasoning effort, model_verbosity, compaction, RTK and xcsift.","/img/blog/codex-reduce-token-usage.jpg",{"name":7,"role":8,"avatar":9,"bio":10},"14 min read",{"stem":1395,"title":1396,"description":1397,"date":1352,"image":1398,"category":1351,"redirected":1356,"author":1399,"readingTime":1400},"blog/cursor-token-usage","Cursor Token Usage: How to Check It, Why It Spikes, and How to Reduce It","Where to see Cursor token usage on X Subscription and legacy plans, what cache-read tokens and the context meter mean, why usage spikes, and how to cut it.","/img/blog/cursor-token-usage.jpg",{"name":7,"role":8,"avatar":9,"bio":10},"13 min read",[],{"width":1360,"height":1359},1795783813488]