feat(openontology): OpenOntology Phase 0 + local engine and CLI#99
Merged
Conversation
… 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>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements OpenPRD 0001 through Phase 0 (specification, schemas, example, docs surface) and Phase 1 (local engine, CLI, conformance tests).
101 files, ~11.9k lines.
@logicsrc/openontologyimplements the standard; the 17 JSON Schemas are the standard.What's here
Schemas — 17 Draft 2020-12 contracts (
logicsrc-openontology-*.schema.json),additionalProperties: false, namespaced extension points, registered in@logicsrc/validatorsand exported from@logicsrc/schemas.Engine (
@logicsrc/openontology)urn:, one canonicalization rule, prefix bound by aNamespaceso IRIs reverse unambiguouslyasOf/recordedAsOf, per-status filtering, explanation mode, enforced limitsjws-ed25519reference profile, fail-closed trust policyCLI —
logicsrc ontology init|validate|lint|build|inspect|entity|claim|query|changeset|import|export|audit. Writes default to a proposal; exit codes stable for CI.Example —
examples/openontology/ethereum-ecosystem: 12 entity types, 17 relationship types, 63 entities, 169 claims, 25 sources, 5 saved queries, every claim lifecycle state, a pending merge proposal. All fictional; removable without affecting any core test.Docs + site — three docs pages, a real
/openontologyroute, homepage/nav/sitemap entries, README section.Safety model
An agent proposes; a human applies. The agent-apply denial keys on actor type, not scopes — an agent holding every scope, at high confidence, under
--yolo, still cannot apply. Tests cover each of those paths, plus prompt injection in source text failing to widen scopes.Verification
Not included
Later PRD phases: MCP resources, REST/SSE, Turso adapter, TUI and PWA surfaces, RDF/SHACL mappings, source adapters, governed actions. The interoperability doc marks these "planned", not "supported".
Open questions resolved by defaults
PRD open questions 1–3 were answered to unblock the work, and are cheap to revisit: ids permit all three forms with one canonicalization rule; signatures use a pluggable envelope with a minimal JWS profile as the only implementation; aggregation and path-finding stay P1.
🤖 Generated with Claude Code