Time travel debugging
Skill Amey-Thakur/AI-SKILLS/skills/debugging/time-travel-debugging
Plug-and-play skills and prompts for every AI coding agent
npx -y skills add Amey-Thakur/AI-SKILLS --skill time-travel-debuggingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 20 days oldThe repository was created 20 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Record an execution once and replay it deterministically so you can step backward to the moment a value went wrong. Use when a bug is hard to reproduce or the failure surfaces long after its cause, and rerunning changes the outcome.
SKILL.md
3.2 KB, 673 tokens by cl100k_base, as published. Nobody here has run it
Time-travel debugging
The hardest bugs are the ones where the crash is far downstream of the cause: a field is corrupted at step three and blows up at step three hundred. A live debugger can only step forward, so you rerun and hope to catch it. Recording the run once and replaying it lets you set a breakpoint on the corruption and run the clock backward to who wrote it.
Method
- Record the failing run so replay is bit-for-bit identical.
rr record ./appcaptures every non-deterministic input, thread schedule, syscall result, signal, sorr replayreproduces the exact same execution every time. The intermittent bug becomes a fixed recording you can study without fear of it not happening again. - Set a watchpoint on the corrupted value, then reverse. Once replay
stops at the symptom,
watch -l corrupted_fieldandreverse-continueruns backward until the last write to that address. This is the move a forward debugger cannot make: you jump straight to the writer instead of guessing which of three hundred steps did it. - Bisect the timeline, not the code. A deterministic recording has
stable event numbers. When you know the value is good at one point and bad
at another,
reverse-continueandcontinuebetween them narrow the write to a single instruction the waygit bisectnarrows a commit. - For front-end state, replay through the action log. Redux DevTools records every dispatched action and lets you step through them, jump to any past state, and see the diff each action produced. The corrupted store is traced to the exact action and reducer, and "time-travel" replays the sequence without clicking through the UI again.
- Pin down non-determinism the recorder cannot capture.
rrserializes threads, but true external sources, wall-clock time, random seeds, network responses, still vary unless you stub them. Seed the RNG, inject a fixed clock, and record with those pinned so the replay is genuinely reproducible and not merely usually so. - Confirm the cause by editing and re-recording, not by editing replay. A replay is read-only history: you cannot fix it in place. Change the source, record a fresh run, and verify the write no longer corrupts the value. Reasoning that never leaves the old recording proves nothing about the fix.
Litmus tests
- Does replay reproduce the failure on every run, not just sometimes?
- Did reverse execution land you on the instruction that wrote the bad value?
- Is every non-deterministic input either captured by the recorder or stubbed?
Boundaries
Recording adds overhead and, for rr, needs specific hardware performance
counters, so it does not run everywhere or under heavy production load. It
shines on single-machine, CPU-bound bugs; a fault that only appears across
distributed services belongs to tracing, which follows one request across
hosts rather than replaying one process.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.