MoonshotAI / MoonshotAI/kimi-code
feat: add -w, --worktree [name] flag for isolated sessions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Problem
Users running multiple Kimi Code sessions on the same repository need a way to avoid file conflicts and branch-switching overhead. The legacy Kimi CLI already supports this with a worktree flag, and users expect the same capability in Kimi Code CLI.
Proposed solution
Add a -w, --worktree [name] CLI flag that creates a new git worktree for the session:
- New worktrees live under
<repo-root>/.kimi/worktrees/<name>with a detached HEAD checkout at the current HEAD. - Auto-generate a three-word slug name when no name is supplied.
- Reject combinations with
--sessionor--continue. - Persist
worktree_pathandparent_repo_pathin session metadata. - Clean up the worktree on exit when the session is empty.
Related PR
- #818
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 related PR #818 and the legacy Kimi CLI's worktree behavior, since the issue names no files or tests. Trace the CLI flag handling, session metadata, and exit cleanup. Done means supporting the specified flag and naming behavior, rejecting --session and --continue, persisting both paths, and removing empty worktrees.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, typescript
- Domain
- cli, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100