MoonshotAI / MoonshotAI/kimi-code

Show a real context-usage breakdown (/context) and reflect the always-sent baseline in the indicator

Open
#524 3 comments 0 reactions 0 assignees View on GitHub

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:

  1. 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.

  2. There is no /context command. Claude Code has a /context command 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 /context slash command that prints a category breakdown with token counts, percentages, and a progress bar, reusing the existing /usage panel style.
  • Add a [context_window] baseline_mode config (off / include / subtract) so users can choose whether the status-bar indicator (and /usage / /status) folds in the baseline. Default off preserves 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-core and surfaced through a new getContextBreakdown() SDK session method (mirrors the existing getUsage / getTools RPC path).
  • To avoid double-counting, the /context total 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

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.