# sastrava/finesse architecture

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

- Interactive diagram: https://gitdiagram.com/sastrava/finesse
- Repository: https://github.com/sastrava/finesse

## Overview

FINESSE is a role-aware AI workspace combining agent orchestration, retrieval over a tenant-scoped knowledge base, consulting workflows, and operator interfaces. A user authenticates and submits a directive; the API routes it to the orchestrator, which selects permitted agents, gathers contextual knowledge, invokes an LLM, and returns a deliverable that may be written to the vault or shared memory. The graph also preserves documented CRM, security-review, SASTRAVA, and live-event capabilities. Some subsystems are represented at directory level because their implementations were not sampled; links are limited to documented or indexed relationships.

Main entry points: [`engine/main.py`](https://github.com/sastrava/finesse/blob/main/engine/main.py) (FastAPI service), [`engine/orchestra/orchestrator.py`](https://github.com/sastrava/finesse/blob/main/engine/orchestra/orchestrator.py) (Directive orchestrator), [`engine/rag/ingest.py`](https://github.com/sastrava/finesse/blob/main/engine/rag/ingest.py) (Knowledge ingestion), [`engine/agents/base.py`](https://github.com/sastrava/finesse/blob/main/engine/agents/base.py) (Agent workers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and API"]
  node_api["FastAPI service<br/>[main.py]"]
  node_identity["Authentication and RBAC<br/>[security.py]"]
  node_tenantdb[("Tenant persistence<br/>[storage.py]")]
end

subgraph group_work["Agent Workflows"]
  node_orchestrator["Directive orchestrator<br/>[orchestrator.py]"]
  node_agent_registry["Agent registry<br/>[registry.py]"]
  node_agent_workers["Agent workers<br/>[base.py]"]
  node_mcp["Tool registry<br/>[base.py]"]
  node_promptguard["Prompt guard<br/>[prompt_guard.py]"]
  node_eventbus["Live event stream<br/>[events.py]"]
end

subgraph group_knowledge["Knowledge and Models"]
  node_rag["RAG retrieval<br/>[retriever.py]"]
  node_ingest["Knowledge ingestion<br/>[ingest.py]"]
  node_vectors[("Vector store<br/>[store.py]")]
  node_embeddings["Embedding service<br/>[embeddings.py]"]
  node_vault["Obsidian vault<br/>[mapper.py]"]
  node_llm["LLM provider<br/>[provider.py]"]
end

subgraph group_consulting["Consulting and Operations"]
  node_conjunction["Review-only plans"]
  node_sastrava["SASTRAVA workflows<br/>[workflows.py]"]
  node_catalog["Service catalog"]
  node_crm["CRM and outreach<br/>[router_v1.py]"]
  node_security["Security review<br/>[toolchain.py]"]
  node_hub["Hub and tenant queues<br/>[hub_api.py]"]
end

subgraph group_interfaces["Operator Interfaces"]
  node_browser["Browser workspace<br/>[workspace.tsx]"]
end

node_user(("Human operator"))
node_model_service{{"Hosted or local LLM"}}

node_user -->|"submits request"| node_api
node_api -->|"authenticates"| node_identity
node_api -->|"routes directive"| node_orchestrator
node_orchestrator -->|"selects agents"| node_agent_registry
node_orchestrator -->|"runs swarm"| node_agent_workers
node_orchestrator -->|"requests context"| node_rag
node_agent_workers -->|"reasons with"| node_llm
node_agent_workers -.->|"uses tools"| node_mcp
node_orchestrator -.->|"guards prompts"| node_promptguard
node_orchestrator -->|"emits events"| node_eventbus
node_api -.->|"serves stream"| node_eventbus
node_ingest -.->|"creates vectors"| node_embeddings
node_ingest -->|"stores chunks"| node_vectors
node_rag -->|"searches vectors"| node_vectors
node_vectors -->|"embeds text"| node_embeddings
node_ingest -.->|"indexes vault notes"| node_vault
node_orchestrator -->|"writes deliverables"| node_vault
node_orchestrator -->|"synthesizes result"| node_llm
node_llm -->|"sends inference"| node_model_service
node_api -->|"persists tenant data"| node_tenantdb
node_api -->|"routes consulting"| node_sastrava
node_sastrava -.->|"uses services"| node_catalog
node_api -.->|"serves CRM"| node_crm
node_api -.->|"exposes planning"| node_conjunction
node_api -.->|"exposes review tools"| node_security
node_api -.->|"serves Hub APIs"| node_hub
node_browser -.->|"calls API"| node_api
node_api -.->|"returns workspace data"| node_browser
node_identity -->|"uses persistence"| node_tenantdb

click node_api "https://github.com/sastrava/finesse/blob/main/engine/main.py"
click node_identity "https://github.com/sastrava/finesse/blob/main/engine/auth/security.py"
click node_tenantdb "https://github.com/sastrava/finesse/blob/main/engine/db/storage.py"
click node_orchestrator "https://github.com/sastrava/finesse/blob/main/engine/orchestra/orchestrator.py"
click node_agent_registry "https://github.com/sastrava/finesse/blob/main/engine/agents/registry.py"
click node_agent_workers "https://github.com/sastrava/finesse/blob/main/engine/agents/base.py"
click node_mcp "https://github.com/sastrava/finesse/blob/main/engine/mcp/base.py"
click node_promptguard "https://github.com/sastrava/finesse/blob/main/engine/prompt_guard.py"
click node_eventbus "https://github.com/sastrava/finesse/blob/main/engine/orchestra/events.py"
click node_rag "https://github.com/sastrava/finesse/blob/main/engine/rag/retriever.py"
click node_ingest "https://github.com/sastrava/finesse/blob/main/engine/rag/ingest.py"
click node_vectors "https://github.com/sastrava/finesse/blob/main/engine/rag/store.py"
click node_embeddings "https://github.com/sastrava/finesse/blob/main/engine/rag/embeddings.py"
click node_vault "https://github.com/sastrava/finesse/blob/main/engine/obsidian/mapper.py"
click node_llm "https://github.com/sastrava/finesse/blob/main/engine/llm/provider.py"
click node_conjunction "https://github.com/sastrava/finesse/blob/main/engine/orchestra/langgraph_conjunction.py"
click node_sastrava "https://github.com/sastrava/finesse/blob/main/engine/sastrava/workflows.py"
click node_catalog "https://github.com/sastrava/finesse/blob/main/engine/sales/services_catalog.py"
click node_crm "https://github.com/sastrava/finesse/blob/main/engine/sales/router_v1.py"
click node_security "https://github.com/sastrava/finesse/blob/main/engine/security/toolchain.py"
click node_hub "https://github.com/sastrava/finesse/blob/main/engine/hub_api.py"
click node_browser "https://github.com/sastrava/finesse/blob/main/frontend/src/workspace.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_api,node_identity,node_tenantdb toneBlue
class node_orchestrator,node_agent_registry,node_agent_workers,node_mcp,node_promptguard,node_eventbus toneAmber
class node_rag,node_ingest,node_vectors,node_embeddings,node_vault,node_llm toneMint
class node_conjunction,node_sastrava,node_catalog,node_crm,node_security,node_hub toneRose
class node_browser,node_user,node_model_service toneIndigo
```

## Components

### Access and API

- [FastAPI service](https://github.com/sastrava/finesse/blob/main/engine/main.py): `engine/main.py`
- [Authentication and RBAC](https://github.com/sastrava/finesse/blob/main/engine/auth/security.py): `engine/auth/security.py`
- [Tenant persistence](https://github.com/sastrava/finesse/blob/main/engine/db/storage.py): `engine/db/storage.py`

### Agent Workflows

- [Directive orchestrator](https://github.com/sastrava/finesse/blob/main/engine/orchestra/orchestrator.py): `engine/orchestra/orchestrator.py`
- [Agent registry](https://github.com/sastrava/finesse/blob/main/engine/agents/registry.py): `engine/agents/registry.py`
- [Agent workers](https://github.com/sastrava/finesse/blob/main/engine/agents/base.py): `engine/agents/base.py`
- [Tool registry](https://github.com/sastrava/finesse/blob/main/engine/mcp/base.py): `engine/mcp/base.py`
- [Prompt guard](https://github.com/sastrava/finesse/blob/main/engine/prompt_guard.py): `engine/prompt_guard.py`
- [Live event stream](https://github.com/sastrava/finesse/blob/main/engine/orchestra/events.py): `engine/orchestra/events.py`

### Knowledge and Models

- [RAG retrieval](https://github.com/sastrava/finesse/blob/main/engine/rag/retriever.py): `engine/rag/retriever.py`
- [Knowledge ingestion](https://github.com/sastrava/finesse/blob/main/engine/rag/ingest.py): `engine/rag/ingest.py`
- [Vector store](https://github.com/sastrava/finesse/blob/main/engine/rag/store.py): `engine/rag/store.py`
- [Embedding service](https://github.com/sastrava/finesse/blob/main/engine/rag/embeddings.py): `engine/rag/embeddings.py`
- [Obsidian vault](https://github.com/sastrava/finesse/blob/main/engine/obsidian/mapper.py): `engine/obsidian/mapper.py`
- [LLM provider](https://github.com/sastrava/finesse/blob/main/engine/llm/provider.py): `engine/llm/provider.py`

### Consulting and Operations

- [Review-only plans](https://github.com/sastrava/finesse/blob/main/engine/orchestra/langgraph_conjunction.py): `engine/orchestra/langgraph_conjunction.py`
- [SASTRAVA workflows](https://github.com/sastrava/finesse/blob/main/engine/sastrava/workflows.py): `engine/sastrava/workflows.py`
- [Service catalog](https://github.com/sastrava/finesse/blob/main/engine/sales/services_catalog.py): `engine/sales/services_catalog.py`
- [CRM and outreach](https://github.com/sastrava/finesse/blob/main/engine/sales/router_v1.py): `engine/sales/router_v1.py`
- [Security review](https://github.com/sastrava/finesse/blob/main/engine/security/toolchain.py): `engine/security/toolchain.py`
- [Hub and tenant queues](https://github.com/sastrava/finesse/blob/main/engine/hub_api.py): `engine/hub_api.py`

### Operator Interfaces

- [Browser workspace](https://github.com/sastrava/finesse/blob/main/frontend/src/workspace.tsx): `frontend/src/workspace.tsx`

### Other components

- **Human operator**
- **Hosted or local LLM**

## Connections

- Human operator → FastAPI service: submits request (evidence: `README.md`)
- FastAPI service → Authentication and RBAC: authenticates (evidence: `engine/main.py`)
- FastAPI service → Directive orchestrator: routes directive (evidence: `engine/main.py`)
- Directive orchestrator → Agent registry: selects agents (evidence: `engine/orchestra/orchestrator.py`)
- Directive orchestrator → Agent workers: runs swarm (evidence: `engine/orchestra/orchestrator.py`)
- Directive orchestrator → RAG retrieval: requests context (evidence: `README.md`)
- Agent workers → LLM provider: reasons with (evidence: `README.md`)
- Agent workers → Tool registry: uses tools
- Directive orchestrator → Prompt guard: guards prompts (evidence: `engine/orchestra/orchestrator.py`)
- Directive orchestrator → Live event stream: emits events (evidence: `engine/orchestra/orchestrator.py`)
- FastAPI service → Live event stream: serves stream (evidence: `README.md`)
- Knowledge ingestion → Embedding service: creates vectors
- Knowledge ingestion → Vector store: stores chunks (evidence: `engine/rag/ingest.py`)
- RAG retrieval → Vector store: searches vectors (evidence: `engine/rag/retriever.py`)
- Vector store → Embedding service: embeds text (evidence: `engine/rag/store.py`)
- Knowledge ingestion → Obsidian vault: indexes vault notes
- Directive orchestrator → Obsidian vault: writes deliverables (evidence: `README.md`)
- Directive orchestrator → LLM provider: synthesizes result (evidence: `engine/orchestra/orchestrator.py`)
- LLM provider → Hosted or local LLM: sends inference (evidence: `engine/llm/provider.py`)
- FastAPI service → Tenant persistence: persists tenant data (evidence: `engine/main.py`)
- FastAPI service → SASTRAVA workflows: routes consulting (evidence: `engine/main.py`)
- SASTRAVA workflows → Service catalog: uses services
- FastAPI service → CRM and outreach: serves CRM (evidence: `engine/main.py`)
- FastAPI service → Review-only plans: exposes planning (evidence: `engine/main.py`)
- FastAPI service → Security review: exposes review tools (evidence: `engine/main.py`)
- FastAPI service → Hub and tenant queues: serves Hub APIs (evidence: `engine/main.py`)
- Browser workspace → FastAPI service: calls API (evidence: `README.md`)
- FastAPI service → Browser workspace: returns workspace data (evidence: `README.md`)
- Authentication and RBAC → Tenant persistence: uses persistence (evidence: `engine/auth/security.py`)
