# hemanth-codecrafter/project-ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/hemanth-codecrafter/project-ai-assistant
- Repository: https://github.com/hemanth-codecrafter/project-ai-assistant

## Overview

Jarvis is a personal AI assistant with text, voice, and HTTP entry points. Its main workflow sends a command through CommandProcessor, which applies memory/context handling and routes recognized intents to actions; commands needing a language-model response go through Brain and provider selection. Voice mode adds wake-word detection, recording, speech recognition, and spoken output. Long-term memories use SQLite, while conversation history and context support follow-ups. The README documents only an extensible assistant, so feature detail comes from the shown source and index; unsampled capabilities and uncertain connections are omitted.

Main entry points: [`core/memory_service.py`](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_service.py) (Memory coordinator), [`main.py`](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/main.py) (Assistant runtime), [`services/command_processor.py`](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/services/command_processor.py) (Command processor), [`core/router.py`](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/router.py) (Intent router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Input and API"]
  node_main["Assistant runtime<br/>[main.py]"]
  node_api["HTTP API<br/>[api.py]"]
  node_server["Server entry<br/>[server.py]"]
end

subgraph group_orchestration["Command handling"]
  node_processor["Command processor"]
end

subgraph group_intelligence["Intent and response"]
  node_router["Intent router<br/>[router.py]"]
  node_classifier["Intent classifier"]
  node_actions["Assistant actions<br/>[actions.py]"]
  node_device["Device actions<br/>[device_actions.py]"]
  node_device_manager["Device manager<br/>[device_manager.py]"]
  node_brain["Language-model brain<br/>[brain.py]"]
  node_providers["Provider selection"]
  node_provider_base["Provider interface<br/>[base_provider.py]"]
  node_gemini["Gemini provider<br/>[gemini_provider.py]"]
  node_groq["Groq provider<br/>[groq_provider.py]"]
  node_openrouter["OpenRouter provider"]
end

subgraph group_memory["Memory"]
  node_context["Context manager<br/>[context_manager.py]"]
  node_memory_service["Memory coordinator<br/>[memory_service.py]"]
  node_conversation["Conversation history"]
  node_memory_manager["Memory manager<br/>[memory_manager.py]"]
  node_extractor["Memory extractor"]
  node_retrieval["Memory retrieval"]
  node_ranker["Memory ranker<br/>[memory_ranker.py]"]
  node_updater["Memory updates<br/>[memory_update.py]"]
  node_record["Memory record<br/>[memory_record.py]"]
  node_memory_db[("SQLite memory store<br/>[memory_db.py]")]
end

subgraph group_voice["Voice I/O"]
  node_wake["Wake-word detector<br/>[wake_word.py]"]
  node_recorder["Audio recorder<br/>[recorder.py]"]
  node_stt["Speech recognition<br/>[stt.py]"]
  node_tts["Speech output<br/>[tts.py]"]
end

node_user(("User"))

node_user -->|"speaks or types"| node_main
node_main -->|"listens for trigger"| node_wake
node_main -->|"records audio"| node_recorder
node_main -->|"transcribes audio"| node_stt
node_main -->|"processes command"| node_processor
node_main -->|"speaks response"| node_tts
node_api -->|"processes request"| node_processor
node_server -->|"uses processor"| node_processor
node_processor -->|"routes command"| node_router
node_processor -->|"requests response"| node_brain
node_processor -->|"coordinates memory"| node_memory_service
node_router -->|"classifies command"| node_classifier
node_router -->|"executes intent"| node_actions
node_router -->|"gets active device"| node_device_manager
node_router -->|"dispatches device action"| node_device
node_brain -->|"selects provider"| node_providers
node_providers -->|"tries provider"| node_gemini
node_providers -->|"falls back"| node_groq
node_providers -->|"registers provider"| node_openrouter
node_gemini -->|"implements interface"| node_provider_base
node_groq -->|"implements interface"| node_provider_base
node_openrouter -->|"implements interface"| node_provider_base
node_memory_service -->|"reads and updates"| node_context
node_memory_service -->|"stores turns"| node_conversation
node_memory_service -->|"searches and forgets"| node_memory_manager
node_memory_service -->|"extracts memories"| node_extractor
node_memory_service -->|"retrieves relevant"| node_retrieval
node_memory_service -->|"configures ranking"| node_ranker
node_memory_service -->|"resolves updates"| node_updater
node_memory_service -->|"saves and retrieves"| node_memory_db
node_memory_manager -->|"searches and saves"| node_memory_db
node_memory_manager -->|"constructs record"| node_record
node_memory_db -->|"accepts record"| node_record

click node_main "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/main.py"
click node_api "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/api.py"
click node_server "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/server.py"
click node_processor "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/services/command_processor.py"
click node_router "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/router.py"
click node_classifier "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/intent_classifier.py"
click node_actions "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/actions.py"
click node_device "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/device_actions.py"
click node_device_manager "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/device_manager.py"
click node_brain "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/brain.py"
click node_providers "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/provider_manager.py"
click node_provider_base "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/base_provider.py"
click node_gemini "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/gemini_provider.py"
click node_groq "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/groq_provider.py"
click node_openrouter "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/openrouter_provider.py"
click node_context "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/context_manager.py"
click node_memory_service "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_service.py"
click node_conversation "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/conversation_memory.py"
click node_memory_manager "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_manager.py"
click node_extractor "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_extractor.py"
click node_retrieval "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_retrieval.py"
click node_ranker "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_ranker.py"
click node_updater "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_update.py"
click node_record "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_record.py"
click node_memory_db "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_db.py"
click node_wake "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/wake_word.py"
click node_recorder "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/recorder.py"
click node_stt "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/stt.py"
click node_tts "https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/tts.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_api,node_server,node_user toneBlue
class node_processor toneAmber
class node_router,node_classifier,node_actions,node_device,node_device_manager,node_brain,node_providers,node_provider_base,node_gemini,node_groq,node_openrouter toneMint
class node_context,node_memory_service,node_conversation,node_memory_manager,node_extractor,node_retrieval,node_ranker,node_updater,node_record,node_memory_db toneRose
class node_wake,node_recorder,node_stt,node_tts toneIndigo
```

## Components

### Input and API

- [Assistant runtime](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/main.py): `main.py`
- [HTTP API](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/api.py): `api.py`
- [Server entry](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/server.py): `server.py`

### Command handling

- [Command processor](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/services/command_processor.py): `services/command_processor.py`

### Intent and response

- [Intent router](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/router.py): `core/router.py`
- [Intent classifier](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/intent_classifier.py): `core/intent_classifier.py`
- [Assistant actions](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/actions.py): `core/actions.py`
- [Device actions](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/device_actions.py): `core/device_actions.py`
- [Device manager](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/device_manager.py): `core/device_manager.py`
- [Language-model brain](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/brain.py): `core/brain.py`
- [Provider selection](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/provider_manager.py): `core/provider_manager.py`
- [Provider interface](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/base_provider.py): `core/providers/base_provider.py`
- [Gemini provider](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/gemini_provider.py): `core/providers/gemini_provider.py`
- [Groq provider](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/groq_provider.py): `core/providers/groq_provider.py`
- [OpenRouter provider](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/providers/openrouter_provider.py): `core/providers/openrouter_provider.py`

### Memory

- [Context manager](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/context_manager.py): `core/context_manager.py`
- [Memory coordinator](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_service.py): `core/memory_service.py`
- [Conversation history](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/conversation_memory.py): `core/conversation_memory.py`
- [Memory manager](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_manager.py): `core/memory_manager.py`
- [Memory extractor](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_extractor.py): `core/memory_extractor.py`
- [Memory retrieval](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_retrieval.py): `core/memory_retrieval.py`
- [Memory ranker](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_ranker.py): `core/memory_ranker.py`
- [Memory updates](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_update.py): `core/memory_update.py`
- [Memory record](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_record.py): `core/memory_record.py`
- [SQLite memory store](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/memory_db.py): `core/memory_db.py`

### Voice I/O

- [Wake-word detector](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/wake_word.py): `core/wake_word.py`
- [Audio recorder](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/recorder.py): `core/recorder.py`
- [Speech recognition](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/stt.py): `core/stt.py`
- [Speech output](https://github.com/hemanth-codecrafter/project-ai-assistant/blob/main/core/tts.py): `core/tts.py`

### Other components

- **User**

## Connections

- User → Assistant runtime: speaks or types (evidence: `main.py`)
- Assistant runtime → Wake-word detector: listens for trigger (evidence: `main.py`)
- Assistant runtime → Audio recorder: records audio (evidence: `main.py`)
- Assistant runtime → Speech recognition: transcribes audio (evidence: `main.py`)
- Assistant runtime → Command processor: processes command (evidence: `main.py`)
- Assistant runtime → Speech output: speaks response (evidence: `main.py`)
- HTTP API → Command processor: processes request (evidence: `api.py`)
- Server entry → Command processor: uses processor (evidence: `server.py`)
- Command processor → Intent router: routes command (evidence: `services/command_processor.py`)
- Command processor → Language-model brain: requests response (evidence: `services/command_processor.py`)
- Command processor → Memory coordinator: coordinates memory (evidence: `services/command_processor.py`)
- Intent router → Intent classifier: classifies command (evidence: `core/router.py`)
- Intent router → Assistant actions: executes intent (evidence: `core/router.py`)
- Intent router → Device manager: gets active device (evidence: `core/router.py`)
- Intent router → Device actions: dispatches device action (evidence: `core/router.py`)
- Language-model brain → Provider selection: selects provider (evidence: `core/brain.py`)
- Provider selection → Gemini provider: tries provider (evidence: `core/provider_manager.py`)
- Provider selection → Groq provider: falls back (evidence: `core/provider_manager.py`)
- Provider selection → OpenRouter provider: registers provider (evidence: `core/provider_manager.py`)
- Gemini provider → Provider interface: implements interface (evidence: `core/providers/gemini_provider.py`)
- Groq provider → Provider interface: implements interface (evidence: `core/providers/groq_provider.py`)
- OpenRouter provider → Provider interface: implements interface (evidence: `core/providers/openrouter_provider.py`)
- Memory coordinator → Context manager: reads and updates (evidence: `core/memory_service.py`)
- Memory coordinator → Conversation history: stores turns (evidence: `core/memory_service.py`)
- Memory coordinator → Memory manager: searches and forgets (evidence: `core/memory_service.py`)
- Memory coordinator → Memory extractor: extracts memories (evidence: `core/memory_service.py`)
- Memory coordinator → Memory retrieval: retrieves relevant (evidence: `core/memory_service.py`)
- Memory coordinator → Memory ranker: configures ranking (evidence: `core/memory_service.py`)
- Memory coordinator → Memory updates: resolves updates (evidence: `core/memory_service.py`)
- Memory coordinator → SQLite memory store: saves and retrieves (evidence: `core/memory_service.py`)
- Memory manager → SQLite memory store: searches and saves (evidence: `core/memory_manager.py`)
- Memory manager → Memory record: constructs record (evidence: `core/memory_manager.py`)
- SQLite memory store → Memory record: accepts record (evidence: `core/memory_db.py`)
