# vmihalis/hacker-bob architecture

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

- Interactive diagram: https://gitdiagram.com/vmihalis/hacker-bob
- Repository: https://github.com/vmihalis/hacker-bob

## Overview

#### Purpose and entry points
Hacker Bob is a Node.js 20+ autonomous security-testing system for authorized web/API, smart-contract, repository, and PR-diff targets. It installs a local Model Context Protocol (MCP) server into a workspace and is driven through host adapters or its CLI.
- CLI/install/doctor/dashboard entry point: `bin/hacker-bob.js`
- MCP runtime and tool registration: `mcp/server.js`, `mcp/tools/index.js`
- Host integration adapters: `adapters/index.js`, `adapters/claude/index.js`, `adapters/codex/index.js`

#### Session authority and lifecycle
Each evaluation is anchored in a session-owned root, with a cryptographically verified session nucleus as the authoritative identity, scope, and lifecycle record. Read projections, events, and ledgers support observability but are not alternate grants of authority.
- Session lifecycle, authority, and state contracts: `mcp/core/session/session-authority.js`, `mcp/core/session/session-state.js`, `mcp/core/session/lifecycle-gates.js`
- Atomic/session-root I/O boundary: `mcp/core/io/storage.js`, `mcp/core/io/engine-lock.js`
- The core lifecycle progresses from setup and frontier work through claim freeze, verification, grading, and reporting, with controlled reopening.

#### Discovery, frontier, and planning
Target observations become surface leads and an attack-surface graph; these are ranked, promoted, and routed into planned work rather than directly treated as findings. Imported artifacts and public intelligence are bounded inputs to this layer.
- Surface graph and lead pipeline: `mcp/core/frontier/surface-graph-builder.js`, `mcp/core/frontier/lead-intake.js`, `mcp/core/frontier/lead-promotion.js`
- Recon routing and reachability: `mcp/core/frontier/surface-router.js`, `mcp/core/frontier/reachability.js`
- Dependency-aware wave/task planning: `mcp/core/waves/wave-planner.js`, `mcp/core/waves/graph-scheduler.js`, `mcp/core/waves/task-graph-state-machine.js`

#### Evaluation and domain execution
The dispatcher selects technique packs and constrained tools for scheduled work. Domain modules implement target-specific execution while emitting evidence and attempt records back into the core pipeline.
- Dispatch policy, packs, and tool registry: `mcp/core/dispatch/dispatch.js`, `mcp/core/dispatch/technique-packs.js`, `mcp/core/dispatch/tool-registry.js`
- Web/browser and HTTP offensive execution: `mcp/domains/web/offensive-runner.js`, `mcp/domains/web/browser-sessions.js`, `mcp/domains/web/offensive-sandbox.js`
- Repository review and isolated reproduction: `mcp/domains/repo/repo-target.js`, `mcp/domains/repo/repo-env.js`, `mcp/tools/repo/repo-docker-run.js`
- Smart-contract RPC and runner boundary: `mcp/domains/blockchain/smart-contracts/chain-rpc-pool.js`, `mcp/domains/blockchain/smart-contracts/sc-container-exec.js`

#### Evidence, claims, verification, and reports
Evaluator outputs are recorded as candidate claims and chain attempts. Independent verification, replay/differential checks, proof bundles, grading, and finalization gate whether a submission-ready finding can be reported.
- Claims and chains: `mcp/core/claims/claims.js`, `mcp/core/chain-state-tree.js`
- Evidence and verification rounds: `mcp/core/evidence.js`, `mcp/core/verification/verification.js`, `mcp/core/repro-replay-verifier.js`
- Finding contracts, scores, and reports: `mcp/core/finding-contracts.js`, `mcp/core/scoring/cvss31.js`, `mcp/core/report-finalize.js`

#### Safety and control boundaries
Scope/session checks, egress profiles, safe HTTP transport, approval hooks, and redaction constrain MCP-owned operations. These controls do not claim to sandbox arbitrary host commands or unrelated browser activity.
- Scope, egress, and network controls: `mcp/core/scope.js`, `mcp/core/egress-profiles.js`, `mcp/core/io/safe-fetch.js`
- Sensitive-data/report fences: `mcp/core/redaction/report-credential-fence.js`, `mcp/redaction.js`
- Installed-host guards: `.claude/hooks/session-read-guard.sh`, `.claude/hooks/bob-http-write-confirm.sh`

#### Optional physical and cloud integrations
Physical testing is a separate provider/instrument plane with leases, resource arbitration, brokered dispatch, artifact custody, and Darwin-native trust boundaries. AWS infrastructure can publish validated artifacts and export findings.
- Physical orchestration: `mcp/domains/physical/physical-session-runtime.js`, `mcp/domains/physical/physical-resource-arbiter.js`
- Instrument broker and artifact vault: `packages/bob-instrument-broker/lib/broker.js`, `packages/bob-artifact-vault/lib/vault.js`
- AWS engagement workflow: `infra/aws/hacker-bob-stack/template.yaml`, `infra/aws/hacker-bob-stack/statemachine/hacker-bob-engagement.asl.json`

