Agent skill

Kg Extract

by ruvnet in ruvnet/ruflo

Extract entities and relations from source files to build a knowledge graph

MITAuto-check: notesKnowledge Management

Install Kg Extract

skills CLI
$ npx skills add ruvnet/ruflo --skill kg-extract -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ruvnet/ruflo kg-extract --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ruvnet/ruflo.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/ruflo-knowledge-graph/skills/kg-extract .claude/skills/kg-extract && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
kg-extract
GitHub stars
74k
Token cost
~751 tokens
SKILL.md length
262 words
Files
1
Skills in repo
264
Repo updated
First seen
Licence
MIT

At a glance

Extract entities and relations from source files to build a knowledge graph

  • Works in 6 steps: Scan files -- use Glob and Read to… → Identify entities -- extract classes,… → Map relations -- for each entity,… → …
  • Tasks that involve Knowledge graphs
  • SKILL.md covers When to use, Steps and CLI alternative
  • Calls npx

What it does

Kg Extract is an agent skill from ruvnet/ruflo. Extract entities and relations from source files to build a knowledge graph

Its SKILL.md is about 750 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Knowledge Management, covering Knowledge graphs. The repository describes itself as: 🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory…. The licence is MIT.

When your agent uses it

  • Tasks that involve Knowledge graphs

