ontosmith 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. ontosmith-0.1.0/LICENSE +21 -0
  2. ontosmith-0.1.0/PKG-INFO +507 -0
  3. ontosmith-0.1.0/README.md +470 -0
  4. ontosmith-0.1.0/api/__init__.py +14 -0
  5. ontosmith-0.1.0/api/server.py +440 -0
  6. ontosmith-0.1.0/app/app.css +312 -0
  7. ontosmith-0.1.0/app/app.js +409 -0
  8. ontosmith-0.1.0/app/favicon.svg +1 -0
  9. ontosmith-0.1.0/app/index.html +72 -0
  10. ontosmith-0.1.0/app/logo-mark.svg +1 -0
  11. ontosmith-0.1.0/examples/README.md +129 -0
  12. ontosmith-0.1.0/examples/corpus/alder-finch-history.txt +1 -0
  13. ontosmith-0.1.0/examples/corpus/alder-finch-people.txt +1 -0
  14. ontosmith-0.1.0/examples/corpus/alder-finch-products.txt +1 -0
  15. ontosmith-0.1.0/examples/corpus/alder-finch-workshops.txt +1 -0
  16. ontosmith-0.1.0/examples/triples.jsonl +7 -0
  17. ontosmith-0.1.0/harness/__init__.py +10 -0
  18. ontosmith-0.1.0/harness/canonicalization.py +298 -0
  19. ontosmith-0.1.0/harness/doc_check.py +113 -0
  20. ontosmith-0.1.0/harness/make_graph_image.py +103 -0
  21. ontosmith-0.1.0/harness/rag_eval.py +116 -0
  22. ontosmith-0.1.0/harness/rag_eval_embedder.py +164 -0
  23. ontosmith-0.1.0/harness/rag_eval_hybrid_search.py +130 -0
  24. ontosmith-0.1.0/harness/render_charts.py +449 -0
  25. ontosmith-0.1.0/harness/verification/__init__.py +33 -0
  26. ontosmith-0.1.0/harness/verification/audit.py +168 -0
  27. ontosmith-0.1.0/harness/verification/cell_runner.py +179 -0
  28. ontosmith-0.1.0/harness/verification/config.py +379 -0
  29. ontosmith-0.1.0/harness/verification/report.py +114 -0
  30. ontosmith-0.1.0/harness/verification/scoring.py +285 -0
  31. ontosmith-0.1.0/harness/verification/verify_cli.py +164 -0
  32. ontosmith-0.1.0/ontosmith.egg-info/PKG-INFO +507 -0
  33. ontosmith-0.1.0/ontosmith.egg-info/SOURCES.txt +161 -0
  34. ontosmith-0.1.0/ontosmith.egg-info/dependency_links.txt +1 -0
  35. ontosmith-0.1.0/ontosmith.egg-info/entry_points.txt +2 -0
  36. ontosmith-0.1.0/ontosmith.egg-info/requires.txt +14 -0
  37. ontosmith-0.1.0/ontosmith.egg-info/top_level.txt +3 -0
  38. ontosmith-0.1.0/packs/bio-medical/conformance.json +100 -0
  39. ontosmith-0.1.0/packs/bio-medical/fitted_qualifiers.json +33 -0
  40. ontosmith-0.1.0/packs/bio-medical/pack.json +114 -0
  41. ontosmith-0.1.0/packs/bio-medical/profile/CENSUS.md +139 -0
  42. ontosmith-0.1.0/packs/bio-medical/profile/profile.json +316 -0
  43. ontosmith-0.1.0/packs/bio-medical/profile/profile_v2.json +816 -0
  44. ontosmith-0.1.0/packs/bio-medical/profile/setup_config.json +450 -0
  45. ontosmith-0.1.0/packs/bio-medical/profile/setup_config_v3.json +445 -0
  46. ontosmith-0.1.0/packs/bio-medical/profile/setup_config_v4.json +450 -0
  47. ontosmith-0.1.0/packs/conformance.schema.json +1 -0
  48. ontosmith-0.1.0/packs/core/conformance.json +1 -0
  49. ontosmith-0.1.0/packs/core/pack.json +1 -0
  50. ontosmith-0.1.0/packs/core/profile/setup_config.json +27 -0
  51. ontosmith-0.1.0/packs/fetch_btt.py +107 -0
  52. ontosmith-0.1.0/packs/fetch_gutenberg.py +93 -0
  53. ontosmith-0.1.0/packs/legal-contract/conformance.json +60 -0
  54. ontosmith-0.1.0/packs/legal-contract/pack.json +57 -0
  55. ontosmith-0.1.0/packs/legal-contract/profile/profile.json +1525 -0
  56. ontosmith-0.1.0/packs/legal-contract/profile/profile.md +141 -0
  57. ontosmith-0.1.0/packs/legal-contract/profile/setup_config.json +79 -0
  58. ontosmith-0.1.0/packs/legal-contract/role_words.json +1 -0
  59. ontosmith-0.1.0/packs/open-domain/conformance.json +1 -0
  60. ontosmith-0.1.0/packs/open-domain/direction_declarations.json +442 -0
  61. ontosmith-0.1.0/packs/open-domain/pack.json +72 -0
  62. ontosmith-0.1.0/packs/open-domain/profile/profile.json +9 -0
  63. ontosmith-0.1.0/packs/open-domain/profile/setup_config.json +591 -0
  64. ontosmith-0.1.0/packs/open-domain/profile/setup_config_v2.json +1140 -0
  65. ontosmith-0.1.0/packs/open-domain/tn_table.json +101 -0
  66. ontosmith-0.1.0/packs/pack.schema.json +1 -0
  67. ontosmith-0.1.0/pipeline/__init__.py +4 -0
  68. ontosmith-0.1.0/pipeline/__main__.py +175 -0
  69. ontosmith-0.1.0/pipeline/analyze_hardened.py +138 -0
  70. ontosmith-0.1.0/pipeline/batch.py +274 -0
  71. ontosmith-0.1.0/pipeline/batch_cli.py +924 -0
  72. ontosmith-0.1.0/pipeline/batch_run.py +2581 -0
  73. ontosmith-0.1.0/pipeline/bindings-template.env +67 -0
  74. ontosmith-0.1.0/pipeline/biored_candidates.py +127 -0
  75. ontosmith-0.1.0/pipeline/calibration.py +58 -0
  76. ontosmith-0.1.0/pipeline/configure.py +540 -0
  77. ontosmith-0.1.0/pipeline/conflict_candidates.py +102 -0
  78. ontosmith-0.1.0/pipeline/connections.py +608 -0
  79. ontosmith-0.1.0/pipeline/decisions.py +409 -0
  80. ontosmith-0.1.0/pipeline/docred.py +113 -0
  81. ontosmith-0.1.0/pipeline/drift_check.py +281 -0
  82. ontosmith-0.1.0/pipeline/embedder.py +157 -0
  83. ontosmith-0.1.0/pipeline/ensemble.py +98 -0
  84. ontosmith-0.1.0/pipeline/er_candidates.py +80 -0
  85. ontosmith-0.1.0/pipeline/evaluate.py +163 -0
  86. ontosmith-0.1.0/pipeline/export_graph.py +68 -0
  87. ontosmith-0.1.0/pipeline/file_registry.py +716 -0
  88. ontosmith-0.1.0/pipeline/gate_cli.py +816 -0
  89. ontosmith-0.1.0/pipeline/graph_store.py +724 -0
  90. ontosmith-0.1.0/pipeline/graph_write.py +91 -0
  91. ontosmith-0.1.0/pipeline/hard_negatives.py +125 -0
  92. ontosmith-0.1.0/pipeline/heartbeat.py +39 -0
  93. ontosmith-0.1.0/pipeline/inspect.py +289 -0
  94. ontosmith-0.1.0/pipeline/neo4j_store.py +719 -0
  95. ontosmith-0.1.0/pipeline/onto_candidates.py +141 -0
  96. ontosmith-0.1.0/pipeline/ontology_builder.py +1192 -0
  97. ontosmith-0.1.0/pipeline/operating_points.py +103 -0
  98. ontosmith-0.1.0/pipeline/pack_schema.py +345 -0
  99. ontosmith-0.1.0/pipeline/pair_proposer.py +839 -0
  100. ontosmith-0.1.0/pipeline/profile_config.py +1106 -0
  101. ontosmith-0.1.0/pipeline/profiler.py +134 -0
  102. ontosmith-0.1.0/pipeline/promotion.py +261 -0
  103. ontosmith-0.1.0/pipeline/proposer.py +557 -0
  104. ontosmith-0.1.0/pipeline/query_stack.py +1330 -0
  105. ontosmith-0.1.0/pipeline/queue.py +256 -0
  106. ontosmith-0.1.0/pipeline/recalibrate.py +77 -0
  107. ontosmith-0.1.0/pipeline/reference_profile.py +67 -0
  108. ontosmith-0.1.0/pipeline/registry.py +284 -0
  109. ontosmith-0.1.0/pipeline/registry_store.py +121 -0
  110. ontosmith-0.1.0/pipeline/relation_map.py +92 -0
  111. ontosmith-0.1.0/pipeline/rer.py +379 -0
  112. ontosmith-0.1.0/pipeline/retrieval_eval.py +186 -0
  113. ontosmith-0.1.0/pipeline/review.py +233 -0
  114. ontosmith-0.1.0/pipeline/roster_pass.py +188 -0
  115. ontosmith-0.1.0/pipeline/search.py +1093 -0
  116. ontosmith-0.1.0/pipeline/setup_service.py +958 -0
  117. ontosmith-0.1.0/pipeline/threshold_stability.py +59 -0
  118. ontosmith-0.1.0/pipeline/turtle_export.py +103 -0
  119. ontosmith-0.1.0/pyproject.toml +168 -0
  120. ontosmith-0.1.0/setup.cfg +4 -0
  121. ontosmith-0.1.0/tests/test_api_server.py +216 -0
  122. ontosmith-0.1.0/tests/test_app.py +251 -0
  123. ontosmith-0.1.0/tests/test_appendix.py +153 -0
  124. ontosmith-0.1.0/tests/test_batch_cli.py +253 -0
  125. ontosmith-0.1.0/tests/test_bindings_regressions.py +545 -0
  126. ontosmith-0.1.0/tests/test_canonicalization.py +106 -0
  127. ontosmith-0.1.0/tests/test_charts.py +96 -0
  128. ontosmith-0.1.0/tests/test_configure.py +322 -0
  129. ontosmith-0.1.0/tests/test_connections.py +700 -0
  130. ontosmith-0.1.0/tests/test_core_pack.py +255 -0
  131. ontosmith-0.1.0/tests/test_demo.py +81 -0
  132. ontosmith-0.1.0/tests/test_doc_guards.py +185 -0
  133. ontosmith-0.1.0/tests/test_drift_check.py +341 -0
  134. ontosmith-0.1.0/tests/test_er_settlement.py +504 -0
  135. ontosmith-0.1.0/tests/test_evaluate.py +75 -0
  136. ontosmith-0.1.0/tests/test_examples.py +62 -0
  137. ontosmith-0.1.0/tests/test_gate_cli.py +248 -0
  138. ontosmith-0.1.0/tests/test_hardening_regressions.py +508 -0
  139. ontosmith-0.1.0/tests/test_imports.py +73 -0
  140. ontosmith-0.1.0/tests/test_inspect.py +185 -0
  141. ontosmith-0.1.0/tests/test_installed_packs.py +158 -0
  142. ontosmith-0.1.0/tests/test_installed_wheel.py +226 -0
  143. ontosmith-0.1.0/tests/test_ontology_builder.py +469 -0
  144. ontosmith-0.1.0/tests/test_pack_schema.py +257 -0
  145. ontosmith-0.1.0/tests/test_packaging.py +141 -0
  146. ontosmith-0.1.0/tests/test_packs.py +115 -0
  147. ontosmith-0.1.0/tests/test_preflight.py +259 -0
  148. ontosmith-0.1.0/tests/test_profile_config_registry.py +93 -0
  149. ontosmith-0.1.0/tests/test_profiler.py +166 -0
  150. ontosmith-0.1.0/tests/test_provider_generalization.py +427 -0
  151. ontosmith-0.1.0/tests/test_pypi_readme.py +217 -0
  152. ontosmith-0.1.0/tests/test_reference_profile.py +163 -0
  153. ontosmith-0.1.0/tests/test_role_words.py +148 -0
  154. ontosmith-0.1.0/tests/test_search.py +597 -0
  155. ontosmith-0.1.0/tests/test_state_root.py +116 -0
  156. ontosmith-0.1.0/tests/test_store_identity.py +694 -0
  157. ontosmith-0.1.0/tests/test_theme_attest.py +200 -0
  158. ontosmith-0.1.0/tests/test_tree_hygiene.py +169 -0
  159. ontosmith-0.1.0/tests/test_verification_audit.py +85 -0
  160. ontosmith-0.1.0/tests/test_verification_cell_runner.py +123 -0
  161. ontosmith-0.1.0/tests/test_verification_config.py +160 -0
  162. ontosmith-0.1.0/tests/test_verification_scoring.py +173 -0
  163. ontosmith-0.1.0/tests/test_verify_cli.py +57 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dongbum Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,507 @@
