# escanoreb22/project-brain architecture

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

- Interactive diagram: https://gitdiagram.com/escanoreb22/project-brain
- Repository: https://github.com/escanoreb22/project-brain

## Overview

project-brain is an engineering-discipline skill and companion toolkit for coding agents. A user describes a product; the skill routes planning and implementation through documented project artifacts, phase gates, verified work loops, and release readiness. The repository combines agent guidance, reference material, reusable production-document templates, deterministic Python checks, and multi-agent workflows. README-described connections are shown; sampled source also confirms the MCP server delegates to the Codex helper. Unsampled components are included only at the documented subsystem level.

Main entry points: [`scripts/pb.py`](https://github.com/escanoreb22/project-brain/blob/main/scripts/pb.py) (Project CLI), [`SKILL.md`](https://github.com/escanoreb22/project-brain/blob/main/SKILL.md) (Skill playbooks), [`workflows/plan-from-prd.js`](https://github.com/escanoreb22/project-brain/blob/main/workflows/plan-from-prd.js) (Plan from PRD), [`workflows/execution-engine.js`](https://github.com/escanoreb22/project-brain/blob/main/workflows/execution-engine.js) (Verified build loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Agent guidance"]
  node_skill["Skill playbooks<br/>[SKILL.md]"]
  node_references["Engineering knowledge"]
  node_agents{{"Specialist agents"}}
end

subgraph group_planning["Planning artifacts"]
  node_templates["Production doc templates"]
  node_project_state[("Project memory")]
end

subgraph group_automation["Checks and tools"]
  node_plan_gate["Plan completeness gate<br/>[plan_check.py]"]
  node_cli["Project CLI<br/>[pb.py]"]
  node_memory_tools["Memory utilities<br/>[project_brain.py]"]
  node_code_guard["Code quality guard<br/>[code_guard.py]"]
  node_security_scans["Security and secret scans<br/>[vuln_scan.py]"]
  node_i18n["Translation checks<br/>[i18n_check.py]"]
  node_codex_mcp["Codex MCP server<br/>[codex_mcp.py]"]
  node_codex_delegate["Codex delegation<br/>[codex_delegate.py]"]
end

subgraph group_workflows["Agent workflows"]
  node_prd_workflow["Plan from PRD<br/>[plan-from-prd.js]"]
  node_map_workflow["Project-map execution<br/>[map-loop.js]"]
  node_execution_workflow["Verified build loop"]
  node_review_workflow["Change review<br/>[review-changes.js]"]
  node_security_workflow["Security audit<br/>[security-audit.js]"]
  node_ui_workflow["UI audit<br/>[ui-audit.js]"]
  node_asset_workflow["Asset generation<br/>[asset-batch.js]"]
end

node_user(("Product owner"))
node_codex_service["Codex CLI"]
node_browser["Real browser"]

node_user -->|"describes product"| node_skill
node_skill -->|"routes to knowledge"| node_references
node_skill -.->|"starts planning"| node_prd_workflow
node_prd_workflow -->|"writes plan artifacts"| node_templates
node_prd_workflow -->|"checks completeness"| node_plan_gate
node_cli -->|"runs planning gate"| node_plan_gate
node_map_workflow -->|"follows project map"| node_project_state
node_map_workflow -->|"assigns build work"| node_execution_workflow
node_execution_workflow -->|"delegates roles"| node_agents
node_execution_workflow -.->|"requests batch review"| node_review_workflow
node_review_workflow -->|"runs review lenses"| node_agents
node_security_workflow -->|"runs audit roles"| node_agents
node_ui_workflow -->|"audits pages"| node_browser
node_asset_workflow -.->|"requests image work"| node_codex_mcp
node_codex_mcp -->|"dispatches tool calls"| node_codex_delegate
node_codex_delegate -->|"runs Codex jobs"| node_codex_service
node_cli -->|"runs quality checks"| node_code_guard
node_cli -->|"runs security checks"| node_security_scans
node_cli -->|"runs translation checks"| node_i18n
node_skill -->|"resumes project work"| node_project_state

click node_skill "https://github.com/escanoreb22/project-brain/blob/main/SKILL.md"
click node_references "https://github.com/escanoreb22/project-brain/tree/main/references"
click node_agents "https://github.com/escanoreb22/project-brain/tree/main/agents"
click node_templates "https://github.com/escanoreb22/project-brain/tree/main/assets/production-docs"
click node_project_state "https://github.com/escanoreb22/project-brain/tree/main/assets/project-template"
click node_plan_gate "https://github.com/escanoreb22/project-brain/blob/main/scripts/plan_check.py"
click node_cli "https://github.com/escanoreb22/project-brain/blob/main/scripts/pb.py"
click node_memory_tools "https://github.com/escanoreb22/project-brain/blob/main/scripts/project_brain.py"
click node_code_guard "https://github.com/escanoreb22/project-brain/blob/main/scripts/code_guard.py"
click node_security_scans "https://github.com/escanoreb22/project-brain/blob/main/scripts/vuln_scan.py"
click node_i18n "https://github.com/escanoreb22/project-brain/blob/main/scripts/i18n_check.py"
click node_codex_mcp "https://github.com/escanoreb22/project-brain/blob/main/scripts/codex_mcp.py"
click node_codex_delegate "https://github.com/escanoreb22/project-brain/blob/main/scripts/codex_delegate.py"
click node_prd_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/plan-from-prd.js"
click node_map_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/map-loop.js"
click node_execution_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/execution-engine.js"
click node_review_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/review-changes.js"
click node_security_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/security-audit.js"
click node_ui_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/ui-audit.js"
click node_asset_workflow "https://github.com/escanoreb22/project-brain/blob/main/workflows/asset-batch.js"

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_skill,node_references,node_agents,node_browser toneBlue
class node_templates,node_project_state toneAmber
class node_plan_gate,node_cli,node_memory_tools,node_code_guard,node_security_scans,node_i18n,node_codex_mcp,node_codex_delegate toneMint
class node_prd_workflow,node_map_workflow,node_execution_workflow,node_review_workflow,node_security_workflow,node_ui_workflow,node_asset_workflow toneRose
class node_user,node_codex_service toneIndigo
```

## Components

### Agent guidance

- [Skill playbooks](https://github.com/escanoreb22/project-brain/blob/main/SKILL.md): `SKILL.md`
- [Engineering knowledge](https://github.com/escanoreb22/project-brain/tree/main/references): `references`
- [Specialist agents](https://github.com/escanoreb22/project-brain/tree/main/agents): `agents`

### Planning artifacts

- [Production doc templates](https://github.com/escanoreb22/project-brain/tree/main/assets/production-docs): `assets/production-docs`
- [Project memory](https://github.com/escanoreb22/project-brain/tree/main/assets/project-template): `assets/project-template`

### Checks and tools

- [Plan completeness gate](https://github.com/escanoreb22/project-brain/blob/main/scripts/plan_check.py): `scripts/plan_check.py`
- [Project CLI](https://github.com/escanoreb22/project-brain/blob/main/scripts/pb.py): `scripts/pb.py`
- [Memory utilities](https://github.com/escanoreb22/project-brain/blob/main/scripts/project_brain.py): `scripts/project_brain.py`
- [Code quality guard](https://github.com/escanoreb22/project-brain/blob/main/scripts/code_guard.py): `scripts/code_guard.py`
- [Security and secret scans](https://github.com/escanoreb22/project-brain/blob/main/scripts/vuln_scan.py): `scripts/vuln_scan.py`
- [Translation checks](https://github.com/escanoreb22/project-brain/blob/main/scripts/i18n_check.py): `scripts/i18n_check.py`
- [Codex MCP server](https://github.com/escanoreb22/project-brain/blob/main/scripts/codex_mcp.py): `scripts/codex_mcp.py`
- [Codex delegation](https://github.com/escanoreb22/project-brain/blob/main/scripts/codex_delegate.py): `scripts/codex_delegate.py`

### Agent workflows

- [Plan from PRD](https://github.com/escanoreb22/project-brain/blob/main/workflows/plan-from-prd.js): `workflows/plan-from-prd.js`
- [Project-map execution](https://github.com/escanoreb22/project-brain/blob/main/workflows/map-loop.js): `workflows/map-loop.js`
- [Verified build loop](https://github.com/escanoreb22/project-brain/blob/main/workflows/execution-engine.js): `workflows/execution-engine.js`
- [Change review](https://github.com/escanoreb22/project-brain/blob/main/workflows/review-changes.js): `workflows/review-changes.js`
- [Security audit](https://github.com/escanoreb22/project-brain/blob/main/workflows/security-audit.js): `workflows/security-audit.js`
- [UI audit](https://github.com/escanoreb22/project-brain/blob/main/workflows/ui-audit.js): `workflows/ui-audit.js`
- [Asset generation](https://github.com/escanoreb22/project-brain/blob/main/workflows/asset-batch.js): `workflows/asset-batch.js`

### Other components

- **Product owner**
- **Codex CLI**
- **Real browser**

## Connections

- Product owner → Skill playbooks: describes product (evidence: `README.md`)
- Skill playbooks → Engineering knowledge: routes to knowledge (evidence: `README.md`)
- Skill playbooks → Plan from PRD: starts planning
- Plan from PRD → Production doc templates: writes plan artifacts (evidence: `workflows/plan-from-prd.js`)
- Plan from PRD → Plan completeness gate: checks completeness (evidence: `workflows/plan-from-prd.js`)
- Project CLI → Plan completeness gate: runs planning gate (evidence: `README.md`)
- Project-map execution → Project memory: follows project map (evidence: `workflows/map-loop.js`)
- Project-map execution → Verified build loop: assigns build work (evidence: `workflows/map-loop.js`)
- Verified build loop → Specialist agents: delegates roles (evidence: `README.md`)
- Verified build loop → Change review: requests batch review
- Change review → Specialist agents: runs review lenses (evidence: `workflows/review-changes.js`)
- Security audit → Specialist agents: runs audit roles (evidence: `workflows/security-audit.js`)
- UI audit → Real browser: audits pages (evidence: `workflows/ui-audit.js`)
- Asset generation → Codex MCP server: requests image work
- Codex MCP server → Codex delegation: dispatches tool calls (evidence: `scripts/codex_mcp.py`)
- Codex delegation → Codex CLI: runs Codex jobs (evidence: `scripts/codex_delegate.py`)
- Project CLI → Code quality guard: runs quality checks (evidence: `README.md`)
- Project CLI → Security and secret scans: runs security checks (evidence: `README.md`)
- Project CLI → Translation checks: runs translation checks (evidence: `README.md`)
- Skill playbooks → Project memory: resumes project work (evidence: `README.md`)
