Skip to content

Kimi-JevCompact

Design-phase proposals for verbatim, Jev-guided context compaction in Kimi Code CLI via a forked mutating PreCompact hook.

CLIprototypeMIT

This repository is mostly documentation or write-up rather than runnable code.

Overview

Kimi-JevCompact is the Kimi Code CLI counterpart of fast-jev-compaction for Claude Code. When Kimi compacts a session today it asks the model for a summary, which loses information. The plan is to score every tool call and tool result with Jev in one fast request, drop or truncate the ones no longer needed, and keep everything else word for word, never rewriting user or assistant text.

Because Kimi's shell hooks can observe but not change compaction, the design has two parts: a small fork of Kimi Code that turns PreCompact into a mutating hook which receives history and may return a prune decision that Kimi applies and records durably, skipping the model summary when enough context is freed; and a Kimi plugin whose hook runs a Node script built on the fast-jev-compaction library and fails open. The repository currently holds only a series of seven OpenSpec proposals plus research notes; there is no product code yet. The patched build would ship as kimi-jev alongside the normal binary.

What the decision model decides

TypeQuestionAnswers
Yes / noIs this tool call or result still needed in context, or can it be dropped or truncated?(inferred)—

How it works

  1. Kimi triggers PreCompact with the agent history
  2. Hook script sends tool calls and results to Jev in one request
  3. Jev scores which items are still needed
  4. Hook returns a prune decision; Kimi applies and records it
  5. If enough context is freed, the model summary is skipped

Strengths

  • Keeps retained content verbatim
  • Fails open to normal summarisation
  • Small, upstreamable patch design

Caveats

  • Design phase only; no product code yet
  • Requires a fork of Kimi Code
  • MIT licence stated but code not yet written

Getting started

openspec show precompact-prune-hook-contract to read the proposals.

At a glance

Type
CLI
Status
prototype
Language
TypeScript
Runtime
Kimi Code fork and plugin (planned)
Has code
no
Has tests
no
License
MIT

Use cases and integrations

How curated lists describe it

Frequently asked questions

Can I use it now?

No, the repository contains design proposals only.

Why fork Kimi Code?

Its PreCompact hook can only observe, not change, compaction.

How does it relate to fast-jev-compaction?

It is the Kimi counterpart and builds on that npm library.

Related projects

  • MCP tool that asks Jev which files, web pages or snippets are relevant to a query, so the agent reads selectively.

    MCP serverbetaTypeScript
  • MCP server with record and recall tools: facts are logged during a session and Jev keeps only those relevant to the next task.

    MCP serverbetaTypeScript
  • Claude Code plugin where Jev asks one yes/no per standing rule and delivers only the rules relevant to each prompt, once per session.

    ProjectbetaJavaScript
  • Scores installed Claude Code skills against the current project with Jev and hides irrelevant ones via skillOverrides.

    Agent skillbetaJavaScript
  • Pre-message hook that keeps or drops SKILL.md files before the first model call, using local overlap or Jev keep/drop judgments.

    HookbetaPython
  • Claude Code and Codex plugin that removes skills from context and lets Jev decide each turn which SKILL.md bodies to inject.

    PluginbetaTypeScript