Long-Running Tasks
August 13, 2026 · View on GitHub
Kimix provides the /plan command for complex or time-consuming tasks: it lets a dedicated Planner Agent generate a reviewable task plan, then a Worker Agent serially implements and reviews it after confirmation.
/plan
Flow: plan generation → user review → execution → review. Best for tasks that need explicit steps and user confirmation before execution.
Basic Usage
/plan
>>>> Start input requirement for plan, end with /end, cancel with /cancel
Add complete error handling to this project:
1. Add parameter validation to all functions
2. Unify exception types and error codes
3. Add logging
/end
Execution Flow (prompt_plan_async)
See src/kimix/utils/prompt.py and src/kimix/cli_impl/commands.py.
Phase 1: Plan Generation
- Create Planner session: Using
agent_planner.jsonconfig and theTodoMakersystem prompt. - Specify plan file: If no file path is provided, a
plan_<uuid>.mdis auto-generated under.kimix_cache/in the current directory; if the specified file already exists, it is deleted first. - Generate plan: The Planner reads the requirement, breaks the task into steps, and writes the plan file via the
WritePlantool. Generation retries up to 3 times to ensure the plan is written correctly. - Open for review: After generation, the file is opened with the system default application for review.
Phase 2: Review & Revision
After the plan is generated, a review loop begins:
- Prompt:
Do you want to implement the plan? (y/n)- Input
y: enter the execution phase. - Input
nor anything else: enter the revision flow.
- Input
- Revision prompt:
Please describe the changes you want (/quit to give up):- Input
/quit: abandon execution. - Input specific feedback: the Planner updates the plan file using the
WritePlanorEditPlantools based on the feedback, then reopens it for review. The loop repeats until confirmed or abandoned.
- Input
Phase 3: Execution & Review
- Close Planner session: After user confirmation, the Planner session is closed.
- Create Worker session: A regular session is created with the default Worker Agent.
- Send implementation prompt:
- If the plan file is smaller than 100 KB, the plan content is embedded directly in the prompt;
- If the plan file is larger than 100 KB, the Agent is prompted to read and execute the plan file.
- Append review prompt: After implementation, an additional review prompt is sent asking the Agent to check whether the plan was fully completed.
Specifying the Plan Output File
Use /plan:<file> to specify the plan output path. Note: this is the plan output file; the task requirement is still provided via multi-line input:
/plan:docs/plan.md
>>>> Start input requirement for plan, end with /end, cancel with /cancel
Add complete error handling to this project:
1. Add parameter validation to all functions
2. Unify exception types and error codes
3. Add logging
/end
If the specified plan file already exists, it will be overwritten.
Long Prompts & Error Handling
Auto-Truncate
Prompts exceeding 65536 chars are exported to a temp file and replaced with read and execute: <temp_file>.
Auto-Retry
prompt_async retries up to 5 times with exponential backoff:
| Status | Behavior |
|---|---|
429 | Wait min(2^attempt, 60)s, retry |
400, 500, 502, 503 | Exponential backoff, retry |
| Other | Wait 1s, retry; throw on last attempt |
TODO Reminder
After each main prompt execution, the system checks whether there are unfinished todos in the current session. If so, a <system-reminder> is automatically appended reminding the Agent to complete all pending / in_progress todos before finishing. This works with the todo_write tool to ensure intermediate steps are not missed in long tasks.
todo_write
Progress tracking tool, auto-invoked during execution.
- Read mode (
todos=null): returns current todo list - Write mode (list provided): updates and persists todos
class Todo:
title: str
status: str # "pending" | "in_progress" | "done"
Persistence:
- Root Agent:
state.todos - Sub Agent:
state.jsonin agent directory
When to Use /plan
| Feature | /plan |
|---|---|
| Execution | Serial |
| Task split | Linear steps |
| Resume | No (current implementation completes generation, review, execution, and review in one flow) |
| Progress | Step visualization |
| Use case | Ordered, dependent tasks |
| Overhead | Lower (single session) |
| Examples | Feature implementation, code refactoring |
Choose /plan when the task needs explicit steps, user review, and confirmation before execution, suitable for one-shot long tasks.