# dario90vlc/sagitari architecture

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

- Interactive diagram: https://gitdiagram.com/dario90vlc/sagitari
- Repository: https://github.com/dario90vlc/sagitari

## Overview

SAGITARI is a Windows desktop AI agent: the user submits a request in chat, Electron routes it to an agent that plans and executes permitted tools, then streams progress and results back to the interface. The agent also supports background tasks, project-aware coding, memory, skills, and MCP tools. Voice is a separate input/output path integrated through the same desktop boundary. The README documents these capabilities; sampled source confirms parts of the agent, IPC, task, and voice behavior, so uncertain internal links are omitted.

Main entry points: [`agent/agent.js`](https://github.com/dario90vlc/sagitari/blob/main/agent/agent.js) (Agent loop), [`main/main.js`](https://github.com/dario90vlc/sagitari/blob/main/main/main.js) (Electron main), [`main/voice/manager.js`](https://github.com/dario90vlc/sagitari/blob/main/main/voice/manager.js) (Voice manager), [`main/preload.js`](https://github.com/dario90vlc/sagitari/blob/main/main/preload.js) (Renderer bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_chat["Chat interface<br/>[10-chat.js]"]
  node_settings["Settings interface<br/>[30-ajustes.js]"]
  node_voiceui["Voice interface<br/>[20-voz.js]"]
  node_preload["Renderer bridge<br/>[preload.js]"]
  node_main["Electron main<br/>[main.js]"]
end

subgraph group_agent["Agent runtime"]
  node_agentcore["Agent loop<br/>[agent.js]"]
  node_context["Context budgeting<br/>[contexto.js]"]
  node_guardrails["Safety controls<br/>[guardrails.js]"]
  node_models["Model routing<br/>[models.js]"]
  node_project["Project awareness<br/>[proyecto.js]"]
  node_repomap["Project map<br/>[repomap.js]"]
  node_skills["Skills<br/>[skills.js]"]
end

subgraph group_actions["Action capabilities"]
  node_tools["Tool registry<br/>[tools.js]"]
  node_browser["Browser control<br/>[browser.js]"]
  node_mcp["MCP integration<br/>[mcp.js]"]
end

subgraph group_state["Local state"]
  node_tasks["Background tasks<br/>[tasks.js]"]
  node_checkpoints[("Run checkpoints<br/>[checkpoints.js]")]
  node_memory[("Memory and habits<br/>[memory.js]")]
end

subgraph group_voice["Voice"]
  node_voiceipc["Voice IPC<br/>[ipc-voz.js]"]
  node_voicemanager["Voice manager<br/>[manager.js]"]
  node_whisper["Local dictation<br/>[whisper.js]"]
  node_voiceengines["Speech engines<br/>[tts-local.js]"]
end

node_user(("User"))
node_os["Windows desktop"]
node_provider{{"Model provider"}}
node_mcpserver{{"MCP servers"}}

node_user -->|"submits request"| node_chat
node_chat -->|"sends chat"| node_preload
node_settings -->|"updates configuration"| node_preload
node_voiceui -->|"sends voice events"| node_preload
node_preload -->|"forwards IPC"| node_main
node_main -->|"starts agent"| node_agentcore
node_agentcore -->|"budgets prompt"| node_context
node_agentcore -->|"checks actions"| node_guardrails
node_agentcore -->|"dispatches tools"| node_tools
node_agentcore -->|"requests completion"| node_models
node_models -->|"calls model"| node_provider
node_agentcore -->|"loads project context"| node_project
node_project -->|"uses project map"| node_repomap
node_agentcore -->|"loads skill instructions"| node_skills
node_agentcore -->|"uses local memory"| node_memory
node_agentcore -->|"dispatches MCP tools"| node_mcp
node_mcp -->|"calls server tools"| node_mcpserver
node_tools -->|"uses browser"| node_browser
node_tools -->|"acts on desktop"| node_os
node_main -->|"routes task requests"| node_tasks
node_tasks -->|"creates task agents"| node_agentcore
node_tasks -->|"saves run state"| node_checkpoints
node_main -->|"routes voice IPC"| node_voiceipc
node_voiceipc -->|"controls voice session"| node_voicemanager
node_voicemanager -.->|"transcribes audio"| node_whisper
node_voicemanager -->|"synthesizes speech"| node_voiceengines
node_main -->|"streams agent events"| node_chat
node_voicemanager -->|"emits voice events"| node_voiceui

click node_chat "https://github.com/dario90vlc/sagitari/blob/main/renderer/10-chat.js"
click node_settings "https://github.com/dario90vlc/sagitari/blob/main/renderer/30-ajustes.js"
click node_voiceui "https://github.com/dario90vlc/sagitari/blob/main/renderer/20-voz.js"
click node_preload "https://github.com/dario90vlc/sagitari/blob/main/main/preload.js"
click node_main "https://github.com/dario90vlc/sagitari/blob/main/main/main.js"
click node_agentcore "https://github.com/dario90vlc/sagitari/blob/main/agent/agent.js"
click node_context "https://github.com/dario90vlc/sagitari/blob/main/agent/contexto.js"
click node_guardrails "https://github.com/dario90vlc/sagitari/blob/main/agent/guardrails.js"
click node_tools "https://github.com/dario90vlc/sagitari/blob/main/agent/tools.js"
click node_browser "https://github.com/dario90vlc/sagitari/blob/main/agent/browser.js"
click node_models "https://github.com/dario90vlc/sagitari/blob/main/agent/models.js"
click node_project "https://github.com/dario90vlc/sagitari/blob/main/agent/proyecto.js"
click node_repomap "https://github.com/dario90vlc/sagitari/blob/main/agent/repomap.js"
click node_tasks "https://github.com/dario90vlc/sagitari/blob/main/agent/tasks.js"
click node_checkpoints "https://github.com/dario90vlc/sagitari/blob/main/agent/checkpoints.js"
click node_memory "https://github.com/dario90vlc/sagitari/blob/main/agent/memory.js"
click node_skills "https://github.com/dario90vlc/sagitari/blob/main/agent/skills.js"
click node_mcp "https://github.com/dario90vlc/sagitari/blob/main/agent/mcp.js"
click node_voiceipc "https://github.com/dario90vlc/sagitari/blob/main/main/ipc-voz.js"
click node_voicemanager "https://github.com/dario90vlc/sagitari/blob/main/main/voice/manager.js"
click node_whisper "https://github.com/dario90vlc/sagitari/blob/main/main/voice/whisper.js"
click node_voiceengines "https://github.com/dario90vlc/sagitari/blob/main/main/voice/tts-local.js"

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_chat,node_settings,node_voiceui,node_preload,node_main,node_user toneBlue
class node_agentcore,node_context,node_guardrails,node_models,node_project,node_repomap,node_skills toneAmber
class node_tools,node_browser,node_mcp,node_mcpserver toneMint
class node_tasks,node_checkpoints,node_memory toneRose
class node_voiceipc,node_voicemanager,node_whisper,node_voiceengines,node_os,node_provider toneIndigo
```

## Components

### Desktop interface

- [Chat interface](https://github.com/dario90vlc/sagitari/blob/main/renderer/10-chat.js): `renderer/10-chat.js`
- [Settings interface](https://github.com/dario90vlc/sagitari/blob/main/renderer/30-ajustes.js): `renderer/30-ajustes.js`
- [Voice interface](https://github.com/dario90vlc/sagitari/blob/main/renderer/20-voz.js): `renderer/20-voz.js`
- [Renderer bridge](https://github.com/dario90vlc/sagitari/blob/main/main/preload.js): `main/preload.js`
- [Electron main](https://github.com/dario90vlc/sagitari/blob/main/main/main.js): `main/main.js`

### Agent runtime

- [Agent loop](https://github.com/dario90vlc/sagitari/blob/main/agent/agent.js): `agent/agent.js`
- [Context budgeting](https://github.com/dario90vlc/sagitari/blob/main/agent/contexto.js): `agent/contexto.js`
- [Safety controls](https://github.com/dario90vlc/sagitari/blob/main/agent/guardrails.js): `agent/guardrails.js`
- [Model routing](https://github.com/dario90vlc/sagitari/blob/main/agent/models.js): `agent/models.js`
- [Project awareness](https://github.com/dario90vlc/sagitari/blob/main/agent/proyecto.js): `agent/proyecto.js`
- [Project map](https://github.com/dario90vlc/sagitari/blob/main/agent/repomap.js): `agent/repomap.js`
- [Skills](https://github.com/dario90vlc/sagitari/blob/main/agent/skills.js): `agent/skills.js`

### Action capabilities

- [Tool registry](https://github.com/dario90vlc/sagitari/blob/main/agent/tools.js): `agent/tools.js`
- [Browser control](https://github.com/dario90vlc/sagitari/blob/main/agent/browser.js): `agent/browser.js`
- [MCP integration](https://github.com/dario90vlc/sagitari/blob/main/agent/mcp.js): `agent/mcp.js`

### Local state

- [Background tasks](https://github.com/dario90vlc/sagitari/blob/main/agent/tasks.js): `agent/tasks.js`
- [Run checkpoints](https://github.com/dario90vlc/sagitari/blob/main/agent/checkpoints.js): `agent/checkpoints.js`
- [Memory and habits](https://github.com/dario90vlc/sagitari/blob/main/agent/memory.js): `agent/memory.js`

### Voice

- [Voice IPC](https://github.com/dario90vlc/sagitari/blob/main/main/ipc-voz.js): `main/ipc-voz.js`
- [Voice manager](https://github.com/dario90vlc/sagitari/blob/main/main/voice/manager.js): `main/voice/manager.js`
- [Local dictation](https://github.com/dario90vlc/sagitari/blob/main/main/voice/whisper.js): `main/voice/whisper.js`
- [Speech engines](https://github.com/dario90vlc/sagitari/blob/main/main/voice/tts-local.js): `main/voice/tts-local.js`

### Other components

- **User**
- **Windows desktop**
- **Model provider**
- **MCP servers**

## Connections

- User → Chat interface: submits request
- Chat interface → Renderer bridge: sends chat
- Settings interface → Renderer bridge: updates configuration
- Voice interface → Renderer bridge: sends voice events
- Renderer bridge → Electron main: forwards IPC
- Electron main → Agent loop: starts agent
- Agent loop → Context budgeting: budgets prompt
- Agent loop → Safety controls: checks actions
- Agent loop → Tool registry: dispatches tools
- Agent loop → Model routing: requests completion
- Model routing → Model provider: calls model
- Agent loop → Project awareness: loads project context
- Project awareness → Project map: uses project map
- Agent loop → Skills: loads skill instructions
- Agent loop → Memory and habits: uses local memory
- Agent loop → MCP integration: dispatches MCP tools
- MCP integration → MCP servers: calls server tools
- Tool registry → Browser control: uses browser
- Tool registry → Windows desktop: acts on desktop
- Electron main → Background tasks: routes task requests
- Background tasks → Agent loop: creates task agents
- Background tasks → Run checkpoints: saves run state
- Electron main → Voice IPC: routes voice IPC
- Voice IPC → Voice manager: controls voice session
- Voice manager → Local dictation: transcribes audio
- Voice manager → Speech engines: synthesizes speech
- Electron main → Chat interface: streams agent events
- Voice manager → Voice interface: emits voice events
