Archive Analysis Skill
Archive temporary markdown files while preserving insights. Files are committed to git then deleted from working tree to avoid context pollution for agents doing codebase searches.
When to Use
- •"Archive these analysis files"
- •"Clean up old markdown files"
- •"Archive FILENAME.md"
Avoid triggering on generic "clean up my workspace" - be more specific about markdown/analysis files.
Workflow
1. Discover Files
Untracked markdown (default):
uv run ~/.claude/skills/archive-analysis/archive_utils.py analyze --mode=untracked
All markdown (comprehensive):
uv run ~/.claude/skills/archive-analysis/archive_utils.py analyze --mode=explore
Specific files:
uv run ~/.claude/skills/archive-analysis/archive_utils.py analyze FILE1.md FILE2.md
2. Decide What to Archive
Archive: One-time analysis, session notes, drafts, old reports, prepared prompts Keep: README, TODO, ARCHITECTURE, templates, actively referenced docs
3. Present Plan & Get Approval
Found 2 untracked analysis files: Recommend archiving: - COMPARISON.md (9 KB) - team vote analysis - NOTES.md (5 KB) - session notes Archive as: 2024-11-24-tin-votes-* Insights to extract: - Add to TODO.md: "Complete assessments for 7 topics" Proceed?
4. Execute
- •Extract insights to TODO.md (or detected task system)
- •Create
archive/andarchive/index.mdif needed - •Move files:
mv FILE.md archive/YYYY-MM-DD-description-FILE.md - •Update
archive/index.mdwith entry - •Commit:
git add archive/ TODO.md && git commit -m "docs: archive [description]" - •Get commit hash, update index.md with hash
- •Delete archived files:
git rm archive/YYYY-MM-DD-*.md && git commit -m "docs: remove archived files from working tree"
5. Report
Archived 2 files (in git history, removed from working tree): - COMPARISON.md → commit abc123 - NOTES.md → commit abc123 Insights added to TODO.md. Retrieve with: git show abc123:archive/FILENAME.md
Key Rules
- •Flat structure:
archive/YYYY-MM-DD-description-FILE.md(no subfolders) - •Always ask before archiving
- •Extract insights first before archiving
- •Two commits: Add to archive, then delete (preserves in history, cleans working tree)
- •Check references: Warn if file is referenced elsewhere
Why Delete After Commit?
Files committed then deleted remain in git history but don't pollute agent context when searching the codebase. Retrieve with git show <commit>:archive/<file>.