> ## Documentation Index
> Fetch the complete documentation index at: https://committ.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Task Draft Store

> The 800+ line Zustand store powering the commitment wizard state machine.

# Task Draft Store

The useTaskDraftStore is the largest Zustand store in the application (\~800 lines, 26KB). It holds the entire state of a commitment being created or edited in the wizard flow.

***

## Core Type

The store manages a single TaskDraft object that mirrors the Convex schema with UI-only extensions:

```typescript theme={null}
type TaskDraft = {
  id: string;
  assigner_id: string | null;
  assignee_id: string | null;
  title: string;
  description?: string;
  visibility: "private" | "public" | "partner_only";
  recurrence: Recurrence;
  conditions: Condition[];
  config: TaskConfig;
  penalty?: PenaltyConfig;
  penalty_waiver?: WaiverConfig;
  cameraTarget: CameraTarget | null;
  isAccountabilityPrefilled: boolean;
};
```

All types are derived directly from the Convex schema via Doc types, ensuring type safety across the stack.

***

## Key Actions

| Action                        | Purpose                                                                                        |
| :---------------------------- | :--------------------------------------------------------------------------------------------- |
| setRecurrence(updates)        | Intelligent recurrence logic that auto-switches between once and weekly based on day selection |
| setSlotLocation(index, loc)   | Attaches a location condition to a specific time slot                                          |
| setSlotBlocklist(index, list) | Attaches an app blocklist to a specific time slot                                              |
| setSlotRule(index, rule)      | Attaches a verification rule to a specific time slot                                           |
| setBlocklist(updates)         | Sets the global digital commitment condition                                                   |
| setLocation(updates)          | Sets the global location condition                                                             |
| resetDraft()                  | Clears all state back to defaults for a new commitment                                         |

***

## Logger Middleware

Every state mutation is logged with a pretty-printed JSON dump of the full draft. This provides complete visibility during development without external devtools.

***

## Slot-Level Conditions

The most complex feature is per-slot condition management. Each time\_window in the recurrence object can have its own independent conditions array, allowing different locations, blocklists, and rules for different time slots within the same commitment.
