MoonshotAI / MoonshotAI/kimi-code
Show a real context-usage breakdown (/context) and reflect the always-sent baseline in the indicator
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What feature would you like to see?
Two related gaps in how Kimi Code reports context usage:
-
The status-bar indicator under-reports. On a fresh session it shows
context: 0.0% (0/262.0k)even though every request already carries a large always-sent baseline — the system prompt, tool schemas, MCP tools, skills listing, and memory (AGENTS.md). The number only becomes meaningful after the first turn, and there is no way to see what fills the window. -
There is no
/contextcommand. Claude Code has a/contextcommand that breaks usage down by category (system prompt, system tools, MCP tools, custom agents, memory files, skills, messages, free space). Kimi Code has/usage(totals + quotas) but nothing that shows the per-category composition.
Proposal
- Add a
/contextslash command that prints a category breakdown with token counts, percentages, and a progress bar, reusing the existing/usagepanel style. - Add a
[context_window] baseline_modeconfig (off/include/subtract) so users can choose whether the status-bar indicator (and/usage//status) folds in the baseline. Defaultoffpreserves current behavior.
I'm happy to open a PR — I already have an implementation with tests and bilingual docs ready, pending maintainer direction on the approach (especially the default baseline_mode and the three-mode design).
Additional information
- The breakdown is computed in
agent-coreand surfaced through a newgetContextBreakdown()SDK session method (mirrors the existinggetUsage/getToolsRPC path). - To avoid double-counting, the
/contexttotal is anchored to the model's real reported input-token count after the first turn, so it matches the footer rather than drifting on the character-based estimate.
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 with the existing /usage and /status panels, the agent-core breakdown, and the getUsage/getTools RPC path; use the proposed getContextBreakdown() session method as the entry point. Done means /context reports category counts, percentages, and progress, while the indicator and usage views consistently apply the selected baseline_mode; verify the documented tests and bilingual docs mentioned in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100