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:
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