Skip to content

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

Merge origin/main into claude/cool-johnson-7atbsy

Claude45ab4ef2660f
diff --cc CLAUDE.md
index 88277b3e,a7d26712..a72e1ae5
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -27,8 -27,9 +27,9 @@@ Do not recreate or depend on removed `a
- Beacon is visibility-first endpoint telemetry for local AI agent runtimes, not a hosted policy service or general endpoint protection product.
- Preserve the local-only default. The public Beacon build must not require a hosted account, remote policy fetch, hosted dashboard, or external network dependency during normal hook execution, and hooks themselves never touch the network.
- `beacon login` is the account-identity channel for interactive users and is required by the interactive `beacon endpoint install` wizard. It uses browser PKCE against beacon.sh and stores the scoped CLI token only in `~/.beacon/auth/session.json` (0600 under a 0700 directory). Signing in alone never starts forwarding. User-mode `beacon endpoint connect` may send that token once to `POST /api/cli/enroll/account` to authorize minting a separate device ingest key, and `beacon mcp token create` may send it to `POST /api/cli/mcp/tokens` (scope `mcp:token:create`, listed on the sign-in page) to mint a personal MCP token that is printed once to stdout and never written to a file; never copy the account token into endpoint config, Vector, hook environments, logs, or command output. System/root/package/MDM/CI/piped-stdin/dry-run installs stay noninteractive and account-free.
- - Beacon Cloud forwarding (`cli/beacon/internal/endpoint/asymptote`, `beacon endpoint connect`, `beacon endpoint asymptote`) is Vector-shaped: Beacon writes local JSONL, Vector ships runtime lines only from the connection point forward and reads inventory from the beginning to establish the endpoint's current baseline, and the `bcn_device_*` key stays only in `<BaseDir>/asymptote/vector-secrets.json` via Vector's secret backend. The onboarding wizard preselects Beacon Cloud, and confirming it connects this endpoint in the same command once the local install has succeeded; an endpoint that is already enrolled is never re-enrolled, because enrollment rotates the device key. Standard mode ships locally sanitized retained content; metadata-only uses local Vector transforms to remove prompts, responses, reasoning, tool arguments/results, command output, raw fields, diffs, inventory content, and MCP definitions before buffering/upload. Keep the ingest URL `https://`, the wire contract aligned with `beacon-ingest` (`/v1/ingest/{runtime,inventory}` and `/v1/ingest/health`), and do not add another endpoint network channel. The cloud-sandbox shuttle is the bounded exception: only with `BEACON_ORIGIN=cloud`, it can upload new runtime lines to GCS, S3, or the same Beacon ingest contract because no Vector/service manager/browser/persistent disk exists there.
+ - Beacon Cloud forwarding (`cli/beacon/internal/endpoint/asymptote`, `beacon endpoint connect`, `beacon endpoint asymptote`) is Vector-shaped: Beacon writes local JSONL, Vector ships runtime lines only from the connection point forward and reads inventory from the beginning to establish the endpoint's current baseline, plus the one bounded exception of the session backfill (below), and the `bcn_device_*` key stays only in `<BaseDir>/asymptote/vector-secrets.json` via Vector's secret backend. The onboarding wizard preselects Beacon Cloud, and confirming it connects this endpoint in the same command once the local install has succeeded; an endpoint that is already enrolled is never re-enrolled, because enrollment rotates the device key. Standard mode ships locally sanitized retained content; metadata-only uses local Vector transforms to remove prompts, responses, reasoning, tool arguments/results, command output, raw fields, diffs, inventory content, and MCP definitions before buffering/upload. Keep the ingest URL `https://`, the wire contract aligned with `beacon-ingest` (`/v1/ingest/{runtime,inventory}` and `/v1/ingest/health`), and do not add another endpoint network channel. The cloud-sandbox shuttle is the bounded exception: only with `BEACON_ORIGIN=cloud`, it can upload new runtime lines to GCS, S3, or the same Beacon ingest contract because no Vector/service manager/browser/persistent disk exists there.
+ - Session backfill (`cli/beacon/cmd/endpoint_backfill.go`; docs in `docs/cli/endpoint-install.mdx#session-backfill` and `docs/cli/endpoint-connect.mdx#session-backfill`): after a successful user-mode install, every session-store collector runs once with `CollectOptions.Since` (30 days; `sessionwindow.Recent` keeps those sessions, newest first, and never touches the cursors of the rest) and a shared `writer.Budget` (24 MiB, at most 12 MiB per runtime through `Budget.Sub`; a refused append returns `writer.ErrBudgetSpent`, the collector stops with cursors past only what was written, and a manual sync reads the rest). A new session-store collector takes both fields and joins `endpointBackfillRunners`. A first user-mode connect runs the same sweep before enrollment (skipped when install just ran it) and, before the forwarder starts, `asymptote.StageBackfill` copies the window's `harness.collection_method=poll` lines into `cloud-backfill.jsonl` beside the runtime log, which the `beacon_backfill` Vector source reads from the beginning into the runtime sink through the same privacy transform. Live hook/OTLP/plugin history before the connection point stays local. Re-connects never stage, a privacy-mode change deletes the staged file with the checkpoints, and `disconnect` removes it. The wizard's confirm screen names the upload (`WizardOptions.BackfillDays`). System-mode, dry-run, `--no-backfill` and `BEACON_BACKFILL=0` skip all of it, so unattended paths are unchanged; the cmd tests run with `BEACON_BACKFILL=0` set in `TestMain`.
-- `beacon endpoint install` has a full-screen onboarding wizard on interactive user TTYs. It signs in, preselects Beacon Cloud, requires an explicit choice to opt out to Local, and asks Managed users to choose Standard or Metadata-only privacy. Signing in alone still moves no telemetry. Confirming Beacon Cloud does: the confirm screen states that it installs Beacon and starts forwarding, and names what the selected privacy mode sends, so that screen is the consent point. The managed destination is recorded only after enrollment succeeds, so a failed enrollment leaves a working local install, prints `beacon endpoint connect` as the retry, and re-offers the question on the next install. The onboarding record is written only after `lifecycle.Install` returns, because a profile written first left a failed install looking onboarded and silently skipped the wizard on the retry. Explicit `install --connect` is unchanged. The wizard is skipped for system/root/CI/piped-stdin/dry-run or `BEACON_ONBOARDING=0`; those unattended paths must never gain an account or browser dependency. Legacy `BEACON_ONBOARDING_EMAIL`/`USAGE` submissions remain only for fleet compatibility. Implementation lives in `cli/beacon/internal/onboarding` and `cli/beacon/cmd/endpoint_onboarding.go`; keep `docs/cli/endpoint-onboarding.mdx` in sync.
+- `beacon endpoint install` has a full-screen onboarding wizard on interactive user TTYs. It signs in, preselects Beacon Cloud, requires an explicit choice to opt out to Local, and asks Managed users to choose Standard or Metadata-only privacy. Signing in alone still moves no telemetry. Confirming Beacon Cloud does: the confirm screen states that it installs Beacon and starts forwarding, and names what the selected privacy mode sends, so that screen is the consent point. The managed destination is recorded only after enrollment succeeds, so a failed enrollment leaves a working local install, prints `beacon endpoint connect` as the retry, and re-offers the question on the next install. The onboarding record is written only after `lifecycle.Install` returns, because a profile written first left a failed install looking onboarded and silently skipped the wizard on the retry. Explicit `install --connect` is unchanged. The wizard is skipped for system/root/CI/piped-stdin/dry-run or `BEACON_ONBOARDING=0`; those unattended paths must never gain an account or browser dependency. Legacy `BEACON_ONBOARDING_EMAIL`/`USAGE` submissions remain only for fleet compatibility. After the destination, the wizard shows an agent tools screen; every row is preselected (opt-out, space toggles). Beacon Cloud MCP is offered only with Beacon Cloud and runs the `beacon mcp connect` flow (`connectCloudMCP` with `yes`, OAuth, detected harnesses) only after the endpoint is connected (or already was), via `finishCloudSetup`; a failed enrollment skips it and names the retry. The Beacon Agent Skills are offered for either destination and installed user-wide into `~/.agents/skills` and, when Claude Code is set up, `~/.claude/skills` (`cli/beacon/internal/agentskills`, `beacon skills install|uninstall`; a `.beacon-managed` marker decides what Beacon may replace or remove; install and repair refresh only copies Beacon already wrote). Both run after `lifecycle.Install` returns and warn rather than fail. The answers are recorded as `onboarding.cloud_mcp`/`agent_skills`. Implementation lives in `cli/beacon/internal/onboarding`, `cli/beacon/cmd/endpoint_onboarding.go`, `cli/beacon/cmd/endpoint_install.go` and `cli/beacon/cmd/agent_tools.go`; keep `docs/cli/endpoint-onboarding.mdx` and `docs/cli/skills.mdx` in sync.
- Do not add dependency vulnerability scanning, OSV/GHSA lookups, package remediation, or other vulnerability-enforcement flows to the public hook path.
- Do not add broad runtime enforcement unless explicitly requested. Current control behavior is limited to hook-native approvals/denials exposed by supported agent runtimes.
- Keep destination support shaped like the existing local JSONL and customer-managed forwarding paths. Beacon may render supported packs or token-based endpoint forwarders, but should not add hosted SIEM dependencies or store third-party service credentials beyond the explicit supported configs. Elastic remains a file-tailing pack over local JSONL.
diff --cc cli/beacon/cmd/endpoint_install.go
index 1a030e73,8513581b..b0487fa4
--- a/cli/beacon/cmd/endpoint_install.go
+++ b/cli/beacon/cmd/endpoint_install.go
@@@ -179,47 -179,31 +179,55 @@@ func runEndpointInstall(cmd *cobra.Comm
}
printLingerGap(cmd.ErrOrStderr(), result)
installHookTargetsFromEndpointInstall(cmd.ErrOrStderr(), selection.Hooks)
+ refreshAgentSkills(cmd.ErrOrStderr())
+ installAgentSkillsFromOnboarding(cmd, onboarded)
+ // Read recent history from the agents' own session stores so the dashboard has sessions
+ // in it before any agent runs again. Local only, bounded, and never a reason to fail the
+ // install; a connect below ships what it wrote rather than sweeping again.
+ backfilled := false
+ if endpointBackfillEnabled(endpointUserMode()) {
+ reportEndpointBackfill(cmd.OutOrStdout(), runEndpointBackfill(result.LogPath))
+ backfilled = true
+ }
- if connectAfterInstall {
- // The install is complete and stands on its own; a failed connect is reported
- // with the retry command rather than turning a working install into an error.
- fmt.Fprintln(cmd.OutOrStdout())
- if err := connectEndpoint(cmd, endpointUserMode(), result.LogPath, backfilled); err != nil {
- fmt.Fprintf(cmd.ErrOrStderr(), "beacon: managed ingest was not connected (%v). Run `beacon endpoint connect` to try again.\n", err)
- } else {
- recordDestinationAsymptote(cmd)
- suggestMCPConnect(cmd.OutOrStdout(), onboarded.Connect)
+ finishCloudSetup(cmd, onboarded, connectAfterInstall, func() error {
- return connectEndpoint(cmd, endpointUserMode(), result.LogPath)
++ return connectEndpoint(cmd, endpointUserMode(), result.LogPath, backfilled)
+ })
+ return nil
+}
+
+// finishCloudSetup connects the endpoint when the wizard or --connect asked for it, and then
+// registers Beacon Cloud MCP when the wizard kept it selected. MCP is registered only once the
+// endpoint forwards to Beacon Cloud, since there is nothing for it to search otherwise.
+func finishCloudSetup(cmd *cobra.Command, onboarded onboardingOutcome, connectAfterInstall bool, connect func() error) {
+ if !connectAfterInstall {
+ if onboarded.ConnectCloudMCP {
+ // An endpoint that was already connected keeps its device key and is not
+ // re-enrolled, but the person still asked for Beacon Cloud MCP.
+ connectCloudMCPFromOnboarding(cmd)
}
+ return
}
- return nil
+ // The install is complete and stands on its own; a failed connect is reported with the
+ // retry command rather than turning a working install into an error.
+ fmt.Fprintln(cmd.OutOrStdout())
+ if err := connect(); err != nil {
+ fmt.Fprintf(cmd.ErrOrStderr(), "beacon: managed ingest was not connected (%v). Run `beacon endpoint connect` to try again.\n", err)
+ if onboarded.ConnectCloudMCP {
+ fmt.Fprintln(cmd.ErrOrStderr(), "beacon: Beacon Cloud MCP was not registered either; run `beacon mcp connect` once the endpoint is connected.")
+ }
+ return
+ }
+ recordDestinationAsymptote(cmd)
+ if onboarded.ConnectCloudMCP {
+ connectCloudMCPFromOnboarding(cmd)
+ return
+ }
+ suggestMCPConnect(cmd.OutOrStdout(), onboarded.Connect)
}
-// suggestMCPConnect points a person who just chose Beacon Cloud in the wizard at
-// `beacon mcp connect`. It only prints: registering the MCP server stays a separate,
-// explicit command, and the unattended install paths never reach the wizard at all.
+// suggestMCPConnect points a person who chose Beacon Cloud in the wizard, but turned Beacon
+// Cloud MCP off, at `beacon mcp connect`. It only prints, and the unattended install paths never
+// reach the wizard at all.
func suggestMCPConnect(out io.Writer, chosenInWizard bool) {
if !chosenInWizard {
return
diff --cc cli/beacon/cmd/endpoint_onboarding.go
index 96911580,d3ef41e1..4e931a06
--- a/cli/beacon/cmd/endpoint_onboarding.go
+++ b/cli/beacon/cmd/endpoint_onboarding.go
@@@ -169,7 -163,7 +169,8 @@@ func runAccountOnboarding(cmd *cobra.Co
DestinationOnly: destinationOnly,
PresetDestination: preset,
PresetPrivacyMode: profile.Onboarding.PrivacyMode,
+ OfferAgentTools: true,
+ BackfillDays: endpointBackfillDays(),
NoBrowser: endpointOpts.noBrowser,
NoDisplay: onboardingDisplayCheck(),
Now: onboardingClock,
diff --cc cli/beacon/internal/onboarding/wizard.go
index 107bd5a4,bb177b76..5ea38a06
--- a/cli/beacon/internal/onboarding/wizard.go
+++ b/cli/beacon/internal/onboarding/wizard.go
@@@ -60,10 -60,10 +60,14 @@@ type WizardOptions struct
DestinationOnly bool
PresetDestination string
PresetPrivacyMode string
+ // OfferAgentTools adds the agent tools screen before confirm. The Beacon agent skills are
+ // offered whichever destination is chosen; Beacon Cloud MCP only with Beacon Cloud. Every
+ // offered tool starts selected: turning one off is the person's choice to make.
+ OfferAgentTools bool
+ // BackfillDays is how far back the install reads agent sessions from their local session
+ // stores, and a first connect uploads them; zero when the backfill is off. The confirm screen
+ // names it, because it is part of what confirming Beacon Cloud sends.
+ BackfillDays int
// SignIn signs in in place. When nil the wizard keeps its original contract:
// it exits with NeedLogin and the caller signs in and runs it again.
diff --cc cli/beacon/internal/onboarding/wizard_test.go
index 1d0f8b90,26ce008c..14613541
--- a/cli/beacon/internal/onboarding/wizard_test.go
+++ b/cli/beacon/internal/onboarding/wizard_test.go
@@@ -662,115 -662,34 +662,147 @@@ func TestSignInScreenHonorsNoBrowser(t
}
}
+func TestManagedWizardOffersCloudMCPAndSkillsSelected(t *testing.T) {
+ model := newWizardModel(WizardOptions{
+ SignedIn: true,
+ Email: "[email protected]",
+ OfferManaged: true,
+ OfferAgentTools: true,
+ })
+ model.width, model.height = 100, 40
+ model, _ = advanceWizard(t, model, "enter") // welcome
+ model, _ = advanceWizard(t, model, "enter") // Beacon Cloud
+ model, _ = advanceWizard(t, model, "enter") // disclosure
+ model, _ = advanceWizard(t, model, "enter") // privacy
+ if model.screen != agentToolsScreen {
+ t.Fatalf("screen = %v, want agent tools", model.screen)
+ }
+ view := model.View()
+ for _, want := range []string{"[x] Beacon Cloud MCP", "[x] Beacon agent skills", "space"} {
+ if !strings.Contains(view, want) {
+ t.Fatalf("agent tools screen missing %q:\n%s", want, view)
+ }
+ }
+ model, _ = advanceWizard(t, model, "enter")
+ if view := model.View(); !strings.Contains(view, "Agent tools: Beacon Cloud MCP, Beacon agent skills") {
+ t.Fatalf("confirm screen should list the agent tools:\n%s", view)
+ }
+ model, _ = advanceWizard(t, model, "enter")
+ if !model.result.Completed || !model.result.ConnectCloudMCP || !model.result.InstallSkills {
+ t.Fatalf("result = %#v", model.result)
+ }
+}
+
+func TestManagedWizardCanTurnOffCloudMCP(t *testing.T) {
+ model := newWizardModel(WizardOptions{
+ SignedIn: true,
+ OfferManaged: true,
+ OfferAgentTools: true,
+ DestinationOnly: true,
+ PresetDestination: DestinationAsymptote,
+ })
+ model.width, model.height = 100, 40
+ model, _ = advanceWizard(t, model, "enter") // disclosure
+ model, _ = advanceWizard(t, model, "enter") // privacy
+ model, _ = advanceWizard(t, model, " ")
+ if model.result.ConnectCloudMCP || !model.result.InstallSkills {
+ t.Fatalf("space should turn off Beacon Cloud MCP only: %#v", model.result)
+ }
+ if view := model.View(); !strings.Contains(view, "[ ] Beacon Cloud MCP") {
+ t.Fatalf("turned-off tool should render unchecked:\n%s", view)
+ }
+ model, _ = advanceWizard(t, model, "j")
+ model, _ = advanceWizard(t, model, " ")
+ model, _ = advanceWizard(t, model, "enter")
+ if view := model.View(); !strings.Contains(view, "Agent tools: none") {
+ t.Fatalf("confirm should say no agent tools:\n%s", view)
+ }
+ model, _ = advanceWizard(t, model, "enter")
+ if !model.result.Completed || model.result.ConnectCloudMCP || model.result.InstallSkills {
+ t.Fatalf("result = %#v", model.result)
+ }
+}
+
+func TestLocalWizardOffersOnlySkills(t *testing.T) {
+ model := newWizardModel(WizardOptions{
+ SignedIn: true,
+ OfferManaged: true,
+ OfferAgentTools: true,
+ })
+ model.width, model.height = 100, 40
+ model, _ = advanceWizard(t, model, "enter") // welcome
+ model, _ = advanceWizard(t, model, "j")
+ model, _ = advanceWizard(t, model, "enter") // Local
+ if model.screen != agentToolsScreen {
+ t.Fatalf("screen = %v, want agent tools", model.screen)
+ }
+ view := model.View()
+ if strings.Contains(view, "Cloud MCP") || !strings.Contains(view, "[x] Beacon agent skills") {
+ t.Fatalf("local agent tools screen should offer only the skills:\n%s", view)
+ }
+ model, _ = advanceWizard(t, model, "enter")
+ model, _ = advanceWizard(t, model, "enter")
+ if !model.result.Completed || model.result.ConnectCloudMCP || !model.result.InstallSkills {
+ t.Fatalf("result = %#v", model.result)
+ }
+}
+
+func TestFinishingWithoutAnAccountStillOffersSkills(t *testing.T) {
+ model := newWizardModel(WizardOptions{OfferManaged: true, OfferAgentTools: true, NoDisplay: errors.New("no display")})
+ model.width, model.height = 100, 40
+ model, _ = advanceWizard(t, model, "enter")
+ if model.screen != signInFailedScreen {
+ t.Fatalf("screen = %v, want recovery", model.screen)
+ }
+ model, _ = advanceWizard(t, model, "enter") // finish without an account
+ if model.screen != agentToolsScreen || !model.result.InstallSkills {
+ t.Fatalf("screen = %v result = %#v", model.screen, model.result)
+ }
+ if view := model.View(); strings.Contains(view, "Cloud MCP") {
+ t.Fatalf("no Cloud MCP without Beacon Cloud:\n%s", view)
+ }
+ model, _ = advanceWizard(t, model, "enter")
+ model, _ = advanceWizard(t, model, "enter")
+ if model.result.ConnectCloudMCP {
+ t.Fatalf("result = %#v", model.result)
+ }
+}
+
+func TestAgentToolsScreenIsSkippedWhenNotOffered(t *testing.T) {
+ model := newWizardModel(WizardOptions{SignedIn: true, OfferManaged: true, DestinationOnly: true, PresetDestination: DestinationLocal})
+ if model.screen != confirmScreen || model.result.ConnectCloudMCP || model.result.InstallSkills {
+ t.Fatalf("screen = %v result = %#v", model.screen, model.result)
+ }
+}
++
+ // Confirming Beacon Cloud also uploads the session backfill, so the confirm screen, which is the
+ // consent point, has to say so; and a local choice says what the install reads.
+ func TestConfirmScreenNamesTheSessionBackfill(t *testing.T) {
+ render := func(destination string, days int) string {
+ model := newWizardModel(WizardOptions{
+ SignedIn: true,
+ Email: "[email protected]",
+ OfferManaged: true,
+ DestinationOnly: true,
+ PresetDestination: destination,
+ PresetPrivacyMode: "standard",
+ BackfillDays: days,
+ })
+ model.width, model.height = 100, 30
+ model.screen = confirmScreen
+ model.result.Destination = destination
+ model.result.PrivacyMode = "standard"
+ return strings.Join(strings.Fields(model.View()), " ")
+ }
+ if view := render(DestinationAsymptote, 30); !strings.Contains(view, "It also uploads your agent sessions from the last 30 days") {
+ t.Fatalf("managed confirm screen does not name the backfill:\n%s", view)
+ }
+ if view := render(DestinationLocal, 30); !strings.Contains(view, "Beacon reads your agent sessions from the last 30 days into its local log.") {
+ t.Fatalf("local confirm screen does not name the backfill:\n%s", view)
+ }
+ for _, destination := range []string{DestinationAsymptote, DestinationLocal} {
+ if view := render(destination, 0); strings.Contains(view, "last 30 days") || strings.Contains(view, "agent sessions from") {
+ t.Fatalf("confirm screen names a backfill that is off:\n%s", view)
+ }
+ }
+ }