Skip to content

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

Stop answering observed pre-tool calls with allow where it pre-approves

Claudea5d9d3024325
diff --git a/cli/beacon-hooks/cmd/devin_permission_test.go b/cli/beacon-hooks/cmd/devin_permission_test.go
index 7bdc1a35..1487d694 100644
--- a/cli/beacon-hooks/cmd/devin_permission_test.go
+++ b/cli/beacon-hooks/cmd/devin_permission_test.go
@@ -3,7 +3,6 @@ package cmd
import (
"bytes"
"encoding/json"
- "io"
"os"
"path/filepath"
"testing"
@@ -67,7 +66,7 @@ func TestDevinPermissionRequestDoesNotApproveMalformedInput(t *testing.T) {
t.Setenv("BEACON_ENDPOINT_MODE", "1")
t.Setenv("BEACON_ENDPOINT_LOG", logPath)
- out := runPermissionRequestWithRawStdin(t, []byte(`{"tool_name": "exec", "tool_input": `))
+ out := runHookWithRawInput(t, runPermissionRequest, []byte(`{"tool_name": "exec", "tool_input": `))
if len(bytes.TrimSpace(out)) != 0 {
var decoded map[string]interface{}
if err := json.Unmarshal(out, &decoded); err != nil {
@@ -89,44 +88,3 @@ func TestDevinPermissionRequestDoesNotApproveMalformedInput(t *testing.T) {
})
}
}
-
-// runPermissionRequestWithRawStdin feeds bytes that are not a JSON object, which runHookWithInput
-// cannot express because it encodes its input. The payloads here are small, so writing before the
-// hook runs fits in any pipe buffer.
-func runPermissionRequestWithRawStdin(t *testing.T, stdin []byte) []byte {
- t.Helper()
- stdinR, stdinW, err := os.Pipe()
- if err != nil {
- t.Fatalf("create stdin pipe: %v", err)
- }
- stdoutR, stdoutW, err := os.Pipe()
- if err != nil {
- t.Fatalf("create stdout pipe: %v", err)
- }
- origStdin, origStdout := os.Stdin, os.Stdout
- os.Stdin, os.Stdout = stdinR, stdoutW
- defer func() {
- os.Stdin, os.Stdout = origStdin, origStdout
- _ = stdinR.Close()
- _ = stdoutR.Close()
- }()
-
- if _, err := stdinW.Write(stdin); err != nil {
- t.Fatalf("write stdin: %v", err)
- }
- if err := stdinW.Close(); err != nil {
- t.Fatalf("close stdin writer: %v", err)
- }
- done := make(chan []byte, 1)
- go func() {
- data, _ := io.ReadAll(stdoutR)
- done <- data
- }()
-
- runPermissionRequest(nil, nil)
-
- if err := stdoutW.Close(); err != nil {
- t.Fatalf("close stdout writer: %v", err)
- }
- return <-done
-}
diff --git a/cli/beacon-hooks/cmd/grok_hooks_test.go b/cli/beacon-hooks/cmd/grok_hooks_test.go
index 660ed2b9..fe9a8a04 100644
--- a/cli/beacon-hooks/cmd/grok_hooks_test.go
+++ b/cli/beacon-hooks/cmd/grok_hooks_test.go
@@ -73,7 +73,7 @@ func TestGrokIgnoresLegacyRetentionEnv(t *testing.T) {
}
}
-func TestGrokPreToolRecordsToolAndAllows(t *testing.T) {
+func TestGrokPreToolRecordsToolWithoutApproving(t *testing.T) {
setupHookConfigDirs(t)
platformFlag = "grok"
logPath := filepath.Join(t.TempDir(), "runtime.jsonl")
@@ -89,8 +89,8 @@ func TestGrokPreToolRecordsToolAndAllows(t *testing.T) {
"command": "npm test",
},
})
- if got := out["decision"]; got != "allow" {
- t.Fatalf("decision = %q, want allow", got)
+ if out == nil || len(out) != 0 {
+ t.Fatalf("pre-tool response = %#v, want an empty object carrying no decision", out)
}
event := lastEndpointEvent(t, logPath)
if action := event["event"].(map[string]interface{})["action"]; action != "tool.invoked" {
diff --git a/cli/beacon-hooks/cmd/kiro.go b/cli/beacon-hooks/cmd/kiro.go
index 11e6252d..2492d18d 100644
--- a/cli/beacon-hooks/cmd/kiro.go
+++ b/cli/beacon-hooks/cmd/kiro.go
@@ -208,7 +208,7 @@ const kiroMCPToolPrefix = "@"
// block is exit code 2 with the reason on stderr. There is no response object to return.
//
// Beacon's shared commands all finish by writing a JSON object to stdout -- `{}` for most of them,
-// `{"permission":"allow"}` for pre-tool -- which every other runtime reads as "no opinion". On
+// `{"permission":"allow"}` for Cursor's pre-tool -- which every other runtime reads as "no opinion". On
// Kiro those same bytes are not read at all on the tool events, and are pasted into the model's
// context on the two events that are. A hook whose job is to observe would be putting `{}` in
// front of the model at the start of every session and before every prompt: a small amount of
diff --git a/cli/beacon-hooks/cmd/kiro_hooks_test.go b/cli/beacon-hooks/cmd/kiro_hooks_test.go
index d4e8e130..4d4cffcd 100644
--- a/cli/beacon-hooks/cmd/kiro_hooks_test.go
+++ b/cli/beacon-hooks/cmd/kiro_hooks_test.go
@@ -98,8 +98,8 @@ func TestKiroEnvelopeResolvesThroughTheSharedReaders(t *testing.T) {
// The property this whole suppression exists for. On Kiro a hook's stdout is not a response
// object: on exit 0 it is *added to the agent's context* for SessionStart and UserPromptSubmit and
-// ignored everywhere else. Beacon's shared commands all finish by writing `{}` or
-// `{"permission":"allow"}`, so without the suppression an observing hook would be pasting text in
+// ignored everywhere else. Beacon's shared commands all finish by writing a JSON
+// object such as `{}`, so without the suppression an observing hook would be pasting text in
// front of the model at the start of every session and before every prompt.
func TestKiroHooksWriteNothingToStdout(t *testing.T) {
for _, tc := range []struct {
diff --git a/cli/beacon-hooks/cmd/pre_tool.go b/cli/beacon-hooks/cmd/pre_tool.go
index be91f1f5..4240ba88 100644
--- a/cli/beacon-hooks/cmd/pre_tool.go
+++ b/cli/beacon-hooks/cmd/pre_tool.go
@@ -27,13 +27,16 @@ func init() {
rootCmd.AddCommand(preToolCmd)
}
-// allowResponse is the standard allow response for preToolUse.
-var allowResponse = map[string]interface{}{"permission": "allow"}
+// cursorPreToolResponse is Cursor's answer to an observed pre-tool event. Cursor and goose are the
+// only runtimes an observing pre-tool hook answers with an allow, because on both it is the only
+// answer that lets a call proceed and neither reads it as a pre-approval; see preToolResponse and
+// gooseBlockingEventResponse.
+var cursorPreToolResponse = map[string]interface{}{"permission": "allow"}
func runPreTool(cmd *cobra.Command, args []string) {
input, err := readStdinJSON()
if err != nil {
- outputJSON(preToolResponse())
+ writePreToolResponse()
return
}
@@ -104,7 +107,15 @@ func runPreTool(cmd *cobra.Command, args []string) {
} else {
emitPreToolDecision(logger, input, sessionID, "approval.allowed", "allow", "Pre-tool observed", asymptoteobserve.FidelityInferred)
}
- outputJSON(preToolResponse())
+ writePreToolResponse()
+}
+
+// writePreToolResponse writes preToolResponse, or nothing at all when the runtime's no-opinion
+// answer is silence.
+func writePreToolResponse() {
+ if response := preToolResponse(); response != nil {
+ outputJSON(response)
+ }
}
func emitCursorPreHook(logger *logging.Logger, input map[string]interface{}, sessionID string) bool {
@@ -159,10 +170,48 @@ func emitPreToolDecision(logger *logging.Logger, input map[string]interface{}, s
emitHookEventWithFidelity(logger, action, "approval", "info", reason, fidelity, input, fields)
}
+// preToolResponse is what an observing pre-tool hook tells the runtime: it must leave the tool call
+// exactly where the runtime's own permission flow would put it. A nil return means write nothing.
+//
+// The rule every branch below follows is that a telemetry hook never answers "allow" where the
+// runtime reads that as a pre-approval, because an observing hook that approved would silently
+// disarm the user's own confirmation prompts for every tool call. A provider deny from the policy
+// seam is not this function's business; policyDenyFor answers that in each runtime's deny shape.
func preToolResponse() map[string]interface{} {
- if platformFlag == "antigravity" || platformFlag == "grok" {
- return map[string]interface{}{"decision": "allow"}
+ // Antigravity gets no output at all. Its documented PreToolUse contract
+ // (https://antigravity.google/docs/hooks/) makes `decision` a required field, and its values
+ // are all opinions: "allow" "automatically allows the tool execution", which is exactly the
+ // bypass this function exists to avoid; "ask" prompts for every call, which would add prompts
+ // the user never configured; and an object with no decision -- `{}` -- is read as a deny with
+ // no reason, which would block every tool call (reported by integrators, e.g.
+ // spacesheep-dev/sessionpipe#50). A hook that prints nothing leaves the call to Antigravity's
+ // own permission settings; PrismorSec/prismor#603 checked that live and prints nothing for the
+ // calls it lets through for the same reason. Silence is therefore the only no-opinion answer
+ // this runtime has.
+ if platformFlag == "antigravity" {
+ return nil
+ }
+ // Cursor answers allow, because it has no other answer that lets a call proceed. Its hooks reference (https://cursor.com/docs/agent/hooks)
+ // does not mark `permission` optional on preToolUse, beforeShellExecution or beforeReadFile,
+ // says a response that "doesn't match the hook's schema blocks the action", and lists "no
+ // output" among the failures that let an action through, so `{}` risks blocking every call
+ // and silence is read the same as allow. "ask" is not an alternative: beforeReadFile does not
+ // accept it, and on the cloud agent's beforeShellExecution there is no person to answer it.
+ // What makes allow an observing answer here is that Cursor does not treat it as a
+ // pre-approval: Cursor staff confirmed on the forum (topics 144244 and 161342, the latter
+ // May 2026) that only a hook's "deny" is enforced, and that "allow" does not override the
+ // user's allowlist or approval mode -- a command the allowlist would prompt for still prompts.
+ // If Cursor ever makes hook verdicts authoritative, this branch must be revisited:
+ // TestPreToolResponseAllowsOnlyWhereAllowIsNotAPreApproval exists to make that a one-line decision.
+ if platformFlag == "cursor" {
+ return cursorPreToolResponse
}
+ // Grok Build reads a top-level `decision` and treats a response without one as no objection,
+ // passing the call to Grok's own permission gate; exit 0 is success and only "deny"/"block" or
+ // exit 2 stops a call (agenticcontrolplane.com/integrations/grok-build; gartnera/lite-sandbox#69
+ // notes a hook "allow" does not skip Grok's approval prompt today). `{}` carries no decision,
+ // so it asserts nothing about the call -- unlike "allow", which would start approving on the
+ // user's behalf the day Grok honors it.
// Qwen Code belongs with claude here, and the reason is a security property rather than a
// convention. Qwen's PreToolUse contract reads a decision from
// `hookSpecificOutput.permissionDecision`, where "allow" means *run the tool without the usual
@@ -204,10 +253,14 @@ func preToolResponse() map[string]interface{} {
// runtime appends a hook's stdout to the model's context. The empty object is still the right
// value to hand back -- Kimi Code's decoder reads an object with no `permissionDecision` as no
// opinion, so it is what the suppression would fall back to if that ever changed.
- if platformFlag == "claude" || platformFlag == "qwen" || isDevinLikePlatform(platformFlag) || platformFlag == "hermes" || platformFlag == "vscode" || platformFlag == "muse" || platformFlag == openHandsPlatform || platformFlag == kiroPlatform || platformFlag == dshPlatform || platformFlag == kimiPlatform {
- return emptyResponse
- }
- return allowResponse
+ //
+ // Every other runtime gets the empty object as well, and that includes the ones that reach
+ // pre-tool with no installer writing the hook (Codex CLI, GitHub Copilot CLI, Factory Droid,
+ // Cline, a hand-written config). Those runtimes read their own decision keys --
+ // `hookSpecificOutput.permissionDecision` on the Claude-shaped ones, where "allow" is a
+ // pre-approval -- and a default that answered allow would be one key rename away from the Qwen
+ // bypass. No decision is the safe default; a runtime that needs more must be named above.
+ return emptyResponse
}
func emitPreToolObserved(logger *logging.Logger, input map[string]interface{}, sessionID string) {
diff --git a/cli/beacon-hooks/cmd/pre_tool_response_test.go b/cli/beacon-hooks/cmd/pre_tool_response_test.go
new file mode 100644
index 00000000..32ba9734
--- /dev/null
+++ b/cli/beacon-hooks/cmd/pre_tool_response_test.go
@@ -0,0 +1,200 @@
+package cmd
+
+import (
+ "bytes"
+ "encoding/json"
+ "io"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/spf13/cobra"
+)
+
+// The security property behind preToolResponse: an observing pre-tool hook never answers "allow"
+// on a runtime that reads it as a pre-approval, because that would silently disarm the user's own
+// confirmation prompts for every tool call on a runtime where Beacon was installed to watch.
+//
+// Cursor and goose are the two exceptions, each with a documented reason in preToolResponse and
+// gooseBlockingEventResponse: neither has a non-opinion answer that lets a call proceed, and
+// neither treats a hook's allow as overriding the operator's approval. Adding a runtime to that
+// list is a security decision, which is why this test names the list rather than deriving it.
+func TestPreToolResponseAllowsOnlyWhereAllowIsNotAPreApproval(t *testing.T) {
+ restore := platformFlag
+ t.Cleanup(func() { platformFlag = restore })
+
+ allowed := map[string]bool{"cursor": true, goosePlatform: true}
+ platforms := []string{
+ "cursor", goosePlatform,
+ "antigravity", "grok",
+ "claude", "qwen", "devin", "devin-cli", "hermes", "vscode", "muse",
+ openHandsPlatform, kiroPlatform, dshPlatform, kimiPlatform,
+ // Reach pre-tool only through a hand-written config: no installer writes the hook.
+ "codex", "copilot", "factory", "cline", "gemini",
+ "", "some-future-runtime",
+ }
+ for _, platform := range platforms {
+ t.Run(platform, func(t *testing.T) {
+ platformFlag = platform
+ response := preToolResponse()
+ if allowed[platform] {
+ if !responseCarriesAllow(response) {
+ t.Fatalf("preToolResponse() = %#v; this runtime needs its allow to let the call proceed", response)
+ }
+ return
+ }
+ if responseCarriesAllow(response) {
+ t.Fatalf("preToolResponse() = %#v, an observing hook must not approve on %q", response, platform)
+ }
+ })
+ }
+}
+
+// Antigravity reads `{"decision":"allow"}` as "automatically allows the tool execution" and an
+// object without a decision as a deny, so the only answer that leaves a call to its own permission
+// settings is no output at all -- including when Beacon could not read the payload.
+func TestAntigravityPreToolWritesNothing(t *testing.T) {
+ setupHookConfigDirs(t)
+ platformFlag = "antigravity"
+ t.Setenv("BEACON_ENDPOINT_LOG", filepath.Join(t.TempDir(), "runtime.jsonl"))
+
+ raw := runHookWithRawInput(t, runPreTool, mustJSON(t, map[string]interface{}{
+ "conversationId": "ag-session",
+ "workspacePaths": []interface{}{"/repo"},
+ "toolCall": map[string]interface{}{
+ "name": "run_command",
+ "args": map[string]interface{}{"CommandLine": "rm -rf build", "Cwd": "/repo"},
+ },
+ }))
+ if len(raw) != 0 {
+ t.Fatalf("antigravity pre-tool wrote %q, want no output", raw)
+ }
+
+ raw = runHookWithRawInput(t, runPreTool, []byte(`{"toolCall": `))
+ if len(raw) != 0 {
+ t.Fatalf("antigravity pre-tool wrote %q on malformed input, want no output", raw)
+ }
+}
+
+// The runtimes that reach the default answer -- Grok Build, and the ones whose pre-tool hook only a
+// hand-written config installs -- get an object with no decision in it, and Beacon records the call
+// without claiming an approval for the runtimes it does not synthesize one on.
+func TestObservingPreToolDoesNotApproveOnDefaultRuntimes(t *testing.T) {
+ for _, platform := range []string{"grok", "codex", "copilot", "factory", "cline"} {
+ t.Run(platform, func(t *testing.T) {
+ setupHookConfigDirs(t)
+ platformFlag = platform
+ t.Setenv("BEACON_ENDPOINT_LOG", filepath.Join(t.TempDir(), "runtime.jsonl"))
+
+ out := runHookWithInput(t, runPreTool, map[string]interface{}{
+ "session_id": platform + "-session",
+ "tool_name": "Bash",
+ "tool_input": map[string]interface{}{"command": "rm -rf build"},
+ })
+ if out == nil || len(out) != 0 {
+ t.Fatalf("pre-tool response = %#v, want an empty object carrying no decision", out)
+ }
+
+ out = runHookWithInput(t, runPreTool, map[string]interface{}{})
+ if out == nil || len(out) != 0 {
+ t.Fatalf("pre-tool response on an empty payload = %#v, want an empty object", out)
+ }
+ })
+ }
+}
+
+// The policy seam keeps each runtime's native deny shape: taking allow out of the observing answer
+// must not take the deny out of the enforcing one.
+func TestPreToolPolicyDenyAntigravityAndGrok(t *testing.T) {
+ for _, platform := range []string{"antigravity", "grok"} {
+ t.Run(platform, func(t *testing.T) {
+ logPath := setupPolicyTest(t, platform, denyResponse)
+ out := runHookWithInput(t, runPreTool, map[string]interface{}{
+ "session_id": "s-" + platform,
+ "tool_name": "run_command",
+ "tool_input": map[string]interface{}{"command": "claude --dangerously-skip-permissions -p go"},
+ })
+ if out["decision"] != "deny" {
+ t.Fatalf("%s deny response = %#v, want decision=deny", platform, out)
+ }
+ assertDenialEvent(t, logPath)
+ })
+ }
+}
+
+// A provider that allows is not grounds for Beacon to approve on the runtime's terms: the seam only
+// ever adds a deny, and an allowed call gets the observing answer like any other.
+func TestPreToolPolicyAllowIsNotTranslatedIntoAnApproval(t *testing.T) {
+ for _, platform := range []string{"antigravity", "grok"} {
+ t.Run(platform, func(t *testing.T) {
+ setupPolicyTest(t, platform, `{"decision":"allow"}`)
+ raw := runHookWithRawInput(t, runPreTool, mustJSON(t, map[string]interface{}{
+ "session_id": "s-" + platform,
+ "tool_name": "run_command",
+ "tool_input": map[string]interface{}{"command": "ls"},
+ }))
+ if bytes.Contains(raw, []byte("allow")) {
+ t.Fatalf("%s pre-tool wrote %q after a provider allow, want no approval", platform, raw)
+ }
+ })
+ }
+}
+
+func responseCarriesAllow(response map[string]interface{}) bool {
+ for _, value := range response {
+ if s, ok := value.(string); ok && (s == "allow" || s == "approve") {
+ return true
+ }
+ }
+ return false
+}
+
+func mustJSON(t *testing.T, value interface{}) []byte {
+ t.Helper()
+ data, err := json.Marshal(value)
+ if err != nil {
+ t.Fatalf("marshal: %v", err)
+ }
+ return data
+}
+
+// runHookWithRawInput feeds stdin bytes as given and returns stdout as written, so a test can tell
+// no output from an empty object and can send a payload that is not JSON. The payloads here are
+// small, so writing before the hook runs fits in any pipe buffer.
+func runHookWithRawInput(t *testing.T, run func(cmd *cobra.Command, args []string), stdin []byte) []byte {
+ t.Helper()
+ stdinR, stdinW, err := os.Pipe()
+ if err != nil {
+ t.Fatalf("create stdin pipe: %v", err)
+ }
+ stdoutR, stdoutW, err := os.Pipe()
+ if err != nil {
+ t.Fatalf("create stdout pipe: %v", err)
+ }
+ origStdin, origStdout := os.Stdin, os.Stdout
+ os.Stdin, os.Stdout = stdinR, stdoutW
+ defer func() {
+ os.Stdin, os.Stdout = origStdin, origStdout
+ _ = stdinR.Close()
+ _ = stdoutR.Close()
+ }()
+
+ if _, err := stdinW.Write(stdin); err != nil {
+ t.Fatalf("write stdin: %v", err)
+ }
+ if err := stdinW.Close(); err != nil {
+ t.Fatalf("close stdin writer: %v", err)
+ }
+ done := make(chan []byte, 1)
+ go func() {
+ data, _ := io.ReadAll(stdoutR)
+ done <- data
+ }()
+
+ run(nil, nil)
+
+ if err := stdoutW.Close(); err != nil {
+ t.Fatalf("close stdout writer: %v", err)
+ }
+ return <-done
+}
diff --git a/cli/beacon-hooks/cmd/pre_tool_test.go b/cli/beacon-hooks/cmd/pre_tool_test.go
index 33faa3cc..94dbd290 100644
--- a/cli/beacon-hooks/cmd/pre_tool_test.go
+++ b/cli/beacon-hooks/cmd/pre_tool_test.go
@@ -668,8 +668,8 @@ func TestRunPreToolEmitsAntigravityCommandTelemetry(t *testing.T) {
},
"stepIdx": 19,
})
- if out["decision"] != "allow" {
- t.Fatalf("antigravity pre-tool response = %#v, want decision=allow", out)
+ if out != nil {
+ t.Fatalf("antigravity pre-tool response = %#v, want no output", out)
}
event := lastEndpointEvent(t, logPath)
@@ -709,13 +709,11 @@ func TestRunPreToolSynthesizesAntigravityPromptFromTranscript(t *testing.T) {
"toolCall": map[string]interface{}{"name": "list_dir", "args": map[string]interface{}{"DirectoryPath": `"/repo"`}},
"artifactDirPath": "/tmp/artifacts",
}
- out := runHookWithInput(t, runPreTool, input)
- if out["decision"] != "allow" {
- t.Fatalf("antigravity pre-tool response = %#v, want decision=allow", out)
+ if out := runHookWithInput(t, runPreTool, input); out != nil {
+ t.Fatalf("antigravity pre-tool response = %#v, want no output", out)
}
- out = runHookWithInput(t, runPreTool, input)
- if out["decision"] != "allow" {
- t.Fatalf("second antigravity pre-tool response = %#v, want decision=allow", out)
+ if out := runHookWithInput(t, runPreTool, input); out != nil {
+ t.Fatalf("second antigravity pre-tool response = %#v, want no output", out)
}
events := endpointEvents(t, logPath)
@@ -747,14 +745,14 @@ func TestRunPreToolRetriesAntigravityPromptUntilTranscriptExists(t *testing.T) {
"toolCall": map[string]interface{}{"name": "list_dir", "args": map[string]interface{}{"DirectoryPath": `"/repo"`}},
}
- if out := runHookWithInput(t, runPreTool, input); out["decision"] != "allow" {
- t.Fatalf("first antigravity pre-tool response = %#v, want decision=allow", out)
+ if out := runHookWithInput(t, runPreTool, input); out != nil {
+ t.Fatalf("first antigravity pre-tool response = %#v, want no output", out)
}
if err := os.WriteFile(transcriptPath, []byte(`{"source":"USER_EXPLICIT","type":"USER_INPUT","content":"<USER_REQUEST>\nshow me the full prompt\n</USER_REQUEST>"}`+"\n"), 0600); err != nil {
t.Fatal(err)
}
- if out := runHookWithInput(t, runPreTool, input); out["decision"] != "allow" {
- t.Fatalf("second antigravity pre-tool response = %#v, want decision=allow", out)
+ if out := runHookWithInput(t, runPreTool, input); out != nil {
+ t.Fatalf("second antigravity pre-tool response = %#v, want no output", out)
}
events := endpointEvents(t, logPath)
diff --git a/docs/runtimes/antigravity-cli.mdx b/docs/runtimes/antigravity-cli.mdx
index 65d5198b..47761672 100644
--- a/docs/runtimes/antigravity-cli.mdx
+++ b/docs/runtimes/antigravity-cli.mdx
@@ -49,6 +49,7 @@ Beacon writes user-level Antigravity hooks to `~/.gemini/config/hooks.json` and
|------|---------|
| 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 |
+| 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 |
diff --git a/docs/runtimes/cursor.mdx b/docs/runtimes/cursor.mdx
index 952b7618..06610416 100644
--- a/docs/runtimes/cursor.mdx
+++ b/docs/runtimes/cursor.mdx
@@ -59,6 +59,7 @@ beacon endpoint hooks install --harness cursor --level project
| Prompt telemetry | Supported for local and cloud Cursor through `beforeSubmitPrompt` hooks. Cursor Cloud requires the project hook to be committed before the run starts and uploads observed prompts immediately; the initial launch prompt can precede hook activation during bootstrap. See [Cursor's Cloud Agent hook support matrix](https://cursor.com/docs/hooks#cloud-agent-support). |
| Turn identity | Supported. Cursor's `generation_id`, which changes with every user message, is promoted to `prompt.id` on hook events |
| Command, tool, and file telemetry | Supported for tool, shell command, MCP-like, approval, and file edit payloads where Cursor exposes them; Cursor Cloud support is limited to Cursor's [cloud-supported command hooks](https://cursor.com/docs/hooks#cloud-agent-support). |
+| Pre-tool answer | `preToolUse`, `beforeShellExecution` and `beforeReadFile` answer `{"permission":"allow"}`, because Cursor's hooks reference does not make `permission` optional and blocks an action whose hook response does not match the schema. Cursor enforces only a hook's `deny`: an `allow` does not override your allowlist or approval mode, so a command Cursor would ask about still asks. A deny from a `BEACON_POLICY_PROVIDER` policy provider returns `{"permission":"deny"}` |
| Agent reasoning telemetry | Supported for local Cursor through `afterAgentThought` hooks. Each completed thinking block is recorded as an `agent.reasoning` event carrying the reasoning text in the OpenTelemetry GenAI output-messages shape (`gen_ai.output.messages` with a `reasoning` part), plus a `content` marker with the original text's hash and byte count. Reasoning is only available for models/modes where Cursor exposes visible thinking text. |
| Repository and branch context | Events include the workspace path as `repository`, and `branch` is resolved from the workspace's local git checkout (`.git/HEAD`) when Cursor does not supply one; disable local git resolution with `BEACON_DISABLE_GIT_METADATA=1`. |
| Token usage and cost | Not collected. No Cursor hook payload carries a token count or a cost. |
diff --git a/docs/runtimes/grok-build.mdx b/docs/runtimes/grok-build.mdx
index 2fba3e00..4ee83d02 100644
--- a/docs/runtimes/grok-build.mdx
+++ b/docs/runtimes/grok-build.mdx
@@ -65,6 +65,7 @@ beacon endpoint grok sync --print
| Prompt telemetry | Supported through `UserPromptSubmit` hooks and session sync |
| Command, tool, and file telemetry | Supported for live hook payloads and committed session records. Session sync reads `chat_history.jsonl`, `events.jsonl`, `summary.json`, `prompt_context.json`, and terminal logs where present |
| Approval telemetry | Live hooks can observe and enforce at pre-tool time; session sync can report committed Grok permission request/resolution records after the fact |
+| Pre-tool answer | The `PreToolUse` hook answers with an empty object, which carries no decision, so Grok's own permission gate decides the call as it would without Beacon. A deny from a `BEACON_POLICY_PROVIDER` policy provider still returns `{"decision":"deny"}` |
| Session lifecycle | `session.started` only. Grok's `turn_ended` record ends a turn, not a session — the next prompt appends to the same session — so session sync records it as `session.context` carrying the turn number and outcome. Grok exposes no session-end record, so Beacon writes no `session.ended` for this runtime rather than inventing one |
| Local JSONL and dashboard | Supported |
| MDM deployment | Supported for the endpoint agent. Grok hooks are installed separately in the logged-in user's context or project context |