[BUG] Task list ID not inherited when transitioning from plan mode to execution

Resolved 💬 3 comments Opened Jan 29, 2026 by purecod3 Closed Jan 29, 2026

Description

When exiting plan mode and beginning execution, Claude Code creates a new session instead of continuing with the same session ID. This causes task updates to be lost because:

  1. Tasks created during plan mode are persisted under the plan session's ID
  2. Execution happens in a new session with a different ID
  3. TaskUpdate calls in the new session update in-memory tasks but don't persist to the original task files

Steps to Reproduce

  1. Start Claude Code and enter plan mode
  2. Create tasks (via TaskCreate) - they persist to ~/.claude/tasks/{plan-session-id}/
  3. Exit plan mode and begin execution
  4. Use TaskUpdate to mark tasks as in_progress and completed
  5. Check the task files on disk - still show "status": "pending"

Evidence

After a full session with plan mode → execution:

$ ls ~/.claude/projects/-mnt-c-Users-{username}-Repos-tasktest/
43bb0393-387c-488f-9d9f-71dbfc2cdc6f.jsonl  # Plan mode session (135KB)
a785bf3c-dba4-4673-b5a4-675837ab398d.jsonl  # Execution session (3.2MB)

$ ls ~/.claude/tasks/
43bb0393-387c-488f-9d9f-71dbfc2cdc6f/  # Has 10 task JSON files (all "pending")
a785bf3c-dba4-4673-b5a4-675837ab398d/  # Empty (just .lock file)

Checking for status updates in each session transcript:

$ grep -c '"status":"completed"' .../43bb0393...jsonl
0

$ grep -c '"status":"completed"' .../a785bf3c...jsonl
30  # Updates happened here but persisted nowhere

Expected Behavior

Either:

  1. Plan mode and execution should share the same session ID, OR
  2. The task list ID should be automatically inherited when transitioning from plan to execution (similar to what's expected with --fork-session)

Actual Behavior

  • New session ID is created after exiting plan mode
  • Tasks remain in the old session's folder with "status": "pending"
  • 42 TaskUpdate calls in the execution session had no persistent effect

Impact

  • Cannot resume task lists across sessions
  • Work tracking is lost if session ends
  • Defeats the purpose of persistent task storage

Environment

  • Platform: Linux (WSL2)
  • Claude Code version: 2.1.21

Related Issues

  • #20664 - --fork-session does not inherit CLAUDE_CODE_TASK_LIST_ID (same root cause: session transitions don't preserve task list context)

View original on GitHub ↗

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