whatisgithub

What is learn-agent?

7-e1even/learn-agent — explained in plain English

Analysis updated 2026-05-18

160JavaScriptAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

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.

Mindmap

mindmap
  root((repo))
    What it does
      Agent mechanism notes
      Runnable Node examples
      Reina production links
    Tech stack
      Node.js
      OpenAI compatible APIs
    Use cases
      Learn agent internals
      Reference implementations
      Compare with own framework
    Audience
      Agent developers
      AI engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Learn how a coding agent's core loop, tool system, and budgets actually work by running small standalone examples.

USE CASE 2

Study specific edge cases like context compaction, prompt caching, or permission gating before building your own agent.

USE CASE 3

Use each chapter as a reference implementation to compare against your own agent framework.

What is it built with?

JavaScriptNode.js

How does it compare?

7-e1even/learn-agentsiigari/claude-heartbeattasihi89/canvas-hand
Stars160161165
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasymoderateeasy
Complexity2/53/52/5
Audiencedeveloperdevelopervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Needs an OpenAI compatible API key for most chapters, though several demos and the final self test run without one.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

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.

Copy-paste prompts

Prompt 1
Explain how the loop budget mechanism in chapter s03 detects a model stuck in a loop.
Prompt 2
Walk me through running the s01 agent loop example with a DeepSeek or OpenRouter API key.
Prompt 3
How does this project handle context compaction without losing the original task in s06?
Prompt 4
Summarize the difference between the permission chapter s13 and the provider compatibility chapter s14.

Frequently asked questions

What is learn-agent?

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.

What language is learn-agent written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

What license does learn-agent use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is learn-agent to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is learn-agent for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.