feat: add session-manager plugin for listing, deleting, and cleaning up sessions#26328
Open
Kropiunig wants to merge 1 commit intoanthropics:mainfrom
Open
feat: add session-manager plugin for listing, deleting, and cleaning up sessions#26328Kropiunig wants to merge 1 commit intoanthropics:mainfrom
Kropiunig wants to merge 1 commit intoanthropics:mainfrom
Conversation
…up sessions Session history accumulates rapidly with no built-in way to manage it. Users must manually navigate ~/.claude/projects/ to find and delete JSONL files — a workflow that is error-prone and breaks flow. This plugin adds three commands that close the session lifecycle gap: - /session-manager:delete — delete a session by name, ID prefix, or interactive selection with confirmation - /session-manager:list — cross-project session overview with timestamps, sizes, and first-prompt previews - /session-manager:cleanup — bulk-remove sessions by age or size with dry-run support All operations are local, require explicit confirmation before deletion, and handle companion data directories alongside JSONL files. Addresses anthropics#2562, anthropics#16901
Author
|
Bumping this — it's been 4 days since opening with no CI failures (no checks configured on this branch). This adds a \ plugin with three commands addressing session lifecycle management — the most-requested missing feature. Happy to adjust scope, naming, or implementation approach based on maintainer feedback. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a session-manager plugin with three commands that address the most-requested missing feature in Claude Code: session lifecycle management.
/session-manager:delete— Delete a session by name, UUID prefix, or interactive numbered selection. Always confirms before deleting./session-manager:list— Cross-project session overview showing timestamps, file sizes, and first-prompt previews — what/resumelacks./session-manager:cleanup— Bulk-remove sessions by age (--older-than=30d) or size (--smaller-than=5KB) with--dry-runsupport.Why this matters
Session history accumulates rapidly. Every
claudeinvocation creates a.jsonlfile under~/.claude/projects/, and there is currently no way to delete or review sessions without manually navigating the filesystem. This is the single most duplicated feature request in the repo:/list-sessionsand/delete-sessionslash commands for better session management #16901 — "Add/list-sessionsand/delete-sessionslash commands"/deletecommand to delete current session" (closed as dup)This plugin provides a working solution today while native support is developed.
Design decisions
commit-commandsand other utility plugins in this repo.--dry-runfor preview..jsonland the directory are cleaned up together.~/.claude/projects/which resolves correctly on macOS, Linux, and Windows (Git Bash / WSL).Plugin structure
Follows the standard plugin structure used by
commit-commands,code-review, and other plugins in this directory.Test plan
/session-manager:listshows sessions across multiple projects/session-manager:deletewith no args — confirm interactive numbered list appears/session-manager:delete <uuid-prefix>— confirm single-match direct deletion with confirmation.jsonlfile and companion directory are both removed/session-manager:cleanup --dry-run --older-than=7d— confirm preview without deletion/session-manager:cleanup --older-than=7d— confirm deletion after approval