Your AI agent is confident. It points to line 42 of PaymentService.java
. "There's your null pointer exception."
You check. Line 42 is a comment. The code was refactored 14 commits ago.
The production crash happened 3 hours ago. Your agent just spent 45 minutes debugging ghosts.
Every AI coding agent today β Claude Code, Cursor, Copilot, Cody, you name it β operates on the same assumption:
The code that matters is atHEAD
.
But production bugs don't live at HEAD
. They live in the commit that was running when the crash happened. That commit is buried under hotfixes, refactors, dependency updates, and feature merges that landed after the incident.
HEAD (now) β Agent analyzes THIS
β
ββ feat: add new payment provider
ββ refactor: extract UserService
ββ fix: handle edge case in checkout
ββ chore: update dependencies
β
βΌ
a1b2c3d (3 hours ago) β Bug ACTUALLY lives HERE
Your agent confidently finds bugs in code that didn't exist when the crash occurred.
We don't need a time machine. Git has had one for years: ** git worktree**.
git log --before="3 hours ago" -1 --format="%H"
git worktree add /tmp/debug-a1b2c3d a1b2c3d
cat /tmp/debug-a1b2c3d/src/PaymentService.java
git worktree remove --force /tmp/debug-a1b2c3d
This gives you:
Agents already know git log
, git show
, git diff
, cat
, grep
. They can analyze code perfectly.
What they struggle with:
So I built temporal-debug-skill β a portable skill definition that teaches any agent to handle exactly those two gaps.
Think of it as a prompt template with superpowers. It's a Markdown file that tells an agent:
"When you detect X context, here are the exact git commands to run, in this order, with this cleanup guarantee."
No Python. No Node. No installation. Just instructions the agent follows.
## Activation
Trigger when user message contains temporal anchors:
- "3 hours ago", "last night", "yesterday"
- "v2.4.1", "tag:release-42"
- "the deploy before...", "commit before..."
## Workflow
1. RESOLVE: `git log --before="<time>" -1 --format="%H"` β commit SHA
2. SNAPSHOT: `git worktree add /tmp/temporal-debug-<sha> <sha>`
3. ANALYZE: Read files from worktree, trace the bug
4. CLEANUP: `git worktree remove --force /tmp/temporal-debug-<sha>`
5. REPORT: Root cause + historical commit reference + introducing commit
You:"Crash from 3 hours ago:NullPointerException in PaymentService.java:42
"
Agent (with skill):
git log --before="3 hours ago" -1 --format="%H"
βa1b2c3d
git worktree add /tmp/temporal-debug-a1b2c3d a1b2c3d
- Reads
PaymentService.java:42
from worktree βuser.getEmail()
without null checkgit worktree remove --force /tmp/temporal-debug-a1b2c3d
Reports:"In commita1b2c3d
(3 hrs ago),PaymentService.java:42
accessesuser.getEmail()
without null check.user
is null for guest checkouts. Introduced inf8e9d0a
."
You:"Users on v2.4.1 report auth failures"(attaches error log)
Agent:Resolves tagv2.4.1
β worktree β finds regex bug in auth middleware skipping validation for/health-records
β reports fix already in v2.4.2
You:"This endpoint 200'd last week, now 500s. Changelog shows nothing."
Agent:Resolves "last week" β createstwo worktrees(last week + HEAD) β diffs relevant modules β finds pool size config regression from 50 β 10
git clone https://github.com/MeherBhaskar/temporal-debug-skill.git skills/temporal-debug-skill
That's it. The skill auto-activates when temporal context is detected.
cp -r temporal-debug-skill/skills/temporal-debug/ /path/to/your/agent/skills/
| β Skill Does | β Skill Doesn't |
|---|---|
| Detects temporal context automatically | Require a CLI tool invocation |
| Resolves fuzzy time β exact commits | Need external scripts/binaries |
Creates isolated git worktree snapshots |
|
| Touch your working directory | |
| Guarantees cleanup (even on error) | Require Python/Node/Go runtime |
| Works in ANY git repo, ANY language | Analyze code for you (you're better at that) |
The skill is additive. It teaches the agent one new trick (time-travel via worktree). Everything else β reading files, tracing logic, suggesting fixes β the agent already does.
Since adding this to my workflow:
| Before | After |
|---|---|
| 45 min debugging wrong version | 30 sec to historical root cause |
"Which commit broke this?" β git bisect manual |
|
Agent tells you: "Introduced in f8e9d0a " |
|
| Context-switching to check historical code | Stay in conversation, agent brings history to you |
git clone https://github.com/MeherBhaskar/temporal-debug-skill.git
Repo: https://github.com/MeherBhaskar/temporal-debug-skill
License: MIT β use it, fork it, ship it.
Have you hit the "agent debugging wrong version" problem?
What temporal anchors do you use most β "3 hours ago", version tags, "last deploy"?
Building agent tools?
The skill pattern (Markdown instructions β agent executes shell) is surprisingly powerful for bridging agent capabilities. Happy to discuss the architecture.
Stop debugging ghosts. Start debugging history. βͺ