Undo for Java AI¶
Undo for Java gives AI agents the runtime context they need to investigate complex problems and answer questions about what your program actually did. The agent replays an Undo recording, a deterministic recording of the program’s execution, through Undo’s time travel debugging capabilities. As a result, the AI agent sees not just the source code, but the values the program produced, the paths it actually took, and the order in which things happened.
An AI agent debugging a recording is not limited to a fixed script. It follows the same strategies a developer would: go to the failure, inspect the state, and execute backwards to the cause. It is equally at home collecting data across a whole recording, for instance sampling stacks to explain where the time went. For work like that, which repeats the same step many times, it writes and runs a single Python script instead of calling the tools one at a time, which is faster and uses far fewer tokens (see Profiling and Analysis). What you can ask AI to do gives a flavour of what you can ask for.
See it in action
How to Debug Java Code with AI (video)
Ways to use it¶
From your AI agent. Undo for Java ships an MCP server, lr4j_mcp_server, that lets an AI agent such as Claude Code, Claude Desktop, or Codex drive the debugger itself. Register it once, and the agent opens recordings as the conversation requires, including several at once. See The MCP Server for setup and a reference of the available tools.
Autonomously, with the bundled agent skill. The distribution includes an agent skill that teaches an AI agent the complete workflow: make a recording, replay it, and debug it to a root cause, without a human driving each step.
From Python. The Python API drives the same debugger from scripts, for batch analysis or use in CI.
The agent skill¶
Added in version 10.0.
$LR4J_HOME/skills/undo-java/ contains an agent skill (in the SKILL.md format used by
Claude Code and compatible agents) covering the end-to-end workflow:
making a recording with the recording agent or with live-record, including controlling when recording starts and stops, skipping application startup, recording long-running services, and attaching to a JVM that is already running;
replaying a recording, including setting up the MCP server if it is not already registered;
debugging recipes that run from a reported failure to a root cause, such as reverse execution from an exception, and using thread fuzzing to provoke concurrency bugs.
With the skill installed, you can ask an AI agent to “record this program and find out why it crashes” and leave it to carry out the whole loop itself.
To use the skill with any AI agent, add a line pointing at it to your project’s instructions file
(CLAUDE.md for Claude Code, AGENTS.md for Codex, or your agent’s equivalent):
For recording and debugging Java with Undo, read
/path/to/lr4j/skills/undo-java/SKILL.md and follow it.
Leave the files where they are rather than copying them into your instructions file, because they
link to one another. The directory also contains an AGENTS.md that leads to SKILL.md, for
agents that look for that name.
Claude Code can also install the skill for every project, with no change to any instructions file:
ln -s $LR4J_HOME/skills/undo-java ~/.claude/skills/undo-java
Your data stays with you¶
Recordings are replayed locally, on your machines. When an AI agent debugs a recording, traffic flows between your machine and the LLM provider that the agent is already configured to use; Undo-hosted servers are not in the loop.
Requirements¶
The MCP server and the Python API need a valid license key file, passed with the --key
option. If you don’t have one, contact Undo Support. The MCP server, lr4j_mcp_server,
also needs a Java 17 or later runtime.