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
hooks: ignore repo-suppliable env for auto-share and the cloud shuttle (#920)
claude[bot]4e6ea97d7a05
diff --git a/.cursor/install.sh b/.cursor/install.shindex 95ee7751..040770e9 100755--- a/.cursor/install.sh+++ b/.cursor/install.sh@@ -3,7 +3,16 @@ set -euo pipefailecho "Installing Beacon Cursor Cloud binaries..."-BEACON_HOME="${BEACON_HOME:-/tmp/beacon}"+# The cloud shuttle uploads only from /tmp/beacon, so a BEACON_HOME outside it is refused.+case "${BEACON_HOME:=/tmp/beacon}" in+ */../* | */..) BEACON_HOME_OK=0 ;;+ /tmp/beacon | /tmp/beacon/*) BEACON_HOME_OK=1 ;;+ *) BEACON_HOME_OK=0 ;;+esac+if [ "$BEACON_HOME_OK" != 1 ]; then+ echo "Beacon ignores BEACON_HOME=$BEACON_HOME outside /tmp/beacon." >&2+ BEACON_HOME=/tmp/beacon+fiBEACON_BIN_DIR="$BEACON_HOME/bin"REPO_ROOT="${BEACON_CLOUD_REPO_DIR:-${CURSOR_PROJECT_DIR:-$(pwd)}}"diff --git a/.cursor/start.sh b/.cursor/start.shindex 23d74aeb..137217e8 100755--- a/.cursor/start.sh+++ b/.cursor/start.sh@@ -1,8 +1,25 @@#!/usr/bin/env bashset -euo pipefail+# The cloud shuttle uploads only from /tmp/beacon, so a path outside it is refused.+under_sandbox() {+ case "$1" in+ */../* | */..) return 1 ;;+ /tmp/beacon | /tmp/beacon/*) return 0 ;;+ esac+ return 1+}+BEACON_HOME="${BEACON_HOME:-/tmp/beacon}"+if ! under_sandbox "$BEACON_HOME"; then+ echo "Beacon ignores BEACON_HOME=$BEACON_HOME outside /tmp/beacon." >&2+ BEACON_HOME=/tmp/beacon+fiBEACON_LOG_PATH="${BEACON_CLOUD_LOG_PATH:-$BEACON_HOME/runtime.jsonl}"+if [ "$BEACON_LOG_PATH" = /tmp/beacon ] || ! under_sandbox "$BEACON_LOG_PATH"; then+ echo "Beacon ignores BEACON_CLOUD_LOG_PATH=$BEACON_LOG_PATH outside /tmp/beacon." >&2+ BEACON_LOG_PATH="$BEACON_HOME/runtime.jsonl"+fimkdir -p "$(dirname "$BEACON_LOG_PATH")"diff --git a/cli/beacon-hooks/cmd/main_test.go b/cli/beacon-hooks/cmd/main_test.goindex 273a06ce..6dd82eb4 100644--- a/cli/beacon-hooks/cmd/main_test.go+++ b/cli/beacon-hooks/cmd/main_test.go@@ -5,8 +5,8 @@ import ("path/filepath""testing"+ "github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/logging""github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/activesession"- "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/shareauto")// TestMain keeps the active-session record every endpoint event updates out of the real home@@ -18,7 +18,8 @@ func TestMain(m *testing.M) {}os.Setenv(activesession.PathEnv, filepath.Join(dir, activesession.FileName))// Auto-share is off unless a test turns it on in a settings file of its own.- os.Setenv(shareauto.PathEnv, filepath.Join(dir, "share-settings.json"))+ settingsPath := filepath.Join(dir, "share-settings.json")+ logging.ShareSettingsPath = func() string { return settingsPath }// A suite run from inside a Claude Code session must not append to that session's env file.os.Unsetenv("CLAUDE_ENV_FILE")code := m.Run()diff --git a/cli/beacon-hooks/cmd/prompt_submit_cloud_test.go b/cli/beacon-hooks/cmd/prompt_submit_cloud_test.goindex da8d36e6..e79720a7 100644--- a/cli/beacon-hooks/cmd/prompt_submit_cloud_test.go+++ b/cli/beacon-hooks/cmd/prompt_submit_cloud_test.go@@ -9,6 +9,8 @@ import ("path/filepath""strings""testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/cloudshuttle")func TestRunPromptSubmitUploadsCursorCloudTelemetryToS3(t *testing.T) {@@ -47,6 +49,9 @@ func TestRunPromptSubmitUploadsCursorCloudTelemetryToS3(t *testing.T) {defer server.Close()tempDir := t.TempDir()+ prevSandbox := cloudshuttle.SandboxDir+ cloudshuttle.SandboxDir = tempDir+ t.Cleanup(func() { cloudshuttle.SandboxDir = prevSandbox })logPath := filepath.Join(tempDir, "runtime.jsonl")t.Setenv("BEACON_ENDPOINT_LOG", logPath)t.Setenv("BEACON_CLOUD_SHUTTLE_STATE", filepath.Join(tempDir, "shuttle-state.json"))diff --git a/cli/beacon-hooks/cmd/share_auto_test.go b/cli/beacon-hooks/cmd/share_auto_test.goindex 83e1d152..9fd3aa27 100644--- a/cli/beacon-hooks/cmd/share_auto_test.go+++ b/cli/beacon-hooks/cmd/share_auto_test.go@@ -6,6 +6,7 @@ import ("path/filepath""testing"+ "github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/logging""github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve""github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/activesession""github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/shareauto"@@ -31,7 +32,7 @@ func shareAutoHookEnv(t *testing.T, settings *shareauto.Settings) string {t.Setenv("BEACON_ENDPOINT_LOG", logPath)t.Setenv(activesession.PathEnv, filepath.Join(dir, activesession.FileName))settingsPath := filepath.Join(dir, "share.json")- t.Setenv(shareauto.PathEnv, settingsPath)+ setShareSettingsPath(t, func() string { return settingsPath })if settings != nil {if err := shareauto.Save(settingsPath, *settings); err != nil {t.Fatal(err)@@ -43,6 +44,13 @@ func shareAutoHookEnv(t *testing.T, settings *shareauto.Settings) string {return logPath}+func setShareSettingsPath(t *testing.T, path func() string) {+ t.Helper()+ prev := logging.ShareSettingsPath+ logging.ShareSettingsPath = path+ t.Cleanup(func() { logging.ShareSettingsPath = prev })+}+func runClaudeSessionHooks(t *testing.T, sessionID string) {t.Helper()runHookWithInput(t, runSessionStart, map[string]interface{}{@@ -112,6 +120,26 @@ func TestAutoShareOffWritesNothing(t *testing.T) {}}+// The hook's environment can come from the repository, so the settings-file override must not point+// it at a file that turns auto-share on.+func TestAutoShareIgnoresRepoSuppliedSettingsPath(t *testing.T) {+ logPath := shareAutoHookEnv(t, nil)+ setShareSettingsPath(t, shareauto.HookPath)+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ override := filepath.Join(t.TempDir(), ".beacon", "user.json")+ if err := shareauto.Save(override, shareauto.Settings{Auto: shareauto.Auto{Enabled: true, Visibility: "public"}}); err != nil {+ t.Fatal(err)+ }+ t.Setenv(shareauto.PathEnv, override)++ runClaudeSessionHooks(t, "sess-a")+ if n := len(shareRequests(t, logPath)); n != 0 {+ t.Fatalf("share requests from a repo-supplied settings file = %d", n)+ }+}+func TestAutoShareHonorsProjectOptOut(t *testing.T) {logPath := shareAutoHookEnv(t, &shareauto.Settings{Auto: shareauto.Auto{Enabled: true},diff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle.goindex 5f9a07e2..58983848 100644--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle.go+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle.go@@ -30,8 +30,8 @@ import ()const (- defaultLogPath = "/tmp/beacon/runtime.jsonl"- defaultStatePath = "/tmp/beacon/shuttle-state.json"+ defaultLogName = "runtime.jsonl"+ defaultStateName = "shuttle-state.json"defaultTokenURI = "https://oauth2.googleapis.com/token"defaultGCSEndpoint = "https://storage.googleapis.com"defaultS3Region = "us-east-1"@@ -42,6 +42,11 @@ const ()var httpClient = http.DefaultClient++// SandboxDir is the cloud sandbox's Beacon directory. The shuttle reads and writes only under it,+// so an environment a repository supplies cannot select a host log to upload. Tests point it+// elsewhere.+var SandboxDir = "/tmp/beacon"var nowUTC = func() time.Time { return time.Now().UTC() }type Config struct {@@ -87,7 +92,7 @@ type tokenResponse struct {}func ConfigFromEnv() Config {- statePath := firstEnvDefault(defaultStatePath, "BEACON_CLOUD_SHUTTLE_STATE")+ statePath := inSandbox("state path", firstEnv("BEACON_CLOUD_SHUTTLE_STATE"), defaultStateName)upload := cloudUploadFromEnv()bucket := strings.TrimSpace(os.Getenv("BEACON_CLOUD_GCS_BUCKET"))prefix := strings.Trim(strings.TrimSpace(os.Getenv("BEACON_CLOUD_GCS_PREFIX")), "/")@@ -97,7 +102,7 @@ func ConfigFromEnv() Config {}return Config{Upload: upload,- LogPath: firstEnvDefault(defaultLogPath, "BEACON_CLOUD_LOG_PATH", "BEACON_ENDPOINT_LOG", "BEACON_LOG_PATH", "BEACON_RUNTIME_LOG"),+ LogPath: inSandbox("log path", firstEnv("BEACON_CLOUD_LOG_PATH", "BEACON_ENDPOINT_LOG", "BEACON_LOG_PATH", "BEACON_RUNTIME_LOG"), defaultLogName),StatePath: statePath,Bucket: bucket,Prefix: prefix,@@ -117,6 +122,27 @@ func ConfigFromEnv() Config {}}+// inSandbox is p when it lies under SandboxDir, else the default file there. A refused p is+// reported on stderr, never stdout, which some runtimes add to the model's context, and only+// under BEACON_ORIGIN=cloud: local installs always set BEACON_ENDPOINT_LOG outside the sandbox+// and reach this through every SessionStart, Stop and SessionEnd, where the shuttle is inert.+func inSandbox(label, p, name string) string {+ fallback := filepath.Join(SandboxDir, name)+ if p == "" {+ return fallback+ }+ if filepath.IsAbs(p) {+ rel, err := filepath.Rel(SandboxDir, p)+ if err == nil && rel != "." && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) {+ return p+ }+ }+ if strings.TrimSpace(os.Getenv("BEACON_ORIGIN")) == "cloud" {+ fmt.Fprintf(os.Stderr, "beacon-hooks: cloud shuttle ignores %s %s outside %s; using %s\n", label, p, SandboxDir, fallback)+ }+ return fallback+}+func MaybeUpload(ctx context.Context, force bool) error {return Upload(ctx, ConfigFromEnv(), force)}@@ -628,10 +654,10 @@ func normalizeConfig(cfg Config) Config {}}if cfg.LogPath == "" {- cfg.LogPath = defaultLogPath+ cfg.LogPath = filepath.Join(SandboxDir, defaultLogName)}if cfg.StatePath == "" {- cfg.StatePath = defaultStatePath+ cfg.StatePath = filepath.Join(SandboxDir, defaultStateName)}if cfg.GCSEndpoint == "" {cfg.GCSEndpoint = defaultGCSEndpointdiff --git a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.goindex a276e2cf..6fc69c48 100644--- a/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go+++ b/cli/beacon-hooks/internal/cloudshuttle/shuttle_test.go@@ -63,8 +63,16 @@ func TestUploadNoopsWithoutCredentials(t *testing.T) {}}+func useSandbox(t *testing.T, dir string) {+ t.Helper()+ prev := SandboxDir+ SandboxDir = dir+ t.Cleanup(func() { SandboxDir = prev })+}+func TestResetFromEnvRemovesCloudRuntimeFiles(t *testing.T) {dir := t.TempDir()+ useSandbox(t, dir)logPath := filepath.Join(dir, "runtime.jsonl")statePath := filepath.Join(dir, "state.json")for _, path := range []string{logPath, logPath + ".lock", statePath} {@@ -86,6 +94,61 @@ func TestResetFromEnvRemovesCloudRuntimeFiles(t *testing.T) {}}+// A target the environment supplies cannot select a log outside the sandbox directory, so a+// repository cannot have a host's runtime log, every project's sessions, uploaded to its bucket.+func TestMaybeUploadRefusesALogOutsideTheSandbox(t *testing.T) {+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ t.Errorf("unexpected upload: %s %s", r.Method, r.URL)+ }))+ defer server.Close()+ dir := t.TempDir()+ useSandbox(t, filepath.Join(dir, "sandbox"))+ hostLog := filepath.Join(dir, "runtime.jsonl")+ if err := os.WriteFile(hostLog, []byte("{\"event\":\"host\"}\n"), 0o644); err != nil {+ t.Fatal(err)+ }+ t.Setenv("BEACON_ORIGIN", "cloud")+ t.Setenv("BEACON_CLOUD_UPLOAD", "s3")+ t.Setenv("BEACON_CLOUD_S3_BUCKET", "bucket")+ t.Setenv("BEACON_CLOUD_S3_ENDPOINT", server.URL)+ t.Setenv("AWS_ACCESS_KEY_ID", "AKIATEST")+ t.Setenv("AWS_SECRET_ACCESS_KEY", "secret")+ t.Setenv("BEACON_RUN_ID", "run")+ t.Setenv("BEACON_CLOUD_SHUTTLE_STATE", filepath.Join(dir, "state.json"))+ for _, key := range []string{"BEACON_CLOUD_LOG_PATH", "BEACON_ENDPOINT_LOG"} {+ t.Setenv(key, hostLog)+ if err := MaybeUpload(context.Background(), true); err != nil {+ t.Fatalf("%s: MaybeUpload returned error: %v", key, err)+ }+ t.Setenv(key, "")+ }+}++// Local installs set BEACON_ENDPOINT_LOG outside the sandbox, and every local SessionStart, Stop+// and SessionEnd reads the shuttle config, so the refusal notice is for cloud runs only.+func TestConfigFromEnvIsSilentOutsideCloud(t *testing.T) {+ dir := t.TempDir()+ useSandbox(t, filepath.Join(dir, "sandbox"))+ t.Setenv("BEACON_ORIGIN", "")+ t.Setenv("BEACON_ENDPOINT_LOG", filepath.Join(dir, "runtime.jsonl"))+ t.Setenv("BEACON_CLOUD_SHUTTLE_STATE", filepath.Join(dir, "state.json"))+ captured, err := os.CreateTemp(dir, "stderr")+ if err != nil {+ t.Fatal(err)+ }+ defer captured.Close()+ prev := os.Stderr+ os.Stderr = captured+ cfg := ConfigFromEnv()+ os.Stderr = prev+ if cfg.LogPath != filepath.Join(SandboxDir, defaultLogName) {+ t.Fatalf("LogPath = %q, want the sandbox default", cfg.LogPath)+ }+ if out, err := os.ReadFile(captured.Name()); err != nil || len(out) != 0 {+ t.Fatalf("stderr = %q (err %v), want nothing", out, err)+ }+}+func TestUploadSendsJSONLToGCS(t *testing.T) {restore := stubNow(t, time.Date(2026, 7, 12, 20, 17, 3, 0, time.UTC))defer restore()diff --git a/cli/beacon-hooks/internal/logging/logging.go b/cli/beacon-hooks/internal/logging/logging.goindex 7acb6983..06969825 100644--- a/cli/beacon-hooks/internal/logging/logging.go+++ b/cli/beacon-hooks/internal/logging/logging.go@@ -148,6 +148,10 @@ func (l *Logger) EndpointEventWithFidelity(action, category, severity, message,return nil}+// ShareSettingsPath locates the user's share settings. It is never taken from the environment,+// which a repository can supply; tests replace it.+var ShareSettingsPath = shareauto.HookPath+// requestShareOnce writes one session.share_requested event for the event's session when the person// turned auto-share on for its working directory (`beacon share auto enable`). It is the first event// of the session the hooks see -- SessionStart where the runtime has one -- and never more than one@@ -173,7 +177,7 @@ func (l *Logger) requestShareOnce(event map[string]interface{}) {if id == "" || dir == "" || name == "" {return}- decision := shareauto.ForHook(shareauto.DefaultPath(), dir)+ decision := shareauto.ForHook(ShareSettingsPath(), dir)if !decision.Enabled {return}diff --git a/cli/beacon-hooks/internal/logging/main_test.go b/cli/beacon-hooks/internal/logging/main_test.goindex 836e7a4a..7a263bfb 100644--- a/cli/beacon-hooks/internal/logging/main_test.go+++ b/cli/beacon-hooks/internal/logging/main_test.go@@ -6,7 +6,6 @@ import ("testing""github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/activesession"- "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve/shareauto")// TestMain keeps the active-session record every endpoint event updates out of the real home@@ -18,7 +17,8 @@ func TestMain(m *testing.M) {}os.Setenv(activesession.PathEnv, filepath.Join(dir, activesession.FileName))// Auto-share is off unless a test turns it on in a settings file of its own.- os.Setenv(shareauto.PathEnv, filepath.Join(dir, "share-settings.json"))+ settingsPath := filepath.Join(dir, "share-settings.json")+ ShareSettingsPath = func() string { return settingsPath }code := m.Run()os.RemoveAll(dir)os.Exit(code)diff --git a/cli/beacon-hooks/internal/logging/share_request_test.go b/cli/beacon-hooks/internal/logging/share_request_test.goindex 0cdd8880..6d809c53 100644--- a/cli/beacon-hooks/internal/logging/share_request_test.go+++ b/cli/beacon-hooks/internal/logging/share_request_test.go@@ -22,7 +22,9 @@ func TestShareRequestMarkIsRolledBackWhenTheWriteFails(t *testing.T) {settingsPath := filepath.Join(dir, "share.json")t.Setenv("BEACON_ENDPOINT_LOG", logPath)t.Setenv(activesession.PathEnv, recordPath)- t.Setenv(shareauto.PathEnv, settingsPath)+ prevPath := ShareSettingsPath+ ShareSettingsPath = func() string { return settingsPath }+ t.Cleanup(func() { ShareSettingsPath = prevPath })var settings shareauto.Settingssettings.SetGlobal(shareauto.GlobalOn)if err := shareauto.Save(settingsPath, settings); err != nil {diff --git a/cli/beacon/cmd/cloud.go b/cli/beacon/cmd/cloud.goindex 8e8184c0..595dbd05 100644--- a/cli/beacon/cmd/cloud.go+++ b/cli/beacon/cmd/cloud.go@@ -6,6 +6,7 @@ import ("fmt""os""os/exec"+ "path""path/filepath""strings""time"@@ -54,10 +55,11 @@ var cloudClaudeWebPrintHooksCmd = &cobra.Command{if strings.TrimSpace(cloudOpts.binaryPath) == "" {return fmt.Errorf("--binary-path is required")}- if strings.TrimSpace(cloudOpts.logPath) == "" {- cloudOpts.logPath = "/tmp/beacon/runtime.jsonl"+ logPath, err := cloudLogPath(cloudOpts.logPath)+ if err != nil {+ return err}- fmt.Print(renderClaudeWebHooks(cloudOpts.binaryPath, cloudOpts.logPath))+ fmt.Print(renderClaudeWebHooks(cloudOpts.binaryPath, logPath))return nil},}@@ -83,9 +85,13 @@ var cloudCursorPrintHooksCmd = &cobra.Command{if strings.TrimSpace(cloudOpts.binaryPath) == "" {return fmt.Errorf("--binary-path is required")}+ logPath, err := cloudLogPath(cloudOpts.logPath)+ if err != nil {+ return err+ }rendered, err := endpointhooks.RenderCursorCloudHooks(endpointhooks.CursorCloudOptions{BinaryPath: cloudOpts.binaryPath,- LogPath: defaultCloudLogPath(cloudOpts.logPath),+ LogPath: logPath,SafeHooks: cloudOpts.safeHooks,})if err != nil {@@ -172,11 +178,20 @@ func init() {cloudS3SetupCmd.Flags().BoolVar(&cloudOpts.printEnv, "print-env", false, "Print Claude web environment variables after setup")}-func defaultCloudLogPath(path string) string {- if strings.TrimSpace(path) == "" {- return "/tmp/beacon/runtime.jsonl"+const cloudSandboxDir = "/tmp/beacon"++// cloudLogPath keeps the hook log where the cloud shuttle reads it: the shuttle uploads only files+// under cloudSandboxDir, so a log anywhere else would never be shipped.+func cloudLogPath(p string) (string, error) {+ p = strings.TrimSpace(p)+ if p == "" {+ return cloudSandboxDir + "/runtime.jsonl", nil+ }+ clean := path.Clean(p)+ if !strings.HasPrefix(clean, cloudSandboxDir+"/") {+ return "", fmt.Errorf("--log-path %s must be under %s, the only directory the cloud shuttle uploads from", p, cloudSandboxDir)}- return path+ return clean, nil}func renderClaudeWebHooks(binaryPath, logPath string) string {diff --git a/cli/beacon/cmd/cloud_test.go b/cli/beacon/cmd/cloud_test.goindex e5e99b9b..4b595117 100644--- a/cli/beacon/cmd/cloud_test.go+++ b/cli/beacon/cmd/cloud_test.go@@ -6,6 +6,7 @@ import ("testing"endpointhooks "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"+ "github.com/spf13/cobra")func TestCloudCommandsRegistered(t *testing.T) {@@ -236,3 +237,18 @@ func TestS3UploadPolicyScopesToPrefix(t *testing.T) {t.Fatalf("Resource = %q", policy.Statement[0].Resource)}}++// The shuttle uploads only from /tmp/beacon, so a hook log elsewhere would never be shipped.+func TestCloudPrintHooksRejectsLogPathOutsideSandbox(t *testing.T) {+ prev := cloudOpts+ t.Cleanup(func() { cloudOpts = prev })+ for _, cmd := range []*cobra.Command{cloudClaudeWebPrintHooksCmd, cloudCursorPrintHooksCmd} {+ cloudOpts.binaryPath = "/tmp/beacon/bin/beacon-hooks"+ for _, logPath := range []string{"/workspace/.beacon/runtime.jsonl", "/tmp/beacon/../etc/runtime.jsonl", "/tmp/beacon"} {+ cloudOpts.logPath = logPath+ if err := cmd.RunE(cmd, nil); err == nil || !strings.Contains(err.Error(), "/tmp/beacon") {+ t.Fatalf("%s --log-path %s: err = %v, want a rejection naming /tmp/beacon", cmd.Parent().Name(), logPath, err)+ }+ }+ }+}diff --git a/cli/beacon/cmd/share_auto.go b/cli/beacon/cmd/share_auto.goindex 07ecb071..1b58a826 100644--- a/cli/beacon/cmd/share_auto.go+++ b/cli/beacon/cmd/share_auto.go@@ -146,6 +146,17 @@ func init() {shareAutoEnableCmd.Flags().BoolVar(&shareAutoOpts.yes, "yes", false, "Enable public auto-share without asking")}+// shareAutoHookMismatch says the hooks will not read path, or "" when they do. The CLI honors+// BEACON_SHARE_SETTINGS_FILE, but the hooks never read it: their environment can come from a+// repository.+func shareAutoHookMismatch(path string) string {+ hook := shareauto.HookPath()+ if hook == "" || filepath.Clean(hook) == filepath.Clean(path) {+ return ""+ }+ return fmt.Sprintf("the hooks read %s, not %s (%s), so this setting will not apply to hook sessions", hook, path, shareauto.PathEnv)+}+type shareAutoStatus struct {SettingsPath string `json:"settings_path"`Directory string `json:"directory"`@@ -253,6 +264,9 @@ func shareAutoSet(cmd *cobra.Command, enable bool) error {if err := shareauto.Save(path, settings); err != nil {return err}+ if w := shareAutoHookMismatch(path); enable && w != "" {+ fmt.Fprintf(cmd.ErrOrStderr(), "warning: %s\n", w)+ }if project != "" {if err := shareauto.SaveMarker(project, shareauto.Marker{Auto: shareauto.Auto{Enabled: enable, Visibility: visibility}}); err != nil {return fmt.Errorf("the setting was saved for you, but %s could not be written: %w", shareauto.MarkerPath(project), err)@@ -375,6 +389,9 @@ func runShareAutoStatus(cmd *cobra.Command, args []string) error {return err}status := buildShareAutoStatus(path, settings, dir)+ if w := shareAutoHookMismatch(path); w != "" {+ status.Warnings = append(status.Warnings, w)+ }out := cmd.OutOrStdout()if shareAutoOpts.jsonOutput {return json.NewEncoder(out).Encode(map[string]any{"ok": true, "data": status})diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 9cdf18ef..116b2911 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -11,6 +11,7 @@ Stay up to date with the latest changes to the Agent Beacon CLI.## Unreleased+- **Hooks ignore settings a repository could supply** · The hooks no longer take the auto-share settings file from `BEACON_SHARE_SETTINGS_FILE`; they read only `~/.beacon/endpoint/share.json`, so an environment a repository supplies cannot turn auto-share on for its own sessions. `beacon share auto` still honors the variable and warns when the hooks read a different file. The cloud shuttle now reads and writes only under `/tmp/beacon`, so the same environment cannot have it upload a host's runtime log, and `beacon cloud … print-hooks` rejects a `--log-path` outside it rather than writing a log that is never uploaded.- **Devin CLI session history sync** · `beacon endpoint devin sync` reads Devin CLI's committed SQLite session store locally and read-only into the runtime log, adding what the live hooks cannot see: assistant replies, reasoning, per-message token usage, the per-turn model with model-change events, compaction summaries, and `approval.denied` for rejected tool calls. Sessions the hooks already cover get only those additions, so nothing is counted twice, and the install backfill includes Devin CLI. Verified on macOS; the Linux and Windows paths are best effort. See [Devin CLI](/runtimes/devin#session-database-sync).- **Claude.ai and ChatGPT answers show in traces** · Answers the browser extension records as `agent.response.completed` were classified as `other` in trace views, so `beacon endpoint traces show`, the dashboard and shared traces showed the prompt without the answer. They are now assistant messages carrying the answer, as are plans recorded as `agent.plan`. OpenCode's separate completion event, which carries only usage, stays out of the conversation. Local history is rebuilt on its next read, so earlier sessions show their answers too.- **Lens findings link to events without an ID** · When a session's events carried no `event.id`, as events written through the SDK's `JSONLSink` or by releases before late August do, a lens finding on one of them came back with empty `event_ids`, so its evidence link pointed nowhere. Findings now name the same `line-N` identifier the trace shows for that event, and an explicit ID containing whitespace is no longer trimmed out of matching it.diff --git a/docs/cli/cloud-claude-web-print-hooks.mdx b/docs/cli/cloud-claude-web-print-hooks.mdxindex a3f5338e..b4248036 100644--- a/docs/cli/cloud-claude-web-print-hooks.mdx+++ b/docs/cli/cloud-claude-web-print-hooks.mdx@@ -13,6 +13,8 @@ beacon cloud claude-web print-hooksThis command is mostly useful for debugging or custom setup scripts.+`--log-path` defaults to `/tmp/beacon/runtime.jsonl` and must name a file under `/tmp/beacon`, the only directory the cloud shuttle uploads from; any other path is rejected.+## ExamplesPrint hook settings for a cloud sandbox:diff --git a/docs/cli/cloud-cursor-print-hooks.mdx b/docs/cli/cloud-cursor-print-hooks.mdxindex 053d2216..726aa55b 100644--- a/docs/cli/cloud-cursor-print-hooks.mdx+++ b/docs/cli/cloud-cursor-print-hooks.mdx@@ -15,6 +15,8 @@ beacon cloud cursor print-hooksThe rendered hooks set `BEACON_ORIGIN=cloud`, `BEACON_RUN_PROVIDER=cursor_cloud`, and `BEACON_RUN_EPHEMERAL=true` for Cursor cloud hook events.+`--log-path` defaults to `/tmp/beacon/runtime.jsonl` and must name a file under `/tmp/beacon`, the only directory the cloud shuttle uploads from; any other path is rejected.+Cursor Cloud only runs command-based project hooks after the cloud VM starts.The generated hook set uses supported Cursor Cloud hooks such as`beforeSubmitPrompt`, `beforeReadFile`, `beforeShellExecution`, `afterShellExecution`,diff --git a/pkg/asymptoteobserve/shareauto/shareauto.go b/pkg/asymptoteobserve/shareauto/shareauto.goindex f4c9c92c..89986a6d 100644--- a/pkg/asymptoteobserve/shareauto/shareauto.go+++ b/pkg/asymptoteobserve/shareauto/shareauto.go@@ -31,7 +31,8 @@ const (FileName = "share.json"// MarkerDir is the project directory that holds the marker.MarkerDir = ".beacon"- // PathEnv overrides where the user file lives (tests, unusual homes).+ // PathEnv overrides where the CLI's user file lives (tests, unusual homes). The hooks never+ // read it: see HookPath.PathEnv = "BEACON_SHARE_SETTINGS_FILE"// SchemaVersion is written into both files.SchemaVersion = "beacon.share_settings.v1"@@ -112,11 +113,18 @@ func (s *Settings) SetGlobal(state string) {s.Auto.Enabled = state == GlobalOn}-// DefaultPath is BEACON_SHARE_SETTINGS_FILE, or ~/.beacon/endpoint/share.json.+// DefaultPath is the user file the CLI reads and writes: BEACON_SHARE_SETTINGS_FILE, or HookPath.func DefaultPath() string {if p := strings.TrimSpace(os.Getenv(PathEnv)); p != "" {return p}+ return HookPath()+}++// HookPath is the user file the hooks read: ~/.beacon/endpoint/share.json. It ignores+// BEACON_SHARE_SETTINGS_FILE, because a hook's environment can come from the repository it runs+// in, and a repository must never be able to turn auto-share on for itself.+func HookPath() string {home, err := os.UserHomeDir()if err != nil || home == "" {return ""