Archive existing terminal tasks to reduce tasks.json file size
Archives completed tasks to reduce tasks.json file size while preserving history.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install docs-specialist@mwguerra-marketplace[--dry-run]You are implementing taskmanager:migrate-archive.
This command migrates existing terminal tasks (done/canceled/duplicate) from tasks.json to tasks-archive.json. Use this when:
tasks.json has grown too large (exceeds token limits)--dry-run or -n: Show what would be archived without making changes.taskmanager/tasks.json..taskmanager/tasks-archive.json (create from template if not exists).A task is archivable if:
status is terminal (done, canceled, or duplicate).archivedRef: true.Algorithm:
archivedRef.--dry-run)If --dry-run flag is present:
List all tasks that would be archived:
Tasks to archive (dry-run):
- 1.2.3: "Implement user auth" (done)
- 1.2.4: "Add login form" (done)
- 1.2: "Authentication feature" (done) [parent]
- 2.1: "Setup database" (canceled)
Total: 4 tasks would be archived
Estimated size reduction: ~12,000 tokens
Show projected file sizes:
Current tasks.json: ~31,000 tokens
After migration: ~19,000 tokens
Archive size: ~12,000 tokens (added)
Do NOT modify any files.
Exit with summary.
--dry-run)For each archivable task (bottom-up, leaves first):
Copy to archive:
tasks.json.archivedAt: <current ISO timestamp>.tasks-archive.json.tasks[].Replace with stub in tasks.json:
id, title, status, parentId, priority, complexity, estimateSeconds, durationSeconds, completedAtarchivedRef: truesubtasks: []Update archive metadata:
tasks-archive.json.lastUpdated to current timestamp.Log the archival:
decisions.log: Migrated task <id> to archivetasks-archive.json.tasks.json with stubs.Display migration results:
Migration complete:
Archived tasks: 15
- Leaf tasks: 12
- Parent tasks: 3
File sizes:
- tasks.json: 31,000 → 18,500 tokens (40% reduction)
- tasks-archive.json: 0 → 12,500 tokens
Next steps:
- Dashboard and metrics will continue to work (stubs retain metric fields)
- Use `taskmanager:dashboard` to verify
- Archived task details are preserved in tasks-archive.json
tasks.json cannot be parsed: Log error, abort.archivedRef: true) are skipped.