Open source AI-assisted home automation with conversation archaeology
June 9, 2025
What happens when you combine Phoenix LiveView error logs, bash scripting wizardry, AppleScript automation, and Claude Code? You get an error watchdog that’s so smart it literally messages itself when something breaks. No joke—we just achieved AI that auto-reports its own bugs in real-time.
Picture this: You’re deep in Phoenix development, errors are flying faster than you can catch them, and your AI coding assistant has no clue what’s breaking under the hood. Traditional debugging feels like playing whack-a-mole blindfolded while juggling flaming torches.
We encountered a classic Ash Framework parameter bug—Protocol.UndefinedError where the system expected a map but received a string. The kind of error that stops development dead in its tracks and forces you to context-switch between your AI session and error logs.
Instead of manually checking logs like cavemen, we built an intelligent error monitoring system that:
tmp/error.log for new content only (no re-processing old errors)#!/bin/bash
# The error_watchdog.sh that started a revolution
notify_claude() {
local message="$1"
# Check rate limits and duplicates first
if clean_and_check_rate_limit; then
echo "⏳ Rate limiting: too many notifications"
return 1
fi
if is_duplicate_message "$message"; then
echo "🔄 Skipping duplicate message"
return 1
fi
# AppleScript magic to find and message Claude
osascript <<EOF
tell application "iTerm"
tell current window
repeat with aSession in sessions of current tab
if name of aSession contains "claude" then
tell aSession
write text "$message"
delay 0.1
write text "" # Press Enter
end tell
return
end if
end repeat
end tell
end tell
EOF
}
Here’s what happened during our live debugging session:
Protocol.UndefinedError at line 37The error watchdog literally sent us this message: “Check errors: Protocol.UndefinedError in pipeline.ex:42”
CURRENT_SIZE=$(wc -c < "$ERROR_LOG")
if [ "$CURRENT_SIZE" -gt "$LAST_POSITION" ]; then
NEW_CONTENT=$(tail -c +$((LAST_POSITION + 1)) "$ERROR_LOG")
# Process only new content...
fi
ERROR_TYPE=$(echo "$NEW_CONTENT" | grep -E "\*\* \(" | tail -1 | sed -E 's/.*\*\* \(([^)]+)\).*/\1/')
ERROR_LINE=$(echo "$NEW_CONTENT" | grep -E "\.ex:[0-9]+" | tail -1 | grep -oE "[^/]+\.ex:[0-9]+")
while IFS='|' read -r timestamp msg; do
if [ "$msg" = "$message" ] && [ "$timestamp" -gt "$cutoff_time" ]; then
return 0 # Duplicate found within window
fi
done < "$RECENT_MESSAGES_FILE"
But wait, there’s more! The watchdog also:
get_current_ollama_model() {
if curl -s "http://localhost:11434/api/ps" >/dev/null 2>&1; then
local model=$(curl -s "http://localhost:11434/api/ps" | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)
echo "$model"
fi
}
This isn’t just a clever hack—it’s a glimpse into the future of AI-assisted development:
AI that can detect, report, and fix its own issues in real-time.
No more switching between terminals, checking logs, or losing context.
The AI gets precise error information with file locations and stack traces.
Only actionable errors bubble up—no noise, no spam, just signal.
We followed the Physics of Work principle: minimum viable automation that provides maximum leverage. The error watchdog is:
Before the watchdog:
🔥 Error occurs → 😴 Developer unaware → 🐌 Manual log checking → 😤 Context switching → 🔧 Fix applied
After the watchdog:
🔥 Error occurs → ⚡ Instant notification → 🤖 AI analyzes → 🎯 Targeted fix → ✅ Problem solved
The error watchdog is live in our Athena repository. Key components:
error_watchdog.sh - The main monitoring scriptWe’ve entered an era where AI doesn’t just help us code—it actively participates in maintaining, monitoring, and improving itself. The error watchdog represents a fundamental shift from reactive debugging to proactive AI collaboration.
The future isn’t just AI-assisted development. It’s AI-driven development where the boundary between human and artificial intelligence becomes beautifully blurred.
Want to see the error watchdog in action? The source code is available in our Athena project repository where we’re pioneering AI-driven development workflows.
Tags: #AI #Debugging #Phoenix #Elixir #Automation #DevOps #Claude #AppleScript #Bash #Innovation
Share this: Because someone needs to tell the world that AI is now debugging itself! 🤖✨