headroom.walls.sh · warp

Warp + Claude Code usage

Add Claude Code session and weekly usage to your Warp terminal — as a prompt status line, a session-start notice, or a menu bar indicator alongside Warp AI.

The data source

When you have the statusLineHook configured, Claude Code writes your current usage to ~/.claude/headroom-usage.json on every status-line refresh. All the integrations below read from this file — no extra processes, no polling Anthropic's API.

Option 1 — Prompt block (PS1 / PROMPT)

Warp uses your shell's PS1/PROMPT (zsh, bash, fish). The simplest approach: add a Claude Code usage badge to your existing prompt.

zsh — add to ~/.zshrc

cc_usage() {
  local f="$HOME/.claude/headroom-usage.json"
  [[ -f "$f" ]] || return
  local s w
  s=$(jq -r '.sessionUsagePct | floor' "$f" 2>/dev/null) || return
  w=$(jq -r '.weeklyUsagePct | floor' "$f" 2>/dev/null) || return
  if   (( s >= 90 )); then echo "%F{red}CC ${s}%·${w}%%f "
  elif (( s >= 70 )); then echo "%F{yellow}CC ${s}%·${w}%%f "
  else                     echo "%F{green}CC ${s}%·${w}%%f "
  fi
}
PROMPT='$(cc_usage)%~ %# '

This shows CC 34%·61% in green, amber at 70%, red at 90%, before your path.

bash — add to ~/.bashrc

cc_usage() {
  local f="$HOME/.claude/headroom-usage.json"
  [[ -f "$f" ]] || return
  local s w
  s=$(jq -r '.sessionUsagePct | floor' "$f" 2>/dev/null) || return
  w=$(jq -r '.weeklyUsagePct | floor' "$f" 2>/dev/null) || return
  printf 'CC %s%%·%s%% ' "$s" "$w"
}
PS1='$(cc_usage)w $ '

Option 2 — Session-start MOTD

Show current usage once when a new Warp window or pane opens — a quick reminder before you start work.

# Add to ~/.zshrc (or ~/.bashrc)
claude_motd() {
  local f="$HOME/.claude/headroom-usage.json"
  [[ -f "$f" ]] || return
  local s w sr wr model
  s=$(jq -r '.sessionUsagePct | floor' "$f")
  w=$(jq -r '.weeklyUsagePct | floor' "$f")
  sr=$(jq -r '.sessionResetSec / 3600 | . * 10 | floor / 10' "$f")
  wr=$(jq -r '.weeklyResetSec / 86400 | . * 10 | floor / 10' "$f")
  model=$(jq -r '.modelName // "unknown"' "$f")
  printf '╌╌ Claude Code  session %s%%  weekly %s%%  [%sh / %sd  %s]
'     "$s" "$w" "$sr" "$wr" "$model"
}
claude_motd

Output on window open:

╌╌ Claude Code  session 34%  weekly 61%  [2.7h / 2.1d  claude-sonnet-4-6]

Option 3 — Warp Drive workflow (query on demand)

Warp Drive workflows let you run a command from the Warp command palette. Create one at Warp → Warp Drive → New Workflow:

Name: Claude Code Usage
Command: cat ~/.claude/headroom-usage.json | jq '{session: "(.sessionUsagePct | floor)%", weekly: "(.weeklyUsagePct | floor)%", cost: "$(.sessionCost)", model: .modelName, session_resets_in: "(.sessionResetSec / 3600 * 10 | floor / 10)h", weekly_resets_in: "(.weeklyResetSec / 86400 * 10 | floor / 10)d"}'

Trigger it from the palette (Ctrl+R → search "Claude") when you want a quick status check.

Warp AI vs Claude Code — using both

Warp has its own built-in AI for terminal help. Claude Code is a separate tool for larger coding tasks. They serve different use cases and different rate limits:

Warp AI

Inline terminal suggestions, command explanations, one-shot fixes. Warp's own model and quota.

Claude Code

Multi-file refactors, long sessions, project-level reasoning. Anthropic quota (5h session + 7d week).

The session/weekly rate limits tracked by the integrations above apply only to Claude Code — not to Warp AI. If you primarily use Claude Code from within Warp, the prompt block or MOTD gives you limit visibility without leaving the terminal.

All integrations read from ~/.claude/headroom-usage.json — a local file Claude Code writes. Zero network calls, no Anthropic token access.

Menu bar instead of terminal

For persistent, always-visible usage without a terminal window open, Headroom adds a Claude Code meter to your macOS menu bar. It reads the same local file — color-coded, with a dropdown showing reset countdowns and pace forecast.

brew install --cask patwalls/tap/headroom

Warp prompt block and Headroom complement each other: the prompt shows usage in-context while you're in the terminal; Headroom shows it globally when Warp is in the background.

Shell prompt guide (zsh, bash, fish)
tmux status bar integration
Starship module
statusLineHook setup