MoonshotAI / MoonshotAI/kimi-code

[feature request] Add session deletion support in TUI

Open
#1,926 2 comments 2 reactions 0 assignees View on GitHub

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 /sessions for 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.jsonl JSON)
  • Prevents orphaned entries from accumulating
  • Gives users control over disk space used by old sessions
  • Consistent with the existing /sessions / /resume workflow

Workaround (current)

Users currently have to:

  1. rm -rf ~/.kimi-code/sessions/<workspace>/<session_id>
  2. Manually edit ~/.kimi-code/session_index.jsonl to 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.