Learn how a coding agent's core loop, tool system, and budgets actually work by running small standalone examples.
Study specific edge cases like context compaction, prompt caching, or permission gating before building your own agent.
Use each chapter as a reference implementation to compare against your own agent framework.
| 7-e1even/learn-agent | siigari/claude-heartbeat | tasihi89/canvas-hand | |
|---|---|---|---|
| Stars | 160 | 161 | 165 |
| Language | JavaScript | JavaScript | JavaScript |
| Setup difficulty | easy | moderate | easy |
| Complexity | 2/5 | 3/5 | 2/5 |
| Audience | developer | developer | vibe coder |
Figures from each repo's GitHub metadata at analysis time.
Needs an OpenAI compatible API key for most chapters, though several demos and the final self test run without one.
Learn Agent is a set of notes written while building a desktop AI agent called Reina, explaining how coding agent tools like Claude Code, Codex, and opencode actually work under the hood. Each chapter covers one mechanism and reduces the real production implementation from Reina into a small, dependency free, single file Node.js program you can run directly, so the ideas come from a working product rather than guesses based on API documentation alone. To try it, you need Node 18 or newer and any OpenAI compatible API key, such as DeepSeek, Kimi, GLM, OpenRouter, or a local Ollama setup. Many of the demo scripts and the self test mode in the final chapter do not require a key at all. The chapters are meant to be read roughly in order. The first twelve build up a complete, usable agent from scratch, covering the core agent loop, a growing tool system, budgets for loop steps and tool output, streaming output with interruption handling, compressing context without losing the original task, prompt caching to control cost, saving and resuming a session after a crash, running sub agents with a watchdog for stuck tasks, assembling the system prompt on demand, and coordinating multiple agents at once. The chapters after that cover edge cases found while building Reina in practice: permission checks before running risky commands, handling different providers whose tool call formats do not match, revealing tools gradually instead of dumping them all into context, whether letting multiple models deliberate together is worth it, letting an agent reflect on its own conversations to build memory and skills, deciding when an agent is truly allowed to say a task is done, resolving the conflict between context compression and prompt caching, and building long term memory that carries across projects without wasting money or accumulating clutter. Each chapter's writeup ends by pointing to where the matching production code lives in the Reina repository. The project is released under the MIT License.
A chapter by chapter set of runnable Node.js notes explaining how real coding agents like Claude Code and Codex work internally, distilled from a production agent.
Mainly JavaScript. The stack also includes JavaScript, Node.js.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.