Tasks created via TaskCreate are lost during conversation compaction
Description
When a conversation is compacted (either manually via /compact or automatically at context limits), all tasks created via TaskCreate / TaskUpdate are permanently lost. There is no mechanism to persist or restore them.
Steps to Reproduce
- Start a Claude Code conversation
- Create multiple tasks using
TaskCreate(e.g., 20+ tasks for a complex project) - Work through tasks, updating status with
TaskUpdate - Trigger compaction (
/compactor reach context limit) - Run
TaskListafter compaction
Expected Behavior
Tasks should survive compaction, or at minimum:
- Tasks should be included in the compaction summary
- Or tasks should be persisted to a file before compaction
- Or the task system should use file-backed storage instead of in-memory only
Actual Behavior
TaskList returns "No tasks found" after compaction. All task state (subjects, descriptions, statuses, dependencies) is completely lost with no way to recover.
Impact
For complex multi-step projects (in this case, 20+ design tasks across 12 modules), losing the task list means:
- No record of what was completed vs pending
- No record of task dependencies
- User must manually reconstruct the entire task list from conversation memory
- Risk of duplicated or missed work
Environment
- Claude Code CLI
- Model: claude-opus-4-6 (1M context)
- macOS Darwin 24.6.0
Suggested Fix
Either:
- Persist tasks to a file (e.g.,
.claude/tasks.json) so they survive compaction - Include task state in compaction summary so they can be auto-reconstructed
- Warn before compaction if there are active tasks, giving the agent a chance to persist them
Workaround
Manually maintain a TODO.md file in the project directory mirroring all task state. This is what I'm now doing, but it defeats the purpose of the built-in task tools.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