Family Smart Hub & Household Agent
A household agent running in my own home: gateway, voice terminal, local models, and a model gateway — now extended with family health records, task planning, and delegation to an external worker.

This project started with “I want to turn the lights on by talking” and then got out of hand, growing into four parts; it’s still being changed. I only describe the system itself here — no household data, addresses, or anything like that will appear on this page. The core is the family gateway; the other three parts are the StickS3 voice terminal, a local model service running on a Mac mini, and a model gateway that manages models centrally. In the November 2026 snapshot, the gateway itself grew several new domains — health records, task delegation, and task planning — and the sections below follow the latest snapshot.
The family gateway
The gateway runs on a Linux host at home and connects to Home Assistant to run the devices. Commands arrive through three entry points — text, voice, and WeCom messages; capabilities include device control, rule-based automation, family memory, food-expiry reminders, calendar to-dos, an operation audit log, and a briefing dashboard for the family.
Commands come in two stages: first a pass of high-confidence local rules (a rule file plus a mapping from spoken names to entity IDs) — a hit goes straight to Home Assistant, which is fast; editing the rule file takes effect on restart, and a name with no alias configured falls back safely to the large model rather than guessing. A miss is handed to DeepSeek Flash for function-calling comprehension. Device control and state queries produced by both paths go through a single ToolBroker before calling Home Assistant. Execution isn’t done when the command is sent — the gateway reads the device state back, and the result falls into one of four kinds: verified (the read-back matches the target), succeeded_unverified (the action succeeded but there’s no reliable read-back), unknown (it may have been sent but can’t be confirmed), and failed (explicitly failed); only the first two are replied as success. One agent round is executed by a standalone AgentRunner — at most 6 model rounds and 10 actual tool calls, bounded by an overall request time limit. Device names resolve in two forms, “device name” and “room + device name”; when the same name exists in several rooms, the room bound to the paired terminal disambiguates first, and if it still can’t be settled, it asks directly rather than guessing one and executing.
A few operating insistences: when a component has no credentials configured, the health check honestly shows it as unconfigured and degrades safely, instead of masking a configuration fault with a mock success; Home Assistant and the large model are independent of each other — when the large model is unavailable, the local fast path can still control devices. The steward’s persona and behavioral boundaries live in a replaceable text file; runtime context such as the date, the speaker, and the request deadline is injected by the server, not written into the persona file, so changing how it talks doesn’t require touching code. The device catalog has a local SQLite cache: when connected to Home Assistant it is written in wholesale, and when HA restarts offline the cache is only used to recognize device names — real-time state and control results still have to be returned by HA and confirmed by read-back.
The test record has two numbers: the README of the 2026-10-17 version records 793 regression tests passing; a later run on an isolated copy came out at 942 passing with 4 pre-existing failures. The two numbers were produced under different conditions — putting them side by side only shows they come from different points in time, not that the system “improved by 149”.
The 2026-11-07 snapshot update summary records two more numbers: a full regression on the production server at 1361 passed and 1 skipped, and the public snapshot’s own regression at 1282 passed (phone-control tests are not in the snapshot). Same caveat as before — the test sets differ in scope, so the numbers only mark different points in time. The same batch of records includes an end-to-end check of the health module: one 2023 physical-exam report yielded 136 extracted facts, 10 conclusions, and 13 comparison indicators, with all 45 gateway validations passing; and a no-data scenario for 2024 passed 14 validations without inventing the missing exam date.
WeCom channel
WeCom is the third entry point, over an encrypted XML callback: each request first passes signature and timestamp validation, only allowlisted members are processed, and duplicate messages are deduplicated by company, app, and message ID. Only text commands are supported for now — a non-text message gets a safe “text commands only” reply and is never executed as a command.
Three parts are three independent switches — callback + inbox, outbound sending, and tunnel health monitoring — none implies another: turning on sending does not by itself establish a public tunnel. The inbox and outbox are persistent, with directory permissions 700 and the database 600; a failed send keeps bounded backoff and an explicit state, and a request whose outcome is unclear (a dropped connection, say) is never resent automatically, so the same action can’t run twice.
The tools visible from the remote entry are a separate, much narrower whitelist than the local one: device status queries, low-risk (no higher than L2) device control, weather, and public-information queries only — and the device catalog is filtered item by item on top of that. L3 operations, anything involving money, real-name submission, and other sensitive tools never appear in the remote tool view at all. The reason is straightforward: a signed enterprise account proves the account’s ownership, not that the account holder is the person holding the phone, so remote operations are always treated as unauthenticated-in-person; a member’s role is read live from the household profile at execution time, never from a copy written into the channel config.
There is also a freeze mechanism: after the freeze phrase is sent to the bot, new requests stop executing, queued messages are cancelled, and in-flight agent requests are aborted; while frozen, only freeze notifications to the administrator go out, and unfreezing can only be done locally on the gateway host — not remotely. If WeCom’s trusted IP drifts (error code 60020), the health check surfaces a warning and enters rate-limited backoff. Tunnel health is a read-only local readiness check: the gateway only reports the tunnel’s state; it never starts or modifies the tunnel itself.
November 2026 added a fixed egress: the gateway’s calls to the WeCom API can go out through one fixed public egress (three modes — direct, proxy, strict proxy), affecting only the qyapi.weixin.qq.com domain and leaving the callback and tunnel untouched; once an expected egress IP is configured, the gateway asserts it periodically and raises a health-check warning with backoff when it drifts — previously, a drifting trusted IP was only discovered when error 60020 came back; now it’s caught proactively.
The remote tool whitelist grew in the same round: family memory, calendar, and food queries were added, along with health query and report tools; health writes remain excluded, and the L3 / money / real-name lines are unchanged. One small thing, too: the first time a family member contacts the steward over WeCom, the iPad briefing shows a notice card in its reminder-card area; tapping “got it” or swiping it away closes it, the closed state persists, and it expires automatically after 7 days by default.
Family memory
Household facts are stored as Markdown a person can open and edit directly, split into files by people, objects, events, knowledge, and passwords, plus a SQLite database managing the structured data. The one-fact-per-line format is tagged: [key=category:object:field][field=field name][mutable or static][date] followed by the fact itself. mutable covers location, preference, and current state — a new value overwrites the old one, and the old value goes into the SQLite audit history; static covers locked facts like name, birthday, and blood type, whose modification or deletion requires a second confirmation within 10 minutes. Upgrading from the old format automatically leaves a backup file.
Food is stored by purchase batch; the same item can have several valid instances, with state flowing through “valid / consumed / expired”, and default queries look only at valid batches; to-dos and progress live in an events table, with state flowing “to-do → in progress → done / cancelled”. Permissions are kept tight: the memory directory is 700, the database and password files 600. The password store can only be searched when the user explicitly mentions words like “password”, “passcode”, or PIN, and the original request text and tool arguments are never written to logs. Memory-type commands don’t take the local fast path; for all of them, the large model picks the corresponding memory, food, or event tool.
The voice pipeline and voiceprints
Voice has three interfaces: recognition (/stt), synthesis (/tts, returning a directly playable MP3), and the full pipeline (/voice, returning the transcript text, the reply text, the reply audio, and per-segment timing). Recognition and synthesis support Alibaba Cloud’s intelligent speech interaction service and DashScope, with configurable fallback chains. Input has hard specs: 16kHz, 16-bit, mono WAV, also accepting 16kHz MP3, at most 60 seconds and 2MB per clip. When voice credentials aren’t configured and mock isn’t explicitly enabled, the interfaces honestly return that the component is not configured; and if Home Assistant is in real mode, /voice refuses to control devices using mock recognition results, to prevent accidents.
The voiceprint recognition code is written too: 256-dimensional vectors from Resemblyzer, averaged over all of a member’s enrollment samples, with a default cosine-similarity threshold of 0.70 (adjustable); below the threshold it returns unknown, and in the voice pipeline the speaker is marked “guest” and processing continues without blocking control. The server stores only voiceprint vectors, not the original recordings used for enrollment; members and terminals can only be pre-created on the server itself with an admin script — no anonymous HTTP interface is exposed. Alongside it are an adult-admin PIN (a confirmation code for high-risk operations), pairing credentials shown only once with only hashes stored in the database, sessions defaulting to 12 hours, and a 5-minute lockout after 5 consecutive wrong PINs. L3-level operations (a door lock, for example) first read the action back aloud by voice, then require the voiceprint member’s own PIN before executing; the confirmation credential expires after 60 seconds and can be consumed only once. But to be clear: this security machinery was still in a to-be-enabled state at the time — its concrete status is in the last section.
Conversation and terminals
Short-term conversation is managed centrally by the Agent; the iPad, the StickS3, and the text interface are only entry points: the same recognized member shares the most recent 6 conversation rounds across devices, so after “I bought steak, it expires in 5 days”, a follow-up of “2 pieces” still has the model remembering the item name and the deadline. Ten continuous minutes without interaction, a gateway restart, or saying “end conversation / start over” opens a new window; different members have separate windows. Windows live only in capacity-capped memory — never written to the database, never written to raw-text logs; password-related conversations aren’t cached; when a member can’t be recognized, separation is by trusted-terminal session, and nobody inherits another person’s identity or permissions.
The StickS3 terminal uses a dedicated entry point: it accepts only 16kHz / 16-bit / mono WAV; every command must carry a stable, unique request ID; network retries reuse the original ID; the server merges concurrent duplicate requests and caches results for 10 minutes, so network jitter can’t execute the same device command twice. The response carries only three fields (reply text, reply audio, audio format); cloud-synthesized MP3 is genuinely decoded, mixed down to mono, and resampled into WAV the device can play directly. This entry point refuses outright in mock mode — simulated recognized text is not allowed to trigger real devices.
The server itself can also serve as an always-on voice terminal: a microphone plus headphone output, with offline wake-word detection (sherpa-onnx); sound from before the wake word is processed only in rolling local memory — never saved, never uploaded; the microphone is switched off while prompts and answers play, so it doesn’t recognize its own voice; the terminal log records only wake events, routing, speaker confidence, and timing — not the original words or the reply text. There’s also a paired iPad at home acting as a briefing terminal: its pairing credential is generated only on the server and shown once, the page keeps only a 12-hour session, and if the iPad is lost, the terminal can be disabled on the server in one action, revoking all of its sessions. If the same terminal submits a completely identical request within 5 seconds, only the first executes, and the response marks it as a deduplicated result.
Proactive reminders
Reminders run on a local SQLite outbox plus a P0 / P1 / P2 grading policy; the master switch is off by default, and while it’s off nothing is produced, displayed, or delivered. Once on, a briefing refresh verifies in real time the food expiring within the next 2 days and generates P2 reminders per batch, deduplicated by type over 24 hours; once a food item is finished, the next refresh suppresses its old reminders; the briefing interface exposes only filtered short copy, never internal data. P2 can only enter the briefing; P1 voice reminders that would fall in 23:00–07:00 at night are deferred to 07:00 in the morning. Primary alarms like smoke, gas, and water leaks are not the Agent’s business — they stay wired directly to Home Assistant automations, and the Agent being down doesn’t affect the alarms.
Health records and health Q&A
A domain added in November 2026, and already running live in my home. health_ops handles the structured actions — report intake, baseline interviews, visit support, medication management, inspection reminders, annual planning, quick notes, pre-exam preparation, and post-discharge follow-up — following the SOP-01 to SOP-10 processes; health_qa handles questions and emergencies. Answering reads in layers: first a directory summary for the person the question points to, then, as needed, quantitative indicators and confirmed qualitative conclusions; when data runs short it asks at most three supplementary rounds — missing is missing, and it doesn’t improvise.
Health operations are split into read-only and write whitelists, and writes require the responsible person’s confirmation. An external worker only ever gets a redacted, read-only, one-time data package — no database paths, no long-term credentials. The module has its own enable switch, and before enabling, an approval summary is generated for the responsible person; it takes effect only when the summary matches.
Delegating tasks to an external worker
The gateway can hand verifiable work — a report draft, say — to an external worker (currently one running on the Mac side). Jobs go into a persistent SQLite queue supporting claim, heartbeat, retry, cancellation, and timeout; the worker claims a job with a one-time token, reads a redacted data package, and returns a report, which the gateway then validates independently — it doesn’t take the worker’s word for anything, it checks whether the artifact passes validation. The worker has no database or SQL access, no long-term credentials, and no right to publish or to message family members; publishing a report requires an explicit confirmation from me or an administrator. Delegation has its own switch, off by default, and can be shut off in one move.
Official APIs, video, and photo intake
The official API clients are all read-only tools with caching, timeouts, daily quotas, and audit, and a tool isn’t registered at all when its key is missing: Amap routing, place search, and geocoding; DeepSeek search and page fetching; JD Union product search and detail — the JD one only ever reached interface-probe level and never entered daily use; it’s mentioned here only because the code is in the snapshot.
Video search goes through Douyin as the primary channel with Bilibili as fallback; results are pushed to the iPad briefing as video cards — cards only, the videos themselves are never downloaded. Photo intake is an entry point into the health records: a photo or document first goes through structured extraction and validation and produces a confirmation card; only after confirmation is it filed, and unconfirmed or failed material is never silently written into the archive. This entry point’s switch is off by default too.
Task planning, background jobs, and context
Complex tasks are now planned first: the planner generates a plan only for multi-step tasks and records it in a plan ledger, and during execution it evaluates steps and checks completion criteria. A plan is not an authorization — every write step in it still has to pass the ToolBroker, the policy, and confirmation; what needs asking still gets asked. Long tasks can go into a persistent background queue and run slowly; reminders have also become a standalone one-shot reminder mechanism with cancellation, retry, and delivery receipts. On the context side there are now context blocks, intent understanding, household-relation and reference resolution (so “my dad’s report” lands on a specific person), and private memory is never shared across members.
The other three parts
The StickS3 voice terminal is a small-screen ESP32-S3 device: press a button and talk, a Chinese UI, Wi-Fi, and battery management. The firmware is my secondary development on top of ESP-IDF and an open-source device SDK, and the host side has tests for WAV/JSON parsing and gateway adaptation.
The local model service runs on a Mac mini: speech recognition, speech synthesis, and a small model. The strategy is cloud-first with local fallback — when the cloud is unavailable, basic device control still works over the local path. The delivery record includes one complete weather voice Q&A pipeline run end to end, and 59 tests passing on the Mac side.
The model gateway centrally manages model registration, application authentication, quotas, usage accounting, and cloud/local routing, shared by the several applications in the house. November 2026 added complexity-tiered model routing on the gateway side: a model alias is chosen by task complexity, the transport supports both direct and via-router backends with a circuit breaker, and the complex tiers never switch on automatically when no router is configured.
Operations and self-checks
What keeps this project running long-term is a set of mostly read-only self-check scripts. Before deployment there’s a preflight: the number of deletions in a sync must be 0, the rollback snapshot must cover every file that will be overwritten, whether the three services are running, disk headroom, and whether the key for the encrypted conversation archive is configured (without the key, every conversation errors after deployment — so it has to be checked in advance). Before and after a sync there is a full hash comparison — not spot checks on a few files, but every file on the list. After deployment there are four verifications: the health check (with a version marker, able to spot “the files synced but the service didn’t restart”), the database (eight tables plus an integrity check), an audit probe (issuing one read-only query to verify the audit chain really can look up a device read), and the scheduler (whether it’s running, and whether any task is overdue and unexecuted). Data management has encrypted backup, restore, and 90-day retention cleanup, and a cleanup forces an encrypted backup first. Every early morning there’s also a nightly-learning timer (02:30–05:30) that refreshes habit candidates, reviews them, retires ones that haven’t been adopted for a long time, registers the device catalog, and writes the day’s summary.
Permissions and what’s not yet accepted
What I care about most in this project is permissions. The agent acts on real devices, so tools were tiered from the start: queries run freely, control actions leave a trace, and the final submission of anything involving money or identity always requires human confirmation. The audit log isn’t for just anyone to read, either: an adult on a trusted terminal has to exchange their own PIN for a temporary audit token valid for 5 minutes; ordinary adults see only redacted summaries; administrators can see diagnostic fields such as requests, traces, and state read-backs; and when a terminal is disabled, its audit tokens become invalid at the same time.
The unfinished list, honestly: per the 2026-11-07 public snapshot, the security enforcement switch (AGENT_SECURITY_ENFORCEMENT) is still off by default, and member profiles and voiceprints are still to be added — the voiceprint code is written, but it will only be switched on as a whole once real family members have tested it in person, voiceprint cross-member false-recognition testing, and a readiness check (a read-only readiness script that must pass in full before the switch may be turned on) are all complete; until then, unauthenticated text requests are all treated as guests. This snapshot includes the WeCom channel, health, and delegation implementations described above; the phone-control module has not yet reached release standard and is not part of the snapshot. The new delegation and photo-intake switches are off by default; the health module is live in my home, but its detailed rules (the charter-level constraints) have not yet had a dedicated verification pass and are being validated gradually in daily use. In addition, identity and permission details for family members, real recording quality, terminal battery life, and unattended recovery after a full power-cycle restart all still need verification.
Designed and built by me (the terminal firmware is secondary development, see above).
Related research project: Family Smart Hub and Family Steward project
Demo video
Diagrams
graph LR
A[Text / voice / WeCom command] --> B{Local rules}
B -->|Fast-path hit| D[ToolBroker]
B -->|Miss| C[LLM understanding]
C --> D
D --> E[HA execution]
E --> F[Read-back verify]
F --> G[Four-state result]
G --> H[Reply to terminal]graph TB
subgraph L1["Terminal layer"]
T1[StickS3 terminal]
T2[iPad briefing]
T3[Text interface]
T4[WeCom]
end
subgraph L2["Gateway layer"]
GW[Family gateway]
TB[ToolBroker]
MEM[Family memory]
end
subgraph L3["Model layer"]
MO[Model gateway]
LM[Local model service]
CL[Cloud models]
end
subgraph L4["Device layer"]
HA[Home Assistant]
DV[Physical devices]
end
T1 --> GW
T2 --> GW
T3 --> GW
T4 --> GW
GW --> TB --> HA --> DV
GW --> MO
MO --> LM
MO --> CL
GW --> MEMUpdates
- Public snapshot updated to 2026-11-07: health records & health Q&A, task delegation to an external worker, official APIs & video search, photo intake, task planning & background jobs, fixed WeCom egress, and complexity-tiered model routing
- Project page gains a recorded demo video (about 2 minutes): the setup, voice control of home devices, and family-memory queries on the StickS3
- WeCom channel live: encrypted callbacks, persistent inbox/outbox, outbound sending, member role mapping and a freeze mechanism; the voice pipeline gains DashScope fallback
- One delivery round of the model gateway completed; the weather voice Q&A pipeline ran end to end
- Family gateway deployment completed; 793 regression tests passing, as recorded at the time