Skip to content

Feature request: Session lifecycle hook / plugin API #447

@grandmaster451

Description

@grandmaster451

Summary

Request for a session lifecycle hook or plugin API in Kimi Code CLI.

Motivation

Other agent CLIs (Claude Code, Codex CLI, OpenCode) provide lifecycle hooks that allow external tools to integrate seamlessly:

  • Session start/end events
  • Tool usage capture (Read, Edit, Bash, etc.)
  • Context compaction triggers

This enables use cases like:

  • Persistent memory across sessions
  • Automatic session summaries and notes
  • Usage analytics and cost tracking
  • Team knowledge sharing

Currently, Kimi CLI supports MCP servers and skills, but there is no mechanism for automatic capture of session events without manual MCP tool calls.

Request

A minimal hook or plugin mechanism that exposes session lifecycle events to external processes. The exact API design (env vars, JSON config, or plugin SDK) is left to the maintainers.

Prior art

  • Claude Code: hooks.json (SessionStart, PostToolUse, PreCompact, SessionEnd)
  • Codex CLI: Plugin SDK with typed event handlers
  • OpenCode: experimental hooks for session/message/tool events

Suggested acceptance criteria

  • External tool can receive session lifecycle events
  • Hook failures are non-blocking (do not break the main session)
  • Documented extension point for plugin authors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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