TL;DR
- The assistant can read almost everything in my homelab without asking.
- Every change pauses for a browser approval with a one-line, plain-English summary.
- Deletes, access management and credentials aren’t exposed to it at all.
My homelab grew the usual way: one service at a time, each with its own login, its own update habit and its own idea of “backed up.” I wanted an AI assistant to help run it. I didn’t want to hand it root. This is how I connected the two, and what the patch and update process looks like now.
What Started It
Three things kept going wrong:
- Updates were vibes-based. I patched whatever I remembered, whenever I remembered, with no snapshot unless I thought of it.
- I couldn’t answer simple questions quickly. Is every backup current? Is anything waiting on a reboot? Which containers are behind?
- An AI agent could answer those questions, but only with access. Giving it my admin credentials would turn a helpful assistant into the biggest single point of failure in the house.
The goal: the assistant can observe everything, change things only through an approval I click, and never touch access, credentials or deletions on its own.
The Setup
Infrastructure, by role:
- A hypervisor running a handful of VMs and system containers
- Docker hosts whose stacks are deployed from Git
- A NAS for shares, container data and the backup datastore
- A home automation appliance
- A zone-based firewall with separate networks for trusted devices, IoT, local-only IoT and cameras
- A mesh VPN overlay for remote access. Nothing is reachable from the internet.
The management layer:
| Job | Tool |
|---|---|
| Source of truth | A self-hosted Git forge. Stacks, playbooks, home automation config and runbooks are all repos. |
| Scheduled and repeatable jobs | Semaphore running Ansible playbooks |
| Container deploys | Portainer, pulling stacks from the main branch |
| Monitoring and alerts | Prometheus, Alertmanager and blackbox probes, sent to a Discord channel |
| Backups | Proxmox Backup Server to the NAS nightly, plus an encrypted offsite copy |
| Agent access to service APIs | Executor, a gateway that exposes each service as a small set of tools |
The access model at a glance:
+-- read -----------> no approval needed
AI assistant --> gateway +-- write ----------> pauses for my approval (one-line summary)
+-- delete / access /
credentials ----> not a tool at all
First Attempt
My first version was over-engineered. Every time the agent needed something, I built a new wrapper, guard or config file. I had guards enforcing rules I’d invented, docs full of history and task IDs, and an “uptime” tool that duplicated what Prometheus already did. It worked, but I couldn’t fix it by hand at 11pm, which is the only test that matters in a homelab.
So I wrote a short rulebook for myself and the agent:
- Use what already exists before building anything new.
- One pull request per feature, not per fix.
- No new tool, wrapper or schema when an existing one plus parameters works.
- Tests only for logic that could silently do damage.
- Docs describe the current setup in as few lines as possible.
- If a task is turning into a project, stop and ask.
Then the agent and I went back through everything and deleted a lot of it.
What Changed
1. Connecting things: one gateway, scoped tools
Each service gets an Executor app with a short list of tools: read the guest list, list firewall policies, read a container’s state, start this job template. Each app uses a dedicated service account, not mine.
- Reads need no approval. That’s what makes the agent useful. It can run a full health check across the hypervisor, firewall, containers, backups and home automation without bothering me.
- Writes pause for a browser approval. The agent gets a link and I click approve or deny. Each request carries a one-line plain-English summary (“snapshot the Docker host before container updates”), because raw JSON on an approval page is how you approve things you didn’t mean to.
- Some things just aren’t tools. Deletes, access management, credential changes and arbitrary command execution aren’t exposed at all.
2. Securing access
- Credentials never pass through chat. They live in the gateway’s account forms, Semaphore’s secret store or a password manager. The agent never sees them and can’t print them.
- Separate identities for separate jobs. The snapshot automation’s API token can take snapshots and read backup lists, and that’s it. The monitoring account is read-only.
- SSH for the agent is a fixed list of commands. On the hypervisor, its account has no password and can run only a handful of read-only health checks, such as guest and task lists, storage pool status and disk health. Everything else is denied.
- I run root setup myself. When access changes, the agent writes a runbook and I paste the commands. Anything touching access, approval rules or credentials also gets a review from a second AI model with no shared context. That review has caught real issues, like a setup step that would have quietly reused an existing account.
- Network boundaries do their own work. Nothing is allowed inbound from the internet, and each network zone can reach only the few services it needs. Local-only IoT has no internet route at all.
3. Git is the source of truth, and a merge is not a deploy
The agent works on a branch in its own worktree and opens a pull request. I review and merge. Deploying is a separate, approved step. That split matters: I can merge a config change at lunch and deploy it when I’m home and watching.
4. The patch and update process
OS packages. These run through one Semaphore playbook, one host at a time:
- Take a hypervisor snapshot named
maint-<UTC time>, tagged as pending. - Upgrade packages, but hold back the container engine and the VPN client. Those are the two updates most likely to cut me off from the machine, so they get their own window.
- Wait for every previously running container to come back.
- Fail if any systemd unit newly failed.
- Mark the snapshot verified.
The playbook stops at the first failure and keeps that host’s snapshot for rollback. It never reboots; it just says when a reboot is needed.
Container images. Renovate opens weekly PRs grouped by risk tier:
| Tier | Example | Before deploying |
|---|---|---|
| Low | Dashboards, exporters | Keep the old image for rollback |
| Stateful | Apps with databases | Fresh data backup, read the migration notes |
| Platform | Git forge, automation, DNS, monitoring | Own window, one at a time, console ready |
Images are pinned by tag and digest. Before a batch, one job snapshots the Docker host. It skips if a maintenance snapshot under six hours old already exists, so retries don’t pile up snapshots. Then stacks are redeployed one at a time, each with its own approval. “Verified” means a real function works, like logging in or running a workflow, not just “the container is up.”
Platform updates (hypervisor, firewall, NAS, home automation) follow a short checklist: baseline, release notes, recovery checkpoint, approval, one change, verify, report.
Cleanup without fear. A weekly job prunes old maintenance snapshots. It deletes one only when all of these are true:
- the automation made it
- it’s over seven days old
- a newer verified snapshot exists
- the backup server has a newer backup of that guest
Hand-made snapshots are never touched. Any read failure stops the run before anything is deleted.
5. Monitoring that nags instead of pages
- The hypervisor exports pending updates, reboot-required, storage pool state and NVMe health.
- Home automation exports its last successful backup time and pending updates.
- Alerts for “updates pending” or “reboot required” wait 7–14 days before firing. They’re reminders, not emergencies. A degraded pool or a stale backup fires right away.
- The NAS sends backup failures to the same Discord channel.
6. A real test: a critical kernel CVE
A critical (9.8) Linux kernel CVE with a published remote exploit landed while I was writing this. The system turned it into an hour of work, not a weekend:
- Inventory: the agent pulled kernel versions everywhere and checked distro changelogs. Version numbers alone mislead, because distros backport fixes.
- Exposure: the exploit needed MPTCP. The agent checked which machines had MPTCP listeners and probed services with a single harmless MPTCP connection. One service stood out: it was reachable from several network zones and ran in a system container, which shares the hypervisor’s kernel.
- Mitigation: I disabled MPTCP for that one container and restarted the service. The agent confirmed it had fallen back to plain TCP and still worked.
- Firewall: it confirmed there were no inbound allow rules from the internet.
- Patching: every machine then went through the normal update process once vendor kernels shipped.
What I Learned
- Free reads, approved writes, and no tools for dangerous things. That boundary is what makes an AI assistant safe enough to use daily.
- Put a plain summary next to every approval. If I can’t tell what I’m approving in one line, I deny it.
- A merge is not a deploy. Separating them lowered the stakes of every PR.
- Hold back anything that can lock you out. The container engine and VPN client update on their own, with another way in ready.
- Tag your automation’s artifacts. “Made by automation, verified, older than a newer backup” is what makes automatic cleanup safe.
- Exposure beats inventory. “What’s listening, and who can reach it” was a better question than “what version is it.”
- The best homelab tooling is the tooling I’d still understand at 11pm.
Next Pass
- A scheduled job that checks kernel and package CVEs against distro trackers, so the next advisory starts with a table.
- Release notes and a vulnerability scan attached to each Renovate PR.
- A device maintenance and UPS power report for the things that aren’t servers.
- Finish moving IoT devices into local-only and cloud-allowed networks, one device at a time.
- A restore test schedule, because a backup that has never been restored isn’t a backup yet.
Free reads, approved writes, and no tools for the dangerous things. Everything else in this setup is detail.