Agentflow / Model Routing

godev 如何判斷不同任務該使用哪個模型?

答案不是「讓模型自由猜測」。Agentflow 採用語意分類、固定角色分級與設定檔解析的分層機制。

使用者任務 ↓ 主控 Agent 判斷工作路線與風險 ↓ direct / selected_advisors / full_pipeline ↓ 需要委派時,指定 pipeline role ↓ role → tier → profile → model + effort

第一層:主控 Agent 判斷工作路線

這一層不是以程式碼行數、token 數或固定關鍵字決定,而是主控 Agent 根據任務內容與 repository 證據,判斷工作屬於哪一條路線。

第二層:工作角色對應能力等級

只要需要外部 worker,主控 Agent 就會先指定一個 role;接著由 ag.json 的 pipeline-roles 將 role 映射成 tier。

任務角色Tier設計意圖
requirements / spec / acceptancebetter需要較強的理解、判斷與驗證
codewalk / explore / spikebetter降低既有系統理解錯誤
implementationbasic在規格已凍結後執行受約束實作
security-scanbest安全與高風險檢查採最高等級
cross-checkbetter獨立覆核最終結果
learnbasic整理已確認的經驗與教訓

第三層:Tier 解析成實際模型

你目前專案中的 Codex profile 映射如下;模型名稱與 reasoning effort 會一起選定。

Tier模型Reasoning effort
bestgpt-5.6-solmedium
bettergpt-5.6-terrahigh
basicgpt-5.6-lunamax
cheapgpt-5.4medium

因此目前的實際解析結果是:requirements 使用 gpt-5.6-terra/high,implementation 使用 gpt-5.6-luna/max,security-scan 使用 gpt-5.6-sol/medium。

第四層:選擇 Claude 或 Codex worker

解析器還會檢查目前 host、cli-provider、worker CLI 是否存在、profile priority,以及該 profile 是否提供指定 tier。

目前 cli-provider: off,所以只能使用與主控 host 相同 family 的 worker:Codex 裡的 godev 使用 Codex profile;Claude 裡則使用 Claude profile。若設定為 on,不同 family 才能共同參與候選選擇。

失敗時如何降級

核心結論:godev 的任務性質由主控 Agent 根據語意與風險判斷;實際模型則透過 role → tier → profile/model 的確定性設定解析。前半段是語意決策,後半段是可配置、可稽核的規則。