Skip to content

feat: optimize todo list token efficiency #5611

@KJ7LNW

Description

@KJ7LNW

What specific problem does this solve?

When the AI model updates a todo list using the update_todo_list tool, it must output the entire list with every update. This is inefficient because:

  • Each update requires outputting the complete list, even when modifying a single item
  • The environment details already shows the current todo list state in the reminder section
  • Outputting the full list with every update wastes expensive output tokens
  • For large todo lists, this redundancy significantly increases token usage and costs
  • Users experience noticeable delays waiting for the full list output tokens to arrive
  • Development speed is reduced as users must wait for redundant output to complete
  • Users experience no benefit from seeing the same list repeated multiple times

This affects all users running tasks with todo lists, particularly impacting complex tasks with many updates. The current implementation in updateTodoListTool.ts forces a complete list replacement on every update, when often only a status change for one item is needed.

The impact on development speed is especially noticeable with longer todo lists, as users must wait for the entire list to be output before they can continue their work, even when only making a small change to a single item.

Additional context

Current implementation in updateTodoListTool.ts:

export async function setTodoListForTask(cline?: Task, todos?: TodoItem[]) {
  if (cline === undefined) return
  cline.todoList = Array.isArray(todos) ? todos : []
}

This shows the direct replacement of the entire list, rather than supporting partial updates.

Proposed Solution

Initial creation of todo list:

<update_todo_list>
<todos>
- [ ] Task 1: Implement feature X
- [ ] Task 2: Write tests
- [ ] Task 3: Update documentation
</todos>
</update_todo_list>

Updating a single task (only sends changed item):

<update_todo_list>
<todos>
- [x] Task 1: Implement feature X
</todos>
</update_todo_list>

Internal state after update (maintained by tool, not output):

- [x] Task 1: Implement feature X
- [ ] Task 2: Write tests
- [ ] Task 3: Update documentation

Acceptance Criteria

Given a task with an existing todo list
When I update the status of a single item
Then only that item's data is sent to the tool
And the response does not echo the full list
And the environment details show the updated state
And the user experiences no delay from redundant output
But no redundant list output is generated

Technical considerations

  • Requires modifying updateTodoListTool.ts to handle partial updates
  • Need to implement merge logic for partial updates
  • Must maintain backwards compatibility for existing todo list features
  • Environment details reminder section already handles display
  • Performance optimization for faster response times

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or requestIssue - Needs ScopingValid, but needs effort estimate or design input before work can start.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions