# jay4ignite/yana architecture

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

- Interactive diagram: https://gitdiagram.com/jay4ignite/yana
- Repository: https://github.com/jay4ignite/yana

## Overview

YANA is a native Windows desktop AI companion. Its main workflow runs from user chat or voice input through the desktop IPC client to the FastAPI agent, then to AI response or a planned, permission-gated tool execution; results return to the UI for chat and task display. Memory, voice, and native desktop controls are distinct supporting capabilities. The execution pipeline, memory manager, and voice pipeline are evidenced by sampled source; additional major capabilities and their paths follow the README and tree.

Main entry points: [`apps/agent/app/core/executor/pipeline.py`](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/executor/pipeline.py) (Execution Pipeline), [`apps/agent/app/api/conversation_routes.py`](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/conversation_routes.py) (Conversation API), [`apps/agent/app/voice/pipeline.py`](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/voice/pipeline.py) (Voice Pipeline), [`apps/desktop/src/App.tsx`](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/App.tsx) (Companion UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Companion"]
  node_app["Companion UI<br/>[App.tsx]"]
  node_ui_views["Pet and Chat Views"]
  node_protocol_hook["Protocol Hook<br/>[useProtocol.ts]"]
  node_client["Agent Client<br/>[agentClient.ts]"]
  node_native["Native IPC<br/>[agent.rs]"]
  node_supervisor["Agent Supervisor"]
  node_contracts["IPC Contracts<br/>[types.ts]"]
  node_protocol_pkg["Shared Domain Types"]
end

subgraph group_agent["Agent Runtime"]
  node_api["FastAPI Routes<br/>[main.py]"]
  node_chat["Conversation API"]
  node_planner["Task Planner<br/>[base.py]"]
  node_tasks["Task Lifecycle<br/>[task_manager.py]"]
  node_ai["AI Providers<br/>[factory.py]"]
  node_executor["Execution Pipeline<br/>[pipeline.py]"]
  node_verifier["Result Verifier<br/>[base.py]"]
  node_audit["Security Audit<br/>[audit.py]"]
end

subgraph group_tools["Safe Actions"]
  node_registry["Tool Registry<br/>[registry.py]"]
  node_permissions["Permission Manager<br/>[manager.py]"]
  node_tools_impl["OS Tool Modules"]
end

subgraph group_memory["Local Memory"]
  node_memory_api["Memory API<br/>[memory_routes.py]"]
  node_memory_manager["Memory Manager<br/>[memory_manager.py]"]
  node_memory_db[("SQLite Memory<br/>[db.py]")]
end

subgraph group_voice["Voice Interaction"]
  node_voice_api["Voice API<br/>[voice_routes.py]"]
  node_voice_pipeline["Voice Pipeline<br/>[pipeline.py]"]
  node_audio_devices["Audio Devices<br/>[device_manager.py]"]
  node_speech["STT and TTS"]
end

node_user(("User"))
node_os["Operating System"]

node_user -->|"interacts"| node_ui_views
node_app -->|"renders"| node_ui_views
node_app -->|"uses"| node_protocol_hook
node_protocol_hook -->|"sends requests"| node_client
node_client -->|"invokes IPC"| node_native
node_native -->|"manages agent"| node_supervisor
node_native -->|"forwards requests"| node_api
node_api -->|"routes chat"| node_chat
node_chat -->|"requests generation"| node_ai
node_chat -->|"tracks task"| node_tasks
node_chat -->|"uses conversation context"| node_memory_manager
node_api -->|"routes agent tasks"| node_planner
node_planner -->|"submits tool calls"| node_executor
node_executor -->|"looks up tools"| node_registry
node_executor -->|"authorizes calls"| node_permissions
node_executor -->|"executes approved tool"| node_tools_impl
node_tools_impl -->|"operates on"| node_os
node_executor -->|"verifies result"| node_verifier
node_executor -->|"records events"| node_audit
node_verifier -->|"returns verification"| node_executor
node_memory_api -->|"delegates memory operations"| node_memory_manager
node_memory_manager -->|"reads and writes"| node_memory_db
node_voice_api -->|"controls voice"| node_voice_pipeline
node_voice_pipeline -->|"checks devices"| node_audio_devices
node_voice_pipeline -->|"transcribes and synthesizes"| node_speech
node_voice_pipeline -->|"submits transcript"| node_chat
node_protocol_hook -->|"uses message types"| node_contracts
node_app -->|"uses domain models"| node_protocol_pkg

click node_app "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/App.tsx"
click node_ui_views "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/components/Companion/ExpandedAssistantView.tsx"
click node_protocol_hook "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/hooks/useProtocol.ts"
click node_client "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/services/agentClient.ts"
click node_native "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src-tauri/src/commands/agent.rs"
click node_supervisor "https://github.com/jay4ignite/yana/blob/main/apps/desktop/src-tauri/src/agent_supervisor.rs"
click node_contracts "https://github.com/jay4ignite/yana/blob/main/packages/protocol/src/types.ts"
click node_api "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/main.py"
click node_chat "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/conversation_routes.py"
click node_planner "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/planner/base.py"
click node_tasks "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/task_manager.py"
click node_ai "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/ai/factory.py"
click node_executor "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/executor/pipeline.py"
click node_registry "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/tools/registry.py"
click node_permissions "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/permissions/manager.py"
click node_tools_impl "https://github.com/jay4ignite/yana/tree/main/apps/agent/app/tools"
click node_verifier "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/verifier/base.py"
click node_audit "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/security/audit.py"
click node_memory_api "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/memory_routes.py"
click node_memory_manager "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/memory/memory_manager.py"
click node_memory_db "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/memory/db.py"
click node_voice_api "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/voice_routes.py"
click node_voice_pipeline "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/voice/pipeline.py"
click node_audio_devices "https://github.com/jay4ignite/yana/blob/main/apps/agent/app/voice/device_manager.py"
click node_speech "https://github.com/jay4ignite/yana/tree/main/apps/agent/app/voice"
click node_protocol_pkg "https://github.com/jay4ignite/yana/tree/main/packages/shared-types/src"

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_ui_views,node_protocol_hook,node_client,node_native,node_supervisor,node_contracts,node_protocol_pkg,node_user toneBlue
class node_api,node_chat,node_planner,node_tasks,node_ai,node_executor,node_verifier,node_audit toneAmber
class node_registry,node_permissions,node_tools_impl toneMint
class node_memory_api,node_memory_manager,node_memory_db toneRose
class node_voice_api,node_voice_pipeline,node_audio_devices,node_speech,node_os toneIndigo
```

## Components

### Desktop Companion

- [Companion UI](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/App.tsx): `apps/desktop/src/App.tsx`
- [Pet and Chat Views](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/components/Companion/ExpandedAssistantView.tsx): `apps/desktop/src/components/Companion/ExpandedAssistantView.tsx`
- [Protocol Hook](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/hooks/useProtocol.ts): `apps/desktop/src/hooks/useProtocol.ts`
- [Agent Client](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src/services/agentClient.ts): `apps/desktop/src/services/agentClient.ts`
- [Native IPC](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src-tauri/src/commands/agent.rs): `apps/desktop/src-tauri/src/commands/agent.rs`
- [Agent Supervisor](https://github.com/jay4ignite/yana/blob/main/apps/desktop/src-tauri/src/agent_supervisor.rs): `apps/desktop/src-tauri/src/agent_supervisor.rs`
- [IPC Contracts](https://github.com/jay4ignite/yana/blob/main/packages/protocol/src/types.ts): `packages/protocol/src/types.ts`
- [Shared Domain Types](https://github.com/jay4ignite/yana/tree/main/packages/shared-types/src): `packages/shared-types/src`

### Agent Runtime

- [FastAPI Routes](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/main.py): `apps/agent/app/main.py`
- [Conversation API](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/conversation_routes.py): `apps/agent/app/api/conversation_routes.py`
- [Task Planner](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/planner/base.py): `apps/agent/app/core/planner/base.py`
- [Task Lifecycle](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/task_manager.py): `apps/agent/app/core/task_manager.py`
- [AI Providers](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/ai/factory.py): `apps/agent/app/ai/factory.py`
- [Execution Pipeline](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/executor/pipeline.py): `apps/agent/app/core/executor/pipeline.py`
- [Result Verifier](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/core/verifier/base.py): `apps/agent/app/core/verifier/base.py`
- [Security Audit](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/security/audit.py): `apps/agent/app/security/audit.py`

### Safe Actions

- [Tool Registry](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/tools/registry.py): `apps/agent/app/tools/registry.py`
- [Permission Manager](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/permissions/manager.py): `apps/agent/app/permissions/manager.py`
- [OS Tool Modules](https://github.com/jay4ignite/yana/tree/main/apps/agent/app/tools): `apps/agent/app/tools`

### Local Memory

- [Memory API](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/memory_routes.py): `apps/agent/app/api/memory_routes.py`
- [Memory Manager](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/memory/memory_manager.py): `apps/agent/app/memory/memory_manager.py`
- [SQLite Memory](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/memory/db.py): `apps/agent/app/memory/db.py`

### Voice Interaction

- [Voice API](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/api/voice_routes.py): `apps/agent/app/api/voice_routes.py`
- [Voice Pipeline](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/voice/pipeline.py): `apps/agent/app/voice/pipeline.py`
- [Audio Devices](https://github.com/jay4ignite/yana/blob/main/apps/agent/app/voice/device_manager.py): `apps/agent/app/voice/device_manager.py`
- [STT and TTS](https://github.com/jay4ignite/yana/tree/main/apps/agent/app/voice): `apps/agent/app/voice`

### Other components

- **User**
- **Operating System**

## Connections

- User → Pet and Chat Views: interacts
- Companion UI → Pet and Chat Views: renders
- Companion UI → Protocol Hook: uses
- Protocol Hook → Agent Client: sends requests
- Agent Client → Native IPC: invokes IPC
- Native IPC → Agent Supervisor: manages agent
- Native IPC → FastAPI Routes: forwards requests
- FastAPI Routes → Conversation API: routes chat
- Conversation API → AI Providers: requests generation
- Conversation API → Task Lifecycle: tracks task
- Conversation API → Memory Manager: uses conversation context
- FastAPI Routes → Task Planner: routes agent tasks
- Task Planner → Execution Pipeline: submits tool calls
- Execution Pipeline → Tool Registry: looks up tools
- Execution Pipeline → Permission Manager: authorizes calls
- Execution Pipeline → OS Tool Modules: executes approved tool
- OS Tool Modules → Operating System: operates on
- Execution Pipeline → Result Verifier: verifies result
- Execution Pipeline → Security Audit: records events
- Result Verifier → Execution Pipeline: returns verification
- Memory API → Memory Manager: delegates memory operations
- Memory Manager → SQLite Memory: reads and writes
- Voice API → Voice Pipeline: controls voice
- Voice Pipeline → Audio Devices: checks devices
- Voice Pipeline → STT and TTS: transcribes and synthesizes
- Voice Pipeline → Conversation API: submits transcript
- Protocol Hook → IPC Contracts: uses message types
- Companion UI → Shared Domain Types: uses domain models
