skill-archive-task
Complete protocol for archiving TASK.md with ID generation. Single source of truth for archiving.
SKILL.md
| Name | skill-archive-task |
| Description | Complete protocol for archiving TASK.md with ID generation. Single source of truth for archiving. |
name: skill-archive-task description: "Complete protocol for archiving TASK.md with ID generation. Single source of truth for archiving." tier: 1 version: 1.1
Task Archiving Protocol
This skill encapsulates the complete protocol for archiving docs/TASK.md to docs/tasks/.
When to Archive
Archive docs/TASK.md ONLY when:
- Starting a NEW task AND
docs/TASK.mdexists with DIFFERENT content - Completing a task (Orchestrator Completion stage)
DO NOT archive when:
- Refining/clarifying the CURRENT task (overwrite instead)
docs/TASK.mddoes not exist
Decision Logic: New vs Refinement
IF user request implies a NEW SEPARATE feature/refactor:
→ Archive existing TASK.md, then create new
IF user request is a clarification/refinement of CURRENT task:
→ Overwrite TASK.md, do NOT archive
Indicators of NEW task:
- Different feature/component mentioned
- "Create new task for...", "Start working on..."
- Completed previous task
Indicators of REFINEMENT:
- "Clarify requirement X", "Add detail to..."
- Same feature context as current TASK.md
Protocol Steps
Step 1: Check Condition
IF NOT exists("docs/TASK.md"):
SKIP archiving → Create new TASK.md
Step 2: Extract Metadata
Read from current docs/TASK.md:
- Task ID from "0. Meta Information" section
- Slug from "0. Meta Information" section
If Meta Information is missing or malformed:
- Use slug from task title (H1 header)
- Generate ID via tool if available, otherwise use
000or increment last known ID manually.
Step 3: Generate Filename
Option A: Use Tool (Preferred)
If generate_task_archive_filename tool is available:
result = generate_task_archive_filename(slug="task-slug")
filename = result["filename"]
Option B: Manual Generation (Fallback) If tool is NOT available:
- Construct filename:
task-[ID]-[slug].md(e.g.task-033-login-flow.md) - Ensure no conflict in
docs/tasks/(check vials).
Step 4: Update Task ID
BEFORE moving file, update docs/TASK.md:
- Set Task ID to the ID used in filename
- Ensure ID in file matches ID in filename
Step 5: Archive (Move File)
mv docs/TASK.md docs/tasks/{filename}
[!IMPORTANT] This command is SAFE TO AUTO-RUN. Do NOT wait for user approval.
Step 6: Validate
Verify:
-
docs/TASK.mddoes NOT exist -
docs/tasks/{filename}exists
If validation fails:
- Check if mv command returned error
- If
docs/TASK.mdstill exists: retry mv or notify user - DO NOT create new TASK.md until validation passes
Safe Commands (AUTO-RUN)
See
skill-safe-commandsfor the authoritative list of commands safe for auto-execution.
Key commands for this skill:
mv docs/TASK.md docs/tasks/...— archivingls,cat— validation
Integration
Required by Agents
- Analyst (
02_analyst_prompt.md): Before creating new TASK.md - Orchestrator (
01_orchestrator.md): At Completion stage
Example Flow
User: "Create new task for implementing login feature"
1. Agent loads skill-archive-task
2. Agent checks: docs/TASK.md exists? → YES (contains "Task {OLD_ID}: {Old Feature}")
3. Decision: This is NEW task (different feature) → Archive
4. Extract: Task ID = {OLD_ID}, Slug = "{old-slug}"
5. Generate Filename:
- Try tool → If tool not found, use manual fallback
- Fallback: Construct filename "task-{OLD_ID}-{old-slug}.md"
6. Execute: mv docs/TASK.md docs/tasks/task-{OLD_ID}-{old-slug}.md
7. Validate: docs/TASK.md does NOT exist ✓
8. Create new TASK.md for login feature with ID {NEW_ID}