[BUG] /clear erases task list (TaskCreate/TaskList) despite persistence guarantee
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Running /clear wipes out the task list created via TaskCreate, making all tasks inaccessible via TaskList. This contradicts the documented behavior which states tasks persist across context operations since they are stored on disk at ~/.claude/tasks/.
This issue was previously reported in #18081 and #23316, both of which were closed as stale/duplicate without a fix being shipped. The bug is still reproducible on the latest version.
Repro:
- Start a Claude Code session
- Create a task using
TaskCreatewith any subject/description - Verify the task exists via
TaskList - Run
/clear - Run
TaskListagain
Expected: Task persists — it is stored on disk, not in conversation memory
Actual: TaskList returns "No tasks found"
What Should Happen?
/clear should only clear conversation history. Tasks stored in ~/.claude/tasks/ should remain accessible via TaskList after /clear because they are a disk-based construct, not an in-memory/conversation construct.
Error Messages/Logs
> TaskList
No tasks found
Steps to Reproduce
- Start a Claude Code session in any project
- Create a task:
TaskCreatewith subject "Test task" - Confirm it exists:
TaskList→ task appears - Run
/clear - Run
TaskListagain → "No tasks found"
Related Issues
- #18081 — closed as stale (unresolved)
- #23316 — closed as duplicate of #18081 (also unresolved)
Claude Model
claude-sonnet-4-6
Is this a regression?
No — this has been present across multiple versions per the referenced issues
Claude Code Version
Latest (2.x)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
The workaround of using CLAUDE_CODE_TASK_LIST_ID=my-project claude to name a task list may help in some cases, but the core bug — that /clear destroys disk-persisted tasks — should be fixed so the tool behaves as documented.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