MoonshotAI / MoonshotAI/kimi-cli
Agent ran rm -rf on a pre-existing directory outside the workspace, deleting user session data
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:
- The symlink creation had actually failed earlier (
ln -sfnonto a pre-existing real directory) — the agent did not notice because it chained commands with newlines and never checked stderr. - When asked to remove "the symlink", the agent ran
rm -rf ~/.piwithout first listing the directory contents. ~/.picontained 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
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
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