CommandCodeAI / CommandCodeAI/command-code
Bug: Context window size in CLI differs from input tokens in usage logs
@ahmadbilaldev 已经在做这个了。
开始于 2026年6月2日。
- 主要语言
- 没有语言数据
- 星标
- 4k
- 派生
- 350
- PR 合并指标
- 30 天内没有已合并 PR
描述
Bug: Context window size in CLI differs from input tokens in usage logs
Summary
There is a significant discrepancy between the context window size displayed in the CLI (bottom right corner) and the input token counts shown in the web usage logs. After compacting, the displayed context size drops significantly, but still doesn't match the actual token usage shown online.
Environment
- Command Code version: 0.30.1
- OS: Windows
- Shell: PowerShell
Steps to Reproduce
- Start a Command Code session and have a conversation
- Note the context window size shown in the CLI bottom right corner (e.g., ~500k tokens)
- Check the web usage dashboard at https://commandcode.ai/settings/usage
- Compare the "input tokens" shown in the usage logs with the CLI context display
- Run
/compactto compact the context - Note the new context window size (e.g., drops to ~300k)
- Compare again with web usage logs
Expected Behavior
The context window size displayed in the CLI should roughly correspond to the input token counts shown in the usage logs. The numbers should be consistent and accurate.
Actual Behavior
Example observations:
- CLI bottom right corner shows ~500k tokens used
- Web usage logs show much lower input token counts for the same requests
- After
/compact, context drops from ~500k to ~300k - Neither the pre-compact nor post-compact CLI numbers match the web usage logs
The context window display appears to be showing a different metric than what's actually being sent as input tokens to the API.
Analysis
This could be caused by:
- The context display counting tokens differently than the API (e.g., including system prompts, tool definitions, cached content)
- The context display showing the total context window capacity used rather than the actual input tokens for the current request
- A bug in how compacting updates the context size display
- The usage logs showing only new tokens (excluding cached tokens) while the CLI shows total context
Impact
This discrepancy makes it difficult to:
- Accurately track token usage and costs
- Understand when context is approaching limits
- Plan when to start new sessions or compact
Related Issues
- #348 — "Context Window Visual Reference" (requesting better context visibility)
- #426 — "Add persistent context window indicator in cli"
- #444 — "Usage data discrepancy between CLI /usage command and web dashboard" (different issue but similar theme of data inconsistency)
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。