Inferensys

Prompt

Aggregate Event Sourcing Suitability Assessment Prompt

A practical prompt playbook for using the Aggregate Event Sourcing Suitability Assessment Prompt in production AI workflows. Produces a structured suitability score with trade-off analysis across audit requirements, performance, complexity, and team capability.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

A structured, repeatable assessment for determining whether a specific aggregate should adopt event sourcing instead of state-based persistence.

This prompt is designed for domain architects and senior engineers who need to evaluate a single aggregate's suitability for event sourcing before committing to its operational complexity. The job-to-be-done is not a whole-system decision, but a focused, evidence-backed recommendation on one aggregate at a time. The prompt forces explicit reasoning across four dimensions—audit and compliance requirements, performance and scalability needs, implementation complexity, and team capability—producing a scored output that can feed directly into an Architecture Decision Record (ADR). Use it when the team is debating event sourcing for a specific aggregate, when a compliance requirement demands full audit trails, or when an existing state-based aggregate is struggling with history reconstruction or temporal queries.

Do not use this prompt for whole-system event sourcing decisions without first assessing individual aggregates. Aggregate-level suitability varies significantly within the same bounded context; an aggregate that manages financial transactions may score high on audit needs, while a neighboring aggregate handling user preferences may score low on every dimension. The prompt is also inappropriate when the team has no prior exposure to event sourcing concepts—it assumes the reader understands terms like event store, projection, and causal consistency. If the aggregate is trivial (fewer than three state transitions in its lifecycle), skip the assessment entirely; the overhead of event sourcing will not be justified. For regulated domains such as healthcare or finance, the prompt's output should be reviewed by a compliance officer before finalizing the ADR, particularly when audit trail immutability has legal implications.

Before running the prompt, gather the aggregate's current design: its invariants, state transitions, read and write patterns, concurrency model, and any existing compliance requirements. The prompt template includes placeholders for these inputs. After receiving the scored recommendation, validate the output by checking whether the trade-off documentation addresses each of the four dimensions with concrete evidence from your context. If the model recommends event sourcing but fails to identify at least two operational risks (such as event schema evolution or projection rebuild time), treat the assessment as incomplete and re-run with tighter constraints. The next step is to take the scored output and trade-off summary into your ADR template, adding any team-specific context the model could not have known, such as upcoming hiring plans or platform migrations that affect the complexity dimension.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Aggregate Event Sourcing Suitability Assessment Prompt works, where it does not, and what operational risks to watch before relying on its output.

01

Good Fit: Audit-Heavy Domains

Use when: the aggregate must produce a complete, immutable history of state changes for compliance, finance, or regulatory audit. Guardrail: confirm the prompt output explicitly scores audit completeness and links the score to concrete event schema requirements.

02

Bad Fit: Simple CRUD Aggregates

Avoid when: the aggregate has no business invariants beyond create, read, update, delete. Event sourcing adds operational complexity without compensating value. Guardrail: add a pre-check step that classifies the aggregate as CRUD vs. transactional before running the full suitability assessment.

03

Required Inputs

What to watch: the prompt needs aggregate boundary definition, invariant list, concurrency profile, and team event-sourcing experience level to produce a meaningful score. Missing inputs produce generic output. Guardrail: validate all required fields are populated before invocation; return an input completeness error if any field is empty.

04

Operational Risk: Team Capability Gap

What to watch: the prompt may recommend event sourcing even when the team lacks operational experience with event stores, projections, or CQRS. Guardrail: require the output to include a team-readiness sub-score and flag recommendations where the capability gap exceeds a defined threshold.

05

Operational Risk: Performance Overestimation

What to watch: the prompt may underestimate the read-side complexity of rebuilding projections from large event streams. Guardrail: add a constraint that forces the assessment to estimate event volume growth over 12 months and score projection rebuild latency impact.

06

Operational Risk: Versioning Blind Spot

What to watch: the prompt may not surface the long-term maintenance cost of event schema evolution across multiple aggregate versions. Guardrail: include a versioning readiness check in the output schema that scores the aggregate's event evolution strategy and flags missing upcaster or schema registry plans.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use prompt that instructs the model to assess an aggregate's suitability for event sourcing and return a structured JSON report with scores, rationale, and trade-off documentation.

This prompt template is designed to be pasted directly into your AI system. It forces the model to act as a domain-driven design architect and produce a rigorous, structured assessment rather than a conversational opinion. The output is a JSON object you can parse, store in an architecture decision record, or feed into a downstream review pipeline. Before using it, gather the required context: the aggregate's name, its invariants, the domain's audit and consistency requirements, the team's experience with event sourcing, and any performance or complexity constraints. The more specific your inputs, the less the model will need to guess—and guessing produces unreliable scores.

text
You are a domain-driven design architect evaluating whether a specific aggregate should use event sourcing. Your output must be a single JSON object with no additional text.

