0001 — Decouple web app from agents

Context

The Next.js web app moved to Vercel in April 2026 but the agent runtime stayed entangled with it. Clara's Lambda bundles 16 modules from src/lib/ via esbuild. When those files change on Vercel's deploy pipeline but Lambda isn't redeployed, the two drift — causing production incidents on April 13 (Clara replied to wrong address) and April 15 (4 PRs merged, Lambda ran day-old code).

We also had:

Root cause: no clean boundary between what runs on Vercel and what runs in AWS. They share runtime code, and the drift surface is wherever they overlap.

Decision

Vercel runs the web app.

AWS runs the agents.

Contract between Vercel and AWS: DynamoDB tables + SQS queues. That's it. Zero shared TypeScript files (see ADR-0002).

Consequences

Easier

Harder

Follow-up work

Alternatives considered

Shared package (packages/shared) via npm workspaces. Originally proposed in Trello #762's initial description. Rejected April 14 because it "tightly couples web app to workers, defeating independent deploys." A shared package doesn't solve the drift problem — it relocates it.

Shared types package only (packages/types, Zod schemas). Seriously considered. Rejected for maximum decoupling; even shared types create a deploy-coordination burden on schema changes.

Thin Lambda that posts back to Vercel for processing. Rejected because it violates "Vercel is web-only." Agent runtime belongs in AWS where we have the right tools (SQS, EventBridge, long Lambda durations).

Keep current coupled state and just add drift detection. Rejected because drift detection is a band-aid. The Apr 13 and Apr 15 incidents happened with drift warnings in CI — they just weren't blocking. Fixing the structural problem is better than fortifying the warning.