Skip to main content

graphify-sf

Turn any Salesforce SFDX project into a queryable knowledge graph — fully offline, no org connection required.

graphify-sf parses your local SFDX source directory, extracts every metadata entity (Apex classes, triggers, Flows, Custom Objects, Fields, LWC/Aura components, Profiles, Permission Sets, Layouts, Validation Rules, and more), maps the real relationships between them, and produces an interactive knowledge graph with community detection.

Built for developers and architects who need to understand large Salesforce orgs without clicking through Setup.


Why this exists

Large Salesforce orgs are hard to reason about. The dependencies that matter — which Trigger fires on which Object, which Flow writes to a field an Apex class also reads, which Profile grants access to a class nobody calls anymore — are spread across thousands of XML files and Setup screens. Grep finds strings; it doesn't find relationships.

graphify-sf reads the source you already have on disk and turns it into a graph you can query. It runs fully offline, so you can point it at a client's repo or a regulated org without sending a single byte to Salesforce or anywhere else. Every edge is tagged with how it was found: EXTRACTED means it came straight from the metadata XML and is a fact; INFERRED means it was guessed from source patterns and might be wrong. You always know which is which.

The result is a knowledge graph an architect can explore, an LLM can ground its answers in, and an AI coding agent can navigate instead of grepping blindly through metadata.


Features

  • Fully offline: pure XML/source parsing. No Salesforce CLI, no org connection, no API calls.
  • Honest provenance: every edge is tagged EXTRACTED (from explicit XML) or INFERRED (from source patterns), so you always know which relationships are facts and which are guesses.
  • Reference file support: indexes .md, .txt, .pdf, .xlsx, .docx, and images alongside SF metadata. Headings become sub-nodes, and SF component mentions create cross-reference edges.
  • Community detection: Louvain/Leiden clustering surfaces cross-metadata couplings you wouldn't think to ask about.
  • Interactive HTML visualization: force-directed graph with search, community filtering, and a node inspector.
  • Many export formats: HTML, SVG, Mermaid call-flow, D3 tree, Obsidian vault, GraphML, Cypher/Neo4j, JSON, and Markdown wiki.
  • Change detection: --update rebuilds the graph from scratch (extraction is not incremental, and facts from deleted files are dropped); check-update dry-runs which files changed.
  • Agentic IDE integration: install a /graphify-sf skill into Claude Code, Cursor, Codex, Kiro, Gemini, and 10+ more IDEs.
  • MCP server: expose graph query tools to Claude Desktop and other MCP clients over stdio.
  • File watcher: auto-rebuild on metadata changes with watch.
  • Git-native: a post-commit hook rebuilds automatically, and a merge driver resolves graph.json conflicts.

Quick Start

# Install
pip install graphify-sf

# Or with uv (recommended)
uv tool install graphify-sf

# Build the knowledge graph from your SFDX project
graphify-sf /path/to/sfdx-project

# Open the interactive visualization
open graphify-sf-out/graph.html

On the first run you'll see:

[graphify-sf] scanning /path/to/sfdx-project
[graphify-sf] 847 metadata files found, 0 skipped
[graphify-sf] extracting metadata...
[graphify-sf] extracted 1243 nodes, 3891 edges
[graphify-sf] clustering...
[graphify-sf] 7 communities found
[graphify-sf] wrote graphify-sf-out/GRAPH_REPORT.md
[graphify-sf] wrote graphify-sf-out/graph.json
[graphify-sf] wrote graphify-sf-out/graph.html

[graphify-sf] done
  1243 nodes · 3891 edges · 7 communities

Output Files

File Description
graphify-sf-out/graph.html Interactive force-directed graph — search, filter by community, inspect nodes
graphify-sf-out/graph.json GraphRAG-ready JSON with node/edge provenance, community assignments
graphify-sf-out/GRAPH_REPORT.md Plain-language report: god nodes, surprising connections, suggested questions
graphify-sf-out/manifest.json File hash manifest (used by check-update)
graphify-sf-out/.graphify_sf_labels.json Community label sidecar

Command Reference

Main Pipeline

# Build graph from SFDX project (full scan)
graphify-sf <path>

# Custom output directory (may be inside the project; it is never scanned)
graphify-sf <path> --out my-graph-out

# Build directed graph (edges have source→target direction)
graphify-sf <path> --directed

# Skip HTML visualization (faster, report + JSON only)
graphify-sf <path> --no-viz

# Overwrite graph.json even if new graph has fewer nodes
graphify-sf <path> --force

# Parallel extraction with N workers
graphify-sf <path> --max-workers 8

# Add AI semantic layer (finds business-rule duplication, dead metadata, etc.)
graphify-sf <path> --backend claude
graphify-sf <path> --backend gemini
graphify-sf <path> --backend auto     # auto-detect from available API keys

# Control LLM chunk size (tokens per API call, default: 40000)
graphify-sf <path> --backend gemini --token-budget 20000

Rebuilds and change detection

# Rebuild the graph from scratch (idempotent; deleted files disappear).
# Covers exactly <path>. Refuses (exit 1) if graph.json holds LLM-derived facts
# that this run didn't redo (no --backend); --force overrides.
graphify-sf <path> --update

# Dry-run: list the files changed since the last run
# Exits 1 if changes exist (useful for CI)
graphify-sf check-update <path>

# Re-run community detection on an existing graph (no re-extraction)
graphify-sf cluster-only <path>
graphify-sf cluster-only --no-viz --graph path/to/graph.json

Exploration

# BFS traversal — broad context around a question
graphify-sf query "What fires when an Account is updated?"

# DFS — trace a specific dependency chain
graphify-sf query "AccountTrigger dependencies" --dfs

# Cap response at N tokens (default: 2000)
graphify-sf query "..." --budget 4000

# Shortest path between two metadata nodes
graphify-sf path "AccountService" "Account__c"

# Full node details: type, file, community, degree, all connections
graphify-sf explain "AccountTrigger"

# Filter connections by relation type (shows all matches, no cap)
graphify-sf explain "Account" --relation triggers
graphify-sf explain "Account" --relation queries
graphify-sf explain "Account" --relation invokes

# Detailed graph statistics: type distribution, edge relations, density
graphify-sf stats
graphify-sf stats --graph path/to/graph.json

All exploration commands accept --graph <path> to target a specific graph.json.

Export Formats

# Regenerate the interactive HTML visualization
graphify-sf export html

# D3 v7 collapsible tree — organized by community, hover tooltips
graphify-sf export tree

# Mermaid call-flow diagram — Apex→Object→Trigger dependency chains
graphify-sf export callflow-html

# Static SVG graph image (dark theme, community colors, degree-sized nodes)
# Requires: pip install graphify-sf[svg]
graphify-sf export svg

# Obsidian vault — one note per node + community overview notes
graphify-sf export obsidian

# GraphML — open in Gephi, yEd, Cytoscape
graphify-sf export graphml

# Neo4j Cypher statements (writes cypher.txt)
graphify-sf export cypher

# Push directly to a running Neo4j instance
# Requires: pip install graphify-sf[neo4j]
graphify-sf export neo4j --push \
  --uri bolt://localhost:7687 \
  --user neo4j \
  --password mypassword

# Agent-crawlable Markdown wiki (one .md per community)
graphify-sf export wiki

# Re-export clean graph.json
graphify-sf export json

# All formats accept --graph and --out:
graphify-sf export html --graph path/to/graph.json --out output-dir/

Merging Graphs

# Merge two or more graph.json files into one
# Deduplicates nodes by label, re-clusters, regenerates report + HTML
graphify-sf merge-graphs a/graph.json b/graph.json --out merged/graph.json
graphify-sf merge-graphs g1.json g2.json g3.json --out combined.json --no-viz

LLM Semantic Extraction

The --backend flag adds an AI-powered extraction layer on top of the static XML/source parser. The LLM finds relationships that static parsing cannot see:

What it finds Example
Business rule duplication Same validation in Apex class AND Flow (both enforce a required field)
Semantic equivalence Two Profiles granting nearly identical Object/Field access
Implicit data couplings Apex writes to Object A; Flow reads from Object A (no XML edge between them)
Dead metadata Profile grants access to Apex class that is never called by any Trigger/Flow
Trigger-bypass risk Bulk utility using Database.insert outside trigger context

Supported Backends

Backend Flag API Key env var Default model Price per 1M tokens (in / out)
Claude --backend claude ANTHROPIC_API_KEY claude-sonnet-4-6 $3.00 / $15.00
Gemini --backend gemini GEMINI_API_KEY or GOOGLE_API_KEY gemini-3.6-flash $0.75 / $3.75
Kimi --backend kimi MOONSHOT_API_KEY kimi-k3 $3.00 / $15.00
OpenAI --backend openai OPENAI_API_KEY gpt-6-luna $0.10 / $0.50
AWS Bedrock --backend bedrock AWS_PROFILE / AWS_REGION us.anthropic.claude-sonnet-4-6 $3.30 / $16.50
Ollama (local) --backend ollama OLLAMA_BASE_URL qwen2.5-coder:7b free
Auto-detect --backend auto (first found) — varies

Prices mirror BACKENDS in graphify_sf/llm.py, which the CLI also uses for its cost estimates. The estimates assume the default model, even if you override it. Gemini 3.x, Kimi K3 and OpenAI's gpt-6-luna reason, and their thinking tokens are billed as output (for gpt-6-luna the request sets reasoning_effort=low and omits temperature; both choices, and the price, are taken from OpenAI's documentation and not verified against the live API; a model that rejects either parameter is retried once without it and remembered for the rest of the run). Set GRAPHIFY_SF_OPENAI_MODEL=gpt-4.1-mini to keep the old model until its 2027-01-14 shutdown. The Bedrock default is a US geo inference profile: outside US regions, set GRAPHIFY_SF_BEDROCK_MODEL (e.g. eu.anthropic.claude-sonnet-4-6 or global.anthropic.claude-sonnet-4-6). Gemini, Kimi, OpenAI and Bedrock defaults can be overridden with the model variables below (Ollama via OLLAMA_MODEL). The Claude model is fixed, and the CLI has no --model flag.

Install the SDK

# Claude
pip install graphify-sf[claude]

# Gemini, Kimi, OpenAI, Ollama (all use the openai SDK)
pip install graphify-sf[gemini]   # or [kimi], [openai], [ollama]

# AWS Bedrock
pip install graphify-sf[bedrock]

# Claude + all OpenAI-compat backends
pip install graphify-sf[llm]

Environment Variables

Variable Description
ANTHROPIC_API_KEY Claude API key
GEMINI_API_KEY / GOOGLE_API_KEY Gemini API key
MOONSHOT_API_KEY Kimi API key
OPENAI_API_KEY OpenAI API key
AWS_PROFILE / AWS_REGION AWS credentials for Bedrock
OLLAMA_BASE_URL Ollama server URL (default: http://localhost:11434/v1)
OLLAMA_MODEL Ollama model name (default: qwen2.5-coder:7b)
GRAPHIFY_SF_GEMINI_MODEL Override Gemini model
GRAPHIFY_SF_KIMI_MODEL Override Kimi model (e.g. kimi-k2.6; K2.x runs with thinking disabled)
GRAPHIFY_SF_OPENAI_MODEL Override OpenAI model
GRAPHIFY_SF_BEDROCK_MODEL Override Bedrock model
GRAPHIFY_SF_MAX_OUTPUT_TOKENS Override max output tokens per LLM call
GRAPHIFY_SF_API_TIMEOUT Override API timeout in seconds (default: 600)

Agentic IDE Integration

Install a /graphify-sf skill that lets any supported AI coding assistant run the full pipeline and explore the graph through natural language.

Zero-dependency install via npx (no Python required)

Uses the open agent skills ecosystem, which works across 55+ AI coding agents.

# Install globally (all projects)
npx skills add raykuonz/graphify-sf

# Install for this project only
npx skills add raykuonz/graphify-sf --project

The skill instructs your agent to run graphify-sf via uvx or pipx run on demand, so no permanent Python install is needed.

Install via Python CLI

graphify-sf install
# Installs to ~/.claude/skills/graphify-sf/SKILL.md

Install for a specific platform

graphify-sf install --platform cursor    # Cursor → .cursor/skills/graphify-sf/SKILL.md
graphify-sf install --platform codex     # OpenAI Codex
graphify-sf install --platform kiro      # AWS Kiro
graphify-sf install --platform gemini    # Google Gemini CLI
graphify-sf install --platform aider     # aider
graphify-sf install --platform copilot   # GitHub Copilot
graphify-sf install --platform opencode  # OpenCode

Supported platforms: antigravity, aider, claude, codex, copilot, cursor, droid, gemini, hermes, kimi, kiro, opencode, pi, trae, trae-cn

Project-scoped install (this project only)

graphify-sf install --scope project

Use --link to write a single canonical skill file to .agents/skills/graphify-sf/SKILL.md and create a symlink from the platform-specific path to it. This means upgrading graphify-sf and re-running install --link once updates every symlinked IDE at the same time, with no per-platform reinstalls.

# Write canonical to .agents/skills/graphify-sf/SKILL.md,
# symlink from ~/.claude/skills/graphify-sf/SKILL.md
graphify-sf install --link

# Same for another IDE
graphify-sf install --link --platform gemini
graphify-sf install --link --platform kiro --scope project

Symlink strategy:

  • Project scope (--scope project): relative symlink — stays valid if the project directory is moved
  • Global scope (default): absolute symlink — stays valid regardless of working directory

Platforms that natively use .agents/ (codex, antigravity): no symlink is created — .agents/skills/graphify-sf/SKILL.md is already their install target, so they share the canonical file directly.

Cursor note: Cursor discovers skills from both .cursor/skills/ and .agents/skills/. When --link is used, the canonical file lands in .agents/skills/graphify-sf/SKILL.md, and Cursor picks it up from there automatically — the symlink to .cursor/skills/ is an optional convenience if you want an explicit entry there too.

Uninstall

graphify-sf uninstall
graphify-sf uninstall --platform cursor --scope project

Update / reinstall after upgrading graphify-sf

The install command is idempotent. Re-running it always overwrites the existing skill file with the latest version bundled in the package:

# 1. Upgrade the package
pip install --upgrade graphify-sf
# or: uv tool upgrade graphify-sf

# 2. Refresh the installed skill
graphify-sf install

For a specific platform or scope, pass the same flags used during the original install:

graphify-sf install --platform cursor --scope project

If you used --link when installing, a single re-run updates the canonical file and all symlinked IDEs pick it up automatically, with no per-platform reinstalls:

graphify-sf install --link          # re-writes .agents/skills/graphify-sf/SKILL.md; all symlinks follow

Always-on: register in AGENTS.md (all agents)

Write mandatory enforcement rules to AGENTS.md so every AI coding agent (Claude Code, Codex, Cursor, Kiro, Gemini CLI, aider, Copilot, etc.) automatically uses the graph instead of grep:

# Write ./AGENTS.md enforcement block (always project-scoped)
graphify-sf agents install

# Remove
graphify-sf agents uninstall

The written block instructs agents to:

  • Read graphify-sf-out/GRAPH_REPORT.md before answering metadata questions
  • Navigate the wiki instead of reading raw metadata files
  • Use graphify-sf query instead of grep/find on metadata files
  • Run graphify-sf . --update --no-viz after modifying metadata files

Always-on: register in CLAUDE.md (Claude Code only)

# Global ~/.claude/CLAUDE.md
graphify-sf claude install

# Project-level ./CLAUDE.md
graphify-sf claude install --scope project

# Remove
graphify-sf claude uninstall

Using the skill

Once installed, type /graphify-sf in your AI coding assistant. The skill will:

  1. Detect your SFDX metadata files
  2. Extract, build, cluster, and report
  3. Present god nodes, surprising connections, and suggested questions
  4. Offer to trace the most interesting question through the graph

Git Integration

Post-commit hook — auto-rebuild on commit

# Install: rebuilds graph after any commit that touches metadata files.
# Run it again after upgrading graphify-sf: it refreshes the installed hook in place
# and leaves everything else in your hook files alone.
graphify-sf hook install

# Remove
graphify-sf hook uninstall

# Check status
graphify-sf hook status

The hook installs both post-commit and post-checkout hooks:

  • post-commit — diffs HEAD~1..HEAD, triggers rebuild only when Apex, Visualforce, *-meta.xml or LWC/Aura bundle files changed
  • post-checkout — triggers rebuild on branch switches (when graphify-sf-out/ exists)

Both hooks run rebuilds in the background (nohup ... & disown) so git commit and git checkout return immediately. Rebuild log (appended to; moved to .log.1 once it passes 1 MiB): ~/.cache/graphify-sf-rebuild.log. Runs that write to the same output directory take turns: a second run waits for the first (see GRAPHIFY_SF_LOCK_TIMEOUT).

Both hooks skip during rebase, merge, and cherry-pick. The _hooks_dir() respects core.hooksPath (Husky/Lefthook compatibility).

Merge driver — conflict-free graph.json merges

When two branches both modify graph.json, a normal git merge produces a JSON conflict. The graphify-sf merge driver performs a 3-way merge instead: a node or edge is kept when both branches have it or when one branch added it, and removed when the common ancestor had it and either branch dropped it (attributes merge per attribute, and the ancestor never wins). The result is re-clustered. An unreadable or malformed graph.json on either side makes the driver fail, so git reports a conflict instead of recording a graph with everything deleted (a missing or empty ancestor is treated as no ancestor, a plain union). merge-graphs likewise refuses a malformed input instead of treating it as empty:

# Install (configures .gitattributes + .git/config)
graphify-sf merge-driver install

# Uninstall
graphify-sf merge-driver uninstall

After installation, git calls graphify-sf merge-driver run %O %A %B automatically on graph.json conflicts.


File Watcher

Auto-rebuild the graph whenever metadata files change:

# Watch current directory, rebuild on any .cls/.trigger/.flow-meta.xml/... change
graphify-sf watch .

# Custom output directory and debounce (seconds to wait after last change)
graphify-sf watch /path/to/project --out my-out --debounce 5

# Also regenerate graph.html on each rebuild (slower)
graphify-sf watch . --viz

# Build directed graph on rebuild
graphify-sf watch . --directed

If watchdog is installed (pip install graphify-sf[watch]), uses efficient FS events. Otherwise falls back to polling every 5 seconds with a notice.

The watcher runs an initial full build if no graph.json exists, then a full --update rebuild on each detected change.


MCP Server

Expose the graph as a set of tools to any MCP-compatible client (Claude Desktop, Cursor MCP, etc.) over stdio JSON-RPC 2.0:

graphify-sf serve
graphify-sf serve --graph path/to/graph.json

Available tools:

Tool Description
graph_stats Node/edge/community counts, community labels, top sf_types, and the analysis coverage ledger (analysis, capabilities; null for graphs built before 0.6.0)
query BFS or DFS traversal for a natural-language question
get_node Full details for a single node (type, file, degree, all neighbors)
get_neighbors Connections of a node (up to N, sorted by degree, optional relation_filter)
shortest_path Shortest path between two named metadata nodes
god_nodes Highest-degree nodes — the most central metadata in the org
list_communities All communities with their labels and member counts
get_community All members of a specific community (by id or label)
bfs_impact Bounded, direction-aware impact traversal (forward/reverse/both, max_depth, relation_filter, EXTRACTED-only unless include_inferred)

Available resources (via resources/list and resources/read):

Resource URI Description
graphify-sf://report Full GRAPH_REPORT.md as text/markdown
graphify-sf://stats Graph statistics JSON
graphify-sf://god-nodes Top 20 god nodes JSON
graphify-sf://surprises Surprising cross-community connections JSON
graphify-sf://audit EXTRACTED/INFERRED/AMBIGUOUS edge breakdown
graphify-sf://questions Suggested exploration questions JSON

Claude Desktop configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "graphify-sf": {
      "command": "graphify-sf",
      "args": ["serve", "--graph", "/path/to/your/project/graphify-sf-out/graph.json"]
    }
  }
}

CI/CD Integration

Check for stale graph before a build

# GitHub Actions example
- name: Check if graph needs update
  run: graphify-sf check-update . --out graphify-sf-out
  # Exits 0 = graph is current, exits 1 = changes detected

Rebuild on metadata changes

- name: Rebuild knowledge graph
  run: graphify-sf . --update --no-viz --force

Check-update pattern (conditional rebuild)

graphify-sf check-update . || graphify-sf . --update --no-viz

Supported Metadata Types

sf_type Source What it extracts
ApexClass .cls Class name, methods, SOQL queries, DML, callouts, extends/implements
ApexTrigger .trigger Trigger name, target object, DML events, handler class references
ApexMethod .cls Individual method signatures within a class
Flow .flow-meta.xml Flow name, referenced objects, fields, called subflows
CustomObject .object-meta.xml Object name, fields, validation rules, record types
CustomField .field-meta.xml Field name, type, lookup targets
ValidationRule *-meta.xml Rule name, parent object, formula references
RecordType *-meta.xml Record type name, parent object
Layout .layout-meta.xml Layout name, referenced fields and objects
LWCBundle lwc/*/ Component name, imported Apex controllers, child components
AuraBundle aura/*/ Component name, Apex controller references
Profile .profile-meta.xml Profile name, object/field/class permissions
PermissionSet .permissionset-meta.xml Permission set name, granted permissions
CustomLabel .labels-meta.xml Label names
NamedCredential .namedCredential-meta.xml Credential name, endpoint
ExternalService .externalServiceRegistration-meta.xml Service name, the Named Credential it uses (namedCredentialReference or namedCredential; also accepts the legacy .externalService-meta.xml)
Bot .bot-meta.xml Agentforce agent definition — label, bot user
BotVersion .botVersion-meta.xml Agent version — links to orchestrator flow, topics, planner
GenAiPlugin .genAiPlugin-meta.xml Agentforce Topic — groups actions, contains GenAiFunctions
GenAiFunction .genAiFunction-meta.xml Agentforce Action — invokes an Apex class or Flow
GenAiPlannerBundle .genAiPlannerBundle-meta.xml Agent planner — maps to sub-agent topics
AiAuthoringBundle .aiAuthoringBundle-meta.xml Authoring container linking Bot to BotVersion
PromptTemplate .promptTemplate-meta.xml AI prompt template — primary object, flex action references

Edge Relations

