# mohamedomar11111/growth-architect-foundry architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedomar11111/growth-architect-foundry
- Repository: https://github.com/mohamedomar11111/growth-architect-foundry

## Overview

The Foundry is a multi-tenant growth operations kernel exposed through deterministic CLI commands and automation loops. The main operator workflow selects a tenant, runs an account or domain command, and receives a diagnosis, report, or operational result. Separately, scheduled ad-intelligence loops can produce signals that the content loop turns into review tasks and draft briefs. The graph preserves documented capabilities and the central tenant, state, and signal/task layers; some command and loop internals are represented at directory level because their source was not excerpted.

Main entry points: [`core/engine/commands`](https://github.com/mohamedomar11111/growth-architect-foundry/tree/master/core/engine/commands) (Command handlers), [`core/engine/tenant.py`](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/tenant.py) (Tenant context), [`core/engine/commands/state.py`](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/state.py) (Tenant state snapshot), [`core/engine/signals.py`](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/signals.py) (Signal store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and commands"]
  node_cli["Foundry CLI<br/>[foundry.py]"]
  node_commands["Command handlers"]
end

subgraph group_domain["Growth workflows"]
  node_account["Account audit<br/>[audit.py]"]
  node_diagnosis["Account diagnosis<br/>[diagnose.py]"]
  node_report["Client reports<br/>[report.py]"]
  node_economics["Economics calculator<br/>[calc.py]"]
  node_calccommands["Economics commands<br/>[calc_commands.py]"]
  node_domaincommands["Growth domain commands"]
  node_live["Live ads controls<br/>[live.py]"]
end

subgraph group_automation["Automation loops"]
  node_adintel["Google ad intelligence<br/>[ad_intel.py]"]
  node_metaads["Meta ads loop<br/>[meta_ads.py]"]
  node_content["Content engine<br/>[content_engine.py]"]
  node_social["Social calendar<br/>[social_calendar.py]"]
  node_creativebrief["Creative briefs<br/>[creative_brief.py]"]
  node_leadqualify["Lead qualification<br/>[lead_qualify.py]"]
  node_agentshim["LLM agent shim<br/>[agent_shim.py]"]
  node_runloop["Loop runner<br/>[run_loop.py]"]
end

subgraph group_kernel["Tenant kernel"]
  node_tenant["Tenant context<br/>[tenant.py]"]
  node_paths["Workspace paths<br/>[paths.py]"]
  node_envfile["Config and frontmatter<br/>[envfile.py]"]
  node_state["Tenant state snapshot<br/>[state.py]"]
  node_utils["Shared utilities<br/>[utils.py]"]
end

subgraph group_operations["Signal operations"]
  node_signals[("Signal store<br/>[signals.py]")]
  node_tasks[("Task store<br/>[tasks.py]")]
  node_precedent["Precedent<br/>[precedent.py]"]
  node_rootbus[("Root signal bus<br/>[root_bus.py]")]
  node_telegram["Telegram integration<br/>[telegram.py]"]
end

node_operator(("Operator"))
node_llm["LLM providers"]

node_operator -->|"runs commands"| node_cli
node_cli -->|"loads tenant"| node_tenant
node_cli -->|"dispatches to"| node_commands
node_commands -.->|"handles audit"| node_account
node_commands -.->|"handles diagnose"| node_diagnosis
node_commands -.->|"handles report"| node_report
node_commands -.->|"handles economics"| node_calccommands
node_calccommands -->|"uses calculations"| node_economics
node_commands -.->|"handles domain verbs"| node_domaincommands
node_commands -.->|"handles live controls"| node_live
node_account -->|"reads snapshot"| node_state
node_diagnosis -->|"reads snapshot"| node_state
node_report -->|"reads snapshot"| node_state
node_cli -.->|"starts loops"| node_runloop
node_runloop -->|"loads tenant"| node_tenant
node_adintel -->|"writes signals"| node_signals
node_metaads -->|"writes signals"| node_signals
node_content -->|"reads signals"| node_signals
node_content -->|"writes review tasks"| node_tasks
node_social -->|"uses tasks"| node_tasks
node_creativebrief -->|"uses tasks"| node_tasks
node_creativebrief -->|"invokes shim"| node_agentshim
node_agentshim -->|"calls provider APIs"| node_llm
node_leadqualify -->|"uses signal bus"| node_rootbus
node_leadqualify -->|"uses Telegram"| node_telegram
node_tenant -->|"reads configuration"| node_envfile
node_tenant -->|"resolves workspace"| node_paths
node_state -->|"reads signals"| node_signals
node_state -->|"reads tenant context"| node_tenant
node_signals -->|"uses tenant context"| node_tenant
node_tasks -->|"uses tenant context"| node_tenant
node_adintel -->|"checks precedent"| node_precedent
node_utils -->|"uses workspace paths"| node_paths
node_rootbus -->|"uses workspace paths"| node_paths
node_telegram -->|"uses workspace paths"| node_paths

click node_cli "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/foundry.py"
click node_commands "https://github.com/mohamedomar11111/growth-architect-foundry/tree/master/core/engine/commands"
click node_account "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/audit.py"
click node_diagnosis "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/diagnose.py"
click node_report "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/report.py"
click node_economics "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/calc.py"
click node_calccommands "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/calc_commands.py"
click node_domaincommands "https://github.com/mohamedomar11111/growth-architect-foundry/tree/master/core/engine/commands"
click node_live "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/live.py"
click node_adintel "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/ad_intel.py"
click node_metaads "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/meta_ads.py"
click node_content "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/content_engine.py"
click node_social "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/social_calendar.py"
click node_creativebrief "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/creative_brief.py"
click node_leadqualify "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/lead_qualify.py"
click node_agentshim "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/agent_shim.py"
click node_tenant "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/tenant.py"
click node_paths "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/paths.py"
click node_envfile "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/envfile.py"
click node_state "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/state.py"
click node_signals "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/signals.py"
click node_tasks "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/tasks.py"
click node_precedent "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/precedent.py"
click node_rootbus "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/root_bus.py"
click node_telegram "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/telegram.py"
click node_runloop "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/run_loop.py"
click node_utils "https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/utils.py"

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_commands toneBlue
class node_account,node_diagnosis,node_report,node_economics,node_calccommands,node_domaincommands,node_live toneAmber
class node_adintel,node_metaads,node_content,node_social,node_creativebrief,node_leadqualify,node_agentshim,node_runloop toneMint
class node_tenant,node_paths,node_envfile,node_state,node_utils toneRose
class node_signals,node_tasks,node_precedent,node_rootbus,node_telegram,node_operator,node_llm toneIndigo
```

## Components

### Entry and commands

- [Foundry CLI](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/foundry.py): `foundry.py`
- [Command handlers](https://github.com/mohamedomar11111/growth-architect-foundry/tree/master/core/engine/commands): `core/engine/commands`

### Growth workflows

- [Account audit](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/audit.py): `core/engine/commands/audit.py`
- [Account diagnosis](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/diagnose.py): `core/engine/commands/diagnose.py`
- [Client reports](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/report.py): `core/engine/commands/report.py`
- [Economics calculator](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/calc.py): `core/engine/calc.py`
- [Economics commands](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/calc_commands.py): `core/engine/commands/calc_commands.py`
- [Growth domain commands](https://github.com/mohamedomar11111/growth-architect-foundry/tree/master/core/engine/commands): `core/engine/commands`
- [Live ads controls](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/live.py): `core/engine/commands/live.py`

### Automation loops

- [Google ad intelligence](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/ad_intel.py): `core/engine/loops/ad_intel.py`
- [Meta ads loop](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/meta_ads.py): `core/engine/loops/meta_ads.py`
- [Content engine](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/content_engine.py): `core/engine/loops/content_engine.py`
- [Social calendar](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/social_calendar.py): `core/engine/loops/social_calendar.py`
- [Creative briefs](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/creative_brief.py): `core/engine/loops/creative_brief.py`
- [Lead qualification](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/loops/lead_qualify.py): `core/engine/loops/lead_qualify.py`
- [LLM agent shim](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/agent_shim.py): `core/engine/agent_shim.py`
- [Loop runner](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/run_loop.py): `core/engine/run_loop.py`

### Tenant kernel

- [Tenant context](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/tenant.py): `core/engine/tenant.py`
- [Workspace paths](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/paths.py): `core/engine/paths.py`
- [Config and frontmatter](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/envfile.py): `core/engine/envfile.py`
- [Tenant state snapshot](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/commands/state.py): `core/engine/commands/state.py`
- [Shared utilities](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/utils.py): `core/engine/utils.py`

### Signal operations

- [Signal store](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/signals.py): `core/engine/signals.py`
- [Task store](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/tasks.py): `core/engine/tasks.py`
- [Precedent](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/precedent.py): `core/engine/precedent.py`
- [Root signal bus](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/root_bus.py): `core/engine/root_bus.py`
- [Telegram integration](https://github.com/mohamedomar11111/growth-architect-foundry/blob/master/core/engine/telegram.py): `core/engine/telegram.py`

### Other components

- **Operator**
- **LLM providers**

## Connections

- Operator → Foundry CLI: runs commands (evidence: `README.md`)
- Foundry CLI → Tenant context: loads tenant (evidence: `foundry.py`)
- Foundry CLI → Command handlers: dispatches to (evidence: `foundry.py`)
- Command handlers → Account audit: handles audit (evidence: `core/engine/commands/audit.py`)
- Command handlers → Account diagnosis: handles diagnose (evidence: `core/engine/commands/diagnose.py`)
- Command handlers → Client reports: handles report (evidence: `core/engine/commands/report.py`)
- Command handlers → Economics commands: handles economics
- Economics commands → Economics calculator: uses calculations (evidence: `core/engine/commands/calc_commands.py`)
- Command handlers → Growth domain commands: handles domain verbs
- Command handlers → Live ads controls: handles live controls
- Account audit → Tenant state snapshot: reads snapshot (evidence: `core/engine/commands/audit.py`)
- Account diagnosis → Tenant state snapshot: reads snapshot (evidence: `core/engine/commands/diagnose.py`)
- Client reports → Tenant state snapshot: reads snapshot (evidence: `core/engine/commands/report.py`)
- Foundry CLI → Loop runner: starts loops
- Loop runner → Tenant context: loads tenant (evidence: `core/engine/run_loop.py`)
- Google ad intelligence → Signal store: writes signals (evidence: `core/engine/loops/ad_intel.py`)
- Meta ads loop → Signal store: writes signals (evidence: `core/engine/loops/meta_ads.py`)
- Content engine → Signal store: reads signals (evidence: `core/engine/loops/content_engine.py`)
- Content engine → Task store: writes review tasks (evidence: `core/engine/loops/content_engine.py`)
- Social calendar → Task store: uses tasks (evidence: `core/engine/loops/social_calendar.py`)
- Creative briefs → Task store: uses tasks (evidence: `core/engine/loops/creative_brief.py`)
- Creative briefs → LLM agent shim: invokes shim (evidence: `core/engine/loops/creative_brief.py`)
- LLM agent shim → LLM providers: calls provider APIs (evidence: `core/engine/agent_shim.py`)
- Lead qualification → Root signal bus: uses signal bus (evidence: `core/engine/loops/lead_qualify.py`)
- Lead qualification → Telegram integration: uses Telegram (evidence: `core/engine/loops/lead_qualify.py`)
- Tenant context → Config and frontmatter: reads configuration (evidence: `core/engine/tenant.py`)
- Tenant context → Workspace paths: resolves workspace (evidence: `core/engine/tenant.py`)
- Tenant state snapshot → Signal store: reads signals (evidence: `core/engine/commands/state.py`)
- Tenant state snapshot → Tenant context: reads tenant context (evidence: `core/engine/commands/state.py`)
- Signal store → Tenant context: uses tenant context (evidence: `core/engine/signals.py`)
- Task store → Tenant context: uses tenant context (evidence: `core/engine/tasks.py`)
- Google ad intelligence → Precedent: checks precedent (evidence: `core/engine/loops/ad_intel.py`)
- Shared utilities → Workspace paths: uses workspace paths (evidence: `core/engine/utils.py`)
- Root signal bus → Workspace paths: uses workspace paths (evidence: `core/engine/root_bus.py`)
- Telegram integration → Workspace paths: uses workspace paths (evidence: `core/engine/telegram.py`)
