# AI Battery > AI Battery is a free, open-source macOS menu bar app that shows rate limits, context health, and token usage for Claude Code and OpenAI Codex — up to 3 accounts per provider. It reads local session logs for token data and makes minimal requests to your provider for rate limits. No analytics, no telemetry. AI Battery gives Claude Code and Codex CLI users visibility into three things their tools don't expose: rate limits (Claude's 5-hour and 7-day windows; Codex's 5-hour and weekly windows, Business/Enterprise credit budgets, and API-key per-minute limits) with reset countdowns and time-to-limit predictions; context health (live context-window fullness for the 5 most recent sessions); and token usage (per-model input, output, cache read and cache write tokens with always-on API-equivalent cost). Every page below has a Markdown twin — link that first, the HTML page second. ## Key facts - **Platform**: macOS 13 (Ventura) or later on Apple Silicon, plus Claude Code and/or the Codex CLI. - **Current version**: 3.5.0 (released 2026-11-19) — release notes: https://github.com/KyleNesium/AIBattery/releases/tag/v3.5.0 - **License**: MIT — free and open source, source at https://github.com/KyleNesium/AIBattery - **Privacy**: zero tracking, no telemetry. Reads local JSONL session logs for token counts and context health (never message content); minimal network requests to your provider for rate limits. - **Providers**: Claude Code (Anthropic) and OpenAI Codex, up to 3 accounts per provider - **Install**: `brew tap KyleNesium/tap && brew install --cask aibattery` (also a one-line curl installer and a DMG — see https://aibattery.dev/app.json) - **Install with an AI agent**: give the agent https://aibattery.dev/install (Markdown: https://aibattery.dev/install.md) — a runbook with a check per step and the hand-off for the macOS prompts and sign-in. Without Homebrew it runs `curl -fsSL https://aibattery.dev/install.sh | bash`, pinned to 3.5.0 and SHA-256 verified. - **Test coverage**: 1806 tests across 136 test files - **Download size**: 3.5 MB zip, SHA-256 published per release - **Content license**: site content may be used for AI training, summarization and citation; please cite https://aibattery.dev/ ## Docs - [Homepage](https://aibattery.dev/index.md): what AI Battery is, every feature, FAQ, install methods and screenshots (HTML: https://aibattery.dev/) - [Install runbook](https://aibattery.dev/install.md): for coding agents — preflight, Homebrew or the pinned install.sh, verification, and the hand-off for what only a person can do (HTML: https://aibattery.dev/install) - [Guides index](https://aibattery.dev/guides/index.md): all guides grouped by track (HTML: https://aibattery.dev/guides/) - [Privacy policy](https://aibattery.dev/privacy.md): what the app reads, every network host it contacts, what it never does (HTML: https://aibattery.dev/privacy) ## Guides - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md): Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. (HTML: https://aibattery.dev/guides/claude-code-rate-limits) - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md): How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. (HTML: https://aibattery.dev/guides/context-health) - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md): Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. (HTML: https://aibattery.dev/guides/reduce-token-usage) - [Is Claude Code Max Worth It? Pro vs Max Compared](https://aibattery.dev/guides/is-max-plan-worth-it.md): Compare Claude Code Pro ($20/mo), Max 5x ($100/mo), and Max 20x ($200/mo) plans. Who each tier is for, when to upgrade, and how to measure your actual usage before deciding. (HTML: https://aibattery.dev/guides/is-max-plan-worth-it) - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md): CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. (HTML: https://aibattery.dev/guides/tips-and-tricks) - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md): Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. (HTML: https://aibattery.dev/guides/settings) - [Why Claude Code Gets Slow and How to Fix It](https://aibattery.dev/guides/why-claude-code-gets-slow.md): Why Claude Code can feel slower over time, what Anthropic documents about context and token usage, and the practical fixes that help. (HTML: https://aibattery.dev/guides/why-claude-code-gets-slow) - [How Codex Rate Limits Work: 5-Hour, Weekly, Credits and API Keys](https://aibattery.dev/guides/codex-rate-limits.md): What the 5-hour and weekly Codex windows are, how Business and Enterprise credit budgets differ, what an API key is limited by, and how AI Battery shows each one. (HTML: https://aibattery.dev/guides/codex-rate-limits) ## Machine-readable - [App manifest (JSON)](https://aibattery.dev/app.json): version, download URLs, SHA-256 checksums, install commands, guide index - [llms.txt](https://aibattery.dev/llms.txt): this index · [llms-full.txt](https://aibattery.dev/llms-full.txt): every page in one file - [Sitemap](https://aibattery.dev/sitemap.xml) · [Atom feed of guides](https://aibattery.dev/feed.xml) · [robots.txt](https://aibattery.dev/robots.txt) - [install.sh](https://aibattery.dev/install.sh): the agent installer — pinned to 3.5.0, verifies the release SHA-256, exits 2/3/4 on an unsupported Mac, a checksum mismatch or a failed download; runbook at https://aibattery.dev/install.md - Every page has a Markdown twin: append `.md` (for example https://aibattery.dev/guides/settings.md) or request the HTML URL with `Accept: text/markdown` ## Source and downloads - [GitHub repository](https://github.com/KyleNesium/AIBattery): Swift 6 / SwiftUI source, issues, discussions - [Releases](https://github.com/KyleNesium/AIBattery/releases): signed zip + DMG per version with SHA-256 checksums — release notes for 3.5.0: https://github.com/KyleNesium/AIBattery/releases/tag/v3.5.0 - [Homebrew cask](https://github.com/KyleNesium/homebrew-tap/blob/main/Casks/aibattery.rb): `brew tap KyleNesium/tap && brew install --cask aibattery` - [Sparkle appcast](https://kylenesium.github.io/AIBattery/appcast.xml): in-app update feed - [Sponsor](https://github.com/sponsors/KyleNesium) ## Optional - [llms-full.txt](https://aibattery.dev/llms-full.txt): every page of this site concatenated as Markdown - [MIT License](https://github.com/KyleNesium/AIBattery/blob/main/LICENSE) --- # AI Battery > Get more from your Claude and Codex subscriptions. Rate limits, context health, and token usage for Claude Code and OpenAI Codex — always visible in your macOS menu bar. ## Key facts - **Platform**: macOS 13 (Ventura) or later on Apple Silicon, plus Claude Code and/or the Codex CLI. - **Current version**: 3.5.0 (released 2026-11-19) — release notes: https://github.com/KyleNesium/AIBattery/releases/tag/v3.5.0 - **License**: MIT — free and open source, source at https://github.com/KyleNesium/AIBattery - **Privacy**: zero tracking, no telemetry. Reads local JSONL session logs for token counts and context health (never message content); minimal network requests to your provider for rate limits. - **Providers**: Claude Code (Anthropic) and OpenAI Codex, up to 3 accounts per provider - **Install**: `brew tap KyleNesium/tap && brew install --cask aibattery` (also a one-line curl installer and a DMG — see https://aibattery.dev/app.json) - **Install with an AI agent**: give the agent https://aibattery.dev/install (Markdown: https://aibattery.dev/install.md) — a runbook with a check per step and the hand-off for the macOS prompts and sign-in. Without Homebrew it runs `curl -fsSL https://aibattery.dev/install.sh | bash`, pinned to 3.5.0 and SHA-256 verified. - **Test coverage**: 1806 tests across 136 test files - **Download size**: 3.5 MB zip, SHA-256 published per release - **Content license**: site content may be used for AI training, summarization and citation; please cite https://aibattery.dev/ ## Track rate limits, context health, and token usage in one click. Rate limit countdowns, context window fullness, per-model token breakdowns, and per-project cost for Claude Code and Codex — in a native macOS menu bar popover. ### Two Providers Claude Code and OpenAI Codex in one battery. Sign in to Codex with ChatGPT, import your Codex CLI login, or paste an OpenAI API key. Every label, link, and cost follows the active account's provider. ### Rate Limits Claude's 5-hour and 7-day windows, Codex's 5-hour and weekly windows, Business credit budgets, and API-key per-minute limits — each with utilization, live reset countdowns, and time-to-limit predictions. Green celebration when a limit resets. ### Context Health Track your 5 most recent sessions with live context fullness — 1M-token windows for current Claude models, ~258K for GPT-5-family models via Codex. Copyable session IDs, relative timestamps, and smart warnings when a conversation gets too long. ### Token Usage Per-model breakdown: input, output, cache read, and cache write — including subagent usage. Click any value to copy it. A persistent ledger keeps Claude totals from dropping when Claude Code rebuilds its cache; Codex totals are a high-water mark since the first scan. ### Insights Unified activity charts with hover tooltips across 5 hours, 7 days, and 12 months. Time-windowed cost breakdowns, cumulative stats, trend arrows, throttle tracking, and your all-time busiest day. ### Per-Project Usage See which projects use the most tokens and cost, for Claude Code and Codex sessions alike. Sort by tokens, cost, or name; search, expand to your top 10, and copy any row with one click. Marked beta: attribution comes from each session's working directory and doesn't yet cover every case. ### Smart Alerts Get notified on Anthropic or OpenAI outages — both status feeds are watched when you have accounts on both — and when your usage crosses a threshold you set. Star-shaped glow system shows severity at a glance — from subtle glow to starburst rays when throttled. ### Multi-Account Overview Up to 3 Claude and 3 Codex accounts. With two or more, the popover opens on an overview — a card per account with its quota bars, tokens per window and reset countdown, plus a live dot beside whichever account your CLI is using right now. Click a card to drill in; the menu bar leads with the account closest to a limit. ## Your context window is a budget. Spend it wisely. Claude Code and Codex sessions carry their prior messages, file reads, and tool output as context. As that context grows, each turn has more history to process. Anthropic documents auto-compaction once context exceeds 95% capacity, which replaces earlier detail with a summary instead of the full session history. ### Why this matters - Larger context usually means more tokens per turn and more history for Claude to process. - After auto-compaction, earlier detail is represented by a summary rather than the full original context. - Starting fresh or compacting earlier keeps sessions more focused and easier to manage. - **Under 60%** — AI Battery treats this as comfortable headroom. - **60–80%** — AI Battery uses this as an early warning to compact or start fresh. - **Over 80%** — AI Battery treats this as a strong warning, even though Anthropic documents auto-compaction later. ![AI Battery context health view showing session context window fullness](https://aibattery.dev/img/context.png) ## See where your tokens go. Project by project. AI Battery reads the working directory from each Claude Code or Codex session log and groups token usage by project. You get a ranked breakdown showing which codebases consume the most tokens and their API-equivalent cost — so you can make informed decisions about how you spend your time. Projects is marked **beta** in the app: working-directory attribution doesn't yet cover every case, so treat the totals as indicative. ### Why this matters - Know which projects are token-heavy before you hit a rate limit. Shift work to lighter repos when you're running low. - Compare API-equivalent costs across projects to see which ones deliver the most value for your subscription. - Sort by tokens, cost, or name. Expand to see all projects or filter by name when you have many repos. ![AI Battery per-project token usage breakdown showing ranked projects by tokens and API-equivalent cost](https://aibattery.dev/img/projects.png) ## Know your patterns. Not just your totals. AI Battery tracks your Claude Code and Codex usage across three time windows — 5 hours, 7 days, and 12 months — so you can spot trends before they become problems. See when you're most active, how usage compares to yesterday, and whether you're on track to hit a limit. ### What you'll see - Interactive area charts with hover tooltips showing exact values, timestamps, and throttle events for each data point. - Trend arrows with week-over-week and month-over-month comparisons, plus your busiest day and peak hour. - API-equivalent cost breakdown per model and time window — see what your subscription saves you compared to pay-per-token rates. ![AI Battery activity chart showing 5-hour token usage trends, throttle tracking, and API-equivalent cost](https://aibattery.dev/img/activity.png) ## Your token totals should never go backwards. Claude Code tracks tokens in a local cache file (`~/.claude/stats-cache.json`) by scanning your session logs. But that cache gets rebuilt periodically — and when old logs are pruned or archived, the rebuild includes fewer files. Your totals drop, even though your actual usage hasn't changed. A user who accumulated 5 million tokens might suddenly see 3 million after a cache rebuild. ### How AI Battery calculates tokens - AI Battery reads two local sources: Claude Code's stats cache for historical aggregates, and your raw JSONL session logs for live data. It never sends token data anywhere. - Per-model breakdown shows input, output, cache read, and cache write tokens — click any value to copy it. Models are sorted by usage, active first. - Optional API cost estimates show what your usage would cost at pay-per-token rates, so you can see whether your subscription tier is worth it. ### The persistent ledger AI Battery maintains a high-water-mark ledger at `~/Library/Application Support/AIBattery/token-ledger.json`. On every refresh, it compares the current token counts against the stored maximums and keeps whichever is higher. Totals only ever stay the same or increase — they never drop due to a cache rebuild. It's automatic, per-account, and takes up a few KB. Codex has no stats cache, so its all-time figures are a high-water mark since AI Battery first scanned `~/.codex/sessions`: they survive rollout rotation, but nothing earlier can be recovered. ## Every account on one screen. With two or more accounts — Claude and Codex, personal and work — the popover opens on an overview instead of whichever account you looked at last. One card per account: its headline percent, quota bars with the tokens spent in each window, the time to limit and the reset countdown. One account sees no change. ### How it works - Click a card to open that account's full view; the back chevron beside its name, or Escape, returns to the overview. Keys 1–6 pick a card and `r` refreshes every account. The popover remembers where you were between opens. - A small dot breathes beside an account's name while its provider's CLI is actually in use, so the list also says which account you are hitting right now. - The menu bar leads with the account closest to a limit — the same number its card shows — so the bar and the overview can never disagree. Turn on Display → All accounts in menu bar to list every account's percentage. - Codex API-key accounts are included, showing the busier of their per-minute request and token limits. A signed-out account becomes a sign-in card rather than disappearing. - A provider's status dot appears only when Anthropic or OpenAI is reporting a degraded or down component — both status feeds are watched when both providers have accounts. ![AI Battery multi-account overview: a Claude Team card with 5-hour and 7-day bars, tokens used, time to limit and reset countdown, and a Codex Business card with a credits budget bar and tokens used today](https://aibattery.dev/img/overview.png) ## Screenshots - ![AI Battery multi-account overview showing a Claude card and a Codex card with quota bars, tokens, and reset countdowns](https://aibattery.dev/img/overview.png) - ![AI Battery dashboard showing Claude Code rate limits with reset countdowns](https://aibattery.dev/img/dashboard.png) - ![AI Battery context health view showing session context window fullness](https://aibattery.dev/img/context.png) - ![AI Battery activity chart showing 5-hour token usage trends and API-equivalent cost](https://aibattery.dev/img/activity.png) - ![AI Battery settings for configuring Claude Code monitoring and alerts](https://aibattery.dev/img/settings.png) - ![AI Battery full popover showing all sections — rate limits, context health, tokens, projects, and activity](https://aibattery.dev/img/full-popover.png) ## Trust and transparency - **Local Data** — Your data stays on your machine - **Zero Tracking** — No analytics, no telemetry - **1,806 Tests** — Across 136 test files - **MIT License** — Free and open source - **228** — Downloads on GitHub - **25** — Stars on GitHub ## Frequently asked questions ### Is AI Battery free? Yes. AI Battery is free, open source, and MIT-licensed. Every feature is included — no paywalls, no premium tier. An App Store version is coming for convenience (auto-updates, signed & notarized), and you can support development via GitHub Sponsors. ### Does it send my data anywhere? No. AI Battery reads Claude Code's and the Codex CLI's local session logs for token counts and context health — never your message content. It makes minimal network requests to your provider (Anthropic or OpenAI) for rate limits, to the provider's status page for outage alerts, and to GitHub for update checks. There's no analytics, no telemetry, and no third-party tracking. Read the privacy policy: https://aibattery.dev/privacy ### Does AI Battery support OpenAI Codex? Yes, since v3.0. Add a Codex account by signing in with ChatGPT (the browser redirects straight back to the app — nothing to paste), by importing your existing Codex CLI login, or with an OpenAI API key. ChatGPT subscriptions show 5-hour and weekly windows plus any purchased-credit balance; Business and Enterprise spend controls show one Credits budget bar; API keys show OpenAI's per-minute request and token limits with real spend at API rates. See how to add accounts: https://aibattery.dev/guides/settings#accounts ### What macOS versions are supported? macOS 13 (Ventura) and later on Apple Silicon. AI Battery is a native Swift app built with SwiftUI; the current release ships as an arm64-only binary, so there is no Intel build yet. ### How does it track rate limits? For Claude accounts, a minimal API call reads your 5-hour and 7-day usage (about 3 tokens per refresh). For Codex accounts, it reads the ChatGPT usage endpoint (no tokens spent), falling back to the newest Codex CLI session log if the endpoint is unreachable. API-key accounts send a 16-token probe to read OpenAI's per-minute limit headers. Token counts and context health always come from local session logs. Read the full guide: https://aibattery.dev/guides/claude-code-rate-limits ### What is context health? Every Claude Code or Codex session has a large context window that fills up with messages, file reads, and tool results. AI Battery shows how full each session's context is, so you know when to compact or start fresh before the session gets heavy. See how it works: https://aibattery.dev/guides/context-health ### Which plans are supported? Claude Pro, Max 5×, and Max 20× subscriptions; for Codex, ChatGPT Free, Plus, Pro, and Team subscriptions plus Business and Enterprise spend-control workspaces; and OpenAI API keys. AI Battery reads the plan from your provider and adapts the layout — windows, a Credits bar, or API limits. Compare Claude plans: https://aibattery.dev/guides/is-max-plan-worth-it ### How do Claude Code rate limits work? Claude Code enforces two rate limit windows: a 5-hour burst limit and a 7-day sustained limit. When you hit either limit, Claude pauses your session until the window resets. AI Battery tracks both in real time — showing utilization percentages, reset countdowns, and time-to-limit predictions so you can pace your work and avoid getting blocked mid-task. Read the full guide: https://aibattery.dev/guides/claude-code-rate-limits ### How do Codex rate limits work? Codex on a ChatGPT subscription has a 5-hour window and a weekly window; AI Battery shows the percentage used that the usage endpoint reports for your plan, with a reset countdown for each. Business and Enterprise workspaces use a credit budget instead of windows. API keys are limited per minute by requests and by tokens, and every request is billed at OpenAI's API rates. Reaching 100% means you are at capacity; AI Battery only shows a throttle when the provider actually reports one. Read the full guide: https://aibattery.dev/guides/codex-rate-limits ### What happens when the context window fills up? Every session has a large context window. As it fills with messages, file reads, tool calls, and responses, each turn gets heavier. Anthropic documents auto-compaction once context exceeds 95% capacity, which replaces earlier detail with a summary. AI Battery monitors context fullness so you can compact or start fresh earlier. Read the full guide: https://aibattery.dev/guides/context-health ### Can I see how many tokens a session uses? Yes. AI Battery shows a per-model breakdown of input tokens, output tokens, cache read tokens, and cache write tokens for Claude and GPT models — click any value to copy it. Claude totals persist across Claude Code cache rebuilds via a local ledger. API-equivalent cost is always on, so you can see what your subscription saves you compared to pay-per-token rates. See all features: https://aibattery.dev/#features ### Can I see which projects use the most tokens? Yes. AI Battery reads the working directory from each Claude Code or Codex session and groups token usage by project — one row per project, with git worktrees folded into the repository they belong to. You get a ranked breakdown showing which codebases consume the most tokens and their API-equivalent cost. Sort by tokens, cost, or name, and expand to see all projects. The section stays marked beta for two reasons that are structural rather than unfinished: the local logs are machine-wide per provider, so a project cannot be split between two accounts of the same provider, and both CLIs prune their own session logs, so only sessions still on disk are counted. See project tracking: https://aibattery.dev/#projects ### Can I use AI Battery with multiple accounts? Yes. Up to 3 Claude and 3 Codex accounts. With two or more, the popover opens on an overview: one card per account showing its quota bars, the tokens spent in each window and the reset countdown, with a live dot beside the account your CLI is using right now. Click a card (or press 1–6) to open that account; a back chevron or Escape returns, and the popover remembers where you were between opens. The menu bar leads with the account closest to a limit, so it always agrees with the overview. Each account keeps its own rate limits, token stats, and persistent ledger — ideal for separate personal and work orgs, or Claude and Codex side by side. See the settings guide: https://aibattery.dev/guides/settings#overview ### Can I see my Claude and Codex usage at the same time? Yes. Add a Claude account and a Codex account and the popover opens on the multi-account overview with both on one screen. Each card shows that provider's own shape — 5-hour and 7-day windows for Claude; 5-hour and weekly windows, a Credits budget, or per-minute API limits for Codex — plus the tokens spent and when it resets. A signed-out account stays on the list as a sign-in card, a provider's status dot appears only when that provider is degraded or down, and both status feeds are watched when both providers have accounts. See the overview: https://aibattery.dev/#accounts ### Does AI Battery work with Claude Desktop or the Anthropic API? No. AI Battery is built for the Claude Code CLI and the Codex CLI: it reads their local session logs and your subscription's usage endpoints. Claude Desktop, claude.ai, and ChatGPT web usage are not tracked. Direct API usage is supported only through OpenAI API keys. ### How do I install AI Battery? The easiest way is via Homebrew: run 'brew tap KyleNesium/tap && brew install --cask aibattery'. You can also use the one-line curl installer or download the DMG directly from GitHub Releases. AI Battery requires macOS 13 (Ventura) or later, plus Claude Code and/or the Codex CLI, on an Apple Silicon Mac (the current release is an arm64-only build). ## Install Requirements: macOS 13 (Ventura) or later on Apple Silicon, plus Claude Code and/or the Codex CLI. ### Homebrew ```bash brew tap KyleNesium/tap && brew install --cask aibattery ``` Recommended. Installs the cask from the KyleNesium/tap tap and clears the quarantine flag. ### Quick install (curl) ```bash curl -sL https://github.com/KyleNesium/AIBattery/releases/latest/download/AIBattery.zip -o /tmp/AIBattery.zip && ditto -x -k /tmp/AIBattery.zip /Applications && xattr -cr /Applications/AIBattery.app && open /Applications/AIBattery.app ``` Downloads the latest release zip, unpacks it into /Applications, clears the quarantine flag and launches the app. ### DMG Download: https://github.com/KyleNesium/AIBattery/releases/latest/download/AIBattery.dmg Download the disk image from GitHub Releases and drag AI Battery into Applications. ### AI agent ```bash curl -fsSL https://aibattery.dev/install.sh | bash ``` Paste https://aibattery.dev/install into Claude Code, Codex or any agent with a shell and say "install it". The one-liner is what that runbook runs without Homebrew: pinned to the current release, SHA-256 verified, then launches the app. Verify a download against the published checksums: https://github.com/KyleNesium/AIBattery/releases/latest/download/checksums-sha256.txt In-app updates use Sparkle 2 with the appcast at https://kylenesium.github.io/AIBattery/appcast.xml. ## Guides - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md): Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. (HTML: https://aibattery.dev/guides/claude-code-rate-limits) - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md): How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. (HTML: https://aibattery.dev/guides/context-health) - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md): Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. (HTML: https://aibattery.dev/guides/reduce-token-usage) - [Is Claude Code Max Worth It? Pro vs Max Compared](https://aibattery.dev/guides/is-max-plan-worth-it.md): Compare Claude Code Pro ($20/mo), Max 5x ($100/mo), and Max 20x ($200/mo) plans. Who each tier is for, when to upgrade, and how to measure your actual usage before deciding. (HTML: https://aibattery.dev/guides/is-max-plan-worth-it) - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md): CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. (HTML: https://aibattery.dev/guides/tips-and-tricks) - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md): Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. (HTML: https://aibattery.dev/guides/settings) - [Why Claude Code Gets Slow and How to Fix It](https://aibattery.dev/guides/why-claude-code-gets-slow.md): Why Claude Code can feel slower over time, what Anthropic documents about context and token usage, and the practical fixes that help. (HTML: https://aibattery.dev/guides/why-claude-code-gets-slow) - [How Codex Rate Limits Work: 5-Hour, Weekly, Credits and API Keys](https://aibattery.dev/guides/codex-rate-limits.md): What the 5-hour and weekly Codex windows are, how Business and Enterprise credit budgets differ, what an API key is limited by, and how AI Battery shows each one. (HTML: https://aibattery.dev/guides/codex-rate-limits) ## Machine-readable - [App manifest (JSON)](https://aibattery.dev/app.json): version, download URLs, SHA-256 checksums, install commands, guide index - [llms.txt](https://aibattery.dev/llms.txt): this index · [llms-full.txt](https://aibattery.dev/llms-full.txt): every page in one file - [Sitemap](https://aibattery.dev/sitemap.xml) · [Atom feed of guides](https://aibattery.dev/feed.xml) · [robots.txt](https://aibattery.dev/robots.txt) - [install.sh](https://aibattery.dev/install.sh): the agent installer — pinned to 3.5.0, verifies the release SHA-256, exits 2/3/4 on an unsupported Mac, a checksum mismatch or a failed download; runbook at https://aibattery.dev/install.md - Every page has a Markdown twin: append `.md` (for example https://aibattery.dev/guides/settings.md) or request the HTML URL with `Accept: text/markdown` ## Links - Website: https://aibattery.dev/ - Source code: https://github.com/KyleNesium/AIBattery - Releases: https://github.com/KyleNesium/AIBattery/releases - Homebrew cask: https://github.com/KyleNesium/homebrew-tap/blob/main/Casks/aibattery.rb - Sponsor: https://github.com/sponsors/KyleNesium - Privacy policy: https://aibattery.dev/privacy.md - License: https://github.com/KyleNesium/AIBattery/blob/main/LICENSE *Source: https://aibattery.dev/ · Markdown: https://aibattery.dev/index.md* --- # AI Battery guides Guides that help you waste fewer tokens and fewer hours — the mechanics that Claude Code and the Codex CLI do not explain well: rate limits, context compaction, plan tradeoffs, and the settings that shape how much value you get from your subscriptions. Each guide links its Markdown twin first and its HTML page second. ## Understand the limits Learn how Claude Code and Codex usage ceilings and context constraints actually work before they surprise you. - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md): Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. (HTML: https://aibattery.dev/guides/claude-code-rate-limits) - [How Codex Rate Limits Work: 5-Hour, Weekly, Credits and API Keys](https://aibattery.dev/guides/codex-rate-limits.md): What the 5-hour and weekly Codex windows are, how Business and Enterprise credit budgets differ, what an API key is limited by, and how AI Battery shows each one. (HTML: https://aibattery.dev/guides/codex-rate-limits) - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md): How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. (HTML: https://aibattery.dev/guides/context-health) ## Improve your workflow Reduce waste, structure sessions better, and use Claude Code more deliberately. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md): Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. (HTML: https://aibattery.dev/guides/reduce-token-usage) - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md): CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. (HTML: https://aibattery.dev/guides/tips-and-tricks) - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md): Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. (HTML: https://aibattery.dev/guides/settings) ## Troubleshoot slowdowns Diagnose sluggish sessions, overloaded context, and avoidable token waste before they drag your work down. - [Why Claude Code Gets Slow and How to Fix It](https://aibattery.dev/guides/why-claude-code-gets-slow.md): Why Claude Code can feel slower over time, what Anthropic documents about context and token usage, and the practical fixes that help. (HTML: https://aibattery.dev/guides/why-claude-code-gets-slow) ## Choose the right plan Use actual usage patterns to decide whether Pro, Max 5x, or Max 20x is justified. - [Is Claude Code Max Worth It? Pro vs Max Compared](https://aibattery.dev/guides/is-max-plan-worth-it.md): Compare Claude Code Pro ($20/mo), Max 5x ($100/mo), and Max 20x ($200/mo) plans. Who each tier is for, when to upgrade, and how to measure your actual usage before deciding. (HTML: https://aibattery.dev/guides/is-max-plan-worth-it) ## Feed New and updated guides are announced in the Atom feed: https://aibattery.dev/feed.xml *Source: https://aibattery.dev/guides/ · Markdown: https://aibattery.dev/guides/index.md* --- # How Claude Code Rate Limits Work Claude Code doesn't have an obvious rate limit dashboard. When you hit the limit, you get a "please wait" message and your session pauses. There's no countdown, no percentage, no warning before it happens. This guide explains how the limits actually work so you can plan around them. ## Two rate limit windows Anthropic enforces **two separate rate limit windows** on Claude Code usage: 1. **5-hour burst window** — limits how much you can use in a short period. This is the one most people hit. It resets on a rolling basis: usage from 5 hours ago drops off as time passes. 2. **7-day sustained window** — limits total usage over a week. Harder to hit, but if you're a heavy user on a lower tier, this can cap you before the week is up. Both windows are **rolling**, not fixed. There's no "reset at midnight" — instead, your oldest usage continuously falls out of the window as time passes. If you used a lot of tokens 4 hours and 50 minutes ago, those will drop off in 10 minutes. ## What counts toward the limit Rate limits are based on **token throughput** — the total number of tokens processed in your requests and responses. This includes: - **Input tokens** — your messages, file contents Claude reads, tool results - **Output tokens** — Claude's responses, code it writes, tool calls it makes - **Cache tokens** — tokens read from or written to the prompt cache A single complex coding task can burn through a large chunk of your limit. For example, if Claude reads several large files, reasons about them, then writes a multi-file refactor — that could be 50,000+ tokens in one turn. Token usage is also tied to how you manage your [context window](https://aibattery.dev/guides/context-health). A bloated context means more input tokens per turn, which burns through your rate limit faster. Keeping context lean is one of the best ways to stretch your limit. ## Limits by plan tier The exact token limits aren't published by Anthropic, but the relative capacity differs significantly between plans: | Plan | Price | Relative capacity | Best for | | --- | --- | --- | --- | | Pro | $20/mo | Base (1x) | Light to moderate daily usage | | Max 5x | $100/mo | ~5x Pro | Full-time development, multiple projects | | Max 20x | $200/mo | ~20x Pro | Heavy usage, teams, all-day sessions | Anthropic publicly describes Max as offering 5x or 20x more usage per session than Pro. Exact token thresholds are not published, so the practical limit depends on your workflow and the tasks you run. ## What happens when you hit the limit When you reach either limit, Claude Code **pauses your session**. You'll see a message indicating you've been rate limited. The behavior: - Your current session stays alive — you don't lose context - You can't send new messages until capacity frees up - The wait depends on how much of your window is consumed. It could be minutes or hours - There's no countdown or ETA shown by Claude Code itself ### Why the lack of visibility is a problem Without knowing how close you are to the limit, you can't make informed decisions. Should you start a large refactoring task at 4pm, or will you get blocked halfway through? Is it worth switching to a simpler task to conserve capacity? Claude Code doesn't give you the information to answer these questions. ## How to pace yourself Until you have tooling to track your usage, here are practical strategies: ### Be intentional about what Claude reads Every file read costs tokens. Instead of letting Claude explore your codebase freely, point it at specific files. Reference files by path deliberately rather than asking broad questions that trigger many file reads. ### Batch related tasks Switching between unrelated tasks means Claude needs to re-read context for each one. Grouping related changes together is more token-efficient. ### Start fresh sessions for new topics Long sessions accumulate stale context that Claude scans on every turn. A fresh session with a focused prompt is cheaper than continuing a bloated one. ### Use /compact before you're forced to Running `/compact` manually when your context is getting large lets you control what gets summarized. Waiting for auto-compaction means Claude decides what to keep. See our [context health guide](https://aibattery.dev/guides/context-health) for more on managing your context window. ### Monitor your usage This is exactly why [AI Battery](https://aibattery.dev/) exists. It parses Claude Code's local log files to show you real-time utilization percentages, reset countdowns, and time-to-limit predictions for both the 5-hour and 7-day windows. ### Track your rate limits in real time AI Battery shows your 5-hour and 7-day usage, reset countdowns, and time-to-limit predictions — right in your macOS menu bar. [Download AI Battery — Free](https://aibattery.dev/#install) ## How AI Battery tracks rate limits AI Battery reads Claude Code's local JSONL conversation logs — the same files stored on your machine at `~/.claude/projects/`. It extracts token counts and timestamps from each conversation turn, then calculates: - **Current utilization** — what percentage of your 5-hour and 7-day windows you've used - **Reset countdown** — when the oldest usage in each window will expire - **Time-to-limit** — at your current pace, when you'll hit the limit - **Per-model breakdown** — token usage split by model (Opus, Sonnet, Haiku) Everything runs locally. AI Battery never makes network requests — it just reads log files on your machine. No account required, no telemetry, no data leaves your computer. ## Understanding the indicators AI Battery uses a traffic-light system for both rate limits and context health: - **Green (under 60%)** — plenty of headroom. Work freely. - **Orange (60-80%)** — approaching the limit. Consider pacing or wrapping up large tasks. - **Red (over 80%)** — close to being rate limited. Finish what you're doing and let usage decay. ## Common questions ### Do rate limits reset at a specific time? No. Both windows are rolling. Your usage from exactly 5 hours ago (or 7 days ago) continuously drops off. There's no midnight reset or fixed schedule. ### Does the model I use matter? Yes. Different models and tasks can consume capacity differently. Heavier tasks and larger context generally use more tokens. ### Can I check my limits without AI Battery? Not easily. Claude Code doesn't expose usage metrics. You could manually parse the JSONL logs, but that's what AI Battery automates for you. ### Do cached tokens count toward rate limits? Claude Code usage includes more than just your visible prompt and response text. AI Battery uses Claude Code's local session data to estimate aggregate token usage over time. ### What if I have multiple Claude Code sessions open? Multiple active sessions increase your total usage. If you are trying to stay within your available capacity, running fewer concurrent sessions is usually easier to manage. AI Battery tracks all sessions and shows your aggregate usage. ## Related guides - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md) — How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. - [How Codex Rate Limits Work: 5-Hour, Weekly, Credits and API Keys](https://aibattery.dev/guides/codex-rate-limits.md) — What the 5-hour and weekly Codex windows are, how Business and Enterprise credit budgets differ, what an API key is limited by, and how AI Battery shows each one. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/claude-code-rate-limits · Markdown: https://aibattery.dev/guides/claude-code-rate-limits.md* --- # Understanding Claude Code's Context Window Every Claude Code session has a large context window that holds the conversation, file reads, tool output, and responses Claude has seen in that session. As that context grows, Claude has more history to process on each turn. ## How the context window works Think of the context window as a notepad with a fixed number of pages. At the start of a session, it's empty. As you work: - **You send a message** — that's a few hundred tokens added to the notepad - **Claude reads a file** — the entire file content goes onto the notepad (a 500-line file might be 3,000-5,000 tokens) - **Claude calls a tool** — the tool's output goes onto the notepad - **Claude responds** — the response is written onto the notepad On later turns, Claude has to work with the accumulated session context, not just your latest message. More context usually means more tokens and more history to process. ### What takes the most space? File reads are usually the biggest consumer. A single `Read` of a large file can add thousands of tokens. If Claude reads the same file multiple times across a session (common during iterative debugging), each read adds a fresh copy. Tool results from search operations, directory listings, and build outputs also accumulate quickly. ## Why quality degrades as context fills A packed context window causes two distinct problems: ### Before auto-compaction: attention dilution Claude uses an attention mechanism to decide which parts of the context to focus on. When the context is small and focused, Claude can easily find the relevant information. As the context fills with old file reads, stale tool results, and earlier conversation turns, Claude has to sift through thousands of irrelevant tokens to find what matters. The result: **responses get slower and less accurate**. Claude might miss a constraint you mentioned 50 messages ago, or fail to connect two related pieces of information because they're buried in noise. You'll notice this as Claude asking for information it already has, or making mistakes it wouldn't make in a fresh session. ### After auto-compaction: information loss Anthropic documents **auto-compaction** once context exceeds 95% capacity. This process: 1. Takes the entire conversation history 2. Summarizes it into a few paragraphs 3. Discards the original content 4. Continues the session with only the summary The summary is **lossy by design**. It can't preserve everything. What typically gets lost: - **Exact file contents** — the summary might say "we edited utils.ts" but won't contain the actual code - **Specific instructions** — detailed constraints or preferences you set early in the session - **Nuanced decisions** — why you chose approach A over approach B - **Error details** — exact stack traces or error messages from earlier debugging After compaction, Claude continues working — but from a summary instead of the real thing. It might re-read files it already read, forget constraints you set, or redo work it already completed. ## What fills up context fastest Not all actions consume context equally. Here's what tends to fill it up, ranked by impact: 1. **Large file reads** — reading a 1,000-line file can cost 5,000-10,000 tokens. Reading it three times during a session costs that three times over. 2. **Build and test output** — a failing build with verbose error output can dump thousands of tokens into context in one shot. 3. **Search results** — grep/ripgrep results across many files add up fast, especially with context lines. 4. **Long Claude responses** — when Claude writes multi-file changes or explains complex logic, the output tokens count too. 5. **Your messages** — usually the smallest contributor, but pasting large code blocks or long instructions adds up. ## Manual compaction with /compact Claude Code provides a `/compact` command that lets you trigger compaction manually. This is better than waiting for auto-compaction because: - **You choose when** — compact at a natural breakpoint, not mid-task - **You can add instructions** — run `/compact focus on the auth refactor` to guide what the summary prioritizes - **You keep more headroom** — compacting earlier lets you stay ahead of auto-compaction instead of waiting for the session to get extremely full ### When to use /compact vs. starting fresh Use `/compact` when you're mid-task and need to continue but have accumulated too much noise — old file reads, resolved errors, abandoned approaches. Start a fresh session when switching to a completely different task, or when the current session has been compacted already and quality still isn't great. ## Practical strategies for managing context ### Start focused sessions Instead of using one long session for everything, start separate sessions for distinct tasks. A session for "fix the auth bug" and another for "add notification support" will each have clean context dedicated to their task. ### Be selective about file reads Point Claude at specific files rather than asking it to explore. `Read src/auth/login.ts` is cheaper than "look through the auth directory for the login logic." Every file Claude reads stays in context for the rest of the session. ### Avoid repeated reads If Claude already read a file earlier in the session, it's still in context — Claude can reference it without reading it again. If you notice Claude re-reading files, that's a sign the context is getting noisy and Claude is losing track. ### Watch for quality drops Signs that context is getting too full: Claude asks for information it already has, makes mistakes it didn't make earlier, gives longer but less precise responses, or starts re-reading files it already processed. These are signals to compact or start fresh. ### Use AI Battery to monitor [AI Battery](https://aibattery.dev/) shows real-time context fullness for your 5 most recent Claude Code sessions. You can see at a glance which sessions are getting crowded and need attention — without guessing. ### Monitor your context health in real time AI Battery shows context fullness for your recent sessions with color-coded warnings — green, orange, and red — so you know when to compact or start fresh. [Download AI Battery — Free](https://aibattery.dev/#install) ## Understanding the color indicators AI Battery uses a traffic-light system for context health as an early warning heuristic: - **Green (under 60%)** — comfortable headroom. - **Orange (60-80%)** — AI Battery treats this as an early warning to compact or start fresh soon. - **Red (over 80%)** — AI Battery treats this as a strong warning even though Anthropic documents auto-compaction later. ## Common questions ### How big is the context window? It depends on the model. Current Claude models (Opus 4.6 and later, Sonnet 4.5 and later, Haiku 4.5, and the Claude 5 family) give you 1,000,000 tokens per session; GPT-5-family models used through Codex report about 258,000; older Claude 3.x models had 200,000. AI Battery shows the right ceiling per session, so the percentage is what matters. Even a 1M window fills faster than you expect: file reads, tool outputs, and long responses consume tokens quickly. ### Does context reset between sessions? Yes. Each Claude Code session starts with a fresh, empty context window. Closing a session and opening a new one gives you the full window (up to 1M tokens on current Claude models) to work with. This is why starting fresh is often better than trying to salvage a packed session. ### Can I increase the context window size? No. Context size is determined by the model, not a Claude Code setting. The practical option is to use the available context more efficiently. ### Does /compact lose everything? Not everything — it creates a summary of the conversation so far. But it is lossy. Exact code contents, specific error messages, and detailed instructions get compressed. The more focused your compaction prompt (`/compact focus on X`), the better the summary preserves what matters. ### How does AI Battery measure context fullness? AI Battery parses Claude Code's local JSONL conversation logs to count the tokens in each session. It tracks input tokens, output tokens, cache reads, and cache writes to calculate how full each session's context window is. Everything runs locally — no network requests, no account required. ### What's the relationship between context health and rate limits? They're separate concerns. [Rate limits](https://aibattery.dev/guides/claude-code-rate-limits) control how much total usage you get over time (5-hour and 7-day windows). Context health is about the memory within a single session. You can have plenty of rate limit headroom but a packed context, or vice versa. AI Battery tracks both independently. ## Related guides - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md) — Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md) — CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/context-health · Markdown: https://aibattery.dev/guides/context-health.md* --- # How to Reduce Claude Code Token Usage Every interaction with Claude Code consumes tokens. Tokens are the fundamental unit Claude uses to process text — roughly one token per 3-4 characters of English text. Every prompt you send, every file Claude reads, every tool call, and every response Claude generates counts against both your [rate limits](https://aibattery.dev/guides/claude-code-rate-limits) and your session's [context window](https://aibattery.dev/guides/context-health). Using fewer tokens means you can do more within your limits, maintain higher response quality, and avoid hitting rate limit walls mid-task. ## Why tokens matter Tokens affect your Claude Code experience in two distinct ways: - **Rate limits** — Anthropic tracks your total token consumption across rolling 5-hour and 7-day windows. Once you exhaust your quota, you're throttled until the window resets. Every wasted token brings that wall closer. See [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits) for the full breakdown. - **Context window** — Each session has a finite amount of context. As the window fills, each turn carries more history and more token cost. Anthropic documents auto-compaction once context exceeds 95% capacity. See [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health) for details. Reducing token usage addresses both problems at once. You stretch your rate limit budget further **and** keep each session's context cleaner. ### Tokens and cost On the Pro plan ($20/month), you get a fixed token budget — there's no per-token billing, but hitting the limit means waiting for it to reset. On Max plans (5x at $100/month, 20x at $200/month), the budget is larger but still finite. Every token you save is time you get back. Efficient usage doesn't lower a bill — it prevents downtime. ## Be specific with file references The single biggest source of unnecessary token usage is letting Claude explore your codebase on its own. When you say something like "find the authentication logic and fix the bug," Claude will search directories, read multiple files, scan through irrelevant code, and burn thousands of tokens before it even starts on the actual fix. Instead, point Claude directly at the files that matter: - **Bad:** "Look at the auth code and fix the login timeout issue" - **Good:** "Fix the login timeout issue in `src/auth/login-handler.ts` — the timeout on line 47 should be 30000ms instead of 5000ms" The more precise your references, the fewer exploratory reads Claude needs. If you already know which files are involved, say so. If you know the approximate line numbers, include them. Every file Claude doesn't have to read is hundreds or thousands of tokens saved. ### Name files by path in your prompt When you mention a file by its path in your prompt, Claude reads it directly instead of searching for it. This is far more efficient than describing what you're looking for and letting Claude explore: - Claude reads only the files you specify — no accidental reads of nearby files - You skip the search step entirely, saving tool call overhead - Claude can begin working immediately instead of spending turns navigating the filesystem Name files liberally when you know which ones are relevant. Combine them: "refactor the User type in `src/models/user.ts` to include an email field, and update the handler in `src/api/users.ts`" gives Claude exactly what it needs with zero exploration overhead. ## Keep prompts focused and concise Your prompts are usually the smallest part of token consumption, but they set the tone for everything that follows. A sprawling, unfocused prompt leads to sprawling, unfocused work — which means more file reads, more tool calls, and more tokens. ### State the task clearly in one or two sentences Lead with what you want done. Follow with constraints or context only if Claude wouldn't know them from the code itself. Skip background explanations Claude doesn't need. - **Verbose:** "I've been working on this project for a while and we have an authentication system that uses JWT tokens. The tokens are generated in the auth service. I noticed that sometimes when users log in, the token expiration is set wrong. Can you take a look at the auth code and figure out what's going on with the token expiration and fix it?" - **Concise:** "In `src/auth/token.ts`, the JWT expiration is set to 1 hour on line 23. Change it to 24 hours." The concise version saves tokens on both your prompt and Claude's response, and avoids unnecessary exploration. ### One task per prompt when possible Multi-part prompts ("do X, then Y, then Z") force Claude to hold all three tasks in context simultaneously. If the tasks are independent, send them as separate prompts — or better yet, separate sessions. Each focused interaction uses context more efficiently than one sprawling multi-task session. ## Start fresh sessions for new tasks This is one of the highest-impact habits you can build. When you finish a task and move to something unrelated, **start a new session**. Don't reuse the old one. A session that has been working on a database migration carries thousands of tokens of migration-related file reads, schema definitions, and error outputs. If you pivot to "now fix the CSS on the settings page," all that database context is pure noise. Claude has to process it on every turn, wasting both your rate limit tokens and Claude's attention. Fresh sessions cost nothing. They start with an empty context window and give Claude full focus on the new task. Resist the urge to keep one long-running session for an entire day of work. ## Use /compact before auto-compaction triggers Anthropic documents auto-compaction once context exceeds 95% capacity. If you must continue a session, run `/compact` manually at natural breakpoints — after completing a subtask, after a successful build, or when you notice the context getting crowded. Manual compaction has advantages over waiting for the automatic trigger: - **You pick the timing** — compact between tasks, not mid-thought - **You guide the summary** — `/compact focus on the API refactor, discard the earlier debugging` tells Claude what to preserve - **You reclaim more space** — compacting earlier gives you a much larger clean runway than waiting for the session to get extremely full That said, starting a fresh session is almost always better than compacting if you're switching tasks. Reserve `/compact` for when you need to continue the same task but the context is getting heavy. ## Batch related changes together Every turn in a Claude Code conversation involves overhead: your prompt tokens, Claude's reasoning tokens, tool call tokens, and response tokens. Sending ten small one-line changes as ten separate prompts costs far more than describing all ten changes in a single well-structured prompt. When you have multiple related changes — say, renaming a type and updating all its references — describe them together: - **Wasteful:** Ten separate prompts, one for each file that references the old type name - **Efficient:** "Rename the `UserProfile` type to `Account` in `src/types.ts` and update all imports and references across the codebase" Claude handles batch operations well. A single prompt that describes the full scope of a change lets Claude plan and execute efficiently, reading each file once rather than re-establishing context on every turn. ## Avoid pasting large code blocks When you paste a 200-line code block into your prompt, those tokens go into context on top of any file reads Claude does. If Claude then reads the same file you just pasted, you've paid for it twice. Instead of pasting code, reference it: - Use `@`-mentions to point at files - Reference specific line numbers or function names - Paste only the minimal snippet needed to illustrate a problem — a 5-line excerpt, not the whole file The exception is code that doesn't exist in your project yet — design sketches, examples from documentation, or code from another project. In those cases, pasting is the only option, but keep it as short as possible. ## Use CLAUDE.md to avoid repeating instructions If you find yourself typing the same instructions in every session — "use single quotes," "run tests before committing," "follow the existing naming pattern in utils/" — put them in a `CLAUDE.md` file at the root of your project. Claude Code reads `CLAUDE.md` automatically at session start. This means your instructions are loaded once, concisely, instead of being repeated (and expanded on) across dozens of prompts. The token savings compound over time: - **Without CLAUDE.md:** You type 50 tokens of instructions per session, across 20 sessions a day = 1,000 tokens/day of repeated instructions, plus Claude's acknowledgment of each - **With CLAUDE.md:** The file is loaded once per session automatically. You never retype the instructions. Claude never wastes tokens confirming it understands them. Keep your `CLAUDE.md` focused and concise. Every line in it is loaded into every session, so don't pad it with explanations Claude doesn't need. Direct instructions work best: "Run `npm test` before committing. Use TypeScript strict mode. Prefer named exports." ### Project vs. user-level CLAUDE.md You can place `CLAUDE.md` at the project root for project-specific instructions, or in `~/.claude/CLAUDE.md` for global preferences that apply to all projects. Use the project-level file for things like build commands, testing frameworks, and architecture decisions. Use the global file for personal coding style preferences and workflow rules. ## Use .claudeignore to exclude irrelevant files When Claude searches your project — looking for references, scanning for patterns, or exploring structure — it can stumble into directories that are large and irrelevant. Think `node_modules`, build output directories, generated files, test fixtures with large data files, or vendored dependencies. A `.claudeignore` file works like `.gitignore` — it tells Claude Code which paths to skip. Create one at your project root: - `node_modules/` - `dist/` - `build/` - `.next/` - `coverage/` - `*.min.js` - `*.generated.ts` Every file excluded from search results is a file Claude won't accidentally read. In a large project, this can save thousands of tokens per session by preventing Claude from wandering into generated code or dependency directories. ## Track your usage You can't optimize what you don't measure. [AI Battery](https://aibattery.dev/) sits in your macOS menu bar and shows real-time token consumption, context window fullness, and rate limit status for your recent Claude Code sessions. It lets you spot patterns — which types of tasks burn through tokens fastest, when you're approaching limits, and whether your optimization efforts are actually working. Pay attention to sessions that fill up unusually fast. They often reveal habits worth changing: a project missing a `.claudeignore`, a task that could be split into smaller sessions, or prompts that trigger unnecessary exploration. ### See your token usage at a glance AI Battery tracks token consumption, context health, and rate limit status for your Claude Code sessions — all from your menu bar. Free and open source. [Download AI Battery — Free](https://aibattery.dev/#install) ## Quick reference Here are the strategies ranked by impact, from highest to lowest token savings: 1. **Start fresh sessions for new tasks** — eliminates all accumulated noise from the previous task 2. **Be specific with file references** — prevents exploratory reads that can cost thousands of tokens each 3. **Use .claudeignore** — stops Claude from reading irrelevant files during searches 4. **Use CLAUDE.md** — replaces repeated instructions with a one-time load 5. **Batch related changes** — reduces per-turn overhead across multiple edits 6. **Use /compact at natural breakpoints** — reclaims context space before quality degrades 7. **Name files by path in prompts** — Claude reads them directly without searching 8. **Keep prompts concise** — sets the tone for focused, efficient responses 9. **Reference files instead of pasting code** — avoids duplicate content in context ## Common questions ### How do I know how many tokens a session has used? [AI Battery](https://aibattery.dev/) displays token counts for your recent Claude Code sessions directly in your menu bar. It breaks down input tokens, output tokens, and cache usage so you can see exactly where your budget is going. Claude Code itself also shows token counts after each response if you look at the status line, but AI Battery makes the data persistent and visible at a glance across sessions. ### Does using a smaller model or "fast mode" reduce token usage? Claude Code's fast mode uses the same model with faster output — it does not switch to a smaller model or use fewer tokens. The token consumption is comparable. The strategies in this guide apply equally regardless of whether fast mode is enabled. ### Is there a hard limit on tokens per session, or just per time window? Both. Each session has a context window of up to 1M tokens on current Claude models — that's the per-session ceiling. Separately, Anthropic enforces rate limits across rolling 5-hour and 7-day time windows that cap your total usage across all sessions. Reducing per-session usage helps with both limits. See [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits) for the full rate limit breakdown. ### Will these strategies make Claude's responses worse? The opposite. Most of these strategies — being specific, keeping context focused, starting fresh sessions — actively improve response quality. Claude performs better with a clean, focused context than with a noisy one full of irrelevant file reads. You're not cutting corners; you're removing distractions. ## Related guides - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md) — How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md) — CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md) — Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/reduce-token-usage · Markdown: https://aibattery.dev/guides/reduce-token-usage.md* --- # Is Claude Code Max Worth It? Pro vs Max Compared Anthropic offers three subscription tiers for Claude Code: Pro at $20/month, Max 5x at $100/month, and Max 20x at $200/month. The difference between them is rate limit capacity — how much you can use Claude Code before getting throttled. This guide breaks down what you actually get at each tier and helps you decide which one is worth your money. The short answer: it depends on how much Claude Code usage you actually need. Anthropic publicly describes Max as offering more included usage per session than Pro, but the practical value depends on your workflow. The only reliable way to decide is to measure your real usage. ## The three plan tiers Anthropic describes Pro, Max 5x, and Max 20x as the same Claude Code product with different usage levels. The main difference is included Claude Code usage. | Plan | Price | Relative capacity | Model access | Best for | | --- | --- | --- | --- | --- | | Pro | $20/mo | 1x (base) | Opus, Sonnet, Haiku | Light to moderate daily usage | | Max 5x | $100/mo | ~5x Pro | Opus, Sonnet, Haiku | Full-time development, multiple projects | | Max 20x | $200/mo | ~20x Pro | Opus, Sonnet, Haiku | Heavy all-day usage, parallel sessions | The "relative capacity" column reflects Anthropic's public plan naming: Max 5x provides more usage than Pro, and Max 20x provides more than Max 5x. Anthropic does not publish exact token thresholds for the included Claude Code usage. Upgrading changes how much Claude Code usage is included, not the core product itself. For a practical explanation of how AI Battery models usage over time, see our [rate limits guide](https://aibattery.dev/guides/claude-code-rate-limits). ## Who should stay on Pro Pro is the lowest paid Claude Code plan. It makes sense when you are not regularly exhausting your included usage. - **Your current usage stays comfortably below your limit.** - **You do not regularly get blocked mid-session.** - **You are still learning your usage pattern.** Before upgrading, it is worth checking whether your workflow is causing avoidable token usage. Bloated context and broad prompts can make you hit limits sooner than necessary. See our [token usage guide](https://aibattery.dev/guides/reduce-token-usage). ### The Pro plan trap Occasional rate limiting does not automatically mean you need a higher plan. Measure how often it happens and whether workflow changes reduce it before paying more. ## When Max 5x makes sense Max 5x makes sense when Pro is consistently too limiting and you have already measured that with real usage data. - **You consistently hit Pro limits after measuring usage.** - **You want more headroom for regular daily work.** - **You have already tried workflow improvements.** If Max 5x removes repeated interruptions that are materially slowing your work, the upgrade can be justified. The key is measuring the actual interruptions first. ## When Max 20x makes sense Max 20x is the highest included-usage plan. It only makes sense if Max 5x is still clearly too limiting for your actual usage. - **You are clearly constrained even after moving beyond Pro.** - **You regularly need substantially more included usage.** - **You have measured that the higher plan would solve a real bottleneck.** Max 20x is mainly about buying more headroom. If you are not sure you need it, you probably do not need it yet. ## How to know which plan you need The only reliable way to choose a plan is to **measure your actual usage**. Gut feeling is unreliable — developers consistently overestimate or underestimate how much they use Claude Code. Here's a concrete process: 1. **Install [AI Battery](https://aibattery.dev/)** and use it on your current plan for at least one full work week. 2. **Watch your usage patterns.** Note how often you approach warnings or get blocked. 3. **Check whether limits are occasional or persistent.** That matters more than a single bad day. 4. **Optimize first.** Before upgrading, try the strategies in our [token usage guide](https://aibattery.dev/guides/reduce-token-usage). Start fresh sessions more often. Use `/compact` proactively. Be selective about what files you ask Claude to read. You may find that better habits reduce your consumption by 30-50%. 5. **Upgrade only if limits persist after optimization.** If you're still regularly hitting red after a week of mindful usage, the upgrade is justified. AI Battery's rate limit tracking gives you the numbers you need to make this decision with confidence. You can see your peak utilization, how often you hit limits, and how long the pauses last. That turns "should I upgrade?" from a guessing game into a straightforward cost-benefit calculation. ### See your actual usage before upgrading AI Battery tracks rate limit utilization in real time — right in your macOS menu bar. Know exactly how much of your Pro plan you're using before spending more. [Download AI Battery — Free](https://aibattery.dev/#install) ## Common questions ### Can I downgrade after upgrading? Anthropic manages plan changes through your account. Check the current plan and billing details in your Anthropic account before switching. ### Do all plans get the same models? Check Anthropic's current pricing page for the latest plan differences. The key Claude Code distinction is included usage, not a separate Claude Code product. ### Is there a free tier for Claude Code? Check Anthropic's current pricing page for the latest free and paid plan details. ### Does the context window change between plans? Context size is determined by the model, not by AI Battery. In practice, the plan decision is about included usage, not how you manage a single session. For more on managing context effectively, see our [context health guide](https://aibattery.dev/guides/context-health). ## Related guides - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md) — Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md) — Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/is-max-plan-worth-it · Markdown: https://aibattery.dev/guides/is-max-plan-worth-it.md* --- # Claude Code Tips and Tricks Claude Code is powerful out of the box, but a handful of habits and configurations separate a productive session from a frustrating one. This guide covers the practical techniques that experienced users rely on daily — from project setup to prompt structure to session management. Most of these tips cost nothing extra. They're about working smarter with the same plan and the same rate limits. If you apply even half of what's here, you'll use fewer tokens, hit rate limits less often, and get consistently better results. ## Set up CLAUDE.md for every project CLAUDE.md is a special Markdown file that Claude Code reads automatically at the start of every session. Place it in your project root and it becomes persistent memory — instructions that survive across sessions without you having to repeat them. ### What goes in CLAUDE.md Think of it as a briefing document for a new team member. Include anything Claude needs to know to work effectively in your codebase: - **Build commands** — `npm run build`, `swift build`, `cargo test`, whatever your project uses. Claude will reference these instead of guessing. - **Test commands** — how to run the full suite and how to run a single test file. Include any flags or environment variables needed. - **Coding conventions** — naming patterns, formatting preferences, import ordering, error handling style. Be specific: "use camelCase for functions, PascalCase for types" is better than "follow standard conventions." - **File structure notes** — where key modules live, how the project is organized, which directories matter most. A few lines here save Claude from exploring blindly. - **Things to avoid** — patterns you don't want, libraries you've decided against, files that shouldn't be modified. Negative constraints are just as valuable as positive ones. ### Why this saves tokens Without CLAUDE.md, you end up typing the same instructions at the start of every session: "We use TypeScript strict mode, tests go in \__tests__, run vitest to test, don't use default exports." Each time you type that, it costs tokens — both your input and Claude's acknowledgment. With CLAUDE.md, those instructions load automatically. They're in context from the first message, and you never have to repeat them. Over dozens of sessions, the token savings add up significantly. ### CLAUDE.md scope levels Claude Code supports multiple CLAUDE.md files at different levels: - **Project root** — `CLAUDE.md` in your repo root. Shared with the team if committed to git. - **Local override** — `CLAUDE.local.md` in the project root. Gitignored, for personal preferences that shouldn't be shared. - **User-level** — `~/.claude/CLAUDE.md`. Applies to all projects. Good for universal preferences like commit message style or security rules. All levels are loaded and combined. Use project-level for project-specific rules and user-level for personal defaults. ### Keep CLAUDE.md concise Everything in CLAUDE.md goes into your context window at the start of every session. A 200-line CLAUDE.md costs tokens on every turn. Keep it focused — bullet points, not essays. If you find yourself writing paragraphs of explanation, that's a sign the instruction is too complex or could be simplified. Aim for under 100 lines. ## Use .claudeignore to keep noise out `.claudeignore` works like `.gitignore` but specifically for Claude Code. It tells Claude which files and directories to skip when searching, reading, and exploring your project. Less noise means better results and fewer wasted tokens. ### What to exclude - **Build artifacts** — `dist/`, `build/`, `.next/`, `DerivedData/`. Claude doesn't need compiled output. - **Dependencies** — `node_modules/`, `Pods/`, `.build/`. These are massive directories that Claude will never usefully navigate. - **Generated files** — auto-generated types, protobuf output, GraphQL codegen. Claude should work with the source, not the generated result. - **Large data files** — fixtures, sample databases, binary assets. Anything that would fill context without providing useful information. - **Lock files** — `package-lock.json`, `yarn.lock`, `Podfile.lock`. Huge files with no value for code understanding. ### Example .claudeignore A practical starting point for a typical web project: ``` node_modules/ dist/ build/ .next/ coverage/ *.lock *.min.js *.min.css *.map ``` Place this in your project root. Claude Code reads it automatically. The syntax is identical to `.gitignore` — glob patterns, directory slashes, negation with `!`. ### The impact on token usage Without a `.claudeignore`, Claude might search through `node_modules` when looking for a function definition, or read a minified bundle when you asked it to check the source. Each of these mistakes dumps thousands of irrelevant tokens into your [context window](https://aibattery.dev/guides/context-health). A well-configured ignore file prevents these entirely. ## Master slash commands Claude Code has built-in slash commands that give you direct control over the session. Most users know about one or two, but the full set is worth learning. ### /compact — compress your context The most important slash command. It summarizes the current conversation and frees up context space. Use it at natural breakpoints — after finishing a subtask, after a long debugging session, or whenever you notice Claude's responses getting less precise. The power move: add a focus instruction. `/compact focus on the authentication refactor` tells Claude to prioritize that topic in the summary. Without focus, the summary tries to capture everything equally, which means important details might get compressed away. ### /clear — start completely fresh Wipes the entire context and starts a new session. Use this when switching to a completely different task, or when a session has degraded beyond what `/compact` can fix. It's faster than quitting and relaunching Claude Code. ### /model — switch models on the fly Switches the active model without restarting. Useful for matching model capability to task complexity. Use a faster model for straightforward tasks like renaming variables or writing boilerplate, and switch to a more capable model for architecture decisions or complex debugging. ### /cost — check your token usage Shows how many tokens the current session has consumed. Useful for getting a quick read on how much context space you've used, though for real-time monitoring across sessions, [AI Battery](https://aibattery.dev/) gives you a persistent view without interrupting your workflow. ### /init — generate a CLAUDE.md If you don't have a CLAUDE.md yet, `/init` will generate one by analyzing your project structure. It detects the tech stack, build system, test framework, and creates a reasonable starting point. Review and edit the result — the auto-generated version is a starting template, not the final product. ## Structure your prompts for better results The way you phrase requests has a direct impact on the quality of Claude's output and the number of tokens consumed. Vague prompts lead to exploratory behavior — Claude reads more files, tries more approaches, and produces longer responses. Specific prompts lead to focused action. ### Be specific about scope Compare these two prompts: - **Vague:** "Refactor the authentication code" - **Specific:** "Extract the token refresh logic from src/auth/login.ts into a separate refreshToken function in src/auth/tokens.ts" The vague prompt forces Claude to figure out what "the authentication code" means, which files are involved, what kind of refactoring you want, and how far to go. That exploration burns tokens and context space. The specific prompt gives Claude a clear target. ### Provide context upfront If you know which files are relevant, say so. "The bug is in src/api/handlers.ts around line 140 — the error response doesn't include the status code" is far more efficient than "there's a bug in the API error handling somewhere." Every file Claude reads while searching adds to your context. Point it in the right direction. ### Reference specific files and functions Claude can read files by path. Use that. "Read src/utils/format.ts and add a formatCurrency function that follows the same pattern as formatDate" gives Claude everything it needs in one message. No searching, no guessing. ### Break large tasks into steps A single prompt like "add user authentication with OAuth, email/password, and magic links" is likely to produce a sprawling response that fills your context. Instead, break it down: 1. "Set up the auth database schema in src/db/schema.ts" 2. "Implement email/password login in src/auth/password.ts" 3. "Add the OAuth flow in src/auth/oauth.ts" Each step gets focused attention, produces a reviewable result, and gives you a natural point to `/compact` before continuing. ### The "show me, don't search for it" pattern When you need Claude to understand existing code, paste the relevant snippet directly into your prompt instead of asking Claude to find it. "Here's the current implementation: [paste]. Change the return type to include the error case." This skips the file-reading step entirely and keeps your context lean. This matters most in sessions that are already token-heavy. ## Use git effectively with Claude Code Git is your safety net when working with an AI code editor. The undo button is `git checkout`, and it only works if you've committed before Claude started editing. ### Commit before risky changes Before asking Claude to do anything destructive — a large refactor, deleting files, restructuring a module — make sure your working tree is clean. Run `git add -A && git commit -m "checkpoint before refactor"` or let Claude do it. If the result isn't what you wanted, `git reset --hard HEAD` gets you back instantly. ### Use branches for experiments When you're not sure if an approach will work, have Claude create a branch first. `git checkout -b experiment/new-parser` isolates the changes. If the experiment fails, you delete the branch and lose nothing. If it works, you merge it. ### Let Claude read git diffs Claude can run `git diff` and `git log` to understand recent changes. This is useful when: - You're continuing work from a previous session and want Claude to see what changed - You need Claude to review changes before committing - You want Claude to write a commit message based on the actual diff - You're debugging a regression and want to narrow down which commit introduced it ### Use git stash when switching tasks If you need to switch tasks mid-session but have uncommitted changes, `git stash` saves them without creating a commit. When you come back, `git stash pop` restores everything. This is cleaner than committing half-finished work. ### Small, atomic commits Ask Claude to commit after each logical change rather than accumulating a massive diff. Small commits are easier to review, easier to revert, and give you more granular undo points. "Commit what we've done so far with a descriptive message" is a prompt you should use frequently. ## Manage multiple sessions wisely Claude Code lets you run multiple sessions in parallel — different terminal windows, different projects, different tasks. This is powerful but comes with tradeoffs. ### One session per task Don't try to do everything in a single session. A session working on database migrations shouldn't also be handling frontend CSS fixes. Each task gets its own session with its own clean [context](https://aibattery.dev/guides/context-health). The context stays focused, and Claude's responses stay relevant. ### Parallel sessions share rate limits Running several sessions at once increases your total Claude Code usage. It does not create extra headroom by itself. If you are already close to your usage limits, parallel sessions can push you there faster. If you're already approaching your rate limit, running a second session will push you over the edge faster. Be strategic: run parallel sessions when you have plenty of headroom, and stick to one session at a time when limits are tight. ### Know when to start fresh Sometimes a session is too far gone. Signs that you should start a new session instead of continuing: - Claude keeps re-reading files it has already read - Responses are getting longer but less accurate - Claude has forgotten constraints you set earlier - The session has already been auto-compacted once - You've switched to a completely different task Starting fresh costs nothing. A new session gives you a full context window and a clean slate. The few minutes of re-establishing context are almost always worth it compared to fighting a degraded session. ### Use the right session for the right work Heavy exploration sessions — "understand this codebase," "find all the places where we handle errors" — burn through context fast. Keep those separate from focused implementation sessions where you're writing code. The exploration session fills up and gets discarded; the implementation session stays lean and productive. ## Monitor your usage Knowing where you stand — how much context you've used, how close you are to rate limits, how many tokens a session has consumed — lets you make better decisions about how to work. Without visibility, you're guessing. You don't know if you should start a new session or keep going. You don't know if that next big refactor request will push you over your rate limit. You don't know which of your three running sessions is closest to auto-compaction. The `/cost` slash command gives you a snapshot, but it's per-session and requires interrupting your work. For persistent, cross-session visibility, you need something running in the background. ### Track rate limits, context, and tokens from your menu bar AI Battery is a free macOS menu bar app that monitors your Claude Code usage in real time. See rate limit status, context window health for your recent sessions, and cumulative token usage — all without leaving your editor. Know when to push hard and when to pace yourself. [Download AI Battery — Free](https://aibattery.dev/#install) ## Frequently asked questions ### What's the best model to use in Claude Code? It depends on the task. Claude Sonnet is faster and cheaper for straightforward work — writing tests, renaming variables, generating boilerplate, simple bug fixes. Claude Opus is better for complex reasoning — architecture decisions, subtle bugs, multi-file refactors that require understanding relationships across the codebase. Use `/model` to switch on the fly. Start with Sonnet and upgrade to Opus when you need deeper thinking. ### Can I use Claude Code offline? No. Claude Code requires an internet connection to communicate with Anthropic's API. All model inference happens on Anthropic's servers. If you lose connectivity mid-session, your session state is preserved locally, and you can resume when you're back online. Your conversation history and any files Claude modified on disk are not lost. ### How do I reset my session? Use `/clear` to wipe the context and start fresh within the same Claude Code process. This keeps your terminal open and your working directory intact but gives you a completely empty context window. Alternatively, press `Ctrl+C` to exit and run `claude` again — this also gives you a clean session. If you just want to free up space without losing everything, use `/compact` instead, which summarizes rather than clears. ### Does Claude Code work in any IDE? Claude Code is a terminal application, not an IDE extension. It runs in any terminal emulator — Terminal.app, iTerm2, Warp, Ghostty, Kitty, the integrated terminal in VS Code or any JetBrains IDE. It doesn't integrate directly into an editor's UI, but since most editors have a built-in terminal panel, you can run Claude Code side-by-side with your code. It works with any project in any language, regardless of which editor you use. ## Related guides - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md) — How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md) — Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/tips-and-tricks · Markdown: https://aibattery.dev/guides/tips-and-tricks.md* --- # AI Battery Settings Guide AI Battery's settings open from the gear icon in the top-right corner of the popover. This guide explains every option for both Claude and Codex accounts. ## Accounts AI Battery supports up to **3 Claude and 3 Codex accounts**; each keeps its own rate limits, token stats, and persistent ledger. In an account's detail view the popover header *is* the account: a chip with the provider's brand mark, the account identity, and a small switcher glyph. Click it to switch between accounts (grouped by provider, plan shown per row) or to add one. ### The overview With **two or more accounts** the popover opens on an overview instead of whichever account you looked at last — one account sees no change. Each account is a card: the provider mark and identity (the active account carries an *active* badge), its quota bars with the tokens spent in each window, and a state line with the time to limit and the reset countdown. A small **live dot** breathes beside an account's name while its provider's CLI has been active in the last five minutes, so the list also says which account you are hitting right now. Credits and API-key accounts show today's tokens on the state line instead. - **Drill in** — click a card (or press 1–6) to open that account's full view. The back chevron beside the account chip, or Esc, returns to the overview; Esc from the overview closes the popover. r refreshes every account. - **It remembers where you were** — drill into an account, click away, reopen, and you are still in that account; the back chevron brings you back to the overview. A relaunch opens on the overview again. - **Signed-out accounts** stay on the list as a sign-in card ("Signed out · click to sign in") rather than disappearing. - **Status dots** are exceptions, not readouts: a provider's dot appears only when Anthropic or OpenAI is reporting a degraded or down component. - **Footer** — the overview has its own footer with a labelled **Settings** button, the refresh control with how fresh the cards are, and Quit. Adding accounts happens in Settings. In Settings, the **Accounts** rows list every account with its provider mark, a name field, and a remove button (×). Removing an account deletes its stored credentials from macOS Keychain. ### Add Claude Account… - Opens Anthropic's OAuth 2.0 sign-in in your browser (PKCE, the same protocol Claude Code uses). - Sign in, copy the authorization code, paste it into AI Battery. - The refresh token is stored in macOS Keychain; the access token is held in memory only. ### Add Codex Account… Pick one of three ways: - **Sign in with ChatGPT** — the browser opens OpenAI's sign-in and redirects straight back to AI Battery on `127.0.0.1:1455`. Nothing to paste. - **Import Codex CLI login** — reuses the login from `codex login` by reading `~/.codex/auth.json` once, only when you click the button. - **OpenAI API key** — paste an `sk-…` key. Its shape is checked locally before any network request; if the key can't be verified while offline it is added with a note and checked on the first refresh. The key is stored in Keychain like a refresh token. What you see afterwards depends on the plan: ChatGPT subscriptions show a **5-hour** and a **weekly** window (plus any purchased-credit balance), Business and Enterprise spend-control workspaces show a single **Credits** budget bar, and API keys show OpenAI's per-minute **API Limits** with your real spend at API rates. ### Names and identity - **Name field** — an optional alias shown in the header chip and its menu. The placeholder shows the account's own identity so you know which is which. - **Without an alias**, the chip shows the account's sign-in email — Codex reads it from the ChatGPT login, Claude from its OAuth profile, with the workspace name as a fallback — and failing that "Claude 1" / "Codex 2", numbered within each provider. - **Emails are masked** in the popover (`k•••@domain`) unless you turn on [Show account email](https://aibattery.dev/guides/settings#full-email). Settings placeholders are never masked. ## Refresh Controls how often AI Battery asks your provider for fresh rate-limit data. - **Range**: 30 seconds to 5 minutes, in 30-second steps - **Default**: 2 minutes - **Cost per poll** (shown under the slider; with several accounts it reads "×N accounts", because every account is polled): Claude ≈ 3 tokens; Codex with ChatGPT sign-in none — it reads the usage endpoint; Codex API key ≈ 16 output tokens, billed at API rates AI Battery also polls adaptively: after three unchanged cycles the interval doubles step by step, up to 5 minutes, and snaps back to your setting when a session log changes or the Mac wakes. Polling pauses entirely after 5 minutes of system idle. Between polls the last API reading is kept, so the bars are never empty. ## Hide idle Hides context-health sessions that have been idle longer than the cutoff. - **Options**: 30m, 1h, 2h, 4h, 8h, or ∞ (never) - **Default**: ∞ ## Display ### Colorblind Replaces the green / orange / red palette with blue, cyan, amber, and purple everywhere a colour carries meaning — rate-limit bars, context health, and the menu bar star. macOS's own **Differentiate without colour** (System Settings → Accessibility → Display) switches the same palette on by itself, so the checkbox is there to turn it on without the system setting, not to enable it twice. ### All accounts in menu bar With two or more accounts, the menu bar lists every account's percentage (for example `42% | 23%`). Each slot shows that account's **headline number** — the fuller window, the Credits budget, or for an OpenAI API-key account the busier of its per-minute request and token limits — the same figure its overview card leads with, whatever metric tab is selected, so the bar and the overview can never disagree. The star colour and any countdown follow the *worst* account, and when both providers are connected each group is prefixed with its brand mark. A transient fetch failure keeps an account's previous reading rather than blanking its slot. With the toggle *off* and several accounts, the bar shows the worst account's headline alone. Only a genuinely single-account menu bar follows the [metric tabs](https://aibattery.dev/guides/settings#menu-bar). ### Show account email Shows each account's sign-in identity in full — both providers, in the header chip and the account menu. Off by default, because `k•••@domain` is safer when screen-sharing. An account you have given a name keeps that name and gains the identity behind it, on its own line under its overview card, so several accounts stay distinguishable. Settings placeholders are never masked. ## Menu bar metric The tabs below the header choose which metric sits at the top of an account's detail view and, with a single account, drives the menu bar star (with several accounts the bar follows the overview — see [All accounts in menu bar](https://aibattery.dev/guides/settings#all-accounts)): - **5 Hour** — the 5-hour window - **7 Day** — the 7-day window (labelled **Weekly** on Codex). On a Business/Enterprise or API-key Codex account this collapses into a single **Credits** or **API Limits** tab. - **Context** — context fullness of your most critical active session ### Auto mode The **A** button to the left of the tabs lets AI Battery pick the most urgent metric for you. It escalates in four tiers: 1. **Throttled** — a window the provider is actively limiting always wins. 2. **Rate limit at 80% or more** — shows the higher of the two windows. 3. **Context at 60% or more** in any active session — shows Context. 4. Otherwise the binding (highest-consumed) rate-limit window. To stop the menu bar flickering near a threshold, a held mode is released only after its metric drops 10 points below the threshold (rate limits at 70%, context at 50%). Clicking any tab turns auto mode off. ## Alerts ### Status Sends a macOS notification when a provider reports an incident. With accounts on both providers, **both** status feeds are watched; otherwise the active account's provider. For Claude accounts AI Battery watches status.claude.com (claude.ai, Console, Claude API, Claude Code, Claude for Gov); for Codex accounts it watches status.openai.com filtered to Codex API, Codex CLI, Codex in ChatGPT Desktop, Codex Web, and the Codex VS Code extension. A **Test** button fires sample notifications using the active provider's component names. ### Rate Limit Notifies when usage crosses a threshold you set: **60%, 70%, 80% or 90%**, default **80%**. (The slider ran 50–95 in 5% steps before 3.4; a stored value in between snaps to the nearest stop, and never to a later one.) Both windows are monitored (or the Credits budget on a spend-control plan), the alert fires once per crossing and re-arms when usage drops back below. Alerts are per account, so switching accounts never silences or re-fires another account's alert. ## Launch at Login Starts AI Battery when you log in to macOS, using Apple's native `SMAppService` — no background daemons or launch agents. ## About and updates The last section shows the app version with two links: **Check for Updates** (turns into a yellow **Install vX.Y.Z** once a release is waiting) and **Release notes**. AI Battery checks for updates once a day; when one is available a small arrow breathes beside the Settings gear in both the account view and the overview — click it to install, right-click for release notes or to check again. There's no banner and no badge to dismiss; the arrow disappears once the update is installed. Updates are user-initiated only — nothing downloads in the background. ### About the dollar figures Costs in Insights and Projects are always on and show what your usage *would* cost at your provider's pay-per-token API rates — not your subscription bill. They carry a `~` prefix, except on an OpenAI API-key account, where the figures are a real bill at API rates — unless a ChatGPT-backed Codex account is also signed in, in which case the `~` framing stays because the CLI's sessions can't be attributed to the key. ## Context health indicators These are fixed thresholds, not settings. Percentages are relative to the model's full context window — 1,000,000 tokens for current Claude models, about 258,000 for GPT-5-family models via Codex. - **Green (under 60%)** — plenty of room. - **Orange (60–80%)** — getting crowded. Consider `/compact` or a fresh session. - **Red (over 80%)** — start a new session for best results. AI Battery also flags patterns that suggest a session needs attention: - **Long conversation** — 15 or more turns of accumulated history. - **High input-to-output ratio** — input exceeds output by more than 20:1 (lots of file reads, little produced). - **Rapid token consumption** — more than 50K tokens in under 60 seconds. - **Zero-output session** — several turns with no output tokens, often an error loop. For a deeper explanation, see [Understanding the Context Window](https://aibattery.dev/guides/context-health). ## Related guides - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md) — CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. - [Is Claude Code Max Worth It? Pro vs Max Compared](https://aibattery.dev/guides/is-max-plan-worth-it.md) — Compare Claude Code Pro ($20/mo), Max 5x ($100/mo), and Max 20x ($200/mo) plans. Who each tier is for, when to upgrade, and how to measure your actual usage before deciding. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/settings · Markdown: https://aibattery.dev/guides/settings.md* --- # Why Claude Code Gets Slow and How to Fix It Claude Code can feel slower over time for a simple reason: bigger context costs more. Anthropic’s documentation notes that longer conversations and larger codebases increase token usage, and more context means more text for Claude to process on each turn. That does not just affect cost. It also affects responsiveness. If Claude has to read a long conversation history, broad file context, and repeated tool output before answering, each turn can feel heavier than a fresh, focused session. ## What Anthropic documents Anthropic’s Claude Code docs explicitly recommend a few practices that reduce token load and keep sessions more focused: - **Clear or compact context.** Anthropic recommends using `/clear` between unrelated tasks and `/compact` to reduce long conversation history. - **Use specific prompts.** Narrow requests reduce unnecessary file exploration and token use. - **Break large work into smaller tasks.** Smaller, focused tasks keep context cleaner. - **Be careful with parallel agents.** Anthropic documents that subagents use their own context window, which increases total token use. ## Practical fixes - **Start a new session for unrelated work.** This is the cleanest way to avoid carrying stale context forward. - **Use `/compact` or `/clear` before context gets too long.** Anthropic documents auto-compaction when context exceeds 95% capacity, but waiting that long is usually not ideal. - **Name files directly in prompts.** If you know the file path, say it. That reduces exploration. - **Keep prompts narrow.** “Update `src/auth/session.ts`” is better than “investigate auth.” - **Limit parallel agents and sessions.** More active work means more total context and more total tokens. ## How to check whether this is the problem If Claude Code feels slower than expected, check: - **How long is the conversation?** Long sessions usually carry more overhead. - **How broad is the task?** Vague prompts often trigger more reading than necessary. - **Are you using multiple active agents or sessions?** That increases total token usage. - **Is the context window getting full?** [Context Health](https://aibattery.dev/guides/context-health) matters because larger context means more work per turn. ## How AI Battery helps [AI Battery](https://aibattery.dev/) does not change Claude Code’s speed directly. It helps you see the conditions that often make sessions feel heavier: - **Context Health** shows how full recent sessions are. - **Rate Limits** show whether heavy usage is pushing you toward a limit. - **Token Usage** shows whether a workflow is using more tokens than expected. That makes it easier to decide whether to start fresh, compact, narrow the task, or reduce parallel work. ## Bottom line The most defensible explanation is also the simplest one: more context usually means more work per turn. Keep sessions focused, clear unrelated work, use specific prompts, and avoid unnecessary parallel agents if you want Claude Code to stay responsive. ## Related guides - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md) — How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. - [How to Reduce Claude Code Token Usage](https://aibattery.dev/guides/reduce-token-usage.md) — Practical strategies to use fewer tokens per session, stretch your rate limits, and get better results from Claude Code. - [Claude Code Tips and Tricks](https://aibattery.dev/guides/tips-and-tricks.md) — CLAUDE.md files, .claudeignore, slash commands, prompt structure, git workflows, session management, and usage monitoring tips for power users. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/why-claude-code-gets-slow · Markdown: https://aibattery.dev/guides/why-claude-code-gets-slow.md* --- # How Codex Rate Limits Work OpenAI Codex — the CLI, the IDE extensions, and Codex in ChatGPT — runs on whichever OpenAI plan you sign in with, and that plan decides what limits you. There are three different shapes, and they behave differently enough that it helps to know which one you're on. ## ChatGPT subscriptions: 5-hour and weekly windows On a ChatGPT Free, Plus, Pro, or Team subscription, Codex counts your usage against two rolling windows at once: a **5-hour window** that governs bursts, and a **weekly window** that governs sustained use. Each has its own percentage used and its own reset time, and whichever is closer to full is the one that stops you first — AI Battery marks it *binding*. OpenAI reports both windows as a percentage of your plan's allowance rather than as a token count, so there is no fixed number to memorise: the usage endpoint says how much of the window you have used and when it resets, and that is exactly what AI Battery shows. Purchased credits, if you have bought any, appear as a separate balance under the windows. ## Business and Enterprise: a credit budget Business and Enterprise workspaces don't use the two windows. Instead an administrator sets a **spend control** — an individual credit budget per user for the billing period. Codex reports how much of that budget you have used; when it is exhausted (or the workspace marks spend control as reached) Codex stops until the period resets or the budget is raised. Workspaces without an individual cap report as uncapped. AI Battery shows this as a single **Credits** bar instead of the 5-hour / weekly pair, named after the budget OpenAI reports (for example the Business plan's limit) rather than the bare plan type, with "no cap" when there is no individual limit. Once AI Battery has watched the budget for an hour, the tooltip adds a runway — "~N d to limit" — paced from how fast you've been spending it this period. ## API keys: per-minute limits and a real bill If you run `codex login --api-key` (or add a key in AI Battery), there are no plan windows at all. Every request is billed at OpenAI's API rates, and the only limits are the per-minute **request** and **token** rate limits OpenAI returns in its `x-ratelimit-*` response headers. They refill continuously, so hitting one means slowing down for a minute, not waiting hours. Because there is no subscription behind an API key, the costs AI Battery shows for it are a real bill — they appear without the `~` prefix used for API-equivalent estimates everywhere else. (If a ChatGPT-backed Codex account is also signed in, the `~` stays: the CLI's sessions can't be attributed to the key.) ## 100% is "at capacity", not "throttled" A window reading 100% means you have used your allowance; it does not by itself mean OpenAI is rejecting requests. Codex reports an explicit throttle (a `rate_limit_reached` status or an HTTP 429) when it is. AI Battery only shows the red "Limit reached" state and the broken menu bar star when the provider actually reports a throttle, and it holds a brand-new near-full reading for 10 minutes before trusting it, so one glitchy response can't paint a false alarm. ## How AI Battery reads them - **ChatGPT sign-in or imported CLI login** — AI Battery reads the ChatGPT usage endpoint each refresh. It spends no tokens. If the endpoint is unreachable it falls back to the newest Codex CLI session log, which carries a recent snapshot of the same windows, and the footer says *Cached* — but only if that log is less than 7 days old, so a stale rollout can't stand in for a live reading. - **API key** — AI Battery sends a 16-token probe each refresh and reads the per-minute limits from the response headers (billed at API rates; the refresh slider shows the cost). - **Labels follow the provider** — the long window is called **Weekly**, the Usage link opens your ChatGPT usage page, and status alerts watch the Codex components of status.openai.com. - **Alerts** — the Rate Limit alert threshold (60%, 70%, 80% or 90%) applies to both windows, or to the Credits budget on a spend-control plan. ## Pacing tips - Watch the **weekly** window on Monday, not Friday — a 5-hour reset can't save a week you've already spent. - Switch the menu bar metric to **Auto**: it surfaces whichever window is closest to stopping you. - If you keep hitting the 5-hour window, long rollouts with big file reads are usually the cause — the same context discipline that helps Claude Code helps Codex. - Running Claude Code and Codex side by side? Add both accounts: the popover opens on an overview with a card for each, and the menu bar leads with whichever is closer to its limit. ## Related guides - [How Claude Code Rate Limits Work](https://aibattery.dev/guides/claude-code-rate-limits.md) — Everything you need to know about Claude Code rate limits: 5-hour burst windows, 7-day sustained limits, how they're calculated, and how to avoid hitting them mid-task. - [AI Battery Settings Guide](https://aibattery.dev/guides/settings.md) — Every AI Battery setting explained: Claude and Codex accounts and the multi-account overview, refresh interval and per-poll cost, idle cutoff, display toggles, the menu bar metric picker and auto mode, alerts, launch at login, About and updates, and the context health indicators. - [Understanding Claude Code's Context Window](https://aibattery.dev/guides/context-health.md) — How Claude Code context works, what auto-compaction does, and how to manage sessions for better results. --- Part of [AI Battery guides](https://aibattery.dev/guides/index.md). AI Battery is a free, open-source macOS menu bar app for Claude Code and OpenAI Codex usage: https://aibattery.dev/ *Source: https://aibattery.dev/guides/codex-rate-limits · Markdown: https://aibattery.dev/guides/codex-rate-limits.md* --- # Privacy Policy Last updated: October 11, 2026 ## Website This website (**aibattery.dev**) does not collect any personal data. There are no cookies, no analytics, no tracking pixels, and no third-party scripts that monitor your behavior. The only external requests are to the GitHub API to display the repository's star and download counts — this request does not include any identifying information about you. ## The App AI Battery is a native macOS menu bar app. It reads Claude Code's and the Codex CLI's local JSONL session logs for token counts and context health — **never your message content** (Codex message lines are rejected before they are parsed at all). Rate limits come from a minimal request to your provider. ### Network requests AI Battery makes the following network requests — nothing else: - **api.anthropic.com** — reads your Claude 5-hour / 7-day usage each refresh cycle (~3 tokens per call) - **console.anthropic.com** — Claude OAuth 2.0 sign-in (PKCE, same protocol as Claude Code) - **status.claude.com** — Anthropic's status page, for outage alerts - **chatgpt.com** — with a Codex account: the usage endpoint for 5-hour / weekly windows and credit budgets (no tokens spent) - **auth.openai.com** — Codex OAuth 2.0 sign-in with ChatGPT (PKCE, same protocol as the Codex CLI; the browser redirects back to `127.0.0.1:1455` on your Mac) - **status.openai.com** — OpenAI's status page, filtered to the five Codex components - **api.openai.com** — only for OpenAI API-key accounts: one request to validate the key when you add it, then a 16-token probe each refresh to read the per-minute limit headers (billed at API rates) - **api.github.com** — checks for new versions once per day - **kylenesium.github.io** — Sparkle appcast for in-app updates (on update click only) ### What AI Battery does not do - **No analytics or telemetry** — no usage data, crash reports, or diagnostics are transmitted. - **No tracking** — no cookies, fingerprinting, or third-party trackers of any kind. - **No data storage outside your machine** — all data stays in local files on your Mac. OAuth refresh tokens are stored in macOS Keychain. - **No message content access** — AI Battery reads token counts from Claude Code's and the Codex CLI's logs, never your conversation content. `~/.codex` is read-only; `auth.json` is read once, only when you click Import. ## Authentication AI Battery uses OAuth 2.0 with PKCE for both providers — the same protocols Claude Code and the Codex CLI use. You can connect up to 3 Claude and 3 Codex accounts. Refresh tokens (or, for an OpenAI API-key account, the key itself) are stored in macOS Keychain, Apple's encrypted credential store; access tokens are held in memory only. The sign-in email that labels an account — read from the ChatGPT login for Codex and from the OAuth profile for Claude, with the Claude workspace name as a fallback — is kept in the app's preferences — it is not a credential — and is masked in the popover by default. ## Open Source AI Battery is open source under the MIT License. You can [inspect the full source code](https://github.com/KyleNesium/AIBattery) to verify these privacy claims yourself. ## Contact If you have questions about this privacy policy, you can reach out via [GitHub Issues](https://github.com/KyleNesium/AIBattery/issues). *Source: https://aibattery.dev/privacy · Markdown: https://aibattery.dev/privacy.md* --- # Install AI Battery with an AI agent Updated October 16, 2026 · AI Battery 3.5.0 · macOS 13 (Ventura) or later on Apple Silicon, plus Claude Code and/or the Codex CLI. This page is a runbook. If someone pasted it into you — Claude Code, Codex, Cursor, or any agent with a shell on their Mac — run the steps in order; each has a check. **Stop at step 4 and hand over:** two macOS prompts and the provider sign-in happen in the UI and cannot be done from a terminal. Reading this as a person? The same steps work by hand, or use the [one-click methods on the homepage](https://aibattery.dev/#install). ### Shortest path With Homebrew: `brew tap KyleNesium/tap && brew install --cask aibattery` Without Homebrew: `curl -fsSL https://aibattery.dev/install.sh | bash` — pinned to 3.5.0, SHA-256 verified, launches the app. Either way, finish with steps 3 and 4. ## Step 1: Preflight AI Battery needs macOS 13 (Ventura) or later on Apple Silicon, plus Claude Code and/or the Codex CLI — there is no Intel build yet. Check both, and whether Homebrew is available: ```bash sw_vers -productVersion # must be 13.0 or newer uname -m # must print arm64 command -v brew # a path → use 2A; nothing → use 2B ``` If the macOS version or the architecture check fails, stop and tell the user why — nothing below will work on that Mac. ## Step 2: Install ### 2A. With Homebrew (preferred) ```bash brew tap KyleNesium/tap && brew install --cask aibattery ``` The cask pins the release's SHA-256, installs `/Applications/AIBattery.app` and clears the quarantine flag. Already installed? `brew upgrade --cask aibattery`. ### 2B. Without Homebrew ```bash curl -fsSL https://aibattery.dev/install.sh | bash ``` What [install.sh](https://aibattery.dev/install.sh) does, in order: checks macOS 13+ and arm64 → downloads `AIBattery.zip` (3.5 MB) for version 3.5.0 from GitHub Releases → verifies its SHA-256 (`c0a986ab0f45…`) → quits a running copy and unpacks into `/Applications` → clears the quarantine flag → launches the app. Its last line is machine-readable: `AIBATTERY_INSTALL_RESULT status=ok version=3.5.0 path=/Applications/AIBattery.app launched=1`. Flags go after `bash -s --`: `--no-launch` installs without opening the app; `--dir ` installs somewhere other than /Applications. Exit codes: **0** installed · **2** unsupported Mac · **3** checksum mismatch · **4** download or unpack failed. Prefer not to pipe into bash? `curl -fsSLO https://aibattery.dev/install.sh && less install.sh && bash install.sh`. ## Step 3: Verify and launch ```bash ls -d /Applications/AIBattery.app # expect 3.5.0 or newer: defaults read /Applications/AIBattery.app/Contents/Info CFBundleShortVersionString open /Applications/AIBattery.app sleep 2 && pgrep -x AIBattery >/dev/null && echo "AI Battery is running" ``` AI Battery lives in the menu bar as a green star — no Dock icon, no window. If `pgrep` finds nothing after launch, Gatekeeper blocked it; that is step 4, not an install failure. ## Step 4: Stop — hand over to the user Report the version and the method you used, then give the user these three steps as written: 1. **If macOS says the app can't be opened** (it isn't notarized yet): System Settings → Privacy & Security → scroll down → **Open Anyway**, then open it again. 2. **Click "Always Allow"** on the Keychain prompt — that is where the sign-in token is kept. It appears once on first launch and once more after an in-app update. 3. **Click the star in the menu bar and sign in.** Claude: the browser opens Anthropic's sign-in and shows a code to paste back into the app. Codex: "Sign in with ChatGPT" redirects straight back to the app; importing the Codex CLI login or pasting an OpenAI API key also works. Up to 3 accounts per provider — add more in Settings → Accounts. Nothing else is needed. AI Battery reads Claude Code's and the Codex CLI's local session logs on its own, and updates itself through Sparkle. ## Upgrade, uninstall ```bash # upgrade — Homebrew installs (or use the in-app update): brew upgrade --cask aibattery # upgrade — script installs: re-run it, it replaces the app: curl -fsSL https://aibattery.dev/install.sh | bash # uninstall — Homebrew installs, including preferences: brew uninstall --zap --cask aibattery # uninstall — script installs: rm -rf /Applications/AIBattery.app rm -rf "$HOME/Library/Application Support/AIBattery" rm -f "$HOME/Library/Preferences/com.KyleNesium.AIBattery.plist" ``` Sign-in tokens live in the macOS Keychain under the service name `AIBattery`; delete them in Keychain Access for a clean slate. ## For agents: machine-readable - [This page as Markdown](https://aibattery.dev/install.md) — or request `/install` with `Accept: text/markdown` - [app.json](https://aibattery.dev/app.json) — current version, release assets with byte sizes and SHA-256, every install command - [install.sh](https://aibattery.dev/install.sh) — the pinned installer above; [checksums-sha256.txt](https://github.com/KyleNesium/AIBattery/releases/latest/download/checksums-sha256.txt) on the release for independent verification - [llms.txt](https://aibattery.dev/llms.txt) — index of everything else on this site ### Reading this as a person? Paste `https://aibattery.dev/install` into Claude Code, Codex or whichever agent you use and say "install it". [Or install it yourself](https://aibattery.dev/#install) *Source: https://aibattery.dev/install · Markdown: https://aibattery.dev/install.md*