Title: feat: add /tokens /context /cost commands to show token usage and context size · Issue #224 · lessweb/deepcode-cli · GitHub
Open Graph Title: feat: add /tokens /context /cost commands to show token usage and context size · Issue #224 · lessweb/deepcode-cli
X Title: feat: add /tokens /context /cost commands to show token usage and context size · Issue #224 · lessweb/deepcode-cli
Description: Feature Request: Token Usage & Context Visibility It would be very useful to have visibility into token consumption and context size directly from the CLI, similar to Claude Code's /context and /cost commands. Motivation Currently, Deep ...
Open Graph Description: Feature Request: Token Usage & Context Visibility It would be very useful to have visibility into token consumption and context size directly from the CLI, similar to Claude Code's /context and /co...
X Description: Feature Request: Token Usage & Context Visibility It would be very useful to have visibility into token consumption and context size directly from the CLI, similar to Claude Code's /context...
Opengraph URL: https://github.com/lessweb/deepcode-cli/issues/224
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: add /tokens /context /cost commands to show token usage and context size","articleBody":"### Feature Request: Token Usage \u0026 Context Visibility\n\nIt would be very useful to have visibility into token consumption and context size directly from the CLI, similar to Claude Code's `/context` and `/cost` commands.\n\n## Motivation\n\nCurrently, Deep Code already **stores token usage data internally** in `sessions-index.json`. According to the docs, each session entry tracks:\n\u003e \"token 用量 and 活跃 token 数\"\n\nHowever, there is **no way to view this information from the CLI interface**. Users have no visibility into:\n- How many tokens they have consumed in the current session\n- How much of the context window is being used\n- What is consuming the most tokens (system prompt, conversation history, skills, MCP tools)\n\n## Proposed Commands\n\n### `/tokens` – Show current session token consumption\n\nDisplays the token usage breakdown for the current session:\n- Input tokens (this turn)\n- Output tokens (this turn)\n- Thinking tokens (if thinking mode is enabled)\n- Total tokens (entire session)\n- Estimated cost (based on model pricing)\n\n### `/context` – Show context window breakdown\n\nDisplays what is consuming the context window:\n- System prompt size (tokens)\n- Conversation history size (# of messages, tokens)\n- Skills loaded and their contribution\n- Active MCP tools and their descriptions size\n- Total context window usage (e.g., 15K / 128K / 1M)\n\n### `/cost` – Show cumulative session cost\n\nShows the estimated cost of the current session based on model pricing:\n- Per-turn cost breakdown\n- Total session cost\n- Thinking vs non-thinking token cost\n\n## Why This Matters\n\n1. **Cost awareness** – Helps users monitor spend when using paid API models (especially with reasoning/thinking tokens which add significant cost)\n2. **Debug context limits** – When approaching context window limits, users can identify the culprit (bloated history, too many skills, etc.)\n3. **Optimization feedback** – Allows users to measure the impact of prompt optimization, skill trimming, or MCP cleanup\n4. **Parity with alternatives** – Tools like Claude Code already offer `/context` and `/cost`; adding these would reduce friction for users migrating to or evaluating Deep Code\n\n## Implementation Notes\n\n- The data already exists in `~/.deepcode/projects/\u003cproject-code\u003e/sessions-index.json` which stores \"token 用量\" per session entry\n- For real-time context window tracking, the token counts could be computed from the messages being sent to the model API\n- A lightweight tokenizer or cached counts per message would suffice — no need for full tokenization on every request\n\n---\n\n*This is an open-ended feature request. Happy to help with implementation or testing.*","author":{"url":"https://github.com/andrewsruge2501-max","@type":"Person","name":"andrewsruge2501-max"},"datePublished":"2026-07-07T02:05:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/224/deepcode-cli/issues/224"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:30465f9d-8107-96bf-98d6-c24c8c0c2bfb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABC6:CD887:C03B4F:10DECD7:6A4E881F |
| html-safe-nonce | aa0e0a7d6ffcbea904e9d857a33e2532af21ee107b1b2d3c58373e990dae9f0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkM2OkNEODg3OkMwM0I0RjoxMERFQ0Q3OjZBNEU4ODFGIiwidmlzaXRvcl9pZCI6IjU4MjU5Mjg3MjE2ODk4MjU2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 42f799c66d8d30b372146129304548eff25e1f1e1fffd99b48d254f24df797fc |
| hovercard-subject-tag | issue:4824554427 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lessweb/deepcode-cli/224/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5de9593fdb6e27378ecbda436909ef2059e80c6f05657f377f60055c6a01d326/lessweb/deepcode-cli/issues/224 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5de9593fdb6e27378ecbda436909ef2059e80c6f05657f377f60055c6a01d326/lessweb/deepcode-cli/issues/224 |
| og:image:alt | Feature Request: Token Usage & Context Visibility It would be very useful to have visibility into token consumption and context size directly from the CLI, similar to Claude Code's /context and /co... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andrewsruge2501-max |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/lessweb/deepcode-cli git https://github.com/lessweb/deepcode-cli.git |
| octolytics-dimension-user_id | 118287711 |
| octolytics-dimension-user_login | lessweb |
| octolytics-dimension-repository_id | 1223512305 |
| octolytics-dimension-repository_nwo | lessweb/deepcode-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1223512305 |
| octolytics-dimension-repository_network_root_nwo | lessweb/deepcode-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width