ModsCode / Claude Code Mods / Ranking / time-machine
time-machine
Every Claude turn becomes a snapshot: review what changed step by step, undo it, or travel back. Local, zero tokens.
What it does
- Draws a band above the prompt, a pane, the status line, toasts
- Watches Write, Edit, NotebookEdit, Bash calls
- Hooks prompt.submit, session.start, turn.complete, turn.start
- Keeps its own state between turns
- Starts processes
Good points
- No network calls
- Written in TypeScript
- Has a desktop-specific branch
- Handles errors
Code to start from
A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like time-machine by xzwache (pane, band, status, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/xzwache-time-machine/
// Written by ModsCode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Button } = $.ui.resolve(e)
const summary = '…'
const alert = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" gap={2}>
<Text dimColor>
{`⏱ ${summary}`}
</Text>
<Button plain hotkey="1" label="Undo turn" />
<Button plain hotkey="2" label="Review" />
<Button role="dismiss" label="×" />
</Box>
<Box flexDirection="row" gap={2}>
<Text color="yellow">
{`⚠ ${alert}`}
</Text>
<Button plain hotkey="3" label="Undo these" />
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Heat" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Svg, Markdown } = $.ui.resolve(e)
const describe = '…'
const turns = '…'
const since = '…'
const i = '…'
const METRIC_LABELS = '…'
const svgTreemap = '…'
const alt = '…'
const legend = '…'
const value = '…'
const length = '…'
const path = '…'
const notice = '…'
const fileUrl = '…'
return (
<Box flexDirection="column">
<Text bold>
{`project · ${describe}`}
</Text>
<Text dimColor>
{`${turns} Claude turns since ${since} · size: lines changed`}
</Text>
<Box flexDirection="row" gap={1} marginTop={1}>
<Button hotkey={`${i}`} variant="primary" label={`${METRIC_LABELS}`} />
<Button hotkey={`${i}`} variant="primary" label={`${METRIC_LABELS}`} />
<Button hotkey={`${i}`} variant="primary" label={`${METRIC_LABELS}`} />
<Button hotkey="b" label="↑ Up" />
<Button hotkey="o" label="Open in browser" />
</Box>
<Box marginTop={1}>
<Svg source={`${svgTreemap}`} alt={`${alt}`} isInteractive />
</Box>
<Text dimColor>
{legend}
</Text>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row" gap={1}>
<Text>
██
</Text>
<Button plain label={`${value}`} />
</Box>
<Box flexDirection="row" gap={1}>
<Text>
██
</Text>
<Button plain label={`${value}`} />
</Box>
<Box flexDirection="row" gap={1}>
<Text>
██
</Text>
<Button plain label={`${value}`} />
</Box>
<Text dimColor>
{"…and "}
{length}
{" more"}
</Text>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row" gap={1}>
<Text bold>
{path}
</Text>
<Button role="dismiss" label="×" />
</Box>
<Text dimColor>
No closed Claude turn changed it in this window.
</Text>
<Button plain label={`${value}`} />
<Button plain label={`${value}`} />
<Button plain label={`${value}`} />
</Box>
<Text color="yellow">
{notice}
</Text>
<Markdown text={`[Open the interactive map](${fileUrl})`} />
</Box>
)
})
on('session.start', async ($, e, next) => {
const problem = '…'
const took = '…'
await $.ui.status(`⏱ time machine on`)
await $.ui.toast(`⏱ ${problem}`)
await $.ui.toast(`⏱ Snapshot took ${took}s. List big folders in .tmignore or .gitignore to speed it up.`)
return next(e)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
hooks/register.tsx lines 150–162 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const shown = await read($, band)
if (shown === null || e.props.hasSurvey || e.props.isWorking) return next(e)
return bandView($.ui.resolve(e), shown, Math.max(20, e.props.bodyColumns), {
undo: () => void update($, band, now => now && { ...now, confirm: 'turn' as const }),
undoSensitive: () => void update($, band, now => now && { ...now, confirm: 'sensitive' as const }),
confirm: () => void undoFromBand($, shown.id, shown.confirm === 'sensitive'),
cancel: () => void update($, band, now => now && { ...now, confirm: null }),
review: () => void openPane($, shown.id),
close: () => void update($, band, () => null),
})
})src/view.tsx lines 29–69 · Band
export function bandView(table: Table, shown: Band, columns: number, on: BandHandlers): RenderElement {
const { Box, Text, Button } = table
const close = <Button key="tm-close" role="dismiss" label="×" onPress={on.close} />
if (shown.result !== null) {
return (
<Box flexDirection="row" gap={1}>
<Text color="green">{clip(shown.result, columns - 6)}</Text>
{close}
</Box>
)
}
if (shown.confirm === 'turn' || shown.confirm === 'sensitive') {
const question = shown.confirm === 'turn' ? 'Undo this turn?' : `Undo only ${shown.alert ?? 'the flagged files'}?`
return (
<Box flexDirection="row" gap={2}>
<Text bold>{clip(`⏱ ${question}`, Math.max(10, columns - 30))}</Text>
<Button key="tm-yes" plain hotkey="1" label="Yes, undo" onPress={on.confirm} />
<Button key="tm-no" plain hotkey="2" label="No" onPress={on.cancel} />
</Box>
)
}
return (
<Box flexDirection="column">
<Box flexDirection="row" gap={2}>
<Text dimColor>{clip(`⏱ ${shown.summary}`, Math.max(10, columns - 34))}</Text>
<Button key="tm-undo" plain hotkey="1" label="Undo turn" onPress={on.undo} />
<Button key="tm-review" plain hotkey="2" label="Review" onPress={on.review} />
{close}
</Box>
{shown.alert !== null && (
<Box flexDirection="row" gap={2}>
<Text color="yellow">{clip(`⚠ ${shown.alert}`, Math.max(10, columns - 20))}</Text>
<Button key="tm-undo-sensitive" plain hotkey="3" label="Undo these" onPress={on.undoSensitive} />
</Box>
)}
</Box>
)
}hooks/register.tsx lines 164–180 · Pane
on('ui.render', { component: 'Pane', requestId: HEAT_PANE }, async ($, e) => {
const view = await read($, heat)
const table = $.ui.resolve(e)
if (view === null) {
const { Text } = table
return <Text dimColor>Run /tm heat to draw the map.</Text>
}
return heatView(table, e.surface, view, Math.max(30, e.props.bodyColumns), e.viewport?.rows ?? 40, {
metric: metric => void update($, heat, now => now && { ...now, metric }),
enter: node => void heatAction($, () => (node.isDir ? moveHeat($, view, node.path) : pickFile($, view, node))),
up: path => void heatAction($, () => moveHeat($, view, path)),
openPage: () => void heatAction($, () => openHeatPage($, view)),
openTurn: id => void openPane($, id),
closeFile: () => void update($, heat, now => now && { ...now, file: null }),
})
})src/view.tsx lines 190–267 · Pane
export function heatView(
table: Table,
surface: RenderSurface,
view: HeatView,
columns: number,
rows: number,
on: HeatHandlers,
): RenderElement {
const { Box, Text, Button, Markdown } = table
const { nodes, metric, parent } = view
const max = maxValue(nodes, metric)
const since = new Date(view.since).toISOString().slice(0, 10)
const legend =
metric === 'owner'
? 'blue: others · grey: both · orange: Claude'
: `${METRIC_LABELS[metric]}: dark none → yellow most`
return (
<Box flexDirection="column">
<Text bold>{clip(`${view.path === '' ? 'project' : `${view.path}/`} · ${describe(view.total)}`, columns)}</Text>
<Text dimColor>{clip(`${view.turns} Claude turns since ${since} · size: lines changed`, columns)}</Text>
<Box flexDirection="row" gap={1} marginTop={1}>
{METRICS.map((one, i) => (
<Button
key={`m-${one}`}
hotkey={String(i + 1)}
variant={one === metric ? 'primary' : undefined}
label={METRIC_LABELS[one]}
onPress={() => on.metric(one)}
/>
))}
{parent !== null && <Button key="up" hotkey="b" label="↑ Up" onPress={() => on.up(parent)} />}
<Button key="open" hotkey="o" label="Open in browser" onPress={on.openPage} />
</Box>
<Box marginTop={1}>
{mapView(table, surface, nodes, metric, columns, Math.max(6, Math.min(MAP_ROWS, rows - LISTED - 10)))}
</Box>
<Text dimColor>{clip(legend, columns)}</Text>
<Box flexDirection="column" marginTop={1}>
{nodes.slice(0, LISTED).map((node, i) => {
const name = `${node.isDir ? '▸' : ' '} ${node.name}${node.isDir ? '/' : ''}`
const shown = metric === 'churn' ? '' : `${valueLabel(node, metric, METRIC_UNITS)} · `
return (
<Box key={`row-${i}`} flexDirection="row" gap={1}>
<Text color={hex(heatColor(intensity(node, metric, max), metric))}>██</Text>
<Button
key={`n-${i}`}
plain
label={clip(`${name} ${shown}${describe(node)}`, Math.max(10, columns - 4))}
onPress={() => on.enter(node)}
/>
</Box>
)
})}
{nodes.length > LISTED && <Text dimColor>…and {nodes.length - LISTED} more</Text>}
</Box>
{view.file !== null && (
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="row" gap={1}>
<Text bold>{clip(view.file.path, columns - 4)}</Text>
<Button key="file-close" role="dismiss" label="×" onPress={on.closeFile} />
</Box>
{view.file.turns.length === 0 && <Text dimColor>No closed Claude turn changed it in this window.</Text>}
{view.file.turns.map((turn, i) => (
<Button
key={`t-${i}`}
plain
label={clip(`↳ ${clock(turn.time)} ${turn.title}`, columns)}
onPress={() => on.openTurn(turn.id)}
/>
))}
</Box>
)}
{view.notice !== '' && <Text color="yellow">{clip(view.notice, columns * 2)}</Text>}
{view.page !== null && <Markdown text={`[Open the interactive map](${fileUrl(view.page)})`} />}
</Box>
)
}src/view.tsx lines 269–287 · Pane
function mapView(
table: Table,
surface: RenderSurface,
nodes: readonly HeatNode[],
metric: HeatMetric,
columns: number,
rows: number,
): RenderElement {
// The element table answers `in` for every name; the surface says what it draws.
if (surface === 'terminal' && 'Raster' in table) {
const width = Math.min(512, Math.max(10, columns))
const { Raster } = table
return <Raster key="heat-map" columns={width} rows={rows} cells={rasterCells(nodes, metric, width, rows)} />
}
if (!('Svg' in table)) throw new Error(`No treemap element on ${surface}`)
const { Svg } = table
const alt = `Treemap of ${nodes.length} entries by ${METRIC_LABELS[metric]}`
return <Svg source={svgTreemap(nodes, metric, 720, 360)} alt={alt} isInteractive />
}Licence text (MIT)
MIT License Copyright (c) 2026 xzwache Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
How to build this: Pane (panel), Deny a tool call
What its code calls
runs programswrites filesenv varstool callsremembers
What its code shows
Read from the source at commit d4d0d9c42436. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.22 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).hooks/register.tsx:298 uname (not on Windows) |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.hooks/register.tsx:204 a program named at run time; hooks/register.tsx:300 a program named at run time |
| Reads and sends | Whether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, files and reaches the network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets ModsCode show its code; otherwise the code is linked.MIT |
| Settings hooks | Hooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone |
| Servers it ships | MCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/ |
| Skills, commands, agents | What its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows |
| Tools and MCP | Whether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command |
| Asks of the model | Completions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command ? |
| Events it hooks | By what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: prompt.submit, tool.call (Write, Edit, NotebookEdit (+1)), command.run · also: session.start, turn.start, turn.complete, ui.render (AbovePrompt, Pane) |
| Reads, by name | The environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: HOME; files: a path computed at run time |
| Writes, by name | The files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.files: a path computed at run time; the clipboard |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and ModsCode does not vouch for what this code does. Read its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
From its marketplace
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add xzwache/claude-time-machine/plugin install time-machine@claude-time-machine/reload-pluginsThis installs the marketplace's latest commit, which may not be the one read here (d4d0d9c42436). Compare them before you install. /reload-plugins loads it into a session that is already open.
Try the commit ModsCode read
No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:
git clone https://github.com/xzwache/claude-time-machinegit -C claude-time-machine checkout d4d0d9c424369477cf782327dd092bfe35b30687claude plugin validate claude-time-machineclaude --plugin-dir claude-time-machineThe validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.
Ask Claude about it
With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:
Read the ModsCode mod "xzwache-time-machine" with its code and make me one like itSearch them from Claude: the MCP connector
Similar mods
- streamsMacleod Labs★ 2
- aitoolsMichael Shepanski★ 0
- session-boardIlia★ 0
- explain-asSumit Paul★ 20
- agent-discoverkeshrath★ 7
- spending-effort-with-jevYaxin Luo★ 6
Badge for your README
If this is your mod, paste this into your README. It links to this page.
[](https://modscode.com/claude-mods/mods/xzwache-time-machine/)