relation Meaning
triggers Apex trigger fires on DML events for this object
queries Apex performs SOQL query on this sObject
dml Apex performs insert/update/delete/upsert on this object
calls Apex class/method calls another class/method
references Flow, Layout, or Profile references this metadata
contains Parent contains child (Object→Field, Class→Method)
extends Apex class extends a superclass
implements Apex class implements an interface
invokes Flow calls a subflow, or Agentforce action calls an Apex class / Flow
makes_callout Apex class/trigger or Flow calls a Named Credential, External Service or external host (see below)

Integration endpoints and the coverage ledger

makes_callout edges run from an Apex class, Apex trigger or Flow HTTP callout action to a NamedCredential, an ExternalService or an ExternalEndpoint node. A Flow's HTTP Callout is an externalService action: the Flow gets an edge to the service and, when the service's registration is in the repo, a second edge to its Named Credential with via_external_service. The edge says how sure the tool is:

  • EXTRACTED: the target is proven by the source. setEndpoint('callout:Acme_NC/v1'), a static final String constant of the same file plus a path, 'callout:Acme' + '_ERP', a literal https://host/..., or a Flow's callout:Name.
  • INFERRED with an inference_reason: dynamic_suffix / non_final_static ('callout:Acme' + env: the suffix could extend the name), receiver_unproven (the type of the object calling setEndpoint is not visible), host_id_collision (two hosts share one node id).
  • No edge: a partial host ('https://api' + sub), an argument the resolver does not model (a method call, a ternary, a shadowed name), or an object declared as a type other than HttpRequest.

Edges carry site_count (call sites merged into the edge), source_location (first line, or the Flow action name) and test_context: true when every site is inside @IsTest code. A callout target whose metadata is not in the repo is a stub node (stub: true, no source_file); a real node always replaces a stub.

graph.json also carries a top-level graphify_sf block saying which analyses ran:

"graphify_sf": {
  "version": "0.6.0",
  "analysis": {"callout-edges.apex": {"status": "complete", "eligible": 120, "analyzed": 120, "failed": 0, "sites": 14, "unresolved": 2}},
  "capabilities": ["callout-edges.apex", "callout-edges.flow-http"]
}

status is complete when no file failed, partial or failed otherwise, and not_run when the analyzer did not run (a merged graph carries statuses only). capabilities lists the complete analyzers. A graph without the block was never analysed. unresolved counts call sites that did not reach a credential or host, so when it is above zero read "nothing calls this endpoint" as a candidate, not a fact. graphify-sf stats and the MCP graph_stats tool show the ledger.


Reference File Support

graphify-sf indexes non-Salesforce reference files that live alongside your SFDX metadata (design docs, data dictionaries, architecture notes, and more) and cross-references them against SF component names found in the graph.

File type Extensions What is extracted Library required
Document .md, .mdx, .txt, .rst, .html H1/H2/H3 headings as sub-nodes; SF name mentions → references edges (none — base install)
Image .png, .jpg, .jpeg, .gif, .webp, .svg Metadata node only (none — base install)
PDF .pdf Full text extracted; SF name mentions → references edges graphify-sf[docs]
Word doc .docx Converted to Markdown sidecar in graphify-sf-out/converted/; then processed as Document graphify-sf[docs]
Spreadsheet .xlsx Converted to Markdown sidecar; structural nodes (workbook → sheet → named table → column) graphify-sf[docs]

SF component mention detection uses a heuristic regex (PascalCase identifiers and names ending in __c, __r, __mdt, etc.). Mention edges are tagged INFERRED and resolved to real SF node IDs in the cross-reference pass; unresolved mentions are silently dropped.

If the required library is not installed, the file is skipped with a warning. The pipeline never crashes because of a missing optional dependency.


Configuration

All configuration via environment variables:

Variable Default Description
GRAPHIFY_SF_OUT graphify-sf-out Default output directory
GRAPHIFY_SF_VIZ_NODE_LIMIT 5000 Max nodes before HTML viz switches to aggregated community view
GRAPHIFY_SF_FORCE `` Set to 1/true to always overwrite graph.json
GRAPHIFY_SF_LOCK_TIMEOUT 900 Seconds a run waits for another run that is writing to the same output directory before giving up (exit 1)
GRAPHIFY_SF_NONATOMIC_WRITE `` Set to 1/true to let graphify-sf write graph.json in place when it is a bind-mounted single file (Docker -v host/graph.json:/out/graph.json) and cannot be replaced. Not crash-safe; mounting the output directory is better
GRAPHIFY_SF_REBUILD_MEMORY_LIMIT_MB `` Cap memory usage for background watch rebuilds (MB)
CLAUDE_CONFIG_DIR ~/.claude Override Claude Code config directory — only set if your Claude Code config lives at a non-standard path (company-managed dotfiles, CI, or multiple installations)

