Comprehensive guide for restoring Advantage HPE's operational intelligence systems when they fail or go down.
Before fixing anything, map out what's broken:
Core Intelligence Systems:
Investigation Commands:
# Check LaunchD services
launchctl list | grep ranger
# Check cron jobs
cron list
# Check running processes
ps aux | grep -E "(keel|pulse|margin|nudge)" | grep -v grep
# Find system code
find /Users/stephendobbins/.config/ranger -name "*.py" | grep -E "(pulse|margin|nudge)"
find /Users/stephendobbins/.openclaw/workspace -name "*.py" | grep -E "(zero|revenue)"
Common Locations:
/Users/stephendobbins/.config/ranger/scripts/ - Main operational scripts/Users/stephendobbins/.config/ranger/materials/ - Material intelligence /Users/stephendobbins/.openclaw/workspace/ - Recent scripts & fixes/Users/stephendobbins/Library/LaunchAgents/ - LaunchD service definitionsCommon Failure Patterns:
Script: /Users/stephendobbins/.config/ranger/scripts/margin_alerts.py
Channel: #margin-alerts (C0A5L7MG60P)
Schedule: Every 30 minutes
Restoration Steps:
launchctl load /Users/stephendobbins/Library/LaunchAgents/com.ranger.margin-alerts.plistcd /Users/stephendobbins/.config/ranger/scripts && python3 margin_alerts.pytail /tmp/margin_alerts.logScript: /Users/stephendobbins/.config/ranger/scripts/pulse_os_full.py
Channel: #manager-nudges (C0A5V9JL2KV)
Schedule: Daily 6:35 AM CT
Restoration Steps:
.bak backup with working data sourcescp pulse_os_full.py.bak pulse_os_full.pylaunchctl load /Users/stephendobbins/Library/LaunchAgents/com.ranger.morning-pulse.plistpython3 pulse_os_full.py pulseScript: /Users/stephendobbins/.config/ranger/scripts/pulse_os_full.py nudges
Channel: #manager-nudges
Schedule: Every 15 minutes
Function: run_nudges() on line 548-617
Features: 🚗 dispatched / 📍 arrived / ✅ completed alerts
Restoration Steps:
grep -n "def run_nudges" pulse_os_full.pylaunchctl load /Users/stephendobbins/Library/LaunchAgents/com.ranger.live-nudges.plistpython3 pulse_os_full.py nudgesScript: /Users/stephendobbins/.config/ranger/materials/reconciliation_report.py
Channel: #material-intel-systems (C0A5L7RB5EK)
Schedule: Daily 7:00 AM CT
Restoration Steps:
cd /Users/stephendobbins/.config/ranger/materials && python3 reconciliation_report.py --no-emailProblem: ServiceTitan API often returns test/historical data instead of real operational data.
Solution: Replace API calls with browser automation:
Browser Data Functions:
get_browser_low_margin_jobs() get_browser_stale_estimates()get_browser_revenue_leaks()get_browser_driver_incidents()Script: /Users/stephendobbins/.config/ranger/keel/keel_slack_bot.py
Safe restart for field tech DM only:
OPERATIONAL_INTELLIGENCE_ENABLED = Falsecd /Users/stephendobbins/.config/ranger/keel && python3 keel_slack_bot.py &ps aux | grep keel_slack_bot# List services
launchctl list | grep ranger
# Load service
launchctl load /Users/stephendobbins/Library/LaunchAgents/com.ranger.<service>.plist
# Unload service
launchctl unload /Users/stephendobbins/Library/LaunchAgents/com.ranger.<service>.plist
# Start service immediately
launchctl start com.ranger.<service>
# Check service logs
tail /tmp/<service>.log
tail /tmp/<service>.err
# List jobs
cron list
# Add job
cron add <job-definition>
# Remove job
cron remove <job-id>
When systems are emergency-stopped due to bad data:
create-live-nudges-service.py - Generate LaunchD plist for live nudgesbrowser_data_sources.py - Browser automation replacement for broken APIslaunchd-service-templates.md - LaunchD plist templates for different scheduleschannel-ids.md - Slack channel IDs for all operational intelligence channelstroubleshooting-checklist.md - Step-by-step debugging guide共 1 个版本