-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
featureFeature level issuesFeature level issues
Description
Description
Background indexing system with intelligent incremental updates for DreamNode content. Implements git-integrated indexing pipeline that automatically maintains vector embeddings as DreamNodes are created, modified, or updated.
Parent Specification: #268 - Search Architecture Specification
Implementation Plan
Architecture Integration
1. IndexingService Creation (src/services/indexing-service.ts) ✅
- Create
IIndexingServiceinterface following existing service pattern - Implement
IndexingServiceclass with cross-session persistence via InterBrain store - Store vector embeddings and indexing metadata in persisted store
- Hook into existing
GitDreamNodeService.checkGitStatus()for change detection
2. Store Enhancement (src/store/interbrain-store.ts) ✅
- Add indexing state:
indexingState,vectorData,indexingProgress - Include vector embeddings in persisted store data
- Track progress for batch operations
3. Service Manager Integration ✅
- Initialize and manage IndexingService instance
- Handle indexing across mock/real mode transitions
- Coordinate between DreamNode CRUD operations and indexing updates
4. Git Integration Hooks ✅
- Trigger indexing on
GitDreamNodeService.create() - Extend
refreshGitStatus()to trigger re-indexing on commit detection - Use git commit hashes for delta detection
5. Command Palette Commands ✅
interbrain:index-selected-node- Index currently selected DreamNodeinterbrain:index-all-nodes- Full reindex of all DreamNodesinterbrain:intelligent-reindex- Delta-based intelligent update (primary command)
Vector Storage Structure ✅
interface VectorData {
nodeId: string;
contentHash: string; // Git commit hash for change detection
embedding: number[]; // Vector embedding
lastIndexed: number; // Timestamp
metadata: {
title: string;
type: 'dream' | 'dreamer';
wordCount: number;
};
}Implementation Phases ✅
- Core Infrastructure: IndexingService, store integration, basic storage
- Git Integration: Creation hooks, commit detection, delta algorithm
- Service Manager: Lifecycle management, mode switching, CRUD coordination
- Performance & UX: Background processing, progress indicators, error handling
Acceptance Criteria
- Command-based indexing system with progress indicators
- Git integration for automatic re-indexing on DreamNode changes
- Incremental updates for optimal performance (only changed nodes)
- Multi-content-type indexing pipeline (text + future image support)
- Background operation with no UX blocking
- Intelligent change detection via git hooks and file monitoring
Dependencies
- Parent specification Search Architecture Specification #268 must be approved
- Qwen3-Embedding-0.6B model integration (deferred - using simple text analysis initially)
- Vectra vector database setup (deferred - using in-memory storage initially)
Definition of Done
- Implementation complete
- Tests passing
- Documentation updated
- Code reviewed and merged
- Git hooks integrated for automatic indexing triggers
- Performance benchmarked for incremental vs full indexing
Technical Notes
- Integration with existing service layer pattern (mock/real implementations)
- Cross-session persistence via Zustand store middleware
- Path of least resistance: Start with intelligent re-index command, then automate
- Scale target: Thousands of DreamNodes
- Storage: InterBrain store with persistent memory middleware
Implementation Complete ✅
Key Features Delivered:
- Complete IndexingService with interface-based architecture
- Cross-session vector data persistence via Zustand store
- Three command palette commands with async operation patterns
- Automatic indexing on DreamNode creation
- Git-based change detection using commit hashes
- Intelligent delta updates with cleanup of deleted nodes
- Comprehensive test suite (22 tests) covering all functionality
- Character frequency-based embeddings (placeholder for future Qwen3 integration)
Files Modified:
src/services/indexing-service.ts(new) - Core indexing functionalitysrc/store/interbrain-store.ts- Added vector data storagesrc/main.ts- Added three indexing commandssrc/services/git-dreamnode-service.ts- Auto-indexing integrationsrc/services/service-manager.ts- IndexingService registrationsrc/services/ui-service.ts- Added showWarning methodsrc/types/dreamnode.ts- Enhanced GitStatus interfacetests/services/indexing-service.test.ts(new) - Complete test coverage
Ready for merge to epic branch.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureFeature level issuesFeature level issues