All projects

AI Reliability / Execution Infrastructure

Customer Journey Composer

Turn a plain-language brief into a customer journey with waits, branches, email, SMS and push. AI proposes the journey, a person approves and publishes it, and a Go runtime on PostgreSQL runs it step by step for each customer.

Ten generated journeys, Nov 15, 202647 / 47
Test Lab cases passedLive run with OpenAI gpt-6-luna: 95,151 tokens and three automatic repairs. Live Claude quality has not been measured.
Down from 177 s, local benchmark88 s
10,000 customers sentAll 10,000 mock sends accepted 87.5 to 89.5 s after a shared timer deadline, from 176.7 s before the queue SQL changes.
Down from 15.75 s9.3 s
Timer p95 latenessTimer step completion minus its due time, at p95, in the same 10,000-customer workload.

A campaign sends once. A journey keeps going.

A customer leaves a cart. An hour later they get an email; if they still have not bought after a day, a push; if they have, the journey stops. Each customer moves through the same steps at their own pace, and a journey can run for days.

Customer Journey Composer lets a marketer describe that journey in plain language and get it drawn on a canvas: the entry event, the waits, the conditions and branches, the email, SMS and push steps, and the goal that ends it. Claude or OpenAI writes the proposal; a person reviews it, edits it and decides when it goes live.

Once published, the journey belongs to the runtime. A Go worker on PostgreSQL carries every customer through the exact version they entered, survives restarts, and sends each message once. It is the sister project of Smart Campaign Composer, which handles one-off campaigns.

Built for the person running the journey.

Every journey goes through the same five steps: describe, review, test, publish and follow.

Draft a journey from a brief

Describe the journey in plain language or start from an example. Claude or OpenAI proposes the steps, and the review shows what it adds, removes and changes, with each setting before and after.

A marketer starts from a working draft instead of an empty canvas.

Edit every step on the canvas

Entry events and scheduled audiences, waits for a time or an event, conditions, multi-way branches, A/B splits, email, SMS, push, webhooks, profile updates and exits. Changes save automatically and can be undone.

The AI draft is a starting point the marketer fully controls.

Test before going live

The Test Lab runs saved scenarios on a virtual clock with injected events and provider failures. The test inbox shows every message as the customer would receive it, with its consent decision and attempts.

Days of a journey can be checked in seconds, and a failing scenario blocks publishing.

Follow customers through it

The live monitor counts entries, goals and waits on the journey map, opens any step to its people and messages, and traces a single customer's path with each transition.

A running journey stays readable step by step.

Measure honestly

Analytics filter by published version and entry period and attribute each outcome to the day the customer entered. Provider acceptance is reported apart from conversion.

Results say what actually happened, not what was sent.

From brief to live journey.

The demo workspace, Northstar Commerce, has a published Abandoned Cart Recovery journey, 14 fictional customers and five Test Lab scenarios. The path below is the one every journey takes.

  1. Describe. Write the brief and confirm the behavior contract: what must happen when the customer buys, when they do not, and who is eligible.
  2. Review. The proposal arrives as a diagram with a summary of each change. Ask for edits in your own words, then apply it as a draft.
  3. Edit and test. Adjust any step on the canvas. Run the Test Lab scenarios on a virtual clock and read every message in the test inbox.
  4. Publish. An Admin publishes a fixed version once a full sandbox run of that exact workflow has passed.
  5. Follow. The live monitor and analytics show entries, waits, sends, goals and each customer's path.

The model proposes. The runtime executes.

The model is only involved before publishing. Its answer is checked against a versioned schema, the behavior contract and the brief, then shown to a person. Nothing it returns is saved or sent without that person applying it.

After publishing, PostgreSQL is the single source of truth. Steps, jobs, waits and the outbox are rows; workers claim due work with FOR UPDATE SKIP LOCKED, leases and fencing tokens. The API and worker share state through the database rather than calling each other.

The model proposes a journey before publishing; the Go API checks it against the schema, the behavior contract and the brief, and a person applies it. Publishing freezes a version in PostgreSQL after a passing sandbox run. Workers then carry each customer through that version with leases, fencing tokens and a transactional outbox, sending to Mailpit and mock providers.

Proposal and publishing

Model output is checked and reviewed; only a passing sandbox run of the exact workflow can be published.

