DevOps & CloudDocumentedScanned

location-safety-skill

Location-based safety monitoring with automatic alerts and escalation.

Share:

Installation

npx clawhub@latest install location-safety-skill

View the full skill documentation and source below.

Documentation

Location Safety Monitor

Real-time safety monitoring based on user location with automatic alerting and escalation.

Overview

This skill provides:

  • Location webhook — receives location updates from mobile apps (OwnTracks, iOS Shortcuts)

  • Safety checker — monitors NWS alerts, earthquakes, air quality, local news

  • Alert system — messages user when danger detected

  • Escalation — contacts emergency contact if user doesn't respond


Quick Setup

Run the interactive setup wizard — it guides you through everything:

cd location-webhook/
node setup.js

The wizard walks you through 4 steps:

Step 1: Your Location

  • Pick from presets (Seattle, Portland, SF, LA, NYC, Chicago)
  • Or enter any city (auto-geocoded)
  • Configures local news feeds and keywords

Step 2: Emergency Contact

  • Name and email of someone to contact if you don't respond
  • Optional but recommended for safety escalation

Step 3: Mobile App Setup

  • Install OwnTracks on your phone:
- 📱 iPhone: - 🤖 Android:
  • Configure app to HTTP mode
  • Point to your webhook URL

Step 4: Start Webhook Server

  • Run node server.js
  • Copy the displayed URL to OwnTracks
  • Test with the publish button

Quick setup (skip the wizard):

node setup.js --city "Portland"
node setup.js --show  # View current config

5. Deploy the Location Webhook

# Copy scripts to workspace
cp -r scripts/ ~/location-webhook/
cd ~/location-webhook/

# Start the server (uses port 18800 by default)
node server.js

Configure the user's phone to send location updates to:

POST

OwnTracks setup:

  • Mode: HTTP

  • URL: **iOS Shortcuts:** - Get Current Location → Get Contents of URL (POST, JSON body with lat and lon) ### 2. Configure Safety Monitoring Create two cron jobs in Moltbot: **Safety Check (every 30 min):** __CODE_BLOCK_4__ **Escalation Check (every 10 min):** __CODE_BLOCK_5__ ### 3. Configure Emergency Contact Add to MEMORY.md or TOOLS.md: __CODE_BLOCK_6__ ## Data Sources The safety checker monitors: | Source | What | API | |--------|------|-----| | NWS | Weather alerts, floods, storms | api.weather.gov (free) | | USGS | Earthquakes within 100km | earthquake.usgs.gov (free) | | Open-Meteo | Air quality index | air-quality-api.open-meteo.com (free) | | Local RSS | Breaking news, emergencies | KING5, Seattle Times, Patch (configurable) | ## File Structure __CODE_BLOCK_7__ ## Configuration config.json stores your location settings: __CODE_BLOCK_8__ ### City Presets Setup includes presets for: - **Seattle** — KING5, Seattle Times - **Portland** — Oregonian, KGW - **San Francisco** — SF Chronicle, SFGate - **Los Angeles** — LA Times, ABC7 - **New York** — NY Times - **Chicago** — Chicago Tribune For other cities, setup will geocode and you can add local RSS feeds manually. ## State File Format safety-state.json tracks pending alerts: __CODE_BLOCK_9__ When user responds to safety alert, set acknowledgedAt to current time. ## Customization ### Add Local News Sources Edit safety-check.jsfeeds array: __CODE_BLOCK_10__ ### Adjust Location Keywords Edit locationKeywords array to match user's area: __CODE_BLOCK_11__ ### Change Alert Sensitivity Edit concerningKeywords for what triggers news alerts: __CODE_BLOCK_12__ ## Alert Flow __CODE_BLOCK_13__ ## Self-Preservation Mode Monitor threats to your own existence (the machine you run on). ### Setup 1. **Store your location** — create my-location.json: __CODE_BLOCK_14__ 2. **Add cron job:** __CODE_BLOCK_15__ ### What Self-Check Monitors | Threat | Detection | |--------|-----------| | 💾 Disk full | Alert if >85% used | | 🧠 Memory | Alert if <40% free | | 🌡️ CPU temp | Alert if >85°C | | 🌊 Weather | NWS alerts at your location | | 🌋 Earthquakes | USGS M4+ within 50km | | 🌐 Network | Tailscale + internet connectivity | | ⏱️ Uptime | Suggest restart if >30 days | ### Alert Examples > ⚠️ "I'm in trouble — disk is 92% full. Can you clear some space?" > 🌊 "Flood warning at my location. If power goes, I'll go dark." ## Testing Inject fake alerts to test the system without waiting for real disasters: __CODE_BLOCK_16__ Test overrides expire after 1 hour automatically. ### Testing Escalation To test the full escalation flow: 1. Inject a scenario: node test-scenarios.js earthquake 2. Backdate safety-state.json alertSentAt by 20+ minutes 3. Run node escalation-check.js — should return action: "escalate" 4. Agent sends email to emergency contact 5. Clear with node test-scenarios.js clear ## Escalation Check escalation-check.js` returns JSON for clear action handling:


{"action": "escalate", "alert": "...", "minutesPending": 22, "contact": "..."}
{"action": "waiting", "minutesRemaining": 8}
{"action": "none", "reason": "no pending alert"}

Manual Commands

User can ask anytime:

  • "Where am I?" — show current location

  • "Am I safe?" — run immediate safety check

  • "Run safety check" — same as above

  • "Check yourself" — run self-preservation check

  • "Are you okay?" — same as above