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:
166
examples/temporal_001.json
Normal file
166
examples/temporal_001.json
Normal file
@@ -0,0 +1,166 @@
|
||||
{
|
||||
"_comment": "Temporal chain example: multi-event sequence with explicit and implicit ordering.",
|
||||
"input_text": "The meeting started at 9am. Alice arrived after it began. She left before noon.",
|
||||
|
||||
"stage_post_gate": {
|
||||
"gate_signals": [
|
||||
{ "gate_id": "has_entity_reference", "activated": true, "confidence": 0.97 },
|
||||
{ "gate_id": "has_coreference", "activated": true, "confidence": 0.88 },
|
||||
{ "gate_id": "has_temporal_relation", "activated": true, "confidence": 0.99,
|
||||
"evidence_spans": [{"text": "at 9am"}, {"text": "after"}, {"text": "before noon"}] },
|
||||
{ "gate_id": "has_state_change", "activated": true, "confidence": 0.85 }
|
||||
]
|
||||
},
|
||||
|
||||
"stage_post_proposal": {
|
||||
"objects": {
|
||||
"E1": {
|
||||
"object_id": "E1",
|
||||
"object_kind": "entity",
|
||||
"status": "active",
|
||||
"confidence": 0.96,
|
||||
"canonical_label": "Alice",
|
||||
"aliases": ["She", "her"],
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"EV_meeting": {
|
||||
"object_id": "EV_meeting",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.97,
|
||||
"surface_span": { "text": "meeting", "start": 4, "end": 11 },
|
||||
"canonical_label": "meeting",
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"EV_meeting_start": {
|
||||
"object_id": "EV_meeting_start",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.97,
|
||||
"surface_span": { "text": "started", "start": 12, "end": 19 },
|
||||
"canonical_label": "meeting_start",
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"EV_arrival": {
|
||||
"object_id": "EV_arrival",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.95,
|
||||
"surface_span": { "text": "arrived", "start": 33, "end": 40 },
|
||||
"canonical_label": "alice_arrival",
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"EV_departure": {
|
||||
"object_id": "EV_departure",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.94,
|
||||
"surface_span": { "text": "left", "start": 57, "end": 61 },
|
||||
"canonical_label": "alice_departure",
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"T_9am": {
|
||||
"object_id": "T_9am",
|
||||
"object_kind": "quantity",
|
||||
"status": "active",
|
||||
"confidence": 0.99,
|
||||
"surface_span": { "text": "9am", "start": 23, "end": 26 },
|
||||
"canonical_label": "09:00",
|
||||
"source_module": "temporal_specialist"
|
||||
},
|
||||
"T_noon": {
|
||||
"object_id": "T_noon",
|
||||
"object_kind": "quantity",
|
||||
"status": "active",
|
||||
"confidence": 0.99,
|
||||
"surface_span": { "text": "noon", "start": 69, "end": 73 },
|
||||
"canonical_label": "12:00",
|
||||
"source_module": "temporal_specialist"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"stage_post_specialist": {
|
||||
"constraints": {
|
||||
"C_t1": {
|
||||
"constraint_id": "C_t1",
|
||||
"constraint_type": "starts_at",
|
||||
"argument_refs": ["EV_meeting_start", "T_9am"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "starts_at(meeting_start, 09:00)",
|
||||
"confidence": 0.97,
|
||||
"source_module": "temporal_specialist"
|
||||
},
|
||||
"C_t2": {
|
||||
"constraint_id": "C_t2",
|
||||
"constraint_type": "after",
|
||||
"argument_refs": ["EV_arrival", "EV_meeting_start"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "after(alice_arrival, meeting_start)",
|
||||
"confidence": 0.96,
|
||||
"source_module": "temporal_specialist"
|
||||
},
|
||||
"C_t3": {
|
||||
"constraint_id": "C_t3",
|
||||
"constraint_type": "before",
|
||||
"argument_refs": ["EV_departure", "T_noon"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "before(alice_departure, 12:00)",
|
||||
"confidence": 0.95,
|
||||
"source_module": "temporal_specialist"
|
||||
},
|
||||
"C_t4": {
|
||||
"constraint_id": "C_t4",
|
||||
"constraint_type": "before",
|
||||
"argument_refs": ["EV_arrival", "EV_departure"],
|
||||
"polarity": "positive",
|
||||
"strength": "soft",
|
||||
"status": "unresolved",
|
||||
"expression": "before(alice_arrival, alice_departure)",
|
||||
"confidence": 0.88,
|
||||
"source_module": "temporal_specialist"
|
||||
},
|
||||
"C_coref": {
|
||||
"constraint_id": "C_coref",
|
||||
"constraint_type": "same_entity",
|
||||
"argument_refs": ["E1", "E_she"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "same_entity(Alice, She)",
|
||||
"confidence": 0.90,
|
||||
"source_module": "entity_specialist"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"stage_resolved": {
|
||||
"_notes": "All temporal constraints resolved. Ordering chain: meeting_start (09:00) → alice_arrival → alice_departure (< 12:00).",
|
||||
"open_contradictions": [],
|
||||
"ordering_chain": [
|
||||
"EV_meeting_start at T_9am",
|
||||
"EV_arrival after EV_meeting_start",
|
||||
"EV_departure before T_noon",
|
||||
"EV_arrival before EV_departure (soft, consistent)"
|
||||
]
|
||||
},
|
||||
|
||||
"stage_synthesized": {
|
||||
"synthesis_mode": "explain",
|
||||
"answer": "The meeting started at 9am. Alice arrived after it began and left before noon.",
|
||||
"confidence": 0.93,
|
||||
"derivation_trace": [
|
||||
"C_t1: starts_at(meeting_start, 09:00) — resolved",
|
||||
"C_t2: after(alice_arrival, meeting_start) — resolved",
|
||||
"C_t3: before(alice_departure, 12:00) — resolved",
|
||||
"C_t4: before(alice_arrival, alice_departure) — resolved (consistent with C_t2, C_t3)",
|
||||
"C_coref: same_entity(Alice, She) — merged"
|
||||
]
|
||||
}
|
||||
}
|
||||
296
examples/word_problem_001.json
Normal file
296
examples/word_problem_001.json
Normal file
@@ -0,0 +1,296 @@
|
||||
{
|
||||
"_comment": "Vertical slice example: apple transfer word problem. Shows complete pipeline state at each stage.",
|
||||
"input_text": "Alice had 5 apples. She gave Bob 2 apples. How many apples does Alice have now?",
|
||||
|
||||
"stage_post_gate": {
|
||||
"gate_signals": [
|
||||
{ "gate_id": "has_entity_reference", "activated": true, "confidence": 0.99, "evidence_spans": [{"text": "Alice", "start": 0, "end": 5}, {"text": "Bob", "start": 29, "end": 32}] },
|
||||
{ "gate_id": "has_coreference", "activated": true, "confidence": 0.90, "evidence_spans": [{"text": "She", "start": 17, "end": 20}] },
|
||||
{ "gate_id": "has_quantity", "activated": true, "confidence": 0.99, "evidence_spans": [{"text": "5 apples", "start": 10, "end": 18}, {"text": "2 apples", "start": 33, "end": 41}] },
|
||||
{ "gate_id": "has_ownership_transfer", "activated": true, "confidence": 0.97, "evidence_spans": [{"text": "gave", "start": 21, "end": 25}] },
|
||||
{ "gate_id": "has_temporal_relation", "activated": true, "confidence": 0.85, "evidence_spans": [{"text": "had", "start": 6, "end": 9}, {"text": "gave", "start": 21, "end": 25}] },
|
||||
{ "gate_id": "is_math", "activated": true, "confidence": 0.95, "evidence_spans": [{"text": "5", "start": 10, "end": 11}, {"text": "2", "start": 33, "end": 34}] }
|
||||
]
|
||||
},
|
||||
|
||||
"stage_post_proposal": {
|
||||
"objects": {
|
||||
"E1": {
|
||||
"object_id": "E1",
|
||||
"object_kind": "entity",
|
||||
"status": "active",
|
||||
"confidence": 0.97,
|
||||
"surface_span": { "text": "Alice", "start": 0, "end": 5 },
|
||||
"canonical_label": "Alice",
|
||||
"aliases": ["She", "her"],
|
||||
"facet_refs": [],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P1"],
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"E2": {
|
||||
"object_id": "E2",
|
||||
"object_kind": "entity",
|
||||
"status": "active",
|
||||
"confidence": 0.97,
|
||||
"surface_span": { "text": "Bob", "start": 29, "end": 32 },
|
||||
"canonical_label": "Bob",
|
||||
"aliases": ["him"],
|
||||
"facet_refs": [],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P2"],
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"O_apples": {
|
||||
"object_id": "O_apples",
|
||||
"object_kind": "concept",
|
||||
"status": "active",
|
||||
"confidence": 0.99,
|
||||
"surface_span": { "text": "apples", "start": 12, "end": 18 },
|
||||
"canonical_label": "apples",
|
||||
"aliases": [],
|
||||
"facet_refs": [],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P3"],
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"Q1": {
|
||||
"object_id": "Q1",
|
||||
"object_kind": "quantity",
|
||||
"status": "active",
|
||||
"confidence": 0.99,
|
||||
"surface_span": { "text": "5", "start": 10, "end": 11 },
|
||||
"canonical_label": "5",
|
||||
"facet_refs": ["F_Q1"],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P4"],
|
||||
"source_module": "quantity_specialist"
|
||||
},
|
||||
"Q2": {
|
||||
"object_id": "Q2",
|
||||
"object_kind": "quantity",
|
||||
"status": "active",
|
||||
"confidence": 0.99,
|
||||
"surface_span": { "text": "2", "start": 33, "end": 34 },
|
||||
"canonical_label": "2",
|
||||
"facet_refs": ["F_Q2"],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P5"],
|
||||
"source_module": "quantity_specialist"
|
||||
},
|
||||
"Q_alice_final": {
|
||||
"object_id": "Q_alice_final",
|
||||
"object_kind": "quantity",
|
||||
"status": "proposed",
|
||||
"confidence": 0.80,
|
||||
"canonical_label": "Alice's final apple count",
|
||||
"facet_refs": ["F_Q_final"],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P6"],
|
||||
"source_module": "quantity_specialist"
|
||||
},
|
||||
"EV_initial": {
|
||||
"object_id": "EV_initial",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.90,
|
||||
"surface_span": { "text": "had", "start": 6, "end": 9 },
|
||||
"canonical_label": "initial_possession",
|
||||
"facet_refs": [],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P7"],
|
||||
"source_module": "entity_specialist"
|
||||
},
|
||||
"EV_transfer": {
|
||||
"object_id": "EV_transfer",
|
||||
"object_kind": "event",
|
||||
"status": "active",
|
||||
"confidence": 0.95,
|
||||
"surface_span": { "text": "gave", "start": 21, "end": 25 },
|
||||
"canonical_label": "transfer",
|
||||
"facet_refs": [],
|
||||
"constraint_refs": [],
|
||||
"evidence_refs": [],
|
||||
"provenance_refs": ["P8"],
|
||||
"source_module": "entity_specialist"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"stage_post_specialist": {
|
||||
"facets": {
|
||||
"F_Q1": {
|
||||
"facet_id": "F_Q1",
|
||||
"facet_kind": "quantity",
|
||||
"object_ref": "Q1",
|
||||
"confidence": 0.99,
|
||||
"source_module": "quantity_specialist",
|
||||
"value": 5,
|
||||
"unit": "apples",
|
||||
"is_exact": true,
|
||||
"derived_from_refs": []
|
||||
},
|
||||
"F_Q2": {
|
||||
"facet_id": "F_Q2",
|
||||
"facet_kind": "quantity",
|
||||
"object_ref": "Q2",
|
||||
"confidence": 0.99,
|
||||
"source_module": "quantity_specialist",
|
||||
"value": 2,
|
||||
"unit": "apples",
|
||||
"is_exact": true,
|
||||
"derived_from_refs": []
|
||||
},
|
||||
"F_Q_final": {
|
||||
"facet_id": "F_Q_final",
|
||||
"facet_kind": "quantity",
|
||||
"object_ref": "Q_alice_final",
|
||||
"confidence": 0.90,
|
||||
"source_module": "quantity_specialist",
|
||||
"value": null,
|
||||
"unit": "apples",
|
||||
"is_exact": false,
|
||||
"derived_from_refs": ["Q1", "Q2"]
|
||||
},
|
||||
"F_EV_initial_temporal": {
|
||||
"facet_id": "F_EV_initial_temporal",
|
||||
"facet_kind": "temporal",
|
||||
"object_ref": "EV_initial",
|
||||
"confidence": 0.90,
|
||||
"source_module": "temporal_specialist",
|
||||
"time_point": "t0",
|
||||
"temporal_order_refs": ["C_temporal"]
|
||||
},
|
||||
"F_EV_transfer_temporal": {
|
||||
"facet_id": "F_EV_transfer_temporal",
|
||||
"facet_kind": "temporal",
|
||||
"object_ref": "EV_transfer",
|
||||
"confidence": 0.90,
|
||||
"source_module": "temporal_specialist",
|
||||
"time_point": "t1",
|
||||
"temporal_order_refs": ["C_temporal"]
|
||||
},
|
||||
"F_E1_ownership_t0": {
|
||||
"facet_id": "F_E1_ownership_t0",
|
||||
"facet_kind": "ownership",
|
||||
"object_ref": "O_apples",
|
||||
"confidence": 0.97,
|
||||
"source_module": "ownership_specialist",
|
||||
"owner_ref": "E1",
|
||||
"owned_ref": "O_apples",
|
||||
"quantity_ref": "Q1",
|
||||
"temporal_ref": "F_EV_initial_temporal",
|
||||
"transfer_type": "initial"
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"C1": {
|
||||
"constraint_id": "C1",
|
||||
"constraint_type": "owns",
|
||||
"argument_refs": ["E1", "O_apples", "Q1"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "owns(Alice, apples, count=5) at t0",
|
||||
"confidence": 0.97,
|
||||
"source_module": "ownership_specialist",
|
||||
"provenance_refs": ["P_C1"]
|
||||
},
|
||||
"C2": {
|
||||
"constraint_id": "C2",
|
||||
"constraint_type": "transfers",
|
||||
"argument_refs": ["E1", "E2", "O_apples", "Q2"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "transfers(Alice, Bob, apples, count=2) at t1",
|
||||
"confidence": 0.96,
|
||||
"source_module": "ownership_specialist",
|
||||
"provenance_refs": ["P_C2"]
|
||||
},
|
||||
"C3": {
|
||||
"constraint_id": "C3",
|
||||
"constraint_type": "quantity_difference",
|
||||
"argument_refs": ["Q_alice_final", "Q1", "Q2"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "quantity(Q_alice_final) = quantity(Q1) - quantity(Q2)",
|
||||
"confidence": 0.99,
|
||||
"source_module": "quantity_specialist",
|
||||
"provenance_refs": ["P_C3"]
|
||||
},
|
||||
"C_temporal": {
|
||||
"constraint_id": "C_temporal",
|
||||
"constraint_type": "before",
|
||||
"argument_refs": ["EV_initial", "EV_transfer"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "before(EV_initial, EV_transfer)",
|
||||
"confidence": 0.90,
|
||||
"source_module": "temporal_specialist",
|
||||
"provenance_refs": ["P_Ct"]
|
||||
},
|
||||
"C_coreference": {
|
||||
"constraint_id": "C_coreference",
|
||||
"constraint_type": "same_entity",
|
||||
"argument_refs": ["E1", "E_she"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "same_entity(Alice, She)",
|
||||
"confidence": 0.90,
|
||||
"source_module": "entity_specialist",
|
||||
"provenance_refs": ["P_Cc"]
|
||||
},
|
||||
"C_distinct": {
|
||||
"constraint_id": "C_distinct",
|
||||
"constraint_type": "not_same_entity",
|
||||
"argument_refs": ["E1", "E2"],
|
||||
"polarity": "positive",
|
||||
"strength": "hard",
|
||||
"status": "unresolved",
|
||||
"expression": "not_same_entity(Alice, Bob)",
|
||||
"confidence": 0.99,
|
||||
"source_module": "entity_specialist",
|
||||
"provenance_refs": ["P_Cd"]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"stage_resolved": {
|
||||
"_notes": "After resolver runs: C3 arithmetic resolved (Q_alice_final=3), C_coreference merged E_she into E1, all hard constraints resolved, no contradictions.",
|
||||
"Q_alice_final_value": 3,
|
||||
"open_contradictions": [],
|
||||
"resolution_log": [
|
||||
{ "operation": "apply_hard", "affected_refs": ["C1"], "result": "resolved" },
|
||||
{ "operation": "apply_hard", "affected_refs": ["C2"], "result": "resolved" },
|
||||
{ "operation": "apply_hard", "affected_refs": ["C_temporal"], "result": "resolved" },
|
||||
{ "operation": "apply_hard", "affected_refs": ["C_distinct"], "result": "resolved" },
|
||||
{ "operation": "resolve_arithmetic", "affected_refs": ["Q_alice_final"], "result": "resolved", "note": "computed 5-2=3" },
|
||||
{ "operation": "merge_coreference", "affected_refs": ["E1", "E_she"], "result": "merged", "note": "merged E_she into E1" }
|
||||
]
|
||||
},
|
||||
|
||||
"stage_synthesized": {
|
||||
"answer": "Alice has 3 apples.",
|
||||
"confidence": 0.97,
|
||||
"derivation_trace": [
|
||||
"E1 (Alice) — active entity, confidence 0.97",
|
||||
"Q1 = 5 apples — quantity, confidence 0.99",
|
||||
"Q2 = 2 apples — quantity, confidence 0.99",
|
||||
"C1: owns(Alice, apples, count=5) at t0 — resolved",
|
||||
"C2: transfers(Alice, Bob, apples, count=2) at t1 — resolved",
|
||||
"C3: quantity_difference(Q_alice_final, Q1, Q2) — resolved, 5-2=3",
|
||||
"Q_alice_final = 3 apples"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user