OntoSmith

Ontology-based GraphRAG,judged triple by triple.

OntoSmith builds knowledge graphs under an ontology a human approves first.

The schema is a flat extraction contract: entity and relation types with definitions and boundary examples. No hierarchy, no axioms: the flatness is what makes per-type quality measurable.

Powered by Jev Built on Neo4j MIT Ontology first

Install from PyPI, pip install ontosmith, and step 1 of the README runs with no API key: start with step 1.

Abdul Jabar Sabet Gulbuddin Hekmatyar Afghanistan Le Ventre de Paris Quenu aide to head of government characters
Two items from the adjudication record, drawn as the graph holds them.
01
Ingest
→
02
NER
→
03
Candidates
→
04
Gates
→
05
Route
→
06
Write
→
07
Index
→
08
Verify

Three seats, three kinds of work

The pipeline never asks one model to do everything. Measured seats are filled by the models that won their jobs in measurement, and judgment sits apart from proposing: the judge seat is the exception, because Jev is a pinned component, not a bake-off winner.

The Proposer

Claude Haiku 5.5

Proposes candidate triples for the entity pairs the pipeline enumerates. The parsing and roster work is local and deterministic. Fast, tireless, and not trusted: everything it proposes is checked.

The Judge

Jev, a decision model

Weighs every candidate against its evidence span and commits: verified, or into the review band. A small model built for exactly one skill: judgment.

The Escalation

Claude Sonnet 5.5

Off by default. When you enable it, this seat takes adjudication escalations and evaluation judging, and it never decides a build’s triples. Frontier tokens are spent only where you point them.

Plus a drafting seat you bind yourself, and an embedder (text-embedding-3-large) for the vector arm of search. Every seat is configuration, never code. Underneath, Jev judges and Neo4j stores, and a build requires both; setup is a first-class step in Connections.

What an edge buys you

A chunk store returns text and leaves the connections in it implicit. In the graph, each connection is a typed edge with its evidence attached. Three real items from the project’s own records:

News
Afghanistan head of government Gulbuddin Hekmatyar
“Sabet was a long time aide to former Afghan Prime Minister Gulbuddin Hekmatyar.”

The fact sits inside an article about Sabet. As an edge, it answers to its own subject, with the sentence attached as evidence.

Adjudication appendix item B-193, judged supported. The article is the Wikipedia entry on Abdul Jabar Sabet, via Re-DocRED.

Novel
Le Ventre de Paris characters Quenu
“He returns to his step-brother Quenu, a charcutier and his wife Lisa Quenu (formerly Macquart), with whom he finds refuge.”

Zola never lists his cast. Quenu enters through a family relation in the plot, and the edge makes him a node, linked onward to Florent and Lisa.

Adjudication appendix item B-151, judged supported. Quote spacing is normalized from the tokenized record.

Contract
“Term” defined term the ten-year period
“The term of this Agreement shall be ten (10) years (the “Term”) which shall commence on the date upon which the Company delivers to Distributor the last Sample, as defined hereinafter.”

Defined names are identities inside the document. The build resolves them to their referents, so every later “during the Term” attaches to the same node.

Corpus-profile example in the Legal Contract pack. Corpus: CUAD (The Atticus Project), CC BY 4.0.

Not a mock-up

The graph below was rendered from an actual build: the shipped legal pack’s reference corpus, judged triple by triple before a single edge was drawn.

Knowledge graph rendered from a real build
Rendered from the cuad-legal-full reference build.
4
ontology domain packs: legal, bio-medical, open-domain, and an imported FIBO contracts pack, on one shared core
8
pipeline stages, ingest to verify
3
search arms: lexical, graph, vector

Three films, in order

See it work, do it yourself, then look inside.

OntoSmith in 57 seconds.
Demo poster frame
Demo, 6 minutes

See it build

A real build, start to finish: documents in, a judged and queryable graph out.

Follow along in the README

Tutorial poster frame
Tutorial, 5 minutes 38

Do it yourself

Install, set the seats, run a small build, then serve, search, and read the evidence.

The hands-on guide

Teardown poster frame
Teardown, 7 minutes

Look inside

The pipeline, the gates, the packs, and how the published numbers were audited.

The whitepaper record

Build, then ask

The graph lives in Neo4j: one graph, the current build’s, and a build under a changed ontology replaces it, named in the run, never silent. Search fuses lexical, graph, and vector arms; a graph with no embeddings still answers on two.

# declare the connection first: the wizard walks the seats and writes your bindings
$ ontosmith configure
# build a graph from a folder of documents
$ ontosmith batch create --source ./contracts --collection contracts --docs "./contracts/*.txt" --pack legal-contract
# with Neo4j running, the graph store the build writes into (Connections)
$ ontosmith batch run <batch_id>
# serve it, then search with the evidence attached
$ ontosmith serve --batch <batch_id>
$ ontosmith search --batch <batch_id> "termination notice period"

No ontology for your documents? It drafts one.

A new document type rarely arrives with an ontology ready. The builder drafts one from your corpus profile and a short brief: by default a skeleton of type names, or, with a drafting model bound and --llm passed, full definitions and boundary examples. You review the draft and pin it as a domain pack of your own.

# profile the corpus, then draft an ontology from the profile and a short brief
$ ontosmith profile ./samples --family my-domain
$ ontosmith ontology draft --profile profiles/my-domain/profile.json --brief brief.json --pack-id my-domain --out my-domain.draft.json
# validate it, approve it (a human step), then emit the pack into this tree
$ ontosmith ontology validate <draft>
$ ontosmith ontology approve <draft> --approver "your name"
$ ontosmith ontology emit <draft> --approval <approval> --out-root .
# check the emitted pack before a build runs under it
$ ontosmith ontology check packs/<pack_id>

Ontologies ship as data

Version-pinned packs, never domain code paths. Every domain pack stands on the same core baseline: core itself is not a domain pack, it is what the domain packs extend. A document type with no pack yet can grow its own.

core, baseline open-domain legal-contract bio-medical fibo-contracts
Every number this project claims is measured first and published with its working: see the whitepaper.