# pipelab-org/pipelock architecture

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

- Interactive diagram: https://gitdiagram.com/pipelab-org/pipelock
- Repository: https://github.com/pipelab-org/pipelock

## Overview

Pipelock is an AI-agent firewall that mediates agent network and tool traffic, evaluates it against security policies, and records signed evidence of boundary decisions. Its primary workflow routes agent traffic through the proxy or MCP interface, applies inspection and enforcement, then emits receipts to the recorder for later replay and offline verification. The repository also documents containment, integrations, a public playground, and enterprise fleet and dashboard capabilities. Connections below are limited to README statements and relationships visible in the supplied source index or excerpts; unsampled subsystem links are omitted.

Main entry points: [`internal/cli/runtime/server.go`](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/server.go) (Proxy runtime), [`internal/mcp/pipeline_gates.go`](https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_gates.go) (MCP pipeline), [`internal/cli/runtime/capture_writer.go`](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/capture_writer.go) (Flight recorder), [`internal/mcp/pipeline_decision.go`](https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_decision.go) (Decision receipts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mediation["Traffic mediation"]
  node_cli["Pipelock CLI<br/>[main.go]"]
  node_runtime["Proxy runtime<br/>[server.go]"]
  node_mcp["MCP pipeline<br/>[pipeline_gates.go]"]
  node_scanner["Content scanner<br/>[fragment_buffer.go]"]
  node_deferred["Deferred actions<br/>[manager.go]"]
  node_containment["Host containment<br/>[run.go]"]
  node_integrations["Agent integrations"]
  node_scanapi["Scan API<br/>[handler.go]"]
end

subgraph group_evidence["Evidence and review"]
  node_receipts["Decision receipts"]
  node_recorder[("Flight recorder<br/>[capture_writer.go]")]
  node_capture["Capture replay<br/>[replay.go]"]
  node_evidenceview["Evidence viewer<br/>[evidence.go]"]
  node_verifier["Receipt verifier<br/>[main.go]"]
end

subgraph group_enterprise["Enterprise operations"]
  node_controlplane["Fleet control plane<br/>[handler.go]"]
  node_fleetsink[("Fleet audit store<br/>[storage.go]")]
  node_dashboard["Enterprise dashboard<br/>[handler.go]"]
  node_licenses["License service<br/>[server.go]"]
end

subgraph group_playground["Playground"]
  node_broker["Playground broker<br/>[server.go]"]
  node_livechat["Live chat<br/>[server.go]"]
  node_playagent["Playground agent<br/>[main.go]"]
end

node_agent(("AI agent"))
node_playgrounduser(("Playground visitor"))

node_agent -->|"routes traffic"| node_runtime
node_agent -->|"uses wrapper"| node_mcp
node_cli -.->|"starts"| node_runtime
node_runtime -->|"dispatches"| node_mcp
node_mcp -->|"scans content"| node_scanner
node_runtime -->|"manages holds"| node_deferred
node_mcp -->|"emits decisions"| node_receipts
node_runtime -.->|"records session"| node_recorder
node_agent -->|"runs contained"| node_containment
node_integrations -->|"configures routing"| node_agent
node_scanapi -->|"invokes scans"| node_scanner
node_recorder -->|"feeds replay"| node_capture
node_recorder -->|"provides sessions"| node_evidenceview
node_receipts -->|"verified offline"| node_verifier
node_controlplane -->|"stores audit batches"| node_fleetsink
node_playgrounduser -->|"requests session"| node_broker
node_broker -->|"proxies session API"| node_livechat
node_playgrounduser -->|"redeems invite"| node_livechat
node_playagent -->|"sends via proxy"| node_runtime

click node_cli "https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock/main.go"
click node_runtime "https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/server.go"
click node_mcp "https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_gates.go"
click node_scanner "https://github.com/pipelab-org/pipelock/blob/main/internal/scanner/fragment_buffer.go"
click node_deferred "https://github.com/pipelab-org/pipelock/blob/main/internal/deferred/manager.go"
click node_containment "https://github.com/pipelab-org/pipelock/blob/main/internal/cli/contain/run.go"
click node_integrations "https://github.com/pipelab-org/pipelock/tree/main/internal/cli/setup"
click node_scanapi "https://github.com/pipelab-org/pipelock/blob/main/internal/scanapi/handler.go"
click node_receipts "https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_decision.go"
click node_recorder "https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/capture_writer.go"
click node_capture "https://github.com/pipelab-org/pipelock/blob/main/internal/capture/replay.go"
click node_evidenceview "https://github.com/pipelab-org/pipelock/blob/main/internal/cli/evidence/evidence.go"
click node_verifier "https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock-verifier/main.go"
click node_controlplane "https://github.com/pipelab-org/pipelock/blob/main/enterprise/conductor/controlplane/handler.go"
click node_fleetsink "https://github.com/pipelab-org/pipelock/blob/main/enterprise/fleet/sink/storage.go"
click node_dashboard "https://github.com/pipelab-org/pipelock/blob/main/enterprise/dashboard/handler.go"
click node_licenses "https://github.com/pipelab-org/pipelock/blob/main/enterprise/licenseservice/server.go"
click node_broker "https://github.com/pipelab-org/pipelock/blob/main/internal/playground/broker/server.go"
click node_livechat "https://github.com/pipelab-org/pipelock/blob/main/internal/playground/livechat/server.go"
click node_playagent "https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock-playground-llm-agent/main.go"

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_cli,node_runtime,node_mcp,node_scanner,node_deferred,node_containment,node_integrations,node_scanapi toneBlue
class node_receipts,node_recorder,node_capture,node_evidenceview,node_verifier toneAmber
class node_controlplane,node_fleetsink,node_dashboard,node_licenses toneMint
class node_broker,node_livechat,node_playagent toneRose
class node_agent,node_playgrounduser toneIndigo
```

## Components

### Traffic mediation

- [Pipelock CLI](https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock/main.go): `cmd/pipelock/main.go`
- [Proxy runtime](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/server.go): `internal/cli/runtime/server.go`
- [MCP pipeline](https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_gates.go): `internal/mcp/pipeline_gates.go`
- [Content scanner](https://github.com/pipelab-org/pipelock/blob/main/internal/scanner/fragment_buffer.go): `internal/scanner/fragment_buffer.go`
- [Deferred actions](https://github.com/pipelab-org/pipelock/blob/main/internal/deferred/manager.go): `internal/deferred/manager.go`
- [Host containment](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/contain/run.go): `internal/cli/contain/run.go`
- [Agent integrations](https://github.com/pipelab-org/pipelock/tree/main/internal/cli/setup): `internal/cli/setup`
- [Scan API](https://github.com/pipelab-org/pipelock/blob/main/internal/scanapi/handler.go): `internal/scanapi/handler.go`

### Evidence and review

- [Decision receipts](https://github.com/pipelab-org/pipelock/blob/main/internal/mcp/pipeline_decision.go): `internal/mcp/pipeline_decision.go`
- [Flight recorder](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/runtime/capture_writer.go): `internal/cli/runtime/capture_writer.go`
- [Capture replay](https://github.com/pipelab-org/pipelock/blob/main/internal/capture/replay.go): `internal/capture/replay.go`
- [Evidence viewer](https://github.com/pipelab-org/pipelock/blob/main/internal/cli/evidence/evidence.go): `internal/cli/evidence/evidence.go`
- [Receipt verifier](https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock-verifier/main.go): `cmd/pipelock-verifier/main.go`

### Enterprise operations

- [Fleet control plane](https://github.com/pipelab-org/pipelock/blob/main/enterprise/conductor/controlplane/handler.go): `enterprise/conductor/controlplane/handler.go`
- [Fleet audit store](https://github.com/pipelab-org/pipelock/blob/main/enterprise/fleet/sink/storage.go): `enterprise/fleet/sink/storage.go`
- [Enterprise dashboard](https://github.com/pipelab-org/pipelock/blob/main/enterprise/dashboard/handler.go): `enterprise/dashboard/handler.go`
- [License service](https://github.com/pipelab-org/pipelock/blob/main/enterprise/licenseservice/server.go): `enterprise/licenseservice/server.go`

### Playground

- [Playground broker](https://github.com/pipelab-org/pipelock/blob/main/internal/playground/broker/server.go): `internal/playground/broker/server.go`
- [Live chat](https://github.com/pipelab-org/pipelock/blob/main/internal/playground/livechat/server.go): `internal/playground/livechat/server.go`
- [Playground agent](https://github.com/pipelab-org/pipelock/blob/main/cmd/pipelock-playground-llm-agent/main.go): `cmd/pipelock-playground-llm-agent/main.go`

### Other components

- **AI agent**
- **Playground visitor**

## Connections

- AI agent → Proxy runtime: routes traffic
- AI agent → MCP pipeline: uses wrapper
- Pipelock CLI → Proxy runtime: starts
- Proxy runtime → MCP pipeline: dispatches (evidence: `internal/cli/runtime/server.go`)
- MCP pipeline → Content scanner: scans content (evidence: `internal/mcp/pipeline_gates.go`)
- Proxy runtime → Deferred actions: manages holds (evidence: `internal/cli/runtime/server.go`)
- MCP pipeline → Decision receipts: emits decisions (evidence: `internal/mcp/pipeline_decision.go`)
- Proxy runtime → Flight recorder: records session
- AI agent → Host containment: runs contained
- Agent integrations → AI agent: configures routing
- Scan API → Content scanner: invokes scans (evidence: `internal/scanapi/handler.go`)
- Flight recorder → Capture replay: feeds replay
- Flight recorder → Evidence viewer: provides sessions
- Decision receipts → Receipt verifier: verified offline
- Fleet control plane → Fleet audit store: stores audit batches (evidence: `enterprise/fleet/sink/storage.go`)
- Playground visitor → Playground broker: requests session
- Playground broker → Live chat: proxies session API
- Playground visitor → Live chat: redeems invite
- Playground agent → Proxy runtime: sends via proxy (evidence: `cmd/pipelock-playground-llm-agent/main.go`)
