kiberon-labs Behave Graphs for VScode
This is a proof of concept exploration of embedding the graph engine inside of VS Code for faster iteration of behave graph
Features
Provides a custom editor for the new file extension type .kbgraph which is a kiberon-labs specific format for the serialized behave graph.
Custom icons for the .kbgraph format
Provides a command to quick create new Graph files
Built-in graph execution server with support for custom registries
Custom frontend plugins
Frontend plugins can be loaded dynamically via the use of a plugin.js file adjacent to a graph.
Examples
Ready-to-run example graphs live in examples/. Open an example's
.kbgraph in the editor and press Run; the adjacent registry.ts is loaded
automatically so its custom nodes are available. The set covers a headless
workflow, a Web-Audio-style audio chain (custom value type + node kind),
a game loop on RealtimeEngine, and an embed value type. See
examples/README.md.
Custom Registry Support
The GraphRunnerServer loads custom registries to extend or replace the default
core profile nodes. When you open a .kbgraph, an adjacent registry.ts /
registry.js (or one named by a .kbworkspace) is dynamically loaded — TS is
transpiled on demand, so a .ts registry works without a build step.
Usage
Note: .ts registries and plugins are transpiled on demand using the
typescript (or esbuild) compiler installed in your workspace. There is no
build step, but one of those must be present in your project's
node_modules. If neither is installed, ship a precompiled .js registry
instead.
Create a registry.ts (or .js) that exports a configured registry:
import { registerCoreProfile, ManualLifecycleEventEmitter } from '@kiberon-labs/behave-graph';
export const registry = registerCoreProfile({
values: {},
nodes: {
// Add custom node types here
},
dependencies: {
ILogger: console,
ILifecycleEventEmitter: new ManualLifecycleEventEmitter(),
}
});
A registry module may also export two optional seams the run server honors:
executionHandlers — a map of custom node kind → handler, taught to the
engine via registerNodeExecutionHandler. This lets you add brand-new node
kinds (not just node types). See
examples/audio/registry.ts.
createEngine — a factory (graph, registry) => Engine to run on a
different engine, e.g. RealtimeEngine. See
examples/game/registry.ts.
See examples/ for complete, runnable registries.
Requirements
Running graphs works out of the box. Loading a .ts registry or editor plugin
additionally requires typescript (or esbuild) installed in the graph's
workspace; see Custom Registry Support.
Extension Settings
The extension exposes the following settings (under Settings → Extensions →
Behave Graph). They control the built-in MCP server that lets external agents
and VS Code Copilot use the editor's tools.
| Setting |
Type |
Default |
Description |
behaveGraph.mcp.httpServer.enabled |
boolean |
true |
Enable the MCP HTTP server so external agents (Claude Desktop, OpenCode, Cursor, etc.) can connect via URL. |
behaveGraph.mcp.httpServer.port |
number |
3100 |
Port for the MCP HTTP server. |
behaveGraph.mcp.vscodeProvider.enabled |
boolean |
true |
Register MCP tools as a VS Code MCP Server Definition Provider so VS Code Copilot can discover and use them. |
Known Issues
Due to how serialization occurs for array buffers and typed arrays, you must use engine 1.57.0 and above of vscode to prevent huge data transfer inefficiencies
Release Notes
Please see the changelog included in the project for more information