Add account component to show active Claude Code login profile - #2
Merged
Merged
Conversation
Introduces an 'account' provider + component that detects which Claude Code account is currently logged in by comparing the live OAuth token in the macOS Keychain against saved per-profile snapshots. The provider is a no-op on non-macOS platforms; on macOS it shells out to `security find-generic-password` to read the active credentials (default slot: "Claude Code-credentials") and each configured profile slot (defaults: "Claude Code-personal", "Claude Code-work"). When the active token matches a saved profile, the component renders a colored label (defaults: cyan "personal", magenta "work"); when it matches no saved slot the provider reports "unknown" and the component hides itself by default (configurable). This is useful when running Claude Code with multiple accounts (e.g. personal Pro + work Team) and switching between them by swapping Keychain entries — the status line then reflects which account the current session belongs to. Default cache TTL is 60s to keep the cost of Keychain shellouts low while still picking up account switches quickly. The component is added to the default `active` list between `duration` and `version`. Users can omit it from `active` if they don't want it shown. Includes unit tests for the component covering: hidden states (missing/empty/unknown), per-profile coloring, default-color fallback for unknown profiles, custom templates/icons, and empty template handling. Provider is not unit-tested as it shells out to `security`; behavior is covered manually.
Mirage20
reviewed
May 18, 2026
| - ratelimit.sevenday | ||
| - changes | ||
| - duration | ||
| - account |
Owner
There was a problem hiding this comment.
Shall we keep this disabled by default, as this is not a common use case?
Contributor
Author
There was a problem hiding this comment.
Good call — agreed. Pushed in a086efb: dropped account from the default active list (both in config.yaml and the hardcoded fallback in main.go), kept the component and provider registered, and added a commented example near the bottom of config.yaml showing how to enable it.
It's only useful for users juggling multiple Claude Code logins, so keep it registered but leave it out of the default active list. Added a commented example near the bottom of config.yaml showing how to enable it.
Mirage20
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new `account` provider + component that detects which Claude Code account is currently logged in (macOS only) and renders a colored label on the status line.
Motivation
When using Claude Code with multiple accounts (e.g. personal Pro + work Team) and switching between them by swapping the OAuth token in the macOS Keychain, it's easy to lose track of which account a given session belongs to. This component makes that visible at a glance.
How it works
Defaults
Config example
```yaml
providers:
account:
cache:
ttl: 60s
active_slot: "Claude Code-credentials"
profiles:
personal: "Claude Code-personal"
work: "Claude Code-work"
components:
account:
template: "{{.Icon}}{{.Profile}}"
colors:
personal: cyan
work: magenta
default_color: gray
hide_unknown: true
```
Test plan
Notes