Skip to content

Commit 8cfacce

Browse files
Merge branch 'ftr/phase-07-2-KG-UI' into development
2 parents 3a40672 + afb472c commit 8cfacce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8629
-996
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,5 @@ CLAUDE.md
267267
.claude
268268
OTHER
269269
.goose
270-
.codex
270+
.codex
271+
DOCS/reference/epstein-network-ui/Epstein-doc-explorer

.planning/MINOR_ISSUES.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ Deferred issues that are non-blocking but should be addressed in future work.
2121
- **Priority**: Low (no runtime impact, passes pyright default mode)
2222
- **Added**: 2025-02-07, QC review of Phase 7 execution ID fix
2323

24-
## MI-003: Fuzzy entity matching produces false positives on numeric/temporal values
25-
26-
- **File**: `backend/app/services/kg_builder.py`, `deduplicate_entities()` (~line 270-288)
27-
- **Detail**: Fuzzy string matching (rapidfuzz ratio >=85%) flags semantically distinct values as potential duplicates when they are string-similar but numerically different. Observed in live testing:
28-
- `'2016-05-02 20:00'` vs `'2016-05-02 22:00'` (92%) — different timestamps (8 PM vs 10 PM)
29-
- `'50,000 dollars'` vs `'2,000 dollars'` (88%) — 25x difference in amount
30-
- `'$5,000'` vs `'$50,000'` (88%) — 10x difference in amount
31-
- **Impact**: No data corruption (flags only, not auto-merged). But these false flags add noise for Phase 8 LLM resolution, wasting tokens and potentially confusing the synthesis agent.
32-
- **Fix**: Add type-aware matching logic before fuzzy comparison. For `entity_type` in (`timestamp`, `monetary_amount`, `date`, `other` when value looks numeric): parse the actual value and compare semantically instead of string-matching. E.g., for monetary amounts, extract the number and compare magnitude; for timestamps, parse and compare actual time difference.
33-
- **Priority**: Medium (should be fixed before or during Phase 8 to avoid noisy LLM resolution input)
34-
- **Phase**: Fix during Phase 8 (Synthesis) when fuzzy flags are consumed
24+
## ~~MI-003: Fuzzy entity matching produces false positives on numeric/temporal values~~ — RESOLVED
25+
26+
- **Status**: RESOLVED by Phase 7.1 (2026-02-08)
27+
- **Resolution**: The programmatic KG Builder with fuzzy dedup (`backend/app/services/kg_builder.py`) was entirely replaced by the LLM-based KG Builder Agent. The LLM uses a clear-and-rebuild strategy and handles deduplication naturally by seeing all findings holistically. No fuzzy string matching exists in the current pipeline.
28+
- **Original file**: `backend/app/services/kg_builder.py` — programmatic service is now dead code (superseded by `backend/app/agents/kg_builder.py`)
3529
- **Added**: 2026-02-07, live pipeline testing
30+
- **Resolved**: 2026-02-08, Phase 7.1 LLM KG Builder
3631

3732
## MI-004: Pipeline summary log mixes two different entity count semantics
3833

.planning/REQUIREMENTS.md

Lines changed: 62 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,13 @@ This document defines formal requirements for Holmes v1. Requirements are derive
511511
**Priority:** HIGH
512512
**Description:** Agent that cross-references all domain findings to produce hypotheses, contradictions, gaps, timeline events, cross-domain conclusions, and case-level summary/verdict.
513513
**Acceptance Criteria:**
514-
- Receives ALL case_findings from PostgreSQL (rich markdown findings with citations)
515-
- Additional context: entity summary from KG tables, file metadata, case description
514+
- **Two-source DB input assembly:**
515+
- Source 1: ALL `case_findings` rows for the case workflow — rich markdown `finding_text` with inline citations, `citations` JSONB (file_id + locator + exact_excerpt), `agent_type` (financial/legal/evidence/strategy), `category`, `confidence`. These are the persisted outputs from all domain agents + strategy agent (pipeline Stage 6).
516+
- Source 2: Curated knowledge graph from `kg_entities` (name, entity_type, description_brief, description_detailed, aliases, domains, source_finding_ids) + `kg_relationships` (label, relationship_type, evidence_excerpt, temporal_context, source_finding_ids, confidence). These are the outputs from the LLM KG Builder Agent (pipeline Stage 7).
517+
- Additional context: case metadata (name, description, case_type) + file metadata (filenames, types) from `cases` and `case_files` tables.
516518
- Gemini 3 Pro with `thinking_level="high"` and 1M context window
517519
- Runs in fresh stage-isolated ADK session (consistent with pipeline pattern)
520+
- Pipeline position: Stage 8, after LLM KG Builder (Stage 7) + Entity Backfill (Stage 7b) complete
518521
- Produces structured SynthesisOutput:
519522
- `hypotheses`: Case hypotheses with initial confidence + supporting/contradicting evidence references
520523
- `contradictions`: Detected contradictions with exact source pairs from both sides, severity classification (minor/significant/critical)
@@ -1550,73 +1553,84 @@ This document defines formal requirements for Holmes v1. Requirements are derive
15501553

