| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Note
Heavily inspired by:
OpenCode TUI plugins that show quota usage, reset countdowns, rate-limit status, compact homepage summaries, MCP server health, active-session context and spend, LSP status, synchronized session TODOs, complete session-tree token totals, direct-child SubAgent activity, and /tokens_* reports for Z.AI (GLM), OpenAI (ChatGPT Plus/Pro), and OpenCode Go.
|
|
Requires OpenCode 1.18.1 or newer, Git, and Node.js with npm.
git clone https://github.com/aamkye/opencode-tools.git
cd opencode-tools
npm ci
npm run deploy:globalFully restart OpenCode after deployment.
The plugins are built and loaded only from local files. This package is not published to npm, and OpenCode is never configured with an npm package spec. OpenCode 1.18.1 or newer is required for the standalone TUI plugin and synchronized MCP, Context, LSP, TODO, session-tree, and SubAgent state APIs.
Native TUI options can be supplied with the local plugin entry:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
"./opencode-tools-home.js",
"./opencode-tools-token-report.js",
"./opencode-tools-context.js",
"./opencode-tools-ses-tokens.js",
"./opencode-tools-subagent.js",
[
"./opencode-tools-quota.js",
{
"quota": {
"refreshIntervalSeconds": 10,
"progressColors": {
"enabled": true,
"errorBelow": 10,
"warningBelow": 30
},
"percentageMode": "remaining",
"hideInactive": false,
"openai": { "hideInactive": false },
"zai": { "hideTools": false, "hideInactive": false },
"opencodego": {
"workspaceId": "wrk_TESTWORKSPACE",
"workspaceToken": "TOKEN_TEST_ONLY_DO_NOT_USE",
"hideInactive": false
},
"otherProviders": { "sortDirection": "desc" }
}
}
],
"./opencode-tools-mcp.js",
"./opencode-tools-lsp.js",
"./opencode-tools-todo.js"
],
"plugin_enabled": {
"internal:sidebar-context": false,
"internal:sidebar-mcp": false,
"internal:sidebar-lsp": false,
"internal:sidebar-todo": false
}
}Context ships as a separate opt-in artifact. Enable it by adding ./opencode-tools-context.js to the plugin array.
The entries must remain standalone and in manifest order. Quota accepts the quota options object; each sidebar panel (Context, SesTokens, SubAgent, MCP, LSP, TODO) optionally accepts an options object with defaultState and chip. Home and token-report use string entries.
Any sidebar panel can be configured with defaultState. Whenever the active session ID changes, including returning to a previously opened session, every panel resets to that configured state. A missing or invalid value uses the built-in "expanded" default. Header and secondary-section toggles remain local to the currently selected session and are not persisted.
| Plugin | Accepted values |
|---|---|
| Context, SesTokens, MCP, LSP, TODO | "expanded" (default), "collapsed" |
| SubAgent, Quota | "expanded" (default), "semi-collapsed", "collapsed" |
"semi-collapsed" starts the panel expanded with the secondary section (Rest / Other Providers) collapsed; it is ignored for panels without a secondary section.
["./opencode-tools-context.js", { "defaultState": "collapsed" }]MCP, Context, LSP, and TODO have no built-in panel override to disable. SesTokens has no built-in panel override. The SubAgent has no built-in panel override. The other external panels do not deactivate their built-in counterparts. Users must disable internal:sidebar-mcp, internal:sidebar-lsp, and internal:sidebar-todo themselves, as shown by plugin_enabled, to avoid duplicate panels.
quota.opencodego.workspaceId identifies the OpenCode Go workspace. quota.opencodego.workspaceToken authenticates the console request; workspaceToken is the plaintext auth cookie value. Keep both values only in local .opencode/tui.json: they must not be committed or shared, and you must rotate the console session when it expires, is revoked, or is exposed.
The provider sends these workspace credentials only to the fixed https://opencode.ai origin; they do not replace the OpenCode-managed inference API key. The sidebar reports exact remaining usage for rolling 5H, weekly 7D, and subscription month 1M windows. OpenCode Go reads the undocumented Solid hydration contract from the authenticated page and fails closed if that contract changes. It does not scrape visible text, save page HTML, or estimate quota from local cost.
OpenCode Go uses the shared default/custom polling interval, one-second countdowns, reset-boundary refresh, and a ten-minute stale horizon without exhausted backoff.
Defaults are quota.refreshIntervalSeconds: 10, quota.progressColors.enabled: true, quota.progressColors.errorBelow: 10, quota.progressColors.warningBelow: 30, quota.percentageMode: "remaining", quota.hideInactive: false, quota.zai.hideTools: false, and quota.otherProviders.sortDirection: "desc". Provider hideInactive overrides resolve as providerOverride ?? quota.hideInactive ?? false. Inactive controls affect only configured providers that are not selected; the selected provider remains visible. Set quota.zai.hideTools to true to remove every Z.AI tool-limit row and its quantities.
Polling defaults to 10 seconds when its value is invalid or non-positive. Color thresholds are clamped to 0-100, and errorBelow cannot exceed warningBelow. Set quota.progressColors.enabled to false to disable semantic bar and percentage colors.
The root-level refreshIntervalSeconds and progressColors paths are ignored. Move them to quota.refreshIntervalSeconds and quota.progressColors respectively. The legacy root-level otherProviders object is also ignored: move otherProviders.percentageMode to quota.percentageMode and otherProviders.sortDirection to quota.otherProviders.sortDirection.
Every configurable option accepted by the plugins and host-level files is listed below. Options are supplied through the tuple form ["./plugin.js", { ... }] in tui.json (or opencode.json). Unknown keys in an options object are ignored.
Per-plugin options
| Plugin | Option | Type | Default | Accepted values |
|---|---|---|---|---|
| Context | defaultState | string | "expanded" | "expanded", "collapsed" |
| SesTokens | defaultState | string | "expanded" | "expanded", "collapsed" |
| SubAgent | defaultState | string | "expanded" | "expanded", "semi-collapsed", "collapsed" |
| Quota | defaultState | string | "expanded" | "expanded", "semi-collapsed", "collapsed" |
| MCP | defaultState | string | "expanded" | "expanded", "collapsed" |
| LSP | defaultState | string | "expanded" | "expanded", "collapsed" |
| TODO | defaultState | string | "expanded" | "expanded", "collapsed" |
defaultState resets every sidebar panel when the active session ID changes. "semi-collapsed" starts the panel expanded with the secondary section (Rest or Other Providers) collapsed; it is ignored for panels without a secondary section. Missing or unrecognized values fall back to "expanded".
Input chips (chip option)
The seven sidebar-panel plugins (Quota, Context, MCP, LSP, TODO, SesTokens, SubAgent) also render a compact status chip through session_prompt_right, on the right of the in-session prompt's agent/model row. Each chip reuses its panel's collapsed summary and semantic status colors — e.g. Q 46%, Ctx 64%, MCP 4/0/0, LSP 2, TODO 4/3/2, Tok 29.11M, Sub 7/1/3. A plugin renders no chip when its panel has no data. Home and token-report do not render chips. Chips are display-only and do not affect the sidebar panels.
| Option | Type | Default | Accepted values | Applicable plugins |
|---|---|---|---|---|
| chip | string | "enabled" | "enabled", "disabled" | Quota, Context, MCP, LSP, TODO, SesTokens, SubAgent |
chip: "disabled" suppresses only that plugin's input chip. Missing or unrecognized values fall back to "enabled".
For example, disable only the LSP chip while keeping its sidebar panel enabled:
["./opencode-tools-lsp.js", { "defaultState": "collapsed", "chip": "disabled" }]Quota plugin options (quota object)
| Path | Type | Default | Accepted values | Effect |
|---|---|---|---|---|
| quota.refreshIntervalSeconds | number | 10 | finite, positive | Provider polling interval in seconds. Invalid or non-positive falls back to 10. |
| quota.progressColors.enabled | boolean | true | true, false | Enables semantic bar and percentage colors. |
| quota.progressColors.errorBelow | number | 10 | 0–100; must be ≤ warningBelow | Remaining percentage at or below which the bar turns error color. |
| quota.progressColors.warningBelow | number | 30 | 0–100 | Remaining percentage at or below which the bar turns warning color. |
| quota.percentageMode | string | "remaining" | "remaining", "used" | Whether bars and collapsed summaries show remaining or used percentage. |
| quota.hideInactive | boolean | false | true, false | Global default for hiding inactive providers in Other Providers. |
| quota.openai.hideInactive | boolean | (inherit) | true, false | Overrides hideInactive for OpenAI. Resolves as providerOverride ?? quota.hideInactive ?? false. |
| quota.zai.hideTools | boolean | false | true, false | Removes every Z.AI tool-limit row and its quantities from the panel. |
| quota.zai.hideInactive | boolean | (inherit) | true, false | Overrides hideInactive for Z.AI. |
| quota.opencodego.workspaceId | string | (none) | wrk_ followed by alphanumeric characters | Identifies the OpenCode Go workspace. Required to activate OpenCode Go. |
| quota.opencodego.workspaceToken | string | (none) | non-empty, no line breaks | Auth cookie value for the console request. Required to activate OpenCode Go. |
| quota.opencodego.hideInactive | boolean | (inherit) | true, false | Overrides hideInactive for OpenCode Go. |
| quota.otherProviders.sortDirection | string | "desc" | "desc", "asc" | Sort direction for secondary providers inside Other Providers. |
When progressColors.errorBelow exceeds progressColors.warningBelow, both revert to their defaults (10 and 30).
Host-level configuration
| Key | Type | Effect |
|---|---|---|
| plugin | array | Ordered list of plugin entries. Each entry is a string spec or [spec, options] tuple. Specs are relative file paths, file:// URLs, or npm package names. Relative paths resolve against the config file that declared them. |
| plugin_enabled | object | Keyed by plugin ID. Set a key to false to disable an internal built-in panel. |
Built-in panel overrides:
| Key | Disables |
|---|---|
| internal:sidebar-context | Built-in Context panel |
| internal:sidebar-mcp | Built-in MCP panel |
| internal:sidebar-lsp | Built-in LSP panel |
| internal:sidebar-todo | Built-in TODO panel |
Set these to false in plugin_enabled when the corresponding opencode-tools plugin is loaded, to avoid duplicate sidebar panels.
MCP names truncate before the right-aligned status label. Every line remains within the 37-cell sidebar width and contains no trailing whitespace.
▼ MCP
-------------------------------------
• codegraph-global Connected
• context7-global Connected
• postgres-test-vendsystem Disabled
• postgres-test-vendsystem… Disabled
-------------------------------------
▶ MCP 4/0/0
-------------------------------------
▶ MCP 2/1/1
-------------------------------------
▶ MCP 0/0/0
-------------------------------------
The collapsed summary shows success/warning/error counts: connected servers, disabled servers, and servers in any error state (failed, needs authentication, needs client registration, or unknown). Each number uses its bucket color — success, warning, or error — including when it is zero, and both separators are muted. For the empty 0/0/0 summary, each zero keeps its bucket color.
Context values come from the active session. The expanded panel uses Limit -, Tokens -, Used -, and Spent $0.00 when context values are unavailable; the collapsed summary uses -. The expanded Used value and collapsed summary are green below 40%, yellow from 40% through 60%, and red above 60%. Only a $0.00 value in the Spent row is muted.
▼ Context
-------------------------------------
Limit 500K
Tokens 322.12K
Used 64%
Spent $0.00
-------------------------------------
▶ Context 64%
-------------------------------------
LSP IDs stay in synchronized source order. Each row also shows the basename of the server's operating directory (root), right-aligned in the muted label color; a server with an empty root shows the id alone. Long IDs truncate with an ellipsis so expanded lines fit within 37 cells and collapsed lines fit within 36 cells.
▼ LSP
-------------------------------------
• typescript opencode-tools
• yaml-ls opencode-tools
-------------------------------------
▼ LSP
-------------------------------------
LSPs will activate as files are read
-------------------------------------
▶ LSP 2
-------------------------------------
The collapsed count uses normal header text. Successful servers use a success bullet, failed servers use an error bullet, and unknown statuses remain present with a muted bullet. Header clicks affect only the current session selection.
TODO records stay in synchronized source order. Status markers occupy four cells, so wrapped content continues beneath the content column without trailing whitespace. TODO continuation lines align under the content column, and the collapsed summary rolls records into done/working/todo counts that exclude cancelled records.
▼ TODO
-------------------------------------
[✓] Explore existing panel patterns
[•] Implement synchronized TODO
state and wrapped rows
[ ] Verify build and deployment
[-] Superseded task
-------------------------------------
▼ TODO
-------------------------------------
No TODOs for this session
-------------------------------------
▶ TODO 4/3/2
-------------------------------------
These examples preserve the current SesTokens layout semantics from AGENTS.md. Fenced lines omit right-padding; OpenTUI flex alignment supplies the visual spacing at runtime. Values remain right-aligned within the 37-cell sidebar.
▼ SesTokens
------------------------------------
↻ turns 97
↑ in 4.41M
↓ out 18.69K
▤ cache write 0
▤ cache read 24.77M
ø cache hit ratio 5.68×
✦ think 2.87K
--- ---
Σ total 29.11M
------------------------------------
▼ SesTokens stale
------------------------------------
↻ turns 97
↑ in 4.41M
↓ out 18.69K
▤ cache write 0
▤ cache read 24.77M
ø cache hit ratio 5.68×
✦ think 2.87K
--- ---
Σ total 29.11M
------------------------------------
▶ SesTokens 29.11M
------------------------------------
▶ SesTokens stale 29.11M
------------------------------------
While the first snapshot loads, the expanded body and collapsed summary show Loading... without zero metrics. If the initial attempt and all three retries fail, they show Usage unavailable. A failed refresh after ready data retains the last successful snapshot as stale and recovers it to ready when a later refresh succeeds. The panel does not poll. Snapshots and collapse choices are memory-only, and the panel does not calculate cost.
These examples preserve every canonical SubAgent layout from AGENTS.md. Rows show the newest five direct children first; older entries appear in the separate Rest group. Fenced lines omit runtime right-padding and contain no trailing whitespace.
▼ SubAgent
------------------------------------
▶ SubAgent11 with super lo… 9m 45s
▶ SubAgent10 1h 15m
▼ SubAgent9
agent: general
status: running
time: 15m 4s
model: gpt-4o-mini
Open Session
▶ SubAgent8 2h 18m
▶ SubAgent7 2h 18m
--- ---
▼ Rest
▶ SubAgent6 9m 45s
▶ SubAgent5 1h 15m
▶ SubAgent4 15s
▶ SubAgent3 25s
▶ SubAgent2 5s
▶ SubAgent1 1h 2m
------------------------------------
▼ SubAgent
------------------------------------
▶ SubAgent11 with super lon
g name that would normall
y wrap but is too long to
fit.
agent: general
status: running
time: 9m 45s
model: gpt-4o-mini
Open Session
▶ SubAgent10 1h 15m
▼ SubAgent9 15m 4s
▶ SubAgent8 2h 18m
▶ SubAgent7 2h 18m
--- ---
▼ Rest
▶ SubAgent6 9m 45s
▶ SubAgent5 1h 15m
▶ SubAgent4 15s
▶ SubAgent3 25s
▶ SubAgent2 5s
▶ SubAgent1 1h 2m
------------------------------------
▼ SubAgent
------------------------------------
▶ SubAgent11 with super lo… 9m 45s
▶ SubAgent10 1h 15m
▶ SubAgent9 15m 4s
▶ SubAgent8 2h 18m
▶ SubAgent7 2h 18m
--- ---
▼ Rest
▶ SubAgent6 9m 45s
▶ SubAgent5 1h 15m
▶ SubAgent4 15s
▶ SubAgent3 25s
▶ SubAgent2 5s
▶ SubAgent1 1h 2m
------------------------------------
▼ SubAgent stale
------------------------------------
▶ SubAgent11 with super lo… 9m 45s
▶ SubAgent10 1h 15m
▶ SubAgent9 15m 4s
▶ SubAgent8 2h 18m
▶ SubAgent7 2h 18m
--- ---
▼ Rest
▶ SubAgent6 9m 45s
▶ SubAgent5 1h 15m
▶ SubAgent4 15s
▶ SubAgent3 25s
▶ SubAgent2 5s
▶ SubAgent1 1h 2m
------------------------------------
▼ SubAgent
------------------------------------
▶ SubAgent11 with super lo… 9m 45s
▶ SubAgent10 1h 15m
▶ SubAgent9 15m 4s
▶ SubAgent8 2h 18m
▶ SubAgent7 2h 18m
--- ---
▶ Rest
------------------------------------
▶ SubAgent 7/1/3
------------------------------------
▶ SubAgent stale 7/1/3
------------------------------------
▼ SubAgent
------------------------------------
No subagents
------------------------------------
The collapsed summary reports successful/running/failed counts. A stale refresh retains the complete entry body and marks the panel stale; it does not replace rows with a loading message. Before a selected parent has ready data, the plugin emits no panel output.
Build the nine standalone minified ESM plugins and their imported shared artifact:
npm run build:pluginsDeploy to this repository's .opencode/ directory or the resolved global OpenCode config directory ($XDG_CONFIG_HOME/opencode, defaulting to ~/.config/opencode):
npm run deploy:local
npm run deploy:globalEach deploy command rebuilds first and automatically migrates managed configuration entries to the nine standalone entries in manifest order. It preserves unrelated plugin entries and preserves existing per-plugin options (quota and defaultState); quota options remain attached only to the quota entry. Local deployment also removes managed source entries from the project-root tui.json, because OpenCode loads it together with .opencode/tui.json; options in the selected .opencode config take precedence. Repeating either command produces the same files and configuration. Deployment does not edit plugin_enabled or disable the built-in MCP, LSP, or TODO panel. Set the overrides in the configuration example yourself when replacing any built-in panel. Fully restart OpenCode after deployment.
Deployment replaces stale managed SubAgent artifacts and removes stale managed source entries while preserving unrelated files and configuration entries.
The normalized quota runtime ID is now aamkye/opencode-tools-quota. This is an intentional ID change, so host-managed plugin state may reset during migration; the deployer still preserves quota's configuration options.
To remove the Context panel, remove ./opencode-tools-context.js from the plugin array and restart OpenCode. To remove the SesTokens panel, remove ./opencode-tools-ses-tokens.js from the plugin array and restart OpenCode. To remove the SubAgent panel, remove ./opencode-tools-subagent.js from the plugin array and restart OpenCode. To return to OpenCode's built-in MCP panel, remove ./opencode-tools-mcp.js from the plugin array, then remove the "internal:sidebar-mcp": false override (or set it to true) to re-enable internal:sidebar-mcp, then restart OpenCode. To return to OpenCode's built-in LSP panel, remove ./opencode-tools-lsp.js from the plugin array, then remove the "internal:sidebar-lsp": false override (or set it to true) to re-enable internal:sidebar-lsp, then restart OpenCode. To return to OpenCode's built-in TODO panel, remove ./opencode-tools-todo.js from the plugin array, then remove the "internal:sidebar-todo": false override (or set it to true) to re-enable internal:sidebar-todo, then restart OpenCode. To roll back the complete standalone migration, optionally restore the prior composed release and its configuration before restarting.
dist/
├── opencode-tools-shared.js
├── opencode-tools-home.js
├── opencode-tools-token-report.js
├── opencode-tools-context.js
├── opencode-tools-ses-tokens.js
├── opencode-tools-subagent.js
├── opencode-tools-quota.js
├── opencode-tools-mcp.js
├── opencode-tools-lsp.js
├── opencode-tools-todo.js
└── session-rename.ts
| File | Runtime ID | Responsibility |
|---|---|---|
| opencode-tools-shared.js | Not registered | Imported-only provider, presentation, and token-report logic. |
| opencode-tools-home.js | aamkye/opencode-tools-home | Compact homepage provider summary. |
| opencode-tools-token-report.js | aamkye/opencode-tools-token-report | TUI /tokens_* commands and reports. |
| opencode-tools-context.js | aamkye/opencode-tools-context | Reactive active-session context and spend panel. |
| opencode-tools-ses-tokens.js | aamkye/opencode-tools-ses-tokens | Complete descendant-session-tree assistant token aggregation panel. |
| opencode-tools-subagent.js | aamkye/opencode-tools-subagent | Direct-child SubAgent activity panel. |
| opencode-tools-quota.js | aamkye/opencode-tools-quota | Quota sidebar panel and provider polling. |
| opencode-tools-mcp.js | aamkye/opencode-tools-mcp | Reactive MCP sidebar health panel immediately after quota. |
| opencode-tools-lsp.js | aamkye/opencode-tools-lsp | Reactive LSP sidebar status panel. |
| opencode-tools-todo.js | aamkye/opencode-tools-todo | Synchronized session TODO sidebar panel immediately after LSP. |
| session-rename.ts | aamkye/session-rename | Manual global session rename command. |
solid-js, @opentui/*, @opencode-ai/plugin, host SDK modules, and Node/Bun built-ins remain external and are provided by the OpenCode host.
The global session rename plugin is manual-only. It changes a session title only when the command is invoked. Use /session-rename Project planning notes to set an explicit, validated 3-8 word title. Use /session-rename without a title to generate one from recent user text and the latest selected user model. The plugin adds success or failure feedback as an ignored message and disables OpenCode's built-in title agent.
Build the plugin with npm run build:session-rename. Deploy it with npm run deploy:global; this installs dist/session-rename.ts as ~/.config/opencode/plugins/session-rename.ts. Deployment installs the new file before it removes the previously managed legacy artifact. Fully restart OpenCode after deployment.
| File | Purpose |
|---|---|
| tui/quota.tsx | Standalone quota sidebar adapter |
| tui/home.tsx | Standalone compact homepage adapter |
| tui/token-report.tsx | Standalone TUI token-report command adapter |
| tui/mcp.tsx | Standalone reactive MCP sidebar adapter |
| tui/context.tsx | Standalone reactive active-session context and spend sidebar adapter |
| tui/lsp.tsx | Standalone reactive LSP sidebar adapter |
| tui/todo.tsx | Standalone synchronized session TODO sidebar adapter |
| tui/ses-tokens.tsx | Standalone SesTokens sidebar adapter |
| tui/features/ses-tokens.ts | Assistant token aggregation and panel model |
| tui/services/session-tree-snapshot.ts | Bounded complete descendant-tree snapshot loader |
| tui/services/ses-tokens-source.ts | Debounced event refresh, retry, and stale-state source |
| tui/subagent.tsx | Standalone SubAgent sidebar component and adapter |
| tui/features/subagent.ts | SubAgent status, duration, grouping, and panel model |
| tui/services/subagent-snapshot.ts | Bounded direct-child snapshot loader |
| tui/services/subagent-source.ts | Event refresh, retry, stale-state, and failure persistence source |
| tui/providers/ | Z.AI, OpenAI, and OpenCode Go provider adapters |
| lib/tokens/ | Vendored token reporting library (upstream, MIT) |
| lib/session-rename.ts | Manual session rename command behavior |
| session-rename.ts | Global manual session rename plugin entry point |
| plugin-manifest.json | Manifest order, runtime IDs, artifacts, slots, and option ownership |
| build-session-rename.mjs | Builds the bundled global session rename plugin |
| build-plugins.mjs | Builds the shared artifact and nine standalone local ESM plugins |
| deploy-plugins.mjs | Idempotently migrates nine local/global plugins and tui.json entries |
Edit the relevant source, redeploy, then fully restart OpenCode to reload.
npm install # install/refresh deps in node_modules
npm run typecheck # tsc --noEmit (informational; runtime resolves via Bun)
npm run build:plugins # rebuild all nine standalone plugins plus shared code
npm run deploy:local # rebuild and deploy into this repository
npm test # run testsThis project was renamed to opencode-tools. Replace every prior project path, TUI entry, package name, token plugin filename, and build command with the paths shown above. Legacy files and aliases are intentionally not provided.
| Back | FazBrowse Home | New Git URL |