How ashik-manjunath/graphify works
Purpose and entry points
Graphify is a Python 3.10+ CLI that converts a repository or mixed corpus (code, docs, media, workspace exports, schemas) into a queryable knowledge graph. Primary entry points are graphify/__main__.py for the graphify command and python -m graphify, and graphify/serve.py for MCP serving. It produces graphify-out/graph.json, GRAPH_REPORT.md, and optional browser/call-flow visualizations.
Orchestration and graph build
The build flow is coordinated by graphify/build.py: discover input, extract nodes and relationships, merge with existing state when requested, cluster the graph, and emit artifacts. graphify/extract.py is the headless extraction entry point; graphify/analyze.py and graphify/detect.py classify files and drive content-specific handling. The important boundary is local structural extraction versus semantic extraction that may invoke an LLM.
Local source extraction and resolution
Code is parsed locally, primarily through AST/language extraction, then normalized into graph entities and edges. graphify/extract.py owns broad extraction; graphify/symbol_resolution.py resolves cross-file/import symbol references; graphify/semantic_cleanup.py and graphify/dedup.py reconcile duplicate or ambiguous entities. This stage creates the canonical graph vocabulary before reporting, querying, or export.
Non-code and external ingestion
Specialized adapters add sources beyond repository code: MCP configurations (graphify/mcp_ingest.py), SCIP indexes (graphify/scip_ingest.py), PostgreSQL schema introspection (graphify/pg_introspect.py), Cargo workspaces (graphify/cargo_introspect.py), and Google Workspace shortcuts/content (graphify/google_workspace.py). Optional runtimes/services include LLM providers, Ollama, AWS Bedrock, Google Workspace gws, PostgreSQL, and graph targets such as Neo4j or FalkorDB.
Persistence, incremental updates, and graph composition
graphify/manifest.py tracks corpus state for portable/incremental rebuilds, while graphify/cache.py stores reusable extraction results. graphify/affected.py identifies impact from changes, and graphify/watch.py supports continuous synchronization. graphify/global_graph.py registers and traverses graphs across projects. These components separate raw extraction state from the generated graph artifact.
Enrichment, clustering, and deliverables
graphify/cluster.py detects graph communities and supports labeling; graphify/report.py generates architecture-oriented findings such as highly connected nodes, cross-cutting relationships, confidence, and suggested questions. graphify/export.py produces alternate formats and graph database exports, while graphify/callflow_html.py generates the call-flow architecture HTML. Visualization is downstream of graph construction and can be skipped without changing extraction.
Consumption and assistant integration
Graph consumers query graph artifacts through CLI-oriented analysis and retrieval in graphify/querylog.py, graphify/analyze.py, and the MCP server in graphify/serve.py, which supports stdio and HTTP with optional API-key protection. graphify/hooks.py installs Git hooks for rebuild/merge behavior. Assistant-specific skill and persistent-instruction assets under graphify/skills/ and graphify/always_on/ are generated/maintained by tools/skillgen/gen.py, enabling query-first behavior across coding-agent platforms.
Main entry points: global_graph.py Cross-project graph · build.py Build orchestrator · extract.py Structural extraction · analyze.py File analysis
Components 20
Entry & Control
- CLI command · Runs graphify builds and analysis commands.
graphify/__main__.py - Build orchestrator · Coordinates discovery, extraction, composition, clustering, and artifact emission.
graphify/build.py
Extraction & Ingestion
- File analysis · Classifies inputs and selects content-specific handling.
graphify/analyze.py - Content detection
graphify/detect.py - Structural extraction · Headless, local extraction into normalized graph entities and relationships.
graphify/extract.py - Symbol resolution · Resolves cross-file and import references.
graphify/symbol_resolution.py - Entity reconciliation · Cleans semantic ambiguity and deduplicates entities.
graphify/semantic_cleanup.py - External adapters · Imports MCP, SCIP, PostgreSQL, Cargo, and Google Workspace sources.
graphify/mcp_ingest.py
Graph State
- Corpus manifest · Tracks portable corpus state for incremental rebuilds.
graphify/manifest.py - Extraction cache · Stores reusable extraction results.
graphify/cache.py - Change impact · Determines affected graph regions after changes.
graphify/affected.py - Continuous sync · Watches changes and triggers synchronized rebuilds.
graphify/watch.py - Cross-project graph · Registers and traverses graphs across projects.
graphify/global_graph.py
Delivery & Consumers
- Graph clustering · Finds and labels graph communities.
graphify/cluster.py - Architecture report · Produces findings, confidence, and suggested questions.
graphify/report.py - Graph export · Writes graph artifacts and graph-database formats.
graphify/export.py - Call-flow visualization · Optional downstream call-flow architecture visualization.
graphify/callflow_html.py - MCP server · Serves graph queries over stdio or HTTP with optional API-key protection.
graphify/serve.py
Agent Automation
- Git hooks · Installs rebuild and merge behavior.
graphify/hooks.py - Skill asset generator · Maintains assistant skills and persistent query-first instructions.
tools/skillgen/gen.py
Connections 21
- CLI command → Build orchestrator: starts build
- Build orchestrator → File analysis: discovers and classifies
- File analysis → Content detection: uses
- File analysis → Structural extraction: routes inputs
- Build orchestrator → Structural extraction: runs
- External adapters → Structural extraction: adds source entities
- Structural extraction → Symbol resolution: normalizes references
- Symbol resolution → Entity reconciliation: resolved entities
- Entity reconciliation → Cross-project graph: canonical graph
- Corpus manifest → Build orchestrator: incremental state
- Extraction cache → Structural extraction: reuses results
- Change impact → Build orchestrator: scopes rebuilds
- Continuous sync → Change impact: change events
- Cross-project graph → Graph clustering: graph topology
- Graph clustering → Architecture report: communities
- Cross-project graph → Architecture report: relationships
- Cross-project graph → Graph export: exports
- Cross-project graph → Call-flow visualization: visualizes
- Cross-project graph → MCP server: queryable artifact
- Git hooks → Build orchestrator: triggers rebuild behavior
- Skill asset generator → MCP server: supports query-first agents