Skip to content

Bring Grok up to par with Claude and Codex in the agents panel - #13992

Merged
dhh merged 12 commits into
quattrofrom
agent-panel-grok
Oct 1, 2026
Merged

dhh merged 12 commits into
quattrofrom
agent-panel-grok

Conversation

@dhh

@dhh dhh commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Grok was only half wired in: it could sign in its first account and launch, but had no usage collector, no icon, refused a second account, and none of the account commands took it. This makes it a full provider alongside Claude and Codex.

Accounts

Grok honors GROK_HOME, so an added Grok account gets its own home under ~/.local/state/omarchy/agents/accounts/grok/<id>/, holding only its login (auth.json) and the settings it caches. Everything else links back to ~/.grok: the CLI binary itself (so no account unpacks its own 160MB copy), sessions, skills, agents, plugins, hooks, memory, rules, commands, workflows, and config files.

  • Every omarchy agent account command takes grok. A second Grok account signs in through a private window, like the others.
  • omarchy agent and a new grok shell function start as the active Grok account; an explicit GROK_HOME still wins.
  • Identity comes from auth.json (user id, email), the plan from settings_cache.json (subscription_tier_display, e.g. "X Premium+").
  • Autoswitch and the near-limit refresh include Grok.

Usage

omarchy-agent-usage-grok:

  • Reads each account's limit from https://cli-chat-proxy.grok.com/v1/billing?format=credits, the endpoint Grok's own /usage view reads, with that account's sign-in. The answer is protobuf JSON under config, with a weekly currentPeriod; the usage percentage is left out while it's zero, so a fresh week reads as 0% rather than nothing known. Verified against a live account.
  • A lapsed token keeps the last credits and reports "Sign-in expired", so the panel offers Sign-in required.
  • Counts today's sessions, all-time prompts and sessions, and active days from each session's summary.json. Grok records neither token counts nor when each prompt was sent there, so neither tokens nor today's prompts are claimed. A limits-only refresh reuses a scan up to 15 minutes old.
  • With one account it reads GROK_HOME when set, as the CLI does.

The panel shows a signed-in agent that has a plan even before its first numbers arrive, so a lapsed sign-in has somewhere to say so. Grok's mark joins the assets. With every agent able to take another account, the add screen no longer dims one.

Ordering the agents

The agents in the panel can be put in any order: drag one by its mark (the mark it would land on lights, and the move happens on release), or put the cursor on an agent's header, now a keyboard stop with its mark boxed, and press Ctrl+Up/Down. The order is kept in ~/.local/state/omarchy/agents/order.json. The shared key catcher only turns Ctrl+Up/Down into a reorder for panels that opt in.

Grok updates

Grok's npm launcher runs ~/.grok/bin/grok whenever it exists, and the install script that repoints it at a new release doesn't run under mise, so machines kept running whichever release they first unpacked (this one was on 1.0.30 with 1.0.44 installed). omarchy-update-mise now has the launcher unpack the installed release, and only then drops the old binary; if the unpack fails, the old release stays linked. Note that mise's npm latest for Grok currently reports itself as the alpha channel.

Tests

  • New agent-usage-grok-test.sh (plan, credits shape, zero percentage, lapsed sign-in, accounts, GROK_HOME, session stats) and update-mise-grok-test.sh; agent-account-test.sh covers adding, listing, and launching a second Grok account.
  • Agent tests and ./test/cli pass, apart from vscode generated theme references current theme file, which fails the same way on quattro.
  • Checked in the running shell: the Grok section shows its mark, plan, and weekly meter.
  • Reviewed with codex review --base quattro (both findings fixed) and Greptile (three fixed; an explicit GROK_HOME alongside registered accounts follows the registry, as Claude and Codex do).

🤖 Generated with Claude Code

dhh and others added 8 commits October 1, 2026 14:42
Grok's npm launcher runs ~/.grok/bin/grok whenever it exists, and the
install script that repoints it at a new release doesn't run under mise,
so every machine kept running the release it first unpacked. Updating
mise tools now drops a link to an older release and the old binary, and
lets the launcher unpack the installed one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grok honors GROK_HOME, so an added Grok account gets its own home holding
only its login and settings cache, with the CLI binary, sessions, skills,
plugins, memory, and config linked back to ~/.grok. The account commands,
the add flow (a second account signs in through a private window), the
launcher, and a grok shell function all take it like the others, and its
identity and plan come from the files Grok writes at login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A grok collector reads each account's plan from the settings Grok caches
and its credits from the endpoint behind Grok's own /usage view, so Grok
gets a section, per-account limits, and autoswitch like Claude and Codex.
A signed-in agent with a plan now shows before its first numbers, so a
lapsed sign-in has somewhere to say so. Grok's mark joins the assets, and
with every agent able to take another account the add screen no longer
needs to dim one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The answer nests under config, names a weekly period with its end, and
as protobuf JSON leaves the usage percentage out while it's zero. The
collector now reads that shape, so a fresh week shows as 0% until it
resets rather than as nothing known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grok keeps a summary beside each session with when it was last active
and how many prompts it had, so its section and the hero's summary get
today's prompts and sessions and its active days. It records no token
counts there, so none are claimed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two overlapping collector runs wrote the same cache through one .tmp
path, so one rename could leave the other's failing and its record not
updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launcher and the CLI honor GROK_HOME, but the collector always read
~/.grok, so a Grok signed in only in a custom home showed nothing. With
one account, the collector now reads the home the CLI would; with
several registered, the primary stays ~/.grok.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds Grok support to the agent account management system.

