anomalyco / anomalyco/opencode

[FEATURE]: /context — detailed token/cost breakdown panel per session component

Open
#41,908 1 comment 2 reactions 1 assignee View on GitHub

@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

  • /context opens 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's context limit.
  • Optionally surface estimated cost per component.
  • Reuse the model context-limit metadata already read in context.tsx.

Benefits

  • Diagnose context overflow before /compact is needed.
  • Clear view of cost drivers per conversation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.