graphify-integration
Skill56 starsChanged 8 months agoMITView on GitHub
Graph-aware planning and research using codebase knowledge graphs — enables architecture-aware task decomposition, dependency discovery, and context reduction
- Installs packages
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- backpropagationSkill
- brainstormingSkill
- caveman-internalSkill
- collaboratingSkill
- design-systemSkill
- executingSkill
- karpathy-guardrailsSkill
- planningSkill
- reviewingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 16 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Never block on graph availability.
- Very specific: line 61
When a knowledge graph is available, the forge-planner agent gains these capabilities:
- Distinctive: line 65
Before decomposing specs into tasks, query the graph to understand the codebase structure:
- Distinctive: line 87
Add dependency edges to the task DAG that the spec alone would miss
- Distinctive: line 100
Instead of loading the full codebase context for each task, query the graph for the relevant subgraph:
- Distinctive: line 115
Before researching external docs, query the graph to understand what already exists:
- Distinctive: line 124
Before implementing a change, query the graph for blast radius:
- Distinctive: line 155
Verify that changes respect architectural boundaries:
- Distinctive: line 162
If a task modifies files in multiple communities without explicit cross-cutting justification, flag for review.
- Distinctive: line 169
Use community boundaries to inform task grouping
- Distinctive: line 170
Use node connectivity to inform tier ordering
- Distinctive: line 171
Add graph-discovered dependencies to the frontier DAG
- Distinctive: line 175
Use graph paths for impact analysis
- Distinctive: line 180
Verify changes respect community boundaries
- Distinctive: line 185
Use graph to find template implementations in the same community
- Distinctive: line 186
Verify no unintended cross-community modifications
- Distinctive: line 212
All graph-enhanced features are additive.
- Very specific: line 218
No Forge workflow should ever fail because graphify is unavailable.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Graphify Integration Skill
This skill enables Forge to leverage codebase knowledge graphs for architecture-aware planning and research. When a graphify knowledge graph exists (or can be generated), Forge agents use it to understand code structure, discover dependencies, prioritize tasks, and reduce context size.
Prerequisites
Graphify integration is optional but recommended for projects with:
- 20+ source files
- Multiple modules or packages
- Cross-component dependencies
- Unfamiliar codebases (new contributor scenario)
Installation
Graphify is bundled as part of Forge's tool ecosystem. Install via:
pip install graphifyyOr use /forge setup-tools which detects and offers to install graphify automatically.
Detection and Auto-Build
At the start of /forge plan or /forge execute, the commands auto-detect and build:
# Check if graphify is installed
node scripts/forge-tools.cjs graph-status
# If installed and no graph exists, build one automatically
node scripts/forge-tools.cjs graph-build --project-dir .
# Extract summary for planning context (god nodes, communities, stats)
node scripts/forge-tools.cjs graph-summary --graph graphify-out/graph.jsonThe build runs graphify . which processes the codebase through: detect -> extract (tree-sitter AST) -> build (NetworkX) -> cluster (Leiden) -> analyze -> export. Output goes to graphify-out/ (graph.json, graph.html, GRAPH_REPORT.md).
Never block on graph availability. If graphify is not installed or the build fails, all commands proceed with standard behavior.
CLI Commands
Agents use these node one-liners to query the graph (no Python needed at query time):
| Command | Purpose |
graph-status | Check if graphify CLI is installed |
graph-build --project-dir . | Build knowledge graph from codebase |
graph-summary --graph graphify-out/graph.json | Get god nodes, communities, stats |
graph-query --graph graphify-out/graph.json --term "auth" | Search for nodes matching a term |
graph-dependents --graph graphify-out/graph.json --file "src/auth.ts" | Find all files that depend on a file |
Graph-Enhanced Planning
When a knowledge graph is available, the forge-planner agent gains these capabilities:
1. Architecture-Aware Task Decomposition
Before decomposing specs into tasks, query the graph to understand the codebase structure:
Query: "What are the main architectural components?"
Result: god nodes (highest-connectivity concepts), community clustersUse this to:
- Align task boundaries with existing module boundaries (communities)
- Identify god nodes (core abstractions) that many tasks will touch -- these need careful ordering
- Detect cross-cutting concerns that affect multiple communities
2. Dependency Discovery
Query the graph to find implicit dependencies not obvious from the spec:
Query: "What depends on {module}?"
Result: downstream consumers, shared utilities, integration pointsUse this to:
- Add dependency edges to the task DAG that the spec alone would miss
- Identify tasks that should be in earlier tiers because they affect shared infrastructure
- Flag tasks that touch god nodes as higher risk (more potential blast radius)
3. Task Prioritization by Connectivity
Rank tasks by the connectivity of the code they modify:
- Tasks touching god nodes (high-degree concepts) go in earlier tiers
- Tasks in isolated communities (low cross-cluster edges) can safely run in parallel
- Bridge tasks (connecting two communities) need careful dependency ordering
4. Context Reduction for Executors
Instead of loading the full codebase context for each task, query the graph for the relevant subgraph:
Query: "Show everything related to {task-target} within depth 3"
Result: relevant nodes, edges, and source filesThis provides the executor with a focused context window containing only the files and relationships relevant to their task, rather than the entire codebase.
Graph-Enhanced Research
The forge-researcher agent can use the graph to:
1. Pre-Implementation Architecture Scan
Before researching external docs, query the graph to understand what already exists:
Query: "Explain {concept}"
Result: all connections to the concept -- what it depends on, what depends on it, which community it belongs to2. Impact Analysis
Before implementing a change, query the graph for blast radius:
Query: "Path from {source} to {target}"
Result: shortest path through the dependency graph, revealing hidden coupling3. Pattern Discovery
Identify how similar patterns are already implemented in the codebase:
Query: "Show nodes similar to {pattern} in community {N}"
Result: related implementations that can serve as templatesGraph-Enhanced Review
The forge-reviewer agent can use the graph to:
1. Blast Radius Verification
Cross-reference modified files against the graph to find all downstream consumers:
Query: "What depends on {modified-file}?"
Result: all files and concepts that consume exports from the modified file2. Community Boundary Checks
Verify that changes respect architectural boundaries:
Query: "Which community does {file} belong to?"
Result: community assignment, cohesion score, bridge statusIf a task modifies files in multiple communities without explicit cross-cutting justification, flag for review.
Integration Points
In forge-planner (planning phase)
- Load
graphify-out/graph.jsonif it exists - Extract god nodes and community structure
- Use community boundaries to inform task grouping
- Use node connectivity to inform tier ordering
- Add graph-discovered dependencies to the frontier DAG
In forge-researcher (research phase)
- Query graph for existing implementations before external research
- Use graph paths for impact analysis
- Include graph context in research reports under "Codebase Architecture (Graph)"
In forge-reviewer (review phase)
- Query graph for blast radius analysis
- Verify changes respect community boundaries
- Include graph-based dependency count in review output
In forge-executor (execution phase)
- Query graph for focused context (relevant files only)
- Use graph to find template implementations in the same community
- Verify no unintended cross-community modifications
Graph Data Format
Graphify produces graph.json in NetworkX node-link format:
{
"nodes": [
{"id": "node-1", "label": "UserService", "type": "class", "community": 0, "source": "src/services/user.ts:15"},
...
],
"links": [
{"source": "node-1", "target": "node-2", "type": "DEPENDS_ON", "confidence": "EXTRACTED"},
...
]
}Key fields:
community: Leiden algorithm cluster ID (group related concepts)confidence: EXTRACTED (explicit), INFERRED (deduced), AMBIGUOUS (uncertain)type: Relationship type (DEPENDS_ON, IMPLEMENTS, EXTENDS, CALLS, IMPORTS)
Graceful Degradation
All graph-enhanced features are additive. When no graph is available:
- Planning falls back to spec-only decomposition (current behavior)
- Research falls back to codebase grep + external docs (current behavior)
- Review falls back to manual blast radius analysis (current behavior)
- Execution falls back to full codebase context (current behavior)
No Forge workflow should ever fail because graphify is unavailable.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