The PR appears safe to merge, with a non-blocking possibility of an incorrect session count for up to 15 minutes after midnight.

Findings

  1. P2 Yesterday's sessions count today ▶

Summary

The PR completes Grok account management and usage reporting in the agents panel, adds its icons and documentation, and updates Grok’s mise-managed launcher.

  • Follow-up changes preserve the previous Grok binary if an update fails and avoid rescanning sessions on routine limits-only refreshes.
  • The new session-scan cache can briefly carry a prior day’s session count past midnight.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Grok account home] --> B[Credits and plan collection]
  C[Shared session summaries] --> D[Session scan cache]
  B --> E[Usage record]
  D --> E
  E --> F[Agents panel]
Loading

Reviews (2) · Last reviewed commit: "Reuse the Grok session scan on a limits-..."

Comment thread bin/omarchy-update-mise Resolved
Comment thread bin/omarchy-agent-usage-grok Resolved
Comment thread bin/omarchy-agent-usage-grok Resolved
Comment thread bin/omarchy-agent-usage-grok Resolved
dhh and others added 4 commits October 1, 2026 17:12
The collector carried fallbacks for fields and shapes guessed from the
binary before xAI's actual answer was seen, a numeric timestamp branch
nothing writes, the panel's default for prompt stats, and guards that an
empty sign-in already covers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The update dropped the link and older binaries before the new release was
unpacked and ignored a failed unpack, which could leave every Grok
account without a CLI. The old release now stays until the new one is
linked, and its link comes back if it never is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A session's summary holds all its prompts and only when it was last
active, so a resumed session put its whole history on today. Today now
counts the sessions active in it; prompts stay an all-time total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opening the panel and near-limit checks only need fresh limits, so they
reuse a scan up to 15 minutes old, as the Codex collector does; --force
still rescans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread bin/omarchy-agent-usage-grok Resolved
@omarchybot omarchybot added the enhancement New feature or request label Oct 1, 2026
@dhh
dhh merged commit f45461a into quattro Oct 1, 2026
1 check passed
buger added a commit to probelabs/omarchy that referenced this pull request Oct 1, 2026
Upstream omacom/omarchy quattro moved c05d901 -> f45461a (omacom#13992, Grok in
the agents panel). It touches no menu or lock file this proof layer covers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@csfh

csfh commented Oct 2, 2026

Copy link
Copy Markdown
Member

@omarchybot there are many PRs adjacent or duplicated by this. We should look for things to include in follow ups or close out PRs and issues that are stale now.

sgruendel pushed a commit to sgruendel/omarchy that referenced this pull request Oct 3, 2026
…m#13992)

* Let Grok updates through mise take effect

Grok's npm launcher runs ~/.grok/bin/grok whenever it exists, and the
install script that repoints it at a new release doesn't run under mise,
so every machine kept running the release it first unpacked. Updating
mise tools now drops a link to an older release and the old binary, and
lets the launcher unpack the installed one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep several Grok accounts, the way Claude and Codex do

Grok honors GROK_HOME, so an added Grok account gets its own home holding
only its login and settings cache, with the CLI binary, sessions, skills,
plugins, memory, and config linked back to ~/.grok. The account commands,
the add flow (a second account signs in through a private window), the
launcher, and a grok shell function all take it like the others, and its
identity and plan come from the files Grok writes at login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Show Grok's plan and credits in the agents panel

A grok collector reads each account's plan from the settings Grok caches
and its credits from the endpoint behind Grok's own /usage view, so Grok
gets a section, per-account limits, and autoswitch like Claude and Codex.
A signed-in agent with a plan now shows before its first numbers, so a
lapsed sign-in has somewhere to say so. Grok's mark joins the assets, and
with every agent able to take another account the add screen no longer
needs to dim one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Document Grok accounts and limits alongside Claude and Codex

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Read Grok's credits the way xAI actually answers

The answer nests under config, names a weekly period with its end, and
as protobuf JSON leaves the usage percentage out while it's zero. The
collector now reads that shape, so a fresh week shows as 0% until it
resets rather than as nothing known.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Count Grok's prompts and sessions from its session summaries

Grok keeps a summary beside each session with when it was last active
and how many prompts it had, so its section and the hero's summary get
today's prompts and sessions and its active days. It records no token
counts there, so none are claimed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Give each Grok limits cache write its own temporary file

Two overlapping collector runs wrote the same cache through one .tmp
path, so one rename could leave the other's failing and its record not
updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Read a single Grok account from GROK_HOME when it's set

The launcher and the CLI honor GROK_HOME, but the collector always read
~/.grok, so a Grok signed in only in a custom home showed nothing. With
one account, the collector now reads the home the CLI would; with
several registered, the primary stays ~/.grok.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop guesses the real Grok credits answer made unnecessary

The collector carried fallbacks for fields and shapes guessed from the
binary before xAI's actual answer was seen, a numeric timestamp branch
nothing writes, the panel's default for prompt stats, and guards that an
empty sign-in already covers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the working Grok release until its update is in place

The update dropped the link and older binaries before the new release was
unpacked and ignored a failed unpack, which could leave every Grok
account without a CLI. The old release now stays until the new one is
linked, and its link comes back if it never is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Count only Grok sessions for today, not prompts

A session's summary holds all its prompts and only when it was last
active, so a resumed session put its whole history on today. Today now
counts the sessions active in it; prompts stay an all-time total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Reuse the Grok session scan on a limits-only refresh

Opening the panel and near-limit checks only need fresh limits, so they
reuse a scan up to 15 minutes old, as the Codex collector does; --force
still rescans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants