Skip to main content

Capability-token enforcement for LLM-synthesized procedures

Project description

Skill Knowledge Graph

Capability-token enforcement for LLM-synthesized procedures. The runtime is the gate, not the manifest.

Hero

SKG sits between an LLM agent and the operations it wants to perform. On every host call, the Wasmtime runtime physically prevents anything the grant set does not include. Recurring tasks resolve through a local router and skip the LLM entirely.

Three measured numbers (full methodology in paper.md):

  • 528 input tokens saved per task (~36%) on a 200-task corpus, 95% bootstrap CI [442, 628].
  • 0.16 ms p50 routing latency vs 3082 ms p50 for the LLM call.
  • 13 of 13 attacks contained vs 5 of 13 for a declared-capability baseline.

Install

One command (pipx or uv tool). Skips the venv-and-clone dance.

pipx install git+https://github.com/bdube83/skill-knowledge-graph
# or:
uv tool install git+https://github.com/bdube83/skill-knowledge-graph

That puts skg and skg-mcp on your PATH. Verified this turn: skg --version -> skg 0.1.0 from ~/.local/bin/skg.

Wire it into your LLM CLI

skg install --client claude-code --write     # writes ~/.claude.json
skg install --client copilot --write         # writes ~/.copilot/mcp-config.json
codex mcp add skg -- $(which skg-mcp)        # codex uses TOML, registers via its own CLI

The hosts now expose three tools: skg_route, skg_execute, skg_list_nodes.

Or use it as a CLI directly

For scripts, CI, and one-off use without an MCP host.

skg run "draft a reviewer ping for PR review"
skg run --vendor copilot "summarise the last 10 commits"
skg run --json --dry-run "any task"

skg run routes through SKG, falls back to the configured vendor on a miss, and prints the result.

For development

When you want to edit the package itself:

git clone https://github.com/bdube83/skill-knowledge-graph
cd skill-knowledge-graph
python3.13 -m venv .venv
.venv/bin/pip install -e .

What you get

Nodes are Rust crates compiled to WASI. Each ships with a manifest that lists requested capabilities. The launcher mints a per-run handle table, wires only the host imports the grant set permits, then runs Wasmtime. A node that imports a host function it was not granted fails at instantiate-time.

Twelve generic effect classes plus text.generate: local.read/write, network.read/write, external.draft/send, browser.read/write, git.read/write, secret.read, production.write. Three of them require an approval token at call time.

The router runs four stages in order: exact, full-text search, vector, graph composition. The first three are local; the fourth expands typed edges in the graph.

Three honest limits

  • The 36% token saving holds on long-context tasks. On short-context tasks the 120-token routing header costs more than the LLM call. Below 120 tokens per task LLM input, SKG adds overhead. Source: eval/results/h1_stats.json.
  • The vector stage gets 0 of 200 hits today. The bottleneck is the placeholder local-hash-v1 embedding, not the pipeline.
  • Graph composition is not yet quantitatively tested; deferred to a follow-up paper.

Tests

.venv/bin/python -m pytest tests/ -q
# 242 tests on commit 5daee75

Code layout

Path Contents
skg/ Kernel, router, runtime, MCP server, CLI, baselines, host adapters.
nodes/ Three reference Rust-WASI crates.
eval/ Corpus, runners, statistical scripts.
tests/ Pytest suite.
figures/ Architecture diagram source and renders.
docs/ Integration guide and paper-reproduction guide.
paper.md / paper.pdf The accompanying paper.

Citation

@misc{dube2026skg,
  title  = {Skill Knowledge Graph: Capability-Token Enforcement for LLM-Synthesized Procedures},
  author = {Dube, Bongani},
  year   = {2026},
  note   = {Paystack. Draft},
  url    = {https://github.com/bdube83/skill-knowledge-graph}
}

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skg-0.1.0.tar.gz (861.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skg-0.1.0-py3-none-any.whl (78.0 kB view details)

Uploaded Python 3

File details

Details for the file skg-0.1.0.tar.gz.

File metadata

  • Download URL: skg-0.1.0.tar.gz
  • Upload date:
  • Size: 861.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for skg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e199e48c0f93fe55be3cddbc8f18cc773f2d5d642955708dc749fd22d9ed9af0
MD5 4c48e2267eeac7049759742a9357ed39
BLAKE2b-256 b0e4385ae2fdda1067359bcced2ec798fca140c8af68f24c46f1bc79c15ef8d7

See more details on using hashes here.

File details

Details for the file skg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: skg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 78.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for skg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5adb132842888e91d8329be8e1324bbfbc41584800a20d5ca383c6a197ab3f79
MD5 eb4e4fc89341c430c0a71f79b113f738
BLAKE2b-256 6858ea73d5f47b55062b90fa0bffdaee19f76bb4773ffa9b8cc02fc770ed68e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page