ShouldPlanFirst decides whether the orchestrator should synthesize a structured plan before dispatching, given the user-configured mode and the live task complexity. - "off" → never - "always" → always - "auto" → ComplexityScore(task) >= cfg.ComplexityThreshold Unknown modes fall through to "
(cfg PlanFirstConfig, task string)
| 111 | // Unknown modes fall through to "auto" so a misconfigured env doesn't |
| 112 | // silently disable planning. |
| 113 | func ShouldPlanFirst(cfg PlanFirstConfig, task string) bool { |
| 114 | switch strings.ToLower(strings.TrimSpace(cfg.Mode)) { |
| 115 | case "off": |
| 116 | return false |
| 117 | case "always": |
| 118 | return true |
| 119 | default: // "auto" or unknown → conservative auto behavior |
| 120 | return ComplexityScore(task) >= cfg.ComplexityThreshold |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // countDistinctVerbs counts unique action verbs in lower (already |
| 125 | // lower-cased), up to cap. Word boundaries are enforced via Fields, |