MoonshotAI / MoonshotAI/kimi-code
[feature request] Add session deletion support in TUI
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing /sessions and /resume workflow in the TUI, then inspect how ~/.kimi-code/sessions/<workspace>/ and session_index.jsonl are read and updated. Define the deletion flow around selection, confirmation, directory cleanup, and index-entry removal, including orphaned entries. Done means selected sessions are safely removed without corrupting the index.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100