Classify every operation
Before you change anything, find out what kind of work each operation is. The table you write here guides every later part of the day.
Study first
- There are four kinds of work. A request answers in a few seconds while the caller waits, and a stream sends as it goes, with server-sent events one way and WebSockets both ways. A job runs outside the request for seconds to minutes, and is retried. A workflow runs for minutes to days, survives restarts, and waits on people and events (Day 18).
- For each operation, ask how long it takes, whether someone is waiting, and what happens when it fails halfway.
- The asynchronous request-reply pattern is how a request hands its work to a job. The endpoint answers 202 with an address to follow, and that address reports the work's state until it is done.
Build
- Write
docs/execution.md, with every operation in a table that gives its kind, where it runs, and why. Pages and writes, webhooks and voice turns are requests, and the chat is a stream. Reading a document, answering a text message, delivering events and the crons are jobs, and document approval is a workflow. - Read the table for what is filed wrong. Since Day 17,
POST /api/documentshas read each document inside the request, with two model calls and retries, which took 5 to 15 s in the reference run. Move the reading out, so the endpoint stores the document, hands it to the workflow, and answers 202 with an address to follow. - Look at investigating a request, the job of the investigation agent from Day 11, which runs for minutes inside a server action. Leave it as a request today, and name it as the next to move.
Done when
- Each operation has a row, and each one in the wrong place is either moved or named.






