Skip to content

Add local and remote Hermes usage sources to Agents panel - #6647

Closed
okurmustafa wants to merge 4 commits into
omacom:quattrofrom
okurmustafa:agent/hermes-gateway-usage
Closed

okurmustafa wants to merge 4 commits into
omacom:quattrofrom
okurmustafa:agent/hermes-gateway-usage

Conversation

@okurmustafa

@okurmustafa okurmustafa commented Aug 8, 2026 •

Copy link
Copy Markdown

Summary

  • add a system-wide, one-shot agent meter for Hermes gateway usage
  • let Hermes users choose This Computer or Remote Gateway directly in the agents popup
  • group timestamped remote session counters into the Omarchy computer's local calendar days, matching the existing Codex seven-day layout
  • preserve the saved gateway session when switching to local usage and silently reuse it when switching back to remote
  • show the inline login fields only when the gateway actually requires authentication
  • collect provider and model names dynamically from Hermes instead of maintaining an Omarchy model list
  • keep local collection as the default and fall back to it when a remote gateway cannot be reached

The meter has no daemon and installs nothing into Hermes' application data. Passwords are sent over stdin rather than process arguments; the saved gateway configuration and session cookie are written with mode 0600. Session titles, previews, prompts, and responses are never written to the agents panel record.

Relationship to the Hermes PRs

This builds on #6645 and should be reviewed as the commit after 65fbf31b. Since that branch lives in a fork, GitHub will show #6645's commits in this PR until #6645 merges into quattro; the diff will then reduce automatically to the gateway integration.

This is separate from the optional Hermes installer in #6644, so people who already run Hermes can use the usage integration even if the installer is not merged.

Testing

  • ./test/cli
  • bash test/shell.d/agent-meter-test.sh
  • bash test/shell.d/agent-usage-hermes-scanner-test.sh
  • bash test/shell.d/agent-usage-update-test.sh
  • python -m py_compile bin/omarchy-agent-meter bin/omarchy-agent-usage-hermes
  • git diff --check
  • live-tested real remote session timestamps crossing UTC/local midnight into the standard Today row
  • live-tested local-to-remote switching with the saved cookie unchanged and no credential-field flash
  • live-tested the themed source selector, first-time remote login form, switching back to local, and real local Hermes token collection

The full ./test/shell run passes all Hermes tests. Its remaining failures on the test machine are unrelated: three packaging checks require a separate omarchy-pkgs checkout, and the existing multi-monitor runtime smoke check reports duplicate loading across every bar widget.

@okurmustafa okurmustafa changed the title Add local and remote Hermes usage sources Add local and remote Hermes usage sources to Agents panel Aug 8, 2026
@okurmustafa
okurmustafa marked this pull request as ready for review August 8, 2026 23:36
Copilot AI balanced review requested due to automatic review settings August 8, 2026 23:36

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 local and remote Hermes usage reporting to the Agents panel.

Changes:

  • Collects Hermes usage by provider and model.
  • Adds remote gateway authentication and source selection.
  • Extends synchronized usage records with model labels.

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 6 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
bin/omarchy-agent-meter Collects and authenticates remote Hermes analytics.
bin/omarchy-agent-usage-hermes Scans local Hermes SQLite ledgers.
bin/omarchy-agent-usage-update Coordinates remote collection and local fallback.
shell/plugins/agents/Main.qml Propagates gateway state and model labels.
shell/plugins/agents/Panel.qml Adds gateway selection and login UI.
shell/plugins/agents/README.md Documents Hermes sources and configuration.
test/shell.d/agent-meter-test.sh Tests remote collection and authentication.
test/shell.d/agent-usage-hermes-scanner-test.sh Tests local Hermes aggregation.
test/shell.d/agent-usage-update-test.sh Tests precedence and fallback behavior.

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

Copilot AI review requested due to automatic review settings August 9, 2026 00:40

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

Copilot reviewed 6 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (1)

shell/plugins/agents/Panel.qml:686

  • First-time setup cannot reach the credential form. A local Hermes record has remoteGateway === false, authRequired === false, and gatewayConfigured === false, so clicking Remote Gateway takes this branch and runs remote; that command requires an existing config and fails, while gatewayRemoteMode stays false and keeps the URL/credential fields hidden. Only reuse the saved gateway when gatewayConfigured is true; otherwise switch to remote mode and show the form.
                    if (root.provider && root.provider.remoteGateway !== true
                        && root.provider.authRequired !== true)
                      root.useRemoteUsage()

@omarchybot

Copy link
Copy Markdown
Collaborator

@teknium1 — same ask as on #6645, and this one leans on you harder. Keeping it open.

Where #6645 reads local usage, this adds a remote source: it talks to a Hermes gateway over HTTP with a cookie-jar login, and sums inputTokens, outputTokens, cacheReadTokens and cacheWriteTokens per session, then groups timestamped remote counters into local calendar days.

What we'd like to know from your side:

  • Is there a supported gateway usage endpoint and auth flow, or is this reverse-engineered from what the gateway happens to serve?
  • Are those four token field names stable, and do they mean what a "total tokens" figure should include? Cache reads especially — counting or not counting them changes the number a user sees.
  • Is cookie-jar login the intended way for a third party to authenticate against a gateway, or is there a token flow you'd rather people used?

If any of it is unofficial, we'd rather wait for something you're happy to support than ship a panel that quietly goes wrong when the gateway changes.

For context: this and #6645 are the only Hermes work not folded into #7469, deliberately — #7469 adds the app and the terminal agent and touches none of shell/plugins/agents/. So there's no rush from our side, and no competing implementation to reconcile against.

@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks! The local Hermes scan, including your named-profile support, is coming in through #14039 (credited there). The remote gateway and the new panel pieces target the old panel, so closing this one.

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