Skip to content

[feature request] Add session deletion support in TUI #1926

Description

@SunshineR04

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions