Skip to content

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

Add the grok_bot harness identity

Claudeb76129fbefcb
diff --git a/pkg/asymptoteobserve/harness.go b/pkg/asymptoteobserve/harness.go
index d7829148..58be7b4c 100644
--- a/pkg/asymptoteobserve/harness.go
+++ b/pkg/asymptoteobserve/harness.go
@@ -198,6 +198,28 @@ func NormalizeHarnessName(name string) string {
lower == "openhands_agent" || lower == "openhands-agent" || lower == "openhands agent" ||
lower == "openhands.dev":
return "openhands"
+ // Grok Bot is xAI's always-on agent product: each Bot runs on a Cursor-hosted cloud computer
+ // and the desktop app is a client to it. It is a different product from Grok Build, the xAI
+ // terminal coding agent Beacon hooks under the `grok` harness, and the two must never share a
+ // name: one runs on the endpoint under the operator's own account, the other runs in a vendor
+ // cloud and reaches Beacon only through Cursor's server-side OpenTelemetry export (resource
+ // attribute cursor.surface=grok_bot). A query grouping by harness.name that merged them would
+ // file cloud-computer shell commands under a local CLI.
+ //
+ // Equality against a closed set, and deliberately narrower than every other xAI spelling.
+ // "grok" alone is Grok Build and stays on the passthrough path as itself; "grok-4", "grok-4.6"
+ // and the other model ids also begin with the same four letters, so a Contains(lower, "grok")
+ // rule would claim both the sibling product and any event whose harness attribute carried a
+ // model string. Those fall through and show up as themselves, which is the visible anomaly a
+ // reader can act on rather than a silent misattribution.
+ //
+ // The canonical spelling is grok_bot because that is what the product is called and what
+ // Cursor's own export writes for the surface; it follows claude_code and muse_code, not a CLI
+ // suffix, because there is no CLI.
+ case lower == "grok_bot" || lower == "grok-bot" || lower == "grok bot" || lower == "grokbot" ||
+ lower == "grok_bot_desktop" || lower == "grok-bot-desktop" || lower == "cursor.grok_bot" ||
+ lower == "cursor/grok_bot" || lower == "xai_grok_bot" || lower == "xai-grok-bot":
+ return "grok_bot"
case name != "":
// An unrecognized runtime keeps its own name rather than being coerced or dropped. A new
// harness should show up in the log as itself, not as "unknown".
diff --git a/pkg/asymptoteobserve/harness_test.go b/pkg/asymptoteobserve/harness_test.go
index 48d32768..a61ce155 100644
--- a/pkg/asymptoteobserve/harness_test.go
+++ b/pkg/asymptoteobserve/harness_test.go
@@ -41,7 +41,7 @@ func TestCanonicalNamesAreStableUnderRenormalization(t *testing.T) {
"claude_code", "codex_cli", "gemini_cli", "antigravity_cli", "vscode_copilot",
"copilot_cli", "claude_web", "chatgpt_web", "claude_cowork", "claude_agent_sdk",
"openclaw_gateway", "pi_cli", "omp", "cline", "qwen_code", "prime_agent", "vercel_fx",
- "muse_code",
+ "muse_code", "grok_bot",
} {
t.Run(canonical, func(t *testing.T) {
if got := NormalizeHarnessName(canonical); got != canonical {
@@ -493,3 +493,57 @@ func TestOpenHandsCanonicalNameIsStableUnderRenormalization(t *testing.T) {
t.Fatalf("NormalizeHarnessName(%q) = %q, want %q", once, got, once)
}
}
+
+// Grok Bot reaches Beacon under the spelling Cursor's server-side OpenTelemetry export writes for
+// its surface (grok_bot) and under whatever a reader types for the product's name. Pinning them
+// here is what keeps one Bot's actions from being recorded under two names.
+func TestGrokBotSpellingsConvergeOnGrokBot(t *testing.T) {
+ for _, in := range []string{
+ "grok_bot", "Grok_Bot", "GROK_BOT", " grok_bot ", "grok-bot", "Grok Bot", "grokbot",
+ "grok_bot_desktop", "grok-bot-desktop", "cursor.grok_bot", "cursor/grok_bot",
+ "xai_grok_bot", "xai-grok-bot",
+ } {
+ t.Run(in, func(t *testing.T) {
+ if got := NormalizeHarnessName(in); got != "grok_bot" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want %q", in, got, "grok_bot")
+ }
+ })
+ }
+}
+
+// Grok Build is the sibling product: xAI's terminal coding agent, hooked by Beacon under the
+// `grok` harness, running on the endpoint under the operator's account. Grok Bot runs on a
+// Cursor-hosted cloud computer. The two must never normalize into each other -- in either
+// direction -- because a query grouping by harness.name would then file cloud-computer shell
+// commands under a local CLI, or the reverse. `grok` stays on the passthrough path as itself,
+// which is the name Grok Build's hook installer already uses.
+func TestGrokBuildIsNotGrokBot(t *testing.T) {
+ for _, name := range []string{"grok", "Grok", "grok_build", "grok-build", "Grok Build", "grok_cli", "grok-cli"} {
+ t.Run(name, func(t *testing.T) {
+ if got := NormalizeHarnessName(name); got == "grok_bot" {
+ t.Errorf("NormalizeHarnessName(%q) = %q; Grok Build must not be reported as the "+
+ "Grok Bot harness", name, got)
+ }
+ })
+ }
+ if got := NormalizeHarnessName("grok"); got != "grok" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want the passthrough value the Grok Build hook "+
+ "installer already records", "grok", got)
+ }
+}
+
+// Every Grok model id begins with the same four letters as both products, which is the reason
+// the case is a closed set rather than Contains(lower, "grok"). A model string that somehow
+// reaches harness.name shows up as itself rather than being filed under the cloud agent.
+func TestGrokModelNamesAreNotTreatedAsGrokBot(t *testing.T) {
+ for _, name := range []string{
+ "grok-4", "grok-4.6", "grok-4-fast", "grok-code-fast-1", "grok_4", "Grok 4.6", "xai", "x.ai",
+ } {
+ t.Run(name, func(t *testing.T) {
+ if got := NormalizeHarnessName(name); got == "grok_bot" {
+ t.Errorf("NormalizeHarnessName(%q) = %q; a Grok model id must not be reported as "+
+ "the Grok Bot harness", name, got)
+ }
+ })
+ }
+}
diff --git a/pkg/asymptoteobserve/identity.go b/pkg/asymptoteobserve/identity.go
index 22018b7e..33074769 100644
--- a/pkg/asymptoteobserve/identity.go
+++ b/pkg/asymptoteobserve/identity.go
@@ -33,6 +33,10 @@ var ToolCallIDKeys = []string{
"call_id",
"callId",
"callID",
+ // Cursor's server-side OpenTelemetry export names a Grok Bot MCP tool call and computer-use
+ // session by this key. It is the only place Beacon learns the id, because Grok Bot runs on
+ // a Cursor-hosted computer and has no hook path that would carry a runtime-native spelling.
+ "cursor.grok_bot.tool_call.id",
}
// eventIDNamespace is the fixed UUID namespace every Beacon event ID is derived
diff --git a/pkg/asymptoteobserve/identity_test.go b/pkg/asymptoteobserve/identity_test.go
index f1757041..5f5e8fc8 100644
--- a/pkg/asymptoteobserve/identity_test.go
+++ b/pkg/asymptoteobserve/identity_test.go
@@ -112,3 +112,16 @@ func TestEventIDForLineIgnoresProvenanceMarkers(t *testing.T) {
t.Fatalf("provenance markers split one call into two IDs: %s and %s", hook, collector)
}
}
+
+// Cursor's export is the only path that carries a Grok Bot tool-call id, and it carries it under
+// a vendor-prefixed key no other runtime writes. The alias belongs in this list rather than in
+// the exporter's Grok Bot normalizer so that gen_ai.tool.call.id is promoted the same way on
+// every capture path, which is the property the list exists for.
+func TestToolCallIDKeysIncludeCursorGrokBotSpelling(t *testing.T) {
+ for _, key := range ToolCallIDKeys {
+ if key == "cursor.grok_bot.tool_call.id" {
+ return
+ }
+ }
+ t.Fatal("ToolCallIDKeys does not include cursor.grok_bot.tool_call.id")
+}