Skip to main content

grag

Local graph memory for AI agents. Keep code structure, documents and decisions in a project knowledge graph that your agent can query and update across sessions.

Documentation · Getting started · PyPI · DeepWiki

grag combines an embedded LadybugDB database with MCP tools, full-text search and optional vector retrieval. It returns source citations and connected context under a configurable budget. The package is gragdb; the command and Python import are grag.

Start with your project

Python 3.10–3.14. Use a stable CLI installation so the launcher survives changes to your project's virtual environment:

pipx install 'gragdb[code]'
cd your-project
grag init

uv tool install 'gragdb[code]' or pip install 'gragdb[code]' also works. The code extra enables non-Python parsers; plain gragdb can index Python.

Restart your MCP client, then ask:

Index this project's source directory with grag. Show me where the authentication functions are defined, with file and line citations.

Remember why we chose this authentication approach, with its source, and link the decision to the relevant code.

init supports Claude Code, Cursor, Windsurf and Zed. Use --client claude or --client cursor to select explicitly. It saves the checkout's database and port, installs agent guidance, and configures a shared server that starts on first use. grag status shows its address and log; grag stop shuts it down cleanly.

grag init --ingest also indexes immediately. Scanning honors .gitignore and .gragignore, and skips nested repositories/worktrees and symlinks. Choose the intended roots; see scope and language coverage.

Windows: grag 0.9.0+ Windows x64 wheels include the required OpenSSL DLLs. Some agent harnesses require starting the shared server in a separate terminal. The Windows installation notes cover that case, source builds and offline readiness checks.

What it helps with

  • Find code structure: definitions, signatures and line ranges, with supported import/call relationships. Source bodies stay in your files.
  • Keep project memory: agents save decisions, tasks and evidence, and can preserve correction history when updating them.
  • Connect documents and code: index Markdown sections and link mentioned symbols.
  • Retrieve focused context: BM25 search, optional embeddings, graph expansion, citations and explicit truncation. Budgets use a byte-based token estimate.
  • Share across harnesses: Claude Code and Cursor can use one database through one owning server. New worktrees get separate databases by default.
  • Preserve continuity: consistent backups retain authored history and retry receipts, with verified restore into a separate database.

Code coverage varies. Python, JS/TS and Go support conservative static relationships; framework scripts and Java/C# overload identities also have explicit coverage. See language coverage. An absent edge does not prove no relationship exists. grag complements source search; useful answers and token savings depend on the question, graph and harness.

Local by default

The default install uses BM25 without an embedding service. Graph storage and retrieval run locally. Native extensions and optional grammars/models can require first-use downloads; prepare those assets before offline use. Your agent harness may send retrieved context to its model provider.

Local embeddings are optional through gragdb[embed-local] and ONNX Runtime. Installing that extra makes a later init configure them automatically; model preparation costs time, disk and memory. The optional remote provider sends embedding input to its configured endpoint.

Go deeper

Task Guide
Understand the components and data flow Architecture
Install and verify a first session Getting started
Index code or documents Code · Documents
Save, revise and retrieve evidence Memory · Retrieval
Connect multiple clients or move a checkout Servers · Projects
Diagnose startup, locks or recovery Troubleshooting · Recovery
Configure tools and resource limits MCP · Configuration · Limits
Develop and measure grag Development · Contributing

The maintained documentation lives in docs/ and publishes to GitHub Pages, including the maintained architecture guide. DeepWiki is a supplementary, generated architecture guide; check its displayed source commit and indexing date before relying on it.

MIT license.

Release files for gragdb 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gragdb 0.10.1
File Size Uploaded
gragdb-0.10.1.tar.gz 583.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for gragdb 0.10.1
File Interpreter ABI Platform
gragdb-0.10.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
gragdb-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 4.2 MB

Release files / gragdb-0.10.1.tar.gz

Download URL gragdb-0.10.1.tar.gz
Size 583.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dda43911c53d76f5e9ac0140686b36debdbf4e718fadc9c039080a7933904e72
BLAKE2b-256 checksum
How to use checksums
46f6c88e97f243cbaf8ad483545f67b5cce025e42ef8b5afd402d9b3ffbdb82c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / gragdb-0.10.1-py3-none-win_amd64.whl

Download URL gragdb-0.10.1-py3-none-win_amd64.whl
Size 3.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
2749baa3918c7b817ce7450c139e503297532aeb25be77afc128e03e3e55d030
BLAKE2b-256 checksum
How to use checksums
a6b5af37647f3e0b4463cd7d53b9e39b8697c96f3c27f943624f91456ee976e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / gragdb-0.10.1-py3-none-any.whl

Download URL gragdb-0.10.1-py3-none-any.whl
Size 577.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b8a7f63563b43b61f66686757ab56ba001ab16924230727d205c089ab9dcf86
BLAKE2b-256 checksum
How to use checksums
1b5a111881c3b098863b4b987af300273c293b65de67457a65b41e1608106910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

3 release files

0.12.0

3 release files

0.11.0

3 release files

This release

0.10.1 This release

3 release files

0.10.0

3 release files

0.9.0

3 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page