Skip to content

Commit 444d1db

Browse files
ralyodioclaude
andcommitted
feat(openontology): implement OpenOntology Phase 0 + local engine and CLI
Implements OpenPRD 0001 through Phase 0 (specification, schemas, example, docs surface) and Phase 1 (local engine, CLI, conformance tests). Schemas (17 contracts, JSON Schema Draft 2020-12, additionalProperties:false) manifest, namespace, entity-type, property, relationship-type, constraint, query, action, entity, claim, source, evidence, changeset, review, approval, event, package — registered in @logicsrc/validators and exported from @logicsrc/schemas under https://logicsrc.com/schemas/openontology/. @logicsrc/openontology - canonical JSON + sha256 package digests; YAML, JSON, NDJSON, and inline authoring all compile to the same bytes, so digests are authoring-agnostic - id profile: compact / IRI / urn with one canonicalization rule, prefix bound by a Namespace object so IRIs reverse unambiguously - validation: schema, graph (domain/range, datatypes, dangling refs), provenance (source-or-firstParty, agent runId, derivation inputs), policy (excerpt limits, licensing, visibility, staleness) and declared constraints; four severities, stable codes, text/json/yaml/markdown - portable triple-pattern query AST: multi-hop, 14 operators, asOf and recordedAsOf, per-status filtering, distinct/order/limit, explanation mode, and enforced depth/binding/row limits - append-only store: claims are immutable; dispute/retract/supersede append status transitions and the effective status is the latest one - change sets: 9 operations, atomic pre-flight, conflict detection on stale base revisions, semantic diff with duplicate-identity warnings and affected-query deltas, per-operation reviewer decisions - policy: agents propose but can never apply — the denial keys on actor type, so every scope plus high confidence plus --yolo still cannot apply; merges need approval, bulk retractions need two, undeclared action side effects are denied - JSON-LD 1.1 export/import with PROV-O aliases and lossy-field reporting - pluggable signature envelope with a jws-ed25519 reference profile and a fail-closed trust policy CLI: logicsrc ontology init|validate|lint|build|inspect, entity, claim, query, changeset, import, export, audit. Reads take --format, writes default to a proposal, exit codes are stable for CI. Example: examples/openontology/ethereum-ecosystem — 12 entity types, 17 relationship types, 63 entities, 169 claims, 25 sources, 31 evidence records, 5 saved queries, every claim lifecycle state, and a pending merge proposal. All data is fictional; the directory is removable without affecting any core test. Docs: docs/openontology{,-governance,-interoperability}.md, a real /openontology route, homepage + nav + sitemap entries, and a root README section. Verification: 112 new tests; full monorepo build and every workspace test pass; conformance bundle (18 valid + 13 invalid fixtures) runs against the published schemas alone; Node.js 25 and Bun 1.3 produce byte-identical digests, revisions, event trails, and query results. Not included (later PRD phases): MCP resources, REST/SSE, Turso adapter, TUI and PWA surfaces, RDF/SHACL mappings, source adapters, governed actions. Refs: prd/0001-add-logicsrc-openontology-spec.md Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 0d9dab0 commit 444d1db

101 files changed

Lines changed: 11934 additions & 10 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ apps/
1414
commandboard-web PWA shell
1515
packages/
1616
cli logicsrc OpenSpec CLI
17+
openontology OpenOntology reference engine (entities, claims, queries, change sets)
1718
logicsrc-mcp @profullstack/logicsrc-mcp standards MCP server
1819
sdk SDK contract types and helpers
1920
tui terminal UI
@@ -27,6 +28,10 @@ plugins/
2728
c0mpute work-in-progress compute jobs and worker pools plugin
2829
docs/
2930
specs, CLI conventions, permissions, and roadmap notes
31+
examples/
32+
openontology/ethereum-ecosystem fictional ecosystem map demonstrating OpenOntology
33+
prd/
34+
numbered OpenPRD proposals
3035
scripts/
3136
install.sh curl | sh installer
3237
```
@@ -47,6 +52,33 @@ npm --workspace @profullstack/logicsrc-mcp run build
4752
node packages/logicsrc-mcp/dist/index.js
4853
```
4954

55+
## OpenOntology
56+
57+
[LogicSRC OpenOntology](docs/openontology.md) is an open contract for durable, source-backed domain
58+
knowledge shared by humans and AI agents: typed entities, claims that carry provenance and time,
59+
a portable query AST, and governed change sets. It is storage-agnostic, model-provider-neutral, and
60+
works offline with no account.
61+
62+
```bash
63+
npm --workspace @logicsrc/cli run dev -- ontology init my-ecosystem
64+
npm --workspace @logicsrc/cli run dev -- ontology validate my-ecosystem --strict
65+
npm --workspace @logicsrc/cli run dev -- ontology query run contributors --dir my-ecosystem
66+
```
67+
68+
```txt
69+
✓ 3 entity types
70+
✓ 4 relationship types
71+
✓ 8 entities
72+
✓ 14 claims
73+
✓ 2 sources
74+
OpenOntology package is valid.
75+
```
76+
77+
Claims are append-only and agents propose rather than apply: a corrected fact becomes a dispute,
78+
retraction, or supersession, and every answer traces back to the claims, evidence, and sources
79+
behind it. See also [governance](docs/openontology-governance.md) and
80+
[interoperability](docs/openontology-interoperability.md).
81+
5082
## MCP
5183

5284
LogicSRC exposes a standards-focused MCP server as `@profullstack/logicsrc-mcp`.
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
import Link from "next/link";
2+
import type { ReactNode } from "react";
3+
import type { Metadata } from "next";
4+
import { SiteShell } from "@/components/site-shell";
5+
6+
export const metadata: Metadata = {
7+
title: "OpenOntology · LogicSRC",
8+
description:
9+
"LogicSRC OpenOntology is an open contract for durable, source-backed domain knowledge shared by humans and AI agents: typed entities, claims with provenance and time, portable queries, and governed change sets.",
10+
alternates: { canonical: "/openontology" },
11+
};
12+
13+
const card = {
14+
border: "1px solid #e3e6e0",
15+
borderRadius: "0.6rem",
16+
padding: "1rem 1.15rem",
17+
background: "#fff",
18+
} as const;
19+
20+
const mono = {
21+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
22+
fontSize: "0.85rem",
23+
} as const;
24+
25+
const pre = {
26+
...mono,
27+
background: "#101418",
28+
color: "#e8eef5",
29+
padding: "1rem 1.1rem",
30+
borderRadius: "0.6rem",
31+
overflowX: "auto" as const,
32+
lineHeight: 1.6,
33+
margin: 0,
34+
};
35+
36+
const NOUNS: Array<[string, string, string]> = [
37+
["Type", "What kind of thing something is", "Person, Project, Codebase"],
38+
["Entity", "A specific thing with a stable id", "eth:person:avery-lindqvist"],
39+
["Claim", "A typed statement about an entity, or between two", "Avery —worksOn→ ZK Prover"],
40+
["Source", "Where the claim came from", "a commit, a page, an API response"],
41+
["Change set", "A reviewable proposal to add, correct, merge, or retract", "“Add Alice to ZK Prover”"],
42+
];
43+
44+
const LAYERS: Array<[string, string]> = [
45+
[
46+
"Ontology schema",
47+
"The types, properties, relationships, constraints, and saved queries that describe a domain. Fetchable on its own, with no data in it.",
48+
],
49+
[
50+
"Knowledge graph",
51+
"The populated entities, claims, sources, and evidence. Append-only: corrections add history rather than overwriting it.",
52+
],
53+
[
54+
"Storage engine",
55+
"Where those objects happen to live — SQLite, Turso/libSQL, Postgres, an RDF store. Swappable behind one adapter interface.",
56+
],
57+
[
58+
"Vector search",
59+
"Optional, rebuildable, derived data that improves discovery. Never authoritative, never the only representation of a fact.",
60+
],
61+
[
62+
"Agent runtime",
63+
"The thing that reads, queries, and proposes. It holds scopes, not privileges: it proposes; a human applies.",
64+
],
65+
];
66+
67+
export default function OpenOntologyPage(): ReactNode {
68+
return (
69+
<SiteShell active="OpenOntology">
70+
<div className="band">
71+
<div className="section-head">
72+
<p className="eyebrow">LogicSRC standards surface</p>
73+
<h2>OpenOntology</h2>
74+
<p>
75+
An open contract for durable, source-backed domain knowledge shared by humans and AI
76+
agents. Define the things in a domain, connect them with typed claims, preserve where
77+
each fact came from, and let agents query or propose changes through governed
78+
interfaces.
79+
</p>
80+
</div>
81+
82+
<p style={{ color: "#41505d" }}>
83+
OpenOntology is a <strong>standard</strong>, not a hosted graph product. The normative
84+
contracts are JSON Schemas; <code style={mono}>@logicsrc/openontology</code> is a
85+
reference implementation of them, not the definition. It is storage-agnostic,
86+
model-provider-neutral, and works with no account, no API key, and no network.
87+
</p>
88+
<p style={{ color: "#5b6b7a", fontSize: "0.95rem" }}>
89+
Status: <strong>0.1 Draft</strong>. Ontologies are decades-old work and OpenOntology did
90+
not invent them — it is one open, agent-shaped contract among several, and it maps to
91+
JSON-LD and PROV-O rather than replacing them.
92+
</p>
93+
</div>
94+
95+
<div className="band">
96+
<div className="section-head">
97+
<h2>Five nouns</h2>
98+
<p>Learn these and you can read any package.</p>
99+
</div>
100+
<div style={{ display: "grid", gap: "0.75rem" }}>
101+
{NOUNS.map(([noun, what, example]) => (
102+
<div key={noun} style={card}>
103+
<strong style={{ color: "#101418" }}>{noun}</strong>
104+
<div style={{ color: "#41505d", margin: "0.2rem 0" }}>{what}</div>
105+
<code style={{ ...mono, color: "#5b6b7a" }}>{example}</code>
106+
</div>
107+
))}
108+
</div>
109+
</div>
110+
111+
<div className="band">
112+
<div className="section-head">
113+
<h2>A map of an ecosystem</h2>
114+
<p>
115+
People, organizations, projects, codebases, and the research topics they serve —
116+
connected by typed, queryable relationships instead of prose.
117+
</p>
118+
</div>
119+
<pre style={pre}>{` Person ──worksAt──▶ Organization ──maintains──▶ Codebase
120+
│ │ │
121+
worksOn builds implements
122+
│ │ │
123+
▼ ▼ ▼
124+
Project ──investigates──▶ ResearchTopic Protocol
125+
126+
funds
127+
128+
FundingProgram`}</pre>
129+
<p style={{ color: "#41505d", marginTop: "1rem" }}>
130+
Ask it a three-hop question — <em>which organizations maintain the codebases the
131+
applications on this network depend on?</em> — and get back rows you can trace to
132+
evidence.
133+
</p>
134+
</div>
135+
136+
<div className="band">
137+
<div className="section-head">
138+
<h2>Every claim carries its receipts</h2>
139+
<p>Status, confidence, both clocks, and the sources it rests on.</p>
140+
</div>
141+
<pre style={pre}>{`openontology: "0.1"
142+
kind: Claim
143+
subject: "eth:person:avery-lindqvist"
144+
predicate: worksOn
145+
object:
146+
entity: "eth:project:zk-prover"
147+
status: asserted # asserted | proposed | disputed
148+
# retracted | superseded | derived
149+
confidence: 0.94 # metadata, never permission
150+
validTime: # when it was true in the world
151+
from: 2026-04-01T00:00:00Z
152+
to: null
153+
assertedAt: 2026-07-25T19:43:12Z # when we recorded it
154+
assertedBy: "agent:research-mapper"
155+
runId: "run_01J3EXAMPLE"
156+
sources: ["eth:source:commit-a41f"]
157+
evidence: ["eth:evidence:007"]`}</pre>
158+
<p style={{ color: "#41505d", marginTop: "1rem" }}>
159+
We say <strong>claim</strong>, not <em>fact</em>. A clean graph makes uncertain things
160+
look definitive, so status, confidence, source count, valid time, and dispute history
161+
stay visible everywhere — in query results, in the CLI, and in the UI.
162+
</p>
163+
</div>
164+
165+
<div className="band">
166+
<div className="section-head">
167+
<h2>Five things people conflate</h2>
168+
<p>OpenOntology is the first two. The rest are implementation choices.</p>
169+
</div>
170+
<div style={{ display: "grid", gap: "0.75rem" }}>
171+
{LAYERS.map(([name, detail]) => (
172+
<div key={name} style={card}>
173+
<strong style={{ color: "#101418" }}>{name}</strong>
174+
<div style={{ color: "#41505d" }}>{detail}</div>
175+
</div>
176+
))}
177+
</div>
178+
</div>
179+
180+
<div className="band">
181+
<div className="section-head">
182+
<h2>Agents propose. Humans apply.</h2>
183+
<p>The safety model in one line, and what enforces it.</p>
184+
</div>
185+
<ul style={{ color: "#41505d", lineHeight: 1.8, paddingLeft: "1.1rem" }}>
186+
<li>Agent-created change sets default to <code style={mono}>proposed</code>.</li>
187+
<li>
188+
An agent holding <em>every</em> scope still cannot apply — the denial keys on actor
189+
type, not on privileges.
190+
</li>
191+
<li>Confidence is metadata, never permission.</li>
192+
<li>
193+
<code style={mono}>--yolo</code> and unattended mode cannot bypass a required approval.
194+
</li>
195+
<li>
196+
Source text is data: an instruction inside an imported document cannot widen scopes or
197+
move tool boundaries.
198+
</li>
199+
<li>Merges, bulk retractions, and breaking migrations require explicit approval.</li>
200+
<li>Model chain-of-thought is never stored; evidence and policy decisions are.</li>
201+
</ul>
202+
</div>
203+
204+
<div className="band">
205+
<div className="section-head">
206+
<h2>Five minutes, offline</h2>
207+
<p>No login, no hosted database, no model key.</p>
208+
</div>
209+
<pre style={pre}>{`logicsrc ontology init my-ecosystem
210+
logicsrc ontology validate my-ecosystem --strict
211+
logicsrc ontology query run contributors --dir my-ecosystem
212+
logicsrc ontology query explain contributors --dir my-ecosystem --row 0`}</pre>
213+
<pre style={{ ...pre, marginTop: "1rem" }}>{` ✓ 3 entity types
214+
✓ 4 relationship types
215+
✓ 8 entities
216+
✓ 14 claims
217+
✓ 2 sources
218+
✓ 1 constraints
219+
OpenOntology package is valid.`}</pre>
220+
</div>
221+
222+
<div className="band">
223+
<div className="section-head">
224+
<h2>Where everything lives</h2>
225+
</div>
226+
<ul style={{ color: "#41505d", lineHeight: 1.9, paddingLeft: "1.1rem" }}>
227+
<li>
228+
<Link href="/docs/openontology">Specification</Link> — the model, packages, claims,
229+
queries, validation, CLI, SDK, conformance
230+
</li>
231+
<li>
232+
<Link href="/docs/openontology-governance">Governance</Link> — review, approval,
233+
scopes, merges, conflicts, rollback, audit, signatures
234+
</li>
235+
<li>
236+
<Link href="/docs/openontology-interoperability">Interoperability</Link> — JSON-LD,
237+
RDF, SHACL, PROV-O, external ids, compatibility matrix
238+
</li>
239+
<li>
240+
<a
241+
href="https://github.com/profullstack/logicsrc/tree/master/packages/schemas/schemas"
242+
rel="noreferrer"
243+
>
244+
JSON Schemas
245+
</a>{" "}
246+
— 16 normative object contracts under{" "}
247+
<code style={mono}>logicsrc-openontology-*.schema.json</code>
248+
</li>
249+
<li>
250+
<a
251+
href="https://github.com/profullstack/logicsrc/tree/master/packages/schemas/fixtures/openontology"
252+
rel="noreferrer"
253+
>
254+
Conformance bundle
255+
</a>{" "}
256+
— valid and invalid fixtures a third party can run with no LogicSRC code
257+
</li>
258+
<li>
259+
<a
260+
href="https://github.com/profullstack/logicsrc/tree/master/examples/openontology/ethereum-ecosystem"
261+
rel="noreferrer"
262+
>
263+
Ethereum ecosystem example
264+
</a>{" "}
265+
— 63 entities, 169 claims, 25 sources, all fictional
266+
</li>
267+
<li>
268+
<a
269+
href="https://github.com/profullstack/logicsrc/blob/master/prd/0001-add-logicsrc-openontology-spec.md"
270+
rel="noreferrer"
271+
>
272+
OpenPRD 0001
273+
</a>{" "}
274+
— the proposal, its decisions, and its open questions
275+
</li>
276+
<li>
277+
<a href="https://github.com/profullstack/logicsrc" rel="noreferrer">
278+
Source on GitHub
279+
</a>
280+
</li>
281+
</ul>
282+
</div>
283+
</SiteShell>
284+
);
285+
}

