Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsSep 13, 2026·3 min de lecture

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.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Graft
Commande d'installation directe
npx -y tokrepo@latest install 904cea6a-af52-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en 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

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires