d-wwei

Build Your Own Agent — AI skill for Claude Code

AI community

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

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 ~