anomalyco / anomalyco/opencode
[FEATURE]: /context — detailed token/cost breakdown panel per session component
@kommander is already working on this.
Since Aug 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Requested feature
Add a /context slash command (inspired by Claude Code's /context) exposing a detailed breakdown of how the context window is being used: prompt, tools, and message history split by token counts, plus estimated cost.
Why
Today the sidebar (packages/tui/src/feature-plugins/sidebar/context.tsx) only shows the aggregate token count and cost for the latest assistant message (last.tokens.input + output + reasoning + cache.read + cache.write, plus money.format(cost())). There is no per-component visibility, so users can't tell whether prompt/system instructions, tools, or history is consuming the window.
Proposed behavior
/contextopens a dialog/sidebar breakdown: system prompt, tool definitions, session messages, and cached tokens each as a separate row with token counts and percentages of the model'scontextlimit.- Optionally surface estimated cost per component.
- Reuse the model context-limit metadata already read in
context.tsx.
Benefits
- Diagnose context overflow before
/compactis needed. - Clear view of cost drivers per conversation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.