Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

总结

12 个 Session 回顾

Session主题一句话总结
s01The Agent LoopOne loop & Bash is all you need
s02Tool UseAdding a tool means adding one handler
s03TodoWriteAn agent without a plan drifts
s04SubagentsBreak big tasks down; each subtask gets a clean context
s05SkillsLoad knowledge when you need it, not upfront
s06Context CompactContext will fill up; you need a way to make room
s07Task SystemBreak big goals into small tasks, order them, persist to disk
s08Background TasksRun slow operations in the background; the agent keeps thinking
s09Agent TeamsWhen the task is too big for one, delegate to teammates
s10Team ProtocolsTeammates need shared communication rules
s11Autonomous AgentsTeammates scan the board and claim tasks themselves
s12Worktree IsolationEach works in its own directory, no interference

四个阶段

Phase 1: THE LOOP                    Phase 2: PLANNING & KNOWLEDGE
==================                   ==============================
s01  The Agent Loop                  s03  TodoWrite
     while + stop_reason                  TodoManager + nag reminder
     |                                    |
     +-> s02  Tool Use                  s04  Subagents
              dispatch map                   fresh messages[]
                                              |
                                         s05  Skills
                                              SKILL.md via tool_result
                                              |
                                         s06  Context Compact
                                              3-layer compression

Phase 3: PERSISTENCE                 Phase 4: TEAMS
==================                   =====================
s07  Tasks                           s09  Agent Teams
     file-based CRUD + deps graph        teammates + JSONL mailboxes
     |                                    |
s08  Background Tasks                s10  Team Protocols
     daemon threads + notify queue       shutdown + plan approval FSM
                                          |
                                     s11  Autonomous Agents
                                          idle cycle + auto-claim
                                     |
                                     s12  Worktree Isolation
                                          task coordination + isolated lanes

核心公式

Agent = Model(模型即智能体)

Harness = Tools + Knowledge + Context + Permissions

Product = Agent + Harness

The Agent Pattern

flowchart TD
    A[User] --> B["messages[]"]
    B --> C[LLM]
    C --> D{"stop_reason == tool_use?"}
    D -->|yes| E[execute tools]
    D -->|no| F[return text]
    E --> G[append results]
    G --> B

关键洞察

  1. 循环不变,工具插件化 – 从 s01 到 s12,Agent Loop 本身从未改变,变化的是周围的 harness 机制

  2. 上下文是稀缺资源 – s04(Subagent 隔离)、s05(Skills 按需加载)、s06(Context Compact)都在解决同一个问题:保持上下文清洁

  3. 持久化是协作的基础 – s07(Task System)和 s12(Worktree)将状态写入磁盘,使多 Agent 协作成为可能

  4. 状态机驱动协作 – s10-s12 用 FSM 管理队友状态和请求审批,实现自组织的团队


The model is the agent. The code is the harness. Build great harnesses. The agent will do the rest.