kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

/rewind 功能相关

Open zha-ji-tui opened this issue 6 months ago • 8 comments

What feature would you like to see?

我希望有 /rewind功能,而且不需要强制要求项目用 git ,类似 claude code的 /rewind能力

Additional information

No response

zha-ji-tui avatar May 27 '26 07:05 zha-ji-tui

/rewind、/undo 这个功能真的是会话上下文构建的核心,请尽快支持 🥺

dulltackle avatar May 30 '26 10:05 dulltackle

Adding context from the legacy kimi-cli side: I filed the same user-facing request there as MoonshotAI/kimi-cli#2290 because Kimi CLI is evolving into Kimi Code CLI.

The behavior I want is the Claude Code-style rewind/checkpoint flow: choose an earlier turn/checkpoint, restore the conversation state, and ideally restore file changes from that point in a predictable way. This issue looks like the right place to track the kimi-code version instead of opening a duplicate.

ktwu01 avatar Jun 08 '26 22:06 ktwu01

刚需功能啊

cyijun avatar Jun 18 '26 03:06 cyijun

刚准备切到Kimi-Code CLI,但没有/rewind真的下不了决心。

pengzhxyz avatar Jun 20 '26 17:06 pengzhxyz

和上面几位一样,我也是因为缺少这个功能而犹豫是否全面切换过来。

补充一些具体的使用场景说明这个问题有多痛:

目前 /undo 的行为只是从会话上下文中移除提示词,但不会回滚该提示词引发的文件修改(见官方文档描述:"从当前上下文撤销最近的提示词")。这意味着:

  1. undo 后代码库处于一个"脏"状态——修改还在,但 AI 已经不记得自己改了什么
  2. 用户必须手动 git checkout . 恢复,还要知道改了哪些文件
  3. 在实际开发中,undo 几乎总是意味着"我刚才说的不对,把改动也撤回",纯撤消息用途很小

对比之下,Claude Code 的 checkpoint/rewind 可以原子性地同时恢复对话状态和文件状态,CURSOR 也有类似的回退能力。这是 Agent 式编程工作流里的核心体验,直接影响迭代效率。

希望官方能关注这个需求,哪怕先做个最小可行版本(比如只追踪 Write/Edit 工具修改的文件,存储 diff 快照)也好。🙏

UoMaster avatar Jul 05 '26 14:07 UoMaster

So strange, how come this important feature is missing for such a long time?

szetakyu avatar Jul 18 '26 03:07 szetakyu

I can see there is an /undo command in verison 0.27.0

YeKc1M avatar Jul 19 '26 06:07 YeKc1M

I traced the current implementation before proposing a PR. /undo now has a selector and correctly removes recent user turns from active context, but it deliberately does not restore filesystem state. That leaves the core request here unresolved.

There are two materially different implementation directions:

  1. Tool-owned checkpoints: record reversible before-images for Write / Edit operations per user turn. This is bounded and predictable, but cannot honestly restore arbitrary changes made by Bash.
  2. Workspace snapshots: create a content-addressed snapshot at each user-turn boundary so Bash changes can also be detected/restored without requiring Git. This is more complete, but needs explicit policies for ignored files, symlinks, large/binary files, concurrent external edits, and changes outside the workspace.

I do not want to submit a partial Write/Edit implementation while calling it Claude-style rewind. My proposed PR would use the second model with a preflight preview and fail closed on conflicts, while limiting snapshots to workspace roots and storing deduplicated content under the session data directory.

Is that the intended product direction, or would maintainers prefer the narrower tool-owned MVP?

Coiggahou2002 avatar Aug 10 '26 14:08 Coiggahou2002