Feature: expose user email/org in status line JSON

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Mar 9, 2026 · closed Mar 9, 2026

Summary

The status line script receives JSON via stdin with fields like model, context_window, cost, workspace, etc. However, two important categories of data are missing:

  1. User account info — email, organization, login method (visible in /status but not in status line JSON)
  2. Rate limit / usage quota — three levels of quota visible in /status → Usage tab but NOT in status line JSON

Current available data vs what /status shows

| Data | In /status? | In status line JSON? |
|------|:---:|:---:|
| Model name | ✅ | ✅ |
| Context window % | ✅ | ✅ |
| Session cost | ✅ | ✅ |
| User email | ✅ | ❌ |
| Organization | ✅ | ❌ |
| Session quota (resets daily) | ✅ | ❌ |
| Weekly quota (all models) | ✅ | ❌ |
| Weekly quota (Sonnet only) | ✅ | ❌ |

What /status → Usage actually shows

Current session
███▌                                               7% used
Resets 1am (Asia/Shanghai)

Current week (all models)
█████████████████                                  34% used
Resets Mar 13 at 11pm (Asia/Shanghai)

Current week (Sonnet only)
█████                                              10% used
Resets Mar 13 at 11pm (Asia/Shanghai)

None of this quota data is exposed to the status line script.

Current status line script

#!/usr/bin/env bash
input=$(cat)

model=$(echo "$input" | jq -r '.model.display_name // empty' | tr '[:upper:]' '[:lower:]')
remaining=$(echo "$input" | jq -r '.context_window.remaining_percentage // empty')
cwd=$(echo "$input" | jq -r '.workspace.current_dir // empty')

home_escaped=$(printf '%s\n' "$HOME" | sed 's/[[\.*^$()+?{|]/\\&/g')
short_dir=$(echo "$cwd" | sed "s|^${home_escaped}|~|")

dim="\033[38;5;242m"
reset="\033[0m"

# WORKAROUND: hardcode user because JSON has no user field
if [[ "$HOME" == */claude-dev ]]; then
  user="dev"
else
  user="aaron"
fi

parts=()
[ -n "$user" ] && parts+=("$user")
[ -n "$model" ] && parts+=("$model")
[ -n "$remaining" ] && parts+=("$(printf '%.0f' "$remaining")% ctx")
# MISSING: would love to show "7% session · 34% week" here
[ -n "$short_dir" ] && parts+=("$short_dir")

result=""
for part in "${parts[@]}"; do
  if [ -z "$result" ]; then result="$part"; else result="$result · $part"; fi
done

printf "${dim}%s${reset}\n" "$result"

Current output: aaron · opus 4.6 · 79% ctx · ~/ai/armatrix
Desired output: aaron@0xdefi · opus 4.6 · 79% ctx · 7% session · 34% week · ~/ai/armatrix

Proposed JSON fields

1. User info

{
  "user": {
    "email": "aaron@0xdefi.club",
    "organization": "0xdefi",
    "login_method": "Claude Team Account"
  }
}

2. Quota (all three levels)

{
  "quota": {
    "session": {
      "used_percentage": 7,
      "remaining_percentage": 93,
      "resets_at": "2026-03-10T01:00:00+08:00"
    },
    "weekly_all_models": {
      "used_percentage": 34,
      "remaining_percentage": 66,
      "resets_at": "2026-03-13T23:00:00+08:00"
    },
    "weekly_sonnet": {
      "used_percentage": 10,
      "remaining_percentage": 90,
      "resets_at": "2026-03-13T23:00:00+08:00"
    }
  }
}

Use cases

Multi-account disambiguation

Running multiple Claude Code instances with different accounts. Without user info in JSON, must hardcode usernames — fragile and not portable.

Rate limit awareness (interactive)

Knowing quota remaining helps decide when to switch models or pause before hitting limits.

Agent orchestration (critical)

When running multi-agent workflows (5+ parallel agents via TeamCreate):

  • Each agent consumes quota independently
  • Leader/orchestrator needs real-time quota visibility to throttle or redistribute work
  • Without quota data, agents can unknowingly exhaust the entire quota window
  • All three quota levels matter: session quota for immediate decisions, weekly quota for sprint planning

Status line refresh for orchestration

Currently status line only refreshes on events (API response, mode switch). During orchestration, the leader session may be idle while agents work. A configurable poll interval (e.g. "refreshInterval": 30) would enable near-real-time monitoring.

View original on GitHub ↗

4 Comments

armatrix · 7 months ago

Additional request: expose rate limit / usage quota in status line JSON

The /status → Usage tab shows the account-level usage quota (the one that auto-resets every 5 hours). This would also be very useful in the status line JSON.

Proposed additional fields

{
  "quota": {
    "used_percentage": 28,
    "remaining_percentage": 72,
    "resets_at": "2026-03-09T18:00:00Z"
  }
}

Use case

Displaying both metrics in the status line:

  • Context window remaining — how much room left in this conversation
  • Quota remaining — how much of the 5-hour rate limit window is left

Example: aaron · opus 4.6 · 79% ctx · 72% quota · ~/ai/armatrix

This helps users decide when to start new sessions or switch to lighter models before hitting rate limits.

armatrix · 7 months ago

Additional request: periodic / push-based refresh for status line

Currently the status line only refreshes on events (API response, mode switch). This is fine for single-session interactive use, but insufficient for agent orchestration scenarios:

Why event-driven refresh isn't enough

  • Parallel agents: When 5+ agents run concurrently via TeamCreate, quota burns fast. The leader/orchestrator session may be idle (waiting for agents to finish) — its status line never refreshes, so quota data goes stale.
  • Long-running operations: An agent executing a 10-minute build or test suite won't trigger a status line update until it completes. By then, quota may already be exhausted.
  • Proactive throttling: To avoid hitting rate limits mid-orchestration, the orchestrator needs near-real-time quota visibility — not just post-hoc.

Proposed options

  1. Configurable poll interval — e.g. "statusLine": { "refreshInterval": 30 } (seconds). Script re-runs periodically even without user interaction.
  2. SSE/WebSocket push — Claude Code pushes quota changes to a local endpoint. Status line (or an external dashboard) subscribes.
  3. Hybrid — Event-driven by default, with optional poll interval for orchestration use cases.

Option 1 is the simplest and would cover most needs. Even a 30-second poll would be a huge improvement over "only on API response".

armatrix · 7 months ago

Closing in favor of a cleaner repost. This issue contained personal information that should have been anonymized.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.