1
+ Metadata-Version: 2.4
2
+ Name: ontosmith
3
+ Version: 0.1.0
4
+ Summary: Ontology-driven knowledge-graph builder: design the ontology, build the graph under it, and serve it — search, API, and app — from one pipeline.
5
+ Author: Dongbum Lee
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Dongbumlee/ontosmith
8
+ Project-URL: Documentation, https://github.com/Dongbumlee/ontosmith#readme
9
+ Project-URL: Repository, https://github.com/Dongbumlee/ontosmith
10
+ Project-URL: Issues, https://github.com/Dongbumlee/ontosmith/issues
11
+ Project-URL: Changelog, https://github.com/Dongbumlee/ontosmith/blob/main/CHANGELOG.md
12
+ Keywords: knowledge-graph,ontology,graphrag,information-extraction,entity-resolution,llm,provenance,benchmark,nlp
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Text Processing :: Linguistic
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy
26
+ Requires-Dist: requests
27
+ Provides-Extra: neo4j
28
+ Requires-Dist: neo4j; extra == "neo4j"
29
+ Provides-Extra: nlp
30
+ Requires-Dist: spacy; extra == "nlp"
31
+ Requires-Dist: gliner; extra == "nlp"
32
+ Provides-Extra: viz
33
+ Requires-Dist: matplotlib; extra == "viz"
34
+ Requires-Dist: networkx; extra == "viz"
35
+ Requires-Dist: python-louvain; extra == "viz"
36
+ Dynamic: license-file
37
+
38
+ # OntoSmith
39
+
40
+ ![OntoSmith](https://github.com/Dongbumlee/ontosmith/raw/main/assets/brand/banner.png)
41
+
42
+ [![PyPI](https://img.shields.io/pypi/v/ontosmith)](https://pypi.org/project/ontosmith/)
43
+ [![Python versions](https://img.shields.io/pypi/pyversions/ontosmith)](https://pypi.org/project/ontosmith/)
44
+ [![CI](https://github.com/Dongbumlee/ontosmith/actions/workflows/ci.yml/badge.svg)](https://github.com/Dongbumlee/ontosmith/actions/workflows/ci.yml)
45
+
46
+ **An ontology-driven knowledge-graph builder: design the
47
+ ontology, build the graph under it, and serve it — search,
48
+ API, and app — from one pipeline.**
49
+
50
+ *Powered by Jev — the decision (judge) model inside
51
+ OntoSmith.*
52
+
53
+ The stack has two named pillars: **Jev** judges what is
54
+ true enough to write, and **Neo4j** stores the graph —
55
+ native graph traversal, a vector index, and full-text
56
+ search in one store. A build requires both.
57
+
58
+ Most knowledge-graph tooling starts from whatever a model
59
+ happens to extract. OntoSmith starts from the ontology:
60
+ you design the schema first — entity and relation types,
61
+ definitions, boundary examples — a human approves it, and
62
+ the graph is then built *under* that schema by a pipeline
63
+ that separates proposing from judging. Models propose
64
+ candidates; a fitted pair call converts enumerated pairs
65
+ into candidate triples, and deterministic gates and the
66
+ Jev decision model decide what is true enough to write.
67
+ Every written triple
68
+ carries its evidence span and provenance, and every build
69
+ prices itself before it spends.
70
+
71
+ ## What the schema is — and is not
72
+
73
+ The ontology here is a **flat extraction contract**: a
74
+ closed inventory of entity and relation types, each with
75
+ a definition and boundary examples — drafted from your
76
+ corpus or imported, approved by a human, and enforced
77
+ type by type by the decision model. It is deliberately
78
+ *not* a formal ontology: there is no class hierarchy,
79
+ no inheritance, and no logical axioms — OntoSmith is
80
+ not an OWL ontology editor, and it runs no inference
81
+ or reasoning over the graph. The flatness is the point:
82
+ judged per-type decisions are what make a build's
83
+ quality measurable, and hierarchy would blur exactly
84
+ those decisions. The job this shape is production-shaped
85
+ for is narrower and concrete: turn a document corpus
86
+ into a governed, evidence-carrying graph that search
87
+ and agents can answer from.
88
+
89
+ ![A built knowledge graph: the Bellicum–Miltenyi neighborhood of one CUAD supply agreement](https://github.com/Dongbumlee/ontosmith/raw/main/docs/assets/built-graph.png)
90
+
91
+ *A real build, not a mock-up: the two parties' neighborhood
92
+ in one CUAD supply agreement (Bellicum Pharmaceuticals ×
93
+ Miltenyi Biotec), built by the Legal Contract pack — 42
94
+ entities, 77 Tier-1 triples, every one carrying its evidence
95
+ span and provenance. Corpus: CUAD (The Atticus Project),
96
+ CC BY 4.0.*
97
+
98
+ ![The batch pipeline: eight stages with the ROUTE tier branches](https://github.com/Dongbumlee/ontosmith/raw/main/docs/assets/pipeline-flow.png)
99
+
100
+ *The batch stage contract and its tier branches, as coded
101
+ in `pipeline/` — rendered by `harness/render_charts.py`.*
102
+
103
+ ## Try it — step 1 needs no API key
104
+
105
+ **Requirements**
106
+
107
+ - **OS** — Linux (developed and tested on Linux).
108
+ Windows: run under **WSL2** — native Windows is not
109
+ a tested platform.
110
+ - **Python** ≥ 3.11.
111
+ - **An LLM connection** — only for step 3 and live
112
+ builds; steps 1–2 run keyless.
113
+ - **Neo4j** (5.x, Community Edition is enough) — the
114
+ graph store a live build writes into; only step 3
115
+ needs it running. Setup in
116
+ [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md).
117
+
118
+ **Step 1 · Look around (no key, two minutes).**
119
+ Install from PyPI:
120
+
121
+ ```console
122
+ $ pip install ontosmith
123
+ $ ontosmith profile examples/corpus --family demo
124
+ Corpus profile
125
+ family demo
126
+ status COMPLETE
127
+ documents 4
128
+ claims 6
129
+ decision points 0
130
+ profile hash sha256:7ae51d31fa9120ec
131
+ spend $0.0000
132
+ written profiles/demo (profile.json, setup_config.json, profile.md)
133
+
134
+ $ ontosmith inspect examples/triples.jsonl
135
+ Triple (1 of 7 in examples/triples.jsonl)
136
+ subject Alder & Finch
137
+ relation founded by
138
+ object Mara Alder
139
+ Evidence
140
+ [quote] Alder & Finch is a ceramics studio founded in 2011 by Mara Alder and Tomas Finch.
141
+ Provenance
142
+ doc_id alder-finch-history
143
+ tier 1
144
+ p_true 0.98
145
+ ```
146
+
147
+ `p_true` is the judge's ranking score for the triple —
148
+ a score to sort and threshold by, not a calibrated
149
+ probability.
150
+
151
+ The profiler is deterministic — the same corpus yields
152
+ the same profile hash on every run — and the example's
153
+ build output ships as a recorded artefact, so inspection
154
+ runs offline too. Profiling, inspecting, validating, and
155
+ the verification math all run keyless; the full list is
156
+ in [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md).
157
+
158
+ Ask the shipped example build a question — retrieval
159
+ over the recorded artefacts, still no key:
160
+
161
+ ```console
162
+ $ ontosmith search "Who founded Alder & Finch?"
163
+ ```
164
+
165
+ And `profile` runs the same way on **your own** folder:
166
+ point it at any corpus directory to see whether it fits
167
+ before any build.
168
+
169
+ **Step 2 · Check the evidence (no key).** The flagship
170
+ build's corrected scoring replays from its shipped
171
+ adjudication appendix — no model calls, and the script
172
+ exits non-zero if any figure drifts:
173
+ `python examples/demo/replay_scores.py`
174
+ ([guide](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md), appendix track). Every
175
+ headline figure maps to the command that recomputes it
176
+ in [reproduce/](https://github.com/Dongbumlee/ontosmith/tree/main/reproduce).
177
+
178
+ **Step 3 · Build with your own connection.** The
179
+ prerequisites, gathered in one place: declare the
180
+ binding with `ontosmith configure` — it walks the
181
+ seats from the preset's values, probes the result
182
+ with zero spend, and writes the bindings file. For
183
+ the reference preset, accept the defaults and set
184
+ `OPENROUTER_API_KEY` — the same key reaches every
185
+ seat, the judge included
186
+ ([Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md) explains the route
187
+ and how to bind your own provider instead);
188
+ install the NLP extra and its model for the full local
189
+ pipeline (`pip install ".[nlp]"`, then
190
+ `python -m spacy download en_core_web_sm`). The extra
191
+ is a heavy install — it pulls the CUDA torch stack,
192
+ several gigabytes — and it serves the default
193
+ candidate path; a build run with
194
+ `--candidate-source llm` (the hands-on Track 1 route)
195
+ never loads GLiNER, so try that path first if the
196
+ download is a problem. One LLM
197
+ connection is the only *model* connection a build
198
+ needs; [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md) covers the
199
+ seats it plugs into and the recommended models. The
200
+ build also needs **Neo4j running** — it is the graph
201
+ store WRITE, INDEX, and VERIFY work in. Install it,
202
+ set its password, and export `NEO4J_PASSWORD` (a local
203
+ default install needs nothing else; the connection
204
+ variables and setup are in
205
+ [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md)). The run probes
206
+ the store before the first stage and refuses by name
207
+ if it is not serving, so a missing store costs no
208
+ spend. Cost, with its
209
+ scope: the four-document demo subset prices at roughly
210
+ $1–2 end to end, fixed overhead included. A full
211
+ corpus prices from the counted projection before it
212
+ runs (Cost guardrails, below). The flagship run's
213
+ governing total prices at 3.8¢ per document over 500
214
+ documents — key-observed; the run's counted ledger
215
+ reads 3.7¢ (whitepaper §5.6). Then the
216
+ [hands-on guide](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md) (Track 1) walks a
217
+ live build on your own documents end to end — profile,
218
+ create, capped run, and the serve / search / inspect
219
+ finish line. A run whose key is missing refuses before
220
+ any stage starts, with the error naming the seat and
221
+ the variable to set.
222
+
223
+ Optional surfaces install as extras:
224
+ `pip install "ontosmith[nlp]"`
225
+ (the pipeline candidate path's local NER),
226
+ `"ontosmith[viz]"`.
227
+ (The `"ontosmith[neo4j]"` extra installs the official
228
+ driver the export utilities use; the build itself talks
229
+ to Neo4j over HTTP and needs the server, not the extra.)
230
+
231
+ ## What's in the box
232
+
233
+ | Piece | What it is |
234
+ |---|---|
235
+ | Batch pipeline | The staged build: ingest → NER/roster → candidates → gates → route → write → index → verify, under a versioned pack, with a ledger-enforced spend cap |
236
+ | Corpus profiler | `ontosmith profile` — a deterministic census of your corpus and the decision points a human should settle first |
237
+ | Ontology builder | `ontosmith ontology` — drafts a domain schema from a profile; deterministic validation; emits a hash-pinned pack only after explicit human approval |
238
+ | Three domain packs + Core baseline | Domain ontologies as data — schema, definitions, boundary examples, thresholds, measured conformance record (below) |
239
+ | Verification cores | `ontosmith verify` — raw *and* audit-corrected scoring, ceiling-adjusted recall, failure anatomy, counted cost projections |
240
+ | Evidence appendix | The flagship record's adjudication samples and verdicts, shipped for replay (`benchmarks/appendix/`) |
241
+ | Serving | Hybrid retrieval (vector + lexical + graph) via `ontosmith search` and a sample API — over the build's Neo4j store; the shipped demo's recorded artifacts also serve from files (lexical + graph arms only — no vector arm) |
242
+ | Demo + guide | A smoke corpus, a fetchable demo subset, and the hands-on guide that walks the whole loop twice |
243
+
244
+ ## Where do I start?
245
+
246
+ | I want to… | Start here |
247
+ |---|---|
248
+ | See if my corpus fits | Step 1 above — profile it; the census names the decision points |
249
+ | Check the quality claims myself | Step 2 — the replay; the full record is the [whitepaper](https://github.com/Dongbumlee/ontosmith/blob/main/docs/whitepaper.md) (§5) |
250
+ | Build a graph from my documents | [Hands-on](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md), Track 1 |
251
+ | Use my own model provider | [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md) — seats, recommended models, custom bindings |
252
+ | Read this project as an LLM | [llms.txt](https://github.com/Dongbumlee/ontosmith/blob/main/llms.txt) — the machine-readable orientation |
253
+ | Design an ontology for my domain | `ontosmith ontology` — the loop below; [hands-on](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md) Track 3 |
254
+ | Audit my own benchmark gold | `ontosmith verify` — [hands-on](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md) appendix track |
255
+ | Serve and query a built graph | [docs/serving.md](https://github.com/Dongbumlee/ontosmith/blob/main/docs/serving.md) — `ontosmith search` / `serve` + the demo app at `/` over the build's Neo4j store (the shipped demo serves from its recorded files, no store needed) |
256
+ | Contribute | [CONTRIBUTING.md](https://github.com/Dongbumlee/ontosmith/blob/main/CONTRIBUTING.md) |
257
+
258
+ ## The loop
259
+
260
+ Two artifacts carry the loop, and they are not the same
261
+ thing. A **profile** describes **your corpus**: a
262
+ deterministic census — document inventory, conventions,
263
+ decision points — that `ontosmith profile` produces with
264
+ no model calls, pinned by its hash. A **pack** carries
265
+ a **domain's ontology as data**: the type inventory,
266
+ definitions, and boundary examples a build runs under,
267
+ versioned and pinned by sha256, with the conformance
268
+ record of what its content measured. A batch binds one
269
+ of each.
270
+
271
+ 1. **Profile** — `ontosmith profile` censuses your corpus
272
+ first (deterministic, no LLM): document inventory,
273
+ conventions, and the decision points a human should
274
+ settle before any build.
275
+ 2. **Design** — `ontosmith ontology` drafts a domain
276
+ schema from the profile, validates it deterministically,
277
+ and emits it as a versioned, hash-pinned **pack** only
278
+ after an explicit human approval.
279
+ 3. **Build** — `ontosmith batch` runs the staged pipeline
280
+ under the pack. Measured operating points ship as
281
+ defaults; the run's cost is capped by a stop-line, and
282
+ countable before it starts (`verify project`).
283
+ 4. **Inspect** — `ontosmith inspect` shows any triple with
284
+ its evidence span and provenance chain — and names what
285
+ is missing when something is.
286
+ 5. **Verify** — `ontosmith verify` ships the measurement
287
+ tooling with the product: audit your own gold, score
288
+ your own builds raw *and* corrected, with the failure
289
+ anatomy attached.
290
+ 6. **Serve** — `ontosmith search` and the sample API
291
+ (`ontosmith serve`) answer hybrid retrieval
292
+ (vector + lexical + graph) over chunks and triples.
293
+ A build is served from its Neo4j store; the shipped
294
+ demo's recorded artifacts also serve from files —
295
+ the keyless read-back path, lexical + graph arms
296
+ only.
297
+
298
+ ## The method
299
+
300
+ ![The OntoSmith method: proposer/judge separation across the build loop](https://github.com/Dongbumlee/ontosmith/raw/main/docs/assets/method.png)
301
+
302
+ One separation runs through everything: nothing is
303
+ written on the proposing seat's say-so alone. A fitted
304
+ pair call converts enumerated pairs into candidate
305
+ triples; deterministic gates check them; the Jev
306
+ decision model **decides** what is written. Operating
307
+ points — thresholds, the enumeration window, the judge
308
+ configuration — are chosen by pre-registered measurement
309
+ gates, not by feel, and configurations that miss their
310
+ gate stay off (the rejections are in the quality record).
311
+ The full loop, walked end to end, is the
312
+ [hands-on guide](https://github.com/Dongbumlee/ontosmith/blob/main/docs/hands-on.md).
313
+
314
+ ## How this differs from GraphRAG-style pipelines
315
+
316
+ GraphRAG-style pipelines typically centre the build on
317
+ a single frontier-class model, and evaluate the result
318
+ by its answers (or by extraction scores on someone
319
+ else's benchmark), rather than by adjudicating the
320
+ graph they actually built. OntoSmith divides the job:
321
+ a low-cost proposer proposes, a fitted pair call
322
+ converts enumerated pairs into candidates,
323
+ deterministic gates check form, and the pinned Jev
324
+ model decides what is written — nothing is written on
325
+ the proposer's say-so alone. Types come from an
326
+ explicit, versioned ontology rather than emerging from
327
+ the extraction, and the published record scores the
328
+ graph itself, verdicts attached (§ Quality). If you
329
+ want emergent structure and a working demo fast, the
330
+ GraphRAG family gets you there sooner; this one is for
331
+ when the graph has to be audited.
332
+
333
+ ## Corpus packs
334
+
335
+ A pack is a domain's ontology as data: schema, definitions,
336
+ boundary examples, thresholds, and its measured conformance
337
+ record — hash-pinned, versioned, fail-closed on load.
338
+ Domain content lives only in packs, never in code branches.
339
+ The format's contract — manifest, pins, candidates,
340
+ conformance — is [docs/PACK_DESIGN.md](https://github.com/Dongbumlee/ontosmith/blob/main/docs/PACK_DESIGN.md).
341
+
342
+ | Pack | Contents | Measured on |
343
+ |---|---|---|
344
+ | **Bio Medical** (`bio-medical`) | Biomedical entity/relation schema, fitted qualifiers | BioRED (pilot record: [whitepaper](https://github.com/Dongbumlee/ontosmith/blob/main/docs/whitepaper.md) §5.7) |
345
+ | **Legal Contract** (`legal-contract`) | Contract schema: 41 label categories, role-word and defined-term rules | CUAD (promotion record: [whitepaper](https://github.com/Dongbumlee/ontosmith/blob/main/docs/whitepaper.md) §5.8) |
346
+ | **Open Domain** (`open-domain`) | Schema for general documents, with fitted direction declarations | Re-DocRED (flagship record: [whitepaper](https://github.com/Dongbumlee/ontosmith/blob/main/docs/whitepaper.md) §5) |
347
+ | **Core** (`core`, baseline) | The domain-neutral baseline every new corpus starts from | The cross-domain core record |
348
+
349
+ No pack fits your domain? The ontology builder (step 2)
350
+ drafts one from your own corpus, for your approval.
351
+
352
+ ![The ontology builder loop: draft, validate, approve, emit](https://github.com/Dongbumlee/ontosmith/raw/main/docs/assets/ontology-loop.png)
353
+
354
+ *The builder loop and its refusal paths, as coded in
355
+ `pipeline/ontology_builder.py` — an emitted pack is
356
+ marked `emitted_unmeasured` until a registered
357
+ measurement adopts it.*
358
+
359
+ ## Reference profile — measured bindings, your choice
360
+
361
+ The published measurements were made with one exact set of
362
+ model bindings. That set ships as the **reference
363
+ profile**, pre-filled in the connection layer as the
364
+ default preset:
365
+
366
+ | Seat | Reference binding |
367
+ |---|---|
368
+ | Proposer — extracts candidates; never decides | `anthropic/claude-haiku-5.5` |
369
+ | Judge — Jev, the decision gate; a pinned product component | `typesafe/jev-1.13` |
370
+ | Escalation — adjudication escalation; in evaluation it also serves as the comparison judge — it never decides a build's triples | `anthropic/claude-sonnet-5.5` |
371
+ | Drafting — schema/profile drafting; an authoring aid behind the human approve gate | — (ships unbound; bind your own) |
372
+ | Embedder — indexing and question embedding | `openai/text-embedding-3-large` |
373
+
374
+ Three layers, five seats: the method's *judge* layer is
375
+ two seats in this table — the fitted pair judge, which
376
+ shares the proposer's model row, and the pinned Jev
377
+ gate — and drafting is an authoring seat outside the
378
+ build loop.
379
+
380
+ Four models, one key: the preset reaches all four named
381
+ models through a single connection key. The names differ
382
+ per seat because each measured seat's default won its
383
+ job in measurement; the judge seat is the exception —
384
+ a pinned component, not a bake-off winner — and you can
385
+ re-point any seat ([Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md)).
386
+
387
+ **Optimized for the Jev decision model; the other seats
388
+ are yours to bind** — see
389
+ [Optimized for Jev](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md#optimized-for-jev)
390
+ in Connections.
391
+
392
+ Read that table as provenance, not as a requirement: the
393
+ preset is the environment the measurements were made in,
394
+ so a default install runs the bindings the published
395
+ numbers were measured under (the numbers themselves
396
+ reproduce keyless from the appendix — step 2) —
397
+ but OntoSmith needs *a* connection, not *this* one.
398
+ Domain packs declare only *capability tiers* (proposer /
399
+ judge / escalation), never model names, so you can bind
400
+ other models and endpoints in your own connection config;
401
+ that is a **custom binding**, and run records state which
402
+ binding produced a run. API keys are never settings
403
+ values: config names the environment variable, the value
404
+ comes from your environment. The full seat-by-seat
405
+ picture — every seat, the recommended models, and the
406
+ custom-binding contract — is
407
+ [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md).
408
+
409
+ ## Cost guardrails
410
+
411
+ Spend is guarded by default. The tooling prints a
412
+ **counted projection** before a run (`ontosmith verify
413
+ project` — candidate pairs counted from your data, priced
414
+ at rates you supply (`--unit-cost`); the tool takes
415
+ prices from the caller and never hardcodes a rate card)
416
+ and every batch enforces a
417
+ **stop-line**: a run that would cross its cap refuses to
418
+ start the unit that crosses it, and resumes from its
419
+ ledger instead of re-spending.
420
+
421
+ ## Quality
422
+
423
+ How well does it work? The measured record — scores with
424
+ their scope and method, the failure anatomy, and the
425
+ pre-registered criterion that failed — lives in the
426
+ project [whitepaper](https://github.com/Dongbumlee/ontosmith/blob/main/docs/whitepaper.md) (§5); the evidence data and the replay
427
+ that recomputes it ship in [`benchmarks/`](https://github.com/Dongbumlee/ontosmith/tree/main/benchmarks).
428
+
429
+ > **What the numbers do and don't say.** The corrected
430
+ > scores describe one measured build — the 3,902-triple
431
+ > sentence-window configuration — not the shipped
432
+ > default, which enumerates differently (whitepaper
433
+ > §5.6); the shipped Tier-1 set adds 186 promoted triples
434
+ > whose corrected precision is not recomputed. The
435
+ > adjudication is machine judging under a published,
436
+ > ruled contract — no human spot-check round has been
437
+ > run on the flagship sample. Retrieval is measured on
438
+ > one pinned 116-question set over long contracts, and
439
+ > at exactly zero on short abstracts. The whitepaper
440
+ > states each limit where the number lives (§5, §7).
441
+
442
+ ## When not to use it
443
+
444
+ OntoSmith is the wrong tool if you want a graph without
445
+ an ontology: the schema-first step, the human approval
446
+ points, and the measurement tooling are the product, not
447
+ ceremony around it. If you need a quick demo graph from a
448
+ pile of text with no quality questions asked, lighter
449
+ extraction tools will get you there faster — and if your
450
+ domain's schema is still changing daily, settle it a
451
+ little before pinning it into a pack.
452
+
453
+ ## Commands
454
+
455
+ ```text
456
+ Label review interactive review-band labeling
457
+ Evaluate evaluate · recalibrate · calibration
458
+ inspect triple + evidence + provenance
459
+ verify score / audit-sets / project / report
460
+ Models llm · ollama candidate judges
461
+ Gates triple · er · conflict · onto · cascade (Jev gates)
462
+ Connect configure declare the seat bindings
463
+ (wizard / --from-file)
464
+ Pipeline batch create / run / status / rollback
465
+ profile corpus profiler (deterministic, no LLM)
466
+ ontology draft / validate / approve / emit a pack
467
+ Serve search hybrid search over a built graph
468
+ serve sample HTTP API (search / entity /
469
+ neighborhood / triple-with-evidence)
470
+ + the demo app at /
471
+ ```
472
+
473
+ ## The store — Neo4j
474
+
475
+ A build's graph lives in **Neo4j**: WRITE, INDEX, and
476
+ VERIFY work in it, the graph views render through
477
+ Neo4j's own tooling on the same host, and serving a
478
+ build reads from it. It is a prerequisite for
479
+ building, not an optional backend — setup and the
480
+ connection variables are in
481
+ [Connections](https://github.com/Dongbumlee/ontosmith/blob/main/docs/connections.md). The store holds
482
+ **one graph** — the current build's, stamped with the
483
+ identity of the ontology that produced it: a build
484
+ under a different ontology replaces the previous graph
485
+ (named in the run's output before it happens), never
486
+ accumulates beside it, so search never needs a scope —
487
+ it answers from the one graph that is there. Asking questions
488
+ of *recorded* artifacts needs no store: the search
489
+ command and sample API also run over a file-backed
490
+ store that reads a finished batch's records (or the
491
+ shipped demo) directly — the demo/read-back path,
492
+ whose search runs the lexical and graph arms only
493
+ ([docs/serving.md](https://github.com/Dongbumlee/ontosmith/blob/main/docs/serving.md)).
494
+
495
+ ## Status
496
+
497
+ Pre-release assembly (0.1.0). The pipeline, profiler,
498
+ ontology builder, inspect viewer, verification cores,
499
+ packs, and the serving surface (search command +
500
+ sample API) in this tree are measured, tested
501
+ components, as is the minimal demo app served with
502
+ the API. What remains is the public launch itself:
503
+ PyPI publication lands with it.
504
+
505
+ ## License
506
+
507
+ MIT — Copyright (c) 2026 Dongbum Lee.