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.2.0.tar.gz (47.5 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.2.0-py3-none-any.whl (61.7 kB view details)

Uploaded Python 3

File details

Details for the file grawiki-0.2.0.tar.gz.

File metadata

  • Download URL: grawiki-0.2.0.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for grawiki-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a4a1de601fb19db4d1a329bcf5da903e2e7b3f6a4134257c9e536c535f9a65f4
MD5 d5fb358ecc5ce90babd96bcbb73418f6
BLAKE2b-256 910514c85f7364fd73c7a305803222f0186f623049c4eda3fcd4b442cff59d22

See more details on using hashes here.

Provenance

The following attestation bundles were made for grawiki-0.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: grawiki-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 61.7 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fc341ff4a1a9f5d088f69d91429983b7fc103e8ab0ec6d942daf56c69c274ac
MD5 77798af02027badc512d07fcfa51323a
BLAKE2b-256 ce7ab6063c927a45dc27b7e7363ae9f6b472cd11a75cc09fb58b342c3efd3da3

See more details on using hashes here.

Provenance

The following attestation bundles were made for grawiki-0.2.0-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