OpenWriterControle/plugins/claude-code/commands/oac-cleanup.md
Darren Hinde f84f32b7b3
fix: overhaul Claude Code plugin for correctness and spec compliance (#225)
- Fix critical bugs: coder-agent name (CoderAgent→coder-agent), manifest
  path in session-start.sh, /oac:setup ghost command replaced with /install-context
- Fix hooks.json: add timeout/async, add description, restore matcher
- Fix session-start.sh: dual-format output (Claude Code + Cursor/OpenCode),
  remove invalid JSON escapes for $ and backtick
- Fix agent spec compliance: disallowedTools on read-only agents, WebFetch
  on external-scout, haiku model on context-scout, example blocks on 3 agents
- Fix skill descriptions: triggering conditions only (no workflow summaries)
  per superpowers empirical testing — prevents Claude shortcutting skill content
- Add Red Flags + Rationalization tables to 4 discipline skills
- Add install-context skill + command replacing oac-setup/oac-plan/oac-add-context
- Add cleanup-tmp.sh (was missing, broke /oac:cleanup)
- Add TypeScript installer (install-context.ts/js) with profile-based download
- Update plugin.json: keywords, homepage for marketplace discoverability
- Update README: correct skill count, fix structure diagram, remove stale refs
- Remove obsolete files: FIRST-TIME-SETUP.md, INSTALL.md, QUICK-START.md,
  download-context.sh, verify-context.sh, load-config.sh, context-manager skill,
  oac-setup/oac-plan/oac-add-context commands
2026-02-19 20:16:17 +00:00

125 lines
3.1 KiB
Markdown

---
name: oac-cleanup
description: Clean up old temporary files from .tmp directory
argument-hint: "[--force] [--days=N]"
---
# Clean Up Temporary Files
Remove old temporary files from the `.tmp` directory to free up disk space.
## What Gets Cleaned
The cleanup script checks three directories:
1. **`.tmp/sessions/`** - Session context files older than 7 days
2. **`.tmp/tasks/`** - Completed task files older than 30 days
3. **`.tmp/external-context/`** - Cached external documentation older than 7 days
## Usage
### Interactive Cleanup (Recommended)
```bash
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh`
```
This will:
1. Scan for old temporary files
2. Show you what will be deleted with sizes
3. Ask for confirmation before deleting
### Force Cleanup (Skip Confirmation)
```bash
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh --force`
```
**⚠️ Warning**: This deletes files immediately without confirmation.
### Custom Age Thresholds
```bash
# Clean sessions older than 14 days
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh --session-days=14`
# Clean tasks older than 60 days
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh --task-days=60`
# Clean external context older than 3 days
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh --external-days=3`
# Combine options
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/cleanup-tmp.sh --session-days=14 --task-days=60 --force`
```
## What Gets Preserved
The script is smart about what it deletes:
- **Active sessions** - Never deleted (even if old)
- **In-progress tasks** - Only completed tasks are eligible for cleanup
- **Recent files** - Files newer than the threshold are kept
## Configuration
You can customize default cleanup thresholds in your `.oac` config file:
```yaml
cleanup:
auto_prompt: true # Prompt for cleanup on session start
session_days: 7 # Days before suggesting session cleanup
task_days: 30 # Days before suggesting task cleanup
external_days: 7 # Days before suggesting external context cleanup
```
See `/install-context` for more about configuration.
## Output
The script outputs JSON with cleanup results:
```json
{
"status": "success",
"deleted": {
"sessions": 3,
"tasks": 5,
"external": 2
},
"freed_space": "2.4 MB",
"summary": "Cleaned up 10 old temporary files, freed 2.4 MB"
}
```
## When to Run Cleanup
Run cleanup when:
- You see a warning on session start about old .tmp files
- Your `.tmp` directory is getting large
- You've finished a major feature and want to clean up
- Before committing to version control (keep .tmp clean)
## Troubleshooting
**"No old files found"**
- All your temporary files are recent
- Nothing to clean up
**"Permission denied"**
- Check file permissions on .tmp directory
- Make sure cleanup-tmp.sh is executable
**"Cannot delete active session"**
- The script detected an active session
- Close the session first, then run cleanup
## Related Commands
- `/oac:status` - Check current .tmp directory status
- `/install-context` - Configure cleanup settings
- `/oac:help` - General help
---
**Tip**: Run cleanup regularly to keep your workspace clean and avoid accumulating old temporary files.