archive_done_tasks
Write · Advanced
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, result and boundaries
- 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
- 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
- ```json { "older_than_days": 7 } ``` Result shape: ```json { "archived": 4, "threshold_days": 7 } ```