Getting started / Introduction

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:

  1. Validate. The reply must be well-formed JSON, name exactly one known tool, and match that tool's expected format.
  2. Ground. Every name in the reply (service, folder, file) must appear in the log window. Made-up names are rejected.
  3. Sanitize. Anything that looks like a hidden shell command is rejected.
  4. Apply your rules. The policy file decides whether the action runs, waits for approval, or is blocked.
  5. 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.

ToolWhat it doesDefault lane
restart_serviceRestarts a named app service (not core system services).AUTO for allowed services
free_diskClears a temporary, queue or cache folder.AUTO for allowed mounts
retry_uploadRetries a stalled or failed upload bundle.AUTO
quarantine_uploadLocks a suspicious upload away so it can do no harm.ASK
escalateAlerts a person, with how serious it is and which part is affected.Always allowed
ignoreMarks 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.

TermMeaning
Edge machineA location with its own computers but usually no IT staff on hand: a depot, factory, store or vehicle test bay.
LogThe text a program writes about what it is doing, including warnings and errors.
IncidentSomething that went wrong and needs attention, such as a full disk or a crashed service.
Root causeThe first thing that actually broke. One full disk can cause twenty errors; the full disk is the root cause.
On-callThe person whose phone rings when something breaks outside working hours.
Policy file / lanepolicy.yaml puts every action in a lane: AUTO runs it, ASK waits for approval, NEVER blocks it and pages a human.
EscalateHand the problem to a person by SMS or voice call instead of acting.
RedactionRemoving private details (emails, addresses, IDs, tokens) from text before it is stored or sent.
Audit chainEvery decision record carries the SHA-256 hash of the previous one, so any later edit or deletion is detectable.
ModelThe small distilled model that reads the log window and proposes one action. It runs on the device, not in the cloud.