# jeanbrito-dev/mascot_assistent architecture

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

- Interactive diagram: https://gitdiagram.com/jeanbrito-dev/mascot_assistent
- Repository: https://github.com/jeanbrito-dev/mascot_assistent

## Overview

Mascote Assistente Local is a Windows desktop assistant: a user enters a Portuguese command in the mascot UI, deterministic rules interpret it, and the assistant replies or performs a guarded local action; notes and tasks persist in JSON. The tree also contains two substantial Node.js assistant backends: a Socket.IO command server and a modular API/assistant implementation. Those are represented as separate runtime branches rather than treated as part of the README’s Python-only launch workflow. Connections reflect excerpts, indexed references, or README statements; unsampled behavior is not inferred.

Main entry points: [`src/api/index.js`](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/api/index.js) (HTTP and socket API), [`mascot/ui.py`](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/ui.py) (Mascot UI), [`mascot/router.py`](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/router.py) (Command router), [`src/core/assistant/index.js`](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/index.js) (Assistant orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Python desktop assistant"]
  node_ui["Mascot UI<br/>[ui.py]"]
  node_router["Command router<br/>[router.py]"]
  node_knowledge["Command knowledge<br/>[knowledge.py]"]
  node_actions["Safe actions<br/>[actions.py]"]
  node_storage["Local storage<br/>[storage.py]"]
  node_tts["Speech output<br/>[tts.py]"]
  node_desktopdata[("Assistant data")]
end

subgraph group_web["Socket command server"]
  node_socketserver["Socket command server<br/>[server.js]"]
  node_webcommands["Command handlers"]
  node_webpersistence[("Web persistence<br/>[persistence.js]")]
  node_webdata[("Web assistant data")]
end

subgraph group_modular["Modular assistant backend"]
  node_api["HTTP and socket API<br/>[index.js]"]
  node_assistant["Assistant orchestration<br/>[index.js]"]
  node_intent["Fast intent router"]
  node_session["Session context<br/>[session.js]"]
  node_proactive["Proactive engine<br/>[proactive.js]"]
  node_indexer["Local indexer<br/>[index.js]"]
  node_memory[("Assistant persistence<br/>[persistence.js]")]
  node_tools["Assistant tools"]
  node_eventbus["Event bus<br/>[index.js]"]
end

subgraph group_integrations["Local integrations"]
  node_os["Windows system"]
  node_localfiles["Projects and downloads"]
end

node_user(("Desktop user"))
node_webuser(("Web client"))
node_modclient(("API client"))

node_user -->|"enters commands"| node_ui
node_ui -.->|"routes input"| node_router
node_router -->|"executes actions"| node_actions
node_router -->|"reads and writes"| node_storage
node_router -.->|"consults rules"| node_knowledge
node_ui -.->|"uses settings"| node_storage
node_ui -.->|"uses speech"| node_tts
node_storage -->|"persists JSON"| node_desktopdata
node_actions -.->|"controls system"| node_os
node_webuser -->|"sends commands"| node_socketserver
node_socketserver -->|"dispatches handlers"| node_webcommands
node_socketserver -->|"routes API data"| node_webpersistence
node_webcommands -.->|"uses stored data"| node_webpersistence
node_webpersistence -->|"reads and writes"| node_webdata
node_modclient -->|"uses endpoints"| node_api
node_api -->|"routes requests"| node_assistant
node_api -->|"reads and updates"| node_memory
node_api -->|"starts indexing"| node_indexer
node_api -->|"reads session"| node_session
node_api -->|"starts engine"| node_proactive
node_assistant -->|"checks intents"| node_intent
node_assistant -->|"uses context"| node_session
node_assistant -->|"dispatches tools"| node_tools
node_session -->|"emits updates"| node_eventbus
node_proactive -->|"uses events"| node_eventbus
node_proactive -->|"uses persistence"| node_memory
node_indexer -->|"reads configuration"| node_memory
node_indexer -->|"scans files"| node_localfiles

click node_ui "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/ui.py"
click node_router "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/router.py"
click node_knowledge "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/knowledge.py"
click node_actions "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/actions.py"
click node_storage "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/storage.py"
click node_tts "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/tts.py"
click node_socketserver "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/server.js"
click node_webcommands "https://github.com/jeanbrito-dev/mascot_assistent/tree/main/server/commands"
click node_webpersistence "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/server/persistence.js"
click node_api "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/api/index.js"
click node_assistant "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/index.js"
click node_intent "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/fastIntentRouter.js"
click node_session "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/context/session.js"
click node_proactive "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/proactive.js"
click node_indexer "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/indexer/index.js"
click node_memory "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/memory/persistence.js"
click node_tools "https://github.com/jeanbrito-dev/mascot_assistent/tree/main/src/core/tools"
click node_eventbus "https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/eventBus/index.js"

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_ui,node_router,node_knowledge,node_actions,node_storage,node_tts,node_desktopdata,node_user,node_webuser,node_modclient toneBlue
class node_socketserver,node_webcommands,node_webpersistence,node_webdata toneAmber
class node_api,node_assistant,node_intent,node_session,node_proactive,node_indexer,node_memory,node_tools,node_eventbus toneMint
class node_os,node_localfiles toneRose
```

## Components

### Python desktop assistant

- [Mascot UI](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/ui.py): `mascot/ui.py`
- [Command router](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/router.py): `mascot/router.py`
- [Command knowledge](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/knowledge.py): `mascot/knowledge.py`
- [Safe actions](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/actions.py): `mascot/actions.py`
- [Local storage](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/storage.py): `mascot/storage.py`
- [Speech output](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/mascot/tts.py): `mascot/tts.py`
- **Assistant data**

### Socket command server

- [Socket command server](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/server.js): `server.js`
- [Command handlers](https://github.com/jeanbrito-dev/mascot_assistent/tree/main/server/commands): `server/commands`
- [Web persistence](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/server/persistence.js): `server/persistence.js`
- **Web assistant data**

### Modular assistant backend

- [HTTP and socket API](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/api/index.js): `src/api/index.js`
- [Assistant orchestration](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/index.js): `src/core/assistant/index.js`
- [Fast intent router](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/fastIntentRouter.js): `src/core/assistant/fastIntentRouter.js`
- [Session context](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/context/session.js): `src/core/context/session.js`
- [Proactive engine](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/assistant/proactive.js): `src/core/assistant/proactive.js`
- [Local indexer](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/indexer/index.js): `src/core/indexer/index.js`
- [Assistant persistence](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/memory/persistence.js): `src/core/memory/persistence.js`
- [Assistant tools](https://github.com/jeanbrito-dev/mascot_assistent/tree/main/src/core/tools): `src/core/tools`
- [Event bus](https://github.com/jeanbrito-dev/mascot_assistent/blob/main/src/core/eventBus/index.js): `src/core/eventBus/index.js`

### Local integrations

- **Windows system**
- **Projects and downloads**

### Other components

- **Desktop user**
- **Web client**
- **API client**

## Connections

- Desktop user → Mascot UI: enters commands
- Mascot UI → Command router: routes input (evidence: `mascot/ui.py`)
- Command router → Safe actions: executes actions (evidence: `mascot/router.py`)
- Command router → Local storage: reads and writes (evidence: `mascot/router.py`)
- Command router → Command knowledge: consults rules (evidence: `mascot/router.py`)
- Mascot UI → Local storage: uses settings (evidence: `mascot/ui.py`)
- Mascot UI → Speech output: uses speech (evidence: `mascot/ui.py`)
- Local storage → Assistant data: persists JSON (evidence: `mascot/storage.py`)
- Safe actions → Windows system: controls system
- Web client → Socket command server: sends commands (evidence: `server.js`)
- Socket command server → Command handlers: dispatches handlers (evidence: `server.js`)
- Socket command server → Web persistence: routes API data (evidence: `server.js`)
- Command handlers → Web persistence: uses stored data (evidence: `server/commands/productivity.js`)
- Web persistence → Web assistant data: reads and writes (evidence: `server/persistence.js`)
- API client → HTTP and socket API: uses endpoints (evidence: `src/api/index.js`)
- HTTP and socket API → Assistant orchestration: routes requests (evidence: `src/api/index.js`)
- HTTP and socket API → Assistant persistence: reads and updates (evidence: `src/api/index.js`)
- HTTP and socket API → Local indexer: starts indexing (evidence: `src/api/index.js`)
- HTTP and socket API → Session context: reads session (evidence: `src/api/index.js`)
- HTTP and socket API → Proactive engine: starts engine (evidence: `src/api/index.js`)
- Assistant orchestration → Fast intent router: checks intents (evidence: `src/core/assistant/index.js`)
- Assistant orchestration → Session context: uses context (evidence: `src/core/assistant/index.js`)
- Assistant orchestration → Assistant tools: dispatches tools (evidence: `src/core/assistant/index.js`)
- Session context → Event bus: emits updates (evidence: `src/core/context/session.js`)
- Proactive engine → Event bus: uses events (evidence: `src/core/assistant/proactive.js`)
- Proactive engine → Assistant persistence: uses persistence (evidence: `src/core/assistant/proactive.js`)
- Local indexer → Assistant persistence: reads configuration (evidence: `src/core/indexer/index.js`)
- Local indexer → Projects and downloads: scans files (evidence: `src/core/indexer/index.js`)
