Skip to content
系列
20 篇文章

Looplane 架構拆解

沿著一次 coding-agent 任務的實際路徑拆解 Looplane:從 TUI、disposable workspace、prompt 與兩條 runtime lane,走到工具權限、state/event lifecycle、MCP、subagents、SDK/IDE,最後把同一套邊界延伸到 Cloudflare 遠端執行。每篇只追一條 data flow、failure boundary 與測試證據。

系列導讀

Looplane 的 prompt、instruction precedence 與 explicit memory:模型最後看見了什麼

Looplane 先在應用程式層解析 user 與 root-to-leaf 專案 instructions,再把 runtime、skills、workspace 與最近 20 筆 explicit memory 放進具名 prompt sections。這套流程可追蹤、可 reload,但不是 semantic memory,也不會把 repo 文字升格成 system authority。

Looplane 的 provider-neutral native loop:一次 model turn 如何走到驗證終態

Looplane 的 native lane 由 AgentRunner 掌握狀態轉移:準備 workspace、送出 model request、執行 tool calls、寫回 observations,模型沒有再呼叫工具時才進入 verification。step、wall time、重複動作、token 與取消條件都能先於模型宣告終止 run;provider adapter 的協定翻譯留給下一篇。

Looplane 的 ModelProvider 多閘道:多個 protocol 共用一個 canonical contract

Looplane 把 OpenAI-compatible、Responses、Anthropic、Gemini、Workers AI、scripted 與 experimental Codex OAuth adapter 收斂成同一個 `ModelProvider` contract。Codex OAuth transport 讀 SSE,但仍在 adapter 內累積成一次性的 canonical `ModelTurn`;AgentRunner 不直接消費 token delta。

Looplane 的 ExternalCodingRunner:為什麼 Codex/Claude Code CLI 是外部 runtime,不是 ModelProvider

`ExternalCodingRunner` 是 Looplane 的第二條 runtime lane:外部 coding CLI 擁有自己的 model loop 與 credential,Looplane 只交付任務與 disposable clone,再把回傳 patch 當成不受信任輸入,重跑 path audit、verification 與 source invariant。它是有明確 capability boundary 的 handoff,不是另一種 `ModelProvider`。

Looplane 的工具隔離:path allowlist、argv 嚴格化、process group 與 credential-free subprocess

這篇只拆 Looplane 的 tool executor 如何把一次呼叫安全落地:`SafePathPolicy` 限制 path 並阻擋 symlink escape,`VerificationCommand` 固定 argv 且使用 `shell=False`,subprocess 只拿清理過的 env,寫入走 read-version hash 與 atomic replace,timeout 會終止整個 process group。權限決策、OS sandbox 與 tool program 各留給後續專篇。

Looplane 的 state-first event journaling:為什麼 manifest commit 跟 JSONL append 之間的 crash 要靠 state 修

Looplane 同時維護 append-only 的 `events.jsonl` 與原子替換的 `session.json`,用 sequence reconciliation 判斷 crash 後能否安全續跑。這份 event contract 現在也支援 deterministic replay、JSON replay、從指定 sequence 建立 fork seed,以及在不重放副作用的前提下建立新 workspace;遇到停在 `tool.started` 或 `verification.started` 的不確定狀態仍然 hard fail。

Looplane 的 Cloudflare 遠端執行:Worker、Sandbox、Capability DO 與 durable RunSession

Looplane 的舊同步 M6 路徑曾完成一次真實 deployed coding run;目前已擴成帶 RunSession、SSE、approval、cancel 與 artifact 的 async control plane,但新增路徑尚未 live revalidate。Sandbox 只拿分 audience 的短效 HMAC capability,provider credential 留在 Worker;現有證據不等於 production traffic 或 SLO。