AI Agent & Harness

Always-On AI Agent Harness: Mac mini Hermes Daemon & Telegram Remote C2

Self-hosted Hermes Agent on Apple Silicon with custom bot personas (SOUL.md), procedural skills, and Telegram remote control

Always-On AI Agent Harness: Mac mini Hermes Daemon & Telegram Remote C2
By: Chiyul Song
Hermes Agent • Mac mini (macOS launchd) • Telegram Bot API • Python UV • SQLite Memory
Executive Abstract
Target Ecosystems: Personal AI Infrastructure • Autonomous Agent Ops

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.

Hermes Agent Harness // Mac mini Daemon ↔ Telegram C2 Simulator
H
Hermes MacMini Bot
● Online • Home Mac mini (launchd)
08:14 KST • Remote LTE
/audit_pipeline

check overnight ETL & Tesla PostGIS sync status

✅ Overnight Pipeline & Node Health [Mac mini M4]2.8s
  • •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)
📎 health_audit_20261106.jsonDelivered
/audit_pipeline check overnight ETL & Tesla PostGIS sync status
Mac mini Host Execution Trace (hermes-daemon)
Auto-Approved (Read-Only Tool Scope)
AUTH_GATEVerified Telegram sender chat_id=719482*** against TELEGRAM_ALLOWED_USERS.
PERSONA_LOADLoaded ~/.hermes/SOUL.md (Staff Analytics & Ops Harness) + SQLite episodic memory.
TOOL_CALL [1/2]uv run scripts/check_etl_health.py --db supabase_prod --window 24h
TOOL_CALL [2/2]SELECT count(*), max(recorded_at) FROM vehicle_telemetry_ticks WHERE recorded_at > now() - interval '12 hours';
C2_DISPATCHFormatted Markdown telemetry card and pushed via Telegram Bot API.
Host Hardware
Mac mini (24/7)
Tools Invoked
3 Sandboxed Tools
Inbound Ports
0 Open (Outbound TLS)
System Architecture

3-Layer Personal AI Agent Harness (Mac mini + Hermes + Telegram)

LAYER 01

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.
// ~/Library/LaunchAgents/com.chiyul.hermes-agent.plist
<?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>
LAYER 02

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.
LAYER 03

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.

Technologies & Protocols

Hermes AgentMac mini (Apple Silicon)macOS launchdTelegram Bot API (C2)SOUL.md / SKILL.mdSQLite Episodic MemoryPython UV