Skip to content

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

update inventory

Justin D'Souza0b0903874f4f
diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.go
index dd93c2ea..0171bea9 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory.go
@@ -7,14 +7,21 @@ import (
"fmt"
"os"
"path/filepath"
+ "runtime"
"sort"
"strings"
"time"
"github.com/pelletier/go-toml/v2"
+ "gopkg.in/yaml.v3"
)
const (
+ formatJSON = "json"
+ formatTOML = "toml"
+ formatYAML = "yaml"
+ formatMetadataOnly = "metadata_only"
+
TransportStdio = "stdio"
TransportHTTP = "http"
TransportSSE = "sse"
@@ -138,16 +145,19 @@ func Scan(opts Options) Result {
}
func candidates(home, wd string) []candidate {
- items := []candidate{
- {runtime: "claude_code", path: filepath.Join(home, ".claude", "settings.json"), scope: ScopeUser, format: "json"},
- {runtime: "claude_code", path: filepath.Join(wd, ".claude", "settings.json"), scope: ScopeProject, format: "json"},
- {runtime: "claude_code", path: "/Library/Application Support/ClaudeCode/managed-settings.json", scope: ScopeManaged, format: "json"},
- {runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser, format: "toml"},
- {runtime: "cursor", path: filepath.Join(home, ".cursor", "mcp.json"), scope: ScopeUser, format: "json"},
- {runtime: "cursor", path: filepath.Join(wd, ".cursor", "mcp.json"), scope: ScopeProject, format: "json"},
- {runtime: "cursor", path: filepath.Join(home, ".cursor", "hooks.json"), scope: ScopeUser, format: "json"},
- {runtime: "cursor", path: filepath.Join(wd, ".cursor", "hooks.json"), scope: ScopeProject, format: "json"},
- }
+ items := []candidate{}
+ items = append(items, claudeCandidates(home, wd)...)
+ items = append(items, codexCandidates(home)...)
+ items = append(items, cursorCandidates(home, wd)...)
+ items = append(items, geminiCandidates(home)...)
+ items = append(items, antigravityCandidates(home, wd)...)
+ items = append(items, vscodeCandidates(home, wd)...)
+ items = append(items, factoryCandidates(home, wd)...)
+ items = append(items, copilotCandidates(home)...)
+ items = append(items, opencodeCandidates(home, wd)...)
+ items = append(items, hermesCandidates(home)...)
+ items = append(items, devinCandidates(home, wd)...)
+ items = append(items, grokCandidates(home, wd)...)
seen := map[string]bool{}
out := make([]candidate, 0, len(items))
for _, item := range items {
@@ -161,6 +171,114 @@ func candidates(home, wd string) []candidate {
return out
}
+func claudeCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "claude_code", path: filepath.Join(home, ".claude", "settings.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "claude_code", path: filepath.Join(wd, ".claude", "settings.json"), scope: ScopeProject, format: formatJSON},
+ {runtime: "claude_code", path: "/Library/Application Support/ClaudeCode/managed-settings.json", scope: ScopeManaged, format: formatJSON},
+ }
+}
+
+func codexCandidates(home string) []candidate {
+ return []candidate{{runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser, format: formatTOML}}
+}
+
+func cursorCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "cursor", path: filepath.Join(home, ".cursor", "mcp.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "cursor", path: filepath.Join(wd, ".cursor", "mcp.json"), scope: ScopeProject, format: formatJSON},
+ {runtime: "cursor", path: filepath.Join(home, ".cursor", "hooks.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "cursor", path: filepath.Join(wd, ".cursor", "hooks.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func geminiCandidates(home string) []candidate {
+ return []candidate{{runtime: "gemini_cli", path: filepath.Join(home, ".gemini", "settings.json"), scope: ScopeUser, format: formatJSON}}
+}
+
+func antigravityCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "antigravity_cli", path: filepath.Join(home, ".gemini", "config", "hooks.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "antigravity_cli", path: filepath.Join(wd, ".agents", "hooks.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func vscodeCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "vscode", path: vscodeUserSettingsPath(home), scope: ScopeUser, format: formatJSON},
+ {runtime: "vscode", path: filepath.Join(wd, ".vscode", "settings.json"), scope: ScopeProject, format: formatJSON},
+ {runtime: "vscode", path: filepath.Join(home, ".copilot", "hooks", "beacon.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "vscode", path: filepath.Join(wd, ".github", "hooks", "beacon.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func factoryCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "factory", path: shellProfilePath(home), scope: ScopeUser, format: formatMetadataOnly},
+ {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "factory", path: filepath.Join(wd, ".factory", "settings.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func copilotCandidates(home string) []candidate {
+ return []candidate{{runtime: "copilot_cli", path: shellProfilePath(home), scope: ScopeUser, format: formatMetadataOnly}}
+}
+
+func opencodeCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "opencode", path: filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly},
+ {runtime: "opencode", path: filepath.Join(wd, ".opencode", "plugins", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly},
+ }
+}
+
+func hermesCandidates(home string) []candidate {
+ return []candidate{{runtime: "hermes", path: filepath.Join(home, ".hermes", "config.yaml"), scope: ScopeUser, format: formatYAML}}
+}
+
+func devinCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "devin-cli", path: filepath.Join(home, ".config", "devin", "config.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "devin-cli", path: filepath.Join(wd, ".devin", "hooks.v1.json"), scope: ScopeProject, format: formatJSON},
+ {runtime: "devin-desktop", path: filepath.Join(home, ".codeium", "windsurf", "hooks.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "devin-desktop", path: filepath.Join(wd, ".windsurf", "hooks.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func grokCandidates(home, wd string) []candidate {
+ return []candidate{
+ {runtime: "grok", path: filepath.Join(home, ".grok", "hooks", "beacon-endpoint.json"), scope: ScopeUser, format: formatJSON},
+ {runtime: "grok", path: filepath.Join(wd, ".grok", "hooks", "beacon-endpoint.json"), scope: ScopeProject, format: formatJSON},
+ }
+}
+
+func vscodeUserSettingsPath(home string) string {
+ switch runtime.GOOS {
+ case "linux":
+ base := os.Getenv("XDG_CONFIG_HOME")
+ if base == "" {
+ base = filepath.Join(home, ".config")
+ }
+ return filepath.Join(base, "Code", "User", "settings.json")
+ case "windows":
+ if appData := os.Getenv("APPDATA"); appData != "" {
+ return filepath.Join(appData, "Code", "User", "settings.json")
+ }
+ return filepath.Join(home, "AppData", "Roaming", "Code", "User", "settings.json")
+ }
+ return filepath.Join(home, "Library", "Application Support", "Code", "User", "settings.json")
+}
+
+func shellProfilePath(home string) string {
+ switch filepath.Base(os.Getenv("SHELL")) {
+ case "zsh":
+ return filepath.Join(home, ".zshrc")
+ case "bash":
+ return filepath.Join(home, ".bash_profile")
+ default:
+ return filepath.Join(home, ".profile")
+ }
+}
+
func inspectCandidate(item candidate, redaction string) (Config, []MCPServer) {
config := Config{
Runtime: item.runtime,
@@ -207,18 +325,26 @@ func inspectCandidate(item candidate, redaction string) (Config, []MCPServer) {
func parseMCPServers(item candidate, data []byte, redaction string) ([]MCPServer, error) {
switch item.format {
- case "json":
+ case formatMetadataOnly:
+ return nil, nil
+ case formatJSON:
var root map[string]interface{}
if err := json.Unmarshal(data, &root); err != nil {
return nil, err
}
return serversFromMap(item, root, redaction), nil
- case "toml":
+ case formatTOML:
var root map[string]interface{}
if err := toml.Unmarshal(data, &root); err != nil {
return nil, err
}
return serversFromMap(item, root, redaction), nil
+ case formatYAML:
+ var root map[string]interface{}
+ if err := yaml.Unmarshal(data, &root); err != nil {
+ return nil, err
+ }
+ return serversFromMap(item, root, redaction), nil
default:
return nil, fmt.Errorf("unsupported config format %q", item.format)
}
@@ -425,7 +551,10 @@ func beaconManaged(data []byte) bool {
text := string(data)
return strings.Contains(text, "BEACON_ENDPOINT_MODE=1") ||
strings.Contains(text, "beacon-managed-opencode-plugin:v1") ||
- strings.Contains(text, "OTEL_EXPORTER_OTLP_ENDPOINT") && (strings.Contains(text, "127.0.0.1") || strings.Contains(text, "localhost"))
+ strings.Contains(text, "beacon-managed-grok-hooks:v1") ||
+ strings.Contains(text, "OTEL_EXPORTER_OTLP_ENDPOINT") && (strings.Contains(text, "127.0.0.1") || strings.Contains(text, "localhost")) ||
+ strings.Contains(text, "OTEL_TELEMETRY_ENDPOINT") && (strings.Contains(text, "127.0.0.1") || strings.Contains(text, "localhost")) ||
+ strings.Contains(text, "COPILOT_OTEL_ENABLED") && (strings.Contains(text, "127.0.0.1") || strings.Contains(text, "localhost"))
}
func hashString(value string) string {
diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.go
index 4e1de39a..c42b17af 100644
--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go
+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go
@@ -157,6 +157,100 @@ func TestMissingCandidatesAreReportedAsNotFound(t *testing.T) {
}
}
+func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {
+ home := t.TempDir()
+ work := t.TempDir()
+ t.Setenv("SHELL", "/bin/bash")
+
+ result := Scan(Options{
+ ContentRetention: RedactionRedacted,
+ HomeDir: home,
+ WorkingDir: work,
+ Now: fixedNow,
+ })
+
+ expected := []candidate{
+ {runtime: "claude_code", path: filepath.Join(home, ".claude", "settings.json"), scope: ScopeUser},
+ {runtime: "claude_code", path: filepath.Join(work, ".claude", "settings.json"), scope: ScopeProject},
+ {runtime: "claude_code", path: "/Library/Application Support/ClaudeCode/managed-settings.json", scope: ScopeManaged},
+ {runtime: "codex_cli", path: filepath.Join(home, ".codex", "config.toml"), scope: ScopeUser},
+ {runtime: "cursor", path: filepath.Join(home, ".cursor", "mcp.json"), scope: ScopeUser},
+ {runtime: "cursor", path: filepath.Join(work, ".cursor", "mcp.json"), scope: ScopeProject},
+ {runtime: "cursor", path: filepath.Join(home, ".cursor", "hooks.json"), scope: ScopeUser},
+ {runtime: "cursor", path: filepath.Join(work, ".cursor", "hooks.json"), scope: ScopeProject},
+ {runtime: "gemini_cli", path: filepath.Join(home, ".gemini", "settings.json"), scope: ScopeUser},
+ {runtime: "antigravity_cli", path: filepath.Join(home, ".gemini", "config", "hooks.json"), scope: ScopeUser},
+ {runtime: "antigravity_cli", path: filepath.Join(work, ".agents", "hooks.json"), scope: ScopeProject},
+ {runtime: "vscode", path: vscodeUserSettingsPath(home), scope: ScopeUser},
+ {runtime: "vscode", path: filepath.Join(work, ".vscode", "settings.json"), scope: ScopeProject},
+ {runtime: "vscode", path: filepath.Join(home, ".copilot", "hooks", "beacon.json"), scope: ScopeUser},
+ {runtime: "vscode", path: filepath.Join(work, ".github", "hooks", "beacon.json"), scope: ScopeProject},
+ {runtime: "factory", path: filepath.Join(home, ".bash_profile"), scope: ScopeUser},
+ {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser},
+ {runtime: "factory", path: filepath.Join(work, ".factory", "settings.json"), scope: ScopeProject},
+ {runtime: "copilot_cli", path: filepath.Join(home, ".bash_profile"), scope: ScopeUser},
+ {runtime: "opencode", path: filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), scope: ScopeUser},
+ {runtime: "opencode", path: filepath.Join(work, ".opencode", "plugins", "beacon.ts"), scope: ScopeProject},
+ {runtime: "hermes", path: filepath.Join(home, ".hermes", "config.yaml"), scope: ScopeUser},
+ {runtime: "devin-cli", path: filepath.Join(home, ".config", "devin", "config.json"), scope: ScopeUser},
+ {runtime: "devin-cli", path: filepath.Join(work, ".devin", "hooks.v1.json"), scope: ScopeProject},
+ {runtime: "devin-desktop", path: filepath.Join(home, ".codeium", "windsurf", "hooks.json"), scope: ScopeUser},
+ {runtime: "devin-desktop", path: filepath.Join(work, ".windsurf", "hooks.json"), scope: ScopeProject},
+ {runtime: "grok", path: filepath.Join(home, ".grok", "hooks", "beacon-endpoint.json"), scope: ScopeUser},
+ {runtime: "grok", path: filepath.Join(work, ".grok", "hooks", "beacon-endpoint.json"), scope: ScopeProject},
+ }
+ if got, want := len(result.Configs), len(expected); got != want {
+ t.Fatalf("config candidates = %d, want %d", got, want)
+ }
+ for _, item := range expected {
+ config := findConfig(result.Configs, item.runtime, item.path)
+ if config == nil {
+ t.Fatalf("missing candidate %s %s", item.runtime, item.path)
+ }
+ if config.Scope != item.scope {
+ t.Fatalf("%s %s scope = %s, want %s", item.runtime, item.path, config.Scope, item.scope)
+ }
+ }
+}
+
+func TestScanYAMLAndMetadataOnlyConfigs(t *testing.T) {
+ home := t.TempDir()
+ work := t.TempDir()
+ t.Setenv("SHELL", "/bin/zsh")
+ writeFile(t, filepath.Join(home, ".hermes", "config.yaml"), `
+mcpServers:
+ memory:
+ command: uvx
+ args:
+ - mcp-server-memory
+`)
+ writeFile(t, filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), `// beacon-managed-opencode-plugin:v1`)
+ writeFile(t, filepath.Join(home, ".zshrc"), `export OTEL_TELEMETRY_ENDPOINT=http://127.0.0.1:4318`)
+
+ result := Scan(Options{
+ ContentRetention: RedactionRedacted,
+ HomeDir: home,
+ WorkingDir: work,
+ Now: fixedNow,
+ })
+
+ assertServer(t, result.MCPServers, "hermes", "memory", TransportStdio, true, 1, 0, 0)
+ opencode := findConfig(result.Configs, "opencode", filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"))
+ if opencode == nil {
+ t.Fatal("opencode metadata-only config not found")
+ }
+ if opencode.ParserStatus != StatusOK || !opencode.BeaconManaged {
+ t.Fatalf("opencode status = %s managed=%t, want ok/managed", opencode.ParserStatus, opencode.BeaconManaged)
+ }
+ factoryProfile := findConfig(result.Configs, "factory", filepath.Join(home, ".zshrc"))
+ if factoryProfile == nil {
+ t.Fatal("factory shell profile config not found")
+ }
+ if factoryProfile.ParserStatus != StatusOK || !factoryProfile.BeaconManaged {
+ t.Fatalf("factory profile status = %s managed=%t, want ok/managed", factoryProfile.ParserStatus, factoryProfile.BeaconManaged)
+ }
+}
+
func fixedNow() time.Time {
return time.Date(2026, 6, 5, 7, 0, 0, 0, time.UTC)
}
@@ -198,3 +292,13 @@ func assertServer(t *testing.T, servers []MCPServer, runtime, name, transport st
}
t.Fatalf("server %s/%s not found in %#v", runtime, name, servers)
}
+
+func findConfig(configs []Config, runtime, path string) *Config {
+ pathHash := hashString(path)
+ for i := range configs {
+ if configs[i].Runtime == runtime && configs[i].PathHash == pathHash {
+ return &configs[i]
+ }
+ }
+ return nil
+}