Open-source project
shareAI-lab/claw0 avatar
shareAI-lab/claw0

claw0: A Ten-Section Python Course That Builds an Agent Gateway, Not a Chat Wrapper

0 - 1 learn OpenClaw: sections to build an claw-AI agent from scratch

3,346 stars385 forksPythonLicense varies

At a glance

What is it?
shareAI-lab's claw0 teaches agent infrastructure through ten runnable Python files, moving from a while loop to named concurrency lanes. It is a reading-and-typing course aimed at engineers who already write Python, and its dependency graph is the most honest part of the repository.
Who is it for?
Adopt claw0 if you already write Python and want to understand what sits between a model API and a deployed agent: the README's dependency graph, the workspace markdown files and the JSONL session format are the parts worth reading closely. Do not adopt it if you want a library to import or a framework to extend, because every section is a standalone teaching file and the README describes no packaging, no test suite and no release.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 77 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The gap claw0 targets: tutorials that stop at one API call

The README states the problem directly: most agent tutorials stop at "call an API once." claw0 starts at that point instead. The repository is a sequence of ten sections, each a single runnable Python file, that walks from a bare agent loop to something the README calls a production-grade gateway. The stated end goal is that after all ten sections, a reader can read OpenClaw's production codebase with confidence. That is a specific and checkable ambition, and it shapes every design decision in the repo.

The audience is narrow on purpose. You need Python 3.11 or newer, an Anthropic API key or a compatible provider, and enough patience to read roughly 7,000 lines of Python spread across the sections. This is not a no-code introduction to agents and it is not a library you install and call. It is a course for backend engineers who have already built something with an LLM API and now want to know what the surrounding infrastructure looks like when it stops being a script.

Ten sections, one new concept each, and a dependency graph that admits the shape

The section list is the clearest statement of scope. s01 is the agent loop: while True plus stop_reason. s02 adds tool use as a dispatch table. s03 introduces sessions with JSONL persistence and a three-stage retry. s04 covers channels, specifically Telegram and Feishu. s05 is the gateway with a five-tier binding table. s06 is labelled Intelligence and covers soul, memory, skills and prompt assembly. s07 adds heartbeat and cron. s08 is delivery, described as a write-ahead queue with backoff. s09 is resilience, a three-layer retry onion with auth profile rotation. s10 is concurrency, where named lanes serialize work.

The README gives a dependency graph rather than pretending the sections are independent. s01 and s02 are the foundation. s03 builds on s02. s04 builds on s03, s05 builds on s04, and s06 branches back to s03. s07 builds on s06, s08 builds on s07, s09 builds on s03 and s06, and s10 builds on s07. That branching is worth noting: s09 and s10 are not a linear continuation, they are revisions of earlier layers. s10 in particular is described as replacing a single Lock with a named lane system, which means it reworks s07's concurrency model rather than adding a new feature on top. If you read out of order, s10 will not make sense without s07.

The architecture is a stack of concerns, and the line counts tell you where the weight sits

The architecture diagram in the README is a vertical stack, and the per-section line counts give a rough sense of where the difficulty concentrates. s01 is about 175 lines. s02 jumps to roughly 445. s03 is around 890, s04 around 780, s05 around 625. s06 is about 750, s07 about 660, s08 about 870. Then s09 is roughly 1,130 lines and s10 roughly 900.

Those numbers are useful for planning. The first two sections are a short afternoon. The middle sections are where the file sizes roughly double and triple, because persistence, channel adapters and routing tables carry more incidental code than a loop does. s09 being the largest section is consistent with its description: a three-layer retry onion with auth rotation, overflow compaction and a tool-use loop is three mechanisms in one file. If you only have time for part of the course, the README's own framing suggests the later sections are where the production vocabulary lives, and those are also the sections that assume the earlier ones are still loaded in your head.

Getting a section running: clone, install, set two keys, pick a language folder

The Quick Start is short and concrete. Clone the repository and enter it, install dependencies from requirements.txt, copy .env.example to .env, and set ANTHROPIC_API_KEY and MODEL_ID in that file. Then run any section directly, for example python sessions/en/s01_agent_loop.py for English, sessions/zh/ for Chinese, or sessions/ja/ for Japanese.

The dependency list is worth reading before you start, because it is wider than a pure teaching repo would need. It pins anthropic>=0.39.0, python-dotenv>=1.0.0, websockets>=12.0, croniter>=2.0.0, python-telegram-bot>=21.0 and httpx>=0.27.0. The websockets dependency lines up with the gateway section, croniter with the cron scheduler, and python-telegram-bot with the channel section. That means a fresh install pulls in a Telegram client library even if you never intend to touch s04. There is no separate requirements file per section mentioned in the README, so the install is all-or-nothing.

