archive_done_tasks
- Category: tasks
- Access: write
- Audience: advanced (ordinary users do not normally call this directly)
Purpose
Sweeps done tasks whose last update is older than N days into archived. A maintenance pass for keeping the live task lists quiet without losing history.
Arguments
Optional: older_than_days.
-
older_than_days. Note: Non-negative age threshold in days (default 7). Only done tasks of type task older than this move.
Result
JSON object with archived (how many moved) and threshold_days (the applied threshold).
Boundaries
Only done tasks visible under the caller's project grants are candidates; notes, live statuses, and foreign projects are never touched. With no visible scope the sweep succeeds with archived 0.
Lifecycle / side effects
Each move travels through the canonical mutation path and records an audit/history event, so archived content keeps its full trail and can be distinguished from cancelled or live work.
Errors
Bad types are rejected (strict validator). A negative threshold is rejected. Failures move nothing (atomic).
Example
{
"older_than_days": 7
}
Result shape:
{
"archived": 4,
"threshold_days": 7
}
See also
query_tasks, task_digest, bump_overdue_priority, update_task.