Inspiration
When a household automation does the wrong thing, the usual fix is to change the rule and hope. HomeRelay treats routine changes like code changes: reproduce the incident from stored evidence, test the fix against a regression suite, and refuse anything that weakens a safety boundary before it is approved.
What it does
HomeRelay Time Machine is a counterfactual debugging and regression-testing workbench for MCP-powered household automations. It reconstructs a saved decision, such as a Saturday arrival that a weekday-only routine refused, from stored snapshots. The recorded reason code identifies the failed policy check, and each check cites stored evidence. If no such record exists, it shows a labelled scenario fixture rather than inventing one.
You then propose a fix (add Saturday) and run a preflight suite. Through a real MCP tool, the server evaluates six cases with the production policy engine for the current routine and the candidate: weekday, Saturday, before sunset, missing sunset, unapproved and door unlock. The table shows that only the Saturday decision changes and that every safety invariant still holds. If someone tries to slip a door unlock into the candidate, the suite fails and every unlock stays denied. Preflight uses a clearly labelled simulated approval, saves only the test run, and never activates the candidate or touches devices, events or receipts.
The original household flow remains: explicit approval, a simulated arrival that lights the porch, an approved unlock that is still denied, and idempotent replay.
How we built it
The browser calls a Node.js 24 web function on Vercel. That web function uses the official MCP TypeScript SDK client to call HomeRelay's separate MCP endpoint over Streamable HTTP with a server-held bearer token. The MCP function alone accesses Neon PostgreSQL and the deterministic policy engine. The hosted database is PostgreSQL 18 using a direct TLS-verified connection. Migrations and seeding were run explicitly; no migration runs at request time.
An immutable routine revision and hash bind explicit approval to reviewed content. One transaction stores the event, decision snapshots, simulated device update and allowed action receipt. Database uniqueness prevents duplicate committed actions. Denied actions have no receipt. Evidence explains the original decision rather than recomputing history with current rules. Three MCP tools with typed schemas (reconstruct_incident, run_preflight and get_preflight_run) power the Time Machine. Preflight reuses the production evaluate() function without the event-processing path. An additive, checksummed migration stores runs. There is no runtime LLM: every result comes from stored evidence or deterministic rules.
Challenges and accomplishments
The difficult part was making retries, failures and approval boundaries observable and correct together. Real PostgreSQL tests cover ten concurrent duplicate events, transaction rollback and process restart; real browser tests cover approval, denial, refresh, keyboard focus and MCP outage/recovery. Time Machine tests show that preflight leaves seven domain tables byte-identical, that only the expected decision changes, that unlock bypass attempts fail, and that a populated database upgrades safely while the server refuses to start on an unmigrated schema.
The first hosting setup put the web and MCP services on separate free Render instances. Repeated checks confirmed that web-to-MCP requests could fail fast while the sleeping MCP service did not wake, so browser retries could not recover the workflow. The app was moved to one Vercel deployment containing both functions, with Neon for persistence. Production checks then confirmed the MCP protocol version, tool discovery and schemas, the full browser workflow, saved-run retrieval, authentication rejection, origin checks, and the mobile layout.
What's next for HomeRelay Time Machine
Turning a passing candidate into a new unapproved revision for explicit approval, user-defined preflight cases, production identity and household isolation, a trusted sunset source and a constrained proposal parser would be next. External devices require a separate delivery/reconciliation design. They are not implemented here.
Built With
- model-context-protocol
- neon
- node.js
- playwright
- postgresql
- typescript
- vercel
- zod
Log in or sign up for Devpost to join the conversation.