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(claude): name the opt-in for the model context it captures
Kyle Elliott0b624af8b07b
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.goindex 592bdbc7..10de6f05 100644--- a/cli/beacon/cmd/endpoint.go+++ b/cli/beacon/cmd/endpoint.go@@ -18,79 +18,80 @@ import ()var endpointOpts struct {- userMode bool- systemMode bool- logPath string- harnesses string- hookHarnesses string- outputDir string- jsonOutput bool- grpcPort int- httpPort int- healthPort int- collectorPath string- includeRuntimeMetrics bool- includeCodexSpans bool- claudeCaptureWebFetch bool- keepLogs bool- keepConfig bool- noStart bool- serviceKind string- dryRun bool- onboardingReset bool- onboardingResend bool- connect bool- noBackfill bool- noBrowser bool- fix bool- allTargets bool- coworkHeaders string- coworkEndpoint string- coworkResourceAttributes string- coworkNgrok bool- coworkOpen bool- coworkSince string- openClawEndpoint string- openClawSince string- vscodeEndpoint string- vscodeSince string- vscodeWorkspace string- vscodeCaptureContent bool- elasticPackDir string- hookLevel string- contentRetention string- splunkHECEndpoint string- splunkHECToken string- splunkIndex string- splunkSource string- splunkSourcetype string- splunkInsecureSkipVerify bool- splunkCAFile string- falconHECEndpoint string- falconHECToken string- falconIndex string- falconSource string- falconSourcetype string- falconInsecureSkipVerify bool- falconCAFile string- dashboardAddr string- dashboardOpen bool- includeEventSummaries bool- includeRawEvents bool- writeInventoryEvent bool- inventoryMCP bool- inventorySkills bool- inventoryHooks bool- inventoryContents bool- inventoryHeartbeatForce bool- inventoryScheduled bool- inventoryHeartbeatConfig string- inventoryWorkingDir string- inventoryTrigger string- inventoryTriggerHarness string-}--const claudeCaptureWebFetchUsage = "Record the pages Claude Code's WebFetch tool fetches. Turns on Claude Code's API body logs; the collector keeps only the page text and drops every other body"+ userMode bool+ systemMode bool+ logPath string+ harnesses string+ hookHarnesses string+ outputDir string+ jsonOutput bool+ grpcPort int+ httpPort int+ healthPort int+ collectorPath string+ includeRuntimeMetrics bool+ includeCodexSpans bool+ claudeCaptureModelContext bool+ keepLogs bool+ keepConfig bool+ noStart bool+ serviceKind string+ dryRun bool+ onboardingReset bool+ onboardingResend bool+ connect bool+ noBackfill bool+ noBrowser bool+ fix bool+ allTargets bool+ coworkHeaders string+ coworkEndpoint string+ coworkResourceAttributes string+ coworkNgrok bool+ coworkOpen bool+ coworkSince string+ openClawEndpoint string+ openClawSince string+ vscodeEndpoint string+ vscodeSince string+ vscodeWorkspace string+ vscodeCaptureContent bool+ elasticPackDir string+ hookLevel string+ contentRetention string+ splunkHECEndpoint string+ splunkHECToken string+ splunkIndex string+ splunkSource string+ splunkSourcetype string+ splunkInsecureSkipVerify bool+ splunkCAFile string+ falconHECEndpoint string+ falconHECToken string+ falconIndex string+ falconSource string+ falconSourcetype string+ falconInsecureSkipVerify bool+ falconCAFile string+ dashboardAddr string+ dashboardOpen bool+ includeEventSummaries bool+ includeRawEvents bool+ writeInventoryEvent bool+ inventoryMCP bool+ inventorySkills bool+ inventoryHooks bool+ inventoryContents bool+ inventoryHeartbeatForce bool+ inventoryScheduled bool+ inventoryHeartbeatConfig string+ inventoryWorkingDir string+ inventoryTrigger string+ inventoryTriggerHarness string+}++const claudeCaptureModelContextUsage = "Record context Claude Code gives the model that no other event reports, such as the pages its WebFetch tool fetches. " ++ "Turns on Claude Code's API body logs; the collector keeps only that context and drops every body"var endpointCmd = &cobra.Command{Use: "endpoint",@@ -428,7 +429,7 @@ func init() {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 and harness operational metrics (OpenClaw, Copilot CLI) 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.claudeCaptureWebFetch, "claude-capture-web-fetch", false, claudeCaptureWebFetchUsage)+ endpointInstallCmd.Flags().BoolVar(&endpointOpts.claudeCaptureModelContext, "claude-capture-model-context", false, claudeCaptureModelContextUsage)endpointInstallCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the collector service")endpointInstallCmd.Flags().BoolVar(&endpointOpts.noBrowser, "no-browser", false, "During interactive setup, print the sign-in URL instead of opening a browser")endpointInstallCmd.Flags().StringVar(&endpointOpts.serviceKind, "service", "", "Service manager to use: auto (default), launchd, systemd, or none for a supervised collector process")@@ -452,7 +453,7 @@ func init() {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 and harness operational metrics (OpenClaw, Copilot CLI) 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.claudeCaptureWebFetch, "claude-capture-web-fetch", false, claudeCaptureWebFetchUsage)+ endpointRepairCmd.Flags().BoolVar(&endpointOpts.claudeCaptureModelContext, "claude-capture-model-context", false, claudeCaptureModelContextUsage)endpointRepairCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the collector service")endpointRepairCmd.Flags().StringVar(&endpointOpts.serviceKind, "service", "", "Service manager to use: auto (default), launchd, systemd, or none for a supervised collector process")endpointRepairCmd.Flags().BoolVar(&endpointOpts.dryRun, "dry-run", false, "Print planned actions without changing endpoint files or services")diff --git a/cli/beacon/cmd/endpoint_install.go b/cli/beacon/cmd/endpoint_install.goindex cacb72e2..49402742 100644--- a/cli/beacon/cmd/endpoint_install.go+++ b/cli/beacon/cmd/endpoint_install.go@@ -116,20 +116,20 @@ var (func endpointInstallOptions(selection endpointTargetSelection, serviceKind service.Kind) lifecycle.InstallOptions {harnesses := append([]string{}, selection.OTLP...)return lifecycle.InstallOptions{- UserMode: endpointUserMode(),- LogPath: endpointOpts.logPath,- Harnesses: harnesses,- GRPCPort: endpointOpts.grpcPort,- HTTPPort: endpointOpts.httpPort,- HealthPort: endpointOpts.healthPort,- CollectorPath: endpointOpts.collectorPath,- StartService: !endpointOpts.noStart,- IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,- IncludeCodexSpans: endpointOpts.includeCodexSpans,- ClaudeCaptureWebFetch: endpointOpts.claudeCaptureWebFetch,- SplunkHEC: splunkHECOptions(),- FalconHEC: falconHECOptions(),- ServiceKind: serviceKind,+ UserMode: endpointUserMode(),+ LogPath: endpointOpts.logPath,+ Harnesses: harnesses,+ GRPCPort: endpointOpts.grpcPort,+ HTTPPort: endpointOpts.httpPort,+ HealthPort: endpointOpts.healthPort,+ CollectorPath: endpointOpts.collectorPath,+ StartService: !endpointOpts.noStart,+ IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,+ IncludeCodexSpans: endpointOpts.includeCodexSpans,+ ClaudeCaptureModelContext: endpointOpts.claudeCaptureModelContext,+ SplunkHEC: splunkHECOptions(),+ FalconHEC: falconHECOptions(),+ ServiceKind: serviceKind,}}diff --git a/cli/beacon/cmd/endpoint_install_harness_test.go b/cli/beacon/cmd/endpoint_install_harness_test.goindex 07b89918..6dd2d780 100644--- a/cli/beacon/cmd/endpoint_install_harness_test.go+++ b/cli/beacon/cmd/endpoint_install_harness_test.go@@ -97,18 +97,18 @@ func TestEndpointRepairHookOnlyHarnessConfiguresNoOTLPRuntime(t *testing.T) {assertNoOTLPHarnesses(t, "repair --harness omp", opts.Harnesses)}-// WebFetch capture has Claude Code export every API body, so it stays off unless the flag asks for+// Model-context capture has Claude Code export every API body, so it stays off unless the flag asks for// it, and repair takes it from its own flags like install, so a repair without it turns it off.func TestEndpointInstallAndRepairCaptureClaudeWebFetchOnlyWhenAsked(t *testing.T) {for _, repair := range []bool{false, true} {// The first recorded run restores every endpoint option when the test ends.- endpointOpts.claudeCaptureWebFetch = false- if opts := runRecordedEndpointCommand(t, repair, "claude"); opts.ClaudeCaptureWebFetch {- t.Fatalf("repair=%t: WebFetch capture is on without --claude-capture-web-fetch", repair)+ endpointOpts.claudeCaptureModelContext = false+ if opts := runRecordedEndpointCommand(t, repair, "claude"); opts.ClaudeCaptureModelContext {+ t.Fatalf("repair=%t: Model-context capture is on without --claude-capture-model-context", repair)}- endpointOpts.claudeCaptureWebFetch = true- if opts := runRecordedEndpointCommand(t, repair, "claude"); !opts.ClaudeCaptureWebFetch {- t.Fatalf("repair=%t: --claude-capture-web-fetch did not reach the lifecycle", repair)+ endpointOpts.claudeCaptureModelContext = true+ if opts := runRecordedEndpointCommand(t, repair, "claude"); !opts.ClaudeCaptureModelContext {+ t.Fatalf("repair=%t: --claude-capture-model-context did not reach the lifecycle", repair)}}}diff --git a/cli/beacon/cmd/endpoint_user_config.go b/cli/beacon/cmd/endpoint_user_config.goindex 72bc67f1..44257f3a 100644--- a/cli/beacon/cmd/endpoint_user_config.go+++ b/cli/beacon/cmd/endpoint_user_config.go@@ -143,7 +143,7 @@ func repairNativeRuntimeConfigForUser(info consoleUserInfo, cfg endpointconfig.Cif seen["claude"] {continue}- path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: true, CaptureWebFetch: cfg.ClaudeCaptureWebFetch})+ path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: true, CaptureModelContext: cfg.ClaudeCaptureModelContext})if err != nil {return struct{}{}, err}diff --git a/cli/beacon/internal/ci/harness_test.go b/cli/beacon/internal/ci/harness_test.goindex 3bda20c8..33a4d6b5 100644--- a/cli/beacon/internal/ci/harness_test.go+++ b/cli/beacon/internal/ci/harness_test.go@@ -39,7 +39,7 @@ func TestBuildHarnessConfigKeepsTheCallersClaudeDefaults(t *testing.T) {if _, copied := cfg.Env["SECRET_TOKEN"]; copied {t.Fatal("BuildHarnessConfig copied the caller's whole environment")}- // WebFetch capture is the caller's opt-in: ci exec neither sets nor clears it, so whatever+ // Model-context capture is the caller's opt-in: ci exec neither sets nor clears it, so whatever// the caller's environment says reaches the child.if got, set := cfg.Env["OTEL_LOG_RAW_API_BODIES"]; set {t.Fatalf("OTEL_LOG_RAW_API_BODIES = %q, want it left to the caller's environment", got)diff --git a/cli/beacon/internal/ci/session_test.go b/cli/beacon/internal/ci/session_test.goindex cf3a70c3..ff9cb2d7 100644--- a/cli/beacon/internal/ci/session_test.go+++ b/cli/beacon/internal/ci/session_test.go@@ -180,7 +180,7 @@ func TestStartDetachedWritesStateAndExports(t *testing.T) {}}-// A CI job opts in to WebFetch capture by setting OTEL_LOG_RAW_API_BODIES itself.+// A CI job opts in to model-context capture by setting OTEL_LOG_RAW_API_BODIES itself.func TestRunChildPassesTheCallersWebFetchOptIn(t *testing.T) {testenv.RequirePOSIXExecutableFixtures(t)dir := t.TempDir()diff --git a/cli/beacon/internal/endpoint/config/config.go b/cli/beacon/internal/endpoint/config/config.goindex d5e15310..27f6d62b 100644--- a/cli/beacon/internal/endpoint/config/config.go+++ b/cli/beacon/internal/endpoint/config/config.go@@ -105,13 +105,13 @@ type Config struct {Collector Collector `json:"collector"`Harnesses []string `json:"harnesses"`EventCategories []string `json:"event_categories,omitempty"`- // ClaudeCaptureWebFetch is the --claude-capture-web-fetch opt-in, recorded so the per-user+ // ClaudeCaptureModelContext is the --claude-capture-model-context opt-in, recorded so the per-user// config repair writes Claude Code's settings the way the install did.- ClaudeCaptureWebFetch bool `json:"claude_capture_web_fetch,omitempty"`- Inventory *Inventory `json:"inventory_heartbeat,omitempty"`- Destinations *Destinations `json:"destinations,omitempty"`- ManagedIngest *ManagedIngest `json:"managed_ingest,omitempty"`- AutoUpdate *AutoUpdate `json:"auto_update,omitempty"`+ ClaudeCaptureModelContext bool `json:"claude_capture_model_context,omitempty"`+ Inventory *Inventory `json:"inventory_heartbeat,omitempty"`+ Destinations *Destinations `json:"destinations,omitempty"`+ ManagedIngest *ManagedIngest `json:"managed_ingest,omitempty"`+ AutoUpdate *AutoUpdate `json:"auto_update,omitempty"`}// ManagedIngest records that this endpoint forwards to Asymptote managed ingest. It holdsdiff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.goindex 16fce3f5..63e0b413 100644--- a/cli/beacon/internal/endpoint/config/config_test.go+++ b/cli/beacon/internal/endpoint/config/config_test.go@@ -59,7 +59,7 @@ func TestSaveLoadRoundTrip(t *testing.T) {cfg.Collector.BinaryPath = filepath.Join(home, "bin", "otelcol")cfg.Collector.IncludeRuntimeMetrics = truecfg.Collector.IncludeCodexSpans = true- cfg.ClaudeCaptureWebFetch = true+ cfg.ClaudeCaptureModelContext = truecfg.EventCategories = []string{"tool", "session"}enabled := truecfg.Inventory = &Inventory{Enabled: &enabled, Runtimes: []string{"cursor"}}@@ -88,8 +88,8 @@ func TestSaveLoadRoundTrip(t *testing.T) {if !loaded.Collector.IncludeCodexSpans {t.Fatal("IncludeCodexSpans = false, want true")}- if !loaded.ClaudeCaptureWebFetch {- t.Fatal("ClaudeCaptureWebFetch = false, want true")+ if !loaded.ClaudeCaptureModelContext {+ t.Fatal("ClaudeCaptureModelContext = 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/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.goindex 606abc6a..05e52654 100644--- a/cli/beacon/internal/endpoint/harness/harness.go+++ b/cli/beacon/internal/endpoint/harness/harness.go@@ -40,9 +40,10 @@ type Harness struct {type ConfigureOptions struct {Endpoint stringUserMode bool- // CaptureWebFetch has Claude Code log its API bodies so the collector can keep the pages- // WebFetch fetches. Off removes an inline setting a previous install wrote.- CaptureWebFetch bool+ // CaptureModelContext has Claude Code log its API bodies so the collector can keep the context+ // Claude Code gives the model that no other event reports, such as the pages WebFetch fetches.+ // Off removes an inline setting a previous install wrote.+ CaptureModelContext bool}type ValidationResult struct {@@ -390,14 +391,14 @@ func ConfigureClaude(opts ConfigureOptions) (string, error) {env["OTEL_LOG_USER_PROMPTS"] = "1"// Inline API bodies carry the page WebFetch sends to its summarizer model, the// only place Claude Code reports it, and also the system prompt and the whole- // conversation. The collector's claude_api_body processor keeps only the page,+ // conversation. The collector's claude_api_body processor keeps only that context,// but Claude Code is asked for them only on opt-in. Neither branch overrides 0 or// file:<dir>; without the opt-in an inline value goes, so opting out works.rawBodies, configured := env["OTEL_LOG_RAW_API_BODIES"]switch {- case opts.CaptureWebFetch && !configured:+ case opts.CaptureModelContext && !configured:env["OTEL_LOG_RAW_API_BODIES"] = "1"- case !opts.CaptureWebFetch && claudeInlineRawBodies(rawBodies):+ case !opts.CaptureModelContext && claudeInlineRawBodies(rawBodies):delete(env, "OTEL_LOG_RAW_API_BODIES")}settings["env"] = envdiff --git a/cli/beacon/internal/endpoint/harness/harness_test.go b/cli/beacon/internal/endpoint/harness/harness_test.goindex 115d608d..ec040d05 100644--- a/cli/beacon/internal/endpoint/harness/harness_test.go+++ b/cli/beacon/internal/endpoint/harness/harness_test.go@@ -79,7 +79,7 @@ func TestConfigureClaudeWritesTelemetryEnvAndBackup(t *testing.T) {}}if got, set := env["OTEL_LOG_RAW_API_BODIES"]; set {- t.Fatalf("OTEL_LOG_RAW_API_BODIES = %q without the WebFetch capture opt-in", got)+ t.Fatalf("OTEL_LOG_RAW_API_BODIES = %q without the model-context capture opt-in", got)}backups, err := filepath.Glob(path + ".beacon.*.bak")if err != nil {@@ -124,7 +124,7 @@ func TestConfigureClaudeEnablesPromptLogging(t *testing.T) {}}-// WebFetch capture is opt-in. The opt-in sets inline API bodies only where nothing is set, and+// Model-context capture is opt-in. The opt-in sets inline API bodies only where nothing is set, and// install without it removes an inline setting, so a repair without the flag turns capture off.// Neither overrides 0 or file:<dir>.func TestConfigureClaudeRawBodiesFollowTheWebFetchOptIn(t *testing.T) {@@ -163,7 +163,7 @@ func TestConfigureClaudeRawBodiesFollowTheWebFetchOptIn(t *testing.T) {t.Fatal(err)}for range 2 {- if _, err := ConfigureClaude(ConfigureOptions{Endpoint: "http://127.0.0.1:4317", CaptureWebFetch: tc.capture}); err != nil {+ if _, err := ConfigureClaude(ConfigureOptions{Endpoint: "http://127.0.0.1:4317", CaptureModelContext: tc.capture}); err != nil {t.Fatal(err)}}diff --git a/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go b/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.goindex afaa300e..64f0ece1 100644--- a/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go+++ b/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go@@ -92,7 +92,7 @@ func TestRepairWithExplicitEmptyHarnessesLeavesClaudeAndCodexConfigAlone(t *test}}-// WebFetch capture follows the flag of the install or repair that ran last: on with it, off again+// Model-context capture follows the flag of the install or repair that ran last: on with it, off again// after a repair without it, in Claude Code's settings and in config.json alike.func TestClaudeWebFetchCaptureFollowsTheLatestInstallOrRepair(t *testing.T) {testenv.RequirePOSIXExecutableFixtures(t)@@ -135,10 +135,10 @@ func TestClaudeWebFetchCaptureFollowsTheLatestInstallOrRepair(t *testing.T) {if err != nil {t.Fatal(err)}- return cfg.ClaudeCaptureWebFetch+ return cfg.ClaudeCaptureModelContext}- opts.ClaudeCaptureWebFetch = true+ opts.ClaudeCaptureModelContext = trueif _, err := Install(opts); err != nil {t.Fatalf("Install: %v", err)}@@ -146,7 +146,7 @@ func TestClaudeWebFetchCaptureFollowsTheLatestInstallOrRepair(t *testing.T) {t.Fatalf("after install with the flag: OTEL_LOG_RAW_API_BODIES = %q, recorded = %t; want 1 and true", value, recorded())}- opts.ClaudeCaptureWebFetch = false+ opts.ClaudeCaptureModelContext = falseif _, err := Repair(opts); err != nil {t.Fatalf("Repair: %v", err)}diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex e37daea0..fda10400 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -193,14 +193,14 @@ type InstallOptions struct {HTTPPort int// HealthPort is the collector health_check port. Zero derives it from the OTLP ports// (endpointconfig.DeriveHealthCheckPort), which keeps 13133 for the default ports.- HealthPort int- CollectorPath string- StartService bool- IncludeRuntimeMetrics bool- IncludeCodexSpans bool- ClaudeCaptureWebFetch bool- SplunkHEC *endpointconfig.SplunkHEC- FalconHEC *endpointconfig.FalconHEC+ HealthPort int+ CollectorPath string+ StartService bool+ IncludeRuntimeMetrics bool+ IncludeCodexSpans bool+ ClaudeCaptureModelContext bool+ SplunkHEC *endpointconfig.SplunkHEC+ FalconHEC *endpointconfig.FalconHEC// ServiceKind selects the service manager. Empty auto-detects: launchd on macOS,// systemd when it is PID 1, otherwise a supervised child process.ServiceKind service.Kind@@ -916,7 +916,7 @@ func buildConfig(opts InstallOptions) endpointconfig.Config {cfg.Collector.BinaryPath = opts.CollectorPathcfg.Collector.IncludeRuntimeMetrics = opts.IncludeRuntimeMetricscfg.Collector.IncludeCodexSpans = opts.IncludeCodexSpans- cfg.ClaudeCaptureWebFetch = opts.ClaudeCaptureWebFetch+ cfg.ClaudeCaptureModelContext = opts.ClaudeCaptureModelContextif opts.SplunkHEC != nil {if cfg.Destinations == nil {cfg.Destinations = &endpointconfig.Destinations{}@@ -1121,7 +1121,7 @@ func configureHarnesses(cfg endpointconfig.Config) ([]string, error) {for _, name := range cfg.Harnesses {switch name {case "claude", "claude_code":- path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: cfg.UserMode, CaptureWebFetch: cfg.ClaudeCaptureWebFetch})+ path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: cfg.UserMode, CaptureModelContext: cfg.ClaudeCaptureModelContext})if err != nil {return paths, err}diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 84fde71b..d7ce3042 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -11,6 +11,24 @@ Stay up to date with the latest changes to the Agent Beacon CLI.## October 2026+- **Opt-in capture of Claude Code model context** · `beacon endpoint install+ --claude-capture-model-context` (and the same flag on `repair`) turns on Claude+ Code's API-body logs, so Beacon can record context Claude Code gives the model+ that no other event reports. The first is the page WebFetch hands its summarizer+ model, recorded as a `WebFetch` tool result, which `indirect-injection-in-tool-result`+ evaluates. Without the flag, install and repair remove an inline+ `OTEL_LOG_RAW_API_BODIES` (`1` or `true`) from `~/.claude/settings.json`; `0`+ and `file:<dir>` are left alone. A CI job opts in by setting+ `OTEL_LOG_RAW_API_BODIES=1` in its environment.+- **API bodies are filtered before every destination** · A new collector+ processor, `claude_api_body`, runs ahead of every exporter, Splunk HEC included.+ It drops every Claude Code API body except the WebFetch page text, which leaves+ redacted and capped at 2048 characters. If you had enabled raw bodies yourself,+ they no longer appear in `raw.attributes.body` or reach your SIEM.+- **`ci exec` keeps your telemetry timing** · A value you set for+ `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_BLRP_SCHEDULE_DELAY` or+ `OTEL_BSP_SCHEDULE_DELAY` now reaches Claude Code. Before, `ci exec` replaced it+ with its own default.- **Model-visible skill listings** · Claude transcript sync and the Oh My Pi extension capture only the skill index the model was shown, as a `session.context` event rather than an operator prompt. `gen_ai.system_instructions` holds one OpenTelemetry GenAI `text` part per skill, so each skill's description is limited on its own and none is cut off by the ones before it. A new `system_context` block says the event is a skill index and names each skill with the `skill_name_hash` the configuration inventory uses; it is metadata, so metadata-only forwarding keeps it while removing the text. Invoked skill bodies and unrelated system instructions remain outside this signal.- **New rule field `e.gen_ai.system_instructions_text`** · Threat rules can match the text of `gen_ai.system_instructions`, whether Beacon recorded it or an OTLP producer reported it. Like `e.gen_ai.tool.call.result_text`, it is derived by the engine from text parts only, redacted, capped at 4 KB per part, and empty when content was not retained. `e.system_context.kind` and `e.system_context.skills` select a skill index without matching its text.- **Pi-family tool results reach the rules** · Oh My Pi, Pi, Prime Agent and Senpi kept every tool result only under `raw`, which no rule can match. A file or skill the agent read, a web page fetched through Oh My Pi's `read`, and an MCP reply are now in `gen_ai.tool.call.result`, matched by `e.gen_ai.tool.call.result_text`, and `bash` output is in `command.output`. The scope is the one every runtime shares, which now also includes any result whose `tool.path` is an http or https URL. An Oh My Pi `skill://` read is recorded as a `file.read` of the `SKILL.md` it read, and media in an MCP reply is kept as its size and SHA-256.@@ -59,23 +77,6 @@ Stay up to date with the latest changes to the Agent Beacon CLI.- **RPM coverage** · The package smoke test now installs, upgrades, and removesthe `.rpm` on Rocky 9 in CI, alongside the `.deb` on Ubuntu, and checks that`apt purge` removes config and logs.-- **Opt-in capture of Claude Code WebFetch pages** · `beacon endpoint install- --claude-capture-web-fetch` (and the same flag on `repair`) turns on Claude- Code's API-body logs. Beacon then records the page WebFetch hands its summarizer- model as a `WebFetch` tool result, which `indirect-injection-in-tool-result`- evaluates. Without the flag, install and repair remove an inline- `OTEL_LOG_RAW_API_BODIES` (`1` or `true`) from `~/.claude/settings.json`; `0`- and `file:<dir>` are left alone. A CI job opts in by setting- `OTEL_LOG_RAW_API_BODIES=1` in its environment.-- **API bodies are filtered before every destination** · A new collector- processor, `claude_api_body`, runs ahead of every exporter, Splunk HEC included.- It drops every Claude Code API body except the WebFetch page text, which leaves- redacted and capped at 2048 characters. If you had enabled raw bodies yourself,- they no longer appear in `raw.attributes.body` or reach your SIEM.-- **`ci exec` keeps your telemetry timing** · A value you set for- `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_BLRP_SCHEDULE_DELAY` or- `OTEL_BSP_SCHEDULE_DELAY` now reaches Claude Code. Before, `ci exec` replaced it- with its own default.### v1.3.21 · September 23, 2026diff --git a/docs/cli/endpoint-install.mdx b/docs/cli/endpoint-install.mdxindex d6d5f48d..daa7235e 100644--- a/docs/cli/endpoint-install.mdx+++ b/docs/cli/endpoint-install.mdx@@ -37,7 +37,7 @@ The `claude` harness writes both Claude Code's OpenTelemetry settings and its us| `--dry-run` | Print planned actions without changing endpoint files or services || `--include-runtime-metrics` | Include generic process, runtime, and harness operational OTLP metrics in Beacon JSONL. By default, low-signal metrics such as process CPU, memory, Node.js event loop, V8 heap, GitHub Copilot CLI, and OpenClaw operational metrics are filtered out || `--include-codex-spans` | Include every high-volume Codex OTLP span for troubleshooting. By default, Beacon keeps semantic logs and only the usage-bearing completed turn span |-| `--claude-capture-web-fetch` | Record the pages Claude Code's WebFetch tool fetches. Turns on Claude Code's API-body logs; the collector keeps only the page text and drops every other body. Off by default; an install without the flag turns it off. See [Claude Code: fetched web pages](/runtimes/claude-code#fetched-web-pages) |+| `--claude-capture-model-context` | Record context Claude Code gives the model that no other event reports, such as the pages its WebFetch tool fetches. Turns on Claude Code's API-body logs; the collector keeps only that context and drops every body. Off by default; an install without the flag turns it off. See [Claude Code: model context from API bodies](/runtimes/claude-code#model-context-from-api-bodies) || `--splunk-hec-endpoint <url>` | Splunk HEC endpoint URL || `--splunk-hec-token <token>` | Splunk HEC token || `--splunk-index <index>` | Optional Splunk index |diff --git a/docs/cli/endpoint-repair.mdx b/docs/cli/endpoint-repair.mdxindex 1f5696b7..f73a196e 100644--- a/docs/cli/endpoint-repair.mdx+++ b/docs/cli/endpoint-repair.mdx@@ -32,7 +32,7 @@ During repair, Beacon removes the existing managed service before reinstalling i| `--dry-run` | Print planned actions without changing endpoint files or services || `--include-runtime-metrics` | Include generic process, runtime, and harness operational OTLP metrics in Beacon JSONL. By default, low-signal metrics such as process CPU, memory, Node.js event loop, V8 heap, GitHub Copilot CLI, and OpenClaw operational metrics are filtered out || `--include-codex-spans` | Include every high-volume Codex OTLP span for troubleshooting. By default, Beacon keeps semantic logs and only the usage-bearing completed turn span |-| `--claude-capture-web-fetch` | Record the pages Claude Code's WebFetch tool fetches. Pass it on every repair that should keep capture on; a repair without it turns capture off. See [Claude Code: fetched web pages](/runtimes/claude-code#fetched-web-pages) |+| `--claude-capture-model-context` | Record context Claude Code gives the model that no other event reports, such as the pages its WebFetch tool fetches. Pass it on every repair that should keep capture on; a repair without it turns capture off. See [Claude Code: model context from API bodies](/runtimes/claude-code#model-context-from-api-bodies) || `--splunk-hec-endpoint <url>` | Splunk HEC endpoint URL || `--splunk-hec-token <token>` | Splunk HEC token || `--splunk-index <index>` | Optional Splunk index |diff --git a/docs/log-forwarding/splunk.mdx b/docs/log-forwarding/splunk.mdxindex 869842bb..6ad3a95e 100644--- a/docs/log-forwarding/splunk.mdx+++ b/docs/log-forwarding/splunk.mdx@@ -94,7 +94,7 @@ exporters: [beaconjson, splunk_hec]The `beaconjson` exporter preserves the local runtime log. The `splunk_hec` exporter sends OTLP logs, traces, and metrics to Splunk HEC, with their attributes as received.-Before log records reach either exporter, the logs pipeline runs Beacon's `claude_api_body` processor (`processors: [memory_limiter, claude_api_body, batch]`). It drops Claude Code API request and response bodies, which can contain the system prompt, conversation history, and tool results. The one exception, when WebFetch capture is turned on, is the WebFetch summarizer request. It is forwarded with its body replaced by the fetched page text in `beacon.web_fetch.input`, with secrets redacted and capped at 2048 characters, the same copy the runtime log stores. See [Claude Code: fetched web pages](/runtimes/claude-code#fetched-web-pages).+Before log records reach either exporter, the logs pipeline runs Beacon's `claude_api_body` processor (`processors: [memory_limiter, claude_api_body, batch]`). It drops Claude Code API request and response bodies, which can contain the system prompt, conversation history, and tool results. The one exception, when Beacon was installed with `--claude-capture-model-context`, is the WebFetch summarizer request. It is forwarded with its body replaced by the fetched page text in `beacon.web_fetch.input`, with secrets redacted and capped at 2048 characters, the same copy the runtime log stores. See [Claude Code: fetched web pages](/runtimes/claude-code#fetched-web-pages).## Validate forwardingdiff --git a/docs/runtimes/claude-code.mdx b/docs/runtimes/claude-code.mdxindex c344fd10..dc200ebb 100644--- a/docs/runtimes/claude-code.mdx+++ b/docs/runtimes/claude-code.mdx@@ -70,20 +70,24 @@ Beacon detects Claude Code through the `claude` executable and Claude settings p`beacon endpoint hooks install --harness claude` adds Beacon-managed Claude Code hooks while preserving existing Claude settings and non-Beacon hooks. `beacon endpoint hooks uninstall --harness claude` removes only Beacon-managed Claude hook entries. Install, repair, and uninstall write every non-Beacon hook back exactly as they found it, including `http`, `prompt`, and `agent` hooks and any fields Beacon does not use itself, such as an http hook's `url` and `headers`.-### Fetched web pages+### Model context from API bodies-Claude Code's WebFetch tool does not return the page to the main model. It sends the page to a separate summarizer model call, and the main model only receives the summary. The only place Claude Code reports that page is the summarizer call's API request body, so recording it means turning on Claude Code's API-body logs. Those logs also carry the system prompt, the whole conversation, tool definitions, and tool results on every model call, so Beacon leaves them off unless you opt in:+Some of what Claude Code gives the model appears in no OTLP event except its API-body logs (`OTEL_LOG_RAW_API_BODIES`). Those logs also carry the system prompt, the whole conversation, tool definitions, and tool results on every model call, so Beacon leaves them off unless you opt in:-```bash title="Record the pages Claude Code's WebFetch fetches"-beacon endpoint install --claude-capture-web-fetch+```bash title="Record model context Claude Code reports only in its API bodies"+beacon endpoint install --claude-capture-model-context```-With the flag, install and repair set `OTEL_LOG_RAW_API_BODIES=1` in `~/.claude/settings.json`, and the choice is recorded as `claude_capture_web_fetch` in Beacon's `config.json`. Without it, they remove an inline setting (`1` or `true`), so a repair without the flag turns capture off. Neither touches `0` (off) or `file:<dir>` (bodies written to files). `beacon ci exec` does not set the variable; a CI job opts in by setting `OTEL_LOG_RAW_API_BODIES=1` in its own environment.+With the flag, install and repair set `OTEL_LOG_RAW_API_BODIES=1` in `~/.claude/settings.json`, and the choice is recorded as `claude_capture_model_context` in Beacon's `config.json`. Without it, they remove an inline setting (`1` or `true`), so a repair without the flag turns capture off. Neither touches `0` (off) or `file:<dir>` (bodies written to files). `beacon ci exec` does not set the variable; a CI job opts in by setting `OTEL_LOG_RAW_API_BODIES=1` in its own environment.-Whatever turned the bodies on, the collector filters them in its `claude_api_body` processor. The processor runs before every destination, including the local runtime log, Falcon, and Splunk HEC:+Whatever turned the bodies on, the collector filters them in its `claude_api_body` processor. The processor runs before every destination, including the local runtime log, Falcon, and Splunk HEC. It keeps only the context listed below, and drops every other request and response body. The `claude_code.api_request` event already records each model call.++#### Fetched web pages++Claude Code's WebFetch tool does not return the page to the main model. It sends the page to a separate summarizer model call, and the main model only receives the summary. The only place Claude Code reports that page is the summarizer call's API request body.- **The WebFetch summarizer request** (`query_source=web_fetch_apply`) is kept, but only the text of its user messages: the fetched page and the summarizer prompt. Beacon removes `body` and `body_ref` and forwards that text as `beacon.web_fetch.input`, with secrets redacted and capped at 2048 characters. It never includes the summarizer's system prompt, tool definitions, or non-text blocks.-- **Every other request and response body is dropped,** including the summarizer's response. The `claude_code.api_request` event already records each model call.+- **The summarizer's response is dropped** with every other body.In the runtime log, the page is a `tool.invoked` event for the `WebFetch` tool, with the text in `gen_ai.tool.call.result`. It is not recorded as `prompt.text`, because it is third-party content, not something the user typed. Threat rules see it as `e.gen_ai.tool.call.result_text`, the same as fetched pages from other runtimes, and `indirect-injection-in-tool-result` evaluates it.