# sridesiyan/mycelium architecture

> Architecture diagram of the GitHub repository sridesiyan/mycelium, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sridesiyan/mycelium
- Repository: https://github.com/sridesiyan/mycelium

## Overview

#### Purpose and Entry Point
MYCELIUM is a client-side investigative intelligence workstation for converting fragmented drug-trafficking evidence into explainable, investigator-reviewed leads, hypotheses, and dossiers. The Next.js App Router entry is `src/app/page.tsx`, wrapped by global layout and styling in `src/app/layout.tsx` and `src/app/globals.css`.

#### Workstation Shell and Navigation
The workstation composes the principal analyst UI: tactical controls, intelligence rail, inspectors, command palette, status strip, and investigation dock. Its central assembly point is `src/workstation/InvestigationWorkstation.tsx`; shared shell framing is in `src/components/layout/Shell.tsx`. Persistent cross-module UI/state coordination is managed through `src/store/intelligence.ts`.

#### Evidence Model and Seeded Investigation
The domain model represents evidence, entities, relationships, cases/leads, and hypotheses through typed contracts in `src/types/evidence.ts`, `src/types/entity.ts`, and `src/types/hypothesis.ts`. The current application is seeded with an Orchid-47 scenario and mock fixtures rather than live source ingestion: `src/data/orchid47Scene.ts` and `src/data/mock/fixtures.ts`. This is the data boundary to replace when connecting operational sources.

#### Source Normalization Adapters
Source-specific adapters isolate external-data semantics from intelligence logic: blockchain, dark-web, OSINT, entity-resolution, graph, hypothesis, and temporal sources are represented under `src/services/adapters/`. Examples include `src/services/adapters/blockchainAdapter.ts`, `src/services/adapters/darkwebAdapter.ts`, and `src/services/adapters/entityResolutionAdapter.ts`. The adapter index, `src/services/adapters/index.ts`, is the integration seam for provider implementations.

#### Intelligence Pipeline and Decision Gates
The analytical flow is evidence sufficiency → multi-signal resolution → knowledge graph → competing hypotheses → explainable leads/dossier. Core stages reside in `src/services/intelligence/sufficiencyGating.ts`, `src/services/intelligence/multiSignalResolution.ts`, `src/services/intelligence/knowledgeGraphEngine.ts`, `src/services/intelligence/explainableLeadEngine.ts`, and `src/services/intelligence/dossierGenerator.ts`. Supporting decision algorithms include `src/lib/sufficiency-gate.ts` and `src/lib/ach-engine.ts`. These modules must preserve citations, alternatives, confidence rationale, and investigator review boundaries rather than produce automated attribution.

#### Investigation Views and Analyst Interaction
Feature views present each investigative lens—cases, evidence, entities, leads, graph, hypotheses, provenance, timeline, blockchain, and dark-web intelligence. Major orchestration surfaces include `src/features/command-center/CommandCenter.tsx`, `src/features/investigation/GuidedInvestigation12Step.tsx`, and `src/features/investigation/InteractiveInvestigationFlow.tsx`. The right-side contextual review boundary is implemented in `src/components/investigation/RightContextInspector.tsx` and `src/panels/RightInvestigatorInspector.tsx`.

#### Graph Visualization, Runtime, and Deployment
The graph is rendered as an interactive Three.js/WebGL scene with a UI component boundary and fallback-oriented visualization design: `src/scenes/IntelligenceGraphScene.tsx`, `src/components/3d/EvidenceConstellation3D.tsx`, and `src/features/graph/GraphView.tsx`. Runtime is Next.js 16, React 19, TypeScript, Zustand, and native Three.js; deployment targets Vercel via `vercel.json`. The repository currently exposes a static App Router surface, with external investigative systems expected to enter through adapters rather than direct UI coupling.

Main entry points: [`src/workstation/InvestigationWorkstation.tsx`](https://github.com/sridesiyan/mycelium/blob/main/src/workstation/InvestigationWorkstation.tsx) (Investigation Workstation), [`src/services/intelligence/knowledgeGraphEngine.ts`](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/knowledgeGraphEngine.ts) (Knowledge Graph Engine), [`src/services/intelligence/explainableLeadEngine.ts`](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/explainableLeadEngine.ts) (Explainable Lead Engine), [`src/services/adapters/index.ts`](https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/index.ts) (Source Adapter Index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_next_entry["Next.js App Entry<br/>App Router page<br/>[page.tsx]"]
  node_global_layout["Global Layout &amp; Styles<br/>app shell styling<br/>[layout.tsx]"]
  node_workstation["Investigation Workstation<br/>analyst workspace"]
  node_shell["Shell Frame<br/>shared layout<br/>[Shell.tsx]"]
  node_intelligence_store["Intelligence Store<br/>Zustand state<br/>[intelligence.ts]"]
end

subgraph group_data["Data &amp; Integration"]
  node_domain_model["Evidence Domain Model<br/>typed contracts<br/>[evidence.ts]"]
  node_seeded_scene[("Orchid-47 Seed Data<br/>mock investigation<br/>[orchid47Scene.ts]")]
  node_mock_fixtures["Mock Fixtures<br/>fixture data<br/>[fixtures.ts]"]
  node_adapter_seam{{"Source Adapter Index<br/>integration seam<br/>[index.ts]"}}
  node_blockchain_adapter["Blockchain Adapter<br/>source adapter"]
  node_darkweb_adapter["Dark-web Adapter<br/>source adapter<br/>[darkwebAdapter.ts]"]
  node_resolution_adapter["Entity Resolution Adapter<br/>source adapter"]
end

subgraph group_intelligence["Intelligence Pipeline"]
  node_sufficiency{{"Evidence Sufficiency Gate<br/>decision gate"}}
  node_resolution["Multi-signal Resolution<br/>entity resolution"]
  node_knowledge_graph["Knowledge Graph Engine<br/>relationship analysis"]
  node_hypothesis_algorithm["Competing Hypotheses<br/>ACH algorithm<br/>[ach-engine.ts]"]
  node_lead_engine["Explainable Lead Engine<br/>lead generation"]
  node_dossier["Dossier Generator<br/>report generation"]
end

subgraph group_ui["Investigation UI"]
  node_investigation_views["Investigation Views<br/>analyst workflows"]
  node_command_center["Command Center<br/>analyst control surface<br/>[CommandCenter.tsx]"]
  node_review_inspector["Right Context Inspector<br/>investigator review"]
end

subgraph group_visualization["Graph Visualization"]
  node_graph_view["Graph View<br/>graph feature UI<br/>[GraphView.tsx]"]
  node_graph_scene["Intelligence Graph Scene<br/>Three.js/WebGL scene"]
end

node_next_entry -->|"wrapped by"| node_global_layout
node_next_entry -->|"renders"| node_workstation
node_global_layout -->|"frames"| node_shell
node_shell -->|"hosts"| node_workstation
node_workstation -->|"coordinates through"| node_intelligence_store
node_seeded_scene -->|"uses"| node_mock_fixtures
node_seeded_scene -->|"conforms to"| node_domain_model
node_mock_fixtures -->|"conforms to"| node_domain_model
node_blockchain_adapter -->|"registers through"| node_adapter_seam
node_darkweb_adapter -->|"registers through"| node_adapter_seam
node_resolution_adapter -->|"registers through"| node_adapter_seam
node_adapter_seam -->|"normalizes source data for"| node_sufficiency
node_seeded_scene -.->|"currently supplies"| node_sufficiency
node_sufficiency -->|"sufficient evidence"| node_resolution
node_resolution -->|"resolved signals"| node_knowledge_graph
node_knowledge_graph -->|"relationship evidence"| node_hypothesis_algorithm
node_hypothesis_algorithm -->|"alternatives and rationale"| node_lead_engine
node_knowledge_graph -->|"graph context"| node_lead_engine
node_lead_engine -->|"explainable leads"| node_dossier
node_workstation -->|"composes"| node_command_center
node_workstation -->|"composes"| node_investigation_views
node_workstation -->|"provides review context"| node_review_inspector
node_lead_engine -->|"presents for review"| node_review_inspector
node_dossier -->|"surfaces"| node_investigation_views
node_knowledge_graph -->|"visualizes"| node_graph_view
node_graph_view -->|"renders with"| node_graph_scene
node_graph_scene -->|"embedded in"| node_workstation

click node_next_entry "https://github.com/sridesiyan/mycelium/blob/main/src/app/page.tsx"
click node_global_layout "https://github.com/sridesiyan/mycelium/blob/main/src/app/layout.tsx"
click node_workstation "https://github.com/sridesiyan/mycelium/blob/main/src/workstation/InvestigationWorkstation.tsx"
click node_shell "https://github.com/sridesiyan/mycelium/blob/main/src/components/layout/Shell.tsx"
click node_intelligence_store "https://github.com/sridesiyan/mycelium/blob/main/src/store/intelligence.ts"
click node_domain_model "https://github.com/sridesiyan/mycelium/blob/main/src/types/evidence.ts"
click node_seeded_scene "https://github.com/sridesiyan/mycelium/blob/main/src/data/orchid47Scene.ts"
click node_mock_fixtures "https://github.com/sridesiyan/mycelium/blob/main/src/data/mock/fixtures.ts"
click node_adapter_seam "https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/index.ts"
click node_blockchain_adapter "https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/blockchainAdapter.ts"
click node_darkweb_adapter "https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/darkwebAdapter.ts"
click node_resolution_adapter "https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/entityResolutionAdapter.ts"
click node_sufficiency "https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/sufficiencyGating.ts"
click node_resolution "https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/multiSignalResolution.ts"
click node_knowledge_graph "https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/knowledgeGraphEngine.ts"
click node_hypothesis_algorithm "https://github.com/sridesiyan/mycelium/blob/main/src/lib/ach-engine.ts"
click node_lead_engine "https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/explainableLeadEngine.ts"
click node_dossier "https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/dossierGenerator.ts"
click node_investigation_views "https://github.com/sridesiyan/mycelium/blob/main/src/features/investigation/GuidedInvestigation12Step.tsx"
click node_command_center "https://github.com/sridesiyan/mycelium/blob/main/src/features/command-center/CommandCenter.tsx"
click node_review_inspector "https://github.com/sridesiyan/mycelium/blob/main/src/components/investigation/RightContextInspector.tsx"
click node_graph_view "https://github.com/sridesiyan/mycelium/blob/main/src/features/graph/GraphView.tsx"
click node_graph_scene "https://github.com/sridesiyan/mycelium/blob/main/src/scenes/IntelligenceGraphScene.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_next_entry,node_global_layout,node_workstation,node_shell,node_intelligence_store toneBlue
class node_domain_model,node_seeded_scene,node_mock_fixtures,node_adapter_seam,node_blockchain_adapter,node_darkweb_adapter,node_resolution_adapter toneAmber
class node_sufficiency,node_resolution,node_knowledge_graph,node_hypothesis_algorithm,node_lead_engine,node_dossier toneMint
class node_investigation_views,node_command_center,node_review_inspector toneRose
class node_graph_view,node_graph_scene toneIndigo
```

## Components

### App Shell

- [Next.js App Entry](https://github.com/sridesiyan/mycelium/blob/main/src/app/page.tsx): App Router page · `src/app/page.tsx`
- [Global Layout & Styles](https://github.com/sridesiyan/mycelium/blob/main/src/app/layout.tsx): app shell styling · `src/app/layout.tsx`
- [Investigation Workstation](https://github.com/sridesiyan/mycelium/blob/main/src/workstation/InvestigationWorkstation.tsx): analyst workspace · Central assembly for the investigative workstation. · `src/workstation/InvestigationWorkstation.tsx`
- [Shell Frame](https://github.com/sridesiyan/mycelium/blob/main/src/components/layout/Shell.tsx): shared layout · `src/components/layout/Shell.tsx`
- [Intelligence Store](https://github.com/sridesiyan/mycelium/blob/main/src/store/intelligence.ts): Zustand state · Coordinates persistent cross-module UI state. · `src/store/intelligence.ts`

### Data & Integration

- [Evidence Domain Model](https://github.com/sridesiyan/mycelium/blob/main/src/types/evidence.ts): typed contracts · Evidence, entities, relationships, leads, and hypotheses. · `src/types/evidence.ts`
- [Orchid-47 Seed Data](https://github.com/sridesiyan/mycelium/blob/main/src/data/orchid47Scene.ts): mock investigation · Current data boundary before operational source ingestion. · `src/data/orchid47Scene.ts`
- [Mock Fixtures](https://github.com/sridesiyan/mycelium/blob/main/src/data/mock/fixtures.ts): fixture data · `src/data/mock/fixtures.ts`
- [Source Adapter Index](https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/index.ts): integration seam · Provider implementations enter intelligence logic here. · `src/services/adapters/index.ts`
- [Blockchain Adapter](https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/blockchainAdapter.ts): source adapter · `src/services/adapters/blockchainAdapter.ts`
- [Dark-web Adapter](https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/darkwebAdapter.ts): source adapter · `src/services/adapters/darkwebAdapter.ts`
- [Entity Resolution Adapter](https://github.com/sridesiyan/mycelium/blob/main/src/services/adapters/entityResolutionAdapter.ts): source adapter · `src/services/adapters/entityResolutionAdapter.ts`

### Intelligence Pipeline

- [Evidence Sufficiency Gate](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/sufficiencyGating.ts): decision gate · Checks whether evidence supports further analysis. · `src/services/intelligence/sufficiencyGating.ts`
- [Multi-signal Resolution](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/multiSignalResolution.ts): entity resolution · `src/services/intelligence/multiSignalResolution.ts`
- [Knowledge Graph Engine](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/knowledgeGraphEngine.ts): relationship analysis · `src/services/intelligence/knowledgeGraphEngine.ts`
- [Competing Hypotheses](https://github.com/sridesiyan/mycelium/blob/main/src/lib/ach-engine.ts): ACH algorithm · Maintains alternative explanations and confidence rationale. · `src/lib/ach-engine.ts`
- [Explainable Lead Engine](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/explainableLeadEngine.ts): lead generation · Produces cited, reviewable leads rather than attribution. · `src/services/intelligence/explainableLeadEngine.ts`
- [Dossier Generator](https://github.com/sridesiyan/mycelium/blob/main/src/services/intelligence/dossierGenerator.ts): report generation · `src/services/intelligence/dossierGenerator.ts`

### Investigation UI

- [Investigation Views](https://github.com/sridesiyan/mycelium/blob/main/src/features/investigation/GuidedInvestigation12Step.tsx): analyst workflows · Guided and interactive case, evidence, entity, lead, and hypothesis views. · `src/features/investigation/GuidedInvestigation12Step.tsx`
- [Command Center](https://github.com/sridesiyan/mycelium/blob/main/src/features/command-center/CommandCenter.tsx): analyst control surface · `src/features/command-center/CommandCenter.tsx`
- [Right Context Inspector](https://github.com/sridesiyan/mycelium/blob/main/src/components/investigation/RightContextInspector.tsx): investigator review · Contextual human-review boundary for findings. · `src/components/investigation/RightContextInspector.tsx`

### Graph Visualization

- [Graph View](https://github.com/sridesiyan/mycelium/blob/main/src/features/graph/GraphView.tsx): graph feature UI · `src/features/graph/GraphView.tsx`
- [Intelligence Graph Scene](https://github.com/sridesiyan/mycelium/blob/main/src/scenes/IntelligenceGraphScene.tsx): Three.js/WebGL scene · Interactive visualization with fallback-oriented design. · `src/scenes/IntelligenceGraphScene.tsx`

## Connections

- Next.js App Entry → Global Layout & Styles: wrapped by
- Next.js App Entry → Investigation Workstation: renders
- Global Layout & Styles → Shell Frame: frames
- Shell Frame → Investigation Workstation: hosts
- Investigation Workstation → Intelligence Store: coordinates through
- Orchid-47 Seed Data → Mock Fixtures: uses
- Orchid-47 Seed Data → Evidence Domain Model: conforms to
- Mock Fixtures → Evidence Domain Model: conforms to
- Blockchain Adapter → Source Adapter Index: registers through
- Dark-web Adapter → Source Adapter Index: registers through
- Entity Resolution Adapter → Source Adapter Index: registers through
- Source Adapter Index → Evidence Sufficiency Gate: normalizes source data for
- Orchid-47 Seed Data → Evidence Sufficiency Gate: currently supplies
- Evidence Sufficiency Gate → Multi-signal Resolution: sufficient evidence
- Multi-signal Resolution → Knowledge Graph Engine: resolved signals
- Knowledge Graph Engine → Competing Hypotheses: relationship evidence
- Competing Hypotheses → Explainable Lead Engine: alternatives and rationale
- Knowledge Graph Engine → Explainable Lead Engine: graph context
- Explainable Lead Engine → Dossier Generator: explainable leads
- Investigation Workstation → Command Center: composes
- Investigation Workstation → Investigation Views: composes
- Investigation Workstation → Right Context Inspector: provides review context
- Explainable Lead Engine → Right Context Inspector: presents for review
- Dossier Generator → Investigation Views: surfaces
- Knowledge Graph Engine → Graph View: visualizes
- Graph View → Intelligence Graph Scene: renders with
- Intelligence Graph Scene → Investigation Workstation: embedded in
