warehouse-systems fleet · executive briefing

task-interleaving

Suggests a nearby next task when an operator finishes one, so fewer walks are empty
eight capabilitys4 events out · 7 in12 recorded decisions

This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic. · November 2026

the short version · read this if nothing else

Task interleaving ranks nearby open work so operators chain tasks instead of walking back empty

1

It ranks the site's open tasks by how far each starts from where the operator stands.

2

Hints are only tie-breaks, so fulfillment keeps control and fails open when one is missing.

3

It measures its own adoption: hints issued, consumed and expired, per site.

The ask

Switch on metrics scraping and trace export, then prove the hint loop live with fulfillment-execution.

why it exists

Every empty walk between tasks is time nobody gets back

task-interleaving is the WES-tier Supporting bounded context that cuts deadhead travel. When a station completes a task, it ranks the site's open tasks by how far each starts from where the operator now stands and issues an interleaving hint: a short, ranked, expiring list of candidates. The hint is strictly advisory…

Today

When a station finishes a task, the next one can start far away, so operators often walk without carrying anything.

The catch

Hints are advisory and can be ignored, metrics are not scraped, no traces export, and nobody has proven it runs in the cluster.

what it does

It suggests the next task, then checks whether anyone took it

Per-site policy

Each site sets its max detour, how many candidates, and how long a hint lives.

Local task and map copies

Keeps its own copies of tasks and layout, so it never has to call siblings.

Ranked hints

Ranks open tasks by walking distance from the operator's current spot.

Hint expiry

Unused hints expire on their own, so stale suggestions do not linger.

Adoption tracking

Counts hints issued, consumed and expired to show real adoption.

Station and policy reads

REST, read-only MCP and A2A, plus a web screen for station and policy state.

who it talks to

Two contexts feed it, one context builds on what it publishes

LISTENS TO · 7 EVENT TYPESIS HEARD BY · 1 CONTEXTSfacility-layout4fulfillment-execution3fulfillment-execution1taskinterleavingbadge = event types on that edge · derived from the CloudEvents types each repo declares
the shared language

A hint is a short ranked list that expires if nobody uses it

