MoonshotAI / MoonshotAI/kimi-cli

Context compaction picks wrong problem from shared workspace filesystem

Open
#1,878 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

Bug Description

When running kimi --print in a workspace containing multiple problem directories (with separate memory/, results/, data/ subdirectories per problem), the context compactor incorrectly summarizes the session as working on a different problem than the one actually assigned.

Steps to Reproduce

  1. Have a workspace with multiple problem directories:

    data/problem_A.md
    data/problem_B.md
    memory/problem_A/   (sparse)
    memory/problem_B/   (rich — 14 verification rounds, literature findings, full blueprint)
    results/problem_B/blueprint.md
    
  2. Launch Kimi on problem_A:

    kimi --print --mcp-config-file .claude/mcp.json --skills-dir .agents/skills      -p "Solve the math problem in data/problem_A.md."
    
  3. Kimi correctly works on problem_A in session 1 (reads problem_A.md, initializes memory for problem_A, runs computations).

  4. When context compaction triggers (at compaction_trigger_ratio = 0.85), the compaction summary says:

    <current_focus>
    Evaluating the existing results/problem_B/blueprint.md proof draft...
    </current_focus>
    <environment>
    Problem ID: problem_B
    Key files read: data/problem_B.md, memory/problem_B/verification_feedback.md...
    </environment>
    
  5. Session 2 proceeds to work on problem_B — downloading papers, writing blueprints, calling verification — all for the wrong problem.

Expected Behavior

The compactor should summarize what the session actually did (work on problem_A), not infer from filesystem content. The compaction summary should preserve the assigned problem_id.

Evidence

  • Session 1 wire.jsonl contains zero references to problem_B
  • Session 1 correctly called memory_init(problem_id="problem_A") and only read data/problem_A.md
  • The compactor appears to scan the filesystem independently and pick the problem directory with the richest content

Environment

  • Kimi CLI v1.30.0
  • ~/.kimi/config.toml: compaction_trigger_ratio = 0.85, tool_call_timeout_ms = 3600000
  • Workspace has 15 problem files, 14 memory directories, 12 result directories

Workaround

Launch Kimi in an isolated temp workspace containing only the target problem's files, so the compactor can't see other problems.

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 kimi --print entry point and the compaction path triggered by compaction_trigger_ratio = 0.85; compare its inputs with the session's wire.jsonl tool calls. Reproduce using separate problem directories and verify that the summary preserves the assigned problem_id without selecting unrelated filesystem content.

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.