← Back to Projects

leptons1618@anishgiri.dev:~/projects/sia-proto cat project.toml

Systems 2025 Stable

SIA Proto

A local-first system monitoring agent that tracks CPU and memory, stores events in SQLite, exposes a JSON-RPC CLI over Unix sockets, and optionally enriches insights via a local Ollama model — all within a 200 MB memory budget and a systemd service.

category
Systems
year
2025
status
Stable
stack
10 tools
highlights
6
write-up
8 min read

01Highlights

  1. Runs as a systemd service with a 200 MB memory budget and 500 MB disk quota enforced in code.
  2. Exposes a JSON-RPC interface over a Unix socket at /run/sia/sia.sock for zero-network CLI communication.
  3. Monitors CPU and memory at 5-second and 10-second intervals, generating threshold-breach events persisted to SQLite via sqlx.
  4. Optional Ollama integration enriches events with AI suggestions without leaving the local machine.
  5. CLI commands (status, list, show) connect to the running agent over the socket, requiring no separate configuration.
  6. Installation script deploys binaries to /usr/local/bin, config to /etc/sia, data to /var/lib/sia, and socket to /run/sia.

02Built with

  • 01Rust
  • 02Tokio
  • 03SQLx
  • 04SQLite
  • 05sysinfo
  • 06Clap
  • 07Reqwest
  • 08Serde
  • 09Chrono
  • 10systemd

03Case study

September 21, 2026 8 min read 1,766 words

SIA Proto — Building a Local-First System Monitoring Agent with Unix-Socket IPC and Optional LLM Enrichment

How a Rust agent monitors CPU and memory, persists events to SQLite, exposes a JSON-RPC CLI over a Unix socket, and optionally enriches insights via a local Ollama model — all within a 200 MB memory budget and a systemd service.

The problem

Existing system monitors either pull telemetry to the cloud, require heavy runtimes, or lack a scriptable interface for local automation; the constraint was a persistent Linux agent that stays under 200 MB RSS, survives reboots via systemd, answers CLI queries over a zero-copy Unix socket, and keeps all data on disk without external dependencies.

The solution

Built the agent in Rust on Tokio with sqlx-backed SQLite for event storage, a JSON-RPC server on a Unix socket for the CLI, clap for command parsing, and a gated Ollama client that only activates when configured — deployed via an install script that places binaries in /usr/local/bin, config in /etc/sia, data in /var/lib/sia, and the socket in /run/sia.

Outcomes

  • The agent runs as a systemd service with a 200 MB memory budget and 500 MB disk quota, auto-starting on boot.
  • Unix-socket JSON-RPC lets the CLI query status, list events, and show details with sub-millisecond latency and no HTTP overhead.
  • SQLite persistence survives restarts and supports time-range queries for forensic analysis of CPU and memory spikes.

+2 more in the write-up

Inside the write-up

  1. Why a local-first agent instead of existing tools
  2. Workspace architecture and crate boundaries
  3. Collection and analysis loop
  4. Storage schema and query patterns
  5. IPC protocol and CLI contract
  6. LLM enrichment as an optional layer
  7. Installation, service management, and dev ergonomics
Read the full case study →

Related projects