mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
a80a7aec63
Fixes #349 - Performance optimization for directory tree rendering in UIs **Problem:** - get_directory_tree() loads ALL entities with full eager loading - Causes multi-second delays for knowledge bases with 1000+ files - Impacts folder tree UI rendering and list_directory() operations **Solution:** Added new get_directory_structure() method optimized for folder navigation: - Only queries file_path column (no entity objects or relationships) - Builds folder tree without file nodes - 10-100x performance improvement for large knowledge bases **Changes:** - EntityRepository.get_all_file_paths() - Optimized query for paths only - DirectoryService.get_directory_structure() - Builds folder-only tree - GET /directory/structure - New API endpoint for folder navigation - Comprehensive tests for service and API layers **Backward Compatibility:** - Existing get_directory_tree() unchanged (full tree with files) - New method is additive, no breaking changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>