Skip to content

feat(statusline): show logged-in account email (show_account) - #201

Merged
luongnv89 merged 3 commits into
mainfrom
feat/show-account-email
Oct 11, 2026
Merged

luongnv89 merged 3 commits into
mainfrom
feat/show-account-email

Conversation

@luongnv89

@luongnv89 luongnv89 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Description

Adds an opt-in show_account option that displays the logged-in Claude account email after the model name, so users who switch between accounts can tell which one a session is running under:

context-stats | main [13] | $0.00 | Opus 5.5 | me@example.com | abc
  • The email is read locally (no network) from oauthAccount.emailAddress in Claude Code's .claude.json: $CLAUDE_CONFIG_DIR/.claude.json when CLAUDE_CONFIG_DIR is set, else ~/.claude.json.
  • Hidden automatically when there is no logged-in account (API-key auth) or the file is missing/unparseable. Non-printable characters are stripped so the value cannot inject terminal escapes.
  • Off by default — the email is personal data that would otherwise leak into screenshots and screen shares. Enable with show_account=true; color via color_account (defaults to the dim separator color).
  • The reader is single-sourced in _shared.py (vendored byte-identically to scripts/_statusline_shared.py); config key, color slot, and segment wired in both the package and the standalone script. New row added to the CLAUDE.md sync table.

Related Issue

None. (The CI Dependency Vulnerability Scan failure seen on this PR predates it; tracked in #202, fixed by #203.)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Python implementation produces correct output (if applicable)

Testing

  • ruff check . and mypy src scripts clean
  • pytest tests/python/ — 1553 passed, coverage 96.9% (floor 94%)
  • New parity tests: reader edge-case grid, .claude.json path resolution (CLAUDE_CONFIG_DIR vs ~), byte-identical package/script render with the option on and off
  • isolated_home fixture now clears CLAUDE_CONFIG_DIR so a developer's real account email can't leak into test renders
  • Manually verified against a real CLAUDE_CONFIG_DIR profile via a pipx install from this branch

Decision Record

  • Root cause: The status line shows no signal of which Claude account a session runs under, so users who switch accounts (e.g. via CLAUDE_CONFIG_DIR profiles) cannot tell them apart.
  • Options considered: (1) read oauthAccount.emailAddress from Claude Code's local .claude.json; (2) query the account over the network; (3) show it by default vs. opt-in.
  • Options rejected: Network lookup (violates the project's no-network rule and adds latency to every render); default-on display (the email is personal data that would leak into screenshots and screen shares).
  • Selected option: Opt-in show_account (default off) reading $CLAUDE_CONFIG_DIR/.claude.json, else ~/.claude.json; non-printable characters stripped; reader single-sourced in _shared.py and vendored byte-identically to the standalone script; color_account color slot.
  • Residual risk: .claude.json is re-parsed on every render when enabled (measured ~0.4–3.8 ms on a 611 KB file); relies on Claude Code's undocumented oauthAccount field, which hides gracefully if the shape changes.

Add an opt-in segment that displays the logged-in Claude account email
after the model name, so multi-account users can tell which account a
session runs under.

- _shared.read_account_email(): reads oauthAccount.emailAddress from
  $CLAUDE_CONFIG_DIR/.claude.json (else ~/.claude.json); local read only,
  None on missing/invalid file or API-key auth, non-printables stripped
- show_account config key (default false) + color_account color key,
  wired in both the package and the standalone script
- conf templates, README, configuration docs, CONTRIBUTING, CLAUDE.md
  sync table, CHANGELOG
- parity tests: reader grid, file resolution, render parity on/off;
  isolated_home now clears CLAUDE_CONFIG_DIR
@luongnv89
luongnv89 merged commit fa1a3fa into main Oct 11, 2026
35 checks passed
@luongnv89
luongnv89 deleted the feat/show-account-email branch October 11, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant