# tomas587/graphify architecture

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

- Interactive diagram: https://gitdiagram.com/tomas587/graphify
- Repository: https://github.com/tomas587/graphify

## Overview

Graphify is a local codebase-to-knowledge-graph tool used through an AI assistant or CLI. The main workflow discovers repository files, extracts code and document knowledge, resolves and builds graph structure, then analyzes and exports graph views and reports for later queries. The map also preserves documented multimodal ingestion, graph querying, and output capabilities. Source excerpts and the index establish several internal calls; other links are limited to README-documented behavior, so unsampled implementation details are not asserted.

Main entry points: [`graphify/cli.py`](https://github.com/tomas587/graphify/blob/v8/graphify/cli.py) (CLI workflow), [`graphify/build.py`](https://github.com/tomas587/graphify/blob/v8/graphify/build.py) (Graph builder), [`graphify/extract.py`](https://github.com/tomas587/graphify/blob/v8/graphify/extract.py) (Code extraction), [`graphify/detect.py`](https://github.com/tomas587/graphify/blob/v8/graphify/detect.py) (File discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and discovery"]
  node_cli["CLI workflow<br/>[cli.py]"]
  node_detect["File discovery<br/>[detect.py]"]
end

subgraph group_knowledge["Extraction and resolution"]
  node_ingest["Document ingestion<br/>[ingest.py]"]
  node_llm["Semantic pass<br/>[llm.py]"]
  node_extract["Code extraction<br/>[extract.py]"]
  node_extractorbase["Extractor foundation<br/>[base.py]"]
  node_engine["Language extractor engine<br/>[engine.py]"]
  node_csharp["C&#35; extractor<br/>[csharp.py]"]
  node_resolution["Symbol resolution<br/>[resolution.py]"]
  node_manifest["Package manifests<br/>[manifest_ingest.py]"]
end

subgraph group_graph["Graph construction"]
  node_ids["Canonical IDs<br/>[ids.py]"]
  node_build["Graph builder<br/>[build.py]"]
  node_dedup["Node deduplication<br/>[dedup.py]"]
  node_cache[("Incremental cache<br/>[cache.py]")]
  node_security["Input safety<br/>[security.py]"]
end

subgraph group_outputs["Analysis and outputs"]
  node_analyze["Graph analysis<br/>[analyze.py]"]
  node_cluster["Subsystem clustering<br/>[cluster.py]"]
  node_html["Interactive graph export<br/>[html.py]"]
  node_html_large["Large graph renderer<br/>[html_large.py]"]
  node_report["Graph report<br/>[report.py]"]
  node_paths["Output paths<br/>[paths.py]"]
  node_json["Persisted graph<br/>[export.py]"]
end

subgraph group_query["Query and context"]
  node_query["Graph query<br/>[cli.py]"]
  node_mcp["MCP graph ingestion<br/>[mcp_ingest.py]"]
end

node_user(("Developer / assistant"))

node_user -->|"runs workflow"| node_cli
node_cli -.->|"maps repository"| node_detect
node_detect -->|"checks cached files"| node_cache
node_detect -.->|"selects documents"| node_ingest
node_ingest -.->|"semantic extraction"| node_llm
node_cli -.->|"maps code"| node_extract
node_extract -->|"uses foundation"| node_extractorbase
node_extract -->|"resolves symbols"| node_resolution
node_extract -.->|"dispatches parsing"| node_engine
node_engine -.->|"selects language parser"| node_csharp
node_cli -.->|"ingests manifests"| node_manifest
node_cli -.->|"builds graph"| node_build
node_build -->|"normalizes identifiers"| node_ids
node_build -->|"uses output paths"| node_paths
node_build -->|"consumes extraction"| node_extract
node_build -->|"deduplicates nodes"| node_dedup
node_build -->|"guards graph input"| node_security
node_cli -.->|"analyzes graph"| node_analyze
node_analyze -->|"clusters subsystems"| node_cluster
node_cli -.->|"exports graph view"| node_html
node_html -->|"renders large graphs"| node_html_large
node_cli -.->|"writes highlights"| node_report
node_cli -.->|"persists graph"| node_json
node_user -->|"queries graph"| node_query
node_user -.->|"shares graph context"| node_mcp

click node_cli "https://github.com/tomas587/graphify/blob/v8/graphify/cli.py"
click node_detect "https://github.com/tomas587/graphify/blob/v8/graphify/detect.py"
click node_ingest "https://github.com/tomas587/graphify/blob/v8/graphify/ingest.py"
click node_llm "https://github.com/tomas587/graphify/blob/v8/graphify/llm.py"
click node_extract "https://github.com/tomas587/graphify/blob/v8/graphify/extract.py"
click node_extractorbase "https://github.com/tomas587/graphify/blob/v8/graphify/extractors/base.py"
click node_engine "https://github.com/tomas587/graphify/blob/v8/graphify/extractors/engine.py"
click node_csharp "https://github.com/tomas587/graphify/blob/v8/graphify/extractors/csharp.py"
click node_resolution "https://github.com/tomas587/graphify/blob/v8/graphify/extractors/resolution.py"
click node_manifest "https://github.com/tomas587/graphify/blob/v8/graphify/manifest_ingest.py"
click node_ids "https://github.com/tomas587/graphify/blob/v8/graphify/ids.py"
click node_build "https://github.com/tomas587/graphify/blob/v8/graphify/build.py"
click node_dedup "https://github.com/tomas587/graphify/blob/v8/graphify/dedup.py"
click node_cache "https://github.com/tomas587/graphify/blob/v8/graphify/cache.py"
click node_analyze "https://github.com/tomas587/graphify/blob/v8/graphify/analyze.py"
click node_cluster "https://github.com/tomas587/graphify/blob/v8/graphify/cluster.py"
click node_html "https://github.com/tomas587/graphify/blob/v8/graphify/exporters/html.py"
click node_html_large "https://github.com/tomas587/graphify/blob/v8/graphify/exporters/html_large.py"
click node_report "https://github.com/tomas587/graphify/blob/v8/graphify/report.py"
click node_security "https://github.com/tomas587/graphify/blob/v8/graphify/security.py"
click node_paths "https://github.com/tomas587/graphify/blob/v8/graphify/paths.py"
click node_query "https://github.com/tomas587/graphify/blob/v8/graphify/cli.py"
click node_mcp "https://github.com/tomas587/graphify/blob/v8/graphify/mcp_ingest.py"
click node_json "https://github.com/tomas587/graphify/blob/v8/graphify/export.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_detect toneBlue
class node_ingest,node_llm,node_extract,node_extractorbase,node_engine,node_csharp,node_resolution,node_manifest toneAmber
class node_ids,node_build,node_dedup,node_cache,node_security toneMint
class node_analyze,node_cluster,node_html,node_html_large,node_report,node_paths,node_json toneRose
class node_query,node_mcp,node_user toneIndigo
```

## Components

### Entry and discovery

- [CLI workflow](https://github.com/tomas587/graphify/blob/v8/graphify/cli.py): `graphify/cli.py`
- [File discovery](https://github.com/tomas587/graphify/blob/v8/graphify/detect.py): `graphify/detect.py`

### Extraction and resolution

- [Document ingestion](https://github.com/tomas587/graphify/blob/v8/graphify/ingest.py): `graphify/ingest.py`
- [Semantic pass](https://github.com/tomas587/graphify/blob/v8/graphify/llm.py): `graphify/llm.py`
- [Code extraction](https://github.com/tomas587/graphify/blob/v8/graphify/extract.py): `graphify/extract.py`
- [Extractor foundation](https://github.com/tomas587/graphify/blob/v8/graphify/extractors/base.py): `graphify/extractors/base.py`
- [Language extractor engine](https://github.com/tomas587/graphify/blob/v8/graphify/extractors/engine.py): `graphify/extractors/engine.py`
- [C# extractor](https://github.com/tomas587/graphify/blob/v8/graphify/extractors/csharp.py): `graphify/extractors/csharp.py`
- [Symbol resolution](https://github.com/tomas587/graphify/blob/v8/graphify/extractors/resolution.py): `graphify/extractors/resolution.py`
- [Package manifests](https://github.com/tomas587/graphify/blob/v8/graphify/manifest_ingest.py): `graphify/manifest_ingest.py`

### Graph construction

- [Canonical IDs](https://github.com/tomas587/graphify/blob/v8/graphify/ids.py): `graphify/ids.py`
- [Graph builder](https://github.com/tomas587/graphify/blob/v8/graphify/build.py): `graphify/build.py`
- [Node deduplication](https://github.com/tomas587/graphify/blob/v8/graphify/dedup.py): `graphify/dedup.py`
- [Incremental cache](https://github.com/tomas587/graphify/blob/v8/graphify/cache.py): `graphify/cache.py`
- [Input safety](https://github.com/tomas587/graphify/blob/v8/graphify/security.py): `graphify/security.py`

### Analysis and outputs

- [Graph analysis](https://github.com/tomas587/graphify/blob/v8/graphify/analyze.py): `graphify/analyze.py`
- [Subsystem clustering](https://github.com/tomas587/graphify/blob/v8/graphify/cluster.py): `graphify/cluster.py`
- [Interactive graph export](https://github.com/tomas587/graphify/blob/v8/graphify/exporters/html.py): `graphify/exporters/html.py`
- [Large graph renderer](https://github.com/tomas587/graphify/blob/v8/graphify/exporters/html_large.py): `graphify/exporters/html_large.py`
- [Graph report](https://github.com/tomas587/graphify/blob/v8/graphify/report.py): `graphify/report.py`
- [Output paths](https://github.com/tomas587/graphify/blob/v8/graphify/paths.py): `graphify/paths.py`
- [Persisted graph](https://github.com/tomas587/graphify/blob/v8/graphify/export.py): `graphify/export.py`

### Query and context

- [Graph query](https://github.com/tomas587/graphify/blob/v8/graphify/cli.py): `graphify/cli.py`
- [MCP graph ingestion](https://github.com/tomas587/graphify/blob/v8/graphify/mcp_ingest.py): `graphify/mcp_ingest.py`

### Other components

- **Developer / assistant**

## Connections

- Developer / assistant → CLI workflow: runs workflow (evidence: `README.md`)
- CLI workflow → File discovery: maps repository
- File discovery → Incremental cache: checks cached files (evidence: `graphify/detect.py`)
- File discovery → Document ingestion: selects documents
- Document ingestion → Semantic pass: semantic extraction
- CLI workflow → Code extraction: maps code
- Code extraction → Extractor foundation: uses foundation (evidence: `graphify/extractors/base.py`)
- Code extraction → Symbol resolution: resolves symbols (evidence: `graphify/extractors/resolution.py`)
- Code extraction → Language extractor engine: dispatches parsing
- Language extractor engine → C# extractor: selects language parser
- CLI workflow → Package manifests: ingests manifests
- CLI workflow → Graph builder: builds graph
- Graph builder → Canonical IDs: normalizes identifiers (evidence: `graphify/build.py`)
- Graph builder → Output paths: uses output paths (evidence: `graphify/build.py`)
- Graph builder → Code extraction: consumes extraction (evidence: `graphify/build.py`)
- Graph builder → Node deduplication: deduplicates nodes (evidence: `graphify/build.py`)
- Graph builder → Input safety: guards graph input (evidence: `graphify/build.py`)
- CLI workflow → Graph analysis: analyzes graph
- Graph analysis → Subsystem clustering: clusters subsystems (evidence: `graphify/analyze.py`)
- CLI workflow → Interactive graph export: exports graph view
- Interactive graph export → Large graph renderer: renders large graphs (evidence: `graphify/exporters/html.py`)
- CLI workflow → Graph report: writes highlights
- CLI workflow → Persisted graph: persists graph
- Developer / assistant → Graph query: queries graph (evidence: `README.md`)
- Developer / assistant → MCP graph ingestion: shares graph context
