# shark-empire/mitos-settings architecture

> Architecture diagram of the GitHub repository shark-empire/mitos-settings, 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/shark-empire/mitos-settings
- Repository: https://github.com/shark-empire/mitos-settings

## Overview

MITOS Settings is a system-settings product with a shared typed settings core, three user-facing entry points (CLI, text navigator, GTK app), and a privileged Unix-socket daemon. The primary workflow is to browse or address a setting, validate and authorize a change, persist it, and—where applicable—apply it to Linux or project selected settings to home.conf. The README documents grants and live synchronization as additional capabilities. Sampled source confirms several call paths; links for unsampled subsystems follow explicit README documentation, and uncertain wiring is omitted.

Main entry points: [`src/settings/manager.rs`](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/manager.rs) (Settings manager), [`src/ipc/server.rs`](https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/server.rs) (Unix IPC server), [`src/categories/mod.rs`](https://github.com/shark-empire/mitos-settings/blob/main/src/categories/mod.rs) (Category registry), [`src/grants/service_client.rs`](https://github.com/shark-empire/mitos-settings/blob/main/src/grants/service_client.rs) (Grant service client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontends["User interfaces"]
  node_cli["CLI commands<br/>[mod.rs]"]
  node_navigator["Text navigator<br/>[application.rs]"]
  node_gui["GTK app<br/>[main.rs]"]
end

subgraph group_core["Settings core"]
  node_manager["Settings manager<br/>[manager.rs]"]
  node_categories["Category registry<br/>[mod.rs]"]
  node_schema["Typed schema<br/>[schema.rs]"]
  node_validation["Value validation<br/>[validation.rs]"]
  node_persistence["Settings persistence<br/>[persistence.rs]"]
  node_history["Change history<br/>[history.rs]"]
end

subgraph group_daemon["Privileged IPC"]
  node_daemon["Daemon entry<br/>[main.rs]"]
  node_ipc_server["Unix IPC server<br/>[server.rs]"]
  node_ipc_client["IPC client<br/>[client.rs]"]
  node_peer_auth["Peer authorization<br/>[permissions.rs]"]
end

subgraph group_system["System integration"]
  node_hardware["Hardware readers<br/>[mod.rs]"]
  node_services["System services<br/>[mod.rs]"]
  node_linux["Linux commands<br/>[linux.rs]"]
end

subgraph group_permissions["Permissions and sync"]
  node_grants["Grant service client<br/>[service_client.rs]"]
  node_grant_model["Grant model<br/>[model.rs]"]
  node_home_conf["Desktop config projection<br/>[home_conf.rs]"]
  node_events["Change event bus<br/>[events.rs]"]
end

node_user(("Settings user"))
node_linux_system(("Linux system"))
node_mitos_service["mitos-service"]
node_desktop_apps(("MITOS desktop apps"))
node_grant_user(("Grant user"))

node_user -->|"runs commands"| node_cli
node_user -->|"navigates settings"| node_navigator
node_user -->|"uses app"| node_gui
node_cli -->|"reads and writes"| node_manager
node_navigator -->|"reads and writes"| node_manager
node_gui -->|"reads and writes"| node_manager
node_manager -->|"registers categories"| node_categories
node_categories -->|"registers settings"| node_schema
node_manager -->|"looks up keys"| node_schema
node_manager -->|"validates changes"| node_validation
node_manager -->|"loads and saves"| node_persistence
node_manager -->|"records and reads"| node_history
node_manager -->|"forwards privileged writes"| node_ipc_client
node_daemon -->|"loads authority manager"| node_manager
node_daemon -->|"starts server"| node_ipc_server
node_ipc_server -->|"authenticates peer"| node_peer_auth
node_ipc_server -->|"dispatches settings requests"| node_manager
node_ipc_client -->|"sends requests"| node_ipc_server
node_gui -->|"subscribes to changes"| node_ipc_client
node_categories -->|"reads live information"| node_hardware
node_categories -->|"reads live information"| node_services
node_services -->|"runs system tools"| node_linux
node_hardware -->|"reads proc and sys"| node_linux_system
node_linux -->|"applies changes"| node_linux_system
node_manager -->|"projects selected settings"| node_home_conf
node_home_conf -->|"writes home.conf"| node_desktop_apps
node_manager -->|"publishes changes"| node_events
node_ipc_server -->|"relays change notices"| node_events
node_cli -->|"executes grant commands"| node_grants
node_ipc_server -->|"dispatches grant requests"| node_grants
node_grants -->|"parses grant data"| node_grant_model
node_grants -->|"sends grant requests"| node_mitos_service
node_grant_user -.->|"answers elevation prompt"| node_mitos_service

click node_cli "https://github.com/shark-empire/mitos-settings/blob/main/src/cli/mod.rs"
click node_navigator "https://github.com/shark-empire/mitos-settings/blob/main/src/app/application.rs"
click node_gui "https://github.com/shark-empire/mitos-settings/blob/main/gui/src/main.rs"
click node_manager "https://github.com/shark-empire/mitos-settings/blob/main/src/settings/manager.rs"
click node_categories "https://github.com/shark-empire/mitos-settings/blob/main/src/categories/mod.rs"
click node_schema "https://github.com/shark-empire/mitos-settings/blob/main/src/settings/schema.rs"
click node_validation "https://github.com/shark-empire/mitos-settings/blob/main/src/settings/validation.rs"
click node_persistence "https://github.com/shark-empire/mitos-settings/blob/main/src/settings/persistence.rs"
click node_history "https://github.com/shark-empire/mitos-settings/blob/main/src/settings/history.rs"
click node_daemon "https://github.com/shark-empire/mitos-settings/blob/main/src/main.rs"
click node_ipc_server "https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/server.rs"
click node_ipc_client "https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/client.rs"
click node_peer_auth "https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/permissions.rs"
click node_hardware "https://github.com/shark-empire/mitos-settings/blob/main/src/hardware/mod.rs"
click node_services "https://github.com/shark-empire/mitos-settings/blob/main/src/services/mod.rs"
click node_linux "https://github.com/shark-empire/mitos-settings/blob/main/src/platform/linux.rs"
click node_grants "https://github.com/shark-empire/mitos-settings/blob/main/src/grants/service_client.rs"
click node_grant_model "https://github.com/shark-empire/mitos-settings/blob/main/src/grants/model.rs"
click node_home_conf "https://github.com/shark-empire/mitos-settings/blob/main/src/services/home_conf.rs"
click node_events "https://github.com/shark-empire/mitos-settings/blob/main/src/notifications/events.rs"

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_cli,node_navigator,node_gui,node_user,node_grant_user toneBlue
class node_manager,node_categories,node_schema,node_validation,node_persistence,node_history toneAmber
class node_daemon,node_ipc_server,node_ipc_client,node_peer_auth toneMint
class node_hardware,node_services,node_linux toneRose
class node_grants,node_grant_model,node_home_conf,node_events,node_linux_system,node_mitos_service,node_desktop_apps toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/shark-empire/mitos-settings/blob/main/src/cli/mod.rs): `src/cli/mod.rs`
- [Text navigator](https://github.com/shark-empire/mitos-settings/blob/main/src/app/application.rs): `src/app/application.rs`
- [GTK app](https://github.com/shark-empire/mitos-settings/blob/main/gui/src/main.rs): `gui/src/main.rs`

### Settings core

- [Settings manager](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/manager.rs): `src/settings/manager.rs`
- [Category registry](https://github.com/shark-empire/mitos-settings/blob/main/src/categories/mod.rs): `src/categories/mod.rs`
- [Typed schema](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/schema.rs): `src/settings/schema.rs`
- [Value validation](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/validation.rs): `src/settings/validation.rs`
- [Settings persistence](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/persistence.rs): `src/settings/persistence.rs`
- [Change history](https://github.com/shark-empire/mitos-settings/blob/main/src/settings/history.rs): `src/settings/history.rs`

### Privileged IPC

- [Daemon entry](https://github.com/shark-empire/mitos-settings/blob/main/src/main.rs): `src/main.rs`
- [Unix IPC server](https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/server.rs): `src/ipc/server.rs`
- [IPC client](https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/client.rs): `src/ipc/client.rs`
- [Peer authorization](https://github.com/shark-empire/mitos-settings/blob/main/src/ipc/permissions.rs): `src/ipc/permissions.rs`

### System integration

- [Hardware readers](https://github.com/shark-empire/mitos-settings/blob/main/src/hardware/mod.rs): `src/hardware/mod.rs`
- [System services](https://github.com/shark-empire/mitos-settings/blob/main/src/services/mod.rs): `src/services/mod.rs`
- [Linux commands](https://github.com/shark-empire/mitos-settings/blob/main/src/platform/linux.rs): `src/platform/linux.rs`

### Permissions and sync

- [Grant service client](https://github.com/shark-empire/mitos-settings/blob/main/src/grants/service_client.rs): `src/grants/service_client.rs`
- [Grant model](https://github.com/shark-empire/mitos-settings/blob/main/src/grants/model.rs): `src/grants/model.rs`
- [Desktop config projection](https://github.com/shark-empire/mitos-settings/blob/main/src/services/home_conf.rs): `src/services/home_conf.rs`
- [Change event bus](https://github.com/shark-empire/mitos-settings/blob/main/src/notifications/events.rs): `src/notifications/events.rs`

### Other components

- **Settings user**
- **Linux system**
- **mitos-service**
- **MITOS desktop apps**
- **Grant user**

## Connections

- Settings user → CLI commands: runs commands
- Settings user → Text navigator: navigates settings
- Settings user → GTK app: uses app
- CLI commands → Settings manager: reads and writes
- Text navigator → Settings manager: reads and writes
- GTK app → Settings manager: reads and writes
- Settings manager → Category registry: registers categories
- Category registry → Typed schema: registers settings
- Settings manager → Typed schema: looks up keys
- Settings manager → Value validation: validates changes
- Settings manager → Settings persistence: loads and saves
- Settings manager → Change history: records and reads
- Settings manager → IPC client: forwards privileged writes
- Daemon entry → Settings manager: loads authority manager
- Daemon entry → Unix IPC server: starts server
- Unix IPC server → Peer authorization: authenticates peer
- Unix IPC server → Settings manager: dispatches settings requests
- IPC client → Unix IPC server: sends requests
- GTK app → IPC client: subscribes to changes
- Category registry → Hardware readers: reads live information
- Category registry → System services: reads live information
- System services → Linux commands: runs system tools
- Hardware readers → Linux system: reads proc and sys
- Linux commands → Linux system: applies changes
- Settings manager → Desktop config projection: projects selected settings
- Desktop config projection → MITOS desktop apps: writes home.conf
- Settings manager → Change event bus: publishes changes
- Unix IPC server → Change event bus: relays change notices
- CLI commands → Grant service client: executes grant commands
- Unix IPC server → Grant service client: dispatches grant requests
- Grant service client → Grant model: parses grant data
- Grant service client → mitos-service: sends grant requests
- Grant user → mitos-service: answers elevation prompt
