/dr-finalize
Finish an archived task with publication, safe cleanup, tracker, and one report.
Purpose
/dr-finalize runs or reuses the current task archive, publishes task documentation, commits and pushes only task-owned work, returns clean checkouts to their observed default branches, and cleans only resources recorded in the task ownership ledger. It then completes the configured tracker step and gives one report with a status for every step.
Safety
Resource-creating stages record exact task-owned worktrees, branches, temporary paths, processes, and containers with the atomic finalize-safety.py add helper when they create them. Agents do not edit the ledger JSON by hand. Unmerged branches, foreign dirty files, unrecorded temporary files, and uncertain process ownership are preserved. A ledger entry is necessary but cleanup also checks worktree cleanliness, merge state, and path safety. An unconfigured tracker is reported as not applied.
Autonomous mode
The project or user can set autonomy.finalize to off, on_request, or always. The default is off. on_request requires a request recorded when the task is created. Project setting overrides user setting.