archive-work

Archive completed scratchpads and session logs to project history. Invoke when user says "archive this work", "clean up scratchpad", "archive scratchpad", or after PR is merged.

16 stars

Best use case

archive-work is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Archive completed scratchpads and session logs to project history. Invoke when user says "archive this work", "clean up scratchpad", "archive scratchpad", or after PR is merged.

Teams using archive-work should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/archive-work/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/archive-work/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/archive-work/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How archive-work Compares

Feature / Agentarchive-workStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Archive completed scratchpads and session logs to project history. Invoke when user says "archive this work", "clean up scratchpad", "archive scratchpad", or after PR is merged.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Archive Work Skill

## Purpose

Archive completed scratchpads and development artifacts to maintain clean project roots while preserving work history for future reference. This skill organizes completed work into a structured archive.

## Natural Language Triggers

This skill activates when the user says things like:
- "Archive this work"
- "Clean up the scratchpad"
- "Archive scratchpad"
- "Move scratchpad to archive"
- "We're done, archive everything"
- After PR merge: "PR merged, let's clean up"

## Workflow Execution

### Phase 1: Detect Artifacts (Parallel)

**Execute these searches in parallel** for faster detection:

1. **Find Scratchpads:**
   - `Glob: SCRATCHPAD_*.md` in project root
   - Identify issue numbers from filenames

2. **Find Session Logs:**
   - `Glob: SESSION_LOG_*.md` in project root
   - These are created by the PreCompact hook before auto-compaction
   - Associate with scratchpad (same issue context)

3. **Find Other Related Files:**
   - Related temporary files
   - Claude Code conversation exports

4. **Check Git Status:**
   - Current branch for context
   - Recent commits for PR detection

**After parallel detection, verify completion:**
- Check if scratchpad tasks are all complete
- Check if PR was created/merged
- Warn if work appears incomplete

### Phase 2: Determine Archive Location

**Default Structure:**
```
docs/dev/cc-archive/
└── {YYYYMMDDHHMM}-{issue-number}-{brief-description}/
    ├── SCRATCHPAD_{issue_number}.md
    ├── session-log.md (if exists)
    └── README.md (summary)
```

**Timestamp Prefix:** Archives use `YYYYMMDDHHMM` prefix for chronological ordering.
This ensures archives sort by completion date, not ticket number.

**Check Project Conventions:**
- Read CLAUDE.md for custom archive location
- Check if `docs/dev/cc-archive/` exists
- Create directory structure if needed

### Phase 3: Prepare Archive

1. **Generate Timestamp and Directory Name:**
   ```bash
   # Generate timestamp prefix
   TIMESTAMP=$(date +%Y%m%d%H%M)
   ARCHIVE_DIR="${TIMESTAMP}-{issue-number}-{description}"
   ```

2. **Create Archive Directory:**
   ```bash
   mkdir -p docs/dev/cc-archive/${ARCHIVE_DIR}
   ```

3. **Generate Archive Summary:**
   Create `README.md` in archive folder:
   ```markdown
   # Issue #{issue_number} - {title}

   **Archived:** {date}
   **PR:** #{pr_number} (if applicable)
   **Status:** {Completed/Merged/Abandoned}

   ## Summary
   {Brief description of what was accomplished}

   ## Key Decisions
   {Extract from scratchpad Decisions Made section}

   ## Files Changed
   {List of files that were modified}

   ## Lessons Learned
   {Any notable insights from Work Log}
   ```

4. **Move Files (using git mv for proper tracking):**
   ```bash
   git mv SCRATCHPAD_{issue_number}.md docs/dev/cc-archive/${ARCHIVE_DIR}/
   ```

   **Important:** Use `git mv` instead of `mv` to ensure both the addition to
   archive AND the removal from project root are tracked in the same commit.

### Phase 4: Confirm with User

```
AskUserQuestion:
  question: "Ready to archive this work?"
  header: "Archive"
  options:
    - "Yes, archive and commit"
      description: "Move files to archive and create commit"
    - "Archive without commit"
      description: "Move files but don't commit yet"
    - "Show me what will be archived"
      description: "Preview the archive operation"
    - "Cancel"
      description: "Keep scratchpad in current location"
```