## INPUT
- Aggregate Name: [AGGREGATE_NAME]
- Domain Context: [DOMAIN_DESCRIPTION]
- Invariants and Business Rules: [INVARIANTS]
- Audit and History Requirements: [AUDIT_REQUIREMENTS]
- Consistency Requirements (immediate vs eventual): [CONSISTENCY_REQUIREMENTS]
- Performance and Throughput Constraints: [PERFORMANCE_CONSTRAINTS]
- Team Event Sourcing Experience: [TEAM_EXPERIENCE]
- Existing Infrastructure and Tooling: [INFRASTRUCTURE_CONTEXT]
- Regulatory or Compliance Constraints: [COMPLIANCE_CONSTRAINTS]

## OUTPUT SCHEMA
Return a JSON object with this exact structure:
{
  "aggregate_name": "string",
  "suitability_score": number (0-100),
  "recommendation": "Recommended" | "Conditional" | "Not Recommended",
  "dimension_scores": {
    "audit_and_history_fit": number (0-100),
    "consistency_flexibility": number (0-100),
    "performance_impact": number (0-100, higher means less negative impact),
    "complexity_burden": number (0-100, higher means lower burden),
    "team_readiness": number (0-100),
    "infrastructure_fit": number (0-100),
    "compliance_alignment": number (0-100)
  },
  "rationale": "string (2-4 sentences explaining the overall score)",
  "key_tradeoffs": ["string", "string", "string"],
  "risks_and_mitigations": [
    {"risk": "string", "severity": "High" | "Medium" | "Low", "mitigation": "string"}
  ],
  "alternatives_considered": [
    {"pattern": "string", "fit_assessment": "string"}
  ],
  "implementation_notes": "string (practical guidance if event sourcing is adopted)",
  "decision_triggers": ["string (conditions that would change the recommendation)"]
}

## CONSTRAINTS
- Score each dimension independently before calculating the overall suitability_score. The overall score is a weighted average, not a gut feel.
- If audit requirements are mandatory and strict, audit_and_history_fit must be at least 80.
- If the team has no event sourcing experience, team_readiness must not exceed 30.
- If consistency requirements demand immediate consistency for all operations, consistency_flexibility must not exceed 20.
- Every risk must have a concrete mitigation, not a generic statement.
- Do not recommend event sourcing if the complexity_burden score is below 40 and the aggregate has fewer than 5 distinct state-changing operations.
- If compliance_constraints include GDPR right-to-erasure requirements, you must address how event immutability conflicts with deletion obligations in the risks_and_mitigations array.

To adapt this prompt, replace each square-bracket placeholder with concrete details about your aggregate. For example, [AGGREGATE_NAME] becomes OrderAggregate and [INVARIANTS] becomes a bullet list like - Order total must equal sum of line items; - An order cannot be shipped before payment is confirmed. If a dimension does not apply, provide a brief note like No specific regulatory constraints rather than leaving the placeholder empty. The model will use these details to calibrate its scores. After receiving the output, validate the JSON structure before accepting the recommendation. If the model returns a score without addressing a constraint you specified, treat that as a failure and re-prompt with the missing constraint emphasized.

This prompt works best with models that have strong reasoning capabilities and can follow multi-constraint instructions. Weaker or smaller models may ignore the scoring constraints or produce malformed JSON. In production, always validate the output against the schema, check that dimension scores are within 0-100, and verify that the recommendation aligns with the dimension scores. If the model recommends event sourcing but scores team_readiness at 15, flag the output for human review. The next section covers how to wire this prompt into an automated assessment pipeline with validation, retries, and logging.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be replaced with concrete data. Vague or incomplete inputs produce unreliable assessments.

PlaceholderPurposeExampleValidation Notes

[AGGREGATE_NAME]

Identifies the specific aggregate under evaluation

Order, CustomerProfile, InventoryItem

Must be a single aggregate name, not a context or module. Reject if empty or contains multiple names.

[AGGREGATE_DESCRIPTION]

Describes the aggregate's responsibilities, invariants, and state

Order enforces that line items cannot be modified after payment is submitted

Must contain at least one invariant or business rule. Reject if purely structural without behavior.

[DOMAIN_CONTEXT]

Explains the business domain and operational environment

E-commerce order fulfillment with 50K orders/day peak

Must include scale indicators or concurrency expectations. Flag if missing throughput or contention notes.

[AUDIT_REQUIREMENTS]

Specifies regulatory, compliance, or business audit needs

Full audit trail required for PCI compliance; every state change must be traceable

Must state whether audit is required, optional, or not applicable. Reject if ambiguous.

[PERFORMANCE_PROFILE]

Describes read/write patterns, latency targets, and throughput

Write-heavy: 200 state changes/sec peak, read 500/sec, p99 latency < 50ms

