带工作区文件快照、Markdown 记录板与卡片记录的对话地图:分支、回溯、文件恢复与记录板一起回退。
安装
# npm 包(预构建)
dsh plugin --profile web add dsh-timeback
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:ppmchen/dsh-timeback
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
A DeepSeek Harness plugin that combines two things the built-in UI keeps apart:
- A conversation tree — branch a conversation at any completed turn; the old history stays intact.
- Workspace snapshots tied to the conversation — after you enable recording for a workspace, every turn records the state of the work tree, so a rewind also restores the files the agent had at that point.
- A Markdown notes board — cards carry free-text (Markdown) notes, and a global notes page holds analysis/decisions from the user or the session; a rewind restores the board to the state it had at that checkpoint.
Recording is opt-in per workspace and off by default. The switch is a workspace-level flag stored against the workspace directory: enabling a directory covers the Sessions in it and its subdirectories (a nested workspace inherits it, so a rewind never misses files). A subdirectory can be turned off individually: unchecking it stores an override and it stays off even while the parent keeps recording; the panel lists such opt-outs with a “restore inherited” button. This keeps unrelated workspaces (a home directory, a dataset folder) untouched.
You can set it in three workspace-level places:
- Workspace menu — the Workspace's “⋯” / right-click menu has “时间回溯:开启/关闭此工作区记录”.
- New Session row — right after “Add workspace…” creates a Workspace and opens its blank Session, a “时间回溯记录” checkbox appears in that row (next to the Workspace/preset controls), so the flag can be chosen at creation time.
- Timeback panel — the “记录此工作区并保存文件快照” switch (same flag).
DSH's “Add workspace…” directory chooser is a single-slot dialog supplied by the directory-picker package; a third-party plugin cannot add a field inside it without replacing that picker, so the checkbox appears in the same creation flow immediately after the Workspace exists, and in the Workspace's own menu for later changes.
The result: when the agent does something wrong, go back to the turn before the mistake, get the files back, and continue in a branch that only carries the conversation up to that turn. Wrong turns stay on the old branch, out of context.
before a mistake rewind from the Timeback panel
┌──────────────────────────────────────────┐
conversation: A ─ B ─ C ─ D │ A ─ B ─ C ─ D (old branch, kept) │
files: s0 s1 s2 s3 │ └─ C′ (new branch, context A─C)│
│ files restored to s2 │
└──────────────────────────────────────────┘
Where it appears
- Notes board — its own right-sidebar tab (open it from the Timeback panel
header or the sidebar guide): a global Markdown board for hand-written notes
and for notes written by the session through
timeback_note. - Card notes — every canvas card has a 📝 button; the Markdown note shows on the card and in the detail pane.
- Workspace menu / New Session row: the workspace-level recording switch (see above).
- Right sidebar → timeback tab: the same recording switch, plus a card-based conversation map: every turn is a card, cards of one branch run left-to-right in their own coloured lane, forked branches start from the fork turn with cubic connectors, and the current root→Session path is highlighted. Drag empty space to pan, wheel or toolbar buttons to zoom, 适应 fits the map to the viewport; click a card to open its checkpoint detail (before/after snapshots, changed-file counts, “回到这里 / 仅恢复文件 / 仅分支”) below the map. Double-click a card or its lane name to jump back to that conversation, drag cards anywhere to arrange them (the canvas grows; near a border the view pans gently — time-based and depth-damped, at most ~55 px/s — so a card can be dropped far outside the current view without flying off; branch names live inside the cards; positions are remembered per branch family, 复位 restores the automatic layout; ⤢ expands the canvas height). Every branchable card has ⑂ 分支 (fork at the checkpoint without touching files) and ✕ 删后续 (delete everything after the node, see below). A Tree / List toggle keeps the flat list view for long histories.
- Three ways in: the composer row pill “⏱ 时间回溯”, the clock button in the conversation header, and the guide entry in the right sidebar. All three open the panel; the panel's first card is the per-workspace 全选 switch and the folder/file selection tree for that workspace.
- Model tools:
timeback_tree,timeback_checkpoint,timeback_rewind, so the agent can inspect its own checkpoints and self-correct when asked. - The map is a pannable/zoomable canvas of cards: a lane per branch Session, one
card per turn (
T1,T2, …) or branch-start marker, cubic connectors along a branch and from the fork turn to the child branch, per-lane colours, and current-path highlight. Manual checkpoints are folded into their turn card (shown in the detail panel). Cards can be dragged (positions persist in the browser per root Session) and double-clicked to return to their conversation. Histories longer than 120 turns are truncated in the map and point at the List view. The interaction model is inspired by the community conversation-map plugins (see ACKNOWLEDGEMENTS); the implementation is original and depends on no third-party canvas/layout library. - Panel behavior: after a rewind the panel shows a “打开新分支” / “Open new branch” button (it does not switch the view by itself), and a “用安全快照恢复” / “Restore the safety snapshot” button that undoes the restore.
Install
Pick the profile you actually use (web for dsh web/browser, desktop for the
desktop app):
# From npm (published: https://www.npmjs.com/package/dsh-timeback)
dsh plugin --profile web add dsh-timeback
dsh plugin --profile web add dsh-timeback@0.7.3 # pin a release
# Straight from GitHub (no npm release needed)
dsh plugin --profile web add github:<owner>/dsh-timeback
dsh plugin --profile web add github:<owner>/dsh-timeback#v0.5.9
# From a local checkout or a packed tarball
dsh plugin --profile web add /path/to/timeback
npm pack && dsh plugin --profile web add ./dsh-timeback-0.5.9.tgz
Or in the Web GUI: Plugins → Add plugin → local directory. After installation
restart dsh web (or the desktop app), hard-refresh the page, and open a new
session: the Host plugin row is timeback, and the panel build marker should
match package.json (e.g. 0.5.10+hero). Recording is off by default — enable
it for a workspace first.
Publishing this repository (GitHub → npm → plugin market) is documented step by step in docs/PUBLISHING.md; the self-hosted index, awesome catalog PR and community directory steps are in docs/MARKET.md. License and marketplace-index details are in docs/LICENSES-AND-PUBLISHING.md.
Delete after a node (prune)
Every branchable card has a danger ✕ 删后续 action; after a normal rewind the result banner also offers 删除旧会话之后的记录. Both perform the same transaction:
- fork a new branch at the selected checkpoint (and restore its file snapshot, unless branch-only was requested);
- archive the old session, plus every branch that was forked after that checkpoint and all of their descendants;
- hide archived sessions from the map.
DSH session logs are append-only, so a conversation cannot be physically truncated. “Delete after” is therefore truncation-by-branch plus archival; the archived sessions stay recoverable from the DSH sidebar archive list (unarchive one and it can appear in the map again). The map reads the workspace archive set, so archiving or unarchiving a session through DSH is reflected immediately.
How a rewind works
- At every turn boundary in an enabled workspace the Host records a checkpoint: the inclusive Session event sequence (the conversation position) plus a complete snapshot of the work tree. Before-turn and after-turn snapshots are both kept.
- Rewind asks the Session controller to fork the conversation at the checkpoint's sequence — an append-only log is never rewritten, so the old branch remains — and then restores the work tree from the checkpoint's snapshot. Restore rewrites only differing paths, restores deleted files and modes, recreates symlinks, and (by default) deletes files created after that point.
- Before touching any file it records a safety snapshot, so the rewind itself can be undone.
- Branching only (
branch-only) and file-only restore (files-only) are also available. - Each checkpoint also stores the notes-board version it saw, and a rewind restores that Markdown state too (the old board versions stay in history).
The enabled-workspace list and checkpoints are stored in a JSON registry under
<DSH_HOME>/timeback/. Snapshots are stored in a private git object store per
workspace under <DSH_HOME>/timeback/repos/<hash>/. The workspace's own .git directory, index,
commits and refs are never read or written. node_modules/, virtualenvs and
caches are excluded by default (configurable), keeping snapshots small and fast.
Notes board (记录板 · sticky notes)
The board is a sticky-note canvas with a graph-paper background:
- Movable sticky notes — every Markdown note is a card you can drag around the grid; positions and colours are remembered per board.
- Drawing tools — pen with an adjustable size slider (1–8 px), eraser, a dedicated colour box (native picker, R/G/B sliders, HEX field, common colours and a recent list that only records colours you actually drew with — dragging the RGB sliders does not pollute it — plus an EyeDropper screen sampler where supported; the button always responds and explains when the browser cannot sample the screen, with the HEX/system picker as fallback) and one grouped 常用图形 dropdown (rectangle, ellipse, line, arrow, triangle; hold Ctrl/Shift while dragging to constrain: rectangles/ellipses become square/circular, lines/arrows snap to 45° directions, including diagonals). A “便签可画” switch decides whether the pen/shape tools may draw on sticky notes or only on the grid. Drawings are stored with the board and roll back with a rewind just like the Markdown entries. Pen strokes and shapes can cross the sticky boundary (start on the grid and continue onto a note, or the reverse). A pen stroke is split at the crossing point with no gap, and a shape is drawn on both the grid and every sticky it crossed (each layer clips its own copy). With the Move tool, dragging empty grid pans the canvas; on open the view auto-fits every note and stroke (zoom + scroll) and the 自动调整 button recomputes that fit whenever the board grows. Manual zoom is available with the toolbar − / % / + buttons (the percentage resets to 100%) or Ctrl/⌘ + mouse wheel / trackpad pinch, anchored at the pointer. Stickies drag under the cursor and have a bottom-right resize handle (sizes are saved with the board). The canvas is a 4000×3000 grid that scrolls with the content. 打开 md opens a large Markdown reader overlay.
- New sticky — the “新建便签” button opens the centred Markdown editor (resizable dialog); saving creates a note and places a sticky card.
- Session notes are hyperlink stickies — when the model writes a note through
timeback_note, it is created as a Markdown file and appears on the board as a compact 🔗 link sticky; clicking it reveals the note. - Graph links (路径) — every sticky has four anchor points (top/right/bottom/ left). Pick the 🔗 路径 tool, drag from one anchor to another sticky and the two notes become connected by a curved path; the same anchor pair always renders the same curve in both directions (A→B and B→A overlap exactly). Links are stored as board edges, roll back with rewinds, and can be deleted by clicking them (or with 清路径).
- Markdown below the canvas — the bottom pane always shows the current board contents fully rendered with larger typography (H1 24px, H2 21px, body 14.5px, code 13px…), with edit/delete/open actions, so the Markdown documents stay readable even when the canvas is full.
- WYSIWYG Markdown editor (SiYuan-inspired) — creating/editing a sticky opens
a rich editing area where you type directly into the formatted document.
Select 你好, press B, and it becomes bold immediately; the document is
serialized back to Markdown as you type. Toolbar: H1–H3, bold/italic/strike,
inline code, code block, bullet/numbered/task lists, quote, link, divider and
text colour (common palette + custom picker, stored as safe
<span style="color:#rrggbb">…</span>Markdown). Tabs switch between 富文本 / 源码 / 预览; the preview is one continuous document with no block separators or line labels. Card notes (📝) use the same editor.
Every board change (notes, layout, drawings) is a numbered board revision and is
captured by checkpoints: rewinding restores the sticky layout and drawings at that
point together with the conversation and files. History lives under
<DSH_HOME>/timeback/notes-history/.
Using it
- Enable recording for the workspace: tick the “时间回溯记录” checkbox when the new Workspace's Session opens, use the Workspace's “⋯” menu, or tick 记录此工作区并保存文件快照 in the Timeback panel. Only enabled workspaces record; switching it off stops every Session in that workspace while keeping existing checkpoints rewindable.
- Work normally; each following turn in that workspace adds a checkpoint row.
- Notice a mistake.
- Find the turn before the mistake → 回到这里 (rewind): a new branch is created, the files are restored, and the panel offers 打开新分支 to switch to it.
- Continue in the new branch. The old branch is still listed in the tree for comparison.
- Need to save a known-good point in the middle of a turn? 手动检查点
(
timeback_checkpoint). In the defaultcapture: workspacemode this also requires the workspace switch to be on; with the plugin configured ascapture: offit stays available as an explicit action.
Configuration
Set fields in the bundle row's config (profile cordis.patch.yml override):
| Field | Default | Meaning |
|---|---|---|
dataDir |
<DSH_HOME>/timeback |
Snapshot repositories and the checkpoint registry |
capture |
workspace |
workspace: only workspaces enabled from the panel record; all: every workspace records automatically; off: no automatic recording (manual checkpoints still work) |
exclude |
dependency/cache directories | Extra gitignore-style patterns kept out of snapshots |
timeoutMs |
30000 |
Deadline for one git command |
maxCheckpoints |
400 |
Retained checkpoints per Session (oldest are forgotten) |
restoreDeletesExtra |
true |
Delete files created after the target checkpoint on restore |
maxFiles |
20000 |
Refuse snapshots of a workspace with more files (first-snapshot guard) |
probeTimeoutMs |
8000 |
Deadline for that size probe |
routePath |
/timeback |
HTTP mount path for the panel API |
The data directory resolves to <DSH_HOME>/timeback when DSH_HOME is set,
otherwise to the directory beside the profile's profiles/ folder (so
recreating a profile from a template does not orphan snapshots). Registry files
are 0600 inside a 0700 directory.
Huge workspaces
Before the first snapshot of an enabled workspace, timeback runs
git add --dry-run to count what would be stored. More than maxFiles files (or a probe that cannot
finish in probeTimeoutMs) blocks snapshots for that workspace for the life of
the Host process, with the reason shown in the panel. This is what stops a
session whose working directory is your home directory from snapshotting
gigabytes by accident. Raise maxFiles, add exclude patterns, or change the
Session's working directory, then reload the plugin (config changes remount it).
Model tools
| Tool | Purpose |
|---|---|
timeback_tree |
List the current Session's branch tree and checkpoints, plus whether the workspace is enabled for recording (ids, turns, changed-file counts, snapshot availability) |
timeback_checkpoint |
Create a manual checkpoint (conversation position + workspace snapshot). In capture: workspace mode this requires the workspace to be enabled; with capture: off it stays available as an explicit action |
timeback_rewind |
Rewind: branch-and-files (default), branch-only, or files-only |
timeback_workspace |
list / enable / disable the recording switch for one workspace (or the current one). It is a user-only privacy decision: the agent may only change it after an explicit request |
timeback_note |
Read/write the global Markdown notes board (list, create, update, delete); rewinds restore the board with the conversation |
Limitations
- The recording flag is stored against the workspace directory path, not a DSH Workspace id: deleting a Workspace keeps its directory flag, renaming or moving a directory requires enabling the new path, and a Session whose working directory leaves the enabled tree stops recording.
- Automatic recording is off until enabled per workspace. The model cannot enable a workspace (it is a user-only privacy decision); it can only report that recording is off.
- Snapshots are per turn, not per tool call. A rewind inside a turn restores the turn's boundary state.
- Sessions that were never captured (created before installation, in a workspace
that was never enabled, or with
capture: off) have conversation positions but no file snapshots; they can still be branched if a checkpoint exists. - Branches made by other tools (the built-in chat branch action, other plugins) are ordinary Sessions without a timeback parent edge, so the tree lists them as separate roots until a timeback rewind creates the relation.
- Restoring deletes files created after the checkpoint by default. Files matching the exclude patterns are never snapshotted, so they are not restored either.
- Snapshot data grows with the number of turns and changed files; git
content-addressing deduplicates unchanged content. Old checkpoints are dropped
from the registry at
maxCheckpoints, but git objects are not garbage-collected by this version. - Only top-level Sessions are recorded; subagent Sessions are skipped.
- A rewind while a turn is running is refused. A rewind does not stop shells or jobs the old branch started.
- Restore writes files directly through the Host (not through the agent's sandbox/approval path); treat the panel as a trusted owner action.
- Restore never deletes untracked or ignored content to make room: a non-empty directory blocking a restored file is reported as a failed path instead. Nested repositories appear as gitlinks and are left untouched.
.gitattributestext/eol conversions can make a restored file differ from the bytes captured when the attribute forces conversion; binary files are exact.- Snapshot directories are
0700, but a snapshot can still contain secrets that were inside the workspace; exclude such paths if the profile is shared. - Two Host processes sharing one
dataDirare not coordinated; run one Host per data directory.
Verification status
- Host + client tests (49 cases,
npm test) cover snapshot/restore semantics (add/edit/delete/symlink/mode, delete-extra policy, nested repositories, file↔directory collisions, refusal to delete untracked content blocking a restore, excludes, missing trees), registry persistence/trimming, and a Host-plugin integration run that mountsapply()on a fake context and drives real turn events, HTTP routes, model tools, file restores and branch registration, and the opt-in workspace flow (nothing recorded before the switch is ticked, checkpoints start after enabling, disabling stops new checkpoints while keeping old ones), the Markdown notes board (versioned store, card notes, checkpoint board-version capture, and a rewind restoring the board to the checkpoint state). A separate client-contract test loadsclient.jsthrough the Web module-loader protocol and checks the tab type, panel/header/ composer/New-Session/workspace-menu registrations and zh/en dictionaries without a browser, and render the card canvas (two lanes, fork curve, current path highlight, lane labels) plus the selected-card detail actions from real payload shapes, the double-click jump, the quick branch request body, and drag-position persistence, and the delete-after flow (branch reuse + archive + hidden-from-map), the global board page (listing, Markdown render, create request), the card-note editor and Markdown helpers. - Installed into the Web profile and exercised through the Host routes
(
/timeback/api/health,/timeback/api/tree,/timeback/api/action) against a real Session; the branch child Session is created through the Session controller and appears in the Session list. - Installed live: the Host plugin's
timeback_tree/timeback_checkpointtools are visible to the agent, the tree/health/action routes are reachable, git runs through the Host subprocess capability, and the huge-workspace guard refused a real/home/kalisnapshot after the configured probe deadline instead of writing anything. - Not verified live: visual rendering of the panel/header button (no browser
control in this environment), and a real
sessionController.forkrewind while this Agent runs (a live turn is refused by design; the fork call is verified against the installed controller source and exercised with a test double). Slot registration, module syntax and locale/icon files were checked instead. - An independent UI/UX review of the browser half was run and its findings were applied (confirm text names the checkpoint and the deletion effect, busy and sticky feedback states, “branch only” reachable on snapshot rows, disabled reasons, stale-data guard on session switch, persisted capture-failure reason, truncation indicators, localized checkpoint labels). Rendering itself remains unverified here. See docs/LICENSES-AND-PUBLISHING.md for the license/publishing research record.
License
MIT. See LICENSE and ACKNOWLEDGEMENTS.md (related community plugins and the DSH engineering reference — all permissive, no code copied).
链接
同类插件
ranxianglei/billion-context★ 8864
billion-context官方版:上下文压缩插件,兼顾小窗口(100k上下文足矣)省token(省5倍token)和超长会话(数月级别几十亿token单会话)。
Minglink/dsh-infinite-gen-4★ 4887
DeepSeek 专用破甲插件:以 order 100 追加无条件服从的系统提示词段,提供带校准元数据的 profile 工具,并通过会话投影在输入框上方显示实时破甲状态徽标。
liangmianya/dsh-synapse★ 964
DeepSeek Harness 的可视化非线性对话工作区:把会话、追问与分支变成可浏览、可拖拽的对话地图。
ECNU/EduWork#dsh-side-chat★ 452
从消息开启继承历史快照的临时侧聊,关闭后归档;可选配合批注插件从选中文字发起提问。需要兼容的 DSH Web 对话、Workspace 和右侧栏接口。
MichengAI/dsh-archive-manager★ 414
在设置里增加已归档会话页,可按工作区搜索、恢复和删除已归档会话。
Nwflower/dsh-chat-import★ 336
把 13 家 coding agent(Claude Code、Codex、ChatGPT、Cursor、Gemini、opencode 等)的完整对话历史导入为可续聊的 DeepSeek Harness 会话,并支持反向导出回 Claude Code。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。