How antropos17/aegis works
Purpose and Entry Points
AEGIS is a local, monitor-first desktop application for observing AI coding-agent processes, sensitive file activity, TCP endpoints, and behavioral risk without agent plugins. Electron’s main process starts the monitoring system; the Svelte renderer presents live state and manual process actions. Core entry points: src/main/main.js, src/main/preload.js, src/renderer/main.js, and src/renderer/App.svelte.
Process Discovery and Identity
The scan loop repeatedly enumerates processes, detects known agents from the shared signature database, resolves parent/IDE/WSL context, and assigns lifetime-aware identities. Identity and attribution are deliberately allowed to be weak or unknown, forming a key correctness boundary under PID reuse and incomplete OS metadata. Main components: src/main/scan-loop.js, src/main/process-scanner.js, src/main/process-identity.js; signatures reside in src/shared/agent-database.json.
Observation Sensors
Sensors independently collect process, file, network, resource, and runtime evidence. File watching runs through a worker-thread boundary and registered watch roots; network monitoring maps TCP endpoints back to detected PIDs. Platform adapters isolate Windows, macOS, Linux, proc-snapshot, Restart Manager, and experimental ETW mechanisms. Relevant paths: src/main/file-watcher.js, src/main/watch-worker-thread.js, src/main/network-monitor.js; platform boundary: src/main/platform/index.js, src/main/platform/win32.js, src/main/platform/linux.js.
Evidence Normalization, Attribution, and Health
Raw observations are normalized into a shared event model, linked to process identities, attributed at confirmed/inferred/unattributed confidence, and monitored for data gaps or degraded sensors. This separates sensor-specific collection from downstream detection and audit semantics. Primary modules: src/main/attribution.js, src/main/audit-normalize.js, src/main/sensor-health.js; shared normalization/types: src/shared/ecs-normalizer.js, src/shared/types/events.ts.
Detection and Risk Pipeline
Normalized events are evaluated against YAML sensitive-path rules, correlated by sequence rules, compared to rolling session baselines, and scored for anomalies. Rules are data-driven and hot-loadable rather than embedded in individual sensors. Components: src/main/rule-loader.js, src/main/sequence-engine.js, src/main/anomaly-detector.js; rule sources: rules/_schema.json, rules/sequences/sequences.yaml, rules/ai-config.yaml.
Durable Audit and Export Boundary
Events enter bounded audit logging and a hash-chained JSONL trail with rotation/retention. An audit index supports queries and rebuilds; exports stream data to JSON, CSV, HTML, or ZIP. The chain detects modification relative to trusted state but is not proof of complete capture, so observation-loss and health records are material inputs. Paths: src/main/audit-logger.js, src/main/audit-hashchain.js, src/main/audit-index.js, src/main/exports.js.
IPC, UI, and External Services
The preload bridge exposes constrained Electron IPC; handlers connect renderer requests to monitoring state, settings, audit queries, exports, and manual process controls. The renderer maintains event/risk/health stores and visualizes feeds, timelines, agent details, network activity, and reports. Paths: src/main/ipc-handlers.js, src/renderer/lib/stores/ipc.ts, src/renderer/lib/components/ActivityFeed.svelte, src/renderer/lib/components/ThreatAnalysis.svelte. Runtime stack is Node.js 24/Electron plus CommonJS main code and Svelte/TypeScript UI. Data stays local by default; optional AI analysis contacts Anthropic, while update checks/releases use GitHub and signed update verification is implemented in src/main/update-verification.js.
Windows Sidecars and Evaluation
C# sidecars provide Windows-specific ETW lifecycle/probing and process-snapshot experiments, invoked across a protocol boundary rather than embedded in the Electron process. The benchmark subsystem records/replays scenarios and compares observations with Sysmon oracle evidence to quantify specific sensor behavior. Paths: sidecar/etw-lifecycle/Program.cs, sidecar/procsnap/Program.cs, src/main/platform/proc-snapshot-client.js; evaluation orchestration: bench/run.js, bench/replay.js.
Main entry points: audit-normalize.js Normalize & attribute · main.js Main process · ipc-handlers.js IPC handlers · index.js Platform adapters
Components 21
Electron Runtime
- Main process · Starts and coordinates local monitoring.
src/main/main.js - Preload bridge
src/main/preload.js - IPC handlers
src/main/ipc-handlers.js - Svelte renderer · Displays live events, risk, health, and manual actions.
src/renderer/App.svelte
Observation
- Scan & identity · Enumerates agents and assigns lifetime-aware identities under uncertain attribution.
src/main/scan-loop.js - Agent signatures
src/shared/agent-database.json - File watcher · Watches registered roots through a worker-thread boundary.
src/main/file-watcher.js - Network monitor · Maps TCP endpoints to detected PIDs.
src/main/network-monitor.js
Evidence & Detection
- Normalize & attribute · Converts raw observations into shared events with attribution confidence.
src/main/audit-normalize.js - Sensor health · Records data gaps and degraded collection.
src/main/sensor-health.js - Rules & sequences · Sensitive-path and sequence rules remain data-driven.
src/main/rule-loader.js - Anomaly detector · Compares events to rolling session baselines.
src/main/anomaly-detector.js
Audit & Export
- Bounded audit log · Writes rotating, retained audit records.
src/main/audit-logger.js - Hash-chained trail · Detects modification relative to trusted state, not capture completeness.
src/main/audit-hashchain.js - Audit index · Supports audit queries and rebuilds.
src/main/audit-index.js - Export service · Produces JSON, CSV, HTML, and ZIP exports.
src/main/exports.js
Platform & External
- Platform adapters · Isolates Windows, Linux, macOS, and OS-specific collection.
src/main/platform/index.js - Windows sidecars · ETW and process-snapshot experiments run across a protocol boundary.
sidecar/etw-lifecycle/Program.cs - Optional AI analysis · Only external analysis path; data is local by default.
- Signed updates
src/main/update-verification.js - Benchmark replay · Compares replayed observations with Sysmon oracle evidence.
bench/replay.js
Connections 29
- Main process → Scan & identity: starts
- Main process → File watcher: starts
- Main process → Network monitor: starts
- Main process → IPC handlers: registers
- Agent signatures → Scan & identity: identifies agents
- Platform adapters → Scan & identity: process context
- Platform adapters → File watcher: OS collection
- Platform adapters → Network monitor: endpoint data
- Windows sidecars → Platform adapters: protocol boundary
- Scan & identity → Normalize & attribute: process evidence
- File watcher → Normalize & attribute: file evidence
- Network monitor → Normalize & attribute: network evidence
- Normalize & attribute → Sensor health: coverage signals
- Normalize & attribute → Rules & sequences: normalized events
- Rules & sequences → Anomaly detector: rule matches
- Normalize & attribute → Anomaly detector: event stream
- Sensor health → Bounded audit log: loss records
- Anomaly detector → Bounded audit log: risk events
- Normalize & attribute → Bounded audit log: audit events
- Bounded audit log → Hash-chained trail: chains records
- Bounded audit log → Audit index: indexes
- Audit index → Export service: query data
- Preload bridge → IPC handlers: constrained IPC
- Svelte renderer → Preload bridge: UI requests
- IPC handlers → Svelte renderer: live state
- IPC handlers → Export service: export requests
- IPC handlers → Optional AI analysis: optional analysis
- Main process → Signed updates: verified update checks
- Benchmark replay → Platform adapters: evaluates sensors