Files
boc/packages/domain/README.md
T
Bernt fa0dbf5127 PR-001: Domain Model v1.0 — compile-only, zero dependencies
- @landvex/domain package with TypeScript strict mode
- 3 Aggregate Roots: FieldSession, Mission, DecisionCase
- Branded IDs, Value Objects, Domain Events, Invariants
- 19 unit tests for IDs, FieldSession, DecisionCase
- Zero runtime dependencies (only TypeScript + jest for tests)
- Separates Entity / Value Object / Aggregate Root
- README documents Three Rules of the domain

Definition of Done met:
- Compiles without errors
- Exports all domain types
- Unit tests for invariants and value objects
- No PostgreSQL, S3, Express, AI models, queues
2026-07-02 14:26:29 +00:00

148 lines
3.7 KiB
Markdown

# @landvex/domain
**LandveX Domain Model - Control Intelligence Platform**
This package describes the LandveX domain model. It contains no dependencies to database, HTTP, cloud storage, or AI frameworks. It defines only the language, objects, and rules that the rest of the platform builds upon.
## Three Rules
### Rule 1: Domain knows nothing about AI
**No AI-specific objects in domain:**
-`AIObservation`
-`YOLODetection`
-`GeminiResult`
-`ClaudeAnalysis`
**Domain only knows:**
-`Observation`
-`Evidence`
-`Finding`
-`Decision`
-`Review`
-`Outcome`
If we switch from YOLO to a custom model in five years, the domain does not change.
### Rule 2: Everything is an Artifact
`Artifact` is a common contract for everything produced:
```
Artifact
├── Image
├── Video
├── Dataset
├── Annotation
├── Model
├── Evaluation
├── DecisionCase
├── Report
└── ExperienceInsight
```
All artifacts share:
- `id`
- `version`
- `hash`
- `lineage`
- `createdAt`
- `createdBy`
- `storageUri`
### Rule 3: All decisions are reproducible
Every Decision Case must answer:
- Which observations were used?
- Which evidence was used?
- Which model?
- Which model version?
- Which rules?
- Who reviewed?
- When?
- Which version was approved?
## Package Structure
```
packages/domain/
├── common/
│ ├── value-objects/
│ ├── ids/
│ └── errors/
├── artifacts/
├── session/
├── mission/
├── observation/
├── evidence/
├── finding/
├── decision/
├── review/
├── action/
├── outcome/
├── events/
├── invariants/
├── index.ts
└── README.md
```
## Aggregate Roots
- `FieldSession` - Organizes field work
- `Mission` - Single data collection task
- `DecisionCase` - Complete decision chain
## Entities
- `Artifact` - Any produced artifact (versioned, immutable)
- `Observation` - Recorded fact from reality
- `Evidence` - Linked observations with context
- `Finding` - Pattern or conclusion
- `Decision` - Recommended action
- `Review` - Human quality assessment
- `Action` - Executed task
- `Outcome` - Measured result
## Value Objects
- `GeoLocation` - Latitude and longitude
- `Confidence` - Model confidence 0-1
- `Severity` - Issue severity (low/medium/high/critical)
- `Priority` - Action priority (low/medium/high/urgent)
- `Hash` - SHA-256 checksum
- `StorageUri` - Storage location
- `Version` - Semantic version
- `BusinessImpact` - Risk, cost, time, opportunity
## Enums
- `ArtifactType` - image, video, dataset, model, etc.
- `ReviewStatus` - assigned, in_review, approved, rejected
- `DecisionVerb` - inspect, repair, monitor, wait, collect, escalate, ignore, prioritize
- `MissionStatus` - created, uploading, processing, completed, failed
- `SessionStatus` - planned, active, completed
## Domain Events
- `FieldSessionCreated`
- `MissionCreated`
- `ArtifactRegistered`
- `ObservationCreated`
- `EvidenceLinked`
- `FindingCreated`
- `DecisionCreated`
- `DecisionReviewed`
- `DecisionApproved`
## Invariants
- **FieldSession**: Must have location and date
- **Mission**: Must belong to one Session, must have at least one Artifact
- **DecisionCase**: Must have at least one Observation, one Evidence, exactly one Decision. Cannot be Approved without Review.
## Strict Rule
**No new feature may introduce new domain concepts without an approved change to the domain model.**
The concepts `Session`, `Mission`, `Artifact`, `Observation`, `Evidence`, `Finding`, `Decision`, `Review`, and `Outcome` become the shared language for the entire organization — code, documentation, APIs, tests, and product discussions use the same terms.