Main entry points: [`mcp/core/dispatch/dispatch.js`](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/dispatch/dispatch.js) (Technique dispatcher), [`mcp/server.js`](https://github.com/vmihalis/hacker-bob/blob/main/mcp/server.js) (MCP server and tools), [`mcp/core/claims/claims.js`](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/claims/claims.js) (Claims and chain state), [`mcp/core/session/session-authority.js`](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/session/session-authority.js) (Session authority)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Host entry"]
  node_cli["CLI and installer<br/>Node entry point<br/>[hacker-bob.js]"]
  node_adapters["Host adapters<br/>Host integration<br/>[index.js]"]
  node_mcp["MCP server and tools<br/>MCP runtime<br/>[server.js]"]
end

subgraph group_core["Core evaluation"]
  node_authority{{"Session authority<br/>Lifecycle authority"}}
  node_storage[("Session-root storage<br/>Atomic I/O boundary<br/>[storage.js]")]
  node_gates["Lifecycle gates<br/>State control<br/>[lifecycle-gates.js]"]
  node_safety{{"Scope and egress controls<br/>Safety boundary<br/>[scope.js]"}}
  node_frontier["Surface lead pipeline<br/>Discovery frontier"]
  node_planning["Wave and task planner<br/>Dependency scheduler<br/>[wave-planner.js]"]
  node_dispatch["Technique dispatcher<br/>Execution policy<br/>[dispatch.js]"]
  node_claims["Claims and chain state<br/>Candidate findings<br/>[claims.js]"]
  node_verification["Evidence verification<br/>Independent validation<br/>[verification.js]"]
  node_reporting["Grading and reports<br/>Finding finalization<br/>[report-finalize.js]"]
end

subgraph group_domains["Execution domains"]
  node_web["Web execution<br/>Web domain"]
  node_repo["Repository execution<br/>Repository domain<br/>[repo-target.js]"]
  node_contracts["Smart-contract execution<br/>Blockchain domain<br/>[chain-rpc-pool.js]"]
end

subgraph group_integrations["Optional integrations"]
  node_physical["Physical testing plane<br/>Provider orchestration"]
  node_instrument["Instrument broker<br/>Brokered execution<br/>[broker.js]"]
  node_aws["AWS engagement workflow<br/>Cloud workflow"]
end

node_cli -->|"starts"| node_mcp
node_adapters -->|"host access"| node_mcp
node_mcp -->|"opens evaluation"| node_authority
node_authority -->|"owns session root"| node_storage
node_authority -->|"authorizes transitions"| node_gates
node_mcp -->|"enforces controls"| node_safety
node_gates -->|"permits discovery"| node_frontier
node_frontier -->|"ranked leads"| node_planning
node_planning -->|"scheduled work"| node_dispatch
node_safety -->|"scope and egress constraints"| node_dispatch
node_dispatch -->|"web tasks"| node_web
node_dispatch -->|"repository tasks"| node_repo
node_dispatch -->|"contract tasks"| node_contracts
node_web -->|"evidence and attempts"| node_claims
node_repo -->|"evidence and attempts"| node_claims
node_contracts -->|"evidence and attempts"| node_claims
node_claims -->|"candidate claims"| node_verification
node_verification -->|"validated proof bundles"| node_reporting
node_gates -->|"finalization gate"| node_reporting
node_dispatch -.->|"physical work"| node_physical
node_physical -->|"brokered instruments"| node_instrument
node_verification -.->|"validated artifacts"| node_aws
node_reporting -.->|"export findings"| node_aws

click node_cli "https://github.com/vmihalis/hacker-bob/blob/main/bin/hacker-bob.js"
click node_adapters "https://github.com/vmihalis/hacker-bob/blob/main/adapters/index.js"
click node_mcp "https://github.com/vmihalis/hacker-bob/blob/main/mcp/server.js"
click node_authority "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/session/session-authority.js"
click node_storage "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/io/storage.js"
click node_gates "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/session/lifecycle-gates.js"
click node_safety "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/scope.js"
click node_frontier "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/frontier/surface-graph-builder.js"
click node_planning "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/waves/wave-planner.js"
click node_dispatch "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/dispatch/dispatch.js"
click node_web "https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/web/offensive-runner.js"
click node_repo "https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/repo/repo-target.js"
click node_contracts "https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/blockchain/smart-contracts/chain-rpc-pool.js"
click node_claims "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/claims/claims.js"
click node_verification "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/verification/verification.js"
click node_reporting "https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/report-finalize.js"
click node_physical "https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/physical/physical-session-runtime.js"
click node_instrument "https://github.com/vmihalis/hacker-bob/blob/main/packages/bob-instrument-broker/lib/broker.js"
click node_aws "https://github.com/vmihalis/hacker-bob/blob/main/infra/aws/hacker-bob-stack/statemachine/hacker-bob-engagement.asl.json"

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_adapters,node_mcp toneBlue
class node_authority,node_storage,node_gates,node_safety,node_frontier,node_planning,node_dispatch,node_claims,node_verification,node_reporting toneAmber
class node_web,node_repo,node_contracts toneMint
class node_physical,node_instrument,node_aws toneRose
```

## Components

### Host entry

- [CLI and installer](https://github.com/vmihalis/hacker-bob/blob/main/bin/hacker-bob.js): Node entry point · Installs and operates the local MCP workspace. · `bin/hacker-bob.js`
- [Host adapters](https://github.com/vmihalis/hacker-bob/blob/main/adapters/index.js): Host integration · `adapters/index.js`
- [MCP server and tools](https://github.com/vmihalis/hacker-bob/blob/main/mcp/server.js): MCP runtime · Registers the security-testing tool surface. · `mcp/server.js`

### Core evaluation

- [Session authority](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/session/session-authority.js): Lifecycle authority · Cryptographically verified session nucleus is the sole authority grant. · `mcp/core/session/session-authority.js`
- [Session-root storage](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/io/storage.js): Atomic I/O boundary · `mcp/core/io/storage.js`
- [Lifecycle gates](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/session/lifecycle-gates.js): State control · Controls progression, freeze, verification, finalization, and reopening. · `mcp/core/session/lifecycle-gates.js`
- [Scope and egress controls](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/scope.js): Safety boundary · Constrains MCP-owned operations, network access, approvals, and redaction. · `mcp/core/scope.js`
- [Surface lead pipeline](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/frontier/surface-graph-builder.js): Discovery frontier · Builds the attack-surface graph and promotes ranked leads. · `mcp/core/frontier/surface-graph-builder.js`
- [Wave and task planner](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/waves/wave-planner.js): Dependency scheduler · `mcp/core/waves/wave-planner.js`
- [Technique dispatcher](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/dispatch/dispatch.js): Execution policy · Selects technique packs and constrained tools for scheduled work. · `mcp/core/dispatch/dispatch.js`
- [Claims and chain state](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/claims/claims.js): Candidate findings · Records candidate claims and attack-chain attempts. · `mcp/core/claims/claims.js`
- [Evidence verification](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/verification/verification.js): Independent validation · Runs verification rounds plus replay and differential checks. · `mcp/core/verification/verification.js`
- [Grading and reports](https://github.com/vmihalis/hacker-bob/blob/main/mcp/core/report-finalize.js): Finding finalization · Scores verified findings and creates submission-ready reports. · `mcp/core/report-finalize.js`

### Execution domains

- [Web execution](https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/web/offensive-runner.js): Web domain · Browser and HTTP offensive execution in a constrained sandbox. · `mcp/domains/web/offensive-runner.js`
- [Repository execution](https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/repo/repo-target.js): Repository domain · Reviews targets and runs isolated reproductions. · `mcp/domains/repo/repo-target.js`
- [Smart-contract execution](https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/blockchain/smart-contracts/chain-rpc-pool.js): Blockchain domain · Uses RPC pooling and a containerized execution boundary. · `mcp/domains/blockchain/smart-contracts/chain-rpc-pool.js`

### Optional integrations

- [Physical testing plane](https://github.com/vmihalis/hacker-bob/blob/main/mcp/domains/physical/physical-session-runtime.js): Provider orchestration · Separately manages leases, resource arbitration, and instrument work. · `mcp/domains/physical/physical-session-runtime.js`
- [Instrument broker](https://github.com/vmihalis/hacker-bob/blob/main/packages/bob-instrument-broker/lib/broker.js): Brokered execution · `packages/bob-instrument-broker/lib/broker.js`
- [AWS engagement workflow](https://github.com/vmihalis/hacker-bob/blob/main/infra/aws/hacker-bob-stack/statemachine/hacker-bob-engagement.asl.json): Cloud workflow · Publishes validated artifacts and exports findings. · `infra/aws/hacker-bob-stack/statemachine/hacker-bob-engagement.asl.json`

## Connections

- CLI and installer → MCP server and tools: starts
- Host adapters → MCP server and tools: host access
- MCP server and tools → Session authority: opens evaluation
- Session authority → Session-root storage: owns session root
- Session authority → Lifecycle gates: authorizes transitions
- MCP server and tools → Scope and egress controls: enforces controls
- Lifecycle gates → Surface lead pipeline: permits discovery
- Surface lead pipeline → Wave and task planner: ranked leads
- Wave and task planner → Technique dispatcher: scheduled work
- Scope and egress controls → Technique dispatcher: scope and egress constraints
- Technique dispatcher → Web execution: web tasks
- Technique dispatcher → Repository execution: repository tasks
- Technique dispatcher → Smart-contract execution: contract tasks
- Web execution → Claims and chain state: evidence and attempts
- Repository execution → Claims and chain state: evidence and attempts
- Smart-contract execution → Claims and chain state: evidence and attempts
- Claims and chain state → Evidence verification: candidate claims
- Evidence verification → Grading and reports: validated proof bundles
- Lifecycle gates → Grading and reports: finalization gate
- Technique dispatcher → Physical testing plane: physical work
- Physical testing plane → Instrument broker: brokered instruments
- Evidence verification → AWS engagement workflow: validated artifacts
- Grading and reports → AWS engagement workflow: export findings
