Skip to content

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

feat(endpoint): add full inventory heartbeats for Codex

shukieshah34b996359788
diff --git a/cli/beacon-hooks/cmd/endpoint_events.go b/cli/beacon-hooks/cmd/endpoint_events.go
index beade60a..28754aa5 100644
--- a/cli/beacon-hooks/cmd/endpoint_events.go
+++ b/cli/beacon-hooks/cmd/endpoint_events.go
@@ -83,7 +83,7 @@ func maybeUploadCursorCloudTelemetry(logger *logging.Logger) {
}
func maybeEmitInventoryHeartbeat(logger *logging.Logger, input map[string]interface{}) {
- if platformFlag != "cursor" && platformFlag != "claude" {
+ if platformFlag != "cursor" && platformFlag != "claude" && platformFlag != "codex" {
return
}
cliPath := strings.TrimSpace(os.Getenv("BEACON_ENDPOINT_CLI"))
diff --git a/cli/beacon-hooks/cmd/endpoint_events_test.go b/cli/beacon-hooks/cmd/endpoint_events_test.go
index 2bd16a0d..79e5c078 100644
--- a/cli/beacon-hooks/cmd/endpoint_events_test.go
+++ b/cli/beacon-hooks/cmd/endpoint_events_test.go
@@ -252,7 +252,7 @@ func TestMaybeEmitInventoryHeartbeatSkipsUnsupportedPlatform(t *testing.T) {
platformFlag = oldPlatform
runInventoryHeartbeatCommand = oldRunner
}()
- platformFlag = "codex"
+ platformFlag = "gemini"
t.Setenv("BEACON_ENDPOINT_CLI", "/usr/local/bin/beacon")
called := false
runInventoryHeartbeatCommand = func(ctx context.Context, name string, args ...string) *exec.Cmd {
@@ -262,7 +262,7 @@ func TestMaybeEmitInventoryHeartbeatSkipsUnsupportedPlatform(t *testing.T) {
return cmd
}
- logger := logging.NewLoggerForPlatform("test", "codex")
+ logger := logging.NewLoggerForPlatform("test", "gemini")
maybeEmitInventoryHeartbeat(logger, map[string]interface{}{"cwd": "/repo"})
if called {
diff --git a/cli/beacon-hooks/cmd/inventory_heartbeat.go b/cli/beacon-hooks/cmd/inventory_heartbeat.go
new file mode 100644
index 00000000..5c4343be
--- /dev/null
+++ b/cli/beacon-hooks/cmd/inventory_heartbeat.go
@@ -0,0 +1,30 @@
+package cmd
+
+import (
+ "github.com/spf13/cobra"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon-hooks/internal/logging"
+)
+
+var inventoryHeartbeatCmd = &cobra.Command{
+ Use: "inventory-heartbeat",
+ Short: "Emit endpoint inventory heartbeat telemetry",
+ Long: `Inventory heartbeat hook - triggered by agent lifecycle hooks to refresh local configuration inventory.`,
+ Run: runInventoryHeartbeat,
+}
+
+func init() {
+ rootCmd.AddCommand(inventoryHeartbeatCmd)
+}
+
+func runInventoryHeartbeat(cmd *cobra.Command, args []string) {
+ input, err := readStdinJSON()
+ if err != nil {
+ outputJSON(emptyResponse)
+ return
+ }
+
+ logger := logging.NewLoggerForPlatform("inventory-heartbeat", platformFlag)
+ maybeEmitInventoryHeartbeat(logger, input)
+ outputJSON(emptyResponse)
+}
diff --git a/cli/beacon-hooks/cmd/root.go b/cli/beacon-hooks/cmd/root.go
index c5480185..8403f19a 100644
--- a/cli/beacon-hooks/cmd/root.go
+++ b/cli/beacon-hooks/cmd/root.go
@@ -11,8 +11,8 @@ var platformFlag string
var rootCmd = &cobra.Command{
Use: "beacon-hooks",
- Short: "Beacon hooks for Claude Code, GitHub Copilot, Cursor, VS Code, Devin, Factory, Grok, Hermes, Antigravity, and opencode",
- Long: `Beacon hooks binary for Claude Code, GitHub Copilot, Cursor, VS Code, Devin, Factory, Grok, Hermes, Antigravity, and opencode integration.
+ Short: "Beacon hooks for Claude Code, Codex, GitHub Copilot, Cursor, VS Code, Devin, Factory, Grok, Hermes, Antigravity, and opencode",
+ Long: `Beacon hooks binary for Claude Code, Codex, GitHub Copilot, Cursor, VS Code, Devin, Factory, Grok, Hermes, Antigravity, and opencode integration.
This binary provides hook commands that are called by IDE plugin systems
to evaluate code changes for security violations.
@@ -21,7 +21,7 @@ Use --platform to specify the calling platform (default: claude).`,
}
func init() {
- rootCmd.PersistentFlags().StringVar(&platformFlag, "platform", "claude", "Platform context: claude, antigravity, copilot, cursor, vscode, devin, devin-cli, devin-desktop, factory, grok, hermes, or opencode")
+ rootCmd.PersistentFlags().StringVar(&platformFlag, "platform", "claude", "Platform context: claude, codex, antigravity, copilot, cursor, vscode, devin, devin-cli, devin-desktop, factory, grok, hermes, or opencode")
}
// Execute runs the root command
diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.go
index 5abb270c..fef7cbcb 100644
--- a/cli/beacon/cmd/endpoint_diagnostics.go
+++ b/cli/beacon/cmd/endpoint_diagnostics.go
@@ -854,7 +854,7 @@ func hookTargets() ([]string, error) {
}
func allHookTargetsForLevel() []string {
- all := []string{"cursor", "vscode", "factory", "opencode", "grok", "hermes", "devin-cli", "devin-desktop", "antigravity"}
+ all := []string{"cursor", "codex", "vscode", "factory", "opencode", "grok", "hermes", "devin-cli", "devin-desktop", "antigravity"}
if endpointOpts.hookLevel != "project" {
return all
}
@@ -890,6 +890,9 @@ func hookStatusesWithConfig(targets []string, cfg endpointconfig.Config) map[str
case "claude":
status := endpointhooks.ClaudeHookStatus(endpointhooks.ClaudeOptions{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.SettingsPath, Raw: status}
+ case "codex":
+ status := endpointhooks.CodexHookStatus(endpointhooks.CodexOptions{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.HooksPath, Raw: status}
case "vscode":
status := endpointhooks.VSCodeHookStatus(endpointhooks.VSCodeOptions{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.HooksPath, Raw: status}
diff --git a/cli/beacon/cmd/endpoint_hooks.go b/cli/beacon/cmd/endpoint_hooks.go
index 93f1d12d..3ab157f7 100644
--- a/cli/beacon/cmd/endpoint_hooks.go
+++ b/cli/beacon/cmd/endpoint_hooks.go
@@ -90,6 +90,16 @@ func installEndpointHookTarget(name string, cfg endpointconfig.Config) error {
return err
}
fmt.Printf("Claude Code hooks installed: %s\n", status.SettingsPath)
+ case "codex":
+ status, err := endpointhooks.InstallCodex(endpointhooks.CodexOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
+ if err != nil {
+ return err
+ }
+ fmt.Printf("Codex CLI inventory hooks installed: %s\n", status.HooksPath)
case "vscode":
status, err := endpointhooks.InstallVSCode(endpointhooks.VSCodeOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
@@ -225,6 +235,16 @@ func uninstallEndpointHookTarget(name string, cfg endpointconfig.Config) error {
return err
}
fmt.Println(status.Message)
+ case "codex":
+ status, err := endpointhooks.UninstallCodex(endpointhooks.CodexOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
+ if err != nil {
+ return err
+ }
+ fmt.Println(status.Message)
case "vscode":
status, err := endpointhooks.UninstallVSCode(endpointhooks.VSCodeOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
@@ -329,6 +349,12 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {
LogPath: cfg.LogPath,
UserMode: cfg.UserMode,
})
+ case "codex":
+ statuses["codex"] = endpointhooks.CodexHookStatus(endpointhooks.CodexOptions{
+ Level: endpointhooks.Level(endpointOpts.hookLevel),
+ LogPath: cfg.LogPath,
+ UserMode: cfg.UserMode,
+ })
case "vscode":
statuses["vscode"] = endpointhooks.VSCodeHookStatus(endpointhooks.VSCodeOptions{
Level: endpointhooks.Level(endpointOpts.hookLevel),
diff --git a/cli/beacon/cmd/endpoint_targets.go b/cli/beacon/cmd/endpoint_targets.go
index d57071e3..d0f70f98 100644
--- a/cli/beacon/cmd/endpoint_targets.go
+++ b/cli/beacon/cmd/endpoint_targets.go
@@ -25,8 +25,8 @@ type endpointTarget struct {
// - hookAliases map a spelling to the harness in the hook-only namespace.
//
// The two alias sets differ on purpose: in the hook-only namespace some OTLP
-// spellings are reinterpreted as their hook variant (for example "claude" and
-// "vscode"), and OTLP-only harnesses are not hook-addressable at all.
+// spellings are reinterpreted as their hook variant (for example "claude",
+// "codex", and "vscode"), and OTLP-only harnesses are not hook-addressable at all.
type harnessTarget struct {
name string
endpointKind endpointTargetKind
@@ -39,7 +39,7 @@ type harnessTarget struct {
var harnessTargets = []harnessTarget{
{name: "claude", endpointKind: endpointTargetOTLP, endpointAliases: []string{"claude", "claude-code"}, hookAliases: []string{"claude", "claude-code"}},
{name: "claude", endpointKind: endpointTargetHook, endpointAliases: []string{"claude-hooks"}, hookAliases: []string{"claude-hooks"}},
- {name: "codex", endpointKind: endpointTargetOTLP, endpointAliases: []string{"codex", "codex-cli"}},
+ {name: "codex", endpointKind: endpointTargetOTLP, endpointAliases: []string{"codex", "codex-cli"}, hookAliases: []string{"codex", "codex-cli"}},
{name: "gemini", endpointKind: endpointTargetOTLP, endpointAliases: []string{"gemini", "gemini-cli"}},
{name: "vscode", endpointKind: endpointTargetOTLP, endpointAliases: []string{"vscode", "vs-code", "vscode-copilot"}, hookAliases: []string{"vscode", "vs-code"}},
{name: "cursor", endpointKind: endpointTargetHook, endpointAliases: []string{"cursor"}, hookAliases: []string{"cursor"}},
diff --git a/cli/beacon/cmd/endpoint_targets_characterization_test.go b/cli/beacon/cmd/endpoint_targets_characterization_test.go
index 44ccfe13..431ac6f3 100644
--- a/cli/beacon/cmd/endpoint_targets_characterization_test.go
+++ b/cli/beacon/cmd/endpoint_targets_characterization_test.go
@@ -73,6 +73,9 @@ func TestNormalizeHookTargetCharacterization(t *testing.T) {
"claude-code": {"claude", true},
"claude_code": {"claude", true},
"claude-hooks": {"claude", true},
+ "codex": {"codex", true},
+ "codex-cli": {"codex", true},
+ "codex_cli": {"codex", true},
"vscode": {"vscode", true},
"vs-code": {"vscode", true},
"vs_code": {"vscode", true},
@@ -87,8 +90,6 @@ func TestNormalizeHookTargetCharacterization(t *testing.T) {
"devin-desktop": {"devin-desktop", true},
"DEVIN_DESKTOP": {"devin-desktop", true},
// OTLP-only harnesses are not hook-addressable
- "codex": {"", false},
- "codex-cli": {"", false},
"gemini": {"", false},
"vscode-copilot": {"", false},
// Unsupported
diff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.go
index ef8920ce..b352955c 100644
--- a/cli/beacon/cmd/endpoint_test.go
+++ b/cli/beacon/cmd/endpoint_test.go
@@ -63,11 +63,11 @@ func TestSplitEndpointTargetsDedupesHookAliases(t *testing.T) {
}
func TestCanonicalHookTargetsNormalizesAliasesToSwitchNames(t *testing.T) {
- got, err := canonicalHookTargets([]string{"claude_code", "vs_code", "droid", "devin", "devin_desktop", "antigravity_cli", "hermes-agent"})
+ got, err := canonicalHookTargets([]string{"claude_code", "codex_cli", "vs_code", "droid", "devin", "devin_desktop", "antigravity_cli", "hermes-agent"})
if err != nil {
t.Fatalf("canonicalHookTargets returned error: %v", err)
}
- want := []string{"claude", "vscode", "factory", "devin-cli", "devin-desktop", "antigravity", "hermes"}
+ want := []string{"claude", "codex", "vscode", "factory", "devin-cli", "devin-desktop", "antigravity", "hermes"}
if strings.Join(got, ",") != strings.Join(want, ",") {
t.Fatalf("canonicalHookTargets = %#v, want %#v", got, want)
}
@@ -853,9 +853,12 @@ func TestInventoryHeartbeatTTLAndSnapshotDigest(t *testing.T) {
work := t.TempDir()
logPath := filepath.Join(t.TempDir(), "runtime.jsonl")
writeTestFile(t, filepath.Join(home, ".cursor", "mcp.json"), `{"mcpServers":{"one":{"command":"npx"}}}`)
+ writeTestFile(t, filepath.Join(home, ".codex", "config.toml"), `[mcp_servers.github]
+command = "gh"
+`)
cfg := endpointconfig.Default(true, logPath)
enabled := true
- cfg.Inventory = &endpointconfig.Inventory{Enabled: &enabled, TTLSeconds: 86400, Runtimes: []string{"cursor", "claude_code"}}
+ cfg.Inventory = &endpointconfig.Inventory{Enabled: &enabled, TTLSeconds: 86400}
settings := endpointconfig.InventoryConfig(cfg)
first, err := writeInventoryHeartbeat(cfg, settings, false, work, "hook", "cursor")
@@ -907,6 +910,9 @@ func TestInventoryHeartbeatTTLAndSnapshotDigest(t *testing.T) {
if !strings.Contains(text, `"server_name":"two"`) {
t.Fatalf("changed snapshot missing new MCP server: %s", text)
}
+ if !strings.Contains(text, `"server_name":"github"`) {
+ t.Fatalf("default heartbeat should include Codex inventory from cursor trigger: %s", text)
+ }
if _, err := os.Stat(filepath.Join(filepath.Dir(logPath), "inventory-state.json")); err != nil {
t.Fatalf("inventory state should live beside inventory log: %v", err)
}
@@ -1110,6 +1116,7 @@ func TestRunEndpointInventoryWriteEventHonorsConfigContentOptIn(t *testing.T) {
t.Fatal(err)
}
endpointOpts.userMode = true
+ endpointOpts.logPath = logPath
endpointOpts.jsonOutput = true
endpointOpts.writeInventoryEvent = true
endpointOpts.inventoryContents = false
diff --git a/cli/beacon/internal/endpoint/config/config.go b/cli/beacon/internal/endpoint/config/config.go
index 1f0775c7..c19835a7 100644
--- a/cli/beacon/internal/endpoint/config/config.go
+++ b/cli/beacon/internal/endpoint/config/config.go
@@ -119,7 +119,7 @@ func InventoryDefaults() InventorySettings {
return InventorySettings{
Enabled: true,
TTLSeconds: 24 * 60 * 60,
- Runtimes: []string{"cursor", "claude_code"},
+ Runtimes: []string{},
}
}
diff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.go
index ff3152cd..7987e97f 100644
--- a/cli/beacon/internal/endpoint/config/config_test.go
+++ b/cli/beacon/internal/endpoint/config/config_test.go
@@ -29,7 +29,7 @@ func TestDefaultUserConfigUsesHomeScopedPaths(t *testing.T) {
t.Fatalf("unexpected default harnesses: %#v", cfg.Harnesses)
}
inventory := InventoryConfig(cfg)
- if !inventory.Enabled || inventory.TTLSeconds != 86400 || len(inventory.Runtimes) != 2 || inventory.Runtimes[0] != "cursor" || inventory.Runtimes[1] != "claude_code" {
+ if !inventory.Enabled || inventory.TTLSeconds != 86400 || len(inventory.Runtimes) != 0 {
t.Fatalf("unexpected inventory defaults: %#v", inventory)
}
if inventory.IncludeContents || inventory.MaxContentBytes != 0 {
diff --git a/cli/beacon/internal/endpoint/hooks/codex.go b/cli/beacon/internal/endpoint/hooks/codex.go
new file mode 100644
index 00000000..bee25977
--- /dev/null
+++ b/cli/beacon/internal/endpoint/hooks/codex.go
@@ -0,0 +1,97 @@
+package hooks
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+)
+
+type CodexOptions struct {
+ Level Level
+ LogPath string
+ UserMode bool
+}
+
+type CodexStatus struct {
+ Installed bool `json:"installed"`
+ BinaryPath string `json:"binary_path,omitempty"`
+ HooksPath string `json:"hooks_path,omitempty"`
+ Message string `json:"message,omitempty"`
+}
+
+var codexRuntime = hookRuntime{
+ displayName: "Codex CLI",
+ configPath: codexHooksPath,
+ install: installCodexHooks,
+ uninstall: removeCodexEndpointHooks,
+ isInstalled: isCodexInstalledAt,
+}
+
+func InstallCodex(opts CodexOptions) (CodexStatus, error) {
+ status, err := installRuntimeHooks(codexRuntime, RuntimeOptions(opts))
+ if err != nil {
+ return CodexStatus{}, err
+ }
+ return codexStatusFromRuntime(status), nil
+}
+
+func UninstallCodex(opts CodexOptions) (CodexStatus, error) {
+ status, err := uninstallRuntimeHooks(codexRuntime, RuntimeOptions(opts))
+ if err != nil {
+ return CodexStatus{}, err
+ }
+ return codexStatusFromRuntime(status), nil
+}
+
+func CodexHookStatus(opts CodexOptions) CodexStatus {
+ return codexStatusFromRuntime(runtimeHookStatus(codexRuntime, RuntimeOptions(opts)))
+}
+
+func IsCodexInstalled(opts CodexOptions) bool {
+ return isRuntimeInstalled(codexRuntime, RuntimeOptions(opts))
+}
+
+func codexStatusFromRuntime(status runtimeStatus) CodexStatus {
+ return CodexStatus{
+ Installed: status.Installed,
+ BinaryPath: status.BinaryPath,
+ HooksPath: status.ConfigPath,
+ Message: status.Message,
+ }
+}
+
+func installCodexHooks(path, binaryPath, logPath, configPath string) error {
+ prefix := endpointCommandPrefix("codex", binaryPath, logPath, configPath)
+ endpointHooks := map[string]settingsHookGroup{
+ "SessionStart": {Hooks: []settingsHookRef{{Type: "command", Command: prefix + " inventory-heartbeat", Timeout: 10}}},
+ "UserPromptSubmit": {Hooks: []settingsHookRef{{Type: "command", Command: prefix + " inventory-heartbeat", Timeout: 10}}},
+ }
+ return installSettingsEndpointHooks(path, "codex", endpointHooks)
+}
+
+func removeCodexEndpointHooks(path string) (bool, error) {
+ return removeSettingsEndpointHooks(path, "codex")
+}
+
+func isCodexInstalledAt(path string) bool {
+ return isSettingsEndpointInstalledAt(path, "codex")
+}
+
+func codexHooksPath(level Level) (string, error) {
+ switch level {
+ case "", LevelUser:
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return "", err
+ }
+ return filepath.Join(home, ".codex", "hooks.json"), nil
+ case LevelProject:
+ cwd, err := os.Getwd()
+ if err != nil {
+ return "", err
+ }
+ return filepath.Join(cwd, ".codex", "hooks.json"), nil
+ default:
+ return "", fmt.Errorf("unknown hook level %q", level)
+ }
+}
diff --git a/cli/beacon/internal/endpoint/hooks/codex_test.go b/cli/beacon/internal/endpoint/hooks/codex_test.go
new file mode 100644
index 00000000..c3fdae53
--- /dev/null
+++ b/cli/beacon/internal/endpoint/hooks/codex_test.go
@@ -0,0 +1,71 @@
+package hooks
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestInstallCodexHooksUsesInventoryHeartbeatOnly(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "hooks.json")
+ existing := `{"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"echo keep"}]}]}}`
+ if err := os.WriteFile(path, []byte(existing), 0600); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := installCodexHooks(path, "/tmp/beacon hooks", "/tmp/runtime.jsonl", "/tmp/config.json"); err != nil {
+ t.Fatalf("installCodexHooks returned error: %v", err)
+ }
+
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read hooks: %v", err)
+ }
+ text := string(data)
+ for _, want := range []string{
+ "echo keep",
+ "SessionStart",
+ "UserPromptSubmit",
+ "--platform codex",
+ "inventory-heartbeat",
+ "BEACON_ENDPOINT_LOG='/tmp/runtime.jsonl'",
+ "BEACON_ENDPOINT_CONFIG='/tmp/config.json'",
+ } {
+ if !strings.Contains(text, want) {
+ t.Fatalf("Codex hooks missing %q:\n%s", want, text)
+ }
+ }
+ for _, forbidden := range []string{"session-start", "prompt-submit"} {
+ if strings.Contains(text, forbidden) {
+ t.Fatalf("Codex inventory hooks should not emit runtime hook events %q:\n%s", forbidden, text)
+ }
+ }
+}
+
+func TestRemoveCodexEndpointHooksPreservesOtherHooks(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "hooks.json")
+ existing := `{"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"echo keep"}]},{"hooks":[{"type":"command","command":"BEACON_ENDPOINT_MODE=1 beacon-hooks --platform codex inventory-heartbeat"}]}]}}`
+ if err := os.WriteFile(path, []byte(existing), 0600); err != nil {
+ t.Fatal(err)
+ }
+
+ updated, err := removeCodexEndpointHooks(path)
+ if err != nil {
+ t.Fatalf("removeCodexEndpointHooks returned error: %v", err)
+ }
+ if !updated {
+ t.Fatal("expected Codex endpoint hook to be removed")
+ }
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read hooks: %v", err)
+ }
+ text := string(data)
+ if !strings.Contains(text, "echo keep") {
+ t.Fatalf("non-Beacon hook was not preserved:\n%s", text)
+ }
+ if strings.Contains(text, "--platform codex") {
+ t.Fatalf("Codex endpoint hook was not removed:\n%s", text)
+ }
+}
diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.go
index d5d58072..49da7b76 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory.go
@@ -81,18 +81,18 @@ type UserScope struct {
}
type Config struct {
- Runtime string `json:"runtime"`
- Path string `json:"path,omitempty"`
- PathHash string `json:"path_hash,omitempty"`
- Scope string `json:"scope"`
- ConfigKind string `json:"config_kind"`
- ParserMode string `json:"parser_mode"`
- Exists bool `json:"exists"`
- Readable bool `json:"readable"`
- Reason string `json:"reason,omitempty"`
- ParserStatus string `json:"parser_status"`
- FileSHA256 string `json:"file_sha256,omitempty"`
- ModifiedAt string `json:"modified_at,omitempty"`
+ Runtime string `json:"runtime"`
+ Path string `json:"path,omitempty"`
+ PathHash string `json:"path_hash,omitempty"`
+ Scope string `json:"scope"`
+ ConfigKind string `json:"config_kind"`
+ ParserMode string `json:"parser_mode"`
+ Exists bool `json:"exists"`
+ Readable bool `json:"readable"`
+ Reason string `json:"reason,omitempty"`
+ ParserStatus string `json:"parser_status"`
+ FileSHA256 string `json:"file_sha256,omitempty"`
+ ModifiedAt string `json:"modified_at,omitempty"`
MCPServerCount int `json:"mcp_server_count"`
BeaconManaged bool `json:"beacon_managed"`
Redaction string `json:"redaction"`
@@ -100,20 +100,20 @@ type Config struct {
}
type MCPServer struct {
- Runtime string `json:"runtime"`
- ServerName string `json:"server_name,omitempty"`
- ServerNameHash string `json:"server_name_hash,omitempty"`
- SourcePath string `json:"source_path,omitempty"`
- SourcePathHash string `json:"source_path_hash,omitempty"`
- SourceScope string `json:"source_scope"`
- Transport string `json:"transport"`
- CommandPresent bool `json:"command_present"`
- CommandName string `json:"command_name,omitempty"`
- CommandNameHash string `json:"command_name_hash,omitempty"`
- ArgsCount int `json:"args_count,omitempty"`
- URLPresent bool `json:"url_present"`
- EnvKeys []string `json:"env_keys,omitempty"`
- EnvKeyCount int `json:"env_key_count,omitempty"`
+ Runtime string `json:"runtime"`
+ ServerName string `json:"server_name,omitempty"`
+ ServerNameHash string `json:"server_name_hash,omitempty"`
+ SourcePath string `json:"source_path,omitempty"`
+ SourcePathHash string `json:"source_path_hash,omitempty"`
+ SourceScope string `json:"source_scope"`
+ Transport string `json:"transport"`
+ CommandPresent bool `json:"command_present"`
+ CommandName string `json:"command_name,omitempty"`
+ CommandNameHash string `json:"command_name_hash,omitempty"`
+ ArgsCount int `json:"args_count,omitempty"`
+ URLPresent bool `json:"url_present"`
+ EnvKeys []string `json:"env_keys,omitempty"`
+ EnvKeyCount int `json:"env_key_count,omitempty"`
DefinitionHash string `json:"definition_hash"`
ParserStatus string `json:"parser_status"`
Redaction string `json:"redaction"`
@@ -193,7 +193,7 @@ func runtimeSet(runtimes []string) map[string]bool {
func candidates(home, wd string) []candidate {
items := []candidate{}
items = append(items, claudeCandidates(home, wd)...)
- items = append(items, codexCandidates(home)...)
+ items = append(items, codexCandidates(home, wd)...)
items = append(items, cursorCandidates(home, wd)...)
items = append(items, geminiCandidates(home)...)
items = append(items, antigravityCandidates(home, wd)...)
@@ -226,8 +226,13 @@ func claudeCandidates(home, wd string) []candidate {
}
}
-func codexCandidates(home string) []candidate {
- return []candidate{{runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser, format: formatTOML, kind: KindNativeConfig}}
+func codexCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser, format: formatTOML, kind: KindNativeConfig},
+ {runtime: "codex_cli", path: filepath.Join(home, ".codex", "hooks.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},
+ {runtime: "codex_cli", path: filepath.Join(wd, ".codex", "config.toml"), scope: ScopeProject, format: formatTOML, kind: KindNativeConfig},
+ {runtime: "codex_cli", path: filepath.Join(wd, ".codex", "hooks.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},
+ }
}
func cursorCandidates(home, wd string) []candidate {
diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.go
index e80f00d8..50f92932 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go
@@ -236,6 +236,9 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {
{runtime: "claude_code", path: filepath.Join(work, ".claude", "settings.json"), scope: ScopeProject, format: formatJSON, kind: KindNativeConfig},
{runtime: "claude_code", path: "/Library/Application Support/ClaudeCode/managed-settings.json", scope: ScopeManaged, format: formatJSON, kind: KindManagedConfig},
{runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser, format: formatTOML, kind: KindNativeConfig},
+ {runtime: "codex_cli", path: filepath.Join(home, ".codex", "hooks.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},
+ {runtime: "codex_cli", path: filepath.Join(work, ".codex", "config.toml"), scope: ScopeProject, format: formatTOML, kind: KindNativeConfig},
+ {runtime: "codex_cli", path: filepath.Join(work, ".codex", "hooks.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},
{runtime: "cursor", path: filepath.Join(home, ".cursor", "mcp.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},
{runtime: "cursor", path: filepath.Join(work, ".cursor", "mcp.json"), scope: ScopeProject, format: formatJSON, kind: KindNativeConfig},
{runtime: "cursor", path: filepath.Join(home, ".cursor", "hooks.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},
diff --git a/docs/cli/endpoint-install.mdx b/docs/cli/endpoint-install.mdx
index 763f7e72..8a7fb1a7 100644
--- a/docs/cli/endpoint-install.mdx
+++ b/docs/cli/endpoint-install.mdx
@@ -11,7 +11,7 @@ description: "Install or update the local Beacon endpoint collector and runtime
beacon endpoint install
```
-By default, Beacon configures Claude Code and Codex CLI telemetry for local or customer-controlled runtime JSONL logs. Gemini CLI and VS Code Copilot telemetry are opt-in with the `gemini` and `vscode` harnesses. Claude Code can also use optional hook telemetry for richer lifecycle, subagent, permission, and tool detail; install the endpoint agent first, then add Claude hooks with `beacon endpoint hooks install --harness claude`. Beacon applies redaction, sanitization, truncation, and event-size limits before writing supported content fields. GitHub Copilot CLI and Factory Droid OTLP are managed through their launch environments, so Beacon validates their telemetry state but does not mutate shell profiles during install.
+By default, Beacon configures Claude Code and Codex CLI telemetry for local or customer-controlled runtime JSONL logs. Gemini CLI and VS Code Copilot telemetry are opt-in with the `gemini` and `vscode` harnesses. Claude Code can also use optional hook telemetry for richer lifecycle, subagent, permission, and tool detail; install the endpoint agent first, then add Claude hooks with `beacon endpoint hooks install --harness claude`. Codex runtime telemetry stays OTLP-based, but optional Codex hooks can trigger inventory heartbeats with `beacon endpoint hooks install --harness codex`. Beacon applies redaction, sanitization, truncation, and event-size limits before writing supported content fields. GitHub Copilot CLI and Factory Droid OTLP are managed through their launch environments, so Beacon validates their telemetry state but does not mutate shell profiles during install.
## Flags
diff --git a/docs/cli/endpoint-inventory.mdx b/docs/cli/endpoint-inventory.mdx
index 362d9a8a..523ad6bb 100644
--- a/docs/cli/endpoint-inventory.mdx
+++ b/docs/cli/endpoint-inventory.mdx
@@ -60,23 +60,22 @@ Content capture is opt-in and offline; `--contents` only reads files inventory a
## Inventory Heartbeats
-Cursor and Claude Code endpoint hooks can periodically append inventory telemetry to a separate `inventory_state.jsonl` file beside `runtime.jsonl`:
+Endpoint hooks can periodically append inventory telemetry to a separate `inventory_state.jsonl` file beside `runtime.jsonl`. The hook that fires is recorded as trigger provenance, but the default heartbeat scans all supported local inventory candidates:
- `inventory.heartbeat` records that Beacon checked local agent configuration inventory, including counts and a snapshot digest.
- `inventory.snapshot` records the current metadata-only inventory when the snapshot changed or when inventory is first initialized.
-By default, inventory snapshots include config file metadata, MCP server metadata, skill metadata, and hook config metadata. They do not include skill instruction bodies, MCP secret values, full environment values, full command arguments, or unrelated config content.
+By default, inventory snapshots include config file metadata, MCP server metadata, skill metadata, and hook config metadata across supported local runtimes. They do not include skill instruction bodies, MCP secret values, full environment values, full command arguments, or unrelated config content.
Set `include_contents` to opt the snapshot/heartbeat telemetry into capturing full definitions, matching the `--contents` CLI behavior. When enabled, `inventory.snapshot` events carry redacted, size-limited config/hook/skill `content` blocks and full MCP server `definition` blocks. Secret-looking values are redacted and bodies are truncated to `max_content_bytes` (64 KiB by default). This setting is off by default so the snapshot contract stays metadata-only unless an operator explicitly enables it.
-The heartbeat TTL and content capture are configured in the existing endpoint config file:
+The heartbeat TTL and content capture are configured in the existing endpoint config file. Omit `runtimes` to scan all supported inventory runtimes, or set it when you intentionally want a narrower snapshot:
```json title="~/.beacon/endpoint/config.json"
{
"inventory_heartbeat": {
"enabled": true,
"ttl_seconds": 86400,
- "runtimes": ["cursor", "claude_code"],
"include_contents": false,
"max_content_bytes": 65536
}
diff --git a/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx b/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx
index e6d89878..d078e983 100644
--- a/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx
+++ b/docs/guides/jamf-anthropic-openai-cursor-mdm.mdx
@@ -285,7 +285,7 @@ The helper switches to the console user and runs:
## Step 4: Configure Codex CLI
-Codex CLI is not hook-based. It reads OTLP settings from `~/.codex/config.toml`.
+Codex CLI runtime telemetry is OTLP-based. It reads OTLP settings from `~/.codex/config.toml`.
Use your standard Jamf user-context mechanism or managed config approach to ensure each Codex user has this block:
@@ -301,7 +301,7 @@ endpoint = "http://127.0.0.1:4317"
endpoint = "http://127.0.0.1:4317"
```
-Preserve existing non-OTel Codex settings and ensure the final file is owned by the user. This step is required for Codex telemetry; the S3 helper does not install Codex hooks.
+Preserve existing non-OTel Codex settings and ensure the final file is owned by the user. This step is required for Codex runtime telemetry. Optional Codex hooks can be installed separately when you want Codex sessions to trigger inventory heartbeats.
## Validate A Deployed Mac
@@ -519,7 +519,7 @@ command -v codex
grep -n 'otel\|otlp-grpc\|127.0.0.1:4317' ~/.codex/config.toml
```
-Codex CLI is not hook-based. Re-run the Codex config policy for the logged-in user if the OTel block is missing.
+Codex runtime telemetry is OTLP-based. Re-run the Codex config policy for the logged-in user if the OTel block is missing.
### Inventory Is Empty
diff --git a/docs/guides/jamf-s3-mdm.mdx b/docs/guides/jamf-s3-mdm.mdx
index b0b893a5..2101fa15 100644
--- a/docs/guides/jamf-s3-mdm.mdx
+++ b/docs/guides/jamf-s3-mdm.mdx
@@ -321,8 +321,7 @@ path = Path("/Library/Application Support/Beacon/Endpoint/config.json")
data = json.loads(path.read_text())
data["inventory_heartbeat"] = {
"enabled": True,
- "ttl_seconds": 5,
- "runtimes": ["cursor", "claude_code"]
+ "ttl_seconds": 5
}
path.write_text(json.dumps(data, indent=2) + "\n")
PY
@@ -414,8 +413,7 @@ path = Path("/Library/Application Support/Beacon/Endpoint/config.json")
data = json.loads(path.read_text())
data["inventory_heartbeat"] = {
"enabled": True,
- "ttl_seconds": 86400,
- "runtimes": ["cursor", "claude_code"]
+ "ttl_seconds": 86400
}
path.write_text(json.dumps(data, indent=2) + "\n")
PY
diff --git a/docs/runtimes/codex-cli.mdx b/docs/runtimes/codex-cli.mdx
index 083a1110..fb834117 100644
--- a/docs/runtimes/codex-cli.mdx
+++ b/docs/runtimes/codex-cli.mdx
@@ -5,7 +5,7 @@ description: "Asymptote support details for Codex CLI endpoint telemetry"
## Runtime Overview
-Asymptote supports Codex CLI through local OTLP logs and token usage metrics, with optional raw Codex spans for troubleshooting.
+Asymptote supports Codex CLI runtime telemetry through local OTLP logs and token usage metrics, with optional raw Codex spans for troubleshooting. Codex hooks can also trigger endpoint inventory heartbeats without replacing the OTLP runtime path.
## Prerequisites
@@ -18,7 +18,7 @@ Before enabling Codex CLI telemetry, make sure:
## Collection path
-Codex CLI exports local OpenTelemetry logs and metrics to Asymptote's localhost collector. Asymptote uses Codex semantic logs for session, prompt, approval, and tool-result events, and keeps the `codex.turn.token_usage` metric for token attribution. Other high-volume Codex metrics, and Codex spans, are suppressed by default.
+Codex CLI exports local OpenTelemetry logs and metrics to Asymptote's localhost collector. Asymptote uses Codex semantic logs for session, prompt, approval, and tool-result events, and keeps the `codex.turn.token_usage` metric for token attribution. Other high-volume Codex metrics, and Codex spans, are suppressed by default. Optional Codex hooks are heartbeat-only and refresh `inventory_state.jsonl`; they do not write duplicate runtime prompt or session events.
Use `--include-codex-spans` during install or repair only when you need raw Codex spans for troubleshooting.
@@ -66,7 +66,13 @@ Asymptote detects Codex CLI through the `codex` executable and `~/.codex/config.
`beacon endpoint install` writes Codex OTLP exporter tables to `~/.codex/config.toml`.
-Codex CLI is not currently configured through Asymptote's hook adapter.
+To let Codex sessions trigger inventory heartbeats, install optional Codex hooks after the endpoint is installed:
+
+```bash
+beacon endpoint hooks install --harness codex
+```
+
+The hook installer writes heartbeat-only hooks to `~/.codex/hooks.json` or project `.codex/hooks.json`, depending on `--level`.
## Telemetry coverage
diff --git a/docs/runtimes/index.mdx b/docs/runtimes/index.mdx
index 741aad60..974c3fb1 100644
--- a/docs/runtimes/index.mdx
+++ b/docs/runtimes/index.mdx
@@ -21,7 +21,7 @@ These integrations are grouped by where the agent runs and how telemetry is coll
|----------------|-----------------|--------------------|
| [Antigravity CLI](/runtimes/antigravity-cli) | Native hooks | Prompt, pre-tool, post-tool, stop, invocation, command, and file telemetry where Antigravity exposes hook payloads |
| [Claude Code](/runtimes/claude-code) | Local OTLP export plus optional hooks | Prompt, command, tool, file, lifecycle, subagent, and permission telemetry where emitted through OTLP or hooks |
-| [Codex CLI](/runtimes/codex-cli) | Local OTLP logs | Session, prompt, approval, and tool-result activity from Codex semantic logs |
+| [Codex CLI](/runtimes/codex-cli) | Local OTLP logs plus optional inventory hooks | Session, prompt, approval, and tool-result activity from Codex semantic logs; inventory heartbeat triggers from hooks |
| [Cursor](/runtimes/cursor) | Native hooks | Prompt, tool, shell command, MCP-like, approval, and file edit telemetry |
| [Devin CLI](/runtimes/devin) | Native hooks | Session, prompt, pre-tool, post-tool, permission request, stop, session-end, approval, and file telemetry |
| [Devin Desktop](/runtimes/devin-desktop) | Cascade/Windsurf hooks | Prompt, command, MCP tool, file read, and file write telemetry where Desktop exposes Cascade hook payloads |
diff --git a/docs/security/data-inventory.mdx b/docs/security/data-inventory.mdx
index b56419c8..6bda77b7 100644
--- a/docs/security/data-inventory.mdx
+++ b/docs/security/data-inventory.mdx
@@ -12,7 +12,7 @@ Beacon writes normalized endpoint events only when supported runtimes provide te
| Agent harness | Collection path | Commonly available telemetry |
|---------------|-----------------|------------------------------|
| Claude Code | Local OTLP export | Prompt, command, tool, and file telemetry when emitted through OTLP |
-| Codex CLI | Local OTLP logs | Session, prompt, approval, and tool-result activity from Codex semantic logs |
+| Codex CLI | Local OTLP logs plus optional inventory hooks | Session, prompt, approval, and tool-result activity from Codex semantic logs; inventory heartbeat triggers from hooks |
| Gemini CLI | Opt-in local OTLP | Prompts, tool calls, MCP activity, file operations, and approval-related events emitted through OTLP |
| Grok Build | Native hooks | Session, prompt, pre-tool, post-tool, failed tool, stop, session-end, command, and file telemetry |
| OpenCode | Managed plugin hooks | Chat messages, session events, command execution, permission activity, diffs, and errors |
@@ -37,12 +37,12 @@ By default, inventory is metadata- and hash-only. Beacon hashes config, hook, an
Operators can opt into capturing full definitions with the `--contents` flag (CLI) or the `include_contents` config setting (snapshot telemetry). When enabled, configs, hooks, and skills gain a redacted `content` block and MCP servers gain a full `definition` block. Captured contents always pass through local secret redaction — values under keys matching `TOKEN`, `SECRET`, `PASSWORD`, `KEY`, `AUTH`, or `CREDENTIAL` are replaced with `***REDACTED***` — and a per-file size cap (64 KiB by default, configurable via `max_content_bytes`).
-Inventory heartbeat telemetry uses a separate local JSONL file, `inventory_state.jsonl`, so `runtime.jsonl` stays scoped to agent runtime activity. For Cursor and Claude Code, normal hook execution can periodically write:
+Inventory heartbeat telemetry uses a separate local JSONL file, `inventory_state.jsonl`, so `runtime.jsonl` stays scoped to agent runtime activity. Normal hook execution can periodically write:
- `inventory.heartbeat`, a small event showing that Beacon checked local agent configuration inventory and recording counts plus a snapshot digest.
- `inventory.snapshot`, a snapshot written when the digest changes or inventory is first initialized. Metadata-only unless `include_contents` is enabled.
-By default, snapshots include config-file metadata, MCP server metadata, skill metadata, and hook config metadata. They do not include skill instruction bodies, MCP secret values, full environment values, full command arguments, or unrelated config content. When `include_contents` is enabled, snapshots additionally carry redacted, size-limited `content` and `definition` blocks as described above.
+By default, snapshots include config-file metadata, MCP server metadata, skill metadata, and hook config metadata across supported local runtimes. They do not include skill instruction bodies, MCP secret values, full environment values, full command arguments, or unrelated config content. When `include_contents` is enabled, snapshots additionally carry redacted, size-limited `content` and `definition` blocks as described above.
## Required Fields