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.

For a simple tree without nested worktrees or unwanted generated code, grag init --ingest also indexes immediately. Scanning does not yet honor .gitignore; see scope and language coverage.

Windows: the current native engine wheel may need OpenSSL DLLs installed separately. Some agent harnesses also require starting the shared server in a separate terminal. Read the Windows installation notes before your first ingest.

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
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. 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.9.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.9.0
File Size Uploaded
gragdb-0.9.0.tar.gz 566.1 kB Details

Built distributions (wheels)

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

Total release size: 4.1 MB

Release files / gragdb-0.9.0.tar.gz

Download URL gragdb-0.9.0.tar.gz
Size 566.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c86f178568ca1c9553db691f1eb5891d53249dbf1fa3bb353ca556b3edb6b7f3
BLAKE2b-256 checksum
How to use checksums
b87e6e278d4abbb2bd2f1ce6a4a5f42fcdbff7d1a08ebcdfbc1bac9fef7532c4
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 9, 2026.

Transparency log

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

Download URL gragdb-0.9.0-py3-none-win_amd64.whl
Size 3.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
585d2842d2e242ce6cec3716aa6675a3e721c44e4cce05447a778b38515dde2d
BLAKE2b-256 checksum
How to use checksums
4ef1bdce8196a6f04301c1c5bc2e3940798da92248586a4c3b7b1c18a68ec9e4
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 9, 2026.

Transparency log

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

Download URL gragdb-0.9.0-py3-none-any.whl
Size 552.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6ea8899723dba568cb4c0ae22e156ae7b553a4e34108aa2c9a27bb3596d7b55
BLAKE2b-256 checksum
How to use checksums
4efef0b46751e632f9d8aa6f80d2fa3acb37ada95965d7895d221b797c53727d
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 9, 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

0.10.1

3 release files

0.10.0

3 release files

This release

0.9.0 This release

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