# oscampo/obsidian-neural-composer architecture

> Architecture diagram of the GitHub repository oscampo/obsidian-neural-composer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oscampo/obsidian-neural-composer
- Repository: https://github.com/oscampo/obsidian-neural-composer

## Overview

Neural Composer is an Obsidian plugin for graph-based AI chat over vault notes. Users configure a LightRAG server and models, ingest or sync notes, then ask questions and explore cited graph results; chat can also use MCP tools. The graph shows documented capabilities and relationships visible in the supplied excerpts or SOURCE INDEX. Some UI-to-runtime and unsampled subsystem wiring is not shown, so those links are omitted rather than inferred.

Main entry points: [`src/main.ts`](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/main.ts) (Plugin lifecycle), [`src/core/rag/ragEngine.ts`](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/ragEngine.ts) (LightRAG client), [`src/components/chat-view/useChatStreamManager.ts`](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/useChatStreamManager.ts) (Chat stream manager), [`src/components/chat-view/Chat.tsx`](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/Chat.tsx) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat and answers"]
  node_chat_ui["Chat interface<br/>[Chat.tsx]"]
  node_stream["Chat stream manager"]
  node_response["Response generation"]
  node_progress["Query progress<br/>[QueryProgress.tsx]"]
  node_chat_types["Chat messages<br/>[chat.ts]"]
end

subgraph group_graph["Vault graph and search"]
  node_rag["LightRAG client<br/>[ragEngine.ts]"]
  node_indexer["Vault indexing<br/>[docIndexService.ts]"]
  node_file_filters["Sync filters<br/>[glob-utils.ts]"]
  node_vectors["Vector manager<br/>[VectorManager.ts]"]
  node_graph_view["Knowledge graph view<br/>[NativeGraphView.ts]"]
end

subgraph group_integrations["Providers and tools"]
  node_llm["Model provider manager<br/>[manager.ts]"]
  node_mcp["MCP manager<br/>[mcpManager.ts]"]
  node_embedding["Embedding service<br/>[embedding.ts]"]
end

subgraph group_platform["Plugin and data"]
  node_plugin["Plugin lifecycle<br/>[main.ts]"]
  node_settings["Settings"]
  node_settings_schema["Settings schema<br/>[setting.types.ts]"]
  node_db["Database manager<br/>[DatabaseManager.ts]"]
  node_schema["Database schema<br/>[schema.ts]"]
  node_chat_store[("Chat history store<br/>[ChatManager.ts]")]
end

node_user(("Vault user"))

node_user -->|"asks questions"| node_chat_ui
node_user -->|"configures server"| node_plugin
node_plugin -->|"initializes"| node_rag
node_plugin -->|"uses"| node_indexer
node_plugin -->|"initializes"| node_db
node_plugin -->|"registers view"| node_graph_view
node_plugin -->|"uses"| node_mcp
node_plugin -->|"loads"| node_settings_schema
node_stream -->|"reads"| node_settings
node_stream -->|"selects model"| node_llm
node_stream -->|"gets manager"| node_mcp
node_stream -->|"runs"| node_response
node_chat_ui -.->|"starts streams"| node_stream
node_chat_ui -.->|"persists history"| node_chat_store
node_indexer -.->|"submits notes"| node_rag
node_rag -->|"checks exclusions"| node_file_filters
node_rag -->|"uses vectors"| node_vectors
node_vectors -->|"stores embeddings"| node_schema
node_db -->|"creates manager"| node_vectors
node_db -.->|"uses schema"| node_schema
node_rag -->|"uses embeddings"| node_embedding
node_user -->|"explores graph"| node_graph_view
node_user -->|"configures tools"| node_mcp
node_llm -.->|"calls provider"| node_user
node_rag -->|"queries server"| node_user
node_chat_ui -.->|"shows query status"| node_progress

click node_chat_ui "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/Chat.tsx"
click node_stream "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/useChatStreamManager.ts"
click node_response "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/utils/chat/responseGenerator.ts"
click node_progress "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/QueryProgress.tsx"
click node_chat_types "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/types/chat.ts"
click node_plugin "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/main.ts"
click node_settings "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/contexts/settings-context.tsx"
click node_settings_schema "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/settings/schema/setting.types.ts"
click node_db "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/DatabaseManager.ts"
click node_schema "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/schema.ts"
click node_chat_store "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/json/chat/ChatManager.ts"
click node_rag "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/ragEngine.ts"
click node_indexer "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/docIndexService.ts"
click node_file_filters "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/utils/glob-utils.ts"
click node_vectors "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/modules/vector/VectorManager.ts"
click node_graph_view "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/views/NativeGraphView.ts"
click node_llm "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/llm/manager.ts"
click node_mcp "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/mcp/mcpManager.ts"
click node_embedding "https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/embedding.ts"

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_chat_ui,node_stream,node_response,node_progress,node_chat_types,node_user toneBlue
class node_rag,node_indexer,node_file_filters,node_vectors,node_graph_view toneAmber
class node_llm,node_mcp,node_embedding toneMint
class node_plugin,node_settings,node_settings_schema,node_db,node_schema,node_chat_store toneRose
```

## Components

### Chat and answers

- [Chat interface](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/Chat.tsx): `src/components/chat-view/Chat.tsx`
- [Chat stream manager](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/useChatStreamManager.ts): `src/components/chat-view/useChatStreamManager.ts`
- [Response generation](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/utils/chat/responseGenerator.ts): `src/utils/chat/responseGenerator.ts`
- [Query progress](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/components/chat-view/QueryProgress.tsx): `src/components/chat-view/QueryProgress.tsx`
- [Chat messages](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/types/chat.ts): `src/types/chat.ts`

### Vault graph and search

- [LightRAG client](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/ragEngine.ts): `src/core/rag/ragEngine.ts`
- [Vault indexing](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/docIndexService.ts): `src/core/rag/docIndexService.ts`
- [Sync filters](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/utils/glob-utils.ts): `src/utils/glob-utils.ts`
- [Vector manager](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/modules/vector/VectorManager.ts): `src/database/modules/vector/VectorManager.ts`
- [Knowledge graph view](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/views/NativeGraphView.ts): `src/views/NativeGraphView.ts`

### Providers and tools

- [Model provider manager](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/llm/manager.ts): `src/core/llm/manager.ts`
- [MCP manager](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/mcp/mcpManager.ts): `src/core/mcp/mcpManager.ts`
- [Embedding service](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/core/rag/embedding.ts): `src/core/rag/embedding.ts`

### Plugin and data

- [Plugin lifecycle](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/main.ts): `src/main.ts`
- [Settings](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/contexts/settings-context.tsx): `src/contexts/settings-context.tsx`
- [Settings schema](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/settings/schema/setting.types.ts): `src/settings/schema/setting.types.ts`
- [Database manager](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/DatabaseManager.ts): `src/database/DatabaseManager.ts`
- [Database schema](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/schema.ts): `src/database/schema.ts`
- [Chat history store](https://github.com/oscampo/obsidian-neural-composer/blob/main/src/database/json/chat/ChatManager.ts): `src/database/json/chat/ChatManager.ts`

### Other components

- **Vault user**

## Connections

- Vault user → Chat interface: asks questions
- Vault user → Plugin lifecycle: configures server
- Plugin lifecycle → LightRAG client: initializes (evidence: `src/main.ts`)
- Plugin lifecycle → Vault indexing: uses (evidence: `src/main.ts`)
- Plugin lifecycle → Database manager: initializes (evidence: `src/main.ts`)
- Plugin lifecycle → Knowledge graph view: registers view (evidence: `src/main.ts`)
- Plugin lifecycle → MCP manager: uses (evidence: `src/main.ts`)
- Plugin lifecycle → Settings schema: loads (evidence: `src/main.ts`)
- Chat stream manager → Settings: reads (evidence: `src/components/chat-view/useChatStreamManager.ts`)
- Chat stream manager → Model provider manager: selects model (evidence: `src/components/chat-view/useChatStreamManager.ts`)
- Chat stream manager → MCP manager: gets manager (evidence: `src/components/chat-view/useChatStreamManager.ts`)
- Chat stream manager → Response generation: runs (evidence: `src/components/chat-view/useChatStreamManager.ts`)
- Chat interface → Chat stream manager: starts streams
- Chat interface → Chat history store: persists history
- Vault indexing → LightRAG client: submits notes
- LightRAG client → Sync filters: checks exclusions (evidence: `src/core/rag/ragEngine.ts`)
- LightRAG client → Vector manager: uses vectors (evidence: `src/core/rag/ragEngine.ts`)
- Vector manager → Database schema: stores embeddings (evidence: `src/database/modules/vector/VectorManager.ts`)
- Database manager → Vector manager: creates manager (evidence: `src/database/DatabaseManager.ts`)
- Database manager → Database schema: uses schema
- LightRAG client → Embedding service: uses embeddings (evidence: `src/core/rag/ragEngine.ts`)
- Vault user → Knowledge graph view: explores graph
- Vault user → MCP manager: configures tools
- Model provider manager → Vault user: calls provider
- LightRAG client → Vault user: queries server (evidence: `src/core/rag/ragEngine.ts`)
- Chat interface → Query progress: shows query status
