name: bounded-context-mapping description: Build A4 bounded context, integration contract, and ownership artifacts. compatibility: opencode
bounded-context-mapping
Purpose
Define bounded contexts, context relationships, integration contracts, and data ownership for A4-bounded-contexts. Anti-scope: aggregate internals and implementation-level APIs.
Stage & Ownership
- stage:
A4-bounded-contexts - owner_agent:
context-mapper - handoffs:
- consumes: A3 subdomain outputs and A2 event catalog
- delivers:
bounded-contexts.md,context-map.md,integration-contracts.md,data-ownership.md
Inputs (Required)
artifacts/03-subdomains/subdomain-map.mdartifacts/03-subdomains/core-domain-rationale.mdartifacts/02-event-storming/event-catalog.md- Prior integration constraints from
artifacts/_state/decisions.mdwhen available
Outputs (Artifacts)
A4.1->artifacts/04-contexts/bounded-contexts.md(create or update)A4.2->artifacts/04-contexts/context-map.md(create or update)A4.3->artifacts/04-contexts/integration-contracts.md(create or update)A4.4->artifacts/04-contexts/data-ownership.md(create or update)
Workflow (Steps)
- Derive candidate contexts from capability and language boundaries.
- Define context responsibilities and anti-corruption needs.
- Create context map with relationship direction and pattern.
- Specify integration contracts and failure semantics.
- Build data ownership matrix by source of truth.
- Stop point: unresolved ownership or coupling conflicts become open questions.
Quality Gates (Definition of Done)
- Every context has explicit boundary, purpose, and owner.
- Context map declares relationship type and direction.
- Integration contracts specify data, protocol, and failure handling.
- Data ownership defines source-of-truth per entity.
- Terminology remains consistent across contexts.
- Material boundary ambiguity is tracked and unresolved items are logged.
Memory Writes (artifacts vs Engram)
A) When memory.backend=artifacts
- write
artifacts/_state/session-log.md: A4 progress and output references. - write
artifacts/_state/decisions.md: context boundary and contract decisions. - write
artifacts/_state/open-questions.md: unresolved context ownership and integration questions.
B) When memory.backend=engram
- Use the full Engram memory toolset (14 tools) as needed; do not limit operations to a fixed subset.
- target
engram:ddd.contexts(topic_keys.contexts) viamem_savefor bounded contexts and map. - target
engram:ddd.risks(topic_keys.risks) viamem_savefor leakage/coupling risks. - use
mem_context/mem_searchto recover previous contract decisions. - use
mem_session_summaryat stage close with produced artifact links.
Prompts / Scripts / References / Assets (Components)
- prompts:
skills/bounded-context-mapping/prompts/context-mapping.prompt.md- boundary and relationship derivation prompt.
- scripts: N/A.
- references:
skills/bounded-context-mapping/references/index.md- relationship patterns and contract checks.
- assets:
skills/bounded-context-mapping/assets/context-map.template.md- context map template.
Failure Modes
- Context boundaries based on technical layers -> redraw boundaries by language and policy ownership.
- Context leakage through shared terms with different meaning -> add translation/ACL strategy.
- Integration contracts without failure semantics -> add retries, timeouts, and error taxonomy.
- Missing source-of-truth ownership -> define authoritative write owner per entity.
- Overlapping responsibilities across contexts -> split by invariant ownership.
Example Invocation (Minimal)
Invoke bounded-context-mapping with A3 and A2 artifacts; generate A4.1-A4.4 and record unresolved ownership conflicts.