### Phase 5: Execute Archive

1. **Move Files (with git tracking):**
   ```bash
   # Use git mv to track both addition and removal in same commit
   git mv SCRATCHPAD_{issue_number}.md docs/dev/cc-archive/${ARCHIVE_DIR}/

   # Move session logs (created by PreCompact hook)
   # These are untracked, so use mv then git add
   for log in SESSION_LOG_*.md; do
     if [ -f "$log" ]; then
       mv "$log" docs/dev/cc-archive/${ARCHIVE_DIR}/
     fi
   done
   git add docs/dev/cc-archive/${ARCHIVE_DIR}/SESSION_LOG_*.md 2>/dev/null || true
   ```
   - Create summary README in archive directory
   - Stage the new README: `git add docs/dev/cc-archive/${ARCHIVE_DIR}/README.md`

2. **Commit Archive:**
   If user opted to commit:
   ```
   Skill: commit-changes

   # Commit message will be:
   # 📚🗃️ chore(docs): Archive work for issue #{issue_number}
   #
   # Completed work archived to docs/dev/cc-archive/
   # PR: #{pr_number}
   ```

   **The commit will include:**
   - Removal of SCRATCHPAD from project root (via git mv)
   - Addition of SCRATCHPAD in archive directory
   - Session logs (SESSION_LOG_*.md) if present
   - New README.md summary

### Phase 6: Report Result

```
✓ Work archived successfully!

📁 Archive location:
   docs/dev/cc-archive/{YYYYMMDDHHMM}-{issue-number}-{description}/

📄 Files archived:
   - SCRATCHPAD_{issue_number}.md
   - SESSION_LOG_*.md (if any existed)
   - README.md (summary generated)

🗑️ Cleaned up:
   - Removed scratchpad from project root (tracked via git mv)
   - Removed session logs from project root

{If committed}
📝 Committed: {commit hash}
   - Added: archive directory with scratchpad, session logs, README
   - Removed: SCRATCHPAD_{issue_number}.md from project root
   - Removed: SESSION_LOG_*.md from project root
```

## Archive Options

### Option 1: Full Archive (Default)
- Move scratchpad to archive
- Generate summary README
- Commit the archive

### Option 2: Delete Only
If user prefers not to keep history:
```
AskUserQuestion:
  question: "How to handle the scratchpad?"
  options:
    - "Archive (keep history)"
    - "Delete (no history)"
    - "Keep in place"
```

### Option 3: Custom Location
Allow user to specify different archive location:
```
AskUserQuestion:
  question: "Archive to default location?"
  options:
    - "Yes, use docs/dev/cc-archive/"
    - "Specify custom location"
```

## Error Handling

### No Scratchpad Found
```
ℹ️ No scratchpad found to archive.
   Looking for: SCRATCHPAD_*.md in project root
```

### Work Incomplete
```
⚠️ Scratchpad has incomplete tasks:
   - {unchecked task 1}
   - {unchecked task 2}

   Archive anyway?
   1. Yes, archive incomplete work
   2. No, continue working first
```

### Archive Directory Exists
```
⚠️ Archive already exists for issue #{number}

   Options:
   1. Overwrite existing archive
   2. Create numbered version (archive-2/)
   3. Cancel
```

### No PR Created
```
ℹ️ No PR found for this work.

   Archive anyway?
   1. Yes, archive without PR reference
   2. No, create PR first
```

## Integration with Other Skills

**Invoked by:**
- `do-work` skill - After completing all tasks
- User directly after PR is merged

**Invokes:**
- `commit-changes` skill - To commit archive

**Reads from:**
- Scratchpad - Content to archive
- Git history - PR information

## Archive Structure Best Practices

### Recommended Directory Layout
```
docs/
└── dev/
    └── cc-archive/
        ├── 202512281430-42-add-authentication/
        │   ├── SCRATCHPAD_42.md
        │   └── README.md
        ├── 202512281545-43-fix-login-bug/
        │   ├── SCRATCHPAD_43.md
        │   ├── SESSION_LOG_1.md
        │   └── README.md
        └── 202512290900-44-refactor-api/
            ├── SCRATCHPAD_44.md
            ├── SESSION_LOG_1.md
            ├── SESSION_LOG_2.md
            └── README.md
```

### Archive Naming Convention
`{YYYYMMDDHHMM}-{issue-number}-{slugified-description}/`

**Format breakdown:**
- `YYYYMMDDHHMM` - Timestamp when archived (enables chronological sorting)
- `{issue-number}` - GitHub issue number for reference
- `{slugified-description}` - Brief description from issue title

Examples:
- `202512281430-42-add-user-authentication/`
- `202512290915-123-fix-payment-bug/`
- `202512271000-7-initial-project-setup/`

**Why timestamp prefix?**
- Archives sort chronologically regardless of ticket number order
- Easy to scan for recent work
- Preserves actual completion order

## Best Practices

### ✅ DO:
- Archive after PR is merged
- Include summary README
- Preserve decision history
- Use consistent archive location
- Commit archives to repo
- Use `git mv` to move scratchpads (tracks removal properly)
- Use timestamp prefix for chronological ordering

### ❌ DON'T:
- Archive incomplete work without noting it
- Delete without archiving (lose history)
- Mix archives from different projects
- Skip the summary README
- Leave scratchpads in project root long-term
- Use plain `mv` for tracked files (leaves unstaged deletion)

---

**Version:** 1.3.0
**Last Updated:** 2025-12-31
**Maintained By:** Escapement
**Changelog:**
- v1.3.0: Added parallel execution for artifact detection
- v1.2.0: Added SESSION_LOG_*.md detection and archiving (from PreCompact hook)
- v1.1.0: Added timestamp prefix for chronological sorting; use git mv for proper tracking
- v1.0.0: Initial conversion from commands/archive-dev.md

Related Skills

ml-pipeline-workflow

16
from diegosouzapw/awesome-omni-skill

Build end-to-end MLOps pipelines from data preparation through model training, validation, and production deployment. Use when creating ML pipelines, implementing MLOps practices, or automating mod...

microsoft-agent-framework

16
from diegosouzapw/awesome-omni-skill

Expert guidance for implementing AI agents and multi-agent workflows using Microsoft Agent Framework. Use when adding AI agent capabilities, implementing multi-agent orchestration patterns, integrating MCP tools, or building intelligent automation systems. Emphasizes gathering up-to-date information from official documentation before implementation.

julien-workflow-advice-codex

16
from diegosouzapw/awesome-omni-skill

Get OpenAI Codex CLI's opinion on code, bugs, or implementation. Use when you want a second AI perspective during coding sessions.

GSTD A2A Network

16
from diegosouzapw/awesome-omni-skill

Decentralized Agent-to-Agent Autonomous Economy. Connects hardware and agents for distributed compute, hive memory access, and economic settlement.

fal-workflow

16
from diegosouzapw/awesome-omni-skill

Generate workflow JSON files for chaining AI models

esp32-workbench-ota

16
from diegosouzapw/awesome-omni-skill

OTA firmware upload, listing, deletion, and over-the-air update for the Universal ESP32 Workbench. Triggers on "OTA", "firmware", "update", "upload", "binary", "over-the-air".

deepwork_jobs

16
from diegosouzapw/awesome-omni-skill

Creates and manages multi-step AI workflows. Use when defining, implementing, or improving DeepWork jobs.

data-quality-frameworks

16
from diegosouzapw/awesome-omni-skill

Implement data quality validation with Great Expectations, dbt tests, and data contracts. Use when building data quality pipelines, implementing validation rules, or establishing data contracts.

daily-work-tracker

16
from diegosouzapw/awesome-omni-skill

Use when the user wants to log work items (bugs, features, tasks), track time spent, or view a daily/weekly work report.

create-workflow

16
from diegosouzapw/awesome-omni-skill

Create Jazz workflow automation files (WORKFLOW.md). Use this for scheduling Jazz agents to run recurring tasks. For OS-level scripts/commands, use create-system-routine.

airflow-workflows

16
from diegosouzapw/awesome-omni-skill

Apache Airflow DAG design, operators, and scheduling best practices.

ai-annotation-workflow

16
from diegosouzapw/awesome-omni-skill

Эксперт по data annotation. Используй для ML labeling, annotation workflows и quality control.