Learn Claude Code
Bash is all you need - A nano claude code–like 「agent harness」, built from 0 to 1
Last verified:
What is Learn Claude Code?
Learn Claude Code is an educational platform and tutorial course that teaches developers how to build a Claude Code-like AI agent harness from scratch. The course provides 19 chapters across 4 stages, guiding learners from implementing a minimal agent loop to building a full multi-agent platform with an external capability bus. It follows the tagline 'Bash is all you need' and demonstrates how to construct an autonomous coding agent step by step.
The course covers core agent engineering concepts including the agent loop (send messages to LLM, execute tools, feed results back), tool dispatch systems, todo management for planning, subagent delegation for context isolation, on-demand skill loading, context compression strategies, permission systems, error recovery, task graphs with dependencies, background tasks, cron scheduling, agent teams with protocols, autonomous agent mechanisms, worktree isolation, and MCP/plugin integration. Each chapter includes working Python code, diagrams, and practical exercises.
This tool is designed for developers who want to understand AI agent architecture from first principles, engineers building their own coding agents, and anyone interested in harness engineering - the code that wraps LLMs to give them tools, context, observation capabilities, action interfaces, and permission boundaries. It is particularly valuable for those who want to move beyond using pre-built agents to understanding and building their own.
The course is entirely free and open source, hosted as a GitHub repository (shareAI-lab/learn-claude-code) with an online visualization learning platform at learn.shareai.run. It has gained over 64,000 stars on GitHub with 29 contributors, indicating strong community adoption. The content is available in both English and Chinese versions.
Learn Claude Code pricing
Pricing model: Freemium
Free - completely open source with no paid tiers. The course is hosted on GitHub (shareAI-lab/learn-claude-code) and the online learning platform at learn.shareai.run. All 19 chapters across 4 stages are freely accessible. The only cost is the LLM API usage when running the agent code yourself (e.g., Anthropic Claude API credits or compatible model API).
Learn Claude Code pros
- Teaches agent design from first principles with minimal code
- Complete agent loop fits in under 30 lines of Python
- 19 progressive chapters from basic loop to multi-agent platform
- Practical working code for each chapter with try-it exercises
- Explains the critical 'write-back' concept in agent design
- Covers context compression with four-lever strategy
- Demonstrates tool dispatch map pattern that never changes the loop
- Includes subagent pattern for clean context isolation
- On-demand skill loading avoids bloating system prompts
- Task graph system with dependencies persists to disk
- Permission system offers pipeline safety (deny, check, allow, ask)
- Open source with 64.6k GitHub stars and 29 contributors
- Available in both English and Chinese
- Free to access with no paywall
- Visual diagrams show agent architecture clearly
- Covers real-world concerns like error recovery and memory
- Teaches harness engineering distinct from model itself
Learn Claude Code cons
- Not an official Anthropic product or Claude Code replacement
- Requires Python knowledge to run the example code
- Focuses on bash-based tools, not GUI or web interfaces
- No pre-built agent - you must build it yourself
- Requires API access to an LLM (Claude or compatible)
- Some chapters assume familiarity with async patterns
- No hosted agent service - purely educational code
- Limited to coding/development tasks primarily
- No drag-and-drop interface, code-focused learning
- May be too technical for non-programmers
Frequently asked questions about Learn Claude Code
What is Learn Claude Code?
Learn Claude Code is a 0-to-1 tutorial for building a Claude Code-like agent harness from scratch. It teaches harness engineering principles through 19 progressive chapters, starting from a minimal agent loop and building up to a multi-agent platform. It is educational content from shareAI-lab, not an official Anthropic product.
How does the agent loop work?
The agent loop is simple: send messages to the LLM with tool definitions, check if the model calls a tool, execute the tool(s), feed the results back into the conversation as a new message, and repeat until the model stops calling tools. The entire agent fits in under 30 lines of Python with a while True loop checking stop_reason.
Do I need to change the loop when adding new tools?
No. The key insight is that adding a tool means adding one handler to the TOOL_HANDLERS dispatch map dictionary. The loop body itself never changes - it just looks up the handler by name and executes it. Add a tool equals add a handler plus add a schema entry.
What is the todo tool used for?
The todo tool with TodoManager keeps the agent on track during complex multi-step tasks by maintaining a visible plan with statuses (pending, in_progress, completed). It prevents the model from drifting, repeating work, or skipping steps. The nag system injects a reminder if the model goes 3+ rounds without calling todo.
Why use subagents?
Subagents provide context isolation for side tasks. A subagent starts with fresh empty messages=[], does all the messy exploration, and returns only a short summary to the parent. The subagent's full message history is discarded, keeping the parent context clean and saving tokens on future API calls.
How does skill loading work?
Skills use a two-layer approach: Layer 1 puts skill names and descriptions in the system prompt (cheap, ~100 tokens/skill), while Layer 2 loads the full skill body via the load_skill tool only when the model requests it (~2000 tokens). Each skill is a directory with SKILL.md containing YAML frontmatter and instructions.
What if the context window fills up?
The course implements four-lever compression: Lever 0 persists large outputs (>50KB) to disk with preview markers; Lever 1 silently replaces old tool results with placeholders; Lever 2 auto-compacts when token threshold is crossed by summarizing; Lever 3 allows manual compact via tool. Transcripts are saved to disk so nothing is permanently lost.
How does the task system differ from todo?
Todo is a flat in-memory checklist for single sessions. The task system (s07) is a file-based task graph with dependencies (blockedBy, blocks), status transitions (pending -> in_progress -> completed), and persistence to disk. Tasks survive compression and restarts, and the graph answers what's ready, what's blocked, and what can run in parallel.
What permissions does the system offer?
The permission system treats safety as a pipeline, not a boolean. It offers four modes: deny outright, check mode (simulate without executing), allow automatically, and ask for user confirmation. Path sandboxing prevents workspace escape with safe_path() validation.
Can I run multiple agents as a team?
Yes, s15-s16 cover agent teams where teammates persist beyond one prompt, have identity, and coordinate through durable channels. Team protocols use structured messages with IDs where responses must reference the same ID. The task graph from s07 becomes the coordination backbone for multi-agent collaboration.