Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import { ApiMessage } from "../task-persistence/apiMessages"
import { getMessagesSinceLastSummary, summarizeConversation } from "../condense"
import { maybeRemoveImageBlocks } from "../../api/transform/image-cleaning"
import { restoreTodoListForTask } from "../tools/updateTodoListTool"
import { TaskComplexityAnalyzer, DEFAULT_AUTO_TODO_CONFIG } from "./TaskComplexityAnalyzer"

// Constants
const MAX_EXPONENTIAL_BACKOFF_SECONDS = 600 // 10 minutes
Expand Down Expand Up @@ -743,6 +744,32 @@ export class Task extends EventEmitter<ClineEvents> {
await this.say("text", task, images)
this.isInitialized = true

// Check if we should automatically create a TODO list for this task
if (task) {
try {
const analyzer = new TaskComplexityAnalyzer(DEFAULT_AUTO_TODO_CONFIG)
const analysis = analyzer.analyzeTask(task)

if (analysis.shouldCreateTodos && analysis.suggestedTodos.length > 0) {
// Create automatic TODO list without user intervention
this.todoList = analysis.suggestedTodos.map((todo, index) => ({
id: `auto-${index + 1}`,
content: todo,
status: "pending" as const,
}))

// Notify user that automatic TODO list was created
await this.say(
"text",
`📋 **Automatic TODO List Created**\n\nBased on the task complexity, I've created a TODO list to help track progress:\n\n${analysis.suggestedTodos.map((todo, i) => `${i + 1}. ${todo}`).join("\n")}\n\nI'll update this list as I work through the task.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the i18n translation function (e.g. t('autoTodoList.created')) for the user‐visible TODO notification rather than an inline hardcoded message. This ensures consistency with translation guidelines.

Suggested change
`📋 **Automatic TODO List Created**\n\nBased on the task complexity, I've created a TODO list to help track progress:\n\n${analysis.suggestedTodos.map((todo, i) => `${i + 1}. ${todo}`).join("\n")}\n\nI'll update this list as I work through the task.`,
t('autoTodoList.created', { todos: analysis.suggestedTodos.map((todo, i) => `${i + 1}. ${todo}`).join("\n") }),

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

)
}
} catch (error) {
// Don't let TODO creation errors interrupt task execution
console.warn("Failed to create automatic TODO list:", error)
}
}

let imageBlocks: Anthropic.ImageBlockParam[] = formatResponse.imageBlocks(images)

console.log(`[subtasks] task ${this.taskId}.${this.instanceId} starting`)
Expand Down
Loading
Loading