[{"data":1,"prerenderedAt":2970},["ShallowReactive",2],{"docs:\u002Ftokens":3},{"id":4,"title":5,"accent":6,"body":7,"description":2926,"estReadTime":2927,"extension":2928,"eyebrow":2929,"icon":2930,"intro":2931,"lastUpdated":2931,"meta":2932,"navigation":521,"next":2933,"path":2936,"prev":2937,"review":2931,"seo":2940,"stem":6,"tocItems":2955,"__hash__":2969},"docs\u002Ftokens.md","Token Mastery","tokens",{"type":8,"value":9,"toc":2904},"minimark",[10,14,136,399,862,1238,1358,1623,1843,1947,2474,2746,2900],[11,12,13],"p",{},"Every token Claude reads costs money and eats into the window you have for actual work. The difference between a $40\u002Fday habit and a $400\u002Fday habit is almost never the number of features shipped — it's the amount of waste. This chapter is the whole playbook for getting more done with fewer tokens. Every number in here comes from real sessions; every fix can be applied in under five minutes.",[15,16,19,31,36,109,121,129,133],"docs-section",{"id":17,"title":18},"why","Why Tokens Matter",[11,20,21,22,26,27,30],{},"Tokens are both a ",[23,24,25],"strong",{},"unit of charge"," and a ",[23,28,29],{},"unit of cognition",". You pay per million of them, and Claude's judgment degrades as they accumulate. The economics and the quality problem collapse into one: the leanest session is usually also the sharpest one.",[32,33,35],"h3",{"id":34},"_2026-pricing-at-a-glance","2026 pricing at a glance",[37,38,39,58],"table",{},[40,41,42],"thead",{},[43,44,45,49,52,55],"tr",{},[46,47,48],"th",{},"Model",[46,50,51],{},"Input (per 1M tok)",[46,53,54],{},"Output (per 1M tok)",[46,56,57],{},"Cached read",[59,60,61,78,93],"tbody",{},[43,62,63,69,72,75],{},[64,65,66],"td",{},[23,67,68],{},"Opus 4.7",[64,70,71],{},"$15",[64,73,74],{},"$75",[64,76,77],{},"$1.50",[43,79,80,85,88,90],{},[64,81,82],{},[23,83,84],{},"Sonnet 4.6",[64,86,87],{},"$3",[64,89,71],{},[64,91,92],{},"$0.30",[43,94,95,100,103,106],{},[64,96,97],{},[23,98,99],{},"Haiku 4.5",[64,101,102],{},"$0.80",[64,104,105],{},"$4",[64,107,108],{},"$0.08",[11,110,111,112,116,117,120],{},"One hour of Opus work on a dense codebase can easily touch 2M input tokens — that's $30 before you count output. The same hour on Sonnet with a disciplined ",[113,114,115],"code",{},".gitignore"," and a small ",[113,118,119],{},"permissions.deny"," list is under $6. The rules below close that gap without sacrificing capability.",[122,123,126],"docs-callout",{"title":124,"variant":125},"The compounding tax","warning",[11,127,128],{},"A bloated context doesn't just cost more per turn — it makes Claude worse. A worse Claude writes a bug. The bug triggers rework. The rework burns another 40K tokens. Over the course of a day, a 2× token multiplier from context bloat typically becomes a 3–4× cost multiplier once the rework is counted. Every fix in this chapter compounds.",[32,130,132],{"id":131},"the-70-ceiling","The 70% ceiling",[11,134,135],{},"The context window is 200K, but in practice performance flattens once you cross ~140K (70%) and falls off a cliff near ~160K (80%). Treat 140K as your budget, not 200K. Designing for 140K also leaves headroom when Claude needs to read an unexpected file mid-task.",[15,137,140,143,153,171,267,282,355,368,372,378,382,385],{"id":138,"title":139},"three-fixes","The 3 Fixes That Cut Usage in Half",[11,141,142],{},"Before any clever tuning, get these three right. They are responsible for 80% of the savings on a typical project. Expect 40–60% bill drop on day one.",[32,144,146,147,149,150,152],{"id":145},"fix-1-a-tight-gitignore-plus-permissionsdeny-for-secrets","Fix #1 — A tight ",[113,148,115],{}," (plus ",[113,151,119],{}," for secrets)",[11,154,155,156,159,160,163,164,167,168,170],{},"Without the noise excluded, Claude's first ",[113,157,158],{},"ls"," or ",[113,161,162],{},"Glob"," may pull 100K tokens of ",[113,165,166],{},"node_modules",", lockfiles, and build artifacts. The good news: Claude Code respects your ",[113,169,115],{}," for search-style operations, so if your gitignore is sane, this is already mostly done for free. Five minutes auditing it is the highest-leverage thing you'll do this week.",[172,173,179],"pre",{"className":174,"code":175,"filename":176,"language":177,"meta":178,"style":178},"language-plaintext shiki shiki-themes github-light","node_modules\u002F\nvendor\u002F\n.venv\u002F\ndist\u002F\nbuild\u002F\n.next\u002F\n.nuxt\u002F\n.output\u002F\n.cache\u002F\n*.log\n*.min.js\n*.min.css\n**\u002Fgenerated\u002F\n**\u002F*.snap\n",".gitignore — the token-saving entries","plaintext","",[113,180,181,189,195,201,207,213,219,225,231,237,243,249,255,261],{"__ignoreMap":178},[182,183,186],"span",{"class":184,"line":185},"line",1,[182,187,188],{},"node_modules\u002F\n",[182,190,192],{"class":184,"line":191},2,[182,193,194],{},"vendor\u002F\n",[182,196,198],{"class":184,"line":197},3,[182,199,200],{},".venv\u002F\n",[182,202,204],{"class":184,"line":203},4,[182,205,206],{},"dist\u002F\n",[182,208,210],{"class":184,"line":209},5,[182,211,212],{},"build\u002F\n",[182,214,216],{"class":184,"line":215},6,[182,217,218],{},".next\u002F\n",[182,220,222],{"class":184,"line":221},7,[182,223,224],{},".nuxt\u002F\n",[182,226,228],{"class":184,"line":227},8,[182,229,230],{},".output\u002F\n",[182,232,234],{"class":184,"line":233},9,[182,235,236],{},".cache\u002F\n",[182,238,240],{"class":184,"line":239},10,[182,241,242],{},"*.log\n",[182,244,246],{"class":184,"line":245},11,[182,247,248],{},"*.min.js\n",[182,250,252],{"class":184,"line":251},12,[182,253,254],{},"*.min.css\n",[182,256,258],{"class":184,"line":257},13,[182,259,260],{},"**\u002Fgenerated\u002F\n",[182,262,264],{"class":184,"line":263},14,[182,265,266],{},"**\u002F*.snap\n",[11,268,269,270,274,275,277,278,281],{},"For secrets and sensitive paths that ",[271,272,273],"em",{},"shouldn't"," be gitignored (because they're files you want tracked, or because you want stricter enforcement than gitignore provides), add a ",[113,276,119],{}," block to ",[113,279,280],{},".claude\u002Fsettings.json",":",[172,283,287],{"className":284,"code":285,"filename":280,"language":286,"meta":178,"style":178},"language-json shiki shiki-themes github-light","{\n  \"permissions\": {\n    \"deny\": [\n      \"Read(.\u002F.env)\",\n      \"Read(.\u002F.env.*)\",\n      \"Bash(cat .env*)\",\n      \"Read(.\u002Ffixtures\u002Fcustomer-data\u002F**)\"\n    ]\n  }\n}\n","json",[113,288,289,295,304,312,321,328,335,340,345,350],{"__ignoreMap":178},[182,290,291],{"class":184,"line":185},[182,292,294],{"class":293},"sgsFI","{\n",[182,296,297,301],{"class":184,"line":191},[182,298,300],{"class":299},"sYu0t","  \"permissions\"",[182,302,303],{"class":293},": {\n",[182,305,306,309],{"class":184,"line":197},[182,307,308],{"class":299},"    \"deny\"",[182,310,311],{"class":293},": [\n",[182,313,314,318],{"class":184,"line":203},[182,315,317],{"class":316},"sYBdl","      \"Read(.\u002F.env)\"",[182,319,320],{"class":293},",\n",[182,322,323,326],{"class":184,"line":209},[182,324,325],{"class":316},"      \"Read(.\u002F.env.*)\"",[182,327,320],{"class":293},[182,329,330,333],{"class":184,"line":215},[182,331,332],{"class":316},"      \"Bash(cat .env*)\"",[182,334,320],{"class":293},[182,336,337],{"class":184,"line":221},[182,338,339],{"class":316},"      \"Read(.\u002Ffixtures\u002Fcustomer-data\u002F**)\"\n",[182,341,342],{"class":184,"line":227},[182,343,344],{"class":293},"    ]\n",[182,346,347],{"class":184,"line":233},[182,348,349],{"class":293},"  }\n",[182,351,352],{"class":184,"line":239},[182,353,354],{"class":293},"}\n",[11,356,357,358,363,364,367],{},"See ",[359,360,362],"a",{"href":361},"\u002Ffoundations#hiding-files","Foundations → Hiding Files from Claude"," for the full breakdown — including why ",[113,365,366],{},".claudeignore"," isn't the right answer despite what you'll see in community posts.",[32,369,371],{"id":370},"fix-2-claudemd-under-3k-tokens","Fix #2 — CLAUDE.md under 3K tokens",[11,373,374,377],{},[113,375,376],{},"CLAUDE.md"," loads on every turn. A 10K file costs $0.03 per turn on Sonnet and eats window you need. If you can't say what you want in 3K, point Claude to sibling files it can load on demand (see the Tiered Architecture section below).",[32,379,381],{"id":380},"fix-3-right-size-the-model","Fix #3 — Right-size the model",[11,383,384],{},"Opus is 5× the price of Sonnet and 18× the price of Haiku. Default to Sonnet. Switch to Opus only for architecture, security, and multi-file reasoning. Let Haiku handle subagent grunt work. A simple reroute of \"exploration subagents\" from Sonnet to Haiku typically saves 30% on the bill with no visible loss in quality.",[122,386,389],{"title":387,"variant":388},"The 24-hour test","success",[11,390,391,392,395,396,398],{},"Do these three on a Monday. Look at your ",[113,393,394],{},"\u002Fcost"," output on Friday. You will have saved at least 40%. This is not an aspirational claim — it's a universal outcome. If your bill didn't drop, check your ",[113,397,115],{}," actually covers your stack's build outputs.",[15,400,403,413,441,445,448,496,791,795,805,848],{"id":401,"title":402},"monitor","Monitor Your Usage",[11,404,405,406,408,409,412],{},"You can't fix what you can't see. Claude Code ships three lenses on your usage: ",[113,407,394],{}," (session total), ",[113,410,411],{},"\u002Fcontext"," (what's in the window right now), and the StatusLine (a live display at the bottom of your terminal).",[172,414,418],{"className":415,"code":416,"language":417,"meta":178,"style":178},"language-bash shiki shiki-themes github-light","# In any Claude Code session:\n\u002Fcost       # cumulative tokens and $ for the session\n\u002Fcontext    # per-bucket breakdown: system, tools, CLAUDE.md, conversation, files\n","bash",[113,419,420,426,434],{"__ignoreMap":178},[182,421,422],{"class":184,"line":185},[182,423,425],{"class":424},"sAwPA","# In any Claude Code session:\n",[182,427,428,431],{"class":184,"line":191},[182,429,394],{"class":430},"s7eDp",[182,432,433],{"class":424},"       # cumulative tokens and $ for the session\n",[182,435,436,438],{"class":184,"line":197},[182,437,411],{"class":430},[182,439,440],{"class":424},"    # per-bucket breakdown: system, tools, CLAUDE.md, conversation, files\n",[32,442,444],{"id":443},"always-on-visibility-the-statusline","Always-on visibility: the StatusLine",[11,446,447],{},"Add a statusline script to your settings and you get continuous feedback without typing a command. The version below shows model, session cost, and context percentage.",[172,449,452],{"className":284,"code":450,"filename":451,"language":286,"meta":178,"style":178},"{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"bash ~\u002F.claude\u002Fscripts\u002Fstatusline.sh\"\n  }\n}\n","~\u002F.claude\u002Fsettings.json",[113,453,454,458,465,478,488,492],{"__ignoreMap":178},[182,455,456],{"class":184,"line":185},[182,457,294],{"class":293},[182,459,460,463],{"class":184,"line":191},[182,461,462],{"class":299},"  \"statusLine\"",[182,464,303],{"class":293},[182,466,467,470,473,476],{"class":184,"line":197},[182,468,469],{"class":299},"    \"type\"",[182,471,472],{"class":293},": ",[182,474,475],{"class":316},"\"command\"",[182,477,320],{"class":293},[182,479,480,483,485],{"class":184,"line":203},[182,481,482],{"class":299},"    \"command\"",[182,484,472],{"class":293},[182,486,487],{"class":316},"\"bash ~\u002F.claude\u002Fscripts\u002Fstatusline.sh\"\n",[182,489,490],{"class":184,"line":209},[182,491,349],{"class":293},[182,493,494],{"class":184,"line":215},[182,495,354],{"class":293},[172,497,500],{"className":415,"code":498,"filename":499,"language":417,"meta":178,"style":178},"#!\u002Fusr\u002Fbin\u002Fenv bash\n# Reads JSON on stdin from Claude Code and prints a one-line status.\n# Fields available: .model.display_name, .session.cost_usd, .session.context_used, .session.context_limit\n\ninput=$(cat)\nmodel=$(jq -r \".model.display_name\" \u003C\u003C\u003C \"$input\")\ncost=$(jq -r \".session.cost_usd \u002F\u002F 0\" \u003C\u003C\u003C \"$input\")\nused=$(jq -r \".session.context_used \u002F\u002F 0\" \u003C\u003C\u003C \"$input\")\nlimit=$(jq -r \".session.context_limit \u002F\u002F 200000\" \u003C\u003C\u003C \"$input\")\npct=$(( used * 100 \u002F limit ))\n\ncolor=32   # green\n[ \"$pct\" -ge 70 ] && color=33   # yellow\n[ \"$pct\" -ge 80 ] && color=31   # red\n\nprintf \"\\033[2m%s\\033[0m  \\033[1;%dm%d%% ctx\\033[0m  $%.2f\" \"$model\" \"$color\" \"$pct\" \"$cost\"\n","~\u002F.claude\u002Fscripts\u002Fstatusline.sh",[113,501,502,507,512,517,523,541,573,599,625,651,678,682,695,724,749,754],{"__ignoreMap":178},[182,503,504],{"class":184,"line":185},[182,505,506],{"class":424},"#!\u002Fusr\u002Fbin\u002Fenv bash\n",[182,508,509],{"class":184,"line":191},[182,510,511],{"class":424},"# Reads JSON on stdin from Claude Code and prints a one-line status.\n",[182,513,514],{"class":184,"line":197},[182,515,516],{"class":424},"# Fields available: .model.display_name, .session.cost_usd, .session.context_used, .session.context_limit\n",[182,518,519],{"class":184,"line":203},[182,520,522],{"emptyLinePlaceholder":521},true,"\n",[182,524,525,528,532,535,538],{"class":184,"line":209},[182,526,527],{"class":293},"input",[182,529,531],{"class":530},"sD7c4","=",[182,533,534],{"class":293},"$(",[182,536,537],{"class":430},"cat",[182,539,540],{"class":293},")\n",[182,542,543,546,548,550,553,556,559,562,565,568,571],{"class":184,"line":215},[182,544,545],{"class":293},"model",[182,547,531],{"class":530},[182,549,534],{"class":293},[182,551,552],{"class":430},"jq",[182,554,555],{"class":299}," -r",[182,557,558],{"class":316}," \".model.display_name\"",[182,560,561],{"class":530}," \u003C\u003C\u003C",[182,563,564],{"class":316}," \"",[182,566,567],{"class":293},"$input",[182,569,570],{"class":316},"\"",[182,572,540],{"class":293},[182,574,575,578,580,582,584,586,589,591,593,595,597],{"class":184,"line":221},[182,576,577],{"class":293},"cost",[182,579,531],{"class":530},[182,581,534],{"class":293},[182,583,552],{"class":430},[182,585,555],{"class":299},[182,587,588],{"class":316}," \".session.cost_usd \u002F\u002F 0\"",[182,590,561],{"class":530},[182,592,564],{"class":316},[182,594,567],{"class":293},[182,596,570],{"class":316},[182,598,540],{"class":293},[182,600,601,604,606,608,610,612,615,617,619,621,623],{"class":184,"line":227},[182,602,603],{"class":293},"used",[182,605,531],{"class":530},[182,607,534],{"class":293},[182,609,552],{"class":430},[182,611,555],{"class":299},[182,613,614],{"class":316}," \".session.context_used \u002F\u002F 0\"",[182,616,561],{"class":530},[182,618,564],{"class":316},[182,620,567],{"class":293},[182,622,570],{"class":316},[182,624,540],{"class":293},[182,626,627,630,632,634,636,638,641,643,645,647,649],{"class":184,"line":233},[182,628,629],{"class":293},"limit",[182,631,531],{"class":530},[182,633,534],{"class":293},[182,635,552],{"class":430},[182,637,555],{"class":299},[182,639,640],{"class":316}," \".session.context_limit \u002F\u002F 200000\"",[182,642,561],{"class":530},[182,644,564],{"class":316},[182,646,567],{"class":293},[182,648,570],{"class":316},[182,650,540],{"class":293},[182,652,653,656,658,661,663,666,669,672,675],{"class":184,"line":239},[182,654,655],{"class":293},"pct",[182,657,531],{"class":530},[182,659,660],{"class":293},"$(( ",[182,662,603],{"class":430},[182,664,665],{"class":299}," *",[182,667,668],{"class":299}," 100",[182,670,671],{"class":316}," \u002F",[182,673,674],{"class":316}," limit",[182,676,677],{"class":293}," ))\n",[182,679,680],{"class":184,"line":245},[182,681,522],{"emptyLinePlaceholder":521},[182,683,684,687,689,692],{"class":184,"line":251},[182,685,686],{"class":293},"color",[182,688,531],{"class":530},[182,690,691],{"class":316},"32",[182,693,694],{"class":424},"   # green\n",[182,696,697,700,702,705,707,710,713,716,718,721],{"class":184,"line":257},[182,698,699],{"class":293},"[ ",[182,701,570],{"class":316},[182,703,704],{"class":293},"$pct",[182,706,570],{"class":316},[182,708,709],{"class":530}," -ge",[182,711,712],{"class":299}," 70",[182,714,715],{"class":293}," ] && color",[182,717,531],{"class":530},[182,719,720],{"class":316},"33",[182,722,723],{"class":424},"   # yellow\n",[182,725,726,728,730,732,734,736,739,741,743,746],{"class":184,"line":263},[182,727,699],{"class":293},[182,729,570],{"class":316},[182,731,704],{"class":293},[182,733,570],{"class":316},[182,735,709],{"class":530},[182,737,738],{"class":299}," 80",[182,740,715],{"class":293},[182,742,531],{"class":530},[182,744,745],{"class":316},"31",[182,747,748],{"class":424},"   # red\n",[182,750,752],{"class":184,"line":751},15,[182,753,522],{"emptyLinePlaceholder":521},[182,755,757,760,763,765,768,770,772,775,777,779,781,783,785,788],{"class":184,"line":756},16,[182,758,759],{"class":299},"printf",[182,761,762],{"class":316}," \"\\033[2m%s\\033[0m  \\033[1;%dm%d%% ctx\\033[0m  $%.2f\"",[182,764,564],{"class":316},[182,766,767],{"class":293},"$model",[182,769,570],{"class":316},[182,771,564],{"class":316},[182,773,774],{"class":293},"$color",[182,776,570],{"class":316},[182,778,564],{"class":316},[182,780,704],{"class":293},[182,782,570],{"class":316},[182,784,564],{"class":316},[182,786,787],{"class":293},"$cost",[182,789,790],{"class":316},"\"\n",[32,792,794],{"id":793},"historical-analysis-with-ccusage","Historical analysis with ccusage",[11,796,797,798,804],{},"For week-over-week trends, the community tool ",[359,799,803],{"href":800,"rel":801},"https:\u002F\u002Fgithub.com\u002Fryoppippi\u002Fccusage",[802],"nofollow","ccusage"," reads the transcript logs Claude Code writes on disk and produces a per-session breakdown. Run it as a Friday ritual and you'll quickly find the one session that ate 40% of your week.",[172,806,808],{"className":415,"code":807,"language":417,"meta":178,"style":178},"npx ccusage@latest weekly   # last 7 days, per day\nnpx ccusage@latest session   # current session breakdown\nnpx ccusage@latest project   # per-project roll-up\n",[113,809,810,824,836],{"__ignoreMap":178},[182,811,812,815,818,821],{"class":184,"line":185},[182,813,814],{"class":430},"npx",[182,816,817],{"class":316}," ccusage@latest",[182,819,820],{"class":316}," weekly",[182,822,823],{"class":424},"   # last 7 days, per day\n",[182,825,826,828,830,833],{"class":184,"line":191},[182,827,814],{"class":430},[182,829,817],{"class":316},[182,831,832],{"class":316}," session",[182,834,835],{"class":424},"   # current session breakdown\n",[182,837,838,840,842,845],{"class":184,"line":197},[182,839,814],{"class":430},[182,841,817],{"class":316},[182,843,844],{"class":316}," project",[182,846,847],{"class":424},"   # per-project roll-up\n",[122,849,852],{"title":850,"variant":851},"The 70\u002F80 heuristic","tip",[11,853,854,855,159,858,861],{},"If the StatusLine is showing yellow (70%), wrap up the current task and save any state you need. If it's red (80%), stop immediately — ",[113,856,857],{},"\u002Fcompact",[113,859,860],{},"\u002Fclear",". Continuing past red is always more expensive than restarting.",[15,863,866,872,876,921,1026,1229],{"id":864,"title":865},"diet","CLAUDE.md Diet",[11,867,868,869,871],{},"Every token in ",[113,870,376],{}," is consumed at the start of every turn, forever. A fat CLAUDE.md is the gift that keeps on taking. The goal is a tight, load-bearing file under 3K tokens (~500 lines of prose, much less if you're dense).",[32,873,875],{"id":874},"what-to-delete-today","What to delete today",[877,878,879,897,903,909,915],"ul",{},[880,881,882,885,886,889,890,896],"li",{},[23,883,884],{},"Examples Claude can derive by reading code."," If ",[113,887,888],{},"src\u002Fauth\u002Flogin.ts"," has a good pattern, a one-liner ",[271,891,892,893,895],{},"\"see ",[113,894,888],{}," for the canonical auth flow\""," is worth 30 lines of inlined example.",[880,898,899,902],{},[23,900,901],{},"Architecture diagrams in ASCII."," Keep a one sentence summary, then point to a real doc.",[880,904,905,908],{},[23,906,907],{},"Onboarding fluff."," \"This project is fun and welcoming to contributors\" doesn't help Claude write code.",[880,910,911,914],{},[23,912,913],{},"Sprint state."," \"Currently working on feature X\" stale within a week and misleads Claude for months.",[880,916,917,920],{},[23,918,919],{},"Boilerplate pleasantries."," \"Please be helpful and careful\" — Claude already is.",[172,922,927],{"className":923,"code":924,"filename":925,"language":926,"meta":178,"style":178},"language-markdown shiki shiki-themes github-light","# My Project\n\n## Welcome\n\nThank you for contributing to MyProject! We are an open, friendly team that values collaboration and clean code. Please read these guidelines carefully before making any changes...\n\n## Architecture\n\n[40-line ASCII diagram]\n\n## Authentication flow\n\nStep 1: The user sends a POST request to \u002Flogin with email and password.\nThe server verifies the password hash using bcrypt. If valid, we issue a JWT.\n[200 more lines of narrative]\n\n## Tests\n\n[Every test convention explained with inline example]\n...\n","CLAUDE.md — before (11K tokens)","markdown",[113,928,929,935,939,944,948,953,957,962,966,971,975,980,984,989,994,999,1003,1009,1014,1020],{"__ignoreMap":178},[182,930,931],{"class":184,"line":185},[182,932,934],{"class":933},"surfw","# My Project\n",[182,936,937],{"class":184,"line":191},[182,938,522],{"emptyLinePlaceholder":521},[182,940,941],{"class":184,"line":197},[182,942,943],{"class":933},"## Welcome\n",[182,945,946],{"class":184,"line":203},[182,947,522],{"emptyLinePlaceholder":521},[182,949,950],{"class":184,"line":209},[182,951,952],{"class":293},"Thank you for contributing to MyProject! We are an open, friendly team that values collaboration and clean code. Please read these guidelines carefully before making any changes...\n",[182,954,955],{"class":184,"line":215},[182,956,522],{"emptyLinePlaceholder":521},[182,958,959],{"class":184,"line":221},[182,960,961],{"class":933},"## Architecture\n",[182,963,964],{"class":184,"line":227},[182,965,522],{"emptyLinePlaceholder":521},[182,967,968],{"class":184,"line":233},[182,969,970],{"class":293},"[40-line ASCII diagram]\n",[182,972,973],{"class":184,"line":239},[182,974,522],{"emptyLinePlaceholder":521},[182,976,977],{"class":184,"line":245},[182,978,979],{"class":933},"## Authentication flow\n",[182,981,982],{"class":184,"line":251},[182,983,522],{"emptyLinePlaceholder":521},[182,985,986],{"class":184,"line":257},[182,987,988],{"class":293},"Step 1: The user sends a POST request to \u002Flogin with email and password.\n",[182,990,991],{"class":184,"line":263},[182,992,993],{"class":293},"The server verifies the password hash using bcrypt. If valid, we issue a JWT.\n",[182,995,996],{"class":184,"line":751},[182,997,998],{"class":293},"[200 more lines of narrative]\n",[182,1000,1001],{"class":184,"line":756},[182,1002,522],{"emptyLinePlaceholder":521},[182,1004,1006],{"class":184,"line":1005},17,[182,1007,1008],{"class":933},"## Tests\n",[182,1010,1012],{"class":184,"line":1011},18,[182,1013,522],{"emptyLinePlaceholder":521},[182,1015,1017],{"class":184,"line":1016},19,[182,1018,1019],{"class":293},"[Every test convention explained with inline example]\n",[182,1021,1023],{"class":184,"line":1022},20,[182,1024,1025],{"class":293},"...\n",[172,1027,1030],{"className":923,"code":1028,"filename":1029,"language":926,"meta":178,"style":178},"# MyProject\n\nNode + Fastify + Postgres. Strict TypeScript. pnpm, not npm.\n\n## Conventions\n\n- Errors throw, never return. See `docs\u002Ferrors.md` when touching error handling.\n- Auth is JWT in `src\u002Fauth\u002F`. Read `src\u002Fauth\u002Flogin.ts` for the canonical pattern.\n- Payments is sensitive. Read `docs\u002Fpayments.md` before `src\u002Fpayments\u002F`.\n- Tests colocated: `foo.ts` + `foo.test.ts`. Snapshot tests are forbidden outside `src\u002Frender\u002F`.\n\n## Commands\n\n- `pnpm dev` — local server\n- `pnpm test` — unit + integration\n- `pnpm db:migrate` — apply new migrations\n- `pnpm typecheck` — strict, required before every commit\n\n## Hard rules\n\n- Never import from `internal\u002F*` outside `src\u002Finternal\u002F`.\n- Never disable a test to make CI pass. Mark it skip with a TODO and open an issue.\n","CLAUDE.md — after (1.8K tokens)",[113,1031,1032,1037,1041,1046,1050,1055,1059,1074,1093,1112,1136,1140,1145,1149,1159,1169,1179,1189,1193,1198,1202,1221],{"__ignoreMap":178},[182,1033,1034],{"class":184,"line":185},[182,1035,1036],{"class":933},"# MyProject\n",[182,1038,1039],{"class":184,"line":191},[182,1040,522],{"emptyLinePlaceholder":521},[182,1042,1043],{"class":184,"line":197},[182,1044,1045],{"class":293},"Node + Fastify + Postgres. Strict TypeScript. pnpm, not npm.\n",[182,1047,1048],{"class":184,"line":203},[182,1049,522],{"emptyLinePlaceholder":521},[182,1051,1052],{"class":184,"line":209},[182,1053,1054],{"class":933},"## Conventions\n",[182,1056,1057],{"class":184,"line":215},[182,1058,522],{"emptyLinePlaceholder":521},[182,1060,1061,1065,1068,1071],{"class":184,"line":221},[182,1062,1064],{"class":1063},"sqxcx","-",[182,1066,1067],{"class":293}," Errors throw, never return. See ",[182,1069,1070],{"class":299},"`docs\u002Ferrors.md`",[182,1072,1073],{"class":293}," when touching error handling.\n",[182,1075,1076,1078,1081,1084,1087,1090],{"class":184,"line":227},[182,1077,1064],{"class":1063},[182,1079,1080],{"class":293}," Auth is JWT in ",[182,1082,1083],{"class":299},"`src\u002Fauth\u002F`",[182,1085,1086],{"class":293},". Read ",[182,1088,1089],{"class":299},"`src\u002Fauth\u002Flogin.ts`",[182,1091,1092],{"class":293}," for the canonical pattern.\n",[182,1094,1095,1097,1100,1103,1106,1109],{"class":184,"line":233},[182,1096,1064],{"class":1063},[182,1098,1099],{"class":293}," Payments is sensitive. Read ",[182,1101,1102],{"class":299},"`docs\u002Fpayments.md`",[182,1104,1105],{"class":293}," before ",[182,1107,1108],{"class":299},"`src\u002Fpayments\u002F`",[182,1110,1111],{"class":293},".\n",[182,1113,1114,1116,1119,1122,1125,1128,1131,1134],{"class":184,"line":239},[182,1115,1064],{"class":1063},[182,1117,1118],{"class":293}," Tests colocated: ",[182,1120,1121],{"class":299},"`foo.ts`",[182,1123,1124],{"class":293}," + ",[182,1126,1127],{"class":299},"`foo.test.ts`",[182,1129,1130],{"class":293},". Snapshot tests are forbidden outside ",[182,1132,1133],{"class":299},"`src\u002Frender\u002F`",[182,1135,1111],{"class":293},[182,1137,1138],{"class":184,"line":245},[182,1139,522],{"emptyLinePlaceholder":521},[182,1141,1142],{"class":184,"line":251},[182,1143,1144],{"class":933},"## Commands\n",[182,1146,1147],{"class":184,"line":257},[182,1148,522],{"emptyLinePlaceholder":521},[182,1150,1151,1153,1156],{"class":184,"line":263},[182,1152,1064],{"class":1063},[182,1154,1155],{"class":299}," `pnpm dev`",[182,1157,1158],{"class":293}," — local server\n",[182,1160,1161,1163,1166],{"class":184,"line":751},[182,1162,1064],{"class":1063},[182,1164,1165],{"class":299}," `pnpm test`",[182,1167,1168],{"class":293}," — unit + integration\n",[182,1170,1171,1173,1176],{"class":184,"line":756},[182,1172,1064],{"class":1063},[182,1174,1175],{"class":299}," `pnpm db:migrate`",[182,1177,1178],{"class":293}," — apply new migrations\n",[182,1180,1181,1183,1186],{"class":184,"line":1005},[182,1182,1064],{"class":1063},[182,1184,1185],{"class":299}," `pnpm typecheck`",[182,1187,1188],{"class":293}," — strict, required before every commit\n",[182,1190,1191],{"class":184,"line":1011},[182,1192,522],{"emptyLinePlaceholder":521},[182,1194,1195],{"class":184,"line":1016},[182,1196,1197],{"class":933},"## Hard rules\n",[182,1199,1200],{"class":184,"line":1022},[182,1201,522],{"emptyLinePlaceholder":521},[182,1203,1205,1207,1210,1213,1216,1219],{"class":184,"line":1204},21,[182,1206,1064],{"class":1063},[182,1208,1209],{"class":293}," Never import from ",[182,1211,1212],{"class":299},"`internal\u002F*`",[182,1214,1215],{"class":293}," outside ",[182,1217,1218],{"class":299},"`src\u002Finternal\u002F`",[182,1220,1111],{"class":293},[182,1222,1224,1226],{"class":184,"line":1223},22,[182,1225,1064],{"class":1063},[182,1227,1228],{"class":293}," Never disable a test to make CI pass. Mark it skip with a TODO and open an issue.\n",[122,1230,1232],{"title":1231,"variant":851},"Test the diet",[11,1233,1234,1235,1237],{},"After trimming, start a fresh session and run ",[113,1236,411],{}," immediately. Your CLAUDE.md bucket should be under 2% of the window. If it's not, trim again.",[15,1239,1242,1251,1317,1321,1328,1347],{"id":1240,"title":1241},"tiered","Tiered Architecture",[11,1243,1244,1245,1247,1248,1250],{},"Past about 3K, you can't stay in a single ",[113,1246,376],{}," without pain. The answer isn't a bigger file — it's ",[271,1249,1240],{}," context. A thin root file points to deeper docs that load only when relevant. The frontend engineer never pays for payments docs; the payments engineer never pays for design tokens.",[172,1252,1255],{"className":174,"code":1253,"filename":1254,"language":177,"meta":178,"style":178},"project\u002F\n├── CLAUDE.md             # ~2K tokens — rules and pointers\n├── docs\u002F\n│   ├── errors.md         # loaded when touching error handling\n│   ├── payments.md       # loaded when touching payments\n│   ├── auth.md           # loaded when touching auth\n│   └── db-schema.md      # loaded when writing migrations\n├── .claude\u002F\n│   └── skills\u002F\n│       ├── migrations\u002F   # auto-loaded when user mentions migration\n│       └── feature-flags\u002F\n└── src\u002F...\n","Tiered layout",[113,1256,1257,1262,1267,1272,1277,1282,1287,1292,1297,1302,1307,1312],{"__ignoreMap":178},[182,1258,1259],{"class":184,"line":185},[182,1260,1261],{},"project\u002F\n",[182,1263,1264],{"class":184,"line":191},[182,1265,1266],{},"├── CLAUDE.md             # ~2K tokens — rules and pointers\n",[182,1268,1269],{"class":184,"line":197},[182,1270,1271],{},"├── docs\u002F\n",[182,1273,1274],{"class":184,"line":203},[182,1275,1276],{},"│   ├── errors.md         # loaded when touching error handling\n",[182,1278,1279],{"class":184,"line":209},[182,1280,1281],{},"│   ├── payments.md       # loaded when touching payments\n",[182,1283,1284],{"class":184,"line":215},[182,1285,1286],{},"│   ├── auth.md           # loaded when touching auth\n",[182,1288,1289],{"class":184,"line":221},[182,1290,1291],{},"│   └── db-schema.md      # loaded when writing migrations\n",[182,1293,1294],{"class":184,"line":227},[182,1295,1296],{},"├── .claude\u002F\n",[182,1298,1299],{"class":184,"line":233},[182,1300,1301],{},"│   └── skills\u002F\n",[182,1303,1304],{"class":184,"line":239},[182,1305,1306],{},"│       ├── migrations\u002F   # auto-loaded when user mentions migration\n",[182,1308,1309],{"class":184,"line":245},[182,1310,1311],{},"│       └── feature-flags\u002F\n",[182,1313,1314],{"class":184,"line":251},[182,1315,1316],{},"└── src\u002F...\n",[32,1318,1320],{"id":1319},"pointer-style-that-works","Pointer style that works",[11,1322,1323,1324,1327],{},"Claude will not read a linked doc unless the link is obviously relevant. Vague references (\"see docs\u002F for more info\") fail. Write triggers in the ",[271,1325,1326],{},"same sentence"," as the reference:",[172,1329,1331],{"className":174,"code":1330,"language":177,"meta":178,"style":178},"GOOD: Payments logic is sensitive — read `docs\u002Fpayments.md` before touching any file in `src\u002Fpayments\u002F`.\n\nBAD: We have some docs in the `docs\u002F` folder.\n",[113,1332,1333,1338,1342],{"__ignoreMap":178},[182,1334,1335],{"class":184,"line":185},[182,1336,1337],{},"GOOD: Payments logic is sensitive — read `docs\u002Fpayments.md` before touching any file in `src\u002Fpayments\u002F`.\n",[182,1339,1340],{"class":184,"line":191},[182,1341,522],{"emptyLinePlaceholder":521},[182,1343,1344],{"class":184,"line":197},[182,1345,1346],{},"BAD: We have some docs in the `docs\u002F` folder.\n",[122,1348,1351],{"title":1349,"variant":1350},"Skills are tier 3","info",[11,1352,1353,1354,1357],{},"Skills are the auto-triggered version of this pattern. Where a doc pointer relies on Claude noticing the link, a skill's ",[113,1355,1356],{},"description"," tells the harness exactly when to inject it — zero cost until it triggers. Big domain knowledge (OAuth, CRDT logic, a billing model) belongs in a skill, not a doc.",[15,1359,1362,1371,1427,1436,1444,1613],{"id":1360,"title":1361},"compact","Compact Strategies",[11,1363,1364,1365,1367,1368,1370],{},"Eventually every session fills up. You have three moves: ",[113,1366,857],{},", ",[113,1369,860],{},", and handoff via file. Picking the right one is worth 30% on long sessions.",[37,1372,1373,1386],{},[40,1374,1375],{},[43,1376,1377,1380,1383],{},[46,1378,1379],{},"Command",[46,1381,1382],{},"What it does",[46,1384,1385],{},"Use when",[59,1387,1388,1400,1412],{},[43,1389,1390,1394,1397],{},[64,1391,1392],{},[113,1393,857],{},[64,1395,1396],{},"Summarizes history to ~10K and keeps the session going",[64,1398,1399],{},"Mid-task, you still need the thread",[43,1401,1402,1406,1409],{},[64,1403,1404],{},[113,1405,860],{},[64,1407,1408],{},"Wipes context, restarts fresh (CLAUDE.md still loads)",[64,1410,1411],{},"Between unrelated tasks",[43,1413,1414,1417,1424],{},[64,1415,1416],{},"File handoff",[64,1418,1419,1420,1423],{},"Claude writes ",[113,1421,1422],{},"handoff.md","; next session reads it",[64,1425,1426],{},"Crossing sessions or agents",[32,1428,1430,1431,1433,1434],{"id":1429},"when-compact-beats-clear","When ",[113,1432,857],{}," beats ",[113,1435,860],{},[11,1437,1438,1440,1441,1443],{},[113,1439,857],{}," keeps the goal and the decisions you made. ",[113,1442,860],{}," throws both away. If you're halfway through a feature and you've agreed on a plan, compact. If the last thing was shipped and the next thing is unrelated, clear.",[172,1445,1448],{"className":923,"code":1446,"filename":1447,"language":926,"meta":178,"style":178},"# Feature: rate-limit \u002Flogin\n\n## Decisions made\n\n- Per-IP rate limit at edge middleware (src\u002Fmiddleware\u002Frate-limit.ts).\n- 100 requests\u002Fminute bucket, leaky-bucket algorithm.\n- Backed by Redis; key = `rl:login:\u003Cip>`; TTL 60s.\n\n## Done\n\n- [x] Created rate-limit.ts with the bucket implementation.\n- [x] Wired into src\u002Fapp.ts before auth middleware.\n- [x] Unit tests green for happy path + burst.\n\n## Not done\n\n- [ ] Integration test against real Redis (requires CI container update).\n- [ ] Metrics hook into `metrics\u002Fcounters.ts` — left a TODO at line 42.\n- [ ] Error message could be more helpful; currently just returns 429.\n\n## Traps\n\n- Middleware order matters: rate-limit must be BEFORE auth so unauthed bursts are blocked cheaply.\n- Redis key MUST be IP-scoped, not session-scoped, or a logged-out attacker bypasses it.\n","handoff.md (written by Claude at end of session)",[113,1449,1450,1455,1459,1464,1468,1475,1482,1495,1499,1504,1508,1522,1533,1544,1548,1553,1557,1564,1577,1584,1588,1593,1597,1605],{"__ignoreMap":178},[182,1451,1452],{"class":184,"line":185},[182,1453,1454],{"class":933},"# Feature: rate-limit \u002Flogin\n",[182,1456,1457],{"class":184,"line":191},[182,1458,522],{"emptyLinePlaceholder":521},[182,1460,1461],{"class":184,"line":197},[182,1462,1463],{"class":933},"## Decisions made\n",[182,1465,1466],{"class":184,"line":203},[182,1467,522],{"emptyLinePlaceholder":521},[182,1469,1470,1472],{"class":184,"line":209},[182,1471,1064],{"class":1063},[182,1473,1474],{"class":293}," Per-IP rate limit at edge middleware (src\u002Fmiddleware\u002Frate-limit.ts).\n",[182,1476,1477,1479],{"class":184,"line":215},[182,1478,1064],{"class":1063},[182,1480,1481],{"class":293}," 100 requests\u002Fminute bucket, leaky-bucket algorithm.\n",[182,1483,1484,1486,1489,1492],{"class":184,"line":221},[182,1485,1064],{"class":1063},[182,1487,1488],{"class":293}," Backed by Redis; key = ",[182,1490,1491],{"class":299},"`rl:login:\u003Cip>`",[182,1493,1494],{"class":293},"; TTL 60s.\n",[182,1496,1497],{"class":184,"line":227},[182,1498,522],{"emptyLinePlaceholder":521},[182,1500,1501],{"class":184,"line":233},[182,1502,1503],{"class":933},"## Done\n",[182,1505,1506],{"class":184,"line":239},[182,1507,522],{"emptyLinePlaceholder":521},[182,1509,1510,1512,1515,1519],{"class":184,"line":245},[182,1511,1064],{"class":1063},[182,1513,1514],{"class":293}," [",[182,1516,1518],{"class":1517},"sEuWB","x",[182,1520,1521],{"class":293},"] Created rate-limit.ts with the bucket implementation.\n",[182,1523,1524,1526,1528,1530],{"class":184,"line":251},[182,1525,1064],{"class":1063},[182,1527,1514],{"class":293},[182,1529,1518],{"class":1517},[182,1531,1532],{"class":293},"] Wired into src\u002Fapp.ts before auth middleware.\n",[182,1534,1535,1537,1539,1541],{"class":184,"line":257},[182,1536,1064],{"class":1063},[182,1538,1514],{"class":293},[182,1540,1518],{"class":1517},[182,1542,1543],{"class":293},"] Unit tests green for happy path + burst.\n",[182,1545,1546],{"class":184,"line":263},[182,1547,522],{"emptyLinePlaceholder":521},[182,1549,1550],{"class":184,"line":751},[182,1551,1552],{"class":933},"## Not done\n",[182,1554,1555],{"class":184,"line":756},[182,1556,522],{"emptyLinePlaceholder":521},[182,1558,1559,1561],{"class":184,"line":1005},[182,1560,1064],{"class":1063},[182,1562,1563],{"class":293}," [ ] Integration test against real Redis (requires CI container update).\n",[182,1565,1566,1568,1571,1574],{"class":184,"line":1011},[182,1567,1064],{"class":1063},[182,1569,1570],{"class":293}," [ ] Metrics hook into ",[182,1572,1573],{"class":299},"`metrics\u002Fcounters.ts`",[182,1575,1576],{"class":293}," — left a TODO at line 42.\n",[182,1578,1579,1581],{"class":184,"line":1016},[182,1580,1064],{"class":1063},[182,1582,1583],{"class":293}," [ ] Error message could be more helpful; currently just returns 429.\n",[182,1585,1586],{"class":184,"line":1022},[182,1587,522],{"emptyLinePlaceholder":521},[182,1589,1590],{"class":184,"line":1204},[182,1591,1592],{"class":933},"## Traps\n",[182,1594,1595],{"class":184,"line":1223},[182,1596,522],{"emptyLinePlaceholder":521},[182,1598,1600,1602],{"class":184,"line":1599},23,[182,1601,1064],{"class":1063},[182,1603,1604],{"class":293}," Middleware order matters: rate-limit must be BEFORE auth so unauthed bursts are blocked cheaply.\n",[182,1606,1608,1610],{"class":184,"line":1607},24,[182,1609,1064],{"class":1063},[182,1611,1612],{"class":293}," Redis key MUST be IP-scoped, not session-scoped, or a logged-out attacker bypasses it.\n",[122,1614,1616],{"title":1615,"variant":851},"Ask Claude to write the handoff",[11,1617,1618,1619,1622],{},"The prompt: ",[271,1620,1621],{},"\"Before I close this session, write a handoff.md with decisions made, what's done, what's not, and any traps the next session should know about. Be specific — cite file:line.\""," Ten seconds, permanent continuity.",[15,1624,1627,1630,1685,1689,1692,1732,1736,1739,1782,1833],{"id":1625,"title":1626},"routing","Model Routing",[11,1628,1629],{},"Picking the right model is the cheapest optimization you'll ever do. Knowing when to reach for each tier is worth about 40% on your bill.",[37,1631,1632,1644],{},[40,1633,1634],{},[43,1635,1636,1638,1641],{},[46,1637,48],{},[46,1639,1640],{},"Best for",[46,1642,1643],{},"Don't use for",[59,1645,1646,1659,1672],{},[43,1647,1648,1653,1656],{},[64,1649,1650],{},[23,1651,1652],{},"Opus",[64,1654,1655],{},"Architecture decisions, security review, tough multi-file refactors, ambiguity",[64,1657,1658],{},"Anything a junior could do — Sonnet handles it fine",[43,1660,1661,1666,1669],{},[64,1662,1663],{},[23,1664,1665],{},"Sonnet",[64,1667,1668],{},"Daily implementation, bug fixes, tests, feature work",[64,1670,1671],{},"Novel architecture calls where judgment matters",[43,1673,1674,1679,1682],{},[64,1675,1676],{},[23,1677,1678],{},"Haiku",[64,1680,1681],{},"Fast exploration, lint fixups, simple transformations, subagent grunt work",[64,1683,1684],{},"Anything requiring judgment on tradeoffs",[32,1686,1688],{"id":1687},"the-hybrid-pattern","The hybrid pattern",[11,1690,1691],{},"Plan on Opus, implement on Sonnet. The plan is a few thousand tokens of dense reasoning — Opus is worth it. Implementation is bulk work — Sonnet is five times cheaper and just as capable with a good plan in hand.",[172,1693,1695],{"className":174,"code":1694,"language":177,"meta":178,"style":178},"# Flow\n\u002Fmodel opus        # Plan Mode on\n[plan the feature with Opus]\n\u002Fmodel sonnet      # exit Plan Mode; implement\n[execute with Sonnet]\n\u002Fmodel opus        # if a review is warranted\n[review with Opus]\n",[113,1696,1697,1702,1707,1712,1717,1722,1727],{"__ignoreMap":178},[182,1698,1699],{"class":184,"line":185},[182,1700,1701],{},"# Flow\n",[182,1703,1704],{"class":184,"line":191},[182,1705,1706],{},"\u002Fmodel opus        # Plan Mode on\n",[182,1708,1709],{"class":184,"line":197},[182,1710,1711],{},"[plan the feature with Opus]\n",[182,1713,1714],{"class":184,"line":203},[182,1715,1716],{},"\u002Fmodel sonnet      # exit Plan Mode; implement\n",[182,1718,1719],{"class":184,"line":209},[182,1720,1721],{},"[execute with Sonnet]\n",[182,1723,1724],{"class":184,"line":215},[182,1725,1726],{},"\u002Fmodel opus        # if a review is warranted\n",[182,1728,1729],{"class":184,"line":221},[182,1730,1731],{},"[review with Opus]\n",[32,1733,1735],{"id":1734},"pinning-model-per-command","Pinning model per command",[11,1737,1738],{},"Slash commands can pin a model in their frontmatter. Put the model you want per job directly in the command file, and you never remember to switch:",[172,1740,1743],{"className":923,"code":1741,"filename":1742,"language":926,"meta":178,"style":178},"---\ndescription: Plan a feature in Plan Mode using Opus\nmodel: opus\n---\n\nEnter plan mode. I want a detailed plan before any edits. $ARGUMENTS\n",".claude\u002Fcommands\u002Fplan.md",[113,1744,1745,1750,1760,1769,1773,1777],{"__ignoreMap":178},[182,1746,1747],{"class":184,"line":185},[182,1748,1749],{"class":293},"---\n",[182,1751,1752,1755,1757],{"class":184,"line":191},[182,1753,1356],{"class":1754},"shJU0",[182,1756,472],{"class":293},[182,1758,1759],{"class":316},"Plan a feature in Plan Mode using Opus\n",[182,1761,1762,1764,1766],{"class":184,"line":197},[182,1763,545],{"class":1754},[182,1765,472],{"class":293},[182,1767,1768],{"class":316},"opus\n",[182,1770,1771],{"class":184,"line":203},[182,1772,1749],{"class":293},[182,1774,1775],{"class":184,"line":209},[182,1776,522],{"emptyLinePlaceholder":521},[182,1778,1779],{"class":184,"line":215},[182,1780,1781],{"class":293},"Enter plan mode. I want a detailed plan before any edits. $ARGUMENTS\n",[172,1783,1786],{"className":923,"code":1784,"filename":1785,"language":926,"meta":178,"style":178},"---\ndescription: Fix lint errors quickly — Haiku is plenty\nmodel: haiku\nallowed-tools: Read, Edit, Bash(npm run lint*)\n---\n\nRun the linter, read the errors, and fix them. Do not refactor.\n",".claude\u002Fcommands\u002Ffix-lint.md",[113,1787,1788,1792,1801,1810,1820,1824,1828],{"__ignoreMap":178},[182,1789,1790],{"class":184,"line":185},[182,1791,1749],{"class":293},[182,1793,1794,1796,1798],{"class":184,"line":191},[182,1795,1356],{"class":1754},[182,1797,472],{"class":293},[182,1799,1800],{"class":316},"Fix lint errors quickly — Haiku is plenty\n",[182,1802,1803,1805,1807],{"class":184,"line":197},[182,1804,545],{"class":1754},[182,1806,472],{"class":293},[182,1808,1809],{"class":316},"haiku\n",[182,1811,1812,1815,1817],{"class":184,"line":203},[182,1813,1814],{"class":1754},"allowed-tools",[182,1816,472],{"class":293},[182,1818,1819],{"class":316},"Read, Edit, Bash(npm run lint*)\n",[182,1821,1822],{"class":184,"line":209},[182,1823,1749],{"class":293},[182,1825,1826],{"class":184,"line":215},[182,1827,522],{"emptyLinePlaceholder":521},[182,1829,1830],{"class":184,"line":221},[182,1831,1832],{"class":293},"Run the linter, read the errors, and fix them. Do not refactor.\n",[122,1834,1836],{"title":1835,"variant":851},"Haiku for subagents",[11,1837,1838,1839,1842],{},"A read-only exploration subagent almost always does fine on Haiku. Set ",[113,1840,1841],{},"model: haiku"," in the agent's frontmatter. Save Sonnet for the main session and Opus for architectural calls. This single change often cuts a third off agent-heavy workflows.",[15,1844,1847,1854,1858,1873,1877,1888,1941],{"id":1845,"title":1846},"subagent-econ","Subagent Economics",[11,1848,1849,1850,1853],{},"Subagents feel free — delegation! — but they aren't. Each spawned subagent carries its own system prompt, its own tool definitions, and its own conversation. What's free is ",[23,1851,1852],{},"main-session"," context, not total tokens.",[32,1855,1857],{"id":1856},"when-a-subagent-saves-tokens","When a subagent saves tokens",[877,1859,1860,1867,1870],{},[880,1861,1862,1863,1866],{},"The task needs ",[23,1864,1865],{},"many"," file reads Claude will discard after answering.",[880,1868,1869],{},"The task is repeatable (exploring the same codebase twice is cheaper when a subagent returns a small summary both times).",[880,1871,1872],{},"Multiple subagents can run in parallel, compressing wall-clock time without paying for them sequentially.",[32,1874,1876],{"id":1875},"when-a-subagent-costs-more","When a subagent costs more",[877,1878,1879,1882,1885],{},[880,1880,1881],{},"One-off questions — the overhead of a new context outweighs the benefit.",[880,1883,1884],{},"Small searches (\u003C 5 file reads) — just do it inline.",[880,1886,1887],{},"Tasks needing back-and-forth with the user — subagents can't pause to clarify.",[172,1889,1894],{"className":1890,"code":1891,"filename":1892,"language":1893,"meta":178,"style":178},"language-yaml shiki shiki-themes github-light","---\nname: codebase-explorer\ndescription: Use for broad codebase questions. Cites file:line, never edits.\ntools: Read, Grep, Glob\nmodel: haiku\n---\n","Agent frontmatter — pick the cheapest model that works","yaml",[113,1895,1896,1900,1910,1919,1929,1937],{"__ignoreMap":178},[182,1897,1898],{"class":184,"line":185},[182,1899,1749],{"class":430},[182,1901,1902,1905,1907],{"class":184,"line":191},[182,1903,1904],{"class":1754},"name",[182,1906,472],{"class":293},[182,1908,1909],{"class":316},"codebase-explorer\n",[182,1911,1912,1914,1916],{"class":184,"line":197},[182,1913,1356],{"class":1754},[182,1915,472],{"class":293},[182,1917,1918],{"class":316},"Use for broad codebase questions. Cites file:line, never edits.\n",[182,1920,1921,1924,1926],{"class":184,"line":203},[182,1922,1923],{"class":1754},"tools",[182,1925,472],{"class":293},[182,1927,1928],{"class":316},"Read, Grep, Glob\n",[182,1930,1931,1933,1935],{"class":184,"line":209},[182,1932,545],{"class":1754},[182,1934,472],{"class":293},[182,1936,1809],{"class":316},[182,1938,1939],{"class":184,"line":215},[182,1940,1749],{"class":430},[122,1942,1944],{"title":1943,"variant":1350},"The parallel fan-out pattern",[11,1945,1946],{},"Need three things investigated? Launch three Haiku subagents in one message. They run concurrently — total wall time ≈ the slowest one, total spend ≈ three Haiku sessions (still cheaper than a single Sonnet doing it serially). This is the power move for large codebase audits.",[15,1948,1951,1958,2058,2440,2444,2465],{"id":1949,"title":1950},"hook-output","Hook-Based Output Control",[11,1952,1953,1954,1957],{},"Some tools produce monstrous output. ",[113,1955,1956],{},"npm install"," can dump 2K lines. A full test suite on failure can exceed 10K. Claude will read every token of it and then think with it sitting in the window. A small hook can trim the output to the useful bits.",[172,1959,1961],{"className":284,"code":1960,"filename":280,"language":286,"meta":178,"style":178},"{\n  \"hooks\": {\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          {\n            \"type\": \"command\",\n            \"command\": \"bash .claude\u002Fhooks\u002Ftrim-output.sh\"\n          }\n        ]\n      }\n    ]\n  }\n}\n",[113,1962,1963,1967,1974,1981,1986,1998,2005,2010,2021,2031,2036,2041,2046,2050,2054],{"__ignoreMap":178},[182,1964,1965],{"class":184,"line":185},[182,1966,294],{"class":293},[182,1968,1969,1972],{"class":184,"line":191},[182,1970,1971],{"class":299},"  \"hooks\"",[182,1973,303],{"class":293},[182,1975,1976,1979],{"class":184,"line":197},[182,1977,1978],{"class":299},"    \"PostToolUse\"",[182,1980,311],{"class":293},[182,1982,1983],{"class":184,"line":203},[182,1984,1985],{"class":293},"      {\n",[182,1987,1988,1991,1993,1996],{"class":184,"line":209},[182,1989,1990],{"class":299},"        \"matcher\"",[182,1992,472],{"class":293},[182,1994,1995],{"class":316},"\"Bash\"",[182,1997,320],{"class":293},[182,1999,2000,2003],{"class":184,"line":215},[182,2001,2002],{"class":299},"        \"hooks\"",[182,2004,311],{"class":293},[182,2006,2007],{"class":184,"line":221},[182,2008,2009],{"class":293},"          {\n",[182,2011,2012,2015,2017,2019],{"class":184,"line":227},[182,2013,2014],{"class":299},"            \"type\"",[182,2016,472],{"class":293},[182,2018,475],{"class":316},[182,2020,320],{"class":293},[182,2022,2023,2026,2028],{"class":184,"line":233},[182,2024,2025],{"class":299},"            \"command\"",[182,2027,472],{"class":293},[182,2029,2030],{"class":316},"\"bash .claude\u002Fhooks\u002Ftrim-output.sh\"\n",[182,2032,2033],{"class":184,"line":239},[182,2034,2035],{"class":293},"          }\n",[182,2037,2038],{"class":184,"line":245},[182,2039,2040],{"class":293},"        ]\n",[182,2042,2043],{"class":184,"line":251},[182,2044,2045],{"class":293},"      }\n",[182,2047,2048],{"class":184,"line":257},[182,2049,344],{"class":293},[182,2051,2052],{"class":184,"line":263},[182,2053,349],{"class":293},[182,2055,2056],{"class":184,"line":751},[182,2057,354],{"class":293},[172,2059,2062],{"className":415,"code":2060,"filename":2061,"language":417,"meta":178,"style":178},"#!\u002Fusr\u002Fbin\u002Fenv bash\n# PostToolUse hook: trim overlong Bash output before Claude re-reads it.\n# Reads the tool result on stdin, re-emits a trimmed version on stdout.\n\nset -euo pipefail\n\ninput=$(cat)\noutput=$(jq -r \".tool_output \u002F\u002F empty\" \u003C\u003C\u003C \"$input\")\ncmd=$(jq -r \".tool_input.command \u002F\u002F empty\" \u003C\u003C\u003C \"$input\")\n\n# Commands we intentionally never trim\ncase \"$cmd\" in\n  *\"git diff\"*|*\"git log\"*) echo \"$input\"; exit 0 ;;\nesac\n\n# Over 200 lines? keep first 40 + last 40, summarize the middle\nlines=$(echo \"$output\" | wc -l)\nif [ \"$lines\" -gt 200 ]; then\n  trimmed=$(\n    (echo \"$output\" | head -n 40;\n     echo \"... [$((lines - 80)) lines trimmed by hook] ...\";\n     echo \"$output\" | tail -n 40)\n  )\n  jq --arg out \"$trimmed\" \".tool_output = \\$out\" \u003C\u003C\u003C \"$input\"\nelse\n  echo \"$input\"\nfi\n",".claude\u002Fhooks\u002Ftrim-output.sh",[113,2063,2064,2068,2073,2078,2082,2093,2097,2109,2135,2161,2165,2170,2185,2226,2231,2235,2240,2270,2297,2307,2334,2355,2376,2381,2416,2422,2434],{"__ignoreMap":178},[182,2065,2066],{"class":184,"line":185},[182,2067,506],{"class":424},[182,2069,2070],{"class":184,"line":191},[182,2071,2072],{"class":424},"# PostToolUse hook: trim overlong Bash output before Claude re-reads it.\n",[182,2074,2075],{"class":184,"line":197},[182,2076,2077],{"class":424},"# Reads the tool result on stdin, re-emits a trimmed version on stdout.\n",[182,2079,2080],{"class":184,"line":203},[182,2081,522],{"emptyLinePlaceholder":521},[182,2083,2084,2087,2090],{"class":184,"line":209},[182,2085,2086],{"class":299},"set",[182,2088,2089],{"class":299}," -euo",[182,2091,2092],{"class":316}," pipefail\n",[182,2094,2095],{"class":184,"line":215},[182,2096,522],{"emptyLinePlaceholder":521},[182,2098,2099,2101,2103,2105,2107],{"class":184,"line":221},[182,2100,527],{"class":293},[182,2102,531],{"class":530},[182,2104,534],{"class":293},[182,2106,537],{"class":430},[182,2108,540],{"class":293},[182,2110,2111,2114,2116,2118,2120,2122,2125,2127,2129,2131,2133],{"class":184,"line":227},[182,2112,2113],{"class":293},"output",[182,2115,531],{"class":530},[182,2117,534],{"class":293},[182,2119,552],{"class":430},[182,2121,555],{"class":299},[182,2123,2124],{"class":316}," \".tool_output \u002F\u002F empty\"",[182,2126,561],{"class":530},[182,2128,564],{"class":316},[182,2130,567],{"class":293},[182,2132,570],{"class":316},[182,2134,540],{"class":293},[182,2136,2137,2140,2142,2144,2146,2148,2151,2153,2155,2157,2159],{"class":184,"line":233},[182,2138,2139],{"class":293},"cmd",[182,2141,531],{"class":530},[182,2143,534],{"class":293},[182,2145,552],{"class":430},[182,2147,555],{"class":299},[182,2149,2150],{"class":316}," \".tool_input.command \u002F\u002F empty\"",[182,2152,561],{"class":530},[182,2154,564],{"class":316},[182,2156,567],{"class":293},[182,2158,570],{"class":316},[182,2160,540],{"class":293},[182,2162,2163],{"class":184,"line":239},[182,2164,522],{"emptyLinePlaceholder":521},[182,2166,2167],{"class":184,"line":245},[182,2168,2169],{"class":424},"# Commands we intentionally never trim\n",[182,2171,2172,2175,2177,2180,2182],{"class":184,"line":251},[182,2173,2174],{"class":530},"case",[182,2176,564],{"class":316},[182,2178,2179],{"class":293},"$cmd",[182,2181,570],{"class":316},[182,2183,2184],{"class":530}," in\n",[182,2186,2187,2190,2193,2196,2199,2202,2205,2208,2210,2212,2214,2217,2220,2223],{"class":184,"line":257},[182,2188,2189],{"class":530},"  *",[182,2191,2192],{"class":316},"\"git diff\"",[182,2194,2195],{"class":530},"*|*",[182,2197,2198],{"class":316},"\"git log\"",[182,2200,2201],{"class":530},"*",[182,2203,2204],{"class":530},")",[182,2206,2207],{"class":299}," echo",[182,2209,564],{"class":316},[182,2211,567],{"class":293},[182,2213,570],{"class":316},[182,2215,2216],{"class":293},"; ",[182,2218,2219],{"class":299},"exit",[182,2221,2222],{"class":299}," 0",[182,2224,2225],{"class":293}," ;;\n",[182,2227,2228],{"class":184,"line":263},[182,2229,2230],{"class":530},"esac\n",[182,2232,2233],{"class":184,"line":751},[182,2234,522],{"emptyLinePlaceholder":521},[182,2236,2237],{"class":184,"line":756},[182,2238,2239],{"class":424},"# Over 200 lines? keep first 40 + last 40, summarize the middle\n",[182,2241,2242,2245,2247,2249,2252,2254,2257,2259,2262,2265,2268],{"class":184,"line":1005},[182,2243,2244],{"class":293},"lines",[182,2246,531],{"class":530},[182,2248,534],{"class":293},[182,2250,2251],{"class":299},"echo",[182,2253,564],{"class":316},[182,2255,2256],{"class":293},"$output",[182,2258,570],{"class":316},[182,2260,2261],{"class":530}," |",[182,2263,2264],{"class":430}," wc",[182,2266,2267],{"class":299}," -l",[182,2269,540],{"class":293},[182,2271,2272,2275,2278,2280,2283,2285,2288,2291,2294],{"class":184,"line":1011},[182,2273,2274],{"class":530},"if",[182,2276,2277],{"class":293}," [ ",[182,2279,570],{"class":316},[182,2281,2282],{"class":293},"$lines",[182,2284,570],{"class":316},[182,2286,2287],{"class":530}," -gt",[182,2289,2290],{"class":299}," 200",[182,2292,2293],{"class":293}," ]; ",[182,2295,2296],{"class":530},"then\n",[182,2298,2299,2302,2304],{"class":184,"line":1016},[182,2300,2301],{"class":293},"  trimmed",[182,2303,531],{"class":530},[182,2305,2306],{"class":293},"$(\n",[182,2308,2309,2312,2314,2316,2318,2320,2322,2325,2328,2331],{"class":184,"line":1022},[182,2310,2311],{"class":293},"    (",[182,2313,2251],{"class":299},[182,2315,564],{"class":316},[182,2317,2256],{"class":293},[182,2319,570],{"class":316},[182,2321,2261],{"class":530},[182,2323,2324],{"class":430}," head",[182,2326,2327],{"class":299}," -n",[182,2329,2330],{"class":299}," 40",[182,2332,2333],{"class":293},";\n",[182,2335,2336,2339,2342,2344,2347,2350,2353],{"class":184,"line":1204},[182,2337,2338],{"class":299},"     echo",[182,2340,2341],{"class":316}," \"... [$((",[182,2343,2244],{"class":430},[182,2345,2346],{"class":316}," - ",[182,2348,2349],{"class":299},"80",[182,2351,2352],{"class":316},")) lines trimmed by hook] ...\"",[182,2354,2333],{"class":293},[182,2356,2357,2359,2361,2363,2365,2367,2370,2372,2374],{"class":184,"line":1223},[182,2358,2338],{"class":299},[182,2360,564],{"class":316},[182,2362,2256],{"class":293},[182,2364,570],{"class":316},[182,2366,2261],{"class":530},[182,2368,2369],{"class":430}," tail",[182,2371,2327],{"class":299},[182,2373,2330],{"class":299},[182,2375,540],{"class":293},[182,2377,2378],{"class":184,"line":1599},[182,2379,2380],{"class":293},"  )\n",[182,2382,2383,2386,2389,2392,2394,2397,2399,2402,2405,2408,2410,2412,2414],{"class":184,"line":1607},[182,2384,2385],{"class":430},"  jq",[182,2387,2388],{"class":299}," --arg",[182,2390,2391],{"class":316}," out",[182,2393,564],{"class":316},[182,2395,2396],{"class":293},"$trimmed",[182,2398,570],{"class":316},[182,2400,2401],{"class":316}," \".tool_output = ",[182,2403,2404],{"class":299},"\\$",[182,2406,2407],{"class":316},"out\"",[182,2409,561],{"class":530},[182,2411,564],{"class":316},[182,2413,567],{"class":293},[182,2415,790],{"class":316},[182,2417,2419],{"class":184,"line":2418},25,[182,2420,2421],{"class":530},"else\n",[182,2423,2425,2428,2430,2432],{"class":184,"line":2424},26,[182,2426,2427],{"class":299},"  echo",[182,2429,564],{"class":316},[182,2431,567],{"class":293},[182,2433,790],{"class":316},[182,2435,2437],{"class":184,"line":2436},27,[182,2438,2439],{"class":530},"fi\n",[32,2441,2443],{"id":2442},"silencing-noisy-commands-entirely","Silencing noisy commands entirely",[11,2445,2446,2448,2449,2452,2453,2456,2457,2460,2461,2464],{},[113,2447,1956],{}," progress bars, ",[113,2450,2451],{},"prettier"," output, ",[113,2454,2455],{},"docker pull"," layer lists — you never need Claude to see any of it. A ",[113,2458,2459],{},"PreToolUse"," hook can rewrite such commands to pipe to ",[113,2462,2463],{},"\u002Fdev\u002Fnull"," transparently, saving tens of thousands of tokens a week.",[122,2466,2468],{"title":2467,"variant":851},"Measure before and after",[11,2469,2470,2471,2473],{},"Before installing a trim hook, record a week of ",[113,2472,394],{},". After, another week. On a busy project a well-tuned trim hook saves more than the CLAUDE.md diet — quietly, without you thinking about it.",[15,2475,2478,2481,2485,2504,2715,2719,2725,2729,2736],{"id":2476,"title":2477},"team-cost","Team Cost Management",[11,2479,2480],{},"Individual discipline scales to about five engineers. Past that you need instrumentation: per-user dashboards, budget alerts, and a shared set of defaults that ships the best practices by default.",[32,2482,2484],{"id":2483},"the-shared-defaults-pattern","The shared defaults pattern",[11,2486,2487,2488,2491,2492,2494,2495,2497,2498,2500,2501,2503],{},"Commit a team ",[113,2489,2490],{},"settings.json"," (with a sensible ",[113,2493,119],{}," list), a tight ",[113,2496,115],{},", a short ",[113,2499,376],{},", and the trim hook above. Every engineer on the team inherits the savings without reading this page. Put personal preferences in ",[113,2502,451],{}," — never in the project file.",[172,2505,2508],{"className":284,"code":2506,"filename":2507,"language":286,"meta":178,"style":178},"{\n  \"model\": \"sonnet\",\n  \"permissions\": {\n    \"allow\": [\"Read\", \"Glob\", \"Grep\", \"Bash(pnpm test*)\", \"Bash(git status)\"],\n    \"deny\": [\"Bash(rm -rf*)\", \"Bash(git push --force*)\"]\n  },\n  \"hooks\": {\n    \"PostToolUse\": [\n      {\n        \"matcher\": \"Bash\",\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"bash .claude\u002Fhooks\u002Ftrim-output.sh\" }\n        ]\n      },\n      {\n        \"matcher\": \"Edit|Write\",\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \"bash .claude\u002Fhooks\u002Fformat.sh\" }\n        ]\n      }\n    ]\n  }\n}\n",".claude\u002Fsettings.json (team defaults)",[113,2509,2510,2514,2526,2532,2566,2583,2588,2594,2600,2604,2614,2620,2644,2648,2653,2657,2668,2674,2695,2699,2703,2707,2711],{"__ignoreMap":178},[182,2511,2512],{"class":184,"line":185},[182,2513,294],{"class":293},[182,2515,2516,2519,2521,2524],{"class":184,"line":191},[182,2517,2518],{"class":299},"  \"model\"",[182,2520,472],{"class":293},[182,2522,2523],{"class":316},"\"sonnet\"",[182,2525,320],{"class":293},[182,2527,2528,2530],{"class":184,"line":197},[182,2529,300],{"class":299},[182,2531,303],{"class":293},[182,2533,2534,2537,2540,2543,2545,2548,2550,2553,2555,2558,2560,2563],{"class":184,"line":203},[182,2535,2536],{"class":299},"    \"allow\"",[182,2538,2539],{"class":293},": [",[182,2541,2542],{"class":316},"\"Read\"",[182,2544,1367],{"class":293},[182,2546,2547],{"class":316},"\"Glob\"",[182,2549,1367],{"class":293},[182,2551,2552],{"class":316},"\"Grep\"",[182,2554,1367],{"class":293},[182,2556,2557],{"class":316},"\"Bash(pnpm test*)\"",[182,2559,1367],{"class":293},[182,2561,2562],{"class":316},"\"Bash(git status)\"",[182,2564,2565],{"class":293},"],\n",[182,2567,2568,2570,2572,2575,2577,2580],{"class":184,"line":209},[182,2569,308],{"class":299},[182,2571,2539],{"class":293},[182,2573,2574],{"class":316},"\"Bash(rm -rf*)\"",[182,2576,1367],{"class":293},[182,2578,2579],{"class":316},"\"Bash(git push --force*)\"",[182,2581,2582],{"class":293},"]\n",[182,2584,2585],{"class":184,"line":215},[182,2586,2587],{"class":293},"  },\n",[182,2589,2590,2592],{"class":184,"line":221},[182,2591,1971],{"class":299},[182,2593,303],{"class":293},[182,2595,2596,2598],{"class":184,"line":227},[182,2597,1978],{"class":299},[182,2599,311],{"class":293},[182,2601,2602],{"class":184,"line":233},[182,2603,1985],{"class":293},[182,2605,2606,2608,2610,2612],{"class":184,"line":239},[182,2607,1990],{"class":299},[182,2609,472],{"class":293},[182,2611,1995],{"class":316},[182,2613,320],{"class":293},[182,2615,2616,2618],{"class":184,"line":245},[182,2617,2002],{"class":299},[182,2619,311],{"class":293},[182,2621,2622,2625,2628,2630,2632,2634,2636,2638,2641],{"class":184,"line":251},[182,2623,2624],{"class":293},"          { ",[182,2626,2627],{"class":299},"\"type\"",[182,2629,472],{"class":293},[182,2631,475],{"class":316},[182,2633,1367],{"class":293},[182,2635,475],{"class":299},[182,2637,472],{"class":293},[182,2639,2640],{"class":316},"\"bash .claude\u002Fhooks\u002Ftrim-output.sh\"",[182,2642,2643],{"class":293}," }\n",[182,2645,2646],{"class":184,"line":257},[182,2647,2040],{"class":293},[182,2649,2650],{"class":184,"line":263},[182,2651,2652],{"class":293},"      },\n",[182,2654,2655],{"class":184,"line":751},[182,2656,1985],{"class":293},[182,2658,2659,2661,2663,2666],{"class":184,"line":756},[182,2660,1990],{"class":299},[182,2662,472],{"class":293},[182,2664,2665],{"class":316},"\"Edit|Write\"",[182,2667,320],{"class":293},[182,2669,2670,2672],{"class":184,"line":1005},[182,2671,2002],{"class":299},[182,2673,311],{"class":293},[182,2675,2676,2678,2680,2682,2684,2686,2688,2690,2693],{"class":184,"line":1011},[182,2677,2624],{"class":293},[182,2679,2627],{"class":299},[182,2681,472],{"class":293},[182,2683,475],{"class":316},[182,2685,1367],{"class":293},[182,2687,475],{"class":299},[182,2689,472],{"class":293},[182,2691,2692],{"class":316},"\"bash .claude\u002Fhooks\u002Fformat.sh\"",[182,2694,2643],{"class":293},[182,2696,2697],{"class":184,"line":1016},[182,2698,2040],{"class":293},[182,2700,2701],{"class":184,"line":1022},[182,2702,2045],{"class":293},[182,2704,2705],{"class":184,"line":1204},[182,2706,344],{"class":293},[182,2708,2709],{"class":184,"line":1223},[182,2710,349],{"class":293},[182,2712,2713],{"class":184,"line":1599},[182,2714,354],{"class":293},[32,2716,2718],{"id":2717},"budget-alerts-at-the-org-level","Budget alerts at the org level",[11,2720,2721,2722,2724],{},"Team and Enterprise plans expose per-seat usage to admins. Set weekly email alerts at 70% of budget and a hard cap at 100%. Have the one engineer who blew past 70% walk you through their session — nine times out of ten you'll find a gap in ",[113,2723,115],{}," coverage or a runaway subagent loop that the team can learn from.",[32,2726,2728],{"id":2727},"the-monthly-audit","The monthly audit",[11,2730,2731,2732,2735],{},"Once a month, run ",[113,2733,2734],{},"ccusage project"," across every repo and look at the top 10% of sessions by cost. Tag each with a root cause — bloated CLAUDE.md, wrong model, missing ignore, infinite subagent loop. Fix the top three. Bill compounds down like interest.",[122,2737,2739],{"title":2738,"variant":1350},"Cost per shipped feature",[11,2740,2741,2742,2745],{},"The real metric isn't \"cost per session\" — it's ",[271,2743,2744],{},"cost per shipped feature",". A team that uses $1,000 in Claude to ship a feature that would have taken a week of engineer salary is winning. Track outcomes, not raw spend, and resist the urge to squeeze the last 5% out of individual sessions if it costs a day of throughput.",[15,2747,2750,2753,2888],{"id":2748,"title":2749},"template","The Token-Efficient Session Template",[11,2751,2752],{},"Put this together and a single session looks roughly like the flow below. Not every step every time — but the shape holds across thousands of hours of real work.",[172,2754,2757],{"className":174,"code":2755,"filename":2756,"language":177,"meta":178,"style":178},"1. START\n   - Open the repo. CLAUDE.md is thin (\u003C3K), .gitignore covers the noise.\n   - StatusLine is visible. Green ctx, $0.\n\n2. ORIENT (Opus, plan mode)\n   \u002Fmodel opus\n   Enter plan mode, give the task, wait for a written plan.\n\n3. EXECUTE (Sonnet)\n   \u002Fmodel sonnet\n   Follow the plan. Small diffs. Let hooks format and trim.\n\n4. DELEGATE HEAVY READS (Haiku subagent)\n   Fan out read-only explorations to Haiku subagents.\n   Main session gets back 2K summaries, not 50K reads.\n\n5. WATCH THE LINE\n   StatusLine turns yellow at 70%. Wrap up task.\n   Turns red at 80%. STOP.\n\n6. COMPACT OR CLEAR\n   Mid-task? \u002Fcompact\n   Between tasks? \u002Fclear\n   Cross-session? Ask for handoff.md, then \u002Fclear.\n\n7. CLOSE\n   \u002Fcost to log the spend. If surprising, open ccusage and see why.\n","session flow",[113,2758,2759,2764,2769,2774,2778,2783,2788,2793,2797,2802,2807,2812,2816,2821,2826,2831,2835,2840,2845,2850,2854,2859,2864,2869,2874,2878,2883],{"__ignoreMap":178},[182,2760,2761],{"class":184,"line":185},[182,2762,2763],{},"1. START\n",[182,2765,2766],{"class":184,"line":191},[182,2767,2768],{},"   - Open the repo. CLAUDE.md is thin (\u003C3K), .gitignore covers the noise.\n",[182,2770,2771],{"class":184,"line":197},[182,2772,2773],{},"   - StatusLine is visible. Green ctx, $0.\n",[182,2775,2776],{"class":184,"line":203},[182,2777,522],{"emptyLinePlaceholder":521},[182,2779,2780],{"class":184,"line":209},[182,2781,2782],{},"2. ORIENT (Opus, plan mode)\n",[182,2784,2785],{"class":184,"line":215},[182,2786,2787],{},"   \u002Fmodel opus\n",[182,2789,2790],{"class":184,"line":221},[182,2791,2792],{},"   Enter plan mode, give the task, wait for a written plan.\n",[182,2794,2795],{"class":184,"line":227},[182,2796,522],{"emptyLinePlaceholder":521},[182,2798,2799],{"class":184,"line":233},[182,2800,2801],{},"3. EXECUTE (Sonnet)\n",[182,2803,2804],{"class":184,"line":239},[182,2805,2806],{},"   \u002Fmodel sonnet\n",[182,2808,2809],{"class":184,"line":245},[182,2810,2811],{},"   Follow the plan. Small diffs. Let hooks format and trim.\n",[182,2813,2814],{"class":184,"line":251},[182,2815,522],{"emptyLinePlaceholder":521},[182,2817,2818],{"class":184,"line":257},[182,2819,2820],{},"4. DELEGATE HEAVY READS (Haiku subagent)\n",[182,2822,2823],{"class":184,"line":263},[182,2824,2825],{},"   Fan out read-only explorations to Haiku subagents.\n",[182,2827,2828],{"class":184,"line":751},[182,2829,2830],{},"   Main session gets back 2K summaries, not 50K reads.\n",[182,2832,2833],{"class":184,"line":756},[182,2834,522],{"emptyLinePlaceholder":521},[182,2836,2837],{"class":184,"line":1005},[182,2838,2839],{},"5. WATCH THE LINE\n",[182,2841,2842],{"class":184,"line":1011},[182,2843,2844],{},"   StatusLine turns yellow at 70%. Wrap up task.\n",[182,2846,2847],{"class":184,"line":1016},[182,2848,2849],{},"   Turns red at 80%. STOP.\n",[182,2851,2852],{"class":184,"line":1022},[182,2853,522],{"emptyLinePlaceholder":521},[182,2855,2856],{"class":184,"line":1204},[182,2857,2858],{},"6. COMPACT OR CLEAR\n",[182,2860,2861],{"class":184,"line":1223},[182,2862,2863],{},"   Mid-task? \u002Fcompact\n",[182,2865,2866],{"class":184,"line":1599},[182,2867,2868],{},"   Between tasks? \u002Fclear\n",[182,2870,2871],{"class":184,"line":1607},[182,2872,2873],{},"   Cross-session? Ask for handoff.md, then \u002Fclear.\n",[182,2875,2876],{"class":184,"line":2418},[182,2877,522],{"emptyLinePlaceholder":521},[182,2879,2880],{"class":184,"line":2424},[182,2881,2882],{},"7. CLOSE\n",[182,2884,2885],{"class":184,"line":2436},[182,2886,2887],{},"   \u002Fcost to log the spend. If surprising, open ccusage and see why.\n",[122,2889,2891],{"title":2890,"variant":388},"If you do only three things",[11,2892,2893,2894,2896,2897,2899],{},"Tighten your ",[113,2895,115],{},". Put ",[113,2898,376],{}," on a diet. Show a StatusLine. Everything else in this chapter is refinement on top of those three moves — and those three alone typically drop spend by 50–60% in the first week.",[2901,2902,2903],"style",{},"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 .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html pre.shiki code .surfw, html code.shiki .surfw{--shiki-default:#005CC5;--shiki-default-font-weight:bold}html pre.shiki code .sqxcx, html code.shiki .sqxcx{--shiki-default:#E36209}html pre.shiki code .sEuWB, html code.shiki .sEuWB{--shiki-default:#032F62;--shiki-default-text-decoration:underline}html pre.shiki code .shJU0, html code.shiki .shJU0{--shiki-default:#22863A}",{"title":178,"searchDepth":191,"depth":191,"links":2905},[2906,2907,2908,2910,2911,2912,2913,2914,2915,2916,2918,2919,2920,2921,2922,2923,2924,2925],{"id":34,"depth":197,"text":35},{"id":131,"depth":197,"text":132},{"id":145,"depth":197,"text":2909},"Fix #1 — A tight .gitignore (plus permissions.deny for secrets)",{"id":370,"depth":197,"text":371},{"id":380,"depth":197,"text":381},{"id":443,"depth":197,"text":444},{"id":793,"depth":197,"text":794},{"id":874,"depth":197,"text":875},{"id":1319,"depth":197,"text":1320},{"id":1429,"depth":197,"text":2917},"When \u002Fcompact beats \u002Fclear",{"id":1687,"depth":197,"text":1688},{"id":1734,"depth":197,"text":1735},{"id":1856,"depth":197,"text":1857},{"id":1875,"depth":197,"text":1876},{"id":2442,"depth":197,"text":2443},{"id":2483,"depth":197,"text":2484},{"id":2717,"depth":197,"text":2718},{"id":2727,"depth":197,"text":2728},"Why tokens matter, the three highest-impact fixes, monitoring, the CLAUDE.md diet, tiered architecture, compacting, model routing, subagent economics, hook-based output control, and team cost management.","20 min","md","Cut usage in half","LucideCoins",null,{},{"title":2934,"path":2935},"Orchestration","\u002Forchestration","\u002Ftokens",{"title":2938,"path":2939},"Extensions","\u002Fextensions",{"title":2941,"description":2942,"keywords":2943,"proficiencyLevel":2953,"timeRequired":2954},"Token Mastery — Cut Claude Code Usage in Half","Why tokens matter, the three highest-impact fixes, usage monitoring, CLAUDE.md diet, tiered architecture, compact strategies, model routing, subagent economics, hook-based output control, and team cost management for Claude Code.",[2944,2945,2946,2947,2948,2949,2950,803,2951,2952,1360],"claude code tokens","token optimization","llm costs","claude md diet","model routing","subagent economics","token monitoring","team cost management","statusline","Intermediate","PT20M",[2956,2957,2959,2960,2961,2962,2963,2964,2965,2966,2967],{"id":17,"title":18,"level":191},{"id":138,"title":2958,"level":191},"The 3 Fixes",{"id":401,"title":402,"level":191},{"id":864,"title":865,"level":191},{"id":1240,"title":1241,"level":191},{"id":1360,"title":1361,"level":191},{"id":1625,"title":1626,"level":191},{"id":1845,"title":1846,"level":191},{"id":1949,"title":1950,"level":191},{"id":2476,"title":2477,"level":191},{"id":2748,"title":2968,"level":191},"Session Template","6UUo9hd_eHpeGYxIvjFB7YajTMwKi_QfVQ94LEjxARM",1777109528355]