Must include at least one quantitative target. Flag if only qualitative adjectives used.

[TEAM_CAPABILITY]

Assesses team experience with event sourcing and CQRS

Team has 2 engineers with event sourcing experience, 4 without

Must describe actual experience level, not aspiration. Reject if only 'willing to learn' without specifics.

[CURRENT_STATE_MODEL]

Describes the existing persistence approach if any

Currently using PostgreSQL with CRUD-style updates, no event log

Must describe current approach. Use 'greenfield' if no existing model. Reject if omitted.

[CONSTRAINTS]

Lists non-negotiable technical or organizational constraints

Must run on existing PostgreSQL infrastructure; no new data stores allowed

Must be concrete and verifiable. Flag if constraints conflict with event sourcing prerequisites.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Aggregate Event Sourcing Suitability Assessment prompt into an architecture review workflow or automated design assessment pipeline.

This prompt is designed to be called programmatically as part of a design review gate, not as a one-off chat interaction. The typical integration point is an architecture review pipeline that receives an aggregate specification document, a set of non-functional requirements, and team context metadata. The harness should assemble these inputs into the [AGGREGATE_SPEC], [NFR_CONTEXT], and [TEAM_CONTEXT] placeholders before invoking the model. Because the output is a structured suitability score with trade-off dimensions, the harness must validate the response shape before accepting it as review evidence.

Implement a validation layer that checks the response against the declared [OUTPUT_SCHEMA] before the result enters any decision record. At minimum, confirm that the suitability_score field is an integer between 0 and 100, that each trade-off dimension includes a risk_level enum value, and that the recommendation field matches one of the expected values (recommended, conditional, or not_recommended). If validation fails, retry once with the same inputs and an explicit repair instruction appended to the prompt: 'Your previous response failed schema validation. Return ONLY a valid JSON object matching the output schema.' If the second attempt also fails, log the failure, flag the assessment for human review, and do not auto-approve the aggregate design. For high-risk domains such as finance, healthcare, or safety-critical systems, always require a human architect to confirm the assessment before it becomes part of an ADR.

Model choice matters for this workflow. Use a model with strong reasoning capabilities and reliable structured output support, such as GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro. Avoid smaller or older models that may produce plausible-sounding but inconsistent scores across multiple runs. If you are running this assessment across many aggregates in a batch, consider caching the [NFR_CONTEXT] and [TEAM_CONTEXT] portions of the prompt as a reusable prefix to reduce token costs. Log every assessment result with the prompt version, model identifier, timestamp, and validation outcome. This audit trail is essential when the suitability score is used to justify architectural decisions that will be revisited months later. The next step after wiring the harness is to define the evaluation rubric that determines whether the prompt's assessments align with expert architect judgments over time.

IMPLEMENTATION TABLE

Expected Output Contract

The JSON structure the model must return. Validate these fields before accepting the assessment.

Field or ElementType or FormatRequiredValidation Rule

suitability_score

integer (0-100)

Must be an integer between 0 and 100 inclusive. Reject if float, string, or out of range.

score_breakdown

object

Must contain sub-scores for audit_requirement, performance_profile, complexity_tolerance, and team_capability. Each sub-score must be an integer 0-100.

score_breakdown.audit_requirement

integer (0-100)

Higher score indicates stronger audit need favoring event sourcing. Must be present and in range.

score_breakdown.performance_profile

integer (0-100)

Higher score indicates performance characteristics compatible with event sourcing. Must be present and in range.

score_breakdown.complexity_tolerance

integer (0-100)

Higher score indicates team and system can absorb event sourcing complexity. Must be present and in range.

score_breakdown.team_capability

integer (0-100)

Higher score indicates team has event sourcing experience or learning capacity. Must be present and in range.

recommendation

string (enum)

Must be one of: 'Strongly Recommended', 'Recommended', 'Neutral', 'Not Recommended', 'Strongly Not Recommended'. Reject any other value.

trade_offs

array of objects

Each object must have 'factor' (string), 'impact' (string enum: 'positive', 'negative', 'neutral'), and 'explanation' (string). Array must contain at least 3 items.

top_risks

array of strings

Must contain at least 2 risks. Each string must be non-empty and describe a concrete risk specific to event sourcing for this aggregate.

alternative_approach

string or null

If recommendation is 'Not Recommended' or 'Strongly Not Recommended', this field must be a non-null string describing a suggested alternative. Otherwise, null is allowed.

confidence_level

string (enum)

Must be one of: 'high', 'medium', 'low'. Reject any other value. If 'low', trade_offs must contain at least 5 items.

requires_human_review

boolean

Must be true if confidence_level is 'low' or if suitability_score is between 40 and 60. Validate this rule programmatically after parsing.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when assessing aggregate event sourcing suitability and how to guard against it.

01

Overweighting Audit Requirements

What to watch: The model recommends event sourcing solely because audit is mentioned, ignoring that append-only logs or database triggers may suffice. Guardrail: Add a constraint requiring the model to compare at least two alternative audit mechanisms before concluding event sourcing is necessary.

02

Ignoring Team Capability Gap

What to watch: The assessment produces a high suitability score while ignoring that the team has no experience with event stores, CQRS, or eventual consistency. Guardrail: Require a mandatory team-readiness dimension in the output schema with a separate score that can veto the overall recommendation.

03

Conflating Event Sourcing with Event-Driven Architecture

What to watch: The model treats domain events and event sourcing as interchangeable, recommending full event sourcing when simple pub/sub event notification is sufficient. Guardrail: Include a definitions section in the prompt that explicitly distinguishes event sourcing from event-driven messaging and ask the model to classify which pattern is needed.

04

Missing Performance Trade-Off Analysis

What to watch: The assessment focuses on write-side benefits but omits read-side costs, such as rebuilding projections, snapshot strategies, and query latency. Guardrail: Require the output to include a dedicated performance trade-off section covering both write and read paths with concrete latency and throughput considerations.

05

Hallucinating Event Store Maturity

What to watch: The model invents features, guarantees, or limitations for specific event store products that aren't in the provided context. Guardrail: Ground all product-specific claims by requiring citations to provided documentation. If no product documentation is supplied, instruct the model to discuss patterns generically without naming vendors.

06

Overlooking Schema Evolution Complexity

What to watch: The assessment treats event versioning as trivial, ignoring the operational burden of upcasters, schema registries, and dual-write migration periods. Guardrail: Add a mandatory complexity dimension that scores the long-term maintenance cost of event evolution and flags aggregates with high schema churn as poor candidates.

IMPLEMENTATION TABLE

Evaluation Rubric

How to test output quality before shipping this prompt into your architecture review workflow. Run these checks against a golden dataset of 5-10 known aggregate assessments.

CriterionPass StandardFailure SignalTest Method

Suitability Score Consistency

Score aligns with golden label within ±1 point on a 1-5 scale

Score deviates by 2+ points from expected label on known aggregate

Run prompt on 10 pre-scored aggregates; compute MAE between output score and golden score

Trade-off Dimension Completeness

All four dimensions (audit, performance, complexity, team capability) receive a distinct sub-score

Missing sub-score for any required dimension or dimension collapsed into another

Parse JSON output; assert keys exist for audit_score, performance_score, complexity_score, team_capability_score

Rationale Grounding

Each sub-score includes at least one concrete reason tied to aggregate characteristics from [AGGREGATE_DESCRIPTION]

Rationale contains generic statements with no reference to input details

Human review or LLM-as-judge: check each rationale sentence for a reference to a specific input fact

Trade-off Language Presence

Output includes explicit trade-off language (e.g., 'while X improves, Y degrades') for at least two dimensions

Output presents all dimensions as uniformly positive or negative without acknowledging conflicts

Keyword scan for trade-off markers: 'trade-off', 'however', 'at the cost of', 'conversely', 'although'

Recommendation Clarity

Final recommendation is one of: 'Strongly Recommended', 'Recommended with Caution', 'Not Recommended' with clear tie to score

Recommendation contradicts aggregate sub-scores or is missing

Assert recommendation field is non-null; check that 'Not Recommended' does not appear with average sub-score > 3.5

Team Capability Honesty

Team capability assessment references [TEAM_EXPERIENCE] input and flags gaps if experience is low

Team capability score is high despite [TEAM_EXPERIENCE] indicating 'none' or 'limited'

Parameterized test: set [TEAM_EXPERIENCE] to 'none'; assert team_capability_score <= 2

Output Schema Compliance

Valid JSON matching [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing required field, wrong type, or unparseable JSON

Schema validation: parse output with JSON Schema validator using expected schema; assert no errors

Edge Case: Missing Input

Prompt returns structured output with null or 'insufficient information' for unscorable dimensions

Prompt hallucinates scores or rationale when [AGGREGATE_DESCRIPTION] is empty or minimal

Test with [AGGREGATE_DESCRIPTION] set to empty string; assert output contains null or explicit abstention for scores

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single aggregate description and lighter scoring. Remove the team-capability dimension and focus on technical fit only. Accept unstructured output initially—a paragraph summary with a rough score is enough to validate the concept before building the full rubric.

code
Evaluate whether [AGGREGATE_NAME] in [BOUNDED_CONTEXT] is suitable for event sourcing. Consider audit requirements, concurrency patterns, and state-rebuild complexity. Return a 1-5 suitability score with one paragraph of reasoning.

Watch for

  • Overly broad instructions that skip invariant enforcement analysis
  • Missing checks for whether the team has event-sourcing experience
  • Score inflation when the model defaults to enthusiasm for event-driven patterns
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.