# samarth3394/smart-company-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/samarth3394/smart-company-assistant
- Repository: https://github.com/samarth3394/smart-company-assistant

## Overview

Nexora is a CLI support assistant whose main workflow accepts a question, routes it to document-based answering, live status lookup, or ticket creation, then reviews the answer and may retry once. A separate ingestion workflow builds the FAISS index used by RAG. The graph also retains conversation state per thread. The graph, CLI, ingestion, and supporting modules are excerpted; connections for documented capabilities are cited to the README where appropriate.

Main entry points: [`src/graph.py`](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py) (Question router), [`src/config.py`](https://github.com/samarth3394/smart-company-assistant/blob/main/src/config.py) (Model configuration), [`src/ingest.py`](https://github.com/samarth3394/smart-company-assistant/blob/main/src/ingest.py) (Document ingestion), [`src/rag_chain.py`](https://github.com/samarth3394/smart-company-assistant/blob/main/src/rag_chain.py) (Retrieval chain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Chat entry"]
  node_cli["Chat CLI<br/>[main.py]"]
end

subgraph group_workflow["Agent workflow"]
  node_graph["Workflow graph<br/>[graph.py]"]
  node_router["Question router<br/>[graph.py]"]
  node_review["Answer review<br/>[graph.py]"]
  node_rag["RAG answering<br/>[graph.py]"]
  node_toolflow["Tool answering<br/>[graph.py]"]
  node_ticket["Ticket extraction<br/>[graph.py]"]
  node_memory[("Conversation memory<br/>[graph.py]")]
end

subgraph group_knowledge["Document knowledge"]
  node_ingest["Document ingestion<br/>[ingest.py]"]
  node_hr["HR policy<br/>[hr_policy.md]"]
  node_faq["Product FAQ<br/>[product_faq.md]"]
  node_index[("FAISS index<br/>[ingest.py]")]
  node_ragchain["Retrieval chain<br/>[rag_chain.py]"]
end

subgraph group_services["Models and tools"]
  node_prompts["Prompt templates<br/>[prompts.py]"]
  node_schema["Ticket schema<br/>[schemas.py]"]
  node_tools["Status lookup tools<br/>[tools.py]"]
  node_config["Model configuration<br/>[config.py]"]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}

node_user -->|"asks"| node_cli
node_cli -->|"invokes"| node_graph
node_graph -->|"starts at"| node_router
node_router -->|"routes RAG"| node_rag
node_router -->|"routes tools"| node_toolflow
node_router -->|"routes ticket"| node_ticket
node_rag -->|"sends answer"| node_review
node_toolflow -->|"sends answer"| node_review
node_ticket -->|"sends answer"| node_review
node_review -->|"retries once"| node_router
node_graph -->|"configures"| node_memory
node_ingest -->|"loads"| node_hr
node_ingest -->|"loads"| node_faq
node_ingest -->|"builds and saves"| node_index
node_rag -->|"invokes"| node_ragchain
node_ragchain -->|"retrieves from"| node_index
node_ragchain -->|"uses RAG prompt"| node_prompts
node_router -->|"uses router prompt"| node_prompts
node_toolflow -->|"uses tool prompt"| node_prompts
node_ticket -->|"uses ticket prompt"| node_prompts
node_ticket -->|"extracts to"| node_schema
node_toolflow -->|"invokes tools"| node_tools
node_config -->|"initializes models"| node_gemini
node_router -->|"calls model"| node_config
node_toolflow -->|"calls model"| node_config
node_ticket -->|"calls model"| node_config
node_ragchain -->|"uses model and embeddings"| node_config
node_ingest -->|"uses embeddings"| node_config

click node_cli "https://github.com/samarth3394/smart-company-assistant/blob/main/src/main.py"
click node_graph "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_router "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_review "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_rag "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_toolflow "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_ticket "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_memory "https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py"
click node_ingest "https://github.com/samarth3394/smart-company-assistant/blob/main/src/ingest.py"
click node_hr "https://github.com/samarth3394/smart-company-assistant/blob/main/data/hr_policy.md"
click node_faq "https://github.com/samarth3394/smart-company-assistant/blob/main/data/product_faq.md"
click node_index "https://github.com/samarth3394/smart-company-assistant/blob/main/src/ingest.py"
click node_ragchain "https://github.com/samarth3394/smart-company-assistant/blob/main/src/rag_chain.py"
click node_prompts "https://github.com/samarth3394/smart-company-assistant/blob/main/src/prompts.py"
click node_schema "https://github.com/samarth3394/smart-company-assistant/blob/main/src/schemas.py"
click node_tools "https://github.com/samarth3394/smart-company-assistant/blob/main/src/tools.py"
click node_config "https://github.com/samarth3394/smart-company-assistant/blob/main/src/config.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_cli,node_user toneBlue
class node_graph,node_router,node_review,node_rag,node_toolflow,node_ticket,node_memory toneAmber
class node_ingest,node_hr,node_faq,node_index,node_ragchain toneMint
class node_prompts,node_schema,node_tools,node_config toneRose
class node_gemini toneIndigo
```

## Components

### Chat entry

- [Chat CLI](https://github.com/samarth3394/smart-company-assistant/blob/main/src/main.py): `src/main.py`

### Agent workflow

- [Workflow graph](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [Question router](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [Answer review](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [RAG answering](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [Tool answering](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [Ticket extraction](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`
- [Conversation memory](https://github.com/samarth3394/smart-company-assistant/blob/main/src/graph.py): `src/graph.py`

### Document knowledge

- [Document ingestion](https://github.com/samarth3394/smart-company-assistant/blob/main/src/ingest.py): `src/ingest.py`
- [HR policy](https://github.com/samarth3394/smart-company-assistant/blob/main/data/hr_policy.md): `data/hr_policy.md`
- [Product FAQ](https://github.com/samarth3394/smart-company-assistant/blob/main/data/product_faq.md): `data/product_faq.md`
- [FAISS index](https://github.com/samarth3394/smart-company-assistant/blob/main/src/ingest.py): `src/ingest.py`
- [Retrieval chain](https://github.com/samarth3394/smart-company-assistant/blob/main/src/rag_chain.py): `src/rag_chain.py`

### Models and tools

- [Prompt templates](https://github.com/samarth3394/smart-company-assistant/blob/main/src/prompts.py): `src/prompts.py`
- [Ticket schema](https://github.com/samarth3394/smart-company-assistant/blob/main/src/schemas.py): `src/schemas.py`
- [Status lookup tools](https://github.com/samarth3394/smart-company-assistant/blob/main/src/tools.py): `src/tools.py`
- [Model configuration](https://github.com/samarth3394/smart-company-assistant/blob/main/src/config.py): `src/config.py`

### Other components

- **User**
- **Google Gemini**

## Connections

- User → Chat CLI: asks (evidence: `src/main.py`)
- Chat CLI → Workflow graph: invokes (evidence: `src/main.py`)
- Workflow graph → Question router: starts at (evidence: `src/graph.py`)
- Question router → RAG answering: routes RAG (evidence: `src/graph.py`)
- Question router → Tool answering: routes tools (evidence: `src/graph.py`)
- Question router → Ticket extraction: routes ticket (evidence: `src/graph.py`)
- RAG answering → Answer review: sends answer (evidence: `src/graph.py`)
- Tool answering → Answer review: sends answer (evidence: `src/graph.py`)
- Ticket extraction → Answer review: sends answer (evidence: `src/graph.py`)
- Answer review → Question router: retries once (evidence: `src/graph.py`)
- Workflow graph → Conversation memory: configures (evidence: `src/graph.py`)
- Document ingestion → HR policy: loads (evidence: `src/ingest.py`)
- Document ingestion → Product FAQ: loads (evidence: `src/ingest.py`)
- Document ingestion → FAISS index: builds and saves (evidence: `src/ingest.py`)
- RAG answering → Retrieval chain: invokes (evidence: `src/graph.py`)
- Retrieval chain → FAISS index: retrieves from (evidence: `src/rag_chain.py`)
- Retrieval chain → Prompt templates: uses RAG prompt (evidence: `src/rag_chain.py`)
- Question router → Prompt templates: uses router prompt (evidence: `src/graph.py`)
- Tool answering → Prompt templates: uses tool prompt (evidence: `src/graph.py`)
- Ticket extraction → Prompt templates: uses ticket prompt (evidence: `src/graph.py`)
- Ticket extraction → Ticket schema: extracts to (evidence: `src/graph.py`)
- Tool answering → Status lookup tools: invokes tools (evidence: `src/graph.py`)
- Model configuration → Google Gemini: initializes models (evidence: `src/config.py`)
- Question router → Model configuration: calls model (evidence: `src/graph.py`)
- Tool answering → Model configuration: calls model (evidence: `src/graph.py`)
- Ticket extraction → Model configuration: calls model (evidence: `src/graph.py`)
- Retrieval chain → Model configuration: uses model and embeddings (evidence: `src/rag_chain.py`)
- Document ingestion → Model configuration: uses embeddings (evidence: `src/ingest.py`)