apps/logicsrc-web/src/app/sitemap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const STATIC_ROUTES: Array<{
1616
}> = [
1717
{ path: "/", changeFrequency: "weekly", priority: 1.0 },
1818
{ path: "/docs", changeFrequency: "weekly", priority: 0.9 },
19+
{ path: "/openontology", changeFrequency: "weekly", priority: 0.9 },
1920
{ path: "/openspec", changeFrequency: "weekly", priority: 0.8 },
2021
{ path: "/agent-swarm", changeFrequency: "weekly", priority: 0.8 },
2122
{ path: "/agentbyte", changeFrequency: "weekly", priority: 0.8 },

apps/logicsrc-web/src/components/site-shell.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const NAV: Array<{ href: string; label: string; external?: boolean }> = [
88
{ href: "/agent-swarm", label: "Soon" },
99
{ href: "/agentbyte", label: "AgentByte" },
1010
{ href: "/credential-sharing", label: "Credentials" },
11+
{ href: "/openontology", label: "OpenOntology" },
1112
{ href: "/#cli", label: "CLI" },
1213
{ href: "/docs", label: "Docs" },
1314
{ href: "/blog", label: "Blog" },

apps/logicsrc-web/src/lib/docs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const DOCS_DIR = resolve(process.cwd(), "../../docs");
88
// Curated, public-facing reference docs. Internal notes (roadmap, positioning,
99
// arcade) are intentionally excluded.
1010
export const DOC_SLUGS = [
11+
"openontology",
12+
"openontology-governance",
13+
"openontology-interoperability",
1114
"openspec-comparison",
1215
"data-model",
1316
"cli",

0 commit comments

Comments
 (0)