zai-org / zai-org/feedback

[建议 / Feature] 工作区代码快照/时光机:支持跨多轮、任意时间点回退(/rewind)

Open
#346 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复提议 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

文件 / 项目操作 · File / Project ops

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

使用场景 · Use case

真实场景:AI 在一个会话里连续多轮修改代码,中途方向跑偏后,我想把工作区整体回到半小时前的状态。现有手段都覆盖不了:

  • 每轮回复下的"撤销"按钮只能撤最后一轮,而且是"要么全撤、要么都不撤";
  • "编辑消息 + 文件重置"同样只能针对最后一轮的消息;
  • 想回到更早的时间点,只能自己在终端用 git 手动回滚,还要处理项目本身不是 git 仓库 / 有未提交改动的情况;终端命令产生的工作区改动也在现有"撤销"的覆盖范围之外。

跑偏之后让 AI"改回来"经常越改越乱,能直接回滚到某个时间点重新来,往往比让它继续修效率高得多。

建议方案 · Proposal
  • 每轮工具调用(Edit/Write/Bash 等)后自动对工作区打轻量快照,存储不触碰用户项目自身的 git 状态(可用独立快照库,或扩展现有内建 git-checkpoint 存储);
  • 提供 /rewind 命令或快捷键(如双击 Esc)打开快照时间线浏览器:列出每个快照的时间、标签、增删行数/文件数,选择任意一个一键恢复;
  • 恢复前自动保存 pre-restore 快照,并支持撤销恢复(redo,可连续);
  • 快照保留策略可配置(数量/天数)。

相关请求:#15(放出 /rewind 命令,已点赞 👍)。本条是对它的补充:#15 请求放出命令本身,这里进一步描述"跨多轮、任意时间点"的完整形态和使用场景。客户端内建的逐轮"撤销"按钮说明快照基础设施已经存在,扩展为多轮时间线的边际成本应该不高。

预期价值 · Expected value
  • 会话跑偏后一键回到任意时间点,显著降低返工成本;
  • 用户更敢放手让 AI 做大范围修改,提升使用信心;
  • 与 Claude Code(/rewind)、Cursor(checkpoints)等主流产品的能力对齐。
你认为的优先级 · Your perceived priority

你使用的 ZCode 版本 / 环境 · ZCode version / environment

v3.8.1(Windows 桌面版,3.8.1.5310)

补充材料 · Additional context

已查阅官方文档"编辑历史"一节:现有能力为逐轮撤销/重置,未覆盖跨多轮回退;ROADMAP 目前为空,所以提此请求。另外希望快照能覆盖 Bash/终端命令造成的工作区改动(现有"撤销"明确忽略这类改动)。

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

Start by reviewing the existing per-round undo/reset behavior described in the “编辑历史” documentation and the built-in git-checkpoint storage mentioned in the proposal. Define how /rewind should browse and restore snapshots across rounds, including Bash changes, pre-restore snapshots, redo, and retention settings. Done means the design and implementation support arbitrary-time workspace restoration without changing the user project’s Git state.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.