CODEX 課程 / 18 CLI + 06 API + 32 MONTHLY
建立可靠的 Codex 作業系統。
先完成 CLI 課程,再由誠實標示日期的月度檔案串起 API 邊界、多模態、Agents、Realtime、Codex 與 app UI。
安全進入 Terminal
安裝、登入、從正確 repository 啟動,並在要求 Codex 行動前選好權限。
讓工作清楚且可重複
控制 live session、保存 durable guidance、依 scope 配置,並把變更轉成可 review 的證據。
- 05控制長時間 CLI session從規劃、實作到 review 都清楚且可操控的 session。
- 06用 AGENTS.md 保存 repository 知識精簡、已驗證,能教 Codex 如何建置與檢查此 repo 的 AGENTS.md chain。
- 07依模型、effort 與 scope 規劃 Codex 工作一份 continuity-first Codex 計畫:模型角色、支援的 native effort、未擴張的 permission boundary、live-catalog 檢查與安全 fallback 都明確。
- 08把變更轉成可 review 的證據可重複的 change-test-diff-review loop,包含 prioritized findings 與 acceptance decision。
擴充、治理與自動化
連接 MCP、封裝 skills、加入 guardrails,再把獨立工作擴展為 subagents 與安全 CI。
- 09透過 MCP 連接外部系統Tool surface 狹窄,startup/approval policy 清楚且已驗證的 MCP connection。
- 10把重複工作封裝成 SkillsTrigger 清楚、可測試,distribution path 合理的 narrow skill。
- 11用 Hooks 與 Rules 加入 guardrails一個已 review hook 與已測 command rule,改善控制但不冒充完整 security boundary。
- 12從 Subagents 擴展到安全 Automation有界 parallel workflow 與 least-privilege automation,輸出可機器驗證。
把 Codex 當成可觀察系統運作
以 headless execution、JSONL、saved-session lifecycle、Cloud tasks、sandbox policy tests、diagnostics、features 與 completions 完成 CLI 課程。
- 13用 codex exec 執行可重複的 headless 工作Workspace、authority、exit status、artifact 與 retry 行為都明確的 headless Codex job。
- 14串流 JSONL,並約束最終結果可安全解析 JSONL,並在採取行動前驗證單一 typed final result 的 automation boundary。
- 15Resume、fork、archive 與 restore Codex sessionsLineage 清楚、整理可逆,而且不會誤刪保存工作的 session workflow。
- 16套用前先審查 Codex Cloud tasks保留 attempt identity、local review 與可逆 apply step 的 remote-task workflow。
- 17在 sandbox 測試命令並稽核 execpolicy能分清 sandbox enforcement 與 command-policy decision 的可重複 permission test。
- 18診斷 Codex、檢視 features 並產生 completions能辨識 failing layer,且只修改目標 feature 或 shell integration 的診斷程序。
直接建置 OpenAI Platform
原有 API 架構筆記以獨立 archive 保留,不列入 18 堂 CLI 課程。
- A01把 Responses 當成系統邊界一層能更換模型、卻不改變產品契約的 request boundary。
- A02為每個工具建立窄契約一層可審查、可重試、可撤銷權限的 tool layer。
- A03把 Schema 當成使用者體驗Typed model output 透過明確 validation gate 才進入產品程式。
- A04決定誰擁有 Agent Loop一個 controller 與 stop conditions 都明確的多步工作流。
- A05把 Realtime 當成即時系統一套用真實網路、聲音與中斷情境測試過的 realtime architecture。
- A06把模型選擇留在系統邊緣能用證據與設定採用新模型、而不是重寫產品的 deployment。
月度技術檔案 / 32 期
三十二期回顧式工程專刊。
從 API 邊界、多模態系統,一路走到 Agents、Realtime、Codex 與 ChatGPT app UI 的官方來源路線。
- ISSUES
- 32
- RANGE
- 2024—26
- LANG
- 03
RETROSPECTIVE / SOURCE-CHECKED
12 ISSUES
- 2024 / 01 API
把 API request 做成產品邊界
先建立由 server 擁有的單一 adapter,統一處理驗證、request ID、timeout 與錯誤,不要讓 UI 到處直接呼叫平台。
- 2024 / 02 PROMPTS
把 prompt 當成應用程式碼版本化
把穩定的 developer instruction 與 user input 分開,明訂 output contract,並讓 prompt 變更可 review。
- 2024 / 03 MODELS
依能力路由,不追逐流行 model 名稱
依 modality、tool support、latency、quality 與 budget 描述 workload,再由 configuration 把 profile 對應到可部署 model。
- 2024 / 04 DATA
用 schema 定義 output contract
Structured Outputs 能降低 parsing 歧義,但產品仍要處理 refusal、incomplete result 與 domain-invalid value。
- 2024 / 05 TOOLS
替每個 function tool 設定窄合約
Tool definition 只表達可呼叫意圖;validation、execution、idempotency 與 result 必須由已驗證的 server code 負責。
- 2024 / 06 UX
把 streaming 設計成狀態機
可用的 stream 要區分 start、typed delta、tool activity、completion、cancellation 與 failure,而不是只累加文字。
- 2024 / 07 VISION
把 image understanding 當成證據抽取
定義 model 可從 image 推論什麼、保存原始 asset reference,並把 observation 與後續 decision 分開。
- 2024 / 08 MEDIA
把 image generation 放進 asset pipeline
把 prompt intent、generation request、moderation state、asset storage、metadata 與 editorial acceptance 拆成可觀察階段。
- 2024 / 09 AUDIO
以 timestamp 與 uncertainty 建立 transcription
把 transcription 當成 media-processing job,包含 upload validation、language context、segmentation、speaker policy 與 correction workflow。
- 2024 / 10 AUDIO
把 synthetic speech 設計成有揭露的介面
把 voice、format、chunking、playback 與 interruption 都當成產品決策,並揭露語音由 AI 生成。
- 2024 / 11 RETRIEVAL
把 retrieval 與 generation 分開
Embedding 支援語意比較;production retrieval 還需要 chunk ownership、metadata filter、freshness、citation 與 deletion。
- 2024 / 12 OPERATIONS
把可容忍延遲的 workload 移到 batch
Batch work 需要穩定 custom identifier、immutable input manifest、逐項 status、result reconciliation 與 bounded replay。
RETROSPECTIVE / SOURCE-CHECKED
12 ISSUES
- 2025 / 01 RESPONSES
以 Responses 作為 agentic application 邊界
Typed input/output item 讓 message、reasoning、tool call 與 tool result 在多步 request 中保持分離。
- 2025 / 02 STATE
明確選擇 conversation state
決定 application 要重送 history、串接 response identifier,或使用 conversation resource,並把選擇寫入 data policy。
- 2025 / 03 TOOLS
把 web search 當成有引用的 retrieval
Search result 是會變動的證據;保留 source URL、區分 retrieval time 與 event time,並把 citation 放在 claim 附近。
- 2025 / 04 RETRIEVAL
用 ownership 與 freshness 建立 file search
即使是 hosted retrieval tool,仍需治理 corpus:ingestion status、metadata、access filter、citation、refresh 與 deletion。
- 2025 / 05 TOOLS
把 code execution 當成可丟棄 compute cell
送入 bounded input、定義 expected artifact,並在 sandbox 外驗證 output 後才進入 business workflow。
- 2025 / 06 ASYNC
把 long-running response 做成 async job
Background work 需要 job identifier、polling/streaming policy、cancellation、expiry、idempotent consumption 與可見 status。
- 2025 / 07 SAFETY
在 side-effect 邊界插入 approval
依 impact 分類 tool,並在對外訊息、購買、破壞性寫入、使用 credential 或權限變更前暫停。
- 2025 / 08 MCP
把 MCP server 當成外部 principal
啟用前盤點 server identity、transport、authentication、exposed tools、returned data、approval 與 failure behavior。
- 2025 / 09 AGENTS
明確指定 agent loop 的 owner
Controller 必須擁有 turn、tool、state、approval、stop condition 與 trace;specialist 只接收窄任務與 typed result。
- 2025 / 10 AGENTS
讓每次 handoff 都是 typed delegation
Handoff 應帶有單一 goal、bounded context、allowed tool、authority、deadline、output shape 與 next owner。
- 2025 / 11 OBSERVE
追蹤決策,但不記錄 secret
以穩定 correlation identifier 串起 run、turn、model、tool、handoff、approval、latency、usage 與 terminal outcome。
- 2025 / 12 EVALS
讓 evaluation 成為 release gate
變更系統前先定義 representative input、human-readable criteria、適當 automated grader 與 baseline。
RETROSPECTIVE / SOURCE-CHECKED
08 ISSUES
- 2026 / 01 REALTIME
把 Realtime 當成即時分散式系統設計
Transport、session configuration、turn detection、interruption、tool、reconnect 與 terminal state 共同定義體驗。
- 2026 / 02 REALTIME
讓 browser Realtime credential 保持短效
由 server 驗證的 session bootstrap,讓 browser 建立 media transport 而不取得長效 platform key。
- 2026 / 03 CODEX
在有界 repository 啟動 Codex
Coding agent 編輯前,先明確 working directory、task、sandbox、approval policy 與 definition of done。
- 2026 / 04 CODEX
把 repository 真相寫進 AGENTS.md
Durable guidance 應說明 architecture boundary、command、convention 與 verification,但不能取代當前 task。
- 2026 / 05 CODEX
分開 configuration、sandbox 與 approval
Configuration 選 default、sandbox 強制 filesystem/network limit,而 approval 管理例外 authority。
- 2026 / 06 CODEX
Live access 用 MCP,repeatable method 用 Skills
MCP 連接已驗證的外部 tool/context;Skill 封裝 instruction、script、reference 與 reusable workflow trigger。
- 2026 / 07 CODEX
平行化 evidence,不平行化衝突寫入
Subagent 需要獨立 ownership 與 result contract;headless CI 需要固定 permission、machine-readable output 與隔離 credential。
- 2026 / 08 APPS
替 MCP tool 加 UI,但不要把信任移進 browser
MCP server 擁有 tool truth 與 authorization;embedded component 只 render state,並透過窄 bridge 請求 action。