Start Part 4: ask Codex to copy Part 3 into Part 4 and grill you on real-time bid updates with WebSockets and a Redis backplane. Optionally send the same request in Plan mode in a second chat, so you can compare the two ways of planning with your own eyes.
part-4-realtime-socketio-redis and starts a grilling session about real-time updates.GRILL.md and CONTEXT.md written in Part 4. The slice list and the build come in guide 18.npm start starts a Redis container as well as the Postgres one. The three concept boxes below explain each of these words.Normal web traffic is HTTP: the browser asks, the server answers, the connection is done. The server cannot speak first. So if a page wants to know about a new bid, it has two options. Polling: ask “anything new?” every second or two. Simple, but wasteful, and still up to two seconds late. WebSocket: open one connection and keep it open, like a phone call instead of a series of text messages. Now either side can talk whenever it likes, so the server can push “new bid on auction X” to the page within milliseconds, and nobody has to keep asking. Our Part 3 pages refresh only after you place a bid or when the auction ends; Part 4 makes them update live, for every watcher, the instant any bid is accepted.
Socket.IO is a Node.js library that makes WebSockets easy to use. Raw WebSockets give you a pipe for messages and nothing else. Socket.IO adds the things every real app needs: named events (“auction:changed”), rooms (a browser joins the room for one auction and only gets that auction's events), automatic reconnection when the network drops, and a fallback to HTTP long-polling for networks that block WebSockets. It has a server part that plugs into our Fastify API and a client part that runs in the React page. It also has an official adapter for Redis, which is how the backplane in the next box is wired up.
Redis is a very fast in-memory data store that runs as its own server (for us, in a Docker container next to Postgres). It is often used as a cache, and it has a built-in messaging feature we use here. Now the problem it solves. Picture the app in production with two API replicas, two identical copies of the server behind a load balancer that spreads users across them. Bidder A's browser is connected to replica 1; bidder B's to replica 2. B places a bid, which lands on replica 2. Replica 2 pushes “auction changed” to its connected browsers, but replica 1 never hears about it, so A's page stays stale. The fix is a backplane: every replica publishes each event to Redis, and Redis forwards it to every replica, which then pushes it to its own browsers. Redis is the shared channel behind all the replicas. With a single replica you do not need it, but we build for the distributed case from the start, because retrofitting it later is painful.
Before I start a new part I always make sure the previous one is committed. A clean commit boundary lets you see exactly what Codex changes for Part 4, nothing mixed in from before. You committed Part 3 in guide 15, so this is most likely a no-op; run it anyway, in the Terminal app.
cd ~/codex-course/workshop && git add -A && git commit -m "Part 3 done"
cd moves into the workshop; git add -A stages anything that changed; git commit -m "Part 3 done" saves a snapshot with that message. If there is nothing to save, Git simply tells you so.
Either a short commit summary (a line starting with [main …] Part 3 done and a file count) or nothing to commit, working tree clean. Both are fine; both mean your Part 3 is safely saved.
In Codex, click New chat in the sidebar under the workshop project. New part, new chat: the Part 3 chat is full of locking and clock details that would only distract here. Check that the picker under the message box reads 5.6 Sol Medium, then paste this prompt and send it.
A confession first. This is my second version of the prompt. My first version said the app needs to be distributed “because we have 100000 users on our waitlist”. It was a joke. Codex took it literally and started asking about capacity targets, connections per second and scaling plans, none of which we want. So I threw that chat away and started again with the cleaner prompt below. Use this one.
start in directory 4 and copy files from directory 3 for this slice we want to make the frontend use websockets to update as soon as bids come through. we want to protect against when this app is distributed that the websockets will succeed. grill me with docs!!!!!!!
Three parts to this prompt. The first line is the housekeeping: copy Part 3 into the Part 4 folder and work there. The middle is the actual feature request in two sentences: live updates over WebSockets, and it must keep working when the app runs as several copies (“distributed”). The last line triggers the grill-with-docs skill, which makes Codex question you about the design and ground its questions in the existing code and docs before writing anything.
Codex names the chat something like “Grill WebSocket bid updates”. It reads the root and part-level AGENTS.md / CONTEXT.md, then reports something similar to: “Part 3's source, tests, manifests, and documentation are now copied into part-4-realtime-socketio-redis; generated dependencies and test output were excluded.” (Generated dependencies means the node_modules folder, which it reinstalls rather than copies.)
Then it splits “WebSockets succeed when distributed” into two guarantees (events cross API replicas; clients recover after interruptions) and starts Grill — Round 1: Product guarantees. You get about 10 numbered questions. Each has a ❓ question and a ➡️ “I recommend…” line, and the round ends with “Answer Q1–Q10 in order.”
Everything you write biases the model. A joke became a requirement. And Codex will probably pick Redis without being asked, because the root AGENTS.md already mentions it as the stack for this part. My habit: leave out explanations, jokes and background, and just ask for what you want. If the model needs context, it will ask.
A grilling session reads a lot of files and writes long answers, so expect a noticeable token cost on your API key. Two rounds for Part 4 is a normal-sized run; do not start extra grills “to see what happens”.
While the grill runs, I want to show you Codex's built-in Plan mode in a second chat, with the same request, so you can compare the two approaches side by side. It is only a comparison and does not change your code. Skip Steps 3 and 4 if you want to save tokens.
/plan and pick Plan mode – Turn plan mode on from the menu.start in directory 4 we want to make the frontend use websockets to update as soon as bids come through. we want to protect against when this app is distributed that the websockets will succeed.
Plan mode is built into Codex. You describe a task, Codex reads the code, asks you a few multiple-choice questions in a card, and then writes one long plan document that you read and accept before any code is written. It is read-only until you approve. Grilling is a skill we installed in guide 5. It also asks before building, but differently: 8–10 pointed questions per round, up to two rounds, each with a recommendation, and it records every answer in GRILL.md and the agreed vocabulary in CONTEXT.md. Plan mode is quick and good for small features that fit the existing patterns. Grilling is slower and surfaces the decisions you did not know you had to make, which is what you want for anything with concurrency, time or infrastructure in it.
A Plan chip appears next to “Approve for me” under the message box, and the empty box says “Describe your task to generate a plan…”. After you send the prompt, Codex reads files, says it has reduced things to a few product choices, then shows a question card labelled “1 of 3”.
If /plan does not show Plan mode in your Codex version, skip this step and the next one. They do not change your code.
Plan mode asks multiple-choice questions in a card, each with one option marked Recommended. Click an option to answer and the next card appears. Notice how few questions there are compared with the grill running in the other chat. I picked:
Then I sent one more line. Both chats are working on the same Part 4 folder, and I did not want the plan chat to write files while the grill chat was also writing there. Two agents editing one folder at the same time is a recipe for confusion.
continue without editing files plz
“Absolutely — this remains read-only planning. I won't edit or generate any project files.” Plan mode keeps working and ends with one long plan document that you are asked to read and accept.
My view after using both: Plan mode is fine for small, native features, but you end up reading one big plan at the end, and big plans get skimmed. Grilling asks better questions one at a time, and I actually read each one because I have to answer it. You do not need to accept this plan. Just go back to the grill chat.
Go back to the grill chat. Codex writes its own questions each run, so the wording, order and count may differ from mine (the root AGENTS.md caps it at 8–10 questions per round, 2 rounds max). Each question ends with a recommendation. Writing “take recommend” accepts it. Read each question properly before answering; this is where you shape the design.
What my answers decided, and why. Match these to your question numbers by topic:
1. take recommend 2. only the auction detail page 3. take recommend, just one Redis server as the backplane plz 4. just keep it super simple, don't worry too much about distributed systems EXCEPT redis as backplane 5. take recommend 6. take recommend 7. take recommend if it's simple enough 8. take recommend 9. no 10. don't add that right now
Why this matters: look at how many of these answers cut scope. Grilling is not only about getting the design right; it is about saying no to everything you do not need yet. The model will happily build sticky sessions and a replica demo if you let it.
Codex replies with something similar to: “Round 1 is recorded in GRILL.md and the resolved domain language in CONTEXT.md.” Then Grill — Round 2: Technical shape starts, with about 9 more questions. Round 1 was about what the product guarantees; round 2 is about how to build it.
If Codex keeps asking about scale or extra infrastructure, steer it the way I do: “just keep it super simple” or “don't add that right now”. Real-world questions like sticky sessions matter, but not for this slice.
Round 2 is about the technical shape. The questions get more specific, and a couple of them hide important ideas. What my answers decided, and why:
auction:changed notice (slug + bid ID), then the browser refetches the auction over HTTP. The socket says “something changed”; the API, which already has the correct, tested read logic, says what. This keeps the socket payload tiny and keeps one source of truth.Publish/subscribe is a messaging pattern. A sender publishes a message to a named channel without knowing or caring who is listening. Any number of receivers subscribe to that channel and get a copy of every message. The sender and receivers never talk to each other directly; the channel decouples them. Redis has this built in. In our design every API replica subscribes to the Socket.IO channel in Redis; when a bid commits on any replica, that replica publishes “auction:changed” once, Redis delivers it to all replicas, and each replica forwards it to the browsers in that auction's room. Socket.IO's Redis adapter does all of this for us behind one line of configuration.
1. take recommend 2. yes 3. take recommend 4. take recommend 5. take recommend 6. yes 7. don't start unless redis is also started 8. take recommend 9. yes, also we're not doing any multi-replica demonstration at all, don't overcomplicate things plz
An “Edited 2 files” card: part-4-realtime-socketio-redis/GRILL.md and CONTEXT.md. Open CONTEXT.md in VS Code if you like: it now defines terms like Accepted bid, Auction watcher and Authoritative auction state. This shared vocabulary is what Codex will use consistently in code, tests and messages in guide 18. Codex then shows “Preparing feature slices proposal…”. This guide ends here. Leave this chat open; guide 18 continues in it with the slice list and the build.
Why I stay on Medium reasoning for grilling: a model that thinks longer also tends to design longer, adding layers we never asked for. LLMs can absolutely overthink a small slice. Medium gives good questions without the gold-plating.
Codex went off on scale and capacity questions? You probably added extra context to the prompt. Start a new chat and send the Step 2 prompt exactly as written.
Part 3 is not finished? Replace your Part 3 with the finished reference version, then start this guide at Step 1. The reference folder is the end state of the whole part (all slices done). The command deletes your Part 3 folder (cannot be undone), copies the reference in, and commits.
If you would rather skip Part 4 entirely, use the same command with part-4-realtime-socketio-redis in place of the Part 3 folder name. Be aware that this copies the finished real-time code from guide 18, not just this guide's grilling docs, so you would then skip guide 18 as well.
cd ~/codex-course/workshop && rm -rf part-3-business-rules-concurrency && cp -R ../reference/part-3-business-rules-concurrency ./ && git add -A && git commit -m "Catch up: part 3 from reference"
AGENTS.md nudged the choice of Redis. Write only what you mean.GRILL.md and CONTEXT.md.