Skip to content
Open
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
20 changes: 20 additions & 0 deletions packages/types/src/__tests__/message.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/types/src/message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { z } from "zod"
import { todoItemSchema } from "./todo.js"

/**
* ClineAsk
Expand Down Expand Up @@ -259,6 +260,8 @@ export const clineMessageSchema = z.object({
text: z.string().optional(),
images: z.array(z.string()).optional(),
partial: z.boolean().optional(),
/** Initial delegated-task checklist, stored with its first message before model updates. */
initialTodos: z.array(todoItemSchema).optional(),
reasoning: z.string().optional(),
conversationHistoryIndex: z.number().optional(),
checkpoint: z.record(z.string(), z.unknown()).optional(),
Expand Down
43 changes: 0 additions & 43 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 56 additions & 2 deletions src/core/environment/__tests__/getEnvironmentDetails.spec.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/core/environment/getEnvironmentDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,9 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
}
}

const todoListEnabled =
state && typeof state.apiConfiguration?.todoListEnabled === "boolean"
? state.apiConfiguration.todoListEnabled
: true
const reminderSection = todoListEnabled ? formatReminderSection(cline.todoList) : ""
const todoListEnabled = cline.apiConfiguration?.todoListEnabled ?? true
// A mode's profile can disable the update tool without clearing the task's list.
// Keep an existing list in the next request so superseded environment blocks can be removed safely.
const reminderSection = formatReminderSection(cline.todoList, todoListEnabled)
return `<environment_details>\n${details.trim()}\n${reminderSection}\n</environment_details>`
}
18 changes: 11 additions & 7 deletions src/core/environment/reminder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { TodoItem, TodoStatus } from "@roo-code/types"
/**
* Format the reminders section as a markdown block in English, with basic instructions.
*/
export function formatReminderSection(todoList?: TodoItem[]): string {
export function formatReminderSection(todoList?: TodoItem[], canUpdate = true): string {
if (!todoList || todoList.length === 0) {
return "You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps."
return canUpdate
? "You have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps."
: ""
}
const statusMap: Record<TodoStatus, string> = {
pending: "Pending",
Expand All @@ -29,10 +31,12 @@ export function formatReminderSection(todoList?: TodoItem[]): string {
})
lines.push("")

lines.push(
"",
"IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.",
"",
)
if (canUpdate) {
lines.push(
"",
"IMPORTANT: When task status changes, remember to call the `update_todo_list` tool to update your progress.",
"",
)
}
return lines.join("\n")
}
2 changes: 1 addition & 1 deletion src/core/prompts/tools/native-tools/new_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const MODE_PARAMETER_DESCRIPTION = `Slug of the mode to begin the new task in (e

const MESSAGE_PARAMETER_DESCRIPTION = `Initial user instructions or context for the new task`

const TODOS_PARAMETER_DESCRIPTION = `Optional initial todo list written as a markdown checklist; required when the workspace mandates todos`
const TODOS_PARAMETER_DESCRIPTION = `Optional string containing the full Markdown checklist, e.g. "[ ] First task\\n[-] Current task". Use [ ], [-], or [x] for status. Required when the workspace mandates todos; otherwise use null to omit.`

export default {
type: "function",
Expand Down
39 changes: 11 additions & 28 deletions src/core/prompts/tools/native-tools/update_todo_list.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
import type OpenAI from "openai"
import { TODO_ARGUMENT_EXAMPLE } from "../../../../shared/todoChecklist"

const UPDATE_TODO_LIST_DESCRIPTION = `Replace the entire TODO list with an updated checklist reflecting the current state. Always provide the full list; the system will overwrite the previous one. This tool is designed for step-by-step task tracking, allowing you to confirm completion of each step before updating, update multiple task statuses at once (e.g., mark one as completed and start the next), and dynamically add new todos discovered during long or complex tasks.
const UPDATE_TODO_LIST_DESCRIPTION = `Replace the entire task TODO list. Include all unfinished tasks and any completed tasks you want to retain; this is a replacement, not an append.

Checklist Format:
- Use a single-level markdown checklist (no nesting or subtasks)
- List todos in the intended execution order
- Status options: [ ] (pending), [x] (completed), [-] (in progress)
Call this native tool with JSON arguments. The todos field is a STRING containing a single-level Markdown checklist. Escape line breaks as \\n inside the JSON string.
- [ ] means pending, [-] means in progress, [x] means completed.
- Put tasks in execution order. Mark completed only when fully accomplished.
- Add newly discovered work and update several statuses in one call when useful.
- Use an empty string only to intentionally clear the entire list.

Core Principles:
- Before updating, always confirm which todos have been completed
- You may update multiple statuses in a single update
- Add new actionable items as they're discovered
- Only mark a task as completed when fully accomplished
- Keep all unfinished tasks unless explicitly instructed to remove
Example JSON arguments:
${TODO_ARGUMENT_EXAMPLE}

Example: Initial task list
{ "todos": "[x] Analyze requirements\\n[x] Design architecture\\n[-] Implement core logic\\n[ ] Write tests\\n[ ] Update documentation" }
Use this for multi-step work that needs progress tracking; skip it for trivial tasks or purely conversational replies.`

Example: After completing implementation
{ "todos": "[x] Analyze requirements\\n[x] Design architecture\\n[x] Implement core logic\\n[-] Write tests\\n[ ] Update documentation\\n[ ] Add performance benchmarks" }

When to Use:
- Task involves multiple steps or requires ongoing tracking
- Need to update status of several todos at once
- New actionable items are discovered during execution
- Task is complex and benefits from stepwise progress tracking

When NOT to Use:
- Only a single, trivial task
- Task can be completed in one or two simple steps
- Request is purely conversational or informational`

const TODOS_PARAMETER_DESCRIPTION = `Full markdown checklist in execution order, using [ ] for pending, [x] for completed, and [-] for in progress`
const TODOS_PARAMETER_DESCRIPTION = `String containing the full checklist in execution order, using [ ] for pending, [x] for completed, and [-] for in progress. JSON arguments example: ${TODO_ARGUMENT_EXAMPLE}`

export default {
type: "function",
Expand Down
34 changes: 34 additions & 0 deletions src/core/task-persistence/__tests__/todoHistory.spec.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading