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
fix(hooks): write Antigravity CLI hook schema (#1219)
Lykin4fa1ae264053
diff --git a/README.md b/README.mdindex 2ed4ecaf..c1cc442f 100644--- a/README.md+++ b/README.md@@ -314,7 +314,7 @@ Beacon supports local agents, browser agents, cloud agents, CI workflows, and ag| Runtime | Collection | Session | Prompt | Tool | Command | File | Approval | MCP | Tokens | Skills || --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |-| Antigravity CLI | Hooks | ✅ | ✅ | ✅ | ✅ | ✅ | – | – | – | ✅ skills CLI |+| Antigravity CLI | Hooks | ✅ | ~ | ✅ | ✅ | ✅ | – | – | – | ✅ skills CLI || Claude Code | OTLP + hooks + poll | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ Plugin || Claude Cowork | OTLP | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ Plugin || Cline | Plugin + poll | ✅ | ✅ | ✅ | ✅ | ✅ | – | ✅ | ✅ | ✅ `.cline/skills` |diff --git a/cli/beacon-hooks/cmd/pre_tool_test.go b/cli/beacon-hooks/cmd/pre_tool_test.goindex 03aeeebe..f33da7a1 100644--- a/cli/beacon-hooks/cmd/pre_tool_test.go+++ b/cli/beacon-hooks/cmd/pre_tool_test.go@@ -10,6 +10,7 @@ import ("strings""sync""testing"+ "time""github.com/spf13/cobra"@@ -564,6 +565,55 @@ func TestRunPreToolSynthesizesAntigravityPromptFromTranscript(t *testing.T) {}}+// SessionStart runs the stale-session sweep on Antigravity as on every runtime. A conversation+// that recorded its first prompt more than two hours ago can still be resumed, so the sweep must+// keep its prompt marker, or the resumed conversation's first tool call records that prompt again.+func TestAntigravitySessionStartDoesNotReplayAnOlderPrompt(t *testing.T) {+ setupHookConfigDirs(t)+ t.Setenv("BEACON_ENDPOINT_MODE", "1")+ platformFlag = "antigravity"+ t.Cleanup(func() { platformFlag = "claude" })+ dir := t.TempDir()+ logPath := filepath.Join(dir, "runtime.jsonl")+ t.Setenv("BEACON_ENDPOINT_LOG", logPath)+ transcript := filepath.Join(dir, "transcript.jsonl")+ if err := os.WriteFile(transcript, []byte(`{"type":"USER_INPUT","content":"first prompt"}`+"\n"), 0600); err != nil {+ t.Fatal(err)+ }+ if err := hookconfig.EnsureStateDir(platformFlag); err != nil {+ t.Fatal(err)+ }+ oldTime := time.Now().Add(-3 * time.Hour).UTC().Format(time.RFC3339)+ statePath := filepath.Join(hookconfig.GetStateDir(platformFlag), "state.json")+ data := fmt.Appendf(nil, `{"old-session":{"prompt_emitted":true,"prompt_emitted_at":%q,"created_at":%q},"stale-session":{"created_at":%q}}`, oldTime, oldTime, oldTime)+ if err := os.WriteFile(statePath, data, 0600); err != nil {+ t.Fatal(err)+ }++ runHookWithInput(t, runSessionStart, map[string]interface{}{"conversationId": "new-session"})+ after, err := os.ReadFile(statePath)+ if err != nil {+ t.Fatal(err)+ }+ var sessions map[string]json.RawMessage+ if err := json.Unmarshal(after, &sessions); err != nil {+ t.Fatal(err)+ }+ if _, ok := sessions["stale-session"]; ok {+ t.Fatalf("session start did not sweep the stale session: %s", after)+ }+ if _, ok := sessions["new-session"]; !ok {+ t.Fatalf("session start did not register the new session: %s", after)+ }+ input := map[string]interface{}{"conversationId": "old-session", "transcriptPath": transcript}+ emitAntigravityPromptFromTranscript(newHookLogger("pre-tool", platformFlag, "old-session"), input, "old-session")+ for _, event := range endpointEvents(t, logPath) {+ if event["event"].(map[string]interface{})["action"] == "prompt.submitted" {+ t.Fatal("starting a new session replayed the first prompt from an older session")+ }+ }+}+// Parallel tool calls run parallel PreToolUse hooks. Each may fall back to the transcript, and the// prompt it finds must be recorded once, not once per hook that saw it unclaimed.func TestAntigravityTranscriptPromptIsRecordedOnceByParallelHooks(t *testing.T) {diff --git a/cli/beacon-hooks/internal/state/state.go b/cli/beacon-hooks/internal/state/state.goindex fc12dd14..4dd67558 100644--- a/cli/beacon-hooks/internal/state/state.go+++ b/cli/beacon-hooks/internal/state/state.go@@ -74,12 +74,22 @@ const (// re-fires over an unchanged transcript after that writes the reply again, which costs one// duplicate event rather than an unbounded state file.replyMarkerTTL = 14 * 24 * time.Hour+ // promptMarkerTTL is how long a session's first-prompt marker is remembered. Antigravity+ // recovers a session's first prompt from its transcript on the first tool call, and a+ // conversation resumed hours later still starts with that prompt; while the marker is kept it+ // is not recorded again. Past the TTL a resumed conversation records it once more, which costs+ // one duplicate event rather than an unbounded state file.+ promptMarkerTTL = 14 * 24 * time.Hour)// SessionData represents data for a single session. Older state files also carry evaluations,// reprompt_count and model keys; they are ignored on load and dropped on the next save.type SessionData struct {PromptEmitted bool `json:"prompt_emitted,omitempty"`+ // PromptEmittedAt is when PromptEmitted was set. Stale-session cleanup keeps a session whose+ // prompt marker is younger than promptMarkerTTL. Markers written before this field existed+ // carry none and are aged from CreatedAt.+ PromptEmittedAt string `json:"prompt_emitted_at,omitempty"`// LastReplyID names the last assistant reply a hook recorded for this session, so a reply read// from a transcript that has not moved since the previous turn is not recorded twice.LastReplyID string `json:"last_reply_id,omitempty"`@@ -168,7 +178,7 @@ func (s *SessionState) SetPromptEmitted() error {state := s.loadStateFile()s.ensureSession(state)- state[s.sessionID].PromptEmitted = true+ state[s.sessionID].markPromptEmitted()return s.saveStateFile(state)}@@ -180,13 +190,18 @@ func (s *SessionState) MarkPromptEmittedIfNeeded() (bool, error) {if state[s.sessionID].PromptEmitted {return false, nil}- state[s.sessionID].PromptEmitted = true+ state[s.sessionID].markPromptEmitted()if err := s.saveStateFile(state); err != nil {return false, err}return true, nil}+func (d *SessionData) markPromptEmitted() {+ d.PromptEmitted = true+ d.PromptEmittedAt = time.Now().UTC().Format(time.RFC3339)+}+// MarkReplyRecorded records id as the session's last recorded assistant reply. It reports false,// and changes nothing, when id is already the last one recorded, so a caller writes a reply at// most once even when two Stop hooks of one session race.@@ -230,7 +245,7 @@ func CleanupStaleForPlatform(platform string) int {sessionsToRemove := []string{}for sessionID, sessionData := range state {- if sessionData.hasRecentReplyMarker() {+ if sessionData.hasRecentReplyMarker() || sessionData.hasRecentPromptMarker() {continue}createdAt, err := time.Parse(time.RFC3339, sessionData.CreatedAt)@@ -264,3 +279,17 @@ func (d *SessionData) hasRecentReplyMarker() bool {at, err := time.Parse(time.RFC3339, d.LastReplyAt)return err == nil && time.Since(at) < replyMarkerTTL}++// hasRecentPromptMarker reports whether the session's first-prompt marker was set within+// promptMarkerTTL, aging a marker that predates PromptEmittedAt from CreatedAt.+func (d *SessionData) hasRecentPromptMarker() bool {+ if !d.PromptEmitted {+ return false+ }+ stamp := d.PromptEmittedAt+ if stamp == "" {+ stamp = d.CreatedAt+ }+ at, err := time.Parse(time.RFC3339, stamp)+ return err == nil && time.Since(at) < promptMarkerTTL+}diff --git a/cli/beacon-hooks/internal/state/state_test.go b/cli/beacon-hooks/internal/state/state_test.goindex 881bd95c..e1138cf4 100644--- a/cli/beacon-hooks/internal/state/state_test.go+++ b/cli/beacon-hooks/internal/state/state_test.go@@ -203,3 +203,53 @@ func TestCleanupKeepsARecentReplyMarker(t *testing.T) {t.Fatal("the reply was treated as new after cleanup")}}++// Antigravity recovers a session's first prompt from its transcript, and a conversation resumed+// after the two-hour sweep still starts with that prompt. Its marker has to survive the sweep for+// promptMarkerTTL, measured from when it was set (or, for a marker written before that was+// recorded, from the session's creation), or the resumed conversation records the prompt again.+func TestCleanupKeepsARecentPromptMarker(t *testing.T) {+ _, cleanup := setupTestStateDir(t)+ defer cleanup()++ old := time.Now().Add(-3 * time.Hour).UTC().Format(time.RFC3339)+ expired := time.Now().Add(-promptMarkerTTL - time.Hour).UTC().Format(time.RFC3339)+ st := NewSessionState("seed", "cursor")+ state := map[string]*SessionData{+ "recent-prompt": {CreatedAt: old, PromptEmitted: true, PromptEmittedAt: old},+ "legacy-prompt": {CreatedAt: old, PromptEmitted: true},+ "expired-prompt": {CreatedAt: expired, PromptEmitted: true, PromptEmittedAt: expired},+ "expired-legacy": {CreatedAt: expired, PromptEmitted: true},+ "no-prompt": {CreatedAt: old},+ }+ if err := st.saveStateFile(state); err != nil {+ t.Fatal(err)+ }++ if got := CleanupStaleForPlatform("cursor"); got != 3 {+ t.Fatalf("CleanupStaleForPlatform = %d, want 3", got)+ }++ after := st.loadStateFile()+ if after["recent-prompt"] == nil || after["legacy-prompt"] == nil {+ t.Fatalf("cleanup removed a session with a recent prompt marker: %v", after)+ }+ if claimed, _ := NewSessionState("recent-prompt", "cursor").MarkPromptEmittedIfNeeded(); claimed {+ t.Fatal("the first prompt was claimed again after cleanup")+ }+}++func TestMarkPromptEmittedRecordsWhen(t *testing.T) {+ _, cleanup := setupTestStateDir(t)+ defer cleanup()++ st := NewSessionState("s1", "cursor")+ if claimed, err := st.MarkPromptEmittedIfNeeded(); err != nil || !claimed {+ t.Fatalf("MarkPromptEmittedIfNeeded = %v, %v", claimed, err)+ }+ data := st.loadStateFile()["s1"]+ at, err := time.Parse(time.RFC3339, data.PromptEmittedAt)+ if err != nil || time.Since(at) > time.Minute {+ t.Fatalf("prompt_emitted_at = %q, want the time the marker was set", data.PromptEmittedAt)+ }+}diff --git a/cli/beacon/cmd/antigravity_target_test.go b/cli/beacon/cmd/antigravity_target_test.gonew file mode 100644index 00000000..91c415b5--- /dev/null+++ b/cli/beacon/cmd/antigravity_target_test.go@@ -0,0 +1,66 @@+package cmd++import (+ "path/filepath"+ "strings"+ "testing"++ endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/diagnostics"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/harness"+ endpointhooks "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"+)++// Antigravity never ran the grouped lifecycle schema Beacon used to write. Such a block stays+// installed so repair rewrites it, but `hooks status`, the inventory row and doctor must each say+// it needs a reinstall rather than report it as configured.+func TestLegacyAntigravityHooksAreReportedAsNeedingReinstall(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ t.Chdir(t.TempDir())+ origOpts := endpointOpts+ t.Cleanup(func() { endpointOpts = origOpts })+ endpointOpts.hookLevel = "user"+ endpointOpts.hookHarnesses = "antigravity"+ endpointOpts.allTargets = false+ endpointOpts.jsonOutput = false++ path := filepath.Join(home, ".gemini", "config", "hooks.json")+ writeTestFile(t, path, `{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`)+ want := endpointhooks.AntigravityLegacyHooksMessage(endpointhooks.LevelUser)++ out, err := captureStdout(t, func() error { return runEndpointHooksStatus(nil, nil) })+ if err != nil {+ t.Fatalf("hooks status: %v", err)+ }+ if !strings.Contains(out, "Antigravity hooks: installed=true needs_reinstall=true path="+path+"\n"+want+"\n") {+ t.Fatalf("hooks status output = %q, want the needs_reinstall line and %q", out, want)+ }++ cfg := endpointconfig.Config{LogPath: filepath.Join(home, "runtime.jsonl"), UserMode: true}+ row := hookStatusesWithConfig([]string{"antigravity"}, cfg)["antigravity"]+ if !row.Installed || row.Status != "needs_reinstall" || row.Message != want {+ t.Fatalf("inventory row = %#v, want installed, needs_reinstall and %q", row, want)+ }++ check := harnessCheck(harness.DiscoverAntigravity(), cfg.LogPath, true)+ if check.Status != diagnostics.StatusWarn || check.Message != want || check.Action != "beacon endpoint hooks install --harness antigravity_cli" {+ t.Fatalf("doctor check = %#v, want a warning carrying %q", check, want)+ }+}++func TestCurrentAntigravityHooksAreConfigured(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ origLevel := endpointOpts.hookLevel+ t.Cleanup(func() { endpointOpts.hookLevel = origLevel })+ endpointOpts.hookLevel = "user"++ writeTestFile(t, filepath.Join(home, ".gemini", "config", "hooks.json"), `{"beacon-endpoint":{"Stop":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}}`)+ cfg := endpointconfig.Config{LogPath: filepath.Join(home, "runtime.jsonl"), UserMode: true}+ if row := hookStatusesWithConfig([]string{"antigravity"}, cfg)["antigravity"]; !row.Installed || row.Status != "configured" {+ t.Fatalf("inventory row = %#v, want configured", row)+ }+}diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.goindex 02f492d7..87f68bc3 100644--- a/cli/beacon/cmd/endpoint_diagnostics.go+++ b/cli/beacon/cmd/endpoint_diagnostics.go@@ -1076,7 +1076,13 @@ func hookStatusesWithConfig(targets []string, cfg endpointconfig.Config) map[strswitch strings.TrimSpace(name) {case "antigravity":status := endpointhooks.AntigravityHookStatus(endpointhooks.AntigravityOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})- statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.ConfigPath, Raw: status}+ result := hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.ConfigPath, Raw: status}+ // Installed stays true for a legacy block so repair rewrites it, but Antigravity does+ // not run it, so it must not read as configured.+ if status.NeedsReinstall {+ result.Status = "needs_reinstall"+ }+ statuses[name] = resultcase "cursor":status := endpointhooks.CursorHookStatus(endpointhooks.CursorOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.HooksJSONPath, Raw: status}diff --git a/cli/beacon/cmd/endpoint_hooks.go b/cli/beacon/cmd/endpoint_hooks.goindex 0eda3c5c..b7b18a5b 100644--- a/cli/beacon/cmd/endpoint_hooks.go+++ b/cli/beacon/cmd/endpoint_hooks.go@@ -816,7 +816,11 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {switch strings.TrimSpace(name) {case "antigravity":status := statuses["antigravity"].(endpointhooks.AntigravityStatus)- fmt.Printf("Antigravity hooks: installed=%t path=%s\n", status.Installed, status.ConfigPath)+ fmt.Printf("Antigravity hooks: installed=%t", status.Installed)+ if status.NeedsReinstall {+ fmt.Print(" needs_reinstall=true")+ }+ fmt.Printf(" path=%s\n", status.ConfigPath)fmt.Println(status.Message)case "cursor":status := statuses["cursor"].(endpointhooks.CursorStatus)diff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.goindex 48eedf15..08ab1211 100644--- a/cli/beacon/cmd/endpoint_test.go+++ b/cli/beacon/cmd/endpoint_test.go@@ -1193,6 +1193,7 @@ func TestRepairInstalledEndpointHooksDetectsAlreadyInstalledBeaconHooks(t *testiwriteTestFile(t, filepath.Join(home, ".claude", "settings.json"), `{"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"echo keep"},{"type":"command","command":"BEACON_ENDPOINT_MODE=1 old-beacon-hooks --platform claude session-start"}]}]}}`)writeTestFile(t, filepath.Join(home, ".codex", "hooks.json"), `{"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"echo keep"}]}]}}`)writeTestFile(t, filepath.Join(home, ".factory", "settings.json"), `{"hooks":{"PostToolUse":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform factory post-tool"}]}]}}`)+ writeTestFile(t, filepath.Join(home, ".gemini", "config", "hooks.json"), `{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`)activeConsoleUser = func() (consoleUserInfo, bool, error) {return consoleUserInfo{Username: "shad", HomeDir: home}, true, nil}@@ -1209,10 +1210,10 @@ func TestRepairInstalledEndpointHooksDetectsAlreadyInstalledBeaconHooks(t *testiif err != nil {t.Fatalf("repairInstalledEndpointHooks returned error: %v", err)}- if strings.Join(result.Targets, ",") != "claude,factory" {- t.Fatalf("targets = %#v, want claude,factory", result.Targets)+ if strings.Join(result.Targets, ",") != "claude,factory,antigravity" {+ t.Fatalf("targets = %#v, want claude,factory,antigravity", result.Targets)}- wantArgs := []string{"endpoint", "hooks", "install", "--harness", "claude,factory", "--level", "user", "--log-path", logPath}+ wantArgs := []string{"endpoint", "hooks", "install", "--harness", "claude,factory,antigravity", "--level", "user", "--log-path", logPath}if strings.Join(gotArgs, "\x00") != strings.Join(wantArgs, "\x00") {t.Fatalf("repair args = %#v, want %#v", gotArgs, wantArgs)}diff --git a/cli/beacon/internal/endpoint/dashboard/hooks_status_test.go b/cli/beacon/internal/endpoint/dashboard/hooks_status_test.goindex 97e00aa0..2f8b7b57 100644--- a/cli/beacon/internal/endpoint/dashboard/hooks_status_test.go+++ b/cli/beacon/internal/endpoint/dashboard/hooks_status_test.go@@ -89,3 +89,30 @@ func TestHookStatusesListEachRuntimeOnceWithItsPath(t *testing.T) {}}}++// Legacy Antigravity hooks stay installed so repair rewrites them, but Antigravity does not run+// them, so the row must not read as configured and must carry the reinstall message.+func TestHookStatusesFlagLegacyAntigravityHooks(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ path := filepath.Join(home, ".gemini", "config", "hooks.json")+ if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {+ t.Fatal(err)+ }+ legacy := `{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`+ if err := os.WriteFile(path, []byte(legacy), 0o600); err != nil {+ t.Fatal(err)+ }++ for _, status := range hookStatuses(filepath.Join(t.TempDir(), "runtime.jsonl"), true) {+ if status.Target != "antigravity" {+ continue+ }+ if !status.Installed || status.Status != "needs_reinstall" || status.Message != endpointhooks.AntigravityLegacyHooksMessage(endpointhooks.LevelUser) {+ t.Fatalf("antigravity row = %#v, want installed, needs_reinstall and the reinstall message", status)+ }+ return+ }+ t.Fatal("antigravity is missing from the hook status list")+}diff --git a/cli/beacon/internal/endpoint/dashboard/server.go b/cli/beacon/internal/endpoint/dashboard/server.goindex b07b4199..7c8ae720 100644--- a/cli/beacon/internal/endpoint/dashboard/server.go+++ b/cli/beacon/internal/endpoint/dashboard/server.go@@ -552,6 +552,10 @@ func hookStatuses(logPath string, userMode bool) []HookStatus {level := endpointhooks.LevelUserantigravity := endpointhooks.AntigravityHookStatus(endpointhooks.AntigravityOptions{Level: level, LogPath: logPath, UserMode: userMode})add("antigravity", antigravity.Installed, antigravity.ConfigPath, antigravity.BinaryPath, antigravity.Message)+ if antigravity.NeedsReinstall {+ // Installed, so repair rewrites the block, but Antigravity does not run its legacy schema.+ out[len(out)-1].Status = "needs_reinstall"+ }cline := endpointhooks.ClineHookStatus(endpointhooks.ClineOptions{Level: level, LogPath: logPath, UserMode: userMode})add("cline", cline.Installed, cline.PluginPath, cline.BinaryPath, cline.Message)cursor := endpointhooks.CursorHookStatus(endpointhooks.CursorOptions{Level: level, LogPath: logPath, UserMode: userMode})diff --git a/cli/beacon/internal/endpoint/dashboard/static/app.js b/cli/beacon/internal/endpoint/dashboard/static/app.jsindex d301cc86..17186585 100644--- a/cli/beacon/internal/endpoint/dashboard/static/app.js+++ b/cli/beacon/internal/endpoint/dashboard/static/app.js@@ -1021,7 +1021,7 @@ function inventoryTableForView(view, ctx) {...inventoryIdentityColumns(),{ label: "Agent Runtime", render: (row) => inventoryRuntimeCell(inventoryRuntimeValue(row)) },{ label: "Scope", render: (row) => row.source_scope || row.scope ? badge(row.source_scope || row.scope, "badge-muted") : `<span class="muted">-</span>` },- { label: "Status", render: (row) => badge(row.status || (row.installed ? "configured" : "not_installed"), row.installed ? "badge-ok" : "badge-muted") },+ { label: "Status", render: (row) => hookStatusBadge(row) },{ label: "Beacon Cloud", render: (row) => row.beacon_managed ? badge("managed", "badge-ok") : `<span class="muted">no</span>` },{ label: "Modified", className: "nowrap", render: (row) => row.modified_at ? escapeHTML(formatTime(row.modified_at)) : `<span class="muted">-</span>` },{ label: "Manifest SHA", className: "mono sha-cell", render: (row) => hashCell(row.file_sha256 || row.path_hash) },@@ -1309,7 +1309,7 @@ function renderInventoryHooks(hooks, configs = []) {<tr class="${hook.installed ? "" : "row-absent"}"><td>${escapeHTML(runtimeLabel(hook.target))}</td><td>${config.scope ? badge(config.scope, "badge-muted") : `<span class="muted">-</span>`}</td>- <td>${badge(hook.status || (hook.installed ? "configured" : "not_installed"), hook.installed ? "badge-ok" : "badge-muted")}</td>+ <td>${hookStatusBadge(hook)}</td><td>${config.beacon_managed ? badge("managed", "badge-ok") : `<span class="muted">no</span>`}</td><td class="nowrap">${config.modified_at ? escapeHTML(formatTime(config.modified_at)) : `<span class="muted">-</span>`}</td><td class="mono sha-cell">${hashCell(config.file_sha256)}</td>@@ -1358,7 +1358,7 @@ function renderHookTargets(hooks, configs = []) {return `<tr class="${hook.installed ? "" : "row-absent"}"><td>${escapeHTML(runtimeLabel(hook.target))}</td>- <td>${badge(hook.status || (hook.installed ? "configured" : "not_installed"), hook.installed ? "badge-ok" : "badge-muted")}</td>+ <td>${hookStatusBadge(hook)}</td><td>${config.scope ? badge(config.scope, "badge-muted") : `<span class="muted">-</span>`}</td><td>${config.beacon_managed ? badge("managed", "badge-ok") : `<span class="muted">no</span>`}</td><td class="mono path-cell">${hook.binary_path ? escapeHTML(hook.binary_path) : `<span class="muted">-</span>`}</td>@@ -1416,6 +1416,14 @@ function telemetryBadge(status, detected) {return badge(status || "unknown", classes[status] || "badge-muted");}+// A hook that needs a reinstall is still installed (repair rewrites it) but does not run, so it+// reads as a warning rather than as configured.+function hookStatusBadge(hook) {+ const status = hook.status || (hook.installed ? "configured" : "not_installed");+ if (status === "needs_reinstall") return badge("needs reinstall", "badge-warn");+ return badge(status, hook.installed ? "badge-ok" : "badge-muted");+}+function parserBadge(config) {const status = config.parser_status || "unknown";const cls =diff --git a/cli/beacon/internal/endpoint/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.goindex 1b2946fb..78e94444 100644--- a/cli/beacon/internal/endpoint/harness/harness.go+++ b/cli/beacon/internal/endpoint/harness/harness.go@@ -99,14 +99,16 @@ func DiscoverAntigravity() Harness {userConfig := filepath.Join(home, ".gemini", "config", "hooks.json")projectConfig := filepath.Join(".agents", "hooks.json")h.ConfigPath = userConfig+ level := hooks.LevelUserif fileExists(projectConfig) {h.ConfigPath = projectConfig+ level = hooks.LevelProject}if !h.Detected && (dirExists(filepath.Join(home, ".gemini", "config")) || dirExists(".agents")) {h.Detected = true}if fileExists(h.ConfigPath) {- status, msg := antigravityStatus(h.ConfigPath)+ status, msg := antigravityStatus(h.ConfigPath, level)h.TelemetryStatus = statush.Message = msg} else {@@ -730,27 +732,22 @@ func hasBeaconHermesHooks(data []byte) (bool, error) {return false, nil}-func antigravityStatus(path string) (TelemetryStatus, string) {+func antigravityStatus(path string, level hooks.Level) (TelemetryStatus, string) {data, err := os.ReadFile(path)if err != nil {return TelemetryMissing, err.Error()}- hasHooks, err := hasBeaconAntigravityHooks(data)+ current, legacy, err := hooks.AntigravityConfigEndpointHooks(data)if err != nil {return TelemetryMisconfigured, "Antigravity hooks JSON is invalid"}- if hasHooks {+ if current {return TelemetryEnabled, "Antigravity endpoint hooks are configured"}- return TelemetryDisabled, "Antigravity hooks exist but endpoint hooks were not found"-}--func hasBeaconAntigravityHooks(data []byte) (bool, error) {- var blocks map[string]json.RawMessage- if err := json.Unmarshal(data, &blocks); err != nil {- return false, err+ if legacy {+ return TelemetryDisabled, hooks.AntigravityLegacyHooksMessage(level)}- return hooks.ConfigHasEndpointHook(data, "antigravity")+ return TelemetryDisabled, "Antigravity hooks exist but endpoint hooks were not found"}func shellExportValue(text, key string) string {diff --git a/cli/beacon/internal/endpoint/harness/hook_only_test.go b/cli/beacon/internal/endpoint/harness/hook_only_test.goindex 4a3b27bd..1cf03199 100644--- a/cli/beacon/internal/endpoint/harness/hook_only_test.go+++ b/cli/beacon/internal/endpoint/harness/hook_only_test.go@@ -39,6 +39,27 @@ func TestDiscoverAntigravityDetectsAgyOnPath(t *testing.T) {}}+// Beacon hooks written in the legacy grouped schema are never run by Antigravity, so discovery must+// not report them as enabled, and its message must say why and how to rewrite them.+func TestDiscoverAntigravityReportsLegacyHooks(t *testing.T) {+ home := setupHookOnlyDiscovery(t)+ t.Chdir(t.TempDir())+ path := filepath.Join(home, ".gemini", "config", "hooks.json")+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {+ t.Fatal(err)+ }+ legacy := `{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`+ if err := os.WriteFile(path, []byte(legacy), 0600); err != nil {+ t.Fatal(err)+ }++ got := DiscoverAntigravity()+ const want = "Beacon's Antigravity CLI hooks use the legacy schema, which Antigravity does not run; rerun beacon endpoint hooks install --harness antigravity to rewrite them"+ if got.TelemetryStatus != TelemetryDisabled || got.Message != want {+ t.Fatalf("DiscoverAntigravity() = %q (%s), want %q (%s)", got.TelemetryStatus, got.Message, TelemetryDisabled, want)+ }+}+func TestDiscoverKiroDetectsProfileDirectory(t *testing.T) {home := setupHookOnlyDiscovery(t)if err := os.MkdirAll(filepath.Join(home, ".kiro"), 0755); err != nil {diff --git a/cli/beacon/internal/endpoint/hooks/antigravity.go b/cli/beacon/internal/endpoint/hooks/antigravity.goindex bbc89784..df0bfd65 100644--- a/cli/beacon/internal/endpoint/hooks/antigravity.go+++ b/cli/beacon/internal/endpoint/hooks/antigravity.go@@ -18,10 +18,13 @@ type AntigravityOptions struct {}type AntigravityStatus struct {- Installed bool `json:"installed"`- BinaryPath string `json:"binary_path,omitempty"`- ConfigPath string `json:"config_path,omitempty"`- Message string `json:"message,omitempty"`+ Installed bool `json:"installed"`+ // NeedsReinstall reports that Beacon's managed block uses the legacy grouped lifecycle schema,+ // which Antigravity does not run. Installed stays true so repair still rewrites the block.+ NeedsReinstall bool `json:"needs_reinstall,omitempty"`+ BinaryPath string `json:"binary_path,omitempty"`+ ConfigPath string `json:"config_path,omitempty"`+ Message string `json:"message,omitempty"`}type antigravityHookGroup struct {@@ -30,18 +33,19 @@ type antigravityHookGroup struct {}type antigravityHookRef struct {- Type string `json:"type,omitempty"`- Command string `json:"command"`- Timeout int `json:"timeout,omitempty"`+ Type string `json:"type,omitempty"`+ Command string `json:"command"`+ Timeout int `json:"timeout,omitempty"`+ Hooks []antigravityHookRef `json:"hooks,omitempty"`}type antigravityHookBlock struct {- PreInvocation []antigravityHookGroup `json:"PreInvocation,omitempty"`- UserPromptSubmit []antigravityHookGroup `json:"UserPromptSubmit,omitempty"`- PostInvocation []antigravityHookGroup `json:"PostInvocation,omitempty"`- PreToolUse []antigravityHookGroup `json:"PreToolUse,omitempty"`- PostToolUse []antigravityHookGroup `json:"PostToolUse,omitempty"`- Stop []antigravityHookGroup `json:"Stop,omitempty"`+ SessionStart []antigravityHookRef `json:"SessionStart,omitempty"`+ PreInvocation []antigravityHookRef `json:"PreInvocation,omitempty"`+ PostInvocation []antigravityHookRef `json:"PostInvocation,omitempty"`+ PreToolUse []antigravityHookGroup `json:"PreToolUse,omitempty"`+ PostToolUse []antigravityHookGroup `json:"PostToolUse,omitempty"`+ Stop []antigravityHookRef `json:"Stop,omitempty"`}type antigravityConfig struct {@@ -73,7 +77,24 @@ func UninstallAntigravity(opts AntigravityOptions) (AntigravityStatus, error) {}func AntigravityHookStatus(opts AntigravityOptions) AntigravityStatus {- return antigravityStatusFromRuntime(runtimeHookStatus(antigravityRuntime, RuntimeOptions(opts)))+ status := antigravityStatusFromRuntime(runtimeHookStatus(antigravityRuntime, RuntimeOptions(opts)))+ if status.Installed {+ if _, legacy := antigravityManagedHookState(status.ConfigPath); legacy {+ status.NeedsReinstall = true+ status.Message = AntigravityLegacyHooksMessage(opts.Level)+ }+ }+ return status+}++// AntigravityLegacyHooksMessage explains a Beacon hook block written in the legacy grouped+// lifecycle schema and names the command that rewrites it at level.+func AntigravityLegacyHooksMessage(level Level) string {+ command := "beacon endpoint hooks install --harness antigravity"+ if level == LevelProject {+ command += " --level project"+ }+ return "Beacon's Antigravity CLI hooks use the legacy schema, which Antigravity does not run; rerun " + command + " to rewrite them"}func IsAntigravityInstalled(opts AntigravityOptions) bool {@@ -96,24 +117,16 @@ func installAntigravityHooks(path, binaryPath, logPath, configPath string) error}prefix := endpointCommandPrefix("antigravity", binaryPath, logPath, configPath)block := antigravityHookBlock{- PreInvocation: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " prompt-submit", Timeout: 30}},- }},- UserPromptSubmit: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " prompt-submit", Timeout: 30}},- }},+ SessionStart: []antigravityHookRef{{Type: "command", Command: prefix + " session-start"}},PreToolUse: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " pre-tool"}},+ Matcher: "*",+ Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " pre-tool"}},}},PostToolUse: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " post-tool"}},- }},- PostInvocation: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " stop", Timeout: 45}},- }},- Stop: []antigravityHookGroup{{- Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " stop", Timeout: 45}},+ Matcher: "*",+ Hooks: []antigravityHookRef{{Type: "command", Command: prefix + " post-tool"}},}},+ Stop: []antigravityHookRef{{Type: "command", Command: prefix + " stop", Timeout: 45}},}data, err := json.Marshal(block)if err != nil {@@ -173,39 +186,81 @@ func removeAntigravityEndpointHooks(path string) (bool, error) {}func isAntigravityInstalledAt(path string) bool {+ installed, _ := antigravityManagedHookState(path)+ return installed+}++// antigravityManagedHookState reports whether Beacon's managed block names an endpoint hook, in+// either schema, and whether that block uses the legacy grouped schema Antigravity does not run.+// A legacy block still counts as installed so that repair targets and rewrites it.+func antigravityManagedHookState(path string) (installed, legacy bool) {config, err := readAntigravityConfig(path)if err != nil {- return false+ return false, false}raw, ok := config.values[antigravityBeaconHookName]if !ok {- return false+ return false, false}- return hasAntigravityEndpointHook(raw)+ found, legacy := antigravityEndpointHookShape(raw)+ return found, found && legacy}-func hasAntigravityEndpointHook(raw json.RawMessage) bool {+// AntigravityConfigEndpointHooks reports whether any block of an Antigravity hooks.json document+// names a Beacon endpoint hook in the schema Antigravity runs (current), and whether one names it+// only in the legacy grouped lifecycle schema, which Antigravity does not run (legacy). The error+// is the document's parse error.+func AntigravityConfigEndpointHooks(data []byte) (current, legacy bool, err error) {+ var blocks map[string]json.RawMessage+ if err := json.Unmarshal(data, &blocks); err != nil {+ return false, false, err+ }+ for _, block := range blocks {+ found, grouped := antigravityEndpointHookShape(block)+ if !found {+ continue+ }+ if grouped {+ legacy = true+ } else {+ current = true+ }+ }+ return current, legacy, nil+}++// antigravityEndpointHookShape reports whether a hooks block names a Beacon endpoint command+// anywhere, and whether a lifecycle event in it lists {"hooks": [...]} groups where Antigravity+// expects handlers. Antigravity does not run a block in that legacy shape.+func antigravityEndpointHookShape(raw json.RawMessage) (found, legacy bool) {var block antigravityHookBlockif err := json.Unmarshal(raw, &block); err != nil {- return false+ return false, false}- for _, groups := range [][]antigravityHookGroup{+ for _, hooks := range [][]antigravityHookRef{+ block.SessionStart,block.PreInvocation,- block.UserPromptSubmit,block.PostInvocation,- block.PreToolUse,- block.PostToolUse,block.Stop,} {+ for _, hook := range hooks {+ if hook.Hooks != nil {+ legacy = true+ for _, grouped := range hook.Hooks {+ found = found || hookcmd.IsEndpointHook(grouped.Command, "antigravity")+ }+ }+ found = found || hookcmd.IsEndpointHook(hook.Command, "antigravity")+ }+ }+ for _, groups := range [][]antigravityHookGroup{block.PreToolUse, block.PostToolUse} {for _, group := range groups {for _, hook := range group.Hooks {- if hookcmd.IsEndpointHook(hook.Command, "antigravity") {- return true- }+ found = found || hookcmd.IsEndpointHook(hook.Command, "antigravity")}}}- return false+ return found, legacy}func antigravityConfigPath(level Level) (string, error) {diff --git a/cli/beacon/internal/endpoint/hooks/antigravity_test.go b/cli/beacon/internal/endpoint/hooks/antigravity_test.goindex 85d83736..79d8e0bc 100644--- a/cli/beacon/internal/endpoint/hooks/antigravity_test.go+++ b/cli/beacon/internal/endpoint/hooks/antigravity_test.go@@ -1,11 +1,13 @@package hooksimport (- "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"+ "encoding/json""os""path/filepath""strings""testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv")func TestInstallAntigravityHooksPreservesNonBeaconBlocks(t *testing.T) {@@ -30,17 +32,47 @@ func TestInstallAntigravityHooksPreservesNonBeaconBlocks(t *testing.T) {"--log '/tmp/runtime.jsonl'","--config '/tmp/config.json'","'/tmp/beacon hooks' --platform antigravity",- "PreInvocation",- "UserPromptSubmit",- "PreToolUse",- "PostToolUse",- "PostInvocation",- "Stop",} {if !strings.Contains(text, want) {t.Fatalf("Antigravity hooks missing %q:\n%s", want, text)}}+ var blocks map[string]map[string]json.RawMessage+ if err := json.Unmarshal(data, &blocks); err != nil {+ t.Fatal(err)+ }+ managed := blocks["beacon-endpoint"]+ if len(managed) != 4 {+ t.Errorf("managed hook events = %v, want four lifecycle and tool events", managed)+ }+ type handler struct {+ Type string `json:"type"`+ Command string `json:"command"`+ }+ for event, suffix := range map[string]string{"SessionStart": " session-start", "Stop": " stop"} {+ var handlers []handler+ if err := json.Unmarshal(managed[event], &handlers); err != nil {+ t.Errorf("%s must be a direct handler list: %v", event, err)+ continue+ }+ if len(handlers) != 1 || handlers[0].Type != "command" || !strings.HasSuffix(handlers[0].Command, suffix) {+ t.Errorf("%s handlers = %#v, want one command ending in %q", event, handlers, suffix)+ }+ }+ for event, suffix := range map[string]string{"PreToolUse": " pre-tool", "PostToolUse": " post-tool"} {+ var groups []struct {+ Matcher string `json:"matcher"`+ Hooks []handler `json:"hooks"`+ }+ if err := json.Unmarshal(managed[event], &groups); err != nil {+ t.Errorf("%s must be a matcher group list: %v", event, err)+ continue+ }+ if len(groups) != 1 || groups[0].Matcher != "*" || len(groups[0].Hooks) != 1 ||+ groups[0].Hooks[0].Type != "command" || !strings.HasSuffix(groups[0].Hooks[0].Command, suffix) {+ t.Errorf("%s groups = %#v, want a wildcard group with one command ending in %q", event, groups, suffix)+ }+ }}func TestInstallAntigravityHooksReplacesManagedBlock(t *testing.T) {@@ -50,9 +82,15 @@ func TestInstallAntigravityHooksReplacesManagedBlock(t *testing.T) {t.Fatal(err)}+ if !isAntigravityInstalledAt(path) {+ t.Error("managed legacy grouped Stop must remain eligible for repair")+ }if err := installAntigravityHooks(path, "/tmp/new-beacon-hooks", "/tmp/runtime.jsonl", "/tmp/config.json"); err != nil {t.Fatalf("installAntigravityHooks returned error: %v", err)}+ if !isAntigravityInstalledAt(path) {+ t.Error("refreshed hooks were not detected")+ }data, err := os.ReadFile(path)if err != nil {t.Fatalf("read hooks: %v", err)@@ -133,15 +171,63 @@ func TestAntigravityHookStatusDetectsInstalled(t *testing.T) {if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {t.Fatal(err)}- if err := os.WriteFile(path, []byte(`{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`), 0600); err != nil {+ if err := os.WriteFile(path, []byte(`{"beacon-endpoint":{"Stop":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}}`), 0600); err != nil {t.Fatal(err)}status := AntigravityHookStatus(AntigravityOptions{Level: LevelUser, UserMode: true})- if !status.Installed {- t.Fatalf("AntigravityHookStatus installed = false, status=%#v", status)+ if !status.Installed || status.NeedsReinstall {+ t.Fatalf("AntigravityHookStatus = %#v, want installed in the current schema", status)}if status.ConfigPath != path {t.Fatalf("ConfigPath = %q, want %q", status.ConfigPath, path)}}++// A managed block in the legacy grouped schema stays installed, so repair rewrites it, but+// Antigravity never runs it, so status must say so and name the command that rewrites it.+func TestAntigravityHookStatusReportsLegacySchema(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ path := filepath.Join(home, ".gemini", "config", "hooks.json")+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(path, []byte(`{"beacon-endpoint":{"Stop":[{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"}]}]}}`), 0600); err != nil {+ t.Fatal(err)+ }++ status := AntigravityHookStatus(AntigravityOptions{Level: LevelUser, UserMode: true})+ if !status.Installed || !status.NeedsReinstall {+ t.Fatalf("AntigravityHookStatus = %#v, want installed and needing a reinstall", status)+ }+ const want = "Beacon's Antigravity CLI hooks use the legacy schema, which Antigravity does not run; rerun beacon endpoint hooks install --harness antigravity to rewrite them"+ if status.Message != want {+ t.Fatalf("Message = %q, want %q", status.Message, want)+ }+ if got := AntigravityLegacyHooksMessage(LevelProject); !strings.Contains(got, "--harness antigravity --level project ") {+ t.Fatalf("project-level message = %q, want the project-level install command", got)+ }+}++func TestAntigravityConfigEndpointHooks(t *testing.T) {+ const command = `"command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform antigravity stop"`+ for _, tc := range []struct {+ name string+ config string+ wantCurrent, wantLegacy bool+ }{+ {"legacy", `{"beacon-endpoint":{"Stop":[{"hooks":[{` + command + `}]}],"PreToolUse":[{"hooks":[{` + command + `}]}]}}`, false, true},+ {"unsupported event", `{"beacon-endpoint":{"UserPromptSubmit":[{` + command + `}]}}`, false, false},+ {"custom block", `{"custom":{"Stop":[{` + command + `}]}}`, true, false},+ {"custom block with non-command handler", `{"custom":{"Stop":[{"type":"other"},{` + command + `}]}}`, true, false},+ {"someone else's legacy block", `{"custom":{"Stop":[{"hooks":[{"command":"echo keep"}]}]}}`, false, false},+ } {+ t.Run(tc.name, func(t *testing.T) {+ current, legacy, err := AntigravityConfigEndpointHooks([]byte(tc.config))+ if err != nil || current != tc.wantCurrent || legacy != tc.wantLegacy {+ t.Fatalf("current = %v, legacy = %v, err = %v, want %v, %v", current, legacy, err, tc.wantCurrent, tc.wantLegacy)+ }+ })+ }+}diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 3ae945b7..08fa67c5 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -13,6 +13,8 @@ Stay up to date with the latest changes to the Agent Beacon CLI.Changes on `main` since v1.3.58. They ship in the next release.+- **Antigravity CLI hooks now run** · Beacon wrote its Antigravity hooks to `~/.gemini/config/hooks.json` and `./.agents/hooks.json` in a grouped lifecycle schema that Antigravity does not run, so none of them ever fired and Antigravity sessions recorded nothing. `beacon endpoint hooks install --harness antigravity` now writes the schema Antigravity runs: `SessionStart` and `Stop` handlers, and `PreToolUse` and `PostToolUse` for every tool. The first prompt of a session is recovered from its transcript on the first tool call, and is recorded once even when the conversation is resumed up to 14 days later. Hooks in the old schema are reported as needing a reinstall: `beacon endpoint hooks status` shows `needs_reinstall=true`, discovery and `beacon endpoint doctor` warn that Beacon's Antigravity hooks use the legacy schema, and the dashboard marks them. Package repair rewrites user-level hooks; for project-level hooks, rerun `beacon endpoint hooks install --harness antigravity --level project`.+- **Beacon leaves your own hooks alone when their command mentions `beacon-hooks`** · Install, repair and uninstall used to claim any hook whose command merely contained `beacon-hooks` -- a script like `~/scripts/my-beacon-hooks-wrapper.sh`, `echo beacon-hooks`, or a log file named `beacon-hooks.log` -- as one Beacon had written, so they overwrote or deleted it, and the DeepSeek Harness and Kiro installers replaced a hooks file they should have refused to touch. A hook now counts as Beacon's only when the program it runs is the hooks binary itself and the command carries the endpoint settings an install writes. This applies to every runtime (Cursor, Hermes, VS Code, Kimi Code, OpenHands, Devin, DeepSeek Harness, Kiro and the rest), and `beacon endpoint hooks status` and discovery agree with what uninstall would remove.- **Redaction covers snake_case secret flags and Stripe webhook secrets, and keeps a URL's other query parameters** · Flags written in snake_case or named for key material (`--client_secret`, `--api_key`, `--private-key`, `--secret-key`) have their values redacted, and so do Stripe webhook signing secrets (`whsec_…`). A secret passed as a URL query parameter (`?api_key=…&user=alice`) is redacted up to the next `&` or `#`, so the parameters after it stay readable; after any other label, `#`, `&` and `?` are still part of the redacted value. A diff line such as `-SECRET_KEY = '…'` keeps its `=`.diff --git a/docs/cli/hooks.mdx b/docs/cli/hooks.mdxindex 6f6af24f..cc55fa5d 100644--- a/docs/cli/hooks.mdx+++ b/docs/cli/hooks.mdx@@ -75,7 +75,7 @@ Beacon validates the embedded `beacon-hooks` binary before writing hook configurbeacon endpoint hooks install --harness cursor```-The hook adapter records local endpoint events for sessions, prompt submission, tool use, command execution, MCP-like tool activity, approval decisions, permissions, diffs, and file edits where the selected runtime exposes those hook payloads. Antigravity hooks cover `PreInvocation`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostInvocation`, and `Stop`. Claude Code hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Stop`, `SubagentStart`, `SubagentStop`, `PermissionRequest`, and `SessionEnd`. Codex CLI uses `SessionStart` for metadata-only OS-user context; Codex prompt, tool, and token telemetry still comes from its local OpenTelemetry export path, and inventory comes from the scheduled inventory job rather than a hook. Devin CLI hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PermissionRequest`, `PostToolUse`, `Stop`, and `SessionEnd`. Devin Desktop hooks use Cascade/Windsurf payloads for prompt submission, file writes, command execution, MCP tool use, and file reads. Factory hooks cover `SessionStart`, `UserPromptSubmit`, `PostToolUse` for write/edit/create operations, `Stop`, and `SessionEnd`. Grok Build hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Stop`, and `SessionEnd`. Hermes Agent hooks cover session lifecycle, `pre_llm_call`, `pre_tool_call`, `post_tool_call`, approval request and response, and subagent stop events. OpenCode hooks use Beacon's managed local plugin to forward `chat.message`, session, command, permission, diff, and error events. Cline hooks use Beacon's managed local plugin to forward `beforeRun`, `beforeTool`, `afterTool`, and `afterRun`, and also accept Cline's file-based hook names (`TaskStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`) so one adapter serves both of Cline's hook surfaces.+The hook adapter records local endpoint events for sessions, prompt submission, tool use, command execution, MCP-like tool activity, approval decisions, permissions, diffs, and file edits where the selected runtime exposes those hook payloads. Antigravity hooks cover `SessionStart`, `PreToolUse`, `PostToolUse`, and `Stop`; Antigravity's prompt is recovered from the session transcript on the first tool call, so only the first prompt of a session is recorded. Claude Code hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Stop`, `SubagentStart`, `SubagentStop`, `PermissionRequest`, and `SessionEnd`. Codex CLI uses `SessionStart` for metadata-only OS-user context; Codex prompt, tool, and token telemetry still comes from its local OpenTelemetry export path, and inventory comes from the scheduled inventory job rather than a hook. Devin CLI hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PermissionRequest`, `PostToolUse`, `Stop`, and `SessionEnd`. Devin Desktop hooks use Cascade/Windsurf payloads for prompt submission, file writes, command execution, MCP tool use, and file reads. Factory hooks cover `SessionStart`, `UserPromptSubmit`, `PostToolUse` for write/edit/create operations, `Stop`, and `SessionEnd`. Grok Build hooks cover `SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `Stop`, and `SessionEnd`. Hermes Agent hooks cover session lifecycle, `pre_llm_call`, `pre_tool_call`, `post_tool_call`, approval request and response, and subagent stop events. OpenCode hooks use Beacon's managed local plugin to forward `chat.message`, session, command, permission, diff, and error events. Cline hooks use Beacon's managed local plugin to forward `beforeRun`, `beforeTool`, `afterTool`, and `afterRun`, and also accept Cline's file-based hook names (`TaskStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`) so one adapter serves both of Cline's hook surfaces.### Examplesdiff --git a/docs/runtimes/antigravity-cli.mdx b/docs/runtimes/antigravity-cli.mdxindex cf511a36..0f51e882 100644--- a/docs/runtimes/antigravity-cli.mdx+++ b/docs/runtimes/antigravity-cli.mdx@@ -47,18 +47,20 @@ Beacon writes user-level Antigravity hooks to `~/.gemini/config/hooks.json` and| Area | Support ||------|---------|-| Prompt telemetry | Supported through `PreInvocation` and `UserPromptSubmit` hooks |-| Command, tool, and file telemetry | Supported for pre-tool, post-tool, invocation stop, command, failed edit, quoted path, diff, and file edit payloads where Antigravity exposes them |+| Prompt telemetry | The first prompt in a session can be recovered from the transcript by `PreToolUse`. Sessions without tool calls do not use this fallback |+| Session, command, tool, and file telemetry | Uses `SessionStart`, `PreToolUse`, `PostToolUse`, and `Stop`, where Antigravity emits those hooks and exposes the corresponding payloads || Approvals | Not recorded or synthesized. The `PreToolUse` hook writes nothing to stdout, so Antigravity's own permission settings decide every call: Antigravity reads a hook's `allow` as approving the call automatically and an object without a decision as a deny. A deny from a `BEACON_POLICY_PROVIDER` policy provider still returns `{"decision":"deny"}` || Local JSONL and dashboard | Supported || MDM deployment | Supported for the endpoint agent. Antigravity hooks are installed separately in the logged-in user's context or project context |-Antigravity can invoke a pre-tool hook before its transcript file contains readable prompt text. Beacon waits until the transcript is available before marking `prompt.submitted` as emitted, so the next hook in the same session can still record the prompt event.+Antigravity can invoke a pre-tool hook before its transcript file contains readable prompt text. Beacon waits until the transcript is available before marking `prompt.submitted` as emitted, so the next hook in the same session can still record the prompt event. Beacon remembers that a session's first prompt was recorded for 14 days, so a conversation resumed within that time does not record it again.## Deployment notesRestart Antigravity after installing or removing hooks so new sessions pick up the updated hook configuration.+Earlier Beacon releases wrote the Antigravity hooks with grouped lifecycle handlers, which Antigravity does not run. `beacon endpoint hooks status --harness antigravity` reports such hooks as `installed=true needs_reinstall=true`, discovery and `beacon endpoint doctor` report Antigravity telemetry as disabled with a warning, and the dashboard shows the hooks as needing a reinstall. Package repair rewrites older managed user-level hooks. For project-level or manual installs, rerun `beacon endpoint hooks install --harness antigravity` at the same level to rewrite the managed block.+If Antigravity telemetry is missing, check the selected hook level, confirm the hook file contains commands with `--platform antigravity`, and run `beacon endpoint hooks status --harness antigravity`.## Relateddiff --git a/docs/runtimes/index.mdx b/docs/runtimes/index.mdxindex d1e27153..d2927aea 100644--- a/docs/runtimes/index.mdx+++ b/docs/runtimes/index.mdx@@ -20,7 +20,7 @@ These integrations are grouped by where the agent runs and how telemetry is coll| Agent harness | Collection path | Telemetry coverage ||----------------|-----------------|--------------------|-| [Antigravity CLI](/runtimes/antigravity-cli) | Native hooks | Prompt, pre-tool, post-tool, stop, invocation, command, and file telemetry where Antigravity exposes hook payloads |+| [Antigravity CLI](/runtimes/antigravity-cli) | Native hooks | Session, pre-tool, post-tool, stop, command, and file telemetry where Antigravity exposes hook payloads. Prompt capture is limited to the first prompt of a session, recovered from the transcript on its first tool call || [Claude Code](/runtimes/claude-code) | Local OTLP export plus optional hooks and poll of `~/.claude/projects` through `beacon endpoint claude sync` | OTLP/hooks: prompt, command, tool, file, lifecycle, subagent, permission, token, and cost telemetry. Poll: historical prompts, assistant messages, tool results, commands, files, MCP-shaped activity, sidechains, and session lifecycle where persisted || [Cline](/runtimes/cline) | Managed plugin hooks plus optional poll of Cline's local task/session stores through `beacon endpoint cline sync` | Plugin: prompts, task lifecycle, tool lifecycle, commands, file reads and edits with diffs, MCP activity, and token usage. Poll: historical prompts, assistant messages, reasoning, tool results, commands, files, MCP-shaped activity, and token counts where persisted || [Codex CLI](/runtimes/codex-cli) | Local OTLP logs, selective usage trace, endpoint hooks, and poll of `~/.codex/sessions` through `beacon endpoint codex sync` | OTLP/hooks: session, prompt, approval, and tool-result activity plus per-user/session/model turn token usage. Poll: historical prompts, assistant messages, commands, files, tool calls, MCP-shaped activity, and token snapshots where persisted |