Skip to content
ASDM KE: 85K Lines to Knowledge Graph in 90 Seconds, Millisecond Impact Queries for AI & Developers

ASDM KE: 85K Lines to Knowledge Graph in 90 Seconds, Millisecond Impact Queries for AI & Developers

ASDM KE pre-analyzes code repositories into a knowledge graph of 23,889 objects and 64,928 relationships in 90 seconds, enabling millisecond-level impact queries for developers and AI assistants via a stable SDK, with extensible architecture supporting multiple knowledge types, data sources, and applications.

DevOps
DevOps
DevOps

Real-World Scenario: 85K Lines to Queryable Graph in 90 Seconds

The article opens with a live demo at codegraph.kengine.ai showing the open-source mall project (85,000 lines of code). On import, the repository is analyzed into 23,889 objects and 64,928 relationships in approximately 90 seconds . Thereafter, questions like "who calls this method", "what is affected by changing this class", or "which database tables does this commit touch" — previously requiring a senior engineer hours of code search — become millisecond queries .

KE CodeGraph exploration mode: UserService impact neighborhood expanding hop by hop
KE CodeGraph exploration mode: UserService impact neighborhood expanding hop by hop

In exploration mode, locating UserService instantly reveals its relationship network ( 426 nodes, 1,032 edges ) with real-time hop-by-hop drill-down, color grouping, and type filtering.

From On-the-Fly Analysis to Pre-Built Graph

Mainstream AI coding tools answer cross-file questions using on-the-fly retrieval + ad-hoc reasoning : every query re-scans code, chunks text, and guesses relationships. The same analysis repeats for each question; larger repositories mean slower responses and higher error rates.

KE (Knowledge Engine) takes a different path: front-load the analysis cost once at import time . Every class, method, database table, and frontend component becomes a graph node; every call, inheritance, and table reference becomes a deterministic edge. All subsequent queries are simple graph traversals — no scanning, no guessing.

Two immediate benefits:

Multi-version comparison : each import generates a new snapshot; old vs. new snapshots can be diffed directly, giving definitive answers to "what changed in this upgrade" without speculation.

Result reuse : analyze once, share the same structured result across all applications, tools, and AI assistants.

Hands-On: TypeScript SDK for Millisecond Queries

The official SDK @asdm-ai/ke-client is written in TypeScript, has zero runtime dependencies, and runs in both browser and Node.js. The following snippet asks the opening question — "what code is impacted by changing UserService?"

import { createKeClient } from "@asdm-ai/ke-client";
// Create client: fill in service address and key (access method see form at end)
const api = createKeClient({
  baseUrl: "<your KE service address>",
  token: "<your API Key>",
});
// Query: who depends on UserService? — full impact surface within 3 hops
const result = await api.expand({
  seed: "cls:com.example.UserService", // starting object
  direction: "in",                     // traverse reverse = who is affected
  depth: 3,                            // traversal depth (max 10 hops)
});
// Result always contains three parts: affected objects, their relationships, layers by distance
for (const node of result.nodes) console.log(node.type, node.id, node.label);
for (const edge of result.edges) console.log(edge.linkType, edge.source, "→", edge.target);
for (const level of result.levels) console.log(`第 ${level.depth} 跳:${level.count} 个对象`);
// If result is truncated, an explicit "data incomplete" marker is returned
if (result.truncated) console.warn(`结果被 ${result.truncatedBy} 截断,仅供参考`);

Three Product Design Decisions

Return complete structure : objects, edges, and layers — not a list of text snippets sorted by similarity.

Disclose truncation honestly : when the impact surface is too large, the system explicitly flags incomplete data instead of pretending the answer is complete.

Stable interface contract : the query contract is reviewed and frozen; consumer code written today will not break on platform upgrades.

For the user, the conclusion is: queries are not only fast, but results are reliable and safe to depend on long-term .

Overall Architecture: Build Once, Query Everywhere

ASDM KE layered architecture: data sources → ontology snapshots → query service → SDK → application ecosystem
ASDM KE layered architecture: data sources → ontology snapshots → query service → SDK → application ecosystem

Bottom-up: various assets (backend code, frontend code, database schemas, config files) are imported to produce ontology snapshots ; on top sits the query service ; at the top, human tools and AI assistants consume answers through the same interface. Left side shows data ingestion, right side shows millisecond query output — build the graph once, query it everywhere .

Extensible Architecture: One Kernel, Four Extension Directions

KE plugin architecture: one kernel, four extension surfaces
KE plugin architecture: one kernel, four extension surfaces

Query capability is the foundation; extensibility is the core value for enterprises. KE's extension architecture comprises a stable kernel and four independent extension axes:

Extension 1: Knowledge Types

The built-in graph is a code knowledge graph, but the type system is user-definable. Business processes, device ledgers, product documentation — all can become knowledge graphs using the same mechanism, with unchanged query semantics for upper-layer applications.

