# thiyan07/zara architecture

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

- Interactive diagram: https://gitdiagram.com/thiyan07/zara
- Repository: https://github.com/thiyan07/zara

## Overview

Zara is a personal assistant whose main workflow accepts a text or voice turn, builds context and memory, obtains an LLM proposal, applies deterministic authorization and routing, invokes a device capability, verifies the result, and replies. The graph also preserves device-fabric management, missions and scheduling, voice, and Android/Linux runtimes. Some subsystems are documented or indexed but their implementation was not sampled, so their internal links are omitted where evidence is unavailable.

Main entry points: [`core/conversation.py`](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/conversation.py) (Turn reasoning), [`core/fabric.py`](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/fabric.py) (Device fabric), [`core/app.py`](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/app.py) (REST gateway), [`android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt`](https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt) (Android device bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_turn["Conversation and reasoning"]
  node_api["REST gateway<br/>[app.py]"]
  node_conversation["Turn reasoning<br/>[conversation.py]"]
  node_context["Prompt context<br/>[context.py]"]
  node_memory[("Persistent memory<br/>[memory.py]")]
  node_sessions[("Chat sessions<br/>[sessions.py]")]
  node_llm["LLM providers<br/>[providers.py]"]
end

subgraph group_control["Policy and orchestration"]
  node_policy["Action policy<br/>[policy.py]"]
  node_governor["Safety governor<br/>[governor.py]"]
  node_execution["Tool execution<br/>[execution.py]"]
  node_fabric["Device fabric<br/>[fabric.py]"]
  node_resolver["Capability resolver<br/>[resolver.py]"]
  node_scheduler["Job scheduler<br/>[scheduler.py]"]
  node_missions["Mission tracking<br/>[missions.py]"]
end

subgraph group_devices["Device capabilities"]
  node_linuxagent["Linux agent<br/>[agent.py]"]
  node_linuxtools["Safe Linux tools<br/>[tools_linux.py]"]
end

subgraph group_voice["Voice interaction"]
  node_voice["Voice pipeline<br/>[voice.py]"]
end

subgraph group_mobile["Android runtime"]
  node_androidactivity["Android app activity<br/>[MainActivity.kt]"]
  node_bridge["Android device bridge<br/>[DeviceBridge.kt]"]
  node_accessibility["Accessibility service<br/>[ZaraA11yService.kt]"]
  node_voiceinteraction["Voice interaction session"]
end

node_user(("User"))
node_androidos["Android system"]

node_user -->|"sends turn"| node_api
node_api -->|"runs turn"| node_conversation
node_conversation -->|"builds context"| node_context
node_conversation -->|"considers memory"| node_memory
node_conversation -->|"records messages"| node_sessions
node_conversation -->|"requests proposal"| node_llm
node_conversation -->|"checks proposal"| node_policy
node_conversation -->|"checks action"| node_governor
node_conversation -->|"executes action"| node_execution
node_conversation -->|"creates mission"| node_missions
node_api -->|"serves fabric data"| node_fabric
node_fabric -->|"uses safety checks"| node_governor
node_fabric -->|"uses scheduling"| node_scheduler
node_resolver -->|"queries capabilities"| node_fabric
node_linuxagent -->|"dispatches tools"| node_linuxtools
node_linuxagent -->|"reports capabilities"| node_fabric
node_api -->|"offers voice turns"| node_voice
node_androidactivity -->|"attaches bridge"| node_bridge
node_bridge -->|"uses service"| node_accessibility
node_voiceinteraction -->|"uses bridge"| node_bridge
node_androidos -.->|"provides device APIs"| node_bridge

click node_api "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/app.py"
click node_conversation "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/conversation.py"
click node_context "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/context.py"
click node_memory "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/memory.py"
click node_sessions "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/sessions.py"
click node_llm "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/providers.py"
click node_policy "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/policy.py"
click node_governor "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/governor.py"
click node_execution "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/execution.py"
click node_fabric "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/fabric.py"
click node_resolver "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/resolver.py"
click node_scheduler "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/scheduler.py"
click node_missions "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/missions.py"
click node_linuxagent "https://github.com/thiyan07/zara/blob/stage15-real-transfer/device/linux/agent.py"
click node_linuxtools "https://github.com/thiyan07/zara/blob/stage15-real-transfer/device/linux/tools_linux.py"
click node_voice "https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/voice.py"
click node_androidactivity "https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/MainActivity.kt"
click node_bridge "https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt"
click node_accessibility "https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraA11yService.kt"
click node_voiceinteraction "https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraVoiceInteractionSession.kt"

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_api,node_conversation,node_context,node_memory,node_sessions,node_llm,node_user toneBlue
class node_policy,node_governor,node_execution,node_fabric,node_resolver,node_scheduler,node_missions toneAmber
class node_linuxagent,node_linuxtools toneMint
class node_voice toneRose
class node_androidactivity,node_bridge,node_accessibility,node_voiceinteraction,node_androidos toneIndigo
```

## Components

### Conversation and reasoning

- [REST gateway](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/app.py): `core/app.py`
- [Turn reasoning](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/conversation.py): `core/conversation.py`
- [Prompt context](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/context.py): `core/context.py`
- [Persistent memory](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/memory.py): `core/memory.py`
- [Chat sessions](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/sessions.py): `core/sessions.py`
- [LLM providers](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/providers.py): `core/providers.py`

### Policy and orchestration

- [Action policy](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/policy.py): `core/policy.py`
- [Safety governor](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/governor.py): `core/governor.py`
- [Tool execution](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/execution.py): `core/execution.py`
- [Device fabric](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/fabric.py): `core/fabric.py`
- [Capability resolver](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/resolver.py): `core/resolver.py`
- [Job scheduler](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/scheduler.py): `core/scheduler.py`
- [Mission tracking](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/missions.py): `core/missions.py`

### Device capabilities

- [Linux agent](https://github.com/thiyan07/zara/blob/stage15-real-transfer/device/linux/agent.py): `device/linux/agent.py`
- [Safe Linux tools](https://github.com/thiyan07/zara/blob/stage15-real-transfer/device/linux/tools_linux.py): `device/linux/tools_linux.py`

### Voice interaction

- [Voice pipeline](https://github.com/thiyan07/zara/blob/stage15-real-transfer/core/voice.py): `core/voice.py`

### Android runtime

- [Android app activity](https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/MainActivity.kt): `android/android/app/src/main/kotlin/dev/zara/zara_android/MainActivity.kt`
- [Android device bridge](https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt): `android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt`
- [Accessibility service](https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraA11yService.kt): `android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraA11yService.kt`
- [Voice interaction session](https://github.com/thiyan07/zara/blob/stage15-real-transfer/android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraVoiceInteractionSession.kt): `android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraVoiceInteractionSession.kt`

### Other components

- **User**
- **Android system**

## Connections

- User → REST gateway: sends turn
- REST gateway → Turn reasoning: runs turn (evidence: `core/app.py`)
- Turn reasoning → Prompt context: builds context (evidence: `core/conversation.py`)
- Turn reasoning → Persistent memory: considers memory (evidence: `core/conversation.py`)
- Turn reasoning → Chat sessions: records messages (evidence: `core/conversation.py`)
- Turn reasoning → LLM providers: requests proposal (evidence: `core/conversation.py`)
- Turn reasoning → Action policy: checks proposal (evidence: `core/conversation.py`)
- Turn reasoning → Safety governor: checks action (evidence: `core/conversation.py`)
- Turn reasoning → Tool execution: executes action (evidence: `core/conversation.py`)
- Turn reasoning → Mission tracking: creates mission (evidence: `core/conversation.py`)
- REST gateway → Device fabric: serves fabric data (evidence: `core/app.py`)
- Device fabric → Safety governor: uses safety checks (evidence: `core/fabric.py`)
- Device fabric → Job scheduler: uses scheduling (evidence: `core/fabric.py`)
- Capability resolver → Device fabric: queries capabilities (evidence: `core/resolver.py`)
- Linux agent → Safe Linux tools: dispatches tools (evidence: `device/linux/agent.py`)
- Linux agent → Device fabric: reports capabilities (evidence: `device/linux/agent.py`)
- REST gateway → Voice pipeline: offers voice turns (evidence: `core/app.py`)
- Android app activity → Android device bridge: attaches bridge (evidence: `android/android/app/src/main/kotlin/dev/zara/zara_android/MainActivity.kt`)
- Android device bridge → Accessibility service: uses service (evidence: `android/android/app/src/main/kotlin/dev/zara/zara_android/DeviceBridge.kt`)
- Voice interaction session → Android device bridge: uses bridge (evidence: `android/android/app/src/main/kotlin/dev/zara/zara_android/ZaraVoiceInteractionSession.kt`)
- Android system → Android device bridge: provides device APIs
