MoonshotAI / MoonshotAI/kimi-code

[FR] headless (kimi -p) sessions: ephemeral option + archived-flag support for legacy-schema sessions

Open
#2,165 1 comment 0 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

Problem

Every non-interactive run of kimi -p "..." creates a persistent session record that shows up in the session sidebar (TUI and web). For users who drive automation through headless runs (CI-ish scripts, cron-style chores, gate verification), the sidebar fills with one-shot sessions titled by their first prompt line, mixed in with real interactive windows. In our workspace 45 honeypot headless runs produced 45 sidebar entries.

What we found

  • Print-mode sessions are written with the legacy (v1) session engine: their state.json has no version field and no archived field, while interactive sessions use the v2 schema (version: 2, archived: false). This matches the v1/v2 engine split discussed in #2070.
  • Because the native archive mechanism (web Settings -> Archived, 0.23.0+) keys off archived in state.json, it cannot hide these legacy-schema headless sessions even when the field is added manually.
  • Verified workaround: kimi -S <session-id> -p "..." reuses an existing session and does NOT create a new sidebar record (session_index.jsonl entry count unchanged). We now route all headless chores through one reused session.

Requests (any subset helps)

  1. An ephemeral/no-persist mode for kimi -p (e.g. --no-session / --ephemeral) that skips creating a sidebar-visible session record entirely.
  2. Support for the archived flag on legacy-schema (v1/print-mode) sessions, so automation can be hidden from the sidebar like v2 sessions.
  3. Optional sidebar grouping/filtering (e.g. hide sessions with no interactive turns, or a per-workspace "automation" bucket), so mixed human/agent usage stays readable.

Environment

  • kimi-code 0.29.0, Windows native install
  • Repro: run kimi -p "say ok" twice; two new sidebar entries appear. Run kimi -S <id> -p "say ok"; no new entry appears.

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 at the non-interactive kimi -p session-creation path and compare it with reused-session handling via kimi -S. Inspect the legacy and v2 state.json schemas, session_index.jsonl, and the web Settings → Archived behavior. Done should mean implementing and verifying one clearly scoped request: ephemeral persistence, legacy archived support, or sidebar grouping/filtering.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.