15511554
### REQ-VIS: Visualization & UI
15521555

1553-
#### REQ-VIS-001: Agent Flow — 🟡 FRONTEND_COMPLETE
1556+
#### REQ-VIS-001: Agent Flow — ✅ COMPLETE
15541557

15551558
| Sub-Criterion | Status | Notes |
15561559
|---------------|--------|-------|
1557-
| React Flow canvas showing agent nodes || D3-based canvas in `CommandCenter/AgentFlowCanvas.tsx` |
1558-
| Animated edges during data flow || Dashed line animations when data flows |
1559-
| Color-coded by agent type || 6 agent types with distinct colors |
1560-
| Click node to expand details panel || `AgentDetailsPanel.tsx` with collapsible sections |
1561-
| Shows model, input, tools, output, duration | 🟡 | UI ready, needs real backend data |
1562-
| Shows thinking traces | 🟡 | UI ready, needs ADK `include_thoughts=True` data |
1563-
| Updates in real-time via SSE | 🟡 | `useCommandCenterSSE.ts` hook ready, needs backend SSE endpoint |
1564-
| ADK callback-to-SSE mapping || Backend work required |
1565-
1566-
**Backend APIs Needed:**
1567-
- `SSE GET /api/cases/:caseId/command-center/stream` — Agent lifecycle events
1568-
1569-
**Files:** `frontend/src/components/CommandCenter/`, `frontend/src/hooks/useCommandCenterSSE.ts`
1560+
| React Flow canvas showing agent nodes || @xyflow/react + dagre in `CommandCenter/AgentFlowCanvas.tsx` (Phase 4.1 revamp) |
1561+
| Animated edges during data flow || FileRoutingEdge with gray tier system |
1562+
| Color-coded by agent type || 7 agent types (incl. evidence, kg_builder) with muted color palette |
1563+
| Click node to expand details panel || `NodeDetailsSidebar.tsx` page-level 30% panel with spring animation |
1564+
| Shows model, input, tools, output, duration || Real backend data via SSE state-snapshot + agent-complete events |
1565+
| Shows thinking traces || Full untruncated text from after_model_callback, JSON normalized |
1566+
| Updates in real-time via SSE || `useCommandCenterSSE.ts` with state-snapshot on reconnect |
1567+
| ADK callback-to-SSE mapping || THINKING_UPDATE, TOOL_CALLED, agent lifecycle events |
1568+
1569+
**Backend APIs:** All complete
1570+
- `SSE GET /sse/cases/:caseId/command-center/stream` — Agent lifecycle events
1571+
- `POST /api/cases/:caseId/confirmations/:requestId` — HITL confirmation
1572+
- `GET /api/cases/:caseId/confirmations/pending` — Pending confirmations
1573+
1574+
**Files:** `frontend/src/components/CommandCenter/`, `frontend/src/hooks/useCommandCenterSSE.ts`, `frontend/src/hooks/useAgentStates.ts`, `frontend/src/hooks/useAgentFlowGraph.ts`
15701575

15711576
---
15721577

1573-
#### REQ-VIS-001a: Human-in-the-Loop Confirmation — ⏳ NOT_STARTED
1578+
#### REQ-VIS-001a: Human-in-the-Loop Confirmation — ✅ COMPLETE
15741579

1575-
No confirmation dialogs implemented yet.
1580+
| Sub-Criterion | Status | Notes |
1581+
|---------------|--------|-------|
1582+
| Confirmation dialog UI || `ConfirmationModal.tsx` with approve/reject + reason input |
1583+
| Routing HITL (batch) || Per-agent-type confidence thresholds, batch confirmation modal |
1584+
| Low-confidence finding HITL || Findings below threshold trigger confirmation |
1585+
| Strategy standalone HITL || User prompted when domain agents fail but strategy has files |
1586+
1587+
**Files:** `frontend/src/components/CommandCenter/ConfirmationModal.tsx`, `backend/app/services/confirmation.py`
15761588

15771589
---
15781590

1579-
#### REQ-VIS-002: Agent Detail View — 🟡 FRONTEND_COMPLETE
1591+
#### REQ-VIS-002: Agent Detail View — ✅ COMPLETE
15801592

15811593
| Sub-Criterion | Status | Notes |
15821594
|---------------|--------|-------|
1583-
| Full thinking trace | 🟡 | UI section exists, needs backend data |
1584-
| Complete input context | 🟡 | UI section exists, needs backend data |
1585-
| Tool calls with inputs/outputs | 🟡 | "Tools Called" section exists |
1586-
| Complete output findings | 🟡 | "Output Findings" section exists |
1587-
| Token usage statistics | | Not implemented |
1588-
| Execution timeline | | Not implemented |
1595+
| Full thinking trace | | JSON-normalized thinking traces from all agents |
1596+
| Complete input context | | Input data visible in sidebar |
1597+
| Tool calls with inputs/outputs | | Tool-called events displayed |
1598+
| Complete output findings | | Finding counts, entity counts in sidebar |
1599+
| Token usage statistics | | CollapsibleSection with input/output tokens, model name |
1600+
| Execution timeline | | Gantt chart showing agent timing overlap |
15891601

1590-
**Files:** `frontend/src/components/CommandCenter/AgentDetailsPanel.tsx`
1602+
**Files:** `frontend/src/components/CommandCenter/NodeDetailsSidebar.tsx`, `frontend/src/components/CommandCenter/ExecutionTimeline.tsx`
15911603

15921604
---
15931605

1594-
#### REQ-VIS-003: Knowledge Graph View — 🟡 FRONTEND_COMPLETE
1606+
#### REQ-VIS-003: Knowledge Graph View — ✅ COMPLETE (Source viewer wiring deferred to Phase 10)
15951607

