๐Ÿ—‚๏ธ ContextWeaver โ€” Source Code Structure

How the cerebro repository is organized โ€” a Flask monolith (app.py, 246 routes) fronting a vanilla-JS SPA, delegating to domain modules, governed by a separate MCP control plane. Click any block for detail.

๐Ÿ“ก Client / Frontend static/ ยท templates/ โ€” served by Flask

๐Ÿ–ฅ๏ธ Single-Page App

static/app.js
~13k lines ยท workflows, Visual Designer, agents, connectors, admin

โš™๏ธ PWA Shell

static/sw.js ยท manifest.json
Service worker cache cw-v9 ยท offline shell

๐ŸŽจ Styling

static/style.css ยท themes.css
Dark/light themes ยท icons/ ยท logo.svg

๐Ÿ“„ Jinja Shells

templates/*.html
2 server-rendered entry pages
โ–ผ   HTTPS ยท ingress โ†’ app.brainzbytes.com   โ–ผ
๐Ÿง  Application Core the controller โ€” everything routes through here

app.py

Flask ยท gunicorn ยท port 5080 12,620 lines ยท 246 routes
agent 23 workflows 20 connectors 18 visual-designer 15 user/auth/groups 24 indexes 11 sources 10 designer 10 config 9 plugin-library 8 workspaces 8 engines 6 cluster 5 sim 4 + pages 27
โ–ผ   delegates by domain   โ–ผ
๐Ÿงฉ Core Domain Modules top-level *.py โ€” focused responsibilities

๐Ÿค– AI / Agent

agent.py ยท sim_mode.py
Agent loop, tool-calling ยท sim/offline mode
1,654565

โšก Workflows

workflow_engine.py ยท scheduler.py
step engine ยท interpolation ยท cron scheduler
661184

๐Ÿ”Œ Plugins / Connectors

connector_catalog ยท plugin_codegen
plugin_builder ยท plugin_resolver
Catalog, codegen, build & resolve plugins
1,77980872060

๐Ÿ“š RAG / Ingest

ingestor.py ยท source_validator.py
Crawl, chunk, embed & validate sources
580220
โ–ผ
๐Ÿ”— Infrastructure Clients the only modules that talk to Azure

โ˜๏ธ Azure Clients

azure_clients.py
Cosmos ยท AI Search ยท OpenAI ยท workload identity
319

๐Ÿ” Vault Client

vault_client.py
User-scoped credentials in Key Vault
366

๐Ÿš€ Bootstrap

launch.py ยท config.json
Local entrypoint & runtime config
39
โ–ผ   persists / reads   โ–ผ
๐Ÿ—„๏ธ Azure Data & AI Services always-on โ€” external to the container

๐Ÿช Cosmos DB

cw-cosmos-brainzbytes ยท db: cerebro
workflows ยท runs ยท designs ยท plugins ยท audit

๐Ÿ”Ž AI Search

cw-search-brainzbytes
RAG vector + keyword index

๐Ÿง  Azure OpenAI

devpilotx-openai ยท gpt-5-chat
Chat + embeddings deployments

๐Ÿ”‘ Key Vault ยท ACR

kv-brainzbytes ยท brainzbytes.azurecr.io
Secrets ยท container images
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”   separate control plane   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
๐Ÿ›ก๏ธ Governance Platform platform/ โ€” MCP engine control plane

โš™๏ธ MCP Engine Operator

platform/mcpengine_operator/
K8s operator + admission webhook ยท CRDs
operator.pyvalidator.pycrds/

๐Ÿ“‹ Policy Engine

platform/policy_engine/
Rules, audit, identity ยท hard-block guardrails
engine.pyrules.pyaudit.py

๐Ÿ”€ Cross-Engine

platform/cross_engine/
Multi-engine orchestration & handoffs
invoker.pyresolver.pyworkflows.yaml

๐Ÿ“Š Eval Harness

platform/eval_harness/
Per-engine eval cards ยท graduation ยท auto-pause
cards/identity/webhook_receiver/
โ–ผ   governs   โ–ผ
๐Ÿ”ง MCP Engines engines/ โ€” per-vertical runtime, declared in AGENTS.md

๐Ÿงฑ Engine Base

engines/mcp-engine-base/
Shared MCP runtime (server.py + Dockerfile)

๐Ÿ’ณ Vertical Services

engines/credit-card-service ยท email-service
Example per-vertical engine implementations

๐Ÿ“‡ 8 Declared Engines

AGENTS.md registry
sre ยท code ยท sfi ยท specs ยท dependency ยท pipeline ยท release ยท glue
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”   packaging & deploy   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
๐Ÿ“ฆ Build ยท Deploy ยท Infra packaging onto AKS

๐Ÿณ Docker

Dockerfile (+ workbench, code-server)
Builds cerebro-app image via ACR Tasks

โŽˆ Helm Charts

helm/
cerebro-app ยท mcp-engine ยท code-server ยท jupyterhub ยท monitoring ยท workbench

๐Ÿ” Pipelines

pipelines/
azure-pipelines.yaml (CI/CD id 7) ยท resource-control.yaml (id 8)

๐Ÿ—๏ธ Terraform ยท Docs

terraform/ ยท docs/ ยท notebooks/
1.3 GB IaC ยท architecture pages ยท guides
Frontend + App Core
Domain Modules
Infra Clients
Azure Data / AI
Governance + Engines
Build / Deploy
×