Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

Reposition the front door: one loop, three beats, and a plan that is semantic (#213)

Fabio Rovai96f3fd92219d
diff --git a/README.md b/README.md
index aa9c4cf1..a88c1e20 100644
--- a/README.md
+++ b/README.md
@@ -7,9 +7,9 @@
<h1 align="center">Open Ontologies</h1>
<p align="center">
- <strong>An engineering and verification platform for trustworthy ontologies and knowledge graphs</strong><br>
- Build, change and operate them with Terraform-style lifecycle management, and reason over them
- with proof-carrying inference. Written in Rust. Ships as a single binary.
+ <strong>Plan a change to a production ontology, see every consequence before you apply it,<br>
+ and hand the reviewer a proof they can check without trusting you.</strong><br>
+ Written in Rust. Ships as a single binary.
</p>
<p align="center">
@@ -41,19 +41,49 @@
</p>
<p align="center">
- <sub><b>150 asserted, 259 certified, 4 rejected.</b> Green edges the engine derived and a Lean 4
- checker then <i>proved</i>. Red edges are forged lines the same checker refused, exit 1, with the
- rule named. Every count is taken from the run, not written into the caption.</sub>
+ <sub><b>150 asserted, 259 certified, 1 rejected.</b> Green edges the engine derived and a Lean 4
+ checker then <i>proved</i>. The red edge is a forged line the same checker refused, exit 1, with
+ the rule named. Every count is taken from the run, not written into the caption.</sub>
</p>
-**Ask a reasoner why it believes something and it will tell you to trust it.** This one hands you a
-proof, and refuses a forged one.
+### One triple. Nothing added, nothing removed, blast radius zero. 901 consequences that were not there before.
-Open Ontologies builds, changes and operates ontologies and knowledge graphs with Terraform-style
-lifecycle management, and reasons over them with proof-carrying inference. Every conclusion comes
-with a certificate that a separate checker, written in Lean 4 and proved sound, will either accept
-or reject. Written in Rust, ships as a single binary, speaks MCP to Claude, Cursor and anything else
-that talks to it.
+```
+$ printf 'load base.ttl\nplan proposed.ttl\n' | open-ontologies batch -
+# the whole change: ex:hasParent rdfs:domain ex:Person
+
+added_classes 0
+removed_classes 0
+blast_radius 0 triples affected
+risk_score low
+ ────────────────────────────────────────────
+conservativity not_conservative_under_rule_table
+new consequences 901 rule table owl-rl, in 0.04s
+```
+
+Every number a shape diff can produce says this change is harmless. It retyped
+every individual the property already had. **That gap is what this is for**, and
+it is the part `git diff` cannot do, because the change is a single well-formed
+line and the text diff is one line long.
+
+**Then hand the reviewer the proof.** The run writes a certificate a third party
+re-verifies months later, with no running instance of this software and no
+network: `oo-cert asserted.tsv derivations.tsv`, exit 0, covered by
+`OOCert.certificate_sound`.
+
+**And it refuses a forged one.** Edit a conclusion into the derivation file and
+the same checker exits 1 and names the rule that does not hold. That is the red
+edge above, and it is the exhibit that makes the first two beats survive
+scrutiny rather than the headline.
+
+> **This is not an ontology editor.** If you want to draw class hierarchies, use
+> Protégé. This is what you run on the change before it reaches production.
+>
+> **Terraform-style, and deliberately so, but the plan is semantic rather than
+> syntactic.** A text diff is `git diff`, and you already have that.
+
+No JVM. No Protégé. Speaks MCP to Claude, Cursor and anything else that talks
+to it.
## See it in action
@@ -313,13 +343,27 @@ Add to `~/.claude/settings.json` for Claude Code, or to
Restart, and the `onto_*` tools are available. Cursor, Windsurf, Zed and VS Code are in
[docs/quickstart.md](docs/quickstart.md).
+## Stars
+
+<a href="https://star-history.com/#fabio-rovai/open-ontologies&Date">
+ <img src="https://api.star-history.com/svg?repos=fabio-rovai/open-ontologies&type=Date" alt="Star history" width="600">
+</a>
+
## What is in the box
-**120 tools** to build, validate, query, diff, lint, version, reason over, align, plan, certify
-and govern RDF and OWL, over an in-memory Oxigraph store. A default build advertises 112 tools.
-Eight need an optional Cargo feature and return an error without it: four need `embeddings`, two
-need `plugins`, two need `postgres` or `duckdb`. The published binaries and the GHCR image are
-built with the default feature set, so they do not carry those eight.
+**One loop:** `plan` a change, `apply` it, watch for `drift`, `certify` what was
+derived, `rollback` when it was wrong. That is the whole of the front page, and
+it is what this is for.
+
+Everything else — alignment, embeddings, PDDL planning, clinical crosswalks, the
+plugin marketplace, CIVeX — has its own documentation and keeps its own code. It
+is listed once, in [docs/tool-reference.md](docs/tool-reference.md), and not
+here. Surface area is not the argument.
+
+A few tools need an optional Cargo feature and return an error without it: four
+need `embeddings`, two need `plugins`, two need `postgres` or `duckdb`. The
+published binaries and the GHCR image are built with the default feature set, so
+they do not carry those eight.
The Python package `open-ontologies-lite` now reasons as well, in pure Python with no Rust
toolchain, and its certificates are checked by the same Lean binaries. It is a second engine, and
diff --git a/README.zh-CN.md b/README.zh-CN.md
index b3d54911..294548e0 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -5,8 +5,9 @@
<h1 align="center">Open Ontologies</h1>
<p align="center">
- <strong>面向知识图谱的 Terraforming MCP 服务器</strong><br>
- 校验、分类并治理 AI 生成的本体。使用 Rust 编写,以单一可执行文件发布。
+ <strong>规划对生产本体的变更,在应用之前看清每一项后果,<br>
+ 并交给审阅者一份无需信任你即可自行核验的证明。</strong><br>
+ 使用 Rust 编写,以单一可执行文件发布。
</p>
<p align="center">
diff --git a/docs/architecture.md b/docs/architecture.md
index 11594ab0..71ee76ae 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -24,7 +24,7 @@ flowchart TD
REST["REST API\n/api/query · /api/update\n/api/save · /api/load · /api/lineage"]
end
- subgraph ToolGroups["120 Tools"]
+ subgraph ToolGroups["Tools"]
direction LR
Core["Core\nvalidate · load · save · clear\nstats · query · diff · lint\nconvert · status"]
DataPipe["Data Pipeline\nmap · ingest · shacl\nreason · extend · import-schema"]
diff --git a/docs/layer3-compiled-reasoning.md b/docs/layer3-compiled-reasoning.md
index 8bca0ccc..3960f382 100644
--- a/docs/layer3-compiled-reasoning.md
+++ b/docs/layer3-compiled-reasoning.md
@@ -93,7 +93,7 @@ scales 3.6–4.3x).
The compiled surface is **sound but deliberately incomplete**, and the API
makes that impossible to ignore:
-- `Rejected` — a contradiction was derived; trustworthy, with a witness.
+- `Rejected` — a contradiction was derived, and the witness is returned with it.
- `Undetermined` — nothing fired, which is NOT evidence of consistency. The
undecided class pairs are returned as `residual_pairs`.
- `Consistent` — only reachable after the residual is discharged by tier 2
diff --git a/docs/reasoning-systems-inventory.md b/docs/reasoning-systems-inventory.md
index d49e5600..733adf0e 100644
--- a/docs/reasoning-systems-inventory.md
+++ b/docs/reasoning-systems-inventory.md
@@ -104,8 +104,8 @@ structural treatment the first-order provers now get has no counterpart here yet
proof logs, and doing so is a separate piece of work from reading TSTP.
cvc5 1.3.4 was added as a SECOND SMT oracle on 18 September 2026, and the reason is worth stating
-precisely because the obvious reason is wrong. It is not there to make the satisfiable answers more
-trustworthy: those rest on a machine-checked theorem about a structure and a formula list, the
+precisely because the obvious reason is wrong. It is not there to strengthen the satisfiable
+answers: those rest on a machine-checked theorem about a structure and a formula list, the
statement does not mention which program produced the structure, and a second producer therefore adds
nothing to them. It is there because the UNSATISFIABLE answers have no defence inside this
architecture at all. Nothing can check one, a wrong one would be published as `unsatisfiable_oracle`
diff --git a/docs/tool-reference.md b/docs/tool-reference.md
new file mode 100644
index 00000000..358bb4bb
--- /dev/null
+++ b/docs/tool-reference.md
@@ -0,0 +1,137 @@
+# Tool reference
+
+Every tool this server registers, with one line each. Generated from the
+`#[tool(...)]` attributes in `src/server.rs` and gated by
+`tests/tool_reference_test.rs`, so a tool added without a line here fails the
+build rather than going unlisted.
+
+The front page does not list these. It shows one loop — `plan`, `apply`,
+`drift`, `certify`, `rollback` — because that is what this is for, and a reader
+who meets a catalogue first cannot tell what it is for. Everything below keeps
+its code and its own documentation; it loses its place above the fold.
+
+
+120 tools.
+
+| Tool | What it does |
+| --- | --- |
+| `borderline_partition` | Generalised borderline-pair partitioning (#37, NORA NeurIPS 2025). |
+| `borderline_record_verdict` | Persist an orchestrator's verdict on a borderline candidate (#37). |
+| `eval_rag` | mmRAG benchmark scoring (#41, ISWC 2025). |
+| `eval_rag_mmrag` | Parse a full mmRAG dataset JSON and score it in one call. |
+| `graph_projection_entailment_check` | Does a retrieved slice still support the claims an answer rests on? Supply the claims as Turtle (goals_ttl); for each one this reports whether the projection entails it exactly when the source does, under one pinned rule profile, with a machine-checked Lean certificate (OOCert.certificate_sound) for each claim the… |
+| `graph_projection_lossy_check` | Audit a projected Turtle slice against the loaded ontology's full neighbourhood of the seed IRIs. |
+| `onto_action_applicable` | Evaluate a registered action's SPARQL preconditions against the loaded graph under the given parameter bindings. |
+| `onto_action_apply` | Apply a registered action's effects with the given parameter bindings. |
+| `onto_action_apply_concurrent` | Fire a tick of concurrent BC+ actions atomically. |
+| `onto_action_list` | List the names of all action schemas registered in this server's Dynamics store. |
+| `onto_action_register` | Persist a named action schema (Dynamics layer #43). |
+| `onto_align` | Detect alignment candidates (owl:equivalentClass, skos:exactMatch, rdfs:subClassOf) between two ontologies using label similarity, property overlap, parent overlap, instance overlap, restriction patterns, and graph neighborhood. |
+| `onto_align_feedback` | Accept or reject an alignment candidate to improve future confidence scoring. |
+| `onto_align_flora` | End-to-end FLORA alignment (#38). |
+| `onto_align_fuzzy` | FLORA-style fuzzy-logic alignment adjudication (#38, ISWC 2025 Best Paper). |
+| `onto_apply` | Apply a plan produced by onto_plan, defaulting to the most recent one. |
+| `onto_cache_list` | List all cached ontologies with metadata (name, source_path, triple_count, source_mtime, source_size, cache_path, compiled_at, last_access_at) and runtime flags (is_active, in_memory). |
+| `onto_cache_remove` | Remove a cached ontology by name. |
+| `onto_cache_status` | Inspect the compile cache: active ontology, all cached entries, and the cache configuration (TTL, auto_refresh, dir). |
+| `onto_certify_action` | CIVeX-style causal certificate for a proposed state-changing ontology action. |
+| `onto_classify_el` | Classify the loaded ontology in the OWL-EL fragment (#30). |
+| `onto_clear` | Clear all triples from the in-memory ontology store and unload the active registry slot (cache file is preserved) |
+| `onto_closure_diff` | Which CONCLUSIONS a projection preserves, with no goals supplied. |
+| `onto_coevolve_dependency_graph` | Build the shape→OWL-dependency map for a SHACL document. |
+| `onto_communities` | Detect communities in the loaded entity graph and return a SKELETON per community: size, top members by degree, internal relations, and the bridges connecting it to other communities. |
+| `onto_conservative_check` | Does adding these axioms change anything the ontology ALREADY said? Reasons base and base+extension to a fixpoint under one rule table and reports closure(base ∪ extension) minus closure(base), restricted to triples every name of which the base already used. |
+| `onto_convert` | Convert an RDF file between formats: turtle, ntriples, rdfxml, nquads, trig |
+| `onto_cq_run` | Run a batch of competency questions (CQs) against the loaded ontology (#29). |
+| `onto_cq_verdicts_list` | List all stored verdicts for a CQ id, most-recent first. |
+| `onto_crosswalk` | Look up clinical crosswalk mappings for a code and system (ICD10, SNOMED, MeSH). |
+| `onto_default_apply` | Apply every registered BC+ default-value law whose condition currently holds. |
+| `onto_default_register` | Register a BC+ default-value law. |
+| `onto_defects` | Check the ONTOLOGY itself, before any data is judged against it. |
+| `onto_diff` | Compare two ontology files and show added/removed triples |
+| `onto_dl_check` | Check if one class is subsumed by another using DL tableaux reasoning. |
+| `onto_dl_explain` | Explain why a class is unsatisfiable using DL tableaux reasoning. |
+| `onto_dlp_boundary` | Ask which of YOUR axioms the rule engine can actually SEE, before trusting a reasoning result. |
+| `onto_drift` | Detect drift between two ontology versions. |
+| `onto_embed` | Generate text + structural Poincaré embeddings for all classes in the loaded ontology. |
+| `onto_enforce` | Enforce design patterns on the loaded ontology. |
+| `onto_enforce_feedback` | Accept or dismiss an enforce violation to improve future enforce runs. |
+| `onto_enrich` | Enrich an ontology class with a SKOS mapping triple from the clinical crosswalks. |
+| `onto_eval_alignment` | OAEI-style P/R/F1 scoring (#31). |
+| `onto_extend` | Convenience pipeline: ingest data → validate with SHACL → run OWL reasoning, all in one call. |
+| `onto_extract_scaffold` | Build a schema-guided structured-extraction scaffold for a class (#28, OntoGPT SPIRES MCP-native). |
+| `onto_extract_validate` | Validate an LLM-supplied extraction (JSON array of objects) against a scaffold previously emitted by `onto_extract_scaffold`. |
+| `onto_fol_export` | Export the loaded ontology as first-order logic, so it can be handed to the automated-theorem-proving ecosystem. |
+| `onto_fol_model` | Find a finite model of the loaded ontology and CHECK IT, so the answer names what it rests on. |
+| `onto_fol_prove` | Run a first-order prover, READ the derivation it prints back, and RE-CHECK what can honestly be re-checked. |
+| `onto_history` | List all saved ontology version snapshots |
+| `onto_hnsw_build` | Build (or rebuild) the HNSW cosine index over the loaded text embeddings with explicit `ef_construction` and `ef_search` parameters. |
+| `onto_import` | Resolve and load all owl:imports from the currently loaded ontology |
+| `onto_import_schema` | Import a relational database schema as an OWL ontology. |
+| `onto_ingest` | Parse a structured data file (CSV, JSON, NDJSON, XML, YAML, XLSX, Parquet) into RDF triples and load into the ontology store. |
+| `onto_invariant_check` | Evaluate every registered BC+ invariant against the current graph and return the names + descriptions of any that fail. |
+| `onto_invariant_list` | List all registered BC+ static causal laws (invariants). |
+| `onto_invariant_register` | Persist a BC+ static causal law (SPARQL ASK invariant). |
+| `onto_invariant_remove` | Remove a registered BC+ invariant by name. |
+| `onto_justify` | AXIOM PINPOINTING: which ASSERTED triples are responsible for a conclusion, or for a contradiction. |
+| `onto_lineage` | Get the compact lineage log for the current or specified session. |
+| `onto_lint` | Check an ontology for quality issues: missing labels, comments, domains, ranges |
+| `onto_lint_feedback` | Accept or dismiss a lint issue to improve future lint runs. |
+| `onto_load` | Load an RDF file or inline Turtle content into the in-memory ontology store. |
+| `onto_lock` | Lock IRIs to prevent removal during plan/apply. |
+| `onto_map` | Generate a mapping config by inspecting a data file's schema against the currently loaded ontology. |
+| `onto_marketplace` | Browse and install ontologies from the curated catalogue of 33 W3C/ISO/industry standards plus the open community-pack registry (community/registry.json, fetched at runtime; override with OPEN_ONTOLOGIES_COMMUNITY_REGISTRY). |
+| `onto_module_extract` | A MODULE over a signature, not a slice: the smallest subset of the axioms syntactic locality can justify, such that every entailment of the WHOLE ontology over those IRIs is still an entailment of the subset. |
+| `onto_monitor` | Run active monitoring watchers. |
+| `onto_monitor_clear` | Clear the monitor blocked flag, allowing apply operations to proceed. |
+| `onto_ossie_import` | Compile an Apache Ossie (incubating, formerly Open Semantic Interchange) ontology document into OWL 2 DL + SHACL, and optionally load it into the active store so every other tool here works on it. |
+| `onto_owl_shacl_coevolve_check` | Combined OWL+SHACL validation (#33, K-CAP 2025). |
+| `onto_owl_shacl_coevolve_incremental` | Incremental coevolve check (#33 follow-on, K-CAP 2025). |
+| `onto_pack` | Write the loaded graph and its verification evidence to a portable, versioned pack: sorted N-Triples plus a manifest (name, version, counts, timestamp, sha256, and the lint/enforce results recorded at pack time). |
+| `onto_plan` | Terraform-style plan: diff current store against proposed Turtle. |
+| `onto_plan_classical` | Invoke Fast Downward as a subprocess on a precompiled PDDL domain + problem (#50). |
+| `onto_plan_compile_pddl` | Compile a PDDL domain from registered Dynamics action schemas (#43) plus a problem instance from the loaded graph and a goal Turtle slice (#45 Planner stub). |
+| `onto_plan_validate` | Validate a candidate plan (sequence of registered-action steps) against the loaded graph WITHOUT mutating the real store. |
+| `onto_plugin_call` | Invoke a tool on an installed WASM plugin. |
+| `onto_plugin_list` | Discover installed WASM plugins and the tools they provide. |
+| `onto_policy_check` | Evaluate a proposed action's target IRIs against every registered policy rule. |
+| `onto_policy_list` | List all registered ARGOS policy rules. |
+| `onto_policy_register` | Register an ARGOS-style policy rule (#40, ISWC 2025 WOP). |
+| `onto_provenance` | PROVENANCE SEMIRINGS: the algebraic expression over the ASSERTED triples that a derived triple carries. |
+| `onto_pull` | Fetch an ontology from a remote URL or SPARQL endpoint and load it into the store |
+| `onto_push` | Push the current ontology store to a remote SPARQL endpoint |
+| `onto_query` | Run a SPARQL query against the loaded ontology store. |
+| `onto_reason` | Run inference over the loaded ontology. |
+| `onto_reason_incremental` | Derive the consequences of newly added triples WITHOUT recomputing the whole closure. |
+| `onto_recompile` | Force-recompile an ontology from its source file, ignoring the on-disk cache. |
+| `onto_repo_list` | List RDF/OWL files in the configured ontology repository directories ([general] ontology_dirs). |
+| `onto_repo_load` | Load an ontology from one of the configured repository directories ([general] ontology_dirs) into the active store. |
+| `onto_rollback` | Restore the ontology store to a previously saved version |
+| `onto_rules_import` | Read rules written in a STANDARD rule syntax into the Horn rule table `onto_reason` evaluates with `rules_file` and the proved-sound Lean checker verifies with `lake exe oo-horn check`. |
+| `onto_save` | Save the current ontology store to a file |
+| `onto_search` | Semantic search over the loaded ontology using natural language. |
+| `onto_segment_retrieve` | Retrieve a TBox-slice neighbourhood of seed IRIs for grounding LLM reasoning (#34, SEMANTiCS 2025 GrOWL-RAG). |
+| `onto_shacl` | Validate the loaded ontology data against SHACL shapes. |
+| `onto_shacl_check` | Dry-run structural check on proposed SHACL shapes against the loaded ontology. |
+| `onto_shape_combinatorics` | Enumerate the property-combination lattice for a class (#36, K-CAP 2025 Kastor). |
+| `onto_shape_induce` | Kastor-style data-driven SHACL shape induction (#36, K-CAP 2025). |
+| `onto_similarity` | Compute embedding similarity between two IRIs — returns cosine similarity (text), Poincaré distance (structural), and product score. |
+| `onto_sql_ingest` | Run a SQL query against a relational backbone (PostgreSQL or DuckDB) and ingest the resulting rows into the triple store as RDF. |
+| `onto_sql_sync_reset` | Clear the recorded CDC watermark for a sync_key. |
+| `onto_sql_sync_state` | Read the recorded CDC watermark for a sync_key. |
+| `onto_sql_sync_states_list` | List every recorded CDC sync state across all sync_keys. |
+| `onto_stats` | Get statistics about the loaded ontology (triple count, classes, properties, individuals) |
+| `onto_status` | Returns health status of the Open Ontologies server |
+| `onto_support_check` | Check whether the graph's claims are backed by the sources they cite. |
+| `onto_support_report` | Summarise provenance quality: the unsourced-claim rate over the whole graph, and the support rate across the claims judged so far. |
+| `onto_support_verdict` | Record whether a cited source supports a claim: supported, refuted, or unrelated. |
+| `onto_temporal_conflicts` | Disjointness violations that claim OVERLAPPING validity, separated from those that do not. |
+| `onto_temporal_query` | Run a SPARQL graph pattern against only the graphs in temporal scope: what the graph said at a given valid time, as known at a given recorded time. |
+| `onto_temporal_snapshot` | Which named graphs are in scope at a point in time, and which are excluded and why. |
+| `onto_unload` | Unload an ontology from memory. |
+| `onto_unpack` | Load a pack written by onto_pack, refusing it if the checksum does not match. |
+| `onto_validate` | Validate RDF/OWL syntax. |
+| `onto_validate_clinical` | Validate all class labels in the loaded ontology against clinical crosswalk data. |
+| `onto_verify_cq` | Persist an LLM-supplied (or human-supplied) verdict on a CQ result (#39, ISWC 2025 Lippolis). |
+| `onto_version` | Save a named snapshot of the current ontology store |
+| `onto_vocab_check` | Closed-world vocabulary check on a Turtle DATA graph: verify that every predicate and every rdf:type class used in the data is actually DECLARED in the loaded ontology. |
diff --git a/src/batch.rs b/src/batch.rs
index 5b41ab77..89f11f7e 100644
--- a/src/batch.rs
+++ b/src/batch.rs
@@ -687,7 +687,22 @@ impl BatchRunner {
match std::fs::read_to_string(file) {
Ok(turtle) => {
let planner = crate::plan::Planner::new(self.db.clone(), self.graph.clone());
- let result = planner.plan(&turtle)
+ // Conservativity ON by default, matching `onto_plan` and the
+ // `plan` subcommand. There were THREE plan entry points and
+ // flipping the default on one of them left the other two
+ // answering a different question from the same word, which is
+ // worse than leaving it off everywhere.
+ let opts = (!args.iter().any(|a| a == "--no-conservativity")).then(|| {
+ crate::conservativity::ConservativityOptions {
+ mode: crate::conservativity::ExtensionMode::Replacement,
+ profile: "owl-rl".to_string(),
+ out: std::env::temp_dir()
+ .join(format!("oo-plan-conservativity-{}", std::process::id())),
+ scan_rows: 10_000,
+ max_rows: 1_000_000,
+ }
+ });
+ let result = planner.plan_checked(&turtle, opts)
.unwrap_or_else(|e| format!(r#"{{"error":"{}"}}"#, e));
serde_json::from_str(&result).unwrap_or(json!({"raw": result}))
}
diff --git a/src/inputs.rs b/src/inputs.rs
index 5f5b923b..453cb14a 100644
--- a/src/inputs.rs
+++ b/src/inputs.rs
@@ -564,9 +564,21 @@ pub struct OntoPlanInput {
pub new_turtle: String,
/// Also answer whether the change alters any consequence over the names the
/// store ALREADY uses, under the rule table in `conservativity_profile`.
- /// Default false: it reasons both graphs to a fixpoint, so it costs seconds
- /// rather than milliseconds. When it is false the plan says so rather than
- /// staying silent.
+ ///
+ /// DEFAULT TRUE since #196. Pass `false` to skip it, and the plan then says
+ /// it did not look rather than staying silent.
+ ///
+ /// This is the only part of a plan that is about MEANING. Everything else
+ /// is shape, and shape cannot see the change that matters most: adding one
+ /// `rdfs:domain` triple adds no class, removes nothing, has a blast radius
+ /// of zero and scores `low`, while retyping every existing individual of
+ /// that property.
+ ///
+ /// It reasons both graphs to a fixpoint, which is the reason it was opt-in.
+ /// Measured: 900 individuals in 0.14s, 9,000 in 0.68s, 45,000 in 3.99s,
+ /// roughly linear at about 11 microseconds an individual. A plan is a
+ /// deliberate pre-production act rather than an interactive query, so that
+ /// is worth paying by default; opt out on a store big enough that it hurts.
#[serde(default)]
pub check_conservativity: Option<bool>,
/// Rule table for the conservativity check: `rdfs`, `owl-rl` (default) or
diff --git a/src/main.rs b/src/main.rs
index 3eddb6e7..c1ab4a9b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -740,7 +740,15 @@ enum Commands {
// ─── Lifecycle ────────────────────────────────────────────────
/// Plan changes: diff current vs proposed Turtle
- Plan { file: String },
+ Plan {
+ file: String,
+ /// Skip the conservativity check, which is the only part of a plan
+ /// that is about MEANING and is ON by default since #196. It reasons
+ /// both graphs to a fixpoint, about 11 microseconds an individual, so
+ /// this is the thing to reach for on a store big enough that it hurts.
+ #[arg(long)]
+ no_conservativity: bool,
+ },
/// Apply planned changes (safe or migrate)
Apply {
#[arg(default_value = "safe")]
@@ -1186,7 +1194,13 @@ impl Commands {
}
cmd("ingest", a)
}
- Commands::Plan { file } => cmd("plan", vec![absolutize(file)]),
+ Commands::Plan { file, no_conservativity } => {
+ let mut a = vec![absolutize(file)];
+ if *no_conservativity {
+ a.push("--no-conservativity".into());
+ }
+ cmd("plan", a)
+ }
Commands::Apply { mode, plan_id } => {
let mut a = vec![mode.clone()];
if let Some(p) = plan_id {
@@ -3138,12 +3152,25 @@ async fn async_main() -> anyhow::Result<()> {
}
// ─── Lifecycle ──────────────────────────────────────────────
- Commands::Plan { file } => {
+ Commands::Plan { file, no_conservativity } => {
let (db, graph) = setup(&cli.data_dir)?;
let turtle = std::fs::read_to_string(&file)?;
let planner = open_ontologies::plan::Planner::new(db, graph);
+ // On by default, matching `onto_plan`. A plan whose semantic half
+ // is switched off looks identical to one that found nothing, which
+ // is the confusion the whole conservativity block exists to end.
+ let opts = (!no_conservativity).then(|| {
+ open_ontologies::conservativity::ConservativityOptions {
+ mode: open_ontologies::conservativity::ExtensionMode::Replacement,
+ profile: "owl-rl".to_string(),
+ out: std::env::temp_dir()
+ .join(format!("oo-plan-conservativity-{}", std::process::id())),
+ scan_rows: 10_000,
+ max_rows: 1_000_000,
+ }
+ });
let result = planner
- .plan(&turtle)
+ .plan_checked(&turtle, opts)
.unwrap_or_else(|e| format!(r#"{{"error":"{}"}}"#, e));
output_result(&result, cli.pretty);
}
@@ -3545,7 +3572,7 @@ mod proxy_serialization_tests {
#[test]
fn an_absolute_path_is_left_alone() {
let abs = if cfg!(windows) { r"C:\onto\proposed.ttl" } else { "/onto/proposed.ttl" };
- let (_, args) = args_of(&Commands::Plan { file: abs.into() });
+ let (_, args) = args_of(&Commands::Plan { file: abs.into(), no_conservativity: false });
assert_eq!(args, vec![abs.to_string()]);
}
@@ -3628,7 +3655,7 @@ mod proxy_serialization_tests {
Commands::History,
Commands::Rollback { label: "v1".into() },
Commands::Ingest { path: "x.csv".into(), format: None, mapping: None, base_iri: None },
- Commands::Plan { file: "p.ttl".into() },
+ Commands::Plan { file: "p.ttl".into(), no_conservativity: false },
Commands::Apply { mode: "safe".into(), plan_id: None },
Commands::Enforce { pack: "generic".into() },
Commands::Monitor,
diff --git a/src/server.rs b/src/server.rs
index 8a2a99c0..ec414036 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -2322,7 +2322,25 @@ impl OpenOntologiesServer {
// `onto_plan` receives the WHOLE proposed graph, so the mode is fixed
// here rather than exposed: reading a replacement as a delta would
// report a change that deletes half the ontology as an extension.
- let conservativity = input.check_conservativity.unwrap_or(false).then(|| {
+ // DEFAULT ON, changed under #196.
+ //
+ // It was opt-in because it reasons both graphs to a fixpoint, and that
+ // is a real cost. Measured on this machine, adding one `rdfs:domain`
+ // triple to a store of N individuals of that property: 900 in 0.14s,
+ // 9,000 in 0.68s, 45,000 in 3.99s. Roughly linear, about 11
+ // microseconds an individual.
+ //
+ // A plan is a deliberate pre-production act, not an interactive query,
+ // and that cost buys the only part of a plan that is about MEANING. In
+ // the run above every shape number stayed at zero — no class added,
+ // none removed, blast radius zero, risk low — while 901 consequences
+ // appeared that were not there before. A safety check that is off by
+ // default is one most users never learn exists, and this one is the
+ // reason to use a plan at all.
+ //
+ // `check_conservativity: false` opts out, and is the thing to reach for
+ // on a store big enough that the fixpoint hurts.
+ let conservativity = input.check_conservativity.unwrap_or(true).then(|| {
crate::conservativity::ConservativityOptions {
mode: crate::conservativity::ExtensionMode::Replacement,
profile: input.conservativity_profile.unwrap_or_else(|| "owl-rl".to_string()),
diff --git a/tests/knowledge_graph_asset_test.rs b/tests/knowledge_graph_asset_test.rs
index b626ae41..b3eafa61 100644
--- a/tests/knowledge_graph_asset_test.rs
+++ b/tests/knowledge_graph_asset_test.rs
@@ -264,3 +264,132 @@ fn the_four_beats_are_captioned_in_order() {
"the first beat's caption must be the one a still frame shows"
);
}
+
+// ── The README's caption must match the asset it captions ──────────────
+//
+// It did not. The caption read "4 rejected" while the legend rendered
+// `REJECTED 1`, and the two had disagreed since the asset was redrawn. Nobody
+// noticed because nothing compared them: the counts test above checks the SVG
+// against a real run, and the README against nothing at all.
+//
+// A number on the front page is a claim, and a claim with no gate decays
+// silently. This is that gate.
+
+fn readme() -> String {
+ std::fs::read_to_string(
+ std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("README.md"),
+ )
+ .expect("README.md")
+}
+
+/// The legend counts, read out of the asset rather than out of the generator,
+/// because what ships is the file.
+fn legend_counts() -> (u64, u64, u64) {
+ let s = svg();
+ let one = |label: &str| -> u64 {
+ let i = s
+ .find(&format!(">{label}<"))
+ .unwrap_or_else(|| panic!("the asset has no {label} row"));
+ let tail = &s[i..(i + 400).min(s.len())];
+ let key = "text-anchor=\"end\">";
+ let j = tail
+ .find(key)
+ .unwrap_or_else(|| panic!("no count beside {label}"))
+ + key.len();
+ let k = tail[j..].find('<').expect("unterminated count") + j;
+ tail[j..k].parse().unwrap_or_else(|_| panic!("{label} count is not a number"))
+ };
+ (one("ASSERTED"), one("CERTIFIED"), one("REJECTED"))
+}
+
+#[test]
+fn the_readme_caption_states_the_counts_the_asset_renders() {
+ let (a, c, r) = legend_counts();
+ let expected = format!("{a} asserted, {c} certified, {r} rejected");
+ let readme = readme();
+ assert!(
+ readme.contains(&expected),
+ "the README caption and the asset's own legend disagree. The asset renders \
+ {expected:?}, and the README does not say that. Regenerate the asset and update \
+ the caption together, or the front page states a number the picture under it \
+ contradicts."
+ );
+}
+
+/// The headline number of the semantic plan, which is the first beat.
+///
+/// Derived from a run: a base of 900 individuals of one property, plus one
+/// `rdfs:domain` triple. Every shape number stays at zero and the conservativity
+/// check reports 901 new consequences. The figures below are asserted against a
+/// live run rather than trusted, because a headline nobody re-measures is the
+/// first thing to go stale.
+#[test]
+fn the_front_page_plan_figures_come_from_a_run() {
+ use open_ontologies::conservativity::{ConservativityOptions, ExtensionMode};
+ use open_ontologies::graph::GraphStore;
+ use open_ontologies::plan::Planner;
+ use open_ontologies::state::StateDb;
+ use std::sync::Arc;
+
+ const N: usize = 900;
+ let mut base = String::from(
+ "@prefix ex: <http://ex.org/> .\n\
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .\n\
+ ex:Person a owl:Class .\n\
+ ex:hasParent a owl:ObjectProperty .\n",
+ );
+ for i in 0..N {
+ base.push_str(&format!("ex:p{i} ex:hasParent ex:q{i} .\n"));
+ }
+ let dir = std::env::temp_dir().join(format!("oo-readme-plan-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(&dir).unwrap();
+ let graph = Arc::new(GraphStore::new());
+ graph.load_turtle(&base, None).unwrap();
+ let planner = Planner::new(StateDb::open(&dir.join("state.db")).unwrap(), graph);
+ let proposal = format!("{base}ex:hasParent rdfs:domain ex:Person .\n");
+ let out = planner
+ .plan_checked(
+ &proposal,
+ Some(ConservativityOptions {
+ mode: ExtensionMode::Replacement,
+ profile: "owl-rl".to_string(),
+ out: dir.join("cert"),
+ scan_rows: 100_000,
+ max_rows: 1_000_000,
+ }),
+ )
+ .unwrap();
+ let v: serde_json::Value = serde_json::from_str(&out).unwrap();
+ let _ = std::fs::remove_dir_all(&dir);
+
+ let readme = readme();
+ // The field names are the plan's own: `added_classes`, not `added.classes`.
+ // The first version of this read `added.classes`, got `None`, and reported
+ // zero through an `unwrap_or(0)` — a missing field and a measured zero
+ // looking identical, which is the measurement error this whole file exists
+ // to prevent.
+ let n_added = v["added_classes"].as_array().expect("added_classes").len();
+ let n_removed = v["removed_classes"].as_array().expect("removed_classes").len();
+ assert_eq!(n_added, 0, "the one-triple change added a class: {:?}", v["added_classes"]);
+ assert_eq!(n_removed, 0, "it removed one: {:?}", v["removed_classes"]);
+ assert_eq!(v["blast_radius"]["triples_affected"], serde_json::json!(0));
+ assert_eq!(v["risk_score"], serde_json::json!("low"));
+ assert_eq!(
+ v["conservativity"]["conservativity_verdict"],
+ serde_json::json!("not_conservative_under_rule_table")
+ );
+ let consequences = v["conservativity"]["new_consequences_total"]
+ .as_u64()
+ .expect("a count of new consequences");
+ assert!(
+ readme.contains(&format!("{consequences} consequences that were not there before")),
+ "the run reports {consequences} new consequences and the README headline does not \
+ say so. The front page number is the claim; this run is the measurement."
+ );
+ assert!(
+ readme.contains(&format!("new consequences {consequences}")),
+ "the plan block on the front page does not state {consequences}"
+ );
+}
diff --git a/tests/readme_claims_test.rs b/tests/readme_claims_test.rs
index 6c42e0c5..8f2028aa 100644
--- a/tests/readme_claims_test.rs
+++ b/tests/readme_claims_test.rs
@@ -30,18 +30,31 @@ fn exposed_tool_count() -> usize {
/// identifies it as a total rather than a subgroup. Add a row when a new one is written.
///
/// The architecture diagram left README.md for docs/architecture.md on 14 September 2026,
-/// when the README was cut from 1213 lines to 171, so it is checked in its new home. The
-/// tool-reference heading went with the section it belonged to and no longer exists.
+/// when the README was cut from 1213 lines to 171. On 19 September 2026 the total left the
+/// outward prose entirely, under #196, and the one row that remains guards it where it now
+/// lives. See the note at the end of this function.
fn total_claims(n: usize) -> Vec<(&'static str, &'static str, String)> {
- vec![
- ("README.md", "the lead paragraph", format!("**{n} tools**")),
- (
- "README.md",
- "the default-build sentence",
- format!("A default build advertises {} tools.", n - gated_tool_count()),
- ),
- ("docs/architecture.md", "the architecture diagram", format!("ToolGroups[\"{n} Tools\"]")),
- ]
+ vec![(
+ "docs/tool-reference.md",
+ "the reference page's own count",
+ format!("{n} tools."),
+ )]
+ // THE README NO LONGER STATES A TOTAL, and the architecture diagram no
+ // longer labels a subgraph with one. Removed under #196, deliberately.
+ //
+ // The reasoning is the issue's: surface area reads as insecurity, and a
+ // number where a purpose belongs tells a visitor nothing about what this is
+ // for. A reader who meets "120 tools" before meeting a verb cannot tell
+ // whether any of them is the one they need. The front page shows one loop
+ // instead, and the breadth moved to docs/tool-reference.md, linked once.
+ //
+ // The count did not stop being checked, it moved with the claim. The
+ // reference page is the catalogue, its job is to be exhaustive, and a
+ // catalogue that will not say how long it is is being coy. So the row above
+ // guards it there, and `tests/tool_reference_test.rs` additionally checks
+ // that the page lists EVERY registered tool and invents none, which is a
+ // stronger statement than the total ever was: a page can state 120 and list
+ // the wrong 120.
// The MCP server's instructions string used to be checked here as a literal, and
// that row is gone on purpose. It stated TWO totals, 114 and 112, and neither was
// the number the router advertised: a hand-typed figure with a second hand-typed
diff --git a/tests/tool_reference_test.rs b/tests/tool_reference_test.rs
new file mode 100644
index 00000000..9321513c
--- /dev/null
+++ b/tests/tool_reference_test.rs
@@ -0,0 +1,179 @@
+//! **The tool reference lists every tool, and the front page lists none of them.**
+//!
+//! Issue #196: the README sold surface area. A visitor met four abstract nouns
+//! and a tool count before meeting a verb, and could not tell what the thing was
+//! for. The breadth is real and it keeps its code; it loses its place above the
+//! fold and moves to `docs/tool-reference.md`, linked once, low on the page.
+//!
+//! A reference page that drifts from the code is worse than no reference page,
+//! because it is read as authoritative. These tests are the gate: the page is
+//! generated from the `#[tool(...)]` attributes and must stay in step with them.
+
+use std::collections::BTreeSet;
+use std::path::{Path, PathBuf};
+
+fn repo() -> PathBuf {
+ PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+}
+
+fn read(p: &str) -> String {
+ std::fs::read_to_string(repo().join(p)).unwrap_or_else(|e| panic!("{p}: {e}"))
+}
+
+/// Tool names as the server registers them.
+fn registered() -> BTreeSet<String> {
+ let src = read("src/server.rs");
+ let mut out = BTreeSet::new();
+ let needle = "#[tool(name = \"";
+ let mut i = 0;
+ while let Some(j) = src[i..].find(needle) {
+ let start = i + j + needle.len();
+ let end = start + src[start..].find('"').expect("unterminated tool name");
+ out.insert(src[start..end].to_string());
+ i = end;
+ }
+ out
+}
+
+/// Tool names the reference page lists, from the first column of its table.
+fn documented() -> BTreeSet<String> {
+ read("docs/tool-reference.md")
+ .lines()
+ .filter_map(|l| {
+ let l = l.trim();
+ let rest = l.strip_prefix("| `")?;
+ let end = rest.find('`')?;
+ Some(rest[..end].to_string())
+ })
+ .collect()
+}
+
+#[test]
+fn every_registered_tool_is_in_the_reference() {
+ let (r, d) = (registered(), documented());
+ let missing: Vec<_> = r.difference(&d).collect();
+ assert!(
+ missing.is_empty(),
+ "these tools are registered and not listed in docs/tool-reference.md: {missing:?}. \
+ Regenerate the page rather than deleting this assertion; an unlisted tool is one \
+ nobody can find."
+ );
+}
+
+#[test]
+fn the_reference_invents_no_tools() {
+ let (r, d) = (registered(), documented());
+ let extra: Vec<_> = d.difference(&r).collect();
+ assert!(
+ extra.is_empty(),
+ "docs/tool-reference.md lists tools the server does not register: {extra:?}. A \
+ reference page that names something that does not exist is worse than a missing \
+ page, because it is read as authoritative."
+ );
+}
+
+/// The count on the page is a claim like any other.
+#[test]
+fn the_reference_states_the_right_count() {
+ let n = registered().len();
+ let page = read("docs/tool-reference.md");
+ assert!(
+ page.contains(&format!("{n} tools.")),
+ "the page does not state {n} tools, which is how many are registered"
+ );
+}
+
+/// The repositioning itself. The front page shows the loop and not the
+/// catalogue, and this is what stops the catalogue creeping back.
+#[test]
+fn the_front_page_sells_the_loop_and_not_the_surface_area() {
+ let readme = read("README.md");
+ let fold = &readme[..readme.len().min(9000)];
+
+ for banned in ["120 tools", "112 tools", "Terraforming MCP"] {
+ assert!(
+ !readme.contains(banned),
+ "the README still says {banned:?}. Surface area reads as insecurity, and a \
+ number where a purpose belongs tells a visitor nothing about what this is for."
+ );
+ }
+ for beat in [
+ "consequences that were not there before", // beat 1, the semantic plan
+ "re-verifies months later", // beat 2, the certificate
+ "exits 1 and names the rule", // beat 3, the refusal
+ ] {
+ assert!(
+ fold.contains(beat),
+ "the fold is missing the beat {beat:?}. The three beats are attention, \
+ evidence, credibility, in that order, and dropping one leaves an argument \
+ that does not close."
+ );
+ }
+ assert!(
+ fold.contains("This is not an ontology editor"),
+ "the anti-positioning line is gone. It answers the first question a visitor has."
+ );
+ assert!(
+ fold.contains("A text diff is `git diff`"),
+ "the second anti-positioning line is gone. It pre-empts the first objection, which \
+ is why this is not just a file in git."
+ );
+ assert!(
+ readme.contains("docs/tool-reference.md"),
+ "the breadth has to be reachable: the reference page is linked once, low on the page"
+ );
+}
+
+/// `trustworthy`, and the other words the issue retired, must stay gone.
+///
+/// Checked by ABSENCE across every file that carries outward prose, because a
+/// claim lives in more copies than anyone expects and reading the new text
+/// finds only the copy you are looking at.
+///
+/// `docs/tool-reference.md` is exempt from the COUNT strings and only those.
+/// The ban exists because a number where a purpose belongs tells a visitor
+/// nothing about what this is for; the reference page is the catalogue, its job
+/// is to be exhaustive, and a catalogue that will not say how long it is is
+/// being coy. It is not exempt from `trustworthy`, which is a faith claim
+/// wherever it appears. This exemption is written down rather than achieved by
+/// narrowing the walk, so a reader can disagree with it.
+#[test]
+fn the_retired_words_do_not_come_back() {
+ let mut hits = vec![];
+ let mut walk = |p: &Path| {
+ if p.extension().is_some_and(|e| e == "md")
+ && let Ok(t) = std::fs::read_to_string(p)
+ {
+ let lower = t.to_lowercase();
+ let is_catalogue = p.ends_with("tool-reference.md");
+ for w in ["120 tools", "112 tools", "terraforming mcp", "trustworthy"] {
+ let counts_only = w.ends_with(" tools");
+ if is_catalogue && counts_only {
+ continue;
+ }
+ if lower.contains(w) {
+ hits.push(format!("{}: {w}", p.display()));
+ }
+ }
+ }
+ };
+ walk(&repo().join("README.md"));
+ walk(&repo().join("README.zh-CN.md"));
+ let docs = repo().join("docs");
+ let mut stack = vec![docs];
+ while let Some(d) = stack.pop() {
+ let Ok(rd) = std::fs::read_dir(&d) else { continue };
+ for e in rd.flatten() {
+ let p = e.path();
+ if p.is_dir() {
+ stack.push(p);
+ } else {
+ walk(&p);
+ }
+ }
+ }
+ assert!(
+ hits.is_empty(),
+ "retired strings are back: {hits:?}. Verify by absence, not by reading the new text."
+ );
+}