Files
ucwm/specialists/spatial.md
bill b758d7ea60 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>
2026-05-01 16:09:55 -07:00

108 lines
2.7 KiB
Markdown

# Spatial Specialist
**specialist_id:** `spatial`
**trigger_gates:** `has_spatial_relation`
---
## Responsibility
The spatial specialist adds location, containment, direction, proximity, and topology constraints to objects. It attaches SpatialFacets to entities and events with spatial dimension, and emits spatial constraints between objects.
---
## Manifest
```
declared_facet_kinds:
- spatial
declared_constraint_types:
- inside
- outside
- adjacent
- above
- below
- north_of
- south_of
- east_of
- west_of
- near
- far
- at_location
- between
- on_path
budget_caps:
max_objects_proposed: 4
max_facets_emitted: 8
max_constraints_emitted: 12
max_merges: 0
max_splits: 0
```
---
## Output: SpatialFacet
Attach to objects with a spatial dimension (entities, events, states, code objects with file location).
```
SpatialFacet fields used:
- location_label: string (natural language location)
- coordinates: {x, y, z} if numeric coords available
- containment_refs: constraint IDs for inside/outside relations
- reference_frame: coordinate system or reference object
```
---
## Output: Constraints
### `inside(A, B)`
Object A is contained within object B. Example: `inside(book, shelf)`, `inside(Alice, building)`.
### `adjacent(A, B)`
A and B are next to each other without containment.
### `at_location(A, L)`
Object A is at named location L. L should be a canonical object of kind `entity` (a place).
### `between(A, B, C)`
Object A is between objects B and C.
### Directional constraints
`north_of`, `south_of`, `east_of`, `west_of`, `above`, `below` — all take two argument_refs in the form `(subject, reference)`.
### `near(A, B)` / `far(A, B)`
Relative proximity. Strength is always `soft` since "near" is inherently vague without a defined scale.
---
## Reference frame handling
Spatial constraints are only meaningful relative to a reference frame. When no frame is explicit in the input, use `"world"` as the default frame label.
```
SpatialFacet.reference_frame:
- "world" -- global geographic frame (default when unspecified)
- "local" -- relative to a locally established reference
- "{object_id}" -- relative to a specific object in WorldState
```
---
## Contract test requirements
- Given `Alice is in the kitchen`, must emit `at_location(E_alice, O_kitchen)` or `inside(E_alice, O_kitchen)`
- Given `The box is on the shelf`, must emit `above(O_box, O_shelf)` or `on(O_box, O_shelf)`
- Must not emit temporal or quantity constraints
- All spatial facets must have `location_label` set
- All emitted constraints must have `source_module: spatial`