Sprint 1: project skeleton, type system, and all architecture specs
- src/types.hpp: complete UCWM type system in C++20 — 19 enums, 11 facet data types, all core structs (CanonicalObject, Constraint, Facet, GateSignal, WorldState, etc.) with full JSON round-trip serialization - src/main.cpp: smoke test — constructs apple-problem WorldState by hand, serializes to JSON - tests/test_types.cpp: 19 tests, 123 assertions, all passing - CMakeLists.txt: CMake + CPM build with nlohmann/json, spdlog, Catch2 - schemas/: JSON Schema contracts for all UCWM data types - gates/, specialists/, resolver/, synthesis/: language-agnostic interface contracts and domain specs for all pipeline layers - docs/: architecture, vocabulary, decision matrices, roadmap (6 phases, 28 sprints), sprint_001, implementation_constraints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
155
schemas/constraints.json
Normal file
155
schemas/constraints.json
Normal file
@@ -0,0 +1,155 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "ucwm/schemas/constraints.json",
|
||||
"title": "Constraint",
|
||||
"description": "The core reasoning currency of UCWM. An explicit relation, restriction, incompatibility, requirement, or preference involving objects and/or facets.",
|
||||
"type": "object",
|
||||
"required": ["constraint_id", "constraint_type", "argument_refs", "polarity", "strength", "status", "source_module"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"constraint_id": {
|
||||
"type": "string",
|
||||
"description": "Unique identifier. Format: C{sequence} e.g. C1, C14"
|
||||
},
|
||||
"constraint_type": {
|
||||
"type": "string",
|
||||
"description": "Named relation type. Implementors should define allowed values per domain.",
|
||||
"examples": [
|
||||
"before",
|
||||
"after",
|
||||
"during",
|
||||
"causes",
|
||||
"enables",
|
||||
"blocks",
|
||||
"same_entity",
|
||||
"not_same_entity",
|
||||
"owns",
|
||||
"transfers",
|
||||
"inside",
|
||||
"outside",
|
||||
"adjacent",
|
||||
"quantity_equals",
|
||||
"quantity_sum",
|
||||
"quantity_difference",
|
||||
"quantity_product",
|
||||
"quantity_greater",
|
||||
"quantity_less",
|
||||
"truth_value",
|
||||
"implies",
|
||||
"negates",
|
||||
"contradicts",
|
||||
"prerequisite",
|
||||
"goal",
|
||||
"has_role"
|
||||
]
|
||||
},
|
||||
"argument_refs": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"minItems": 1,
|
||||
"description": "Ordered list of object_ids or facet_ids this constraint relates. Order is significant for asymmetric relations."
|
||||
},
|
||||
"polarity": {
|
||||
"type": "string",
|
||||
"enum": ["positive", "negative"],
|
||||
"description": "Whether this constraint asserts or denies the relation."
|
||||
},
|
||||
"strength": {
|
||||
"type": "string",
|
||||
"enum": ["hard", "soft", "probabilistic", "defeasible"],
|
||||
"description": "hard=must hold; soft=preferred; probabilistic=holds with stated probability; defeasible=default, retractable by new evidence"
|
||||
},
|
||||
"probability": {
|
||||
"type": "number",
|
||||
"minimum": 0.0,
|
||||
"maximum": 1.0,
|
||||
"description": "Required when strength=probabilistic."
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": ["unresolved", "resolved", "contradicted", "suspended"],
|
||||
"description": "Resolver lifecycle status.",
|
||||
"default": "unresolved"
|
||||
},
|
||||
"expression": {
|
||||
"type": "string",
|
||||
"description": "Optional human-readable or formal logic expression of the constraint. Informational; not authoritative.",
|
||||
"examples": [
|
||||
"before(E1, E2)",
|
||||
"quantity(Q1) = quantity(Q2) - 3",
|
||||
"owner(O3) = Entity_Alice"
|
||||
]
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0.0,
|
||||
"maximum": 1.0,
|
||||
"description": "Confidence that this constraint is correctly extracted."
|
||||
},
|
||||
"contradicted_by_refs": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "constraint_ids that contradict this one. Populated by the resolver.",
|
||||
"default": []
|
||||
},
|
||||
"supports_refs": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "constraint_ids that reinforce this one.",
|
||||
"default": []
|
||||
},
|
||||
"source_module": {
|
||||
"type": "string",
|
||||
"description": "Specialist or module that emitted this constraint."
|
||||
},
|
||||
"provenance_refs": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"default": []
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"constraint_id": "C1",
|
||||
"constraint_type": "owns",
|
||||
"argument_refs": ["E1", "O_apples", "Q1"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "resolved",
|
||||
"expression": "owns(Alice, apples, count=5) at t0",
|
||||
"confidence": 0.98,
|
||||
"source_module": "ownership_specialist",
|
||||
"contradicted_by_refs": [],
|
||||
"supports_refs": [],
|
||||
"provenance_refs": ["P1"]
|
||||
},
|
||||
{
|
||||
"constraint_id": "C2",
|
||||
"constraint_type": "before",
|
||||
"argument_refs": ["EV_initial_possession", "EV_transfer"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "resolved",
|
||||
"expression": "before(E_initial_possession, E_transfer)",
|
||||
"confidence": 0.99,
|
||||
"source_module": "temporal_specialist",
|
||||
"contradicted_by_refs": [],
|
||||
"supports_refs": [],
|
||||
"provenance_refs": ["P2"]
|
||||
},
|
||||
{
|
||||
"constraint_id": "C3",
|
||||
"constraint_type": "quantity_difference",
|
||||
"argument_refs": ["Q_alice_final", "Q1", "Q2"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "resolved",
|
||||
"expression": "quantity(Q_alice_final) = quantity(Q1) - quantity(Q2)",
|
||||
"confidence": 0.99,
|
||||
"source_module": "quantity_specialist",
|
||||
"contradicted_by_refs": [],
|
||||
"supports_refs": [],
|
||||
"provenance_refs": ["P3"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user