Skip to content

Commit 1327f85

Browse files
committed
chore(opencode): compress todowrite tool prompt
Rewrites the TodoWrite tool description to reduce token usage by ~75% (1,380 -> 337 words) while preserving all behavioral guardrails. Trimmed: - Eight full example blocks (4 use / 4 skip) with reasoning paragraphs reduced to one-line example summaries. - Redundant framing prose and duplicated rules. Preserved: - All use / skip trigger conditions. - Task states (pending, in_progress, completed, cancelled) and the one-in_progress-at-a-time invariant. - Anti-hallucination rule: only mark completed after the work is actually done (including any required verification). - Follow-up handling for both blocked and successfully completed tasks. Clarified: - 'Distinct steps or actions (not just 3 tool calls for a single conceptual step)' avoids triggering todos for simple multi-grep lookups. - Preserve user-provided commands verbatim (flags, args, order).
1 parent b1cb718 commit 1327f85

1 file changed

Lines changed: 44 additions & 167 deletions

File tree

Lines changed: 44 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,167 +1,44 @@
1-
Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
2-
It also helps the user understand the progress of the task and overall progress of their requests.
3-
4-
## When to Use This Tool
5-
Use this tool proactively in these scenarios:
6-
7-
1. Complex multistep tasks - When a task requires 3 or more distinct steps or actions
8-
2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
9-
3. User explicitly requests todo list - When the user directly asks you to use the todo list
10-
4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
11-
5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.
12-
6. After completing a task - Mark it complete and add any new follow-up tasks
13-
7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.
14-
15-
## When NOT to Use This Tool
16-
17-
Skip using this tool when:
18-
1. There is only a single, straightforward task
19-
2. The task is trivial and tracking it provides no organizational benefit
20-
3. The task can be completed in less than 3 trivial steps
21-
4. The task is purely conversational or informational
22-
23-
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
24-
25-
## Examples of When to Use the Todo List
26-
27-
<example>
28-
User: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!
29-
Assistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.
30-
*Creates todo list with the following items:*
31-
1. Create dark mode toggle component in Settings page
32-
2. Add dark mode state management (context/store)
33-
3. Implement CSS-in-JS styles for dark theme
34-
4. Update existing components to support theme switching
35-
5. Run tests and build process, addressing any failures or errors that occur
36-
*Begins working on the first task*
37-
38-
<reasoning>
39-
The assistant used the todo list because:
40-
1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes
41-
2. The user explicitly requested tests and build be run afterward
42-
3. The assistant inferred that tests and build need to pass by adding "Ensure tests and build succeed" as the final task
43-
</reasoning>
44-
</example>
45-
46-
<example>
47-
User: Help me rename the function getCwd to getCurrentWorkingDirectory across my project
48-
Assistant: Let me first search through your codebase to find all occurrences of 'getCwd'.
49-
*Uses grep or search tools to locate all instances of getCwd in the codebase*
50-
Assistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.
51-
*Creates todo list with specific items for each file that needs updating*
52-
53-
<reasoning>
54-
The assistant used the todo list because:
55-
1. First, the assistant searched to understand the scope of the task
56-
2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps
57-
3. The todo list helps ensure every instance is tracked and updated systematically
58-
4. This approach prevents missing any occurrences and maintains code consistency
59-
</reasoning>
60-
</example>
61-
62-
63-
<example>
64-
User: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.
65-
Assistant: I'll help implement these features. First, let's add all the features to the todo list.
66-
*Creates a todo list breaking down each feature into specific tasks based on the project architecture*
67-
Assistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.
68-
69-
<reasoning>
70-
The assistant used the todo list because:
71-
1. The user provided multiple complex features to implement in a comma separated list
72-
2. The todo list helps organize these large features into manageable tasks
73-
3. This approach allows for tracking progress across the entire implementation
74-
</reasoning>
75-
</example>
76-
77-
<example>
78-
User: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>
79-
Assistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.
80-
*Reviews component structure, render patterns, state management, and data fetching*
81-
Assistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.
82-
*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*
83-
Let's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>
84-
85-
<reasoning>
86-
The assistant used the todo list because:
87-
1. First, the assistant examined the codebase to identify specific performance issues
88-
2. Based on this analysis, it identified multiple optimization opportunities
89-
3. Performance optimization is a non-trivial task requiring multiple steps
90-
4. The todo list helps methodically track improvements across different components
91-
5. This systematic approach ensures all performance bottlenecks are addressed
92-
</reasoning>
93-
</example>
94-
95-
## Examples of When NOT to Use the Todo List
96-
97-
<example>
98-
User: How do I print 'Hello World' in Python?
99-
Assistant: In Python, you can print "Hello World" with this simple code:
100-
101-
python
102-
print("Hello World")
103-
104-
This will output the text "Hello World" to the console when executed.</assistant>
105-
106-
<reasoning>
107-
The assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.
108-
</reasoning>
109-
</example>
110-
111-
<example>
112-
User: What does the git status command do?
113-
Assistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.
114-
115-
<reasoning>
116-
The assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.
117-
</reasoning>
118-
</example>
119-
120-
<example>
121-
User: Can you add a comment to the calculateTotal function to explain what it does?
122-
Assistant: Sure, let me add a comment to the calculateTotal function to explain what it does.
123-
* Uses the Edit tool to add a comment to the calculateTotal function *
124-
125-
<reasoning>
126-
The assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.
127-
</reasoning>
128-
</example>
129-
130-
<example>
131-
User: Run npm install for me and tell me what happens.
132-
Assistant: I'll run the npm install command for you.
133-
134-
*Executes: npm install*
135-
136-
The command completed successfully. Here's the output:
137-
[Output of npm install command]
138-
139-
All dependencies have been installed according to your package.json file.
140-
141-
<reasoning>
142-
The assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.
143-
</reasoning>
144-
</example>
145-
146-
## Task States and Management
147-
148-
1. **Task States**: Use these states to track progress:
149-
- pending: Task not yet started
150-
- in_progress: Currently working on (limit to ONE task at a time)
151-
- completed: Task finished successfully
152-
- cancelled: Task no longer needed
153-
154-
2. **Task Management**:
155-
- Update task status in real-time as you work
156-
- Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
157-
- Only have ONE task in_progress at any time
158-
- Complete current tasks before starting new ones
159-
- Cancel tasks that become irrelevant
160-
161-
3. **Task Breakdown**:
162-
- Create specific, actionable items
163-
- Break complex tasks into smaller, manageable steps
164-
- Use clear, descriptive task names
165-
166-
When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.
167-
1+
Create and maintain a structured task list for the current coding session. Tracks progress, organizes multi-step work, and surfaces status to the user.
2+
3+
## When to use
4+
Use proactively when:
5+
- The task requires 3+ distinct steps or actions (not just 3 tool calls for a single conceptual step)
6+
- The work is non-trivial and benefits from planning
7+
- The user provides multiple tasks (numbered or comma-separated) or explicitly asks for a todo list
8+
- New instructions arrive — capture them as todos
9+
- You start a task — mark it `in_progress` (only one at a time) before working
10+
- You finish a task — mark it `completed` and add any follow-ups discovered during the work
11+
12+
## When NOT to use
13+
Skip when:
14+
- The work is a single, straightforward task (or <3 trivial steps)
15+
- The request is purely informational or conversational
16+
- Tracking adds no organizational value
17+
18+
## States
19+
- `pending` — not started
20+
- `in_progress` — actively working (exactly ONE at a time)
21+
- `completed` — finished successfully
22+
- `cancelled` — no longer needed
23+
24+
## Rules
25+
- Update status in real time; don't batch completions
26+
- Mark `completed` only after the required work is actually done, including any required verification. Never based on intent.
27+
- Keep exactly one `in_progress` while work remains
28+
- If blocked or partial, keep it `in_progress` and add a follow-up todo describing the blocker
29+
- Preserve user-provided commands verbatim (flags, args, order)
30+
- Items should be specific and actionable; break large work into smaller steps
31+
32+
## Examples
33+
34+
Use it:
35+
- "Add a dark mode toggle and run the tests" → multi-step feature + explicit verification
36+
- "Rename getCwd → getCurrentWorkingDirectory across the repo" → grep reveals 15 occurrences in 8 files
37+
- "Implement registration, catalog, cart, checkout" → multiple complex features
38+
39+
Skip it:
40+
- "How do I print Hello World in Python?" → informational
41+
- "Add a comment to calculateTotal" → single edit
42+
- "Run npm install and tell me what happened" → one command
43+
44+
When in doubt, use it.

0 commit comments

Comments
 (0)