# laksh-star/competitive-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/laksh-star/competitive-intelligence
- Repository: https://github.com/laksh-star/competitive-intelligence

## Overview

Competitive Intelligence Monitor supports a credential-free analyst workflow over saved articles and a live web-to-events pipeline backed by PostgreSQL. Analysts can run either mode through the CLI; agents can use the MCP tools to analyze, search, rank trends, and create briefs or dashboards. In live mode, CocoIndex searches with Tavily, extracts competitive events with an LLM, and indexes articles and events. The README also documents interactive monitoring; its wiring is represented only where supported by the sampled source. The live pipeline internals are only partially sampled, so uncertain stage-level links are omitted.

Main entry points: [`local_intel.py`](https://github.com/laksh-star/competitive-intelligence/blob/main/local_intel.py) (Local Analyzer), [`main.py`](https://github.com/laksh-star/competitive-intelligence/blob/main/main.py) (CocoIndex Pipeline), [`mcp_server.py`](https://github.com/laksh-star/competitive-intelligence/blob/main/mcp_server.py) (MCP Tools), [`competitive_intel.py`](https://github.com/laksh-star/competitive-intelligence/blob/main/competitive_intel.py) (Command Line)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_cli["Command Line"]
  node_interactive["Interactive Monitor<br/>[run_interactive.py]"]
end

subgraph group_local["Local Analysis"]
  node_local_engine["Local Analyzer<br/>[local_intel.py]"]
  node_watchlist["Watchlist<br/>[watchlist.json]"]
  node_sample_articles["Saved Articles"]
  node_artifacts["Briefs And Dashboards<br/>[local_intel.py]"]
end

subgraph group_live["Live Intelligence"]
  node_live_check["Live Run Coordinator<br/>[live_demo_check.py]"]
  node_pipeline["CocoIndex Pipeline<br/>[main.py]"]
end

subgraph group_access["Agent Access"]
  node_mcp["MCP Tools<br/>[mcp_server.py]"]
  node_providers["Data Providers<br/>[providers.py]"]
end

node_analyst(("Analyst"))
node_agent(("MCP Agent"))
node_tavily["Tavily Search"]
node_llm["LLM Extraction"]
node_postgres[("PostgreSQL")]

node_analyst -->|"runs command"| node_cli
node_analyst -->|"sets monitoring"| node_interactive
node_agent -->|"calls tools"| node_mcp
node_cli -->|"runs sample analysis"| node_local_engine
node_cli -->|"starts live check"| node_live_check
node_interactive -->|"starts monitoring"| node_pipeline
node_local_engine -->|"reads config"| node_watchlist
node_local_engine -->|"reads articles"| node_sample_articles
node_local_engine -->|"writes reports"| node_artifacts
node_live_check -->|"requests updates and queries"| node_mcp
node_mcp -->|"dispatches data tools"| node_providers
node_mcp -->|"runs CocoIndex update"| node_pipeline
node_providers -->|"uses local analysis"| node_local_engine
node_providers -->|"queries events"| node_postgres
node_pipeline -->|"searches articles"| node_tavily
node_pipeline -->|"extracts events"| node_llm
node_pipeline -->|"indexes articles and events"| node_postgres

click node_cli "https://github.com/laksh-star/competitive-intelligence/blob/main/competitive_intel.py"
click node_interactive "https://github.com/laksh-star/competitive-intelligence/blob/main/run_interactive.py"
click node_local_engine "https://github.com/laksh-star/competitive-intelligence/blob/main/local_intel.py"
click node_watchlist "https://github.com/laksh-star/competitive-intelligence/blob/main/watchlist.json"
click node_sample_articles "https://github.com/laksh-star/competitive-intelligence/blob/main/data/sample_articles.json"
click node_artifacts "https://github.com/laksh-star/competitive-intelligence/blob/main/local_intel.py"
click node_live_check "https://github.com/laksh-star/competitive-intelligence/blob/main/live_demo_check.py"
click node_pipeline "https://github.com/laksh-star/competitive-intelligence/blob/main/main.py"
click node_mcp "https://github.com/laksh-star/competitive-intelligence/blob/main/mcp_server.py"
click node_providers "https://github.com/laksh-star/competitive-intelligence/blob/main/providers.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_interactive toneBlue
class node_local_engine,node_watchlist,node_sample_articles,node_artifacts,node_postgres toneAmber
class node_live_check,node_pipeline toneMint
class node_mcp,node_providers toneRose
class node_analyst,node_agent,node_tavily,node_llm toneIndigo
```

## Components

### User Interfaces

- [Command Line](https://github.com/laksh-star/competitive-intelligence/blob/main/competitive_intel.py): `competitive_intel.py`
- [Interactive Monitor](https://github.com/laksh-star/competitive-intelligence/blob/main/run_interactive.py): `run_interactive.py`

### Local Analysis

- [Local Analyzer](https://github.com/laksh-star/competitive-intelligence/blob/main/local_intel.py): `local_intel.py`
- [Watchlist](https://github.com/laksh-star/competitive-intelligence/blob/main/watchlist.json): `watchlist.json`
- [Saved Articles](https://github.com/laksh-star/competitive-intelligence/blob/main/data/sample_articles.json): `data/sample_articles.json`
- [Briefs And Dashboards](https://github.com/laksh-star/competitive-intelligence/blob/main/local_intel.py): `local_intel.py`

### Live Intelligence

- [Live Run Coordinator](https://github.com/laksh-star/competitive-intelligence/blob/main/live_demo_check.py): `live_demo_check.py`
- [CocoIndex Pipeline](https://github.com/laksh-star/competitive-intelligence/blob/main/main.py): `main.py`

### Agent Access

- [MCP Tools](https://github.com/laksh-star/competitive-intelligence/blob/main/mcp_server.py): `mcp_server.py`
- [Data Providers](https://github.com/laksh-star/competitive-intelligence/blob/main/providers.py): `providers.py`

### Other components

- **Analyst**
- **MCP Agent**
- **Tavily Search**
- **LLM Extraction**
- **PostgreSQL**

## Connections

- Analyst → Command Line: runs command
- Analyst → Interactive Monitor: sets monitoring
- MCP Agent → MCP Tools: calls tools
- Command Line → Local Analyzer: runs sample analysis
- Command Line → Live Run Coordinator: starts live check
- Interactive Monitor → CocoIndex Pipeline: starts monitoring
- Local Analyzer → Watchlist: reads config
- Local Analyzer → Saved Articles: reads articles
- Local Analyzer → Briefs And Dashboards: writes reports
- Live Run Coordinator → MCP Tools: requests updates and queries
- MCP Tools → Data Providers: dispatches data tools
- MCP Tools → CocoIndex Pipeline: runs CocoIndex update
- Data Providers → Local Analyzer: uses local analysis
- Data Providers → PostgreSQL: queries events
- CocoIndex Pipeline → Tavily Search: searches articles
- CocoIndex Pipeline → LLM Extraction: extracts events
- CocoIndex Pipeline → PostgreSQL: indexes articles and events
