You're deep in a complex refactoring project. You've built a mental map of what needs to happen: fix the authentication module, then update the user service that depends on it, then run the integration tests. Claude knows this plan too. You've discussed it. It's all in context.
Then you hit the wall. Context is at 80%. Quality is degrading. You need to run /clear.
And the plan vanishes.
This is the ephemeral state problem. Your project roadmap lived only in the conversation. Clear the context, lose the roadmap.
Claude Code's Tasks system solves this. Tasks are filesystem-backed persistent state. Your plan lives on disk, not in context. Clear freely. The roadmap survives.
Before Tasks, Claude Code had Todos. You might have seen them in the sidebar: an orange sticky-note icon. They helped Claude remember what to do during a session.
The problem: Todos lived in the chat. When you ran /clear or /compact, they could disappear along with your conversation history. The plan existed only as long as the context existed.
This isn't a small upgrade. It's a paradigm shift in how plans relate to context.
Here's the key insight, directly from the VentureBeat analysis of this feature:
"Because the plan is stored on disk, users can run /clear or /compact to free up tokens for the model's reasoning, without losing the project roadmap."
This is context engineering in action. You've learned that context fills up and quality degrades. You've learned about the attention budget and position sensitivity. Now you have a tool that decouples your plan from your context.
Before Tasks:
After Tasks:
You interact with tasks by talking to Claude. Claude uses internal tools (TaskCreate, TaskUpdate, TaskList, TaskGet) behind the scenes—you don't call these directly.
What you say:
What Claude does internally: Uses TaskCreate to store the task with a subject, description, and status.
What you see: The task appears in your task list (press Ctrl+T to toggle the view).
What you say:
or
What you see:
A task is "available" when:
What you say:
Claude breaks this into discrete tasks and wires up the dependencies so tasks become available only when their prerequisites complete.
What you say:
or Claude marks it complete automatically after finishing the work.
What happens: Task 1 moves to completed. Tasks 2 and 3 (which were blocked by #1) automatically become available.
Tasks are stored as files in ~/.claude/tasks/, not in your conversation. That's why they persist when you clear context—they're on disk, not in memory.
Tasks support Directed Acyclic Graphs (DAGs). Task 3 can be blocked by Tasks 1 and 2. When both complete, Task 3 automatically becomes available.
This is powerful for complex projects:
Task 3 (integration tests) is blocked by Tasks 2 and 4. Both must complete before testing can begin.
How you'd set this up:
Claude handles the internal mechanics—creating the tasks and wiring up the dependency graph. You describe WHAT you need; Claude figures out HOW to structure it.
Because tasks live on disk (~/.claude/tasks/), you get three benefits:
1. Crash Recovery: If your terminal crashes, your tasks persist. Resume your session, ask "What tasks do we have?", and continue where you left off.
2. Session Independence: Tasks don't consume context tokens. A 50-task project plan uses zero tokens in your conversation—it's all on disk.
3. Clear Freely: Run /clear whenever context fills up. Your roadmap survives because it was never in context to begin with.
Armed with Tasks, here's the pattern for long-running work:
Phase 1: Plan Create tasks at the beginning of a work session when context is fresh:
Claude breaks this into discrete tasks (extract terms, identify provisions, flag issues, cross-reference, draft recommendations) and sets up the dependency chain automatically.
Phase 2: Clear When context fills up (60-80%), clear aggressively:
Your plan survives. The 6-task roadmap persists on disk.
Phase 3: Execute After clearing, check what's available and continue:
Claude checks the task list, finds which tasks are unblocked, and continues execution.
The key insight: You're not losing information when you clear. You're freeing context for reasoning while your strategic plan persists.
Here's how Tasks enable complex projects across different domains:
Legal: Due Diligence Review
Marketing: Campaign Development
Research: Literature Synthesis
How execution flows:
Why this works: Each task runs with focused context. The agent drafting the executive summary doesn't inherit the noise from analyzing 50 contracts—it gets the cross-referenced findings and writes clearly. Context stays clean at every stage.
This is the pattern: plan → clear → delegate → synthesize. The task system manages the coordination. You focus on the work.
For team workflows or parallel execution, multiple sessions can share the same task list using the CLAUDE_CODE_TASK_LIST_ID environment variable.
Terminal A (Writer):
Terminal B (Reviewer):
Both sessions now see the same tasks. When Writer marks a task complete, Reviewer sees it update. When Reviewer creates a feedback task, Writer sees it appear.
The Writer/Reviewer Pattern:
This enables parallel execution with coordination. No stepping on each other's work. No duplicate effort. The task system manages handoffs.
You might wonder: "How are Tasks different from the progress files we'll learn about later in this chapter?"
Use both together: Tasks track the WHAT (action items). Progress files track the WHY (decisions and discoveries). Tasks tell you what to do next. Progress files tell you what you've learned along the way.
Objective: Experience the plan-clear-execute pattern with real work.
Setup:
Protocol:
Step 1: Plan with Dependencies
Ask Claude to create a task plan:
Verify by pressing Ctrl+T or asking "Show me the tasks."
Step 2: Work Until Context Fills
Execute tasks until you notice quality degradation (typically 60-80% context usage).
Check with /context.
Step 3: Clear and Verify
Run /clear.
Then immediately ask: "What tasks do we have?" (or press Ctrl+T).
Observation: Your plan survived the clear. Your strategic roadmap persists even though your conversation history is gone.
Step 4: Continue Execution
Ask Claude to continue:
Expected Finding: The workflow continues seamlessly despite the context clear. This is the power of filesystem-backed state.
Choose a project from your domain:
Legal:
Marketing:
Research:
What you're learning: Notice how Claude breaks down your goal into discrete tasks and figures out which ones depend on others. You describe the outcome; Claude handles the structure.
After Claude creates the tasks: Press Ctrl+T to see them in your terminal.
Then run /clear in your terminal. After clearing:
What you're learning: Your tasks survived because they're on disk, not in context. You just freed your entire context window while keeping your project roadmap intact.
What you're learning: When a blocking task completes, dependent tasks automatically become available. This is the DAG in action—no manual coordination needed.
What you're learning: Claude will explain the CLAUDE_CODE_TASK_LIST_ID pattern. Try it yourself:
Both sessions now share the same task list.