InventoryQueueValueOrchestration

Can AI agents do real Domain‑Driven Design?

IQVO is a study and an open experiment. 42 bounded contexts — a warehouse, a retail network and a storefront — modelled with DDD and built by AI agents, a memory that outlives every session and a harness of tests that can say no. We swap the LLM and watch what actually changes.

A study project. Not a product, not production, not affiliated with any company.

Event map · 42 contexts · 154 routes

Hover, tap or arrow-key through a context

    Each pulse is a CloudEvent route between two contexts, drawn from the real AsyncAPI contracts. The traffic is illustrative, not live.
    bounded contexts
    42
    event routes
    154
    MCP servers
    42
    decision records
    946
    commits
    18,292
    days since first commit
    99

    Counted from the repositories by scripts/collect-facts.mjs on 29 Nov 2026. First commit 21 Aug 2026.

    Read this first

    What IQVO is not.

    • A study project.A Domain-Driven Design exercise and an experiment with AI agents. Nobody should build on it as if it were finished software.
    • Not a product.Nothing here is for sale, supported or on a roadmap. There are no customers, and no service levels.
    • Not production.It runs on a small two-node k3s cluster with one Kafka broker. REST and MCP are deliberately unauthenticated, so do not expose it to a network you do not control.
    • Not affiliated with any company.It is not endorsed by anyone and uses no company’s code, data, logos or trademarks. Names, figures and examples are illustrative or synthetic.

    § 01 · The experiment

    One system. Five variables.

    A warehouse is a good excuse: it is rich enough to need real boundaries and boring enough to keep us honest. The question underneath is not about warehouses. When a language model writes the code, what makes the result trustworthy?

    1. the constant

      Domain

      Domain-Driven Design end to end: Big Picture EventStorming, a context map, core-domain charts, a ubiquitous language per context, aggregates, and a bounded-context canvas for each of the 42 services.

      strategic-design/ · context-map

    2. the labour

      Agents

      AI agents implement, test, document, review and open pull requests. The services are built for them too: 42 expose an MCP server for tools and all 39 publish an A2A agent card so one context can delegate a goal to another.

      architecture/a2a-agents · warehouse-ops-agent

    3. the brain

      Memory

      Lessons live in files, not in a context window: decision records, an incident log, repository memory, skills and an orchestrator that remembers across sessions. A new agent starts with what the last one learned.

      946 ADRs · 46 incidents · MEMORY.md

    4. the walls

      Harness

      Guides steer an agent before it acts; sensors check what it did. Every sensor exists because something broke once, and each broken thing became a test that runs on every future change.

      43 fitness tests · warehouse-harness-template

    5. the variable

      Model

      The one thing we change on purpose. Several Claude generations appear in the git history, other LLMs drive orchestration sessions, and the same hooks run under Claude Code, Codex and OpenCode.

      swap the model ↓

    § 02 · Different LLMs

    Swap the model. Keep the walls.

    These are the models that leave a mark in our history, plus the one that orchestrates some sessions. Pick one: the only box that changes is the first. Everything an agent’s work has to pass through stays put.

    Trailer counts are a floor, not a share. 1,007 of 18,292 commits carry an explicit Claude co-author trailer; not every AI-assisted commit is tagged.

    1. swappable

      Claude Sonnet 5.5

      Reads the same AGENTS.md, writes the same kind of diff.

    2. guides · before it acts

      AGENTS.md, path-scoped rules, skills

      Ubiquitous language, the CloudEvents contract, the no-auth decision, how-tos for recurring tasks.

    3. runtime hooks

      Claude Code · Codex · OpenCode

      One hook script, three adapters. It blocks pushes to develop and main, --no-verify, and edits to generated files.

    4. sensors · after it acts

      pre-commit → pre-push → pull request

      Format, lint, race tests, 90% coverage, BDD, architecture fitness, containers, mutation testing, vulnerability and API-contract checks.

    5. review · advisory

      Code, architecture and domain review

      Isolated sub-agents that never share context with the turn that wrote the diff.

    6. memory

      Write the lesson back

      A new fact becomes an ADR, a MEMORY.md line or an incident row, and ideally a test.

    7. merge · human rules

      Green CI merges. Red never does.

      Irreversible steps still wait for a person to say go.

    What we have not done: benchmark these models against each other. The comparison we do have is of the harness itself, and its results are in the harness section.

    § 03 · AI usage, in plain words

    Agents do most of the typing. People own the claims.

    This ecosystem is built with AI, openly. Here is who decides, who does and who checks.

    Who decides, who does and who checks, by activity
    ActivityHumanAgentMachine
    Set direction and hard constraints Decides. “No auth on REST or MCP.” “CloudEvents only.” Applied fleet-wide, not debated. Proposes options, then applies the call everywhere. Encodes it as a fitness test so it cannot drift quietly.
    Write code, tests, docs Reviews by exception; reads the decisions. Does the typing: implements, tests, documents, opens the PR. Lint, coverage, mutation and contract checks on every change.
    Accept an architecture decision Decides. Drafts the ADR with the trade-offs. Fitness tests enforce it afterwards.
    Merge to develop Sets the standing rule: merge when CI is green, never when it is red. Merges once green. Decides what “green” means; branch protection blocks the rest.
    Irreversible stepsdestroy a cluster, force-push, lose data Authorizes explicitly, beforehand. Waits for the word. Hooks refuse pushes to develop and main and --no-verify.
    Say what is true in the docs Owns the claims. Audits docs against code and fixes the drift it finds. Drift checks fail the build when spec and docs disagree.

    What git can prove

    1,007 of 18,292 commits across the IQVO repositories carry an explicit Co-Authored-By: Claude trailer. We treat that as a floor. Plenty of agent work lands under a human author, in squashed merges or with no trailer, and we would rather under-claim than invent a percentage.

    • Claude Sonnet 5.5408
    • Claude Opus 5.5478
    • Claude Sonnet 541
    • Claude Opus 522
    • Claude, unversioned44

    Known limits

    • It is a study. Not production, not a product, not a benchmark.
    • REST and MCP are unauthenticated across the fleet, by a deliberate decision for the study. Do not expose it.
    • Small samples. Our harness evaluations are one model and small n. We say so where we publish them.
    • Small hardware. Two arm64 k3s nodes hold the whole fleet. With one node down, the applications that do not fit stay pending until it returns.
    • One broker, two nodes. The reference deployment is an existing two-node k3s cluster with one Kafka broker, and no replication.

    § 04 · Harness engineering

    Every rule is a scar.

    We follow the guides-and-sensors model from Birgitta Böckeler’s “Harness engineering for coding agent users” (martinfowler.com, 2026): guides steer an agent before it acts, sensors check after. Nothing is added speculatively. A failure that gets through ends with a fix, a sensor, a fleet-wide roll-out and a row in the incident log.

    1. pre-commitseconds
      • gofmt
      • golangci-lint
      • go vet
      • fast tests
    2. pre-pushminutes
      • coverage ≥ 90%
      • godog BDD
      • architecture fitness
    3. pull requestCI, blocking
      • testcontainers
      • mutation (gremlins)
      • govulncheck
      • Spectral API lint
      • docs drift
      • CodeQL
      • Trivy
    4. weeklyadvisory
      • full mutation run
      • dead-code & dependency drift
      • Scorecard
      • cross-repo e2e

    2026-09-11 · fleet-wide decision

    Static bearer auth was reverted. An agent could quietly put it back.

    The fleet deliberately runs REST, MCP and A2A unauthenticated for the study. An agent that “helpfully” adds auth middleware is doing the sensible thing in the wrong repository.

    guardTestNoAuthMiddlewareReintroduced The attempt fails CI instead of shipping unreviewed. Re-adopting auth is a human decision plus an ADR first.

    2026-09-30 · cutover

    Every repo had its own event envelope, and several grew a dual-mode toggle “while migrating”.

    The fleet sat half-migrated to CloudEvents for months. The cutover made CloudEvents 1.0 the only envelope on every Kafka message.

    guardTestNoEventEnvelopeToggleOrFlatEnvelope Fails on any envelope toggle, or a struct that declares both the flat event_id and event_type tags.

    2026-10-06

    A repository test never ran in CI. The same shape was hiding in ten more repos.

    Integration tests gated on DATABASE_URL plus t.Skip pass silently wherever the variable is unset. Green, and proving nothing.

    guardTestPostgresIntegrationTestsUseTestcontainers and a twin test that proves the sensor can fail, because a sensor that cannot fail is decoration.

    2026-10-12

    One outbox row that could never be sent would block a context’s relay forever.

    The relay had no attempt cap and no dead-letter path. Found in inventory-storage, then checked everywhere.

    guardTestOutboxRelaysPassAttemptCap Every relay under cmd/ must pass WithMaxAttempts.

    2026-10-13

    The Kafka client defaults to fire-and-forget. A broker blip silently dropped messages.

    Publishers and dead-letter writers in several repos never set RequiredAcks, so the default of acks=0 applied.

    guardkafka_writer_acks_fitness_test.go Every production writer literal must set it, with a test that proves the sensor bites on bad fixtures.

    2026-10-12

    Tools described a filter as optional. The MCP SDK published it as required.

    Every call without the filter failed with missing properties, in five contexts. An agent calling the tool could not tell why.

    guardTestMCPOptionalToolInputsCarryOmitempty A field described as optional must carry omitempty.

    2026-10-05 · from our own evals

    “Update the event catalogue when you add an event” was followed about half the time.

    With guides or without. A sentence in a skill is advice. A test is a rule.

    guardTestEventCatalogueMatchesContract Every event type a service declares must appear in a CloudEvents ADR. It documents what it cannot see, too.

    46 incidents logged · 28 fully guarded · 43 architecture fitness tests in the template · read the log

    We measured the harness itself

    Honest limits first: one repo, one model, small n.

    We ran the harness against a bare repository in three rounds of agent sessions, with objective gates and transcript checks. Some of it we got wrong, and the write-up says where.

    • The guides’ clearest value: stopping the rare destructive shortcut. In round 1 the only failure in 24 runs was a bare agent pushing straight to develop.
    • Code outcomes did not depend on the guides. The repository’s structure, fitness tests and spec linters carried it.
    • The round-2 hypothesis did not replicate. Convention-following looked better with guides in one repo and reversed in another.
    • Consequence: do not rely on prose to keep cross-file docs current. Make staleness a sensor.

    source: warehouse-harness-template / EVALS.md

    § 05 · Brain memory

    A brain that outlives the context window.

    An agent forgets everything when its session ends. The repositories do not. Each layer below keeps a different kind of knowledge alive for a different length of time.

    1. minutes

      Context window

      What the agent holds right now. Gone when the session closes.

    2. per task

      Guides and skills

      AGENTS.md, path-scoped rules, how-to skills. Loaded when a matching file is touched, about 50 tokens each until used.

    3. per repo

      Repository memory

      .claude/memory/MEMORY.md: heuristics that need no test, one lesson per entry, stated as a fact with its evidence. A pure classifier measured 89.91% mutation coverage as a switch and 97.17% as an if-chain, with no test changes.

    4. per incident

      Incident log

      46 rows. Each failure ends with the fix, a sensor, the sensor rolled out fleet-wide, and a row here. A row with no guard is an open gap and says so.

    5. per decision

      Decision records

      946 ADRs across the contexts: the reason behind each choice, so an agent can tell a rule from an accident. The index links out; ADRs are never copied.

    6. fleet-wide

      Fleet canon

      Rules no single repository owns live once in warehouse-docs; every service carries byte-identical copies. Edit at the source, then re-sync.

    § 06 · The ecosystem

    Why it holds together.

    Six properties that make a 42-service system something an agent can work in without breaking it.

    1. ABoundaries you can see

      42 bounded contexts in four domains — WMS (10), WES (14), Retail Network (12) and Digital Storefront (6) — each classified Core, Supporting or Generic. Two contexts are barred from calling a sibling at all: they live on events and local copies. Beneath the WES, a warehouse-control tier has begun: asrs-control, the first WCS context, schedules an automated storage rack over MQTT telegrams against a simulated PLC — two more equipment controllers are designed, not built.

      context map · process-path-management · labor-performance

    2. BOne event language

      CloudEvents 1.0 on every Kafka message, in a single naming scheme. 154 producer-to-consumer routes are catalogued in AsyncAPI and in the EventCatalog, so a new agent can read the topology instead of guessing it.

      CloudEvents standard · EventCatalog

    3. CHexagonal, enforced

      Ports and adapters is not a diagram here, it is a failing build. Fitness tests keep the domain from importing adapters and keep MCP and A2A as additive inbound adapters that nothing may depend on.

      arch-go · ADR‑0008 · TestHexagonalArchitecture

    4. DBuilt for agents, not only people

      42 contexts ship an MCP server and all 39 an A2A agent card. Kafka carries facts, MCP carries an agent’s tools, A2A carries the delegation of a goal: three transports, no overlap. The ops agent’s one write path is human-gated.

      A2A agents · warehouse-ops-agent

    5. EContracts as code

      OpenAPI and AsyncAPI for every context, linted with Spectral, regenerated into the documentation and drift-checked in CI. If the spec and the docs disagree, the build says so.

      API reference · docs-api-drift

    6. FKubernetes-native and observable

      An existing k3s cluster driven by Terraform, with every chart installed by ArgoCD from its service repo and every image built on GitHub, never locally. Kong at the edge, OpenTelemetry signals and Prometheus alert rules. Honest about scope: it is a two-node reference deployment, not production.

      warehouse-infra · alert catalogue

    § 07 · Engineering study

    Measured every week, not just shipped.

    A software-engineering study of all 58 repositories: quality, pull requests and commits per month for every project, and one report per ISO week with DORA-style delivery proxies, flow, CI health and the risks left open. Counted from git and the GitHub API, like every number on this page.

    projects studied
    58
    weekly reports
    15
    pull requests merged
    6,833
    CI runs green
    94%
    median PR lead time
    18 min

    Proxies, not a benchmark. One maintainer directs AI agents across every repository, so review counts are near zero by construction and volume says little about effort. The study states each metric's source and blind spot.

    § 08 · Architecture assessment

    Fitness functions, not opinions.

    Every repository assessed with ten architectural fitness functions — the term from Building Evolutionary Architectures (Ford, Parsons & Kua; foreword by Martin Fowler): objective integrity checks on structure, coupling, contracts, governance and delivery, each with a stated target. Counted from the git trees at HEAD of every default branch; a missed target is a listed risk, never a judgement.

    projects assessed
    58
    checks evaluated
    481
    checks passing
    95%
    in-repo fitness tests
    1,826
    risk lines
    23

    Static shape, honestly. Nine of the ten checks read structure at HEAD; only CI green is dynamic. ATAM’s tradeoff analysis needs people in a room — this is one repository-reading script, and the method says so.

    § 09 · Clean-code assessment

    Clean code, counted.

    Every repository measured against ten clean-code checks — gofmt discipline, function size, control-flow depth, file size, documented API surface, naming, debt markers, duplication, and the CI and pre-commit gates that keep them honest. A Go parser reads the AST of 49 repositories; git counts the rest. A miss is a finding with its evidence, never a judgement.

    projects assessed
    58
    functions parsed
    33,562
    checks passing
    91%
    debt markers
    0
    duplicate functions
    833

    Syntax only, honestly. The scanner has no type information — no cyclomatic complexity, no semantic duplication — and tests are excluded from the size checks. Where the fleet already has a gate (make fmt-check, pinned golangci-lint, lefthook), the target is that gate. The blind spots are stated on the method page, not papered over.

    § 10 · Executive briefings

    Every project, briefed like a business.

    Each repository ships an executive briefing — mission, capabilities, events, risks, next steps. Four program landing pages quote them, join them to the counted engineering and architecture data, and draw each program’s real event flow: every arrow is a counted Kafka route.

    briefing decks
    48
    programs
    4
    bounded contexts
    42
    event routes
    154
    split
    WMS/WES · Retail · Yard · Storefront

    Committed artifacts. The decks live in each repository; these pages quote them verbatim and count the rest from git. Where a context has no deck yet, the page says so — a gap, published as a gap.

    § 11 · EventStorming

    The whole ecosystem, on one wall of sticky notes.

    EventStorming is a workshop method by Alberto Brandolini for seeing how a business really works: write what happens on sticky notes, line them up on a timeline, then ask what caused each one. We replayed it on IQVO: one big picture of all 42 bounded contexts, then a board for every context, rebuilt from its real code and documentation, in the official colours.

    1. Find the eventsOrange notes: things that happened, in the past tense, placed left to right in time.
    2. Ask what caused each oneA blue command, a small yellow actor, a lilac policy (“whenever X, do Y”), a green read model for what they needed to know.
    3. Find the rule keepersBig yellow aggregates accept or refuse each command. Where the language changes, a bounded context begins.

    The colours

    EventReceiptClosed
    EventSomething that happened, in the past tense. EventStorming always starts here.orange sticky
    CommandCloseReceipt
    CommandA decision or an intent. It is what causes an event.blue sticky
    ActorDock staff
    ActorThe person or role who issues the command.small yellow sticky
    AggregateReceipt
    AggregateThe rule keeper: accepts or refuses the command and records the event. The EventStorming glossary now calls it a constraint.big pale yellow sticky
    PolicyWhenever a receipt closes, close its ASN in the same transaction
    PolicyA reaction: whenever X happens, do Y. It sits between an event and the next command.lilac sticky
    Read modelAppointments copy
    Read modelThe information someone needs to decide, or a copy kept up to date from events.green sticky
    External systemnetwork-fulfillment
    External systemAnother bounded context, or a system outside the fleet, that takes part in the flow.wide pink sticky
    Hot spotTolerance bands are per supplier only. A product-class band waits until product-master publishes a class this service can copy.
    Hot spotA real problem, open question or known gap. Here each one comes from a decision record.neon pink sticky
    OpportunityThe receiving advice has no reader yet. Partner connectivity could send it back to the supplier.
    OpportunityA possible improvement that the documentation already names.dark green sticky

    One real row, read left to right

    1. Close the receipt

      Dock staff close the receipt. Differences inside the supplier's band are accepted; the rest are reported against the ASN, missing cartons are flagged and the receiving advice is sent.

      ActorDock staff
      Read modelSupplier tolerance bands
      CommandCloseReceiptPOST /receipts/{receiptId}/closures
      AggregateReceipt
      EventReceiptClosed
      EventReceivingAdviceIssued
      EventCartonDiscrepancyRaised
      Systemnetwork-fulfillment
      PolicyKeeps a copy of the closed receipt
      Systemyard-management
      PolicyFeeds its inbound views
    context boards
    42
    domain events placed
    389
    commands
    530
    policies
    764
    hot spots
    188

    A reconstruction, not a workshop. A real EventStorming puts domain experts in a room. These boards are rebuilt from what each repository says today, and a script checks every event, command and aggregate against the sources: a board that invents or omits one fails the build. Hot spots are only gaps the decision records already admit.

    Read it. Poke holes in it. Steal the idea.

    The most useful thing you can do with an experiment is try to break it.