# pardhuvarmax/kernel-borderlands architecture

> Architecture diagram of the GitHub repository pardhuvarmax/kernel-borderlands, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pardhuvarmax/kernel-borderlands
- Repository: https://github.com/pardhuvarmax/kernel-borderlands

## Overview

Kernel Borderlands is a Linux runtime-defense platform: kernel telemetry is collected and analyzed, coordinated by a Go control plane, and exposed to operators and an autonomous defense swarm for response. The graph also preserves the documented script-safety checker, management interfaces, MCP integration, and MARL research capabilities. Some links—especially dashboard/backend and kernel event delivery to AADS—are documented only broadly or explicitly incomplete; these are omitted or marked unverified rather than inferred as live flows.

Main entry points: [`kb-control-plane/internal/controlplane`](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/controlplane) (Control plane), [`kb-core/userspace/sensor/kbd_sensor.c`](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-core/userspace/sensor/kbd_sensor.c) (Sensor loader), [`kb-checker/src/main.rs`](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/main.rs) (Safety checker), [`kb-aads/agents`](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-aads/agents) (Defense agents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel sensing"]
  node_ebpf["eBPF hooks"]
  node_sensor["Sensor loader<br/>[kbd_sensor.c]"]
  node_evidence["Behavior evidence<br/>[kb_evidence.h]"]
  node_behavior["Behavior analytics"]
  node_bridge["Userspace bridge"]
end

subgraph group_control["Control and policy"]
  node_daemon["Control daemon<br/>[main.go]"]
  node_controlplane["Control plane"]
  node_policy["Policy and enforcement"]
  node_detection["Exfiltration detection<br/>[exfil.go]"]
  node_state[("Process state store")]
  node_ipc["Sensor IPC"]
end

subgraph group_defense["Autonomous defense"]
  node_swarm["Swarm orchestrator<br/>[orchestrator.py]"]
  node_agents["Defense agents"]
  node_consensus["JJE consensus<br/>[jje.py]"]
  node_marl["MARL training"]
end

subgraph group_interfaces["Operator and integrations"]
  node_dashboard["Web dashboard<br/>[App.tsx]"]
  node_tui["Terminal interface<br/>[app.rs]"]
  node_mcp["MCP server<br/>[main.go]"]
end

subgraph group_analysis["Safety analysis"]
  node_checker["Safety checker<br/>[main.rs]"]
  node_integrity["Integrity checks<br/>[mod.rs]"]
  node_servicecheck["Service checks<br/>[mod.rs]"]
  node_report["Analysis reports<br/>[mod.rs]"]
end

node_linux(("Linux host"))
node_operator(("Operator"))

node_linux -.->|"triggers hooks"| node_ebpf
node_ebpf -.->|"emits telemetry"| node_sensor
node_sensor -->|"uses evidence model"| node_evidence
node_sensor -.->|"uses analytics"| node_behavior
node_sensor -->|"uses bridge"| node_bridge
node_daemon -->|"starts"| node_controlplane
node_controlplane -->|"coordinates"| node_detection
node_controlplane -->|"uses policy"| node_policy
node_controlplane -->|"uses store"| node_state
node_controlplane -->|"uses IPC"| node_ipc
node_ipc -.->|"exchanges commands"| node_sensor
node_operator -->|"views monitoring"| node_dashboard
node_operator -->|"manages host"| node_tui
node_tui -->|"queries and controls"| node_controlplane
node_operator -->|"uses AI tools"| node_mcp
node_swarm -->|"spawns actors"| node_agents
node_swarm -->|"creates judge"| node_consensus
node_consensus -->|"coordinates jury"| node_agents
node_agents -.->|"requests actions"| node_controlplane
node_operator -->|"trains policies"| node_marl
node_checker -->|"runs checks"| node_integrity
node_checker -->|"runs checks"| node_servicecheck
node_checker -->|"produces reports"| node_report
node_report -->|"uses check results"| node_servicecheck

click node_ebpf "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/ebpf"
click node_sensor "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-core/userspace/sensor/kbd_sensor.c"
click node_evidence "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-core/include/kb_evidence.h"
click node_behavior "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/userspace/behavior"
click node_bridge "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/userspace/bridge"
click node_daemon "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-control-plane/cmd/kbd/main.go"
click node_controlplane "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/controlplane"
click node_policy "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/policy"
click node_detection "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-control-plane/internal/detection/exfil.go"
click node_state "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/store"
click node_ipc "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/ipc"
click node_swarm "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-aads/swarm/orchestrator.py"
click node_agents "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-aads/agents"
click node_consensus "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-aads/consensus/jje.py"
click node_marl "https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-aads/marl"
click node_dashboard "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-dashboard/src/App.tsx"
click node_tui "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-tui/src/app.rs"
click node_mcp "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-mcp/main.go"
click node_checker "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/main.rs"
click node_integrity "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/integrity/mod.rs"
click node_servicecheck "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/service_check/mod.rs"
click node_report "https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/report/mod.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ebpf,node_sensor,node_evidence,node_behavior,node_bridge toneBlue
class node_daemon,node_controlplane,node_policy,node_detection,node_state,node_ipc toneAmber
class node_swarm,node_agents,node_consensus,node_marl toneMint
class node_dashboard,node_tui,node_mcp toneRose
class node_checker,node_integrity,node_servicecheck,node_report,node_linux,node_operator toneIndigo
```

## Components

### Kernel sensing

- [eBPF hooks](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/ebpf): `kb-core/ebpf`
- [Sensor loader](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-core/userspace/sensor/kbd_sensor.c): `kb-core/userspace/sensor/kbd_sensor.c`
- [Behavior evidence](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-core/include/kb_evidence.h): `kb-core/include/kb_evidence.h`
- [Behavior analytics](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/userspace/behavior): `kb-core/userspace/behavior`
- [Userspace bridge](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-core/userspace/bridge): `kb-core/userspace/bridge`

### Control and policy

- [Control daemon](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-control-plane/cmd/kbd/main.go): `kb-control-plane/cmd/kbd/main.go`
- [Control plane](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/controlplane): `kb-control-plane/internal/controlplane`
- [Policy and enforcement](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/policy): `kb-control-plane/internal/policy`
- [Exfiltration detection](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-control-plane/internal/detection/exfil.go): `kb-control-plane/internal/detection/exfil.go`
- [Process state store](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/store): `kb-control-plane/internal/store`
- [Sensor IPC](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-control-plane/internal/ipc): `kb-control-plane/internal/ipc`

### Autonomous defense

- [Swarm orchestrator](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-aads/swarm/orchestrator.py): `kb-aads/swarm/orchestrator.py`
- [Defense agents](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-aads/agents): `kb-aads/agents`
- [JJE consensus](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-aads/consensus/jje.py): `kb-aads/consensus/jje.py`
- [MARL training](https://github.com/pardhuvarmax/kernel-borderlands/tree/main/kb-aads/marl): `kb-aads/marl`

### Operator and integrations

- [Web dashboard](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-dashboard/src/App.tsx): `kb-op/kb-dashboard/src/App.tsx`
- [Terminal interface](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-tui/src/app.rs): `kb-op/kb-tui/src/app.rs`
- [MCP server](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-op/kb-mcp/main.go): `kb-op/kb-mcp/main.go`

### Safety analysis

- [Safety checker](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/main.rs): `kb-checker/src/main.rs`
- [Integrity checks](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/integrity/mod.rs): `kb-checker/src/integrity/mod.rs`
- [Service checks](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/service_check/mod.rs): `kb-checker/src/service_check/mod.rs`
- [Analysis reports](https://github.com/pardhuvarmax/kernel-borderlands/blob/main/kb-checker/src/report/mod.rs): `kb-checker/src/report/mod.rs`

### Other components

- **Linux host**
- **Operator**

## Connections

- Linux host → eBPF hooks: triggers hooks (evidence: `README.md`)
- eBPF hooks → Sensor loader: emits telemetry (evidence: `README.md`)
- Sensor loader → Behavior evidence: uses evidence model (evidence: `kb-core/userspace/sensor/kbd_sensor.c`)
- Sensor loader → Behavior analytics: uses analytics
- Sensor loader → Userspace bridge: uses bridge (evidence: `kb-core/userspace/sensor/kbd_sensor.c`)
- Control daemon → Control plane: starts (evidence: `kb-control-plane/cmd/kbd/main.go`)
- Control plane → Exfiltration detection: coordinates (evidence: `kb-control-plane/internal/controlplane/controlplane.go`)
- Control plane → Policy and enforcement: uses policy (evidence: `kb-control-plane/internal/controlplane/controlplane.go`)
- Control plane → Process state store: uses store (evidence: `kb-control-plane/internal/controlplane/controlplane.go`)
- Control plane → Sensor IPC: uses IPC (evidence: `kb-control-plane/internal/controlplane/controlplane.go`)
- Sensor IPC → Sensor loader: exchanges commands
- Operator → Web dashboard: views monitoring (evidence: `README.md`)
- Operator → Terminal interface: manages host (evidence: `README.md`)
- Terminal interface → Control plane: queries and controls
- Operator → MCP server: uses AI tools (evidence: `README.md`)
- Swarm orchestrator → Defense agents: spawns actors (evidence: `kb-aads/swarm/orchestrator.py`)
- Swarm orchestrator → JJE consensus: creates judge (evidence: `kb-aads/swarm/orchestrator.py`)
- JJE consensus → Defense agents: coordinates jury (evidence: `kb-aads/swarm/orchestrator.py`)
- Defense agents → Control plane: requests actions
- Operator → MARL training: trains policies (evidence: `README.md`)
- Safety checker → Integrity checks: runs checks
- Safety checker → Service checks: runs checks
- Safety checker → Analysis reports: produces reports
- Analysis reports → Service checks: uses check results (evidence: `kb-checker/src/report/mod.rs`)
