Codex Team Dispatch (headless) + Dual-Layer Codex Fleet · สูตรโกง 10 coders ขนาน
วิวัฒน์ขั้นถัดจาก ch20: dispatch แบบ headless (codex exec ผ่าน background Agent, ไม่ต้อง tmux/charter) และ Dual-Layer Fleet 10 coders ขนาน (5 headless + 5 tmux) พร้อม traps จริง — cross-verify โดย fleet · The evolution past ch20: headless dispatch (codex exec via a background Agent, no tmux/charter) and a 10-coder dual-layer fleet (5 headless + 5 tmux) with the real traps — cross-verified by the fleet.
จากสูตร charter สู่ headless · From the charter recipe to headless dispatch
บทนี้ต่อยอดจาก ch20 (/codex-team lifecycle) ซึ่งเป็นสูตร charter + tmux. ใน session เดียวกัน (17 มิ.ย. 2026) P'Nut ดันสูตรไปอีกขั้น: เพิ่ม verb dispatch ที่รัน codex แบบ headless ผ่าน background Agent — ไม่ต้อง tmux, ไม่ต้อง charter. วิวัฒน์ทั้งสาย: ting → tee → arra → headless → dual-layer ในสัปดาห์เดียว.
This chapter extends ch20 (/codex-team lifecycle), the charter+tmux recipe. In the same 17 Jun 2026 session P'Nut pushed it further: a dispatch verb that runs codex headless via a background Agent — no tmux, no charter. The full evolution in one week: ting → tee → arra → headless → dual-layer.
5 verbs + สิ่งที่ session พิสูจน์ · The skill & what the session proved
/oracle-team มี 5 verbs; ตัวใหม่คือ dispatch (headless codex exec, tracked ผ่าน background Agent).
/oracle-team has five verbs; the new one is dispatch (headless codex exec, tracked via a background Agent).
| Verb | ทำอะไร · Does |
|---|---|
up [profile] | tmux panes (long-term) |
dispatch [issues] | headless codex exec — background Agent, tracked ← ใหม่ · NEW |
down [1,2,3] | safe teardown |
lead | orchestrate cycle |
status | read-only peek |
สิ่งที่ session นี้พิสูจน์ (P'Nut + fleet cross-verify) · What this session proved:
| Discovery | Detail |
|---|---|
Shell & | harness มองไม่เห็น — อย่าใช้ · invisible to the harness — don't use |
Agent(run_in_background=true) | harness track + notify (the /forward-bg pattern) |
| Haiku wraps codex exec | wrapper ถูก ($0.25/M), งานจริงคือ codex (gpt-5.5) · cheap wrapper, real work is codex |
| Worktrees required | codex exec ไม่มี worktree = งานหายตอน exit · no worktree = changes lost on exit |
maw hey callback | ยิงจาก codex exec ได้ ไปโผล่ใน tmux · fires from codex exec, arrives in tmux |
| 3 parallel coders | 920 lines committed, zero manual intervention |
tmux เดิม vs codex exec headless · Old vs new
เทียบสองสูตรตรง ๆ:
| เดิม · tmux-based | ใหม่ · codex exec headless | |
|---|---|---|
| Engine | omx ผ่าน tmux window | codex exec -m gpt-5.5 headless |
| Isolation | maw wake --wt | git worktree add (manual) |
| API key | shared | CODEX_HOME per coder (~/.codex-team/N/) |
| Dispatch | maw hey session:member | prompt ใส่ตรงใน codex exec |
| Monitoring | maw peek | git -C agents/coder-N log |
| Callback | maw hey กลับ lead | maw hey กลับ lead (เหมือนกัน) |
5 จุดที่ใหม่จริง ๆ · The five genuinely new points:
- CODEX_HOME isolation — แยก API key per coder กัน rate-limit ชนกัน · separate API key per coder to avoid rate-limit collisions.
codex execheadless — ไม่ต้อง tmux, ไม่ต้องmaw wake, รันตรงจาก shell · runs straight from the shell.-m gpt-5.5ไม่ใช่-c model=— trap ที่เจอจริง · a real trap.cargo clippy -- -D warningsต้องใส่ใน prompt เสมอ ไม่งั้น coder commit code ที่มี warning · always put it in the prompt or coders commit warnings.cdเข้า worktree ก่อน —codex execใช้pwd· codex exec uses pwd, so cd into the worktree first.
นี่คือ lightweight version: ไม่ต้อง charter YAML, ไม่ต้อง maw team up — แค่ worktree + codex exec + maw hey callback. · The lightweight version: no charter YAML, no maw team up — just a worktree, codex exec, and a maw hey callback.
Dual-Layer Codex Fleet — 10 coders ขนาน · The dual-layer fleet
Evolution ขั้นสุด: รวม headless + tmux เป็น 10 coders ขนาน (5 + 5) แยก orchestration/execution layer ชัด.
The final evolution: combine headless + tmux into 10 parallel coders (5 + 5), cleanly splitting the orchestration and execution layers.
Layer 1 — Headless (×5)
Agent(run_in_background) → codex exec → git worktree
✅ harness tracked ✅ fire-and-forget ❌ รับ maw hey กลับไม่ได้
Layer 2 — Tmux (×5)
maw team up → tmux panes → maw hey dispatch
✅ ส่ง/รับ maw hey ได้ ✅ peer coordination ❌ ต้อง maw peek loop
เลือก layer ตามงาน: fire-and-forget งานเดี่ยว ๆ → headless; งานที่ต้อง peer-coordination หรือสั่งกลับระหว่างทาง → tmux.
Pick the layer by task: fire-and-forget single-shot work → headless; anything needing peer coordination or mid-flight redirection → tmux.
Traps ของ dual-layer · The dual-layer traps
- headless รับ
maw heyกลับไม่ได้ — ไม่มี tmux pane; ใช้ tmux layer สำหรับ peer-coordination เท่านั้น. คนพลาดง่ายสุด. - CODEX_HOME trust per repo — ต้อง pre-trust ใน
config.tomlไม่งั้น codex ถามตอน exec (ดู Trust Loop ด้านล่าง). headless:ใน YAML ทำ maw parser พัง — ต้อง comment out หรือแยกไฟล์.maw team down --onlyฆ่าหมดทุกตัว — trap! ใช้maw tmux killต่อ window แทน.- 15 processes จาก 5 coders เป็นเรื่องปกติ — 5 × 3 child processes.
The five traps: (1) headless cannot RECEIVE maw hey — no tmux pane; use the tmux layer for peer coordination only (the easiest miss). (2) CODEX_HOME needs per-repo trust in config.toml or codex prompts at exec time (see Trust Loop below). (3) headless: in YAML breaks the maw parser — comment it out or split the file. (4) maw team down --only kills ALL — use maw tmux kill per window instead. (5) 15 processes from 5 coders is normal (5 × 3 child processes).
Trust Loop + BunInvokeRuntime · Two supporting tricks
Trust Loop — วนเขียน trust_level = "trusted" ลงทุก CODEX_HOME และ generic ~/.codex/config.toml เพื่อตัด interactive prompt ตอน agent เริ่มงานย่อยในซับโฟลเดอร์.
Trust Loop — loop trust_level = "trusted" into every CODEX_HOME and the generic ~/.codex/config.toml to kill the interactive prompt when an agent starts subfolder work.
BunInvokeRuntime — migration trick ที่ทำให้ thin Rust CLI รัน plugin เดิมได้หมดทันที:
invoke_ts() stub → BunInvokeRuntime
= bun run <entry_path> -- <args>
= 113 plugins work immediately, 0 rewrites
Thin Rust CLI → bun bridge — 113 plugins ใช้ได้ทันทีไม่ต้อง rewrite. เป็น migration path ที่ fleet มองว่าทองสุด.
A thin Rust CLI → bun bridge: all 113 plugins run immediately with zero rewrites — the migration path the fleet rated highest.
Checklist
- งาน fire-and-forget → headless (
dispatch); งานที่ต้อง coordinate → tmux (up). - ทุก coder ต้องมี worktree ของตัวเอง —
codex execไม่มี worktree = งานหาย. - แยก
CODEX_HOMEper coder กัน rate-limit ชนกัน; pre-trusttrust_level = "trusted"กัน prompt. - ใช้
-m gpt-5.5(ไม่ใช่-c model=) และใส่cargo clippy -- -D warningsใน prompt. - ใช้
Agent(run_in_background=true)— ไม่ใช่Shell &(harness มองไม่เห็น). - อย่าใช้
maw team down --only(ฆ่าหมด) —maw tmux killต่อ window. - headless รับ
maw heyไม่ได้ — lead สั่ง headless ผ่าน prompt ตอน dispatch เท่านั้น.