Week 4 · Build the Clone

The Chat Interface

The product begins

⏱ ~6 hours, hands-on🐍 Python / 🔷 TypeScript🛠 You ship: mycode v0.1 — a streaming chat agent
What this week is

Weeks 1–3 gave you every primitive: the agent loop, tools, evals, streaming, RAG, durable execution, sandboxing, human approval. Starting now, you stop building exercises and start building a product — a working clone of a professional AI coding agent, one subsystem per week.

By Week 12 it reads codebases, edits files, runs commands, plans, remembers, previews artifacts, traces itself, and orchestrates sub-agents. It goes in your portfolio, not in a folder of course exercises.

And we are not designing in the dark. This course uses the actual Claude Code source as a reference implementation. Each week, after building our own version of a subsystem, we open the real thing and study the decisions a production team made.

Why start with the interface? Because the interface is the product. An agent that thinks brilliantly but dumps a wall of text after forty silent seconds feels broken.

The walkthrough

Each part adds one capability to the same growing codebase, and each is a runnable checkpoint.

  1. 01The REPL skeletonA read-eval-print loop that feels instant and never blocks on a long model call.
  2. 02Streaming outputTokens as they arrive, so the machine visibly thinks out loud.
  3. 03Slash commandsAn escape hatch for everything that is not a model turn.
  4. 04Safe interruptsCtrl-C that cancels the turn without corrupting the conversation state.
  5. 05The cost meterLive token and dollar accounting, because the bill is a feature.

After this week you can

  • Build a responsive streaming terminal interface
  • Handle cancellation without losing conversation state
  • Track and display real-time token cost