Time Machine

Roll back Claude Code changes to any tool call

·

source at 93fa0f7

·

Apache-2.0 license

Records every tool call in a session as a branching timeline with git snapshots, so you can see which step broke a test, diff steps, and restore files to any point.

What this mod can do

  • Reviewed at commit 93fa0f7
  • Runs programs
  • Runs Claude Code's tools, such as Bash and Edit, which still pass the session's permission check
  • Writes files
  • Reads environment variables
  • Sees each tool call before it runs and can block or change it
  • Also uses $.session.append, which this page doesn't describe yet
5 more things it can do
  • Reads files
  • Remembers data between sessions
  • Adds the /tm-pane command
  • Adds the /tm command
  • Runs on a timer
Good to know (3)
  • Needs git. Snapshots also turn off at your home folder or when the baseline takes over 5 seconds.
  • Restores and branches are dry runs until you add --yes, and only run when you type them yourself.
  • Ignored files like node_modules and .env are never snapshotted or restored; the chat is not rewound.
Are mods safe?

Preview

Terminal

⎿ time-machine: Time Machine pane opened (shown in the terminal and the desktop app). ╭────────────────────────────────────────────────────────────────────────────────────────────────✕─╮ │ Session b8e1c0d2 · branch main · 5 step(s) · 1 snapshot(s), avg 29ms │ │ storage: recording │ │ │ │ │ ├── ⓪ baseline │ │ │ └── snapshot d917d91 · 12 file(s) │ │ ├── ① Bash npm test │ │ │ └── ✗ 1 failed, 2 passed │ │ ├── ② Read src/sum.js │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ⚠ time-machine: tm ⑤ · 1 snaps · 29ms · recording

Claude Desktop

Time Machine in Claude Desktop

What it does

In the author's words

Agent Time Machine: a branching timeline of tool calls with shadow-git snapshots — inspect, diff, explain test failures, restore, branch, compare, re-run

What you see
A timeline pane, a status entry and toasts
Works in
Terminal and Claude Desktop
Slash commands
/tm-pane, /tm
Uses your tokens
No
Changes files
Its own git store; project files on restore with --yes
Network access
Only through programs it runs
Reviewed commit
93fa0f7
Preview recorded with
Claude Code 2.1.309

How it works

  1. Takes a baseline snapshot right before the first tool that can change files
  2. After each Edit, Write or Bash call, commits the files to a separate shadow git repo
  3. Parses pytest, jest, vitest, go, cargo and node:test output for pass and fail counts
  4. Shows the timeline with /tm or in a live pane via /tm-pane, plus a status entry

Common questions

How do I undo file changes Claude Code made several steps ago?

Run /tm restore <n> with the step number from the /tm timeline. Without --yes it only lists the files that would change; with --yes it saves the current state first, then sets the files to that step, and the restore itself can be undone.

How do I find which change broke my tests?

/tm why ranks the files changed since the last passing run of the same test command, scoring mentions in the failure output and file:line locations. The author calls it inference, not proof, so treat the ranking as a clue.

Does it write to my project's .git folder?

No. Snapshots go to a separate bare repository under ~/.claude/time-machine by default, with the git environment pinned so nothing is written to your .git.

How is it different from Claude Code's /rewind?

The README says it does not replace /rewind. It also snapshots files changed by Bash, and adds the step timeline, test failure causes and run comparison. Restoring moves only files and the timeline, never the conversation.

Badge for your README

Own this listing? Add it to your README. The badge shows the install count as it grows.

Reviewed on statuslin.es
[![Reviewed on statuslin.es](https://statuslin.es/badge/mods/time-machine.svg)](https://statuslin.es/mods/time-machine?utm_source=readme-badge)

Or show the preview card:

Preview on statuslin.es
[![Preview on statuslin.es](https://statuslin.es/og/mods/time-machine.png)](https://statuslin.es/mods/time-machine?utm_source=readme-badge)

More like this

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Context Bar in Claude Desktop

Your context window as a stacked bar above the prompt, a color per category, with token counts and the compaction point. /context-bar shows or hides it.

Flightdeck in Claude Desktop

Flightdeck: a live agent dashboard for Claude Code. Main model vitals, an on-call architect, every permission check, subagent cards and swimlanes, a turn receipt and a session log, all from real session events

[✓] Tables, diagrams and charts drawn in the terminal [✓] Copy tables as Markdown, art or HTML (macOS/Linux), and tables, diagrams and charts as a PNG image (macOS/Windows) [ ] Pick a taskStyle in /config: checks, ticks, box or progress [ ] Set listMarker to dash so a list you select with the mouse pastes as markdown [ ⧉ source ] [ ⧉ art ] [ ⧉ source ] [ ⧉ art ] ┌───────┐ ┌───────┐ ┌──────┐ ┌────────┐ Color options per group │ Reply ├──►│ Parse ├──►│ Draw ├──►│ Screen │ └───────┘ └───────┘ └──────┘ └────────┘ 8┤···7·························· 7┤·▄▄▄▄················6········ 6┤·████··············▄▄▄▄······· 5┤·████··············████······· 4┤·████····3·········████······· 3┤·████··▄▄▄▄····2···████····2·· 2┤·████··████··▄▄▄▄··████··▄▄▄▄· 1┤·████··████··████··████··████· 0┼─▀▀▀▀──▀▀▀▀──▀▀▀▀──▀▀▀▀──▀▀▀▀─ text head num code diag ╭──────────────────────────────────────────────────────────────────────────────────────╮ [ ⧉ copy ] │ Caution │ │ Claude Code refuses trees over 20000 nodes. A code block past about 500 highlighted │ │ lines falls back to plain text. │ ╰──────────────────────────────────────────────────────────────────────────────────────╯

Colorful, themeable rendering for Claude Code replies: tables, headings, code, numbers, paths and links.

╭─ CONTEXT ────────────────────────────────────────────╮ │ ████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ├─ STATS ──────────────────────────────────────────────┤ │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ ├─ REPO ───────────────────────────────────────────────┤ │ ◆ Opus 4.8 · main · 16:21 │ ╰──────────────────────────────────────────────────────╯

A boxed multi-line panel with auto-sizing borders: a context section with a gradient bar and status word, a stats section (tokens, cost, duration, lines changed), and a repo section (model, git branch with file counts, clock, vim mode), in a terracotta Claude-brand palette.

Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m

Two-line status with a block context bar and quarter-step dot meters (◔◑◕●) for the 5-hour and weekly limits (fill shows usage, color shows whether you are ahead of or behind pace), plus model, effort, git and cost. Needs no jq.

Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h Fable ● ● ● ● ● ● ● ● ● ○ ○ 85% left Resets in 2d 0h ◐ Read:index.ts ✓ Read×1 ✓ Bash×1 ✓ Edit×1 ✓ Grep×1 ◐ code-reviewer Review the change for regressions

A header with model, context and burn rate per hour, then live tool and agent activity parsed from the session transcript.

Model: Opus 4.8 | Thinking: high | Context: [▰▰▱▱▱▱▱▱▱▱] 45k/200k (22%) | cwd: ~/app | ⎇ main | (+0,-0) Cost: $0.41 | Block: 2hr 6m | Weekly: 7.0% | Session: 10m | In: 916.7 t/s | Out: 29.2 t/s | Cached: 2k | Session: [▰▱▱▱▱] 26.0% Mem: 0.8G/1.0G | (*゚∀゚*) | Session ID: b8e1c0d2-4a6f-4e2a-9c1b-3f5d7a9e2c10

Three lines in One Dark: model, thinking effort and a context bar up top; cost, quota, session clock and token throughput in the middle; weather, free memory and a rotating kaomoji below.