Skip to content

Add bender kg command and knowledge graph subsystem#306

Draft
aottavianoTT wants to merge 1 commit into
pulp-platform:masterfrom
aottavianoTT:aottaviano/kg
Draft

Add bender kg command and knowledge graph subsystem#306
aottavianoTT wants to merge 1 commit into
pulp-platform:masterfrom
aottavianoTT:aottaviano/kg

Conversation

@aottavianoTT
Copy link
Copy Markdown

@aottavianoTT aottavianoTT commented May 19, 2026

This PR introduces a knowledge graph (KG) pipeline that parses SystemVerilog designs via bender-slang into a queryable graph, exposed via bender kg CLI and an MCP server for AI assistant integration.

Architecture

The pipeline is split across six new crates:

Crate Role
bender-kg-models Shared IR types (ModuleData, PortInfo, ParamInfo, InstantiationInfo, …) used as the common data contract between crates
bender-kg-extract Drives bender-slang to parse SV source files and emit structured IR
bender-kg-store Persists the graph using Grafeo, augmented with an HNSW vector index for similarity lookups and BM25 for keyword search
bender-kg-similarity Produces dense per-module embeddings via a Model2Vec/ONNX pipeline, powering structural similarity queries
bender-kg-core Orchestrates the above into a typed Engine API; callers issue structured queries and get typed results back
bender-kg-mcp Wraps bender-kg-core in a stdio MCP server so AI assistants can call all queries as MCP tools

Query surface

Once the KG is built (or incrementally updated), it supports:

  • Module search — find modules by name or natural-language description
  • Hierarchy traversal — walk instantiation trees up and down
  • Port / parameter / signal tracing — trace connectivity across module boundaries
  • Structural similarity — find modules that are structurally similar based on dense embeddings
  • Connectivity checks — verify expected connections exist in the design

…igns

Introduces the `bender kg` command and six supporting crates:

- bender-kg-models: IR types (ModuleData, PortInfo, ParamInfo, InstantiationInfo, …)
- bender-kg-extract: SystemVerilog → IR extraction pipeline via bender-slang
- bender-kg-store: Grafeo-backed graph + HNSW vector + BM25 text store
- bender-kg-similarity: dense module embeddings (Model2Vec / ONNX)
- bender-kg-core: orchestration layer with typed Engine query API
- bender-kg-mcp: stdio MCP server exposing all queries as MCP tools

The kg subsystem supports build, incremental update, and a rich query surface
(module search, hierarchy traversal, port/parameter/signal tracing, structural
similarity, connectivity checks) consumable from both the CLI and AI assistants.
@aottavianoTT aottavianoTT changed the title Add bender knowledge-graph command Add bender kg command and knowledge graph subsystem May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant