Plan tasks with todos
Keep complex jobs on the rails with Gemini CLIâs built-in task planning. In this guide, youâll learn how to ask for a plan, execute it step-by-step, and monitor progress with the todo list.
Prerequisites
Section titled âPrerequisitesâ- Gemini CLI installed and authenticated.
- A complex task in mind (e.g., a multi-file refactor or new feature).
Why use task planning?
Section titled âWhy use task planning?âStandard LLMs have a limited context window and can âforgetâ the original goal after 10 turns of code generation. Task planning provides:
- Visibility: You see exactly what the agent plans to do before it starts.
- Focus: The agent knows exactly which step itâs working on right now.
- Resilience: If the agent gets stuck, the plan helps it get back on track.
How to ask for a plan
Section titled âHow to ask for a planâThe best way to trigger task planning is to explicitly ask for it.
Prompt:
I want to migrate this project from JavaScript to TypeScript. Please make a plan first.
Gemini will analyze your codebase and use the write_todos tool to generate a
structured list.
Example Plan:
- Create
tsconfig.json. - Rename
.jsfiles to.ts. - Fix type errors in
utils.js. - Fix type errors in
server.js. - Verify build passes.
How to review and iterate
Section titled âHow to review and iterateâOnce the plan is generated, it appears in your CLI. Review it.
- Missing steps? Tell the agent: âYou forgot to add a step for installing
@types/node.â - Wrong order? Tell the agent: âLetâs verify the build after each file, not just at the end.â
The agent will update the todo list dynamically.
How to execute the plan
Section titled âHow to execute the planâTell the agent to proceed.
Prompt: Looks good. Start with the first step.
As the agent works, youâll see the todo list update in real-time above the input box.
- Current focus: The active task is highlighted (e.g.,
[IN_PROGRESS] Create tsconfig.json). - Progress: Completed tasks are marked as done.
How to monitor progress (Ctrl+T)
Section titled âHow to monitor progress (Ctrl+T)âFor a long-running task, the full todo list might be hidden to save space. You can toggle the full view at any time.
Action: Press Ctrl+T.
This shows the complete list, including pending, in-progress, and completed items. Itâs a great way to check âhow much is left?â without scrolling back up.
How to handle unexpected changes
Section titled âHow to handle unexpected changesâPlans change. Maybe you discover a library is incompatible halfway through.
Prompt:
Actually, let's skip the 'server.js' refactor for now. It's too risky.
The agent will mark that task as cancelled or remove it, and move to the next
item. This dynamic adjustment is what makes the todo system powerfulâitâs a
living document, not a static text block.
Next steps
Section titled âNext stepsâ- Explore Session management to save your plan and finish it tomorrow.
- See the Todo tool reference for technical schema details.
- Learn about Memory management to persist planning preferences (e.g., âAlways create a test plan firstâ).