[feature request] Add session deletion support in TUI
Summary
Currently there is no way to delete or manage sessions from within the kimi-code TUI. The only way to remove a session is to manually delete its directory under ~/.kimi-code/sessions/<workspace>/ and edit session_index.jsonl to remove the corresponding JSON line. This is error-prone and tedious, especially when orphaned index entries accumulate over time.
Proposed change
Add a slash command (or extend an existing one) that allows users to list, select, and delete sessions directly from the interactive TUI.
Desired behavior
- List all sessions for the current workspace (similar to
/sessionsfor resuming, but with management options) - Allow selecting one or more sessions and deleting them
- Clean up both the session directory on disk and the corresponding entry in
session_index.jsonl - Optionally warn when a session has no matching directory (orphaned index entry)
Example interaction
> /sessions-delete
session_c391db2e 2026-07-19 15:30 C:\Users\Administrator\Documents\opencode project\test3
session_b895b8d6 [orphaned - no data]
↑/↓ to select, Space to mark, Enter to delete marked, Esc to cancel
Benefits
- Safer than manual file editing (no risk of corrupting
session_index.jsonlJSON) - Prevents orphaned entries from accumulating
- Gives users control over disk space used by old sessions
- Consistent with the existing
/sessions//resumeworkflow
Workaround (current)
Users currently have to:
rm -rf ~/.kimi-code/sessions/<workspace>/<session_id>- Manually edit
~/.kimi-code/session_index.jsonlto remove the matching line
This is fragile — a malformed JSON line breaks the session index.
Environment
- kimi-code version: 0.27.0
- Platform: Windows / win32-x64
最好能在/sessions里直接删除 session
是的,这个可以借鉴一下opencode的会话管理功能