-
Notifications
You must be signed in to change notification settings - Fork 682
feat(setup): add kimi agent adapter for Kimi Code CLI #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
63b57e9
50f335e
834748a
0712978
6b86dec
b247384
b8ee931
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,6 +160,20 @@ func agentAdapters() []agentAdapter { | |
| "Verify ~/.config/kilo/AGENTS.md has the Memory Protocol block", | ||
| }, | ||
| }, | ||
| { | ||
| slug: "kimi", | ||
| description: "Kimi Code CLI — MCP registration in ~/.kimi-code/mcp.json plus AGENTS.md Memory Protocol", | ||
| mcpPath: kimiMCPPath, | ||
| mcpFormat: mcpServersObject, | ||
| instructions: []instrSurface{ | ||
| {path: kimiAgentsPath, style: markerBlock, body: memoryProtocolMarkdown}, | ||
| }, | ||
| postInstall: []string{ | ||
| "Restart Kimi Code so MCP config is reloaded", | ||
| "Verify ~/.kimi-code/mcp.json includes mcpServers.engram", | ||
| "Verify ~/.kimi-code/AGENTS.md has the Memory Protocol block", | ||
| }, | ||
|
Comment on lines
+171
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Build Kimi Code verification messages from resolved paths When 🤖 Prompt for AI Agents |
||
| }, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -291,3 +305,26 @@ func kilocodeConfigPath() string { | |
| func kilocodeAgentsPath() string { | ||
| return filepath.Join(kilocodeConfigDir(), "AGENTS.md") | ||
| } | ||
|
|
||
| // ─── Kimi Code paths ───────────────────────────────────────────────────────── | ||
| // | ||
| // Kimi Code keeps all user-level data under KIMI_CODE_HOME (default | ||
| // ~/.kimi-code on every platform, including Windows). MCP servers are declared | ||
| // in mcp.json (top-level "mcpServers") and global agent instructions in | ||
| // AGENTS.md; both live directly under the data root. | ||
|
|
||
| func kimiCodeHome() string { | ||
| if dir := os.Getenv("KIMI_CODE_HOME"); dir != "" && filepath.IsAbs(dir) { | ||
| return dir | ||
| } | ||
| home, _ := userHome() | ||
| return filepath.Join(home, ".kimi-code") | ||
| } | ||
|
|
||
| func kimiMCPPath() string { | ||
| return filepath.Join(kimiCodeHome(), "mcp.json") | ||
| } | ||
|
|
||
| func kimiAgentsPath() string { | ||
| return filepath.Join(kimiCodeHome(), "AGENTS.md") | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ func declarativeAgents() []declarativeAgent { | |
| {"cursor", cursorMCPPath, "mcpServers", mcpServersObject, cursorMemoryProtocolPath, wholeFile}, | ||
| {"vscode-copilot", vscodeMCPPath, "servers", serversObject, vscodePromptPath, wholeFile}, | ||
| {"kilocode", kilocodeConfigPath, "mcp", opencodeObject, kilocodeAgentsPath, markerBlock}, | ||
| {"kimi", kimiMCPPath, "mcpServers", mcpServersObject, kimiAgentsPath, markerBlock}, | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -44,6 +45,7 @@ func stubRegistryEnv(t *testing.T) string { | |
| osExecutable = func() (string, error) { return testEngramBin, nil } | ||
| t.Setenv("XDG_CONFIG_HOME", "") | ||
| t.Setenv("APPDATA", "") | ||
| t.Setenv("KIMI_CODE_HOME", "") | ||
| return home | ||
| } | ||
|
|
||
|
|
@@ -58,7 +60,7 @@ func TestSupportedAgentsIncludesAllRegistryAgents(t *testing.T) { | |
| want := []string{ | ||
| "opencode", "pi", "claude-code", "gemini-cli", "codex", | ||
| "antigravity-cli", "windsurf", "qwen", "kiro", "cursor", | ||
| "vscode-copilot", "kilocode", | ||
| "vscode-copilot", "kilocode", "kimi", | ||
| } | ||
| for _, slug := range want { | ||
| if !got[slug] { | ||
|
|
@@ -450,4 +452,31 @@ func TestConfigDirsIgnoreRelativeConfigHome(t *testing.T) { | |
| t.Errorf("vscodeUserDir with relative APPDATA = %q, want %q", got, want) | ||
| } | ||
| }) | ||
|
|
||
| t.Run("relative KIMI_CODE_HOME ignored", func(t *testing.T) { | ||
| t.Setenv("KIMI_CODE_HOME", "relative/kimi") | ||
| if got, want := kimiCodeHome(), filepath.Join(home, ".kimi-code"); got != want { | ||
| t.Errorf("kimiCodeHome with relative KIMI_CODE_HOME = %q, want %q", got, want) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| // TestKimiCodeHomeHonorsAbsoluteEnv verifies an absolute KIMI_CODE_HOME | ||
| // relocates both the MCP config and the AGENTS.md instruction surface. | ||
| func TestKimiCodeHomeHonorsAbsoluteEnv(t *testing.T) { | ||
| resetSetupSeams(t) | ||
| useTestHome(t) | ||
|
|
||
| custom := filepath.Join(t.TempDir(), "kimi-home") | ||
| t.Setenv("KIMI_CODE_HOME", custom) | ||
|
|
||
| if got := kimiCodeHome(); got != custom { | ||
| t.Errorf("kimiCodeHome = %q, want %q", got, custom) | ||
| } | ||
| if got, want := kimiMCPPath(), filepath.Join(custom, "mcp.json"); got != want { | ||
| t.Errorf("kimiMCPPath = %q, want %q", got, want) | ||
| } | ||
| if got, want := kimiAgentsPath(), filepath.Join(custom, "AGENTS.md"); got != want { | ||
| t.Errorf("kimiAgentsPath = %q, want %q", got, want) | ||
| } | ||
|
Comment on lines
+470
to
+481
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win Add installation-level coverage for absolute 🤖 Prompt for AI Agents |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Document the absolute-path requirement for
KIMI_CODE_HOME.kimiCodeHome()usesKIMI_CODE_HOMEonly whenfilepath.IsAbsreturns true. A relative value falls back to~/.kimi-code. Change “whenKIMI_CODE_HOMEis set” to “whenKIMI_CODE_HOMEis set to an absolute path.”This behavior is defined by
internal/setup/agents.go:316-322.🤖 Prompt for AI Agents