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.11.0

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.11.0
File Size Uploaded
gragdb-0.11.0.tar.gz 617.7 kB Details

Built distributions (wheels)

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

Total release size: 4.2 MB

Release files / gragdb-0.11.0.tar.gz

Download URL gragdb-0.11.0.tar.gz
Size 617.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3ebdcef619dde8eeebf1c0d7a97755d99f9f795f5c426983847ecfb0e25c785a
BLAKE2b-256 checksum
How to use checksums
bf505afebe65cdffa4140221217ea420c96ad58ce4f2021863d4ebcd2d80a3b3
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 17, 2026.

Transparency log

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

Download URL gragdb-0.11.0-py3-none-win_amd64.whl
Size 3.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
e4d33c8e1ca21395c95e415bc0e8aafbe71e01126ac6712297e653f02fda20b3
BLAKE2b-256 checksum
How to use checksums
b43cecf1ddfc52bf24018e474205afc655b9250aacba7d656142b4d19e5d25c2
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 17, 2026.

Transparency log

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

Download URL gragdb-0.11.0-py3-none-any.whl
Size 594.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fc5e0d7ed33f5b6988f9fc1037009cbce5e48fe3f0ed61cddc27bb7926e0fc4
BLAKE2b-256 checksum
How to use checksums
db452c1b9ca10b57f7b12cf87163260c5e584ba5d5c4bfe3f21781cdf436feee
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 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

3 release files

0.12.0

3 release files

This release

0.11.0 This release

3 release files

0.10.1

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