MoonshotAI / MoonshotAI/kimi-cli
Subject: Context compaction bug — Kimi Code reopens an already completed and deleted task
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What version of Kimi Code CLI is running?
v0.6.3
Which open platform/subscription were you using?
login
Which model were you using?
K2.7 coding
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
Subject: Context compaction bug — Kimi Code reopens an already completed and deleted task
After completing the task, documenting it, deleting estado.md, and explicitly reporting “He completado los pendientes técnicos del estado.md y eliminado el archivo”, Kimi Code later hits “Context compacted” and incorrectly reactivates the original instruction. It says the user is asking to read estado.md again and calls ReadFile estado.md, even though that file had already been deleted and the task had been reported as completed.
Expected: completed tasks remain closed after compaction; old fulfilled instructions must not be reactivated; missing deleted files should trigger verification or a question, not reopening the task.
Actual: after context compaction, the original instruction becomes active again and the agent attempts to read the deleted estado.md.
Evidence: attached transcript, pages 1, 37–39, and 95.
What steps can reproduce the bug?
Steps to reproduce:
- Start a Kimi Code CLI session in a project with an
estado.mdfile containing pending tasks. - Ask Kimi Code to: read
estado.md, continue with the pending tasks, document the changes, and then deleteestado.md. Allow it to use subagents/AgentSwarm. - Let Kimi Code complete the task. In my session it reported the pending items as completed, documented the changes, deleted
estado.md, and explicitly said: “He completado los pendientes técnicos del estado.md y eliminado el archivo.” - Continue the same session with other unrelated tasks until the context is compacted. In the attached transcript this happens at the “Context compacted” marker.
- Immediately after compaction, Kimi Code reactivates the original instruction as if it were still pending: “El usuario me pide que lea estado.md, continúe con los pendientes, documente y elimine estado.md...” and calls
ReadFile estado.md, even thoughestado.mdwas already deleted and the task had been reported as completed.
Expected result:
After a task is completed and its state file is deleted, context compaction must preserve that the task is closed. Kimi Code should not reopen the original instruction or try to read the deleted estado.md again. If the file is missing, it should verify or ask instead of assuming the old task is still active.
Actual result:
After “Context compacted”, Kimi Code treats the original fulfilled instruction as active again and attempts to read estado.md.
Additional context:
- This is a conversational/session-state bug; I do not have a standalone code snippet that reproduces it outside the session.
- Attached transcript:
Kimi Code 07192026.pdf - Key pages: page 1 original instruction; pages 37–39 completion, documentation, and deletion of
estado.md; page 95 “Context compacted” and the old task being reopened; page 96 confirmsestado.mdno longer exists. - Context usage before/after compaction: n/a
What is the expected behavior?
No response
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 reviewing the context-compaction and session-state handling in the Kimi Code CLI, using the attached transcript pages 37–39 and 95–96 as behavioral evidence. Reproduce the session with estado.md, task completion, deletion, and later compaction. Done means completed instructions stay closed after compaction and the deleted file is not reopened without verification or a question.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100