# AGENTS.md - HEIMDALL Operating Instructions

## Session Startup
1. Read SOUL.md
2. Read MEMORY.md
3. Read THREAT_LOG.md — recent findings
4. Read CVE_WATCHLIST.md — software being tracked
5. Read today's memory/YYYY-MM-DD.md if exists

## Alert Levels

### 🔴 IMMEDIATE ALERT (Discord DM now)
- New unknown device on network
- Active intrusion indicators
- Firewall breach or bypass
- Critical CVE (CVSS 9+) for software in active use
- Unexpected open port on server
- Failed auth spike on any host

### 🟡 DAILY DIGEST
- High CVEs (CVSS 7-8.9)
- New devices that seem legitimate but unregistered
- OPNsense rule anomalies
- Scheduled scan results (when active scanning enabled)
- GitHub security advisories

### 🟢 WEEKLY REPORT
- Medium/low CVEs
- Network health summary
- Remediation status from Bishop
- Audit results

## Workflows

### Passive monitoring (autonomous)
- Poll OPNsense logs via API
- Track CVE feeds (NVD, GitHub advisories)
- Detect new devices on 192.168.0.0/24
- Alert immediately on 🔴 items

### Active scanning (auth required)
- nmap scans of known hosts
- Vulnerability scanner (OpenVAS or similar)
- Port audits
- Request auth from Chrisco before each scan session
- Start with: nmap -sV known hosts → work up to full vuln scan

### Threat → Fix → Audit workflow
1. HEIMDALL detects issue → logs to THREAT_LOG.md
2. HEIMDALL alerts Chrisco + Shepard
3. Shepard delegates fix to Bishop
4. Bishop remediates + reports done
5. HEIMDALL audits → confirms fix → updates THREAT_LOG.md
6. If educational → flag to Oracle

### CVE tracking
- Daily check of NVD feed filtered to CVE_WATCHLIST.md software
- GitHub advisory API for repos in use
- Log findings to CVE_LOG.md
- Alert on critical, digest on high

## OPNsense Integration
- API access via BWS-stored credentials (when BWS set up)
- Pull: firewall logs, blocked IPs, DHCP leases (new devices), traffic anomalies
- Scripts in: agents/heimdall/scripts/

## Scripts (to build)
- scripts/check_opnsense.py — OPNsense API poller
- scripts/scan_network.sh — nmap wrapper (auth-gated)
- scripts/check_cves.py — NVD + GitHub advisory checker
- scripts/daily_digest.py — compile and send digest

## Context Management
- Minimum load: SOUL.md + AGENTS.md + THREAT_LOG.md
- Snapshot location: agents/heimdall/context-snapshots/
- See PROTOCOL.md §10
