[Feature] Option to preserve completed tasks in named task lists
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When all tasks in a task list reach completed status, Claude Code automatically deletes all task JSON files from ~/.claude/tasks/<list-id>/.
For session-ID-based task lists, this makes sense — they're ephemeral by nature and cleaning up after a session is reasonable.
However, for named task lists created via CLAUDE_CODE_TASK_LIST_ID, this auto-deletion is problematic. Named task lists are intentionally persistent and shared across sessions, which suggests the user wants to retain them beyond a single session's lifecycle.
Reproduction:
CLAUDE_CODE_TASK_LIST_ID=my-project claude- Create 2 tasks via
TaskCreate - Complete task A via
TaskUpdate→ file preserved ✅ - Complete task B via
TaskUpdate(all tasks now completed) → all JSON files deleted ❌ ls ~/.claude/tasks/my-project/→ only.highwatermarkand.lockremain
Why this matters
We're using named task lists as a team collaboration tool — a lightweight single source of truth for task management:
ownerfield for assigning tasks to team membersmetadatafor deadline, priority, and other tracking infoblocks/blockedByfor dependency DAGs- Git-tracked: the task list directory is committed to the project repository, so the team can review task history through
git log
When all tasks complete and files are deleted:
- Completion history is lost (who did what, when)
- Metadata (deadlines, priorities) is gone
- Git commit targets disappear before they can be committed
- The current workaround — a
PostToolUsehook that copies files before deletion — requires every team member to configure the same hook
Proposed Solution
Add an option to disable auto-deletion for named task lists:
{
"taskList": {
"preserveCompleted": true
}
}
true: When all tasks complete, files remain with"status": "completed"in named task lists. Session-ID-based lists can continue to behave as they do today.false(default): Current behavior preserved — no breaking change.
Completed tasks could be shown in a collapsed "Done" section in TaskList output to avoid cluttering the active task view.
Related Issues
- #31420, #28208 — Both relate to task data loss in different contexts, but neither addresses the intentional auto-deletion of completed named task lists described here.
Priority
High - Significant impact on productivity
Feature Category
Task list
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