graffiti · code graph
GitHub
Comparison

graffiti vs RAG vs Cursor:
which gives your AI the best code context?

There are three common ways to give an AI coding assistant context about your code — embedding-based RAG, an AI editor like Cursor, and graffiti's static code graph. Here is how they actually differ, and where graffiti fits.

In one sentence

graffiti gives your assistant exact structural context — the real calls, definitions and imports — fully offline and at $0, where embeddings/RAG retrieve approximate matches and editors like Cursor manage context inside the IDE. It complements both: point them at graffiti's graph over MCP.

Install in 30s

graffiti vs embeddings / RAG

RAG embeds your code into vectors and retrieves chunks by semantic similarity. graffiti builds an exact graph of how the code actually connects.

Dimension Embeddings / RAG graffiti
Retrieval methodapproximate vector (semantic) similarityexact directed graph of calls, definitions & imports
What it returnsnearest-neighbor text chunksthe real callers, callees & definitions — a scoped subgraph
Determinismvaries with model & index versionbyte-deterministic — same repo yields an identical map.json
Cost & infrastructureembedding model + vector database, usually paid or cloudone static binary — $0, no model, no database
Privacy & offlineoften sends code to an API to embed itfully offline; nothing about your code leaves your machine
Setup & upkeepchunk, embed, store, and re-embed on every changerun graffiti .; a per-file cache re-parses only what changed
Best atfuzzy natural-language recall (“find code about X”)structural questions: who calls what, change impact, dependencies
View on GitHub

graffiti vs Cursor

Cursor is an AI editor that indexes your codebase to feed its built-in assistant. graffiti is an editor-agnostic context layer you can use anywhere — including inside Cursor.

Dimension Cursor graffiti
What it isan AI code editor (a full IDE) with built-in codebase indexinga CLI that builds a code-graph context layer — editor-agnostic
How it gives the AI contextindexes your codebase with embeddings inside the editora directed graph of calls/defs/imports your assistant queries
Where it runscloud-assisted indexing; a privacy mode is availablefully local & offline — nothing leaves your machine
Costpaid subscription for full featuresfree to build & run on your own repos (Source-Available)
Portabilitycontext lives inside the Cursor editorone binary, usable from any tool via MCP or paste — Claude Code, ChatGPT, Cursor
Determinisma managed index — not a file you can open or diffbyte-deterministic map.json you can commit & diff
Use them togetheradd graffiti as an MCP server so Cursor's AI can read the graph
★ Service architecture · the killer feature

When to use which

Reach for embeddings/RAG when you want fuzzy, natural-language recall across code and docs. Reach for an AI editor like Cursor for inline authoring as you type. Reach for graffiti when you need exact structure — who calls what, what breaks if you change an endpoint, cross-service dependencies — fully offline, $0, and reproducible. They stack: graffiti feeds precise structure into whichever assistant you already use.

Comparison questions

How is graffiti different from RAG or embeddings for code?
Does graffiti work with Cursor, Copilot, and ChatGPT, or only Claude Code?
Is there a free, offline alternative to cloud code indexing, embeddings, or RAG?

Give your assistant the map.

One command builds the graph — free, offline, deterministic. Then query it, or wire it into Claude Code, Cursor, or ChatGPT.

curl -fsSL https://raw.githubusercontent.com/amazopic/graffiti/main/scripts/install.sh | sh
graffiti .                 # build the code graph
graffiti serve             # expose it over MCP (Cursor, Claude Code, …)

← Back to the overview