Skip to main content

Graph-backed knowledge extraction and agent memory for LLM systems

Project description

GraWiki

GraWiki logo

GraWiki is an early-stage open source Python project for graph-backed knowledge extraction, retrieval, and agent memory.

It combines two closely related ideas:

  1. GraphRAG-style ingestion and retrieval over extracted entities and relationships.
  2. 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.

  1. 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.
  2. 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] for networkx and matplotlib graph 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 under docs/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: the GraphRAG facade 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:

  1. A source document is loaded and split into chunks.
  2. Documents and chunks are embedded and persisted.
  3. Each chunk is sent to an LLM extractor to produce nodes and relationships.
  4. Extracted entities can optionally be resolved against existing persisted entities during ingest.
  5. The resulting graph is stored and becomes available for retrieval, memory linking, and later deduplication.
  6. Queries are handled through configured retrievers that combine text search, vector search, and graph-context expansion.
  7. 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: a pydantic_ai.Agent wired to GraphRAG.search(...), GraphRAG.remember(...), and GraphRAG.recall(...).
  • 03_visualize_graph.ipynb: a lightweight graph view built with optional networkx and matplotlib.

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

grawiki-0.1.2.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grawiki-0.1.2-py3-none-any.whl (56.8 kB view details)

Uploaded Python 3

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

Hashes for grawiki-0.1.2.tar.gz
Algorithm Hash digest
SHA256 996637a19aa8c46086caf0703b2ef9827255cca26f5193e2dfb7db7fbd7e415c
MD5 cac60a9b69a2b859548c6c0546f4dda1
BLAKE2b-256 c1697f36c2f18f57a955bf9dfece93c59114d285e7300fbdbd21d3883f71128b

See more details on using hashes here.

Provenance

The following attestation bundles were made for grawiki-0.1.2.tar.gz:

Publisher: publish.yml on maddataanalyst/grawiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for grawiki-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8b052f1cad12fc8f002cf618ab2039a8aea69af058038d7e6391fa19b7e646f6
MD5 dc6dc03a0d3dbb4dda2ca0f02af2aa5f
BLAKE2b-256 eead2103c4bc6cda5a3bf9789f1b988ba194e27cc8731f90ed941b742e89a88c

See more details on using hashes here.

Provenance

The following attestation bundles were made for grawiki-0.1.2-py3-none-any.whl:

Publisher: publish.yml on maddataanalyst/grawiki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page