Introduction
Nightwatch is an AI on-call agent that runs on the edge machine it watches. When a burst of errors hits the log, it finds the root cause, takes one policy-approved action and records it. Risky actions wait for a human. It runs fully offline.
What it does
- Watches the machine's logs: log files, the system journal (journald), or the built-in simulator.
- Diagnoses the root cause with a small distilled model running locally through Ollama.
- Acts only within the limits of your rules (the policy file), or waits for a person to approve.
- Pages the on-call phone by SMS or voice when a person is needed, without sending any log text.
- Records every decision in an embedded ClickHouse database for reports and audits.
How it decides
A simple pattern match watches for WARN, ERROR and similar markers. When it fires, Nightwatch takes a window of 5 to 15 lines around the burst and hands it to the model. The model must answer with exactly one tool call. Everything after that is deterministic code:
- Validate. The reply must be well-formed JSON, name exactly one known tool, and match that tool's expected format.
- Ground. Every name in the reply (service, folder, file) must appear in the log window. Made-up names are rejected.
- Sanitize. Anything that looks like a hidden shell command is rejected.
- Apply your rules. The policy file decides whether the action runs, waits for approval, or is blocked.
- Redact and record. Emails, IP addresses, VINs, tokens and usernames are scrubbed from the summary before it is stored or sent.
If any check fails, the decision becomes escalate: a person is alerted. Nightwatch never asks the model again hoping for a better answer.
The six tools
The model can only pick from this list. For each one, you choose in the policy file whether it runs on its own, waits for approval, or is never allowed.
| Tool | What it does | Default lane |
|---|---|---|
restart_service | Restarts a named app service (not core system services). | AUTO for allowed services |
free_disk | Clears a temporary, queue or cache folder. | AUTO for allowed mounts |
retry_upload | Retries a stalled or failed upload bundle. | AUTO |
quarantine_upload | Locks a suspicious upload away so it can do no harm. | ASK |
escalate | Alerts a person, with how serious it is and which part is affected. | Always allowed |
ignore | Marks the burst as harmless noise. | Always allowed |
What leaves the machine
By default, nothing. If you set up Vonage, Nightwatch sends two kinds of messages: one-time approval codes, and alerts of 160 characters at most that contain only a status word, the machine name, a short reference and how many private details were scrubbed. See SMS & voice.
Words we use
Terms used across the site and docs.
| Term | Meaning |
|---|---|
| Edge machine | A location with its own computers but usually no IT staff on hand: a depot, factory, store or vehicle test bay. |
| Log | The text a program writes about what it is doing, including warnings and errors. |
| Incident | Something that went wrong and needs attention, such as a full disk or a crashed service. |
| Root cause | The first thing that actually broke. One full disk can cause twenty errors; the full disk is the root cause. |
| On-call | The person whose phone rings when something breaks outside working hours. |
| Policy file / lane | policy.yaml puts every action in a lane: AUTO runs it, ASK waits for approval, NEVER blocks it and pages a human. |
| Escalate | Hand the problem to a person by SMS or voice call instead of acting. |
| Redaction | Removing private details (emails, addresses, IDs, tokens) from text before it is stored or sent. |
| Audit chain | Every decision record carries the SHA-256 hash of the previous one, so any later edit or deletion is detectable. |
| Model | The small distilled model that reads the log window and proposes one action. It runs on the device, not in the cloud. |