# siddardha10/cyber_assistant architecture

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

- Interactive diagram: https://gitdiagram.com/siddardha10/cyber_assistant
- Repository: https://github.com/siddardha10/cyber_assistant

## Overview

CyberSentinel is a local Windows monitoring assistant. Its main workflow collects system and security signals into SQLite, then answers user questions through offline matching or LLM-assisted query planning; users can interact through a CLI or API. A separate command path translates natural-language requests into validated actions before execution. The README also describes alerts and optional network monitoring and LLM support. Edges reflect the provided excerpts, source-index references, or README; unsampled connections are omitted where their callers are not evidenced.

Main entry points: [`db/database.py`](https://github.com/siddardha10/cyber_assistant/blob/main/db/database.py) (SQLite access), [`query/llm.py`](https://github.com/siddardha10/cyber_assistant/blob/main/query/llm.py) (LLM query planning), [`commands/translator.py`](https://github.com/siddardha10/cyber_assistant/blob/main/commands/translator.py) (Command translation), [`api/server.py`](https://github.com/siddardha10/cyber_assistant/blob/main/api/server.py) (Web API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_main["App startup<br/>[main.py]"]
  node_cli["CLI chat<br/>[repl.py]"]
  node_api["Web API<br/>[server.py]"]
end

subgraph group_collection["Monitoring and Alerts"]
  node_monitors["System monitors"]
  node_alerts["Alert notifications<br/>[notifier.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("SQLite access<br/>[database.py]")]
  node_schema["Database schema<br/>[schema.py]"]
end

subgraph group_query["Question Answering"]
  node_engine["Query entry point<br/>[engine.py]"]
  node_offline["Offline matching<br/>[offline.py]"]
  node_llm["LLM query planning<br/>[llm.py]"]
  node_sqlguard["SQL validation<br/>[sql_guard.py]"]
  node_webfallback["Web fallback<br/>[web_fallback.py]"]
  node_catalog["Query catalog<br/>[catalog.py]"]
end

subgraph group_commands["Command Execution"]
  node_translator["Command translation<br/>[translator.py]"]
  node_router["Intent routing<br/>[intent_router.py]"]
  node_entity["Entity resolution<br/>[entity_resolver.py]"]
  node_path["Path resolution<br/>[path_resolver.py]"]
  node_templates["Command templates<br/>[templates.py]"]
  node_executor["Command execution<br/>[executor.py]"]
end

node_user(("Local user"))

node_user -->|"asks questions"| node_cli
node_user -->|"asks questions"| node_api
node_main -->|"starts monitors"| node_monitors
node_main -->|"starts CLI"| node_cli
node_main -->|"starts API"| node_api
node_monitors -->|"stores observations"| node_database
node_monitors -.->|"raises alerts"| node_alerts
node_alerts -->|"records alerts"| node_database
node_database -->|"uses schema"| node_schema
node_cli -->|"asks questions"| node_engine
node_api -->|"asks questions"| node_engine
node_engine -->|"tries matching"| node_offline
node_engine -->|"routes fallback"| node_llm
node_engine -->|"logs answers"| node_database
node_llm -->|"reads query data"| node_database
node_llm -->|"validates SQL"| node_sqlguard
node_llm -->|"translates commands"| node_translator
node_llm -->|"executes commands"| node_executor
node_llm -->|"uses fallback"| node_webfallback
node_api -->|"serves suggestions"| node_catalog
node_api -->|"executes approved command"| node_executor
node_translator -->|"routes intent"| node_router
node_translator -->|"resolves entities"| node_entity
node_translator -->|"resolves paths"| node_path
node_translator -->|"selects template"| node_templates
node_translator -->|"stores corrections"| node_database
node_router -->|"retrieves actions"| node_templates
node_executor -->|"logs execution"| node_database
node_executor -->|"loads template"| node_templates

click node_main "https://github.com/siddardha10/cyber_assistant/blob/main/main.py"
click node_cli "https://github.com/siddardha10/cyber_assistant/blob/main/cli/repl.py"
click node_api "https://github.com/siddardha10/cyber_assistant/blob/main/api/server.py"
click node_monitors "https://github.com/siddardha10/cyber_assistant/tree/main/monitors"
click node_alerts "https://github.com/siddardha10/cyber_assistant/blob/main/alerts/notifier.py"
click node_database "https://github.com/siddardha10/cyber_assistant/blob/main/db/database.py"
click node_schema "https://github.com/siddardha10/cyber_assistant/blob/main/db/schema.py"
click node_engine "https://github.com/siddardha10/cyber_assistant/blob/main/query/engine.py"
click node_offline "https://github.com/siddardha10/cyber_assistant/blob/main/query/offline.py"
click node_llm "https://github.com/siddardha10/cyber_assistant/blob/main/query/llm.py"
click node_sqlguard "https://github.com/siddardha10/cyber_assistant/blob/main/query/sql_guard.py"
click node_webfallback "https://github.com/siddardha10/cyber_assistant/blob/main/query/web_fallback.py"
click node_catalog "https://github.com/siddardha10/cyber_assistant/blob/main/query/catalog.py"
click node_translator "https://github.com/siddardha10/cyber_assistant/blob/main/commands/translator.py"
click node_router "https://github.com/siddardha10/cyber_assistant/blob/main/commands/intent_router.py"
click node_entity "https://github.com/siddardha10/cyber_assistant/blob/main/commands/entity_resolver.py"
click node_path "https://github.com/siddardha10/cyber_assistant/blob/main/commands/path_resolver.py"
click node_templates "https://github.com/siddardha10/cyber_assistant/blob/main/commands/templates.py"
click node_executor "https://github.com/siddardha10/cyber_assistant/blob/main/commands/executor.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_main,node_cli,node_api,node_user toneBlue
class node_monitors,node_alerts toneAmber
class node_database,node_schema toneMint
class node_engine,node_offline,node_llm,node_sqlguard,node_webfallback,node_catalog toneRose
class node_translator,node_router,node_entity,node_path,node_templates,node_executor toneIndigo
```

## Components

### User Interfaces

- [App startup](https://github.com/siddardha10/cyber_assistant/blob/main/main.py): `main.py`
- [CLI chat](https://github.com/siddardha10/cyber_assistant/blob/main/cli/repl.py): `cli/repl.py`
- [Web API](https://github.com/siddardha10/cyber_assistant/blob/main/api/server.py): `api/server.py`

### Monitoring and Alerts

- [System monitors](https://github.com/siddardha10/cyber_assistant/tree/main/monitors): `monitors`
- [Alert notifications](https://github.com/siddardha10/cyber_assistant/blob/main/alerts/notifier.py): `alerts/notifier.py`

### Persistence

- [SQLite access](https://github.com/siddardha10/cyber_assistant/blob/main/db/database.py): `db/database.py`
- [Database schema](https://github.com/siddardha10/cyber_assistant/blob/main/db/schema.py): `db/schema.py`

### Question Answering

- [Query entry point](https://github.com/siddardha10/cyber_assistant/blob/main/query/engine.py): `query/engine.py`
- [Offline matching](https://github.com/siddardha10/cyber_assistant/blob/main/query/offline.py): `query/offline.py`
- [LLM query planning](https://github.com/siddardha10/cyber_assistant/blob/main/query/llm.py): `query/llm.py`
- [SQL validation](https://github.com/siddardha10/cyber_assistant/blob/main/query/sql_guard.py): `query/sql_guard.py`
- [Web fallback](https://github.com/siddardha10/cyber_assistant/blob/main/query/web_fallback.py): `query/web_fallback.py`
- [Query catalog](https://github.com/siddardha10/cyber_assistant/blob/main/query/catalog.py): `query/catalog.py`

### Command Execution

- [Command translation](https://github.com/siddardha10/cyber_assistant/blob/main/commands/translator.py): `commands/translator.py`
- [Intent routing](https://github.com/siddardha10/cyber_assistant/blob/main/commands/intent_router.py): `commands/intent_router.py`
- [Entity resolution](https://github.com/siddardha10/cyber_assistant/blob/main/commands/entity_resolver.py): `commands/entity_resolver.py`
- [Path resolution](https://github.com/siddardha10/cyber_assistant/blob/main/commands/path_resolver.py): `commands/path_resolver.py`
- [Command templates](https://github.com/siddardha10/cyber_assistant/blob/main/commands/templates.py): `commands/templates.py`
- [Command execution](https://github.com/siddardha10/cyber_assistant/blob/main/commands/executor.py): `commands/executor.py`

### Other components

- **Local user**

## Connections

- Local user → CLI chat: asks questions (evidence: `README.md`)
- Local user → Web API: asks questions (evidence: `README.md`)
- App startup → System monitors: starts monitors (evidence: `main.py`)
- App startup → CLI chat: starts CLI (evidence: `main.py`)
- App startup → Web API: starts API (evidence: `main.py`)
- System monitors → SQLite access: stores observations (evidence: `monitors/logins.py`)
- System monitors → Alert notifications: raises alerts
- Alert notifications → SQLite access: records alerts (evidence: `alerts/notifier.py`)
- SQLite access → Database schema: uses schema (evidence: `db/database.py`)
- CLI chat → Query entry point: asks questions (evidence: `cli/repl.py`)
- Web API → Query entry point: asks questions (evidence: `api/server.py`)
- Query entry point → Offline matching: tries matching (evidence: `query/engine.py`)
- Query entry point → LLM query planning: routes fallback (evidence: `query/engine.py`)
- Query entry point → SQLite access: logs answers (evidence: `query/engine.py`)
- LLM query planning → SQLite access: reads query data (evidence: `query/llm.py`)
- LLM query planning → SQL validation: validates SQL (evidence: `query/llm.py`)
- LLM query planning → Command translation: translates commands (evidence: `query/llm.py`)
- LLM query planning → Command execution: executes commands (evidence: `query/llm.py`)
- LLM query planning → Web fallback: uses fallback (evidence: `query/llm.py`)
- Web API → Query catalog: serves suggestions (evidence: `api/server.py`)
- Web API → Command execution: executes approved command (evidence: `api/server.py`)
- Command translation → Intent routing: routes intent (evidence: `commands/translator.py`)
- Command translation → Entity resolution: resolves entities (evidence: `commands/translator.py`)
- Command translation → Path resolution: resolves paths (evidence: `commands/translator.py`)
- Command translation → Command templates: selects template (evidence: `commands/translator.py`)
- Command translation → SQLite access: stores corrections (evidence: `commands/translator.py`)
- Intent routing → Command templates: retrieves actions (evidence: `commands/intent_router.py`)
- Command execution → SQLite access: logs execution (evidence: `commands/executor.py`)
- Command execution → Command templates: loads template (evidence: `commands/executor.py`)
