| name | plan-cleanup |
| description | Archive completed plans and clean workspace using CLI commands |
| triggers | ["archive plans","clean plans","cleanup workspace","remove old plans","archive completed"] |
| maintainer | false |
Plan Cleanup & Archival Skill
What: Systematically archive completed plans and clean workspace
When to use:
- Plans accumulating in
.aiknowsys/ (>20 active plans)
- Completed plans need archival
- Periodic workspace cleanup (monthly/quarterly)
- Before major releases (declutter workspace)
- Plan pointer files getting cluttered
Commands: archive-plans, clean
Prerequisites
- AIKnowSys project initialized
- Plan files exist in
.aiknowsys/PLAN_*.md
- Plan pointer files in
.aiknowsys/plans/active-*.md (optional but recommended)
Workflow
Step 1: Assess Current State
Check plan count:
ls -1 .aiknowsys/PLAN_*.md | wc -l
Preview what would be archived:
npx aiknowsys archive-plans --dry-run
Preview full cleanup:
npx aiknowsys clean --dry-run
Step 2: Choose Cleanup Strategy
Option A: Archive Completed Plans Only
Use when:
- You want fine-grained control
- Need to archive specific status (COMPLETE, CANCELLED, PAUSED)
- Want to set custom age threshold
Command:
npx aiknowsys archive-plans --status COMPLETE --threshold 0
Options:
--status <status> - Archive by status (COMPLETE, CANCELLED, PAUSED, etc.) - default: COMPLETE
--threshold <days> - Archive plans older than N days (use 0 for immediate) - default: 7
--dry-run - Preview without actually moving files
What it does:
- Reads plan pointer files (
.aiknowsys/plans/active-*.md)
- Finds plans with matching status and age threshold
- Moves plan files to
.aiknowsys/archived/plans/
- Updates plan pointer files to remove archived references
- Shows summary of archived vs kept plans
Option B: All-in-One Workspace Cleanup
Use when:
- Monthly/quarterly cleanup routine
- Want to clean everything at once
- Preparing for release or major milestone
Command:
npx aiknowsys clean
What it cleans:
- ✅ Archives old sessions (>30 days by default)
- ✅ Archives completed plans (COMPLETE status)
- ✅ Removes temp files and directories (test artifacts, etc.)
Preview first (recommended):
npx aiknowsys clean --dry-run
Step 3: Verify Archival
Check archived plans:
ls -1 .aiknowsys/archived/plans/ | grep PLAN_
Check remaining active plans:
ls -1 .aiknowsys/PLAN_*.md | wc -l
Verify plan pointers updated:
cat .aiknowsys/plans/active-*.md
Step 4: Commit Changes
Review changes:
git status
Commit:
git add -A
git commit -m "chore: archive completed plans (cleanup)
Archived X plans to .aiknowsys/archived/plans/:
- PLAN_feature_x.md (completed)
- PLAN_feature_y.md (completed)
...
Result: N plans → M active plans"
Common Scenarios
Scenario 1: Monthly Cleanup Routine
Goal: Declutter workspace at end of month
Steps:
npx aiknowsys clean --dry-run
npx aiknowsys clean
ls -1 .aiknowsys/PLAN_*.md | wc -l
ls -1 .aiknowsys/archived/plans/ | tail -10
git add -A
git commit -m "chore: monthly workspace cleanup"
Scenario 2: Archive Specific Status
Goal: Archive all cancelled plans (failed experiments)
Steps:
npx aiknowsys archive-plans --status CANCELLED --dry-run
npx aiknowsys archive-plans --status CANCELLED --threshold 0
ls -1 .aiknowsys/archived/plans/ | grep CANCELLED
git add -A
git commit -m "chore: archive cancelled plans"
Scenario 3: Pre-Release Cleanup
Goal: Clean workspace before major release
Steps:
npx aiknowsys archive-plans --status COMPLETE --threshold 0
npx aiknowsys clean --dry-run
npx aiknowsys clean
tree .aiknowsys -L 2
git add -A
git commit -m "chore: workspace cleanup for v0.11.0 release
Archived completed plans and old sessions
Active plans remaining: $(ls -1 .aiknowsys/PLAN_*.md | wc -l)"
Scenario 4: Manual Archival (Without Commands)
When: Commands unavailable or need custom logic
Steps:
mkdir -p .aiknowsys/archived/plans
mv .aiknowsys/PLAN_feature_x.md .aiknowsys/archived/plans/
mv .aiknowsys/PLAN_feature_y.md .aiknowsys/archived/plans/
git add -A
git commit -m "chore: archive completed plans (manual)"
⚠️ Limitation: Manual archival doesn't update plan pointer files automatically. Use commands when possible.
Best Practices
DO ✅
- Preview first: Always run
--dry-run before actual cleanup
- Commit after archival: Keep git history clean
- Archive regularly: Monthly or after major milestones
- Use status-based archival: Archive COMPLETE, CANCELLED separately
- Keep active plans focused: <20 active plans per developer ideal
- Document archival in commit message: List what was archived
DON'T ❌
- Don't archive ACTIVE plans: Use status transitions first (ACTIVE → COMPLETE)
- Don't delete archived plans: Keep for historical reference
- Don't archive without git: Risk losing plan history
- Don't archive plans with uncommitted work: Complete work first
- Don't use aggressive thresholds:
--threshold 0 is safe, avoid high values unless certain
Integration with Plan Management
Plan Lifecycle:
- Create plan:
npx aiknowsys create-plan --title "Feature X"
- Work on plan: Update status to ACTIVE
- Complete work: Update status to COMPLETE
- Archive plan:
npx aiknowsys archive-plans --status COMPLETE
- Historical reference: Plans remain in
.aiknowsys/archived/plans/
Plan Pointer Workflow:
- Plan pointers track active plans per developer
- Archival removes completed plans from pointers automatically
- Pointers keep workspace organized (no manual tracking)
Troubleshooting
Archive Command Not Found
Symptom: npx aiknowsys archive-plans → command not recognized
Solution:
npm run build
npx aiknowsys --help | grep archive
Plans Not Archived (Kept)
Symptom: archive-plans reports 0 plans archived
Possible causes:
- Plans don't have COMPLETE status
- Plans are too recent (within threshold)
- No plan pointer files exist
Solutions:
grep -r "status:" .aiknowsys/PLAN_*.md
npx aiknowsys archive-plans --threshold 0
ls -1 .aiknowsys/plans/active-*.md
Accidentally Archived Active Plan
Symptom: Archived a plan still being worked on
Solution:
mv .aiknowsys/archived/plans/PLAN_feature_x.md .aiknowsys/
git add -A
git commit -m "chore: restore accidentally archived plan"
Related Commands
create-plan - Create new implementation plan
update-plan - Update plan status and content
query-plans - Query plan metadata
clean - All-in-one workspace cleanup
Related Skills
See Also
Last Updated: 2026-02-09
AIKnowSys Version: 0.10.0+