Skip to content

agents: add OpenCode usage collector - #9944

Closed
ranjithrajv wants to merge 1 commit into
omacom:quattrofrom
ranjithrajv:feat/agents-opencode
Closed

ranjithrajv wants to merge 1 commit into
omacom:quattrofrom
ranjithrajv:feat/agents-opencode

Conversation

@ranjithrajv

Copy link
Copy Markdown

Summary

Adds an omarchy-agent-usage-opencode collector so the omarchy.agents bar panel shows OpenCode usage alongside Claude, Codex, and Fireworks.

  • Reads ~/.local/share/opencode/opencode.db (any provider) — input/output/reasoning/cache tokens, grouped by day and model.
  • Follows the existing collector contract (schemaVersion: 1, --force/--limits-only, file-locked cache in ~/.cache/omarchy/agent-usage, ready/hasLocalStats based on actual sessions).
  • No rate-limits endpoint — limits: [], same as other local-only views.
  • Manifest defaults and README updated to include opencode (enabled by default, enabled still defaults to true for any discovered agent).

Automatically discovered by omarchy-agent-usage-update (ships as bin/omarchy-agent-usage-opencode) — no plugin code changes needed.

Testing

  • python3 -m py_compile bin/omarchy-agent-usage-opencode — pass
  • bin/omarchy-agent-usage-opencode --force | jq — produces valid record with id: opencode, recentDays, modelUsage, todayTokensByModel
  • omarchy-agent-usage-update --force && ls ~/.local/state/omarchy/agents/usage/ — opencode.json appears and the bar panel picks up a new tab on refresh

Notes

  • Respects XDG_DATA_HOME for the DB path; read-only SQLite open to avoid blocking a running opencode.

Add omarchy-agent-usage-opencode to surface OpenCode sessions in the
agents bar panel alongside Claude, Codex, and Fireworks. The collector
reads ~/.local/share/opencode/opencode.db directly (all providers),
groups tokens by day and model, and writes the same schemaVersion 1
record the panel already watches.

Update the agents manifest defaults and README to include the new
provider.
@bjarneo

bjarneo commented Sep 20, 2026

Copy link
Copy Markdown
Member

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

2 participants