MoonshotAI / MoonshotAI/kimi-code

feat(hooks): include the final assistant message in Stop payload

Open
#2,123 0 comments 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

While testing Rocky's Kimi Code integration with Kimi Code CLI v0.29.0 on macOS, I observed that the Stop hook payload contains only:

{hook_event_name, session_id, cwd, stop_hook_active}

Because it contains no assistant text, an integration using the Stop payload cannot show what Kimi said when the turn ended. In one observed case, Kimi ended with a question for the user, but the UI could only display "done."

The text is present in the session's wire.jsonl as a content.part event, but using it requires parsing the on-disk session log instead of receiving the text through the hook.

Could Stop include the final assistant message, for example:

"last_assistant_message": "…"

Claude Code exposes this field in its Stop hook and recommends using it instead of reading transcript_path, because its transcript is written asynchronously and can lag. A similar field would give Kimi integrations a direct, hook-supported way to display the final response.

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 how the Stop hook payload is assembled and compare it with the final assistant content recorded as a content.part event in the session's wire.jsonl. Check whether existing hook tests cover Stop payload fields. Done means the Stop payload exposes the final assistant message reliably for integrations without requiring session-log parsing.

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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.