perf(workflow): default to inline execution for small plans (#1979)
Plans with 1-2 tasks now execute inline (Pattern C) instead of spawning a subagent (Pattern A). This avoids ~14K token subagent spawn overhead and preserves the orchestrator's prompt cache for small plans. The threshold is configurable via workflow.inline_plan_threshold (default: 2). Set to 0 to always spawn subagents. Plans above the threshold continue to use checkpoint-based routing as before. Closes #1979 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,10 +61,18 @@ PLAN_START_EPOCH=$(date +%s)
|
||||
|
||||
<step name="parse_segments">
|
||||
```bash
|
||||
TASK_COUNT=$(grep -c "^<task" .planning/phases/XX-name/{phase}-{plan}-PLAN.md 2>/dev/null || echo "0")
|
||||
INLINE_THRESHOLD=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.inline_plan_threshold --default 2 2>/dev/null || echo "2")
|
||||
grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md
|
||||
```
|
||||
|
||||
**Routing by checkpoint type:**
|
||||
**Primary routing: task count threshold (#1979)**
|
||||
|
||||
If `TASK_COUNT <= INLINE_THRESHOLD`: Use Pattern C (inline) regardless of checkpoint type. Small plans execute faster inline — avoids ~14K token subagent spawn overhead and preserves prompt cache. Configure threshold via `workflow.inline_plan_threshold` (default: 2).
|
||||
|
||||
If `TASK_COUNT > INLINE_THRESHOLD`: Apply checkpoint-based routing below.
|
||||
|
||||
**Checkpoint-based routing (plans with > threshold tasks):**
|
||||
|
||||
| Checkpoints | Pattern | Execution |
|
||||
|-------------|---------|-----------|
|
||||
|
||||
Reference in New Issue
Block a user