Lengzhao Blog

Thinking will not overcome fear but action will.

Claude Code Series 12 Prompt Index

Claude Code 系列|Prompt 篇索引与阅读顺序

Claude Code Prompt 文档索引 这个目录把原来的 prompt-templates/ 和 prompt-examples/ 合并成一套文档。 合并后的原则很简单: 每个主题只保留一页 每页同时包含: 结构模板 半实化示例 关键观察点 不再让“抽象结构”和“真实观感”分散在两个目录里来回跳 ...

Claude Code Series 11 Memory System

Claude Code 系列|长期记忆如何存、读、注入与整理

Claude Code 记忆系统技术方案 本文档重新按“系统设计”视角整理 Claude Code 的 memory 体系。目标不是解释零散函数,而是回答这些核心问题: memory 到底解决什么问题 它和 transcript、task、plan 的边界是什么 它如何存、如何读、如何注入、如何更新 daily log、extract memories、auto dre...

Claude Code Series 10 Core Tools

Claude Code 系列|核心工具如何构成执行面

Claude Code 核心工具详解 本文档专门讲 Claude Code 里最核心的一批工具,不是简单罗列名字,而是解释: 它们在系统里的定位 模型为什么会用它 prompt / schema 在哪里 运行时有哪些关键行为 什么时候该用,什么时候不该用 这份文档重点覆盖: AgentTool BashTool Read / FileReadTo...

Claude Code Series 09 Agenttool Deep Dive

Claude Code 系列|AgentTool 为什么是调度入口

Claude Code AgentTool 深入解析 本文档只聚焦一个工具:AgentTool。 之所以值得单独写,是因为它不是普通的“读文件 / 执行命令”工具,而是 Claude Code 整个多执行体体系的入口。很多关键能力都从它分叉出去: 子 Agent fork agent 后台 agent resume teammate / swarm 协作 如果...

Claude Code Series 08 Subagent System

Claude Code 系列|子 Agent、fork 与 teammate 的多执行体架构

Claude Code 子 Agent 系统技术方案 本文档专门解释 Claude Code 里的子 Agent / fork agent / teammate / swarm 体系。目标不是解释某几个实现文件,而是回答下面这些问题: 为什么需要子 Agent,而不是一个主 Agent 干到底 子 Agent 和 fork agent 有什么本质区别 teammate / ...

Claude Code Series 07 Memory Prompt

Claude Code 系列|memory 相关块如何进入上下文

memory 相关块 这个主题不描述完整请求,而是把 memory 相关块单独抽出来看,帮助区分: 哪些内容进入 system 哪些内容进入 messages 哪些内容作为运行时 recall attachment 注入 1. 结构模板 1.1 memory policy 块 这类块通常进入 system: # {{MEMORY_DISPLAY_NAME}} ...

Claude Code Series 06 Teammate Prompt

Claude Code 系列|teammate 与 swarm 的协作 prompt

teammate / swarm 这个主题对应 teammate,尤其是 in-process teammate 的典型 prompt 结构。 它的重点不是“又一个子 Agent”,而是: 继承主系统 prompt 追加团队协作 addendum 接收 team lead 的包装消息和 mailbox 上下文 1. 结构模板 1.1 system system...

Claude Code Series 05 Fork Agent Prompt

Claude Code 系列|fork agent 如何复用父线程前缀

fork Agent 这个主题对应 runForkedAgent()。 fork agent 的重点不是高度定制,而是: 尽量复用父线程已经稳定下来的 prompt 前缀。 1. 结构模板 cacheSafeParams = { systemPrompt: {{PARENT_RENDERED_SYSTEM_PROMPT}}, userContext: {{PARENT_...

Claude Code Series 04 Subagent Prompt

Claude Code 系列|普通子 Agent 的 prompt 结构

普通子 Agent 这个主题对应 runAgent() 启动的普通子 Agent。 它和主线程最大的区别是: 有自己的角色 prompt 会做上下文裁剪 默认更强调隔离和受控工具面 1. 结构模板 1.1 system system = [ {{AGENT_DEFINITION_SYSTEM_PROMPT_OR_DEFAULT_AGENT_PROMPT}}...

Claude Code Series 03 Main Thread Prompt

Claude Code 系列|主线程 prompt 如何拼装

主线程 这个主题对应主线程最常见的 prompt 结构,也就是 QueryEngine 进入 query() 前后的主请求形态。 1. 结构模板 1.1 system system = [ {{INTRO_SECTION}}, {{SYSTEM_SECTION}}, {{DOING_TASKS_SECTION}}, {{ACTIONS_SECTION}}, {...