What Are the 12 Progressive Sessions in learn-claude-code?

The 12 progressive sessions in learn-claude-code are incremental learning modules (s01–s12) that teach you how to build a Claude-code-style AI coding agent, starting from a basic agent loop and culminating in a multi-agent system with worktree isolation.

The learn-claude-code repository provides a structured curriculum for building AI coding agents through 12 progressive sessions. Each session adds exactly one new mechanism to the core agent loop, allowing you to understand complex multi-agent architectures incrementally. This guide breaks down every session from the foundational agent loop to the final worktree isolation implementation.

Overview of the 12 Progressive Sessions in learn-claude-code

The curriculum follows a strict incremental design philosophy: each session introduces a single, well-scoped mechanism without modifying the core agent loop established in s01. This approach ensures that learners understand exactly what each component adds to the system.

The progression moves through five distinct phases:

  1. Core Fundamentals (s01–s02): Establishing the agent loop and tool dispatch
  2. Extensibility (s03–s05): Adding planning, sub-agents, and dynamic skill loading
  3. Scalability (s06–s08): Managing context limits, persistent tasks, and background operations
  4. Collaboration (s09–s11): Multi-agent teams, protocols, and autonomous task claiming
  5. Isolation (s12): Worktree-based directory isolation for parallel task execution

The 12 Sessions Explained: From Agent Loop to Multi-Agent Systems

Phase 1: Core Fundamentals (s01–s02)

s01: The Agent Loop

Motto: "One loop & Bash is all you need"

The foundation of the entire curriculum, s01 establishes the perpetual LLM↔tool↔message loop in agents/s01_agent_loop.py. This session implements the minimal viable agent that can receive messages, execute bash commands, and return results to the language model.

s02: Tool Use

Motto: "Adding a tool means adding one handler"

Building on s01, s02 introduces the tool dispatch mechanism in agents/s02_tool_use.py. This session demonstrates how to extend the agent's capabilities by adding new tools to a dispatch map without modifying the core loop—establishing the extensibility pattern used throughout the curriculum.

Phase 2: Extensibility and Planning (s03–s05)

s03: TodoWrite

Motto: "An agent without a plan drifts"

s03 adds persistent task planning to the agent through the TodoWrite tool in agents/s03_todo_write.py. This session teaches how to maintain a structured todo list that survives across conversation turns, preventing the agent from losing track of multi-step objectives.

s04: Subagent

Motto: "Break big tasks down; each subtask gets a clean context"

The s04 session in agents/s04_subagent.py introduces the ability to spawn isolated sub-agents. Unlike the main agent loop, subagents receive a clean message buffer for specific tasks, preventing context pollution when handling complex, multi-file operations.

s05: Skill Loading

Motto: "Load knowledge when you need it, not upfront"

s05 implements dynamic skill loading in agents/s05_skill_loading.py. This session demonstrates how to load domain-specific knowledge (stored in the skills/ directory) only when relevant tools are invoked, rather than bloating the system prompt with unused information.

Phase 3: Scalability and Persistence (s06–s08)

s06: Context Compact

Motto: "Context will fill up; you need a way to make room"

As conversations grow, context windows fill. s06 in agents/s06_context_compact.py introduces three-layer context management: micro (recent messages), auto (summarized history), and compact (aggressive compression). This ensures the agent maintains performance during long-running sessions.

s07: Task System

Motto: "Break big goals into small tasks, order them, persist to disk"

s07 replaces simple todo lists with a persistent task graph in agents/s07_task_system.py. This session implements a DAG-based task system where tasks are stored as JSON files in .tasks/, with explicit dependency tracking (blockedBy arrays) and topological ordering for execution.

s08: Background Tasks

Motto: "Run slow operations in the background; the agent keeps thinking"

s08 in agents/s08_background_tasks.py introduces asynchronous execution. Long-running tools (like complex builds or tests) run in background threads, allowing the main agent loop to continue processing messages and maintaining responsiveness during intensive operations.

Phase 4: Collaboration and Teams (s09–s11)

s09: Agent Teams

Motto: "When the task is too big for one, delegate to teammates"

s09 in agents/s09_agent_teams.py scales the architecture from single-agent to multi-agent. This session introduces the concept of specialized agent instances that can be instantiated and delegated to, distributing workload across multiple agent processes.

s10: Team Protocols

Motto: "Teammates need shared communication rules"

Coordination requires standards. s10 in agents/s10_team_protocols.py implements structured communication protocols between agents, including message formats, handshake procedures, and error handling conventions that enable reliable inter-agent collaboration.

s11: Autonomous Agents

Motto: "Teammates scan the board and claim tasks themselves"

s11 in agents/s11_autonomous_agents.py advances from delegated tasks to autonomous behavior. Agents can now scan available tasks, evaluate their own capabilities against requirements, and claim work independently without explicit delegation from a coordinator.

Phase 5: Isolation and Final Architecture (s12)

s12: Worktree + Task Isolation

