-
Notifications
You must be signed in to change notification settings - Fork 0
01 Architecture Deep Dive
This document provides a technical overview of the R-AI-OS architecture, focusing on the daemon-centric design, client-server communication, and security mechanisms.
The core of R-AI-OS is the aiosd (AI Operating System Daemon). It runs as a background process and serves as the central intelligence and state coordinator for the entire system.
-
Neural Indexing: Maintains a hybrid search index combining BM25 (lexical) and Vector (semantic) search capabilities via the
Cortexmodule. - Entity Discovery: Automatically scans the workspace to identify projects, tools, and documentation.
-
Background Workers:
- Health Worker: Periodically scans projects for compliance and structural integrity.
- Git Worker: Monitors repository states and handles synchronization.
- Sentinel Worker: Watches for critical file changes and enforces "Sentinel Guard" policies.
- Cortex Worker: Manages embedding generation and vector store updates.
-
State Management: Holds the
DaemonState, which is a thread-safe, shared repository of all active agents, health reports, and pending approvals.
The raios binary is the primary interface for users. It supports both a rich Terminal User Interface (TUI) and a standard Command Line Interface (CLI).
-
Ratatui Integration: Uses the
ratatuicrate for high-performance, immediate-mode terminal rendering. -
Asynchronous Core: The TUI runs on a main loop that polls for user input while simultaneously listening for background messages (
BgMsg) from the IPC thread. - Component-Based UI: The interface is divided into specialized panels (Dashboard, Search, Sentinel, MemPalace) that react to state changes.
- For quick commands (e.g.,
raios search "query"), the client bypasses the TUI and communicates directly with the daemon to fetch and display results.
Communication between raios and aiosd is handled via a custom IPC protocol named Aura, designed for low latency and high security.
-
Transport: TCP over
127.0.0.1:42069. -
Handshake (Aura Hardened):
- Upon startup,
aiosdgenerates a unique UUID v4 token. - This token is stored securely in
~/.config/raios/.ipc_token(or the platform equivalent). - When
raiosconnects, it must immediately send anAUTH <token>command. -
aiosddrops any connection that fails this handshake within the first message.
- Upon startup,
- All messages are newline-delimited JSON objects.
-
Commands (Client -> Daemon):
{"command": "Search", "query": "..."} -
Events (Daemon -> Client):
{"event": "SearchResults", "results": [...]}
The following sequence illustrates how a search task is processed:
-
Initiation: The user types a query in the
raiosSearch panel. -
Request:
raiossends aVectorSearchcommand over the TCP socket. -
Processing:
-
aiosdreceives the command and triggers theCortexmodule. - It performs a semantic search in the vector database and a lexical search in the BM25 index.
- The results are fused using Reciprocal Rank Fusion (RRF).
-
-
Response:
aiosdsends aVectorResultsevent back to the client. -
Update: The
raiosIPC thread receives the JSON, parses it into aBgMsg::SearchResults, and sends it to the main UI thread via an mpsc channel. - Rendering: The TUI detects the new results in the application state and re-renders the Search panel.
R-AI-OS: Empowering developers with a hardened, daemon-backed AI workspace.