Skip to content

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

feat(claude): make WebFetch page capture opt-in; redact and cap the page before export

Kyle Elliott4ab932b8d4d1
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.go
index d2bb7616..592bdbc7 100644
--- a/cli/beacon/cmd/endpoint.go
+++ b/cli/beacon/cmd/endpoint.go
@@ -31,6 +31,7 @@ var endpointOpts struct {
collectorPath string
includeRuntimeMetrics bool
includeCodexSpans bool
+ claudeCaptureWebFetch bool
keepLogs bool
keepConfig bool
noStart bool
@@ -89,6 +90,8 @@ var endpointOpts struct {
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"
+
var endpointCmd = &cobra.Command{
Use: "endpoint",
Short: "Manage the local Beacon endpoint agent",
@@ -425,6 +428,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.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")
@@ -448,6 +452,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.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.go
index b0487fa4..cacb72e2 100644
--- a/cli/beacon/cmd/endpoint_install.go
+++ b/cli/beacon/cmd/endpoint_install.go
@@ -126,6 +126,7 @@ func endpointInstallOptions(selection endpointTargetSelection, serviceKind servi
StartService: !endpointOpts.noStart,
IncludeRuntimeMetrics: endpointOpts.includeRuntimeMetrics,
IncludeCodexSpans: endpointOpts.includeCodexSpans,
+ ClaudeCaptureWebFetch: endpointOpts.claudeCaptureWebFetch,
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.go
index 99c031cb..07b89918 100644
--- a/cli/beacon/cmd/endpoint_install_harness_test.go
+++ b/cli/beacon/cmd/endpoint_install_harness_test.go
@@ -97,6 +97,22 @@ 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
+// 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.claudeCaptureWebFetch = true
+ if opts := runRecordedEndpointCommand(t, repair, "claude"); !opts.ClaudeCaptureWebFetch {
+ t.Fatalf("repair=%t: --claude-capture-web-fetch did not reach the lifecycle", repair)
+ }
+ }
+}
+
// `--harness ""` is the documented collector-only install (splitHarnessCSV keeps it an empty
// list on purpose), so it must configure no runtime at all.
func TestEndpointInstallCollectorOnlyHarnessConfiguresNoOTLPRuntime(t *testing.T) {
diff --git a/cli/beacon/cmd/endpoint_user_config.go b/cli/beacon/cmd/endpoint_user_config.go
index 6e9d8266..72bc67f1 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.C
if seen["claude"] {
continue
}
- path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: true})
+ path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: true, CaptureWebFetch: cfg.ClaudeCaptureWebFetch})
if err != nil {
return struct{}{}, err
}
diff --git a/cli/beacon/internal/ci/harness.go b/cli/beacon/internal/ci/harness.go
index a99c90f2..95dee781 100644
--- a/cli/beacon/internal/ci/harness.go
+++ b/cli/beacon/internal/ci/harness.go
@@ -69,10 +69,6 @@ var claudeEnvDefaults = map[string]string{
// inherited from three different SDK defaults.
"OTEL_BLRP_SCHEDULE_DELAY": "1000",
"OTEL_BSP_SCHEDULE_DELAY": "1000",
- // The same WebFetch page capture an endpoint install enables. ci exec writes the same collector
- // config, so its claude_api_body processor drops every other body. 0 or file:<dir> is the
- // caller's.
- "OTEL_LOG_RAW_API_BODIES": "1",
}
func BuildHarnessConfig(base []string, harnessList, grpcEndpoint, baseDir string, run *schema.RunInfo) (HarnessConfig, error) {
diff --git a/cli/beacon/internal/ci/harness_test.go b/cli/beacon/internal/ci/harness_test.go
index 8cbc5aa7..3bda20c8 100644
--- a/cli/beacon/internal/ci/harness_test.go
+++ b/cli/beacon/internal/ci/harness_test.go
@@ -15,7 +15,6 @@ func TestClaudeEnvIncludesDetailedToolAndPromptLogging(t *testing.T) {
"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta",
"OTEL_LOG_TOOL_DETAILS=1",
"OTEL_LOG_USER_PROMPTS=1",
- "OTEL_LOG_RAW_API_BODIES=1",
} {
if !strings.Contains(env, want) {
t.Fatalf("ClaudeEnv missing %q in:\n%s", want, env)
@@ -26,31 +25,24 @@ func TestClaudeEnvIncludesDetailedToolAndPromptLogging(t *testing.T) {
// ci exec builds the child's env through BuildHarnessConfig and lays it over the caller's own, so a
// value the caller set survives only if BuildHarnessConfig hands it to ClaudeEnv.
func TestBuildHarnessConfigKeepsTheCallersClaudeDefaults(t *testing.T) {
- for _, policy := range []string{"0", "file:/tmp/claude-bodies"} {
- base := []string{"OTEL_LOG_RAW_API_BODIES=" + policy, "OTEL_METRIC_EXPORT_INTERVAL=30000", "SECRET_TOKEN=not-copied"}
- cfg, err := BuildHarnessConfig(base, "claude", "http://127.0.0.1:4317", t.TempDir(), nil)
- if err != nil {
- t.Fatal(err)
- }
- if got := cfg.Env["OTEL_LOG_RAW_API_BODIES"]; got != policy {
- t.Fatalf("OTEL_LOG_RAW_API_BODIES = %q, want the caller's %q", got, policy)
- }
- if got := cfg.Env["OTEL_METRIC_EXPORT_INTERVAL"]; got != "30000" {
- t.Fatalf("OTEL_METRIC_EXPORT_INTERVAL = %q, want the caller's 30000", got)
- }
- if got := cfg.Env["OTEL_BSP_SCHEDULE_DELAY"]; got != "1000" {
- t.Fatalf("OTEL_BSP_SCHEDULE_DELAY = %q, want the default for a key the caller left unset", got)
- }
- if _, copied := cfg.Env["SECRET_TOKEN"]; copied {
- t.Fatal("BuildHarnessConfig copied the caller's whole environment")
- }
- }
- cfg, err := BuildHarnessConfig(nil, "claude", "http://127.0.0.1:4317", t.TempDir(), nil)
+ base := []string{"OTEL_METRIC_EXPORT_INTERVAL=30000", "OTEL_LOG_RAW_API_BODIES=1", "SECRET_TOKEN=not-copied"}
+ cfg, err := BuildHarnessConfig(base, "claude", "http://127.0.0.1:4317", t.TempDir(), nil)
if err != nil {
t.Fatal(err)
}
- if got := cfg.Env["OTEL_LOG_RAW_API_BODIES"]; got != "1" {
- t.Fatalf("OTEL_LOG_RAW_API_BODIES = %q, want 1 by default", got)
+ if got := cfg.Env["OTEL_METRIC_EXPORT_INTERVAL"]; got != "30000" {
+ t.Fatalf("OTEL_METRIC_EXPORT_INTERVAL = %q, want the caller's 30000", got)
+ }
+ if got := cfg.Env["OTEL_BSP_SCHEDULE_DELAY"]; got != "1000" {
+ t.Fatalf("OTEL_BSP_SCHEDULE_DELAY = %q, want the default for a key the caller left unset", got)
+ }
+ 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
+ // 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.go
index 8a9eca7f..cf3a70c3 100644
--- a/cli/beacon/internal/ci/session_test.go
+++ b/cli/beacon/internal/ci/session_test.go
@@ -180,6 +180,32 @@ func TestStartDetachedWritesStateAndExports(t *testing.T) {
}
}
+// A CI job opts in to WebFetch capture by setting OTEL_LOG_RAW_API_BODIES itself.
+func TestRunChildPassesTheCallersWebFetchOptIn(t *testing.T) {
+ testenv.RequirePOSIXExecutableFixtures(t)
+ dir := t.TempDir()
+ output := filepath.Join(dir, "env.txt")
+ child := fakeExecutable(t, "child", "#!/bin/sh\nenv > \"$1\"\n")
+ t.Setenv("OTEL_LOG_RAW_API_BODIES", "1")
+ session := &Session{
+ BaseDir: dir,
+ ConfigPath: filepath.Join(dir, "otelcol.yaml"),
+ LogPath: filepath.Join(dir, "runtime.jsonl"),
+ GRPCEndpoint: "http://127.0.0.1:4317",
+ cfg: endpointconfig.Default(true, filepath.Join(dir, "runtime.jsonl")),
+ }
+ if _, err := session.RunChild(context.Background(), []string{child, output}, nil, nil); err != nil {
+ t.Fatal(err)
+ }
+ data, err := os.ReadFile(output)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !strings.Contains(string(data), "\nOTEL_LOG_RAW_API_BODIES=1\n") && !strings.HasPrefix(string(data), "OTEL_LOG_RAW_API_BODIES=1\n") {
+ t.Fatalf("child env lost the caller's OTEL_LOG_RAW_API_BODIES=1:\n%s", data)
+ }
+}
+
func TestRunChildInjectsClaudeEnvAndBeaconPaths(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.go
index d2317888..d5e15310 100644
--- a/cli/beacon/internal/endpoint/config/config.go
+++ b/cli/beacon/internal/endpoint/config/config.go
@@ -100,15 +100,18 @@ const (
)
type Config struct {
- UserMode bool `json:"user_mode"`
- LogPath string `json:"log_path"`
- Collector Collector `json:"collector"`
- Harnesses []string `json:"harnesses"`
- EventCategories []string `json:"event_categories,omitempty"`
- Inventory *Inventory `json:"inventory_heartbeat,omitempty"`
- Destinations *Destinations `json:"destinations,omitempty"`
- ManagedIngest *ManagedIngest `json:"managed_ingest,omitempty"`
- AutoUpdate *AutoUpdate `json:"auto_update,omitempty"`
+ UserMode bool `json:"user_mode"`
+ LogPath string `json:"log_path"`
+ 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
+ // 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"`
}
// ManagedIngest records that this endpoint forwards to Asymptote managed ingest. It holds
diff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.go
index 2897f4d8..16fce3f5 100644
--- a/cli/beacon/internal/endpoint/config/config_test.go
+++ b/cli/beacon/internal/endpoint/config/config_test.go
@@ -59,6 +59,7 @@ func TestSaveLoadRoundTrip(t *testing.T) {
cfg.Collector.BinaryPath = filepath.Join(home, "bin", "otelcol")
cfg.Collector.IncludeRuntimeMetrics = true
cfg.Collector.IncludeCodexSpans = true
+ cfg.ClaudeCaptureWebFetch = true
cfg.EventCategories = []string{"tool", "session"}
enabled := true
cfg.Inventory = &Inventory{Enabled: &enabled, Runtimes: []string{"cursor"}}
@@ -87,6 +88,9 @@ 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 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.go
index 335e7f39..606abc6a 100644
--- a/cli/beacon/internal/endpoint/harness/harness.go
+++ b/cli/beacon/internal/endpoint/harness/harness.go
@@ -40,6 +40,9 @@ type Harness struct {
type ConfigureOptions struct {
Endpoint string
UserMode 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
}
type ValidationResult struct {
@@ -386,11 +389,16 @@ func ConfigureClaude(opts ConfigureOptions) (string, error) {
env["OTEL_LOG_TOOL_DETAILS"] = "1"
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. The collector's claude_api_body processor
- // keeps that text and drops every other body before any exporter sees it.
- // Preserve an explicit user opt-out or capture mode.
- if _, configured := env["OTEL_LOG_RAW_API_BODIES"]; !configured {
+ // 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,
+ // 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:
env["OTEL_LOG_RAW_API_BODIES"] = "1"
+ case !opts.CaptureWebFetch && claudeInlineRawBodies(rawBodies):
+ delete(env, "OTEL_LOG_RAW_API_BODIES")
}
settings["env"] = env
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
@@ -793,6 +801,16 @@ func commandVersion(path string) string {
return strings.TrimSpace(string(out))
}
+// claudeInlineRawBodies reports whether an OTEL_LOG_RAW_API_BODIES value has Claude Code put
+// API bodies inline in its log events, rather than leave them off or write them to files.
+func claudeInlineRawBodies(value interface{}) bool {
+ switch strings.ToLower(strings.TrimSpace(fmt.Sprint(value))) {
+ case "1", "true":
+ return true
+ }
+ return false
+}
+
func backup(path string, data []byte) error {
if len(data) == 0 {
return nil
diff --git a/cli/beacon/internal/endpoint/harness/harness_test.go b/cli/beacon/internal/endpoint/harness/harness_test.go
index 2f46f3e2..115d608d 100644
--- a/cli/beacon/internal/endpoint/harness/harness_test.go
+++ b/cli/beacon/internal/endpoint/harness/harness_test.go
@@ -2,6 +2,7 @@ package harness
import (
"encoding/json"
+ "fmt"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"
"os"
"path/filepath"
@@ -72,12 +73,14 @@ func TestConfigureClaudeWritesTelemetryEnvAndBackup(t *testing.T) {
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://127.0.0.1:4317",
"OTEL_LOG_TOOL_DETAILS": "1",
"OTEL_LOG_USER_PROMPTS": "1",
- "OTEL_LOG_RAW_API_BODIES": "1",
} {
if got := env[key]; got != want {
t.Fatalf("env[%s] = %q, want %q; env=%#v", key, got, want, env)
}
}
+ 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)
+ }
backups, err := filepath.Glob(path + ".beacon.*.bak")
if err != nil {
t.Fatalf("glob backups: %v", err)
@@ -121,18 +124,38 @@ func TestConfigureClaudeEnablesPromptLogging(t *testing.T) {
}
}
-func TestConfigureClaudePreservesExplicitRawBodyCapturePolicy(t *testing.T) {
- for _, policy := range []string{"0", "file:/private/claude-bodies"} {
- t.Run(policy, func(t *testing.T) {
+// WebFetch 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) {
+ const unset = "<unset>"
+ tests := []struct {
+ capture bool
+ before, want string
+ }{
+ {capture: true, before: unset, want: "1"},
+ {capture: true, before: "1", want: "1"},
+ {capture: true, before: "0", want: "0"},
+ {capture: true, before: "file:/private/claude-bodies", want: "file:/private/claude-bodies"},
+ {capture: false, before: unset, want: unset},
+ {capture: false, before: "1", want: unset},
+ {capture: false, before: "true", want: unset},
+ {capture: false, before: "0", want: "0"},
+ {capture: false, before: "file:/private/claude-bodies", want: "file:/private/claude-bodies"},
+ }
+ for _, tc := range tests {
+ t.Run(fmt.Sprintf("capture=%t/%s", tc.capture, tc.before), func(t *testing.T) {
home := t.TempDir()
testenv.SetHome(t, home)
path := filepath.Join(home, ".claude", "settings.json")
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
t.Fatal(err)
}
- before, err := json.Marshal(map[string]interface{}{
- "env": map[string]string{"OTEL_LOG_RAW_API_BODIES": policy},
- })
+ env := map[string]string{}
+ if tc.before != unset {
+ env["OTEL_LOG_RAW_API_BODIES"] = tc.before
+ }
+ before, err := json.Marshal(map[string]interface{}{"env": env})
if err != nil {
t.Fatal(err)
}
@@ -140,7 +163,7 @@ func TestConfigureClaudePreservesExplicitRawBodyCapturePolicy(t *testing.T) {
t.Fatal(err)
}
for range 2 {
- if _, err := ConfigureClaude(ConfigureOptions{Endpoint: "http://127.0.0.1:4317"}); err != nil {
+ if _, err := ConfigureClaude(ConfigureOptions{Endpoint: "http://127.0.0.1:4317", CaptureWebFetch: tc.capture}); err != nil {
t.Fatal(err)
}
}
@@ -152,8 +175,12 @@ func TestConfigureClaudePreservesExplicitRawBodyCapturePolicy(t *testing.T) {
if err := json.Unmarshal(data, &settings); err != nil {
t.Fatal(err)
}
- if got := settings["env"]["OTEL_LOG_RAW_API_BODIES"]; got != policy {
- t.Fatalf("install or reinstall changed explicit capture policy: got %q, want %q", got, policy)
+ got, set := settings["env"]["OTEL_LOG_RAW_API_BODIES"]
+ if !set {
+ got = unset
+ }
+ if got != tc.want {
+ t.Fatalf("OTEL_LOG_RAW_API_BODIES after install and reinstall = %q, want %q", got, tc.want)
}
})
}
diff --git a/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go b/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go
index e200a3d6..afaa300e 100644
--- a/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/harness_selection_test.go
@@ -1,6 +1,7 @@
package lifecycle
import (
+ "encoding/json"
"os"
"path/filepath"
"testing"
@@ -90,3 +91,66 @@ func TestRepairWithExplicitEmptyHarnessesLeavesClaudeAndCodexConfigAlone(t *test
t.Fatalf("config.json harnesses = %#v, want the explicit empty selection, not the prior default", cfg.Harnesses)
}
}
+
+// WebFetch 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)
+ home := t.TempDir()
+ testenv.SetHome(t, home)
+ installFakeInventoryJob(t, false)
+ collectorPath := filepath.Join(home, "bin", "beacon-otelcol")
+ if err := os.MkdirAll(filepath.Dir(collectorPath), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(collectorPath, []byte("#!/bin/sh\n"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ opts := InstallOptions{
+ UserMode: true,
+ LogPath: filepath.Join(home, ".beacon", "endpoint", "logs", "runtime.jsonl"),
+ Harnesses: []string{"claude"},
+ GRPCPort: freePort(t),
+ HTTPPort: freePort(t),
+ HealthPort: freePort(t),
+ CollectorPath: collectorPath,
+ ServiceKind: service.KindSupervised,
+ }
+ rawBodies := func() (string, bool) {
+ data, err := os.ReadFile(filepath.Join(home, ".claude", "settings.json"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var settings struct {
+ Env map[string]string `json:"env"`
+ }
+ if err := json.Unmarshal(data, &settings); err != nil {
+ t.Fatal(err)
+ }
+ value, set := settings.Env["OTEL_LOG_RAW_API_BODIES"]
+ return value, set
+ }
+ recorded := func() bool {
+ cfg, err := endpointconfig.Load(true)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return cfg.ClaudeCaptureWebFetch
+ }
+
+ opts.ClaudeCaptureWebFetch = true
+ if _, err := Install(opts); err != nil {
+ t.Fatalf("Install: %v", err)
+ }
+ if value, _ := rawBodies(); value != "1" || !recorded() {
+ t.Fatalf("after install with the flag: OTEL_LOG_RAW_API_BODIES = %q, recorded = %t; want 1 and true", value, recorded())
+ }
+
+ opts.ClaudeCaptureWebFetch = false
+ if _, err := Repair(opts); err != nil {
+ t.Fatalf("Repair: %v", err)
+ }
+ if value, set := rawBodies(); set || recorded() {
+ t.Fatalf("after repair without the flag: OTEL_LOG_RAW_API_BODIES = %q (set %t), recorded = %t; want capture off", value, set, recorded())
+ }
+}
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index 2c844b79..e37daea0 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -198,6 +198,7 @@ type InstallOptions struct {
StartService bool
IncludeRuntimeMetrics bool
IncludeCodexSpans bool
+ ClaudeCaptureWebFetch bool
SplunkHEC *endpointconfig.SplunkHEC
FalconHEC *endpointconfig.FalconHEC
// ServiceKind selects the service manager. Empty auto-detects: launchd on macOS,
@@ -915,6 +916,7 @@ func buildConfig(opts InstallOptions) endpointconfig.Config {
cfg.Collector.BinaryPath = opts.CollectorPath
cfg.Collector.IncludeRuntimeMetrics = opts.IncludeRuntimeMetrics
cfg.Collector.IncludeCodexSpans = opts.IncludeCodexSpans
+ cfg.ClaudeCaptureWebFetch = opts.ClaudeCaptureWebFetch
if opts.SplunkHEC != nil {
if cfg.Destinations == nil {
cfg.Destinations = &endpointconfig.Destinations{}
@@ -1119,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})
+ path, err := harness.ConfigureClaude(harness.ConfigureOptions{Endpoint: grpcEndpoint, UserMode: cfg.UserMode, CaptureWebFetch: cfg.ClaudeCaptureWebFetch})
if err != nil {
return paths, err
}
diff --git a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body.go b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body.go
index 6deb7e40..a95721b3 100644
--- a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body.go
+++ b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body.go
@@ -17,10 +17,12 @@ const (
// ClaudeWebFetchInputAttr holds the user-role text of Claude Code's WebFetch summarizer
// request -- the fetched page and the summarizer prompt -- once the request body itself is
- // gone. ClaudeWebFetchInputTruncatedAttr says Claude Code cut the body short and the text is
- // the part that survived.
+ // gone, with secrets redacted and capped at DefaultRawStringLimit. The Truncated attribute
+ // says the text is a prefix, because Claude Code cut the body or the cap did; the Redacted
+ // one says secrets were replaced.
ClaudeWebFetchInputAttr = "beacon.web_fetch.input"
ClaudeWebFetchInputTruncatedAttr = "beacon.web_fetch.input_truncated"
+ ClaudeWebFetchInputRedactedAttr = "beacon.web_fetch.input_redacted"
// Claude Code 2.1.291 sends the fetched page to a separate summarizer model call and tags that
// call's body events with this query_source; the main model only ever gets the summary.
@@ -49,6 +51,15 @@ func isClaudeWebFetchSummarizerRequest(eventName, querySource string) bool {
type claudeWebFetchInput struct {
text string
truncated bool
+ redacted bool
+}
+
+// retainedClaudeWebFetchInput is the page text as Beacon keeps it at every destination, Splunk
+// included: secrets redacted, then capped at the limit gen_ai is stored at.
+func retainedClaudeWebFetchInput(text string, partial bool) claudeWebFetchInput {
+ redacted := asymptoteobserve.RedactString(text)
+ kept := asymptoteobserve.TruncateString(redacted, asymptoteobserve.DefaultRawStringLimit)
+ return claudeWebFetchInput{text: kept, truncated: partial || kept != redacted, redacted: redacted != text}
}
// takeClaudeAPIBody removes the body, body_ref and summarizer input of a Claude Code API body
@@ -63,7 +74,8 @@ func takeClaudeAPIBody(attrs map[string]interface{}, eventName string) (input cl
body, _ := attrs["body"].(string)
input.text, _ = attrs[ClaudeWebFetchInputAttr].(string)
input.truncated, _ = BoolAttr(attrs, ClaudeWebFetchInputTruncatedAttr)
- for _, key := range []string{"body", "body_ref", ClaudeWebFetchInputAttr, ClaudeWebFetchInputTruncatedAttr} {
+ input.redacted, _ = BoolAttr(attrs, ClaudeWebFetchInputRedactedAttr)
+ for _, key := range claudeAPIBodyAttrs {
delete(attrs, key)
}
if !isClaudeWebFetchSummarizerRequest(eventName, FirstString(attrs, "query_source")) {
@@ -77,9 +89,12 @@ func takeClaudeAPIBody(attrs map[string]interface{}, eventName string) (input cl
if !ok {
return claudeWebFetchInput{}, true
}
- return claudeWebFetchInput{text: text, truncated: partial}, true
+ return retainedClaudeWebFetchInput(text, partial), true
}
+// claudeAPIBodyAttrs are the attributes that carry body content, removed from every body event.
+var claudeAPIBodyAttrs = []string{"body", "body_ref", ClaudeWebFetchInputAttr, ClaudeWebFetchInputTruncatedAttr, ClaudeWebFetchInputRedactedAttr}
+
// SanitizeClaudeAPIBodyRecord applies the API body policy to a log record in place, and reports
// whether the record is dropped. A kept summarizer request leaves with its text in
// ClaudeWebFetchInputAttr in place of body and body_ref. The claude_api_body processor calls it so
@@ -99,13 +114,16 @@ func SanitizeClaudeAPIBodyRecord(record plog.LogRecord) (drop bool) {
if input.text == "" {
return true
}
- for _, key := range []string{"body", "body_ref", ClaudeWebFetchInputTruncatedAttr} {
+ for _, key := range claudeAPIBodyAttrs {
attrs.Remove(key)
}
attrs.PutStr(ClaudeWebFetchInputAttr, input.text)
if input.truncated {
attrs.PutBool(ClaudeWebFetchInputTruncatedAttr, true)
}
+ if input.redacted {
+ attrs.PutBool(ClaudeWebFetchInputRedactedAttr, true)
+ }
return false
}
@@ -134,11 +152,11 @@ func normalizeClaudeWebFetchInput(event *Event, input claudeWebFetchInput) {
event.GenAI.Tool.Call = &GenAIToolCallInfo{}
}
event.GenAI.Tool.Call.Result = input.text
- // gen_ai is stored at the raw-attribute limit, so that is the limit the marker describes.
+ // The text is already redacted and capped, so the marker describes the stored copy and the
+ // flags carry what was done to it.
event.Content = asymptoteobserve.RetainedContent(input.text, asymptoteobserve.DefaultRawStringLimit)
- if input.truncated {
- event.Content.Truncated = true
- }
+ event.Content.Truncated = event.Content.Truncated || input.truncated
+ event.Content.Redacted = event.Content.Redacted || input.redacted
}
// claudeUserText returns the text parts of the user messages in an Anthropic Messages request
diff --git a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body_test.go b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body_test.go
index df89d443..46cae569 100644
--- a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body_test.go
+++ b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/claude_api_body_test.go
@@ -215,10 +215,18 @@ func TestClaudeUserTextReadsEveryUserTextPartInAnyKeyOrder(t *testing.T) {
}
}
-func TestSanitizeClaudeAPIBodyRecordMatchesTheConverter(t *testing.T) {
- direct := NewConverter(Options{}).EventFromLog(nil, claudeBodyRecord("api_request_body", claudeWebFetchApplyQuerySource, summarizerBody))
+// splunk_hec forwards what the processor leaves, so the page leaves it redacted and capped the way
+// the runtime log stores it, and converting with or without the processor records the same thing.
+func TestClaudeWebFetchInputIsRedactedAndCappedOnEveryPath(t *testing.T) {
+ secret := "sk-" + strings.Repeat("a", 32)
+ page := "Web page content:\n---\nPAGE-CANARY api_key=" + secret + "\n" + strings.Repeat("x", 3*asymptoteobserve.DefaultRawStringLimit)
+ body, err := json.Marshal(map[string]interface{}{"messages": []interface{}{map[string]interface{}{"role": "user", "content": page}}})
+ if err != nil {
+ t.Fatal(err)
+ }
+ direct := NewConverter(Options{}).EventFromLog(nil, claudeBodyRecord("api_request_body", claudeWebFetchApplyQuerySource, string(body)))
- record := claudeBodyRecord("api_request_body", claudeWebFetchApplyQuerySource, summarizerBody)
+ record := claudeBodyRecord("api_request_body", claudeWebFetchApplyQuerySource, string(body))
if SanitizeClaudeAPIBodyRecord(record) {
t.Fatal("the processor dropped the summarizer request")
}
@@ -227,15 +235,31 @@ func TestSanitizeClaudeAPIBodyRecordMatchesTheConverter(t *testing.T) {
t.Fatalf("the processor forwarded %q", key)
}
}
- if value, ok := record.Attributes().Get(ClaudeWebFetchInputAttr); !ok || !strings.Contains(value.Str(), "PAGE-CANARY") {
- t.Fatalf("the processor did not forward the summarizer input")
+ value, _ := record.Attributes().Get(ClaudeWebFetchInputAttr)
+ forwarded := value.Str()
+ if !strings.Contains(forwarded, "PAGE-CANARY") || strings.Contains(forwarded, secret) || len(forwarded) > asymptoteobserve.DefaultRawStringLimit {
+ t.Fatalf("forwarded input (%d bytes) = %.120q, want the page prefix, redacted and capped at %d", len(forwarded), forwarded, asymptoteobserve.DefaultRawStringLimit)
+ }
+ for _, key := range []string{ClaudeWebFetchInputTruncatedAttr, ClaudeWebFetchInputRedactedAttr} {
+ if flag, ok := record.Attributes().Get(key); !ok || !flag.Bool() {
+ t.Fatalf("the processor did not forward %s", key)
+ }
}
processed := NewConverter(Options{}).EventFromLog(nil, record)
- if processed.GenAI.Tool.Call.Result != direct.GenAI.Tool.Call.Result || *processed.Content != *direct.Content {
- t.Fatalf("processed then converted = %#v %+v, converted directly = %#v %+v",
- processed.GenAI.Tool.Call.Result, processed.Content, direct.GenAI.Tool.Call.Result, direct.Content)
+ for path, event := range map[string]Event{"direct": direct, "processed": processed} {
+ if result, _ := event.GenAI.Tool.Call.Result.(string); result != forwarded {
+ t.Fatalf("%s: stored result differs from what the processor forwards", path)
+ }
+ if event.Content == nil || !event.Content.Truncated || !event.Content.Redacted {
+ t.Fatalf("%s: content marker = %+v, want truncated and redacted", path, event.Content)
+ }
}
+ if *processed.Content != *direct.Content {
+ t.Fatalf("processed marker %+v, direct marker %+v", processed.Content, direct.Content)
+ }
+}
+func TestSanitizeClaudeAPIBodyRecordDropsOtherBodiesAndLeavesOtherRecords(t *testing.T) {
if !SanitizeClaudeAPIBodyRecord(claudeBodyRecord("api_response_body", "sdk", `{}`)) {
t.Fatal("the processor kept a main-loop body")
}
diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdx
index 901b5583..84fde71b 100644
--- a/docs/changelog/cli.mdx
+++ b/docs/changelog/cli.mdx
@@ -59,15 +59,23 @@ Stay up to date with the latest changes to the Agent Beacon CLI.
- **RPM coverage** · The package smoke test now installs, upgrades, and removes
the `.rpm` on Rocky 9 in CI, alongside the `.deb` on Ubuntu, and checks that
`apt purge` removes config and logs.
-- **Claude Code WebFetch pages reach threat rules** · Install and `ci exec` now
- enable Claude Code's inline API-body logs, unless you already set
- `OTEL_LOG_RAW_API_BODIES`. Beacon records the page WebFetch hands its
- summarizer model as a `WebFetch` tool result, which
- `indirect-injection-in-tool-result` evaluates. A new collector processor,
- `claude_api_body`, runs before every destination, Splunk HEC included. It keeps
- only that page text and drops every other API body. If you had already enabled
- raw bodies yourself, they no longer appear in `raw.attributes.body` or reach
- your SIEM.
+- **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, 2026
diff --git a/docs/cli/endpoint-install.mdx b/docs/cli/endpoint-install.mdx
index 5e3bd417..d6d5f48d 100644
--- a/docs/cli/endpoint-install.mdx
+++ b/docs/cli/endpoint-install.mdx
@@ -37,6 +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) |
| `--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.mdx
index 1ff35a00..1f5696b7 100644
--- a/docs/cli/endpoint-repair.mdx
+++ b/docs/cli/endpoint-repair.mdx
@@ -32,6 +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) |
| `--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.mdx
index 0de7774e..869842bb 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 is the WebFetch summarizer request, which is forwarded with its body replaced by the fetched page text in `beacon.web_fetch.input`. 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 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).
## Validate forwarding
diff --git a/docs/runtimes/claude-code.mdx b/docs/runtimes/claude-code.mdx
index 9ad7f930..c344fd10 100644
--- a/docs/runtimes/claude-code.mdx
+++ b/docs/runtimes/claude-code.mdx
@@ -72,18 +72,24 @@ Beacon detects Claude Code through the `claude` executable and Claude settings p
### 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. So `beacon endpoint install` and `beacon ci exec` enable inline API-body logs (`OTEL_LOG_RAW_API_BODIES=1`). If the setting is already present, Beacon keeps it, so `0` (off) or `file:<dir>` (bodies written to files) stays as you set it.
+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:
-API bodies can contain the system prompt, the whole conversation, tool definitions, and tool results, so 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:
+```bash title="Record the pages Claude Code's WebFetch fetches"
+beacon endpoint install --claude-capture-web-fetch
+```
+
+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.
+
+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:
-- **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`. It never includes the summarizer's system prompt, tool definitions, or non-text blocks.
+- **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.
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.
Limits:
-- `gen_ai.tool.call.result` is stored at 2048 characters, after secret redaction. The `content` marker's hash and byte count describe the whole text Beacon received.
+- Every destination gets the same copy: secrets redacted, then at most 2048 characters. The `content` marker describes that stored copy, and `content.redacted` and `content.truncated` say what was done to it.
- Claude Code truncates long inline bodies and sets `body_truncated`. Beacon then keeps the page text up to the cut and marks the event `content.truncated`.
- Beacon never reads body files, so `file:<dir>` mode does not record the page.
- Beacon selects the summarizer request by its `query_source` value, as observed in Claude Code 2.1.291. If a later release renames that value, the page is no longer recorded.