Local-first incident intelligence for manufacturing lines. Vigil ingests noisy machine logs, maintenance tickets and operator notes, detects explainable incidents, records what operators did about them, and lets anyone re-verify the evidence behind each decision.
Maturity: working prototype. Everything below runs locally against generated demo data. It has not been deployed on a real plant network. See Limitations.
Requires Rust 1.89+ and SQLite.
git clone https://github.com/AngelP17/Vigil && cd Vigil
cargo run -p vigil-cli -- daemon --port 8080 # seeds demo data, runs detection, serves the UIOpen http://localhost:8080. Or with Docker: docker compose up --build.
One command runs every core claim end to end in a throwaway workspace and writes a PASS/FAIL verdict per claim:
cargo run -p vigil-cli -- proof # writes artifacts/latest/proof.json, exits non-zero on any FAILReal output from this repository:
PASS detection: 7 incidents from 182 events, 1 rejected as invalid; all of temp_spike, vibration_anomaly, multi_machine_cascade present
PASS replay_verifies: 7 of 7 replays verified
PASS replay_detects_tampering: edited incident 95a4794b-... failed; 6 untouched incidents still verified
PASS telemetry_chains_verify: 6 sensors, 182 records verified
PASS telemetry_detects_tampering: edited a record in georgia-line2-temp; verifier reported: Corruption detected at hash e9a9d84c...
PASS mesh_announcements: both nodes listed each other after 26 ms
CI runs the proof on every push and pull request and uploads proof.json as a build artifact. Every public claim is mapped to its evidence in docs/CLAIMS.md.
Ingest -> Detect -> Explain -> Recommend -> Act -> Replay
- Three incident rules:
temp_spike,vibration_anomalyandmulti_machine_cascade(rules.rs). - Three messy sources: machine logs, maintenance tickets and operator notes. Demo data deliberately includes nulls, duplicates, delayed and out-of-order readings, and notes that conflict with telemetry (simulation.rs).
- Five operator actions: acknowledge, assign maintenance, reroute, override and resolve, each recorded with who and when (actions.rs).
- Verifiable replay: every replay recomputes each audit entry's Merkle root and reports edits (details).
- Hash-chained telemetry: each sensor reading is SHA3-256 hashed together with its parent's hash (types.rs).
- Read-first copilot: summaries, explanations and shift handoffs grounded in incident data. It never takes operator actions; its answers are written to the audit log and verified on replay.
- Plant mesh: nodes announce their telemetry root to each other over HTTP so each site can see which peers are online and whether they hold the same data.
- No required cloud services: no SaaS, cloud database or LLM API. Slack alerts are optional.
All captured from a live two-node run by demo/screenshots/capture-all.mjs, which refuses to capture if the UI is showing sample data.
| Triage queue | Mesh with a second plant |
|---|---|
![]() |
![]() |
| Sensor trends | Telemetry health |
![]() |
![]() |
flowchart LR
subgraph Sources
Logs[Machine logs]
Tickets[Maintenance tickets]
Notes[Operator notes]
end
subgraph Node[Vigil node]
Ingest[Ingest + validation]
Sled[(Sled: hash-chained telemetry)]
Detect[Rule engine]
SQLite[(SQLite: incidents, actions, audit log)]
Replay[Replay verifier]
API[Axum API + WebSocket]
end
Peer[Other Vigil node]
UI[React workbench]
Logs --> Ingest
Ingest --> Sled
Ingest --> SQLite
Tickets --> SQLite
Notes --> SQLite
Sled --> Detect
SQLite --> Detect
Detect --> SQLite
SQLite --> Replay
Replay --> API
SQLite --> API
Sled --> API
API <--> Peer
API --> UI
- Backend: Rust, Axum, Sled for telemetry chains, SQLite (sqlx) for operational state.
- Frontend: Vite, React, TypeScript, Tailwind CSS, Chart.js, served by the same binary.
- Telemetry chains live in Sled; raw events, tickets, notes, incidents, actions and the audit log live in SQLite.
Each incident stores:
- timeline snapshot
- rule fired
- reasoning text
- Merkle root
- operator action history
Replay responses include the verification string (exact characters returned by the API; see crates/vigil-core/src/audit.rs):
Valid Merkle path - data untampered
Use ASCII hyphen-minus (U+002D) between path and data, not an en dash or em dash.
Every replay recomputes the Merkle root of each stored audit entry (detection timelines and copilot answers) from its stored contents and compares it with the root recorded when the entry was written. The verification field is one of:
Valid Merkle path - data untampered: every audit entry for the incident matches its stored root.Merkle verification failed: at least one entry was edited after it was written; its id is listed infailed_entries.No audit records to verify: the incident has no audit entries, so nothing is claimed.
verified_entries reports how many entries matched. This detects edits to the evidence or the answer text. It does not protect against someone who can rewrite both the contents and the stored root in the SQLite database, and it does not cover the Sled telemetry chain, which vigil verify -s <sensor> checks separately by walking parent hashes from the latest stored record.
Copilot responses are also written into replay as read-only audit entries. For completeness relative to known-good evidence, use independently retained checkpoints. The CLI verifies sensor prefixes or exact incident snapshots against a separately trusted checkpoint.
Point each node at its peers:
vigil --db-path ./plant-a daemon --port 8080 --peer http://10.0.0.6:8080
vigil --db-path ./plant-b daemon --port 8080 --peer http://10.0.0.5:8080Every --announce-interval-secs (default 10) a node sends its node id and a Merkle root over every sensor's latest chain hash to each peer. GET /api/mesh/topology then lists peers, when they were last seen and their root, so an operator can tell which plants are online and whether two nodes hold identical telemetry. Set VIGIL_MESH_TOKEN on every node to reject announcements from anything else. The mesh shares roots, not data: it does not replicate telemetry between nodes.
The copilot is intentionally narrow:
- summarizes the incident
- explains why the incident fired
- prepares a shift handoff note
- answers bounded read-only questions grounded in incident, replay, health, and telemetry context
It does not execute operator actions. Each answer is stored as an audit entry so replay can verify it later. Implementation details are in docs/vigil-agent.md.
GET /api/dashboard/summary
GET /api/incidents
GET /api/incidents?severity=&status=&machine=&q=&from=&to=&tenant_id=
GET /api/incidents/export/csv
GET /api/incidents/:id
GET /api/incidents/:id/export/json
GET /api/incidents/:id/export/pdf
GET /api/incidents/:id/report
GET /api/incidents/:id/notify/mailto
GET /api/mesh/topology
POST /api/mesh/gossip
POST /api/export/:id
GET /api/export/:id/car
GET /api/integrations/slack
PUT /api/integrations/slack
POST /api/integrations/slack/test
POST /api/incidents/:id/copilot
GET /api/incidents/:id/replay
POST /api/incidents/:id/actions
POST /api/auth/login
POST /api/auth/logout
GET /api/auth/me
GET /api/health
GET /api/status
GET /api/copilot/status
POST /api/detection/run
GET /api/sensors
GET /api/sensor/:id/history
GET /api/sensor/:id/analytics
Environment (optional):
VIGIL_REQUIRE_AUTH=true: requireAuthorization: Bearer <token>on write/simulation/detection/actions/copilot/reorderVIGIL_ENFORCE_TENANT_SCOPE=true: when set, signed-in operators with roleoperator(notsupervisor/admin) only see incidents matching theirtenant_id(CSV/list/detail/replay/exports respect the same rule)VIGIL_MESH_TOKEN: shared secret peers send asX-Vigil-Mesh-TokenonPOST /api/mesh/gossip. Required whenVIGIL_REQUIRE_AUTH=true; without it the mesh endpoint rejects every announcement.VIGIL_SLACK_WEBHOOK_URL: Slack incoming webhook for critical incidents after detection (optional; dashboard System Health can also persist a URL in SQLite viaPUT /api/integrations/slack,admin/supervisoronly : env wins on restart if set)
Default operator (first database init): username operator, password vigil. Create more with
cargo run -p vigil-cli -- create-user --username alice --password '...' --role supervisor.
scripts/bench.sh builds a release binary and measures chain writes and full-chain verification, recording hardware and toolchain with the raw output in benchmarks/results/.
| Records | Write throughput | Full-chain verify |
|---|---|---|
| 10,000 | 34,167 writes/s | 0.048 s |
| 100,000 | 32,661 writes/s | 0.590 s |
Measured on a 2 vCPU Intel Xeon @ 2.30GHz cloud VM, Linux, rustc 1.97.0. Single-writer, single sensor, Sled default settings. Your numbers will differ; rerun the script.
- Demo data only. No real PLC or historian integration has been tested.
- Legacy replay can verify edits within surviving audit rows but cannot establish completeness. The optional incident checkpoint covers the captured audit and operator action rows if independently retained.
- Without
--checkpoint, telemetry verification only walks from the current stored head. It cannot detect lost history that is no longer reachable. An independent checkpoint can establish completeness of the captured sensor prefix. - The mesh exchanges roots only and does not replicate or reconcile telemetry. The CRDT and CAR export code in
vigil-p2pandvigil-syncis not wired into live sync. - Router tests cover authenticated operator actions and tenant-scoped list, detail and actions. Other route and role combinations have not been exhaustively tested.
- Default credentials are
operator/vigil. Change them before exposing a node to a network.
Contributions are welcome. Start with CONTRIBUTING.md and the good first issues.
MIT




