docs/claude.md
Claude supports three usage data paths plus local cost usage. The main provider pipeline uses runtime-specific
automatic selection, but the codebase still has multiple active Claude .auto decision sites while the refactor is
pending. For the exact current-state parity contract, see
docs/refactor/claude-current-baseline.md.
.auto order. That inconsistency is tracked in
docs/refactor/claude-current-baseline.md.Usage source picker:
Never prompt: never attempts interactive Claude OAuth Keychain prompts.Only on user action (default): interactive prompts are reserved for user-initiated repair flows.Always allow prompts: allows interactive prompts in both user and background flows.~/.claude/.credentials.json.Claude Code-credentials.user:profile scope (CLI tokens with only user:inference cannot call usage).GET https://api.anthropic.com/api/oauth/usageAuthorization: Bearer <access_token>anthropic-beta: oauth-2025-04-20five_hour → session window.seven_day → weekly window; also becomes the primary fallback when five_hour is absent or has no utilization.seven_day_sonnet / seven_day_opus → model-specific weekly window.extra_usage → Extra usage cost (monthly spend/limit).subscriptionType is preferred when present; rate_limit_tier falls back to
Max/Pro/Team/Enterprise.Cookie: header from a claude.ai request.~/.codexbar/config.json (tokenAccounts) and set Claude cookies to
Manual. The menu can show all accounts stacked or a switcher bar (Preferences → Advanced → Display).sessionKey cookies or OAuth access tokens (sk-ant-oat...). OAuth-token
accounts route to the OAuth path and disable cookie mode; session-key or cookie-header accounts stay in manual
cookie mode. The exact edge-routing rules are documented in
docs/refactor/claude-current-baseline.md.~/Library/Cookies/Cookies.binarycookies~/Library/Application Support/Google/Chrome/*/Cookies~/Library/Application Support/Firefox/Profiles/*/cookies.sqliteclaude.ai.sessionKey (value prefix sk-ant-...).com.steipete.codexbar.cache (account cookie.claude, source + timestamp).
Reused before re-importing from browsers.Cookie: sessionKey=<value>):
GET https://claude.ai/api/organizations → org UUID.GET https://claude.ai/api/organizations/{orgId}/usage → session/weekly/opus.GET https://claude.ai/api/organizations/{orgId}/overage_spend_limit → Extra usage spend/limit.GET https://claude.ai/api/account → email + plan hints.claude in a PTY session (ClaudeCLISession).--allowed-tools "" (no tools)./usage, wait for rendered panel; send Enter retries if needed./status to extract identity fields.ClaudeStatusProbe):
Account: and Org: lines when present.$CLAUDE_CONFIG_DIR (comma-separated), each root uses <root>/projects.~/.config/claude/projects~/.claude/projects~/.pi/agent/sessions/**/*.jsonl**/*.jsonl under the native project roots plus supported pi session files.type: "assistant" and message.usage.message.id + requestId (usage is cumulative per chunk).anthropic assistant usage to Claude and bucket it by assistant-turn timestamp, so a single pi
session can contribute to multiple models/days.~/Library/Caches/CodexBar/cost-usage/claude-v2.json~/Library/Caches/CodexBar/cost-usage/pi-sessions-v1.jsonSources/CodexBarCore/Providers/Claude/ClaudeOAuth/*Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swiftSources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift,
Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swiftSources/CodexBarCore/CostUsageFetcher.swift,
Sources/CodexBarCore/PiSessionCostScanner.swift,
Sources/CodexBarCore/PiSessionCostCache.swift,
Sources/CodexBarCore/Vendored/CostUsage/*