Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Adds local OpenCode Zen token usage to the agents panel, including OpenCode, Pi, and OMP sessions.
Changes:
- Adds the Zen SQLite/JSONL collector and comprehensive scanner tests.
- Enables OpenCode Zen by default with light/dark icons.
- Documents Zen support in plugin and user 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 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
bin/omarchy-agent-usage-opencode-zen |
Collects and aggregates local Zen usage. |
test/shell.d/agent-usage-opencode-zen-scanner-test.sh |
Tests scanning, filtering, caching, and discovery. |
shell/plugins/agents/manifest.json |
Enables and describes the provider. |
shell/plugins/agents/README.md |
Documents the collector and configuration. |
shell/plugins/agents/assets/opencode-zen.svg |
Adds the dark-surface icon. |
shell/plugins/agents/assets/opencode-zen-light.svg |
Adds the light-surface icon. |
manual/17-ai.md |
Documents OpenCode Zen panel support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Opencode go subscription is supported? |
|
|
Thanks! OpenCode Zen usage is covered by the OpenCode collector in #14040. Closing in favor of that. |
Summary
Add an
opencode-zencollector to the agents panel for local OpenCode Zen token usage.The collector reads Zen activity from OpenCode's SQLite database and from Pi/OMP sessions using the
opencodeprovider. It aggregates usage by local day and model, while keeping Pi and OMP models identifiable in the panel.The panel presents this as OpenCode with the tier Zen · Pay as you go.
Why a separate Zen collector?
Zen and Go have different billing models and provider identifiers:
opencodeopencode-goopencode-zenopencode-goExact provider matching keeps this compatible with a dedicated Go collector without double counting.
OpenCode does not currently expose a supported API-key-authenticated Zen balance endpoint, so this collector intentionally reports local token statistics only. It does not read credentials or call private endpoints.
This overlaps with the Zen portion of #6526, but is intentionally narrower now that Go has an official limits endpoint and dedicated work in #6779. This PR contains no Go collection or limits code.
Collection behavior
~/.local/share/opencode/opencode.dbwhereproviderID == "opencode".session_messagerows, where the provider is stored asmodel.providerID.~/.pi/agent/sessionsand~/.omp/agent/sessionsusing the exactopencodeprovider.Pi-orOmp-so the consuming harness remains visible.PRAGMA query_only = ON, supports WAL databases, and never caches an interrupted scan.Screenshots
Light theme
Dark theme
Verification
bash test/shell.d/agent-usage-opencode-zen-scanner-test.sh— 22 assertions passedbash test/shell.d/agent-usage-update-test.sh— passedbash test/shell.d/agents-panel-test.sh— passed./test/cli— passed./test/all— passed on a live-linked Omarchy test machinepython3 -m py_compile bin/omarchy-agent-usage-opencode-zen— passedgit diff --check— passedmessageandsession_messageAll automated fixtures are synthetic. No API keys, prompt content, account identifiers, or raw user messages are included in the tests or screenshots.