Repository navigation
Closed
Labels
Description
Summary
Enhance the 2D graph explorer (shipped in v0.5.0) with interactive search, filtering, and a fact inspector sidebar.
Architecture
Where code lives
- Visualizer HTML:
internal/graph/visualizer.html(1,123 lines, embedded via//go:embed) - Graph API:
internal/graph/graph.go— serves/api/clusterendpoint returning nodes + edges JSON - Server:
internal/graph/server.go— HTTP server on configurable port (default :8090) - Graph data:
internal/graph/graph.go—BuildClusterGraph()queries store for facts → nodes/edges
Current state
- 2D force-directed graph using D3.js (embedded in visualizer.html)
- Cluster view: groups nodes by shared subject
- Node tooltips on hover
- 78 nodes, 85 edges at current DB size (28K facts)
- No search, no filtering, no click-to-inspect
Key APIs the frontend can call
The graph server already serves the visualizer HTML at / and cluster data at /api/cluster. New endpoints needed:
GET /api/cluster — existing, returns {nodes, edges}
GET /api/facts?subject=X — NEW: return all facts for a subject
GET /api/search?q=term — NEW: return matching nodes/facts
GET /api/facts?memory_id=N — NEW: return facts linked to a memory
Implementation tasks
Backend (Go)
- Add
GET /api/facts?subject=Xendpoint tointernal/graph/server.go- Query
store.ListFacts()filtered by subject - Return JSON array of facts with id, subject, predicate, object, type, confidence, source
- Query
- Add
GET /api/search?q=termendpoint- Use
search.Engine.Search()to find matching memories - Return node highlights (which nodes match the query)
- Use
- Add
GET /api/facts?memory_id=Nendpoint- Return all facts extracted from a specific memory
- Add node metadata to cluster API response: fact_count, last_updated, source_types
- Tests in
internal/graph/graph_test.gofor new endpoints
Frontend (visualizer.html)
- Search bar (top of page): type to filter/highlight nodes
- Debounced input (300ms), calls
/api/search?q=term - Matching nodes get highlighted color + enlarged
- Non-matching nodes fade to 20% opacity
- Clear button resets view
- Debounced input (300ms), calls
- Click-to-inspect sidebar (right side, 300px):
- Click any node → sidebar slides in
- Shows: subject name, fact count, all facts (subject-predicate-object), source memories, connected nodes
- Facts sorted by confidence (highest first)
- Each fact shows type badge (identity, temporal, decision, etc.)
- Click a connected node → navigates to that node
- Node coloring by type:
- Determine node "type" from its most common fact type
- Color scheme: identity=blue, temporal=orange, decision=green, preference=purple, kv=gray, relationship=red
- Legend in bottom-left corner
- Time filter:
- Range slider or date picker at top
- Filters to nodes with facts updated within the selected window
- Default: all time. Presets: today, this week, this month
- Edge labels on hover:
- Show predicate text when hovering over an edge line
- Use D3 tooltip or SVG text element
CSS/Layout
- Sidebar: fixed right, 300px wide, white background, scrollable
- Search bar: fixed top, full width, z-index above graph
- Graph canvas: fills remaining space
- Responsive: sidebar collapses to bottom on narrow screens
Acceptance criteria
- Search highlights matching nodes in < 500ms
- Click any node → sidebar shows its facts and connections
- Node colors reflect primary fact type
- Time filter correctly hides/shows nodes
- Edge labels appear on hover
- All existing Go tests still pass (13 packages)
- Works in Chrome, Firefox, Safari
Dependencies
- D3.js (already embedded in visualizer.html)
- No new Go dependencies
Design reference
The current visualizer uses a dark theme with colored nodes. Keep the same aesthetic. The sidebar should feel like a property inspector (VS Code style).
Activity
feat(graph): add facts API and interactive explorer filtering (#197)
hurttlocker commentedon Feb 24, 2026
Shipped in v0.7.0 — verified via full audit (13/13 test packages passing, clean build, code reviewed).