Schema Lock-in Auto Approved

Operational Ontology Target, Logic, and Implementation

목표는 모든 source row를 예쁘게 graph로 바꾸는 것이 아니다. 목표는 conservative logistics data를 decision 가능한 의미 계층으로 compile해서, deterministic logic과 LLM retrieval이 같은 source-grounded context를 쓰게 만드는 것이다.

1. Objective

현재 digital twin은 source-world를 잘 보여준다. 다음 단계의 ontology decision layer는 “왜 이 action을 추천하는가”를 source row, typed edge, deterministic fact, semantic explanation으로 traceable하게 보여줘야 한다.

ScalableSourceRecord는 증가해도 semantic node type은 늘리지 않는다. schema는 source volume이 아니라 decision responsibility 기준으로 유지된다.
Minimalnode는 action, lifecycle, traversal, provenance, governance, replacement value가 있을 때만 만든다. 나머지는 field다.
Dual-usecapacity math, freshness, IDs, status, graph expansion은 deterministic. ambiguity, explanation, operator language는 LLM.

2. Actions Enabled

ActionOntology supportDemo target
Retrieve contextsearchable nodes with retrieval_description, aliases, source refs, and typed graph expansion policyT05 query retrieves dock, shipment, task, capacity, lineage, and source evidence without pulling baseline noise.
Understand incidentIncident -> Risk -> SourceRecord plus NEXT_INCIDENT causal replay edgesCarrier early arrival is represented as an operational pressure event, not just a UI label.
Propagate impactAFFECTS, EXECUTES_ORDER, FULFILLS_IN, CONSTRAINED_BY, LINEAGE_STEP_ATOrder risk expands to WCS work, AMR assignment, dock shipment, resource overload, and handling-unit trace gaps.
Rank action optionsDecision -> RECOMMENDS/CONSIDERS -> ActionOption -> IMPACTS_RISKResequence APT-007 premium cartons outranks conditional notice because deterministic KPI deltas are stronger.
Explain provenanceEVIDENCED_BY and REFERS_TO edges preserve source file, source record id, freshness, replay orderEvery decision surface can show what source rows supported it and which evidence is stale/missing.

3. Minimal Schema

v0.1 uses 14 node types. This is intentionally small enough to reason about, but complete enough to support deterministic and semantic decision work.

Node typeWhy it deserves a nodeRejected as separate node
LocationSpatial anchor for tasks, assets, resources, incidents, and twin highlights.Zone/status are fields.
AssetAMR/charger can be assigned, excluded, routed, charged, or used as capacity evidence.Battery snapshot is evidence/source state.
Order, OrderLine, ShipmentEach has independent SLA, allocation, fulfillment, or carrier-decision lifecycle.Customer/account/wave are fields for v0.1.
WorkTask, HandlingUnitExecution and movement truth are where operational decisions become concrete.Milestones are lineage edge fields.
Resource, LaborRoleFeasibility, approval, staffing, and bottleneck logic need deterministic capacity anchors.Individual worker is not needed in this demo.
SourceRecordProvenance must be a first-class retrievable object, not hidden metadata.Raw source system is a field/source ref.
Incident, Risk, Decision, ActionOptionDecision twin needs explicit causal state, risk, selected action, rejected action, and explanation target.Pressure score is a field, not a node.

4. Logic Boundary

LayerOwnsReason
Deterministic selectorsID match, source freshness, affected entity expansion, task status, capacity overload, lineage gap, action KPI scoringThese are exact source facts or computed checks. They should not be delegated to a model.
Graph querytyped path expansion with max depth and allowed edge typesIt prevents context explosion while preserving why each node is included.
LLM judgmentoperator-language synthesis, uncertainty explanation, supervisor/customer-facing rationaleThese require language judgment but must stay inside the ContextPacket evidence boundary.
Human approvalresequence, split, notify, operational override, customer-facing commitmentConservative logistics environments require approval for side effects and external commitments.

5. ContextPacket

ContextPacket is the retrieval boundary between ontology and LLM. The model receives selected nodes, selected edges, deterministic facts, missing/conflicting evidence, allowed actions, and semantic judgment needs. It does not receive the full graph.

First target: CTX-T05. It contains carrier early arrival, APT-007 / SHIP-007, DOCK-03 capacity pressure, high-priority blocked WCS tasks, source sync asymmetry, handling-unit trace gaps, and the recommended resequence action.

6. Implementation

ArtifactPurpose
scripts/compile-operational-ontology.mjsReads source exports and twin scenario data, emits full ontology, context packets, and UI projection.
scripts/validate-operational-ontology.mjsValidates node/edge integrity, provenance, retrieval fields, ContextPacket references, and T05 smoke case.
data/ontology/operational-logistics-ontology-v0.1/operational-ontology.jsonFull source-grounded ontology artifact for research, validation, and future compiler work.
src/data/generated/ontology-decision-demo.jsonSmall UI projection for graph view and decision process panels.
app/api/ontology/decisionRuntime LLM explanation endpoint using OpenRouter openai/gpt-5.4-mini when the API key is configured.

7. High Standard

v0.1 is intentionally minimal, but it is not a toy graph. It must prove that ontology compilation makes operational decisions traceable: source rows become evidence nodes, evidence nodes expand to operational entities, deterministic facts choose and constrain action options, and LLM explanation is bounded by the ContextPacket.

Completion bar: the demo should let a viewer see source row -> ontology node/edge -> deterministic fact -> selected action -> LLM explanation -> digital twin impact without trusting hidden prompt magic.