How shareAI-lab Built claw0 to Teach OpenClaw Agents from Scratch
Built by shareAI-lab · · Source: GitHub
Result: The README states no measured results. The repo page shows 3.4k stars and 388 forks.
What they built
shareAI-lab published claw0, an open source teaching repo for people who want to understand how an OpenClaw style agent works by building one. According to the README, it has 10 progressive sections, each one a single Python file you can run, adding up to about 7,000 lines of Python. Each section adds one idea and keeps the earlier code intact.
The README says the goal is to go past tutorials that stop at calling an API once, so that by the end you can read OpenClaw's production codebase with confidence. The code and docs come in English, Chinese and Japanese. The repo is MIT licensed.
How it works
The sections build on each other in this order, per the README:
- s01 Agent Loop: a loop that keeps going based on the model's stop reason.
- s02 Tool Use: tools defined as a schema plus a handler map. The model picks a name and the code looks it up.
- s03 Sessions: history saved as JSONL, replayed on read, and summarized when it gets long.
- s04 Channels: Telegram and Feishu messages normalized into one inbound message format.
- s05 Gateway: a five-tier binding table that maps a channel and peer to an agent, with the most specific match winning.
- s06 Intelligence: a system prompt assembled from files on disk for soul, memory and skills.
- s07 Heartbeat and Cron: a timer thread that decides whether to run, plus scheduled tasks.
- s08 Delivery: messages written to disk before sending so a crash doesn't lose them.
- s09 Resilience: three layers of retry covering auth rotation, overflow compaction and the tool loop.
- s10 Concurrency: named lanes with FIFO queues.
Setup is short. You clone the repo, install the requirements with pip, copy the example .env file, set your Anthropic API key and model ID, then run a section file such as the s01 agent loop. The README lists Python 3.11 or newer and an API key for Anthropic or a compatible provider as prerequisites. A sample workspace folder includes files like SOUL.md, MEMORY.md, HEARTBEAT.md, CRON.json and an example skill.
The README also points to a companion repo, learn-claude-code, which builds a small Claude Code style agent framework in 12 sessions.
The result
The README makes no claims about measured results or users. The GitHub page shows 3.4k stars and 388 forks.
How to build something similar
- Start with the smallest working agent you can: one loop, one model call, one tool. Get it running before you add anything.
- Add one capability at a time, such as saved sessions, then a chat channel, then scheduled tasks. Keep each step runnable so you can see exactly what the new piece changed.
- Keep the agent's personality, memory and skills in plain files on disk. That makes them easy to read, edit and version.
- Leave retries, crash safety and concurrency for last. They make more sense once you've watched the simple version fail.
The original post
Want to build something like this?
Join the Shipping Skool community free. Paid members get live bootcamp calls every week.
Join Shipping Skool — Free