<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Nixon Perinchery]]></title><description><![CDATA[Nixon Perinchery]]></description><link>https://nixonperinchery.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 01 Nov 2026 22:22:51 GMT</lastBuildDate><atom:link href="https://nixonperinchery.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Claude Code Status Line: Show Context, Cost and Limits]]></title><description><![CDATA[The short version A Claude Code status line is a row in the terminal that runs a script you choose and shows whatever the script prints. Claude Code passes…]]></description><link>https://nixonperinchery.hashnode.dev/claude-code-status-line-show-context-cost-and-limits</link><guid isPermaLink="true">https://nixonperinchery.hashnode.dev/claude-code-status-line-show-context-cost-and-limits</guid><category><![CDATA[claude-code]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[Nixon Perinchery]]></dc:creator><pubDate>Wed, 28 Oct 2026 13:05:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6adf48eccaa30cf051498542/691ef829-cc3c-4a0c-b64f-bc4f518666ec.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>The short version</strong></p>
<ul>
<li>A Claude Code status line is a script you configure. It receives session data as JSON on stdin and prints a row above the footer. The docs say it runs locally and does not consume API tokens.</li>
<li>Set it up with the /statusline command, or add a statusLine entry with type command to settings.json.</li>
<li>The JSON includes context-window percentage, estimated session cost, 5-hour and 7-day plan usage (Pro and Max only) and prompt cache health (v2.1.251 or later).</li>
<li>Guard every optional field, keep the script fast, and cache slow git calls by session_id. A non-zero exit or empty output blanks the line.</li>
<li>Session cost is a client-side estimate at list price. On Pro and Max it is not relevant for billing, so use it as a guide.</li>
</ul>
<p>A Claude Code status line is a row in the terminal that runs a script you choose and shows whatever the script prints. Claude Code passes the script session data as JSON, so you can keep context fill, session cost, plan limits and git state in view without typing a command. Per the docs, it runs locally and does not consume API tokens.</p>
<p>This guide covers setup, the fields worth showing, a working script, and the mistakes that leave the line blank or stale. It is based on the official status line and cost documentation.</p>
<h2>What is the Claude Code status line?</h2>
<p>The status line renders in its own row above the built-in footer badges. It does not replace them, but once a custom status line is configured, Claude Code stops showing most of the footer's keyboard hints, including <code>esc to interrupt</code>.</p>
<p>Your script reads JSON on stdin and writes text to stdout. Each line you print becomes a row. You can use ANSI colors, and OSC 8 escape sequences for clickable links in terminals that support them (iTerm2, Kitty, WezTerm).</p>
<p>Three reasons to use one:</p>
<ul>
<li><strong>Context fill.</strong> You see how full the window is before a compaction fires.</li>
<li><strong>Which session is which.</strong> With several sessions open, the line can show the branch, worktree or session name.</li>
<li><strong>Limits and spend.</strong> Plan usage and cost sit next to your prompt instead of behind a command.</li>
</ul>
<h2>How do I set up a status line?</h2>
<p>There are two routes.</p>
<h3>Option 1: let Claude write it</h3>
<p>Run <code>/statusline</code> with a plain-language request. Claude Code generates a script in <code>~/.claude/</code> and updates your settings:</p>
<pre><code class="language-text">/statusline show model name and context percentage with a progress bar
</code></pre>
<p>Approve the file edit prompts if Claude Code asks for permission.</p>
<h3>Option 2: configure it by hand</h3>
<p>Add a <code>statusLine</code> field to <code>~/.claude/settings.json</code> (user settings) or to project settings. Set <code>type</code> to <code>"command"</code> and point <code>command</code> at a script:</p>
<pre><code class="language-json">{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh",
    "padding": 2
  }
}
</code></pre>
<p>The <code>command</code> runs in a shell, so an inline command works too. This one uses <code>jq</code> to print the model and context percentage:</p>
<pre><code class="language-json">{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
  }
}
</code></pre>
<p>There is also a <code>refreshInterval</code> setting that re-runs the command on a fixed timer. You need it for clocks, or when the line depends on something that changes while the main session is idle.</p>
<h3>A minimal working script</h3>
<p>Save this as <code>~/.claude/statusline.sh</code>:</p>
<pre><code class="language-bash">#!/bin/bash
input=$(cat)

MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)

