Configs2026年9月13日·1 分钟阅读

Graft — Code Intelligence for AI Coding Agents

A code-graph engine that indexes your codebase into a knowledge graph, giving AI coding agents contextual understanding with fewer tokens and faster responses.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Graft
直接安装命令
npx -y tokrepo@latest install 904cea6a-af52-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Graft is a TypeScript-based code intelligence engine that builds a persistent knowledge graph of your codebase. It parses source files with tree-sitter, extracts symbols, relationships, and call chains, then serves this structured context to AI coding agents. The result: agents understand your code faster, use fewer tokens, and produce more accurate edits.

What Graft Does

  • Indexes codebases into a queryable knowledge graph of symbols and their relationships
  • Provides an MCP server that AI coding agents can query for contextual code understanding
  • Reduces token consumption by serving precise, relevant context instead of raw file dumps
  • Supports incremental re-indexing so the graph stays current as code changes
  • Works with Claude Code, Cursor, Codex, Gemini CLI, and any MCP-compatible agent

Architecture Overview

Graft uses tree-sitter parsers to produce ASTs for each source file, then extracts a graph of definitions, references, imports, and call sites. This graph is stored in a local SQLite database for fast querying. The MCP server exposes graph queries as tools that agents can call — for example, asking for all callers of a function, or the dependency chain of a module. The indexer runs as a background process that watches for file changes and updates the graph incrementally.

Self-Hosting & Configuration

  • Initialize with npx graft init in your project root to generate a config file
  • Run npx graft index to build the initial code graph
  • Start the MCP server with npx graft serve and point your agent to it
  • Configure language support and excluded directories in graft.config.json
  • Set the graph database path and cache size for large monorepos

Key Features

  • Tree-sitter-based parsing with support for 50+ programming languages
  • Incremental indexing keeps the graph fresh without full rebuilds
  • MCP server integrates with all major AI coding agents out of the box
  • Sub-millisecond query responses for symbol lookups and relationship traversals
  • Open source with no external API dependencies — everything runs locally

Comparison with Similar Tools

  • Graphify — builds knowledge graphs from code; Graft focuses on MCP-native agent integration
  • Codebase Memory MCP — persistent code index; Graft uses tree-sitter for precise AST-level graphs
  • Sourcegraph — enterprise code search; Graft is local-first and agent-oriented
  • Codegraph — similar graph approach; Graft emphasizes incremental updates and MCP serving

FAQ

Q: Does Graft work with monorepos? A: Yes. Configure workspace roots in the config file and Graft indexes them as a unified graph.

Q: Which languages are supported? A: Any language with a tree-sitter grammar — TypeScript, Python, Go, Rust, Java, C/C++, and more.

Q: How much disk space does the graph use? A: Typically 1-5% of the source code size, stored in a local SQLite database.

Q: Can I use Graft without an AI agent? A: Yes. The CLI includes query commands for exploring the code graph directly.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产