Time Travel
Replay your entire AI programming session like watching a video, seeing code change with every conversation message.
What is Time Travel?
Imagine you've been pair programming with AI all day, writing hundreds of lines of code. Now you want to know when a particular function was added, or see how the AI refactored your code step by step.
Time Travel is Mantra's "replay" capability:
- Click any conversation message
- Instantly see the code state at that moment
- Just like a video player's progress bar, jump to any point in time
Simple Explanation
If Git is your code's "save points," then Time Travel is the "time machine" that lets you freely travel between those save points.
Why Do You Need Time Travel?
When using AI coding assistants (like Cursor or Copilot Chat), you might encounter these challenges:
| Problem | How Time Travel Helps |
|---|---|
| Want to know when a feature was implemented | Click along the conversation to find the right moment |
| Code broke, want to review previous version | Click earlier messages to see the code at that time |
| Want to understand how AI made changes step by step | Click messages sequentially to watch code evolution |
| Want to share coding approach with colleagues | Replay the entire programming session from the start |
Interface Layout
Mantra uses a side-by-side layout so you can see both conversation and code:
Conversation Panel (Left)
The left panel displays the complete AI conversation history:
- Message List: All exchanges between you and the AI, in chronological order
- Timestamps: Each message has a precise timestamp
- Message Types: Distinguishes user messages, AI responses, code executions, etc.
- Current Position: Highlights the message you're currently viewing
Pro Tip
Conversations can get long. Use Message Filtering to show only the content you care about.
Code Snapshot Panel (Right)
The right panel shows the code state at the selected point in time:
- File Tree: Displays the project's directory structure
- Code Content: Shows the complete code of the selected file
- Change Highlighting: Uses different colors to mark code changes
- Multi-file Navigation: Browse any file in the project
Note
The code snapshot shows the code state at the time of the conversation, not the current content on your computer.
Basic Operations
Click Messages to View Code Changes
This is the core operation of Time Travel:
- Find the message you want to view in the left conversation panel
- Click on the message
- The right code panel instantly updates to show the code state at that time
Experience the "Aha Moment"
When trying this for the first time, click back and forth between two messages that are far apart. When you see the code instantly switch, you'll truly understand the magic of Time Travel!
Timeline Navigation
Besides clicking messages directly, you can also navigate using the timeline:
- Find the timeline component at the top of the interface
- Drag the timeline to your desired position
- The code automatically updates as you move the timeline
The timeline displays key nodes to help you quickly locate important code changes.
Browsing Historical Versions with File Tree
Time Travel isn't just for viewing single files—you can browse the entire project's state at any point in time:
- Use Time Travel to jump to a specific point in time
- Expand the file tree in the right code panel
- Click any file to view its content at that moment
- When switching files, the time point remains the same
Use Case
This feature is especially useful when you want to understand which files were changed during a refactoring.
Git Integration
How Code Snapshots Relate to Git History
You might wonder: How does Mantra know the code state at each point in time?
The answer is Git. Mantra analyzes your project's Git commit history and combines it with conversation timestamps to automatically match the closest code version.
How It Works
- Mantra reads timestamps from the conversation history
- Finds the most recent Git commit before that timestamp
- Extracts the code snapshot from that commit in Git history
- Displays this version of the code in the interface
Git Repository Requirements
Time Travel requires your project to meet these conditions:
- Must be a Git repository: The project root needs a
.gitfolder - Has commit history: At least some Git commit records are needed
- Commit frequency affects precision: More frequent commits mean more precise Time Travel
Best Practice
When using AI coding assistants, develop a habit of making frequent small commits. This allows Mantra to more precisely restore code states at each point in time.
Impact of Git Working Directory
If you have uncommitted changes (working directory modifications), Time Travel behaves differently:
| Situation | What Time Travel Shows |
|---|---|
| Viewing the latest time point | Shows code from the most recent Git commit |
| Viewing historical time points | Shows the Git version at that time |
| Untracked new files | Won't appear in the code snapshot |
Note
Time Travel shows versions from Git, not the real-time state of your local files. If you just wrote code that hasn't been committed, Time Travel won't show it.
Advanced Tips
Keyboard Shortcuts
Use keyboard shortcuts to browse conversation history more efficiently:
| Shortcut | Function |
|---|---|
Cmd/Ctrl + J | Jump between messages |
Cmd/Ctrl + K | Open search |
Continuous Browsing
Press Cmd/Ctrl + J repeatedly to quickly jump between messages, like fast-forwarding/rewinding a video. Combine with Cmd/Ctrl + K search to quickly locate specific conversations.
For more shortcuts, see Keyboard Shortcuts Reference.
Combining with Message Filtering
When conversation history is long, Time Travel works better with Message Filtering:
- First use message filtering to show only key messages (like code-related ones)
- Use Time Travel within the filtered results
- This lets you skip irrelevant chat and focus on code evolution
File Tree Browsing Tips
Make full use of the file tree to get a more comprehensive code perspective:
- Collapse irrelevant directories: Only expand the code directories you care about
- Compare multiple files: Switch between different files at the same time point
- Track file creation: Observe when new files appear
- Track file deletion: Notice when files disappear after a certain point
Frequently Asked Questions
Code snapshot not showing?
Possible causes:
Project is not a Git repository
- Solution: Run
git initin the project root to initialize a repository
- Solution: Run
No Git commits exist
- Solution: Create at least one commit with
git add . && git commit -m "Initial commit"
- Solution: Create at least one commit with
Git repository is corrupted
- Solution: Check if the
.gitdirectory is intact; re-clone the repository if necessary
- Solution: Check if the
File path issues
- Solution: Ensure the project path doesn't contain special characters or excessively long paths
Git history matching failed?
Possible causes:
Conversation time is earlier than the first commit
- Explanation: If the conversation occurred before the first Git commit, no corresponding code version can be found
- Solution: You can only view time periods covered by Git history
Inaccurate timestamps
- Explanation: Incorrect system time might cause matching errors
- Solution: Check your computer's system time settings
Low commit frequency
- Explanation: Long gaps between commits may prevent precise restoration of intermediate states
- Solution: Develop a habit of making frequent small commits
File shows as empty?
Possible causes:
File didn't exist at that time point
- Explanation: You're viewing a time point before the file was created
- Solution: Jump to a time point after the file was created
File was deleted
- Explanation: The file was deleted in a subsequent commit
- Solution: Jump to a time point before the file was deleted
Git isn't tracking the file
- Explanation: The file is in
.gitignoreor was never added to Git - Solution: Ensure important files are tracked by Git
- Explanation: The file is in
Time Travel and IDE code are out of sync?
This is normal behavior.
Mantra shows code versions from Git history, while your IDE shows the current state of local files.
The difference:
- Mantra Time Travel: Historical versions committed to Git
- IDE/Editor: Real-time local file content (may include uncommitted changes)
If you want to see the latest code in Mantra, you need to git commit your changes first.
Next Steps
After mastering Time Travel, explore more features:
- Message Filtering - Filter key information in conversations
- Content Redaction - Protect sensitive code information
