MoonshotAI / MoonshotAI/kimi-code
ACP: expose undo and session fork/close (btw support)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Motivation
The ACP adapter currently exposes /compact as a built-in slash command, but two adjacent session operations have no ACP surface:
- Undo —
Session.undoHistory(count)exists in the node SDK (the TUI's/undodrives it), but ACP clients cannot reach it. Hosts embeddingkimi acp(IDEs, chat bots) have no way to roll back turns. - Fork / btw —
KimiHarness.forkSessionexists in the node SDK, but ACP clients cannot create an ephemeral fork to run a side conversation that cannot pollute the main session's context.
Proposal
/undo [count]built-in slash command (same shape as/compact): parse an optional positive-integer count, refuse while a turn is running (the kernel'scontext.undohas no active-turn guard, so an undo landing mid-turn would splice the history the in-flight turn is still reading), and callSession.undoHistory(count).kimi/session/forkextension method{ sessionId } -> { sessionId }: fork a session into an ephemeral copy and register it as a first-class ACP session the client cansession/promptwith the full streaming/tool surface. Kernel-sideSESSION_FORK_ACTIVE_TURNrejection is preserved.kimi/session/closeextension method{ sessionId, archive? }: close and drop a session from the adapter; witharchive: truealso archive the on-disk directory (the fork cleanup path). Requires anarchiveSessionpassthrough in the node SDK (agent-core already implements it).
Extension methods live in the kimi/* namespace so they cannot collide with future ACP spec methods.
Known limitation
ACP-supplied mcpServers are not carried into forks: resumeSession rebuilds MCP from the on-disk config only. Carrying caller-supplied MCP servers through fork is a follow-up.
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 with the ACP adapter and its existing /compact built-in command, then trace Session.undoHistory and KimiHarness.forkSession in the node SDK. Check how session/prompt and streaming/tool handling register sessions, and where archiveSession would fit. Done means /undo, kimi/session/fork, and kimi/session/close work with the stated guards and archive behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- api, backend, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100