Help us improve
Share bugs, ideas, or general feedback.
npx claudepluginhub mironmax/claudecode-pluginsHow this skill is triggered — by the user, by Claude, or both
Slash command
/knowledge-graph:kg-extractThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Extract maps a codebase's architecture into the project-level knowledge graph. You use standard tools (Read, Glob, Grep) to explore, then `kg_put_node`/`kg_put_edge` to record structure.
Answers questions about a codebase by querying the knowledge graph at .understand-anything/knowledge-graph.json. Searches nodes, edges, layers for code structure, dependencies, and relationships.
Auto-generates always-current knowledge maps (AGENTS.md) from .harness/graph/ topology. Use when docs outdated, after refactoring, on commits; falls back to static analysis if no graph.
Share bugs, ideas, or general feedback.
Extract maps a codebase's architecture into the project-level knowledge graph. You use standard tools (Read, Glob, Grep) to explore, then kg_put_node/kg_put_edge to record structure.
The goal: a navigable map of how the codebase fits together — not documentation of every file.
kg_read(cwd="<project root>") # Load graph + get session_id
kg_progress(session_id, task_id="extract") # Check prior progress
| Type | What it represents | Examples |
|---|---|---|
module | Cohesive unit of functionality | service, package, feature, bounded context |
resource | Persistent state or external system | database, cache, external API, message queue |
entry | How the system is invoked | HTTP endpoint, CLI command, cron job, event handler |
artifact | File or directory containing code/config | source file, config, directory |
contract | Explicit interface between modules | API schema, shared types, event schema |
Node properties:
id: kebab-case unique keygist: 1 sentence max describing purpose| Edge | From → To | Meaning |
|---|---|---|
contains | artifact → module | This file/dir implements this module |
exposes | module → contract | Module provides this interface |
consumes | module → contract | Module depends on this interface |
persists | module → resource | Module reads/writes this resource |
serves | module → entry | Module handles this entry point |
calls | module → module | Direct dependency (prefer contract-mediated) |
configures | artifact → module/resource | Config affects behavior |
Edge properties:
notes: what mediates the relationship, criticality (core/supporting/optional)kg_progress(session_id, task_id="extract")
Resume from where you left off, or start fresh.
Quick scan to understand project structure:
Glob("**/package.json") or Glob("**/pyproject.toml")
Glob("src/**")
Glob("**/README*")
Identify: entry points, main directories, config files, key abstractions.
For each cohesive unit found:
kg_put_node(
level="project",
id="auth-module",
gist="JWT-based auth with refresh tokens, middleware pattern",
touches=["src/auth/"],
notes=["layer: api+domain", "stateless"]
)
Guidelines:
payment-processor not processorConnect modules to each other and to resources/entries:
kg_put_edge(level="project", from="auth-module", to="user-db",
rel="persists", notes=["reads user credentials, writes tokens"])
kg_put_edge(level="project", from="src/config.yaml", to="auth-module",
rel="configures", notes=["JWT secret, token TTL"])
Prefer edges over new nodes. If two modules interact, that's an edge — don't create a node for the interaction.
kg_progress(session_id, task_id="extract", state={
"modules_mapped": ["auth", "api", "data-layer"],
"directories_surveyed": ["src/", "config/"],
"last_updated": "2025-01-15"
})
touchesartifact nodes to bridge filesystem to logical structureGood times:
Bad times:
# Modules
kg_put_node(level="project", id="api-layer", gist="FastAPI routes, request validation, response formatting")
kg_put_node(level="project", id="domain-logic", gist="Business rules, orchestration, no framework deps")
kg_put_node(level="project", id="data-layer", gist="SQLAlchemy models + async session management")
# Resources
kg_put_node(level="project", id="postgres-db", gist="Primary datastore, schema managed by Alembic")
kg_put_node(level="project", id="redis-cache", gist="Session store + rate limiting")
# Key edges
kg_put_edge(level="project", from="api-layer", to="domain-logic", rel="calls")
kg_put_edge(level="project", from="domain-logic", to="data-layer", rel="calls")
kg_put_edge(level="project", from="data-layer", to="postgres-db", rel="persists")
kg_put_edge(level="project", from="api-layer", to="redis-cache", rel="persists", notes=["rate limiting"])
kg_put_edge(level="project", from="src/config.py", to="data-layer", rel="configures")