Build agents
from zero.

Hands-on series that ship real code. Currently running: Mini Claude Code — a working coding agent built in six episodes, no framework hiding the moving parts.

EP 01TypeScript
14 min

Mini Claude Code · Episode 01: A 40-Line REPL That Actually Remembers

Start of a hands-on series where we build a working coding agent from scratch in TypeScript. Episode 1 gets the smallest possible loop running — stdin, streaming, and a conversation that survives turns.

EP 02TypeScript
17 min

Mini Claude Code · Episode 03: Editing Files Without Wrecking the Repo

Episode 3 adds the apply_patch tool — the one where most agents quietly destroy your work. We build a strict unified-diff applier with dry-run preview, workspace guardrails, and a confirmation gate that survives a Claude in a bad mood.

EP 03TypeScript
16 min

Mini Claude Code · Episode 02: Teaching the Agent to Use Tools

Episode 2 gives our REPL its first three tools — read_file, list_dir, run_bash — and walks through the tool-use loop with the Anthropic SDK. We handle stop reasons, tool errors, and the surprisingly tricky part of what to put back in the conversation.

EP 04TypeScript
18 min

Mini Claude Code · Episode 06: The Eval Loop That Finally Tells You If You Made It Worse

Season finale. We build a 15-task SWE-lite harness that runs the agent end-to-end against verifiable code tasks, then wire in prompt caching so iteration is cheap. Pass rate, mean turns, and cost per task — pinned as a baseline you can regress against.

EP 05TypeScript
17 min

Mini Claude Code · Episode 05: Spawning Sub-Agents With Their Own Context

Episode 5 splits the agent in two. We add a spawn_subagent tool that dispatches a scoped task to a fresh Claude with its own tool set and its own context window, then returns a compact summary. The pattern behind Anthropic's 'token usage explains 80% of variance' finding, in ~90 lines.

EP 06TypeScript
16 min

Mini Claude Code · Episode 04: Making the Agent Forget on Purpose

Episode 4 attacks the token bill head-on. We implement observation masking (the JetBrains-style trick that beats LLM summarization on cost and quality) and add an auto-continue path so max_tokens truncation stops silently breaking tool sequences.