$ show Graphify-Labs/graphify
Graphify is a CLI tool and library that extracts structural and semantic knowledge graphs from source code across 36+ programming languages. It parses files using tree-sitter grammars, builds a graph of nodes (functions, classes, modules, etc.) and edges (calls, imports, inheritance, etc.), performs community detection via Leiden/Louvain, and generates reports, wikis, and exports to formats like Obsidian, Neo4j, and FalkorDB. The system integrates with AI coding assistants through an MCP server (stdio/HTTP), skill files (SKILL.md, CLAUDE.md), and git hooks for automatic graph updates. Key entry points include `graphify extract`, `graphify query`, `graphify serve`, and `graphify install`. External dependencies include tree-sitter grammars, LLM APIs (OpenAI, Anthropic, Gemini, Ollama), and optional databases. The architecture is modular: per-language extractors in `graphify/extractors/`, graph assembly in `build.py`, clustering in `cluster.py`, and export in `export.py`. The codebase demonstrates strong engineering practices with extensive tests, atomic file writes, security validation (SSRF, path traversal), and cross-platform support.
The LLM identified 4 files worth highlighting for reuse:
Self-contained MinHash implementation with band-based LSH for fuzzy deduplication of code entities. Avoids external dependencies like scipy/numpy, making it easily extractable into any Python project needing near-duplicate detection. Demonstrates non-obvious skill in implementing a probabilistic data structure from scratch with careful attention to hash seed stability and integer arithmetic.
Robust node ID normalization that applies case folding, NFKC normalization, and fixpoint iteration for combining marks. Ensures consistent IDs across different Unicode representations and case variations. This is a reusable pattern for any system that needs deterministic, collision-resistant identifiers from arbitrary strings, especially in multilingual codebases.
Atomic file write utilities (`write_text_atomic`, `write_json_atomic`) that use `os.replace` for atomicity on POSIX and fall back to copy-then-rename on Windows when `os.replace` fails due to permission errors or cross-device links. Preserves file modes and handles edge cases like read-only files. This pattern is directly reusable in any Python application requiring crash-safe file persistence.
Comprehensive security module implementing SSRF protection via custom HTTP/HTTPS connection classes that block private IP ranges and cloud metadata endpoints, URL validation with scheme whitelisting, path traversal prevention, and metadata sanitization. The SSRF guard pattern is self-contained and can be extracted to protect any Python application that makes HTTP requests based on user input.