PacketFlowAI is a predictive cyber-defence prototype built around a temporal threat world model, deterministic hyperdimensional encoding, local neural/prototype/anomaly evidence, optional bounded NVIDIA NIM reasoning, and an explicit authority graph. Live capture and PCAP replay use the same flow, detection, fusion, policy, evidence, and campaign pipeline.
- Deterministic HDC encoding with checkpoint integrity validation
- Bidirectional IPv4/IPv6 TCP/UDP flow tracking with temporal and host features
- Temporal HDC, prototype similarity, OOD detection, anomaly scoring, and calibration
- Dataset-native label normalization without explanation leakage
- Named dataset adapters and machine-readable security benchmark reports
- Optional NIM disabled/shadow/influence modes with evidence sanitization
- Deterministic fusion, ATT&CK provenance, alert-only defaults, and TTL containment gates
- SQLite evidence, analyst-adjudicated feedback, drift checks, and active learning
- Candidate/active/previous model registry with promotion and rollback
- Read-only API, Prometheus metrics, structured logs, and operations dashboard
- Persistent campaign graph connecting flows, hosts, accounts, services, alerts, ATT&CK techniques, and cases
- Next-move prediction with uncertainty, evidence references, and time horizons
- Counterfactual response simulation and digital-twin blast-radius analysis
- Evidence time reconstruction, hash-chain sealing, Merkle verification, and explicit action authority
- Multi-sensor adapters, threat memory, guarded continual prototypes, federated consensus, and bounded playbooks
- Clone the repository.
git clone https://github.com/Arkay92/PacketFlowAI.git- Install dependencies.
cd PacketFlowAI
pip install -e .List available commands:
python -m packetflowai --helpTrain against a dataset containing authoritative labels:
python -m packetflowai train --dataset rdpahalavan/packet-tag-explanation --split train --epochs 10List interfaces and start live capture:
python -m packetflowai interfaces
python -m packetflowai capture --interface <interface_name>Replay a PCAP through the same flow pipeline:
python -m packetflowai replay traffic.pcap
python -m packetflowai replay traffic.pcap --realtime --speed 10 --output artifacts/replay.jsonBenchmark, model lifecycle, API/dashboard, and load testing:
python -m packetflowai benchmark run --dataset cicids2017 --input test.csv \
--predictions predictions.json --model candidate-v2 --output artifacts/benchmarks/report.json
python -m packetflowai model list
python -m packetflowai model promote packet-hv-mlp:2.3.0
python -m packetflowai api --host 127.0.0.1 --port 8080
python -m packetflowai loadtest --flows 10000 --packets-per-flow 4The API command starts the Signal Room at http://127.0.0.1:8080. The live dashboard visualizes flow activity, threat pressure, classifications, alerts, evidence channels, model state, and runtime telemetry. It refreshes every four seconds and exposes a pause control for incident review.
The Forensics view isolates orange and red packet conversations for deeper analysis. Select cases from the threat constellation or case strip, use the arrow keys to move between incidents, and inspect route identity, packet statistics, directional volume, model evidence, protocol metadata, policy provenance, and the correlated read-only record.
The Command view is the v3 predictive-defence cell. Navigate the temporal threat graph, inspect campaign and next-move assessments, compare counterfactual responses, rewind the evidence timeline, verify the sealed forensic chain, and inspect exactly where autonomous authority ends.
Create the guided Signal Room presentation video with Playwright:
pip install -e ".[presentation]"
playwright install chromium
python scripts/create_ui_video.pyThe recorder uses isolated presentation data and writes artifacts/presentation/packetflowai-signal-room-tour.webm. Each explanatory card and dashboard view is held for at least six seconds.
Record the interactive Forensic War Room analyst journey with:
python scripts/create_forensics_video.pyThis walkthrough uses a visible guided cursor, real clicks, smooth scrolling, case navigation, and the same UI-styled explanatory cards. It writes artifacts/presentation/packetflowai-forensics-war-room-tour.webm.
Record the complete v3 journey with:
python scripts/create_v3_video.pyThe v3 walkthrough uses real navigation, graph selection, response comparisons, timeline controls, Forensic War Room movement, and UI-styled cards held for at least five seconds. It writes artifacts/presentation/packetflowai-v3-predictive-defence-tour.webm.
python main.py ... remains available as a compatibility launcher. Live capture requires appropriate packet-capture permissions and Npcap on Windows.
Configuration is defined in packetflowai/config.py. Common runtime overrides are available through environment variables:
PACKETFLOWAI_ARTIFACT_DIRPACKETFLOWAI_HV_DIMENSIONPACKETFLOWAI_NUM_LEVELSPACKETFLOWAI_ENCODER_SEEDPACKETFLOWAI_QUEUE_SIZEPACKETFLOWAI_RISK_HALF_LIFEPACKETFLOWAI_NIM_MODE(disabled,shadow, orinfluence)NIM_BASE_URLNIM_MODELNVIDIA_API_KEY(environment/secret manager only)
NIM is disabled by default. Its self-reported reasoning strength is not a calibrated probability, it cannot invoke enforcement, and its assessments cannot become training labels. Generated checkpoints, registry state, databases, reports, and logs live under artifacts/ and are excluded from Git. Legacy state-dict-only checkpoints intentionally fail manifest validation.
See architecture, threat model, and benchmark methodology.
Run the test suite with:
python -m unittest discover -vThis project is licensed under the MIT License. See LICENSE.