modscode / Gallery / 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
Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.
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/gallery/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.
What its code calls
runs programswrites filesenv varstool callsremembers
The design, read from code
Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.
What its code shows
Read from the source at commit f2c144e6abc5 on 2026-10-06. 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 files or environment variables and reaches the network.reads environment variables and 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 |
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 the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
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-machineThis installs the marketplace's latest commit, which may not be the one read here (f2c144e6abc5). Compare them before you install.
Ask Claude about it
With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:
Read the modscode design "xzwache-time-machine" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Notes⚠ A team of Never uses your Claude usage much faster.Showing:buildbuildbuildHide completed:buildbuildbuildSet team size:DefaultDefaultDefaultSet model:NotesNotesNotesWorkflowYour next prompt can hand work to Never Notes helpers.● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m
-
Ask Claude…доска: обновляю карту…Доска сессииK ИтогK ИтогK ИтогAnswer↻ обновитьдля Claude заметок: 3. Уйдут с твоим следующим сообщением.• 3• 3• 3
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxAsk Claude…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoAsk Claude…
-
Ask Claude…superpowersϟ Arc tokens showing buildNot now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)d darkl lightz daltonizeda ansiu auto
-
Ask Claude…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel