# imadityarai/vanipilot architecture

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

- Interactive diagram: https://gitdiagram.com/imadityarai/vanipilot
- Repository: https://github.com/imadityarai/vanipilot

## Overview

VaniPilot is a voice-first simulator for fictional phone tasks: people speak or type a request, the app interprets it, plans a simulated action or answers a supported question, and presents the result with approval gates where needed. Its domain spans speech and language handling, intent resolution, sample phone records, screen planning, and transaction/session updates. Similarity matching is the default answer path; an optional model-backed assistant adds interpretation and answers. The excerpts establish key module calls, but do not expose every runtime connection, so uncertain links are omitted.

Main entry points: [`app/use-pilot.js`](https://github.com/imadityarai/vanipilot/blob/main/app/use-pilot.js) (Pilot controller), [`lib/model-server.mjs`](https://github.com/imadityarai/vanipilot/blob/main/lib/model-server.mjs) (Model assistant), [`lib/session.mjs`](https://github.com/imadityarai/vanipilot/blob/main/lib/session.mjs) (Task transactions), [`lib/scenario.mjs`](https://github.com/imadityarai/vanipilot/blob/main/lib/scenario.mjs) (Sample records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_app["Simulator UI<br/>[page.jsx]"]
  node_pilot["Pilot controller<br/>[use-pilot.js]"]
  node_speech["Speech capture"]
  node_speechworker["Speech recognition<br/>[speech-worker.mjs]"]
end

subgraph group_understanding["Request understanding"]
  node_intent["Intent parser<br/>[intent.mjs]"]
  node_similarity["Question matcher<br/>[similarity.mjs]"]
  node_language["Language handling<br/>[language.mjs]"]
  node_modelcontract["Model validation<br/>[model-contract.mjs]"]
end

subgraph group_simulation["Demo task simulation"]
  node_screens["Screen planner<br/>[screens.mjs]"]
  node_sampledata["Sample records<br/>[scenario.mjs]"]
  node_session["Task transactions<br/>[session.mjs]"]
  node_replies["Reminder replies<br/>[task-replies.js]"]
  node_browserstore[("Browser storage")]
end

subgraph group_assistant["Assistant services"]
  node_assistantroute["Assistant API route<br/>[route.model.js]"]
  node_modelserver["Model assistant<br/>[model-server.mjs]"]
  node_spaceassistant["Space assistant adapter"]
end

node_user(("User"))
node_ollama["Ollama service"]

node_user -->|"uses"| node_app
node_app -->|"delegates to"| node_pilot
node_app -->|"reads"| node_sampledata
node_app -->|"renders from"| node_screens
node_app -->|"summarizes with"| node_session
node_pilot -->|"starts"| node_speech
node_speech -.->|"transcribes via"| node_speechworker
node_speechworker -->|"loads locales"| node_language
node_pilot -->|"interprets with"| node_intent
node_pilot -->|"matches questions"| node_similarity
node_pilot -->|"checks credentials"| node_modelcontract
node_pilot -->|"selects reply locale"| node_language
node_pilot -->|"plans routes"| node_screens
node_pilot -->|"commits tasks"| node_session
node_pilot -->|"formats reminders"| node_replies
node_intent -->|"matches records"| node_sampledata
node_intent -->|"uses operations"| node_modelcontract
node_similarity -->|"formats results"| node_sampledata
node_screens -->|"plans from records"| node_sampledata
node_session -->|"uses sample state"| node_sampledata
node_session -->|"checks goal view"| node_screens
node_session -.->|"persists changes"| node_browserstore
node_replies -->|"uses task replies"| node_session
node_assistantroute -->|"routes to"| node_modelserver
node_modelserver -->|"grounds answers"| node_sampledata
node_modelserver -->|"uses locale rules"| node_language
node_modelserver -->|"validates output"| node_modelcontract
node_spaceassistant -->|"configures assistant"| node_modelserver
node_modelserver -.->|"requests model"| node_ollama

click node_app "https://github.com/imadityarai/vanipilot/blob/main/app/page.jsx"
click node_pilot "https://github.com/imadityarai/vanipilot/blob/main/app/use-pilot.js"
click node_speech "https://github.com/imadityarai/vanipilot/blob/main/app/automatic-speech.js"
click node_speechworker "https://github.com/imadityarai/vanipilot/blob/main/app/speech-worker.mjs"
click node_intent "https://github.com/imadityarai/vanipilot/blob/main/lib/intent.mjs"
click node_similarity "https://github.com/imadityarai/vanipilot/blob/main/lib/similarity.mjs"
click node_language "https://github.com/imadityarai/vanipilot/blob/main/lib/language.mjs"
click node_modelcontract "https://github.com/imadityarai/vanipilot/blob/main/lib/model-contract.mjs"
click node_screens "https://github.com/imadityarai/vanipilot/blob/main/lib/screens.mjs"
click node_sampledata "https://github.com/imadityarai/vanipilot/blob/main/lib/scenario.mjs"
click node_session "https://github.com/imadityarai/vanipilot/blob/main/lib/session.mjs"
click node_replies "https://github.com/imadityarai/vanipilot/blob/main/app/task-replies.js"
click node_assistantroute "https://github.com/imadityarai/vanipilot/blob/main/app/api/assistant/route.model.js"
click node_modelserver "https://github.com/imadityarai/vanipilot/blob/main/lib/model-server.mjs"
click node_spaceassistant "https://github.com/imadityarai/vanipilot/blob/main/lib/space-assistant.mjs"

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_app,node_pilot,node_speech,node_speechworker,node_user toneBlue
class node_intent,node_similarity,node_language,node_modelcontract toneAmber
class node_screens,node_sampledata,node_session,node_replies,node_browserstore toneMint
class node_assistantroute,node_modelserver,node_spaceassistant toneRose
class node_ollama toneIndigo
```

## Components

### User interaction

- [Simulator UI](https://github.com/imadityarai/vanipilot/blob/main/app/page.jsx): `app/page.jsx`
- [Pilot controller](https://github.com/imadityarai/vanipilot/blob/main/app/use-pilot.js): `app/use-pilot.js`
- [Speech capture](https://github.com/imadityarai/vanipilot/blob/main/app/automatic-speech.js): `app/automatic-speech.js`
- [Speech recognition](https://github.com/imadityarai/vanipilot/blob/main/app/speech-worker.mjs): `app/speech-worker.mjs`

### Request understanding

- [Intent parser](https://github.com/imadityarai/vanipilot/blob/main/lib/intent.mjs): `lib/intent.mjs`
- [Question matcher](https://github.com/imadityarai/vanipilot/blob/main/lib/similarity.mjs): `lib/similarity.mjs`
- [Language handling](https://github.com/imadityarai/vanipilot/blob/main/lib/language.mjs): `lib/language.mjs`
- [Model validation](https://github.com/imadityarai/vanipilot/blob/main/lib/model-contract.mjs): `lib/model-contract.mjs`

### Demo task simulation

- [Screen planner](https://github.com/imadityarai/vanipilot/blob/main/lib/screens.mjs): `lib/screens.mjs`
- [Sample records](https://github.com/imadityarai/vanipilot/blob/main/lib/scenario.mjs): `lib/scenario.mjs`
- [Task transactions](https://github.com/imadityarai/vanipilot/blob/main/lib/session.mjs): `lib/session.mjs`
- [Reminder replies](https://github.com/imadityarai/vanipilot/blob/main/app/task-replies.js): `app/task-replies.js`
- **Browser storage**

### Assistant services

- [Assistant API route](https://github.com/imadityarai/vanipilot/blob/main/app/api/assistant/route.model.js): `app/api/assistant/route.model.js`
- [Model assistant](https://github.com/imadityarai/vanipilot/blob/main/lib/model-server.mjs): `lib/model-server.mjs`
- [Space assistant adapter](https://github.com/imadityarai/vanipilot/blob/main/lib/space-assistant.mjs): `lib/space-assistant.mjs`

### Other components

- **User**
- **Ollama service**

## Connections

- User → Simulator UI: uses (evidence: `README.md`)
- Simulator UI → Pilot controller: delegates to (evidence: `app/page.jsx`)
- Simulator UI → Sample records: reads (evidence: `app/page.jsx`)
- Simulator UI → Screen planner: renders from (evidence: `app/page.jsx`)
- Simulator UI → Task transactions: summarizes with (evidence: `app/page.jsx`)
- Pilot controller → Speech capture: starts (evidence: `app/use-pilot.js`)
- Speech capture → Speech recognition: transcribes via
- Speech recognition → Language handling: loads locales (evidence: `app/speech-worker.mjs`)
- Pilot controller → Intent parser: interprets with (evidence: `app/use-pilot.js`)
- Pilot controller → Question matcher: matches questions (evidence: `app/use-pilot.js`)
- Pilot controller → Model validation: checks credentials (evidence: `app/use-pilot.js`)
- Pilot controller → Language handling: selects reply locale (evidence: `app/use-pilot.js`)
- Pilot controller → Screen planner: plans routes (evidence: `app/use-pilot.js`)
- Pilot controller → Task transactions: commits tasks (evidence: `app/use-pilot.js`)
- Pilot controller → Reminder replies: formats reminders (evidence: `app/use-pilot.js`)
- Intent parser → Sample records: matches records (evidence: `lib/intent.mjs`)
- Intent parser → Model validation: uses operations (evidence: `lib/intent.mjs`)
- Question matcher → Sample records: formats results (evidence: `lib/similarity.mjs`)
- Screen planner → Sample records: plans from records (evidence: `lib/screens.mjs`)
- Task transactions → Sample records: uses sample state (evidence: `lib/session.mjs`)
- Task transactions → Screen planner: checks goal view (evidence: `lib/session.mjs`)
- Task transactions → Browser storage: persists changes (evidence: `README.md`)
- Reminder replies → Task transactions: uses task replies (evidence: `app/task-replies.js`)
- Assistant API route → Model assistant: routes to (evidence: `app/api/assistant/route.model.js`)
- Model assistant → Sample records: grounds answers (evidence: `lib/model-server.mjs`)
- Model assistant → Language handling: uses locale rules (evidence: `lib/model-server.mjs`)
- Model assistant → Model validation: validates output (evidence: `lib/model-server.mjs`)
- Space assistant adapter → Model assistant: configures assistant (evidence: `lib/space-assistant.mjs`)
- Model assistant → Ollama service: requests model (evidence: `README.md`)
