Skip to content

aboylabs/ai-agent-skills / skills/devops/vps-cleanup

vps-cleanup

Verified

Systematic VPS cleanup — analyze files, categorize by importance, safely delete temporary/old data to free disk space

references/hermes-ecosystem-audit.md

View on GitHub
# Hermes Ecosystem Audit — Systematic Cleanup Methodology

**Session:** 2026-05-05  
**Context:** User asked "apa ada tools/sistem yang gak kepake?" (are there unused tools/systems?)  
**Result:** 78MB cleanup potential identified and executed

---

## Audit Methodology

### Phase 1: Disk Usage Analysis

```bash
# Total ecosystem size
du -sh ~/.hermes/

# Breakdown by subdirectory
du -sh ~/.hermes/* 2>/dev/null | sort -hr | head -20

# Identify large files
find ~/.hermes -type f -size +10M -exec ls -lh {} \; | sort -k5 -hr
```

### Phase 2: Categorization

For each directory/file, determine:

| Category | Keep? | Examples |
|----------|-------|----------|
| **Core infrastructure** | ✅ Always | hermes-agent/, node/, state.db, config.yaml |
| **Active tools** | ✅ Keep | Mnemosyne, skills, ecosystem tools |
| **Stale backups** | ⚠️ Cleanup | state-snapshots/ (old pre-update backups) |
| **Bloated databases** | ⚠️ Checkpoint | SQLite WAL files >5MB |
| **Growing logs** | ⚠️ Truncate | agent.log, gateway.log >1MB |
| **Temporary caches** | ⚠️ Clear | image_cache/, audio_cache/ |
| **Unused plugins** | ✅ Keep | Installed but inactive (zero disk cost) |
| **Disabled toolsets** | ✅ Keep | Part of core, cannot remove |

### Phase 3: Unused vs. Inactive Distinction

**CRITICAL:** "Unused" ≠ "Inactive"

**Unused (can delete):**
- Stale data (old backups, expired caches)
- Temporary files (logs, WAL files)
- Redundant copies (extracted + archive)

**Inactive (keep):**
- Bundled plugins (part of core, zero runtime cost)
- Disabled toolsets (part of core, cannot remove)
- Installed but not active (e.g., memory providers — zero cost until activated)

**Example from 2026-05-05 audit:**
- 8 memory provider plugins installed → **INACTIVE, not unused**
- Zero disk cost (just Python files, part of hermes-agent)
- Zero RAM cost (never loaded)
- Zero network cost (never called)
- **Decision:** Keep (no benefit to removing)

### Phase 4: Cleanup Execution

**Safe cleanup targets:**

1. **State snapshots** (pre-update backups)
   ```bash
   rm -rf ~/.hermes/state-snapshots/YYYYMMDD-*
   ```

2. **SQLite WAL checkpoint** (reclaim disk)
   ```bash
   python3 -c "
   import sqlite3
   conn = sqlite3.connect('~/.hermes/state.db')
   conn.execute('PRAGMA wal_checkpoint(TRUNCATE)')
   conn.close()
   "
   ```

3. **Log truncation** (keep last 1000 lines)
   ```bash
   tail -1000 ~/.hermes/logs/agent.log > /tmp/agent.log && mv /tmp/agent.log ~/.hermes/logs/agent.log
   tail -1000 ~/.hermes/logs/gateway.log > /tmp/gateway.log && mv /tmp/gateway.log ~/.hermes/logs/gateway.log
   tail -1000 ~/.hermes/logs/errors.log > /tmp/errors.log && mv /tmp/errors.log ~/.hermes/logs/errors.log
   ```

4. **Image cache** (temporary files)
   ```bash
   rm ~/.hermes/image_cache/img_*.jpg
   ```

**Never delete:**
- Core infrastructure (hermes-agent/, node/, bin/)
- Active databases (state.db, sessions/, mnemosyne/)
- Configuration (config.yaml, .env, memories/)
- Skills and ecosystem tools

---

## 2026-05-05 Audit Results

### Disk Usage Breakdown

| Directory | Size | Status | Action |
|---|---|---|---|
| hermes-agent/ | 1.9GB | ✅ Core | Keep |
| node/ | 507MB | ✅ Active | Keep |
| state-snapshots/ | 71MB | ⚠️ Stale | **Delete** |
| state.db | 65MB | ✅ Active | Keep |
| ecosystem-atlas/ | 62MB | ✅ Active | Keep (static docs) |
| sessions/ | 39MB | ✅ Active | Keep |
| ecosystem/ | 15MB | ✅ Active | Keep |
| bin/ | 12MB | ✅ Active | Keep |
| skills/ | 11MB | ✅ Active | Keep |
| cache/ | 6.3MB | ✅ Active | Keep |
| state.db-wal | 5.4MB | ⚠️ Bloated | **Checkpoint** |
| logs/ | 2.1MB | ⚠️ Growing | **Truncate** |
| models_dev_cache.json | 1.8MB | ✅ Active | Keep |
| wiki/ | 1.1MB | ✅ Active | Keep |
| mnemosyne/ | 276KB | ✅ Active | Keep |
| image_cache/ | 232KB | ⚠️ Stale | **Clear** |
| kanban.db | 100KB | ❓ Unknown | Check usage |

