Graph-backed knowledge extraction and agent memory for LLM systems
Project description
GraWiki
GraWiki is an early-stage open source Python project for graph-backed knowledge extraction, retrieval, and agent memory.
It combines two closely related ideas:
- GraphRAG-style ingestion and retrieval over extracted entities and relationships.
- Andrej Karpathy's "LLM Wiki" style memory, where prior agent work is stored as durable graph state instead of only transient prompt context.
The project uses an LLM to turn text into structured graph data, persists that data in a graph database, and then reuses the same graph for search, memory recall, similarity inspection, and duplicate-entity cleanup.
What GraWiki does
GraWiki currently focuses on two main workflows.
- Document-to-graph ingestion. Source documents are read, chunked, embedded, processed by an LLM extractor, and persisted as document nodes, chunk nodes, entity nodes, and typed relationships.
- Graph-backed agent memory.
Agent outputs can be stored as dedicated
__memory__nodes, linked back into the graph, and later recalled together with connected context.
Current capabilities include:
- reading source documents and splitting them into chunks,
- extracting entities and relationships from chunk text,
- persisting documents, chunks, entities, relationships, and memories in a graph database,
- retrieving graph-backed context with vector and full-text search,
- expanding graph context around matched entities and memories,
- inspecting duplicate candidates through semantic-key collision checks and pluggable similarity matchers,
- merging duplicate entities through the facade-level deduplication workflow.
Installation
Install the base package:
pip install grawiki
Install the local file-backed FalkorDBLite backend:
pip install 'grawiki[falkordblite]'
Install the full FalkorDB server backend:
pip install 'grawiki[falkordb]'
Useful optional extras:
grawiki[notebooks]for the maintained notebooks.grawiki[viz]fornetworkxandmatplotlibgraph visualization.grawiki[docs]for local MkDocs builds.grawiki[all]for the full optional dependency set.
Package layout
The public repository is organized around a small number of major areas.
src/grawiki/: main application package.tests/: pytest coverage for the facade, retrieval layer, graph models, extraction, query generation, and FalkorDB adapter.docs/: public MkDocs documentation, including narrative pages and generated API reference pages underdocs/api/.notebooks/: maintained tutorial notebooks plus sample input data.
Main package structure
grawiki.core: shared source-data types and the embedding protocol.grawiki.doc_processing: document loading and chunking.grawiki.graph: graph schema, extraction, and prompts.grawiki.db: backend-agnostic database interfaces plus the FalkorDB implementation.grawiki.retrieval: query-time retrieval strategies.grawiki.similarity: duplicate-candidate inspection, similarity matchers, and deduplication helpers.grawiki.rag: theGraphRAGfacade that ties ingestion, retrieval, memory, and deduplication together.
Core entrypoints
grawiki.GraphRAG: the main public facade.src/grawiki/rag/graph_rag.py: end-to-end ingestion, search, recall, memory, and deduplication flows.src/grawiki/graph/models.py: the canonical graph schema.src/grawiki/db/base.py: the backend contract.src/grawiki/similarity/: the duplicate-inspection and merge-support surface.
Runtime flow
At a high level, GraWiki works like this:
- A source document is loaded and split into chunks.
- Documents and chunks are embedded and persisted.
- Each chunk is sent to an LLM extractor to produce nodes and relationships.
- Extracted entities can optionally be resolved against existing persisted entities during ingest.
- The resulting graph is stored and becomes available for retrieval, memory linking, and later deduplication.
- Queries are handled through configured retrievers that combine text search, vector search, and graph-context expansion.
- Memory recall searches
__memory__nodes first, then expands linked graph context around them.
Documentation
Public documentation lives in docs/ and is built with MkDocs Material. It includes:
- conceptual background,
- flow documentation,
- a project structure page,
- generated API reference pages centered on
GraphRAG.
Tutorial notebooks
The repository ships three tutorial notebooks under notebooks/:
01_ingest_and_deduplicate.ipynb: step-by-step ingestion, entity inspection, duplicate finding, deduplication, and final querying.02_agent_memory_and_recall.ipynb: apydantic_ai.Agentwired toGraphRAG.search(...),GraphRAG.remember(...), andGraphRAG.recall(...).03_visualize_graph.ipynb: a lightweight graph view built with optionalnetworkxandmatplotlib.
Run notebook 1 first. Notebook 2 reuses the same FalkorDB graph, and notebook 3 visualizes that populated graph.
The sample texts used by the notebooks live in notebooks/experimental_data/. They are Medium.com articles by Filip Wojcik, sourced from https://medium.com/@filip.igor.wojcik, and are fully accessible without a subscription.
Development
Install development tooling:
uv sync --group dev
Install development tooling with the FalkorDBLite notebook stack:
uv sync --group dev --extra falkordblite --extra notebooks --extra viz
Install development tooling with the Docker-backed FalkorDB stack:
uv sync --group dev --extra falkordb --extra notebooks --extra viz
Install the documentation toolchain:
uv sync --group dev --extra docs
Install git hooks:
uv run pre-commit install
Run all configured checks manually:
uv run pre-commit run --all-files
Run the test suite:
uv run pytest
Build the public documentation site locally:
uv run mkdocs build --strict
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grawiki-0.1.2.tar.gz.
File metadata
- Download URL: grawiki-0.1.2.tar.gz
- Upload date:
- Size: 43.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
996637a19aa8c46086caf0703b2ef9827255cca26f5193e2dfb7db7fbd7e415c
|
|
| MD5 |
cac60a9b69a2b859548c6c0546f4dda1
|
|
| BLAKE2b-256 |
c1697f36c2f18f57a955bf9dfece93c59114d285e7300fbdbd21d3883f71128b
|
Provenance
The following attestation bundles were made for grawiki-0.1.2.tar.gz:
Publisher:
publish.yml on maddataanalyst/grawiki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grawiki-0.1.2.tar.gz -
Subject digest:
996637a19aa8c46086caf0703b2ef9827255cca26f5193e2dfb7db7fbd7e415c - Sigstore transparency entry: 1409349683
- Sigstore integration time:
-
Permalink:
maddataanalyst/grawiki@0d43a31e56d8b9ade789499f3d8f72f5968f9f52 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/maddataanalyst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d43a31e56d8b9ade789499f3d8f72f5968f9f52 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grawiki-0.1.2-py3-none-any.whl.
File metadata
- Download URL: grawiki-0.1.2-py3-none-any.whl
- Upload date:
- Size: 56.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b052f1cad12fc8f002cf618ab2039a8aea69af058038d7e6391fa19b7e646f6
|
|
| MD5 |
dc6dc03a0d3dbb4dda2ca0f02af2aa5f
|
|
| BLAKE2b-256 |
eead2103c4bc6cda5a3bf9789f1b988ba194e27cc8731f90ed941b742e89a88c
|
Provenance
The following attestation bundles were made for grawiki-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on maddataanalyst/grawiki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grawiki-0.1.2-py3-none-any.whl -
Subject digest:
8b052f1cad12fc8f002cf618ab2039a8aea69af058038d7e6391fa19b7e646f6 - Sigstore transparency entry: 1409349693
- Sigstore integration time:
-
Permalink:
maddataanalyst/grawiki@0d43a31e56d8b9ade789499f3d8f72f5968f9f52 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/maddataanalyst
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d43a31e56d8b9ade789499f3d8f72f5968f9f52 -
Trigger Event:
push
-
Statement type: