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 24ms │ │ storage: recording │ │ │ │ │ ├── ⓪ baseline │ │ │ └── snapshot 4232bcb · 12 file(s) │ │ ├── ① Bash npm test │ │ │ └── ✗ 1 failed, 2 passed │ │ ├── ② Read src/sum.js │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ⚠ time-machine: tm ⑤ · 1 snaps · 24ms · 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://staging.statuslin.es/badge/mods/time-machine.svg)](https://staging.statuslin.es/mods/time-machine?utm_source=readme-badge)

Or show the preview card:

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

More like this

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.

Flow in Claude Desktop

Ambient scenes above the prompt that move with your agent's work: a fire, bubbles, surf, ski, rockets, a hot-air balloon and more, by day or night. /flow to control it.

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.

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

Feature-rich bash status line with model, context bar, session cost (read live from Claude Code, so it stays correct on any model), rate-limit bars, and live tool/agent activity that adapts to terminal width. Source: github.com/JungHoonGhae/claude-statusline

✧ ███████████▋ 73% 🗝 Ultima Weapon ✦ app ∙ main ♥ ████████████████████████ 100% 「SAVE POINT」 ✶ Limit Form ◉ 41

Claude Code plan-usage HP bar that reads the Claude auth token to show remaining usage.

🤖 Opus 4.8 [200K] │ 🎯 high │ 📁 app │ 🌿 main 📅 07/07/26 Tue │ ⏰ 22:59:15 │ ₿$63k │ ☀️ +90°F Ctx: ● ▓▓░░░░ 33% [66K/200K] │ ⏱ 10m │ 🔧 2.1.155

A three-line bar that mixes coding metrics with ambient real-world data: model, context and git on top; date, time, live weather from wttr.in and the Bitcoin price from Coinbase in the middle; a context bar with real token counts, session cost and Claude Code version below.

Opus 4.8 │ ✍️ 78% │ app (main) │ +128/-34 Cost $0.4100 Tokens in 44.0k │ cache write 5000 │ cache read 2000 │ out 1.4k

Compact status line showing model, context remaining %, directory/git, session time and lines changed, with rate-limit bars or a cost/token breakdown. Source: github.com/susomejias/claude-statusline