The workspace directory is a separate piece of configuration that the README lists but does not explain in the Quick Start. It contains SOUL.md, IDENTITY.md, TOOLS.md, USER.md, HEARTBEAT.md, BOOTSTRAP.md, AGENTS.md, MEMORY.md, a CRON.json and a skills/example-skill/SKILL.md. The s06 description says the system prompt is files on disk and that swapping files changes personality. So the workspace folder is not decoration; it is the configuration surface for the intelligence section, and you should expect to edit these files rather than only the .env.

Three languages, one codebase: what is actually shared

The repository ships the same ten sections in English, Chinese and Japanese, each as a .py file paired with a .md file. The README is explicit about what differs: code logic is identical across languages, while comments and docs differ. That is a deliberate choice and it has a practical consequence. If you read the English section and then open the Chinese one to compare, you are reading the same program with different prose around it. The value of the multilingual layout is documentation reach, not three implementations to compare.

It also means the maintenance story is roughly three times the documentation cost for one code cost. Every time a section's code changes, three sets of comments and three markdown files describe it. The README does not describe an automated check that keeps the three language folders in sync, and no releases are listed, so there is no changelog to inspect for how often that has gone wrong. Treat the three folders as one course with three transcriptions rather than three independent tracks.

Where claw0 is the wrong tool, and what learn-claude-code does differently

The most important limitation is stated by the repository itself. The Related Projects section points to learn-claude-code, described as a companion teaching repo that builds an agent framework, a nano Claude Code, from scratch in twelve progressive sessions. claw0 focuses on the gateway. The difference in approach is architectural: learn-claude-code builds the agent itself, while claw0 builds the infrastructure around it, the routing, sessions, queues, retries and lanes that a deployed agent needs. If your question is how to structure an agent's reasoning loop or its tool surface, the companion repo is the closer match. If your question is how messages get from a Telegram chat to a specific agent and back without being lost when the process crashes, claw0 is aimed at you.

The second limitation is that this is a course, not a dependency. There is no packaging, no versioned release and no library entry point described in the README. The sections are standalone teaching files, and the README does not describe a test suite. That matters if you were hoping to lift the delivery queue or the lane system into your own service: you would be copying code out of a teaching file, and you would be responsible for whatever the surrounding assumptions were. The README also gives no license identifier, so the terms under which you could reuse that code are not stated in the material available here. If reuse is the plan, that is the first thing to resolve.

The third limitation is the provider assumption. Prerequisites name Anthropic or a compatible provider, and the dependency pin is on the anthropic SDK. The README does not describe an abstraction layer for swapping providers, so the sections are written against that API shape. If you are standardised on a different vendor, expect the model-calling code in each section to need rework, and expect that rework to touch more than one file.

Maintenance, licence and what to check before you spend a week on it

The repository is not archived, and the last push recorded is 2026-06-30. No releases are listed, which is consistent with a teaching repo that has no distribution artefact, but it also means there is no version history to read for breaking changes. The licence field is unknown in the material available, and the README does not state one. Without a licence you have no stated permission to reuse the code, so if your interest is copying the delivery queue or the lane system into a product, resolve that before you start, and treat it as a question for whoever handles licensing at your organisation rather than something to infer from the repository layout.

The upgrade cost is mostly your own. Dependencies are pinned with lower bounds rather than exact versions, so a fresh pip install will pull current releases of anthropic, websockets, croniter and python-telegram-bot. The README gives no tested version matrix. If a section fails after an install, the first thing to check is whether a dependency has moved past the API the section was written against, starting with the anthropic SDK because every section depends on it.

What to verify before committing time is narrow and specific. Confirm Python 3.11 or newer. Confirm your provider works with the anthropic SDK version that requirements.txt resolves to, and that MODEL_ID is set to a model your key can actually call. Then decide whether s04's Telegram and Feishu pipelines matter to you, because they are the reason python-telegram-bot and httpx are in the install, and skipping them does not remove those dependencies. If you only want the loop, the tools and the session format, the first three sections are self-contained and the dependency list will still be the full one.

Editorial conclusion

Adopt claw0 if you already write Python and want to understand what sits between a model API and a deployed agent: the README's dependency graph, the workspace markdown files and the JSONL session format are the parts worth reading closely. Do not adopt it if you want a library to import or a framework to extend, because every section is a standalone teaching file and the README describes no packaging, no test suite and no release. Before committing time, verify three things yourself: that Python 3.11 or newer is available, that your provider works with the anthropic SDK version pinned in requirements.txt, and that the Telegram and Feishu sections in s04 are relevant to you, since they pull in python-telegram-bot and httpx and are the heaviest non-core dependencies in the tree.

Official sources

  1. Issues
  2. README
  3. shareAI-lab/claw0 on GitHub
Community notes

Community notes