# anurupkumar18/fndr architecture

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

- Interactive diagram: https://gitdiagram.com/anurupkumar18/fndr
- Repository: https://github.com/anurupkumar18/fndr

## Overview

#### Purpose and Runtime Shape
FNDR is a macOS, local-first multimodal memory engine: it converts desktop activity into searchable, structured memories and exposes grounded recall to its UI, mobile companions, and external agents. The primary desktop entry points are the React/Vite frontend at `src/app/main.tsx`, Tauri bootstrap at `src-tauri/src/main.rs`, and backend composition/command registration in `src-tauri/src/lib.rs`.

#### Desktop UI and IPC Boundary
The TypeScript UI is a presentation/client layer; it invokes Tauri commands rather than accessing capture, storage, or models directly. Application shell and workspace orchestration live in `src/app/AppShell.tsx` and `src/app/WorkModeShell.tsx`; memory browsing and graph views are centered in `src/domains/memory-vault/MemoryCardsPanel.tsx` and `src/domains/memory-vault/KnowledgeGraph.tsx`. The Rust IPC boundary is organized by command domain under `src-tauri/src/ipc/commands/mod.rs`, notably memory, retrieval, graph, agent, and companion commands.

#### Capture-to-Memory Pipeline
Desktop capture is macOS-specific and passes through admission, permission, sampling, deduplication, cleanup, and entity extraction before persistence. Its boundary is `src-tauri/src/capture/mod.rs`, with platform capture in `src-tauri/src/capture/macos.rs` and policy/admission controls in `src-tauri/src/capture/admission.rs`. OCR is separate in `src-tauri/src/ocr/`, while privacy checks and blocklists gate sensitive contexts in `src-tauri/src/privacy/safety_gate.rs` and `src-tauri/src/privacy/blocklist.rs`. This pipeline intentionally produces compact records rather than a screenshot archive.

#### Local Intelligence and Persistence
Text is chunked and embedded locally through ONNX/MiniLM paths; image similarity uses CLIP. Core embedding interfaces are in `src-tauri/src/embedding/mod.rs`, `src-tauri/src/embedding/onnx.rs`, and `src-tauri/src/embedding/clip_vision.rs`. LanceDB is the durable local store for memories, vectors, lexical fields, and graph tables, implemented by `src-tauri/src/storage/lance_store/mod.rs` and schemas in `src-tauri/src/storage/lance_store/schemas.rs`. Required/optional model lifecycle is managed in `src-tauri/src/models.rs` and `src-tauri/src/downloads.rs`; models reside in the app-data area, not source control.

#### Retrieval and Grounded Answering
Search runs semantic vector and lexical branches, fuses them, then reranks and shapes memory cards. The core boundary is `src-tauri/src/search/hybrid.rs`, supported by `src-tauri/src/search/reranker.rs` and `src-tauri/src/search/memory_cards.rs`. For `fndr_answer` and agent-ready recall, the context runtime turns a query into retrieval routes and an evidence/context pack before verification and response composition: `src-tauri/src/context_runtime/query_plan.rs`, `src-tauri/src/context_runtime/composer.rs`, and `src-tauri/src/context_runtime/verifier.rs`.

#### Insight Graph and Memory Derivation
Memories can be distilled into insight fields and typed graph entities/relations persisted alongside LanceDB records. Memory transformation is bounded by `src-tauri/src/memory/mod.rs` and `src-tauri/src/memory_insight/derive.rs`. The graph subsystem owns schema, storage/indexing, edges, traversal, projection, and reranking in `src-tauri/src/graph/schema.rs`, `src-tauri/src/graph/graph_store.rs`, and `src-tauri/src/graph/traversal.rs`. Frontend graph adapters/layout/rendering remain separate from backend graph semantics at `src/features/graph/data/adapter.ts` and `src/features/graph/components/KnowledgeGraph3D.tsx`.

#### External and Mobile Interfaces
MCP exposes local memory and agent capabilities over controlled transports; deployment mode, authentication, and TLS are isolated in `src-tauri/src/mcp/mod.rs`, `src-tauri/src/mcp/token.rs`, and `src-tauri/src/mcp/tls.rs`. The desktop companion API has its own auth, pairing, device registry, DTOs, and handlers under `src-tauri/src/companion/mod.rs`, `src-tauri/src/companion/auth.rs`, and `src-tauri/src/companion/handlers/`. iOS and Watch clients consume this boundary through shared Swift networking/pairing abstractions in `apps/ios/FNDRKit/Sources/FNDRKit/CompanionClient.swift` and `apps/ios/FNDRKit/Sources/FNDRKit/PairingFlow.swift`.

#### Operational Boundaries
Rust/Tauri 2, React/TypeScript, Swift/SwiftUI, and Python model sidecars are material runtimes. Python sidecars support agent, TTS, and speech-model execution under `src-tauri/sidecars/`. macOS screen/accessibility permissions, Apple Vision OCR, local ONNX models, LanceDB, and optional MCP tunnel/public networking are the major infrastructure/external-service boundaries.

Main entry points: [`src-tauri/src/ipc/commands/mod.rs`](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/ipc/commands/mod.rs) (Tauri commands), [`src-tauri/src/memory_insight/derive.rs`](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/memory_insight/derive.rs) (Memory derivation), [`src-tauri/src/graph/graph_store.rs`](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/graph/graph_store.rs) (Insight graph), [`src-tauri/src/storage/lance_store/mod.rs`](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/storage/lance_store/mod.rs) (LanceDB store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop UI"]
  node_react_entry["React/Vite entry<br/>frontend entry<br/>[main.tsx]"]
  node_workspace["Workspace shell<br/>UI orchestration<br/>[AppShell.tsx]"]
  node_memory_ui["Memory browsing<br/>UI feature"]
  node_graph_ui["Graph rendering<br/>UI feature"]
  node_tauri_bootstrap{{"Tauri bootstrap<br/>desktop runtime<br/>[main.rs]"}}
  node_backend_composition["Backend composition<br/>Rust application<br/>[lib.rs]"]
  node_ipc_commands{{"Tauri commands<br/>IPC boundary<br/>[mod.rs]"}}
end

subgraph group_capture["Capture &amp; Memory"]
  node_macos_capture["macOS capture<br/>capture source<br/>[macos.rs]"]
  node_capture_admission["Capture admission<br/>pipeline policy<br/>[admission.rs]"]
  node_privacy_gate["Privacy gate<br/>safety policy<br/>[safety_gate.rs]"]
  node_ocr["Apple Vision OCR<br/>text extraction<br/>[mod.rs]"]
  node_memory_derivation["Memory derivation<br/>memory transformation<br/>[derive.rs]"]
end

subgraph group_intelligence["Local Intelligence"]
  node_embedding["Local embeddings<br/>ONNX and CLIP<br/>[mod.rs]"]
  node_model_lifecycle["Model lifecycle<br/>model management<br/>[models.rs]"]
  node_lance_store[("LanceDB store<br/>local database<br/>[mod.rs]")]
  node_python_sidecars["Python sidecars<br/>model runtime<br/>[agent_runner.py]"]
end

subgraph group_retrieval["Retrieval &amp; Graph"]
  node_hybrid_search["Hybrid search<br/>retrieval engine<br/>[hybrid.rs]"]
  node_context_runtime["Grounded context runtime<br/>answering pipeline<br/>[composer.rs]"]
  node_insight_graph["Insight graph<br/>graph subsystem<br/>[graph_store.rs]"]
end

subgraph group_interfaces["External Interfaces"]
  node_mcp{{"MCP service<br/>agent interface<br/>[mod.rs]"}}
  node_companion_api{{"Companion API<br/>mobile interface<br/>[mod.rs]"}}
end

subgraph group_mobile["Mobile"]
  node_ios_clients["iOS and Watch clients<br/>Swift clients"]
end

node_react_entry --> node_workspace
node_workspace --> node_memory_ui
node_workspace --> node_graph_ui
node_memory_ui -->|"invoke"| node_ipc_commands
node_graph_ui -->|"invoke"| node_ipc_commands
node_tauri_bootstrap -->|"starts"| node_backend_composition
node_backend_composition -->|"registers"| node_ipc_commands
node_ipc_commands -->|"capture commands"| node_macos_capture
node_ipc_commands -->|"search commands"| node_hybrid_search
node_ipc_commands -->|"answer commands"| node_context_runtime
node_ipc_commands -->|"graph commands"| node_insight_graph
node_macos_capture -->|"activity frames"| node_capture_admission
node_capture_admission -->|"candidate records"| node_privacy_gate
node_privacy_gate -->|"permitted content"| node_ocr
node_ocr -->|"extracted text"| node_memory_derivation
node_memory_derivation -->|"memory content"| node_embedding
node_embedding -->|"vectors"| node_lance_store
node_memory_derivation -->|"memory records"| node_lance_store
node_memory_derivation -->|"entities and relations"| node_insight_graph
node_insight_graph -->|"graph tables"| node_lance_store
node_model_lifecycle -->|"provisions models"| node_embedding
node_python_sidecars -.->|"uses managed models"| node_model_lifecycle
node_hybrid_search -->|"vector and lexical retrieval"| node_lance_store
node_context_runtime -->|"retrieval routes"| node_hybrid_search
node_context_runtime -->|"graph evidence"| node_insight_graph
node_ipc_commands -->|"agent capabilities"| node_mcp
node_ipc_commands -->|"companion commands"| node_companion_api
node_ios_clients -->|"pair and recall"| node_companion_api

click node_react_entry "https://github.com/anurupkumar18/fndr/blob/main/src/app/main.tsx"
click node_workspace "https://github.com/anurupkumar18/fndr/blob/main/src/app/AppShell.tsx"
click node_memory_ui "https://github.com/anurupkumar18/fndr/blob/main/src/domains/memory-vault/MemoryCardsPanel.tsx"
click node_graph_ui "https://github.com/anurupkumar18/fndr/blob/main/src/features/graph/components/KnowledgeGraph3D.tsx"
click node_tauri_bootstrap "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/main.rs"
click node_backend_composition "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/lib.rs"
click node_ipc_commands "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/ipc/commands/mod.rs"
click node_macos_capture "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/capture/macos.rs"
click node_capture_admission "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/capture/admission.rs"
click node_privacy_gate "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/privacy/safety_gate.rs"
click node_ocr "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/ocr/mod.rs"
click node_memory_derivation "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/memory_insight/derive.rs"
click node_embedding "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/embedding/mod.rs"
click node_model_lifecycle "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/models.rs"
click node_lance_store "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/storage/lance_store/mod.rs"
click node_hybrid_search "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/search/hybrid.rs"
click node_context_runtime "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/context_runtime/composer.rs"
click node_insight_graph "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/graph/graph_store.rs"
click node_mcp "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/mcp/mod.rs"
click node_companion_api "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/companion/mod.rs"
click node_ios_clients "https://github.com/anurupkumar18/fndr/blob/main/apps/ios/FNDRKit/Sources/FNDRKit/CompanionClient.swift"
click node_python_sidecars "https://github.com/anurupkumar18/fndr/blob/main/src-tauri/sidecars/agent_runner.py"

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_react_entry,node_workspace,node_memory_ui,node_graph_ui,node_tauri_bootstrap,node_backend_composition,node_ipc_commands toneBlue
class node_macos_capture,node_capture_admission,node_privacy_gate,node_ocr,node_memory_derivation toneAmber
class node_embedding,node_model_lifecycle,node_lance_store,node_python_sidecars toneMint
class node_hybrid_search,node_context_runtime,node_insight_graph toneRose
class node_mcp,node_companion_api toneIndigo
class node_ios_clients toneTeal
```

## Components

### Desktop UI

- [React/Vite entry](https://github.com/anurupkumar18/fndr/blob/main/src/app/main.tsx): frontend entry · `src/app/main.tsx`
- [Workspace shell](https://github.com/anurupkumar18/fndr/blob/main/src/app/AppShell.tsx): UI orchestration · `src/app/AppShell.tsx`
- [Memory browsing](https://github.com/anurupkumar18/fndr/blob/main/src/domains/memory-vault/MemoryCardsPanel.tsx): UI feature · `src/domains/memory-vault/MemoryCardsPanel.tsx`
- [Graph rendering](https://github.com/anurupkumar18/fndr/blob/main/src/features/graph/components/KnowledgeGraph3D.tsx): UI feature · Adapts backend graph data for 3D presentation. · `src/features/graph/components/KnowledgeGraph3D.tsx`
- [Tauri bootstrap](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/main.rs): desktop runtime · `src-tauri/src/main.rs`
- [Backend composition](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/lib.rs): Rust application · Builds application services and registers commands. · `src-tauri/src/lib.rs`
- [Tauri commands](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/ipc/commands/mod.rs): IPC boundary · Domain commands mediate UI access to local services. · `src-tauri/src/ipc/commands/mod.rs`

### Capture & Memory

- [macOS capture](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/capture/macos.rs): capture source · Screen and accessibility capture under macOS permissions. · `src-tauri/src/capture/macos.rs`
- [Capture admission](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/capture/admission.rs): pipeline policy · Samples, deduplicates, and admits compact activity records. · `src-tauri/src/capture/admission.rs`
- [Privacy gate](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/privacy/safety_gate.rs): safety policy · Blocks sensitive contexts using privacy checks and blocklists. · `src-tauri/src/privacy/safety_gate.rs`
- [Apple Vision OCR](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/ocr/mod.rs): text extraction · `src-tauri/src/ocr/mod.rs`
- [Memory derivation](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/memory_insight/derive.rs): memory transformation · Distills records into insight fields and typed entities. · `src-tauri/src/memory_insight/derive.rs`

### Local Intelligence

- [Local embeddings](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/embedding/mod.rs): ONNX and CLIP · Generates text and image similarity vectors locally. · `src-tauri/src/embedding/mod.rs`
- [Model lifecycle](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/models.rs): model management · Manages required and optional local model downloads. · `src-tauri/src/models.rs`
- [LanceDB store](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/storage/lance_store/mod.rs): local database · Durable memories, vectors, lexical fields, and graph tables. · `src-tauri/src/storage/lance_store/mod.rs`
- [Python sidecars](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/sidecars/agent_runner.py): model runtime · Supports agent, TTS, and speech-model execution. · `src-tauri/sidecars/agent_runner.py`

### Retrieval & Graph

- [Hybrid search](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/search/hybrid.rs): retrieval engine · Fuses semantic and lexical branches, then reranks memory cards. · `src-tauri/src/search/hybrid.rs`
- [Grounded context runtime](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/context_runtime/composer.rs): answering pipeline · Plans retrieval, composes evidence packs, and verifies answers. · `src-tauri/src/context_runtime/composer.rs`
- [Insight graph](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/graph/graph_store.rs): graph subsystem · Stores typed entities and relations and performs traversal. · `src-tauri/src/graph/graph_store.rs`

### External Interfaces

- [MCP service](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/mcp/mod.rs): agent interface · Controlled local memory and agent transport. · `src-tauri/src/mcp/mod.rs`
- [Companion API](https://github.com/anurupkumar18/fndr/blob/main/src-tauri/src/companion/mod.rs): mobile interface · Authenticated pairing, device registry, and companion handlers. · `src-tauri/src/companion/mod.rs`

### Mobile

- [iOS and Watch clients](https://github.com/anurupkumar18/fndr/blob/main/apps/ios/FNDRKit/Sources/FNDRKit/CompanionClient.swift): Swift clients · Pair with and consume the desktop companion boundary. · `apps/ios/FNDRKit/Sources/FNDRKit/CompanionClient.swift`

## Connections

- React/Vite entry → Workspace shell
- Workspace shell → Memory browsing
- Workspace shell → Graph rendering
- Memory browsing → Tauri commands: invoke
- Graph rendering → Tauri commands: invoke
- Tauri bootstrap → Backend composition: starts
- Backend composition → Tauri commands: registers
- Tauri commands → macOS capture: capture commands
- Tauri commands → Hybrid search: search commands
- Tauri commands → Grounded context runtime: answer commands
- Tauri commands → Insight graph: graph commands
- macOS capture → Capture admission: activity frames
- Capture admission → Privacy gate: candidate records
- Privacy gate → Apple Vision OCR: permitted content
- Apple Vision OCR → Memory derivation: extracted text
- Memory derivation → Local embeddings: memory content
- Local embeddings → LanceDB store: vectors
- Memory derivation → LanceDB store: memory records
- Memory derivation → Insight graph: entities and relations
- Insight graph → LanceDB store: graph tables
- Model lifecycle → Local embeddings: provisions models
- Python sidecars → Model lifecycle: uses managed models
- Hybrid search → LanceDB store: vector and lexical retrieval
- Grounded context runtime → Hybrid search: retrieval routes
- Grounded context runtime → Insight graph: graph evidence
- Tauri commands → MCP service: agent capabilities
- Tauri commands → Companion API: companion commands
- iOS and Watch clients → Companion API: pair and recall
