/dr-archive
Archive completed task with mandatory reflection and evolution proposals
Overview
/dr-archive is the final pipeline stage. It resolves the target task, verifies all git repos are clean, runs a mandatory reflection (Step 0.5) that generates evolution proposals, packages the task into a permanent archive document, updates the backlog, handles follow-up task creation, and resets the workspace. Since v1.10.0 (TUNE-0013), the previously separate /dr-reflect command is consolidated here because an "optional mandatory gate" was identified as a design defect.
Usage
/dr-archive
/dr-archive cancel
/dr-archive cancel TASK-0001
What It Does
- Step 0 — Task Resolution — resolves which task is being archived from the argument or by disambiguation when multiple tasks are active.
- Step 0.1 — Pre-Archive Git Check (mandatory, multi-agent aware since v1.18.0 / TUNE-0044) — classifies every touched repo as workspace (shared by parallel agent sessions) or project (single-agent). For workspace repos,
scripts/pre-archive-check.sh --task-id <ID> --shared <repo>classifies each modified file's hunks asown,foreign,mixed, orunattributed: foreign-only is NOT a blocker (parallel sessions own their hunks), but own/mixed/unattributed hunks block until the patch-staging recipe (git add -por non-interactive blob-swap) is applied. For project repos, the legacy TUNE-0003 contract (any uncommitted change blocks; 3-way prompt: commit / accept pending / abort) is unchanged. - Step 0.5 — Reflect (mandatory, non-skippable) — loads the reflecting skill and executes the full reflection workflow:
- Creates
datarim/reflection/reflection-[task_id].md - Generates evolution proposals classified as Class A (safe, apply now) or Class B (requires PRD update first)
- Presents Class A proposals for approval; applies approved ones to runtime
- Logs changes in
datarim/docs/evolution-log.md - Runs health-metrics check; suggests
/dr-optimizeif thresholds exceeded - Notes follow-up tasks for Step 4
This step cannot be skipped. No
--no-reflectflag exists. On failure, archive stops — re-running re-enters Step 0.5. - Creates
- Step 1 — Determine Archive Area — extracts the prefix from the task ID (e.g.,
INFRAfromINFRA-0001) and maps it to an archive subdirectory. - Step 2 — Create Archive Document — writes
documentation/archive/{area}/archive-{task_id}.mdfollowing the canonicaltemplates/archive-template.md(v2.14.0+, TUNE-0255). The archive carries four operator-facing top sections in strict order — «Начальная задача» (one Russian sentence sourced from the operator brief), «Как решили» (single-level bullet list mapping every brief item to a quoted bullet + Russian status word + one or two plain-language sentences; expectations fromtasks/{ID}-expectations.mdfold into the same list with marker «(уточнение брифа)»), «Артефакты задачи» (what was produced or changed), «Следующие шаги» (concrete/dr-*commands or operator actions, or «всё закрыто»). Under a---horizontal rule sits an audit addendum carrying### verification_outcome,### Acceptance Criteria,### Lessons Learned,### Operator Handoff,### Related. Status words: «выполнено» / «частично» / «не выполнено» / «неприменимо» — never the schema enummet/partial/missed/n-a. Includes a Known Loss Verification Gate: before recording any content as "permanently lost", the agent runs a 5-channel disaster recovery checklist. Only after all channels are exhausted may a loss claim enter the archive. - Step 3 — Update Backlog — if the task existed in
backlog.md, removes it and adds a completed entry tobacklog-archive.mdwith the same ID, completion date, and link to the archive document. - Step 4 — Follow-up Tasks — reads follow-up items from the reflection document and asks whether to add them as new backlog entries.
- Step 5 — Update Tasks Table — adds a row to the Archived Tasks table in
tasks.md. - Step 6 — Update Context — removes the archived task from
## Active TasksinactiveContext.md, prepends it to## Recently Completed. Does not reset the entire file — other active tasks are preserved.
Cancellation Mode
If you say "cancel task" or provide a task ID to cancel, the command removes the task from the backlog, adds a cancelled entry to backlog-archive.md, clears it from active tasks, and skips archive document creation (the task was not completed). No reflection runs for cancelled tasks.
Arguments
Optional. Use cancel to cancel instead of archive. Optionally specify a task ID for multi-task disambiguation.
Output
Creates: documentation/archive/{area}/archive-{task_id}.md, datarim/reflection/reflection-[task_id].md. Updates: datarim/backlog.md, datarim/backlog-archive.md, datarim/tasks.md, datarim/activeContext.md, datarim/docs/evolution-log.md.
Example Session
> /dr-archive
Task Resolution: AUTH-0001 (only active task)
Pre-Archive Clean-Git Check:
arcanada workspace: clean
Projects/Datarim/code/datarim: clean
Step 0.5 — Reflection:
Created: datarim/reflection/reflection-AUTH-0001.md
Evolution proposals:
[Class A] Update security.md with OAuth patterns (approved → applied)
[Class B] Refactor auth agent — deferred (requires PRD)
Health metrics: within thresholds
Archiving AUTH-0001...
Area: auth (mapped from AUTH prefix)
Archive: documentation/archive/auth/archive-AUTH-0001.md
Backlog updated:
Removed AUTH-0001 from backlog.md
Added AUTH-0001 to backlog-archive.md (completed)
Follow-up tasks from reflection:
1. Add rate limiting to AUTH module
2. Write user-facing auth documentation
Add to backlog? (y/n)
Context updated. Ready for next task.
Next step: /dr-init or /dr-dream (5+ docs since last run)
Related Commands
- /dr-qa — previous stage: quality verification
- /dr-compliance — optional previous stage: hardening
- /dr-init — start a new task
- /dr-dream — suggested if knowledge base has grown