Traces upstream provenance of knowledge graph resources by reading live KG-Registry Parquet files, walking original_source and secondary_source references, with optional recursive depth.
Ships in kg-registry-discovery. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Determine all upstream data sources that feed into a given resource, from the provenance KG-Registry records, using the live hosted data.
httpfs extension and internet access. Portable option:
uv run --with duckdb --no-project python - <<'PY'
... query ...
PY
(Or pip install duckdb + python, or the duckdb CLI with INSTALL httpfs; LOAD httpfs;.)https://kghub.org/kg-registry/registry/parquet/resources.parquet has one row per resource. Provenance is not a flat column — it lives inside the raw_data JSON, under each product. Setup block:
import duckdb, json
con = duckdb.connect()
con.execute("INSTALL httpfs; LOAD httpfs;")
BASE = "https://kghub.org/kg-registry/registry/parquet"
R = f"read_parquet('{BASE}/resources.parquet')"
P = f"read_parquet('{BASE}/resource_products.parquet')" # resource_id, product_id, ...
def record(rid):
row = con.execute(f"SELECT raw_data FROM {R} WHERE id = ?", [rid]).fetchone()
return json.loads(row[0]) if row else None
raw_data has a products list.{source, relation_type} objects:
original_source — primary inputs. Default relation prov:hadPrimarySource.secondary_source — non-primary influences/derivatives. Relations like prov:wasInfluencedBy, prov:wasDerivedFrom, prov:wasInformedBy, prov:used.source is a KG-Registry resource or product id — not a URL, not an INFORES id, not a label.original_source; that self-reference is not an external upstream source.kg-microbe. (Find it with search-resources if only a topic/name is known.)depth — recursion levels (default: 1 = direct sources; higher or "full" to chase sources of sources).secondary_source (default: yes, labeled separately from primary).Pull the resource record and collect every provenance reference.
rec = record('kg-microbe')
refs = []
for prod in rec.get('products', []):
for slot in ('original_source', 'secondary_source'):
for assoc in (prod.get(slot) or []):
refs.append({'product': prod['id'], 'slot': slot,
'source': assoc['source'],
'relation': assoc.get('relation_type')})
record() returns None, the id is wrong — locate it with search-resources.Separate the resource's own products from genuine upstream sources.
source equals the resource id (or one of its own product ids).source. That is the set of direct upstream sources.Resolve each upstream id to a real resource.
def resolve(sid):
r = con.execute(f"SELECT id,name,category,activity_status FROM {R} WHERE id = ?", [sid]).fetchone()
if r: return r
# source may be a PRODUCT id — find its owning resource
o = con.execute(f"SELECT resource_id FROM {P} WHERE product_id = ?", [sid]).fetchone()
return con.execute(f"SELECT id,name,category,activity_status FROM {R} WHERE id = ?", [o[0]]).fetchone() if o else None
None — it may be an intentionally minted id whose page does not exist yet. Note it; do not silently drop it.Recurse if requested.
original_source/secondary_source (the primary-source leaves).Report the upstream tree.
prov:hadPrimarySource) first, then secondary influences with their specific relation.id — name (category, status) — relation — which product of the target it feeds.| Task | How |
|---|---|
| Get a resource record | json.loads(con.execute(f"SELECT raw_data FROM {R} WHERE id=?", [rid]).fetchone()[0]) |
| Source ids on a record | walk rec['products'][*]['original_source'/'secondary_source'][*]['source'] |
| Resolve a resource id | SELECT id,name,category,activity_status FROM {R} WHERE id=? |
| Resolve a product id to its owner | SELECT resource_id FROM {P} WHERE product_id=? |
| Recurse | call record() on each resolved source id |
source value as a URL or label. It is a KG-Registry id and must be resolved as one.source can be a product id, not a resource id — resolve both ways via resource_products.secondary_source. It carries real upstream influence; just label it separately from primary inputs.find-downstream-usages answers the reverse question (where a resource is used).search-resources locates the starting resource id when the user only has a topic or name.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/find-downstream-usagesUse when asked everywhere a given resource is used or consumed downstream — which knowledge graphs, aggregators, or products draw on it, and any recorded real-world uses — based on what KG-Registry records. Reads the live hosted KG-Registry Parquet files over HTTP (no local clone needed), combining reverse provenance (other resources naming this one as a source) with the resource's own usages field./find-similar-resourcesUse when asked to find KG-Registry resources similar to a given one — alternatives, related graphs, or near-duplicates. Reads the live hosted KG-Registry Parquet files over HTTP (no local clone needed), combining structured signals (shared domains, taxa, category, node/edge scale, shared upstream sources) with softer heuristics (description similarity and overlapping publication authors) into a ranked shortlist./search-resourcesUse when asked to find KG-Registry resources about a topic, subject area, or domain (e.g. "everything about RNA interactions", "what proteomics knowledge graphs are there", "find resources mentioning Reactome"). Queries the live hosted KG-Registry Parquet files over HTTP — no local clone needed — mapping a free-text topic to the registry's domain vocabulary plus keyword search./kg-registry-discovery:trace-upstream-sourcesfrom kg-registry-discovery
npx claudepluginhub knowledge-graph-hub/kg-registry --plugin kg-registry-discoveryOther plugins' skills for the same job