Chapter Map

July 8, 2026 · View on GitHub

This tutorial keeps 24 chapters on purpose. The chapters are not separate products; each one isolates one harness mechanism so a reader can build, run, and understand it before the next layer appears. The machine-checkable version of that ladder lives in Progression Contract.

Should Any Chapters Be Merged?

Not now. Some topics are adjacent, but merging them would make the learning curve worse:

Adjacent ChaptersWhy Keep Separate
s05 Electron Shell / s06 Sidecar / s07 SessionUI process isolation, sidecar control plane, and session lifecycle are three different failure domains.
s10 Workspace Memory / s11 User Memory / s12 Cloud MemoryThe storage location, ownership, update policy, and retrieval timing are different.
s16 Skills / s17 MCP / s18 ExpertsSkills add instructions, MCP adds external tools, Experts package persona + memory + tools.
s21 SQLite / s22 Automation / s23 AuditPersistence, scheduling, and security governance share infrastructure but answer different production questions.

The right improvement is enrichment, not compression: better prerequisites, clearer architecture notes, and stronger cross-chapter links.

Module 1: Agent Core

ChapterMechanismBuild Outcome
s01 Agent LoopReAct-style loop with tool callsA minimal agent loop.
s02 Tool DispatchTool registry and handler dispatchAdd tools without changing the loop.
s03 Deferred LoadingTool discovery before schema loadingKeep startup prompt small.
s04 Permission & HooksTiered trust and hook gatesLet the agent act inside safe boundaries.

Module 2: Desktop Runtime

ChapterMechanismBuild Outcome
s05 Electron ShellMain/renderer/preload process splitUnderstand desktop app boundaries.
s06 Sidecar ServerJSON-RPC control plane and ring bufferKeep agent work outside the UI process.
s07 Session ManagementPer-session process lifecycleRun isolated work sessions.
s08 Model RoutingCheap model for routing, stronger model for reasoningMatch model cost to task complexity.
s09 JSONL TranscriptAppend-only event streamRecover and replay sessions.

Module 3: Context & Memory

ChapterMechanismBuild Outcome
s10 Workspace MemoryProject-local logs and curated memoryRemember current project work.
s11 User MemoryCross-project preferences and identityCarry stable user context.
s12 Cloud MemoryServer-side profile and history recallRetrieve long-horizon context.
s13 Output ExternalizationSwap large tool output to diskKeep context small.
s14 Context CompactStructured compression before overflowContinue long sessions.
s15 Prompt AssemblyRuntime prompt compositionAssemble exactly the context needed.

Module 4: Extension System

ChapterMechanismBuild Outcome
s16 Skills SystemInstruction packages with optional scripts/assetsAdd capabilities without changing core code.
s17 MCP ConnectorsExternal tool protocol and trust modelConnect third-party services safely.
s18 Experts SystemDomain bundles of persona, memory, and toolsSwitch working modes cleanly.
s19 VisualizerStructured output to diagrams/UI artifactsTurn agent output into inspectable views.
s20 Result PresentationPrioritized deliverablesPresent work as files, summaries, and diffs.

Module 5: Production Harness

ChapterMechanismBuild Outcome
s21 SQLite DatabaseDurable metadata and usage trackingPersist sessions and usage.
s22 Automation SchedulerTimed and recurring agent runsWake the harness without a user prompt.
s23 Audit & SandboxCommand policy and tamper-evident logsMake autonomous work governable.
s24 ComprehensiveEnd-to-end mini harnessSee how all layers fit together.

The Mental Model

The tutorial is a ladder:

agent loop
  + tool dispatch
  + permissions
  + desktop process boundary
  + sidecar/session runtime
  + memory/context compression
  + extension protocols
  + persistence/scheduling/audit
  = WorkBuddy-style harness

Each chapter should answer three questions:

  1. What problem appears when the previous chapter gets real users?
  2. What minimal mechanism fixes it?
  3. How would a production desktop agent harden that mechanism?

Interview Topic Map(8 个 Agent 工程考点 ↔ 章节)

社区求职指南(AgentGuide)把 Agent 工程面试归纳为 8 个考点。本教程每个考点都有对应的可运行章节——学完一章,就多一个能在面试里从"讲概念"升级到"讲我怎么实现的"的话题:

考点对应章节面试时你能讲的实现细节
Agent Loops01, s02tool_use/tool_result 反馈环、stop_reason 驱动的退出条件、工具分发表
Context & Costs03, s13, s14工具 schema 延迟加载、大输出外部化(swap file + 指针)、token 压力检测与结构化压缩
Tool Designs02, s03, s17路径守卫、schema 设计、ToolSearch 按需发现、MCP 连接器命名空间
Multi-Model Routings08lite/default/craft 三档路由、成本追踪、Agent 到模型槽位的映射
Memorys10, s11, s12工作区日志→主题蒸馏、用户偏好去重、三层记忆的所有权边界
Eval & Governances23, tests/哈希链审计(含截断锚点)、命令安全分级、权限门单元测试与绕过边界用例
Harnesss05, s06, s07, s24UI/sidecar/session 三层进程隔离、JSON-RPC 控制面、端到端 mini harness
Reliabilitys09, mini_workbuddyJSONL append-only 转录与崩溃恢复、fail-closed 错误边界、可靠工具 call id

配套阅读顺序见 Further Reading Map