diff --git a/swarm-common/obsidian-vault/will/will-shared-zap/Infrastructure/Automation/n8n Implementation Handoff.md b/swarm-common/obsidian-vault/will/will-shared-zap/Infrastructure/Automation/n8n Implementation Handoff.md index 4c756a2..9dad762 100644 --- a/swarm-common/obsidian-vault/will/will-shared-zap/Infrastructure/Automation/n8n Implementation Handoff.md +++ b/swarm-common/obsidian-vault/will/will-shared-zap/Infrastructure/Automation/n8n Implementation Handoff.md @@ -5,7 +5,7 @@ tags: [automation, n8n, handoff, atlas] created: 2026-05-13 updated: 2026-05-13 status: active -related: [[Infrastructure/Automation/n8n Workflows]], [[Infrastructure/Automation/n8n IMAP Triage Pipeline]], [[Infrastructure/Automation/n8n Nightly Vault Sync]], [[Infrastructure/Services/Docker Services]] +related: [[Infrastructure/Automation/n8n Workflows]], [[Infrastructure/Automation/n8n IMAP Triage Pipeline]], [[Infrastructure/Automation/n8n Morning Brief]], [[Infrastructure/Automation/n8n Evening Digest]], [[Infrastructure/Services/Docker Services]] --- # n8n Implementation Handoff @@ -130,6 +130,21 @@ Last verified on 2026-05-13 (evening): - Add systemd timer health once a host-side endpoint exists. - Add reminders and task queue summary. +### Morning Brief + +- Workflow ID: `g3IdGZCK1EtTsv9T` +- Status: active +- Trigger: daily at 06:30 America/Los_Angeles +- Current behavior: + - Collects: weather (wttr.in/Seattle), swarm Docker health (`172.19.0.1:18809`), n8n self-health (`127.0.0.1:5678`), LiteLLM health (`172.19.0.1:18804`), email highlights via n8n API (recent IMAP Triage executions), Google Calendar (graceful skip if OAuth expired). + - Synthesizes with local gemma-4-26B LLM (`172.19.0.1:18806`). + - Delivers to Telegram (chat 8367012007, HTML format) and Obsidian (`Notes/YYYY-MM-DD Morning Brief.md` with YAML frontmatter). + - All 6 data-collection nodes have `continueOnFail`; one failure does not block the brief. +- Remaining improvement: + - Re-enable calendar section once Google OAuth is re-authorized. + - Add relevant news via SearXNG or Brave Search. + - Add tasks/reminders section from Obsidian notes tagged `action-required`. + ### Daily OpenClaw Session Digest - Workflow ID: `qqYwAD05AvRHrHPc` @@ -194,43 +209,6 @@ Last verified on 2026-05-13 (evening): ## Not yet implemented -### Morning brief - -Desired scope: - -- Calendar for today. -- Email highlights / needs-reply items. -- Weather for Seattle. -- Tasks/reminders. -- Relevant news. -- Swarm/n8n health rollup. - -Recommended implementation: - -1. Build n8n scheduled workflow for data collection and retries. -2. Use local LLM for cheap classification/short summarization. -3. Call Atlas/Hermes only for final synthesis if quality matters. -4. Deliver to Telegram/Discord ops/home channel. -5. Save brief to Obsidian daily note. - -### Evening digest - -Desired scope: - -- What ran today. -- Failed n8n executions. -- Failed cron jobs/timers. -- Reminders due soon. -- New notes/captures. -- Short summaries and next actions. - -Recommended implementation: - -1. Extend Nightly Obsidian Vault Sync or create a separate evening digest workflow. -2. Pull n8n Failure Digest output, cron/timer health, and Obsidian note deltas. -3. Send concise report to Telegram/Discord. -4. Save durable digest note in Obsidian. - ### Weekly review Desired scope: @@ -329,8 +307,31 @@ curl -fsS --max-time 3 http://127.0.0.1:18808/healthz docker inspect --format '{{.Name}} {{.State.Status}} {{if .State.Health}}{{.State.Health.Status}}{{else}}no-health{{end}} restarts={{.RestartCount}}' n8n-agent docker exec n8n-agent n8n export:workflow --all --output=/tmp/workflows-verify.json + +# Docker health endpoint (host-side systemd service) +curl -fsS --max-time 3 http://127.0.0.1:18809/health | python3 -m json.tool + +# Verify from inside n8n container +docker exec n8n-agent wget -qO- http://172.19.0.1:18809/health ``` +### n8n Public API access + +The `N8N_API_KEY` in `~/lab/swarm/.env` is stale (returns 401). Get the working API key from the n8n credential store: + +```bash +docker exec n8n-agent sh -lc 'n8n export:credentials --id=UPAHgUJVRqZQceL4 --decrypted --output=/tmp/n8n-api-cred.json >/tmp/n8n-api-cred.log 2>&1' +docker cp n8n-agent:/tmp/n8n-api-cred.json /tmp/n8n-api-cred.json +API_KEY=$(python3 -c "import json; c=json.load(open('/tmp/n8n-api-cred.json')); c=c[0] if isinstance(c,list) else c; print(c['data']['value'])") +rm -f /tmp/n8n-api-cred.json +docker exec n8n-agent rm -f /tmp/n8n-api-cred.json /tmp/n8n-api-cred.log + +# Example: list workflows +curl -sS -H "X-N8N-API-KEY: $API_KEY" http://127.0.0.1:18808/api/v1/workflows?limit=100 +``` + +Do NOT print the API key in logs or output. + Inspect workflow inventory from SQLite copy: ```bash @@ -354,4 +355,7 @@ docker logs n8n-agent --tail 120 - Empty strings in these fields can crash n8n even when SQLite integrity is `ok`. - From inside n8n, host-published swarm services use Docker bridge gateway `172.19.0.1:`. - From inside n8n, n8n self-calls should use `127.0.0.1:5678`, not host port `18808`. +- `N8N_API_KEY` in `~/lab/swarm/.env` is stale and returns 401. Get the working key from n8n credential `UPAHgUJVRqZQceL4` (see Verification commands). - Do not commit DB backups, workflow execution history, secrets, or runtime state. +- The Google OAuth credential (`wpcf2epDDCT57Y5x`) cannot refresh (`invalid_client`). Gmail workflows use IMAP fallback instead. +- The Docker health endpoint (`18809`) must bind to `0.0.0.0` (not `127.0.0.1`) so the n8n container can reach it via the Docker bridge gateway.