Ignoring files (.gitignore, .forceignore, .graphifysfignore)

By default graphify-sf respects your project's .gitignore and .forceignore so that deprecated metadata, __tests__, queues, editor/lint scaffolding, and build output don't become noise in the graph. Patterns use full gitignore semantics (negation !keep, anchored /foo, directory foo/, **), parsed with pathspec — the same way git and the sf CLI read them. The ignore files are found by walking up from the path you scan, so graphify-sf force-app still honors the .gitignore/.forceignore at your project root.

After a scan, any skipped files are reported honestly:

[graphify-sf] 5573 metadata files found, 57 skipped
[graphify-sf] skipped 57 files (.forceignore: 57) — use --include-ignored to include them

To scan everything regardless of .gitignore/.forceignore (e.g. you suspect a real metadata file was excluded):

graphify-sf <path> --include-ignored

.graphifysfignore

For graphify-specific exclusions independent of git/SF, place a .graphifysfignore file at your project root (glob patterns, always applied):

# Exclude test data
force-app/test/**
# Exclude archived components
force-app/archived/**
*.bak

Optional Extras

# Better community detection (Leiden algorithm via graspologic-native)
pip install graphify-sf[leiden]

# Neo4j direct push support
pip install graphify-sf[neo4j]

# SVG/PNG graph image export
pip install graphify-sf[svg]

# Watchdog for efficient file-system events in watch mode
pip install graphify-sf[watch]

# MCP server — no extra needed (`graphify-sf serve` is self-contained);
# kept as an empty alias so existing install commands still work
pip install graphify-sf[mcp]

# LLM semantic extraction — Claude
pip install graphify-sf[claude]

# LLM semantic extraction — Gemini / Kimi / OpenAI / Ollama (all use openai SDK)
pip install graphify-sf[gemini]

# LLM semantic extraction — AWS Bedrock
pip install graphify-sf[bedrock]

# LLM semantic extraction — Claude + all OpenAI-compat backends
pip install graphify-sf[llm]

# Reference file support (PDF, Word, Excel alongside SFDX metadata)
pip install graphify-sf[docs]

# Everything
pip install graphify-sf[all]

Requirements

  • Python 3.11+
  • No Salesforce CLI, no org connection, no API keys
  • Core dependencies: networkx, pathspec, idna

Maturity & limitations

Read this before you trust the graph in anger. graphify-sf is honest about what it knows for sure and what it's guessing at.

What's solid

  • The test suite is real. 280 unit tests cover detection, every extractor, graph assembly, clustering, the report, exports, and the security helpers. Extractors are tested against real metadata fixtures, not mocks of themselves.
  • EXTRACTED edges are facts. Anything tagged EXTRACTED came directly from the metadata XML (a Trigger's target object, a Flow's referenced fields, a Lookup field's target). If the source says it, the graph says it.

What's a heuristic, not a fact

  • INFERRED edges are guesses. They come from pattern-matching source code and prose, not declared metadata. They can be wrong. The provenance tag exists precisely so you can filter them out when you need certainty — check the EXTRACTED/INFERRED breakdown in the report before betting on an inferred relationship.
  • Callout edges are static. makes_callout reads literals, same-file constants and + concatenation. Anything computed at runtime (a custom setting, a method result, another class's constant) is not resolved, and unresolved in the coverage ledger counts those sites. Named Credentials and external hosts that exist only in the org appear as stubs.
  • Apex calls edges are noisy. Resolving Foo.bar() to the right Apex class from source alone is genuinely hard. A heuristic filters out obvious local-variable calls and cuts the false-positive rate from roughly 96% to roughly 36%, but a third of the remaining calls edges may still be spurious. Treat call graphs as a lead, not a proof.
  • Reference-file mention detection is regex-based. Cross-references from docs/PDFs/spreadsheets to SF components rely on a PascalCase/__c heuristic. It misses lowercase or unconventional names and can match coincidental words; unresolved mentions are dropped silently.
  • Community detection is unsupervised. Louvain (and optional Leiden) cluster the graph by structure. The communities are a useful lens, not ground-truth modules — and Louvain results vary slightly between runs.

The LLM layer is optional and non-deterministic

  • The --backend semantic layer asks an LLM to find couplings static parsing can't see. Its findings are judgments, not measurements: two runs can disagree, and it can hallucinate a relationship that isn't there. Read what it surfaces; don't paste it into an audit unchecked. The entire core pipeline works with no LLM at all.

Scope

  • One SFDX source tree at a time. Multi-org or multi-repo analysis is done by building each separately and using merge-graphs.
  • Static only. graphify-sf reads source and metadata. It does not connect to an org, so it can't see runtime config, data, or anything that only exists in the live org rather than in the repo.

Architecture

graphify_sf/
├── detect.py       File scanner — classifies .cls/.trigger/.flow-meta.xml/... files + doc/paper/image types
├── extract/        Per-type extractors — Apex, Flow, Object, LWC, Aura, Profile, Agentforce, ...
│   └── doc.py      Document extractor — headings, SF mentions, xlsx structure, PDF/image nodes
├── build.py        Graph construction — node/edge deduplication, merge strategies
├── cluster.py      Community detection — Louvain (default) or Leiden (optional)
├── analyze.py      Graph analysis — god nodes, surprising connections, question generation
├── report.py       GRAPH_REPORT.md generation
├── export.py       All export formats — HTML, SVG, Obsidian, GraphML, Cypher, wiki, ...
├── llm.py          LLM semantic extraction — 6 backends, SF-specific prompt, adaptive retry
├── watch.py        File-system watcher — fcntl rebuild lock, resource limits, callflow regen
├── serve.py        MCP stdio server — 9 tools, 6 resources, blank-stdin filter
├── validate.py     Extraction schema validation — catches bad extractors before graph assembly
├── security.py     Input sanitization — sanitize_label, validate_graph_path
└── __main__.py     CLI entry point — all command dispatch

Changelog

v0.3.0

Edge extraction improvements

  • Record-Triggered Flows now emit triggers edges to the target object with EXTRACTED confidence
  • Flows emit invokes edges for subflow references and calls edges for Apex action calls
  • Custom Fields emit references (Lookup) and master_detail (MasterDetail) edges to target objects
  • ValidationRule formula fields emit INFERRED references edges to the fields they reference
  • Agentforce: GenAiPlannerBundle local actions parsed as inline GenAiFunction nodes; conversationDefinitionPlanners XML path supported for BotVersion planner references; PromptTemplate flexTemplateActionCalls create reference edges
  • build.py exports _resolve_apex_calls, _derive_object_edges, and _ensure_stub_nodes for use in the extract pipeline

Bug fixes

  • Fixed: standard-object edges (Lead, Account, etc.) were incorrectly downgraded from EXTRACTED to INFERRED confidence because _ensure_stub_nodes ran after _resolve_cross_references; ordering is now correct
  • Fixed: Apex calls edges had ~96% false-positive rate from local variable method calls; new _looks_like_apex_class() heuristic reduces noise to ~36%

Tests

  • 65 new tests → 268 total (up from 203)
  • New test_extract_pipeline.py with regression test for the stub-node ordering fix

v0.2.0

  • Reference file support: .md, .txt, .pdf, .xlsx, .docx, and images indexed alongside SF metadata
  • Headings become sub-nodes; SF component mentions create cross-reference edges
  • .[docs] extra for PDF/Word/Excel parsing

v0.1.0

  • Initial release: Apex, Flow, Object, LWC, Aura, Profile, Permission Set, Agentforce metadata extraction
  • NetworkX graph with Louvain community detection
  • HTML, JSON, Obsidian, GraphML, Cypher, SVG, Mermaid export formats
  • Change detection via SHA-256 manifest (check-update)
  • MCP stdio server, file watcher, git hooks

License

MIT

Metadata

Release files for graphify-sf 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphify-sf 0.6.1
File Size Uploaded Provenance Actions
graphify_sf-0.6.1.tar.gz 303.2 kB With provenance Details for graphify_sf-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graphify-sf 0.6.1
File Interpreter ABI Platform Actions
graphify_sf-0.6.1-py3-none-any.whl Python 3 none any Details for graphify_sf-0.6.1-py3-none-any.whl

Total release size: 492.6 kB

Release files / graphify_sf-0.6.1.tar.gz

Download URL graphify_sf-0.6.1.tar.gz
Size 303.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3dfddb585e182ebb707dc9f70eb12b03576414e93fa036c5e0a98bb2d7759c11
BLAKE2b-256 checksum
How to use checksums
a76526fa49ef9d0839d5ef7ab156211a6249261156e845873e696960def61f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / graphify_sf-0.6.1-py3-none-any.whl

Download URL graphify_sf-0.6.1-py3-none-any.whl
Size 189.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6402683836fafda60bd7aa8ce37b4fe9bc4749ffc0daf84247111478438f6ed0
BLAKE2b-256 checksum
How to use checksums
5333fe118243699cf0366bd261b474c680488a6db548f6d9e83509edab4037f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for graphify-sf 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for graphify_sf-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page