Motto: "Each works in its own directory, no interference"

The final session, s12 in agents/s12_worktree_task_isolation.py, solves the file system collision problem. Using Git worktrees, each task executes in an isolated directory (.worktrees/), ensuring that parallel agents or tasks never interfere with each other's file operations or Git state.

Key Implementation Files for the 12 Progressive Sessions

Each session corresponds to a specific Python file in the agents/ directory, with the final capstone combining all mechanisms:

Session Implementation File Capstone Integration
s01 agents/s01_agent_loop.py Base loop
s02 agents/s02_tool_use.py Tool dispatch
s03 agents/s03_todo_write.py Planning
s04 agents/s04_subagent.py Task decomposition
s05 agents/s05_skill_loading.py Dynamic knowledge
s06 agents/s06_context_compact.py Memory management
s07 agents/s07_task_system.py Persistent DAG
s08 agents/s08_background_tasks.py Async execution
s09 agents/s09_agent_teams.py Multi-agent spawn
s10 agents/s10_team_protocols.py Communication standards
s11 agents/s11_autonomous_agents.py Self-organization
s12 agents/s12_worktree_task_isolation.py Filesystem isolation
Full agents/s_full.py All mechanisms combined

Code Examples from the 12 Progressive Sessions

Running the First Session

To start with the foundational agent loop:

python agents/s01_agent_loop.py

This executes the minimal loop defined in agents/s01_agent_loop.py, establishing the core LLM↔tool↔message cycle.

Adding a New Tool (s02)

The tool dispatch mechanism allows extension without modifying the core loop:


# In agents/s02_tool_use.py

TOOLS = [
    {
        "name": "bash",
        "description": "Run a shell command",
        "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}},
    },
    # New tool added in s02

    {
        "name": "read_file",
        "description": "Read a file safely",
        "input_schema": {"type": "object", "properties": {"path": {"type": "string"}}},
    },
]

The dispatch map automatically routes read_file calls to the appropriate handler without touching the main agent loop.

Persisted Task Graph (s07)

The task system uses JSON files to maintain a persistent DAG:

// .tasks/task_2.json
{
  "id": 2,
  "subject": "Write tests for login",
  "status": "pending",
  "blockedBy": [1]   // depends on task 1
}

agents/s07_task_system.py loads all .tasks/*.json files, builds the dependency graph, and selects ready tasks where blockedBy is empty.

Worktree Isolation (s12)

The final session implements filesystem isolation using Git worktrees:


# Create a worktree for task 12

git worktree add .worktrees/auth-refactor wt/auth-refactor

agents/s12_worktree_task_isolation.py executes tools within the isolated directory specified by the task's worktree field, ensuring parallel tasks never interfere.

Summary

The 12 progressive sessions in learn-claude-code provide a methodical path from simple scripted agents to sophisticated multi-agent systems:

  • s01–s02 establish the core agent loop and tool dispatch mechanism
  • s03–s05 add planning, sub-agents, and dynamic skill loading
  • s06–s08 solve scalability through context compression, persistent task graphs, and background processing
  • s09–s11 enable multi-agent collaboration, communication protocols, and autonomous task claiming
  • s12 finalizes the architecture with Git worktree isolation for parallel task execution

Each session builds upon the previous without refactoring the core loop, culminating in agents/s_full.py, which combines all twelve mechanisms into a production-ready agent.

Frequently Asked Questions

What programming knowledge is required for the 12 progressive sessions in learn-claude-code?

You should have intermediate Python proficiency and basic familiarity with Git operations. The sessions assume understanding of asynchronous programming concepts by s08 (Background Tasks) and familiarity with JSON data structures for the task system in s07. No prior AI or LLM framework experience is required, as the curriculum builds these concepts from first principles.

How long does it take to complete all 12 sessions?

Each session represents approximately 1–2 hours of study and implementation time, meaning the full curriculum requires 12–24 hours depending on your pace. Sessions s01–s05 typically move faster as they establish single-threaded patterns, while s09–s12 require more time to understand multi-agent coordination and Git worktree mechanics.

Can I skip ahead to the multi-agent sessions (s09–s12) without completing earlier sessions?

While the code in later sessions is technically modular, the learn-claude-code curriculum is designed as a cumulative architecture where each session's abstractions build upon previous implementations. Skipping to s09 (Agent Teams) without understanding s04 (Subagent) context isolation or s07 (Task System) persistence would make the delegation mechanisms difficult to understand. The repository enforces this progression through dependent imports in the reference implementations.

What is the difference between s04 Subagent and s09 Agent Teams?

s04 Subagent implements hierarchical task decomposition where a parent agent spawns child agents to handle specific subtasks, but these subagents are transient and exist only within the context of the parent task. s09 Agent Teams introduces persistent, peer-to-peer agent processes that can operate concurrently and delegate work to each other through a mailbox system. While s04 focuses on context isolation for single-agent task breakdown, s09 establishes multi-agent collaboration with persistent team members and shared communication protocols.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →