# pranavagarwal2101-byte/company-brain architecture

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

- Interactive diagram: https://gitdiagram.com/pranavagarwal2101-byte/company-brain
- Repository: https://github.com/pranavagarwal2101-byte/company-brain

## Overview

Company Brain answers engineering-organization questions by having an agent choose graph traversals, running them against FalkorDB, and returning both findings and the traversal path for explanation. Its query capabilities cover formal ownership, inferred expertise, decision provenance, dependency blast radius, and finding people to ask. Separately, ingestion loads or updates company.json as graph nodes and relationships. The excerpts show the agent-to-tool dispatch and shared database connection; individual tools are grouped by capability, but their internal query details are only partially sampled.

Main entry points: [`agent.py`](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/agent.py) (Agent loop), [`graph.py`](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/graph.py) (Graph connection), [`tools.py`](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py) (Find owner), [`ingest.py`](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/ingest.py) (Graph ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Question answering"]
  node_agent["Agent loop<br/>[agent.py]"]
  node_gemini["Gemini model"]
end

subgraph group_queries["Graph queries"]
  node_owner["Find owner<br/>[tools.py]"]
  node_experts["Find experts<br/>[tools.py]"]
  node_decision["Trace decision<br/>[tools.py]"]
  node_blast["Blast radius<br/>[tools.py]"]
  node_ask["Who to ask<br/>[tools.py]"]
end

subgraph group_data["Knowledge graph"]
  node_ingest["Graph ingestion<br/>[ingest.py]"]
  node_dataset["Company dataset<br/>[company.json]"]
  node_connection["Graph connection<br/>[graph.py]"]
  node_falkordb[("FalkorDB graph")]
end

node_engineer(("Engineer"))

node_engineer -->|"asks"| node_agent
node_agent -->|"sends question"| node_gemini
node_gemini -->|"requests tool"| node_agent
node_agent -->|"dispatches"| node_owner
node_agent -->|"dispatches"| node_experts
node_agent -->|"dispatches"| node_decision
node_agent -->|"dispatches"| node_blast
node_agent -->|"dispatches"| node_ask
node_owner -->|"queries via"| node_connection
node_experts -->|"queries via"| node_connection
node_decision -->|"queries via"| node_connection
node_blast -->|"queries via"| node_connection
node_ask -->|"queries via"| node_connection
node_dataset -->|"loads"| node_ingest
node_ingest -->|"gets graph"| node_connection
node_connection -->|"connects to"| node_falkordb

click node_agent "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/agent.py"
click node_owner "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py"
click node_experts "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py"
click node_decision "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py"
click node_blast "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py"
click node_ask "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py"
click node_ingest "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/ingest.py"
click node_dataset "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/company.json"
click node_connection "https://github.com/pranavagarwal2101-byte/company-brain/blob/main/graph.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_agent,node_gemini toneBlue
class node_owner,node_experts,node_decision,node_blast,node_ask toneAmber
class node_ingest,node_dataset,node_connection,node_falkordb toneMint
class node_engineer toneIndigo
```

## Components

### Question answering

- [Agent loop](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/agent.py): `agent.py`
- **Gemini model**

### Graph queries

- [Find owner](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py): `tools.py`
- [Find experts](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py): `tools.py`
- [Trace decision](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py): `tools.py`
- [Blast radius](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py): `tools.py`
- [Who to ask](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/tools.py): `tools.py`

### Knowledge graph

- [Graph ingestion](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/ingest.py): `ingest.py`
- [Company dataset](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/company.json): `company.json`
- [Graph connection](https://github.com/pranavagarwal2101-byte/company-brain/blob/main/graph.py): `graph.py`
- **FalkorDB graph**

### Other components

- **Engineer**

## Connections

- Engineer → Agent loop: asks (evidence: `README.md`)
- Agent loop → Gemini model: sends question (evidence: `agent.py`)
- Gemini model → Agent loop: requests tool (evidence: `agent.py`)
- Agent loop → Find owner: dispatches (evidence: `agent.py`)
- Agent loop → Find experts: dispatches (evidence: `agent.py`)
- Agent loop → Trace decision: dispatches (evidence: `agent.py`)
- Agent loop → Blast radius: dispatches (evidence: `agent.py`)
- Agent loop → Who to ask: dispatches (evidence: `agent.py`)
- Find owner → Graph connection: queries via (evidence: `tools.py`)
- Find experts → Graph connection: queries via (evidence: `tools.py`)
- Trace decision → Graph connection: queries via (evidence: `tools.py`)
- Blast radius → Graph connection: queries via (evidence: `tools.py`)
- Who to ask → Graph connection: queries via (evidence: `tools.py`)
- Company dataset → Graph ingestion: loads (evidence: `ingest.py`)
- Graph ingestion → Graph connection: gets graph (evidence: `ingest.py`)
- Graph connection → FalkorDB graph: connects to (evidence: `graph.py`)