15961608
| Sub-Criterion | Status | Notes |
15971609
|---------------|--------|-------|
1598-
| D3.js force simulation (5 forces) | 🟠 | Basic D3.js graph exists; needs radial force, collision, charge tuning (Phase 7.2) |
1599-
| Nodes sized by connection count || Implemented |
1600-
| Edges labeled with relationship type || Implemented |
1601-
| Domain layer toggles | 🟠 | Layer concept exists but not domain-based toggle system yet |
1602-
| Zoom and pan controls || Full zoom/pan/reset controls |
1603-
| Node search and highlight || Implemented |
1604-
| Click node for details || Info panel shows on click |
1605-
| Left panel (filters/controls, local to KG canvas) | | Not implemented (Phase 7.2) |
1606-
| Right panel (entity timeline, local to KG canvas) | | Not implemented (Phase 7.2) |
1607-
| Source viewer panel (multi-media) | | Not implemented (Phase 7.2+) — details during phase discussions |
1608-
| Density threshold slider || Not implemented (Phase 7.2) |
1610+
| D3.js force simulation (5 forces) | | useGraphSimulation: link, charge, center, collision, radial (Phase 7.2) |
1611+
| Nodes sized by connection count || Sqrt-scaled node radius via d3.scalePow().exponent(0.5) |
1612+
| Edges labeled with relationship type || Always-horizontal edge labels with disclosure |
1613+
| Domain layer toggles | | 4 domain toggles (Financial, Legal, Evidence, Strategy) in FilterPanel |
1614+
| Zoom and pan controls || d3.zoom() with scale extent [0.01, 10], zoom/pan/reset buttons |
1615+
| Node search and highlight || Debounced search with coral (#E87461) highlight, distinct from selection (white) |
1616+
| Click node for details || Opens DetailSidebar with entity panel + EntityTimeline |
1617+
| Left panel (filters/controls, local to KG canvas) | | FilterPanel: stats, search, keyword filter, domain/type toggles |
1618+
| Right panel (entity timeline, local to KG canvas) | | EntityTimeline in DetailSidebar: chronological relationships, date range, filter-by-entity |
1619+
| Source viewer panel (multi-media) | 🟡 | Components built (PdfViewer, AudioViewer, VideoViewer, ImageViewer) but NOT wired — deferred to Phase 10 |
1620+
| Density threshold slider || Not implemented |
16091621
| Fullscreen capability || Not implemented |
1610-
| Basic analytics | | Not implemented |
1622+
| Basic analytics | | Entity count, relationship count, domain breakdown in FilterPanel |
16111623

1612-
**Backend APIs Needed:**
1613-
- `GET /api/cases/:caseId/graph` — Fetch graph data
1624+
**Backend APIs:** All complete
1625+
- `GET /api/cases/:caseId/graph` — Full graph visualization data
1626+
- `GET /api/cases/:caseId/entities` — List entities with filters
16141627
- `POST /api/cases/:caseId/entities` — Create entity
1615-
- `POST /api/cases/:caseId/relationships` — Create relationship
16161628
- `PATCH /api/cases/:caseId/entities/:entityId` — Update entity
16171629
- `DELETE /api/cases/:caseId/entities/:entityId` — Delete entity
1630+
- `GET /api/cases/:caseId/relationships` — List relationships with filters
1631+
- `POST /api/cases/:caseId/relationships` — Create relationship
16181632

1619-
**Files:** `frontend/src/components/app/knowledge-graph.tsx`, `frontend/src/hooks/use-case-graph.ts`, `frontend/src/types/knowledge-graph.ts`
1633+
**Files:** `frontend/src/components/knowledge-graph/KnowledgeGraphCanvas.tsx`, `frontend/src/components/knowledge-graph/GraphSvg.tsx`, `frontend/src/components/knowledge-graph/FilterPanel.tsx`, `frontend/src/components/knowledge-graph/EntityTimeline.tsx`, `frontend/src/hooks/useGraphSimulation.ts`, `frontend/src/hooks/useGraphSelection.ts`, `frontend/src/hooks/useGraphFilters.ts`, `frontend/src/hooks/use-case-graph.ts`, `frontend/src/types/knowledge-graph.ts`
16201634

16211635
---
16221636

@@ -1824,19 +1838,20 @@ Limitations documented in code comments and mitigated:
18241838

18251839
| Category | Requirements | Complete | Frontend Done | Partial | Not Started |
18261840
|----------|-------------|----------|---------------|---------|-------------|
1827-
| Visualization (VIS) | 6 | 0 | 4 | 1 | 1 |
1841+
| Visualization (VIS) | 6 | 4 | 1 | 0 | 1 |
18281842
| Case Management (CASE) | 5 | 5 | 0 | 0 | 0 |
18291843
| Chat (CHAT) | 5 | 0 | 1 | 0 | 4 |
18301844
| Source Panel (SOURCE) | 5 | 0 | 0 | 0 | 5 |
1831-
| Agents (Core) | 2 | 1 | 0 | 1 | 0 |
1845+
| Agents (Core) | 4 | 3 | 0 | 0 | 1 |
18321846
| Agents (ADK Config) | 4 | 4 | 0 | 0 | 0 |
1847+
| Knowledge Storage (STORE) | 3 | 2 | 0 | 0 | 1 |
18331848

1834-
*Phase 2 requirements (REQ-CASE-001, 002, 003) completed previously. Phase 3 requirements (REQ-CASE-004, 005) completed 2026-02-02. Phase 4 requirements (REQ-AGENT-001, 007, 007a, 007b, 007e) completed 2026-02-03. REQ-AGENT-002 partial (routing logic done, domain agent execution pending Phase 6).*
1849+
*Phase 2 requirements (REQ-CASE-001, 002, 003) completed. Phase 3 requirements (REQ-CASE-004, 005) completed 2026-02-02. Phase 4 requirements (REQ-AGENT-001, 007, 007a, 007b, 007e) completed 2026-02-03. Phase 5 (REQ-VIS-001, 001a, 002) completed 2026-02-05. Phase 6 (REQ-AGENT-002/003/004/005/006) completed 2026-02-06. Phase 7/7.1 (REQ-STORE-001/002, REQ-AGENT-009) completed 2026-02-08. Phase 7.2 (REQ-VIS-003) completed 2026-02-08. REQ-AGENT-008 (Synthesis) next in Phase 8.*
18351850

18361851
---
18371852

18381853
*Generated: 2026-01-18*
1839-
*Updated: 2026-02-07*
1854+
*Updated: 2026-02-08*
18401855
*Architecture redesign: 2026-02-07 (REQ-STORE added, REQ-AGENT-008/009 rewritten, REQ-CHAT-002/003 updated for tool-based architecture)*
18411856
*Architecture revision: 2026-02-08 (REQ-AGENT-009 revised for LLM-based KG Builder; REQ-VIS-003 updated for D3.js with Epstein-inspired patterns; vis-network deferred)*
18421857
*Status: Complete - Integration features added (REQ-RESEARCH, REQ-HYPO, REQ-GEO, REQ-TASK)*

0 commit comments

Comments
 (0)