Vue canvas submits Go API + model. Go API + model presents for review Human apply + Test Lab. Human apply + Test Lab publishes PostgreSQL.

  1. ClientVue canvasbrief and behavior contract
  2. AnalyzerGo API + modelschema, contract and brief checks, one repair
  1. ControlHuman apply + Test Labdraft edits and virtual-clock scenarios
  2. PersistencePostgreSQLimmutable published version

Execution and delivery

Each customer stays on the version they entered; every step and send survives a worker restart.

Go worker checks policy Send policy. Send policy sends via outbox Mailpit + mock providers. Mailpit + mock providers feeds Live monitor + analytics.

  1. ServiceGo workerSKIP LOCKED claims, leases and fencing
  2. ControlSend policyconsent, frequency caps and global exit
  1. OutputMailpit + mock providersemail, SMS and push
  2. ObservabilityLive monitor + analyticscustomer paths, goals and conversion

Architecture notes

  • PostgreSQL holds steps, jobs, waits, the outbox and provider channel state. There is no Redis.
  • Pauses, credential locks and the circuit breaker are rows on the provider channel, shared by every worker.
  • Messages go only to Mailpit and mock providers. An unclear SMTP outcome stays UNKNOWN.
Read the architecture

What the runtime guarantees.

A journey outlives the browser tab that published it and the worker that started it. These rules keep each customer's path predictable across edits, restarts and provider trouble.

A published version never changes

Customers already in a journey stay on the version they entered while a new draft is edited and published. Publishing changes only who enters next.

Read the design

Waits survive restarts

A wait can last a fixed time, end at a time of day or a date on the customer, or wait for an event or a message open or click with a timeout. Each is a row in PostgreSQL, so a restarted worker picks it up.

Read the design

A goal ends the journey

A global exit, such as a purchase, ends the journey as converted, and can be scoped to the object that started it, such as the same cart.

Read the design

Provider trouble is shared state

Backoff with jitter, a pause on 429, a credential lock on 401, a circuit breaker per workspace and channel, and a rate window, all held in PostgreSQL rows so every worker sees them at once.

Read the design

Keep the AI before the publish button.

Check the proposal against the brief

A versioned JSON schema shapes the model's answer. The backend checks the graph, the message syntax and the behavior contract the person confirmed, and compares every link, code and number in the messages with the brief. Invalid output goes back once with the reasons and is never offered to apply.

Approve, then publish separately

Warnings need an acknowledgement, and an edit made while a proposal is open blocks applying it. Applying creates a draft; publishing is a separate Admin action with its own review and needs a passing sandbox run of the exact workflow.

Keep execution in PostgreSQL

Jobs are claimed with row locks and leases, fencing tokens stop a worker that lost its lease, and waits are rows, so executions survive restarts. There is no Redis: every worker reads the same state.

Send each action once

Events are deduplicated, every logical action has a unique identity, and a transactional outbox carries sends, so a retry never sends twice from this side. An outcome the provider leaves unclear stays UNKNOWN instead of being reported as delivered.

Decide at send time

Consent, frequency caps, the customer's lifecycle state and the journey's global exit are checked when a message is about to go, not when the journey was written. A blocked message is recorded with its reason and the journey goes on.

Provider trouble is not a failed customer.

Each message has five attempts. A busy or locked channel costs no attempt, so a provider outage holds messages instead of failing them. Every rule is a column on the channel's PostgreSQL row, shared by all workers.

What happenedWhat the worker doesUses an attempt
429 from the providerEvery worker pauses the channel for Retry-After, between 1 and 30 s.No
401 or SMTP login refusedLock the channel; one call every 30 s tests the credentials.No
5xx, 408 or connection failureRetry after 2, 4, 8, 16, 32 s with jitter, under the same idempotency key.Yes
Half of recent calls failingOpen the circuit breaker for the workspace and channel, then probe.No, while open
No answer after a possible sendMark SMTP outcomes UNKNOWN for an operator; never resend blindly.Yes
Read the delivery rules

Twice as fast, without new infrastructure.

The benchmark puts 10,000 customers in one published journey, moves all their timers to the same deadline and lets real workers run timer, condition, SMS and exit. Reordering the queue SQL halved the time to drain every send.

MetricBeforeAfter
All 10,000 mock sends accepted176.7 s87.5 to 89.5 s
Timer step lateness, p9515.75 s9.25 to 9.41 s

No index, cache, connection pool increase or Redis was added. The worker's claims now walk the ordered pending indexes first and filter after, and drains continue from where they left off instead of rescanning the queue.

PostgreSQL 17 in Docker, limited to 2 CPU and 2 GiB, two final repetitions. Ingestion latency did not improve, because the faster producer meets the per-workspace request limiter.

