When running in goal mode with a swarm of background agents, the driveGoal() loop currently schedules continuation turns with no minimum interval. The model calls TaskList every 1-2 seconds to check agent status, consuming 100-200 tokens per turn and wasting a large amount of context over a long-running goal.
We fixed this in our fork by adding a 15-second minimum interval between goal continuation turns and by updating the goal reminder/continuation prompt to tell the model not to poll background tasks with TaskList (prefer automatic completion notifications or TaskOutput(block=true)).
Commit with the fix: thecannabisapp@f227bb20
If the maintainers want to merge this, the key changes are in packages/agent-core/src/agent/turn/index.ts (the driveGoal throttle) and packages/agent-core/src/agent/injection/goal.ts (the prompt guidance).
When running in goal mode with a swarm of background agents, the
driveGoal()loop currently schedules continuation turns with no minimum interval. The model callsTaskListevery 1-2 seconds to check agent status, consuming 100-200 tokens per turn and wasting a large amount of context over a long-running goal.We fixed this in our fork by adding a 15-second minimum interval between goal continuation turns and by updating the goal reminder/continuation prompt to tell the model not to poll background tasks with
TaskList(prefer automatic completion notifications orTaskOutput(block=true)).Commit with the fix: thecannabisapp@f227bb20
If the maintainers want to merge this, the key changes are in
packages/agent-core/src/agent/turn/index.ts(thedriveGoalthrottle) andpackages/agent-core/src/agent/injection/goal.ts(the prompt guidance).