# gourav2411/general-marketing-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/gourav2411/general-marketing-intelligence
- Repository: https://github.com/gourav2411/general-marketing-intelligence

## Overview

General Marketing Intelligence is an MCP marketing decision layer: it gathers acquisition and CRM evidence, normalizes it, calculates diagnostics and recommendations, and presents decision-oriented outputs to a human through MCP clients. Its broader loop includes precedent retrieval, outcome-backed account learning, and human-approved actions; read-only reporting is the default. The graph preserves documented capabilities, including dashboards and hosted team architecture. Some subsystems are represented by their exact source directories because their internal wiring was not sampled.

Main entry points: [`src/evidence/normalize.ts`](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/normalize.ts) (Evidence normalization), [`src/index.ts`](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/index.ts) (MCP server), [`src/ai/enhance.ts`](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/ai/enhance.ts) (AI enhancement), [`src/intelligence/knowledge.ts`](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/knowledge.ts) (Strategic precedents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Evidence inputs"]
  node_google_sources["Google sources"]
  node_ads_sources["Paid media sources"]
  node_crm_api["CRM API<br/>[api.ts]"]
  node_crm_csv["CRM CSV<br/>[csv.ts]"]
  node_crm_hubspot["HubSpot CRM<br/>[hubspot.ts]"]
  node_crm_salesforce["Salesforce CRM<br/>[salesforce.ts]"]
end

subgraph group_analysis["Evidence and analysis"]
  node_evidence["Evidence normalization<br/>[normalize.ts]"]
  node_evidence_mapping["Evidence mapping<br/>[mapping.ts]"]
  node_evidence_schema["Evidence schema<br/>[schema.ts]"]
  node_ad_strategy["Ad strategy<br/>[adStrategy.ts]"]
  node_analysis_tools["Marketing analysis"]
  node_numeric_provenance["Numeric provenance"]
end

subgraph group_intelligence["Decision intelligence"]
  node_ai_enhancement["AI enhancement<br/>[enhance.ts]"]
  node_ai_schemas["AI schemas<br/>[schemas.ts]"]
  node_precedents["Strategic precedents<br/>[knowledge.ts]"]
  node_ontology["Case ontology<br/>[ontology.ts]"]
  node_intelligence_context["Intelligence context<br/>[pipeline.ts]"]
  node_decisions["Decision records<br/>[service.ts]"]
  node_account_learning["Account learning context<br/>[context.ts]"]
end

subgraph group_interfaces["MCP and dashboards"]
  node_mcp_server["MCP server<br/>[index.ts]"]
  node_tool_families["Tool families<br/>[router.ts]"]
  node_dashboard["Local dashboards<br/>[dashboard.ts]"]
end

subgraph group_governance["Actions and governance"]
  node_action_service["Action approvals<br/>[service.ts]"]
  node_hosted_security["Hosted security<br/>[hosted.ts]"]
  node_telemetry["Tool telemetry<br/>[telemetry.ts]"]
end

node_mcp_client(("MCP client"))

node_mcp_client -->|"invokes tools"| node_mcp_server
node_google_sources -->|"provides evidence"| node_evidence
node_ads_sources -->|"provides evidence"| node_evidence
node_crm_api -->|"provides evidence"| node_evidence
node_crm_csv -->|"provides evidence"| node_evidence
node_crm_hubspot -->|"provides evidence"| node_evidence
node_crm_salesforce -->|"provides evidence"| node_evidence
node_evidence -->|"uses mappings"| node_evidence_mapping
node_evidence -->|"uses schema"| node_evidence_schema
node_evidence -->|"grounds calculations"| node_analysis_tools
node_ad_strategy -.->|"supports recommendations"| node_analysis_tools
node_mcp_server -->|"routes questions"| node_tool_families
node_mcp_server -->|"offers dashboards"| node_dashboard
node_mcp_server -->|"enhances outputs"| node_ai_enhancement
node_ai_enhancement -->|"validates output"| node_ai_schemas
node_ai_enhancement -->|"checks claims"| node_numeric_provenance
node_intelligence_context -->|"retrieves cases"| node_precedents
node_precedents -->|"uses ontology"| node_ontology
node_ai_enhancement -->|"loads learning"| node_account_learning
node_account_learning -->|"inspects records"| node_decisions
node_mcp_server -.->|"records outcomes"| node_decisions
node_mcp_server -.->|"controls actions"| node_action_service
node_mcp_server -->|"emits events"| node_telemetry
node_mcp_client -.->|"authenticates optionally"| node_hosted_security

click node_google_sources "https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/connectors/google"
click node_ads_sources "https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/connectors/paid"
click node_crm_api "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/api.ts"
click node_crm_csv "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/csv.ts"
click node_crm_hubspot "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/hubspot.ts"
click node_crm_salesforce "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/salesforce.ts"
click node_evidence "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/normalize.ts"
click node_evidence_mapping "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/mapping.ts"
click node_evidence_schema "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/schema.ts"
click node_ad_strategy "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/analysis/adStrategy.ts"
click node_analysis_tools "https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/analysis"
click node_numeric_provenance "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/measurement/numericProvenance.ts"
click node_mcp_server "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/index.ts"
click node_tool_families "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/tools/router.ts"
click node_dashboard "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/dashboard.ts"
click node_ai_enhancement "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/ai/enhance.ts"
click node_ai_schemas "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/ai/schemas.ts"
click node_precedents "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/knowledge.ts"
click node_ontology "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/ontology.ts"
click node_intelligence_context "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/pipeline.ts"
click node_decisions "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/decisions/service.ts"
click node_account_learning "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/decisions/context.ts"
click node_action_service "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/actions/service.ts"
click node_hosted_security "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/hosted.ts"
click node_telemetry "https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/observability/telemetry.ts"

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_google_sources,node_ads_sources,node_crm_api,node_crm_csv,node_crm_hubspot,node_crm_salesforce,node_mcp_client toneBlue
class node_evidence,node_evidence_mapping,node_evidence_schema,node_ad_strategy,node_analysis_tools,node_numeric_provenance toneAmber
class node_ai_enhancement,node_ai_schemas,node_precedents,node_ontology,node_intelligence_context,node_decisions,node_account_learning toneMint
class node_mcp_server,node_tool_families,node_dashboard toneRose
class node_action_service,node_hosted_security,node_telemetry toneIndigo
```

## Components

### Evidence inputs

- [Google sources](https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/connectors/google): `src/connectors/google`
- [Paid media sources](https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/connectors/paid): `src/connectors/paid`
- [CRM API](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/api.ts): `src/connectors/crm/api.ts`
- [CRM CSV](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/csv.ts): `src/connectors/crm/csv.ts`
- [HubSpot CRM](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/hubspot.ts): `src/connectors/crm/hubspot.ts`
- [Salesforce CRM](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/connectors/crm/salesforce.ts): `src/connectors/crm/salesforce.ts`

### Evidence and analysis

- [Evidence normalization](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/normalize.ts): `src/evidence/normalize.ts`
- [Evidence mapping](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/mapping.ts): `src/evidence/mapping.ts`
- [Evidence schema](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/evidence/schema.ts): `src/evidence/schema.ts`
- [Ad strategy](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/analysis/adStrategy.ts): `src/analysis/adStrategy.ts`
- [Marketing analysis](https://github.com/gourav2411/general-marketing-intelligence/tree/main/src/analysis): `src/analysis`
- [Numeric provenance](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/measurement/numericProvenance.ts): `src/measurement/numericProvenance.ts`

### Decision intelligence

- [AI enhancement](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/ai/enhance.ts): `src/ai/enhance.ts`
- [AI schemas](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/ai/schemas.ts): `src/ai/schemas.ts`
- [Strategic precedents](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/knowledge.ts): `src/intelligence/knowledge.ts`
- [Case ontology](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/ontology.ts): `src/intelligence/ontology.ts`
- [Intelligence context](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/intelligence/pipeline.ts): `src/intelligence/pipeline.ts`
- [Decision records](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/decisions/service.ts): `src/decisions/service.ts`
- [Account learning context](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/decisions/context.ts): `src/decisions/context.ts`

### MCP and dashboards

- [MCP server](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/index.ts): `src/index.ts`
- [Tool families](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/tools/router.ts): `src/tools/router.ts`
- [Local dashboards](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/dashboard.ts): `src/dashboard.ts`

### Actions and governance

- [Action approvals](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/actions/service.ts): `src/actions/service.ts`
- [Hosted security](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/hosted.ts): `src/hosted.ts`
- [Tool telemetry](https://github.com/gourav2411/general-marketing-intelligence/blob/main/src/observability/telemetry.ts): `src/observability/telemetry.ts`

### Other components

- **MCP client**

## Connections

- MCP client → MCP server: invokes tools (evidence: `README.md`)
- Google sources → Evidence normalization: provides evidence (evidence: `README.md`)
- Paid media sources → Evidence normalization: provides evidence (evidence: `README.md`)
- CRM API → Evidence normalization: provides evidence
- CRM CSV → Evidence normalization: provides evidence
- HubSpot CRM → Evidence normalization: provides evidence
- Salesforce CRM → Evidence normalization: provides evidence
- Evidence normalization → Evidence mapping: uses mappings (evidence: `src/evidence/normalize.ts`)
- Evidence normalization → Evidence schema: uses schema (evidence: `src/evidence/normalize.ts`)
- Evidence normalization → Marketing analysis: grounds calculations (evidence: `README.md`)
- Ad strategy → Marketing analysis: supports recommendations
- MCP server → Tool families: routes questions (evidence: `README.md`)
- MCP server → Local dashboards: offers dashboards (evidence: `README.md`)
- MCP server → AI enhancement: enhances outputs (evidence: `src/index.ts`)
- AI enhancement → AI schemas: validates output (evidence: `src/ai/enhance.ts`)
- AI enhancement → Numeric provenance: checks claims (evidence: `src/ai/enhance.ts`)
- Intelligence context → Strategic precedents: retrieves cases (evidence: `src/intelligence/pipeline.ts`)
- Strategic precedents → Case ontology: uses ontology (evidence: `src/intelligence/knowledge.ts`)
- AI enhancement → Account learning context: loads learning (evidence: `src/ai/enhance.ts`)
- Account learning context → Decision records: inspects records (evidence: `src/decisions/context.ts`)
- MCP server → Decision records: records outcomes (evidence: `src/index.ts`)
- MCP server → Action approvals: controls actions (evidence: `src/index.ts`)
- MCP server → Tool telemetry: emits events (evidence: `src/index.ts`)
- MCP client → Hosted security: authenticates optionally (evidence: `README.md`)
