Agent accounts and provider usage
Omarchy gives supported AI agents one account and usage view. It keeps subscription logins separate from shared agent work data, selects the account for new sessions, and turns local activity plus provider limits, balances, or spend into records for the agents panel. Read AI agent integrations for the wider agent model.
Account registry
The account registry is the provider-level source of truth for account identity, the active account, and selection preferences. It supports Claude, Codex, and Grok. The login already used by the provider remains the primary account. Added subscriptions become named accounts with display-safe identity data, while credentials stay in their provider homes. Claude also tracks which account is seated in the normal Claude home. bin/omarchy-agent-account-state owns this shared model.
Each account has a stable id, a label, sign-in state, email, plan, and home. The registry also stores the usage threshold that starts a notice. Account switching is a user choice; the threshold does not silently change the active account.
An added account uses a separate home for its credentials. Shared work data links back to the primary home. This keeps project history, skills, and settings as one set across accounts. Account selection therefore changes the login used by a new session, not the workspace used by that session.
References: bin/omarchy-agent-account-state• L5-21 bin/omarchy-agent-account-state• L223-299 bin/omarchy-agent-account-state• L1238-1257
Account lifecycle
Account creation is a sign-in flow that adds a provider login only after Omarchy can read its identity. Claude, Codex, and Grok can have several registered accounts. Other supported providers keep one sign-in or API key in the provider or harness that runs them.
Sign-in and recovery
The account-add flow uses the provider's normal sign-in for a first account and an isolated sign-in for an added account. Omarchy creates a pending home, reads the identity after sign-in, rejects duplicates, and commits the account only after the registry and home agree. A completed sign-in can be recovered after an interrupted final step.
Re-authentication uses the account's existing home. Removal forgets the selected sign-in and refreshes usage data. It refuses to remove a registered home that a running session still uses. Renaming changes the label and routing id while keeping the home path stable.
When a new account is added, Omarchy selects it when possible and refreshes its usage in the background. Claude sessions can follow a successful seating change. Codex and Grok sessions keep the home they started with.
References: bin/omarchy-agent-account-add• L9-16 bin/omarchy-agent-account-add• L155-176 bin/omarchy-agent-account-add• L365-468 bin/omarchy-agent-account-state• L387-445 bin/omarchy-agent-account-state• L448-518 bin/omarchy-agent-account-state• L932-977
Account transfer
Account transfer copies signed-in Claude, Codex, or Grok subscriptions to another machine. It carries provider login data and account choices. It does not carry shared work data such as sessions, skills, or project history.
The transfer validates provider identities, account names, the active account, and the threshold before import. Existing identities stay in place unless replacement is requested. New accounts receive local homes and shared-data links. A successful import starts a usage refresh so the panel does not retain old limits.
The transfer can send a versioned account stream over SSH. The destination can use its installed account backend or a bundled compatible backend. This supports older destinations without placing credentials in command arguments.
References: bin/omarchy-agent-account-transfer• L32-78 bin/omarchy-agent-account-transfer• L110-159 bin/omarchy-agent-account-transfer• L272-371 bin/omarchy-agent-account-transfer• L403-421
Account selection and homes
Account selection controls which registered account new Claude, Codex, or Grok sessions use. The launcher and direct account boundary resolve the selected home before starting the provider CLI. An explicit provider home still takes precedence.
Claude normally seats the selected login in its standard home. A running Claude session can follow after the login moves. A session that still holds the selected account's private home can delay the move. New Claude sessions use the selected account while the move is blocked. Codex and Grok keep the home chosen when their sessions start, so a later selection affects new sessions only.
The registry checks running sessions before it moves, removes, or replaces a login. This protects a live session from losing the credentials it already uses. Registry changes are serialized and saved as complete updates so a panel refresh, a usage check, and a command do not overwrite one another.
References: bin/omarchy-agent-account-state• L571-614 bin/omarchy-agent-account-state• L756-825 bin/omarchy-agent-account-state• L865-977 bin/omarchy-agent-account-state• L279-299
Shared work state
Account homes share the files and folders that describe the user's agent work. Login files remain private to each account home. This lets account selection change subscription access without splitting project history, skills, rules, or settings.
Omarchy also keeps one shared instruction file for supported harnesses. The links place the same coding rules where each harness looks for global instructions. Provider persona files are not treated as shared coding rules.
References: bin/omarchy-agent-account-state• L322-363 bin/omarchy-agent-account-state• L47-65 bin/omarchy-agent-instructions• L7-19 bin/omarchy-agent-instructions• L29-54
Usage records
Every usage collector emits one display-ready JSON record. bin/omarchy-agent-usage-update refreshes registered account identities, discovers the collectors, runs them in parallel, and writes records under Omarchy state. The agents panel reads these records instead of reading provider files or calling provider services itself.
The common record keeps two meanings apart:
- Local activity: prompts, sessions, active days, recent activity, and token totals by model when the source provides them.
- Provider state: plan, quota windows or balance, reset times, sign-in status, freshness, and help text.
Collectors reuse recent scans and provider checks. A failed check can keep a usable last answer and mark it stale. This lets the panel show local activity during a provider outage without treating missing limits as zero use.
References: bin/omarchy-agent-usage-update• L7-13 bin/omarchy-agent-usage-update• L47-64 bin/omarchy-agent-usage-update• L66-90
Collection pipeline
When Omarchy refreshes usage, it follows a structured sequence:
- Refresh registered account identities.
- Start the enabled provider collectors in parallel.
- Write each valid record atomically to the usage state.
- Check the Claude, Codex, and Grok records for threshold notices.
The flow keeps provider checks out of the panel and gives account selection one fresh set of limits to use.
This diagram shows how local activity and provider state become a panel record and a threshold notice.
flowchart LR
A[Agent activity] --> C[Provider collector]
B[Login, quota, balance, or billing data] --> C
C --> D[Usage JSON record]
D --> E[Agents panel]
D --> F[Threshold notice]
F --> G[User selects an account]
G --> H[New sessions use selected home]
References: bin/omarchy-agent-usage-update• L59-90 bin/omarchy-agent-account-state• L1129-1227
Subscription account usage
Claude, Codex, and Grok collect limits from the account used by each provider home. Their records add per-account rows. The top-level plan and limits describe the active account so the panel's main meter matches the account used by new sessions.
- Claude: combines Claude Code activity with Anthropic sessions from pi, omp, and OpenCode. It reports session, weekly, and model-scoped allowance windows.
- Codex: combines native Codex activity with supported pi, omp, and OpenCode sessions. It reports rate windows, plan data, spend limits, and reset credits when the provider supplies them.
- Grok: combines Grok session activity with xAI credit or monthly limits.
Each account's provider limits are cached by provider identity. A replacement login therefore cannot inherit the limits of an older account with the same label.
References: bin/omarchy-agent-usage-claude• L5-13 bin/omarchy-agent-usage-claude• L597-679 bin/omarchy-agent-usage-claude• L727-817 bin/omarchy-agent-usage-codex• L5-11 bin/omarchy-agent-usage-codex• L801-887 bin/omarchy-agent-usage-grok• L5-13 bin/omarchy-agent-usage-grok• L348-407
Provider quota usage
Other collectors report the provider or API-key scope that their source can prove. They do not create rows in the subscription account registry. Their local activity can include native agent sessions and supported pi, omp, OpenCode, or routed harness sessions.
| Usage shape | Supported examples | Panel meaning |
|---|---|---|
| Shared sign-in and quota | Antigravity | Google plan and quota are combined with activity from Antigravity and supported harnesses that use the same sign-in. |
| Account-wide allowance | GitHub Copilot, Cursor, Grok Bot | The meter describes the provider account. Grok Bot has its own weekly allowance even though it uses Cursor authentication. |
| Balance or spend | DeepSeek, Fireworks, MiniMax, OpenRouter | The panel shows remaining credits or provider billing state. Local activity stays separate from account-wide spend. |
| Provider quota | Synthetic and Z.ai | The panel shows provider windows when the key has the required plan. |
| Activity without a quota | Qwen Code | The panel shows local and supported Qwen-plan activity without inventing a limit meter. |
Antigravity, Cursor, and Grok Bot use provider account data for their meters. Copilot and Fireworks can show account-wide state that includes activity from more than this machine. OpenRouter uses a management key for account-wide history when available and falls back to local activity when it is not.
References: bin/omarchy-agent-usage-agy• L5-20 bin/omarchy-agent-usage-copilot• L5-36 bin/omarchy-agent-usage-cursor• L5-13 bin/omarchy-agent-usage-grokbot• L5-14 bin/omarchy-agent-usage-deepseek• L5-13 bin/omarchy-agent-usage-fireworks• L5-16 bin/omarchy-agent-usage-minimax• L5-15 bin/omarchy-agent-usage-openrouter• L5-24 bin/omarchy-agent-usage-qwen• L5-25 bin/omarchy-agent-usage-synthetic• L5-13 bin/omarchy-agent-usage-zai• L5-17
Local model usage
Local models are self-hosted routes, not subscription accounts. The models command sets up, starts, shares, and removes models that run on the user's machine or a paired machine. The usage boundary counts self-hosted activity and excludes provider-owned routes such as cloud-tagged models.
The agents launcher can start a selected local model through pi or OpenCode. Omarchy prepares the required runtime during setup, gives configured text models launchers, and shows a visible warm-up while a model loads. This path does not change the Claude, Codex, or Grok account registry.
References: bin/omarchy-models• L1-25 bin/omarchy-models• L28-77 bin/omarchy-models-launchers• L6-16 bin/omarchy-models-warmup• L7-15 bin/omarchy-agent-make• L1-28 bin/omarchy-agent-pi-defaults• L7-43
Usage display
The agents panel turns common records into a compact view of capacity and recent work. It shows provider limits with reset times, groups model-specific allowances with their parent window, and shows prepaid balances as remaining funds. It keeps stale data, expired sign-ins, unavailable usage, and current zero use distinct.
For subscription providers, the account list joins registry identity with the latest per-account record. It marks the active account and keeps account identity visible when limits are stale or unavailable. Account changes and transfers trigger a usage refresh because the panel must not keep rows for an old account set.
Provider-wide records declare their scope. The panel does not sum account-wide usage as if it were local machine activity. It also keeps a missing quota separate from an exhausted quota, so an API failure cannot create a false switching or billing signal.
References: bin/omarchy-agent-account-list• L22-57 bin/omarchy-agent-usage-update• L47-57 bin/omarchy-agent-usage-claude• L758-817 bin/omarchy-agent-usage-cursor• L95-100 bin/omarchy-agent-usage-fireworks• L112-121 bin/omarchy-agent-usage-openrouter• L557-618
Usage threshold notices
The threshold policy watches the active Claude, Codex, or Grok account after usage records are written. When its known open window reaches the configured percentage, Omarchy notifies the user and offers another signed-in account with known room. The user confirms the switch through account selection.
Unknown usage does not prove exhaustion. If every account is known to be over the threshold, Omarchy stays on the current account and can show the soonest reset. A manual account choice is held until a fresh check shows that account below the threshold. The threshold can be set from 50% to 100% with omarchy-agent-account-threshold.
References: bin/omarchy-agent-account-threshold• L1-25 bin/omarchy-agent-account-state• L1006-1126 bin/omarchy-agent-account-state• L1190-1227
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the Claude, Codex, and Grok provider set aligned across the registry, home resolution, launcher routing, account rows, and threshold notices.
- Keep non-registry collectors separate from subscription account rows. Preserve each record's declared scope for local activity, provider activity, balances, and billing history.
- Preserve the usage record contract for active-account top-level limits, per-account limits, local activity, freshness, and sign-in status.
- Keep collector ownership aligned with provider routing so one session is counted by one provider record. This includes shared pi, omp, OpenCode, Codex, Claude Code, Qwen Code, and harness sessions.
- Keep account-home changes aligned with collector authentication. Codex and Grok sessions retain their original home, while Claude may catch up after a seating move is unblocked.
- Keep account-add events aligned with cancellation, notifications, launcher installation, account selection, and the usage refresh after sign-in.
- Keep account transfer validation, identity matching, name mapping, credential replacement, rollback, SSH receiver compatibility, and post-import refresh aligned.
- When a provider changes a quota or billing shape, update its normalized windows or balance, reset information, freshness state, and failure status together.
- Keep account identity as the cache boundary. A new login or API key must not reuse another account's limits, balance, or spend.
- Keep collector discovery and the usage directory contract aligned with every new
omarchy-agent-usage-*record. - Keep the shared instruction links aligned with each harness's global instruction path. Do not link a persona file as coding rules.
- Keep local-model setup, launcher generation, and warm-up behavior aligned with detached panel actions and the runtime support required by the selected hardware.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A running session uses an account home that someone removes or replaces | The session could lose its credentials | Account changes check active process use before moving or removing a home |
| A provider check fails after a valid result exists | The panel could erase useful limits, balances, or spend | Collectors keep the last valid answer and mark it stale with its fetch time |
| A provider route is counted by both a provider collector and the local-model record | Usage is double-counted | Collectors claim provider routes and self-hosted classification excludes provider-owned routes |
| The active account reaches the threshold while another account has no usable data | A notice could recommend an account that cannot start a session | Threshold decisions require known signed-in usage and stay quiet when exhaustion is not proven |
| A registry change races with a panel refresh or threshold check | One change could overwrite another | Registry updates use a per-provider lock and atomic save |
| An added sign-in is cancelled or identifies an existing account | A partial or duplicate account could appear | Pending homes are cleaned up and registration checks provider identity |
| A management key is missing or rejected for account-wide history | The panel could show incomplete history as full account history | OpenRouter falls back to local activity and keeps the scope visible |
| A transfer contains an unknown identity, invalid account choice, or live home conflict | The destination could create the wrong account or interrupt a session | Import validates the stream, refuses unsafe replacement, and restores prior files on failure |
| A replacement login uses the same label as an old account | The new account could show the old account's limits | Caches use provider identity rather than the display label |
| Local-model setup lacks its runtime or hardware support | The model cannot start or detached setup can block on a hidden prompt | The models command installs required packages and detached setup uses a visible terminal or password dialog |
Key files
| File | Why to read it |
|---|---|
bin/omarchy-agent-account-state | Defines the account registry, account homes, Claude seating, selection, threshold notices, and safe removal for Claude, Codex, and Grok. |
bin/omarchy-agent-account-add | Shows sign-in, re-authentication, recovery, panel events, account selection, and usage refresh. |
bin/omarchy-agent-account-list | Shows how registry identity is joined with the latest per-account limits for display. |
bin/omarchy-agent-account-threshold | Shows the user-facing threshold setting and its manual-switch meaning. |
bin/omarchy-agent-account-transfer | Defines validated account export, SSH copy, import matching, replacement, rollback, and post-import refresh. |
bin/omarchy-agent-usage-update | Coordinates identity refresh, collector discovery, parallel collection, record writes, and threshold checks. |
bin/omarchy-agent-usage-claude | Shows combined Claude activity, provider limits, model windows, identity-scoped caches, and account rows. |
bin/omarchy-agent-usage-codex | Shows combined Codex activity, rate windows, plan data, and per-account records. |
bin/omarchy-agent-usage-grok | Shows combined Grok activity, account-specific limits, and per-account records. |
bin/omarchy-agent-usage-agy | Shows shared Antigravity sign-ins, Google quota, and activity from supported harnesses. |
bin/omarchy-agent-usage-copilot | Shows account-wide Copilot allowance and local CLI activity. |
bin/omarchy-agent-usage-cursor | Shows Cursor dashboard limits and account-scoped token activity. |
bin/omarchy-agent-usage-grokbot | Shows the separate Grok Bot allowance that shares Cursor authentication. |
bin/omarchy-agent-usage-deepseek | Shows prepaid balance collection and routed local activity for DeepSeek. |
bin/omarchy-agent-usage-fireworks | Shows account-wide billing usage, spend, and cap state. |
bin/omarchy-agent-usage-openrouter | Shows key limits, credit balance, management-key history, and local fallback. |
bin/omarchy-agent-usage-qwen | Shows Qwen Code and Qwen-plan activity without a quota meter. |
bin/omarchy-agent-usage-minimax | Shows MiniMax Token Plan windows and routed local activity. |
bin/omarchy-agent-usage-synthetic | Shows Synthetic quotas and routed local activity. |
bin/omarchy-agent-usage-zai | Shows Z.ai Coding Plan windows and routed local activity. |
bin/omarchy-models | Shows the self-hosted model lifecycle and the boundary between local models and subscription accounts. |
bin/omarchy-models-launchers | Shows how configured text models receive agent launchers. |
bin/omarchy-models-warmup | Shows how a local model starts and reports loading before an agent opens. |
bin/omarchy-agent-pi-defaults | Shows how Omarchy gives Pi its shared extensions and safe default settings. |