# sterlingtrustees/internal-knowledge-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/sterlingtrustees/internal-knowledge-assistant
- Repository: https://github.com/sterlingtrustees/internal-knowledge-assistant

## Overview

Trust Intelligence is an internal assistant for trust officers. Users authenticate, ask trust/entity questions, and receive Box AI answers with citations; separate workflows extract and review uploaded documents, compare them with Salesforce, generate summaries, and manage tasks. The frontend calls a FastAPI backend, which resolves entities and coordinates Box, Salesforce, and AI services. The README documents the offline Box Hub ingestion pipeline as a companion capability. Some route and agent internals were not excerpted, so uncertain implementation links are omitted.

Main entry points: [`Frontend/src/api/client.ts`](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/api/client.ts) (API client), [`Frontend/src/App.tsx`](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/App.tsx) (Agent interface), [`FastApi/app/routes/docreview.py`](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/docreview.py) (Review endpoints), [`FastApi/app/main.py`](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Agent interface<br/>[App.tsx]"]
  node_conversation["Question workflow<br/>[useConversation.ts]"]
  node_docui["Document review UI<br/>[DocReview.tsx]"]
  node_taskui["Task board UI<br/>[TasksBoard.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
end

subgraph group_api["Backend API"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_ask_route["Ask endpoint<br/>[ask.py]"]
  node_review_route["Review endpoints<br/>[docreview.py]"]
  node_summary_route["Summary endpoints<br/>[summary.py]"]
  node_tasks_route["Task endpoints<br/>[tasks.py]"]
end

subgraph group_agents["Assistant workflows"]
  node_registry[("Entity registry<br/>[entity_registry.py]")]
  node_resolver["Trust resolver<br/>[resolver.py]"]
  node_orchestrator["Tool-use orchestrator<br/>[orchestrator.py]"]
  node_extractor["Document extraction<br/>[extractor.py]"]
  node_comparator["Review comparison<br/>[comparator.py]"]
  node_summarizer["Document summary<br/>[summarizer.py]"]
end

subgraph group_integrations["Data integrations"]
  node_entra["Microsoft Entra"]
  node_box["Box AI and Hubs<br/>[box_service.py]"]
  node_salesforce["Salesforce records"]
  node_tasks_service[("Task storage<br/>[tasks_service.py]")]
end

subgraph group_ingest["Hub preparation"]
  node_hub_pipeline["Hub ingestion pipeline<br/>[build_hub.py]"]
  node_inclusion["Document inclusion rules"]
end

node_officer(("Trust officer"))

node_officer -->|"uses"| node_frontend
node_frontend -->|"hosts"| node_conversation
node_frontend -->|"hosts"| node_docui
node_frontend -.->|"calls"| node_api_client
node_api_client -->|"gets token"| node_entra
node_api_client -->|"requests"| node_ask_route
node_api_client -->|"requests"| node_review_route
node_api_client -->|"requests"| node_summary_route
node_taskui -.->|"requests"| node_tasks_route
node_fastapi -->|"configures"| node_auth
node_officer -->|"signs in"| node_entra
node_fastapi -->|"mounts routes"| node_ask_route
node_ask_route -->|"delegates"| node_orchestrator
node_orchestrator -->|"resolves trust"| node_resolver
node_orchestrator -->|"queries hubs"| node_box
node_ask_route -->|"returns citations"| node_box
node_fastapi -->|"mounts routes"| node_review_route
node_review_route -->|"extracts fields"| node_extractor
node_review_route -->|"compares reviews"| node_comparator
node_docui -->|"uploads documents"| node_api_client
node_review_route -.->|"reads or writes"| node_salesforce
node_frontend -.->|"opens summaries"| node_summary_route
node_summary_route -.->|"generates summaries"| node_summarizer
node_summary_route -.->|"stores summary"| node_box
node_fastapi -->|"mounts routes"| node_tasks_route
node_tasks_route -->|"delegates"| node_tasks_service
node_taskui -->|"polls and updates"| node_tasks_route
node_hub_pipeline -.->|"uses rules"| node_inclusion
node_hub_pipeline -->|"builds hubs"| node_box
node_hub_pipeline -->|"publishes registry"| node_registry

click node_frontend "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/App.tsx"
click node_conversation "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/hooks/useConversation.ts"
click node_docui "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/components/DocReview.tsx"
click node_taskui "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/components/TasksBoard.tsx"
click node_api_client "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/api/client.ts"
click node_fastapi "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/main.py"
click node_auth "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/auth.py"
click node_ask_route "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/ask.py"
click node_review_route "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/docreview.py"
click node_summary_route "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/summary.py"
click node_tasks_route "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/tasks.py"
click node_registry "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/registry/entity_registry.py"
click node_resolver "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/registry/resolver.py"
click node_orchestrator "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/orchestration/orchestrator.py"
click node_extractor "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/extractor.py"
click node_comparator "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/comparator.py"
click node_summarizer "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/summarizer.py"
click node_box "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/box_service.py"
click node_salesforce "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/salesforce_service.py"
click node_tasks_service "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/tasks_service.py"
click node_hub_pipeline "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Ingest/build_hub.py"
click node_inclusion "https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Ingest/inclusion_policy.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_frontend,node_conversation,node_docui,node_taskui,node_api_client toneBlue
class node_fastapi,node_auth,node_ask_route,node_review_route,node_summary_route,node_tasks_route toneAmber
class node_registry,node_resolver,node_orchestrator,node_extractor,node_comparator,node_summarizer toneMint
class node_entra,node_box,node_salesforce,node_tasks_service toneRose
class node_hub_pipeline,node_inclusion,node_officer toneIndigo
```

## Components

### User interface

- [Agent interface](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/App.tsx): `Frontend/src/App.tsx`
- [Question workflow](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/hooks/useConversation.ts): `Frontend/src/hooks/useConversation.ts`
- [Document review UI](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/components/DocReview.tsx): `Frontend/src/components/DocReview.tsx`
- [Task board UI](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/components/TasksBoard.tsx): `Frontend/src/components/TasksBoard.tsx`
- [API client](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Frontend/src/api/client.ts): `Frontend/src/api/client.ts`

### Backend API

- [FastAPI application](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/main.py): `FastApi/app/main.py`
- [Authentication](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/auth.py): `FastApi/app/auth.py`
- [Ask endpoint](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/ask.py): `FastApi/app/routes/ask.py`
- [Review endpoints](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/docreview.py): `FastApi/app/routes/docreview.py`
- [Summary endpoints](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/summary.py): `FastApi/app/routes/summary.py`
- [Task endpoints](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/routes/tasks.py): `FastApi/app/routes/tasks.py`

### Assistant workflows

- [Entity registry](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/registry/entity_registry.py): `FastApi/app/registry/entity_registry.py`
- [Trust resolver](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/registry/resolver.py): `FastApi/app/registry/resolver.py`
- [Tool-use orchestrator](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/orchestration/orchestrator.py): `FastApi/app/orchestration/orchestrator.py`
- [Document extraction](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/extractor.py): `FastApi/app/docreview/extractor.py`
- [Review comparison](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/comparator.py): `FastApi/app/docreview/comparator.py`
- [Document summary](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/docreview/summarizer.py): `FastApi/app/docreview/summarizer.py`

### Data integrations

- **Microsoft Entra**
- [Box AI and Hubs](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/box_service.py): `FastApi/app/services/box_service.py`
- [Salesforce records](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/salesforce_service.py): `FastApi/app/services/salesforce_service.py`
- [Task storage](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/FastApi/app/services/tasks_service.py): `FastApi/app/services/tasks_service.py`

### Hub preparation

- [Hub ingestion pipeline](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Ingest/build_hub.py): `Ingest/build_hub.py`
- [Document inclusion rules](https://github.com/sterlingtrustees/internal-knowledge-assistant/blob/main/Ingest/inclusion_policy.py): `Ingest/inclusion_policy.py`

### Other components

- **Trust officer**

## Connections

- Trust officer → Agent interface: uses (evidence: `README.md`)
- Agent interface → Question workflow: hosts (evidence: `Frontend/src/App.tsx`)
- Agent interface → Document review UI: hosts (evidence: `Frontend/src/App.tsx`)
- Agent interface → API client: calls
- API client → Microsoft Entra: gets token (evidence: `Frontend/src/api/client.ts`)
- API client → Ask endpoint: requests (evidence: `Frontend/src/api/client.ts`)
- API client → Review endpoints: requests (evidence: `Frontend/src/api/client.ts`)
- API client → Summary endpoints: requests (evidence: `Frontend/src/api/client.ts`)
- Task board UI → Task endpoints: requests
- FastAPI application → Authentication: configures (evidence: `FastApi/app/main.py`)
- Trust officer → Microsoft Entra: signs in (evidence: `README.md`)
- FastAPI application → Ask endpoint: mounts routes (evidence: `FastApi/app/main.py`)
- Ask endpoint → Tool-use orchestrator: delegates
- Tool-use orchestrator → Trust resolver: resolves trust (evidence: `FastApi/app/orchestration/orchestrator.py`)
- Tool-use orchestrator → Box AI and Hubs: queries hubs (evidence: `README.md`)
- Ask endpoint → Box AI and Hubs: returns citations (evidence: `README.md`)
- FastAPI application → Review endpoints: mounts routes (evidence: `FastApi/app/main.py`)
- Review endpoints → Document extraction: extracts fields (evidence: `FastApi/app/routes/docreview.py`)
- Review endpoints → Review comparison: compares reviews (evidence: `FastApi/app/routes/docreview.py`)
- Document review UI → API client: uploads documents (evidence: `Frontend/src/components/DocReview.tsx`)
- Review endpoints → Salesforce records: reads or writes
- Agent interface → Summary endpoints: opens summaries
- Summary endpoints → Document summary: generates summaries
- Summary endpoints → Box AI and Hubs: stores summary
- FastAPI application → Task endpoints: mounts routes (evidence: `FastApi/app/main.py`)
- Task endpoints → Task storage: delegates (evidence: `FastApi/app/routes/tasks.py`)
- Task board UI → Task endpoints: polls and updates
- Hub ingestion pipeline → Document inclusion rules: uses rules
- Hub ingestion pipeline → Box AI and Hubs: builds hubs (evidence: `README.md`)
- Hub ingestion pipeline → Entity registry: publishes registry (evidence: `README.md`)
