[Feature] Option to preserve completed tasks in named task lists

Resolved 💬 3 comments Opened Mar 24, 2026 by namho-hong Closed Apr 30, 2026

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:

  1. CLAUDE_CODE_TASK_LIST_ID=my-project claude
  2. Create 2 tasks via TaskCreate
  3. Complete task A via TaskUpdate → file preserved ✅
  4. Complete task B via TaskUpdate (all tasks now completed) → all JSON files deleted
  5. ls ~/.claude/tasks/my-project/ → only .highwatermark and .lock remain

Why this matters

We're using named task lists as a team collaboration tool — a lightweight single source of truth for task management:

  • owner field for assigning tasks to team members
  • metadata for deadline, priority, and other tracking info
  • blocks/blockedBy for 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 PostToolUse hook 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