learn-agent

by 7-e1evenVerified

学习Agent开发的笔记,尝试让Agent从可用到可靠

271
Stars
14
Forks
JavaScript
Language
8/23/2026
Added
View on GitHubDownload ZIP

⚠️ Third-Party Software Notice

This skill is third-party open-source software developed and hosted independently on GitHub. SkillTip is an informational directory and does not control or maintain the underlying repository. Any security checks displayed are automated and limited in scope. Review the source code before installing.

Read the Terms of Service

Installation

Add to your Claude Code skills directory:

# Add to your Claude Code skills
git clone https://github.com/7-e1even/learn-agent

Getting Started

Guides for using skills like learn-agent.

Security Report

Verified

Last scanned: —

{
  "status": "PASSED",
  "issues": []
}

README.md

learn-agent · AI Agent 开发笔记

简体中文 · English

开发桌面 agent Reina 过程中记下的笔记,讲 coding agent(Claude Code、Codex、opencode 这类工具)的内部实现机制。每篇讲一个机制,把 Reina 里的生产实现简化成零依赖、单文件、可直接运行的 Node 程序——所以这些做法不是照 API 文档推想的,是实际产品里验证过的。

所有机制最终都建立在同一个循环上

仓库分三块:notes/ 是正篇笔记(s01–s23,每篇一个机制,配可运行 demo);agent_analysis/ 是其他 agent(pi、Kimi CLI)的源码调研档案,笔记从这里取材;interview/ 是从笔记整理的面试题(连载中)。

运行

Node 18+,零依赖:

git clone https://github.com/7-e1even/learn-agent && cd learn-agent
AGENT_API_KEY=sk-xxx node notes/s01_agent_loop/agent.mjs

任何 OpenAI 兼容的 API key(DeepSeek / Kimi / GLM / OpenRouter / 本地 Ollama)都行;没有 key 的话,多数章节的 demo.mjss12 的自测模式不需要 key。

clone 之后可以一键验证所有免 key 的示例:node selftest.mjs——20 个章末 demo 加 s12 的整合自测,十几秒跑完。

目录

s01–s12 从零搭出一个完整可用的 agent,按顺序读;s13 之后是开发 Reina 时陆续踩到、记下来的边界问题,挑感兴趣的读。每篇结尾附 Reina 中对应生产实现的位置。

#主题要解决的问题
s01Agent 主循环最小可用的 agent 长什么样
s02工具系统工具越加越多,怎么不用每次都改循环
s03循环预算与纠偏模型原地打转、反复报错,怎么发现并拉回来
s04工具输出预算与溢出一条 cat 的输出就能撑爆上下文,怎么办
s05流式输出与中断用户按下 Ctrl+C,断在一半的消息记录怎么修
s06上下文压缩上下文满了要压缩,怎么不忘掉最初的任务
s07Prompt 缓存同样的对话,为什么有人的账单贵 10 倍
s08会话持久化与恢复进程崩了,跑了半小时的会话怎么接着跑
s09子代理与看门狗子任务卡死了,怎么发现它并保住已完成的部分
s10System prompt 组装system prompt 越写越长,怎么按需拼装
s11多 agent 协作几个 agent 同时干活,怎么分工不重复不冲突
s12完整 agent 整合前面所有机制装回一个循环里是什么样
s13权限与审批模型要执行 rm -rf,怎么在动手前拦住
s14Provider 兼容层换个模型 tool call 格式全乱,怎么兼容
s15渐进式工具披露工具有几十个,怎么不把上下文塞满
s16MoA 多模型合议让多个模型一起商量,到底值不值
s17自进化复盘环agent 能不能自己复盘对话,把学到的沉淀成记忆和技能
s18自主任务的完成门agent 说"做完了",凭什么信
s19压缩与缓存的冲突压缩必然击穿缓存,怎么把损失降到最低
s20自动长期记忆跨项目自动沉淀该记住的事,不烧钱也不攒垃圾
s21横读其他 agent同一道题,pi 和 Kimi CLI 为什么给出相反的答案
s22思考档位思考档位从滑块到 API 请求,中间要过哪几关
s23图片输入一张 8MB 截图进上下文,要过哪几层处理

发现事实错误或代码 bug 欢迎提 issue。MIT License · © 2026 7-e1even

Frequently Asked Questions

What is learn-agent?

learn-agent is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by 7-e1even. 学习Agent开发的笔记,尝试让Agent从可用到可靠. It has 271 GitHub stars.

Is learn-agent safe to use?

Yes. learn-agent passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install learn-agent?

Clone the repository with "git clone https://github.com/7-e1even/learn-agent" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is learn-agent written in?

learn-agent is primarily written in JavaScript. It is open-source under 7-e1even on GitHub, so you can review or fork the full source.

Are there alternatives to learn-agent?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh learn-agent against similar tools.

Comments (0)

No comments yet. Be the first to share your thoughts!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI Agents
View details

Developers Also Liked

Based on votes and bookmarks from developers who liked this skill

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI Agentsai-agentsanthropicclaude-code
View details
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI Agentsai-agentsbrainstorming
View details

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP Serversapisai-tools
View details

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI Agentsai-agentsanthropicclaude-code
View details

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI Agentsclaude-codeai-tools
View details