Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

feat(cli): wire Kimi Code into endpoint hooks

Claude36ed20309acd
diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.go
index 47bf6227..87d2650f 100644
--- a/cli/beacon/cmd/endpoint_diagnostics.go
+++ b/cli/beacon/cmd/endpoint_diagnostics.go
@@ -957,10 +957,14 @@ var userScopeOnlyHookTargets = map[string]bool{
"hermes": true,
"muse": true,
"dsh": true,
+ // Kimi Code reads one user-level config.toml and has no project-level config mechanism at
+ // all: its project-local .kimi-code directory holds a workspace override and an MCP server
+ // list, neither of which can register a hook.
+ "kimi": true,
}
func allHookTargetsForLevel() []string {
- all := []string{"cursor", "codex", "vscode", "factory", "opencode", "openhands", "kiro", "dsh", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}
+ all := []string{"cursor", "codex", "vscode", "factory", "opencode", "openhands", "kiro", "kimi", "dsh", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}
if endpointOpts.hookLevel != "project" {
return all
}
@@ -1038,6 +1042,9 @@ func hookStatusesWithConfig(targets []string, cfg endpointconfig.Config) map[str
// mounts the bridge at it rides along in Raw, where the JSON output keeps it -- this
// struct carries one path and the install has two.
statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.HooksPath, Raw: status}
+ case "kimi":
+ status := endpointhooks.KimiHookStatus(endpointhooks.KimiOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})
+ statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.HooksPath, Raw: status}
case "kiro":
status := endpointhooks.KiroHookStatus(endpointhooks.KiroOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})
statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.HooksPath, Raw: status}
diff --git a/cli/beacon/cmd/endpoint_hooks.go b/cli/beacon/cmd/endpoint_hooks.go
index c7bbae81..750264b7 100644
--- a/cli/beacon/cmd/endpoint_hooks.go
+++ b/cli/beacon/cmd/endpoint_hooks.go
@@ -265,6 +265,20 @@ func installEndpointHookTarget(name string, cfg endpointconfig.Config) error {
// profile enabled HMR -- and the symptom otherwise is a successful install collecting
// nothing until the next restart, which reads as a broken install.
fmt.Println("Restart dsh (or rely on its config watcher, if your profile enables HMR) for the hooks to take effect.")
+ case "kimi":
+ status, err := endpointhooks.InstallKimi(endpointhooks.KimiOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
+ if err != nil {
+ return err
+ }
+ fmt.Printf("Kimi Code hooks installed: %s\n", status.HooksPath)
+ // Said on every install, because Kimi Code reads config.toml once at startup: a running
+ // session will not pick these up, and the symptom is a successful install collecting
+ // nothing until the next `kimi`, which reads as a broken install.
+ fmt.Println("Start a new Kimi Code session (or run /reload) for the hooks to take effect.")
case "kiro":
status, err := endpointhooks.InstallKiro(endpointhooks.KiroOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
@@ -532,6 +546,16 @@ func uninstallEndpointHookTarget(name string, cfg endpointconfig.Config) error {
return err
}
fmt.Println(status.Message)
+ case "kimi":
+ status, err := endpointhooks.UninstallKimi(endpointhooks.KimiOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
+ if err != nil {
+ return err
+ }
+ fmt.Println(status.Message)
case "kiro":
status, err := endpointhooks.UninstallKiro(endpointhooks.KiroOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
@@ -704,6 +728,12 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {
LogPath: cfg.LogPath,
UserMode: cfg.UserMode,
})
+ case "kimi":
+ statuses["kimi"] = endpointhooks.KimiHookStatus(endpointhooks.KimiOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
case "kiro":
statuses["kiro"] = endpointhooks.KiroHookStatus(endpointhooks.KiroOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
@@ -820,6 +850,10 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {
fmt.Printf("DeepSeek Harness hooks: installed=%t path=%s patch=%s\n",
status.Installed, status.HooksPath, status.PatchPath)
fmt.Println(status.Message)
+ case "kimi":
+ status := statuses["kimi"].(endpointhooks.KimiStatus)
+ fmt.Printf("Kimi Code hooks: installed=%t path=%s\n", status.Installed, status.HooksPath)
+ fmt.Println(status.Message)
case "kiro":
status := statuses["kiro"].(endpointhooks.KiroStatus)
fmt.Printf("Kiro hooks: installed=%t path=%s\n", status.Installed, status.HooksPath)
diff --git a/cli/beacon/cmd/endpoint_hooks_repair.go b/cli/beacon/cmd/endpoint_hooks_repair.go
index 76ca098f..8bfb35a0 100644
--- a/cli/beacon/cmd/endpoint_hooks_repair.go
+++ b/cli/beacon/cmd/endpoint_hooks_repair.go
@@ -148,7 +148,7 @@ func installedHookTargetsForUser(homeDir, logPath string) ([]string, error) {
}
func repairTargetOrder() []string {
- return []string{"claude", "codex", "cursor", "vscode", "factory", "opencode", "openhands", "kiro", "dsh", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}
+ return []string{"claude", "codex", "cursor", "vscode", "factory", "opencode", "openhands", "kiro", "kimi", "dsh", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}
}
// withUserHome runs fn as if it were executing inside another user's profile.
diff --git a/cli/beacon/cmd/endpoint_targets.go b/cli/beacon/cmd/endpoint_targets.go
index 6d08a330..d2e83368 100644
--- a/cli/beacon/cmd/endpoint_targets.go
+++ b/cli/beacon/cmd/endpoint_targets.go
@@ -104,6 +104,20 @@ var harnessTargets = []harnessTarget{
// people say it; Kiro's own documentation does not, which is why it is an alias and not the
// name.
{name: "kiro", endpointKind: endpointTargetHook, endpointAliases: []string{"kiro", "kiro-ide", "kiro-cli", "kiro-code"}, hookAliases: []string{"kiro", "kiro-ide", "kiro-cli", "kiro-code"}},
+ // Kimi Code. One row for every surface, because the terminal CLI, the desktop app, the VS
+ // Code extension and the ACP server are front ends over one agent core that reads one
+ // user-level config.toml -- so one install covers all of them, and "kimi-code-cli" is an alias
+ // of that install rather than a target of its own. "kimi" is the binary and the --platform
+ // value; "kimi-code" and "kimi_code" are what the product is called and the canonical harness
+ // name events are written under, so a row read out of the runtime log and passed back to
+ // --harness resolves to the runtime it names.
+ //
+ // Bare "moonshot" and every "kimi-k2"/"kimi-k3" spelling are deliberately not aliases. The
+ // first is the vendor and the rest are the model family, and accepting either would let
+ // someone ask to install hooks for a model -- the same reason NormalizeHarnessName leaves them
+ // unmapped. Bare "kimi" is accepted here and not there for the same reason it is accepted in
+ // the harness normalizer: it is the name of the thing the operator runs.
+ {name: "kimi", endpointKind: endpointTargetHook, endpointAliases: []string{"kimi", "kimi-code", "kimi-code-cli"}, hookAliases: []string{"kimi", "kimi-code", "kimi-code-cli"}},
// OpenClaw Gateway. One row, and it is the plugin row: `--harness openclaw` installs the
// Beacon-managed plugin, which is the path that collects the agent's work. The gateway's other
// surface, its own diagnostics-otel plugin, is configured inside OpenClaw rather than by
diff --git a/cli/beacon/cmd/kimi_target_test.go b/cli/beacon/cmd/kimi_target_test.go
new file mode 100644
index 00000000..fe7847a3
--- /dev/null
+++ b/cli/beacon/cmd/kimi_target_test.go
@@ -0,0 +1,218 @@
+package cmd
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/harness"
+ endpointhooks "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"
+)
+
+// The install -> status -> uninstall round trip for Kimi Code, through the CLI entry points rather
+// than the package API.
+//
+// Wiring a runtime into `beacon endpoint hooks` means five separate switches (install, uninstall,
+// status collection, status printing, repair) plus a registry row, and every one of them fails by
+// omission rather than by error. TestEveryHookTargetIsWired proves each switch has a case; this
+// proves the cases do the thing their name claims -- and here that means writing into a file that
+// holds the user's API keys and giving it back unchanged.
+
+func kimiCLIHome(t *testing.T) (home, configPath string, cfg endpointconfig.Config) {
+ t.Helper()
+ home = t.TempDir()
+ t.Setenv("HOME", home)
+ t.Setenv("USERPROFILE", home)
+ t.Setenv("KIMI_CODE_HOME", "")
+
+ origLevel := endpointOpts.hookLevel
+ t.Cleanup(func() { endpointOpts.hookLevel = origLevel })
+ endpointOpts.hookLevel = "user"
+
+ return home,
+ filepath.Join(home, ".kimi-code", "config.toml"),
+ endpointconfig.Config{LogPath: filepath.Join(home, "runtime.jsonl"), UserMode: true}
+}
+
+func TestEndpointHooksInstallAndUninstallKimi(t *testing.T) {
+ _, configPath, cfg := kimiCLIHome(t)
+
+ if err := os.MkdirAll(filepath.Dir(configPath), 0700); err != nil {
+ t.Fatalf("mkdir: %v", err)
+ }
+ original := "# mine\ndefault_model = \"k2\"\n\n[providers.kimi]\napi_key = \"sk-do-not-touch\"\n"
+ if err := os.WriteFile(configPath, []byte(original), 0600); err != nil {
+ t.Fatalf("write config: %v", err)
+ }
+
+ if err := installEndpointHookTarget("kimi", cfg); err != nil {
+ t.Fatalf("installEndpointHookTarget(kimi) returned error: %v", err)
+ }
+ written, err := os.ReadFile(configPath)
+ if err != nil {
+ t.Fatalf("install did not write %s: %v", configPath, err)
+ }
+ if !strings.Contains(string(written), "--platform kimi") {
+ t.Fatalf("the config does not carry the kimi hook command:\n%s", written)
+ }
+ // The property this integration is built around: the user's own file is appended to, never
+ // rewritten.
+ if !strings.HasPrefix(string(written), original) {
+ t.Fatalf("install did not leave the user's config as a prefix:\n%s", written)
+ }
+
+ if !endpointhooks.IsKimiInstalled(endpointhooks.KimiOptions{
+ Level: endpointhooks.LevelUser, LogPath: cfg.LogPath, UserMode: true,
+ }) {
+ t.Fatal("IsKimiInstalled = false after installEndpointHookTarget")
+ }
+
+ if err := uninstallEndpointHookTarget("kimi", cfg); err != nil {
+ t.Fatalf("uninstallEndpointHookTarget(kimi) returned error: %v", err)
+ }
+ after, err := os.ReadFile(configPath)
+ if err != nil {
+ t.Fatalf("uninstall removed the user's config file entirely: %v", err)
+ }
+ if string(after) != original {
+ t.Fatalf("uninstall did not restore the config:\n--- want ---\n%s\n--- got ---\n%s", original, after)
+ }
+}
+
+// `endpoint hooks repair` walks a hard-coded list rather than the registry, so a runtime absent
+// from it is never repaired -- and repair is what fixes a hook whose binary path went stale after
+// an upgrade. It fails silently: repair reports success having skipped the runtime entirely.
+func TestKimiIsInTheRepairTargetList(t *testing.T) {
+ for _, name := range repairTargetOrder() {
+ if name == "kimi" {
+ return
+ }
+ }
+ t.Fatal("kimi is missing from the repair target list; `endpoint repair` would silently skip it")
+}
+
+// Every spelling a person plausibly types resolves to the one hook target, in both namespaces.
+// One install covers the CLI, the desktop app, the VS Code extension and the ACP server, so
+// "kimi-code-cli" is an alias of it rather than a target of its own.
+func TestKimiHarnessSpellingsResolveToTheHookTarget(t *testing.T) {
+ for _, spelling := range []string{
+ "kimi", "KIMI", " kimi ", "Kimi",
+ "kimi-code", "kimi_code", "Kimi-Code",
+ "kimi-code-cli", "kimi_code_cli",
+ } {
+ t.Run(spelling, func(t *testing.T) {
+ target, ok := normalizeEndpointTarget(spelling)
+ if !ok {
+ t.Fatalf("normalizeEndpointTarget(%q) = not found", spelling)
+ }
+ if target.Name != "kimi" || target.Kind != endpointTargetHook {
+ t.Fatalf("normalizeEndpointTarget(%q) = %+v, want the kimi hook target", spelling, target)
+ }
+ if got, ok := normalizeHookTarget(spelling); !ok || got != "kimi" {
+ t.Fatalf("normalizeHookTarget(%q) = %q, %t; want kimi, true", spelling, got, ok)
+ }
+ })
+ }
+}
+
+// Moonshot ships the agent and a large model family under one name. Accepting a model id as a
+// target would let somebody ask to install hooks for a model, which is the same reason
+// NormalizeHarnessName leaves those spellings unmapped. "moonshot" is the vendor.
+func TestKimiModelAndVendorSpellingsAreNotHookTargets(t *testing.T) {
+ for _, spelling := range []string{
+ "moonshot", "moonshotai", "kimi-k2", "kimi-k3", "kimi-k2.7-code", "kimi-latest",
+ } {
+ t.Run(spelling, func(t *testing.T) {
+ if target, ok := normalizeEndpointTarget(spelling); ok && target.Name == "kimi" {
+ t.Fatalf("normalizeEndpointTarget(%q) resolved to the kimi hook target", spelling)
+ }
+ })
+ }
+}
+
+// kimi is swept by --all at user scope and filtered out at project scope. The filtering is not
+// cosmetic: install and uninstall both return on the first target error, so a target that refuses
+// project scope would abort the sweep and silently skip every target ordered after it.
+func TestKimiIsSweptAtUserScopeOnly(t *testing.T) {
+ origLevel := endpointOpts.hookLevel
+ t.Cleanup(func() { endpointOpts.hookLevel = origLevel })
+
+ endpointOpts.hookLevel = "user"
+ if !containsTarget(allHookTargetsForLevel(), "kimi") {
+ t.Fatalf("user-level --all dropped kimi:\n%v", allHookTargetsForLevel())
+ }
+ endpointOpts.hookLevel = "project"
+ if containsTarget(allHookTargetsForLevel(), "kimi") {
+ t.Fatalf("project-level --all kept kimi, whose installer refuses that level:\n%v",
+ allHookTargetsForLevel())
+ }
+ if !userScopeOnlyHookTargets["kimi"] {
+ t.Fatal("kimi is not marked user scope only; Kimi Code reads one user-level config.toml " +
+ "and has no project-level config mechanism")
+ }
+}
+
+// A project-scope install is refused with its reason rather than silently becoming a machine-wide
+// one. An operator asking for a repository-scoped install must not get something else.
+func TestEndpointHooksKimiRefusesProjectLevel(t *testing.T) {
+ home, _, cfg := kimiCLIHome(t)
+ endpointOpts.hookLevel = "project"
+
+ err := installEndpointHookTarget("kimi", cfg)
+ if err == nil {
+ t.Fatal("a project-level Kimi Code install succeeded; there is no project-scoped hook config")
+ }
+ if !strings.Contains(err.Error(), "user scope") {
+ t.Fatalf("error %q does not tell the operator what to do instead", err)
+ }
+ if _, statErr := os.Stat(filepath.Join(home, ".kimi-code")); !os.IsNotExist(statErr) {
+ t.Fatal("the refused install wrote into the Kimi Code data root anyway")
+ }
+}
+
+// Discovery reads the same file the installer writes, so it has to agree with it about what
+// "installed" means -- and about the one document shape the installer refuses, which a user is
+// better told about before they hit it than after.
+func TestKimiDiscoveryTracksTheInstall(t *testing.T) {
+ _, configPath, cfg := kimiCLIHome(t)
+ if err := os.MkdirAll(filepath.Dir(configPath), 0700); err != nil {
+ t.Fatalf("mkdir: %v", err)
+ }
+
+ kimiRow := func(t *testing.T) (status, message string) {
+ t.Helper()
+ for _, h := range harness.DiscoverAll() {
+ if h.Name == "kimi_code" {
+ return string(h.TelemetryStatus), h.Message
+ }
+ }
+ t.Fatal("kimi_code is missing from endpoint discovery")
+ return "", ""
+ }
+
+ if err := os.WriteFile(configPath, []byte("default_model = \"k2\"\n"), 0600); err != nil {
+ t.Fatalf("write: %v", err)
+ }
+ if status, message := kimiRow(t); status != "disabled" {
+ t.Fatalf("discovery = %q (%s) for a config with no Beacon hooks, want disabled", status, message)
+ }
+
+ if err := installEndpointHookTarget("kimi", cfg); err != nil {
+ t.Fatalf("install: %v", err)
+ }
+ if status, message := kimiRow(t); status != "enabled" {
+ t.Fatalf("discovery = %q (%s) after an install, want enabled", status, message)
+ }
+
+ // The shape the installer refuses. Reporting it at discovery time turns a refusal the user
+ // meets later into something they can fix first.
+ if err := os.WriteFile(configPath, []byte("hooks = [{ event = \"Stop\", command = \"x\" }]\n"), 0600); err != nil {
+ t.Fatalf("write: %v", err)
+ }
+ status, message := kimiRow(t)
+ if status != "misconfigured" || !strings.Contains(message, "inline array") {
+ t.Fatalf("discovery = %q (%s) for an inline hooks array, want misconfigured naming the shape", status, message)
+ }
+}
diff --git a/cli/beacon/internal/endpoint/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.go
index 3170f375..c2e85837 100644
--- a/cli/beacon/internal/endpoint/harness/harness.go
+++ b/cli/beacon/internal/endpoint/harness/harness.go
@@ -65,6 +65,7 @@ func DiscoverAll() []Harness {
DiscoverOmo(),
DiscoverFx(),
DiscoverQwen(),
+ DiscoverKimi(),
DiscoverHermes(),
DiscoverFactory(),
DiscoverVSCode(),
diff --git a/cli/beacon/internal/endpoint/harness/kimi.go b/cli/beacon/internal/endpoint/harness/kimi.go
new file mode 100644
index 00000000..6e776859
--- /dev/null
+++ b/cli/beacon/internal/endpoint/harness/kimi.go
@@ -0,0 +1,92 @@
+package harness
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"
+ "github.com/pelletier/go-toml/v2"
+)
+
+// DiscoverKimi reports whether Kimi Code is present and whether Beacon's hooks are installed for
+// it.
+//
+// Its capability is "hooks" rather than "otel_env" or "otel_config", and that is a fact about the
+// runtime rather than a gap in this probe: Kimi Code ships no OpenTelemetry export at all. Its
+// only telemetry switch is `KIMI_DISABLE_TELEMETRY`, which governs Moonshot's own anonymous
+// product reporting and has nothing to do with Beacon -- there is no endpoint to point at the
+// local collector, so the hook system is the whole integration surface.
+func DiscoverKimi() Harness {
+ h := Harness{Name: "kimi_code", DisplayName: "Kimi Code", Capability: "hooks"}
+ detectExecutable(&h, "kimi")
+
+ configPath, err := hooks.KimiConfigPath(hooks.LevelUser)
+ if err != nil {
+ h.TelemetryStatus = TelemetryMissing
+ h.Message = "Kimi Code data directory could not be resolved: " + err.Error()
+ return h
+ }
+ h.ConfigPath = configPath
+
+ // Kimi Code installs through npm, and a version manager, a shell alias or a per-project
+ // install all hide the binary from the PATH this process inherited while the data root is
+ // still there. Treating that directory as evidence keeps `endpoint discover` from reporting
+ // "not detected" for a runtime the user is actively using -- the same fallback the opencode,
+ // Cursor, Pi, Qwen and Hermes probes make for the same reason.
+ //
+ // The directory is derived from the config path rather than from $HOME, so a machine that
+ // sets KIMI_CODE_HOME is checked where it actually keeps its data.
+ if !h.Detected && dirExists(filepath.Dir(configPath)) {
+ h.Detected = true
+ }
+
+ h.TelemetryStatus, h.Message = kimiStatus(configPath)
+ return h
+}
+
+// kimiStatus classifies Kimi Code's config file.
+//
+// Five outcomes, and the two in the middle are the ones worth spelling out.
+//
+// A config with hooks that are not Beacon's is *disabled*, not enabled: reporting it as enabled
+// would claim telemetry Beacon is not collecting.
+//
+// Invalid TOML is *misconfigured* rather than missing, and on this runtime that is the most
+// useful thing discovery can say. Kimi Code refuses to start on a config it cannot load, so the
+// user's agent is already broken; Beacon's installer will also refuse to touch the file, and
+// reporting "not found" for a file that is right there would send them looking in the wrong
+// place.
+//
+// The fifth is specific to this runtime and is the reason this probe reads the file rather than
+// grepping it: a `hooks` key written as an inline array cannot take an appended `[[hooks]]`, so
+// the install will refuse. Saying so at discovery time turns a refusal the user meets later into
+// something they can fix first.
+func kimiStatus(path string) (TelemetryStatus, string) {
+ data, err := os.ReadFile(path)
+ if err != nil {
+ if os.IsNotExist(err) {
+ return TelemetryMissing, "Kimi Code config file was not found"
+ }
+ return TelemetryMissing, err.Error()
+ }
+ text := string(data)
+
+ var config map[string]interface{}
+ if err := toml.Unmarshal(data, &config); err != nil {
+ return TelemetryMisconfigured, "Kimi Code config.toml is not valid TOML; Kimi Code will not start until it is fixed"
+ }
+
+ // Matched on the hook command, not on Beacon's comment, for the reason the installer gives:
+ // Kimi Code's legacy migration rewrites this file by serializing it, which keeps the entries
+ // and drops every comment.
+ if strings.Contains(text, "--platform kimi") || strings.Contains(text, "--platform=kimi") {
+ return TelemetryEnabled, "Beacon Kimi Code hooks are configured"
+ }
+
+ if _, present := config["hooks"]; present && !strings.Contains(text, "[[hooks]]") {
+ return TelemetryMisconfigured, "Kimi Code config.toml defines `hooks` as an inline array; " +
+ "rewrite it as [[hooks]] blocks before installing Beacon hooks"
+ }
+ return TelemetryDisabled, "Kimi Code config file exists but Beacon endpoint hooks were not found"
+}
diff --git a/cli/beacon/internal/endpoint/hooks/kimi.go b/cli/beacon/internal/endpoint/hooks/kimi.go
index e64fc8c8..2f2d5ac1 100644
--- a/cli/beacon/internal/endpoint/hooks/kimi.go
+++ b/cli/beacon/internal/endpoint/hooks/kimi.go
@@ -736,6 +736,16 @@ func writeKimiConfig(path, text string) error {
return os.WriteFile(path, []byte(text), mode)
}
+// KimiConfigPath is where Beacon registers Kimi Code's hooks.
+//
+// Exported because `harness` reports on the same file and must not rebuild the path itself. Two
+// copies of "where the config lives" is how discovery comes to report on a file the installer does
+// not write -- and here that would be worse than usual, because the value it reports on is the one
+// holding the user's API keys.
+func KimiConfigPath(level Level) (string, error) {
+ return kimiConfigPath(level)
+}
+
func kimiConfigPath(level Level) (string, error) {
dir, err := kimiHomeDir(level)
if err != nil {