decodingai-magazine/building-a-coding-agent-from-scratch-course

Learn harness engineering by building Claude Code from scratch. Free, open-source course: 8 articles, 6 videos, 1 codebase.

What this project is

An open-source, free-to-run course (8 articles, 6 videos, Apache-2.0 license) that walks you through building a coding agent — an AI that can read, edit, and run code in a project — from the ground up. The result is decode, a working coding assistant you build yourself. The course is by Decoding AI, with technical backing from Modal, Opik, and Kitaru.

The core idea: “the harness” is what matters

The project makes a strong, evidence-backed argument: the AI model itself is only ~20 lines of code — a simple loop where the model reads a prompt, decides what tool to call (like reading a file, running a command), and repeats. The hard, interesting work is everything around that loop: the tools, permission checks, memory management, sandboxing, and error handling. That surrounding system is called the harness, and the README claims that improving the harness alone moved a coding agent from ~30th place to the top 5 in a benchmark. So the course teaches you to engineer that harness.

What you build

A complete coding agent called decode with:

  • Two interfaces: an interactive terminal UI and a remote serverless mode (deployed on Modal) that can run many agents in parallel, triggered manually, by a webhook, or on a schedule.
  • Six supporting modules: LLM providers, memory, skills (reusable instruction sets), sandboxing, permissions, and an LSP server for fast editor-like feedback.
  • Context engineering: automatic summarization of the conversation when it reaches ~80% of the model's context window, plus memory and skills loading.
  • Subagents: specialized helper agents (for exploring code, planning, or reviewing) that each get a focused, small context window rather than one bloated one.
  • Observability & evaluation: every session is recorded and can be replayed. The code integrates Opik for tracing and Kitaru for replaying runs, and includes an eval harness for benchmarking and catching regressions.

Technology stack

  • Language: Python
  • Agent framework: Pydantic AI
  • LLMs: three swappable providers — Modal (host your own open-weights models via SGLang), OpenRouter (open-weights as a service), or Gemini (proprietary)
  • Sandboxing: local Docker or remote Modal sandboxes — the agent's commands never run directly on your machine
  • Deployment: Modal serverless functions
  • Recording/eval: Kitaru (sessions, replays), Opik (tracing)

Everything else is built from scratch deliberately — the course avoids frameworks that abstract away the hard parts.

The 8 lessons (each with articles, most with videos)

# Topic What you learn
1 System design Sketch the entire harness: headless core, six modules, the two interface modes, and an evals layer.
2 The bare-bones agent loop Your agent loops over 9 tools and 3 swap-pable LLM providers in a steerable TUI.
3 Sandboxing Tools run inside Docker or Modal sandboxes — never on your host.
4 Context engineering Load memory, invoke skills, read LSP diagnostics, and auto-compact at 80% of the window.
5 Subagents Fan out parallel Explore subagents; switch between build, plan, and code-reviewer personas.
6 Deployment Run the headless harness remotely on Modal, triggering agents via CLI, webhook, or cron.
7 Evaluation Build benchmarks and regression tests for your agent.
8 Regression growth Turn real failed agent traces into new regression tests, and use Kitaru replays to compare runs.

Try it now

The finished agent ships with demo skills. You can clone, install (free), and in about 5 minutes watch decode build a playable Snake game, scrape web articles into an interactive knowledge graph, or fetch GitHub data into a dashboard — all from a single prompt.

git clone https://github.com/decodingai-magazine/building-a-coding-agent-from-scratch-course.git
cd building-a-coding-agent-from-scratch-course
make install
cp .env.example .env   # set your LLM API key
uv run decode

Then type /demo- and pick a demo.

Who it's for

The README issues a playful warning: building a coding harness from scratch can make you "dangerously good" at building any other AI product — in finance, medicine, or e-commerce. The lessons emphasize not just what the code does but why each design decision was made — e.g., why compaction fires at ~80% rather than at the limit, or why subagents are a matter of context engineering.

Related

  • Project
  • Project
  • Project
  • Project