Skip to content

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

Merge branch 'main' into claude/prime-agent-beacon-support-oil4fl-1-harness

Claude53ca2076c77e
diff --cc pkg/asymptoteobserve/harness.go
index b591afd0,71534435..61a882c5
--- a/pkg/asymptoteobserve/harness.go
+++ b/pkg/asymptoteobserve/harness.go
@@@ -101,25 -123,20 +123,39 @@@ func NormalizeHarnessName(name string)
lower == "qwencode" || lower == "qwen_cli" || lower == "qwen-cli" || lower == "qwen cli" ||
lower == "qwen_coder" || lower == "qwen-coder" || lower == "qwen coder":
return "qwen_code"
+ // Prime Agent (Prime Intellect) ships the same extension API as Pi, which is why Beacon
+ // observes it the same way -- but it is a separate product, and recording its sessions as
+ // pi_cli would merge two runtimes' activity under one name in every query that groups by
+ // harness.name. The canonical spelling is prime_agent because that is the product's name and
+ // the command it installs; it follows claude_code and qwen_code, not codex_cli.
+ //
+ // Equality against a closed set, like Pi, Cline and Qwen Code above rather than the Contains
+ // rules further up. "prime" is an ordinary English word that appears in model ids, file paths
+ // and vendor names, so a substring rule would report any event whose harness attribute merely
+ // contained it as a Prime Agent session. The set is closed rather than a prefix rule for the
+ // same reason.
+ //
+ // Both the hook spelling and the runtime's own are pinned here: the hook path installs with
+ // --platform prime, while the runtime calls itself prime-agent, and without this one session
+ // would be recorded under two names.
+ case lower == "prime" || lower == "prime_agent" || lower == "prime-agent" || lower == "prime agent" ||
+ lower == "primeagent" || lower == "prime_cli" || lower == "prime-cli" || lower == "prime cli" ||
+ lower == "prime_intellect" || lower == "prime-intellect" || lower == "prime intellect":
+ return "prime_agent"
+ // fx (vercel-labs/fx) is matched by equality against a closed set for the same reason Pi is,
+ // only more so: "fx" is two characters and appears inside ordinary words a harness attribute
+ // can plausibly carry -- "sfx", "fx-runner", "effects" does not contain it but "fxagent" does
+ // -- so a Contains rule would claim sessions that are not fx's. There is no prefix rule here
+ // either: a future runtime named "fxr" is not this one.
+ //
+ // The canonical name is vercel_fx rather than fx because harness.name is what a SIEM query
+ // groups by, and a two-letter value there says nothing about which product produced the row.
+ // The vendor prefix follows what the product is called in practice ("Vercel fx") and keeps the
+ // name self-describing for a reader who has never seen it before.
+ case lower == "fx" || lower == "fx_cli" || lower == "fx-cli" || lower == "fx cli" ||
+ lower == "fx.sh" || lower == "vercel_fx" || lower == "vercel-fx" || lower == "vercel fx" ||
+ lower == "vercel fx cli" || lower == "fx_agent" || lower == "fx-agent":
+ return "vercel_fx"
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 --cc pkg/asymptoteobserve/harness_test.go
index d1cda3e2,dff7e87d..608fb8eb
--- a/pkg/asymptoteobserve/harness_test.go
+++ b/pkg/asymptoteobserve/harness_test.go
@@@ -17,9 -17,9 +17,10 @@@ func TestHookPlatformsConvergeOnCanonic
"antigravity": "antigravity_cli",
"vscode": "vscode_copilot",
"pi": "pi_cli",
+ "omp": "omp",
"cline": "cline",
"qwen": "qwen_code",
+ "prime": "prime_agent",
} {
t.Run(platform, func(t *testing.T) {
if got := NormalizeHarnessName(platform); got != want {
@@@ -38,7 -38,7 +39,7 @@@ func TestCanonicalNamesAreStableUnderRe
for _, canonical := range []string{
"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", "cline", "qwen_code", "prime_agent",
- "openclaw_gateway", "pi_cli", "omp", "cline", "qwen_code", "vercel_fx",
++ "openclaw_gateway", "pi_cli", "omp", "cline", "qwen_code", "prime_agent", "vercel_fx",
} {
t.Run(canonical, func(t *testing.T) {
if got := NormalizeHarnessName(canonical); got != canonical {
@@@ -216,50 -266,54 +267,102 @@@ func TestEmptyNameStaysEmpty(t *testing
}
}
+// Prime Agent reaches Beacon under more than one spelling for the same reason Qwen Code does: the
+// hook path installs with --platform prime, while an OTLP resource attribute carries whatever the
+// runtime calls itself, which is prime-agent.
+func TestPrimeAgentSpellingsConvergeOnPrimeAgent(t *testing.T) {
+ for _, in := range []string{
+ "prime", "Prime", "PRIME", " prime ", "prime_agent", "prime-agent", "Prime Agent",
+ "primeagent", "prime_cli", "prime-cli", "prime cli", "prime-intellect", "Prime Intellect",
+ } {
+ t.Run(in, func(t *testing.T) {
+ if got := NormalizeHarnessName(in); got != "prime_agent" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want %q", in, got, "prime_agent")
+ }
+ })
+ }
+}
+
+// Prime Agent is a Pi distribution -- it ships Pi's extension API under a rebranded config
+// directory -- which is exactly why this needs a test. The two runtimes are observed through the
+// same mechanism, so the temptation is to file them under one name; doing that would merge two
+// products' sessions in every query that groups by harness.name, and would make "which runtime is
+// running here" unanswerable from the log.
+func TestPrimeAgentIsNotAttributedToPi(t *testing.T) {
+ for _, in := range []string{"prime", "prime-agent", "prime_agent", "Prime Agent"} {
+ if got := NormalizeHarnessName(in); got == "pi_cli" {
+ t.Errorf("NormalizeHarnessName(%q) = %q; Prime Agent must not be recorded as Pi", in, got)
+ }
+ }
+ for _, in := range []string{"pi", "pi.dev", "pi-agent"} {
+ if got := NormalizeHarnessName(in); got != "pi_cli" {
+ t.Errorf("NormalizeHarnessName(%q) = %q; adding Prime Agent must not move Pi", in, got)
+ }
+ }
+}
+
+// The reason the Prime case is an equality match rather than a Contains rule. "prime" is an
+// ordinary word: it turns up in model ids, vendor names, and directory paths that have nothing to
+// do with this runtime, and a substring rule would file every one of them under prime_agent.
+func TestPrimeSubstringsAreNotTreatedAsTheHarness(t *testing.T) {
+ for _, name := range []string{
+ "prime-numbers", "amazon_prime", "primer", "optimus-prime-cli", "claude_code_primed",
+ } {
+ if got := NormalizeHarnessName(name); got == "prime_agent" {
+ t.Errorf("NormalizeHarnessName(%q) = %q; a name that merely contains \"prime\" must not be "+
+ "reported as the Prime Agent harness", name, got)
+ }
+ }
+}
++
+ // fx (vercel-labs/fx) reaches Beacon under the spellings a reader is likely to type and the ones
+ // the session collector records, and all of them must land on one canonical name. fx has no hook
+ // or OTLP surface, so the collector is currently the only writer -- but harness names also arrive
+ // from `--harness` flags and hand-written queries, and one session recorded as both "fx" and
+ // "vercel_fx" splits it for anything grouping by harness.name.
+ func TestFxSpellingsConvergeOnVercelFx(t *testing.T) {
+ for _, in := range []string{
+ "fx", "FX", " fx ", "fx_cli", "fx-cli", "fx cli", "fx.sh", "vercel_fx", "vercel-fx",
+ "Vercel FX", "vercel fx cli", "fx_agent", "fx-agent",
+ } {
+ t.Run(in, func(t *testing.T) {
+ if got := NormalizeHarnessName(in); got != "vercel_fx" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want %q", in, got, "vercel_fx")
+ }
+ })
+ }
+ }
+
+ // The reason the fx case is an equality match rather than a Contains rule. "fx" is two characters
+ // and sits inside ordinary words, so a substring rule would relabel unrelated runtimes -- and
+ // unlike a wrong name on a known runtime, this failure invents fx activity on a machine that has
+ // never run fx.
+ func TestFxDoesNotSwallowNamesContainingFx(t *testing.T) {
+ for _, name := range []string{"fxagent", "sfx", "soundfx", "fxr", "myfx-cli", "fx-runner"} {
+ if got := NormalizeHarnessName(name); got != name {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want it preserved -- a substring rule for fx "+
+ "would report this runtime's sessions as fx activity", name, got)
+ }
+ }
+ }
+
+ // fx runs on Vercel AI Gateway and can authenticate against ChatGPT and Grok subscriptions, so its
+ // events carry provider and model strings from three vendors. None of those makes the harness
+ // something other than fx, and none of the harness rules above may claim an fx session because a
+ // provider name happens to appear beside it.
+ func TestFxIsNotAttributedToItsModelProviders(t *testing.T) {
+ if got := NormalizeHarnessName("fx"); got != "vercel_fx" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want vercel_fx", "fx", got)
+ }
+ for _, provider := range []string{"gateway", "grok", "xai"} {
+ if got := NormalizeHarnessName(provider); got != provider {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want it preserved", provider, got)
+ }
+ }
+ // "codex" is the one provider spelling fx uses that an existing rule already claims for the
+ // Codex CLI. That rule stays as it is: an event whose harness is literally "codex" is the
+ // Codex CLI, and fx's own events say "fx".
+ if got := NormalizeHarnessName("codex"); got != "codex_cli" {
+ t.Errorf("NormalizeHarnessName(%q) = %q, want codex_cli", "codex", got)
+ }
+ }
diff --cc pkg/asymptoteobserve/provenance.go
index 60f0348d,f2fc1f8e..6231ded6
--- a/pkg/asymptoteobserve/provenance.go
+++ b/pkg/asymptoteobserve/provenance.go
@@@ -96,7 -99,7 +99,7 @@@ func CollectionMethodForPlatform(platfo
switch strings.ToLower(strings.TrimSpace(platform)) {
case "":
return ""
- case "opencode", "cline", "pi", "prime":
- case "opencode", "cline", "pi", "omp":
++ case "opencode", "cline", "pi", "omp", "prime":
return CollectionMethodPlugin
default:
return CollectionMethodHook
diff --cc pkg/asymptoteobserve/provenance_test.go
index 5b3a6060,9e953776..d94d2580
--- a/pkg/asymptoteobserve/provenance_test.go
+++ b/pkg/asymptoteobserve/provenance_test.go
@@@ -113,7 -113,7 +113,8 @@@ func TestCollectionMethodForPlatform(t
"opencode": CollectionMethodPlugin,
"cline": CollectionMethodPlugin,
"pi": CollectionMethodPlugin,
+ "omp": CollectionMethodPlugin,
+ "prime": CollectionMethodPlugin,
// Unset stays unset rather than defaulting to a method, so an event with no platform does
// not claim one.
"": "",