Skip to content

Add Hermes usage to agents monitor - #6645

Closed
okurmustafa wants to merge 2 commits into
omacom:quattrofrom
okurmustafa:agent/hermes-usage-monitor
Closed

okurmustafa wants to merge 2 commits into
omacom:quattrofrom
okurmustafa:agent/hermes-usage-monitor

Conversation

@okurmustafa

Copy link
Copy Markdown

Summary

  • add a collector for token usage stored in Hermes' local SQLite session ledger
  • preserve model switches and auxiliary-task usage by billing provider and model
  • let Hermes supply human-readable provider/model labels from its local catalogue
  • carry optional model labels through the agents widget and cross-device snapshots

Why

Hermes can use several providers and models within the same session, so treating it like a single-subscription agent would lose important attribution. This adds one Hermes tab while keeping each provider/model route distinct and avoids presenting a misleading unified quota.

This is a follow-up to #6644, but it is intentionally independent: existing Hermes users can benefit even if the installation integration is not merged.

The collector reads ~/.hermes/state.db and named-profile databases in read-only mode. It performs no paid model calls and uses Hermes' local model metadata without requiring a network request. Unknown or custom routes fall back to the exact identifiers Hermes recorded.

Validation

  • bash test/shell.d/agent-usage-hermes-scanner-test.sh
  • Claude, Codex, Fireworks, and usage-update collector tests
  • ./test/cli
  • live Quickshell load and panel layout check with multi-provider synthetic usage

@okurmustafa
okurmustafa marked this pull request as ready for review August 8, 2026 19:40
Copilot AI balanced review requested due to automatic review settings August 8, 2026 19: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

Adds Hermes token usage to the agents monitor while preserving provider/model attribution across local and synced data.

Changes:

  • Adds a read-only Hermes SQLite usage collector with route labels.
  • Displays provider/model labels and includes them in synced snapshots.
  • Adds collector coverage and documentation.

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

Show a summary per file
File Description
bin/omarchy-agent-usage-hermes Collects and attributes Hermes usage.
test/shell.d/agent-usage-hermes-scanner-test.sh Tests reconciliation, profiles, labels, and damaged databases.
shell/plugins/agents/Main.qml Carries labels through local and synced records.
shell/plugins/agents/Panel.qml Displays route labels in rows and tooltips.
shell/plugins/agents/README.md Documents Hermes and the label contract.

💡 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 8, 2026 23:26

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

@omarchybot

Copy link
Copy Markdown
Collaborator

@teknium1 — would you or someone on your team take a look at this one? Keeping it open; it's the piece of Hermes-in-Omarchy that #7469 doesn't touch at all.

It adds Hermes to Omarchy's agents usage panel, and the part worth your eyes is what it has to read to do that:

  • ~/.hermes/state.db directly over sqlite3, plus each ~/.hermes/profiles/*/state.db
  • from agent.models_dev import PROVIDER_TO_MODELS_DEV, fetch_models_dev
  • from hermes_cli.models import provider_label

Two questions. Is that ledger's schema something you'd consider stable to read from outside, or internal enough that it will move? And are those module paths safe to import against, or are they internals?

The failure mode if either shifts is quiet: the panel shows nothing or wrong numbers rather than erroring, and nobody notices for a while.

If there's an official surface for this — even a hermes usage --json — Omarchy would rather call it than read the database. For comparison, Omarchy's Claude collector uses local transcripts plus Anthropic's OAuth usage endpoint, and Codex reads its native session files, so per-agent coupling isn't new here; it's just that a supported command would age much better.

The multi-provider attribution question is yours too: Hermes can switch models mid-session, and this keeps each provider/model route distinct rather than presenting one unified quota. Sanity-checking that against how you think about it would be valuable.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #9871, which covers the same Hermes 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 21, 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.

4 participants