echo "[$MODEL] ${DIR##*/} | ${PCT}% context"
</code></pre>
<p>Then run <code>chmod +x ~/.claude/statusline.sh</code>. Claude Code reloads settings automatically and runs the script as soon as you save the settings file.</p>
<p>To test without starting a session, pipe in mock input:</p>
<pre><code class="language-bash">echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"/home/user/project"},"context_window":{"used_percentage":25},"session_id":"test-session-abc"}' | ~/.claude/statusline.sh
</code></pre>
<h2>What data can the status line show?</h2>
<p>The JSON is larger than most people expect. These fields are the most useful day to day:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>What it gives you</th>
</tr>
</thead>
<tbody><tr>
<td><code>model.id</code>, <code>model.display_name</code></td>
<td>Current model</td>
</tr>
<tr>
<td><code>workspace.current_dir</code></td>
<td>Where you are</td>
</tr>
<tr>
<td><code>workspace.git_worktree</code>, <code>worktree.*</code></td>
<td>Linked worktree details; only present inside one</td>
</tr>
<tr>
<td><code>context_window.used_percentage</code></td>
<td>Percent of the context window used</td>
</tr>
<tr>
<td><code>cost.total_cost_usd</code></td>
<td>Estimated session cost</td>
</tr>
<tr>
<td><code>cost.total_duration_ms</code>, <code>cost.total_api_duration_ms</code></td>
<td>Session time, and time spent waiting on the API</td>
</tr>
<tr>
<td><code>rate_limits.five_hour</code>, <code>rate_limits.seven_day</code></td>
<td><code>used_percentage</code> and <code>resets_at</code> for each plan window</td>
</tr>
<tr>
<td><code>prompt_cache.*</code></td>
<td>Cache warmth, hit ratio, misses</td>
</tr>
<tr>
<td><code>session_name</code>, <code>agent.name</code>, <code>pr.*</code></td>
<td>Session label, active agent, open PR or merge request</td>
</tr>
</tbody></table>
<p>Two details matter for accuracy:</p>
<ul>
<li><code>used_percentage</code> is calculated from input tokens only (<code>input_tokens + cache_creation_input_tokens + cache_read_input_tokens</code>). Output tokens are not included. <code>/context</code> can read higher because it adds an estimate for messages added since the last API response.</li>
<li><code>cost.total_cost_usd</code> is computed locally from token counts at list price, unless an administrator has set a <code>modelPricing</code> table in managed settings. The cost docs call it an estimate. They also say that on Pro and Max the session cost figure is not relevant for billing, because usage is included in the subscription. The total resets to $0 when <code>/clear</code> starts a new session.</li>
</ul>
<h3>Plan limits only appear for some accounts</h3>
<p><code>rate_limits</code> is present only for claude.ai Pro and Max subscribers (or behind a Claude apps gateway with a spend limit), and only after the first API response in a session. Each window can be absent on its own, and Claude Code drops a window once its <code>resets_at</code> time passes. A script that assumes the field exists will misbehave on API-key setups.</p>
<h3>Cache health</h3>
<p>The <code>prompt_cache</code> object needs Claude Code v2.1.251 or later and appears after the main conversation's first API response. It includes <code>warm</code>, <code>ttl</code> (<code>"5m"</code> or <code>"1h"</code>), <code>expires_at</code>, <code>hit_ratio</code> (0 to 1) and <code>misses</code>. From v2.1.260 it also reports a likely cause for the last miss, such as <code>tools_changed</code>, <code>system_prompt_changed</code> or <code>ttl_expired_5m</code>. The same statistics appear on the <code>Prompt cache (main)</code> line of <code>/usage</code>. Subagent requests are not counted.</p>
<p>A miss means a request re-processed content the cache already held. In the docs' definition, that is more than 5% and at least 2,000 tokens of what could have been read from cache, with no compaction or tool-result clearing to explain it.</p>
<h2>A status line for context, cost and limits</h2>
<p>This script puts a colored context bar, cost and plan usage on one row, and copes with absent fields:</p>
<pre><code class="language-bash">#!/bin/bash
input=$(cat)

MODEL=$(echo "$input" | jq -r '.model.display_name')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
FIVE_H=$(echo "$input" | jq -r '.rate_limits.five_hour.used_percentage // empty')
WEEK=$(echo "$input" | jq -r '.rate_limits.seven_day.used_percentage // empty')

GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; RESET='\033[0m'
if [ "$PCT" -ge 90 ]; then C="$RED"
elif [ "$PCT" -ge 70 ]; then C="$YELLOW"
else C="$GREEN"; fi

FILLED=$((PCT / 10)); EMPTY=$((10 - FILLED))
printf -v FILL "%${FILLED}s"; printf -v PAD "%${EMPTY}s"
BAR="${FILL// /#}${PAD// /-}"

LIMITS=""
[ -n "$FIVE_H" ] &amp;&amp; LIMITS=" | 5h $(printf '%.0f' "$FIVE_H")%"
[ -n "$WEEK" ] &amp;&amp; LIMITS="$LIMITS 7d $(printf '%.0f' "$WEEK")%"

