Skip to content

Add Grok and OMP collectors to the agents usage panel - #8649

Closed
rmacy wants to merge 1 commit into
omacom:quattrofrom
rmacy:feat/grok-omp-agent-usage
Closed

rmacy wants to merge 1 commit into
omacom:quattrofrom
rmacy:feat/grok-omp-agent-usage

Conversation

@rmacy

@rmacy rmacy commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Setup already offers Grok and OMP as first-party coding agents, but omarchy.agents never lights up for them. Collectors are discovered from $OMARCHY_PATH/bin/omarchy-agent-usage-*; there was no Grok or OMP one.

This adds omarchy-agent-usage-grok and omarchy-agent-usage-omp. Both print the record contract the panel already understands.

There are several open Grok-only collector PRs (#7200, #6485, #6902, #7393, #8280, #6477). None of them are merged, and none add OMP. This patch covers both.

Change

  • Grok local stats come from $GROK_HOME/sessions (default ~/.grok/sessions). Billed usage is on updates.jsonl turn_completed rows (nested usage, or flat token fields / event_name). Cache read is split out of input. session_kind values that start with subagent are skipped so parent totals are not counted twice.
  • Grok limits come from ACP _x.ai/billing (grok agent --no-leader stdio), the same source /usage uses. A SuperGrok weekly (or monthly) pool becomes limits[]. Leftover prepaid / on-demand credits become a balance only when the ledger is actually non-zero. SuperGrok Heavy often omits creditUsagePercent; the collector does not invent a 0% meter.
  • OMP is a local cross-provider runtime view: ~/.omp/stats.db (or $OMP_HOME/stats.db), grouped by day and model. No subscription limits.
  • assets/grok.svg (and a -light twin) use the official Grok mark. The bar glyph still stands in without them.
  • Provider switch pills size to their labels and wrap, so "Claude Code" does not overflow once more tabs join the strip.

Tests

test/shell.d/agent-usage-grok-scanner-test.sh — nested and flat turn ledgers, cache split, prompt_id dedupe, subagent skip, empty install, weekly/monthly mapping, zero prepaid omit, leftover credits, missing percent.

test/shell.d/agent-usage-omp-scanner-test.sh — empty install, message/session/token totals, per-model buckets, local scope.

test/shell.d/agents-panel-test.sh — provider switch no longer forces equal-width cells.

Verified live on Grok 1.0.5 / SuperGrok Heavy and a populated OMP stats.db.

Setup already offers both as first-party coding agents, but the bar
widget only lights up for Claude, Codex, and Fireworks. Ship collectors
that print the existing record contract, Grok's official mark, and size
provider pills to their labels so longer names still fit.
Copilot AI balanced review requested due to automatic review settings August 27, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Grok and OMP usage collectors to the agents panel.

Changes:

  • Collects Grok sessions, billing limits, and balances.
  • Aggregates OMP’s local SQLite usage statistics.
  • Adds Grok branding and wrapping provider controls.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/omarchy-agent-usage-grok Implements Grok usage collection.
bin/omarchy-agent-usage-omp Implements OMP database collection.
shell/plugins/agents/Panel.qml Makes provider pills wrap.
shell/plugins/agents/manifest.json Enables Grok and OMP.
shell/plugins/agents/README.md Documents both collectors.
shell/plugins/agents/assets/grok.svg Adds dark-surface Grok mark.
shell/plugins/agents/assets/grok-light.svg Adds light-surface Grok mark.
manual/17-ai.md Lists the new providers.
test/shell.d/agent-usage-grok-scanner-test.sh Tests Grok collection.
test/shell.d/agent-usage-omp-scanner-test.sh Tests OMP collection.
test/shell.d/agents-panel-test.sh Tests wrapping provider controls.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bjarneo

bjarneo commented Sep 20, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #9498, which covers the same Grok usage collector. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 20, 2026
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.

3 participants