skills-graph
A small library to persist, retrieve and evolve AI skills in Memgraph.
Part of the Context Graph family — usually wired into
agent-context-graphso that skill usage across Claude Code / Codex sessions is recorded automatically. This README covers using it directly.
Graph Model
(:Skill {name, description, content, license, compatibility,
allowed_tools, metadata, created_at, updated_at, source_path?})
(:Skill)-[:DEPENDS_ON]->(:Skill)
(:Session)-[:USED_SKILL {first_access, last_access, access_count, actions}]->(:Skill)
USED_SKILL is written from a MERGE (:Session {session_id}) — skills-graph MERGEs the shared Session node it does not own (see the Context Graph map). source_path is set only when a skill is created by observing a local SKILL.md read.
Quick Start
from skills_graph import SkillGraph, Skill
# Connect (uses MEMGRAPH_URL, MEMGRAPH_USER, MEMGRAPH_PASSWORD env vars by default)
sg = SkillGraph()
# Prepare the database schema (constraints + indexes)
sg.setup()
# Store a skill.
# name: lowercase letters/digits/hyphens only, 1-64 chars, no leading/trailing/
# consecutive hyphens (an invalid name raises SkillValidationError).
sg.add_skill(
Skill(
name="memgraph-cypher",
description="Writing Cypher queries for Memgraph",
content="# Cypher for Memgraph\n\nUse MATCH, CREATE, MERGE ...",
)
)
# Retrieve by name
skill = sg.get_skill("memgraph-cypher")
# Search
sg.search_by_name("memgraph")
# Dependencies
sg.add_dependency("advanced-cypher", "memgraph-cypher")
deps = sg.get_dependencies("advanced-cypher")
# List all
all_skills = sg.list_skills()
# Update
sg.update_skill("memgraph-cypher", content="updated content")
# Delete
sg.delete_skill("memgraph-cypher")
Agent Context Graph integration
Wire SkillGraphConnector into an AgentLink and skill usage is recorded automatically from any runtime adapter's event stream (Claude Code, Codex, OpenAI SDK):
from skills_graph import SkillGraph
from skills_graph.connector import SkillGraphConnector
from agent_context_graph import AgentLink
from agent_context_graph.adapters.claude import ClaudeAdapter
link = AgentLink()
link.add_connector(SkillGraphConnector(SkillGraph()))
adapter = ClaudeAdapter(link, session_id="s-1")
hooks = adapter.get_runtime_hooks()
Requires the agent-context-graph extra: pip install "skills-graph[agent-context-graph]".
The connector detects skill usage from TOOL_START/TOOL_END/MESSAGE events — direct tool names like get_skill, MCP-style names like mcp__skills__get_skill, and local reads of an Agent Skills definition (.../skills/<name>/SKILL.md), which covers runtimes where using a skill appears as a file read rather than a dedicated tool call. Search/list results that surface skill objects are also recorded through USED_SKILL.
Installation
pip install skills-graph
# or, for the connector: pip install "skills-graph[agent-context-graph]"
Needs a running Memgraph (default bolt://localhost:7687):
docker run --rm -p 7687:7687 memgraph/memgraph
From a workspace checkout, uv sync installs it with its siblings.
Testing
uv run pytest tests/ -v
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skills_graph-0.2.0.tar.gz.
File metadata
- Download URL: skills_graph-0.2.0.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec6c7944b99939fc5250e07d755a47a9b8b4997a1c55e6b2acdf42a0415a4252
|
|
| MD5 |
c8e9c103b8c82aa83fcc01bb4e95dc3c
|
|
| BLAKE2b-256 |
e31a45a627212ba74d32856e4101e292251962c11970672f2d0869539851e1ae
|
File details
Details for the file skills_graph-0.2.0-py3-none-any.whl.
File metadata
- Download URL: skills_graph-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d758b6e3dcdfbd6ee87f788ec0ec348c2463b6295d14ad0b34dea28b7b16ca75
|
|
| MD5 |
9225c1aadc0d6ceb050e5a8946e033de
|
|
| BLAKE2b-256 |
cc00fc3101503e5a9fe25ab047e3ebe29a6171d40cd3e51673f690e10de65b8e
|