echo -e "[$MODEL] ${C}${BAR}${RESET} ${PCT}% | $(printf '$%.2f' "$COST")${LIMITS}"
</code></pre>
<p>The color thresholds (green under 70%, yellow 70 to 89%, red from 90%) match the docs' multi-line example; adjust them to taste. The <code>// empty</code> idiom prints nothing when a field is missing, so the limits segment disappears for accounts without <code>rate_limits</code>.</p>
<h2>How often does the status line run?</h2>
<p>It runs once when a session starts or resumes, then again when:</p>
<ul>
<li>a new assistant message arrives</li>
<li><code>/compact</code> finishes</li>
<li>the permission mode changes</li>
<li>vim mode toggles</li>
<li>the <code>command</code> in your settings changes</li>
<li>a <code>refreshInterval</code> timer elapses, if you set one</li>
<li>a rate-limit window reaches its <code>resets_at</code> time, or a warm prompt cache reaches its <code>expires_at</code> time</li>
</ul>
<p>Updates are debounced at 300 ms, except that a change to the command itself runs right away. If a new update triggers while your script is still running, Claude Code cancels the in-flight run. The event-driven triggers can go quiet when the main session is idle, for example while a coordinator waits on background subagents. Set <code>refreshInterval</code> if the line must stay current then.</p>
<h2>Common problems and fixes</h2>
<p><strong>The line is blank.</strong> Check these in turn:</p>
<ul>
<li>The script is not executable (<code>chmod +x</code>).</li>
<li>It writes to stderr instead of stdout.</li>
<li>It exits non-zero or prints nothing. Claude Code displays output only after the script exits with code 0.</li>
<li>You have not accepted the workspace trust dialog for the folder. Until then the line stays blank, and <code>claude --debug</code> logs <code>Status line command skipped: workspace trust not accepted</code>.</li>
<li><code>disableAllHooks</code> is <code>true</code> outside managed settings, in which case only a <code>statusLine</code> from managed settings runs. Or your organization sets <code>allowManagedHooksOnly</code>, which means you can only get a status line from managed settings.</li>
</ul>
<p><code>claude --debug</code> logs your script's stderr on every invocation and its exit code on the first one in a session, which makes it the quickest way to find a parse error.</p>
<p><strong>Values show <code>--</code> or empty.</strong> Fields can be <code>null</code> before the first API response. <code>context_window.used_percentage</code> may be <code>null</code> early in a session, and <code>context_window.current_usage</code> is <code>null</code> again right after <code>/compact</code> until the next API call. Use fallbacks such as <code>// 0</code>.</p>
<p><strong>The line lags.</strong> The script runs often, and <code>git status</code> or <code>git diff</code> in a large repo is slow. Cache the result in a temp file for a few seconds. Key the cache on <code>session_id</code> from the JSON, not on <code>$$</code>: a process ID changes on every invocation and defeats the cache, while <code>session_id</code> is stable within a session and unique across concurrent ones. The docs include a full example that refreshes git info every 5 seconds.</p>
<p><strong>Links are not clickable.</strong> Terminal.app does not support them. If your terminal does but the link text is not clickable, Claude Code may not have detected hyperlink support; launch with <code>FORCE_HYPERLINK=1 claude</code>. SSH and tmux can strip the escape sequences. If escape codes show up as literal text, use <code>printf '%b'</code> instead of <code>echo -e</code>.</p>
<p><strong>Windows paths.</strong> With Git Bash, write paths in <code>command</code> with forward slashes. Unquoted backslashes are treated as escape characters, and the command fails without a visible error.</p>
<p><strong>Garbled output.</strong> Complex escape sequences, especially in multi-line status lines, can occasionally corrupt the display. Simplify to plain text if you see it.</p>
<h2>Status lines for subagents</h2>
<p>A separate <code>subagentStatusLine</code> setting customizes the row shown for each subagent in the agent panel. Its command runs once per refresh tick and receives all visible rows as one JSON object, with a <code>tasks</code> array whose entries include fields such as <code>name</code>, <code>status</code>, <code>model</code>, <code>tokenCount</code> and <code>contextWindowSize</code>. You answer with one JSON line per row, in the form <code>{"id": "&lt;task id&gt;", "content": "&lt;row body&gt;"}</code>. Omit <code>id</code> to keep the default row; send an empty <code>content</code> to hide it. The same trust, <code>disableAllHooks</code> and <code>allowManagedHooksOnly</code> gates apply as for <code>statusLine</code>. If you split work across helpers, this is a cheap way to see which one is using the most tokens.</p>
<h2>Should the status line be shared with a team?</h2>
<p>Because <code>statusLine</code> executes a shell command, it falls under the same workspace-trust rule as hooks in settings files. A project-level status line therefore runs code from the repository on whoever trusts the folder. Keep shared scripts small and reviewable, and prefer user settings for personal preferences. Plugins can ship a default <code>subagentStatusLine</code>, but unlike hooks, those values do not run under <code>allowManagedHooksOnly</code>.</p>
<h2>Conclusion</h2>
<p>A status line is a small script that keeps context fill, estimated cost and plan usage in front of you, so you can compact or start fresh before a session gets expensive. Start with <code>/statusline</code>, move to a hand-written script once you know which fields you read, guard every optional field, and cache anything slow. Treat the cost figure as an estimate; for authoritative billing, the cost docs point to the Usage page in the Claude Console.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://code.claude.com/docs/en/statusline">Customize your status line - Claude Code Docs</a></li>
<li><a href="https://code.claude.com/docs/en/costs">Manage costs effectively - Claude Code Docs</a></li>
</ul>
<hr />
<p><em>Originally published on the <a href="https://bridge-terminal.com/atlas/blog/claude-code-status-line-context-cost-limits/?utm_source=hashnode&amp;utm_medium=crosspost&amp;utm_campaign=claude-code-status-line-context-cost-limits">Atlas blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Agent Usage Limits Explained in Plain English]]></title><description><![CDATA[The short version If your AI coding agent suddenly stops and says a limit has been reached, you have not broken anything. On Claude Pro and Max plans…]]></description><link>https://nixonperinchery.hashnode.dev/ai-coding-agent-usage-limits-explained-in-plain-english</link><guid isPermaLink="true">https://nixonperinchery.hashnode.dev/ai-coding-agent-usage-limits-explained-in-plain-english</guid><category><![CDATA[claude-code]]></category><category><![CDATA[AI]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[ai agents]]></category><dc:creator><![CDATA[Nixon Perinchery]]></dc:creator><pubDate>Mon, 26 Oct 2026 13:19:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6adf48eccaa30cf051498542/84a7794c-b10c-4cf6-b801-56e2b53af08c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>The short version</strong></p>
<ul>
<li>Claude Pro and Max plans have a five-hour session limit and a weekly limit, and Claude chat and Claude Code draw from the same allowance.</li>
<li>At the limit the agent stops, or may be allowed to finish its current step. Files already changed stay changed; you wait for the reset, upgrade, or turn on usage credits.</li>
<li>Long conversations, bigger models, higher effort and many connected tools use the allowance faster, so short, focused sessions stretch it further.</li>
<li>Several AI engineers working at once use the plan faster, so size the plan to the amount of parallel work.</li>
<li>Usage credits and API credits are billed at standard API rates, outside the plan price, so decide who may turn them on before you hit the wall.</li>
</ul>
<p>If your AI coding agent suddenly stops and says a limit has been reached, you have not broken anything. On Claude Pro and Max plans, Claude Code runs against a usage allowance, and that allowance has two main parts: a limit for each five-hour session and a limit for each week. When you reach one, the agent stops until it resets, or until you pay for more.</p>
<p>This guide explains those limits in plain English, what uses them up, and how a founder, product owner or manager can plan around them.</p>
<h2>What are AI coding agent usage limits?</h2>
<p>Think of a mobile data plan, but with two meters instead of one. Anthropic's help pages say that both Pro and Max have a five-hour session limit and a weekly limit. Max plans also have a separate weekly limit for Fable, which sits apart from the general weekly limit.</p>
<p>Paid plans have a session limit that resets every five hours and weekly limits that reset once a week. Anthropic's help pages give no exact message counts or token numbers, so nobody can tell you in advance "you get exactly this many tasks." What you can learn is how fast your own work uses the meters. (A "token" is a small chunk of text the AI reads or writes, and it is the unit usage is counted in.)</p>
<h2>Are chat and coding counted together?</h2>
<p>Yes. Usage on the Claude chat app, Claude Code and Claude Desktop counts toward the same limit, and Anthropic says usage in code editors counts too. If a colleague spends the morning asking Claude questions on the same account, that comes out of the same allowance your coding agent needs in the afternoon.</p>
<p>This surprises many teams. If one login is shared by several people, or one person uses the chat heavily, the coding agent can hit the wall earlier than expected.</p>
<h2>What happens when you hit the limit?</h2>
<p>Anthropic says you get warning messages as you approach a limit. If you reach the five-hour limit in the middle of a response, Claude Code may be allowed to finish its current step, and you would see the message "Usage limit reached · wrapping up." That extra allowance is small and capped, it counts toward your weekly limit, and it covers only a response already in progress, not a new message you send afterwards.</p>
<p>Anthropic says it is rolling out gradually, so it may not be on your account yet. On Pro it applies up to once per weekly period. On Max it can apply each time you reach a five-hour limit, within the weekly limit.</p>
<p>After that, the agent stops. The files it already changed stay changed, so you are waiting, not losing work. It is still wise to ask the agent to leave short notes on where it stopped, so the next session can pick up cleanly.</p>
<h2>What uses up the allowance fastest?</h2>
<p>Anthropic points to these factors:</p>
<ul>
<li><strong>Length and complexity of the conversation.</strong> A long, wandering session costs more than a short, focused one. Very long conversations also trigger automatic context management, which uses more of your limit.</li>
<li><strong>The model you pick.</strong> Model choice affects how quickly usage is consumed.</li>
<li><strong>The effort level.</strong> Higher effort uses more tokens, so asking the agent to think hard on every small task adds up.</li>
<li><strong>Tools and connectors.</strong> Anthropic describes these as token-intensive.</li>
</ul>
<p>A plain example: asking the agent to rename a button label is a cheap job. Asking it to redesign checkout, read the whole codebase, run tests and fix what fails is an expensive one. Ten of the second kind in a day will empty a meter sooner than ten of the first. This is our own illustration, not an Anthropic figure.</p>
<h2>How can I make the allowance last longer?</h2>
<p>Anthropic's own tips are simple, and you can ask your team to follow them:</p>
<ol>
<li>Start a new conversation when a long one nears your limit.</li>
<li>Use a lower effort level for routine work.</li>
<li>Turn off extended thinking when you do not need it.</li>
<li>Turn off connected apps and tools you are not using.</li>
<li>Remove unused project files and keep the project's instructions short.</li>
</ol>
<p>For a non-technical manager, the most useful habit is the first one: give the agent one clear job at a time. A clear brief should also help, because the agent has less to guess at, though that is common sense rather than something Anthropic measures.</p>
<h2>Why do several AI engineers hit the limit sooner?</h2>
<p>If you run a team of AI engineers, each one is its own working session, and all of them draw from the same plan. More engineers working in parallel will use the allowance faster than one working alone. That is the trade: you finish sooner on the clock, but you also reach the meters sooner.</p>
<p>So match the size of the plan to the amount of parallel work. Anthropic suggests that a Pro user who regularly hits limits consider Max 5x, and that someone on Max 5x who regularly hits them consider Max 20x. The help pages give no price or capacity figures for the tiers, so check the current pricing page before you decide.</p>
<h2>What are my options when I hit the wall?</h2>
<p>Anthropic lists these choices:</p>
<ul>
<li><strong>Wait for the reset.</strong> Free, and fine if the work is not urgent.</li>
<li><strong>Upgrade your plan.</strong> The new limits apply right away.</li>
<li><strong>Turn on usage credits.</strong> Work carries on instead of stopping, but this is extra spending beyond your plan. Pro, Max and Team plans can buy them.</li>
<li><strong>Use a developer (Console) account with API credits.</strong> Billed at standard API rates, which are separate from plan pricing.</li>
</ul>
<p>Two cautions. First, extra usage is real money, so decide in advance who may switch it on and what the ceiling is. Second, if the <code>ANTHROPIC_API_KEY</code> setting exists on the machine, Claude Code uses that key instead of your subscription, and you are charged per use. If you meant to stay on the plan, ask someone technical to check this. Anthropic says you can see your remaining allocation with the <code>/status</code> command, and that you can decline the API credit option when it is offered.</p>
<h2>How do I plan work around the limits?</h2>
<p>A few practical rules. They are our suggestions, not Anthropic's:</p>
<ul>
<li><strong>Do the heavy work early in the week.</strong> Save small fixes and polish for when the meter is low.</li>
<li><strong>Start big jobs at the beginning of a session.</strong> Do not begin a large build when you are nearly out.</li>
<li><strong>Keep a buffer.</strong> Do not run the plan to the limit in the middle of a release. A stop on release day is the worst time.</li>
<li><strong>Watch the trend.</strong> If you reach the weekly limit early every week, either the work is too big for the plan or the sessions are too long.</li>
</ul>
<h2>What Atlas does today</h2>
<p>Atlas is a team of AI engineers built on Claude Code. It runs on your own Claude Pro or Max plan, signed in with that plan, with no API keys and no per-token bill, so usage counts against the plan. Several engineers working at once use the plan's limits faster, and Max gives the most room. Atlas's price never includes Claude.</p>
<p>Atlas also has an optional daily budget that warns at 50% and 80% and pauses the team at 100%. Production go-lives, spending and deleting data are never decided for you.</p>
<p>Atlas does not yet let you set a stop point tied to the five-hour or weekly plan limits. That is coming to Atlas, built in, so it needs no setup. Until then, use the daily budget, watch your remaining allocation with <code>/status</code>, and follow the planning rules above.</p>
<h2>Conclusion</h2>
<p>Usage limits are not a fault; they are the shape of the plan you bought. Know the two meters, keep sessions short and focused, and decide in advance whether you will wait, upgrade or pay for extra. Then a limit becomes a scheduling detail instead of a surprise. The <a href="https://bridge-terminal.com/atlas/?utm_source=hashnode&amp;utm_medium=crosspost&amp;utm_campaign=ai-coding-agent-usage-limits-plain-english">Atlas home page</a> has more plain-language guides.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan">Using Claude Code with your Pro or Max plan</a></li>
<li><a href="https://support.claude.com/en/articles/11647753-how-do-usage-and-length-limits-work">How do usage and length limits work?</a></li>
</ul>
<hr />
<p><em>Originally published on the <a href="https://bridge-terminal.com/atlas/blog/ai-coding-agent-usage-limits-plain-english/?utm_source=hashnode&amp;utm_medium=crosspost&amp;utm_campaign=ai-coding-agent-usage-limits-plain-english">Atlas blog</a>.</em></p>
]]></content:encoded></item><item><title><![CDATA[Claude Code OpenTelemetry: Track Cost and Tool Use]]></title><description><![CDATA[The short version To monitor Claude Code usage across a team, turn on its built-in OpenTelemetry export: set CLAUDE_CODE_ENABLE_TELEMETRY=1, pick an…]]></description><link>https://nixonperinchery.hashnode.dev/claude-code-opentelemetry-track-cost-and-tool-use</link><guid isPermaLink="true">https://nixonperinchery.hashnode.dev/claude-code-opentelemetry-track-cost-and-tool-use</guid><category><![CDATA[OpenTelemetry]]></category><category><![CDATA[claude-code]]></category><category><![CDATA[Devops]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[Nixon Perinchery]]></dc:creator><pubDate>Mon, 26 Oct 2026 13:11:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6adf48eccaa30cf051498542/17c40976-4ed0-45c7-9dd5-fedb42104787.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>The short version</strong></p>
<ul>
<li>Claude Code exports usage metrics and events through OpenTelemetry once you set CLAUDE_CODE_ENABLE_TELEMETRY=1 and choose an exporter.</li>
<li>A repository cannot switch telemetry on or point it somewhere: OTEL exporter variables in project settings files are ignored, so rollout belongs in managed settings.</li>
<li>Prompt text, tool details and raw API bodies are off by default, and each has its own opt-in flag.</li>
<li>Cost and token metrics can be split by model, subagent, skill, plugin and MCP server, which shows what drives your spend.</li>
<li>The dollar figures are local estimates at list price (or your configured rates), not a bill. On Pro and Max plans usage is included in the subscription, so use the figures to compare, not to invoice.</li>
</ul>
<p>To monitor Claude Code usage across a team, turn on its built-in OpenTelemetry export: set <code>CLAUDE_CODE_ENABLE_TELEMETRY=1</code>, pick an exporter, and point it at a collector. You then get token, cost, commit, pull request and tool-decision data in your own observability stack, tagged by model, subagent, skill and MCP server.</p>
<p>The Claude Code docs describe OpenTelemetry export as working on every setup and as the only option that streams per-user token and cost metrics into your own stack in near real time. This guide covers the minimum setup, a managed-settings rollout, the privacy switches, and the questions the data can answer.</p>
<h2>Why export telemetry instead of reading /usage?</h2>
<p><code>/usage</code> is per machine. Its breakdown is computed from local session history, so usage from other devices or claude.ai is not included. That is fine for one developer and no help for a team that wants to compare weeks, repos or workflows.</p>
<p>Telemetry sends the signals to one place. The docs' comparison for organizations lists the alternatives by setup: the spend report and analytics dashboard on Teams and Enterprise, the Console dashboard and Claude Code Analytics API for API customers, and your cloud's billing console on Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. On the cloud providers, OpenTelemetry (or an LLM gateway) is how you get per-user numbers.</p>
<p>One caveat up front: Claude Code computes dollar figures locally from token counts at list price. Pro and Max subscribers have usage included in the subscription, so a cost figure there is not a billing number. Even for API users the docs call it an estimate; the Console usage page is authoritative.</p>
<h2>How do I turn on Claude Code OpenTelemetry?</h2>
<p>Set environment variables before starting Claude Code. These are the documented basics:</p>
<pre><code class="language-bash">export CLAUDE_CODE_ENABLE_TELEMETRY=1          # required
export OTEL_METRICS_EXPORTER=otlp              # otlp, prometheus, console, none
export OTEL_LOGS_EXPORTER=otlp                 # otlp, console, none
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc        # grpc, http/json, http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer your-token"
</code></pre>
<p>There is no default protocol, so set <code>OTEL_EXPORTER_OTLP_PROTOCOL</code> (or the per-signal protocol variable) for each OTLP exporter you enable. Metrics export every 60 seconds by default (<code>OTEL_METRIC_EXPORT_INTERVAL</code>, in milliseconds) and logs every 5 seconds (<code>OTEL_LOGS_EXPORT_INTERVAL</code>).</p>
<h3>Test locally first</h3>
<p>Before you involve a collector, print metrics to the terminal at a one-second interval:</p>
<pre><code class="language-bash">export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=console
export OTEL_METRIC_EXPORT_INTERVAL=1000
</code></pre>
<p>Or expose a Prometheus endpoint and scrape <code>http://localhost:9464/metrics</code>:</p>
<pre><code class="language-bash">export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=prometheus
</code></pre>
<p>To confirm a metrics pipeline works, look for <code>claude_code.session.count</code>, which is emitted at session start. For a logs-only setup, submit a prompt and look for the <code>claude_code.user_prompt</code> event. If nothing arrives, start Claude Code with <code>claude --debug-file &lt;path&gt;</code> and search the file for <code>[3P telemetry]</code> errors. Lines tagged <code>[Anthropic telemetry]</code> describe Anthropic's own operational telemetry and do not point to a problem with your setup.</p>
<h3>Send metrics and logs to different backends</h3>
<p>Per-signal variables override the generic ones:</p>
<pre><code class="language-bash">export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://metrics.example.com:4318
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://logs.example.com:4317
</code></pre>
<p>Per-signal headers merge with the generic <code>OTEL_EXPORTER_OTLP_HEADERS</code>. Metric temporality defaults to <code>delta</code>; set <code>OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative</code> if your backend expects that.</p>
<h2>How do I roll it out to a whole team?</h2>
<p>Put the variables in the managed settings file so they apply to every user:</p>
<pre><code class="language-json">{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://collector.example.com:4317",
    "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer example-token"
  }
}
</code></pre>
<p>Four behaviours matter here, all from the docs:</p>
<ul>
<li>Claude Code ignores <code>OTEL_*</code> exporter variables in <code>.claude/settings.json</code> and <code>.claude/settings.local.json</code>. A repository cannot enable telemetry, choose a destination or capture content. It can still set an exporter selector to <code>none</code> to turn a signal off, unless managed settings, a <code>--settings</code> file or the starting environment already sets that variable.</li>
<li>Setting <code>OTEL_EXPORTER_OTLP_ENDPOINT</code> in managed settings removes developer-set per-signal endpoints. Setting the protocol removes developer-set per-signal protocols. Setting headers or client key and certificate variables removes the developer-set per-signal versions of that variable and all developer-set endpoints.</li>
<li>The exporter selectors (<code>OTEL_METRICS_EXPORTER</code>, <code>OTEL_LOGS_EXPORTER</code>, <code>OTEL_TRACES_EXPORTER</code>) are not locked by those endpoint rules. To lock them, set them in managed settings too; the docs say this needs v2.1.223 or later.</li>
<li>Claude Code does not pass <code>OTEL_*</code> variables to subprocesses such as the Bash tool, hooks, MCP servers or language servers, so your own scripts do not inherit your collector credentials.</li>
</ul>
<p>The first point is a useful safety property: a cloned repo cannot quietly redirect your telemetry.</p>
<h2>What does Claude Code measure?</h2>
<h3>Metrics</h3>
<table>
<thead>
<tr>
<th>Metric</th>
<th>What it counts</th>
</tr>
</thead>
<tbody><tr>
<td><code>claude_code.session.count</code></td>
<td>Sessions, with <code>start_type</code>: <code>fresh</code>, <code>resume</code>, <code>continue</code>, <code>agents_view</code></td>
</tr>
<tr>
<td><code>claude_code.lines_of_code.count</code></td>
<td>Lines, <code>type</code> <code>added</code> or <code>removed</code></td>
</tr>
<tr>
<td><code>claude_code.pull_request.count</code></td>
<td>Pull requests</td>
</tr>
<tr>
<td><code>claude_code.commit.count</code></td>
<td>Commits</td>
</tr>
<tr>
<td><code>claude_code.cost.usage</code></td>
<td>Estimated USD cost, per API request</td>
</tr>
<tr>
<td><code>claude_code.token.usage</code></td>
<td>Tokens by <code>type</code>: <code>input</code>, <code>output</code>, <code>cacheRead</code>, <code>cacheCreation</code></td>
</tr>
<tr>
<td><code>claude_code.code_edit_tool.decision</code></td>
<td>Accept or reject decisions for edit tools, with <code>tool_name</code>, <code>decision</code>, <code>source</code>, <code>language</code></td>
</tr>
<tr>
<td><code>claude_code.active_time.total</code></td>
<td>Seconds, split into <code>user</code> (keyboard) and <code>cli</code> (tools and responses)</td>
</tr>
</tbody></table>
<p>Cost and token metrics also carry <code>model</code>, <code>query_source</code> (<code>main</code>, <code>subagent</code> or <code>auxiliary</code>), <code>speed</code>, <code>effort</code>, <code>agent.name</code>, <code>skill.name</code>, <code>plugin.name</code>, <code>mcp_server.name</code> and <code>mcp_tool.name</code>. That attribution is the valuable part: it lets you ask whether spend comes from the main conversation, a subagent, one skill or one MCP server.</p>
<p>Agent, skill, plugin and MCP names are redacted to <code>custom</code> or <code>third-party</code> unless <code>OTEL_LOG_TOOL_DETAILS=1</code> is set.</p>
<h3>Events</h3>
<p>Events go through the logs exporter and share a <code>claude_code.</code> prefix. The useful ones:</p>
<ul>
<li><code>api_request</code>: model, <code>cost_usd</code>, <code>duration_ms</code>, token counts, <code>request_id</code>.</li>
<li><code>api_error</code>: <code>error</code>, <code>status_code</code>, <code>attempt</code>.</li>
<li><code>tool_result</code>: <code>tool_name</code>, <code>tool_use_id</code>, <code>success</code>, <code>duration_ms</code>, <code>decision_source</code>.</li>
<li><code>tool_decision</code>: <code>decision</code> (<code>accept</code> or <code>reject</code>), <code>source</code>, <code>permission_mode</code>.</li>
<li><code>user_prompt</code> and <code>assistant_response</code>: lengths by default, content only if you opt in.</li>
</ul>
<p><code>prompt.id</code> links every event from one prompt. <code>event.sequence</code> is a per-process counter, so sort by <code>event.timestamp</code> first. With those you can reconstruct what one instruction cost and which tools it touched.</p>
<h3>Traces (beta)</h3>
<p>Set <code>CLAUDE_CODE_ENABLE_TELEMETRY=1</code> and <code>CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1</code>, then choose <code>OTEL_TRACES_EXPORTER</code>. Spans run from <code>claude_code.interaction</code>, the root span for each prompt, down to <code>claude_code.llm_request</code> and <code>claude_code.tool</code>, which has <code>blocked_on_user</code> and <code>execution</code> children. The blocked-on-user span shows how long work waited for a permission answer. The <code>claude_code.hook</code> span needs extra settings (<code>ENABLE_BETA_TRACING_DETAILED=1</code> and <code>BETA_TRACING_ENDPOINT</code>), and interactive CLI sessions also need organization allowlisting.</p>
<h2>What should I keep private?</h2>
<p>Content capture is off by default. Opt in deliberately:</p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Effect</th>
</tr>
</thead>
<tbody><tr>
<td><code>OTEL_LOG_USER_PROMPTS=1</code></td>
<td>Prompt text in <code>user_prompt</code>; otherwise <code>&lt;REDACTED&gt;</code></td>
</tr>
<tr>
<td><code>OTEL_LOG_ASSISTANT_RESPONSES=1</code></td>
<td>Response text; follows the prompts flag if unset, <code>0</code> keeps it redacted</td>
</tr>
<tr>
<td><code>OTEL_LOG_TOOL_DETAILS=1</code></td>
<td>Tool parameters, Bash commands, MCP and skill names, full error messages</td>
</tr>
<tr>
<td><code>OTEL_LOG_TOOL_CONTENT=1</code></td>
<td>Tool output in a span event (needs tracing)</td>
</tr>
<tr>
<td><code>OTEL_LOG_RAW_API_BODIES=1</code> or <code>file:&lt;dir&gt;</code></td>
<td>Full API request and response bodies, inline or as untruncated files on disk</td>
</tr>
</tbody></table>
<p>Treat the last one as sensitive data storage, since the bodies carry whatever the conversation contained. Content attributes are truncated at 60 KB by default (<code>CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH</code>). A sensible team default is metrics plus event metadata, with tool details on only if you want per-skill and per-server attribution and your policy allows commands in logs.</p>
<p>Standard attributes include <code>session.id</code>, <code>user.account_uuid</code>, <code>user.id</code> (a random anonymous ID) and <code>user.email</code>. If you do not want per-person data, check what your collector keeps.</p>
<h2>How do I keep metric cardinality under control?</h2>
<p>Every attribute multiplies series in your backend. Defaults:</p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Default</th>
</tr>
</thead>
<tbody><tr>
<td><code>OTEL_METRICS_INCLUDE_SESSION_ID</code></td>
<td><code>true</code></td>
</tr>
<tr>
<td><code>OTEL_METRICS_INCLUDE_ACCOUNT_UUID</code></td>
<td><code>true</code></td>
</tr>
<tr>
<td><code>OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES</code></td>
<td><code>true</code></td>
</tr>
<tr>
<td><code>OTEL_METRICS_INCLUDE_VERSION</code></td>
<td><code>false</code></td>
</tr>
<tr>
<td><code>OTEL_METRICS_INCLUDE_ENTRYPOINT</code></td>
<td><code>false</code></td>
</tr>
<tr>
<td><code>OTEL_METRICS_INCLUDE_REPOSITORY</code></td>
<td><code>false</code> (v2.1.269 and later)</td>
</tr>
</tbody></table>
<p>Session ID is the usual culprit, since every session creates a new series. If you only chart by team or model, set <code>OTEL_METRICS_INCLUDE_SESSION_ID=false</code>. To add your own dimensions, use <code>OTEL_RESOURCE_ATTRIBUTES</code>, for example <code>department=engineering,team.id=platform</code>. Values cannot contain spaces, and quotes do not escape them.</p>
<h2>What questions can the data answer?</h2>
<p>Start with four panels:</p>
<ol>
<li><strong>Tokens by type over time.</strong> A high <code>cacheCreation</code> share next to low <code>cacheRead</code> suggests sessions keep rebuilding context, for example after long idle gaps.</li>
<li><strong>Cost by <code>agent.name</code>, <code>skill.name</code> and <code>mcp_server.name</code>.</strong> This shows whether a subagent or an MCP server dominates. Turn on <code>OTEL_LOG_TOOL_DETAILS=1</code> to see real names.</li>
<li><strong><code>tool_decision</code> rejects and <code>blocked_on_user</code> time.</strong> Many prompts waiting on a person point to permission rules that need tuning.</li>
<li><strong><code>api_error</code> by <code>status_code</code>.</strong> Rising errors or retries explain slow sessions better than guessing.</li>
</ol>
<p>Use the same data to check changes. If you move a task type to a smaller model or lower effort, compare <code>claude_code.cost.usage</code> split by <code>model</code> and <code>effort</code> before and after, rather than trusting a feeling.</p>
<p>Where an organization pays contracted rates, the docs say cost figures, including OpenTelemetry, stay at list price unless an administrator sets the <code>modelPricing</code> managed setting (Claude Code v2.1.242 or later). That changes what is reported, not what is charged.</p>
<h2>Where does Atlas fit?</h2>
<p>Atlas is a team of AI engineers built on Claude Code. Each engineer is its own Claude Code session, signed in with your own Claude Pro or Max plan, so there are no API keys and no per-token bill. Several engineers at once use the plan's limits faster, and Max gives the most room. Atlas has an optional daily budget that warns at 50% and 80% and pauses the team at 100%, and a Network screen shows what every engineer is doing live.</p>
<p>Atlas does not export OpenTelemetry data today. Streaming the team's activity to a collector you own is coming to Atlas, built in, so it will need no setup on your side. Until then, if you run Claude Code yourself, the setup above works as written. Atlas is an independent product. Learn more at <a href="https://bridge-terminal.com/atlas/?utm_source=hashnode&amp;utm_medium=crosspost&amp;utm_campaign=claude-code-opentelemetry-monitor-cost-usage">Atlas</a>.</p>
<h2>Conclusion</h2>
<p>Telemetry is a small config change that gives you one place to see tokens, estimated cost and tool behaviour across everyone. Start with the console exporter on one machine, move to a collector, then enforce the settings through managed settings so a repository cannot change them. Keep prompt and API-body capture off unless you have a clear reason, and drop session ID from metrics if your backend struggles.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://code.claude.com/docs/en/monitoring-usage">Claude Code OpenTelemetry reference (monitoring usage)</a></li>
<li><a href="https://code.claude.com/docs/en/costs">Manage costs effectively - Claude Code docs</a></li>
</ul>
<hr />
<p><em>Originally published on the <a href="https://bridge-terminal.com/atlas/blog/claude-code-opentelemetry-monitor-cost-usage/?utm_source=hashnode&amp;utm_medium=crosspost&amp;utm_campaign=claude-code-opentelemetry-monitor-cost-usage">Atlas blog</a>.</em></p>
]]></content:encoded></item></channel></rss>