RoutineGuard — Test the Routine Before You Trust It
Inspiration
Smart-home routines can fail when a device is offline, sensor information is missing or outdated, or two scheduled actions conflict. A routine that looks correct on screen may still need attention before someone relies on it.
I built RoutineGuard to explore a simple question: What if we could check a smart-home routine before treating it as ready?
What it does
RoutineGuard is a simulation-first preflight checker for smart-home routines. It evaluates routine schedules, device availability, sensor-data freshness, and conflicting actions. It then returns a status, supporting evidence, and a recommended next step.
The four outcomes are:
- PASS: The supplied inputs passed the implemented checks.
- REVIEW: Conflicting scheduled actions need attention.
- BLOCKED: A required device is offline or not configured.
- UNKNOWN: Required evidence is missing or invalid.
A deterministic evaluation engine makes the decisions reproducible. The dashboard lets users explore different scenarios, while a self-hosted Model Context Protocol (MCP) server exposes the checks to compatible AI clients.
How we built it
The project uses Next.js and React for the web dashboard, Node.js for the runtime, and the official MCP TypeScript SDK to expose three tools over Streamable HTTP:
run_preflight_test— evaluate a supplied routine.run_demo_scenario— run a built-in synthetic scenario.get_routineguard_policy— explain the policy and limitations.
The interface includes Overview, Routine Lab, Devices, and Activity Log views. Four demonstration scenarios cover a clear routine, an offline device, a schedule conflict, and missing sensor data.
Challenges and what I learned
One challenge was making sure missing or invalid information could never be mistaken for a successful check. I added tests for invalid schedules, stale sensor data, unconfigured devices, and overlapping actions.
I also encountered a Git ignore rule that hid application source files, a lint issue involving session-history restoration, and a PowerShell path-resolution problem. I documented the actual issues, workarounds, and suggested improvements in the repository's development friction log.
Testing includes 26 unit tests, 10 MCP core tests, MCP protocol integration checks, linting, and a successful production build. The server's initialization response was verified to use MCP protocol version 2025-11-25.
Limitations and future work
This is a prototype that uses synthetic data. It does not connect to or control real smart-home devices, and a PASS result is not a guarantee of real-world safety. Future work could add authorized device integrations, richer routine simulation, and more extensive testing with real-world data.
Built for Alexa+
RoutineGuard demonstrates a self-hosted MCP server using Streamable HTTP, with a browser-based interface that makes the results understandable to users. The goal is to make routine validation explainable, testable, and accessible to compatible AI clients.
Try it: See the public source repository and setup instructions linked below.
Built With
- alexa+
- context
- javascript
- mcp
- model
- next.js
- node.js
- protocol
- react
- tailwind
- typescript
- zod