---
title: Atlas Event-Driven Automation
owner: Will / Atlas
status: implemented-partial
created: 2026-05-14T16:50:33-07:00
source_task: t_fe2dbd34
---

# Atlas Event-Driven Automation

This runbook records the first safe event-driven automation layer for Atlas. The implementation favors deterministic no-agent monitoring, silent success, deduped alerts, and explicit human approval before exposing new public webhooks or enabling agent-backed external triggers.

## Production target profile

- Target profile: Hermes `default`, the stable production gateway profile.
- Gateway state observed: running under `hermes-gateway.service` with PID 982929.
- Webhook state observed: webhook platform is not enabled on the default profile; `http://127.0.0.1:8644/health` is not listening.
- Cron state observed before this work: existing default-profile jobs were present; workstream jobs were added to the same default profile.

## Implemented event routes

### System threshold watchdog

- Script: `/home/will/.hermes/scripts/system_threshold_watchdog.py`
- State: `/home/will/.hermes/state/system_threshold_watchdog.json`
- Cron job: `451d1563e678`
- Schedule: every 10 minutes
- Delivery: `discord:1494453542243532932`
- Mode: no-agent; script stdout is delivered directly.
- Behavior: silent when healthy/no new alert; dedupes unchanged alerts.
- Checks:
  - root/home disk usage: warning at 85%, critical at 92%;
  - 15-minute load average greater than CPU cores;
  - available memory below 10%;
  - failed critical user services;
  - local health endpoints for Docker, RAG/embedding, voice memo processor, and Obsidian reindex.
- Verification commands:
  - `/home/will/.hermes/scripts/system_threshold_watchdog.py --dry-run`
  - `hermes -p default cron run 451d1563e678`
  - `hermes -p default cron list`

### Blocked Kanban escalation

- Script: `/home/will/.hermes/scripts/blocked_kanban_escalation.py`
- State: `/home/will/.hermes/state/blocked_kanban_escalation_seen.json`
- Cron job: `02304524b741`
- Schedule: every 30 minutes
- Delivery: `discord:1494453542243532932`
- Mode: no-agent; script stdout is delivered directly.
- Behavior: reads `/home/will/.hermes/kanban/boards/*/kanban.db` in read-only mode; silent when no stale blocked tasks; dedupes repeated alerts by task and escalation bucket.
- Escalation thresholds: more than 4 business hours or more than 24 wall-clock hours; repeats at 48h and 72h buckets.
- Verification commands:
  - `/home/will/.hermes/scripts/blocked_kanban_escalation.py --dry-run`
  - `hermes -p default cron run 02304524b741`
  - `hermes -p default cron list`

## Existing routes confirmed

### n8n failure handling

- Existing export: `/home/will/lab/swarm/swarm-common/n8n-workflows/G9ylNbHbnJ6fWX2C.json`
- Workflow name: `n8n Failure Digest`
- Export state: `active: true`
- Schedule in export: hourly.
- Decision: do not add a duplicate Hermes n8n failure cron yet. The existing n8n workflow is deterministic, already active, and already performs failure digesting; add a Hermes supplement only if duplicate/deduped notification behavior outside n8n is later required.

### Transcript ingestion local path

- Local services checked:
  - `http://127.0.0.1:18813/healthz` returned OK.
  - `http://127.0.0.1:18808/healthz` returned OK.
  - `http://127.0.0.1:18810/healthz` returned OK.
- Smoke payload sent to n8n `obsidian-chat-summary` webhook with synthetic, non-private transcript content.
- Smoke result: HTTP 200, note path `Inbox/Chat Summaries/2026-05-14 - Atlas Event-Driven Automation Smoke.md`.
- Accepted local payload shape:

```json
{
  "type": "transcript",
  "title": "Short title",
  "summary": "Human-readable summary",
  "content": "Transcript text or sanitized excerpt",
  "tags": ["transcript", "atlas"]
}
```

- Privacy policy: raw transcript content should go to local capture/Obsidian paths only by default. Do not include raw transcript content in chat notifications or public webhooks unless Will explicitly approves that source and payload class.

## Deferred routes and blockers

### Webhook platform / GitHub PR review

Deferred. Enabling the webhook platform on the production gateway requires generating/storing a global HMAC secret, editing default-profile config or `.env`, choosing a public exposure/tunnel strategy, and restarting the production gateway. GitHub PR review also needs a first repository and delivery target policy. Do not guess these in an implementation task.

Proposed first route after approval:

- Subscription name: `github-pr-review`
- Event: `pull_request`
- Skill: `github-code-review`
- Delivery: GitHub comment if configured; otherwise the review Discord channel.
- Prompt should instruct the reviewer to inspect correctness, safety, tests, and config/secrets risk, and never merge.

### Feed summaries

Deferred. A feed summary cron should not be created until Will chooses the feed source list and digest destination. Keep the source list in a tracked plain config file rather than embedding it in the cron prompt. Start daily, with agent mode enabled only for summarization/prioritization.

### Public transcript webhook

Deferred. Use local n8n/Obsidian capture for now. A public deliver-only transcript notification route needs a payload privacy decision and HMAC-protected webhook platform first.

## Notification policy

- Silent success: healthy/no-op automations print nothing.
- Deterministic alerts use no-agent scripts and direct delivery.
- Agent runs are reserved for outputs where reasoning/summarization is the value, such as PR review and curated feed digesting.
- Alerts should include source, severity, time, correlation id/execution id/task id where available, and the next manual action.
- Alerts must not include secrets, tokens, raw stack traces, private payload dumps, or raw transcript PII.
- Deduplicate repeated alerts with local state or workflow logic.
- Severity mapping:
  - Critical: service down, disk at or above 92%, unhealthy core containers, active board blocked task older than 24h.
  - Warning: disk at or above 85%, high load, low memory, first non-critical workflow failure, optional service health warning.
  - Info: successful transcript capture, feed digest, PR review completion.

## Verification performed 2026-05-14

- `python -m py_compile` succeeded for both watchdog scripts.
- `system_threshold_watchdog.py --dry-run` returned OK with no threshold alerts.
- `blocked_kanban_escalation.py --dry-run` returned OK with no stale blocked tasks.
- Default-mode watchdog executions produced no stdout when healthy/no-op.
- Cron jobs `451d1563e678` and `02304524b741` were created under `hermes -p default` and force-triggered.
- After the scheduler tick, both new cron jobs showed last run `ok`.
- n8n, voice memo processor, Obsidian reindex, Docker health, and RAG/embedding health endpoints responded OK during implementation checks.
