# bhoomik-codes/codex-3-hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/bhoomik-codes/codex-3-hackathon
- Repository: https://github.com/bhoomik-codes/codex-3-hackathon

## Overview

GuardSaaB is a local-first governance control plane for agent tool calls, with a separate Northstar Works HR/finance demo workspace. The principal flow intercepts an agent action, evaluates policy and security signals, then allows, blocks, or holds it for human review; resulting activity is exposed in the dashboard and audit log. The graph also preserves the documented proxy, MCP, dependency-risk, audit, and company-workspace capabilities. Some links reflect README or SOURCE INDEX evidence because those implementations were not excerpted; omitted details are not inferred.

Main entry points: [`src/engine/server.ts`](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/engine/server.ts) (GuardSaaB engine), [`src/cli/index.ts`](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/cli/index.ts) (CLI operations), [`dashboard/src/App.tsx`](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/App.tsx) (Governance console), [`src/risk/engine.ts`](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/risk/engine.ts) (Risk aggregation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Agent entrypoints"]
  node_hook["Agent hook<br/>[adapters.ts]"]
  node_proxy["Egress proxy<br/>[server.ts]"]
  node_engine["GuardSaaB engine<br/>[server.ts]"]
end

subgraph group_decision["Decision and security"]
  node_policy["Policy evaluation<br/>[engine.ts]"]
  node_taxonomy["Tool taxonomy<br/>[index.ts]"]
  node_behavior["Behavioral signals<br/>[behavioral.ts]"]
  node_content["Content signals<br/>[content.ts]"]
  node_injection["Injection detection<br/>[injection.ts]"]
  node_ioc["IOC checks<br/>[ioc.ts]"]
  node_risk["Risk aggregation<br/>[engine.ts]"]
end

subgraph group_operations["Audit and operations"]
  node_cli["CLI operations<br/>[index.ts]"]
  node_audit[("Audit chain<br/>[audit-store.ts]")]
  node_auditview["Audit projection<br/>[projector.ts]"]
end

subgraph group_portals["User portals"]
  node_governance["Governance console<br/>[App.tsx]"]
  node_livefeed["Live engine feed<br/>[useEngine.ts]"]
  node_sessions["Session review<br/>[SessionsView.tsx]"]
  node_company["Northstar workspace"]
  node_scenario["Scenario lab<br/>[ScenarioLab.tsx]"]
end

subgraph group_integrations["Discovery and integrations"]
  node_mcp["MCP inspection<br/>[scanner.ts]"]
  node_discovery["MCP discovery<br/>[discover.ts]"]
  node_deps["Dependency advisories<br/>[advisories.ts]"]
end

node_agent(("Agent tool call"))
node_user(("Employee or reviewer"))

node_agent -->|"submits action"| node_hook
node_hook -->|"intercepts"| node_engine
node_proxy -.->|"uses decisions"| node_engine
node_engine -->|"evaluates policy"| node_policy
node_policy -->|"classifies tool"| node_taxonomy
node_engine -->|"checks behavior"| node_behavior
node_engine -->|"checks content"| node_content
node_engine -->|"checks injection"| node_injection
node_engine -->|"checks indicators"| node_ioc
node_engine -->|"aggregates risk"| node_risk
node_risk -->|"uses signals"| node_behavior
node_risk -->|"uses signals"| node_content
node_engine -->|"records activity"| node_audit
node_audit -.->|"projects events"| node_auditview
node_engine -->|"streams events"| node_livefeed
node_livefeed -->|"provides state"| node_governance
node_governance -->|"sends decisions"| node_engine
node_governance -->|"renders sessions"| node_sessions
node_user -->|"reviews activity"| node_governance
node_user -->|"uses workspace"| node_company
node_company -.->|"opens scenario lab"| node_scenario
node_cli -->|"starts engine"| node_engine
node_cli -->|"runs scans"| node_mcp
node_cli -->|"discovers servers"| node_discovery
node_cli -.->|"checks dependencies"| node_deps

click node_hook "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/hook/adapters.ts"
click node_proxy "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/proxy/server.ts"
click node_engine "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/engine/server.ts"
click node_policy "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/policy/engine.ts"
click node_taxonomy "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/taxonomy/index.ts"
click node_behavior "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/behavioral.ts"
click node_content "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/content.ts"
click node_injection "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/injection.ts"
click node_ioc "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/ioc.ts"
click node_risk "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/risk/engine.ts"
click node_mcp "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/mcp/scanner.ts"
click node_discovery "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/mcp/discover.ts"
click node_deps "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/deps/advisories.ts"
click node_cli "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/cli/index.ts"
click node_audit "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/db/audit-store.ts"
click node_auditview "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/audit/projector.ts"
click node_governance "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/App.tsx"
click node_livefeed "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/useEngine.ts"
click node_sessions "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/SessionsView.tsx"
click node_company "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/CompanyWorkspace.tsx"
click node_scenario "https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/ScenarioLab.tsx"

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_hook,node_proxy,node_engine,node_user toneBlue
class node_policy,node_taxonomy,node_behavior,node_content,node_injection,node_ioc,node_risk toneAmber
class node_cli,node_audit,node_auditview toneMint
class node_governance,node_livefeed,node_sessions,node_company,node_scenario toneRose
class node_mcp,node_discovery,node_deps,node_agent toneIndigo
```

## Components

### Agent entrypoints

- [Agent hook](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/hook/adapters.ts): `src/hook/adapters.ts`
- [Egress proxy](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/proxy/server.ts): `src/proxy/server.ts`
- [GuardSaaB engine](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/engine/server.ts): `src/engine/server.ts`

### Decision and security

- [Policy evaluation](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/policy/engine.ts): `src/policy/engine.ts`
- [Tool taxonomy](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/taxonomy/index.ts): `src/taxonomy/index.ts`
- [Behavioral signals](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/behavioral.ts): `src/signals/behavioral.ts`
- [Content signals](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/content.ts): `src/signals/content.ts`
- [Injection detection](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/injection.ts): `src/signals/injection.ts`
- [IOC checks](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/signals/ioc.ts): `src/signals/ioc.ts`
- [Risk aggregation](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/risk/engine.ts): `src/risk/engine.ts`

### Audit and operations

- [CLI operations](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/cli/index.ts): `src/cli/index.ts`
- [Audit chain](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/db/audit-store.ts): `src/db/audit-store.ts`
- [Audit projection](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/audit/projector.ts): `src/audit/projector.ts`

### User portals

- [Governance console](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Live engine feed](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/useEngine.ts): `dashboard/src/useEngine.ts`
- [Session review](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/SessionsView.tsx): `dashboard/src/SessionsView.tsx`
- [Northstar workspace](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/CompanyWorkspace.tsx): `dashboard/src/CompanyWorkspace.tsx`
- [Scenario lab](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/dashboard/src/ScenarioLab.tsx): `dashboard/src/ScenarioLab.tsx`

### Discovery and integrations

- [MCP inspection](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/mcp/scanner.ts): `src/mcp/scanner.ts`
- [MCP discovery](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/mcp/discover.ts): `src/mcp/discover.ts`
- [Dependency advisories](https://github.com/bhoomik-codes/codex-3-hackathon/blob/main/src/deps/advisories.ts): `src/deps/advisories.ts`

### Other components

- **Agent tool call**
- **Employee or reviewer**

## Connections

- Agent tool call → Agent hook: submits action (evidence: `README.md`)
- Agent hook → GuardSaaB engine: intercepts (evidence: `src/engine/server.ts`)
- Egress proxy → GuardSaaB engine: uses decisions
- GuardSaaB engine → Policy evaluation: evaluates policy (evidence: `src/engine/server.ts`)
- Policy evaluation → Tool taxonomy: classifies tool (evidence: `src/policy/engine.ts`)
- GuardSaaB engine → Behavioral signals: checks behavior (evidence: `src/engine/server.ts`)
- GuardSaaB engine → Content signals: checks content (evidence: `src/engine/server.ts`)
- GuardSaaB engine → Injection detection: checks injection (evidence: `src/engine/server.ts`)
- GuardSaaB engine → IOC checks: checks indicators (evidence: `src/engine/server.ts`)
- GuardSaaB engine → Risk aggregation: aggregates risk (evidence: `src/engine/server.ts`)
- Risk aggregation → Behavioral signals: uses signals (evidence: `src/risk/engine.ts`)
- Risk aggregation → Content signals: uses signals (evidence: `src/risk/engine.ts`)
- GuardSaaB engine → Audit chain: records activity (evidence: `src/engine/server.ts`)
- Audit chain → Audit projection: projects events
- GuardSaaB engine → Live engine feed: streams events (evidence: `dashboard/src/useEngine.ts`)
- Live engine feed → Governance console: provides state (evidence: `dashboard/src/App.tsx`)
- Governance console → GuardSaaB engine: sends decisions
- Governance console → Session review: renders sessions (evidence: `dashboard/src/App.tsx`)
- Employee or reviewer → Governance console: reviews activity (evidence: `README.md`)
- Employee or reviewer → Northstar workspace: uses workspace (evidence: `README.md`)
- Northstar workspace → Scenario lab: opens scenario lab
- CLI operations → GuardSaaB engine: starts engine (evidence: `src/cli/index.ts`)
- CLI operations → MCP inspection: runs scans
- CLI operations → MCP discovery: discovers servers
- CLI operations → Dependency advisories: checks dependencies
