Learn Agent — Development skill for Claude Code
用 LangChain + DeepSeek 从零实现类 Claude Code 的编码智能体 —— 17 章渐进式,每章引入一个机制,主循环结构自始至终不变.
How to install Learn Agent
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open old-rut/learn-agent and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Learn Agent does
用 LangChain + DeepSeek 从零实现类 Claude Code 的编码智能体 —— 17 章渐进式,每章引入一个机制,主循环结构自始至终不变.
Alternatives in Development
- Learn Coding Agent — Research on Coding Agents 12.2k ★
- Learn Eval — 从会话中提取可复用的模式(Patterns),在保存前进行质量自评,并确定合适的保存位置(全局 vs 项目) 1.9k ★
- Learn 1.5k ★
README
learn-agent
用 **LangChain + DeepSeek** 从零实现一个类 Claude Code 的编码智能体。
每章引入一个新机制,主循环的核心结构自始至终不变 —— 变的只是循环周围的东西。
课程结构参考 [shareAI-lab/learn-claude-code](https://github.com/shareAI-lab/learn-claude-code), 本项目是它的重新实现 —— 代码完全重写为 LangChain 的 `init_chat_model` / `@tool` / `bind_tools`, 运行环境改为 Windows + PowerShell 7。详见文末[致谢](#致谢)。
章节
与原项目一一对应,共 17 章。**带链接的是已实现的章节**,其余在陆续补上:
| 章节 | 主题 | 关键技术点 |
|---|---|---|
| s01 Agent Loop | 一个 while + 一个工具 |
messages / tool_calls / 结果回流 |
| s02 Tools | 5 个工具 + 工作区防护 | 工具 schema / safe_path / 错误返回而非抛出 |
| s03 Permission | 三层权限门控 | 硬拒绝 / 规则匹配 / 用户审批 / PowerShell 别名 |
| s04 Hooks | 扩展逻辑与主循环解耦 | PreToolUse / PostToolUse / Stop |
| s05 TodoWriter | 先计划再执行 | Pydantic schema / 跨元素校验 / 三轮催促 |
| s06 Subagent | 上下文隔离 | 全新 messages / 只回传最终结论 |
| s07 SkillLoader | 技能按需加载 | 目录常驻 / frontmatter 扫描 / 渐进式披露 |
| s08 ContextCompact | 上下文压缩 | 三区划分 / 比例配额 / 官方词表计量 / 中间件注入 |
| s09 Memory | 记忆系统 | PreAgent 召回 / PostAgent 提炼 / 去重与合并 / 显式 /remember |
| s10 Task System | 任务系统 | TaskRecord / blockedBy / 落盘持久化 |
| s11 Background Tasks | 后台任务 | 线程执行 / 通知队列 |
| s12 Cron Scheduler | 定时调度 | 持久化调度 / 会话级触发 |
| s13 Agent Teams | 智能体团队 | 常驻队友 / 原子认领 / 任务级 worktree / 类型化协议 |
| s14 MCP Plugin | MCP 插件 | 工具发现 / 命名空间 / 工具池装配 |
| s15 Integrated Harness | 集成 | 工具、上下文、任务、团队、调度、MCP 围绕一个循环 |
| s16 Workflow Runtime | 工作流运行时 | 脚本编排 / 生命周期事件 / journal 恢复 |
| s17 Goal Loop | 目标循环 | 目标闸门 / 会话评估 / 自动续跑 |
每章目录下的 README 都以「问题 → 方案 → 代码怎么走 → 跑起来」的顺序讲这一章, 顶部导航行标出它在整条路线上的位置。
环境
- Python ≥ 3.12
- Windows + PowerShell 7(路径写在
config.py的PS7_PATH,默认C:\Program Files\PowerShell\7\pwsh.exe) - uv 管理依赖
- 一个 DeepSeek API Key
uv sync
cp .env.example .env # 然后填入 DEEPSEEK_API_KEY
`.env` 会被 `.gitignore` 排除,不会被提交。
运行
命令行
各章入口脚本所在目录会进入 `s
Related Skills
Learn Langchain With Phoebe
From a 40-line agent loop to a governed multi-agent system. Leader track to decide, builder track to ship - on
Langchain Skills
⚠️ — This project is in early development. APIs and skill content may change.
Openapis
Free Claude API + free OpenAI API in one unified proxy. Drop-in compatible with Anthropic SDK, OpenAI SDK, Cla
Langchain Multi Agent Example
Comprehensive tutorial and code examples for building multi-agent systems with LangChain
Langchain Plugins
Cross-tool plugin marketplace for deepagents-code (dcode), Claude Code, and OpenAI Codex — LangChain & LangSmi
Langchain Agent
LangChain/LangGraph Agent Development Expert
Related Agents
Agentic AI Dev
Expert Agentic AI developer with Python 3.14, LangChain v1.2.8, LangGraph v1.0.7, and FastAPI 0.135.2. Use for
Hephaestus.Agent
AI tooling & pipelines specialist — LangChain/LangGraph chains, RAG architecture,
AI LLM Engineer
Use this agent when the user types /ai or asks for ai/llm engineer work — e.g., build a RAG pipeline over our