MoonshotAI / MoonshotAI/kimi-cli

Agent ran rm -rf on a pre-existing directory outside the workspace, deleting user session data

Open
#2,596 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

What happened

During a session, the agent (Kimi Code CLI, yolo permission mode) was asked to clean up a symlink it had created at ~/.pi/agent/sessions. Instead:

  1. The symlink creation had actually failed earlier (ln -sfn onto a pre-existing real directory) — the agent did not notice because it chained commands with newlines and never checked stderr.
  2. When asked to remove "the symlink", the agent ran rm -rf ~/.pi without first listing the directory contents.
  3. ~/.pi contained pre-existing user data (agent/sessions/ with pi CLI session archives from the previous week) which was permanently deleted.

Expected behavior

Destructive operations outside the working directory should get a hard confirmation gate even in yolo mode, e.g.:

  • rm -rf (or any recursive delete) on a path outside the session working directory requires explicit user confirmation, showing what will be deleted.
  • Prefer move-to-trash over permanent deletion when the target contains pre-existing content the agent did not create.

Environment

  • OS: Linux (Debian)
  • Kimi Code CLI running inside a managed multi-agent environment (CCB)
  • Permission mode: yolo

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

The issue does not name files or tests. Start by locating the CLI's shell-command execution and yolo permission checks, then reproduce the reported recursive deletion scenario in a safe environment. Done means destructive operations outside the session working directory show what will be deleted and require explicit confirmation, with move-to-trash preferred for pre-existing content.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.