THE LANGUAGEOF THE DOMAINInterleavingPolicyStationTripInterleaving hintTravel model port with…Task pool copy and…Tie-break-within-one-priori…RankerHint adoption
REST10 operations over 9 paths: api :8080…
MCPMCP server (cmd/mcp, :8090, Streamable HTTP…
A2AA2A agent (cmd/a2a, :8093): 2 read skills…
how it is built

Five binaries around one pure ranker, wired together only in cmd

DRIVERS · INBOUNDOUTBOUND · ADAPTERSREST API :808010 operations over 9 paths…MCP tools :8090MCP server (cmd/mcp, :8090…Kafka consumer · 7 eventstask.TaskAvailabletask.TaskClaimedDOMAIN COREInterleavingPolicyStationTripInterleaving hintTravel model port with…PostgreSQLPostgreSQL only for the…Kafka producer · 4 eventsInterleavingHintIssuedInterleavingHintConsumedTransactional outboxrelay · DLQ on x-dlq-*commands inevents inevents outstorage / infra
event traffic · CloudEvents 1.0 on Kafka

7 facts come in and 4 go out, all as CloudEvents

CONSUMED · BY SOURCE · 7PUBLISHED · BY ENTITY · 4facility-layout 4fulfillment-execution 33 stationtrip1 policyTaskAvailableTaskClaimedTaskCompletedZoneRegisteredLocationSlotRegisteredLocationSlotDecommissionedLocationGeometryUpdatedInterleavingHintIssuedInterleavingHintConsumedInterleavingHintExpiredInterleavingPolicyDeclared
how we know it is healthy

Five adoption metrics exist, but nothing scrapes them or exports spans

Structured logs plus five OpenTelemetry metrics served on GET /metrics via the OTel Prometheus exporter (taskinterleaving.hints.issued/consumed/expired counters by site…

What we watch

  • Hint lifecycle counters give a direct adoption funnel (issued -> consumed vs expired) per site
  • Recommender duration histogram watches the ranking hot path; consumer-lag histogram watches the copies freshness
  • Boot retries (internal/bootretry) and readiness probes for postgres and kafka

What stops a bad change

  • make check / check-all; coverage gate 90% over domain+application (Makefile:21-22)
  • make mutation (gremlins) over the four pure domain packages, blocking in CI with thresholds 90/90 (.gremlins.yaml)…
  • make bdd (godog), make integration (testcontainers Postgres+Kafka), make load
by the numbers

12 decisions and 13 BDD feature files back a heavily tested core

12
Architecture decisions
#31 of 45 in the fleet
1
DB migrations
#32 of 45 in the fleet
13
BDD feature files
#26 of 45 in the fleet
4
Events published
#22 of 45 in the fleet

Ranked against all 45 briefed repositories (dot = one repository, highest on the left).

One-command workflows (make)

arch-testbddbuildcheckcheck-allcheck-fastcoveragefmtfmt-checkguide-lintharness-testhelpintegrationlint
what comes next

Five steps take it from wired to proven

NOW1Turn on metricsscraping inwarehouse-infraEnablemetrics.prometheus inwarehouse-infra'shelm-values/task-interleaving.yamlso /metrics gets scraped(chart valuemetrics.prometheus.enableddefaults false and the …NEXT2Install a tracerprovider so spansexportInstall a tracerprovider and an OTLPexporter (spans arecreated in the A2Aadapter but neverrecorded; no OTEL_*variables are read; nootelchi/otelhttp…NEXT3Add a dashboardpanel and alert onthe adoptionAdd a Grafana panel andalert on the fivetaskinterleaving_*series: thewarehouse-infradashboard registersbusiness_metrics: [] andno alert reads them …LATER4Raise the mutationthresholds from 90to 99Raise the mutationthresholds:.gremlins.yaml setsefficacy 90 /mutant-coverage 90although the recordedrun was 100/100 (fleetstandard is 99/99)LATER5Prove the hintloop live withfulfillmentProve the loop withfulfillment-execution ina live cluster: hintissued -> tie-breakclaim -> HintConsumed,and track adoption overtime
what could go wrong · and what we do about it

It only pays off if fulfillment actually uses the hints

Hints can be ignored, so empty travel stays

Value depends on adoption: hints are advisory tie-breaks only; fulfillment-execution can ignore them and deadhead travel stays

→

Per-site adoption counters show whether hints get used; proving the loop live is next.

Rectilinear distance is a coarse travel proxy

Rectilinear travel model v1 is a coarse distance proxy; wrong geometry weakens ranking quality (location copies must stay fresh)

→

The travel model sits behind a port, and a consumer-lag histogram watches copy freshness.

Auth is off by decision; relies on cluster reach

Every REST, MCP and A2A endpoint is unauthenticated by decision (fleet-wide revert); relies on cluster-internal reachability

→

No mitigation on the roadmap yet: this one needs an owner.

Cluster wiring is registered but unverified

Wiring is registered but unverified in the cluster — the docs state whether anything actually runs is not verified there

→

Next step: prove the hint loop with fulfillment-execution in a live cluster.

the decision we need

Switch on metrics scraping and trace export, then prove the hint loop live with fulfillment-execution.

WHAT ISWhen a station finishes a task, thenext one can start far away, sooperators often walk withoutcarrying anything.THE CATCHHints are advisory and can beignored, metrics are not scraped, notraces export, and nobody has provenit runs in the cluster.WHAT COULD BEAdoption is tracked on scrapedmetrics with traces and an alert,showing whether chained tasks cutempty walking.
Why it matters

Task interleaving ranks nearby open work so operators chain tasks instead of walking back empty

appendix · for the engineers in the room

The fine print: how it is put together

StyleHexagonal (ports and adapters) per fleet layout: dependencies point inward, the domain imports nothing internal, only cmd/ wires layers; event-driven with transactional outbox
LayoutFive binaries: cmd/api (chi REST + two Kafka consumers + outbox relay + hint-expiry worker), cmd/mcp, cmd/a2a (Agent Card, skills), cmd/ti-projector, cmd/ti-reports…
StoragePostgreSQL only for the write side (pgx, unit of work, embedded migration 0001, transactional outbox, task-pool/location-book copies…
Testingtable-driven domain unit tests (policy, recommend, stationtrip, travel packages, incl. PICK parity and candidate-bound tests of ADR 0012) and application/adapter/httptest tests…
REST10 operations over 9 paths: api :8080 — /sites/{siteId}/policy, /hints, /hints/{hintId}, /stations/{stationId}, /recommendations, /healthz, /readyz…
Go 1.27chipgx v5 + golang-migratekafka-go + CloudEvents SDK v2MCP go-sdk and a2a-goOpenTelemetry metrics with…godog + testcontainersAnalytics read sideReact/Vite web remoteHelm chart