Skip to content

feat: add knowledge graph visualization - #108

Merged
comppaz merged 2 commits into
mainfrom
feat/knowledge-graph
Feb 5, 2026
Merged

feat: add knowledge graph visualization#108
comppaz merged 2 commits into
mainfrom
feat/knowledge-graph

Conversation

@comppaz

@comppaz comppaz commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add interactive knowledge graph visualization with force-directed layout using Reagraph
  • Implement AI-powered link suggestions with one-click accept functionality
  • Add graph analytics (centrality, communities, health metrics) via NetworkX
  • Support filtering by memory type, date range, and isolated node visibility
  • Include community detection with automatic coloring and collapsible legend
  • Add "View in graph" navigation from memory detail panel
  • Implement TTL cache with invalidation for graph data performance

Test plan

  • Navigate to /graph route and verify graph renders with existing memories
  • Test filters: memory type selector, date range, show/hide isolated nodes
  • Click on a node to open memory detail panel
  • Test "View in graph" button from memory detail panel
  • Open insights panel and verify AI link suggestions load
  • Accept a suggested link and verify it appears in the graph
  • Verify community coloring groups related nodes together
  • Test graph legend expand/collapse functionality

🤖 Generated with Claude Code

Implement automatic link suggestions using semantic similarity to help
users discover related memories that could be linked together.

Backend Changes:
- Add suggestion service using vector search to find similar memories
- Filter out existing links and self-links automatically
- Convert cosine distance to relevance scores (0-1)
- Add GET /api/memories/{id}/suggestions endpoint with configurable
  limit and min_relevance parameters
- Add helper function to efficiently get linked memory IDs
- Graceful error handling (returns empty array on failure)

Frontend Changes:
- Add "Suggested Connections" section in memory detail panel
- Display suggestions with relevance scores as percentages
- One-click acceptance with "+" button to create links
- Loading state with spinner during fetch
- Remove suggestions from list after acceptance
- Refresh suggestions when links are created/deleted (SSE integration)
- Visual distinction with dashed borders and Sparkles icon
- Auto-fetch suggestions when panel opens

Features:
- Uses existing embedding infrastructure (no new models needed)
- Default threshold of 0.35 cosine distance (60% relevance minimum)
- Returns top 5 suggestions by default (configurable 1-20)
- Created links are marked as "auto" type with relevance score
- Empty state handling (no suggestions if no embeddings or no matches)
Add interactive knowledge graph visualization with AI-powered insights:

Frontend:
- New GraphPage with force-directed graph using Reagraph
- Filters for memory type, date range, and isolated nodes
- Community detection with automatic coloring
- AI link suggestions panel with one-click accept
- "View in graph" button in memory detail panel
- New tooltip, legend, and filter components

Backend:
- Graph data endpoint with filtering support
- Analytics endpoints for centrality, communities, stats
- Insights endpoints for link recommendations and health metrics
- Batch link creation for auto-linking
- TTL cache with invalidation for graph data
- NetworkX-based graph analytics services
@comppaz
comppaz force-pushed the feat/knowledge-graph branch from ce5f565 to 5faa0a4 Compare February 5, 2026 11:56
@comppaz
comppaz merged commit a624807 into main Feb 5, 2026
@comppaz
comppaz deleted the feat/knowledge-graph branch February 5, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant