Adaptive KG-RAG
Local-first knowledge graph repo memory for coding agents.
Adaptive KG-RAG indexes a workspace into a typed code knowledge graph, then
lets coding agents query compact repo context through MCP instead of reading
large parts of the repository into the prompt.
What It Does
- Indexes files, symbols, imports, calls, tests, docs, and repo-memory facts.
- Shows graph status, node/edge counts, storage footprint, and export tokens in
a VS Code sidebar.
- Provides a graph explorer for inspecting files, symbols, and relationships.
- Configures MCP for Codex, Claude Code, Cursor, and Antigravity.
- Lets agents query
adaptive_kg_status, adaptive_kg_query, and related MCP
tools before falling back to direct source reads.
- Uses offline Hash/KG mode by default; optional embedding providers can be
configured outside the extension.
Important Beta Note
This extension is currently a lightweight VS Code wrapper around the local
Adaptive KG Python package. For best results, install the Python package from
the project repository first:
git clone https://github.com/YijunSun/KG-RAG-CodeKG
cd KG-RAG-CodeKG
python -m pip install -e .[dev]
If you are developing from source, set adaptiveKg.sourceRoot to the repository
root when VS Code cannot discover src/adaptive_kg automatically.
Quick Use
- Open a repository in VS Code.
- Open the Adaptive KG activity bar icon.
- Run
Index Workspace or Rebuild Graph.
- Run
Configure Agent MCP and choose Codex, Claude Code, Cursor, or
Antigravity.
- Restart the selected agent or open a fresh agent session.
MCP Targets
| Agent |
MCP Config |
Managed Instruction File |
| Codex |
~/.codex/config.toml |
AGENTS.md |
| Claude Code |
.mcp.json |
CLAUDE.md |
| Cursor |
~/.cursor/mcp.json |
.cursor/rules/adaptive-kg-rag.mdc |
| Antigravity |
~/.gemini/antigravity/mcp_config.json |
GEMINI.md |
Use Adaptive KG: Uninstall Agent MCP to remove the managed MCP entry and
managed instruction block from one target or all configured targets.
Commands
Adaptive KG: Index Workspace
Adaptive KG: Rebuild Workspace Graph
Adaptive KG: Query Workspace Graph
Adaptive KG: Configure Agent MCP
Adaptive KG: Uninstall Agent MCP
Adaptive KG: Show Graph Status
Adaptive KG: Open Graph Explorer
Adaptive KG: Prepare LLM Graph Audit
Adaptive KG: Open Agent Protocol
Adaptive KG: Review Pending Updates
Adaptive KG: Start Local API Server
Adaptive KG: Evaluate Local Model
Privacy
Default indexing and querying are local. MCP mode does not ask Adaptive KG for
your model API key; the host agent keeps using its own account and model
session.
Project
Source, documentation, benchmarks, and release notes:
https://github.com/YijunSun/KG-RAG-CodeKG