Skip to content

feat(kimi): add Kimi Code CLI adapter with opt-in hooks#233

Merged
zzet merged 2 commits into
zzet:mainfrom
blankanswer:feat/kimi-code-cli-pr1
Jul 3, 2026
Merged

feat(kimi): add Kimi Code CLI adapter with opt-in hooks#233
zzet merged 2 commits into
zzet:mainfrom
blankanswer:feat/kimi-code-cli-pr1

Conversation

@blankanswer

Copy link
Copy Markdown
Contributor

Summary

  • Add a Kimi Code CLI agent adapter for Gortex.
  • Support project-local Kimi MCP setup through gortex init --agents=kimi, writing .kimi-code/mcp.json.
  • Support explicit user-level Kimi integration through gortex install --agents=kimi, writing Kimi MCP config and the UserPromptSubmit hook.
  • Route Kimi hooks through gortex hook --agent=kimi and reuse the existing UserPromptSubmit symbol-context enrichment.
  • Keep Kimi hook output plain stdout, matching Kimi's hook behavior instead of Claude-style additionalContext JSON.
  • Part of Add support for Kimi code cli with pretool use/post tool use hooks for context injection #214.

Design notes

  • init remains repo-local and team-shareable; it does not mutate ~/.kimi-code/config.toml.
  • install is the explicit local-machine action that enables the user-level Kimi hook.
  • The user-level Kimi hook no-ops outside Gortex-enabled projects before probing the daemon.
  • A project is considered Gortex-enabled when the hook cwd is under one of:
    • .kimi-code/mcp.json containing mcpServers.gortex
    • .gortex.yaml
    • a Gortex-managed .gortex/.gitignore marker
  • Kimi prompt payloads support both plain string prompts and text content parts.
  • Existing Claude, Gemini, Codex, and Antigravity behavior remains unchanged.

Out of scope

  • Stop
  • subagent hooks
  • PreToolUse
  • PostToolUse
  • deny / enforcement behavior
  • permission decisions
  • input rewrite
  • output suppression
  • resolver / indexer / daemon / graph / MCP tool changes

Tests

  • go test ./internal/agents/... -count=1
  • go test ./internal/hooks -count=1 -timeout=180s
  • go test ./cmd/gortex -count=1 -timeout=300s
  • go test ./internal/hooks -run 'TestRunKimi|TestKimi' -count=1 -timeout=120s -v
  • git diff --check -- internal/hooks/kimi.go internal/hooks/kimi_test.go
  • Added coverage for Kimi project-local MCP rendering, user-level hook install, plain stdout hook output, content-part prompt handling, and project-outside no-op behavior.

@zzet zzet merged commit e0c2c35 into zzet:main Jul 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants