File History
TatsuCode tracks every file edit during your session, allowing you to undo changes, view history, and revert to any previous state.
How It Works
Every time TatsuCode edits a file, it saves a snapshot of the content before the change. This creates a complete history that you can navigate at any time.
Original file
↓ Edit 1 (snapshot saved)
State after edit 1
↓ Edit 2 (snapshot saved)
State after edit 2
↓ Edit 3 (snapshot saved)
Current state
You can revert to any snapshot or the original state.

Undoing Changes
Undo Last Edit
> Undo the last edit to main.py
TatsuCode reverts the file to its state before the most recent edit.
Undo Multiple Edits
> Undo the last 3 edits to config.json
Or revert to the original state:
> Revert auth.ts to its original state
Undo by Confirmation
After edits, you can ask:
> Actually, undo that change
> Revert what you just did
Undo a Find & Replace Batch
A change made across many files with Find & Replace can be undone in one step:
> Undo that rename
Each file in the batch can still be undone on its own, too.
Viewing History
File Edit History
See all edits made to a specific file:
> Show the edit history for utils.js
Output shows:
- Edit number
- Timestamp
- Line number affected (if applicable)
- Summary of change
Session Summary
See all files edited this session:
> What files have I edited this session?
> Show me a summary of all changes
Output includes:
- File paths
- Number of edits per file
- Line change statistics
Searching History
Find specific changes across all history:
> Search my edit history for "TODO"
> Find where I changed the database URL
This searches through all saved snapshots for matching content.
Practical Examples
Experimenting Safely
Try changes knowing you can always revert:
> Refactor this function to use async/await
> Hmm, that doesn't work with the existing code. Undo that.
Comparing Approaches
> Implement approach A
> Take note of the result
> Undo and implement approach B
> Which is better?
Recovering from Mistakes
> Oh no, that edit broke everything. Undo all changes to auth.ts
Reviewing What Changed
> What did we change in this session?
> Show me the history of changes to the API routes
How Revert Works
When you revert:
- TatsuCode finds the specified snapshot
- Restores the file to that content
- The revert itself is recorded in history
This means you can even "undo an undo" if needed.
Your Files Keep Their Format
Every edit TatsuCode makes, and every undo, changes only what you asked for. The rest of the file stays exactly as it was, so your diffs show just the real change:
- Text encoding: UTF-8 (with or without a byte-order mark), UTF-16, UTF-32, and older 8-bit files are written back in their own format. If an older 8-bit file can't store a character, an edit is refused with that character named; it never silently turns into
?. (Rewriting such a file from scratch switches it to UTF-8, and the agent is told.) - Line endings: Windows-style (CRLF) files keep CRLF and others keep LF. New text takes the file's own style.
- Safe saves: a file is written to a temporary copy first and swapped in, in one step, so nothing ever sees a half-written file. Its permissions and hidden or system attributes are kept, a symbolic link is written through to its target, and a file with several hard links is updated in place.
- Read-only files are left alone, with a clear message. A Perforce file that isn't checked out stays untouched.
- Undo restores the exact original bytes, format included.
Files in older 8-bit encodings are read as Latin-1: every byte is written back exactly as it was, but a few Windows-specific characters (curly quotes, for example) can look odd to the agent.
Revert Options
By steps back:
> Undo the last 2 edits to main.py
To original state:
> Revert config.json to its original state
> Reset auth.ts to how it was before any edits
By state ID (advanced):
> Revert to state abc123
State IDs are shown in the history output.
Session Scope
File history is maintained per session:
- History starts when you begin a session
- History is preserved when you save/load sessions
- Starting a new session (
/new) begins fresh history
The history is stored in memory and session files, not in your project.
What's Tracked
Tracked:
- All edits made through TatsuCode's own tools
- Write operations (new files)
- Edit operations (modifications)
- Find & Replace batches
- Revert operations (so you can undo them)
Not tracked:
- Changes made outside TatsuCode
- Changes before the session started
- Binary file contents
- Edits by Claude Code's own built-in Edit and Write tools, when Claude Code is your main model (its Find & Replace edits are tracked). Use git, or ask Claude to put the text back
Storage
History is stored in local session data:
- Location: user-local app data storage
- Format: compact snapshots; large ones are stored compressed
- Cleanup: old sessions can be removed via
/remove-tatsu
History doesn't persist in your project folder — it's separate from your code.
Undo History and Older Versions
The undo history format changed in TatsuCode 1.2. Older versions can't read history saved by 1.2: they open the session without its undo history rather than misread it. If you plan to go back to an older version, finish any undos first. The other way round, an undo history saved by a newer version is left untouched.
Best Practices
Save Before Big Changes
For major refactoring, consider:
> First, note the current state of the authentication module
> [Makes changes]
> If this doesn't work, I can undo all changes
Use Descriptive Sessions
Name sessions so you can find them later:
/session-rename "Experiment: New auth approach"
Review Before Reverting
Check what will change:
> Show me the history for this file first
> What was the original state?
Clean Up Failed Experiments
> Undo all changes to the test files
> Revert the config to its original state
Crash Recovery
Long sessions are now resilient to system crashes, power loss, and unexpected shutdowns. TatsuCode saves session state more frequently in v0.9.107, and restored sessions come back with file history intact. If TatsuCode does crash, a detailed crash log is captured for support — see Troubleshooting for the location.
Limitations
- Session scope only — History persists with the session but isn't a replacement for git history
- Memory-based — Very long sessions with many edits may use more memory
- Text files only — Binary files (images, executables) aren't fully tracked
- No external changes — Edits made outside TatsuCode aren't captured
Next Steps
- AI Capabilities — What TatsuCode can do
- Tools Reference — All available tools
- Commands — Slash command reference