# venkie07/pocket-ai architecture

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

- Interactive diagram: https://gitdiagram.com/venkie07/pocket-ai
- Repository: https://github.com/venkie07/pocket-ai

## Overview

Pocket AI is a portable, local-first AI environment. Its principal user-to-result paths are chat or direct CLI inference through a local model, and an agent workflow that turns a task into registered tools and Windows UI automation. The tree also exposes a browser chat UI and a FlaUI command-line product. README-documented OpenCode, Laya, and Colibri capabilities are shown as external or optional components because their implementations are not in the supplied tree; unsampled wiring is not inferred.

Main entry points: [`AI/web/src/App.tsx`](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/App.tsx) (Chat UI), [`AI/tools/base.py`](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/base.py) (Tool Registry), [`FlaUI.Cli/src/FlaUI.Cli/Program.cs`](https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Program.cs) (FlaUI CLI Routing), [`AI/main.py`](https://github.com/venkie07/pocket-ai/blob/main/AI/main.py) (Agent Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Local Inference"]
  node_llama["llama.cpp"]
  node_localmodel[("Local GGUF Model")]
  node_opencode["OpenCode"]
  node_directcli["Direct CLI Inference"]
  node_colibri["Colibri MoE"]
end

subgraph group_chat["Chat Interface"]
  node_chatui["Chat UI<br/>[App.tsx]"]
  node_webboot["Web Bootstrap<br/>[main.tsx]"]
  node_translations["Translations<br/>[index.ts]"]
  node_api["Inference API Client<br/>[api.ts]"]
  node_settings["Saved Settings<br/>[storage.ts]"]
end

subgraph group_agent["Agent Tools"]
  node_aiapp["AI Application<br/>[app.py]"]
  node_aimain["Agent Entry<br/>[main.py]"]
  node_toolregistry["Tool Registry<br/>[base.py]"]
  node_toolwiring["Tool Registration<br/>[__init__.py]"]
  node_ghosttools["GhostHand Tools<br/>[action.py]"]
  node_ghostsession["Session Tools<br/>[session.py]"]
  node_ghostclient["GhostHand Client<br/>[client.py]"]
  node_laya["Laya Clarification"]
end

subgraph group_automation["Windows Automation"]
  node_flauiprogram["FlaUI CLI Routing<br/>[Program.cs]"]
  node_sessionmgr["Session Manager<br/>[SessionManager.cs]"]
  node_automationengine["Automation Engine"]
  node_sessionfile["Session State<br/>[SessionFile.cs]"]
  node_windowsui["Windows UI"]
end

node_user(("User"))

node_user -->|"uses"| node_chatui
node_webboot -->|"renders"| node_chatui
node_chatui -->|"localizes"| node_translations
node_chatui -->|"requests inference"| node_api
node_chatui -->|"persists settings"| node_settings
node_api -.->|"sends requests"| node_llama
node_llama -->|"runs inference"| node_localmodel
node_user -->|"uses"| node_opencode
node_opencode -->|"calls API"| node_llama
node_user -->|"runs inference"| node_directcli
node_directcli -->|"invokes"| node_llama
node_user -.->|"requests task"| node_aimain
node_aimain -.->|"dispatches tools"| node_toolregistry
node_aiapp -->|"loads tools"| node_toolwiring
node_toolwiring -->|"registers tools"| node_toolregistry
node_toolregistry -.->|"executes"| node_ghosttools
node_toolregistry -.->|"executes"| node_ghostsession
node_ghosttools -->|"calls"| node_ghostclient
node_ghostsession -->|"calls"| node_ghostclient
node_ghostclient -.->|"runs CLI"| node_flauiprogram
node_flauiprogram -->|"routes commands"| node_sessionmgr
node_flauiprogram -->|"routes commands"| node_automationengine
node_sessionmgr -->|"reads and writes"| node_sessionfile
node_automationengine -.->|"automates"| node_windowsui
node_laya -.->|"clarifies requests"| node_aimain
node_colibri -.->|"runs MoE models"| node_localmodel

click node_chatui "https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/App.tsx"
click node_webboot "https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/main.tsx"
click node_translations "https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/i18n/index.ts"
click node_api "https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/lib/api.ts"
click node_settings "https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/lib/storage.ts"
click node_aiapp "https://github.com/venkie07/pocket-ai/blob/main/AI/app.py"
click node_aimain "https://github.com/venkie07/pocket-ai/blob/main/AI/main.py"
click node_toolregistry "https://github.com/venkie07/pocket-ai/blob/main/AI/tools/base.py"
click node_toolwiring "https://github.com/venkie07/pocket-ai/blob/main/AI/tools/__init__.py"
click node_ghosttools "https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/tools/action.py"
click node_ghostsession "https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/tools/session.py"
click node_ghostclient "https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/client.py"
click node_flauiprogram "https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Program.cs"
click node_sessionmgr "https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Services/SessionManager.cs"
click node_automationengine "https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Services/AutomationEngine.cs"
click node_sessionfile "https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Models/SessionFile.cs"

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_llama,node_localmodel,node_opencode,node_directcli,node_colibri,node_user toneBlue
class node_chatui,node_webboot,node_translations,node_api,node_settings toneAmber
class node_aiapp,node_aimain,node_toolregistry,node_toolwiring,node_ghosttools,node_ghostsession,node_ghostclient,node_laya toneMint
class node_flauiprogram,node_sessionmgr,node_automationengine,node_sessionfile,node_windowsui toneRose
```

## Components

### Local Inference

- **llama.cpp**
- **Local GGUF Model**
- **OpenCode**
- **Direct CLI Inference**
- **Colibri MoE**

### Chat Interface

- [Chat UI](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/App.tsx): `AI/web/src/App.tsx`
- [Web Bootstrap](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/main.tsx): `AI/web/src/main.tsx`
- [Translations](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/i18n/index.ts): `AI/web/src/i18n/index.ts`
- [Inference API Client](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/lib/api.ts): `AI/web/src/lib/api.ts`
- [Saved Settings](https://github.com/venkie07/pocket-ai/blob/main/AI/web/src/lib/storage.ts): `AI/web/src/lib/storage.ts`

### Agent Tools

- [AI Application](https://github.com/venkie07/pocket-ai/blob/main/AI/app.py): `AI/app.py`
- [Agent Entry](https://github.com/venkie07/pocket-ai/blob/main/AI/main.py): `AI/main.py`
- [Tool Registry](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/base.py): `AI/tools/base.py`
- [Tool Registration](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/__init__.py): `AI/tools/__init__.py`
- [GhostHand Tools](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/tools/action.py): `AI/tools/ghosthand/tools/action.py`
- [Session Tools](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/tools/session.py): `AI/tools/ghosthand/tools/session.py`
- [GhostHand Client](https://github.com/venkie07/pocket-ai/blob/main/AI/tools/ghosthand/client.py): `AI/tools/ghosthand/client.py`
- **Laya Clarification**

### Windows Automation

- [FlaUI CLI Routing](https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Program.cs): `FlaUI.Cli/src/FlaUI.Cli/Program.cs`
- [Session Manager](https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Services/SessionManager.cs): `FlaUI.Cli/src/FlaUI.Cli/Services/SessionManager.cs`
- [Automation Engine](https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Services/AutomationEngine.cs): `FlaUI.Cli/src/FlaUI.Cli/Services/AutomationEngine.cs`
- [Session State](https://github.com/venkie07/pocket-ai/blob/main/FlaUI.Cli/src/FlaUI.Cli/Models/SessionFile.cs): `FlaUI.Cli/src/FlaUI.Cli/Models/SessionFile.cs`
- **Windows UI**

### Other components

- **User**

## Connections

- User → Chat UI: uses (evidence: `README.md`)
- Web Bootstrap → Chat UI: renders (evidence: `AI/web/src/main.tsx`)
- Chat UI → Translations: localizes (evidence: `AI/web/src/App.tsx`)
- Chat UI → Inference API Client: requests inference (evidence: `AI/web/src/App.tsx`)
- Chat UI → Saved Settings: persists settings (evidence: `AI/web/src/App.tsx`)
- Inference API Client → llama.cpp: sends requests (evidence: `README.md`)
- llama.cpp → Local GGUF Model: runs inference (evidence: `README.md`)
- User → OpenCode: uses (evidence: `README.md`)
- OpenCode → llama.cpp: calls API (evidence: `README.md`)
- User → Direct CLI Inference: runs inference (evidence: `README.md`)
- Direct CLI Inference → llama.cpp: invokes (evidence: `README.md`)
- User → Agent Entry: requests task
- Agent Entry → Tool Registry: dispatches tools
- AI Application → Tool Registration: loads tools (evidence: `AI/app.py`)
- Tool Registration → Tool Registry: registers tools (evidence: `AI/tools/__init__.py`)
- Tool Registry → GhostHand Tools: executes (evidence: `AI/tools/ghosthand/tools/action.py`)
- Tool Registry → Session Tools: executes (evidence: `AI/tools/ghosthand/tools/session.py`)
- GhostHand Tools → GhostHand Client: calls (evidence: `AI/tools/ghosthand/tools/action.py`)
- Session Tools → GhostHand Client: calls (evidence: `AI/tools/ghosthand/tools/session.py`)
- GhostHand Client → FlaUI CLI Routing: runs CLI
- FlaUI CLI Routing → Session Manager: routes commands (evidence: `FlaUI.Cli/src/FlaUI.Cli/Program.cs`)
- FlaUI CLI Routing → Automation Engine: routes commands
- Session Manager → Session State: reads and writes (evidence: `FlaUI.Cli/src/FlaUI.Cli/Services/SessionManager.cs`)
- Automation Engine → Windows UI: automates (evidence: `README.md`)
- Laya Clarification → Agent Entry: clarifies requests (evidence: `README.md`)
- Colibri MoE → Local GGUF Model: runs MoE models (evidence: `README.md`)
