MoonshotAI / MoonshotAI/kimi-cli
# Context compaction reloads system prompt and project instructions, wasting ~20k tokens
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Problem
After the session triggers context compaction, the system prompt and project-level instructions (e.g., AGENTS.md, skills, environment context) appear to be reloaded from scratch. This costs a significant number of tokens (~20k in observed cases) even though the information itself has not changed.
Steps to reproduce
- Start a Kimi Code CLI session in a project with a large
AGENTS.md/ skill set. - Work until context compaction is triggered.
- Observe that the system prompt and project instructions are re-injected/reloaded instead of being preserved.
Expected behavior
Context compaction should prune transient conversation history while keeping immutable or unchanged context (system prompt, project instructions, skills) pinned, so it does not need to be re-sent and re-billed.
Actual behavior
The system prompt and project instructions are reloaded after compaction, causing unnecessary token usage.
Additional information
No response
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 reproducing context compaction in a Kimi Code CLI project with a large AGENTS.md or skill set, then trace the context compaction path to see where system and project instructions are reloaded. Done means transient conversation history is pruned while unchanged system prompts, project instructions, skills, and environment context remain pinned without the observed token waste.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100