Example prompts

  • “/kg-extract”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Read, Glob, Grep, mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store, mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge, mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store, mcp__plugin_ruflo-core_ruflo__embeddings_generate, Bash

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Scan files -- use Glob and Read to enumerate and read source files at the given path
  2. Identify entities -- extract classes, functions, modules, types, and config references from each file
  3. Map relations -- for each entity, determine its relations to other entities. Critical: TypeScript import type and inline type specifiers…
  4. Store in AgentDB -- call mcpplugin_ruflo-core_rufloagentdb_hierarchical-store for each entity with metadata (name, type, file, line…
  5. Create edges -- call mcpplugin_ruflo-core_rufloagentdb_causal-edge for each relation with source, target, relation type, and weight
  6. Report -- summarize: total entities by type, total relations by type, files scanned

What it can do on your machine

Read from SKILL.md and the folder at commit 58e0ae7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Glob
    • Grep
    • mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store
    • mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge
    • mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store
    • mcp__plugin_ruflo-core_ruflo__embeddings_generate
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Kg Extract loads about 751 tokens when it runs. Until then it costs about 22 tokens; SKILL.md has 262 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~22
When it runs · the whole SKILL.md, loaded when a task matches
~751

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Glob, Grep, mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store, mcp__plugin_ruflo-core_r

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ruvnet/ruflo at commit 58e0ae7, republished under its MIT licence (© ruvnet). 262 words, ~751 tokens.

Download SKILL.mdSave it as .claude/skills/kg-extract/SKILL.md (or your agent's skills folder).
name
kg-extract
description
Extract entities and relations from source files to build a knowledge graph
allowed-tools
Read, Glob, Grep, mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store, mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge, mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store, mcp__plugin_ruflo-core_ruflo__embeddings_generate, Bash
argument-hint
<path>

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

  1. Scan files -- use Glob and Read to enumerate and read source files at the given path

  2. Identify entities -- extract classes, functions, modules, types, and config references from each file

  3. Map relations -- for each entity, determine its relations to other entities. Critical: TypeScript import type and inline type specifiers (import { type Foo, bar }) are erased at compile time and MUST NOT be counted as value imports -- they're a separate, weaker relation. Misclassifying them produces phantom runtime cycles (see ruvnet/ruflo#2049).

    • imports: value imports (import { x } from '...', require(...)) -- weight 0.9
    • type-depends-on: TypeScript type-only imports (import type { Foo } from '...' and import { type Foo, value } from '...') -- weight 0.1, never used for cycle detection or runtime impact analysis
    • extends: class inheritance -- weight 0.9
    • implements: interface implementations -- weight 0.7
    • depends-on: constructor dependencies, injected services -- weight 0.8
    • calls: function/method invocations -- weight 0.7
    • references: documentation mentions, comments -- weight 0.3

    Regex hint for classifying TS imports (so a naive from '...' grep doesn't conflate the two):

    ^\s*import\s+type\s+               → type-depends-on (entire import is type-only)
    ^\s*import\s*\{[^}]*\btype\s+\w+   → split: type specifiers → type-depends-on, value specifiers → imports
    ^\s*import\s+[^{]*\bfrom\s+        → imports (value)
  4. Store in AgentDB -- call mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store for each entity with metadata (name, type, file, line, description)

  5. Create edges -- call mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge for each relation with source, target, relation type, and weight

  6. 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

© ruvnet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/ruflo-knowledge-graph/skills/kg-extract of ruvnet/ruflo.

Open the folder on GitHubat commit 58e0ae7

Compare with similar skills

Kg Extract next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Kg Extract compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Kg Extract this skillruvnet/ruflo74k—~751Automated safety check: NotesMIT
Obsidian Canvas BoardsAgriciDaniel/claude-obsidian15k—~1.4kAutomated safety check: PassMIT
Ontology1mancompany/OneManCompany4412 repos~1.5kAutomated safety check: PassApache-2.0
Knowledge Graphgnomeria/usbtree691—~1.5kAutomated safety check: PassMIT
Graphagenticnotetaking/arscontexta3.5k—~4.9kAutomated safety check: NotesMIT
LLM Wiki Knowledge GraphEgonex-AI/Understand-Anything86k—~1.5kAutomated safety check: PassMIT

Similar skills

  • Obsidian Canvas Boards

    AgriciDaniel/claude-obsidian

    Creates, inspects and updates Obsidian JSON Canvas boards in a vault, with text, file, link, group and edge nodes, using safe recoverable edits.

    15k GitHub stars~1.4k tokensUpdated 28 days ago
    Knowledge ManagementAuto-check passed
  • Ontology

    1mancompany/OneManCompany

    Typed knowledge graph for structured agent memory and composable skills.

    441 GitHub starsUsed in 2 repos~1.5k tokens
    Knowledge ManagementAuto-check passed
  • Knowledge Graph

    gnomeria/usbtree

    Set up and maintain a lightweight, file-based knowledge graph of the repo — entities, typed relations, decisions, gotchas — so agents load context fast instead of re-exploring the codebase every…

    691 GitHub stars~1.5k tokensUpdated 1 mo ago
    Knowledge ManagementAuto-check passed
  • Graph

    agenticnotetaking/arscontexta

    Interactive knowledge graph analysis. An agent skill from agenticnotetaking/arscontexta.

    3.5k GitHub stars~4.9k tokensUpdated 7 mo ago
    Knowledge ManagementAuto-check: notes
  • LLM Wiki Knowledge Graph

    Egonex-AI/Understand-Anything

    Detects a Karpathy-pattern LLM wiki and builds an interactive knowledge graph with entities, implicit relationships and topic clusters.

    86k GitHub stars~1.5k tokensUpdated today
    Knowledge ManagementAuto-check passed
  • Gitnexus Guide

    aws-samples/sample-kolya-br-proxy

    Official

    A skill your agent uses when the user asks about GitNexus itself — available tools, how to query the knowledge graph, MCP resources, graph schema, or workflow reference.

    106 GitHub starsUsed in 11 repos~867 tokens
    Knowledge ManagementAuto-check passed

More from ruvnet/ruflo

All 264 skills in this repo
  • Stores, searches, and retrieves successful patterns with HNSW-indexed semantic search so agents can reuse past solutions instead of relearning them.

    74k GitHub starsUsed in 2 repos~830 tokens
    Auto-check passed
  • Runs claude-flow CLI security scans for input validation, path traversal, SQL injection, XSS, hardcoded secrets and known CVEs, and writes an audit report.

    74k GitHub starsUsed in 2 repos~823 tokens
    Auto-check passed
  • Applies the SPARC method (specification, pseudocode, architecture, refinement, completion) with 17 specialized modes and multi-agent orchestration, from research to deployment.

    74k GitHub starsUsed in 2 repos~829 tokens
    Auto-check passed
  • Coordinates a hierarchical swarm of specialized agents through the claude-flow CLI for work that spans several files or modules at once.

    74k GitHub starsUsed in 2 repos~779 tokens
    Auto-check passed
  • Sets up and drives Ruflo, an npm-installed orchestration layer for multi-agent swarms, persistent memory, routing, hooks and its MCP tool catalog.

    74k GitHub starsUsed in 1 repo~975 tokens
    Auto-check passed
  • Agent Coordination

    ruvnet/ruflo

    Reference for spawning, listing, monitoring and stopping agents with claude-flow commands, with agent type families, routing codes and coordination tips.

    74k GitHub starsUsed in 2 repos~519 tokens
    Auto-check passed

Questions about Kg Extract

What does Kg Extract do?

Extract entities and relations from source files to build a knowledge graph. Kg Extract is an agent skill from ruvnet/ruflo.

When should I use Kg Extract?

Kg Extract fits situations like: tasks that involve Knowledge graphs.

How do I install Kg Extract in Claude Code?

Run `npx skills add ruvnet/ruflo --skill kg-extract -a claude-code`. Or copy the skill folder (plugins/ruflo-knowledge-graph/skills/kg-extract in ruvnet/ruflo) into .claude/skills/kg-extract in your project. Claude Code loads it when a task matches its description.

How do I install Kg Extract in Codex?

Run `npx skills add ruvnet/ruflo --skill kg-extract -a codex`. Or copy the skill folder (plugins/ruflo-knowledge-graph/skills/kg-extract in ruvnet/ruflo) into .agents/skills/kg-extract in your project. Codex loads it when a task matches its description.

Can I use Kg Extract in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ruvnet/ruflo --skill kg-extract -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/kg-extract, .gemini/skills/kg-extract, .github/skills/kg-extract and .opencode/skills/kg-extract in your project.

What does Kg Extract need to run?

Going by SKILL.md and its folder, Kg Extract needs the command-line tools its instructions call (npx). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Read, Glob, Grep, mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store, mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge, mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store, mcp__plugin_ruflo-core_ruflo__embeddings_generate, Bash.

Does Kg Extract access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Kg Extract safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Kg Extract use?

Kg Extract is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Kg Extract use?

About 751 tokens (SKILL.md is roughly 3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Kg Extract?

Skills that share tags, products or a category with Kg Extract: Obsidian Canvas Boards (AgriciDaniel/claude-obsidian, 15k stars), Ontology (1mancompany/OneManCompany, 441 stars), Knowledge Graph (gnomeria/usbtree, 691 stars) and Graph (agenticnotetaking/arscontexta, 3.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Kg Extract?

ruvnet (a GitHub user) maintains it in ruvnet/ruflo, which has 74,159 GitHub stars. The repository holds 264 skills in this directory. The repository was last updated on October 9, 2026.

Source: ruvnet/ruflo on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.