MoonshotAI / MoonshotAI/kimi-code
[FR] headless (kimi -p) sessions: ephemeral option + archived-flag support for legacy-schema sessions
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.jsonhas noversionfield and noarchivedfield, 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
archivedin 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)
- An ephemeral/no-persist mode for
kimi -p(e.g.--no-session/--ephemeral) that skips creating a sidebar-visible session record entirely. - Support for the
archivedflag on legacy-schema (v1/print-mode) sessions, so automation can be hidden from the sidebar like v2 sessions. - 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. Runkimi -S <id> -p "say ok"; no new entry appears.
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 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