RAG_Wright
A domain-retargetable, open-core engine for hybrid retrieval + knowledge-graph RAG.
RAG_Wright parses documents, chunks and embeds them, runs hybrid (dense + sparse) search with reranking, extracts a
knowledge graph with resolved entities, and answers cited, abstention-willing questions over a corpus — with
provenance and confidence on every claim. What a document means (the vocabulary, schema, and constraints) lives in
an ontology (.ttl), not in code, so standing up a new domain is a pack, not a fork.
Why it exists
Building a retrieval + knowledge-graph system for a new domain usually means rebuilding the same plumbing every time, or hardcoding one domain so deeply that the next one is a rewrite. RAG_Wright splits the two:
- the engine (this repo) is the reusable, domain-neutral machinery — ingestion and query pipelines, a capability runtime, one store, and the model seam;
- the domain is just an ontology pack + a few capabilities you author against the engine.
Answers carry citations and will abstain rather than guess, because retrieval over real corpora has to be trustworthy. It is open-core: a user-facing product is a separate repo that depends on the engine one way (Product → Engine, never the reverse). A runnable reference pack (a contract/compliance worked example) ships here so the engine is demoable out of the box — your product brings its own domain pack, not this one.
What you get
- One store. ArcadeDB holds both the hybrid retrieval index and the knowledge graph — no cross-store join to keep consistent.
- A capability runtime (ARD). Parsing, chunking, embedding, hybrid search, reranking, graph extraction, entity
resolution, reasoning/generation and more are registered capabilities invoked by name through one API — and
discoverable by task (
discover), so an agent can plan over them. The engine ships with an empty catalog; you register your domain's capabilities (or opt into the reference pack). - Knowledge in the ontology. Closed vocabularies, schema, SHACL constraints and mappings live in a
.ttlpack; code holds mechanism only. - Model-neutral. Model access is a profile seam — OpenRouter by default, self-hosted open models (vLLM) supported — never a hardcoded provider.
- Typed, provenance-first, test-driven. Ships with
py.typed; every answer carries citations; every capability has an eval.
Documentation — start here
The whole doc set is under docs/. Pick your path:
- New here? Read Concepts (the mental model), then run the Quickstart.
- Installing / configuring? Installation → Configuration.
- Building a product on the engine? The domain-adaptation guide walks the whole
sequence (author a
.ttlpack → build & register capabilities → eval-first → ingest → entity resolution → the product seam); a coding agent should drive it with theusing-the-rag-wright-engineskill. - Going deep? Architecture, the generated API reference, the Reference pack, and the ADR index.
Install
uv add rag-wright
Runtime prerequisites: ArcadeDB (the store — run it locally with Docker, see
docs/installation.md); a model provider (an OpenRouter key by default, or a self-hosted
endpoint); and, only for NER, the optional extra uv pip install 'rag-wright[ner]' + uv run python -m spacy download en_core_web_sm.
Quickstart (shape)
The whole public surface is rag_wright.api. The full runnable walkthrough (ingest a document, then query it) is in
docs/quickstart.md / examples/quickstart.py:
import asyncio
from rag_wright.api import EngineConfig, StoreConfig, open_workspace, load_reference_pack, ainvoke_subgraph
load_reference_pack() # opt in to the contract/compliance worked example (the engine ships an empty catalog)
config = EngineConfig(store=StoreConfig(host="localhost", port="2480", user="root", password="<arcadedb-password>"))
ws = open_workspace(config, corpus="demo") # corpus = the backend DB name
async def main():
out = await ainvoke_subgraph(
"intra_document_qa", {"contract_id": "ACME_MSA", "question": "What is the liability cap?"}, resources=ws)
print(out["answer"].answer, out["answer"].citations) # a grounded, cited answer (or an abstention)
asyncio.run(main())
Status
Alpha, and not yet on PyPI — install from source or a git/path dependency for now. The bundled reference pack is a worked example, not the product; restrictively-licensed evaluation corpora (CUAD/ACORD) are not shipped.
Development
Python with uv (never bare python/pip):
uv sync && uv run pytest && uv run ruff check .
Layout
src/rag_wright/
api/ the stable, domain-agnostic public surface (import everything from here)
capabilities/ the capability catalog + ARD runtime (manifests, registry, the invoker)
subgraphs/ the composite LangGraph pipelines (domain graphs; e.g. the reference pack's)
models/ the model-profile seam (OpenRouter default / self-hosted open models)
ontology/ the .ttl packs + entity-registry derivation (knowledge lives here)
store/ the single ArcadeDB store behind the query seam
spans/ operative-span segmentation + the classifier fleet
reference/ the reference-pack facades (the worked example)
mcp/ MCP tool surfaces over registered capabilities
skills/ authored capability SKILL.md content
docs/ documentation (docs/archive/ holds superseded/historical material)
Licensed under MIT. Working rules for coding agents are in CLAUDE.md.
Metadata
Release files for rag-wright 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rag_wright-0.1.0.tar.gz | 2.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rag_wright-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.8 MB
Release files / rag_wright-0.1.0.tar.gz
| Download URL | rag_wright-0.1.0.tar.gz |
|---|---|
| Size | 2.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d80915f9765cb8a528e6236999ff2c5aa2f2251d6eeea1b69c10a90387703b15
|
|
BLAKE2b-256 checksum How to use checksums |
e88a9dd5b65438bf70bc1e7e16c80aa7a64025889fc3d55e9e54b108a265de3a
|
| 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 Oct 6, 2026.
Transparency logRelease files / rag_wright-0.1.0-py3-none-any.whl
| Download URL | rag_wright-0.1.0-py3-none-any.whl |
|---|---|
| Size | 603.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1797e1e11997ee67a6e3e18b192a557c098c00ea3258c16567e8ec01134444aa
|
|
BLAKE2b-256 checksum How to use checksums |
f046e5cee543c8ef40371f0577ad8bf773fd553b0622c15e3fad32071a74cd13
|
| 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 Oct 6, 2026.
Transparency log