Turning spoken commands into safe actions: regex first, the language model second
Description and use
<h2> Introduction </h2> <p>I built a tiny voice‑controlled home automation server for my own website. The goal was simple: speak a command, have the server execute a safe action (turn a light on, start a backup, etc.). The tricky part is making sure the spoken text can’t be turned into an arbitrary shell command. My solution is a two‑step filter – a strict regular‑expression whitelist first, then a language‑model (LLM) to fill in the details.</p> <h2> Why regex first? </h2> <p>Regular expressions give me a deterministic gate. Anything that doesn’t match a known pattern is rejected before it ev
Problem
<h2> Introduction </h2> <p>I built a tiny voice‑controlled home automation server for my own website. The goal was simple: speak a command, have the server execute a safe action (turn a light on, start a backup, etc.). The tricky part is making sure the spoken text can’t be turned into an arbitrary shell command. My solution is a two‑step filter – a strict regular‑expression whitelist first, then a language‑model (LLM) to fill in the details.</p> <h2> Why regex first? </h2> <p>Regular expressions give me a deterministic gate. Anything that doesn’t match a known pattern is rejected before it ev
Outcome
<h2> Introduction </h2> <p>I built a tiny voice‑controlled home automation server for my own website. The goal was simple: speak a command, have the server execute a safe action (turn a light on, start a backup, etc.). The tricky part is making sure the spoken text can’t be turned into an arbitrary shell command. My solution is a two‑step filter – a strict regular‑expression whitelist first, then a language‑model (LLM) to fill in the details.</p> <h2> Why regex first? </h2> <p>Regular expressions give me a deterministic gate. Anything that doesn’t match a known pattern is rejected before it ev
Evidence
Turning spoken commands into safe actions: regex first, the language model second
- Record date: 2026-10-24T01:11:15.804Z