Extension 2: Data Sources

Currently supports Java, frontend, database schemas, etc. Adding a new language or document format only requires a new analyzer plugin; the graph mechanism itself remains untouched.

Extension 3: Access Methods

The same graph is queryable via web tool, IDE plugin, AI assistant (through MCP protocol), and automated pipelines. Batch scanning pipelines integrate with GitHub Actions: open-source repos are analyzed automatically and reports generated.

Extension 4: Applications

The CodeGraph shown earlier is the first application built on this mechanism: React + WebGL rendering (sigma.js, graphology), depending only on the query interface, zero coupling to platform internals. Any team can publish an application; each automatically gets a dedicated appname.kengine.ai subdomain, and deploying or removing an app requires no server configuration changes .

Enterprises make incremental investment in any extension direction; kernel interface stays stable, no rebuild needed.

GitNexus Capability Comparison

GitNexus (https://github.com/abhigyanpatwari/GitNexus) is an active open-source project positioned as an "enterprise codebase context engine": it uses tree-sitter to parse repositories, builds graphs of symbols, call chains, community, and execution flows, and exposes 19 MCP tools for AI agents. While it addresses a similar surface problem, the differences are structural:

GitNexus vs KE CodeGraph comparison table
GitNexus vs KE CodeGraph comparison table

Scope Advantage: CodeGraph Is Just One KE Application

GitNexus's entire capability lives inside the code domain. Enterprise-critical knowledge — how business processes flow, how device ledgers link, how policy documents reference each other — has no place in its model. In KE, these knowledge types enter the same query service and application ecosystem via the blueprint mechanism. CodeGraph demonstrates KE's floor, not its ceiling.

Model Advantage: Data Model Determines Answerable Questions

In GitNexus's symbol graph, database tables are not first-class objects; cross-repository complete data flow is still on the roadmap. In KE's object graph, the path "frontend component → API → Mapper → database table" is traversable in a single hop. Version management is another telling example: GitNexus can only say "index stale, please rebuild"; KE's multi-version snapshots directly show every added, deleted, and changed edge between two versions. This is a have-vs-have-not difference, not a better-worse difference.

Extension Advantage: Standard Paths vs. Modifying Source Code

GitNexus's analysis pipeline is statically defined at compile time with no plugin mechanism; any capability extension requires modifying its source code, submitting a PR, and waiting for upstream acceptance. Its non-commercial license (PolyForm Noncommercial 1.0.0, https://polyformproject.org/licenses/noncommercial/1.0.0/) also creates compliance boundaries for enterprise deep customization and distribution. KE turns extension into a built-in product path: defining blueprints, adding analyzers, developing application packages are all standard actions that do not depend on anyone else's code being merged. Enterprises build their own things per specification, not by modifying someone else's code.

In one sentence: GitNexus is an excellent developer tool answering "how does AI understand this codebase"; KE is an enterprise knowledge engine answering "how to build, govern, and consume enterprise knowledge assets for both humans and AI".

Getting Started: AI-Era Knowledge Infrastructure

How to start with KE
How to start with KE

From the AI perspective: when an AI assistant answers questions via this graph, it receives governed, structured facts , not retrieved similar text snippets. This is the concrete form of "building systems for AI" discussed in a companion article. AI-era enterprise knowledge infrastructure is not another document library, but a knowledge graph callable in milliseconds.

Closing Thoughts

85,000 lines of code, 90 seconds to a knowledge graph; one stable interface powering diverse applications. KE validates a direct proposition: enterprise knowledge need not remain fragmented across code, documents, and experts' heads — it can be engineered into a graph, governed, and consumed, and from day one it is designed to be callable by AI .

References and Further Reading

Product & Sites

KEngine official site: https://kengine.ai/

KE CodeGraph (demo source, mall repo live): https://codegraph.kengine.ai/

Comparison Project

GitNexus (open-source code context engine): https://github.com/abhigyanpatwari/GitNexus

GitNexus Web UI: https://gitnexus.vercel.app

PolyForm Noncommercial License (used by GitNexus): https://polyformproject.org/licenses/noncommercial/1.0.0/

Repositories & Protocols Mentioned

mall (macrozheng/mall, example data source): https://github.com/macrozheng/mall

Model Context Protocol (MCP, AI assistant integration protocol): https://modelcontextprotocol.io/

GitHub Actions (batch scanning pipeline): https://docs.github.com/actions

CodeGraph Application Tech Stack

React: https://react.dev/

TanStack Query: https://tanstack.com/query/latest

sigma.js (WebGL graph rendering): https://www.sigmajs.org/

graphology (graph data structure): https://graphology.github.io/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

software architecturecode analysisKnowledge GraphMCP protocolTypeScript SDKimpact analysisGitNexusASDM KE
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.