MoonshotAI / MoonshotAI/kimi-code
Feature request: track incoming/outgoing tokens per session in Kimi vis, /status, and context status line
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
It would be very useful to see a per-session breakdown of token consumption, split into incoming (input/prompt/context) and outgoing (output/completion) tokens.
Where this information should be available:
- Kimi vis — show input/output token counters alongside the existing visual context map.
/statuscommand — add lines such as:tokens (session): 145.2k in / 38.7k out tokens (turn): 12.4k in / 3.1k out- Context status line — optionally display the counters next to the context usage indicator, e.g.:
context: 66.8% (175.1k/262.1k) | tokens: 145.2k in / 38.7k out
Why this helps
- Users can quickly understand whether they are running out of context because of large file reads, tool outputs, or because the model is generating long responses.
- It makes it easier to optimize workflows and decide when to compact, restart, or switch to a model with a larger context window.
Suggested data to expose
session_tokens_in/session_tokens_out— cumulative since the session started.turn_tokens_in/turn_tokens_out— for the current agent turn.- Ideally also model/tokenizer-aware numbers when the provider reports them.
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.
Research direction
Start by tracing the existing context usage data and display paths for Kimi vis, the /status command, and the context status line. Then inspect how provider-reported token counts could map to session and turn totals. Done means the requested input/output counters are available on all three surfaces, with model-aware values used when reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100