Blog / Stack

The stack behind Nightwatch

2026-11-29·6 min read

Nightwatch started as a hackathon project with one rule: only use a partner tool where it solves a real problem of running machines at remote sites. Here is what each one does in the shipped agent.

Model training

distil labs

Turned small, untrained models into specialists that score 90 to 97.5%.

Base models

Gemma 4 & Qwen

Open models from Google DeepMind and Alibaba, slimmed down to fit on the machine.

Audit store

ClickHouse

A full analytics database running inside the app. No server needed.

SMS & voice

Vonage

Approval codes, short alerts and phone calls. The only thing that ever leaves the site.

Security scanning

Aikido

Security scans on every change, and findings that shaped the design.

distil labs: model training

The problem. A big cloud AI would break both of our promises: it needs internet, and it would see your logs. A small AI on the machine keeps both promises but gets the answer wrong (2.5% right, untrained).

What distil labs did. It let us measure how well the big "teacher" AIs did on our task (Claude Opus 5.5, Qwen3.8-2.4T and GLM 5.3), grow 36 hand-written examples into 1,513 checked practice incidents, and train four small "student" models to answer like the teachers. Three rounds, $7.28 in total.

The result. Four models from 610 MB to 3.46 GB, scoring 90% to 97.5% on a secret exam, and the 1.35 GB one matching Claude Opus 5.5 on our check set. Read the full training story →

Gemma 4 and Qwen: base models

The students are built on open models: Gemma 4 E2B from Google DeepMind for the default, and Qwen3 / Qwen3.5 from Alibaba for the smaller sizes. Gemma 4 can also see and hear, which we don't need, so we removed those parts. That alone shrank it from 8.12 GB to 3.46 GB without losing a single point of accuracy.

SizeBuilt onOn diskExam scoreTypical answer time
DefaultGemma 4 E2B3.46 GB97.5%0.20 s
BalancedQwen3.5 2B1.35 GB95.0%0.33 s
SmallQwen3.5 0.8B774 MB92.5%0.21 s
TinyQwen3 0.6B610 MB90.0%0.10 s

ClickHouse: the audit store

The problem. Operators want a morning summary, a way to test new rules against last night, a record nobody can tamper with, and the freedom to ask their own questions in SQL. But nobody wants to run and babysit a database server on a small remote machine.

What ClickHouse does. Through chDB, the full ClickHouse engine runs inside Nightwatch. No server, no setup. That gives us real analytics features on a laptop-sized box:

Vonage: SMS and voice

Vonage is off until you switch it on, and it only ever sends. Nightwatch opens no inbound connections, so nothing on the internet can reach in. It handles three jobs:

1. One-time code approval

A risky action, like locking away a suspicious file, is put on hold. The on-call engineer gets a six-digit code by text (or taps "call me instead"), enters it in the dashboard, and only then does the action go ahead. Deny it or approve it another way, and the pending code is cancelled so no late phone call fires.

2. SMS alerts with no log text

Alerts follow fixed templates under 160 characters, with no log content and no personal details. They queue on the machine when the internet is down, never send twice even after a crash, max out at 6 an hour, and hold low-priority news during quiet hours.

3. Voice call if unacknowledged

If a critical alert isn't acknowledged within five minutes (you choose the time), Nightwatch calls the on-call phone and reads the message aloud. Acknowledge it in the dashboard or with one command, and the call is cancelled.

Aikido: security scanning

Security wasn't bolted on at the end. Aikido scanned every change through MCP, GitHub PR checks and Deep Review for code weaknesses, leaked secrets, end-of-life runtimes and risky CI permissions, and its findings directly shaped the shipped agent:

Our AI coding setup

We build Nightwatch with AI coding assistants connected to three MCP servers: Aikido for SAST/secrets/dependency scans (0 findings across all 51 scanned files), Vonage's documentation for exact API details, and a read-only view of the ClickHouse audit store. Local safety hooks block commits to main, run gitleaks and offline aikido-local-scanner pre-commit-scan, and keep Go code formatted.

For engineers: the details
PreviousInside Nightwatch: one Go binary, three guardrails