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
--session or --continue.
- Persist
worktree_path and parent_repo_path in session metadata.
- Clean up the worktree on exit when the session is empty.
Related PR
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:<repo-root>/.kimi/worktrees/<name>with a detached HEAD checkout at the current HEAD.--sessionor--continue.worktree_pathandparent_repo_pathin session metadata.Related PR