# devopsmaddog/security-context-builder architecture

> Architecture diagram of the GitHub repository devopsmaddog/security-context-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devopsmaddog/security-context-builder
- Repository: https://github.com/devopsmaddog/security-context-builder

## Overview

This repository is an AppSec system design with a small runnable evidence-context prototype and a Pattern1 reference integration—not a complete autonomous agent. The concrete workflow is deployment and normalized scan evidence → canonical bundle assembly → validation and context generation → scoped SQLite fix retrieval. The design also specifies broader readers, adapters, repair, verification and knowledge capabilities, but those are not implemented here. Edges for those planned capabilities are limited to README-documented relationships; unsampled implementation details are not inferred.

Main entry points: [`context_compiler.py`](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py) (Bundle Compiler), [`patterns/pattern1/scripts/build_bundle.py`](https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/scripts/build_bundle.py) (Bundle Assembly), [`APPSEC_SKILLS.md`](https://github.com/devopsmaddog/security-context-builder/blob/main/APPSEC_SKILLS.md) (Repair and Test Workers), [`patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py`](https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py) (Deployment Capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prototype["Context Prototype"]
  node_compiler["Bundle Compiler"]
  node_validation["Scope and Freshness Checks"]
  node_context["Context and Finding Packets"]
  node_ledger[("SQLite Snapshot")]
  node_retrieval["Fix Retrieval"]
end

subgraph group_pattern["Pattern1 Reference"]
  node_capture["Deployment Capture"]
  node_app["Reference App<br/>[server.js]"]
  node_assembler["Bundle Assembly<br/>[build_bundle.py]"]
end

subgraph group_design["Enterprise Design"]
  node_readers["Application and Cloud Readers"]
  node_adapters["Security Tool Adapters<br/>[INTEGRATIONS.md]"]
  node_specs["Versioned Specifications"]
  node_repair["Repair and Test Workers<br/>[APPSEC_SKILLS.md]"]
  node_verification["Sandbox Verification"]
end

subgraph group_knowledge["Knowledge Layer"]
  node_memory[("Experience Retrieval")]
end

node_engineer(("AppSec Engineer"))
node_deployment["Deployment Evidence"]
node_scans["Normalized Scan Evidence"]
node_aws["AWS Services"]

node_aws -->|"supplies observations"| node_capture
node_capture -->|"writes manifest"| node_deployment
node_deployment -->|"provides manifest"| node_assembler
node_scans -->|"provides normalized scans"| node_assembler
node_assembler -->|"imports and validates"| node_compiler
node_engineer -->|"runs compile or query"| node_compiler
node_compiler -->|"validates bundle"| node_validation
node_compiler -->|"renders outputs"| node_context
node_compiler -->|"stores snapshot"| node_ledger
node_compiler -->|"queries fixes"| node_retrieval
node_retrieval -->|"reads snapshot"| node_ledger
node_readers -.->|"feeds evidence"| node_adapters
node_adapters -.->|"normalizes evidence"| node_assembler
node_specs -.->|"guides workflows"| node_repair
node_repair -.->|"requires verification"| node_verification
node_verification -.->|"informs experience"| node_memory
node_memory -.->|"supports retrieval"| node_repair

click node_capture "https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py"
click node_app "https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/vulnapp-app/src/server.js"
click node_assembler "https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/scripts/build_bundle.py"
click node_compiler "https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py"
click node_validation "https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py"
click node_context "https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py"
click node_ledger "https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py"
click node_retrieval "https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py"
click node_readers "https://github.com/devopsmaddog/security-context-builder/blob/main/ENTERPRISE_APPSEC_BLUEPRINT.md"
click node_adapters "https://github.com/devopsmaddog/security-context-builder/blob/main/INTEGRATIONS.md"
click node_specs "https://github.com/devopsmaddog/security-context-builder/blob/main/OPENSPEC_AND_ENTERPRISE_STANDARDS.md"
click node_repair "https://github.com/devopsmaddog/security-context-builder/blob/main/APPSEC_SKILLS.md"
click node_verification "https://github.com/devopsmaddog/security-context-builder/blob/main/SANDBOX_AND_VERIFICATION.md"
click node_memory "https://github.com/devopsmaddog/security-context-builder/blob/main/KNOWLEDGE_AND_SMALL_MODELS.md"

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_compiler,node_validation,node_context,node_ledger,node_retrieval toneBlue
class node_capture,node_app,node_assembler toneAmber
class node_readers,node_adapters,node_specs,node_repair,node_verification toneMint
class node_memory toneRose
class node_engineer,node_deployment,node_scans,node_aws toneIndigo
```

## Components

### Context Prototype

- [Bundle Compiler](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py): `context_compiler.py`
- [Scope and Freshness Checks](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py): `context_compiler.py`
- [Context and Finding Packets](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py): `context_compiler.py`
- [SQLite Snapshot](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py): `context_compiler.py`
- [Fix Retrieval](https://github.com/devopsmaddog/security-context-builder/blob/main/context_compiler.py): `context_compiler.py`

### Pattern1 Reference

- [Deployment Capture](https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py): `patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py`
- [Reference App](https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/vulnapp-app/src/server.js): `patterns/pattern1/vulnapp-app/src/server.js`
- [Bundle Assembly](https://github.com/devopsmaddog/security-context-builder/blob/main/patterns/pattern1/scripts/build_bundle.py): `patterns/pattern1/scripts/build_bundle.py`

### Enterprise Design

- [Application and Cloud Readers](https://github.com/devopsmaddog/security-context-builder/blob/main/ENTERPRISE_APPSEC_BLUEPRINT.md): `ENTERPRISE_APPSEC_BLUEPRINT.md`
- [Security Tool Adapters](https://github.com/devopsmaddog/security-context-builder/blob/main/INTEGRATIONS.md): `INTEGRATIONS.md`
- [Versioned Specifications](https://github.com/devopsmaddog/security-context-builder/blob/main/OPENSPEC_AND_ENTERPRISE_STANDARDS.md): `OPENSPEC_AND_ENTERPRISE_STANDARDS.md`
- [Repair and Test Workers](https://github.com/devopsmaddog/security-context-builder/blob/main/APPSEC_SKILLS.md): `APPSEC_SKILLS.md`
- [Sandbox Verification](https://github.com/devopsmaddog/security-context-builder/blob/main/SANDBOX_AND_VERIFICATION.md): `SANDBOX_AND_VERIFICATION.md`

### Knowledge Layer

- [Experience Retrieval](https://github.com/devopsmaddog/security-context-builder/blob/main/KNOWLEDGE_AND_SMALL_MODELS.md): `KNOWLEDGE_AND_SMALL_MODELS.md`

### Other components

- **AppSec Engineer**
- **Deployment Evidence**
- **Normalized Scan Evidence**
- **AWS Services**

## Connections

- AWS Services → Deployment Capture: supplies observations (evidence: `patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py`)
- Deployment Capture → Deployment Evidence: writes manifest (evidence: `patterns/pattern1/vuln-app-infra/scripts/capture_deployment.py`)
- Deployment Evidence → Bundle Assembly: provides manifest (evidence: `patterns/pattern1/scripts/build_bundle.py`)
- Normalized Scan Evidence → Bundle Assembly: provides normalized scans (evidence: `patterns/pattern1/scripts/build_bundle.py`)
- Bundle Assembly → Bundle Compiler: imports and validates (evidence: `patterns/pattern1/scripts/build_bundle.py`)
- AppSec Engineer → Bundle Compiler: runs compile or query (evidence: `README.md`)
- Bundle Compiler → Scope and Freshness Checks: validates bundle (evidence: `context_compiler.py`)
- Bundle Compiler → Context and Finding Packets: renders outputs (evidence: `context_compiler.py`)
- Bundle Compiler → SQLite Snapshot: stores snapshot (evidence: `context_compiler.py`)
- Bundle Compiler → Fix Retrieval: queries fixes (evidence: `context_compiler.py`)
- Fix Retrieval → SQLite Snapshot: reads snapshot (evidence: `context_compiler.py`)
- Application and Cloud Readers → Security Tool Adapters: feeds evidence (evidence: `README.md`)
- Security Tool Adapters → Bundle Assembly: normalizes evidence (evidence: `README.md`)
- Versioned Specifications → Repair and Test Workers: guides workflows (evidence: `README.md`)
- Repair and Test Workers → Sandbox Verification: requires verification (evidence: `README.md`)
- Sandbox Verification → Experience Retrieval: informs experience (evidence: `README.md`)
- Experience Retrieval → Repair and Test Workers: supports retrieval (evidence: `README.md`)
