# devopstem/plna_voice architecture

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

- Interactive diagram: https://gitdiagram.com/devopstem/plna_voice
- Repository: https://github.com/devopstem/plna_voice

## Overview

Daemon is a local Linux assistant and TCP control plane. The primary remote workflow is controller → newline-JSON protocol → authenticated daemon request handling → allowlisted skill routing → OS action and response; local text commands use the same router. A separate microphone path captures PCM through selectable sources into the voice engine, while optional TTS speaks skill results. The graph reflects README capabilities and shown source references; some audio and networking internals were not excerpted, so uncertain links are omitted.

Main entry points: [`src/app/main.cpp`](https://github.com/devopstem/plna_voice/blob/main/src/app/main.cpp) (CLI and mode entry), [`src/net/daemon_server.cpp`](https://github.com/devopstem/plna_voice/blob/main/src/net/daemon_server.cpp) (TCP daemon server), [`src/skills/router.cpp`](https://github.com/devopstem/plna_voice/blob/main/src/skills/router.cpp) (Skill router), [`src/audio/make_source.cpp`](https://github.com/devopstem/plna_voice/blob/main/src/audio/make_source.cpp) (Audio source factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry modes"]
  node_main["CLI and mode entry<br/>[main.cpp]"]
end

subgraph group_audio["Audio capture"]
  node_source_factory["Audio source factory<br/>[make_source.cpp]"]
  node_mock_source["Mock source<br/>[mock_source.cpp]"]
  node_pipewire_source["PipeWire capture"]
  node_audio_ring[("PCM ring buffer<br/>[ring_buffer.cpp]")]
  node_voice_engine["Voice engine<br/>[voice_engine.cpp]"]
end

subgraph group_control["Control plane"]
  node_daemon_server["TCP daemon server<br/>[daemon_server.cpp]"]
  node_protocol["JSON line protocol<br/>[protocol.cpp]"]
  node_protocol_contract["Shared protocol contract"]
end

subgraph group_skills["Skills and OS"]
  node_skill_router["Skill router<br/>[router.cpp]"]
  node_open_skill["Browser opener<br/>[os_open.cpp]"]
  node_status_skill["System status skills<br/>[os_status.cpp]"]
  node_process["Safe process launcher<br/>[process.cpp]"]
end

subgraph group_speech["Speech output"]
  node_tts["TTS engine<br/>[engine.cpp]"]
  node_speech_cli["Speech CLI tools"]
end

node_operator(("Local operator"))
node_controller(("Remote controller"))

node_operator -->|"enters command"| node_main
node_main -->|"routes local text"| node_skill_router
node_main -->|"selects source"| node_source_factory
node_source_factory -->|"creates source"| node_mock_source
node_source_factory -->|"creates source"| node_pipewire_source
node_main -->|"starts capture"| node_voice_engine
node_pipewire_source -->|"buffers PCM"| node_audio_ring
node_voice_engine -->|"reads PCM"| node_audio_ring
node_controller -.->|"sends TCP request"| node_daemon_server
node_main -->|"starts daemon"| node_daemon_server
node_daemon_server -->|"parses and replies"| node_protocol
node_daemon_server -->|"dispatches skill"| node_skill_router
node_protocol_contract -.->|"defines request shape"| node_protocol
node_skill_router -->|"dispatches match"| node_open_skill
node_skill_router -->|"dispatches match"| node_status_skill
node_open_skill -->|"launches application"| node_process
node_main -->|"creates and invokes"| node_tts
node_tts -->|"spawns speech tool"| node_process
node_tts -->|"speaks through"| node_speech_cli

click node_main "https://github.com/devopstem/plna_voice/blob/main/src/app/main.cpp"
click node_source_factory "https://github.com/devopstem/plna_voice/blob/main/src/audio/make_source.cpp"
click node_mock_source "https://github.com/devopstem/plna_voice/blob/main/src/audio/mock_source.cpp"
click node_pipewire_source "https://github.com/devopstem/plna_voice/blob/main/src/audio/pipewire_source.cpp"
click node_audio_ring "https://github.com/devopstem/plna_voice/blob/main/src/audio/ring_buffer.cpp"
click node_voice_engine "https://github.com/devopstem/plna_voice/blob/main/src/core/voice_engine.cpp"
click node_daemon_server "https://github.com/devopstem/plna_voice/blob/main/src/net/daemon_server.cpp"
click node_protocol "https://github.com/devopstem/plna_voice/blob/main/src/net/protocol.cpp"
click node_protocol_contract "https://github.com/devopstem/plna_voice/blob/main/protocol/schema/v1/request.schema.json"
click node_skill_router "https://github.com/devopstem/plna_voice/blob/main/src/skills/router.cpp"
click node_open_skill "https://github.com/devopstem/plna_voice/blob/main/src/skills/os_open.cpp"
click node_status_skill "https://github.com/devopstem/plna_voice/blob/main/src/skills/os_status.cpp"
click node_process "https://github.com/devopstem/plna_voice/blob/main/src/platform/process.cpp"
click node_tts "https://github.com/devopstem/plna_voice/blob/main/src/tts/engine.cpp"

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_main toneBlue
class node_source_factory,node_mock_source,node_pipewire_source,node_audio_ring,node_voice_engine toneAmber
class node_daemon_server,node_protocol,node_protocol_contract toneMint
class node_skill_router,node_open_skill,node_status_skill,node_process toneRose
class node_tts,node_speech_cli,node_operator,node_controller toneIndigo
```

## Components

### Entry modes

- [CLI and mode entry](https://github.com/devopstem/plna_voice/blob/main/src/app/main.cpp): `src/app/main.cpp`

### Audio capture

- [Audio source factory](https://github.com/devopstem/plna_voice/blob/main/src/audio/make_source.cpp): `src/audio/make_source.cpp`
- [Mock source](https://github.com/devopstem/plna_voice/blob/main/src/audio/mock_source.cpp): `src/audio/mock_source.cpp`
- [PipeWire capture](https://github.com/devopstem/plna_voice/blob/main/src/audio/pipewire_source.cpp): `src/audio/pipewire_source.cpp`
- [PCM ring buffer](https://github.com/devopstem/plna_voice/blob/main/src/audio/ring_buffer.cpp): `src/audio/ring_buffer.cpp`
- [Voice engine](https://github.com/devopstem/plna_voice/blob/main/src/core/voice_engine.cpp): `src/core/voice_engine.cpp`

### Control plane

- [TCP daemon server](https://github.com/devopstem/plna_voice/blob/main/src/net/daemon_server.cpp): `src/net/daemon_server.cpp`
- [JSON line protocol](https://github.com/devopstem/plna_voice/blob/main/src/net/protocol.cpp): `src/net/protocol.cpp`
- [Shared protocol contract](https://github.com/devopstem/plna_voice/blob/main/protocol/schema/v1/request.schema.json): `protocol/schema/v1/request.schema.json`

### Skills and OS

- [Skill router](https://github.com/devopstem/plna_voice/blob/main/src/skills/router.cpp): `src/skills/router.cpp`
- [Browser opener](https://github.com/devopstem/plna_voice/blob/main/src/skills/os_open.cpp): `src/skills/os_open.cpp`
- [System status skills](https://github.com/devopstem/plna_voice/blob/main/src/skills/os_status.cpp): `src/skills/os_status.cpp`
- [Safe process launcher](https://github.com/devopstem/plna_voice/blob/main/src/platform/process.cpp): `src/platform/process.cpp`

### Speech output

- [TTS engine](https://github.com/devopstem/plna_voice/blob/main/src/tts/engine.cpp): `src/tts/engine.cpp`
- **Speech CLI tools**

### Other components

- **Local operator**
- **Remote controller**

## Connections

- Local operator → CLI and mode entry: enters command (evidence: `src/app/main.cpp`)
- CLI and mode entry → Skill router: routes local text (evidence: `src/app/main.cpp`)
- CLI and mode entry → Audio source factory: selects source (evidence: `src/app/main.cpp`)
- Audio source factory → Mock source: creates source (evidence: `src/audio/make_source.cpp`)
- Audio source factory → PipeWire capture: creates source (evidence: `src/audio/make_source.cpp`)
- CLI and mode entry → Voice engine: starts capture (evidence: `src/app/main.cpp`)
- PipeWire capture → PCM ring buffer: buffers PCM
- Voice engine → PCM ring buffer: reads PCM
- Remote controller → TCP daemon server: sends TCP request (evidence: `README.md`)
- CLI and mode entry → TCP daemon server: starts daemon (evidence: `src/app/main.cpp`)
- TCP daemon server → JSON line protocol: parses and replies
- TCP daemon server → Skill router: dispatches skill
- Shared protocol contract → JSON line protocol: defines request shape (evidence: `README.md`)
- Skill router → Browser opener: dispatches match (evidence: `src/skills/router.cpp`)
- Skill router → System status skills: dispatches match (evidence: `src/skills/router.cpp`)
- Browser opener → Safe process launcher: launches application (evidence: `src/skills/os_open.cpp`)
- CLI and mode entry → TTS engine: creates and invokes (evidence: `src/app/main.cpp`)
- TTS engine → Safe process launcher: spawns speech tool (evidence: `src/tts/engine.cpp`)
- TTS engine → Speech CLI tools: speaks through (evidence: `src/tts/engine.cpp`)
