Skip to main content

Domain Agent

Position in pipeline: Agent 3
Phase: 2 — Domain Contracts
Min confidence: 0.85
Version: 1.0.0


Role

The Domain Agent builds and maintains the domain model — the shared vocabulary and structural contract that all downstream agents must respect. It translates the Ubiquitous Language established in the Discovery Engine into a machine-consumable YAML schema.

The domain model is not documentation — it is a formal contract. Agents that produce outputs referencing entities not in the domain model are flagged for hallucination.


The domain model schema

The Domain Agent produces and maintains docs/architecture/domain-model.md in strict YAML schema format:

domain: <domain name>
version: <semver>
last_updated: <ISO date>
owner: <Tech Lead name>

entities:
- name: <EntityName>
description: <one sentence>
attributes:
- name: <attribute>
type: <primitive or EntityReference>
required: true | false
description: <one sentence>
invariants:
- <business rule that must ALWAYS hold — violations are bugs>

value_objects:
- name: <ValueObjectName>
description: <one sentence>
attributes: [...]

aggregates:
- root: <EntityName>
members: [<EntityName>, ...]

domain_events:
- name: <EventName>
trigger: <what causes this event>
payload: [<attribute>, ...]

ubiquitous_language:
- term: <Term>
definition: <precise definition>
aliases: [<alias>, ...]
bounded_context: <context name>

What the Domain Agent does

ActivityDescription
Validate existing modelCheck schema compliance against the YAML schema contract
Extend the modelAdd new entities, events, or language terms proposed by the current slice
Detect conflictsIdentify when the same term has different definitions in different bounded contexts
Propose new entitiesWhen a Spec Agent requirement references an entity not in the model, flag it and propose a definition
Enforce invariantsVerify that proposed changes do not violate existing entity invariants

How downstream agents use the domain model

AgentHow it uses the domain model
Spec AgentValidates that every noun in a requirement exists in ubiquitous_language
Validation AgentDomain term resolution check — blocks requirements with undefined terms
Design AgentUses entities, aggregates, and domain_events to synthesize architecture
Implementation AgentUses entity attributes and invariants to generate correct data models
QA AgentMaps domain_events to observable test assertions
Security AgentUses entity classification (PII, sensitive) to enforce data handling rules

Context fidelity rules

RuleEnforcement
No backward-incompatible changesRemoving or renaming an existing entity requires a new ADR
Invariant preservationNew entity attributes must not violate existing invariants
Bounded context isolationTerms can have different meanings in different contexts — must be explicitly separated
Version controlEvery model update increments the semver and records the change in the change log

Governance

RuleBehavior
Confidence < 0.85Draft model update; require TL review before the gate passes
Schema non-complianceCI gate rejects the file; Pipeline blocked
TL sign-offRequired before the domain model update is accepted and downstream agents proceed

Next agent

Design Agent — consumes the approved domain model to synthesize system architecture