### Cleanup Actions Taken

1. **Deleted state snapshots** — 71MB
   - `20260501-055224-pre-update` (34MB)
   - `20260502-031908-pre-update` (37MB)
   - Reason: Pre-update backups, Hermes already updated successfully

2. **Checkpointed SQLite WAL** — 5.4MB → 0KB
   - `state.db-wal` compacted
   - Database integrity verified

3. **Cleared image cache** — 232KB
   - `img_8f1d855787ae.jpg` (stale, May 4)
   - Reason: Temporary cache, regenerable

4. **Truncated logs** — 2.1MB → 496KB
   - `agent.log`: 939KB → 137KB
   - `gateway.log`: 727KB → 130KB
   - `errors.log`: 373KB → 197KB
   - Kept last 1000 lines per file

**Total savings:** 78.2MB (71 + 5.4 + 0.2 + 1.6)

### Unused vs. Inactive Analysis

**Memory Provider Plugins (8 installed):**
- Location: `~/.hermes/hermes-agent/plugins/memory/`
- Disk: 1.2MB total (honcho 468KB, hindsight 188KB, holographic 184KB, etc.)
- Status: **INACTIVE, not unused**
- Dependencies: 5/8 require pip packages NOT installed
- Runtime cost: Zero (never loaded, Mnemosyne is active)
- **Decision:** Keep (part of core, zero cost, no benefit to removing)

**Disabled Toolsets (5 disabled):**
- moa, rl, homeassistant, spotify, yuanbao
- Status: **INACTIVE, not unused**
- Part of hermes-agent core (cannot remove individually)
- **Decision:** Keep disabled

**Key insight:** "Installed" ≠ "Active" ≠ "Consuming resources"
- Bundled code has zero cost until executed
- Only active processes consume RAM
- Only written files consume disk (code is static)

---

## Maintenance Schedule

### Weekly
```bash
# Checkpoint SQLite WAL
python3 -c "
import sqlite3
for db in ['~/.hermes/state.db', '~/.hermes/mnemosyne/data/mnemosyne.db']:
    conn = sqlite3.connect(db)
    conn.execute('PRAGMA wal_checkpoint(TRUNCATE)')
    conn.close()
"
```

### Monthly
```bash
# Truncate logs
for log in agent.log gateway.log errors.log; do
    tail -1000 ~/.hermes/logs/$log > /tmp/$log && mv /tmp/$log ~/.hermes/logs/$log
done

# Clear image cache
rm ~/.hermes/image_cache/img_*.jpg

# Delete old state snapshots (>30 days)
find ~/.hermes/state-snapshots/ -type d -mtime +30 -exec rm -rf {} \;
```

### Quarterly
```bash
# Full audit
du -sh ~/.hermes/* | sort -hr
hermes sessions prune --older-than 90d
```

---

## Audit Report Template

```markdown
# Hermes Ecosystem Audit — [Date]

## Summary
- Total disk: [X]GB
- Cleanup potential: [Y]MB
- Actions: [N] items

## Breakdown
| Item | Size | Status | Action |
|---|---|---|---|
| ... | ... | ... | ... |

## Cleanup Actions
1. [Action 1] — [Size]
2. [Action 2] — [Size]

## Results
- Before: [X]GB
- After: [Y]GB
- Freed: [Z]MB

## Verification
✅ All services running
✅ Critical files intact
✅ Disk space freed
```

---

## Key Learnings

1. **Always distinguish unused vs. inactive**
   - Inactive code has zero cost
   - Only delete stale data, not dormant code

2. **Bundled plugins are not "installed"**
   - Part of core repository
   - Zero cost until activated
   - No benefit to removing

3. **SQLite WAL needs periodic checkpointing**
   - Can grow to 5-10MB
   - Checkpoint reclaims disk
   - No data loss

4. **Logs grow unbounded**
   - agent.log can reach 1MB+ in days
   - Truncate to last 1000 lines
   - Keep for debugging, but limit size

5. **State snapshots accumulate**
   - Created before each update
   - Safe to delete after successful update
   - Largest cleanup opportunity (71MB)

---

## References

- Hermes session: 2026-05-05 04:44-05:38 UTC
- User: ryzen (VPS: 2 vCPU, 2GB RAM, 40GB disk)
- Full report: `~/.hermes/ecosystem/UNUSED_TOOLS_AUDIT.md`
- Cleanup report: `~/.hermes/ecosystem/CLEANUP_REPORT_20260505.md`
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall