kg-extract
Original:🇺🇸 English
Translated
Extract entities and relations from source files to build a knowledge graph
6installs
Sourceruvnet/ruflo
Added on
NPX Install
npx skill4agent add ruvnet/ruflo kg-extractTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →KG Extract
Extract entities (classes, functions, modules, types, concepts) and their relations (imports, extends, implements, depends-on, calls) from source files, then store them as a knowledge graph in AgentDB.
When to use
When you need to build or update a knowledge graph from source code or documentation. Useful for understanding codebase structure, dependency analysis, and impact assessment.
Steps
- Scan files -- use and
Globto enumerate and read source files at the given pathRead - Identify entities -- extract classes, functions, modules, types, and config references from each file
- Map relations -- for each entity, determine its relations to other entities:
- : follow import/require statements
imports - : class inheritance
extends - : interface implementations
implements - : constructor dependencies, injected services
depends-on - : function/method invocations
calls - : documentation mentions, comments
references
- Store in AgentDB -- call for each entity with metadata (name, type, file, line, description)
mcp__claude-flow__agentdb_hierarchical-store - Create edges -- call for each relation with source, target, relation type, and weight
mcp__claude-flow__agentdb_causal-edge - Report -- summarize: total entities by type, total relations by type, files scanned
CLI alternative
bash
npx @claude-flow/cli@latest memory store --namespace knowledge-graph --key "entity-NAME" --value "METADATA_JSON"
npx @claude-flow/cli@latest memory search --query "entities in auth module" --namespace knowledge-graph