Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphify Toolkit - Turn any codebase into a queryable knowledge graph

Part of AgentStack

MIT License CI GitHub Stars

Quick Start · Use Cases · Query Commands · Comparison · Ecosystem


Graphify Toolkit Demo


The Story

Before Graphify, "What depends on this file?" meant 20 minutes of grepping through imports, tracing function calls, and hoping you found everything. One missed dependency and the deploy breaks at midnight.

Now it is one command and a JSON response.

We run Graphify across 5 repositories with 17,000+ documentation files, merged into a single system-wide knowledge graph with 3,472 queryable chunks. When an agent wants to change middleware.ts, it checks the blast radius first. 16 affected nodes? The commit hook warns before a human ever has to.

No SaaS account. No API keys. Just bash, jq, and python3.

    ┌──────────────────────────────────────────────────────────────┐
    │                    YOUR CODEBASE                             │
    │                                                              │
    │   auth/                  api/                  utils/        │
    │   ├── middleware.ts       ├── users.ts          ├── jwt.ts   │
    │   └── context.ts         └── cron/health.ts    └── db.ts    │
    └──────────────┬───────────────────────────────────────────────┘
                   │  graphify-core.sh
                   ▼
    ┌──────────────────────────────────────────────────────────────┐
    │                    KNOWLEDGE GRAPH                           │
    │                                                              │
    │   [middleware.ts] ──imports──▶ [jwt.ts]                      │
    │        │                         │                           │
    │     exports                   exports                       │
    │        │                         │                           │
    │   [authMiddleware()] ◀─calls─ [verifyToken()]               │
    │        │                                                     │
    │     imports                                                  │
    │        ▼                                                     │
    │   [users.ts] ──imports──▶ [db.ts]                           │
    │                                                              │
    │   22 nodes · 23 edges · 8 languages · queryable in ms       │
    └──────────────────────────────────────────────────────────────┘
                   │  graphify-query.sh
                   ▼
    ┌──────────────────────────────────────────────────────────────┐
    │  $ graphify impact "middleware.ts"                           │
    │                                                              │
    │  Direct nodes: 4                                             │
    │  Affected (depth 2): 16                                      │
    │  WARNING: HIGH IMPACT                                        │
    └──────────────────────────────────────────────────────────────┘

Quick Start

# Install
git clone https://github.com/FvdHMBAI/graphify-toolkit.git
cd graphify-toolkit && bash install.sh

# Build a graph
graphify-core.sh /path/to/your/project

# Query it
graphify-query.sh search "auth"
graphify-query.sh impact "src/auth/middleware.ts"
graphify-query.sh path "login" "database"
graphify-query.sh god-nodes --top 10

Three commands from zero to a fully queryable knowledge graph.

Use Cases

Impact Analysis

Before touching a file, see what breaks. Graphify walks the dependency tree to a configurable depth and reports every affected node. Hook it into pre-commit and your team sees blast radius before code review.

Dependency Tracking

Find every file that imports a module, every function that calls another, every table that a query touches. No more "I thought nobody used that function."

Architecture Discovery

Run god-nodes to surface the most connected modules in your codebase. These are your architectural bottlenecks, the files where a small change causes a large ripple. Refactor them first.

Cross-Repo Queries

Merge graphs from multiple repositories into one system graph. Ask "Which services call the payment API?" and get answers that span your entire stack, not just one repo.


Numbers from Production

Metric Value
Repositories merged 5
Vault files indexed 17,169
RAG chunks queryable 3,472
Languages supported 8
Setup time 30 seconds

What It Does

Graphify extracts nodes (files, functions, classes, tables, headings) and edges (imports, exports, contains, depends_on) from your codebase:

your-project/
  src/auth/middleware.ts    →  [file] middleware.ts
    export authMiddleware   →    [function] authMiddleware()
    import verifyToken      →    [edge] imports → jwt.ts
  src/utils/jwt.ts          →  [file] jwt.ts
    export verifyToken      →    [function] verifyToken()

