# trhariharasudhan/grandpa architecture

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

- Interactive diagram: https://gitdiagram.com/trhariharasudhan/grandpa
- Repository: https://github.com/trhariharasudhan/grandpa

## Overview

Grandpa is a local-first Windows personal assistant. Users enter through terminal, desktop, voice, or phone surfaces; requests are understood by the shared AI, then routed through action handling and confirmation before PC or connected-service work. Separate branches cover screen reading, workflows, reminders, and user-controlled memory. The README documents the high-level flow and capabilities; source excerpts/index support selected internal relationships, but many listed modules were not sampled, so undocumented links are omitted.

Main entry points: [`src/grandpa/ai/core_ai_brain.py`](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/core_ai_brain.py) (Assistant brain), [`src/grandpa/backend/action_layer/executor.py`](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/action_layer/executor.py) (Action executor), [`src/grandpa/database/knowledge/engine.py`](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/knowledge/engine.py) (Knowledge store), [`src/grandpa/frontend/voice/wake_engine.py`](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/frontend/voice/wake_engine.py) (Voice input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_terminal["Terminal chat<br/>[app.py]"]
  node_voice["Voice input<br/>[wake_engine.py]"]
  node_desktopapp["Desktop app"]
  node_phone["Phone access"]
end

subgraph group_intelligence["AI and planning"]
  node_brain["Assistant brain<br/>[core_ai_brain.py]"]
  node_planner["Request planner<br/>[engine.py]"]
  node_modelruntime["Local model runtime<br/>[ollama_adapter.py]"]
  node_development["Development planning"]
end

subgraph group_actions["Actions and services"]
  node_actioncatalogue["Action catalogue<br/>[catalogue.py]"]
  node_actionexecutor["Action executor<br/>[executor.py]"]
  node_confirm["Risk confirmation"]
  node_pccontrol["Windows control<br/>[service.py]"]
  node_screen["Screen reading"]
  node_browser["Browser research"]
  node_workflows["Workflow engine<br/>[engine.py]"]
  node_reminders["Reminders<br/>[reminders.py]"]
  node_automation["Screen automation<br/>[windows.py]"]
  node_tools["Tool integrations<br/>[_stubs.py]"]
end

subgraph group_state["Memory and runtime"]
  node_memory[("Long-term memory<br/>[intelligence.py]")]
  node_knowledge[("Knowledge store<br/>[engine.py]")]
  node_notes[("Notes storage<br/>[storage.py]")]
  node_config["Configuration<br/>[config.py]"]
  node_events["Runtime events<br/>[events.py]"]
  node_registry["Service registry<br/>[registry.py]"]
  node_paths["Runtime paths<br/>[runtime_paths.py]"]
  node_memorycontext["Memory context<br/>[memory_context.py]"]
  node_intelligence_store[("Intelligence database<br/>[intelligence.py]")]
end

node_person(("User"))

node_person -->|"chats through"| node_terminal
node_person -->|"speaks to"| node_voice
node_person -->|"uses"| node_desktopapp
node_person -->|"accesses by"| node_phone
node_terminal -->|"shares brain"| node_brain
node_voice -->|"shares brain"| node_brain
node_desktopapp -->|"shares brain"| node_brain
node_phone -->|"shares brain"| node_brain
node_brain -->|"runs locally"| node_modelruntime
node_brain -->|"routes actions"| node_actioncatalogue
node_actioncatalogue -->|"dispatches actions"| node_actionexecutor
node_actionexecutor -->|"checks risk"| node_confirm
node_actionexecutor -->|"executes on PC"| node_pccontrol
node_actionexecutor -->|"reads screen"| node_screen
node_actionexecutor -->|"controls browser"| node_browser
node_actionexecutor -.->|"runs workflows"| node_workflows
node_actionexecutor -->|"manages reminders"| node_reminders
node_actionexecutor -->|"manages notes"| node_notes
node_brain -.->|"plans requests"| node_planner
node_planner -->|"uses context"| node_memory
node_planner -->|"queries knowledge"| node_knowledge
node_knowledge -->|"uses context"| node_memorycontext
node_knowledge -->|"resolves storage"| node_paths
node_workflows -->|"uses events"| node_events
node_workflows -->|"dispatches actions"| node_actioncatalogue
node_automation -->|"uses screen"| node_screen
node_voice -->|"detects wake phrase"| node_person
node_development -.->|"syncs project state"| node_intelligence_store
node_tools -->|"exposes memory tools"| node_memory
node_notes -->|"loads settings"| node_config
node_knowledge -.->|"indexes knowledge"| node_intelligence_store
node_brain -.->|"resolves models"| node_registry
node_brain -.->|"loads settings"| node_config

click node_terminal "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/frontend/tui/app.py"
click node_voice "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/frontend/voice/wake_engine.py"
click node_desktopapp "https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/frontend/app"
click node_phone "https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/frontend/devices"
click node_brain "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/core_ai_brain.py"
click node_planner "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/planner/engine.py"
click node_modelruntime "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/runtime/ollama_adapter.py"
click node_actioncatalogue "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/action_layer/catalogue.py"
click node_actionexecutor "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/action_layer/executor.py"
click node_confirm "https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/action_layer"
click node_pccontrol "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/automation/service.py"
click node_screen "https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/screen"
click node_browser "https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/browser_intelligence"
click node_workflows "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/workflow/engine.py"
click node_reminders "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/reminders.py"
click node_memory "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/core/intelligence.py"
click node_knowledge "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/knowledge/engine.py"
click node_notes "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/notes/storage.py"
click node_config "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/config.py"
click node_events "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/events.py"
click node_registry "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/registry.py"
click node_paths "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/runtime_paths.py"
click node_development "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/agent/development/roadmap_generator.py"
click node_automation "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/automation/windows.py"
click node_tools "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/tools/_stubs.py"
click node_memorycontext "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/memory_context.py"
click node_intelligence_store "https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/core/intelligence.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_terminal,node_voice,node_desktopapp,node_phone,node_person toneBlue
class node_brain,node_planner,node_modelruntime,node_development toneAmber
class node_actioncatalogue,node_actionexecutor,node_confirm,node_pccontrol,node_screen,node_browser,node_workflows,node_reminders,node_automation,node_tools toneMint
class node_memory,node_knowledge,node_notes,node_config,node_events,node_registry,node_paths,node_memorycontext,node_intelligence_store toneRose
```

## Components

### User interfaces

- [Terminal chat](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/frontend/tui/app.py): `src/grandpa/frontend/tui/app.py`
- [Voice input](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/frontend/voice/wake_engine.py): `src/grandpa/frontend/voice/wake_engine.py`
- [Desktop app](https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/frontend/app): `src/grandpa/frontend/app`
- [Phone access](https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/frontend/devices): `src/grandpa/frontend/devices`

### AI and planning

- [Assistant brain](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/core_ai_brain.py): `src/grandpa/ai/core_ai_brain.py`
- [Request planner](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/planner/engine.py): `src/grandpa/ai/planner/engine.py`
- [Local model runtime](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/runtime/ollama_adapter.py): `src/grandpa/ai/runtime/ollama_adapter.py`
- [Development planning](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/ai/agent/development/roadmap_generator.py): `src/grandpa/ai/agent/development/roadmap_generator.py`

### Actions and services

- [Action catalogue](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/action_layer/catalogue.py): `src/grandpa/backend/action_layer/catalogue.py`
- [Action executor](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/action_layer/executor.py): `src/grandpa/backend/action_layer/executor.py`
- [Risk confirmation](https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/action_layer): `src/grandpa/backend/action_layer`
- [Windows control](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/automation/service.py): `src/grandpa/backend/automation/service.py`
- [Screen reading](https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/screen): `src/grandpa/backend/screen`
- [Browser research](https://github.com/trhariharasudhan/grandpa/tree/main/src/grandpa/backend/browser_intelligence): `src/grandpa/backend/browser_intelligence`
- [Workflow engine](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/workflow/engine.py): `src/grandpa/backend/workflow/engine.py`
- [Reminders](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/reminders.py): `src/grandpa/backend/reminders.py`
- [Screen automation](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/automation/windows.py): `src/grandpa/backend/automation/windows.py`
- [Tool integrations](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/backend/tools/_stubs.py): `src/grandpa/backend/tools/_stubs.py`

### Memory and runtime

- [Long-term memory](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/core/intelligence.py): `src/grandpa/database/core/intelligence.py`
- [Knowledge store](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/knowledge/engine.py): `src/grandpa/database/knowledge/engine.py`
- [Notes storage](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/notes/storage.py): `src/grandpa/database/notes/storage.py`
- [Configuration](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/config.py): `src/grandpa/core/config.py`
- [Runtime events](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/events.py): `src/grandpa/core/events.py`
- [Service registry](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/registry.py): `src/grandpa/core/registry.py`
- [Runtime paths](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/core/runtime_paths.py): `src/grandpa/core/runtime_paths.py`
- [Memory context](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/memory_context.py): `src/grandpa/database/memory_context.py`
- [Intelligence database](https://github.com/trhariharasudhan/grandpa/blob/main/src/grandpa/database/core/intelligence.py): `src/grandpa/database/core/intelligence.py`

### Other components

- **User**

## Connections

- User → Terminal chat: chats through (evidence: `README.md`)
- User → Voice input: speaks to (evidence: `README.md`)
- User → Desktop app: uses (evidence: `README.md`)
- User → Phone access: accesses by (evidence: `README.md`)
- Terminal chat → Assistant brain: shares brain (evidence: `README.md`)
- Voice input → Assistant brain: shares brain (evidence: `README.md`)
- Desktop app → Assistant brain: shares brain (evidence: `README.md`)
- Phone access → Assistant brain: shares brain (evidence: `README.md`)
- Assistant brain → Local model runtime: runs locally (evidence: `README.md`)
- Assistant brain → Action catalogue: routes actions (evidence: `README.md`)
- Action catalogue → Action executor: dispatches actions (evidence: `README.md`)
- Action executor → Risk confirmation: checks risk (evidence: `README.md`)
- Action executor → Windows control: executes on PC (evidence: `README.md`)
- Action executor → Screen reading: reads screen (evidence: `README.md`)
- Action executor → Browser research: controls browser (evidence: `README.md`)
- Action executor → Workflow engine: runs workflows (evidence: `src/grandpa/backend/workflow/engine.py`)
- Action executor → Reminders: manages reminders (evidence: `README.md`)
- Action executor → Notes storage: manages notes (evidence: `README.md`)
- Assistant brain → Request planner: plans requests
- Request planner → Long-term memory: uses context (evidence: `src/grandpa/ai/planner/engine.py`)
- Request planner → Knowledge store: queries knowledge (evidence: `src/grandpa/ai/planner/engine.py`)
- Knowledge store → Memory context: uses context (evidence: `src/grandpa/database/knowledge/engine.py`)
- Knowledge store → Runtime paths: resolves storage
- Workflow engine → Runtime events: uses events (evidence: `src/grandpa/backend/workflow/engine.py`)
- Workflow engine → Action catalogue: dispatches actions (evidence: `src/grandpa/backend/workflow/engine.py`)
- Screen automation → Screen reading: uses screen (evidence: `src/grandpa/backend/automation/pipeline.py`)
- Voice input → User: detects wake phrase (evidence: `src/grandpa/frontend/voice/wake_engine.py`)
- Development planning → Intelligence database: syncs project state
- Tool integrations → Long-term memory: exposes memory tools
- Notes storage → Configuration: loads settings (evidence: `src/grandpa/database/notes/storage.py`)
- Knowledge store → Intelligence database: indexes knowledge
- Assistant brain → Service registry: resolves models
- Assistant brain → Configuration: loads settings
