Build Your Own Agent — AI skill for Claude Code
Build your own AI Agent from scratch — 11 architecture modules + 6 emergent behaviors, extracted from 600K lines of production Agent source code.
How to install Build Your Own Agent
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open d-wwei/build-your-own-agent and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Build Your Own Agent does
Build your own AI Agent from scratch — 11 architecture modules + 6 emergent behaviors, extracted from 600K lines of production Agent source code. Step-by-step guides with best practices from hermes-agent, openclaw, NemoClaw, and Claude Code. Bilingual: EN + ZH.
Alternatives in AI
- System Prompts Leaks — Extracted system prompts from ChatGPT (GPT-5.4, GPT-5.3, Codex), Claude (Opus 4.6, Sonnet 4.6, Claude Code), G 38.6k ★
- Claw0 — 0 - 1 learn OpenClaw: sections to build an claw-AI agent from scratch 2.6k ★
- Obsidian + Claude Code: Rebuild Your Second Brain With AI — Build an AI-powered personal knowledge management system from scratch 540 ★
README
Build Your Own Agent
**[中文版 →](README_zh.md)**
**What I cannot create, I do not understand.** — Richard Feynman
4 production Agent projects. ~600,000 lines of code. Distilled into 11 architecture modules and 6 emergent behavior patterns.
This is a step-by-step guide to building AI Agents from scratch — not from theory, not from framework docs, but from patterns extracted from real, working code.
Architecture Overview
flowchart TB
subgraph SE["🔒 Security / Policy Envelope — optional, Agent-unaware"]
direction TB
IF["📡 Interface
CLI · Chat Platforms · Web · API inbound · MCP inbound · ACP"]
subgraph GR["🚪 Gateway + Routing — optional, multi-user/multi-agent only"]
G["Gateway
Auth · Rate Limit
Method Dispatch"]
R["Routing
Which Agent?
Which Session?
Binding Match"]
end
subgraph AC["⭐ Agent Core — the Orchestrator"]
direction TB
CORE["Conversation Loop · Context Construction · Sub-Agent Delegation · Iteration Budget
↕ Session Store (SQLite/JSONL) · Config Store (YAML/JSON)"]
subgraph PEERS[" "]
direction LR
M["🧠 Model
Provider Routing
Failover Chain
Prompt Cache
Token Estimation
↕ No storage"]
T["🔧 Tools
Register · Discover
Dispatch · Parallel
MCP outbound
Security Approval
↕ Skill Store"]
MEM["🧩 Memory
Dual Role:
① Tool — LLM calls
② Infra — Core injects
↕ Memory Store"]
CTX["📐 Context Mgr
Compression
Tool Result Pruning
Token Budget
↕ No storage"]
end
end
end
RT["🖥️ Runtime — local process / Docker / OpenShell sandbox / cloud"]
INFRA["🏗️ Infrastructure — Blueprint plan/apply · Health check · Rollback"]
IF --> GR
GR --> AC
AC ~
Related Skills
ShriForgeAISkill
Open-source AI Agent Skill for planning, designing, building, auditing, optimizing, and shipping production-re
Claude Code From Scratch
Build an AI Coding Agent from Scratch — Learning Context Engineering Step by Step. Companion code for the book
Vibe Coding Toolkit
A curated, battle-tested AI-coding toolkit: Claude Code plugins, subagent orchestration, quality gates, and re
Claude Code Sourcemap Learning Notebook
Reverse-engineering Claude Code's 512K+ lines of TypeScript — architecture, design decisions, and 11 transfera
AI Agents Workshop
2-hour workshop: build an AI agent in under 150 lines of Node.js. Concepts, architecture, failure modes, and l
Claude Code 2.1.88
Source code of @anthropic-ai/claude-code v2.1.88, extracted from the npm package's source map (cli.js.map). 1,
Related Agents
Feature Planner
Plans feature architecture before implementation. Use when designing new screens, managers, modules, or multi-
File Refactor Organizer
Use this agent when you need to break down large files into smaller, more maintainable components or modules.
Agency Incident Commander
Production incident management — SEV1-4 framework, blameless post-mortems, on-call process. Use při Flash VPS