Read the measurements

The working product.

Every screen below is the running application with the demo workspace. Open any screenshot to see it full size.

Brief page with the abandoned-cart brief, the workspace events and fields it can use, and example journeys
Describe the journey

Write what should happen in everyday language, with the workspace's events and customer fields listed beside the brief.

Behavior contract for the situation No purchase during recovery, for EUR carts of at least 50 with email, SMS and push consent
Say what must be true

Before the model is called, confirm what the journey must do in each situation. Every proposal is checked against it.

Review page with the proposed steps from the cart trigger through the wait, email and purchase check
Review the proposal

The proposal is drawn as a diagram with each path. Ask for a change in your own words, or approve it as an editable draft.

Builder with the purchase wait selected, its push follow-up on the timeout path and the wait's settings in the side panel
Edit it on the canvas

Triggers, waits, conditions, branches, A/B splits, email, SMS, push, webhooks and exits are all editable, with autosave and undo.

Test Lab running the Email, push and SMS, no purchase scenario on a virtual clock, passed, with its assertions and timeline
Run days in seconds

Saved scenarios run on a virtual clock in an isolated sandbox, with the path taken and every assertion.

Test inbox with a push notification for Alex Morgan on a phone banner preview
See what the customer gets

The test inbox shows each message a scenario produced, personalized, with its trace, consent decision and attempts.

Publish review with three changed steps, the passed readiness checks and the version rules
Publish a fixed version

Publishing shows what changed and the checks it passed. Customers already in the journey keep the version they entered.

Step breakdown of the cart email on the journey map, with reached, accepted, opened and blocked counts
Follow it live

The live monitor counts entries, goals and waits on the journey map and opens any step to its people and messages.

Customer path showing one execution with its version, exit reason and each step
Trace one customer

One customer's execution with its version, exit reason and every step it passed.

Journey analytics with entries, goals, waits and their trend over time
Measure the outcome

Filter by version and entry period. Provider acceptance is reported apart from conversion, never as delivery.

Measured runs.

Generation quality and runtime behavior are measured separately. Each figure links back to a dated report in the repository.

Live generation

47/47 Test Lab cases

Ten journeys · OpenAI gpt-6-luna · 2026-11-15

Engagement waits and discount codes, 95,151 tokens, three automatic repairs. Earlier runs, failures included, stay in the validation history.

Queue drain

87.5 to 89.5 s for 10,000 sends

Local benchmark · PostgreSQL limited to 2 CPU and 2 GiB · 2026-11-10

Down from 176.7 s after reordering the queue SQL, with no new index, cache, pool increase or Redis.

Timer lateness

p95 9.25 to 9.41 s

Same workload, from 15.75 s

Ingestion p95 and p99 did not improve: the faster producer hits the per-workspace limiter and retries, and the report keeps that visible.

Recovery

Resumes once after a worker stop

make test-recovery, run in CI

The test stops the worker during a wait and checks the execution resumes from its last committed step exactly once.

Run it locally.

  • Go
  • Vue
  • TypeScript
  • PostgreSQL
  • Vue Flow
  • Docker Compose
  • Prometheus
  • OpenTelemetry
  • Grafana
  • Anthropic API
  • OpenAI API
  • Playwright

Docker Compose starts the web app, API, worker, PostgreSQL and Mailpit; SMS and push go to mock providers. The demo reset prepares Northstar Commerce with its journey, customers and scenarios.

git clone https://github.com/negativexq/customer-journey-composer.git
cd customer-journey-composer
make up
npm run demo:reset
# Open http://localhost:5173

OpenTelemetry traces, Prometheus metrics with tested alert rules, Grafana and Tempo cover the runtime; Playwright tests run the main flows on desktop and mobile.

In short

What is Customer Journey Composer?
A Go and Vue application that turns a plain-language brief into a customer journey on a visual canvas, requires human approval and publishing, and runs each published version on a durable PostgreSQL runtime.
Can the AI publish or send anything?
No. The model returns a proposal. A person applies it as a draft, an Admin publishes it, and the runtime then runs that fixed version without a model.
Does it send real messages?
No. Email goes to a local Mailpit inbox and SMS and push go to mock providers, so nothing leaves the machine.
How is a journey tested before it goes live?
The Test Lab runs the real journey logic in a sandbox on a virtual clock, with injected events and provider failures, and checks expected outcomes. A journey whose required scenarios fail cannot be published.

Follow the implementation.