The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
refactor
Justin D'Souza543f77ab8042
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.goindex 98866d4a..340720fa 100644--- a/cli/beacon/cmd/endpoint.go+++ b/cli/beacon/cmd/endpoint.go@@ -30,42 +30,41 @@ import ()var endpointOpts struct {- userMode bool- systemMode bool- logPath string- harnesses string- hookHarnesses string- outputDir string- jsonOutput bool- grpcPort int- httpPort int- collectorPath string- includeRuntimeMetrics bool- includeCodexSpans bool- includeOpenClawRuntimeMetrics bool- keepLogs bool- keepConfig bool- noStart bool- coworkHeaders string- coworkEndpoint string- coworkResourceAttributes string- coworkNgrok bool- coworkOpen bool- coworkSince string- openClawEndpoint string- openClawSince string- elasticPackDir string- hookLevel string- contentRetention string- splunkHECEndpoint string- splunkHECToken string- splunkIndex string- splunkSource string- splunkSourcetype string- splunkInsecureSkipVerify bool- splunkCAFile string- dashboardAddr string- dashboardOpen bool+ userMode bool+ systemMode bool+ logPath string+ harnesses string+ hookHarnesses string+ outputDir string+ jsonOutput bool+ grpcPort int+ httpPort int+ collectorPath string+ includeRuntimeMetrics bool+ includeCodexSpans bool+ keepLogs bool+ keepConfig bool+ noStart bool+ coworkHeaders string+ coworkEndpoint string+ coworkResourceAttributes string+ coworkNgrok bool+ coworkOpen bool+ coworkSince string+ openClawEndpoint string+ openClawSince string+ elasticPackDir string+ hookLevel string+ contentRetention string+ splunkHECEndpoint string+ splunkHECToken string+ splunkIndex string+ splunkSource string+ splunkSourcetype string+ splunkInsecureSkipVerify bool+ splunkCAFile string+ dashboardAddr string+ dashboardOpen bool}var endpointCmd = &cobra.Command{@@ -438,9 +437,8 @@ func init() {endpointInstallCmd.Flags().IntVar(&endpointOpts.grpcPort, "otlp-grpc-port", endpointconfig.DefaultGRPCPort, "Local OTLP gRPC port")endpointInstallCmd.Flags().IntVar(&endpointOpts.httpPort, "otlp-http-port", endpointconfig.DefaultHTTPPort, "Local OTLP HTTP port")endpointInstallCmd.Flags().StringVar(&endpointOpts.collectorPath, "collector", "", "Path to a beacon-otelcol binary")- endpointInstallCmd.Flags().BoolVar(&endpointOpts.includeRuntimeMetrics, "include-runtime-metrics", false, "Include generic process/runtime OTLP metrics in the runtime JSONL log")+ endpointInstallCmd.Flags().BoolVar(&endpointOpts.includeRuntimeMetrics, "include-runtime-metrics", false, "Include generic process/runtime OTLP metrics and OpenClaw operational metrics in the runtime JSONL log")endpointInstallCmd.Flags().BoolVar(&endpointOpts.includeCodexSpans, "include-codex-spans", false, "Include high-volume Codex OTLP spans for troubleshooting")- endpointInstallCmd.Flags().BoolVar(&endpointOpts.includeOpenClawRuntimeMetrics, "include-openclaw-runtime-metrics", false, "Include high-volume OpenClaw operational OTLP metrics in the runtime JSONL log")endpointInstallCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the launchd service")endpointInstallCmd.Flags().StringVar(&endpointOpts.contentRetention, "content-retention", "full", "Content retention mode: metadata, redacted, or full")registerSplunkFlags(endpointInstallCmd)@@ -448,9 +446,8 @@ func init() {endpointRepairCmd.Flags().IntVar(&endpointOpts.grpcPort, "otlp-grpc-port", endpointconfig.DefaultGRPCPort, "Local OTLP gRPC port")endpointRepairCmd.Flags().IntVar(&endpointOpts.httpPort, "otlp-http-port", endpointconfig.DefaultHTTPPort, "Local OTLP HTTP port")endpointRepairCmd.Flags().StringVar(&endpointOpts.collectorPath, "collector", "", "Path to a beacon-otelcol binary")- endpointRepairCmd.Flags().BoolVar(&endpointOpts.includeRuntimeMetrics, "include-runtime-metrics", false, "Include generic process/runtime OTLP metrics in the runtime JSONL log")+ endpointRepairCmd.Flags().BoolVar(&endpointOpts.includeRuntimeMetrics, "include-runtime-metrics", false, "Include generic process/runtime OTLP metrics and OpenClaw operational metrics in the runtime JSONL log")endpointRepairCmd.Flags().BoolVar(&endpointOpts.includeCodexSpans, "include-codex-spans", false, "Include high-volume Codex OTLP spans for troubleshooting")- endpointRepairCmd.Flags().BoolVar(&endpointOpts.includeOpenClawRuntimeMetrics, "include-openclaw-runtime-metrics", false, "Include high-volume OpenClaw operational OTLP metrics in the runtime JSONL log")endpointRepairCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the launchd service")endpointRepairCmd.Flags().StringVar(&endpointOpts.contentRetention, "content-retention", "full", "Content retention mode: metadata, redacted, or full")registerSplunkFlags(endpointRepairCmd)@@ -982,18 +979,17 @@ func runEndpointDashboard(cmd *cobra.Command, args []string) error {func runEndpointInstall(cmd *cobra.Command, args []string) error {result, err := lifecycle.Install(lifecycle.InstallOptions{- UserMode: endpointUserMode(),- LogPath: endpointOpts.logPath,- Harnesses: splitCSV(endpointOpts.harnesses),- GRPCPort: endpointOpts.grpcPort,- HTTPPort: endpointOpts.httpPort,- CollectorPath: endpointOpts.collectorPath,- StartService: !endpointOpts.noStart,- ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),- IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,- IncludeCodexSpans: endpointOpts.includeCodexSpans,- IncludeOpenClawRuntimeMetrics: endpointOpts.includeOpenClawRuntimeMetrics,- SplunkHEC: splunkHECOptions(),+ UserMode: endpointUserMode(),+ LogPath: endpointOpts.logPath,+ Harnesses: splitCSV(endpointOpts.harnesses),+ GRPCPort: endpointOpts.grpcPort,+ HTTPPort: endpointOpts.httpPort,+ CollectorPath: endpointOpts.collectorPath,+ StartService: !endpointOpts.noStart,+ ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),+ IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,+ IncludeCodexSpans: endpointOpts.includeCodexSpans,+ SplunkHEC: splunkHECOptions(),})if err != nil {return err@@ -1115,18 +1111,17 @@ func runEndpointUninstall(cmd *cobra.Command, args []string) error {func runEndpointRepair(cmd *cobra.Command, args []string) error {result, err := lifecycle.Repair(lifecycle.InstallOptions{- UserMode: endpointUserMode(),- LogPath: endpointOpts.logPath,- Harnesses: splitCSV(endpointOpts.harnesses),- GRPCPort: endpointOpts.grpcPort,- HTTPPort: endpointOpts.httpPort,- CollectorPath: endpointOpts.collectorPath,- StartService: !endpointOpts.noStart,- ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),- IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,- IncludeCodexSpans: endpointOpts.includeCodexSpans,- IncludeOpenClawRuntimeMetrics: endpointOpts.includeOpenClawRuntimeMetrics,- SplunkHEC: splunkHECOptions(),+ UserMode: endpointUserMode(),+ LogPath: endpointOpts.logPath,+ Harnesses: splitCSV(endpointOpts.harnesses),+ GRPCPort: endpointOpts.grpcPort,+ HTTPPort: endpointOpts.httpPort,+ CollectorPath: endpointOpts.collectorPath,+ StartService: !endpointOpts.noStart,+ ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),+ IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,+ IncludeCodexSpans: endpointOpts.includeCodexSpans,+ SplunkHEC: splunkHECOptions(),})if err != nil {return errdiff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.goindex 6237d175..ebc8eded 100644--- a/cli/beacon/cmd/endpoint_test.go+++ b/cli/beacon/cmd/endpoint_test.go@@ -274,8 +274,8 @@ func TestEndpointInstallAndRepairSupportDebugTelemetryFlags(t *testing.T) {if cmd.Flags().Lookup("include-codex-spans") == nil {t.Fatalf("%s command missing --include-codex-spans flag", cmd.Use)}- if cmd.Flags().Lookup("include-openclaw-runtime-metrics") == nil {- t.Fatalf("%s command missing --include-openclaw-runtime-metrics flag", cmd.Use)+ if cmd.Flags().Lookup("include-runtime-metrics") == nil {+ t.Fatalf("%s command missing --include-runtime-metrics flag", cmd.Use)}}}diff --git a/cli/beacon/internal/endpoint/collector/collector.go b/cli/beacon/internal/endpoint/collector/collector.goindex c0ef6c9c..66818b2a 100644--- a/cli/beacon/internal/endpoint/collector/collector.go+++ b/cli/beacon/internal/endpoint/collector/collector.go@@ -123,10 +123,6 @@ func ConfigYAML(cfg endpointconfig.Config) string {if cfg.Collector.IncludeCodexSpans {codexSpansYAML = " include_codex_spans: true\n"}- openClawRuntimeMetricsYAML := ""- if cfg.Collector.IncludeOpenClawRuntimeMetrics {- openClawRuntimeMetricsYAML = " include_openclaw_runtime_metrics: true\n"- }return fmt.Sprintf(`receivers:otlp:protocols:@@ -173,7 +169,7 @@ service:receivers: [otlp]processors: [memory_limiter, batch]exporters: %s-`, cfg.Collector.GRPCPort, cfg.Collector.HTTPPort, cfg.LogPath, cfg.ContentRetention, runtimeMetricsYAML+codexSpansYAML+openClawRuntimeMetricsYAML+splunkExporter, exporters, exporters, exporters)+`, cfg.Collector.GRPCPort, cfg.Collector.HTTPPort, cfg.LogPath, cfg.ContentRetention, runtimeMetricsYAML+codexSpansYAML+splunkExporter, exporters, exporters, exporters)}func splunkHECYAML(cfg endpointconfig.Config) string {diff --git a/cli/beacon/internal/endpoint/collector/collector_test.go b/cli/beacon/internal/endpoint/collector/collector_test.goindex b72d95e2..0efbbe19 100644--- a/cli/beacon/internal/endpoint/collector/collector_test.go+++ b/cli/beacon/internal/endpoint/collector/collector_test.go@@ -55,9 +55,6 @@ func TestConfigYAMLIncludesReleaseContractFields(t *testing.T) {if strings.Contains(yaml, "include_codex_spans") {t.Fatalf("ConfigYAML should omit Codex span option unless explicitly enabled:\n%s", yaml)}- if strings.Contains(yaml, "include_openclaw_runtime_metrics") {- t.Fatalf("ConfigYAML should omit OpenClaw runtime metrics option unless explicitly enabled:\n%s", yaml)- }}func TestConfigYAMLIncludesRuntimeMetricsOptIn(t *testing.T) {@@ -80,16 +77,6 @@ func TestConfigYAMLIncludesCodexSpansOptIn(t *testing.T) {}}-func TestConfigYAMLIncludesOpenClawRuntimeMetricsOptIn(t *testing.T) {- cfg := testConfig(t)- cfg.Collector.IncludeOpenClawRuntimeMetrics = true-- yaml := ConfigYAML(cfg)- if !strings.Contains(yaml, "include_openclaw_runtime_metrics: true") {- t.Fatalf("ConfigYAML missing OpenClaw runtime metrics opt-in:\n%s", yaml)- }-}-func TestConfigYAMLIncludesSplunkHECWhenConfigured(t *testing.T) {cfg := testConfig(t)cfg.Destinations = &endpointconfig.Destinations{SplunkHEC: &endpointconfig.SplunkHEC{diff --git a/cli/beacon/internal/endpoint/config/config.go b/cli/beacon/internal/endpoint/config/config.goindex 57b1b6b1..8127e837 100644--- a/cli/beacon/internal/endpoint/config/config.go+++ b/cli/beacon/internal/endpoint/config/config.go@@ -38,14 +38,13 @@ type Config struct {}type Collector struct {- BinaryPath string `json:"binary_path,omitempty"`- ConfigPath string `json:"config_path,omitempty"`- GRPCPort int `json:"grpc_port"`- HTTPPort int `json:"http_port"`- SpoolPath string `json:"spool_path,omitempty"`- IncludeRuntimeMetrics bool `json:"include_runtime_metrics,omitempty"`- IncludeCodexSpans bool `json:"include_codex_spans,omitempty"`- IncludeOpenClawRuntimeMetrics bool `json:"include_openclaw_runtime_metrics,omitempty"`+ BinaryPath string `json:"binary_path,omitempty"`+ ConfigPath string `json:"config_path,omitempty"`+ GRPCPort int `json:"grpc_port"`+ HTTPPort int `json:"http_port"`+ SpoolPath string `json:"spool_path,omitempty"`+ IncludeRuntimeMetrics bool `json:"include_runtime_metrics,omitempty"`+ IncludeCodexSpans bool `json:"include_codex_spans,omitempty"`}type Destinations struct {diff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.goindex e7987b46..15d81575 100644--- a/cli/beacon/internal/endpoint/config/config_test.go+++ b/cli/beacon/internal/endpoint/config/config_test.go@@ -41,7 +41,6 @@ func TestSaveLoadRoundTrip(t *testing.T) {cfg.Collector.BinaryPath = filepath.Join(home, "bin", "otelcol")cfg.Collector.IncludeRuntimeMetrics = truecfg.Collector.IncludeCodexSpans = true- cfg.Collector.IncludeOpenClawRuntimeMetrics = truecfg.EventCategories = []string{"tool", "session"}cfg.ContentRetention = ContentRetentionRedacted@@ -69,9 +68,6 @@ func TestSaveLoadRoundTrip(t *testing.T) {if !loaded.Collector.IncludeCodexSpans {t.Fatal("IncludeCodexSpans = false, want true")}- if !loaded.Collector.IncludeOpenClawRuntimeMetrics {- t.Fatal("IncludeOpenClawRuntimeMetrics = false, want true")- }if len(loaded.EventCategories) != 2 || loaded.EventCategories[1] != "session" {t.Fatalf("EventCategories did not round-trip: %#v", loaded.EventCategories)}diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex 22ac0f78..5f87f859 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -19,18 +19,17 @@ import ()type InstallOptions struct {- UserMode bool- LogPath string- Harnesses []string- GRPCPort int- HTTPPort int- CollectorPath string- StartService bool- ContentRetention endpointconfig.ContentRetention- IncludeRuntimeMetrics bool- IncludeCodexSpans bool- IncludeOpenClawRuntimeMetrics bool- SplunkHEC *endpointconfig.SplunkHEC+ UserMode bool+ LogPath string+ Harnesses []string+ GRPCPort int+ HTTPPort int+ CollectorPath string+ StartService bool+ ContentRetention endpointconfig.ContentRetention+ IncludeRuntimeMetrics bool+ IncludeCodexSpans bool+ SplunkHEC *endpointconfig.SplunkHEC}type UninstallOptions struct {@@ -284,7 +283,6 @@ func buildConfig(opts InstallOptions) endpointconfig.Config {cfg.Collector.BinaryPath = opts.CollectorPathcfg.Collector.IncludeRuntimeMetrics = opts.IncludeRuntimeMetricscfg.Collector.IncludeCodexSpans = opts.IncludeCodexSpans- cfg.Collector.IncludeOpenClawRuntimeMetrics = opts.IncludeOpenClawRuntimeMetricsif opts.ContentRetention != "" {cfg.ContentRetention = opts.ContentRetention}diff --git a/collector-builder/exporter/beaconjsonexporter/config.go b/collector-builder/exporter/beaconjsonexporter/config.goindex b92e51e5..9a827c89 100644--- a/collector-builder/exporter/beaconjsonexporter/config.go+++ b/collector-builder/exporter/beaconjsonexporter/config.go@@ -9,14 +9,13 @@ const (// Config controls local JSONL export for Beacon endpoint events.type Config struct {- Path string `mapstructure:"path"`- MaxEventBytes int `mapstructure:"max_event_bytes"`- RotateBytes int64 `mapstructure:"rotate_bytes"`- RedactSecrets bool `mapstructure:"redact_secrets"`- ContentRetention string `mapstructure:"content_retention"`- IncludeRuntimeMetrics bool `mapstructure:"include_runtime_metrics"`- IncludeCodexSpans bool `mapstructure:"include_codex_spans"`- IncludeOpenClawRuntimeMetrics bool `mapstructure:"include_openclaw_runtime_metrics"`+ Path string `mapstructure:"path"`+ MaxEventBytes int `mapstructure:"max_event_bytes"`+ RotateBytes int64 `mapstructure:"rotate_bytes"`+ RedactSecrets bool `mapstructure:"redact_secrets"`+ ContentRetention string `mapstructure:"content_retention"`+ IncludeRuntimeMetrics bool `mapstructure:"include_runtime_metrics"`+ IncludeCodexSpans bool `mapstructure:"include_codex_spans"`}func createDefaultConfig() *Config {diff --git a/collector-builder/exporter/beaconjsonexporter/exporter.go b/collector-builder/exporter/beaconjsonexporter/exporter.goindex c758b8d7..d6aa08f9 100644--- a/collector-builder/exporter/beaconjsonexporter/exporter.go+++ b/collector-builder/exporter/beaconjsonexporter/exporter.go@@ -127,7 +127,7 @@ func (e *beaconExporter) consumeMetrics(ctx context.Context, metrics pmetric.MetscopeMetrics := resourceMetrics.ScopeMetrics().At(j)for k := 0; k < scopeMetrics.Metrics().Len(); k++ {metric := scopeMetrics.Metrics().At(k)- if shouldDropMetric(resourceAttrs, metric.Name(), e.cfg.IncludeRuntimeMetrics, e.cfg.IncludeOpenClawRuntimeMetrics) {+ if shouldDropMetric(resourceAttrs, metric.Name(), e.cfg.IncludeRuntimeMetrics) {continue}event := e.eventFromMetric(resourceAttrs, metric)@@ -167,11 +167,11 @@ func isNoisyCodexLog(attrs map[string]interface{}, body string) bool {return strings.HasPrefix(eventName, "codex.")}-func shouldDropMetric(resourceAttrs map[string]interface{}, name string, includeRuntimeMetrics, includeOpenClawRuntimeMetrics bool) bool {+func shouldDropMetric(resourceAttrs map[string]interface{}, name string, includeRuntimeMetrics bool) bool {if shouldDropCodexMetric(resourceAttrs, name) {return true}- if shouldDropOpenClawMetric(resourceAttrs, name, includeOpenClawRuntimeMetrics) {+ if shouldDropOpenClawMetric(resourceAttrs, name, includeRuntimeMetrics) {return true}if !includeRuntimeMetrics && shouldDropRuntimeMetric(name) {@@ -207,8 +207,8 @@ func shouldDropCodexMetric(resourceAttrs map[string]interface{}, name string) boreturn strings.HasPrefix(normalized, "codex.")}-func shouldDropOpenClawMetric(resourceAttrs map[string]interface{}, name string, includeOpenClawRuntimeMetrics bool) bool {- if includeOpenClawRuntimeMetrics {+func shouldDropOpenClawMetric(resourceAttrs map[string]interface{}, name string, includeRuntimeMetrics bool) bool {+ if includeRuntimeMetrics {return false}normalized := strings.ToLower(strings.TrimSpace(name))diff --git a/collector-builder/exporter/beaconjsonexporter/exporter_test.go b/collector-builder/exporter/beaconjsonexporter/exporter_test.goindex 8758693a..dad6394e 100644--- a/collector-builder/exporter/beaconjsonexporter/exporter_test.go+++ b/collector-builder/exporter/beaconjsonexporter/exporter_test.go@@ -351,12 +351,12 @@ func TestConsumeMetricsDropsOpenClawOperationalMetricsByDefault(t *testing.T) {func TestConsumeMetricsIncludesOpenClawOperationalMetricsWhenConfigured(t *testing.T) {path := filepath.Join(t.TempDir(), "runtime.jsonl")exp, err := newExporter(&Config{- Path: path,- MaxEventBytes: defaultMaxEventBytes,- RotateBytes: defaultRotateBytes,- RedactSecrets: true,- ContentRetention: "metadata",- IncludeOpenClawRuntimeMetrics: true,+ Path: path,+ MaxEventBytes: defaultMaxEventBytes,+ RotateBytes: defaultRotateBytes,+ RedactSecrets: true,+ ContentRetention: "metadata",+ IncludeRuntimeMetrics: true,}, exporter.Settings{})if err != nil {t.Fatalf("newExporter returned error: %v", err)