Agent Reliability: Claude Stops Mid-Task and Fails to Complete Its Own Plan/Todo List
Title: Agent Reliability: Claude Stops Mid-Task and Fails to Complete Its Own Plan/Todo List
Issue Type: Bug Report / Feature Request (Reliability)
Claude Code Version: 1.0.85
Description
When given a complex, multi-step task, Claude Code correctly generates a detailed plan, creates a TodoWrite list to track its progress, but then prematurely stops after completing only a portion of the plan. It provides a summary as if the entire task is complete, leaving the user to notice the incomplete work and manually prompt it to continue.
This undermines the agent's reliability for complex tasks and requires the user to micromanage the execution of a plan that the agent itself created.
Steps to Reproduce
- Provide Claude Code with a complex task that requires a multi-phase implementation plan (e.g., "Refactor this entire module for performance and add a new feature").
- Allow Claude to analyze the codebase, generate a plan, and populate its todo list using
TodoWrite. - Observe as Claude executes the first few phases of its plan (in my case, Phase 1, 2, and 3a/3b).
- After completing a subset of the tasks, Claude stops and provides a summary of its work, effectively ending the session without user intervention or completing the full plan.
Current Behavior
Claude generated a comprehensive plan and correctly tracked it in a todo list. However, after completing some of the initial tasks, it stopped and acted as if the job was done. It did not automatically proceed to the next pending items on its list.
Here is the state of the todo list when Claude decided to stop:
- [x] Phase 1: Enable strict mode (
set -euo pipefail) in all shell scripts - [x] Phase 2: Create permission mode display (collector + renderer)
- [x] Phase 3a: Replace external commands with parameter expansion
- [x] Phase 3b: Parallelize data collection in
data_manager.sh - [x] Run comprehensive test suite
- [ ] Phase 4a: Display active sub-agent
- [ ] Phase 4b: Implement coproc for Anthropic status
- [ ] Phase 5: Update input parser for full compliance
- [ ] Phase 6: Additional improvements (dependencies, mapfile, arrays)
Claude then required a new user prompt ("commit and push") to do anything further, and did not resume its plan afterward.
Reference Session Log: d57c481d-b3c1-4ae3-97a2-3257fe5c9abd.jsonl.txt
Expected Behavior
After completing a task from its todo list (e.g., "Phase 3b"), the agent's next thought process should be to consult its own todo list. Upon seeing pending tasks, it should automatically announce "Now proceeding to Phase 4a..." and begin the next task.
The agent should only consider the overall task complete and stop execution when all items on its self-generated todo list are marked as completed, or if it encounters an unrecoverable error.
Suggestion for a More Robust Mechanism
The core issue is a lack of a "plan execution loop." The user's role should be to approve the plan, not to repeatedly nudge the agent to execute each step.
A more robust mechanism could be implemented in a few ways:
- Self-Correction Prompting: After each major step or tool use, the agent's internal monologue/prompt should guide it to check the
TodoWritelist status. If unchecked items remain, it should be instructed to continue with the next one.
- System-Level
StopHook: Before the agent is allowed to exit its main loop and stop, a system hook could check the status of the session's todo list. If pending tasks exist, the hook could block the stop action and inject a new prompt back into the context, such as:
> "System: Your plan is not yet complete. The following tasks remain: [list of pending tasks]. Please continue with the next step."
- Explicit State Management: The agent should enter an "Executing Plan" state after a plan is approved. It should only be able to exit this state if the todo list is empty, if it fails repeatedly, or if the user explicitly cancels the entire operation with
Ctrl+C.
This would make Claude Code a far more reliable and truly autonomous partner for complex development tasks. Thank you for your consideration.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