# Tasks

> How an AI agent creates, updates and completes tasks in Klarity: due vs start dates, priorities, estimates, recurrence and acceptance criteria.

Use this when the user wants to capture, change, find or finish tasks.

## Find

- `list_tasks` filters by `status` (`open` = not done or canceled), `priority`, `assigned_to` (`me` for the user), `due_after` / `due_before` (inclusive; a date is the whole day), `project_id`, `organization_id`, `deal_id`, or `search` (title and description, any case). Sort by `due_date`, `priority` or `created_at`.
- "Due this week": `status: "open"`, `assigned_to: "me"`, `due_before` Sunday. Overdue: `due_before` yesterday.
- `get_task` returns one task with its attachments as download links valid for one hour. `list_task_comments` reads the discussion.

## Create and update

- `create_task` needs only a `title`. Defaults: status `todo`, priority `medium`.
- Always try to set `estimated_minutes` (15 to 4800, i.e. up to 10 working days of 8 h). The planner uses it as the task's length and splits a long one into sessions across days; without it the task is planned at 30 minutes.
- Estimates are always minutes. When the user gives days ("2 days", "1,5 Tage", "3 PT", "½ d"), a day is their working day, not 24 h: take `working_day_minutes` from `list_work_hours` (8 h = 480 when none are set) and multiply. "2 days" on a 7 h day is 840.
- `due_date` is when it must be done. `start_date` is the earliest it may be worked on: the planner places nothing before it. Neither is when the work is scheduled; the planner decides that.
- A date alone (`2026-12-04`) is all day. A date with a time (`2026-12-04T14:00`) is timed. Both are wall time in the user's zone.
- Priority: `low`, `medium`, `high`, `urgent`. Urgent is planned first; use it sparingly.
- Link with `project_id`, `organization_id` or `deal_id`. Time logged on the task inherits its client.
- `is_personal: true` makes a task visible only to the user.
- `update_task` changes only the fields you send. `null` clears a date, link or estimate.
- `add_task_comment` records notes or progress on a task.

## Complete

Set `status` to `done` (or `canceled`) with `update_task`. This stamps the completion time, frees its coming blocks, and stops a running timer on it. If the task is a process step, it advances the run.

## Recurrence

`set_task_recurrence` makes a task repeat (`frequency`, plus `weekdays`, `month_day`, `time` or `cron`). One occurrence is open at a time; finishing it creates the next. `frequency: "none"` stops it and keeps the history. For multi-step routines, use a process instead (`processes` guide).

## Acceptance criteria

Process steps can carry acceptance criteria; `get_task` returns them as `acceptanceCriteria`. The tools cannot add or check them off on a task. Ask the user to check them in the app.

## Pitfalls

- Search before creating, to avoid duplicates.
- Statuses `review`, `blocked` and `report` exist; keep to `todo`, `in_progress`, `done` unless the user uses them. A task waiting on other tasks stays `todo` with `blocked_by` set, so it is still planned (after them); `blocked` takes it off the schedule.
