# kunal0040/kaitu architecture

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

- Interactive diagram: https://gitdiagram.com/kunal0040/kaitu
- Repository: https://github.com/kunal0040/kaitu

## Overview

Kaitu is a personal AI assistant whose primary workflow accepts keyboard or voice input, routes it to local replies, memory handling, commands, calculations, or the AI brain, and returns a response. Voice modes add speech input and spoken output; commands cover Windows applications, web search, and reader/calculator skills. Memory management classifies facts before reading or updating persistent memory. The README documents these capabilities, but several implementation files were not sampled, so uncertain internal links are omitted.

Main entry points: [`router.py`](https://github.com/kunal0040/kaitu/blob/main/router.py) (Input router), [`command_engine.py`](https://github.com/kunal0040/kaitu/blob/main/command_engine.py) (Command engine), [`audio/voice_talk.py`](https://github.com/kunal0040/kaitu/blob/main/audio/voice_talk.py) (Voice modes), [`provider_manager.py`](https://github.com/kunal0040/kaitu/blob/main/provider_manager.py) (Provider selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction and routing"]
  node_main["CLI entry<br/>[main.py]"]
  node_router["Input router<br/>[router.py]"]
  node_local["Local responses<br/>[local_responses.py]"]
end

subgraph group_assistant["Assistant intelligence"]
  node_brain["AI brain<br/>[brain.py]"]
  node_provider_manager["Provider selection"]
  node_ollama["Ollama provider<br/>[ollama_provider.py]"]
  node_groq["Groq provider<br/>[groq_provider.py]"]
  node_gemini["Gemini provider<br/>[gemini_provider.py]"]
end

subgraph group_memory["Persistent memory"]
  node_memory_manager["Memory manager<br/>[memory_manager.py]"]
  node_memory_store[("Memory and history<br/>[memory.py]")]
end

subgraph group_actions["Commands and skills"]
  node_commands["Command engine<br/>[command_engine.py]"]
  node_aliases["Command aliases<br/>[aliases.py]"]
  node_discovery["App discovery<br/>[app_discovery.py]"]
  node_calculator["Calculator skill<br/>[calculator.py]"]
  node_reader["Reader skill<br/>[reader.py]"]
end

subgraph group_voice["Voice interaction"]
  node_voice_modes["Voice modes<br/>[voice_talk.py]"]
  node_voice_processing["Voice controls"]
  node_speech_input["Speech input<br/>[speech_input.py]"]
  node_speech_output["Speech output<br/>[speech_output.py]"]
end

node_user(("User"))
node_provider_services(("Model services"))
node_windows(("Windows applications"))
node_web(("Web browser"))
node_speech_services(("Speech devices"))

node_user -->|"enters text"| node_main
node_main -->|"routes input"| node_router
node_main -->|"starts voice mode"| node_voice_modes
node_router -->|"checks replies"| node_local
node_router -->|"handles memory"| node_memory_manager
node_router -->|"detects commands"| node_commands
node_router -->|"checks calculations"| node_calculator
node_router -->|"asks assistant"| node_brain
node_brain -->|"selects provider"| node_provider_manager
node_provider_manager -->|"dispatches requests"| node_ollama
node_provider_manager -->|"dispatches requests"| node_groq
node_provider_manager -->|"dispatches requests"| node_gemini
node_ollama -->|"calls model"| node_provider_services
node_groq -->|"calls model"| node_provider_services
node_gemini -->|"calls model"| node_provider_services
node_memory_manager -->|"reads and writes"| node_memory_store
node_memory_manager -->|"classifies facts"| node_provider_services
node_ollama -->|"reads context"| node_memory_store
node_groq -->|"reads context"| node_memory_store
node_commands -->|"normalizes targets"| node_aliases
node_commands -->|"finds or closes apps"| node_discovery
node_discovery -->|"controls apps"| node_windows
node_commands -->|"opens or searches"| node_web
node_commands -->|"runs calculation"| node_calculator
node_commands -->|"runs reader"| node_reader
node_reader -->|"speaks text"| node_speech_output
node_voice_modes -->|"captures speech"| node_speech_input
node_speech_input -->|"uses recognition"| node_speech_services
node_voice_modes -->|"routes recognized input"| node_router
node_voice_modes -->|"checks voice controls"| node_voice_processing
node_voice_modes -->|"speaks responses"| node_speech_output
node_speech_output -->|"synthesizes speech"| node_speech_services

click node_main "https://github.com/kunal0040/kaitu/blob/main/main.py"
click node_router "https://github.com/kunal0040/kaitu/blob/main/router.py"
click node_local "https://github.com/kunal0040/kaitu/blob/main/local_responses.py"
click node_brain "https://github.com/kunal0040/kaitu/blob/main/brain.py"
click node_provider_manager "https://github.com/kunal0040/kaitu/blob/main/provider_manager.py"
click node_ollama "https://github.com/kunal0040/kaitu/blob/main/providers/ollama_provider.py"
click node_groq "https://github.com/kunal0040/kaitu/blob/main/providers/groq_provider.py"
click node_gemini "https://github.com/kunal0040/kaitu/blob/main/providers/gemini_provider.py"
click node_memory_manager "https://github.com/kunal0040/kaitu/blob/main/memory_manager.py"
click node_memory_store "https://github.com/kunal0040/kaitu/blob/main/memory.py"
click node_commands "https://github.com/kunal0040/kaitu/blob/main/command_engine.py"
click node_aliases "https://github.com/kunal0040/kaitu/blob/main/aliases.py"
click node_discovery "https://github.com/kunal0040/kaitu/blob/main/app_discovery.py"
click node_calculator "https://github.com/kunal0040/kaitu/blob/main/skills/calculator.py"
click node_reader "https://github.com/kunal0040/kaitu/blob/main/skills/reader.py"
click node_voice_modes "https://github.com/kunal0040/kaitu/blob/main/audio/voice_talk.py"
click node_voice_processing "https://github.com/kunal0040/kaitu/blob/main/audio/voice_processing.py"
click node_speech_input "https://github.com/kunal0040/kaitu/blob/main/audio/speech_input.py"
click node_speech_output "https://github.com/kunal0040/kaitu/blob/main/audio/speech_output.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_router,node_local,node_user,node_web toneBlue
class node_brain,node_provider_manager,node_ollama,node_groq,node_gemini toneAmber
class node_memory_manager,node_memory_store toneMint
class node_commands,node_aliases,node_discovery,node_calculator,node_reader toneRose
class node_voice_modes,node_voice_processing,node_speech_input,node_speech_output,node_provider_services,node_windows,node_speech_services toneIndigo
```

## Components

### Interaction and routing

- [CLI entry](https://github.com/kunal0040/kaitu/blob/main/main.py): `main.py`
- [Input router](https://github.com/kunal0040/kaitu/blob/main/router.py): `router.py`
- [Local responses](https://github.com/kunal0040/kaitu/blob/main/local_responses.py): `local_responses.py`

### Assistant intelligence

- [AI brain](https://github.com/kunal0040/kaitu/blob/main/brain.py): `brain.py`
- [Provider selection](https://github.com/kunal0040/kaitu/blob/main/provider_manager.py): `provider_manager.py`
- [Ollama provider](https://github.com/kunal0040/kaitu/blob/main/providers/ollama_provider.py): `providers/ollama_provider.py`
- [Groq provider](https://github.com/kunal0040/kaitu/blob/main/providers/groq_provider.py): `providers/groq_provider.py`
- [Gemini provider](https://github.com/kunal0040/kaitu/blob/main/providers/gemini_provider.py): `providers/gemini_provider.py`

### Persistent memory

- [Memory manager](https://github.com/kunal0040/kaitu/blob/main/memory_manager.py): `memory_manager.py`
- [Memory and history](https://github.com/kunal0040/kaitu/blob/main/memory.py): `memory.py`

### Commands and skills

- [Command engine](https://github.com/kunal0040/kaitu/blob/main/command_engine.py): `command_engine.py`
- [Command aliases](https://github.com/kunal0040/kaitu/blob/main/aliases.py): `aliases.py`
- [App discovery](https://github.com/kunal0040/kaitu/blob/main/app_discovery.py): `app_discovery.py`
- [Calculator skill](https://github.com/kunal0040/kaitu/blob/main/skills/calculator.py): `skills/calculator.py`
- [Reader skill](https://github.com/kunal0040/kaitu/blob/main/skills/reader.py): `skills/reader.py`

### Voice interaction

- [Voice modes](https://github.com/kunal0040/kaitu/blob/main/audio/voice_talk.py): `audio/voice_talk.py`
- [Voice controls](https://github.com/kunal0040/kaitu/blob/main/audio/voice_processing.py): `audio/voice_processing.py`
- [Speech input](https://github.com/kunal0040/kaitu/blob/main/audio/speech_input.py): `audio/speech_input.py`
- [Speech output](https://github.com/kunal0040/kaitu/blob/main/audio/speech_output.py): `audio/speech_output.py`

### Other components

- **User**
- **Model services**
- **Windows applications**
- **Web browser**
- **Speech devices**

## Connections

- User → CLI entry: enters text
- CLI entry → Input router: routes input
- CLI entry → Voice modes: starts voice mode
- Input router → Local responses: checks replies
- Input router → Memory manager: handles memory
- Input router → Command engine: detects commands
- Input router → Calculator skill: checks calculations
- Input router → AI brain: asks assistant
- AI brain → Provider selection: selects provider
- Provider selection → Ollama provider: dispatches requests
- Provider selection → Groq provider: dispatches requests
- Provider selection → Gemini provider: dispatches requests
- Ollama provider → Model services: calls model
- Groq provider → Model services: calls model
- Gemini provider → Model services: calls model
- Memory manager → Memory and history: reads and writes
- Memory manager → Model services: classifies facts
- Ollama provider → Memory and history: reads context
- Groq provider → Memory and history: reads context
- Command engine → Command aliases: normalizes targets
- Command engine → App discovery: finds or closes apps
- App discovery → Windows applications: controls apps
- Command engine → Web browser: opens or searches
- Command engine → Calculator skill: runs calculation
- Command engine → Reader skill: runs reader
- Reader skill → Speech output: speaks text
- Voice modes → Speech input: captures speech
- Speech input → Speech devices: uses recognition
- Voice modes → Input router: routes recognized input
- Voice modes → Voice controls: checks voice controls
- Voice modes → Speech output: speaks responses
- Speech output → Speech devices: synthesizes speech
