Engineering a 24/7 personal AI agent harness on a headless Mac mini—combining Nous Hermes Agent, custom bot definitions, sandboxed local tool execution, and a secure Telegram Command & Control (C2) gateway.
The Core Business Problem
Running autonomous AI agents with local shell and filesystem access introduces two major engineering challenges: (1) keeping the runtime alive 24/7 without cloud VM costs or open inbound firewall ports, and (2) enforcing strict identity authentication and human-in-the-loop (HITL) approval so remote mobile commands cannot accidentally corrupt production state.
Engineered Architecture & Solution
Architected a 3-layer agent harness: (1) Provisioned an Apple Silicon Mac mini as a 3.6W headless node managed by macOS launchd with zero open inbound ports, (2) Configured Hermes Agent with a custom Staff Analytics & Ops persona (SOUL.md), reusable procedural skills (SKILL.md), and SQLite episodic memory, and (3) Wired an encrypted Telegram Bot C2 gateway with numeric User ID allowlisting and inline confirmation buttons for state-mutating operations.
check overnight ETL & Tesla PostGIS sync status
- •Host Uptime: 42d 18h • Idle Power: 3.6W • Thermal: 34°C
- •Supabase Keep-Alive & ETL: 100% pass (0 schema fan-out anomalies)
- •Tesla PostGIS Stream: +4,820 ticks ingested • Vehicle in Deep Sleep (0.04 kW)
3-Layer Personal AI Agent Harness (Mac mini + Hermes + Telegram)
Always-On Mac mini Host & launchd Daemon
Turning Apple Silicon into a silent, 3.5W 24/7 personal AI server with zero inbound port exposure
Cloud LLM chat interfaces lose context the moment you close the browser tab and cannot touch local databases, scripts, or private repositories. By provisioning a dedicated Mac mini as an always-on headless node managed by macOS launchd, the agent harness runs continuously with automatic crash recovery and outbound-only TLS polling.
- Configured headless power management (sudo pmset -a sleep 0 autorestart 1) for uninterrupted 24/7 operation at <4W idle draw.
- Registered Hermes Agent as a persistent user-level launchd service (KeepAlive=true) with structured stdout/stderr log rotation.
- Zero port-forwarding or public IP exposure: all Telegram communication occurs over outbound TLS 1.3 long-polling / Cloudflare tunnel.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "...">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.chiyul.hermes-agent</string>
<key>ProgramArguments</key>
<array>
<string>/Users/chiyul/.local/bin/hermes</string>
<string>gateway</string>
<string>--platform</string>
<string>telegram</string>
</array>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/chiyul/workspace</string>
</dict>
</plist>Hermes Agent Harness & Custom Bot Definition
Defining agent identity (SOUL.md), procedural skills (SKILL.md), and persistent cross-session memory
An LLM without a harness is just a stateless text generator. Inside Hermes, I defined a custom bot persona (SOUL.md), wired domain-specific tools (PostgreSQL runner, Python UV script executor, PPTX deck builder, Git ops), and enabled SQLite episodic memory so the bot remembers prior decisions and learns new skills autonomously.
- Custom Bot Persona (SOUL.md): Enforces concise executive communication, zero-discrepancy metric checks, and strict directory boundaries.
- Procedural Skill Library (SKILL.md): Reusable, self-improving workflows for daily telemetry briefings, ETL audits, and automated slide generation.
- Model-Agnostic Routing: Dynamically switches between frontier reasoning models for complex SQL/math and fast models for routine status checks.
Telegram Remote C2 Gateway & Security Guardrails
Mobile command-and-control from anywhere with cryptographic user allowlisting and HITL approval gates
Connecting an autonomous shell-capable agent to a mobile messenger requires strict defense-in-depth. I engineered the Telegram gateway as a locked-down Command & Control (C2) interface where only my verified Telegram numeric user ID can issue instructions, and any state-mutating command triggers an interactive inline approval keyboard.
- Strict Identity Allowlist: Drops any incoming Telegram webhook/update whose numeric from.id does not match TELEGRAM_ALLOWED_USER_IDS.
- Tiered Action Permissions: Read-only diagnostics (/audit_pipeline, SQL SELECT, log inspection) run immediately; file edits or Git pushes require 1-tap inline button confirmation.
- Bi-Directional File & Alert Bus: Delivers generated .pptx decks, chart PNGs, and proactive anomaly alerts directly to my phone.