Skip to content

Add cleanup command for session plugin #25

@kuiwang02

Description

@kuiwang02

Problem
The /save-session command (#11) creates session files in the repository root directory. Over time, these files can accumulate and create clutter:

  • session-2025-10-16-feature-work.md
  • session-2025-10-17-bug-fixes.md
  • session-2025-10-18-pr-review.md
  • ...

Users are left to manually identify and delete old session files they no longer need. This can lead to:

  • Repository root directory becoming cluttered with old session files
  • Difficulty identifying which sessions are still relevant
  • Risk of accidentally deleting important sessions
  • Manual cleanup burden (rm session-*.md)

Solution
Add a /cleanup-sessions command (or similar) to help users manage their session files. This should:

  1. List existing sessions with metadata (date, size, age)
  2. Provide filtering options such as:
    • Age-based: sessions older than N days
    • Pattern-based: sessions matching a description pattern
    • Interactive selection: let users choose which to delete
  3. Safe deletion with confirmation to prevent accidental data loss
  4. Optional automation: e.g., /save-session --cleanup-old to clean up while saving

Design Questions to Consider

  • Should this be a separate /cleanup-sessions command or an option to /save-session?
  • What default criteria should be used for cleanup? (age-based, count-based, interactive?)
  • Should deleted files be moved to trash/backup location instead of permanent deletion?
  • Should cleanup work across all repositories or only the current one?

Context
This was suggested by @brandisher in PR #11 review: #11 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions