[SELF-IMPROVE] Session DB auto-pruning — compress old sessions, enforce growth limit #1479

Open
opened 2026-04-05 23:20:25 +00:00 by Timmy · 1 comment
Owner

Problem

hermes_state.py session DB (SQLite FTS5) grows without bound. Every conversation, tool call, response lives forever. Eventually: slow FTS5 queries, disk pressure, bloated context.

What To Do

Create ~/.hermes/bin/session-db-pruner.py:

  1. Find and connect to session DB (HERMES_HOME, likely hermes_sessions.db)
  2. Report current DB size and row count
  3. Prune rules:
    • Sessions older than 30 days: compress (keep first/last message + metadata, drop tool call details)
    • Sessions older than 90 days: delete entirely
    • Rebuild FTS5 index after pruning
  4. Run VACUUM to reclaim space
  5. Report before/after: size, rows removed, space reclaimed
  6. No active sessions affected (activity in last 7 days)

Acceptance Criteria

  • Script at ~/.hermes/bin/session-db-pruner.py exists
  • Running it outputs: DB before, rows compressed, rows deleted, DB after, space reclaimed
  • No active sessions (last 7 days) affected
  • FTS5 search still works after pruning (test with a known query)
  • Comment on epic #1474 with script path, before/after sizes, search test result

Labels: self-improve, priority-medium

Assignee: groq

## Problem hermes_state.py session DB (SQLite FTS5) grows without bound. Every conversation, tool call, response lives forever. Eventually: slow FTS5 queries, disk pressure, bloated context. ## What To Do Create ~/.hermes/bin/session-db-pruner.py: 1. Find and connect to session DB (HERMES_HOME, likely hermes_sessions.db) 2. Report current DB size and row count 3. Prune rules: - Sessions older than 30 days: compress (keep first/last message + metadata, drop tool call details) - Sessions older than 90 days: delete entirely - Rebuild FTS5 index after pruning 4. Run VACUUM to reclaim space 5. Report before/after: size, rows removed, space reclaimed 6. No active sessions affected (activity in last 7 days) ## Acceptance Criteria - [ ] Script at ~/.hermes/bin/session-db-pruner.py exists - [ ] Running it outputs: DB before, rows compressed, rows deleted, DB after, space reclaimed - [ ] No active sessions (last 7 days) affected - [ ] FTS5 search still works after pruning (test with a known query) - [ ] Comment on epic #1474 with script path, before/after sizes, search test result ## Labels: self-improve, priority-medium ## Assignee: groq
groq was assigned by Timmy 2026-04-05 23:20:25 +00:00
Author
Owner

Alexander ordered: go to Issue #427 and comment on OpenProse as force multiplier. Do it now.

Alexander ordered: go to [Issue #427](https://forge.alexanderwhitestone.com/Timmy_Foundation/timmy-home/issues/427) and comment on OpenProse as force multiplier. Do it now.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1479