Output: graphify-out/graph.json, a portable JSON file you can query, merge, visualize, or feed into any tool.

Supported Languages

Language Extraction
TypeScript / JavaScript imports, exports, require()
Python import/from, def/class
Go imports, exported functions
Bash source/. commands, function definitions
SQL CREATE TABLE, FROM/JOIN references
Markdown links, headings
YAML / JSON / TOML structure
Dockerfile / Terraform structure

Query Commands

Search

Find nodes matching a term:

$ graphify-query.sh search "auth"

Found 6 nodes matching 'auth':

  [file        ] middleware.ts                             src/auth/middleware.ts
  [function    ] authMiddleware()                          src/auth/middleware.ts
  [function    ] requireAdmin()                            src/auth/middleware.ts
  [class       ] AuthContext                               src/auth/middleware.ts
  [directory   ] auth                                      src/auth

Impact Analysis

The killer feature. Before you touch a file, see what breaks:

$ graphify-query.sh impact "middleware.ts"

  File: middleware.ts
  Direct nodes: 4
  Affected (depth 2): 16
    [directory] api, docs, utils, auth
    [file] jwt.ts, users.ts, architecture.md
    [function] createToken(), verifyToken(), listUsers(), createUser(), getUserById()
    [heading] Security, Data flow, Architecture, Overview

  WARNING: HIGH IMPACT — 16 affected nodes!

Or check all uncommitted changes at once:

graphify-query.sh impact --diff

Shortest Path

Trace how two concepts are connected:

$ graphify-query.sh path "middleware" "jwt"

Path from 'middleware.ts' to 'jwt.ts' (2 hops):

     middleware.ts                              (file)
  -> authMiddleware()                           (function) [exports]
  -> jwt.ts                                     (file) [imports]

God Nodes

Find the most connected modules, your architectural bottlenecks:

$ graphify-query.sh god-nodes --top 5

=== Top 5 most connected nodes ===

    8 connections  [file      ]  middleware.ts            src/auth/middleware.ts
    6 connections  [file      ]  users.ts                src/api/users.ts
    5 connections  [file      ]  jwt.ts                  src/utils/jwt.ts

Statistics

$ graphify-query.sh stats

=== Graph Statistics ===

  Nodes:       22
  Edges:       23
  Communities: 1

  Node types:
    function                 8
    file                     5
    directory                4

  Edge types:
    exports                 13
    contains                 5
    imports                  5

Multi-Repo Support

Build graphs across multiple repositories and merge them into one system-wide graph:

# Set your repos
export GRAPHIFY_REPOS="/path/to/api:/path/to/frontend:/path/to/shared-lib"

# Build all + merge
graphify-build.sh

# Query across everything
graphify-query-all.sh "Which services call the payment API?"

The merge engine detects when two repos share function signatures (e.g., an API client calling an API server) and creates shares_implementation edges automatically, revealing architectural dependencies no single-repo analysis can surface.

CI/CD Integration

Pre-Commit Impact Gate

Block commits that affect too many nodes:

cp examples/ci-integration.sh .git/hooks/pre-commit
export GRAPHIFY_IMPACT_THRESHOLD=15

Incremental Builds

Only re-extract changed files (uses git diff internally):

graphify-core.sh /path/to/project --update

Nightly Cron

0 4 * * * graphify-build.sh /path/to/repo1 /path/to/repo2 >> /var/log/graphify.log 2>&1

GitHub Actions

- name: Build knowledge graph
  run: |
    sudo apt-get install -y jq
    ./graphify-toolkit/core/graphify-core.sh .
    ./graphify-toolkit/core/graphify-query.sh stats

Claude Code Skill

Graphify Toolkit includes a drop-in Claude Code skill for interactive graph exploration:

# Install the skill
cp -r skill/* ~/.claude/skills/graphify/

# Then in Claude Code:
/graphify                              # build graph for current directory
/graphify query "How does auth work?"  # query the graph
/graphify path "AuthModule" "Database" # shortest path

How It Compares

Feature Graphify Toolkit Sourcegraph GitHub Code Search grep
Self-hosted Yes Enterprise only No Yes
Dependencies bash + jq + python3 Docker + infra N/A None
Knowledge graph Full (nodes + edges + communities) Code Intel (limited) No No
Impact analysis Depth-configurable, pre-commit gate Limited No No
Multi-repo merge Auto cross-repo edge detection Yes Yes Manual
Offline Yes No No Yes
Cost Free $$$ Free (limited) Free
Setup time 30 seconds Hours N/A N/A

Architecture

graphify-toolkit/
  core/
    graphify-core.sh         # Graph builder: code -> graph.json (standalone)
    graphify-query.sh        # Query engine: search, path, impact, stats, god-nodes
  bin/
    graphify-build.sh        # Multi-repo build orchestrator
    graphify-merge.sh        # Cross-repo graph merger (auto cross-links)
    graphify-impact.sh       # Standalone impact analysis
    graphify-query-all.sh    # Cross-repo query
    graphify-auto-rebuild.sh # Incremental rebuild (cron/hook)
  examples/
    sample-project/          # Working example with TS + Markdown
    output/                  # Example graph.json
    ci-integration.sh        # Pre-commit hook example
  tests/
    test-graphify.sh         # Test suite (31 tests)
  skill/
    SKILL.md                 # Claude Code skill integration

Graph Format

{
  "nodes": [
    {
      "id": "src_auth_middleware_ts",
      "label": "middleware.ts",
      "type": "file",
      "file_type": "typescript",
      "source_file": "src/auth/middleware.ts",
      "metadata": { "language": "typescript", "lines": 18, "kind": "file" },
      "community": "0"
    }
  ],
  "links": [
    {
      "source": "src_auth_middleware_ts",
      "target": "src_utils_jwt_ts",
      "relation": "imports",
      "confidence": "EXTRACTED",
      "weight": 1.0
    }
  ],
  "stats": { "total_nodes": 22, "total_edges": 23, "communities": 1 }
}

Compatible with D3.js, Gephi, Neo4j, Obsidian Canvas, or any tool that reads JSON graphs.

Optional: Semantic Enrichment

The standalone core uses pure AST extraction (free, no API key). For richer semantic analysis, install the graphify Python package:

pip install graphifyy
export GEMINI_API_KEY="..."  # optional: enables semantic extraction
graphify-build.sh /path/to/project  # uses graphify if available, falls back to core

Environment Variables

Variable Default Description
GRAPHIFY_GRAPH Auto-detected Path to graph.json for queries
GRAPHIFY_PROJECT Current directory Project root
GRAPHIFY_REPOS Colon-separated repo paths for multi-repo
GRAPHIFY_SYSTEM_DIR ./system-graph Merged graph output directory
GRAPHIFY_IMPACT_THRESHOLD 20 Impact warning threshold
GEMINI_API_KEY Optional: semantic extraction via Gemini

Requirements

  • Bash 4+
  • jq
  • Python 3.8+ (stdlib only, no pip packages)
  • Linux or macOS

AgentStack Ecosystem

Graphify Toolkit is part of AgentStack, five open-source tools for running AI agents in production:

Tool What it does
GuardRail Pre-execution security guards. 172 rules, 96% enforcement.
Model Router Shell-native LLM routing. One config, every model.
NightShift Overnight code improvement. Fixes lint, types, security while you sleep.
Graphify Toolkit Codebase to knowledge graph. You are here.
Autonomie OS Self-improving agent framework. Learns from every session.

Want to learn the principles behind these tools? The free KI-Governance course covers Guards, Routing, Automation, and Autonomy in 18 hands-on lessons.

License

MIT


Built by Prompt & Build.
Used in production: 5 repositories, 3,472 RAG chunks, system-wide graph rebuilt nightly.

If Graphify Toolkit helps you understand your codebase, consider giving it a star. It helps others find it.

About

Multi-repo knowledge graph orchestration — extends graphify with cross-repo merge, impact analysis, CI/CD integration, and Claude Code skill

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages