Tracing history
Tracing History Examples
This guide provides examples of how to trace the history of code using Arc Memory, showing how to follow the decision trail from a specific line of code to related commits, PRs, issues, and ADRs.
Related Documentation:
- Trace Commands - Reference for trace commands
- Build Commands - Build your knowledge graph before tracing
- Trace API - Programmatic access to trace functionality
- Models - Understanding the data models in trace results
Basic History Tracing
The simplest way to trace the history of a specific line in a file is:
This will:
- Find the commit that last modified line 42 in
src/main.py
- Traverse the knowledge graph to find related entities
- Display the results in a table
Example output:
Adjusting Search Depth and Results
You can control the depth of the search and the number of results:
Increasing --max-hops
will follow longer paths in the graph, potentially finding more distantly related entities. Increasing --max-results
will return more entities.
Tracing History for Different File Types
Arc Memory works with any file type in your repository:
Finding the Decision Behind a Feature
To understand why a particular feature was implemented:
This will show you:
- The commit that introduced the feature
- The PR that merged the commit
- Any issues that were mentioned in the PR
- Any ADRs that were related to the issues
Tracing History Programmatically
You can also trace history programmatically in your Python code:
Real-World Use Cases
Debugging a Bug
When you find a bug, trace the history of the problematic line:
This can help you understand:
- Who wrote the code and why
- What PR introduced the bug
- What issues were being addressed
- What architectural decisions influenced the code
Understanding a Complex Feature
When you need to understand a complex feature:
Code Review
During code review, trace the history of changed lines:
Onboarding New Team Members
Help new team members understand the codebase:
Troubleshooting
No History Found
If no history is found:
Incomplete History
If the history seems incomplete:
Performance Issues
If tracing is slow: