# guts-yang/opswarden architecture

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

- Interactive diagram: https://gitdiagram.com/guts-yang/opswarden
- Repository: https://github.com/guts-yang/opswarden

## Overview

OpsWarden is an operations-support platform: employees ask questions in the web app, receive RAG or agent-assisted answers, and can confirm ticket creation when knowledge is insufficient. Operators manage ticket lifecycles and write solutions back into the knowledge base, while administrators manage accounts; analytics provides operational summaries. The map includes the documented two-stage retrieval, chat fallback, persisted agent conversations, and major UI areas. Relationships reflect README or shown source references; unsampled implementation details are represented only at their known directory paths.

Main entry points: [`backend/app/main.py`](https://github.com/guts-yang/opswarden/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/api/client.js`](https://github.com/guts-yang/opswarden/blob/main/frontend/src/api/client.js) (API client), [`backend/app/agent/graph.py`](https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/graph.py) (Agent orchestration), [`backend/app/models/account.py`](https://github.com/guts-yang/opswarden/blob/main/backend/app/models/account.py) (Account records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web_app["Vue application<br/>[App.vue]"]
  node_chat_view["AI chat<br/>[AiChatView.vue]"]
  node_ticket_view["Ticket management<br/>[TicketsView.vue]"]
  node_knowledge_view["Knowledge management"]
  node_account_view["Account management<br/>[AccountsView.vue]"]
  node_dashboard["Dashboard<br/>[DashboardView.vue]"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_api["API and access"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_account_api["Account API<br/>[account.py]"]
  node_ticket_api["Ticket API<br/>[ticket.py]"]
  node_knowledge_api["Knowledge API<br/>[knowledge.py]"]
  node_analytics_api["Analytics API<br/>[analytics.py]"]
  node_access_control["Authentication and roles<br/>[auth.py]"]
  node_chat_api["Chat API<br/>[chat.py]"]
end

subgraph group_assistant["AI assistance"]
  node_chat_workflow["Chat workflow<br/>[chat_workflow.py]"]
  node_agent_graph["Agent orchestration<br/>[graph.py]"]
  node_agent_decision["LLM decisions<br/>[llm.py]"]
  node_agent_tools["Agent tools<br/>[tools.py]"]
  node_chat_pipeline["Fallback chat<br/>[chat_pipeline.py]"]
  node_retrieval["Two-stage retrieval<br/>[retriever.py]"]
  node_embedding["Text embeddings<br/>[embedder.py]"]
  node_rag_model["Answer generation<br/>[llm.py]"]
  node_faq_loader["FAQ loading<br/>[faq_loader.py]"]
  node_agent_trace["Agent trace<br/>[trace.py]"]
  node_checkpointer["Conversation checkpoints<br/>[runtime.py]"]
end

subgraph group_operations["Operations"]
end

subgraph group_persistence["Persistence"]
  node_database[("PostgreSQL and pgvector<br/>[database.py]")]
  node_account_model["Account records<br/>[account.py]"]
  node_ticket_model["Ticket records<br/>[ticket.py]"]
  node_knowledge_model["Knowledge entries and anchors<br/>[knowledge.py]"]
end

node_employee(("Employee"))
node_operator(("Operator"))
node_admin(("Administrator"))
node_local_llm{{"Local model service"}}

node_employee -->|"uses"| node_web_app
node_operator -->|"uses"| node_web_app
node_admin -->|"uses"| node_web_app
node_web_app -->|"renders"| node_chat_view
node_employee -->|"asks"| node_chat_view
node_operator -->|"manages"| node_ticket_view
node_operator -->|"manages"| node_knowledge_view
node_operator -->|"reviews"| node_dashboard
node_admin -->|"manages"| node_account_view
node_chat_view -.->|"requests"| node_api_client
node_ticket_view -.->|"requests"| node_api_client
node_knowledge_view -.->|"requests"| node_api_client
node_account_view -.->|"requests"| node_api_client
node_dashboard -.->|"requests"| node_api_client
node_api_client -.->|"calls"| node_api_app
node_api_app -->|"registers"| node_auth_api
node_api_app -->|"registers"| node_account_api
node_api_app -->|"registers"| node_ticket_api
node_api_app -->|"registers"| node_analytics_api
node_api_app -->|"registers"| node_knowledge_api
node_api_app -->|"registers"| node_chat_api
node_auth_api -->|"queries"| node_account_model
node_access_control -->|"checks"| node_account_model
node_chat_api -->|"invokes"| node_chat_workflow
node_chat_api -->|"falls back"| node_chat_pipeline
node_chat_workflow -.->|"orchestrates"| node_agent_graph
node_agent_graph -.->|"requests decisions"| node_agent_decision
node_agent_graph -.->|"dispatches tools"| node_agent_tools
node_agent_graph -.->|"persists state"| node_checkpointer
node_agent_graph -.->|"records trace"| node_agent_trace
node_agent_decision -->|"requests completion"| node_local_llm
node_chat_pipeline -->|"searches"| node_retrieval
node_chat_pipeline -->|"generates answer"| node_rag_model
node_retrieval -->|"embeds query"| node_embedding
node_retrieval -->|"reads and writes"| node_database
node_chat_pipeline -->|"checks ticket sequence"| node_ticket_model
node_rag_model -.->|"requests completion"| node_local_llm
node_api_app -->|"loads FAQs"| node_faq_loader
node_account_api -->|"manages"| node_account_model
node_ticket_api -->|"manages"| node_ticket_model
node_ticket_api -->|"writes solutions"| node_knowledge_model
node_knowledge_api -->|"manages"| node_knowledge_model
node_knowledge_api -->|"indexes entries"| node_retrieval
node_analytics_api -->|"summarizes"| node_account_model
node_analytics_api -->|"summarizes"| node_ticket_model
node_analytics_api -->|"summarizes"| node_knowledge_model
node_database -->|"stores"| node_account_model
node_database -->|"stores"| node_ticket_model

click node_web_app "https://github.com/guts-yang/opswarden/blob/main/frontend/src/App.vue"
click node_chat_view "https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/AiChatView.vue"
click node_ticket_view "https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/TicketsView.vue"
click node_knowledge_view "https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/KnowledgeBaseView.vue"
click node_account_view "https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/AccountsView.vue"
click node_dashboard "https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/DashboardView.vue"
click node_api_client "https://github.com/guts-yang/opswarden/blob/main/frontend/src/api/client.js"
click node_api_app "https://github.com/guts-yang/opswarden/blob/main/backend/app/main.py"
click node_auth_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/auth.py"
click node_account_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/account.py"
click node_ticket_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/ticket.py"
click node_knowledge_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/knowledge.py"
click node_analytics_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/analytics.py"
click node_access_control "https://github.com/guts-yang/opswarden/blob/main/backend/app/middleware/auth.py"
click node_chat_api "https://github.com/guts-yang/opswarden/blob/main/backend/app/api/chat.py"
click node_chat_workflow "https://github.com/guts-yang/opswarden/blob/main/backend/app/graphs/chat_workflow.py"
click node_agent_graph "https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/graph.py"
click node_agent_decision "https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/llm.py"
click node_agent_tools "https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/tools.py"
click node_chat_pipeline "https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/chat_pipeline.py"
click node_retrieval "https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/retriever.py"
click node_embedding "https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/embedder.py"
click node_rag_model "https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/llm.py"
click node_faq_loader "https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/faq_loader.py"
click node_agent_trace "https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/trace.py"
click node_checkpointer "https://github.com/guts-yang/opswarden/blob/main/backend/app/checkpointer/runtime.py"
click node_database "https://github.com/guts-yang/opswarden/blob/main/backend/app/database.py"
click node_account_model "https://github.com/guts-yang/opswarden/blob/main/backend/app/models/account.py"
click node_ticket_model "https://github.com/guts-yang/opswarden/blob/main/backend/app/models/ticket.py"
click node_knowledge_model "https://github.com/guts-yang/opswarden/blob/main/backend/app/models/knowledge.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_web_app,node_chat_view,node_ticket_view,node_knowledge_view,node_account_view,node_dashboard,node_api_client toneBlue
class node_api_app,node_auth_api,node_account_api,node_ticket_api,node_knowledge_api,node_analytics_api,node_access_control,node_chat_api toneAmber
class node_chat_workflow,node_agent_graph,node_agent_decision,node_agent_tools,node_chat_pipeline,node_retrieval,node_embedding,node_rag_model,node_faq_loader,node_agent_trace,node_checkpointer toneMint
class node_database,node_account_model,node_ticket_model,node_knowledge_model,node_employee,node_operator,node_admin,node_local_llm toneIndigo
```

## Components

### Web client

- [Vue application](https://github.com/guts-yang/opswarden/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [AI chat](https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/AiChatView.vue): `frontend/src/views/AiChatView.vue`
- [Ticket management](https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/TicketsView.vue): `frontend/src/views/TicketsView.vue`
- [Knowledge management](https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/KnowledgeBaseView.vue): `frontend/src/views/KnowledgeBaseView.vue`
- [Account management](https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/AccountsView.vue): `frontend/src/views/AccountsView.vue`
- [Dashboard](https://github.com/guts-yang/opswarden/blob/main/frontend/src/views/DashboardView.vue): `frontend/src/views/DashboardView.vue`
- [API client](https://github.com/guts-yang/opswarden/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### API and access

- [FastAPI application](https://github.com/guts-yang/opswarden/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Account API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/account.py): `backend/app/api/account.py`
- [Ticket API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/ticket.py): `backend/app/api/ticket.py`
- [Knowledge API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/knowledge.py): `backend/app/api/knowledge.py`
- [Analytics API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/analytics.py): `backend/app/api/analytics.py`
- [Authentication and roles](https://github.com/guts-yang/opswarden/blob/main/backend/app/middleware/auth.py): `backend/app/middleware/auth.py`
- [Chat API](https://github.com/guts-yang/opswarden/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`

### AI assistance

- [Chat workflow](https://github.com/guts-yang/opswarden/blob/main/backend/app/graphs/chat_workflow.py): `backend/app/graphs/chat_workflow.py`
- [Agent orchestration](https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/graph.py): `backend/app/agent/graph.py`
- [LLM decisions](https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/llm.py): `backend/app/agent/llm.py`
- [Agent tools](https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/tools.py): `backend/app/agent/tools.py`
- [Fallback chat](https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/chat_pipeline.py): `backend/app/rag/chat_pipeline.py`
- [Two-stage retrieval](https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`
- [Text embeddings](https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/embedder.py): `backend/app/rag/embedder.py`
- [Answer generation](https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/llm.py): `backend/app/rag/llm.py`
- [FAQ loading](https://github.com/guts-yang/opswarden/blob/main/backend/app/rag/faq_loader.py): `backend/app/rag/faq_loader.py`
- [Agent trace](https://github.com/guts-yang/opswarden/blob/main/backend/app/agent/trace.py): `backend/app/agent/trace.py`
- [Conversation checkpoints](https://github.com/guts-yang/opswarden/blob/main/backend/app/checkpointer/runtime.py): `backend/app/checkpointer/runtime.py`

### Persistence

- [PostgreSQL and pgvector](https://github.com/guts-yang/opswarden/blob/main/backend/app/database.py): `backend/app/database.py`
- [Account records](https://github.com/guts-yang/opswarden/blob/main/backend/app/models/account.py): `backend/app/models/account.py`
- [Ticket records](https://github.com/guts-yang/opswarden/blob/main/backend/app/models/ticket.py): `backend/app/models/ticket.py`
- [Knowledge entries and anchors](https://github.com/guts-yang/opswarden/blob/main/backend/app/models/knowledge.py): `backend/app/models/knowledge.py`

### Other components

- **Employee**
- **Operator**
- **Administrator**
- **Local model service**

## Connections

- Employee → Vue application: uses
- Operator → Vue application: uses
- Administrator → Vue application: uses
- Vue application → AI chat: renders (evidence: `frontend/src/App.vue`)
- Employee → AI chat: asks
- Operator → Ticket management: manages
- Operator → Knowledge management: manages
- Operator → Dashboard: reviews
- Administrator → Account management: manages
- AI chat → API client: requests
- Ticket management → API client: requests
- Knowledge management → API client: requests
- Account management → API client: requests
- Dashboard → API client: requests
- API client → FastAPI application: calls
- FastAPI application → Authentication API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Account API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Ticket API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Analytics API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Knowledge API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Chat API: registers (evidence: `backend/app/main.py`)
- Authentication API → Account records: queries (evidence: `backend/app/api/auth.py`)
- Authentication and roles → Account records: checks (evidence: `backend/app/middleware/auth.py`)
- Chat API → Chat workflow: invokes (evidence: `backend/app/api/chat.py`)
- Chat API → Fallback chat: falls back (evidence: `backend/app/api/chat.py`)
- Chat workflow → Agent orchestration: orchestrates
- Agent orchestration → LLM decisions: requests decisions
- Agent orchestration → Agent tools: dispatches tools
- Agent orchestration → Conversation checkpoints: persists state
- Agent orchestration → Agent trace: records trace
- LLM decisions → Local model service: requests completion (evidence: `backend/app/agent/llm.py`)
- Fallback chat → Two-stage retrieval: searches (evidence: `backend/app/rag/chat_pipeline.py`)
- Fallback chat → Answer generation: generates answer (evidence: `backend/app/rag/chat_pipeline.py`)
- Two-stage retrieval → Text embeddings: embeds query (evidence: `backend/app/rag/retriever.py`)
- Two-stage retrieval → PostgreSQL and pgvector: reads and writes (evidence: `backend/app/rag/retriever.py`)
- Fallback chat → Ticket records: checks ticket sequence (evidence: `backend/app/rag/chat_pipeline.py`)
- Answer generation → Local model service: requests completion
- FastAPI application → FAQ loading: loads FAQs (evidence: `backend/app/main.py`)
- Account API → Account records: manages (evidence: `backend/app/api/account.py`)
- Ticket API → Ticket records: manages (evidence: `backend/app/api/ticket.py`)
- Ticket API → Knowledge entries and anchors: writes solutions (evidence: `backend/app/api/ticket.py`)
- Knowledge API → Knowledge entries and anchors: manages (evidence: `backend/app/api/knowledge.py`)
- Knowledge API → Two-stage retrieval: indexes entries (evidence: `backend/app/api/knowledge.py`)
- Analytics API → Account records: summarizes (evidence: `backend/app/api/analytics.py`)
- Analytics API → Ticket records: summarizes (evidence: `backend/app/api/analytics.py`)
- Analytics API → Knowledge entries and anchors: summarizes (evidence: `backend/app/api/analytics.py`)
- PostgreSQL and pgvector → Account records: stores (evidence: `backend/app/models/account.py`)
- PostgreSQL and pgvector → Ticket records: stores (evidence: `backend/app/models/ticket.py`)
