青雲的博客
《拆开 Codex》封面
全部小册

源码版本 rust-v0.144.6

拆开 Codex

从源码读懂一个生产级 Agent

全书只分析 openai/codex 开源仓库:既把 Codex 的真实实现讲透,也从这些实现中解释一个生产级 Agent 需要处理的模型回路、工具执行、安全治理、状态恢复、扩展协议、多 Agent 和验证体系。

目录

36 章已发布

查阅索引

动态工具声明与领域执行器的分离
Dynamic Tools 为什么把执行权交回宿主
active context versus cumulative usage
上下文快满时,Codex 到底压缩了什么
Agent identity versus UI identity
一个子 Agent 为什么需要独立 Thread
bounded audio, text, handoff, and output queues
普通 Responses 与 Realtime 为什么是两套会话
child-to-parent result notification
多个 Agent 怎样通信、等待与中断
claim to source to observed artifact ledger
没有证据的“跑通”不算跑通
Code Mode control tool versus nested tool
Code Mode 为什么仍然绕不开同一张工具表
content items 到 function_call_output
Dynamic Tools 为什么把执行权交回宿主
continuation condition
Codex 为什么有两层循环
continuation reason and error semantics
Hooks 为什么不是一条统一回调链
deterministic local binary task
没有证据的“跑通”不算跑通
direct and deferred tool exposure
外部 MCP Server 的工具怎样进入 Codex
direct result versus code mode result
Code Mode 为什么仍然绕不开同一张工具表
discovery, exposure, approval, execution boundary
外部 MCP Server 的工具怎样进入 Codex
durable history copy versus process snapshot
Resume 与 Fork:恢复的不是同一件事
event projection after mutation
Goal 为什么必须活在 Turn 之上
event-specific stdin and output schemas
Hooks 为什么不是一条统一回调链
execution-scoped network attribution
网络访问为什么另有一条决策链
executor-selected Plugin contributor path
一个 Plugin 怎样变成一组可安装能力
experimental opt-in memory
Memory 不是更长的 History
explicit Codex handoff into realtime output
普通 Responses 与 Realtime 为什么是两套会话
extraction state versus final corpus
Memory 不是更长的 History
global consolidation ownership
Memory 不是更长的 History
history resume as a new identity
Resume 与 Fork:恢复的不是同一件事
idle continuation eligibility
Goal 为什么必须活在 Turn 之上
installed package versus runtime projection
一个 Plugin 怎样变成一组可安装能力
instruction source ledger
模型收到的指令从哪里来
layer evidence versus cross-layer proof
没有证据的“跑通”不算跑通
live registry versus persisted graph
一个子 Agent 为什么需要独立 Thread
live subtree versus persisted graph
多个 Agent 怎样通信、等待与中断
mailbox activity versus agent completion
多个 Agent 怎样通信、等待与中断
mailbox delivery phase
Codex 为什么有两层循环
matcher selection and matcher aliases
Hooks 为什么不是一条统一回调链
model-visible exec and nested apply_patch ownership
没有证据的“跑通”不算跑通
observation frontier and terminal response
Code Mode 为什么仍然绕不开同一张工具表
parser effect versus runtime mutation
Hooks 为什么不是一条统一回调链
pre-execution block versus post-execution feedback
Hooks 为什么不是一条统一回调链
preflight and runtime failure boundary
一份补丁怎样落盘,又怎样成为 TurnDiff
process lifecycle token 与 turn cancellation
命令返回以后,进程为什么还活着
progressive disclosure read path
Memory 不是更长的 History
raw MCP identity versus model-visible ToolInfo
外部 MCP Server 的工具怎样进入 Codex
realtime V1/V2 and WebSocket/WebRTC transport choices
普通 Responses 与 Realtime 为什么是两套会话
rollout identity versus trace identity
没有证据的“跑通”不算跑通
rollout-derived memory
Memory 不是更长的 History
running resume versus cold resume
Resume 与 Fork:恢复的不是同一件事
runtime accounting attachment
Goal 为什么必须活在 Turn 之上
runtime enforcement boundary
模型收到的指令从哪里来
runtime projection and effective servers
外部 MCP Server 的工具怎样进入 Codex
screenshot as terminal projection
没有证据的“跑通”不算跑通
separate realtime conversation state machine
普通 Responses 与 Realtime 为什么是两套会话
session-scoped MCP runtime snapshot
外部 MCP Server 的工具怎样进入 Codex
session-scoped ModelClient versus turn-scoped ModelClientSession
普通 Responses 与 Realtime 为什么是两套会话
SkillMetadata versus SkillInstructions
Skills 不是工具:从目录发现到渐进注入
skipped test as missing evidence
没有证据的“跑通”不算跑通
spawn topology versus history lineage
一个子 Agent 为什么需要独立 Thread
synchronous command discovery boundary
Hooks 为什么不是一条统一回调链
telemetry as observation rather than causality
没有证据的“跑通”不算跑通
ten event names versus separate lifecycle entry points
Hooks 为什么不是一条统一回调链
thread scope versus turn scope
Hooks 为什么不是一条统一回调链
thread-scoped durable objective
Goal 为什么必须活在 Turn 之上
tool future 与 OS process 生命周期
命令返回以后,进程为什么还活着
transport resource ownership
Codex 为什么有两层循环
turn interruption versus thread shutdown
多个 Agent 怎样通信、等待与中断
usage feedback metadata
Memory 不是更长的 History
user-visible turn ownership
Codex 为什么有两层循环