How to Set Up Git LFS to Track Large Knowledge Graph Files in Understand-Anything
Configure Git LFS to track JSON files in the .understand-anything/ directory to prevent the repository from bloating when knowledge-graph.json exceeds Git's default size limits.
The Understand-Anything project generates semantic analysis results as JSON files that can quickly grow beyond 10 MiB. To maintain repository performance and avoid Git's 100 MiB object-size limit, you need to set up Git LFS to track large knowledge graph files in the Egonex-AI/Understand-Anything repository.
Why Git LFS is Required for Knowledge Graphs
Git stores full snapshots of every file version, making large binaries expensive to track in history. The primary artifact .understand-anything/knowledge-graph.json can easily exceed 10 MiB when analyzing big projects, and the README.md (lines 292-298) explicitly recommends using Git Large File Storage (LFS) for these cases.
The dashboard application in packages/dashboard/src/App.tsx loads this data via dataUrl("knowledge-graph.json"), meaning the file must remain accessible in the repository while keeping clone operations lightweight. LFS stores the actual binary data on a separate server while keeping lightweight pointer files in the repository, allowing collaborators to fetch the heavy knowledge graph only when needed.
Step-by-Step Git LFS Configuration
Install Git LFS
Run the following command once per machine to install the LFS hooks:
git lfs install
This modifies your local Git configuration to enable LFS filtering.
Configure Tracking for Knowledge Graph Files
Track every JSON file in the hidden .understand-anything/ directory where the analysis pipeline outputs results:
git lfs track ".understand-anything/*.json"
This command creates a .gitattributes entry with the following content:
.understand-anything/*.json filter=lfs diff=lfs merge=lfs -text
Commit the Configuration
Add the generated .gitattributes file and the graph directory to your repository:
git add .gitattributes .understand-anything/
git commit -m "Enable LFS for large knowledge-graph JSON files"
Push to Remote
Upload the LFS objects and pointer files to your remote:
git push origin main
The LFS objects upload automatically alongside your regular Git objects.
Updating Existing Large Graphs
After running /understand --full and generating a new knowledge-graph.json that exceeds size limits, commit the changes normally. LFS handles storage automatically without additional commands:
git add .understand-anything/knowledge-graph.json
git commit -m "Update large knowledge graph"
git push
Verify LFS Tracking
Confirm that your knowledge graph files are properly tracked by LFS:
git lfs ls-files
You should see entries for .understand-anything/knowledge-graph.json and any other JSON files in that directory.
Summary
- Git LFS prevents repository bloat by offloading large knowledge graph files to external storage while keeping lightweight pointers in the repo.
- Track
.understand-anything/*.jsonto capture theknowledge-graph.jsonoutput and related files generated by the analysis pipeline. - The dashboard depends on these files at
packages/dashboard/src/App.tsx, requiring them to remain in the repository but not in Git's standard object database. - Configuration persists via
.gitattributes, ensuring all collaborators automatically use LFS for these files.
Frequently Asked Questions
What file size triggers the need for Git LFS in Understand-Anything?
The project documentation recommends configuring Git LFS when knowledge graph files exceed approximately 10 MiB, though Git's hard limit is 100 MiB per object. According to the README.md (lines 292-298), this threshold is easily reached when analyzing large codebases that produce extensive semantic graphs.
Where does the dashboard expect the knowledge graph file?
The dashboard loads the knowledge graph from .understand-anything/knowledge-graph.json as referenced in packages/dashboard/src/App.tsx via the dataUrl("knowledge-graph.json") function. This path is also documented in understand-anything-plugin/skills/understand/SKILL.md, which defines the skill's output location.
Can I track only specific knowledge graph files instead of all JSON?
Yes. While the recommendation uses git lfs track ".understand-anything/*.json" to capture all potential graph outputs, you can track specific files instead:
git lfs track ".understand-anything/knowledge-graph.json"
This creates a more restrictive rule in .gitattributes that applies only to the main knowledge graph file rather than all JSON files in the directory.
How do I verify that LFS is actually storing my knowledge graph?
Run git lfs ls-files to see which files are currently managed by LFS. If properly configured, you will see .understand-anything/knowledge-graph.json listed with its SHA-256 pointer. Additionally, checking the file content in the repository on GitHub (or your Git host) will show a pointer file rather than the raw JSON content.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →